[antlr-interest] MissingTokenException

Jim Idle jimi at temporal-wave.com
Wed Feb 16 09:19:27 PST 2011


Kevin's suggestion is the best way to do this as it involves no
predicates.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Wilbur Lang
> Sent: Wednesday, February 16, 2011 9:14 AM
> To: antlr-interest at antlr.org
> 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


More information about the antlr-interest mailing list