com.neoworks.rdc
Class SymbolTable

java.lang.Object
  |
  +--com.neoworks.rdc.TokenList
        |
        +--com.neoworks.rdc.SymbolTable

public class SymbolTable
extends TokenList

A class to represent a symbol table. The table uses tokens to represent the identifiers held in it.

This is realy a TokenList but its nicer to call it a SymbolTable when it is a symbol table ok!

See Also:
Token

Field Summary
 
Fields inherited from class com.neoworks.rdc.TokenList
tokenData
 
Constructor Summary
SymbolTable(java.util.Vector newTokenList)
          Create a new symbol table using the tokens passed.
 
Method Summary
 int isInTable(Token findToken)
          Checks if a token is in the SymbolTable.
 
Methods inherited from class com.neoworks.rdc.TokenList
addToken, getSize, getTokenAt, removeTokenAt, tokenIsIn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolTable

public SymbolTable(java.util.Vector newTokenList)
Create a new symbol table using the tokens passed. The tokens are in a vector and represent the contence of the symbol table.

Method Detail

isInTable

public int isInTable(Token findToken)
Checks if a token is in the SymbolTable. Looks for a token in the table with the same lexeme as in the findToken passed. Note that it does the search on the lexeme only not the type or the value. Returns the index of the token in the table or -1 if it is not found in the table.

Parameters:
findToken - The token to look for in the table
Returns:
The index of the token in the table (or -1 if not found)