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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      TreeNode getCurrentNode()
      Returns the current node, that is being parsed (not necessarily finished).
      TreeNode getLatestChild()
      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​(java.lang.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 setCurrentResult​(java.lang.Object result)
      Whenever a labeled parser succeeds, it calls this method to set its result in the trace.
      void setLatestChild​(TreeNode node)
      Called by labeled parser to reset the current child node when the current node failed.
      void setStateAs​(ParseContext.ParserTrace that)
      Set the enclosing parser's tree state into the nested parser's state.
      void startFresh​(ParseContext context)
      Called when tokenizer passes on to token-level parser.
    • Method Detail

      • push

        void push​(java.lang.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​(java.lang.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.