[antlr-interest] MissingTokenException

Wilbur Lang zigzed at ovi.com
Wed Feb 16 09:13:45 PST 2011


On 2011/2/16 23:54, Kevin J. Cummings wrote:
> On 02/16/2011 10:38 AM, Wilbur Lang wrote:
>> moduleId
>>       :    TYPEREFERENCE
>>       ;
>>
>> I'd do the following:
>>
>> fragment TYPEREFERENCE : ;
>>
>> CAPITALREFERENCE
>>      : UPPER (UPPER | DIGIT | LOWER { $type=TYPEREFERENCE; })*
>>       (HYPHEN (UPPER | DIGIT | LOWER { $type=TYPEREFERENCE; })+ )*
>>      ;
>>
>> That way you'll only change the token type to TYPEREFERENCE if 1 or more
>> LOWER characters are found....
Thanks Kevin.

I rechecked the grammar, it not a context-free one, and it's impossible 
to disambiguate 'T3' is a CAPTIALREFERENCE or TYPEREFERENCE. Maybe I 
should check the 'semantic predicated'.

Wilbur Lang

--------------------------------------------------------------
Ovi Mail: Making email access easy
http://mail.ovi.com



More information about the antlr-interest mailing list