[antlr-interest] Taking control of the input stream

Ric Klaren klaren at cs.utwente.nl
Wed Sep 18 02:11:46 PDT 2002


Hi,

On Tue, Sep 17, 2002 at 09:23:41PM -0000, weitzman_d wrote:
> C: A003 APPEND saved-messages (\Seen) "Date: Mon, ..."
>
> But servers must also be able to accept in the 'literal' form like
> this:
>
> C: A003 APPEND saved-messages (\Seen) {310}
> S: + continue
> C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
> C: ...
> C: (310 bytes later...)
> S: A003 OK APPEND completed
>
> I want my ANTLR grammer to see the {NUM} and eat up the next NUM
> bytes into a single token.  A general outline of the rule would look
> something like this:
>
> literal	:	"{" len:NUMBER "}" CRLF
> 	{
> 	int length = Integer.parseInt(len.getText());
>         out.println("+ continue");
> 	String value = [read the next 'length' bytes]
> 	}
> 	;
>
> How can I do this (or is it not possible)?

Where you want to do this lexer or parser? It's been ages past since I've
been hacking on something IMAP-ish so not sure what would be the most
practical.

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     Innovation makes enemies of all those who prospered under the old
   regime, and only lukewarm support is forthcoming from those who would
               prosper under the new. --- Niccolò Machiavelli


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list