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 TypeMethodDescriptionReturns 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
Upon applying a parser withParser.label(java.lang.String)
, the label name is used to create a new child node under the current node.void
setCurrentResult
(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
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 Details
-
push
Upon applying a parser withParser.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
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
Called by labeled parser to reset the current child node when the current node failed. Also called byBestParser
to set the optimum parse tree. -
startFresh
Called when tokenizer passes on to token-level parser. -
setStateAs
Set the enclosing parser's tree state into the nested parser's state. Called for both nested token-level parser and nested scanner.
-