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!
The range added to the
SyntaxTree
for an optional parser that is skipped, is reported as0..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 at0
. 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!