public class VariableDeclarator extends Declarator implements Symbol
| Constructor and Description |
|---|
VariableDeclarator(IDExpression direct_decl)
Constructs a new VariableDeclarator with the given ID.
|
VariableDeclarator(IDExpression direct_decl,
java.util.List trailing_specs)
Constructs a new variable declarator with the given ID and the trailing
specifiers.
|
VariableDeclarator(IDExpression direct_decl,
Specifier spec)
Constructs a new variable declarator with the given name ID and the
trailing specifier.
|
VariableDeclarator(java.util.List leading_specs,
IDExpression direct_decl)
Constructs a new variable declarator with the given leading specifiers and
the name ID.
|
VariableDeclarator(java.util.List leading_specs,
IDExpression direct_decl,
java.util.List trailing_specs)
Constructs a new variable declarator with the given leading specifiers,
the name ID, and the trailing specifiers.
|
VariableDeclarator(Specifier spec,
IDExpression direct_decl)
Constructs a new variable declarator with the given leading specifier and
the name ID.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(Declaration decl)
Inserts a new child declaration to the parameter list.
|
void |
addParameterAfter(Declaration ref,
Declaration decl)
Inserts a new child declaration to the parameter list after the given
reference declaration.
|
void |
addParameterBefore(Declaration ref,
Declaration decl)
Inserts a new child declaration to the parameter list before the given
reference declaration.
|
VariableDeclarator |
clone()
Returns a clone of this variable declarator.
|
static void |
defaultPrint(VariableDeclarator d,
java.io.PrintWriter o)
Prints a variable declarator to a stream.
|
boolean |
equals(java.lang.Object obj)
Checks if the given Object obj refers to the same Symbol as this
Symbol.
|
java.util.List |
getArraySpecifiers()
Returns the list of specifiers trailing the declarator.
|
Declaration |
getDeclaration()
Returns the parent declaration containing the symbol object.
|
IDExpression |
getID()
Returns the name ID of this variable declarator.
|
Initializer |
getInitializer()
Returns the initializer of this variable declarator.
|
java.util.List<Declaration> |
getParameters()
Returns a List of Function Parameter
|
java.util.List |
getSpecifiers()
Returns the list of leading specifiers of this variable declarator.
|
java.lang.String |
getSymbolName()
Returns the name of the symbol.
|
java.util.List |
getTrailingSpecifiers()
Returns the list of trailing specifiers of this variable declarator.
|
java.util.List |
getTypeSpecifiers()
Returns a list of type specifiers.
|
int |
hashCode()
If there are multiple Symbols with external linkage and same name,
hashCode() returns same value for those symbols
|
static void |
setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently
created objects will use the supplied method.
|
void |
setInitializer(Initializer init)
Assigns a new initializer init for the variable declarator.
|
void |
setName(java.lang.String name)
Modify the name of the symbol.
|
addTrailingSpecifier, defaultPrint, getChildren, getParameter, getParent, print, removeChild, setChild, setParent, toStringpublic VariableDeclarator(IDExpression direct_decl)
NameID object for
direct_decl since the constructor internally assigns a new
NameID if direct_decl is not an instanceof NameID.direct_decl - the given name ID for the new variable declarator.public VariableDeclarator(IDExpression direct_decl, java.util.List trailing_specs)
NameID object for
direct_decl since the constructor internally assigns a new
NameID if direct_decl is not an instanceof NameID.direct_decl - the given name ID.trailing_specs - the list of trailing specifiers.public VariableDeclarator(IDExpression direct_decl, Specifier spec)
NameID object for
direct_decl since the constructor internally assigns a new
NameID if direct_decl is not an instanceof NameID.direct_decl - the given name ID.spec - the given trailing specifier.public VariableDeclarator(java.util.List leading_specs,
IDExpression direct_decl)
NameID object for
direct_decl since the constructor internally assigns a new
NameID if direct_decl is not an instanceof NameID.leading_specs - the list of leading specifiers.direct_decl - the given name ID.public VariableDeclarator(java.util.List leading_specs,
IDExpression direct_decl,
java.util.List trailing_specs)
NameID object for
direct_decl since the constructor internally assigns a new
NameID if direct_decl is not an instanceof NameID.leading_specs - the list of leading specifiers.direct_decl - the given name ID.trailing_specs - the list of trailing specifiers.public VariableDeclarator(Specifier spec, IDExpression direct_decl)
NameID object for
direct_decl since the constructor internally assigns a new
NameID if direct_decl is not an instanceof NameID.spec - the given leading specifier.direct_decl - the given name ID.public VariableDeclarator clone()
clone in class Declaratorpublic static void defaultPrint(VariableDeclarator d, java.io.PrintWriter o)
d - The declarator to print.o - The writer on which to print the declarator.public IDExpression getID()
getID in class Declaratorpublic java.util.List getSpecifiers()
getSpecifiers in class Declaratorpublic java.util.List getTrailingSpecifiers()
public static void setClassPrintMethod(java.lang.reflect.Method m)
m - The new print method.public Initializer getInitializer()
getInitializer in class Declaratorpublic void setInitializer(Initializer init)
setInitializer in class Declaratorinit - An initial value for the variable.public java.lang.String getSymbolName()
SymbolgetSymbolName in interface Symbolpublic java.util.List getTypeSpecifiers()
SymbolgetTypeSpecifiers in interface Symbolpublic java.util.List getArraySpecifiers()
DeclaratorgetArraySpecifiers in interface SymbolgetArraySpecifiers in class Declaratorpublic void setName(java.lang.String name)
Symbolextern variables and
procedure names are not automatically handled.public Declaration getDeclaration()
SymbolgetDeclaration in interface Symbolpublic java.util.List<Declaration> getParameters()
DeclaratorgetParameters in class Declaratorpublic void addParameter(Declaration decl)
DeclaratoraddParameter in class Declaratordecl - the new parameter declaration to be inserted.public void addParameterAfter(Declaration ref, Declaration decl)
DeclaratoraddParameterAfter in class Declaratorref - the reference parameter declaration.decl - the new parameter declaration to be inserted.public void addParameterBefore(Declaration ref, Declaration decl)
DeclaratoraddParameterBefore in class Declaratorref - the reference parameter declaration.decl - the new parameter declaration to be inserted.public boolean equals(java.lang.Object obj)
equals in class Declaratorobj - public int hashCode()
hashCode in class Declarator