Package org.antlr.v4.codegen.model
Class RuleFunction
java.lang.Object
org.antlr.v4.codegen.model.OutputModelObject
org.antlr.v4.codegen.model.RuleFunction
- Direct Known Subclasses:
LeftRecursiveRuleFunction
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AltLabelStructDecl[]
final String
boolean
final int
final String
final Rule
final Collection
<String> final ATNState
final Collection
<String> Fields inherited from class org.antlr.v4.codegen.model.OutputModelObject
ast, factory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addContextDecl
(String altLabel, Decl d) Add decl to struct ctx for rule or alt if labeledvoid
addContextGetters
(OutputModelFactory factory, Rule r) void
addLocalDecl
(Decl d) Add local var declvoid
fillNamedActions
(OutputModelFactory factory, Rule r) getDeclForAltElement
(GrammarAST t, String refLabelName, boolean needList, boolean optional) getDeclsForAllElements
(List<AltAST> altASTs) for all alts, find which ref X or r needs List Must see across alts.protected Pair
<FrequencySet<String>, FrequencySet<String>> Given list of X and r refs in alt, compute how many of each there areprivate String
getName
(GrammarAST token) private List
<GrammarAST> getRuleTokens
(List<GrammarAST> refs)
-
Field Details
-
name
-
escapedName
-
modifiers
-
ctxType
-
ruleLabels
-
tokenLabels
-
startState
-
index
public final int index -
rule
-
altToContext
-
hasLookaheadBlock
public boolean hasLookaheadBlock -
code
-
locals
-
args
-
ruleCtx
-
altLabelCtxs
-
namedActions
-
finallyAction
-
exceptions
-
postamble
-
-
Constructor Details
-
RuleFunction
-
-
Method Details
-
addContextGetters
-
fillNamedActions
-
getDeclsForAllElements
for all alts, find which ref X or r needs List Must see across alts. If any alt needs X or r as list, then define as list. -
getRuleTokens
-
getName
-
getElementFrequenciesForAlt
Given list of X and r refs in alt, compute how many of each there are -
getDeclForAltElement
public List<Decl> getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList, boolean optional) -
addLocalDecl
Add local var decl -
addContextDecl
Add decl to struct ctx for rule or alt if labeled
-