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


Java Source.getColumn方法代码示例

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


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

示例1: throwParserException

import jdk.nashorn.internal.runtime.Source; //导入方法依赖的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

示例2: error

import jdk.nashorn.internal.runtime.Source; //导入方法依赖的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

示例3: enterThrowNode

import jdk.nashorn.internal.runtime.Source; //导入方法依赖的package包/类
@Override
public boolean enterThrowNode(final ThrowNode throwNode) {
    if(!method.isReachable()) {
        return false;
    }
    enterStatement(throwNode);

    if (throwNode.isSyntheticRethrow()) {
        method.beforeJoinPoint(throwNode);

        //do not wrap whatever this is in an ecma exception, just rethrow it
        final IdentNode exceptionExpr = (IdentNode)throwNode.getExpression();
        final Symbol exceptionSymbol = exceptionExpr.getSymbol();
        method.load(exceptionSymbol, EXCEPTION_TYPE);
        method.checkcast(EXCEPTION_TYPE.getTypeClass());
        method.athrow();
        return false;
    }

    final Source     source     = getCurrentSource();
    final Expression expression = throwNode.getExpression();
    final int        position   = throwNode.position();
    final int        line       = throwNode.getLineNumber();
    final int        column     = source.getColumn(position);

    // NOTE: we first evaluate the expression, and only after it was evaluated do we create the new ECMAException
    // object and then somewhat cumbersomely move it beneath the evaluated expression on the stack. The reason for
    // this is that if expression is optimistic (or contains an optimistic subexpression), we'd potentially access
    // the not-yet-<init>ialized object on the stack from the UnwarrantedOptimismException handler, and bytecode
    // verifier forbids that.
    loadExpressionAsObject(expression);

    method.load(source.getName());
    method.load(line);
    method.load(column);
    method.invoke(ECMAException.CREATE);

    method.beforeJoinPoint(throwNode);
    method.athrow();

    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:CodeGenerator.java


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