Interface Parser

  • All Known Implementing Classes:
    AbstractParser, AntlrBaseParser, JjtreeParserAdapter

    public interface Parser
    Produces an AST from a source file. Instances of this interface must be stateless (which makes them trivially threadsafe). TODO - Ideally ParserOptions would be an argument to ::parse - ::parse would also take some more parameters, eg an error collector - The reader + filename would be a TextDocument
    Pieter_Van_Raemdonck - Application Engineers NV/SA -
    • Method Detail

      • parse

        RootNode parse​(String fileName,
                       Reader source)
                throws ParseException
        Parse source code and return the root node of the AST.
        fileName - The file name being parsed (may be null).
        source - Reader that provides the source code of a compilation unit
        the root node of the AST that is built from the source code
        ParseException - In case the source code could not be parsed, probably due to syntactical errors.