Package org.antlr.v4.tool
Class Alternative
java.lang.Object
org.antlr.v4.tool.Alternative
- All Implemented Interfaces:
AttributeResolver
An outermost alternative for a rule. We don't track inner alternatives.
-
Field Summary
FieldsModifier and TypeFieldDescriptionTrack all executable actions other than named actions like @init and catch/finally (not in an alt).int
What alternative number is this outermost alt? 1..norg.stringtemplate.v4.misc.MultiMap
<String, LabelElementPair> A list of all LabelElementPair attached to tokens like id=ID, ids+=IDorg.stringtemplate.v4.misc.MultiMap
<String, GrammarAST> org.stringtemplate.v4.misc.MultiMap
<String, GrammarAST> org.stringtemplate.v4.misc.MultiMap
<String, TerminalAST> org.stringtemplate.v4.misc.MultiMap
<String, GrammarAST> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
resolvesToAttributeDict
(String x, ActionAST node) boolean
resolvesToLabel
(String x, ActionAST node) boolean
resolvesToListLabel
(String x, ActionAST node) boolean
resolvesToToken
(String x, ActionAST node) resolveToAttribute
(String x, String y, ActionAST node) $x.y, x can be surrounding rule, token/rule/label ref.resolveToAttribute
(String x, ActionAST node) $x Attribute: rule arguments, return values, predefined rule prop.x can be ruleref or rule label.
-
Field Details
-
rule
-
ast
-
altNum
public int altNumWhat alternative number is this outermost alt? 1..n -
tokenRefs
-
tokenRefsInActions
-
ruleRefs
-
ruleRefsInActions
-
labelDefs
A list of all LabelElementPair attached to tokens like id=ID, ids+=ID -
actions
Track all executable actions other than named actions like @init and catch/finally (not in an alt). Also tracks predicates, rewrite actions. We need to examine these actions before code generation so that we can detect refs to $rule.attr etc... This tracks per alt
-
-
Constructor Details
-
Alternative
-
-
Method Details
-
resolvesToToken
- Specified by:
resolvesToToken
in interfaceAttributeResolver
-
resolvesToAttributeDict
- Specified by:
resolvesToAttributeDict
in interfaceAttributeResolver
-
resolveToAttribute
$x Attribute: rule arguments, return values, predefined rule prop.- Specified by:
resolveToAttribute
in interfaceAttributeResolver
-
resolveToAttribute
$x.y, x can be surrounding rule, token/rule/label ref. y is visible attr in that dictionary. Can't see args on rule refs.- Specified by:
resolveToAttribute
in interfaceAttributeResolver
-
resolvesToLabel
- Specified by:
resolvesToLabel
in interfaceAttributeResolver
-
resolvesToListLabel
- Specified by:
resolvesToListLabel
in interfaceAttributeResolver
-
getAnyLabelDef
-
resolveToRule
x can be ruleref or rule label.
-