[antlr-interest] how to write a rule that eats everything until a specific KEYWORD?

Gavin Lambert antlr at mirality.co.nz
Mon Mar 16 12:37:15 PDT 2009


At 08:25 17/03/2009, Reynold Xin wrote:
 >I am writing a shallow SQL select parser that should parse
 >
 >SELECT (eats everything until keyword LINK or semicolon) LINK 
...
 >
 >I have been reading the wiki and the Definitive ANTLR Reference
 >but still haven't got any clue how to do this. Can anyone shed 
some
 >light?

rule
   : SELECT (~(LINK | SEMI))* (LINK ...)? SEMI
   ;



More information about the antlr-interest mailing list