First grammar:
> VALUE:
>    (LETTER | DIGIT)+
>    ;

Second Grammar:
> VALUE:
>    (LETTER | DIGIT) '!'+
>    ;
> action MYVAL!   (MismatchedTokenException: line 3:7 mismatched input 'MYVAL'

You've got the rule in + in the wrong place.  I'm pretty sure you meant:

VALUE:
   (LETTER | DIGIT)+ '!'
;

It is blowing up at the 'Y', because it can have one letter or one
digit, and at least '!'.  You've given it 5 letters then one '!'.

While you can make this work, it would likely be easier to make the
difference between those to easier to disambiguate.  However, if you
think this is the correct approach read the FAQ about floats vs.
ranges:
http://www.antlr.org/wiki/display/ANTLR3/Lexer+grammar+for+floating+point,+dot,+range,+time+specs

That's got the example of all of the power tools for how to man handle
ambiguous tokens types.

Kirby

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to