public class VariableDeclaration extends Declaration
Constructor and Description |
---|
VariableDeclaration(Declarator declarator)
Creates a variable declaration that does not use specifiers, such
as for a constructor prototype.
|
VariableDeclaration(java.util.List specs)
Creates a parameter declaration for a procedure, where the
parameter is unnamed but its type is specified.
|
VariableDeclaration(java.util.List specs,
Declarator declarator)
Creates a variable declaration that has multiple specifiers, such
as for unsigned int x.
|
VariableDeclaration(java.util.List specs,
java.util.List declarator_list)
Creates a declaration of multiple variables that has multiple specifiers,
such as for unsigned int x, y, z.
|
VariableDeclaration(Specifier spec,
Declarator declarator)
Creates a variable declaration that has only one specifier, such
as for int x.
|
VariableDeclaration(Specifier spec,
java.util.List declarator_list)
Creates a declaration of multiple variables that has only one specifier,
such as for int x, y, z.
|
Modifier and Type | Method and Description |
---|---|
void |
addDeclarator(Declarator declarator)
Adds another declarator to this declaration.
|
VariableDeclaration |
clone()
Creates and returns a deep copy of this declaration.
|
static void |
defaultPrint(VariableDeclaration d,
java.io.PrintWriter o)
Prints a declaration to a stream.
|
Declarator |
getDeclarator(int n)
Returns the nth declarator in this declaration.
|
java.util.List<IDExpression> |
getDeclaredIDs()
Returns a list of name ID introduced by this declaration.
|
java.util.List<Symbol> |
getDeclaredSymbols()
Returns the list of symbols being declared within this variable
declaration.
|
int |
getNumDeclarators()
Returns the number of declarators in this declaration.
|
java.util.List<Specifier> |
getSpecifiers() |
boolean |
isTypedef() |
static void |
setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently
created objects will use the supplied method.
|
annotate, annotateAfter, annotateBefore, containsAnnotation, detach, equals, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getChildren, getParent, hashCode, print, removeAnnotations, removeAnnotations, removeChild, setChild, setParent, setPrintMethod, setSemiColon, toString, verify
public VariableDeclaration(Declarator declarator)
declarator
- The only declarator in this declaration.public VariableDeclaration(java.util.List specs)
specs
- A list of specifiers.public VariableDeclaration(Specifier spec, Declarator declarator)
spec
- A single specifier.declarator
- The only declarator in this declaration.public VariableDeclaration(java.util.List specs, Declarator declarator)
specs
- A list of specifiers.declarator
- The only declarator in this declaration.public VariableDeclaration(Specifier spec, java.util.List declarator_list)
spec
- A single specifier.declarator_list
- A list of declarators.public VariableDeclaration(java.util.List specs, java.util.List declarator_list)
specs
- A list of specifiers.declarator_list
- A list of declarators.public void addDeclarator(Declarator declarator)
declarator
- The declarator to add.public VariableDeclaration clone()
Declaration
clone
in class Declaration
public static void defaultPrint(VariableDeclaration d, java.io.PrintWriter o)
d
- The declaration to print.o
- The stream on which to print the declaration.public Declarator getDeclarator(int n)
n
- index of declarator to returnjava.lang.IndexOutOfBoundsException
- if the nth declarator does
not exist.public java.util.List<IDExpression> getDeclaredIDs()
Declaration
getDeclaredIDs
in class Declaration
public java.util.List<Symbol> getDeclaredSymbols()
public int getNumDeclarators()
public java.util.List<Specifier> getSpecifiers()
public boolean isTypedef()
public static void setClassPrintMethod(java.lang.reflect.Method m)
m
- The new print method.