[antlr-interest] Not consuming the next token

David Smith david.smith at cc.gatech.edu
Tue Aug 16 08:49:20 PDT 2011


Sorry to bother you again. Another question indicating a complete 
lack of understanding of the basic Antlr mechanism. Matlab over-uses 
the token END and I am trying to distinguish two uses based on the 
token that follows END.  If it is followed by COMMA, COLON, CLOSEP or 
SEMI, it is used in an indexing context.  Otherwise, it's the normal 
usage.  So this rule:

endIndex: END (COMMA | COLON | CLOSEP | SEMI) => END;

seems to work except that it consumes the following token.  How do I 
express this rule in such a way that the following token is not consumed?

DMS

David M. Smith http://www.cc.gatech.edu/fac/David.Smith
Georgia Institute of Technology, College of Computing
Sent from my ASR-33 Teletype 



More information about the antlr-interest mailing list