While this is convenient when skipping whitespace (which is generally only done in Init), it's a special case that we need to keep in mind when using rules without a RHS.
This PR removes this special case. A rule without a RHS now always resets the current match.
This is breaking change. A rule without a RHS in a non-Init rule set now needs to explicitly call continue to work as before. Example:
// Old code, this used to NOT reset the current match, but it now
// resets the current match
rule MyRule {
$$whitespace,
...
}
// New version that works as before:
rule MyRule {
$$whitespace => |lexer| lexer.continue_(),
}
Currently a rule without a RHS (e.g.
$$whitespace,
) resets the current match in theInit
rule set, but it does not reset it in other rule sets.For example, the lexer below
would work as if it's desugared to:
While this is convenient when skipping whitespace (which is generally only done in
Init
), it's a special case that we need to keep in mind when using rules without a RHS.This PR removes this special case. A rule without a RHS now always resets the current match.
Desugared to:
Regardless of the rule set.
This is breaking change. A rule without a RHS in a non-Init rule set now needs to explicitly call
continue
to work as before. Example:Fixes #12