Top Fields Constructors Methods
org.antlr.v4.codegen.model

public Class RuleFunction

extends OutputModelObject
Class Inheritance
Known Direct Subclasses
org.antlr.v4.codegen.model.LeftRecursiveRuleFunction
Imports
org.antlr.runtime.RecognitionException, org.antlr.runtime.tree.CommonTree, .CommonTreeNodeStream, org.antlr.v4.codegen.OutputModelFactory, org.antlr.v4.codegen.model.decl.AltLabelStructDecl, .AttributeDecl, .ContextRuleGetterDecl, .ContextRuleListGetterDecl, .ContextRuleListIndexedGetterDecl, .ContextTokenGetterDecl, .ContextTokenListGetterDecl, .ContextTokenListIndexedGetterDecl, .Decl, .StructDecl, org.antlr.v4.misc.FrequencySet, .Utils, org.antlr.v4.parse.GrammarASTAdaptor, org.antlr.v4.runtime.atn.ATNState, org.antlr.v4.runtime.misc.IntervalSet, .OrderedHashSet, .Pair, org.antlr.v4.tool.Attribute, .ErrorType, .Rule, org.antlr.v4.tool.ast.ActionAST, .AltAST, .GrammarAST, .PredAST, java.util.ArrayList, .Collection, .HashMap, .HashSet, .LinkedHashSet, .List, .Map, .Set

Field Summary

Modifier and TypeField and Description
public Map<String, AltLabelStructDecl>
public final AltLabelStructDecl[]
public Collection<AttributeDecl>
public List<SrcOp>
public String
public final String
public List<ExceptionClause>
public Action
public boolean
public final int
public OrderedHashSet<Decl>
public final List<String>
public final String
public Map<String, Action>
public List<SrcOp>
public final Rule
public StructDecl
public final Collection<String>
public final ATNState
public final Collection<String>
Inherited from org.antlr.v4.codegen.model.OutputModelObject:
astfactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addContextDecl(String altLabel, Decl d)

Add decl to struct ctx for rule or alt if labeled

public void
public void
addLocalDecl(Decl d)

Add local var decl

public void
public List<Decl>
getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList, boolean optional)

public 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

private String
private List<GrammarAST>

Field Detail

altLabelCtxsback to summary
public Map<String, AltLabelStructDecl> altLabelCtxs
Annotations
@ModelElement
altToContextback to summary
public final AltLabelStructDecl[] altToContext
argsback to summary
public Collection<AttributeDecl> args
Annotations
@ModelElement
codeback to summary
public List<SrcOp> code
Annotations
@ModelElement
ctxTypeback to summary
public String ctxType
escapedNameback to summary
public final String escapedName
exceptionsback to summary
public List<ExceptionClause> exceptions
Annotations
@ModelElement
finallyActionback to summary
public Action finallyAction
Annotations
@ModelElement
hasLookaheadBlockback to summary
public boolean hasLookaheadBlock
indexback to summary
public final int index
localsback to summary
public OrderedHashSet<Decl> locals
Annotations
@ModelElement
modifiersback to summary
public final List<String> modifiers
nameback to summary
public final String name
namedActionsback to summary
public Map<String, Action> namedActions
Annotations
@ModelElement
postambleback to summary
public List<SrcOp> postamble
Annotations
@ModelElement
ruleback to summary
public final Rule rule
ruleCtxback to summary
public StructDecl ruleCtx
Annotations
@ModelElement
ruleLabelsback to summary
public final Collection<String> ruleLabels
startStateback to summary
public final ATNState startState
tokenLabelsback to summary
public final Collection<String> tokenLabels

Constructor Detail

RuleFunctionback to summary
public RuleFunction(OutputModelFactory factory, Rule r)

Method Detail

addContextDeclback to summary
public void addContextDecl(String altLabel, Decl d)

Add decl to struct ctx for rule or alt if labeled

addContextGettersback to summary
public void addContextGetters(OutputModelFactory factory, Rule r)
addLocalDeclback to summary
public void addLocalDecl(Decl d)

Add local var decl

fillNamedActionsback to summary
public void fillNamedActions(OutputModelFactory factory, Rule r)
getDeclForAltElementback to summary
public List<Decl> getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList, boolean optional)
getDeclsForAllElementsback to summary
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.

getElementFrequenciesForAltback to summary
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

getNameback to summary
private String getName(GrammarAST token)
getRuleTokensback to summary
private List<GrammarAST> getRuleTokens(List<GrammarAST> refs)