[antlr-interest] Alternative Lexer rule in grammar file

Matej Mailing mailing at tam.si
Sun Jul 1 04:06:44 PDT 2012


I was able to solve the previous issue, but as for every n00b, another
issue has shown up: I have a lexer rule in the grammar file like:
ID : ('a'..'z'|'A'..'Z'|'_') { System.out.println($text + " is here."); };

and I would like to get an alternative output for every other text
that is not matched by ID and get the output like $text + "is not

What is the best way to achieve that? A subquestion: I was unable to
find any documentation source where names of output attributes like
$text, $line, $pos would be listed - I would be very happy to have it
as well. :-)


More information about the antlr-interest mailing list