[antlr-interest] Match All Tokens Except
Zachary Palmer
zep_antlr at bahj.com
Fri Jun 4 07:17:05 PDT 2010
I need way to match every token coming in from the lexer except one or
two in particular. This situation is a bit unusual, but it has to do
with the fact that certain parsing decisions in this language cannot be
made until semantic analysis of other parts of the code is complete;
that is, how I choose to parse the code may vary depending upon other
information I gather later. In order to separate these steps cleanly, I
simply want to parse the as-of-yet ambiguous section as a sequence of
tokens. (The parse is ambiguous but the lex is not.)
So here's a representative example:
program: programElement* EOF;
programElement: normal | special;
normal: 'a'..'z';
special: '<:'
(
special |
???
)
':>';
In the place of the ??? above, I would like to express to ANTLR that it
should accept ANY token which is not '<:' or ':>'. Any suggestions?
Thanks!
- Zach
More information about the antlr-interest
mailing list