Parser
v2.1

Parser
Class SymbolTable

java.lang.Object
  |
  +--Parser.SymbolTable

public class SymbolTable
extends java.lang.Object

Represents a generic symbol table object.


Constructor Summary
SymbolTable()
           
 
Method Summary
 void addEntry(java.lang.String name, java.lang.Object value, int level)
          Adds an entry at the specified level.
 int getCurrentLevel()
          Gets the current level in the stack.
 java.util.Hashtable getEntries(int level)
          Gets the hashtable for a specified scope.
 java.lang.Object[] getEntry(java.lang.String name, int highestLevel)
          Gets the first entry with the same name (starting at the specified level).
 void popScope()
          Removes a scoping block from the stack.
 void pushScope()
          Adds a new scoping block to the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolTable

public SymbolTable()
Method Detail

getCurrentLevel

public int getCurrentLevel()
Gets the current level in the stack.
Returns:
the current level in the stack.

pushScope

public void pushScope()
Adds a new scoping block to the stack.

popScope

public void popScope()
Removes a scoping block from the stack.

addEntry

public void addEntry(java.lang.String name,
                     java.lang.Object value,
                     int level)
Adds an entry at the specified level.
Parameters:
name - the name of the entry.
value - the value of the entry.
level - the level to start searching on.

getEntry

public java.lang.Object[] getEntry(java.lang.String name,
                                   int highestLevel)
Gets the first entry with the same name (starting at the specified level).
Parameters:
name - the name of the entry to look for.
highestLevel - the level to start searching on.
Returns:
an object array with the entry value and level, or null if no entry was found.

getEntries

public java.util.Hashtable getEntries(int level)
Gets the hashtable for a specified scope.
Parameters:
level - the leve of scope to be returned.

Parser
v2.1