[antlr-interest] Re: Is it possible to treat a non-literal li
ke a literal?
mzukowski at yci.com
mzukowski at yci.com
Mon Sep 30 07:50:49 PDT 2002
That is a sensible solution to your problem. You are lucky that you can
handle it in your lexer.
Monty
> -----Original Message-----
> From: weitzman_d [mailto:weitzman_d at yahoo.com]
> Sent: Sunday, September 29, 2002 9:57 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Re: Is it possible to treat a
> non-literal like
> a literal?
>
>
> I seem to have found an acceptable solution by overriding
> testLiteralsTable(int). The lexer is now always either expecting a
> command or not expecting one, and the state changes when it comes
> across commands and CRLF. The overriden version calls the superclass
> version only if it is expecting a command.
>
> David Weitzman
>
> --- In antlr-interest at y..., "weitzman_d" <weitzman_d at y...> wrote:
> > I'm still working on that IMAP nonsense.
> >
> > Basically my problem is parsing something like this:
> >
> > 001 UID FETCH 1:* (BLAH UID BLAH)
> >
> > The first appearnces of 'UID' is a command, the second is a
> string.
> > The way I've been doing things so far, 'UID' is a literal (as are
> all
> > commands). It looks like I need to do something else, because I
> want
> > any appearence of a command name after the actual command name to
> be
> > treated as a string.
> >
> > I suppose I could replace every reference to UID and other commands
> > in the
> > parser with some sort of ugly lookahead that verifies the text
> > says 'UID' and than parse it as a string instead of a literal (the
> > command names
> > just get discarded anyway).
> >
> > That sounds pretty ugly, though. Is there another way?
> >
> > Thanks.
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list