pnuts.lang
Class Function

java.lang.Object
  |
  +--pnuts.lang.Runtime
        |
        +--pnuts.lang.Function

public class Function
extends Runtime
implements java.io.Serializable

This class represents a function with a certain number of parameters. In Pnuts, functions should be accessed through PnutsFunction. This class is used mainly by compiler implementors. Note that there is no way to create a Function object through public API.

See Also:
Serialized Form

Field Summary
protected  java.lang.String file
          file name in which this function is defined
protected  java.lang.String funcName
          name of the function including the scope information
protected  PnutsFunction function
          reference to PnutsFunction
protected  pnuts.lang.ImportEnv importEnv
          "import" environment
protected  java.lang.String[] locals
          local parameters
protected  java.lang.String name
          name of the function without the scope information
protected  int nargs
          the number of arguments
protected  SimpleNode node
          reference to the definition
protected  Function outer
          reference to the outer function
protected  Package pkg
           
protected  java.lang.String pkgName
          the package name in which this function is defined
 
Constructor Summary
protected Function()
           
protected Function(java.lang.String func, java.lang.String[] locals, int nargs, SimpleNode node, Package pkg, Context context)
           
 
Method Summary
protected  java.lang.Object accept(Visitor visitor, Context context)
           
protected  java.lang.Object call(java.lang.Object[] args, Context context)
           
protected  java.lang.Object exec(java.lang.Object[] args, Context context)
           
protected  java.lang.String getFile()
           
 java.lang.String getName()
           
protected  void init()
           
protected  PnutsFunction register(PnutsFunction pf)
           
 java.lang.String toString()
           
protected  java.lang.String unparse(Context context)
           
 
Methods inherited from class pnuts.lang.Runtime
arrayType, assignRange, callConstructor, callConstructor, callConstructor, callFunction, callMethod, callMethod, callMethod, cast, catchException, checkException, checkException, doReturn, getField, getIndex, getInterpreter, getNodes, getStaticField, isArray, newInstance, parseChar, parseFloat, parseInt, parseString, primitive, putField, putStaticField, quantity, readSymbolTable, setInterpreter, setLine, writeSymbolTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

funcName

protected java.lang.String funcName
name of the function including the scope information

name

protected java.lang.String name
name of the function without the scope information

nargs

protected int nargs
the number of arguments

locals

protected java.lang.String[] locals
local parameters

file

protected java.lang.String file
file name in which this function is defined

node

protected SimpleNode node
reference to the definition

importEnv

protected pnuts.lang.ImportEnv importEnv
"import" environment

outer

protected Function outer
reference to the outer function

pkgName

protected java.lang.String pkgName
the package name in which this function is defined

function

protected PnutsFunction function
reference to PnutsFunction

pkg

protected transient Package pkg
Constructor Detail

Function

protected Function()

Function

protected Function(java.lang.String func,
                   java.lang.String[] locals,
                   int nargs,
                   SimpleNode node,
                   Package pkg,
                   Context context)
Method Detail

init

protected void init()

getName

public java.lang.String getName()

getFile

protected java.lang.String getFile()

call

protected java.lang.Object call(java.lang.Object[] args,
                                Context context)

exec

protected java.lang.Object exec(java.lang.Object[] args,
                                Context context)

register

protected PnutsFunction register(PnutsFunction pf)

accept

protected java.lang.Object accept(Visitor visitor,
                                  Context context)

unparse

protected java.lang.String unparse(Context context)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object