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


Java ErrorManager.format方法代码示例

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


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

示例1: error

import jdk.nashorn.internal.runtime.ErrorManager; //导入方法依赖的package包/类
/**
 * Report an error.
 *
 * @param errorType  The error type
 * @param message    Error message.
 * @return ParserException upon failure. Caller should throw and not ignore
 */
protected final ParserException error(final JSErrorType errorType, final String message) {
    // TODO - column needs to account for tabs.
    final int position = Token.descPosition(token);
    final int column = position - linePosition;
    final String formatted = ErrorManager.format(message, source, line, column, token);
    return new ParserException(errorType, formatted, source, line, column, token);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AbstractParser.java

示例2: throwParserException

import jdk.nashorn.internal.runtime.ErrorManager; //导入方法依赖的package包/类
private void throwParserException(final String message, final Node origin) {
    if (origin == null) {
        throw new ParserException(message);
    }
    final Source source = compiler.getSource();
    final long token = origin.getToken();
    final int line = source.getLine(origin.getStart());
    final int column = source.getColumn(origin.getStart());
    final String formatted = ErrorManager.format(message, source, line, column, token);
    throw new ParserException(JSErrorType.SYNTAX_ERROR, formatted, source, line, column, token);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:AssignSymbols.java

示例3: error

import jdk.nashorn.internal.runtime.ErrorManager; //导入方法依赖的package包/类
ParserException error(final String message, final int start, final int length) throws ParserException {
    final long token     = Token.toDesc(STRING, start, length);
    final int  pos       = Token.descPosition(token);
    final Source src     = Source.sourceFor("<json>", source);
    final int  lineNum   = src.getLine(pos);
    final int  columnNum = src.getColumn(pos);
    final String formatted = ErrorManager.format(message, src, lineNum, columnNum, token);
    return new ParserException(JSErrorType.SYNTAX_ERROR, formatted, src, lineNum, columnNum, token);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:JSONParser.java

示例4: throwNotImplementedYet

import jdk.nashorn.internal.runtime.ErrorManager; //导入方法依赖的package包/类
private void throwNotImplementedYet(final String msgId, final Node node) {
    final long token = node.getToken();
    final int line = source.getLine(node.getStart());
    final int column = source.getColumn(node.getStart());
    final String message = ECMAErrors.getMessage("unimplemented." + msgId);
    final String formatted = ErrorManager.format(message, source, line, column, token);
    throw new RuntimeException(formatted);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Lower.java

示例5: error

import jdk.nashorn.internal.runtime.ErrorManager; //导入方法依赖的package包/类
/**
 * Generate a runtime exception
 *
 * @param message       error message
 * @param type          token type
 * @param start         start position of lexed error
 * @param length        length of lexed error
 * @throws ParserException  unconditionally
 */
protected void error(final String message, final TokenType type, final int start, final int length) throws ParserException {
    final long token     = Token.toDesc(type, start, length);
    final int  pos       = Token.descPosition(token);
    final int  lineNum   = source.getLine(pos);
    final int  columnNum = source.getColumn(pos);
    final String formatted = ErrorManager.format(message, source, lineNum, columnNum, token);
    throw new ParserException(JSErrorType.SYNTAX_ERROR, formatted, source, lineNum, columnNum, token);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:Lexer.java


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