pnuts.lang
Class PnutsImpl

java.lang.Object
  |
  +--pnuts.lang.PnutsImpl
Direct Known Subclasses:
CachedPnutsImpl, CompilerPnutsImpl, SecurePnutsImpl

public class PnutsImpl
extends java.lang.Object

This class defines an abstract interface of script interpreter's implementation, It also gives the default implementation, which is a pure interpreter.

See Also:
Context.setPnutsImpl(), Context.getPnutsImpl()

Constructor Summary
PnutsImpl()
           
 
Method Summary
 java.lang.Object accept(SimpleNode node, Context context)
           
protected  void checkException(Context context, java.lang.Throwable t)
          Check if any exception handler for the specified exception is defined.
 java.lang.Object eval(java.lang.String str, Context context)
          Evaluate an expreesion
 java.lang.Object load(java.io.Reader reader, Context context)
           
 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 pushFile(java.lang.Object file, Context context)
          Tell the context that it's started processing the script file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PnutsImpl

public PnutsImpl()
Method Detail

eval

public java.lang.Object eval(java.lang.String str,
                             Context context)
Evaluate an expreesion
Parameters:
expr - the expression to be evaluated
context - the context in which the expression is evaluated
Returns:
the result of the evaluation

loadFile

public java.lang.Object loadFile(java.lang.String filename,
                                 Context context)
                          throws java.io.FileNotFoundException
Load a script file from local file system
Parameters:
filename - the file name of the script
context - the context in which the expression is evaluated
Returns:
the result of the evaluation

load

public java.lang.Object load(java.lang.String file,
                             Context context)
                      throws java.io.FileNotFoundException
Load a script file using classloader
Parameters:
file - the name of the script
context - the context in which the script is executed
Returns:
the result of the evaluation

load

public java.lang.Object load(java.net.URL scriptURL,
                             Context context)
Load a script file from a URL
Parameters:
scriptURL - the URL of the script
context - the context in which the script is executed
Returns:
the result of the evaluation

load

public java.lang.Object load(java.io.Reader reader,
                             Context context)

accept

public java.lang.Object accept(SimpleNode node,
                               Context context)

pushFile

protected void pushFile(java.lang.Object file,
                        Context context)
Tell the context that it's started processing the script file.

popFile

protected void popFile(Context context)
Tell the context that the current script file has been completed.

checkException

protected void checkException(Context context,
                              java.lang.Throwable t)
Check if any exception handler for the specified exception is defined.