Lexical State ?
- While I am at it- could any refer me to a good reference on how to
use Lexical States in ANTLR. I am trying to define rules such as
anything_but_semi to help parse a semi-delimited list. I have no way
of knowing what exists between the delimiters in advance. When I
tried various approaches it seemed that ANTLR would match a specific
token, for example, ALPHANUMERIC_TEXT when I really wanted to
consume until I hit a semi.
The only way I could get it to work is by listing all of the possible
tokens (e.g. ALPHA | CHAR | NUMERIC | PERIOD, ... ) that I have
defined in the lexer EXCEPT the one that I am 'keying on' in a parser
rule. It seems to be very repetitive. I tried ANYTHING_BUT_SEMI in
the lexer but it didn't seem to work for the above reason.
Thanks in advance for any comments.