White spaces ignored after keywords #967
Replies: 1 comment 3 replies
-
I have the same problem. Naively I thought I could do this:
But of course that doesn't work, because Ignore tokensThe keywords now also take up space in the token stream, even though I don't care about them (the keyword is mostly implied from the rule that was matched). This seems to be unsolvable, since in order to both force at least one whitespace AND the token to not appear I need a rule that is both atomic (to suppress the behavior of Forcing a whitespace separatorIt seems unnecessarily hard to force at least a single whitespace separator. It seems like the Pest parser should give us more control here?
Requiring a whitespace separator seems like it should be simple, but it's borderline impossible (without resorting to dropping the implicit |
Beta Was this translation helpful? Give feedback.
-
I have a simple grammar with few keywords:
It works nicely but ignores whitespaces AFTER keywords, so it's able to parse also things like
FINDfoo inbar;
The only way I found to prevent this behavior is to change the keyword definitions into
but it doesn't sound right to me. Also, the parsed rule for keywords now contains trailing spaces.
What am I missing here?
Beta Was this translation helpful? Give feedback.
All reactions