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


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