|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.antlr.tool.AttributeScope
public class AttributeScope
Track 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.
| Field Summary | |
|---|---|
LinkedHashMap<String,GrammarAST> |
actions
|
protected LinkedHashMap<String,Attribute> |
attributes
The list of Attribute objects |
Token |
derivedFromToken
This scope is associated with which input token (for error handling)? |
Grammar |
grammar
|
boolean |
isDynamicGlobalScope
Not a rule scope, but visible to all rules "scope symbols { ...}" |
boolean |
isDynamicRuleScope
Visible to all rules, but defined in rule "scope { int i; }" |
boolean |
isParameterScope
|
boolean |
isPredefinedLexerRuleScope
|
boolean |
isPredefinedRuleScope
|
boolean |
isReturnScope
|
static AttributeScope |
tokenScope
All token scopes (token labels) share the same fixed scope of of predefined attributes. |
| Constructor Summary | |
|---|---|
AttributeScope(Grammar grammar,
String name,
Token derivedFromToken)
|
|
AttributeScope(String name,
Token derivedFromToken)
|
|
| Method Summary | |
|---|---|
void |
addAttribute(String name,
String decl)
|
void |
addAttributes(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. |
void |
defineNamedAction(GrammarAST nameAST,
GrammarAST actionAST)
Given @scope::name {action} define it for this attribute scope. |
Attribute |
getAttribute(String name)
|
List<Attribute> |
getAttributes()
Used by templates to get all attributes |
String |
getName()
|
Set |
intersection(AttributeScope other)
Return the set of keys that collide from this and other. |
int |
size()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static AttributeScope tokenScope
public Token derivedFromToken
public Grammar grammar
public boolean isDynamicGlobalScope
public boolean isDynamicRuleScope
public boolean isParameterScope
public boolean isReturnScope
public boolean isPredefinedRuleScope
public boolean isPredefinedLexerRuleScope
protected LinkedHashMap<String,Attribute> attributes
public LinkedHashMap<String,GrammarAST> actions
| Constructor Detail |
|---|
public AttributeScope(String name,
Token derivedFromToken)
public AttributeScope(Grammar grammar,
String name,
Token derivedFromToken)
| Method Detail |
|---|
public String getName()
public void addAttributes(String definitions,
int separator)
public void addAttribute(String name,
String decl)
public final void defineNamedAction(GrammarAST nameAST,
GrammarAST actionAST)
public Attribute getAttribute(String name)
public List<Attribute> getAttributes()
public Set intersection(AttributeScope other)
public int size()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||