|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjparse.SymbolTable
A mapping from names to definitions of those names (AST nodes)
Field Summary | |
private HashMap |
labelMap
The mapping from label names to AST nodes representing the labeled statement |
private MethAST[] |
methods
An alphabetical list of methods (methods with the same name are in no particular order) |
(package private) SymbolTable |
parent
The symbol table for the enclosing scope |
private TypeAST |
type
The type (class or interface) in which the symbols in this table are defined |
private HashMap |
varMap
The mapping from variable names to AST nodes representing the definitions of those variables |
Constructor Summary | |
SymbolTable()
Create a new SymbolTable |
Method Summary | |
void |
addLabel(String label,
JavaAST stmt)
Add a labeled statement to the symbol table |
void |
addMeth(MethAST meth)
Add a method symbol to the symbol table |
void |
addVar(VarAST ast)
Add a variable symbol to the symbol table |
StatementAST |
getLabel(String label)
Find a labeled statement in the symbol table |
Method |
getMeth(String name,
Type[] params,
Type caller)
Find a method symbol in the symbol table |
Method[] |
getMeths()
Retrieve all methods defined by this symbol table |
Method[] |
getMeths(String name,
Type[] params,
Type caller)
Retrieve all matching methods |
VarAST |
getVar(String name)
Find a variable symbol in the symbol table |
(package private) void |
setEnclosingType(TypeAST enclosingType)
Set the enclosing type for this symbol table |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
final SymbolTable parent
private TypeAST type
private final HashMap varMap
private MethAST[] methods
private final HashMap labelMap
Constructor Detail |
public SymbolTable()
SymbolTable
Method Detail |
void setEnclosingType(TypeAST enclosingType)
enclosingType
- the enclosing type for this symbol tablepublic void addVar(VarAST ast)
ast
- the AST node defining the variablepublic VarAST getVar(String name)
name
- the name of the variable to look up
null
if it
cannot be foundpublic void addMeth(MethAST meth)
meth
- the AST node describing the methodpublic Method getMeth(String name, Type[] params, Type caller)
name
- the name of the method to look upparams
- the types of the parameters to the methodcaller
- the type of the caller
null
if one
could not be foundpublic Method[] getMeths(String name, Type[] params, Type caller)
name
- the name of the method to look upparams
- the types of the parameters to the methodcaller
- the type of the caller
public Method[] getMeths()
public void addLabel(String label, JavaAST stmt)
label
- the label on the statementstmt
- the AST node for the labeled statementpublic StatementAST getLabel(String label)
label
- the label to look up
null
if it cannot be foundpublic String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |