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. 60 * if null is passed, a NashornException is thrown on the first parse error. | 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 * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool 40 * are deprecated with the intent to remove them in a future release. 41 * 42 * @since 9 43 */ 44 @Deprecated(since="11", forRemoval=true) 45 public interface Parser { 46 /** 47 * Parses the source file and returns compilation unit tree 48 * 49 * @param file source file to parse 50 * @param listener to receive diagnostic messages from the parser. This can be null. 51 * if null is passed, a NashornException is thrown on the first parse error. 52 * @return compilation unit tree 53 * @throws NullPointerException if file is null 54 * @throws IOException if parse source read fails 55 * @throws NashornException is thrown if no listener is supplied and parser encounters error 56 */ 57 public CompilationUnitTree parse(final File file, final DiagnosticListener listener) throws IOException, NashornException; 58 59 /** 60 * Parses the source Path and returns compilation unit tree 61 * 62 * @param path source Path to parse 63 * @param listener to receive diagnostic messages from the parser. This can be null. 64 * if null is passed, a NashornException is thrown on the first parse error. |