|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscripting.JSInterpreterDriver
public class JSInterpreterDriver
JavaScript / EcmaScript implementation of a language interpreter. This class uses the FESI library by Jean-Marc Lugrin for interpretation, available at:
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface scripting.InterpreterDriver |
---|
InterpreterDriver.InterpreterException |
Constructor Summary | |
---|---|
JSInterpreterDriver()
Default constructor |
Method Summary | |
---|---|
void |
executeScript(java.lang.String script,
java.lang.String[] argNames,
java.lang.String[] argValues)
Executes the specified JavaScript/EcmaScript code |
void |
executeScriptFile(java.lang.String scriptFile,
java.lang.String[] argNames,
java.lang.String[] argValues)
Executes JavaScript/Ecma code contained in the specified file |
java.lang.String[] |
getSupportedExtensions()
Returns the list of file extensions supported by this interpreter |
java.lang.String[] |
getSupportedLanguages()
Returns the list of languages supported by this interpreter |
void |
run()
Interprets a script in a new thread |
void |
setVariable(java.lang.String name,
java.lang.String value)
Sets a variable/member to the specified value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSInterpreterDriver() throws FESI.jslib.JSException
FESI.jslib.JSException
Method Detail |
---|
public void executeScript(java.lang.String script, java.lang.String[] argNames, java.lang.String[] argValues) throws InterpreterDriver.InterpreterException
executeScript
in interface InterpreterDriver
script
- the script data to executeargNames
- an array containing the names of arguments to be passed to
the evaluationargValues
- an array containing the values of the arguments to be
passed to the evaluation
InterpreterDriver.InterpreterException
- if an exception occurs during
executionpublic void executeScriptFile(java.lang.String scriptFile, java.lang.String[] argNames, java.lang.String[] argValues) throws InterpreterDriver.InterpreterException
executeScriptFile
in interface InterpreterDriver
scriptFile
- filename containing the code to be executed. This must
end in either a '.js' or '.es' extension.argNames
- an array containing the names of arguments to be passed to
the evaluationargValues
- an array containing the values of the arguments to be
passed to the evaluation
InterpreterDriver.InterpreterException
- if an exception occurs during
executionpublic java.lang.String[] getSupportedExtensions()
getSupportedExtensions
in interface InterpreterDriver
public java.lang.String[] getSupportedLanguages()
getSupportedLanguages
in interface InterpreterDriver
public void setVariable(java.lang.String name, java.lang.String value)
setVariable
in interface InterpreterDriver
name
- the name of the variable to setvalue
- the value to assign the variablepublic void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |