[antlr-interest] syntax predicate strange behavior
    Ilia Kantor 
    ilia at obnovlenie.ru
       
    Tue May  1 01:39:12 PDT 2007
    
    
  
Yeah, Gavin, actually, your variant is same and causes same problems.
It should be corrected with predicate to compile:
( (LCURL) => LCURL command_arguments? RCURL)? -> ^(USER_COMMAND command_arguments?);
> At 19:53 1/05/2007, David Holroyd wrote:
>  >> By the way, this works fine:
>  >>
>  >> command_user_body
>  >> options {backtrack=true;}:	
>  >> 	LCURL command_arguments? RCURL -> ^(USER_COMMAND
>  >command_arguments?) |					
>  >> 	-> USER_COMMAND
>  >> ;
>  >
>  >With backtracking (which I admit I don't wholly understand yet) 
> I
>  >guess if it fails on the first alt, it will back-off to the 
> second,
>  >empty alternative?
> 
> Speaking of which, since (I think) USER_COMMAND and 
> ^(USER_COMMAND) are equivalent, wouldn't the above be identical to 
> this (ignoring the backtracking for the moment):
> 
> command_user_body:
>    (LCURL command_arguments? RCURL)? -> ^(USER_COMMAND 
> command_arguments?);
> 
> (I could be wrong.)
> 
> 
    
    
More information about the antlr-interest
mailing list