Class IdentTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--IdentTable
All Implemented Interfaces:
Cloneable, Map, Serializable

public class IdentTable
extends Hashtable

This class implement the table of ident of the parser.

Author:
P. URSO
See Also:
Ident, SemanticException, Serialized Form

Inner classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
IdentTable()
           
 
Method Summary
 void declareFunction(String name, boolean c, boolean infix, Type type, SortList typeParams)
          Declares a new function in this table Throw an error if the function is allready declared.
 void declareType(String name)
          Declares a new type in this table.
 Function getFunction(String name)
          Gets a function in this table.
 Type getType(String name)
          Get a type in this table.
 Ident keep(String name)
          Gets a Ident in this table.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentTable

public IdentTable()
Method Detail

declareType

public void declareType(String name)
                 throws SemanticException
Declares a new type in this table. Throw an error if the type is allready declared.
Parameters:
name - the name of the type.

getType

public Type getType(String name)
             throws SemanticException
Get a type in this table. Throw an error if the type is not well declared.
Parameters:
name - the name of the type
Returns:
the type to which the name name is mapped.

declareFunction

public void declareFunction(String name,
                            boolean c,
                            boolean infix,
                            Type type,
                            SortList typeParams)
                     throws SemanticException
Declares a new function in this table Throw an error if the function is allready declared.
Parameters:
name - the name of the function.
infix - true for infix operator.
c - true for constructor symbol.
type - return type of the function.
typeParams - list of types of parameters.

getFunction

public Function getFunction(String name)
                     throws SemanticException
Gets a function in this table. Throw an error if the function is not well declared.
Parameters:
name - the name of the function.
Returns:
the function to which the name name is mapped.

keep

public Ident keep(String name)
Gets a Ident in this table. If this ident is not in the hashtable it is putted as a Variable.
Parameters:
name - the name of the ident.
Returns:
the ident to which the name name is mapped.