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>altLabelCtxsAltLabelStructDecl[]altToContextCollection<AttributeDecl>argsList<SrcOp>codeStringctxTypeStringescapedNameList<ExceptionClause>exceptionsActionfinallyActionbooleanhasLookaheadBlockintindexOrderedHashSet<Decl>localsList<String>modifiersStringnameMap<String,Action>namedActionsList<SrcOp>postambleRuleruleStructDeclruleCtxCollection<String>ruleLabelsATNStatestartStateCollection<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 voidaddContextDecl(String altLabel, Decl d)Add decl to struct ctx for rule or alt if labeledvoidaddContextGetters(OutputModelFactory factory, Rule r)voidaddLocalDecl(Decl d)Add local var declvoidfillNamedActions(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
-
-