[antlr-interest] Why is that part needed?

Matthias Gutheil matthias.gutheil at informatik.uni-mannheim.de
Sun Feb 11 05:54:54 PST 2007


Hello,

in my expr rule, I need that (IDENT COLON) part, otherwise my parser 
doesn't behave like a want.
I tested it with a System.out, but the (IDENT COLON) part is not in one 
of my examples.

At the end of the mql rule I test if there comes a next token and store 
the position, so I can find the beginning position of the rest.

Everything works fine, but why only with that (IDENT COLON) part?

Matthias

expr :    
   (mql | (IDENT COLON)) rest?    
    EOF
;


IDENT        
   :  
           ('a'..'z'|'A'..'Z'|'_'|'0'..'9'| STAR | DOLLAR | (LBRACK 
RBRACK))+      
  ;

rest     :
    (.)*
 ;


More information about the antlr-interest mailing list