当前位置: 首页>>代码示例>>Java>>正文


Java ParserException.throwAsEcmaException方法代码示例

本文整理汇总了Java中jdk.nashorn.internal.runtime.ParserException.throwAsEcmaException方法的典型用法代码示例。如果您正苦于以下问题:Java ParserException.throwAsEcmaException方法的具体用法?Java ParserException.throwAsEcmaException怎么用?Java ParserException.throwAsEcmaException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.nashorn.internal.runtime.ParserException的用法示例。


在下文中一共展示了ParserException.throwAsEcmaException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkFunctionParameters

import jdk.nashorn.internal.runtime.ParserException; //导入方法依赖的package包/类
private static void checkFunctionParameters(final String params) {
    final Parser parser = getParser(params);
    try {
        parser.parseFormalParameterList();
    } catch (final ParserException pe) {
        pe.throwAsEcmaException();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:NativeFunction.java

示例2: checkFunctionBody

import jdk.nashorn.internal.runtime.ParserException; //导入方法依赖的package包/类
private static void checkFunctionBody(final String funcBody) {
    final Parser parser = getParser(funcBody);
    try {
        parser.parseFunctionBody();
    } catch (final ParserException pe) {
        pe.throwAsEcmaException();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:NativeFunction.java

示例3: NativeRegExp

import jdk.nashorn.internal.runtime.ParserException; //导入方法依赖的package包/类
NativeRegExp(final String input, final String flagString, final Global global) {
    this(global);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }

    this.setLastIndex(0);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:NativeRegExp.java

示例4: parse

import jdk.nashorn.internal.runtime.ParserException; //导入方法依赖的package包/类
/**
 * Returns AST as JSON compatible string.
 *
 * @param context context
 * @param code code to be parsed
 * @param name name of the code source (used for location)
 * @param includeLoc tells whether to include location information for nodes or not
 * @return JSON string representation of AST of the supplied code
 */
public static String parse(final Context context, final String code, final String name, final boolean includeLoc) {
    final Parser       parser     = new Parser(context.getEnv(), sourceFor(name, code), new Context.ThrowErrorManager(), context.getEnv()._strict, context.getLogger(Parser.class));
    final JSONWriter   jsonWriter = new JSONWriter(includeLoc);
    try {
        final FunctionNode functionNode = parser.parse(); //symbol name is ":program", default
        functionNode.accept(jsonWriter);
        return jsonWriter.getString();
    } catch (final ParserException e) {
        e.throwAsEcmaException();
        return null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:JSONWriter.java

示例5: NativeRegExp

import jdk.nashorn.internal.runtime.ParserException; //导入方法依赖的package包/类
NativeRegExp(final String input, final String flagString, final Global global, final ScriptObject proto) {
    super(proto, $nasgenmap$);
    try {
        this.regexp = RegExpFactory.create(input, flagString);
    } catch (final ParserException e) {
        // translate it as SyntaxError object and throw it
        e.throwAsEcmaException();
        throw new AssertionError(); //guard against null warnings below
    }
    this.globalObject = global;
    this.setLastIndex(0);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:NativeRegExp.java


注:本文中的jdk.nashorn.internal.runtime.ParserException.throwAsEcmaException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。