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 static Object |
getAncestor(TreeAdaptor adaptor,
String[] tokenNames,
Object t,
String goal)
Helper for static inContext
|
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() |
boolean |
inContext(String context)
Check if current node in input has a context.
|
static boolean |
inContext(TreeAdaptor adaptor,
String[] tokenNames,
Object t,
String context)
The worker for inContext.
|
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, traceOutpublic 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()
BaseRecognizerreset in class BaseRecognizerpublic void setTreeNodeStream(TreeNodeStream input)
public TreeNodeStream getTreeNodeStream()
public String getSourceName()
getSourceName in class BaseRecognizerprotected Object getCurrentInputSymbol(IntStream input)
BaseRecognizergetCurrentInputSymbol in class BaseRecognizerprotected Object getMissingSymbol(IntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
BaseRecognizergetMissingSymbol in class BaseRecognizerpublic void matchAny(IntStream ignore)
matchAny in class BaseRecognizerprotected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
recoverFromMismatchedToken in class BaseRecognizerRecognitionExceptionpublic String getErrorHeader(RecognitionException e)
getErrorHeader in class BaseRecognizerpublic String getErrorMessage(RecognitionException e, String[] tokenNames)
getErrorMessage in class BaseRecognizerpublic boolean inContext(String context)
public static boolean inContext(TreeAdaptor adaptor, String[] tokenNames, Object t, String context)
protected static Object getAncestor(TreeAdaptor adaptor, String[] tokenNames, Object t, String goal)
public void traceIn(String ruleName, int ruleIndex)
public void traceOut(String ruleName, int ruleIndex)
Copyright © 1992-2013 ANTLR. All Rights Reserved.