Class TypedInterpreter<T>

java.lang.Object
quickparse.semantics.interpreters.typed.TypedInterpreter<T>
All Implemented Interfaces:
Interpreter<T>

public abstract class TypedInterpreter<T>
extends java.lang.Object
implements Interpreter<T>
  • Constructor Summary

    Constructors 
    Constructor Description
    TypedInterpreter​(Grammar grammar)  
  • Method Summary

    Modifier and Type Method Description
    T analyze​(SyntaxTree syntaxTree)  
    protected SyntaxTree getCurrentSyntaxNode()
    Gets the node that this interpreter is currently analyzing.
    This method is useful to generate detailed semantic errors from inside the annotated methods of the interpreter.
    Grammar getGrammar()  
    protected SyntaxTree getSyntaxNodeByResult​(java.lang.Object result)
    Gets the node whose interpretation generated the given result object.
    This method is useful to generate detailed semantic errors from inside the annotated methods of the interpreter.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getGrammar

      public final Grammar getGrammar()
    • getCurrentSyntaxNode

      protected final SyntaxTree getCurrentSyntaxNode()
      Gets the node that this interpreter is currently analyzing.
      This method is useful to generate detailed semantic errors from inside the annotated methods of the interpreter.
      Returns:
      A syntax node
    • getSyntaxNodeByResult

      protected final SyntaxTree getSyntaxNodeByResult​(java.lang.Object result)
      Gets the node whose interpretation generated the given result object.
      This method is useful to generate detailed semantic errors from inside the annotated methods of the interpreter.
      Parameters:
      result - a result object generated by an annotated method of this interpreter
      Returns:
      A syntax node
      Throws:
      java.lang.IllegalArgumentException - if the given result object is not the direct result of the analysis of a syntax node
    • analyze

      public final T analyze​(SyntaxTree syntaxTree) throws SemanticsException
      Specified by:
      analyze in interface Interpreter<T>
      Throws:
      SemanticsException