[antlr-interest] Multiple alternatives warning

Pavel Grinfeld pg at freeboundaries.com
Tue Jun 22 08:08:06 PDT 2010


Hi,

I'm begging to get my bearings on this.... But the following gives two 
"multiple alternatives" warnings.

How come?

Many thanks in advance,

Pavel

grammar PGTeX;

doc
:     
(a=text{System.out.print(">"+$a.value+"<");}|b=command{System.out.print($b.value);})+ 
EOF;

command returns [ String value ]
:'\\' a=word '\{' b=word '\}' {$value=$a.value+"+"+$b.value;};

text    returns[String value]
:{$value="";}(a=word{$value += $a.value;} | WS{$value += $WS.text;} )+;

word    returns[String value]
:WORD  {$value = $WORD.text;}  ;

WS  :   ( ' '
         | '\t'
         | '\r'
         | '\n'
         )+;


WORD:    ('a'..'z')+;


More information about the antlr-interest mailing list