Search code examples
intellij-ideagrammar-kit

Negative lookaheads in Grammar-Kit


Is there a way to do a negative lookahead in Grammar-kit?

Example: I have two tokens defined A and B and would like the define the a rule that matches A if it is not followed by B.

I tried to find it in this grammar, but I am not able to read it.


Solution

  • Grammar-Kit is based on PEG (Parsing Expression Grammars).

    • Positive lookahead: &XXX
    • Negative lookahead: !XXX