[antlr-interest] syntax predicate strange behavior

Ilia Kantor ilia at obnovlenie.ru
Mon Apr 30 15:03:37 PDT 2007


Hello, I have a rule


command_user_body:	
	 (LCURL) => LCURL command_arguments? RCURL -> ^(USER_COMMAND command_arguments?) |		 			
	 -> USER_COMMAND
;

On input LCURL WS WORD WS MINUS GT...
this gives me exception from DFA.noViableAlt at first WORD token.

How can that happen ?

I guess, it should match LCURL and go first alternative and match it happily no ?


By the way, this works fine:

command_user_body
options {backtrack=true;}:	
	LCURL command_arguments? RCURL -> ^(USER_COMMAND command_arguments?) |		 			
	 -> USER_COMMAND
;



Best wishes
Ilia


More information about the antlr-interest mailing list