- EMPTY
ParserRuleContext EMPTY;
- children
ParseTree[] children;
If we are debugging or building a parse tree for a visitor,
we need to track all of the tokens and rule invocations associated
with this rule's context. This is empty for parsing w/o tree constr.
operation because we don't the need to track the details about
how we parse this rule.
- start
Token start;
Undocumented in source.
- stop
Token stop;
Undocumented in source.
- exception
RecognitionException exception;
The exception that forced this rule to return. If the rule successfully
completed, this is {@code null}.
- copyFrom
void copyFrom(ParserRuleContext ctx)
COPY a ctx (I'm deliberately not using copy constructor) to avoid
confusion with creating node with parent. Does not copy children
(except error leaves).
- enterRule
void enterRule(ParseTreeListener listener)
Undocumented in source. Be warned that the author may not have intended to support it.
- exitRule
void exitRule(ParseTreeListener listener)
Undocumented in source. Be warned that the author may not have intended to support it.
- addAnyChild
ParseTree addAnyChild(ParseTree t)
Add a parse tree node to this as a child. Works for
internal and leaf nodes. Does not set parent link;
other add methods must do that. Other addChild methods
call this.
- addChild
RuleContext addChild(RuleContext ruleInvocation)
Undocumented in source. Be warned that the author may not have intended to support it.
- addChild
TerminalNode addChild(TerminalNode t)
Add a token leaf node child and force its parent to be this node.
- removeLastChild
void removeLastChild()
Used by enterOuterAlt to toss out a RuleContext previously added as
we entered a rule. If we have # label, we will need to remove
generic ruleContext object.
- addChild
TerminalNode addChild(Token matchedToken)
Undocumented in source. Be warned that the author may not have intended to support it.
- addErrorNode
ErrorNode addErrorNode(Token badToken)
Undocumented in source. Be warned that the author may not have intended to support it.
- getParent
ParserRuleContext getParent()
Override to make type more specific
@uml
@override
- getChild
ParseTree getChild(int i)
- getChild
auto getChild(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
- getToken
TerminalNode getToken(int ttype, int i)
Undocumented in source. Be warned that the author may not have intended to support it.
- getTokens
TerminalNode[] getTokens(int ttype)
Undocumented in source. Be warned that the author may not have intended to support it.
- getRuleContext
T getRuleContext(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
- getRuleContexts
T[] getRuleContexts()
Undocumented in source. Be warned that the author may not have intended to support it.
- getChildCount
int getChildCount()
- getSourceInterval
Interval getSourceInterval()
- getStart
Token getStart()
Get the initial token in this context.
Note that the range from start to stop is inclusive, so for rules that do not consume anything
(for example, zero length or error productions) this token may exceed stop.
- getStop
Token getStop()
Get the final token in this context.
Note that the range from start to stop is inclusive, so for rules that do not consume anything
(for example, zero length or error productions) this token may precede start.
- toInfoString
string toInfoString(InterfaceParser recognizer)
Used for rule context info debugging during parse-time, not so much for ATN debugging
This class extends {@link ParserRuleContext} by allowing the value of {@link #getRuleIndex} to be explicitly set for the context.
<p> {@link ParserRuleContext} does not include field storage for the rule index since the context classes created by the code generator override the {@link #getRuleIndex} method to return the correct value for that context. Since the parser interpreter does not use the context classes generated for a parser, this class (with slightly more memory overhead per node) is used to provide equivalent functionality.</p>