[antlr-interest] MissingTokenException
Wilbur Lang
zigzed at ovi.com
Wed Feb 16 07:38:48 PST 2011
Hi,
I'm working on ANTLR to create a parser but failed with
MissingTokenException. Following is the grammar:
grammar test1;
moduleId
: TYPEREFERENCE
;
WS : ( ' '| '\t'| '\r'| '\n') {$channel=HIDDEN;}
;
fragment UPPER : ('A'..'Z') ;
fragment LOWER : ('a'..'z') ;
fragment DIGIT : ('0'..'9') ;
HYPHEN : '-' ;
CAPITALREFERENCE
: UPPER (UPPER|DIGIT)* (HYPHEN (UPPER|DIGIT)+)*
;
TYPEREFERENCE
: UPPER (UPPER|LOWER|DIGIT)* (HYPHEN (UPPER|LOWER|DIGIT)+)*
;
When I input sentence 'T3', ANTLR failed with 'MissingTokenException'.
When I comment 'CAPITALREFERENCE', ANTLR worked. How can I correct the
grammar?
Please note, I need 'CAPITALREFERENCE' to distinguish such as 'Tabc-01'
and 'TABC-01'.
Thanks.
Wilbur Lang
--------------------------------------------------------------
Ovi Mail: Making email access easy
http://mail.ovi.com
More information about the antlr-interest
mailing list