|
Free
EcmaScript
Interpreter.
A JavaScript interpreter
written in Java. |
FESI implements few language extensions and try to follow
the standard as much as possible. This is unlike most implementation of
JavaScript, which are unfortunately very incompatibles between them.
However to be useful at all EcmaScript must be extended, at least to
link it to some host application. Because many applications have some
common needs,
FESI extensions can be build as libraries and loaded on demand, using
the
Java dynamic loading capability. A host program will usually list the
required
extensions as part of its initialization (see the
FESI Java library
). The extensions only add host objects and functions as prescribe the
the
EcmaScript standard, they do not change existing functions or extend
the
syntax.
Builtin extensions
The builtin extensions are capabilities always present on the
interpreter. They include the following capabilities:
- The interactive interpreter add the global array variables args[]
, which contains the arguments of the command line after the option -A
, if any. This is not present in the called interpreter (unless the
progammer implements it).
- The possibility to call FESI
from the Bean Scripting Framework.
- the tryEval routine, described below.
- The capability of calling methods of Java objects (if such
an
object is returned by some other extension or if the
JavaAccess extension is loaded). This is explained as part of the
JavaAccess extension.
- The capability to use Java beans as EcmaScript objects (mapping
of
bean properties and EcmaScript properties).
- The capability to add event handlers
to Java objects (if such an object is returned by some other extension
or
if the JavaAccess extension is loaded).
- tryEval(string[,default])
- tryEval evaluates the parameter as
eval, but returns an object with two properties: value
and error. If the evaluation is successful, the value
properties
contains the result of the evaluation and the error property
is null (which tests as false). If the evaluation
results
in an error, the the value property is either the value of the default
parameter (if specified) or undefined, and the error
property
contains an object describing the error, which is guaranteed to test as
true. The error object string representation is some description
of
the error. In the future more detailed error information may be
available.
- throwError([stringOrException])
- throwError throws and exception.
The
parameter is converted to a string, and added as an exception parameter
if
it is a Throwable.
Loadable extensions
The following extensions are all loaded by default by the
interactive interpreter. However they may or may not be loaded by a
user program using the interpreter as an embedded language, depending
on the caller.
BasicIO, BasicIOw
and BasicIOs
Provide basic documentand windowbased IO to enable
to share
some scripts with interpreter hosted in browsers.
BasicIO and
BasicIOw documentation
JavaAccess
Allows to created Java objects and provide access to any public
Java class and function from an EcmaScript program.
JavaAccess
documentation
FileIO
Provides text file IO and directory manipulation functions to
EcmaScript programs.
FileIO documentation
Database
Provides simple database access functions (via JDBC) to EcmaScript
programs.
Database Access
documentation
RegExp
Provides regular expression base search and replace, based on the Java
1.4
regular expression pacakage or, if not available, on the Apache ORO or
GNU
RegExp pacakge..
Regular
Expression documentation
Return to the main page
| Copyright ©
Jean-Marc Lugrin 1998-2003 - Under LGPL license |
Last update: 26 August 2003 |