Package org.jparsec

Interface ParseContext.ParserTrace

Enclosing class:
ParseContext

static interface ParseContext.ParserTrace
Allows tracing of parsing progress during error condition, to ease debugging.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the current node, that is being parsed (not necessarily finished).
    Called by branching parsers, to save the current state of tree, before trying parsers that could modify the tree state.
    void
    pop()
    When a parser finishes, the current node is popped so we are back to the parent parser.
    void
    push(String name)
    Upon applying a parser with Parser.label(java.lang.String), the label name is used to create a new child node under the current node.
    void
    Whenever a labeled parser succeeds, it calls this method to set its result in the trace.
    void
    Called by labeled parser to reset the current child node when the current node failed.
    void
    Set the enclosing parser's tree state into the nested parser's state.
    void
    Called when tokenizer passes on to token-level parser.
  • Method Details

    • push

      void push(String name)
      Upon applying a parser with Parser.label(java.lang.String), the label name is used to create a new child node under the current node. The new child node is set to be the current node.
    • pop

      void pop()
      When a parser finishes, the current node is popped so we are back to the parent parser.
    • getCurrentNode

      TreeNode getCurrentNode()
      Returns the current node, that is being parsed (not necessarily finished).
    • setCurrentResult

      void setCurrentResult(Object result)
      Whenever a labeled parser succeeds, it calls this method to set its result in the trace.
    • getLatestChild

      TreeNode getLatestChild()
      Called by branching parsers, to save the current state of tree, before trying parsers that could modify the tree state.
    • setLatestChild

      void setLatestChild(TreeNode node)
      Called by labeled parser to reset the current child node when the current node failed. Also called by BestParser to set the optimum parse tree.
    • startFresh

      void startFresh(ParseContext context)
      Called when tokenizer passes on to token-level parser.
    • setStateAs

      void setStateAs(ParseContext.ParserTrace that)
      Set the enclosing parser's tree state into the nested parser's state. Called for both nested token-level parser and nested scanner.