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
public class RuleFunction extends OutputModelObject
-
-
Field Summary
Fields Modifier and Type Field Description Map<String,AltLabelStructDecl>
altLabelCtxs
AltLabelStructDecl[]
altToContext
Collection<AttributeDecl>
args
List<SrcOp>
code
String
ctxType
String
escapedName
List<ExceptionClause>
exceptions
Action
finallyAction
boolean
hasLookaheadBlock
int
index
OrderedHashSet<Decl>
locals
List<String>
modifiers
String
name
Map<String,Action>
namedActions
List<SrcOp>
postamble
Rule
rule
StructDecl
ruleCtx
Collection<String>
ruleLabels
ATNState
startState
Collection<String>
tokenLabels
-
Fields inherited from class org.antlr.v4.codegen.model.OutputModelObject
ast, factory
-
-
Constructor Summary
Constructors Constructor Description RuleFunction(OutputModelFactory factory, Rule r)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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)
List<Decl>
getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList, boolean optional)
Set<Decl>
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>>
getElementFrequenciesForAlt(AltAST ast)
Given list of X and r refs in alt, compute how many of each there are
-
-
-
Field Detail
-
name
public final String name
-
escapedName
public final String escapedName
-
ctxType
public String ctxType
-
ruleLabels
public final Collection<String> ruleLabels
-
tokenLabels
public final Collection<String> tokenLabels
-
startState
public final ATNState startState
-
index
public final int index
-
rule
public final Rule rule
-
altToContext
public final AltLabelStructDecl[] altToContext
-
hasLookaheadBlock
public boolean hasLookaheadBlock
-
locals
public OrderedHashSet<Decl> locals
-
args
public Collection<AttributeDecl> args
-
ruleCtx
public StructDecl ruleCtx
-
altLabelCtxs
public Map<String,AltLabelStructDecl> altLabelCtxs
-
finallyAction
public Action finallyAction
-
exceptions
public List<ExceptionClause> exceptions
-
-
Constructor Detail
-
RuleFunction
public RuleFunction(OutputModelFactory factory, Rule r)
-
-
Method Detail
-
addContextGetters
public void addContextGetters(OutputModelFactory factory, Rule r)
-
fillNamedActions
public void fillNamedActions(OutputModelFactory factory, Rule r)
-
getDeclsForAllElements
public Set<Decl> getDeclsForAllElements(List<AltAST> altASTs)
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.
-
getElementFrequenciesForAlt
protected Pair<FrequencySet<String>,FrequencySet<String>> getElementFrequenciesForAlt(AltAST ast)
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
public void addLocalDecl(Decl d)
Add local var decl
-
-