| Modifier and Type | Field and Description |
|---|---|
| public List | 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. |
| public static final ParserRuleContext | |
| public RecognitionException | exception
The exception that forced this rule to return. |
| public Token | start
For debugging/tracing purposes, we want to track all of the nodes in the ATN traversed by the parser for a particular rule. |
| public Token | stop
For debugging/tracing purposes, we want to track all of the nodes in the ATN traversed by the parser for a particular rule. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public <T extends ParseTree> T | |
| public RuleContext | |
| public TerminalNode | |
| public TerminalNode | |
| public ErrorNode | |
| public ErrorNode | |
| public void | copyFrom(ParserRuleContext ctx)
COPY a ctx (I'm deliberately not using copy constructor) to avoid confusion with creating node with parent. |
| public void | |
| public void | |
| public ParseTree | getChild(int i)
Overrides org. Implements org. ith value indexed from 0.
|
| public <T extends ParseTree> T | |
| public int | getChildCount()
Overrides org. Implements org. |
| public ParserRuleContext | getParent()
Overrides org. Implements org. |
| public <T extends ParserRuleContext> T | |
| public <T extends ParserRuleContext> List | |
| public Interval | getSourceInterval()
Overrides org. Implements org. Interval indicating the index in the
TokenStream of the first and last token associated with this
subtree.
|
| public Token | |
| public Token | |
| public TerminalNode | |
| public List | |
| public void | removeLastChild()
Used by enterOuterAlt to toss out a RuleContext previously added as we entered a rule. |
| public String | toInfoString(Parser recognizer)
Used for rule context info debugging during parse-time, not so much for ATN debugging |
| children | back to summary |
|---|---|
| public List<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. | |
| EMPTY | back to summary |
|---|---|
| public static final ParserRuleContext EMPTY | |
| exception | back to summary |
|---|---|
| public RecognitionException exception The exception that forced this rule to return. If the rule successfully
completed, this is | |
| start | back to summary |
|---|---|
| public Token start For debugging/tracing purposes, we want to track all of the nodes in the ATN traversed by the parser for a particular rule. This list indicates the sequence of ATN nodes used to match the elements of the children list. This list does not include ATN nodes and other rules used to match rule invocations. It traces the rule invocation node itself but nothing inside that other rule's ATN submachine. There is NOT a one-to-one correspondence between the children and states list. There are typically many nodes in the ATN traversed for each element in the children list. For example, for a rule invocation there is the invoking state and the following state. The parser setState() method updates field s and adds it to this list if we are debugging/tracing. This does not trace states visited during prediction. | |
| stop | back to summary |
|---|---|
| public Token stop For debugging/tracing purposes, we want to track all of the nodes in the ATN traversed by the parser for a particular rule. This list indicates the sequence of ATN nodes used to match the elements of the children list. This list does not include ATN nodes and other rules used to match rule invocations. It traces the rule invocation node itself but nothing inside that other rule's ATN submachine. There is NOT a one-to-one correspondence between the children and states list. There are typically many nodes in the ATN traversed for each element in the children list. For example, for a rule invocation there is the invoking state and the following state. The parser setState() method updates field s and adds it to this list if we are debugging/tracing. This does not trace states visited during prediction. | |
| ParserRuleContext | back to summary |
|---|---|
| public ParserRuleContext() | |
| ParserRuleContext | back to summary |
|---|---|
| public ParserRuleContext(ParserRuleContext parent, int invokingStateNumber) | |
| addAnyChild | back to summary |
|---|---|
| public <T extends ParseTree> T addAnyChild(T 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. We cannot set the parent pointer of the incoming node because the existing interfaces do not have a setParent() method and I don't want to break backward compatibility for this.
| |
| addChild | back to summary |
|---|---|
| public RuleContext addChild(RuleContext ruleInvocation) | |
| addChild | back to summary |
|---|---|
| public TerminalNode addChild(TerminalNode t) Add a token leaf node child and force its parent to be this node. | |
| addChild | back to summary |
|---|---|
| public TerminalNode addChild(Token matchedToken)
Deprecated
Add a child to this node based upon matchedToken. It
creates a TerminalNodeImpl rather than using
| |
| addErrorNode | back to summary |
|---|---|
| public ErrorNode addErrorNode(ErrorNode errorNode) Add an error node child and force its parent to be this node.
| |
| addErrorNode | back to summary |
|---|---|
| public ErrorNode addErrorNode(Token badToken)
Deprecated
Add a child to this node based upon badToken. It
creates a ErrorNodeImpl rather than using
| |
| copyFrom | back to summary |
|---|---|
| public 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). This is used in the generated parser code to flip a generic XContext node for rule X to a YContext for alt label Y. In that sense, it is not really a generic copy function. If we do an error sync() at start of a rule, we might add error nodes to the generic XContext so this function must copy those nodes to the YContext as well else they are lost! | |
| enterRule | back to summary |
|---|---|
| public void enterRule(ParseTreeListener listener) | |
| exitRule | back to summary |
|---|---|
| public void exitRule(ParseTreeListener listener) | |
| getChild | back to summary |
|---|---|
| public ParseTree getChild(int i) Overrides org. Implements org. Doc from org. If there are children, get the
| |
| getChild | back to summary |
|---|---|
| public <T extends ParseTree> T getChild(Class<? extends T> ctxType, int i) | |
| getChildCount | back to summary |
|---|---|
| public int getChildCount() Overrides org. Implements org. Doc from org. How many children are there? If there is none, then this node represents a leaf node.
| |
| getParent | back to summary |
|---|---|
| public ParserRuleContext getParent() Overrides org. Implements org. Doc from org. The parent of this node. If the return value is null, then this node is the root of the tree.
| |
| getRuleContext | back to summary |
|---|---|
| public <T extends ParserRuleContext> T getRuleContext(Class<? extends T> ctxType, int i) | |
| getRuleContexts | back to summary |
|---|---|
| public <T extends ParserRuleContext> List | |
| getSourceInterval | back to summary |
|---|---|
| public Interval getSourceInterval() Overrides org. Implements org. Doc from org. Return an An interval of i..i-1 indicates an empty interval at position i in the input stream, where 0 <= i <= the size of the input token stream. Currently, the code base can only have i=0..n-1 but in concept one could have an empty interval after EOF. If source interval is unknown, this returns As a weird special case, the source interval for rules matched after EOF is unspecified.
| |
| getStart | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public TerminalNode getToken(int ttype, int i) | |
| getTokens | back to summary |
|---|---|
| public List | |
| removeLastChild | back to summary |
|---|---|
| public 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 | back to summary |
|---|---|
| public String toInfoString(Parser recognizer) Used for rule context info debugging during parse-time, not so much for ATN debugging | |