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.Returns the source option values associated with the parsing request's source and language.The source code to parse.
-
Method Details
-
getSource
The source code to parse.- Returns:
- the source code, never
null
- Since:
- 0.22
-
getOptionValues
Returns the source option values associated with the parsing request's source and language. This method should be preferred overTruffleLanguage.Env.getOptions(Source)
when accessing the source options of a source when possible.In order to allow users of the language to specify source options they must be declared by implementing
TruffleLanguage.getSourceOptionDescriptors()
.- Since:
- 25.0
-
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
-