[antlr-interest] Re: Purpose of Parser.setFilename()

jsrs701 jsrs701 at yahoo.com
Fri Jun 7 12:17:57 PDT 2002

--- In antlr-interest at y..., "Spenser Kao" <spenserkao at o...> wrote:
> Does anyone know the purpose of Parser's method setFilename()? Which
> file will be set? The input stream?
> Parser's javadoc provides not much info.

My understanding of that method is that it just supports the output 
of "helpful" errors.

If you implemented the C preprocessor (for an example that's awfully 
popular around here :-) you would end up reading and parsing multiple 
files from one source file, right?  As in #include <stdio.h>.  Well, 
when you open up stdio.h and start parsing it, you do a 
   setFilename( "stdio.h" )
and then, if there are any errors, you can accurately tell the user 
where the error occurred.

Same with the line number support.  ANTLR doesn't care in the least 
what line number you're on--but the users of your 
processor/interpreter/compiler do!  :-)



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

More information about the antlr-interest mailing list