Loading ...
Sorry, an error occurred while loading the content.
 

Purpose of Parser.setFilename()

Expand Messages
  • Spenser Kao
    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. Regards,
    Message 1 of 2 , Jun 7, 2002

      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.

       

      Regards,

       

      Spenser

    • jsrs701
      ... 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
      Message 2 of 2 , Jun 7, 2002
        --- In antlr-interest@y..., "Spenser Kao" <spenserkao@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! :-)

        JSRS
      Your message has been successfully submitted and would be delivered to recipients shortly.