ScopeType
- the type of the scope of the language.ReaderType
- the type of the input reader.public interface ScriptSystemInterface<ScopeType extends ExecutionScope,ReaderType extends ReaderInterface>
Modifier and Type | Field and Description |
---|---|
static ScriptType |
ANY |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
assignmentToString(java.lang.String identifier,
java.lang.String value)
Returns an assignment in valid script syntax.
|
java.lang.String |
callToString(java.lang.String key,
java.lang.String arguments)
Returns a call in valid script syntax.
|
ExecutionResult<?> |
cast(ExecutionResult<?> value,
ScriptType toType)
Tries to cast the given value to the given type.
|
ExecuterInterface |
createExecuter(ReaderType source)
Parses the given source and creates an executer from it.
|
ExecuterInterface |
createExecuter(java.lang.String source)
Parses the given string and creates an executer out of it.
|
SignatureInterface |
createSignature()
Creates a new uninitialized signature.
|
ExecuterInterface |
executerFromFile(java.io.File file)
Parses the given file and creates an executer from it.
|
ReaderType |
fileToScriptReader(java.io.File file)
Creates a script reader from file content.
|
ReaderType |
fileToScriptReader(java.lang.String filename)
Creates a script reader from file content.
|
ScriptType |
getScriptType(java.lang.String typeName)
Returns the script type associated with the given type key.
|
ScopeType |
getTopScope()
Returns the global scope of the script.
|
void |
putTypeCast(ScriptType fromType,
ScriptType toType,
TypeCast<?,?> typeCast)
Registers the given type cast with the two given types.
|
void |
putTypeCast(java.lang.String[] fromTypes,
java.lang.String toType,
TypeCast<?,?> typeCast)
Registers one type cast and associates it with the given types.
|
void |
putTypeCast(java.lang.String fromType,
java.lang.String[] toTypes,
TypeCast<?,?> typeCast)
Registers one type cast and associates it with the given types.
|
void |
putTypeCast(java.lang.String fromType,
java.lang.String toType,
TypeCast<?,?> typeCast)
Registers the given type cast with the two given types.
|
void |
registerComplexType(ScriptComplexType complexType)
Registers the given complex type.
|
ScriptComplexType |
registerComplexType(java.lang.String name,
java.lang.String parameters)
Creates and registers a complex type.
|
java.lang.String |
statementToString(java.lang.String statement)
Returns the given statement embedded in valid script syntax.
|
ReaderType |
stringToScriptReader(java.lang.String string)
Creates a script reader from string.
|
static final ScriptType ANY
ScriptType getScriptType(java.lang.String typeName)
typeName
- the key of the type to return.void putTypeCast(ScriptType fromType, ScriptType toType, TypeCast<?,?> typeCast)
fromType
- the input type of the cast.toType
- the output type of the cast.typeCast
- the type cast to register.void putTypeCast(java.lang.String fromType, java.lang.String toType, TypeCast<?,?> typeCast)
fromType
- the key of the input type of the cast.toType
- the key of the output type of the cast.typeCast
- the type cast to register.void putTypeCast(java.lang.String[] fromTypes, java.lang.String toType, TypeCast<?,?> typeCast)
fromTypes
- keys of the input types. The given type cast reference will be registered with every single key.toType
- key of the output type.typeCast
- the type cast to register.void putTypeCast(java.lang.String fromType, java.lang.String[] toTypes, TypeCast<?,?> typeCast)
fromType
- key of the input type.toTypes
- keys of the output types. The given type cast reference will be registered with every single key.typeCast
- the type cast to register.ExecutionResult<?> cast(ExecutionResult<?> value, ScriptType toType)
value
- the value to cast.toType
- the type to which to cast the value.void registerComplexType(ScriptComplexType complexType)
complexType
- the complex type to register.ScriptComplexType registerComplexType(java.lang.String name, java.lang.String parameters) throws ParameterParseException
name
- the name of the complex type to create.parameters
- the names and types of the complex type given as a string. See ParameterTuple
for the syntax.ParameterParseException
- if an error occurred while parsing the parameter string.SignatureInterface createSignature()
ScopeType getTopScope()
ReaderType fileToScriptReader(java.io.File file)
file
- the file to parse.ReaderType fileToScriptReader(java.lang.String filename)
filename
- the filename of the file to parse.ReaderType stringToScriptReader(java.lang.String string)
string
- the string containing the source code to parse.ExecuterInterface createExecuter(ReaderType source)
source
- the source code to parse.ExecuterInterface createExecuter(java.lang.String source)
source
- the string containing the source code to parse.ExecuterInterface executerFromFile(java.io.File file)
file
- the file containing the source code to parse.java.lang.String statementToString(java.lang.String statement)
statement
- the statement.java.lang.String assignmentToString(java.lang.String identifier, java.lang.String value)
identifier
- the left hand side of the assignment.value
- the right hand side of the assignment.java.lang.String callToString(java.lang.String key, java.lang.String arguments)
key
- the identifier of the call.arguments
- the arguments of the call.