[antlr-interest] Reading from Files vs Strings

Terence Parr parrt at cs.usfca.edu
Tue May 1 14:18:08 PDT 2007


On May 1, 2007, at 11:18 AM, Marc-André Laverdière wrote:

> Hello,
>
> I have an interesting bug.
>
> I have a file to parse. Since I'm working on an IDE, I load it in  
> memory as a String and I pass it to ANTLR to parse using:
> ANTLRReaderStream input = new ANTLRReaderStream(new StringReader 
> (dataToCompile));
>
> And I'm getting a bunch of errors.
> However, if I'm telling ANTLR to parse it as a file, using
> ANTLRStringStream input= new ANTLRInputStream(new FileInputStream 
> (fileName));
> then things do parse well.
>
> What am I doing wrong here?

What error ddo you get?  Are you following the examples in the book  
or elsewhere?
Ter



More information about the antlr-interest mailing list