jellyj.util
Class SymbolTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--jellyj.util.SymbolTable

public class SymbolTable
extends Hashtable


Field Summary
 (package private) final static intNUMBER_METHODS
           

Constructor Summary
SymbolTable()
           
SymbolTable(int size, float factor)
           

Method Summary
 FieldDeclarationNodeaddField(Symbol name, FieldDeclarationNode node)
          Adds a field name to the symbol table.
 FormalParameterNodeaddFormal(Symbol name, FormalParameterNode node)
          Adds a formal param to the symbol table.
 LabeledStatementNodeaddLabel(Symbol name, LabeledStatementNode node)
          Adds a statement label to the symbol table.
 LocalVarDeclarationNodeaddLocal(Symbol name, LocalVarDeclarationNode node)
          Adds a local var to the symbol table.
 VectoraddMethod(Symbol name, MethodDeclarationNode node)
          Adds a method name to the symbol table.
 CompilationUnitNodeaddPackage(Symbol name, CompilationUnitNode node)
          Adds a package declaration to the symbol table.
 VectoraddPrimop(Symbol name, MethodType mtype)
          Adds a primop name to the symbol table.
 TypeDeclarationNodeaddType(Symbol name, TypeDeclarationNode node)
          Adds a class or an interface name to the symbol table.
 FieldDeclarationNodelookupField(Symbol name)
          Looks up a field declaration in the symbol table.
 FormalParameterNodelookupFormal(Symbol name)
          Looks up a formal parameter in the symbol table.
 LabeledStatementNodelookupLabel(Symbol name)
          Looks up a statement label in the symbol table.
 LocalVarDeclarationNodelookupLocal(Symbol name)
          Looks up a local var in the symbol table.
 VectorlookupMethod(Symbol name)
          Looks up a method declaration in the symbol table.
 CompilationUnitNodelookupPackage(Symbol name)
          Looks up a package declaration in the symbol table.
 VectorlookupPrimop(Symbol name)
          Looks up a primop in the symbol table.
 TypeDeclarationNodelookupType(Symbol name)
          Looks up a class or interface declaration in the symbol table.

Methods inherited from class java.util.Hashtable
size, isEmpty, keys, elements, contains, containsValue, containsKey, get, put, remove, putAll, clear, clone, toString, keySet, entrySet, values, equals, hashCode

Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait

Field Detail

NUMBER_METHODS

final static int NUMBER_METHODS
Constructor Detail

SymbolTable

public SymbolTable()

SymbolTable

public SymbolTable(int size, float factor)
Method Detail

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.

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.

addLabel

public LabeledStatementNode addLabel(Symbol name, LabeledStatementNode node)
Adds a statement label to the symbol table. Appends a ":" to avoid name clashes.

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.

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).

addPackage

public CompilationUnitNode addPackage(Symbol name, CompilationUnitNode node)
Adds a package declaration to the symbol table. The name should be fully qualified.

addPrimop

public Vector addPrimop(Symbol name, MethodType mtype)
Adds a primop name to the symbol table. A vector is kept for each name (overloading).

addType

public TypeDeclarationNode addType(Symbol name, TypeDeclarationNode node)
Adds a class or an interface name to the symbol table. Names should be fully qualified.

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.

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.

lookupLabel

public LabeledStatementNode lookupLabel(Symbol name)
Looks up a statement label in the symbol table. Appends ":" to the name before searching.

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.

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.

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.

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.

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.