|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpnuts.lang.Runtime
pnuts.lang.PnutsImpl
public class PnutsImpl
This class defines an abstract interface of script interpreter's implementation, It also gives the default implementation, which is a pure interpreter.
Context.setImplementation(Implementation)
,
Context.getImplementation()
Nested Class Summary |
---|
Nested classes/interfaces inherited from class pnuts.lang.Runtime |
---|
Runtime.Accessor, Runtime.Break, Runtime.Continue, Runtime.FunctionSerializer, Runtime.TypeMap |
Field Summary | |
---|---|
protected java.util.Properties |
properties
|
Fields inherited from class pnuts.lang.Runtime |
---|
BOOLEAN_SYMBOL, BYTE_SYMBOL, CHAR_SYMBOL, CLONE, DOUBLE_SYMBOL, EXCEPTOIN_FIELD_SYMBOL, FLOAT_SYMBOL, INT_SYMBOL, LONG_SYMBOL, SHORT_SYMBOL, VOID_SYMBOL |
Constructor Summary | |
---|---|
PnutsImpl()
|
Method Summary | |
---|---|
java.lang.Object |
accept(SimpleNode node,
Context context)
Interpret an AST |
java.lang.Object |
eval(java.lang.String expr,
Context context)
Evaluate an expreesion |
static PnutsImpl |
getDefault()
Returns the default PnutsImpl object |
java.lang.Object |
load(java.lang.String file,
Context context)
Load a script file using classloader |
java.lang.Object |
load(java.net.URL scriptURL,
Context context)
Load a script file from a URL |
java.lang.Object |
loadFile(java.lang.String filename,
Context context)
Load a script file from local file system |
protected void |
popFile(Context context)
Tell the context that the current script file has been completed. |
protected void |
provide(java.lang.String file,
Context context)
Check if any exception handler for the specified exception is defined. |
protected void |
pushFile(java.lang.Object file,
Context context)
Tell the context that it's started processing the script file. |
java.lang.String |
queryProperty(java.lang.String key)
|
protected void |
revoke(java.lang.String file,
Context context)
|
void |
setProperties(java.util.Properties properties)
|
void |
setProperty(java.lang.String key,
java.lang.String value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Properties properties
Constructor Detail |
---|
public PnutsImpl()
Method Detail |
---|
public static PnutsImpl getDefault()
public void setProperties(java.util.Properties properties)
public void setProperty(java.lang.String key, java.lang.String value)
public java.lang.String queryProperty(java.lang.String key)
public java.lang.Object eval(java.lang.String expr, Context context)
eval
in interface Implementation
expr
- the expression to be evaluatedcontext
- the context in which the expression is evaluated
public java.lang.Object loadFile(java.lang.String filename, Context context) throws java.io.FileNotFoundException
loadFile
in interface Implementation
filename
- the file name of the scriptcontext
- the context in which the expression is evaluated
java.io.FileNotFoundException
public java.lang.Object load(java.lang.String file, Context context) throws java.io.FileNotFoundException
load
in interface Implementation
file
- the name of the scriptcontext
- the context in which the script is executed
java.io.FileNotFoundException
public java.lang.Object load(java.net.URL scriptURL, Context context)
load
in interface Implementation
scriptURL
- the URL of the scriptcontext
- the context in which the script is executed
public java.lang.Object accept(SimpleNode node, Context context)
Implementation
accept
in interface Implementation
node
- the ASTcontext
- the context in which the AST is interpretedprotected void pushFile(java.lang.Object file, Context context)
protected void popFile(Context context)
protected void provide(java.lang.String file, Context context)
protected void revoke(java.lang.String file, Context context)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |