-
-
Method Detail
-
parse
CompilationUnitTree parse(String name,
Reader reader,
DiagnosticListener listener)
throws IOException,
NashornException
Parses the reader and returns compilation unit tree
- Parameters:
name - name of the source file to parse
reader - from which source is read
listener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.
- Returns:
- compilation unit tree
- Throws:
NullPointerException - if name or reader is null
IOException - if parse source read fails
NashornException - is thrown if no listener is supplied and parser encounters error
-
parse
CompilationUnitTree parse(String name,
String code,
DiagnosticListener listener)
throws NashornException
Parses the string source and returns compilation unit tree
- Parameters:
name - of the source
code - string source
listener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.
- Returns:
- compilation unit tree
- Throws:
NullPointerException - if name or code is null
NashornException - is thrown if no listener is supplied and parser encounters error
-
parse
CompilationUnitTree parse(ScriptObjectMirror scriptObj,
DiagnosticListener listener)
throws NashornException
Parses the source from script object and returns compilation unit tree
- Parameters:
scriptObj - script object whose script and name properties are used for script source
listener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.
- Returns:
- compilation unit tree
- Throws:
NullPointerException - if scriptObj is null
NashornException - is thrown if no listener is supplied and parser encounters error