[antlr-interest] How can I decide at runtime if a rule contains an optional token

Gabriel Petrovay gabriel.petrovay at 28msec.com
Sat Apr 25 15:03:43 PDT 2009


Hi,

Here is the solution that I found and that it works:

rule : T1 extraRule T3 ...
extraRule
  : { isT2Alowed }?=> T2?
  | { isSomethingElse }?=> T4?
  | /* nothing */
  ;

Regards,
Gabriel



-- 
MSc Gabriel Petrovay
MCSA, MCDBA, MCAD
Mobile: +41(0)787978034


More information about the antlr-interest mailing list