public class PolyglotEngine.Language extends Object
PolyglotEngine. The handle provides
access to the language's metadata, including the language's name,
version, and supported MIME types.
A Truffle language implementation is an extension of the abstract class
TruffleLanguage, where more details about interactions between languages and engines
can be found.
PolyglotEngine.getLanguages()| Modifier and Type | Method and Description |
|---|---|
PolyglotEngine.Value |
eval(Source source)
Evaluates code using this language, ignoring the code's
MIME
type. |
PolyglotEngine.Value |
getGlobalObject()
Returns this language's global object,
null if not supported. |
Set<String> |
getMimeTypes()
Gets the MIME types supported by this language.
|
String |
getName()
Gets the human-readable name of this language.
|
String |
getVersion()
Gets the version of this language.
|
boolean |
isInteractive()
Returns whether this language supports interactive evaluation of
sources. |
String |
toString() |
public Set<String> getMimeTypes()
public String getName()
public String getVersion()
public boolean isInteractive()
sources.
Such languages should be displayed in interactive environments and presented to the user.true if and only if this language implements an interactive response
to evaluation of interactive sources.public PolyglotEngine.Value eval(Source source)
MIME
type.
When evaluating an interactive source the result of the
evaluation is
tested to be visible and if the value
is visible, it gets converted to string
and printed to standard
output.
source - code to executePolyglotEngine.Value that holds the resultException - thrown to signal errors while processing the codepublic PolyglotEngine.Value getGlobalObject()
null if not supported.
The result is expected to be a TruffleObject (e.g. a native object from the other
language) but technically it can also be one of Java's primitive wrappers (
Integer , Double, Short, etc.).
null if the language has none