A symbol table. This class implements a symbol table, which maps symbols represented as strings to values of any type. The mapping is organized into hierarchical {@link Scope scopes}, which allows for multiple definitions of the same symbol across different scopes. Additionally, a symbol may have multiple definitions within the same scope: if the corresponding value is a Java collections framework list, it is recognized as a multiply defined symbol. Scopes are named, with names being represented as strings. Both scope names and symbols can be unqualified — that is, they need to be resolved relative to the {@link #current() currentscope} — or qualified by the {@link Constants#QUALIFIER qualification character} '
.
' — that is, they areresolved relative to the symbol table's {@link #root() root}. Once {@link #enter(String) created}, a scope remains in the symbol table and the corresponding AST node should be associated with that scope by setting the corresponding {@link Constants#SCOPE property} tothe scope's qualified name. Subsequent traversals over that node can then automatically {@link #enter(Node) enter} and {@link #exit(Node) exit} that scope. Alternatively, if traversing out oftree order, the current scope can be set {@link #setScope(SymbolTable.Scope) explicitly}.
To support different name spaces within the same scope, this class can optionally {@link #toNameSpace mangle} and {@link #fromNameSpace unmangle} unqualified symbols. By convention, aname in any name space besides the default name space is prefixed by the name of the name space and an opening parenthesis '
(
' and suffixed by a closing parenthesis '
)
'.
@author Robert Grimm
@version $Revision: 1.34 $