Package org.antlr.tool
Class Attribute
- java.lang.Object
-
- org.antlr.tool.Attribute
-
public class Attribute extends Object
Track the names of attributes define in arg lists, return values, scope blocks etc...
-
-
Field Summary
Fields Modifier and Type Field Description String
decl
The entire declaration such as "String foo;"String
initValue
The optional attribute intialization expressionString
name
The name of the attribute "foo"String
type
The type; might be empty such as for Python which has no static typing
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
extractAttribute(String decl)
For decls like "String foo" or "char *foo32[3]" compute the ID and type declarations.String
toString()
-
-
-
Field Detail
-
decl
public String decl
The entire declaration such as "String foo;"
-
type
public String type
The type; might be empty such as for Python which has no static typing
-
name
public String name
The name of the attribute "foo"
-
initValue
public String initValue
The optional attribute intialization expression
-
-
Method Detail
-
extractAttribute
protected void extractAttribute(String decl)
For decls like "String foo" or "char *foo32[3]" compute the ID and type declarations. Also handle "int x=3" and 'T t = new T("foo")' but if the separator is ',' you cannot use ',' in the initvalue. AttributeScope.addAttributes takes care of the separation so we are free here to use from '=' to end of string as the expression. Set name, type, initvalue, and full decl instance vars.
-
-