I want to use (
as a token name in a ANTLR lexer file. I've tried several versions, but none of them seem to work and cause errors when building. Here are my (broken) attempts:
(1) (: '(';
(2) '(': '(';
(3) '\(': '(';
(4) \(: '(';
Is this possible and, if so, how would I do that?
That is not possible. A rule name must start with an underscore or letter, and is followed by zero or more underscores, letters or digits. So '('
, or whatever variation of it, is not a valid rule name.