[antlr-interest] [V3] Null Pointer Exception on bad input containing optional options

Terence Parr parrt at cs.usfca.edu
Wed Aug 9 12:55:01 PDT 2006


On Aug 9, 2006, at 12:47 PM, John B. Brodie wrote:

> Greetings!
>
> the following grammar gets a null pointer exception (rather than a
> nice error message about its ambiguity):
>
>
> grammar t;
> foo : JUNK* EOF ;
> JUNK : 'foo' ( 'bar'? 'baz'? )? ;
>
>
>
> did not see anything similar on the wiki's bug list.
>
> is this the best place to report these things?

yep :)

> if it matters, i am using:
> ANTLR Parser Generator   Early Access Version 3.0b3 (July 21,  
> 2006)  1989-2006

Thanks...i fixed this yesterday.  now I get:

ANTLR Parser Generator   Early Access Version 3.0b4 (??, 2006)   
1989-2006
duh.g:5:14: Decision can match input such as "<EOT>" using multiple  
alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
duh.g:5:14: The following alternatives are unreachable: 2

which is the correct message.

Ter


More information about the antlr-interest mailing list