The toplevel and main interface for the interpreter. There can only be
one instance of this object. The scope object can be used to create
logically isolated interpreter "instances".
This does need some cleanup, and perhaps should be a front-end for other
stuff someone embedding this in an application might want, such as
creating a new scope...
CACHE_VERSION the CACHE_VERSION should change any time a change is made in the interpreter
that could cause incompatibility with previously serialized cache entries.
the CACHE_VERSION should change any time a change is made in the interpreter
that could cause incompatibility with previously serialized cache entries. It
is made part of the path to serialized cache entry, so entries serialized with
different cache versions will not conflict.
DEFAULT_ARRAY_SORT_COMPARISION_FXN
public static Value DEFAULT_ARRAY_SORT_COMPARISION_FXN(Code)
Add the parser to list of recognized parsers. The
registered parsers will determine what sorts of input the interpreter
can handle.
Parameters: parser - the parser to register See Also:OscriptInterpreter.removeParser
addScriptPath
public static void addScriptPath(String path)(Code)
Add the specified path to the paths that are searched to import a
file.
Parameters: path - a path to search for imports
Create a NodeEvaluator to evaluate a node. An application embedding
the interpreter should use this method to convert the parsed syntax
tree to something that can be evaluated within a scope, rather than
directly using the visitors. This protects the application against
changes to the parsed representation of the program.
Parameters: desc - description Parameters: node - the node a NodeEvaluator
Evaluate from the specified abstract file. The stream is evaluated
until EOF is hit.
Parameters: file - the file to evaluate the result of evaluating the input throws: ParseException - if error parsing input throws: IOException - if something goes poorly when reading file
Evaluate from the specified abstract file. The stream is evaluated
until EOF is hit.
Parameters: file - the file to evaluate Parameters: scope - the scope to evaluate in the result of evaluating the input throws: ParseException - if error parsing input throws: IOException - if something goes poorly when reading file
Evaluate the specified sting.
Parameters: str - the string to evaluate the result of evaluating the string throws: ParseException - if error parsing string
Evaluate the specified sting.
Parameters: str - the string to evaluate Parameters: scope - the scope to evaluate in the result of evaluating the string throws: ParseException - if error parsing string
Get the global scope object. The globalScope is static,
meaning that all script code in an application shares a single global
scope. But, since the interpreter is multi-threaded, you can achieve
the same effect of having multiple interpreter instances by creating
a new level of scope (ie with globalScope as it's parent,
an evaluate within that scope.
the globalScope object
Return an iterator of entries in the script-path. Each entry is a path
that is prefixed to a relative path passed to
OscriptInterpreter.resolve in the
process of trying to resolve a file.
an iterator of strings
Register a class loader that we can delegate the act of resolving
classes. This allows the user of ObjectScript to give us the
ability to load classes that we might not otherwise have access
to.
removeParser
public static void removeParser(Parser parser)(Code)
Remove the parser from list of recognized parsers. The
registered parsers will determine what sorts of input the interpreter
can handle.
Parameters: parser - the parser to register See Also:OscriptInterpreter.addParser
removeScriptPath
public static void removeScriptPath(String path)(Code)
Remove the specified path to the paths that are searched to import a
file.
Parameters: path - a path to search for imports
Try to load the specified file from one of the registered filesystems.
Parameters: path - the path to the file to resolve Parameters: create - create the file if it does not exist throws: IOException - if something goes wrong when reading file See Also:OscriptInterpreter.addScriptPath