[antlr-interest] Decision can match input such as ...using multiple alternatives: 1, 2

jabon elekis at gmail.com
Thu Apr 24 21:40:23 PDT 2008


hi,
the problem is there:

there is the real grammar:


singlePragma: t1=T_Ident{callback.IdentFromSinglePragma($t1.text);}
            (  T_LParent {callback.BeginLiteralOrDesignFromSinglePragma();}
                  
(t2=literal{callback.FirstLiteralFromSinglePragma($t2.text);}
                  |desig)
                  (T_Comma 
(t3=literal{callback.NextLiteralFromSinglePragma($t3.text);}
                  |desig)
              T_RParent{callback.EndLiteralOrDesignFromSinglePragma();}
            )? T_SemiColon;



desig    :  desigElement (T_Comma desigElement)*;   


desigElement
    : ;

and design element will looks like that  but not yet implémented
DesigElement ::= Ident <http://www.raincode.com/rcdoc/yaflrc/Ident.htm> 
[ *'('* { ActualParameter 
<http://www.raincode.com/rcdoc/yaflrc/ActualParameter.htm> } + by *','* 
*')'* ] { Subscript <http://www.raincode.com/rcdoc/yaflrc/Subscript.htm> } *

thanks

A+++


Gavin Lambert a écrit :
> At 06:51 25/04/2008, elekis wrote:
> >singlePragma: t1=T_Ident
> >            (  T_LParent     ( literal | desigElement (T_Comma 
> desigElement)*)
> >                  (T_Comma ( literal | desigElement (T_Comma 
> desigElement)*))
> >              T_RParent )? T_SemiColon;
> >
> >I have the followed warning
> >
> >warning(200): Pyaflplug.g:35:42: Decision can match input such as
> >"T_Comma T_Comma" using multiple alternatives: 1, 2
> >As a result, alternative(s) 2 were disabled for that input
>
> At a guess, 'desigElement' contains a T_Comma, so ANTLR is warning you 
> that it's ambiguous with its surroundings.  It's hard to say for sure 
> without seeing more of the grammar.
>
> (And you've got a common subexpression there; you probably ought to 
> factor it out.)
>



More information about the antlr-interest mailing list