public interface Parser
| Modifier and Type | Method | Description |
|---|---|---|
static Parser |
create(String... options) |
Factory method to create a new instance of Parser.
|
CompilationUnitTree |
parse(File file,
DiagnosticListener listener) |
Parses the source file and returns compilation unit tree
|
CompilationUnitTree |
parse(String name,
Reader reader,
DiagnosticListener listener) |
Parses the reader and returns compilation unit tree
|
CompilationUnitTree |
parse(String name,
String code,
DiagnosticListener listener) |
Parses the string source and returns compilation unit tree
|
CompilationUnitTree |
parse(URL url,
DiagnosticListener listener) |
Parses the source url and returns compilation unit tree
|
CompilationUnitTree |
parse(Path path,
DiagnosticListener listener) |
Parses the source Path and returns compilation unit tree
|
CompilationUnitTree |
parse(ScriptObjectMirror scriptObj,
DiagnosticListener listener) |
Parses the source from script object and returns compilation unit tree
|
CompilationUnitTree parse(File file, DiagnosticListener listener) throws IOException, NashornException
file - source file to parselistener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.NullPointerException - if file is nullIOException - if parse source read failsNashornException - is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(Path path, DiagnosticListener listener) throws IOException, NashornException
path - source Path to parselistener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.NullPointerException - if path is nullIOException - if parse source read failsNashornException - is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(URL url, DiagnosticListener listener) throws IOException, NashornException
url - source file to parselistener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.NullPointerException - if url is nullIOException - if parse source read failsNashornException - is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(String name, Reader reader, DiagnosticListener listener) throws IOException, NashornException
name - name of the source file to parsereader - from which source is readlistener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.NullPointerException - if name or reader is nullIOException - if parse source read failsNashornException - is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(String name, String code, DiagnosticListener listener) throws NashornException
name - of the sourcecode - string sourcelistener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.NullPointerException - if name or code is nullNashornException - is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(ScriptObjectMirror scriptObj, DiagnosticListener listener) throws NashornException
scriptObj - script object whose script and name properties are used for script sourcelistener - to receive diagnostic messages from the parser. This can be null.
if null is passed, a NashornException is thrown on the first parse error.NullPointerException - if scriptObj is nullNashornException - is thrown if no listener is supplied and parser encounters errorstatic Parser create(String... options) throws IllegalArgumentException
options - configuration options to initialize the Parser.
Currently the following options are supported:
NullPointerException - if options array or any of its element is nullIllegalArgumentException - on unsupported option value. Submit a bug or feature
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 2014, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-Debian+0-9b155-1