|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pnuts.lang.Pnuts
"Manager" class for Pnuts interpreter.
"pnuts" command starts from main method of this class.
Annotated reference manual is here.
Field Summary | |
static java.lang.String |
pnuts_version
|
static java.lang.String |
prompt
"prompt" string for the command shell |
protected SimpleNode |
startNodes
parsed scripts |
protected java.lang.Object |
value
|
Constructor Summary | |
protected |
Pnuts()
|
protected |
Pnuts(java.io.Reader reader)
|
protected |
Pnuts(java.io.Reader reader,
boolean interactive,
Context context)
Starts Pnuts interpreter. |
Method Summary | |
protected java.lang.Object |
accept(Context context)
|
java.lang.Object |
accept(Visitor visitor,
Context context)
traverse the parsed tree with the specified Visitor and Context |
static java.lang.Object |
eval(java.lang.String str)
Deprecated. Replaced by eval(String, Context) |
static java.lang.Object |
eval(java.lang.String expr,
Context context)
evaluate "str" in "context" |
static java.lang.Object |
eval(java.lang.String str,
java.lang.String pkg)
Deprecated. Replaced by eval(String, Context) |
static int |
evalDepth()
Get the depth of evaluation. |
static java.lang.String |
format(java.lang.Object obj)
returns a formatted string for obj |
static java.lang.Object |
get(java.lang.String str)
|
static java.lang.Object |
get(java.lang.String str,
java.lang.String pkg)
|
static java.lang.ClassLoader |
getClassLoader(Context context)
Deprecated. Replaced by Context.getClassLoader() |
static Visitor |
getDefaultVisitor()
|
static boolean |
isJava2()
|
static boolean |
isVerbose()
|
static java.lang.Object |
load(java.io.InputStream in)
Deprecated. Replaced by load(InputStream, Context) |
static java.lang.Object |
load(java.io.InputStream in,
boolean interactive,
Context context)
Load a script from an InputStream in the specified Context. |
static java.lang.Object |
load(java.io.InputStream in,
Context context)
load a script from InputStream "in" in "context" |
static java.lang.Object |
load(java.io.Reader reader)
Deprecated. Replaced by load(Reader, Context) |
static java.lang.Object |
load(java.io.Reader reader,
boolean interactive)
Deprecated. Replaced by load(Reader, boolean, Context) |
static java.lang.Object |
load(java.io.Reader reader,
boolean interactive,
Context context)
This method loads a script |
static java.lang.Object |
load(java.io.Reader reader,
Context context)
This method loads a script |
static java.lang.Object |
load(java.lang.String file)
Deprecated. Replaced by load(String, Context) |
static java.lang.Object |
load(java.lang.String name,
Context context)
load a script "file" in "context" |
static java.lang.Object |
load(java.net.URL url,
Context context)
|
static java.lang.Class |
loadClass(java.lang.String name)
Deprecated. |
static java.lang.Class |
loadClass(java.lang.String name,
Context context)
Loads the class with the specified name. |
static java.lang.Object |
loadFile(java.lang.String file)
Deprecated. Replaced by loadFile(String, Context) |
static java.lang.Object |
loadFile(java.lang.String file,
Context context)
load a local script "file" in "context" |
static void |
main(java.lang.String[] args)
Deprecated. |
static Pnuts |
parse(java.io.InputStream in)
parse a script from InputStream and return a Pnuts object |
static Pnuts |
parse(java.io.Reader reader)
parse a script from Reader and return a Pnuts object |
static Pnuts |
parse(java.lang.String expr)
parse a script and return a Pnuts object |
static void |
require(java.lang.String file,
Context context)
load a script "file" only when the script has not been read. |
java.lang.Object |
run()
Deprecated. Replaced by run(Context) |
java.lang.Object |
run(Context context)
executes a Pnuts object with the specified Context |
static void |
set(java.lang.String str,
java.lang.Object val)
set a value "val" to a global variable "str" |
static void |
set(java.lang.String str,
java.lang.Object val,
java.lang.String pkg)
set a value "val" to a variable "str" in package "pkg" |
static void |
setClassLoader(java.lang.ClassLoader loader,
Context context)
Deprecated. Replaced by Context.setClassLoader(ClassLoader) |
static void |
setLoadPath(java.lang.Object[] paths)
Deprecated. |
static void |
setPrompt(java.lang.String str)
set a "prompt" string for the command shell |
static void |
setVerbose(boolean b)
set verbose mode |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String pnuts_version
public static java.lang.String prompt
protected SimpleNode startNodes
protected transient java.lang.Object value
Constructor Detail |
protected Pnuts()
protected Pnuts(java.io.Reader reader) throws ParseException
protected Pnuts(java.io.Reader reader, boolean interactive, Context context)
Method Detail |
public static final boolean isJava2()
public static Visitor getDefaultVisitor()
public static void setClassLoader(java.lang.ClassLoader loader, Context context)
loader
- the ClassLoader with which classes are accessedpublic static java.lang.ClassLoader getClassLoader(Context context)
public static final java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
public static final java.lang.Class loadClass(java.lang.String name, Context context) throws java.lang.ClassNotFoundException
name
- the class name to be loadedcontext
- the context in which the class is loadedpublic static void setPrompt(java.lang.String str)
public static void setVerbose(boolean b)
public static boolean isVerbose()
public static void setLoadPath(java.lang.Object[] paths)
public static java.lang.String format(java.lang.Object obj)
public static java.lang.Object get(java.lang.String str)
public static java.lang.Object get(java.lang.String str, java.lang.String pkg)
public static void set(java.lang.String str, java.lang.Object val)
public static void set(java.lang.String str, java.lang.Object val, java.lang.String pkg)
public static java.lang.Object eval(java.lang.String str, java.lang.String pkg)
public static java.lang.Object eval(java.lang.String str)
public static java.lang.Object eval(java.lang.String expr, Context context)
expr
- the expression to be evaluatedcontext
- the context in which the expression is evaluatedpublic static java.lang.Object loadFile(java.lang.String file) throws java.io.FileNotFoundException
public static java.lang.Object loadFile(java.lang.String file, Context context) throws java.io.FileNotFoundException
public static java.lang.Object load(java.lang.String file) throws java.io.FileNotFoundException
public static java.lang.Object load(java.lang.String name, Context context) throws java.io.FileNotFoundException
public static java.lang.Object load(java.net.URL url, Context context)
public static java.lang.Object load(java.io.InputStream in)
public static java.lang.Object load(java.io.InputStream in, Context context)
public static java.lang.Object load(java.io.InputStream in, boolean interactive, Context context)
in
- an InputStream from which the interpreter reads an inputinteractive
- context
- a Context in which the interpretation is taken place.public static java.lang.Object load(java.io.Reader reader)
reader
- the Reader from which the script is loadedpublic static java.lang.Object load(java.io.Reader reader, Context context)
reader
- the Reader from which the script is loadedcontext
- the context in which the script is loadedpublic static java.lang.Object load(java.io.Reader reader, boolean interactive)
reader
- the Reader from which the script is loadedinteractive
- specifies if the execution is in interactive mode.public static java.lang.Object load(java.io.Reader reader, boolean interactive, Context context)
reader
- the Reader from which the script is loadedinteractive
- specifies if the execution is in interactive mode.context
- the context in which the script is loadedpublic static Pnuts parse(java.io.InputStream in) throws ParseException
in
- the InputStreampublic static Pnuts parse(java.io.Reader reader) throws ParseException
reader
- the Readerpublic static Pnuts parse(java.lang.String expr) throws ParseException
expr
- the scriptpublic static void require(java.lang.String file, Context context) throws java.io.FileNotFoundException
public java.lang.Object run()
public java.lang.Object run(Context context)
context
- the Contextprotected java.lang.Object accept(Context context)
public java.lang.Object accept(Visitor visitor, Context context)
context
- the Contextpublic static int evalDepth()
public static void main(java.lang.String[] args) throws java.lang.Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |