Top Description Inners Fields Constructors Methods
org.antlr.v4.tool

public Class AttributeDict

extends Object
Class Inheritance
Imports
org.antlr.v4.runtime.Token, org.antlr.v4.tool.ast.GrammarAST, java.util.Collections, .HashSet, .LinkedHashMap, .Set

Track the attributes within retval, arg lists etc...

Each rule has potentially 3 scopes: return values, parameters, and an implicitly-named scope (i.e., a scope defined in a rule). Implicitly-defined scopes are named after the rule; rules and scopes then must live in the same name space--no collisions allowed.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
public GrammarAST
public final LinkedHashMap<String, Attribute>
attributes

The list of Attribute objects.

public String
public static final AttributeDict
predefinedTokenDict

All Token scopes (token labels) share the same fixed scope of of predefined attributes.

public AttributeDict.DictType

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public Attribute
public Attribute
get(String name)

public String
public Set<String>
intersection(AttributeDict other)

Return the set of keys that collide from this and other.

public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

astback to summary
public GrammarAST ast
attributesback to summary
public final LinkedHashMap<String, Attribute> attributes

The list of Attribute objects.

nameback to summary
public String name
predefinedTokenDictback to summary
public static final AttributeDict predefinedTokenDict

All Token scopes (token labels) share the same fixed scope of of predefined attributes. I keep this out of the Token interface to avoid a runtime type leakage.

typeback to summary
public AttributeDict.DictType type

Constructor Detail

AttributeDictback to summary
public AttributeDict()
AttributeDictback to summary
public AttributeDict(AttributeDict.DictType type)

Method Detail

addback to summary
public Attribute add(Attribute a)
getback to summary
public Attribute get(String name)
getNameback to summary
public String getName()
intersectionback to summary
public Set<String> intersection(AttributeDict other)

Return the set of keys that collide from this and other.

sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
org.antlr.v4.tool back to summary

public final Enum AttributeDict.DictType

extends Enum<AttributeDict.DictType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final AttributeDict.DictType
public static final AttributeDict.DictType
public static final AttributeDict.DictType
public static final AttributeDict.DictType
public static final AttributeDict.DictType
public static final AttributeDict.DictType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AttributeDict.DictType
public static AttributeDict.DictType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ARGback to summary
public static final AttributeDict.DictType ARG
LOCALback to summary
public static final AttributeDict.DictType LOCAL
PREDEFINED_LEXER_RULEback to summary
public static final AttributeDict.DictType PREDEFINED_LEXER_RULE
PREDEFINED_RULEback to summary
public static final AttributeDict.DictType PREDEFINED_RULE
RETback to summary
public static final AttributeDict.DictType RET
TOKENback to summary
public static final AttributeDict.DictType TOKEN

Constructor Detail

DictTypeback to summary
private DictType()

Method Detail

valueOfback to summary
public static AttributeDict.DictType valueOf(String name)
valuesback to summary
public static AttributeDict.DictType[] values()