Class ParseTree


  • public final class ParseTree
    extends java.lang.Object
    The ParseTree class is used to hold the root Statement generated by the Parser.

    When the Parser creates a series of Statement objects, the root is held here in the form of a ParseTree. Typically, this will be SourceStatement object, but any child of the Statement interface is valid.

    Since:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      ParseTree​(Statement statement)
      Constructs a ParseTree object for storing a Statement object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Statement getStatement()
      Returns the root Statement object initially stored when the ParseTree was constructed.
      static void print()
      Pretty prints the ParseTree to the console.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParseTree

        public ParseTree​(Statement statement)
        Constructs a ParseTree object for storing a Statement object.

        A static copy of the Statement is also saved on initialisation, so that it can be printed later on.

        Parameters:
        statement - The Statement root object to be stored
    • Method Detail

      • getStatement

        public Statement getStatement()
        Returns the root Statement object initially stored when the ParseTree was constructed.
        Returns:
        The root Statement object
      • print

        public static void print()
        Pretty prints the ParseTree to the console.