gov.llnl.babel.symbols
public class SymbolTable extends java.lang.Object implements SymbolResolver
SymbolTable
is a singleton class that represents the
locally cached SIDL symbols used during the parse of a SIDL file
or XML type descriptions. Only one version of a particular symbol
may exist in the table, although different versions may exist in
the resolver search path. A symbol may not be added to the table
if it already exists in the table. A symbol may not be added to
the table if already exists in the SymbolResolver
search path with the same version. The symbol table keeps a list
of modified symbols that must be written to a database at the end
of the parsing.Constructor and Description |
---|
SymbolTable()
Create a new instance of a symbol table.
|
Modifier and Type | Method and Description |
---|---|
void |
addSymbolResolver(SymbolResolver resolver)
Add a new symbol resolver to the end of the list of current
resolvers.
|
boolean |
conflictingSymbols(SymbolID s1,
SymbolID s2) |
void |
freezeAll() |
java.util.Set |
generateDependencies(java.util.Set symbols)
Generate dependencies for the symbols in the input
Set . |
java.util.Set |
getModifiedSymbolNames()
Return the set of symbol names in the symbol table that are new
or modified.
|
java.util.Set |
getSymbolNames()
Return the set of symbol names in the symbol table.
|
java.util.Map |
getTable()
Return the current symbol table as a
Map . |
Symbol |
lookupSymbol(java.lang.String fqn)
Look up a symbol in the symbol table based on the fully qualified
name.
|
Symbol |
lookupSymbol(SymbolID id)
Look up a symbol in the symbol table based on the fully qualified
name and the version number.
|
void |
markSymbolAsModified(SymbolID id)
Mark a symbol in the symbol table as modified.
|
void |
putSymbol(Symbol symbol)
Add a new symbol to the symbol table.
|
void |
removeSymbolResolver(SymbolResolver resolver) |
void |
resolveAllParents()
Resolve all external symbol references for all parents of symbols in
the symbol table.
|
void |
resolveAllReferences()
Resolve all external symbol references for all symbols in the symbol
table.
|
Symbol |
resolveSymbol(java.lang.String fqn)
Resolve the specified symbol by fully qualified name and cache the
symbol in the symbol table.
|
Symbol |
resolveSymbol(SymbolID id)
Resolve the specified symbol by fully qualified name and version number
and cache the symbol in the symbol table.
|
void |
setInputFromSIDL() |
void |
setTargetIsXML(boolean value) |
void |
validateContracts()
Verify that any and all contracts that can be checked at this time
are valid.
|
void |
verifyReferences()
Verify that all references in the table have been satisfied.
|
public SymbolTable()
public java.util.Map getTable()
Map
. The keys
for the hash table are of type SymbolID
and the values
are of type Symbol
.public java.util.Set getSymbolNames()
SymbolID
.public java.util.Set getModifiedSymbolNames()
SymbolID
.public void markSymbolAsModified(SymbolID id)
public Symbol lookupSymbol(java.lang.String fqn)
lookupSymbol
in interface SymbolResolver
public Symbol lookupSymbol(SymbolID id)
lookupSymbol
in interface SymbolResolver
public void addSymbolResolver(SymbolResolver resolver)
public void removeSymbolResolver(SymbolResolver resolver)
public Symbol resolveSymbol(java.lang.String fqn)
public Symbol resolveSymbol(SymbolID id) throws SymbolRedefinitionException
SymbolRedefinitionException
is thrown.
If the symbol does not exist in the symbol table, then this method will
search through the resolver list for the symbol with the matching
version number. If no symbol is found, then null is returned.SymbolRedefinitionException
public void putSymbol(Symbol symbol) throws SymbolRedefinitionException
SymbolRedefinitionException
if the symbol already exists
in the symbol table with the same name or if the symbol exists in the
resolver search path with the same name and version. This symbol
is also placed on the new or modified symbol list.SymbolRedefinitionException
public java.util.Set generateDependencies(java.util.Set symbols) throws SymbolNotFoundException, SymbolRedefinitionException
Set
.
The input set contains a set of SymbolID
symbol names.
All dependencies will be loaded into the symbol table and their
SymbolID
names will be returned in the Set
return argument. If the input argument is null or if there are no
dependencies, then the return argument will be null.public void resolveAllReferences() throws SymbolNotFoundException, SymbolRedefinitionException
SymbolNotFoundException
is thrown. If a symbol
reference redefines a symbol with a different version number, then
a SymbolRedefinitionException
is thrown.public void resolveAllParents() throws SymbolNotFoundException
SymbolNotFoundException
public void validateContracts() throws AssertionException, CodeGenerationException
public void verifyReferences() throws SymbolNotFoundException
SymbolNotFoundException
public void setInputFromSIDL()
public void setTargetIsXML(boolean value)
public void freezeAll()