Package com.oracle.truffle.api
Class TruffleLanguage.ParsingRequest
java.lang.Object
com.oracle.truffle.api.TruffleLanguage.ParsingRequest
- Enclosing class:
TruffleLanguage<C>
Request for parsing. Contains information of what to parse and in which context.
- Since:
- 0.22
-
Method Summary
Modifier and TypeMethodDescriptionArgument names.The source code to parse.
-
Method Details
-
getSource
The source code to parse.- Returns:
- the source code, never
null
- Since:
- 0.22
-
getArgumentNames
Argument names. The result ofparsing
is an instance ofCallTarget
thatcan be invoked
without or with some parameters. If the invocation requires some arguments, and thegetSource()
references them, it is essential to name them. Example that uses the argument names:public void parseWithParams(Env env) { Source multiply = Source.newBuilder("js", "a * b", "mul.js").build(); CallTarget method = env.parsePublic(multiply, "a", "b"); Number fortyTwo = (Number) method.call(6, 7); assert 42 == fortyTwo.intValue(); Number ten = (Number) method.call(2, 5); assert 10 == ten.intValue(); }
- Returns:
- symbolic names for parameters of
CallTarget.call(java.lang.Object...)
- Since:
- 0.22
-