public interface LanguageAdapter
Language adapters are usually accessed via a LanguageManager
instance.
LanguageManager
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_EXTENSION
Attribute for default source code filename extension.
|
static String |
DEFAULT_TAG
Default language tag used for scriptlets.
|
static String |
EXTENSIONS
Attribute for standard source code filename extensions.
|
static String |
LANGUAGE_NAME
Attribute for the name of the implemented language.
|
static String |
LANGUAGE_VERSION
Attribute for the version of the implemented language.
|
static String |
NAME
Attribute for the name of the language adapter implementation.
|
static String |
TAGS
Attribute for language tags supported for scriptlets.
|
static String |
VERSION
Attribute for the version of the language adapter implementation.
|
Modifier and Type | Method and Description |
---|---|
Program |
createProgram(String sourceCode,
boolean isScriptlet,
int position,
int startLineNumber,
int startColumnNumber,
Executable executable)
Turns source code into a program.
|
Object |
enter(String entryPointName,
Executable executable,
ExecutionContext executionContext,
Object... arguments)
Enters the executable at a stored, named location.
|
Map<String,Object> |
getAttributes()
Adapter attributes.
|
Lock |
getLock()
Used when
isThreadSafe() returns false. |
LanguageManager |
getManager()
The language manager.
|
String |
getSourceCodeForExpressionInclude(String expression,
Executable executable)
Creates source code for including the output of a text-with-scriptlets
document.
|
String |
getSourceCodeForExpressionOutput(String expression,
Executable executable)
Creates source code for outputting a source code expression to standard
output.
|
String |
getSourceCodeForLiteralOutput(String literal,
Executable executable)
Creates source code for outputting literal text to standard output.
|
boolean |
isEphemeral()
Some languages are meant for use in one segment only.
|
boolean |
isThreadSafe()
Some languages or their script engines are inherently broken when called
by multiple threads.
|
void |
releaseContext(ExecutionContext executionContext)
Cleans up any resources used for an execution context.
|
void |
setManager(LanguageManager manager)
The language manager.
|
static final String NAME
static final String VERSION
static final String LANGUAGE_NAME
static final String LANGUAGE_VERSION
static final String EXTENSIONS
static final String DEFAULT_EXTENSION
static final String TAGS
static final String DEFAULT_TAG
LanguageManager getManager()
void setManager(LanguageManager manager)
manager
- The managerMap<String,Object> getAttributes()
boolean isThreadSafe()
boolean isEphemeral()
Lock getLock()
isThreadSafe()
returns false.String getSourceCodeForLiteralOutput(String literal, Executable executable) throws ParsingException
literal
- The literal textexecutable
- The executableParsingException
- In case of a parsing errorString getSourceCodeForExpressionOutput(String expression, Executable executable) throws ParsingException
expression
- The source code expressionexecutable
- The executableParsingException
- In case of a parsing errorString getSourceCodeForExpressionInclude(String expression, Executable executable) throws ParsingException
For this to work, the executable must have been created with a container
that supports an inclusion command named according to the language
manager attribute
LanguageManager.CONTAINER_INCLUDE_COMMAND_ATTRIBUTE
.
expression
- The source code expressionexecutable
- The executableParsingException
- In case of a parsing errorLanguageManager.getAttributes()
Program createProgram(String sourceCode, boolean isScriptlet, int position, int startLineNumber, int startColumnNumber, Executable executable) throws ParsingException
Program.prepare()
on the program.sourceCode
- The source codeisScriptlet
- Whether the source code is a scriptletposition
- The program's position in the executablestartLineNumber
- The line number in the document for where the program's source
code beginsstartColumnNumber
- The column number in the document for where the program's source
code beginsexecutable
- The executableParsingException
- In case of a parsing errorObject enter(String entryPointName, Executable executable, ExecutionContext executionContext, Object... arguments) throws NoSuchMethodException, ParsingException, ExecutionException
entryPointName
- The entry point nameexecutable
- The executableexecutionContext
- The executable contextarguments
- Optional state to pass to the entry pointNoSuchMethodException
- In case the entry point does not existParsingException
- In case of a parsing errorExecutionException
- In case of an execution errorvoid releaseContext(ExecutionContext executionContext)
executionContext
- The execution contextExecutionContext.getAttributes()
Copyright © 2009-2015 Three Crickets LLC.