Top Description Fields Constructors Methods
org.antlr.tool

public Class Attribute

extends Object
Class Inheritance

Track the names of attributes define in arg lists, return values, scope blocks etc...

Field Summary

Modifier and TypeField and Description
public String
decl

The entire declaration such as "String foo;"

public String
initValue

The optional attribute intialization expression

public String
name

The name of the attribute "foo"

public String
type

The type; might be empty such as for Python which has no static typing

Constructor Summary

AccessConstructor and Description
public
public
Attribute(String name, String decl)

Method Summary

Modifier and TypeMethod and Description
protected void
extractAttribute(String decl)

For decls like "String foo" or "char *foo32[3]" compute the ID and type declarations.

public String
toString()

Overrides java.lang.Object.toString.

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

Field Detail

declback to summary
public String decl

The entire declaration such as "String foo;"

initValueback to summary
public String initValue

The optional attribute intialization expression

nameback to summary
public String name

The name of the attribute "foo"

typeback to summary
public String type

The type; might be empty such as for Python which has no static typing

Constructor Detail

Attributeback to summary
public Attribute(String decl)
Attributeback to summary
public Attribute(String name, String decl)

Method Detail

extractAttributeback to summary
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.

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