jsint
Class LexicalEnvironment
java.lang.Object
|
+--jsint.LexicalEnvironment
- All Implemented Interfaces:
- java.io.Serializable
- public class LexicalEnvironment
- extends java.lang.Object
- implements java.io.Serializable
Environments store mappings from symbols to locations.
At compile time, we can lookup to see if a symbol names a location,
and at run time we can get or set the value in a location.
- Author:
- Peter Norvig, Copyright 1998, peter@norvig.com, license
subsequently modified by Jscheme project members
licensed under zlib licence (see license.txt)
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NULLENV
public static final LexicalEnvironment NULLENV
- The global environment. All info is in the Symbols themselves.
LexicalEnvironment
public LexicalEnvironment(java.lang.Object vars,
java.lang.Object[] vals,
LexicalEnvironment parent)
- Create an LexicalEnvironment with local variables and values,
and a parent LexicalEnvironment.
LexicalEnvironment
public LexicalEnvironment(java.lang.Object vars,
java.lang.Object[] vals,
LexicalEnvironment parent,
boolean isNullEnv)
lookup
public LocalVariable lookup(Symbol var)
lookup
public LocalVariable lookup(Symbol var,
int up,
int in,
java.lang.Object vars)
- Lookup the symbol in the environment. Return either a
LocalVariable a Symbol representing the global variable.
get
public java.lang.Object get(LocalVariable var)
- Get the value of the LocalVariable in this LexicalEnvironment.
set
public java.lang.Object set(LocalVariable var,
java.lang.Object newVal)
- Set the value of the LocalVariable in this LexicalEnvironment to
a new value.
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
show
public void show(java.io.PrintWriter s)