|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Symbol
Each Symbol object represents one entry in a SymbolTable.
Field Summary | |
static int |
FUNCTION
Symbol type: function. |
static int |
GLOBAL
Symbol scope: global. |
private String |
label
|
static int |
LOCAL
Symbol scope: local. |
static int |
PARAMETER
Symbol scope: parameter. |
private int |
scope
|
private static String[] |
symbolScope
|
private static String[] |
symbolType
|
private int |
type
|
static int |
UNKNOWN_SCOPE
Symbol scope: unknown. |
static int |
UNKNOWN_TYPE
Symbol type: unknown. |
static int |
VARIABLE
Symbol type: variable. |
Constructor Summary | |
Symbol()
Construct a new Symbol with unknown values for all fields. |
|
Symbol(String name,
int t,
int s)
Construct a new Symbol. |
Method Summary | |
String |
getLabel()
Get the label attribute of this object. |
int |
getScope()
Get the scope of this Symbol. |
int |
getType()
Get the type of this Symbol. |
void |
setLabel(String name)
Set the label attribute of this object. |
void |
setScope(int t)
Set the scope of this Symbol. |
void |
setType(int t)
Set the type of this Symbol. |
String |
toString()
Provide the String that describes this Symbol. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private int type
private int scope
private String label
private static String[] symbolType
public static final int UNKNOWN_TYPE
public static final int FUNCTION
public static final int VARIABLE
private static String[] symbolScope
public static final int UNKNOWN_SCOPE
public static final int LOCAL
public static final int PARAMETER
public static final int GLOBAL
Constructor Detail |
public Symbol()
public Symbol(String name, int t, int s)
name
- the label by which the program being compiled
refers to this Symbolt
- the symbol type, one of the type values defined
by the Symbol class.s
- the symbol scope, one of the scope values defined
by the Symbol class.Method Detail |
public String getLabel()
public void setLabel(String name)
name
- the Symbol labelpublic int getType()
public void setType(int t)
t
- the Symbol typepublic int getScope()
public void setScope(int t)
t
- the Symbol scopepublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |