Closed glennschmidt closed 1 year ago
Thanks for reporting. This is an existing bug, previously reported as #12. In short, a rule without a right-hand side ($$ascii_whitespace,
in your examples) only resets the current match in Init
rule set. In the other rule sets it doesn't reset the match. This is working as intended (usually the initial rule set handles whitespace, other rule sets handle strings, comments etc.), but the intended behavior is confusing and we should fix it.
In https://github.com/osa1/lexgen/issues/12#issuecomment-940707685 I describe two ways to fix this problem. If you provide feedback that would be helpful.
Closing this one as duplicate.
In the following example, there's a pattern in the
Secondary
rule intended to skip whitespace. But the whitespace ends up part of the following match.Expected result: Test passes
Actual result:
Note: This only happens in a non-initial rule. If I redefine the lexer as follows, the test will pass:
Am I misunderstanding something or is this a bug?