1999-05-07 22:18:39 +00:00
|
|
|
|
|
|
|
import java.util.Hashtable;
|
|
|
|
|
|
|
|
class Environment {
|
|
|
|
|
1999-06-15 00:57:05 +00:00
|
|
|
JSScope scope = new JSScope("globals");
|
|
|
|
JSScope globalScope = scope;
|
|
|
|
|
1999-06-11 23:05:16 +00:00
|
|
|
|
1999-06-15 00:57:05 +00:00
|
|
|
void enterNewScope(JSScope newScope)
|
1999-06-11 23:05:16 +00:00
|
|
|
{
|
1999-06-15 00:57:05 +00:00
|
|
|
newScope.parent = scope;
|
|
|
|
scope = newScope;
|
|
|
|
}
|
|
|
|
|
|
|
|
void leaveScope()
|
|
|
|
{
|
|
|
|
scope = scope.parent;
|
1999-06-11 23:05:16 +00:00
|
|
|
}
|
1999-05-28 19:00:48 +00:00
|
|
|
|
1999-05-07 22:18:39 +00:00
|
|
|
String print()
|
|
|
|
{
|
|
|
|
StringBuffer result = new StringBuffer("Globals contents :\n");
|
1999-05-25 21:49:40 +00:00
|
|
|
result.append(scope.toString());
|
1999-05-07 22:18:39 +00:00
|
|
|
return result.toString();
|
|
|
|
}
|
|
|
|
|
1999-06-11 00:21:26 +00:00
|
|
|
JSValue resultValue;
|
1999-05-07 22:18:39 +00:00
|
|
|
|
|
|
|
}
|