[antlr-interest] non-existed char met

John B. Brodie jbb at acm.org
Mon Jun 5 08:42:10 PDT 2006


>DenotOrFunnyID: (('+'|'-') {$setType(FunnyID);})? NUM{$setType(IntDenot);} ( '.' NUM ( 'E' 
..................................................^^^^^ // NUM not optional!
>('+'|'-')?    NUM)? {$setType(RealDenot);})?;

So any '+' or '-' MUST be followed by a NUM.

Your input of just a single '-' is therefore illegal under this rule.

I think the pop up was trying to tell you that it found an EOF when it
was expecting a Digit... 

Note that if you make the NUM above optional, then you would have a
lexer rule that could match the empty input and that would be a Bad
Thing.

Hope this helps...
   -jbb


More information about the antlr-interest mailing list