public static final class TruffleLanguage.ParsingRequest extends Object
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getArgumentNames()
Argument names.
|
MaterializedFrame |
getFrame()
Specifies the execution context for parsing.
|
Node |
getLocation()
Specifies the code location for parsing.
|
Source |
getSource()
The source code to parse.
|
public Source getSource()
nullpublic Node getLocation()
Node in the AST. There doesn't have to be any specific location and in such case
this method returns null. If the node is provided, it can be for example
EventContext.getInstrumentedNode() when
EventContext.parseInContext(com.oracle.truffle.api.source.Source, java.lang.String...) is called.Node defining AST context for the parsing or nullpublic MaterializedFrame getFrame()
DebugStackFrame.eval(String) method, this method
provides access to current frame with local variables, etc.MaterializedFrame exposing the current execution state or
null if there is nonepublic List<String> getArgumentNames()
parsing is an
instance of CallTarget that can be
invoked without or with some parameters. If the invocation requires some arguments, and
the TruffleLanguage.ParsingRequest.getSource() references them, it is essential to name them. Example that uses
the argument names:
public void parseWithParams(TruffleLanguage.Envenv) {Sourcemultiply =Source.newBuilder("a * b"). mimeType("text/javascript"). name("mul.js"). build();CallTargetmethod = env.parse(multiply, "a", "b");NumberfortyTwo = (Number) method.call(6, 7); assert 42 == fortyTwo.intValue();Numberten = (Number) method.call(2, 5); assert 10 == ten.intValue(); }
CallTarget.call(java.lang.Object...)