[antlr-interest] Strange parse result
Micha
micha-1 at fantasymail.de
Mon Jan 17 02:25:15 PST 2011
Am 16.01.2011 22:23, schrieb Mark Christiaens:
> I simplified my test case further. The grammar is now:
>
> grammar test_grammar;
>
> start : t*;
> t: ASSIGN | NUM ;
> ASSIGN : ':=';
> //NUM : '0';
> NUM : '0' ':0'?;
>
> I would expect this to be able to match the input
>
> 0:=0
>
> but it doesn't. Changing the definition of NUM to the commented version and
> the grammar does match the input.
some lookahead may help:
ASSIGN: (':=')=> ':=' ;
NUM: '0' ( (':0')=>':0' )?;
Michael
More information about the antlr-interest
mailing list