< prev index next >

nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java

Print this page




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.api.tree;
  27 
  28 import java.io.File;
  29 import java.io.IOException;
  30 import java.io.Reader;
  31 import java.net.URL;
  32 import java.nio.file.Path;
  33 import jdk.nashorn.api.scripting.NashornException;
  34 import jdk.nashorn.api.scripting.ScriptObjectMirror;
  35 
  36 /**
  37  * Represents nashorn ECMAScript parser instance.
  38  *
  39  * @since 1.9
  40  */
  41 @jdk.Exported
  42 public interface Parser {
  43     /**
  44      * Parses the source file and returns compilation unit tree
  45      *
  46      * @param file source file to parse
  47      * @param listener to receive diagnostic messages from the parser. This can be null.
  48      * if null is passed, a NashornException is thrown on the first parse error.
  49      * @return compilation unit tree
  50      * @throws NullPointerException if file is null
  51      * @throws IOException if parse source read fails
  52      * @throws NashornException is thrown if no listener is supplied and parser encounters error
  53      */
  54     public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException;
  55 
  56     /**
  57      * Parses the source Path and returns compilation unit tree
  58      *
  59      * @param path source Path to parse




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.api.tree;
  27 
  28 import java.io.File;
  29 import java.io.IOException;
  30 import java.io.Reader;
  31 import java.net.URL;
  32 import java.nio.file.Path;
  33 import jdk.nashorn.api.scripting.NashornException;
  34 import jdk.nashorn.api.scripting.ScriptObjectMirror;
  35 
  36 /**
  37  * Represents nashorn ECMAScript parser instance.
  38  *
  39  * @since 9
  40  */
  41 @jdk.Exported
  42 public interface Parser {
  43     /**
  44      * Parses the source file and returns compilation unit tree
  45      *
  46      * @param file source file to parse
  47      * @param listener to receive diagnostic messages from the parser. This can be null.
  48      * if null is passed, a NashornException is thrown on the first parse error.
  49      * @return compilation unit tree
  50      * @throws NullPointerException if file is null
  51      * @throws IOException if parse source read fails
  52      * @throws NashornException is thrown if no listener is supplied and parser encounters error
  53      */
  54     public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException;
  55 
  56     /**
  57      * Parses the source Path and returns compilation unit tree
  58      *
  59      * @param path source Path to parse


< prev index next >