public class NestedDeclarator extends Declarator implements Symbol
| Constructor and Description |
|---|
NestedDeclarator(Declarator nested_decl)
Constructs a new nested declarator with the given child declarator.
|
NestedDeclarator(Declarator nested_decl,
java.util.List params)
Constructs a new nested declarator with the given child declarator and the
list of parameters.
|
NestedDeclarator(java.util.List leading_specs,
Declarator nested_decl,
java.util.List params)
Constructs a new nested declarator with the given list of leading
specifiers, the child declarator, and the list of parameters.
|
NestedDeclarator(java.util.List leading_specs,
Declarator nested_decl,
java.util.List params,
java.util.List trailing_specs)
Constructs a new nested declarator with the given list of leading
specifers, the child declarator, the list of parameters, and the list of
trailing specifiers.
|
NestedDeclarator(Specifier spec,
Declarator nested_decl,
java.util.List params)
Constructs a new nested declarator with the given leading specifier, the
child declarator, and the list of parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(Declaration decl)
Inserts a new parameter declaration to the nested declarator.
|
void |
addParameterAfter(Declaration ref,
Declaration decl)
Inserts a new parameter declaration to the nested declarator after the
reference parameter declaration.
|
void |
addParameterBefore(Declaration ref,
Declaration decl)
Inserts a new parameter declaration to the nested declarator before the
reference parameter declaration.
|
NestedDeclarator |
clone()
Returns a clone of the nested declarator.
|
static void |
defaultPrint(NestedDeclarator d,
java.io.PrintWriter o)
Prints a nested declarator to a stream.
|
java.util.List |
getArraySpecifiers()
Returns the list of specifiers trailing the declarator.
|
Declaration |
getDeclaration()
Returns the parent declaration containing the symbol object.
|
Declarator |
getDeclarator()
Returns the child declarator of the nested declarator.
|
IDExpression |
getID()
Returns the name ID declared by the nested declarator.
|
Initializer |
getInitializer()
Returns the initializer of the nested declarator.
|
java.util.List<Declaration> |
getParameters()
Returns the list of parameters if the declarator represents a function.
|
java.lang.String |
getSymbolName()
Returns the name of the symbol.
|
java.util.List |
getTypeSpecifiers()
Returns a list of type specifiers.
|
boolean |
isProcedure()
Checks if the nested declarator is used to represent a procedure call.
|
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 for the nested declarator.
|
void |
setName(java.lang.String name)
Modify the name of the symbol.
|
addTrailingSpecifier, defaultPrint, equals, getChildren, getParameter, getParent, getSpecifiers, hashCode, print, removeChild, setChild, setParent, toStringpublic NestedDeclarator(Declarator nested_decl)
nested_decl - the child declarator to be added.public NestedDeclarator(Declarator nested_decl, java.util.List params)
nested_decl - the child declarator to be added.params - the list of parameters.public NestedDeclarator(java.util.List leading_specs,
Declarator nested_decl,
java.util.List params)
leading_specs - the list of leading specifiers.nested_decl - the child declarator to be added.params - the list of parameters.public NestedDeclarator(Specifier spec, Declarator nested_decl, java.util.List params)
spec - the leading specifier.nested_decl - the child declarator to be added.params - the list of parameters.public NestedDeclarator(java.util.List leading_specs,
Declarator nested_decl,
java.util.List params,
java.util.List trailing_specs)
leading_specs - the list of leading specifiers.nested_decl - the child declarator to be added.params - the list of parameters.trailing_specs - the list of trailing specifiers.public void addParameter(Declaration decl)
addParameter in class Declaratordecl - the new parameter declaration to be added.public void addParameterBefore(Declaration ref, Declaration decl)
addParameterBefore in class Declaratorref - the reference parameter declaration.decl - the new parameter declaration to be added.public void addParameterAfter(Declaration ref, Declaration decl)
addParameterAfter in class Declaratorref - the reference parameter declaration.decl - the new parameter declaration to be added.public NestedDeclarator clone()
clone in class Declaratorpublic static void defaultPrint(NestedDeclarator d, java.io.PrintWriter o)
d - The declarator to print.o - The writer on which to print the declarator.public Declarator getDeclarator()
public java.util.List<Declaration> getParameters()
getParameters in class Declaratornull otherwise.public IDExpression getID()
getID in class Declaratorpublic 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 boolean isProcedure()
public java.util.List getTypeSpecifiers()
SymbolgetTypeSpecifiers in interface Symbolpublic java.lang.String getSymbolName()
SymbolgetSymbolName 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 Symbol