程序包 org.antlr.tool
类 AttributeScope
- java.lang.Object
-
- org.antlr.tool.AttributeScope
-
- 直接已知子类:
RuleLabelScope
public class AttributeScope extends java.lang.ObjectTrack the attributes within a scope. A named scoped has just its list of attributes. 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.
-
-
字段概要
字段 修饰符和类型 字段 说明 java.util.LinkedHashMap<java.lang.String,GrammarAST>actionsprotected java.util.LinkedHashMap<java.lang.String,Attribute>attributesThe list of Attribute objectsTokenderivedFromTokenThis scope is associated with which input token (for error handling)?GrammargrammarbooleanisDynamicGlobalScopeNot a rule scope, but visible to all rules "scope symbols { ...}"booleanisDynamicRuleScopeVisible to all rules, but defined in rule "scope { int i; }"booleanisParameterScopebooleanisPredefinedLexerRuleScopebooleanisPredefinedRuleScopebooleanisReturnScopestatic AttributeScopetokenScopeAll token scopes (token labels) share the same fixed scope of of predefined attributes.
-
构造器概要
构造器 构造器 说明 AttributeScope(java.lang.String name, Token derivedFromToken)AttributeScope(Grammar grammar, java.lang.String name, Token derivedFromToken)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddAttribute(java.lang.String name, java.lang.String decl)voidaddAttributes(java.lang.String definitions, int separator)From a chunk of text holding the definitions of the attributes, pull them apart and create an Attribute for each one.voiddefineNamedAction(GrammarAST nameAST, GrammarAST actionAST)Given @scope::name {action} define it for this attribute scope.AttributegetAttribute(java.lang.String name)java.util.List<Attribute>getAttributes()Used by templates to get all attributesjava.lang.StringgetName()java.util.Set<java.lang.String>intersection(AttributeScope other)Return the set of keys that collide from this and other.intsize()java.lang.StringtoString()
-
-
-
字段详细资料
-
tokenScope
public static final AttributeScope tokenScope
All token scopes (token labels) share the same fixed scope of of predefined attributes. I keep this out of the runtime.Token object to avoid a runtime space burden.
-
derivedFromToken
public Token derivedFromToken
This scope is associated with which input token (for error handling)?
-
grammar
public Grammar grammar
-
isDynamicGlobalScope
public boolean isDynamicGlobalScope
Not a rule scope, but visible to all rules "scope symbols { ...}"
-
isDynamicRuleScope
public boolean isDynamicRuleScope
Visible to all rules, but defined in rule "scope { int i; }"
-
isParameterScope
public boolean isParameterScope
-
isReturnScope
public boolean isReturnScope
-
isPredefinedRuleScope
public boolean isPredefinedRuleScope
-
isPredefinedLexerRuleScope
public boolean isPredefinedLexerRuleScope
-
attributes
protected java.util.LinkedHashMap<java.lang.String,Attribute> attributes
The list of Attribute objects
-
actions
public java.util.LinkedHashMap<java.lang.String,GrammarAST> actions
-
-
方法详细资料
-
getName
public java.lang.String getName()
-
addAttributes
public void addAttributes(java.lang.String definitions, int separator)From a chunk of text holding the definitions of the attributes, pull them apart and create an Attribute for each one. Add to the list of attributes for this scope. Pass in the character that terminates a definition such as ',' or ';'. For example, scope symbols { int n; List names; } would pass in definitions equal to the text in between {...} and separator=';'. It results in two Attribute objects.
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.String decl)
-
defineNamedAction
public final void defineNamedAction(GrammarAST nameAST, GrammarAST actionAST)
Given @scope::name {action} define it for this attribute scope. Later, the code generator will ask for the actions table.
-
getAttribute
public Attribute getAttribute(java.lang.String name)
-
getAttributes
public java.util.List<Attribute> getAttributes()
Used by templates to get all attributes
-
intersection
public java.util.Set<java.lang.String> intersection(AttributeScope other)
Return the set of keys that collide from this and other.
-
size
public int size()
-
toString
public java.lang.String toString()
- 覆盖:
toString在类中java.lang.Object
-
-