Purpose of Parser.setFilename()
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.
- --- In antlr-interest@y..., "Spenser Kao" <spenserkao@o...> wrote:
> Does anyone know the purpose of Parser's method setFilename()? WhichMy understanding of that method is that it just supports the output
> file will be set? The input stream?
> Parser's javadoc provides not much info.
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! :-)