|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarf.nlp.Parsing.SymbolTable
public class SymbolTable
Symbol Table data structure. TODO: complete implementation.
$Id: SymbolTable.java,v 1.18 2008/01/03 03:21:57 mokhov Exp $
| Field Summary | |
|---|---|
protected SymbolTable |
oParentSymTab
Backward reference. |
protected java.util.Hashtable |
oSymTabIndex
Global Index 'pointing' to all SymbolTables to speedup search. |
protected java.lang.String |
strName
Name of the table, must be unique. |
| Constructor Summary | |
|---|---|
SymbolTable()
Default Constructor. |
|
SymbolTable(java.lang.String pstrName)
Accepts scope name. |
|
SymbolTable(java.lang.String pstrName,
SymbolTable poParentSymTab)
Accepts scope name and the reference to the parent. |
|
| Method Summary | |
|---|---|
void |
addEntry(int piEntryType,
Token poToken)
Not implemented. |
int |
addSymbol(Token poToken)
Adds a symbol token to the table. |
int |
addSymbol(Token poToken,
boolean pbResolved)
Not implemented. |
int |
addSymbol(Token oToken,
int piSymDataType)
Not implemented. |
void |
create(java.lang.String pstrNewTableName)
Creates child symbol table with a given name. |
void |
delete(java.lang.String pstrTable)
Not implemented. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
java.util.Hashtable |
getSymTabEntries()
Allows querying for the contained entries. |
SymTabEntry |
getSymTabEntry(int piID)
Not implemented. |
SymTabEntry |
getSymTabEntry(java.lang.String pstrLexeme)
This method returns the entry by token's lexeme. |
java.lang.Object |
insert(java.lang.String pstrTable,
java.lang.String pstrID)
Finds a reserved entry given table and ID and marks it unreserved. |
void |
print(java.lang.String pstrTable)
Serializes the named table into STDOUT. |
java.lang.Object |
search(java.lang.String pstrTable,
java.lang.String pstrID)
Looks up an entry in either this table or in index given the table name an the identifier. |
java.lang.Object |
search(java.lang.String pstrTable,
java.lang.String pstrID,
boolean pbReserveEntry)
Looks up a symbol table entry in either this table or in index. |
boolean |
serialize(int piOpertation)
Not implemented. |
boolean |
setResolved(int piID,
boolean pbResolved)
Not implemented. |
boolean |
setResolved(java.lang.String pstrLexeme,
boolean pbResolved)
Marks a symbol table entry as resolved/declared (or not) given lexeme. |
boolean |
setType(int piID,
int piType)
Not implemented. |
boolean |
setType(java.lang.String pstrLexeme,
int piType)
Not implemented. |
void |
updateEntry(java.lang.String pstrScope,
java.lang.String pstrName,
boolean pbDeclared)
Not implemented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable oSymTabIndex
protected SymbolTable oParentSymTab
protected java.lang.String strName
| Constructor Detail |
|---|
public SymbolTable()
public SymbolTable(java.lang.String pstrName)
pstrName - name of the scope
public SymbolTable(java.lang.String pstrName,
SymbolTable poParentSymTab)
pstrName - scope namepoParentSymTab - parent symbol table reference| Method Detail |
|---|
public int addSymbol(Token poToken)
poToken - symbol token to add
public int addSymbol(Token poToken,
boolean pbResolved)
addSymbol(Token), just has
an extra parameter for convenience
if on the time of insertion the symbol
is already defined.
poToken - pbResolved -
NotImplementedExceptionaddSymbol(Token)
public int addSymbol(Token oToken,
int piSymDataType)
oToken - piSymDataType -
NotImplementedException
public void addEntry(int piEntryType,
Token poToken)
piEntryType - poToken -
NotImplementedException
public void updateEntry(java.lang.String pstrScope,
java.lang.String pstrName,
boolean pbDeclared)
pstrScope - pstrName - pbDeclared -
NotImplementedExceptionpublic void create(java.lang.String pstrNewTableName)
pstrNewTableName - child's symbol table name
public java.lang.Object search(java.lang.String pstrTable,
java.lang.String pstrID)
search(pstrTable, pstrID, false).
pstrTable - the table namepstrID - the symbol identifier
search(String, String, boolean)
public java.lang.Object search(java.lang.String pstrTable,
java.lang.String pstrID,
boolean pbReserveEntry)
pstrTable - the table namepstrID - the symbol identifierpbReserveEntry - mark the symbol table entry reserved or not
public java.lang.Object insert(java.lang.String pstrTable,
java.lang.String pstrID)
pstrTable - symbol table name to search forpstrID - identifier to search for
public void delete(java.lang.String pstrTable)
pstrTable - table name to deletepublic void print(java.lang.String pstrTable)
pstrTable - the symbol table to dumppublic java.util.Hashtable getSymTabEntries()
public SymTabEntry getSymTabEntry(int piID)
piID -
public SymTabEntry getSymTabEntry(java.lang.String pstrLexeme)
pstrLexeme - the lexeme of the entry to look up
public boolean setResolved(int piID,
boolean pbResolved)
piID - pbResolved -
public boolean setResolved(java.lang.String pstrLexeme,
boolean pbResolved)
pstrLexeme - the lexeme to look uppbResolved - flag to set whether the given entry is resolved or not
true if the entry was updated (read found and updated)
public boolean setType(int piID,
int piType)
piID - piType -
public boolean setType(java.lang.String pstrLexeme,
int piType)
pstrLexeme - piType -
public boolean serialize(int piOpertation)
piOpertation -
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||