本文整理汇总了Java中org.codehaus.groovy.ast.ASTNode.getColumnNumber方法的典型用法代码示例。如果您正苦于以下问题:Java ASTNode.getColumnNumber方法的具体用法?Java ASTNode.getColumnNumber怎么用?Java ASTNode.getColumnNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.groovy.ast.ASTNode
的用法示例。
在下文中一共展示了ASTNode.getColumnNumber方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
static Options parse(MethodNode mn, ASTNode source, String[] options) throws IncorrectTypeHintException {
int pIndex = 0;
boolean generateIndex = false;
for (String option : options) {
String[] keyValue = option.split("=");
if (keyValue.length==2) {
String key = keyValue[0];
String value = keyValue[1];
if ("argNum".equals(key)) {
pIndex = Integer.parseInt(value);
} else if ("index".equals(key)) {
generateIndex = Boolean.valueOf(value);
} else {
throw new IncorrectTypeHintException(mn, "Unrecognized option: "+key, source.getLineNumber(), source.getColumnNumber());
}
} else {
throw new IncorrectTypeHintException(mn, "Incorrect option format. Should be argNum=<num> or index=<boolean> ", source.getLineNumber(), source.getColumnNumber());
}
}
return new Options(pIndex, generateIndex);
}
示例2: createLocation
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
@Override
protected Location createLocation(@NonNull Context context, @NonNull Object cookie) {
ASTNode node = (ASTNode) cookie;
Pair<Integer, Integer> offsets = getOffsets(node, context);
int fromLine = node.getLineNumber() - 1;
int fromColumn = node.getColumnNumber() - 1;
int toLine = node.getLastLineNumber() - 1;
int toColumn = node.getLastColumnNumber() - 1;
return Location.create(context.file,
new DefaultPosition(fromLine, fromColumn, offsets.getFirst()),
new DefaultPosition(toLine, toColumn, offsets.getSecond()));
}
示例3: addErrorMessage
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
private void addErrorMessage(GroovyRuntimeException exception) {
ASTNode astNode = exception.getNode();
ModuleNode module = exception.getModule();
if (module == null) {
module = findModule(astNode);
}
String moduleName = module == null ? "<no module>" : module.getDescription();
int lineNumber = astNode == null ? -1 : astNode.getLineNumber();
int columnNumber = astNode == null ? -1 : astNode.getColumnNumber();
collector.add(new CompilerMessage(GroovyCompilerMessageCategories.ERROR, getExceptionMessage(exception), moduleName, lineNumber, columnNumber));
}
示例4: addError
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
@Override
public void addError(final String msg, final ASTNode expr) {
Long err = ((long) expr.getLineNumber()) << 16 + expr.getColumnNumber();
if ((DEBUG_GENERATED_CODE && expr.getLineNumber()<0) || !typeCheckingContext.reportedErrors.contains(err)) {
typeCheckingContext.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(
new SyntaxException(msg + '\n', expr.getLineNumber(), expr.getColumnNumber(), expr.getLastLineNumber(), expr.getLastColumnNumber()),
typeCheckingContext.source)
);
typeCheckingContext.reportedErrors.add(err);
}
}
示例5: addStaticTypeError
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
protected void addStaticTypeError(final String msg, final ASTNode expr) {
if (expr.getColumnNumber() > 0 && expr.getLineNumber() > 0) {
addError(StaticTypesTransformation.STATIC_ERROR_PREFIX + msg, expr);
} else {
if (DEBUG_GENERATED_CODE) {
addError(StaticTypesTransformation.STATIC_ERROR_PREFIX + "Error in generated code ["+expr.getText()+"] - "+ msg, expr);
}
// ignore errors which are related to unknown source locations
// because they are likely related to generated code
}
}
示例6: hasPlausibleSourcePosition
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
private static boolean hasPlausibleSourcePosition(ASTNode node) {
return node.getLineNumber() > 0
&& node.getColumnNumber() > 0
&& node.getLastLineNumber() >= node.getLineNumber()
&& node.getLastColumnNumber() >
(node.getLineNumber() == node.getLastLineNumber() ? node.getColumnNumber() : 0);
}
示例7: createLocation
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
private Location createLocation(@NonNull Context context, @NonNull Object cookie) {
ASTNode node = (ASTNode) cookie;
Pair<Integer, Integer> offsets = getOffsets(node, context);
int fromLine = node.getLineNumber() - 1;
int fromColumn = node.getColumnNumber() - 1;
int toLine = node.getLastLineNumber() - 1;
int toColumn = node.getLastColumnNumber() - 1;
return Location.create(context.file,
new DefaultPosition(fromLine, fromColumn, offsets.getFirst()),
new DefaultPosition(toLine, toColumn, offsets.getSecond()));
}
示例8: createSyntaxErrorMessage
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
private Message createSyntaxErrorMessage(String message, ASTNode node) {
return new SyntaxErrorMessage(
new SyntaxException(message, node.getLineNumber(), node.getColumnNumber(),
node.getLastLineNumber(), node.getLastColumnNumber()),
getSourceUnit());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:DependencyManagementBomTransformation.java
示例9: throwParserException
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
public void throwParserException() throws SyntaxException {
final ASTNode node = getNode();
throw new SyntaxException(getMessage(), node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber());
}
示例10: SyntaxException
import org.codehaus.groovy.ast.ASTNode; //导入方法依赖的package包/类
public SyntaxException(String message, ASTNode node) {
this(message, node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber());
}