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

Fix reported range when an optional parser is lifted to an AST parser #48

Merged
merged 1 commit into from Oct 31, 2021

Conversation

Thomvis
Copy link
Contributor

@Thomvis Thomvis commented Oct 26, 2021

The range added to the SyntaxTree for an optional parser that is skipped, is reported as 0..0, as per this logic. This will affect the reported range of parent parsers as well, e.g. if the optional parser is the first in an "and combinator", the reported range of the "and combinator" as a whole will start at 0. This PR changes the fallback behavior to an empty range starting at the current token's offset. I think it can be debated if this is fully correct, but I like it because it's pragmatic.

Thanks for considering this PR. Let me know if you have any comments or things I should improve!

@h0tk3y
Copy link
Owner

h0tk3y commented Oct 31, 2021

Thanks a lot @Thomvis!

@h0tk3y h0tk3y merged commit 1f6c975 into h0tk3y:master Oct 31, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants