[antlr-interest] Re: Is it possible to treat a non-literal like a literal?

weitzman_d weitzman_d at yahoo.com
Sun Sep 29 09:57:01 PDT 2002


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/ 



More information about the antlr-interest mailing list