I am working on a grammar that allows for keywords as identifiers, and the current suggestion seems to be to do something like:
id : 'if'|'call'|'then'|ID;
My language has a lot of keywords, so I've been doing:
id: ~(PLUS | MINUS);
Basically any token that's NOT a non-keyword token.
Is there a way to have all of my keyword tokens be prepended with some string and wildcard match that? e.g.
K_PLUS: '+';
K_MINUS: '-';
ID: <everything else>;
id : ID | ~(K_*);