| Modifier and Type | Class and Description |
|---|---|
| public class | |
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | _buildParseTrees
Specifies whether or not the parser should construct a parse tree during the parsing process. |
| protected ParserRuleContext | _ctx
The |
| protected ANTLRErrorStrategy | _errHandler
The error handling strategy for the parser. |
| protected TokenStream | _input
The input stream. |
| protected List | _parseListeners
The list of |
| protected final IntegerStack | |
| protected int | _syntaxErrors
The number of syntax errors reported during parsing. |
| private Parser. | _tracer
When |
| private static final Map | bypassAltsAtnCache
This field maps from the serialized ATN string to the deserialized |
| protected boolean | matchedEOF
Indicates parser has match()ed EOF token. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public void | addParseListener(ParseTreeListener
the listener to add listener)Registers |
| public ParseTreePattern | compileParseTreePattern(String pattern, int patternRuleIndex)
The preferred method of getting a tree pattern. |
| public ParseTreePattern | compileParseTreePattern(String pattern, int patternRuleIndex, Lexer lexer)
The same as |
| public Token | |
| public ErrorNode | createErrorNode(ParserRuleContext parent, Token t)
How to create an error node, given a token, associated with a parent. |
| public TerminalNode | createTerminalNode(ParserRuleContext parent, Token t)
How to create a token leaf node associated with a parent. |
| public void | |
| public void | |
| public void | |
| public void | enterRecursionRule(ParserRuleContext localctx, int ruleIndex)
Deprecated
Use
enterRecursionRule(ParserRuleContext, int, int, int) instead.
|
| public void | |
| public void | enterRule(ParserRuleContext localctx, int state, int ruleIndex)
Always called by generated parsers upon entry to a rule. |
| public void | |
| public ATN | getATNWithBypassAlts()
The ATN with bypass alternatives is expensive to create so we create it lazily. |
| public boolean | Returns: true if a complete parse tree will be constructed while
parsing, otherwise falseGets whether or not a complete parse tree will be constructed while parsing. |
| public ParserRuleContext | |
| public Token | getCurrentToken()
Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID. |
| public List | |
| public ANTLRErrorStrategy | |
| public ParserErrorListener | |
| public IntervalSet | getExpectedTokens()
Computes the set of input symbols which could follow the current parser
state and context, as given by |
| public IntervalSet | |
| public TokenStream | |
| public ParserRuleContext | |
| public int | |
| public ParseInfo | getParseInfo()
Overrides org. |
| public List | |
| public final int | Returns: The precedence level for the top-most precedence rule, or -1 if the parser context is not nested within a precedence rule.Get the precedence level for the top-most precedence rule. |
| public ParserRuleContext | |
| public int | |
| public List | getRuleInvocationStack()
Return List<String> of the rule names in your parser instance leading up to a call to the current rule. |
| public List | |
| public String | |
| public TokenFactory | |
| public boolean | Returns: true if the ParserRuleContext#children list is trimmed
using the default Parser. during the parse process.
|
| public boolean | |
| public boolean | Returns: true if symbol can follow the current state in
the ATN, otherwise false.the symbol type to check symbol)Checks whether or not |
| public boolean | |
| public boolean | |
| public Token | Returns: the matched symbolthe token type to match ttype)Match current input symbol against |
| public Token | |
| public final void | |
| public void | |
| public boolean | |
| public void | pushNewRecursionContext(ParserRuleContext localctx, int state, int ruleIndex)
Like |
| public void | removeParseListener(ParseTreeListener
the listener to remove listener)Remove |
| public void | |
| public void | |
| public void | setBuildParseTree(boolean buildParseTrees)
Track the |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setTrace(boolean trace)
During a parse is sometimes useful to listen in on the rule entry and exit events as well as token matches. |
| public void | setTrimParseTree(boolean
true to trim the capacity of the ParserRuleContext#children
list to its size after a rule is parsed.Trim the internal lists of the parse tree during parsing to conserve memory. |
| protected void | |
| protected void | |
| public void |
| _buildParseTrees | back to summary |
|---|---|
| protected boolean _buildParseTrees Specifies whether or not the parser should construct a parse tree during
the parsing process. The default value is
| |
| _ctx | back to summary |
|---|---|
| protected ParserRuleContext _ctx The | |
| _errHandler | back to summary |
|---|---|
| protected ANTLRErrorStrategy _errHandler The error handling strategy for the parser. The default value is a new
instance of
| |
| _input | back to summary |
|---|---|
| protected TokenStream _input The input stream.
| |
| _parseListeners | back to summary |
|---|---|
| protected List<ParseTreeListener> _parseListeners The list of
| |
| _precedenceStack | back to summary |
|---|---|
| protected final IntegerStack _precedenceStack | |
| _syntaxErrors | back to summary |
|---|---|
| protected int _syntaxErrors The number of syntax errors reported during parsing. This value is
incremented each time | |
| _tracer | back to summary |
|---|---|
| private Parser. When | |
| bypassAltsAtnCache | back to summary |
|---|---|
| private static final Map<String, ATN> bypassAltsAtnCache This field maps from the serialized ATN string to the deserialized | |
| matchedEOF | back to summary |
|---|---|
| protected boolean matchedEOF Indicates parser has match()ed EOF token. See | |
| Parser | back to summary |
|---|---|
| public Parser(TokenStream input) | |
| addContextToParseTree | back to summary |
|---|---|
| protected void addContextToParseTree() | |
| addParseListener | back to summary |
|---|---|
| public void addParseListener(ParseTreeListener listener) Registers To support output-preserving grammar transformations (including but not
limited to left-recursion removal, automated left-factoring, and
optimized code generation), calls to listener methods during the parse
may differ substantially from calls made by
With the following specific exceptions, calls to listener events are deterministic, i.e. for identical input the calls to listener methods will be the same.
| |
| compileParseTreePattern | back to summary |
|---|---|
| public ParseTreePattern compileParseTreePattern(String pattern, int patternRuleIndex) The preferred method of getting a tree pattern. For example, here's a sample use:
ParseTree t = parser.expr();
ParseTreePattern p = parser.compileParseTreePattern("<ID>+0", MyParser.RULE_expr);
ParseTreeMatch m = p.match(t);
String id = m.get("ID");
| |
| compileParseTreePattern | back to summary |
|---|---|
| public ParseTreePattern compileParseTreePattern(String pattern, int patternRuleIndex, Lexer lexer) The same as | |
| consume | back to summary |
|---|---|
| public Token consume() Consume and return the current symbol. E.g., given the following input with A B ^If the parser is not in error recovery mode, the consumed symbol is added to the parse tree using ParserRuleContext#addChild(TerminalNode), and
ParseTreeListener#visitTerminal is called on any parse listeners.
If the parser is in error recovery mode, the consumed symbol is
added to the parse tree using createErrorNode(ParserRuleContext, Token) then
ParserRuleContext#addErrorNode(ErrorNode) and
ParseTreeListener#visitErrorNode is called on any parse
listeners.
| |
| createErrorNode | back to summary |
|---|---|
| public ErrorNode createErrorNode(ParserRuleContext parent, Token t) How to create an error node, given a token, associated with a parent. Typically, the error node to create is not a function of the parent.
| |
| createTerminalNode | back to summary |
|---|---|
| public TerminalNode createTerminalNode(ParserRuleContext parent, Token t) How to create a token leaf node associated with a parent. Typically, the terminal node to create is not a function of the parent.
| |
| dumpDFA | back to summary |
|---|---|
| public void dumpDFA() For debugging and other purposes. | |
| enterLeftFactoredRule | back to summary |
|---|---|
| public void enterLeftFactoredRule(ParserRuleContext localctx, int state, int ruleIndex) | |
| enterOuterAlt | back to summary |
|---|---|
| public void enterOuterAlt(ParserRuleContext localctx, int altNum) | |
| enterRecursionRule | back to summary |
|---|---|
| public void enterRecursionRule(ParserRuleContext localctx, int ruleIndex)
Deprecated Use
| |
| enterRecursionRule | back to summary |
|---|---|
| public void enterRecursionRule(ParserRuleContext localctx, int state, int ruleIndex, int precedence) | |
| enterRule | back to summary |
|---|---|
| public void enterRule(ParserRuleContext localctx, int state, int ruleIndex) Always called by generated parsers upon entry to a rule. Access field
| |
| exitRule | back to summary |
|---|---|
| public void exitRule() | |
| getATNWithBypassAlts | back to summary |
|---|---|
| public ATN getATNWithBypassAlts() The ATN with bypass alternatives is expensive to create so we create it lazily.
| |
| getBuildParseTree | back to summary |
|---|---|
| public boolean getBuildParseTree() Gets whether or not a complete parse tree will be constructed while
parsing. This property is
| |
| getContext | back to summary |
|---|---|
| public ParserRuleContext getContext() | |
| getCurrentToken | back to summary |
|---|---|
| public Token getCurrentToken() Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID.
| |
| getDFAStrings | back to summary |
|---|---|
| public List For debugging and other purposes. | |
| getErrorHandler | back to summary |
|---|---|
public ANTLRErrorStrategy getErrorHandler()
| |
| getErrorListenerDispatch | back to summary |
|---|---|
| public ParserErrorListener getErrorListenerDispatch() Overrides org.
| |
| getExpectedTokens | back to summary |
|---|---|
| public IntervalSet getExpectedTokens() Computes the set of input symbols which could follow the current parser
state and context, as given by
| |
| getExpectedTokensWithinCurrentRule | back to summary |
|---|---|
public IntervalSet getExpectedTokensWithinCurrentRule()
| |
| getInputStream | back to summary |
|---|---|
| public TokenStream getInputStream() Implements abstract org.
| |
| getInvokingContext | back to summary |
|---|---|
| public ParserRuleContext getInvokingContext(int ruleIndex) | |
| getNumberOfSyntaxErrors | back to summary |
|---|---|
| public int getNumberOfSyntaxErrors() Gets the number of syntax errors reported during parsing. This value is
incremented each time
| |
| getParseInfo | back to summary |
|---|---|
| public ParseInfo getParseInfo() Overrides org. Doc from org. If profiling during the parse/lex, this will return DecisionInfo records for each decision in recognizer in a ParseInfo object.
| |
| getParseListeners | back to summary |
|---|---|
public List
| |
| getPrecedence | back to summary |
|---|---|
| public final int getPrecedence() Get the precedence level for the top-most precedence rule.
| |
| getRuleContext | back to summary |
|---|---|
| public ParserRuleContext getRuleContext() | |
| getRuleIndex | back to summary |
|---|---|
| public int getRuleIndex(String ruleName) Get a rule's index (i.e., | |
| getRuleInvocationStack | back to summary |
|---|---|
| public List Return List<String> of the rule names in your parser instance leading up to a call to the current rule. You could override if you want more details such as the file/line info of where in the ATN a rule is invoked. This is very useful for error messages. | |
| getRuleInvocationStack | back to summary |
|---|---|
| public List | |
| getSourceName | back to summary |
|---|---|
| public String getSourceName() | |
| getTokenFactory | back to summary |
|---|---|
| public TokenFactory getTokenFactory() | |
| getTrimParseTree | back to summary |
|---|---|
public boolean getTrimParseTree()
| |
| inContext | back to summary |
|---|---|
| public boolean inContext(String context) | |
| isExpectedToken | back to summary |
|---|---|
| public boolean isExpectedToken(int symbol) Checks whether or not return getExpectedTokens().contains(symbol);
| |
| isMatchedEOF | back to summary |
|---|---|
| public boolean isMatchedEOF() | |
| isTrace | back to summary |
|---|---|
| public boolean isTrace() Gets whether a
| |
| match | back to summary |
|---|---|
| public Token match(int ttype) throws RecognitionException Match current input symbol against If the symbol type does not match,
| |
| matchWildcard | back to summary |
|---|---|
| public Token matchWildcard() throws RecognitionException Match current input symbol as a wildcard. If the symbol type matches
(i.e. has a value greater than 0), If the symbol type does not match,
| |
| notifyErrorListeners | back to summary |
|---|---|
| public final void notifyErrorListeners(String msg) | |
| notifyErrorListeners | back to summary |
|---|---|
| public void notifyErrorListeners(Token offendingToken, String msg, RecognitionException e) | |
| precpred | back to summary |
|---|---|
| public boolean precpred(RuleContext localctx, int precedence) Overrides org.
| |
| pushNewRecursionContext | back to summary |
|---|---|
| public void pushNewRecursionContext(ParserRuleContext localctx, int state, int ruleIndex) Like | |
| removeParseListener | back to summary |
|---|---|
| public void removeParseListener(ParseTreeListener listener) Remove If
| |
| removeParseListeners | back to summary |
|---|---|
| public void removeParseListeners() Remove all parse listeners.
| |
| reset | back to summary |
|---|---|
| public void reset() reset the parser's state | |
| setBuildParseTree | back to summary |
|---|---|
| public void setBuildParseTree(boolean buildParseTrees) Track the Note that if we are not building parse trees, rule contexts only point upwards. When a rule exits, it returns the context but that gets garbage collected if nobody holds a reference. It points upwards but nobody points at it. When we build parse trees, we are adding all of these contexts to
| |
| setContext | back to summary |
|---|---|
| public void setContext(ParserRuleContext ctx) | |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ANTLRErrorStrategy handler) | |
| setInputStream | back to summary |
|---|---|
| public void setInputStream(TokenStream input) Set the token stream and reset the parser. | |
| setProfile | back to summary |
|---|---|
public void setProfile(boolean profile)
| |
| setTrace | back to summary |
|---|---|
| public void setTrace(boolean trace) During a parse is sometimes useful to listen in on the rule entry and exit events as well as token matches. This is for quick and dirty debugging. | |
| setTrimParseTree | back to summary |
|---|---|
| public void setTrimParseTree(boolean trimParseTrees) Trim the internal lists of the parse tree during parsing to conserve memory.
This property is set to
| |
| triggerEnterRuleEvent | back to summary |
|---|---|
| protected void triggerEnterRuleEvent() Notify any parse listeners of an enter rule event.
| |
| triggerExitRuleEvent | back to summary |
|---|---|
| protected void triggerExitRuleEvent() Notify any parse listeners of an exit rule event.
| |
| unrollRecursionContexts | back to summary |
|---|---|
| public void unrollRecursionContexts(ParserRuleContext _parentctx) | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void |
| TraceListener | back to summary |
|---|---|
| public TraceListener() | |
| enterEveryRule | back to summary |
|---|---|
| public void enterEveryRule(ParserRuleContext ctx) Implements org.
| |
| exitEveryRule | back to summary |
|---|---|
| public void exitEveryRule(ParserRuleContext ctx) Implements org.
| |
| visitErrorNode | back to summary |
|---|---|
| public void visitErrorNode(ErrorNode node) Implements org.
| |
| visitTerminal | back to summary |
|---|---|
| public void visitTerminal(TerminalNode node) Implements org.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Parser. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void |
| INSTANCE | back to summary |
|---|---|
| public static final Parser. | |
| TrimToSizeListener | back to summary |
|---|---|
| public TrimToSizeListener() | |
| enterEveryRule | back to summary |
|---|---|
| public void enterEveryRule(ParserRuleContext ctx) Implements org.
| |
| exitEveryRule | back to summary |
|---|---|
| public void exitEveryRule(ParserRuleContext ctx) Implements org.
| |
| visitErrorNode | back to summary |
|---|---|
| public void visitErrorNode(ErrorNode node) Implements org.
| |
| visitTerminal | back to summary |
|---|---|
| public void visitTerminal(TerminalNode node) Implements org.
| |