All Packages Class Hierarchy This Package Previous Next Index
Class espresso.util.SymbolTable
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----espresso.util.SymbolTable
- public class SymbolTable
- extends Hashtable
-
NUMBER_METHODS
-
-
SymbolTable()
-
-
SymbolTable(int, float)
-
-
addField(Symbol, FieldDeclarationNode)
- Adds a field name to the symbol table.
-
addFormal(Symbol, FormalParameterNode)
- Adds a formal param to the symbol table.
-
addLabel(Symbol, LabeledStatementNode)
- Adds a statement label to the symbol table.
-
addLocal(Symbol, LocalVarDeclarationNode)
- Adds a local var to the symbol table.
-
addMethod(Symbol, MethodDeclarationNode)
- Adds a method name to the symbol table.
-
addPackage(Symbol, CompilationUnitNode)
- Adds a package declaration to the symbol table.
-
addPrimop(Symbol, MethodType)
- Adds a primop name to the symbol table.
-
addType(Symbol, TypeDeclarationNode)
- Adds a class or an interface name to the symbol table.
-
lookupField(Symbol)
- Looks up a field declaration in the symbol table.
-
lookupFormal(Symbol)
- Looks up a formal parameter in the symbol table.
-
lookupLabel(Symbol)
- Looks up a statement label in the symbol table.
-
lookupLocal(Symbol)
- Looks up a local var in the symbol table.
-
lookupMethod(Symbol)
- Looks up a method declaration in the symbol table.
-
lookupPackage(Symbol)
- Looks up a package declaration in the symbol table.
-
lookupPrimop(Symbol)
- Looks up a primop in the symbol table.
-
lookupType(Symbol)
- Looks up a class or interface declaration in the symbol table.
NUMBER_METHODS
static final int NUMBER_METHODS
SymbolTable
public SymbolTable()
SymbolTable
public SymbolTable(int size,
float factor)
addPackage
public CompilationUnitNode addPackage(Symbol name,
CompilationUnitNode node)
- Adds a package declaration to the symbol table. The name should
be fully qualified.
lookupPackage
public CompilationUnitNode lookupPackage(Symbol name)
- Looks up a package declaration in the symbol table. If the name
is not present or does not correspond to a package null is returned.
addType
public TypeDeclarationNode addType(Symbol name,
TypeDeclarationNode node)
- Adds a class or an interface name to the symbol table. Names should
be fully qualified.
lookupType
public TypeDeclarationNode lookupType(Symbol name)
- Looks up a class or interface declaration in the symbol table. If
the name is not present or does not correspond to a class or an
interface then null is returned.
addField
public FieldDeclarationNode addField(Symbol name,
FieldDeclarationNode node)
- Adds a field name to the symbol table. Names should be fully
qualified. A forward declaration may be resolved.
lookupField
public FieldDeclarationNode lookupField(Symbol name)
- Looks up a field declaration in the symbol table. If the name
is not present or does not correspond to a field, null is returned.
addMethod
public Vector addMethod(Symbol name,
MethodDeclarationNode node)
- Adds a method name to the symbol table. Names should be fully
qualified. A key is built by appending "()" to the name. A vector
is kept for each name (method overloading).
lookupMethod
public Vector lookupMethod(Symbol name)
- Looks up a method declaration in the symbol table. A key is built by
appending "()" to the name. If the name is not present or does not
correspond to a method, null is returned.
addFormal
public FormalParameterNode addFormal(Symbol name,
FormalParameterNode node)
- Adds a formal param to the symbol table. A name must be qualified
with the method (that also includes package and class) and a
unique index identifying outermost scope.
lookupFormal
public FormalParameterNode lookupFormal(Symbol name)
- Looks up a formal parameter in the symbol table. If the name is
not present or does not correspond to a field, null is returned.
addLocal
public LocalVarDeclarationNode addLocal(Symbol name,
LocalVarDeclarationNode node)
- Adds a local var to the symbol table. A name must be qualified
with the method (that also includes package and class) and a
unique index identifying the scope.
lookupLocal
public LocalVarDeclarationNode lookupLocal(Symbol name)
- Looks up a local var in the symbol table. If the name is
not present or does not correspond to a field, null is returned.
addPrimop
public Vector addPrimop(Symbol name,
MethodType mtype)
- Adds a primop name to the symbol table. A vector is kept for
each name (overloading).
lookupPrimop
public Vector lookupPrimop(Symbol name)
- Looks up a primop in the symbol table. If the name is not present
or does not correspond to a primop, null is returned.
addLabel
public LabeledStatementNode addLabel(Symbol name,
LabeledStatementNode node)
- Adds a statement label to the symbol table. Appends a ":" to avoid
name clashes.
lookupLabel
public LabeledStatementNode lookupLabel(Symbol name)
- Looks up a statement label in the symbol table. Appends ":" to the
name before searching.
All Packages Class Hierarchy This Package Previous Next Index