[antlr-interest] pushed antlr build with tree rewriting and composite grammars (java)

Terence Parr parrt at cs.usfca.edu
Sun Jan 13 15:13:56 PST 2008


Yep, antlr is not ignoring "what follows" for loops on ends of rules  
anymore I guess. strange.
Ter
On Jan 13, 2008, at 12:19 PM, David Holroyd wrote:

> On Sun, Jan 13, 2008 at 01:49:35AM +0000, David Holroyd wrote:
>> e.g., here's the definition of 'identifier',
>>
>>  identifier
>>    :   (   qualifiedIdent -> qualifiedIdent
>>        )
>>        (   options{greedy=true;}
>>        :   poi=propOrIdent[root_0, retval.start] -> $poi
>>        )*
>>        -> ^(IDENTIFIER $identifier)
>>    ;
>>
>> With the input snippet "testpkg" I invoke the generated identifier()
>> method directly, and I see
>>
>>  NoViableAltException(-1!=[()* loopback of 676:3: ( options  
>> {greedy=true;} : poi= propOrIdent[root_0, retval.start] -> $poi)*])
>
> If I explicitly add an optional EOF to the rule, all is well again,
>
>
>  identifier
>    :   (   qualifiedIdent -> qualifiedIdent
>        )
>        (   options{greedy=true;}
>        :   poi=propOrIdent[root_0, retval.start] -> $poi
>        )*
>        EOF?
>        -> ^(IDENTIFIER $identifier)
>        ;
>
>
> -- 
> http://david.holroyd.me.uk/



More information about the antlr-interest mailing list