[antlr-interest] Help me please to improve lexer

mzukowski at yci.com mzukowski at yci.com
Thu Dec 5 08:12:24 PST 2002


You could override the match() rule, that gets called on everything, but you
would have to figure out in there whether you were doing WS or not.  Look at
your generated code to see what I mean.

Monty

-----Original Message-----
From: alekseyandreev [mailto:andreev at quorum.ru]
Sent: Thursday, December 05, 2002 1:30 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Help me please to improve lexer


My lexer grammar looks like this:

START options { ignore WS; } 
   : "aaa"{do();} "bbb"{do();} "ccc"{do();}
   | "ddd"{do();} "eee"{do();}
   | "fff"{do();}  XXX {do();}
   |  YYY {do();}
   ;
XXX options { ignore WS; } 
   : "iii"{do();} "jjj"{do();}
   | "kkk"{do();}
   ;
YYY options { ignore WS; } 
   : "lll"{do();} "mmm"{do();}
   | "nnn"{do();}
   ;

Is there any opportunity to remove actions {do();}
after every element and have analogue behavior?

Aleksey


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list