Top Fields Constructors Methods
org.antlr.v4.tool

public Class LeftRecursiveRule

extends Rule
Class Inheritance
Imports
org.antlr.v4.analysis.LeftRecursiveRuleAltInfo, org.antlr.v4.misc.OrderedHashMap, org.antlr.v4.runtime.misc.Pair, org.antlr.v4.tool.ast.AltAST, .GrammarAST, .RuleAST, java.util.ArrayList, .HashMap, .List, .Map

Field Summary

Modifier and TypeField and Description
public List<Pair<GrammarAST, String>>
leftRecursiveRuleRefLabels

Did we delete any labels on direct left-recur refs?

public RuleAST
public OrderedHashMap<Integer, LeftRecursiveRuleAltInfo>
public List<LeftRecursiveRuleAltInfo>
Inherited from org.antlr.v4.tool.Rule:
actionIndexactionsaltargsastcaseInsensitiveexceptionsfinallyActiongindexisStartRulelocalsmodemodifiersnamenamedActionsnumberOfAltspredefinedRulePropertiesDictretvalsvalidLexerCommands

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Map<String, List<Pair<Integer, AltAST>>>
getAltLabels()

Overrides org.antlr.v4.tool.Rule.getAltLabels.

Get -> labels from those alts we deleted for left-recursive rules.
public RuleAST
public int
getOriginalNumberOfAlts()

Overrides org.antlr.v4.tool.Rule.getOriginalNumberOfAlts.

Used for recursive rules (subclass), which have 1 alt, but many original alts
public int[]
getPrimaryAlts()

Return an array that maps predicted alt from primary decision to original alt of rule.

public int[]
getRecursiveOpAlts()

Return an array that maps predicted alt from recursive op decision to original alt of rule.

public List<AltAST>
public boolean
Inherited from org.antlr.v4.tool.Rule:
defineActionInAltdefineLexerActiondefinePredicateInAltequalsgetAnyLabelDefgetElementLabelDefsgetElementLabelNamesgetPredefinedScopegetTokenRefshashCodeisFragmentresolveRetvalOrPropertyresolvesToAttributeDictresolvesToLabelresolvesToListLabelresolvesToTokenresolveToAttributeresolveToAttributeresolveToRuletoString

Field Detail

leftRecursiveRuleRefLabelsback to summary
public List<Pair<GrammarAST, String>> leftRecursiveRuleRefLabels

Did we delete any labels on direct left-recur refs? Points at ID of ^(= ID el)

originalASTback to summary
public RuleAST originalAST
recOpAltsback to summary
public OrderedHashMap<Integer, LeftRecursiveRuleAltInfo> recOpAlts
recPrimaryAltsback to summary
public List<LeftRecursiveRuleAltInfo> recPrimaryAlts

Constructor Detail

LeftRecursiveRuleback to summary
public LeftRecursiveRule(Grammar g, String name, RuleAST ast)

Method Detail

getAltLabelsback to summary
public Map<String, List<Pair<Integer, AltAST>>> getAltLabels()

Overrides org.antlr.v4.tool.Rule.getAltLabels.

Get -> labels from those alts we deleted for left-recursive rules.

Annotations
@Override
getOriginalASTback to summary
public RuleAST getOriginalAST()
getOriginalNumberOfAltsback to summary
public int getOriginalNumberOfAlts()

Overrides org.antlr.v4.tool.Rule.getOriginalNumberOfAlts.

Doc from org.antlr.v4.tool.Rule.getOriginalNumberOfAlts.

Used for recursive rules (subclass), which have 1 alt, but many original alts

Annotations
@Override
getPrimaryAltsback to summary
public int[] getPrimaryAlts()

Return an array that maps predicted alt from primary decision to original alt of rule. For following rule, return [0, 2, 4] e : e '*' e | INT | e '+' e | ID ; That maps predicted alt 1 to original alt 2 and predicted 2 to alt 4.

Since
4.5.1
getRecursiveOpAltsback to summary
public int[] getRecursiveOpAlts()

Return an array that maps predicted alt from recursive op decision to original alt of rule. For following rule, return [0, 1, 3] e : e '*' e | INT | e '+' e | ID ; That maps predicted alt 1 to original alt 1 and predicted 2 to alt 3.

Since
4.5.1
getUnlabeledAltASTsback to summary
public List<AltAST> getUnlabeledAltASTs()

Overrides org.antlr.v4.tool.Rule.getUnlabeledAltASTs.

Annotations
@Override
hasAltSpecificContextsback to summary
public boolean hasAltSpecificContexts()

Overrides org.antlr.v4.tool.Rule.hasAltSpecificContexts.

Annotations
@Override