[antlr-interest] Re: Passing OutputStream to Lexer

spenserkao spenserkao at optushome.com.au
Fri Jun 7 10:37:27 PDT 2002


Empirically, I think I've found the alternative for the same goal.
In the Lexer part of the grammar, create a method something like
Public String getOutputMsg() { 
 } to return the outgoing message, 
then in the main program, where Parser and Lexer will be 
instantiated, call the public method to pass the outgoing message to 
PrintWriter.println().

I am answering my own question here:o)

Regards, Spenser
--- In antlr-interest at y..., "Spenser Kao" <spenserkao at o...> wrote:
> Question on Java version antlr 2.7.1: 
> Is there any to pass OutputStream to Lexer constructor?
>  
> I can pass an InputStream instance to the Lexer constructor; can I 
do
> the same with OutputStream? 
> So far I can only redirect the o/p message to a file on the command
> line, but passing an OutputStream onto Lexer on the fly will be 
more
> flexible and it seems none of current Lexer constructors allows me 
to do
> that.
>  
> Any clue will be much appreciated! 
>  
> Regards, 
>  
> Spenser


 

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



More information about the antlr-interest mailing list