Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get a position of a token from ParseErrorContext #162

Open
artempyanykh opened this issue Feb 13, 2022 · 1 comment
Open

How to get a position of a token from ParseErrorContext #162

artempyanykh opened this issue Feb 13, 2022 · 1 comment

Comments

@artempyanykh
Copy link

I'm trying to implement error recovery with fslexyacc. I've defined parse_error_rich function. The argument to the function is ctx: ParseErrorContext<GeneratedParser.token>*.

I see that ctx.ParseState has some positional information, but ParseState.ResultRange gives some weird positions not really related to my input, and the rest of the methods requires an int argument, however it's not really clear what sort of argument I should supply or where to get it.

I'm a bit stuck at this point, and would really appreciate an advice!

Version of FsLexYacc: 11.0.0-beta1

*) Actually, getting access to the generated token type inside parse_error_rich is not possible because of the order of type definitions, but that's a different issue.

@robreno
Copy link

robreno commented Oct 26, 2022

I'm trying to implement error recovery with fslexyacc. I've defined parse_error_rich function. The argument to the function is ctx: ParseErrorContext<GeneratedParser.token>*.

I see that ctx.ParseState has some positional information, but ParseState.ResultRange gives some weird positions not really related to my input, and the rest of the methods requires an int argument, however it's not really clear what sort of argument I should supply or where to get it.

I'm a bit stuck at this point, and would really appreciate an advice!

Version of FsLexYacc: 11.0.0-beta1

*) Actually, getting access to the generated token type inside parse_error_rich is not possible because of the order of type definitions, but that's a different issue.

This is an issue I ran into recently. I am trying to figure out how to get better error information from ParseState too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants