- addChild
TerminalNode addChild(TerminalNode t)
Does not set parent link; other add methods do that
- addChild
RuleContext addChild(RuleContext ruleInvocation)
Undocumented in source. Be warned that the author may not have intended to support it.
- 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.
- 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.
- 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.
- 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.
- getChildCount
int getChildCount()
- getParent
ParserRuleContext getParent()
Override to make type more specific
@uml
@override
- 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.
- 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.
- 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.
- 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.
- toInfoString
string toInfoString(InterfaceParser recognizer)
Used for rule context info debugging during parse-time, not so much for ATN debugging
- EMPTY
ParserRuleContext EMPTY;
Undocumented in source.
- parent
RuleContext parent;
Undocumented in source.
- invokingState
int invokingState;
Undocumented in source.
- depth
int depth()
Undocumented in source. Be warned that the author may not have intended to support it.
- isEmpty
bool isEmpty()
A context is empty if there is no invoking state; meaning nobody called
current context.
- getSourceInterval
Interval getSourceInterval()
satisfy the ParseTree / SyntaxTree interface
- getRuleContext
RuleContext getRuleContext()
Undocumented in source. Be warned that the author may not have intended to support it.
- getPayload
RuleContext getPayload()
Undocumented in source. Be warned that the author may not have intended to support it.
- getText
string getText()
Return the combined text of all child nodes. This method only considers
tokens which have been added to the parse tree.
<p>
Since tokens on hidden channels (e.g. whitespace or comments) are not
added to the parse trees, they will not appear in the output of this
method.
- getRuleIndex
int getRuleIndex()
Undocumented in source. Be warned that the author may not have intended to support it.
- getAltNumber
int getAltNumber()
For rule associated with this parse tree internal node, return
the outer alternative number used to match the input. Default
implementation does not compute nor store this alt num. Create
a subclass of ParserRuleContext with backing field and set
option contextSuperClass.
to set it.
- setAltNumber
void setAltNumber(int altNumber)
Set the outer alternative number for this context node. Default
implementation does nothing to avoid backing field overhead for
trees that don't need it. Create
a subclass of ParserRuleContext with backing field and set
option contextSuperClass.
- getChild
ParseTree getChild(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
- getChildCount
int getChildCount()
Undocumented in source. Be warned that the author may not have intended to support it.
- accept
U accept(ParseTreeVisitor!U visitor)
Undocumented in source. Be warned that the author may not have intended to support it.
- toStringTree
string toStringTree(InterfaceRecognizer recog)
Print out a whole tree, not just a node, in LISP format
(root child1 .. childN). Print just a node if this is a leaf.
We have to know the recognizer so we can get rule names.
- toStringTree
string toStringTree(string[] ruleNames)
Undocumented in source. Be warned that the author may not have intended to support it.
- toStringTree
string toStringTree()
Undocumented in source. Be warned that the author may not have intended to support it.
- toString
string toString()
- toString
string toString(InterfaceRecognizer recog)
Undocumented in source. Be warned that the author may not have intended to support it.
- toString
string toString(string[] ruleNames)
Undocumented in source. Be warned that the author may not have intended to support it.
- toString
string toString(InterfaceRecognizer recog, RuleContext stop)
recog null unless ParserRuleContext, in which case we use subclass toString(...)
- toString
string toString(string[] ruleNames, RuleContext stop)
Undocumented in source. Be warned that the author may not have intended to support it.
- getParent
RuleContext getParent()
Undocumented in source. Be warned that the author may not have intended to support it.
A rule invocation record for parsing.
Contains all of the information about the current rule not stored in the RuleContext. It handles parse tree children list, Any ATN state tracing, and the default values available for rule invocations: start, stop, rule index, current alt number.
Subclasses made for each rule and grammar track the parameters, return values, locals, and labels specific to that rule. These are the objects that are returned from rules.
Note text is not an actual field of a rule return value; it is computed from start and stop using the input stream's toString() method. I could add a ctor to this so that we can pass in and store the input stream, but I'm not sure we want to do that. It would seem to be undefined to get the .text property anyway if the rule matches tokens from multiple input streams.
I do not use getters for fields of objects that are used simply to group values such as this aggregate. The getters/setters are there to satisfy the superclass interface.