< 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 public interface Parser {
  42     /**
  43      * Parses the source file and returns compilation unit tree
  44      *
  45      * @param file source file to parse
  46      * @param listener to receive diagnostic messages from the parser. This can be null.
  47      * if null is passed, a NashornException is thrown on the first parse error.
  48      * @return compilation unit tree
  49      * @throws NullPointerException if file is null
  50      * @throws IOException if parse source read fails
  51      * @throws NashornException is thrown if no listener is supplied and parser encounters error
  52      */
  53     public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException;
  54 
  55     /**
  56      * Parses the source Path and returns compilation unit tree
  57      *
  58      * @param path source Path to parse
  59      * @param listener to receive diagnostic messages from the parser. This can be null.




  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 public interface Parser {
  42     /**
  43      * Parses the source file and returns compilation unit tree
  44      *
  45      * @param file source file to parse
  46      * @param listener to receive diagnostic messages from the parser. This can be null.
  47      * if null is passed, a NashornException is thrown on the first parse error.
  48      * @return compilation unit tree
  49      * @throws NullPointerException if file is null
  50      * @throws IOException if parse source read fails
  51      * @throws NashornException is thrown if no listener is supplied and parser encounters error
  52      */
  53     public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException;
  54 
  55     /**
  56      * Parses the source Path and returns compilation unit tree
  57      *
  58      * @param path source Path to parse
  59      * @param listener to receive diagnostic messages from the parser. This can be null.


< prev index next >