Public Member Functions | |
ParseTreeDebugParser (int k_) | |
ParseTreeDebugParser (ParserSharedInputState state, int k_) | |
ParseTreeDebugParser (TokenBuffer tokenBuf, int k_) | |
ParseTreeDebugParser (TokenStream lexer, int k_) | |
ParseTree | getParseTree () |
int | getNumberOfDerivationSteps () |
void | match (int i) throws MismatchedTokenException, TokenStreamException |
void | match (BitSet bitSet) throws MismatchedTokenException, TokenStreamException |
void | matchNot (int i) throws MismatchedTokenException, TokenStreamException |
void | traceIn (String s) throws TokenStreamException |
void | traceOut (String s) throws TokenStreamException |
Protected Member Functions | |
void | addCurrentTokenToParseTree () throws TokenStreamException |
Protected Attributes | |
Stack | currentParseTreeRoot = new Stack() |
ParseTreeRule | mostRecentParseTreeRoot = null |
int | numberOfDerivationSteps = 1 |
Override the standard matching and rule entry/exit routines to build parse trees. This class is useful for 2.7.3 where you can specify a superclass like
class TinyCParser extends Parser(ParseTreeDebugParser);
antlr.debug.ParseTreeDebugParser.ParseTreeDebugParser | ( | int | k_ | ) |
antlr.debug.ParseTreeDebugParser.ParseTreeDebugParser | ( | ParserSharedInputState | state, | |
int | k_ | |||
) |
antlr.debug.ParseTreeDebugParser.ParseTreeDebugParser | ( | TokenBuffer | tokenBuf, | |
int | k_ | |||
) |
antlr.debug.ParseTreeDebugParser.ParseTreeDebugParser | ( | TokenStream | lexer, | |
int | k_ | |||
) |
void antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree | ( | ) | throws TokenStreamException [protected] |
This adds LT(1) to the current parse subtree. Note that the match() routines add the node before checking for correct match. This means that, upon mismatched token, there will a token node in the tree corresponding to where that token was expected. For no viable alternative errors, no node will be in the tree as nothing was matched() (the lookahead failed to predict an alternative).
References antlr.BaseAST.addChild(), antlr.debug.ParseTreeDebugParser.currentParseTreeRoot, antlr.ParserSharedInputState.guessing, antlr.Parser.inputState, antlr.LLkParser.LA(), and antlr.LLkParser.LT().
Referenced by antlr.debug.ParseTreeDebugParser.match(), and antlr.debug.ParseTreeDebugParser.matchNot().
int antlr.debug.ParseTreeDebugParser.getNumberOfDerivationSteps | ( | ) |
ParseTree antlr.debug.ParseTreeDebugParser.getParseTree | ( | ) |
void antlr.debug.ParseTreeDebugParser.match | ( | BitSet | b | ) | throws MismatchedTokenException, TokenStreamException |
Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.
Reimplemented from antlr.Parser.
References antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree().
void antlr.debug.ParseTreeDebugParser.match | ( | int | t | ) | throws MismatchedTokenException, TokenStreamException |
Make sure current lookahead symbol matches token type t
. Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.
Reimplemented from antlr.Parser.
References antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree().
void antlr.debug.ParseTreeDebugParser.matchNot | ( | int | i | ) | throws MismatchedTokenException, TokenStreamException |
Reimplemented from antlr.Parser.
References antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree().
void antlr.debug.ParseTreeDebugParser.traceIn | ( | String | s | ) | throws TokenStreamException |
Create a rule node, add to current tree, and make it current root
Reimplemented from antlr.LLkParser.
References antlr.BaseAST.addChild(), antlr.debug.ParseTreeDebugParser.currentParseTreeRoot, antlr.ParserSharedInputState.guessing, antlr.Parser.inputState, and antlr.debug.ParseTreeDebugParser.numberOfDerivationSteps.
void antlr.debug.ParseTreeDebugParser.traceOut | ( | String | s | ) | throws TokenStreamException |
Pop current root; back to adding to old root
Reimplemented from antlr.LLkParser.
References antlr.debug.ParseTreeDebugParser.currentParseTreeRoot, antlr.ParserSharedInputState.guessing, antlr.Parser.inputState, and antlr.debug.ParseTreeDebugParser.mostRecentParseTreeRoot.
Stack antlr.debug.ParseTreeDebugParser.currentParseTreeRoot = new Stack() [protected] |
Each new rule invocation must have it's own subtree. Tokens are added to the current root so we must have a stack of subtree roots.
Referenced by antlr.debug.ParseTreeDebugParser.addCurrentTokenToParseTree(), antlr.debug.ParseTreeDebugParser.traceIn(), and antlr.debug.ParseTreeDebugParser.traceOut().
ParseTreeRule antlr.debug.ParseTreeDebugParser.mostRecentParseTreeRoot = null [protected] |
Track most recently created parse subtree so that when parsing is finished, we can get to the root.
Referenced by antlr.debug.ParseTreeDebugParser.getParseTree(), and antlr.debug.ParseTreeDebugParser.traceOut().
int antlr.debug.ParseTreeDebugParser.numberOfDerivationSteps = 1 [protected] |
For every rule replacement with a production, we bump up count.
Referenced by antlr.debug.ParseTreeDebugParser.getNumberOfDerivationSteps(), and antlr.debug.ParseTreeDebugParser.traceIn().