Package org.antlr.v4.runtime
Class InterpreterRuleContext
- java.lang.Object
-
- org.antlr.v4.runtime.RuleContext
-
- org.antlr.v4.runtime.ParserRuleContext
-
- org.antlr.v4.runtime.InterpreterRuleContext
-
- All Implemented Interfaces:
ParseTree
,RuleNode
,SyntaxTree
,Tree
public class InterpreterRuleContext extends ParserRuleContext
This class extendsParserRuleContext
by allowing the value ofgetRuleIndex()
to be explicitly set for the context.ParserRuleContext
does not include field storage for the rule index since the context classes created by the code generator override thegetRuleIndex()
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.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
ruleIndex
This is the backing field forgetRuleIndex()
.-
Fields inherited from class org.antlr.v4.runtime.ParserRuleContext
children, exception, start, stop
-
Fields inherited from class org.antlr.v4.runtime.RuleContext
EMPTY, invokingState, parent
-
-
Constructor Summary
Constructors Constructor Description InterpreterRuleContext()
InterpreterRuleContext(ParserRuleContext parent, int invokingStateNumber, int ruleIndex)
Constructs a newInterpreterRuleContext
with the specified parent, invoking state, and rule index.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getRuleIndex()
-
Methods inherited from class org.antlr.v4.runtime.ParserRuleContext
addAnyChild, addChild, addChild, addChild, addErrorNode, addErrorNode, copyFrom, enterRule, exitRule, getChild, getChild, getChildCount, getParent, getRuleContext, getRuleContexts, getSourceInterval, getStart, getStop, getToken, getTokens, removeLastChild, toInfoString
-
Methods inherited from class org.antlr.v4.runtime.RuleContext
accept, depth, getAltNumber, getPayload, getRuleContext, getText, isEmpty, setAltNumber, setParent, toString, toString, toString, toString, toString, toStringTree, toStringTree, toStringTree
-
-
-
-
Field Detail
-
ruleIndex
protected int ruleIndex
This is the backing field forgetRuleIndex()
.
-
-
Constructor Detail
-
InterpreterRuleContext
public InterpreterRuleContext()
-
InterpreterRuleContext
public InterpreterRuleContext(ParserRuleContext parent, int invokingStateNumber, int ruleIndex)
Constructs a newInterpreterRuleContext
with the specified parent, invoking state, and rule index.- Parameters:
parent
- The parent context.invokingStateNumber
- The invoking state number.ruleIndex
- The rule index for the current context.
-
-
Method Detail
-
getRuleIndex
public int getRuleIndex()
- Overrides:
getRuleIndex
in classRuleContext
-
-