public interface Parser
Modifier and Type | Method and Description |
---|---|
CompilationUnitTree |
parse(File file,
DiagnosticListener listener)
Parses the source file and returns compilation unit tree
|
CompilationUnitTree |
parse(jdk.nashorn.api.scripting.ScriptObjectMirror scriptObj,
DiagnosticListener listener)
Parses the source from script object and returns compilation unit tree
|
CompilationUnitTree |
parse(String name,
Reader reader,
DiagnosticListener listener)
Parses the readerand 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(File file, DiagnosticListener listener) throws IOException, jdk.nashorn.api.scripting.NashornException
file
- source file to parselistener
- to receive diagnostic messages from the parserIOException
- if parse source read failsjdk.nashorn.api.scripting.NashornException
- is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(URL url, DiagnosticListener listener) throws IOException, jdk.nashorn.api.scripting.NashornException
url
- source file to parselistener
- to receive diagnostic messages from the parserIOException
- if parse source read failsjdk.nashorn.api.scripting.NashornException
- is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(String name, Reader reader, DiagnosticListener listener) throws IOException, jdk.nashorn.api.scripting.NashornException
name
- name of the source file to parsereader
- from which source is readlistener
- to receive diagnostic messages from the parserIOException
- if parse source read failsjdk.nashorn.api.scripting.NashornException
- is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(String name, String code, DiagnosticListener listener) throws jdk.nashorn.api.scripting.NashornException
name
- of the sourcecode
- string sourcelistener
- to receive diagnostic messages from the parserjdk.nashorn.api.scripting.NashornException
- is thrown if no listener is supplied and parser encounters errorCompilationUnitTree parse(jdk.nashorn.api.scripting.ScriptObjectMirror scriptObj, DiagnosticListener listener) throws jdk.nashorn.api.scripting.NashornException
scriptObj
- script object whose script and name properties are used for script sourcelistener
- to receive diagnostic messages from the parserjdk.nashorn.api.scripting.NashornException
- is thrown if no listener is supplied and parser encounters error