I wrote a stub for a grammar (only matches comments so far), and it’s giving me the error:
syntax error: invalid char literal: <INVALID>
Moreover, I’ve tracked down the error to being in the following command:
... ~LINE_ENDING* ...
LINE_ENDING : ( '\n' | '\r' | '\r\n');
Can someone help me fix this?
The
~operator can only be applied to a set. In a lexer, the elements of a set are characters of an input stream. In other words, you can have this:But you can’t have this because it’s a sequence (of two characters) instead of a set.
The problem you encountered is an extension of this second case.