public class TreeParser extends BaseRecognizer
Modifier and Type | Field and Description |
---|---|
static int |
DOWN |
protected TreeNodeStream |
input |
static int |
UP |
DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
Constructor and Description |
---|
TreeParser(TreeNodeStream input) |
TreeParser(TreeNodeStream input,
RecognizerSharedState state) |
Modifier and Type | Method and Description |
---|---|
protected Object |
getCurrentInputSymbol(IntStream input)
Match needs to return the current input symbol, which gets put
into the label for the associated token ref; e.g., x=ID.
|
String |
getErrorHeader(RecognitionException e)
Prefix error message with the grammar name because message is
always intended for the programmer because the parser built
the input tree not the user.
|
String |
getErrorMessage(RecognitionException e,
String[] tokenNames)
Tree parsers parse nodes they usually have a token object as
payload.
|
protected Object |
getMissingSymbol(IntStream input,
RecognitionException e,
int expectedTokenType,
BitSet follow)
Conjure up a missing token during error recovery.
|
String |
getSourceName() |
TreeNodeStream |
getTreeNodeStream() |
void |
matchAny(IntStream ignore)
Match '.' in tree parser has special meaning.
|
protected Object |
recoverFromMismatchedToken(IntStream input,
int ttype,
BitSet follow)
We have DOWN/UP nodes in the stream that have no line info; override.
|
void |
reset()
reset the parser's state; subclasses must rewinds the input stream
|
void |
setTreeNodeStream(TreeNodeStream input)
Set the input stream
|
void |
traceIn(String ruleName,
int ruleIndex) |
void |
traceOut(String ruleName,
int ruleIndex) |
alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getGrammarFileName, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, reportError, setBacktrackingLevel, toStrings, traceIn, traceOut
public static final int DOWN
public static final int UP
protected TreeNodeStream input
public TreeParser(TreeNodeStream input)
public TreeParser(TreeNodeStream input, RecognizerSharedState state)
public void reset()
BaseRecognizer
reset
in class BaseRecognizer
public void setTreeNodeStream(TreeNodeStream input)
public TreeNodeStream getTreeNodeStream()
public String getSourceName()
getSourceName
in class BaseRecognizer
protected Object getCurrentInputSymbol(IntStream input)
BaseRecognizer
getCurrentInputSymbol
in class BaseRecognizer
protected Object getMissingSymbol(IntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
BaseRecognizer
getMissingSymbol
in class BaseRecognizer
public void matchAny(IntStream ignore)
matchAny
in class BaseRecognizer
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
recoverFromMismatchedToken
in class BaseRecognizer
RecognitionException
public String getErrorHeader(RecognitionException e)
getErrorHeader
in class BaseRecognizer
public String getErrorMessage(RecognitionException e, String[] tokenNames)
getErrorMessage
in class BaseRecognizer
public void traceIn(String ruleName, int ruleIndex)
public void traceOut(String ruleName, int ruleIndex)
Copyright © 2020. All rights reserved.