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
    Author:
    Pieter_Van_Raemdonck - Application Engineers NV/SA - www.ae.be
    • Method Detail

      • parse

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