public class ParserInterpreter extends Parser
Parser.TraceListener, Parser.TrimToSizeListener| 限定符和类型 | 字段和说明 |
|---|---|
protected Deque<Tuple2<ParserRuleContext,Integer>> |
_parentContextStack
This stack corresponds to the _parentctx, _parentState pair of locals
that would exist on call stack frames with a recursive descent parser;
in the generated function for a left-recursive rule you'd see:
private EContext e(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx; // Pair.a
int _parentState = getState(); // Pair.b
...
}
Those values are used to create new recursive rule invocation contexts
associated with left operand of an alt like "expr '*' expr".
|
protected ATN |
atn |
protected String |
grammarFileName |
protected int |
overrideDecision
We need a map from (decision,inputIndex)->forced alt for computing ambiguous
parse trees.
|
protected int |
overrideDecisionAlt |
protected int |
overrideDecisionInputIndex |
protected boolean |
overrideDecisionReached |
protected InterpreterRuleContext |
overrideDecisionRoot
What is the current context when we override a decisions?
|
protected BitSet |
pushRecursionContextStates
This identifies StarLoopEntryState's that begin the (...)*
precedence loops of left recursive rules.
|
protected InterpreterRuleContext |
rootContext |
protected String[] |
ruleNames |
protected String[] |
tokenNames
已过时。
|
_buildParseTrees, _ctx, _errHandler, _input, _parseListeners, _precedenceStack, _syntaxErrors, matchedEOF_interp, EOF| 构造器和说明 |
|---|
ParserInterpreter(ParserInterpreter old)
A copy constructor that creates a new parser interpreter by reusing
the fields of a previous interpreter.
|
ParserInterpreter(String grammarFileName,
Collection<String> tokenNames,
Collection<String> ruleNames,
ATN atn,
TokenStream input)
已过时。
|
ParserInterpreter(String grammarFileName,
Vocabulary vocabulary,
Collection<String> ruleNames,
ATN atn,
TokenStream input) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addDecisionOverride(int decision,
int tokenIndex,
int forcedAlt)
Override this parser interpreters normal decision-making process
at a particular decision and input token index.
|
protected InterpreterRuleContext |
createInterpreterRuleContext(ParserRuleContext parent,
int invokingStateNumber,
int ruleIndex)
Provide simple "factory" for InterpreterRuleContext's.
|
void |
enterRecursionRule(ParserRuleContext localctx,
int state,
int ruleIndex,
int precedence) |
ATN |
getATN()
Get the
ATN used by the recognizer for prediction. |
protected ATNState |
getATNState() |
String |
getGrammarFileName()
For debugging and other purposes, might want the grammar name.
|
InterpreterRuleContext |
getOverrideDecisionRoot() |
InterpreterRuleContext |
getRootContext()
Return the root of the parse, which can be useful if the parser
bails out.
|
String[] |
getRuleNames() |
String[] |
getTokenNames()
已过时。
|
Vocabulary |
getVocabulary()
Get the vocabulary used by the recognizer.
|
ParserRuleContext |
parse(int startRuleIndex)
Begin parsing at startRuleIndex
|
protected void |
recover(RecognitionException e)
Rely on the error handler for this parser but, if no tokens are consumed
to recover, add an error node.
|
protected Token |
recoverInline() |
void |
reset()
reset the parser's state
|
protected int |
visitDecisionState(DecisionState p)
Method visitDecisionState() is called when the interpreter reaches
a decision state (instance of DecisionState).
|
protected void |
visitRuleStopState(ATNState p) |
protected void |
visitState(ATNState p) |
addContextToParseTree, addParseListener, compileParseTreePattern, compileParseTreePattern, consume, createErrorNode, createTerminalNode, dumpDFA, enterLeftFactoredRule, enterOuterAlt, enterRecursionRule, enterRule, exitRule, getATNWithBypassAlts, getBuildParseTree, getContext, getCurrentToken, getDFAStrings, getErrorHandler, getErrorListenerDispatch, getExpectedTokens, getExpectedTokensWithinCurrentRule, getInputStream, getInvokingContext, getNumberOfSyntaxErrors, getParseInfo, getParseListeners, getPrecedence, getRuleContext, getRuleIndex, getRuleInvocationStack, getRuleInvocationStack, getSourceName, getTokenFactory, getTrimParseTree, inContext, isExpectedToken, isMatchedEOF, isTrace, match, matchWildcard, notifyErrorListeners, notifyErrorListeners, precpred, pushNewRecursionContext, removeParseListener, removeParseListeners, setBuildParseTree, setContext, setErrorHandler, setInputStream, setProfile, setTrace, setTrimParseTree, triggerEnterRuleEvent, triggerExitRuleEvent, unrollRecursionContextsaction, addErrorListener, getErrorHeader, getErrorListeners, getInterpreter, getRuleIndexMap, getSerializedATN, getState, getTokenErrorDisplay, getTokenType, getTokenTypeMap, removeErrorListener, removeErrorListeners, sempred, setInterpreter, setStateprotected final String grammarFileName
protected final ATN atn
protected final BitSet pushRecursionContextStates
@Deprecated protected final String[] tokenNames
protected final String[] ruleNames
protected final Deque<Tuple2<ParserRuleContext,Integer>> _parentContextStack
protected int overrideDecision
protected int overrideDecisionInputIndex
protected int overrideDecisionAlt
protected boolean overrideDecisionReached
protected InterpreterRuleContext overrideDecisionRoot
protected InterpreterRuleContext rootContext
public ParserInterpreter(@NotNull
ParserInterpreter old)
old - The interpreter to copy@Deprecated public ParserInterpreter(String grammarFileName, Collection<String> tokenNames, Collection<String> ruleNames, ATN atn, TokenStream input)
ParserInterpreter(String, Vocabulary, Collection, ATN, TokenStream) instead.public ParserInterpreter(String grammarFileName, @NotNull Vocabulary vocabulary, Collection<String> ruleNames, ATN atn, TokenStream input)
public ATN getATN()
RecognizerATN used by the recognizer for prediction.getATN 在类中 Recognizer<Token,ParserATNSimulator>ATN used by the recognizer for prediction.@Deprecated public String[] getTokenNames()
RecognizergetTokenNames 在类中 Recognizer<Token,ParserATNSimulator>public Vocabulary getVocabulary()
RecognizergetVocabulary 在类中 Recognizer<Token,ParserATNSimulator>Vocabulary instance providing information about the
vocabulary used by the grammar.public String[] getRuleNames()
getRuleNames 在类中 Recognizer<Token,ParserATNSimulator>public String getGrammarFileName()
RecognizergetGrammarFileName 在类中 Recognizer<Token,ParserATNSimulator>public ParserRuleContext parse(int startRuleIndex)
public void enterRecursionRule(ParserRuleContext localctx, int state, int ruleIndex, int precedence)
enterRecursionRule 在类中 Parserprotected ATNState getATNState()
protected void visitState(ATNState p)
protected int visitDecisionState(DecisionState p)
protected InterpreterRuleContext createInterpreterRuleContext(ParserRuleContext parent, int invokingStateNumber, int ruleIndex)
protected void visitRuleStopState(ATNState p)
public void addDecisionOverride(int decision,
int tokenIndex,
int forcedAlt)
public InterpreterRuleContext getOverrideDecisionRoot()
protected void recover(RecognitionException e)
protected Token recoverInline()
public InterpreterRuleContext getRootContext()
Copyright © 1992–2022 Daniel Sun. All rights reserved.