|
|||||||||
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.applet.Applet |
applet
If Pnuts starts in applet this variable should be set. |
protected static Visitor |
interpreter
|
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 | |
java.lang.Object |
accept(Visitor visitor,
Context context)
traverse the start nodes with the specified Visitor and Context |
static java.lang.Object |
eval(java.lang.String str)
evaluate "str" in the global package |
static java.lang.Object |
eval(java.lang.String str,
Context context)
evaluate "str" in "context" |
static java.lang.Object |
eval(java.lang.String str,
java.lang.String pkg)
evaluate "str" in package "pkg" |
static int |
evalDepth()
returns the depth of evaluations |
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()
get ClassLoader for class access |
static boolean |
isJava2()
|
static boolean |
isVerbose()
|
static java.lang.Object |
load(java.io.InputStream in)
load a script from InputStream "in" |
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)
load a script from Reader "reader" |
static java.lang.Object |
load(java.io.Reader reader,
boolean interactive)
|
static java.lang.Object |
load(java.io.Reader reader,
boolean interactive,
Context context)
Load a script from an Reader in the specified Context. |
static java.lang.Object |
load(java.io.Reader reader,
Context context)
load a script from Reader "reader" in context |
static java.lang.Object |
load(java.lang.String file)
load a script "file" |
static java.lang.Object |
load(java.lang.String file,
Context context)
load a script "file" in "context" |
static java.lang.Class |
loadClass(java.lang.String name)
|
static java.lang.Object |
loadFile(java.lang.String file)
load a local script "file" |
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)
starts the command shell interpreter |
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 |
registerQuantityFactory(java.lang.String unit,
QuantityFactory factory)
|
static void |
require(java.lang.String file)
load a script "file" only when the script has not been read. |
java.lang.Object |
run()
executes a Pnuts object with a new 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)
set ClassLoader for class access |
static void |
setLoadPath(java.lang.Object[] paths)
set a search path for scripts as an object array Elements of the array should one of the followings. |
static void |
setLoadPath(java.lang.String path)
set a search path for scripts as a colon-separated String This method remains for compatibility reason. |
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 java.applet.Applet applet
public static java.lang.String prompt
protected static Visitor interpreter
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 void registerQuantityFactory(java.lang.String unit, QuantityFactory factory)
public static void setClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoader with which classes are accessedpublic static java.lang.ClassLoader getClassLoader()
public static final java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
public 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 void setLoadPath(java.lang.String path)
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 str, Context context)
public 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 file, Context context) throws java.io.FileNotFoundException
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)
public static java.lang.Object load(java.io.Reader reader, Context context)
public static java.lang.Object load(java.io.Reader reader, boolean interactive)
public static java.lang.Object load(java.io.Reader reader, boolean interactive, Context context)
reader
- an Reader from which the interpreter reads an inputinteractive
- context
- a Context in which the interpretation is taken place.public 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) throws java.io.FileNotFoundException
public java.lang.Object run()
public java.lang.Object run(Context context)
context
- the Contextpublic 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 |