Kevin's suggestion is the best way to do this as it involves no predicates.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Wilbur Lang > Sent: Wednesday, February 16, 2011 9:14 AM > To: [email protected] > Subject: Re: [antlr-interest] MissingTokenException > > 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 > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address 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.
