[antlr-interest] Not consuming lexer tokens

Uwe Lammers Uwe.Lammers at sciops.esa.int
Tue Aug 26 05:29:46 PDT 2008


Hi,

I have recently discovered antlr ... what a wonderful tool!

Newbie question (did not find it addressed in the Wiki FAQ though):
I have been working with flex/bison in the past and want to convert an
existing grammar to antlr. Have managed ok so far but can't see how to 
do the
following: In flex, a symbol can be marked as belonging to a token but it
is actually not consumed by the lexer, e.g.

Lexer rule
abc/(        { return AFUNC; }

Parser rule
arith:
AFUNC '(' arith ')'    { ... }

So, an input like 'abc(...)' is matched by the parser rule arith because
the first opening parenthesis was not consumed by the lexer - the preceding
'/' does this.

Is there an equivalent construct in antlr?

thanks for any answer
Uwe



 

================================================================================================
This message and any attachments are intended for the use of the addressee or addressees only. The
unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its content
is prohibited. If you received this message in error, please delete it from your system and notify
the sender. E-mails can be altered and their integrity cannot be guaranteed. ESA shall not be liable
for any e-mail if modified.
=================================================================================================



More information about the antlr-interest mailing list