/** * Enters the given tree (se {@link #scan(JCTree)}. */ protected void enter(JCTree tree) { super.enter(tree); positionStack.push(new Position(getCurrentPosition(), currentLine, currentColumn)); if (compilationUnit != null && tree.pos >= 0 && inSourceMap(tree)) { sourceMap.addEntry(new Position(tree.pos, // compilationUnit.lineMap.getLineNumber(tree.pos), // compilationUnit.lineMap.getColumnNumber(tree.pos)), positionStack.peek()); } }
/** * Exits the currently scanned tree. */ @Override protected void exit() { JCTree tree = stack.peek(); if (compilationUnit != null && tree instanceof JCBlock) { int endPos = tree.getEndPosition(diagnosticSource.getEndPosTable()); sourceMap.addEntry( new Position(endPos, // compilationUnit.lineMap.getLineNumber(endPos), // compilationUnit.lineMap.getColumnNumber(endPos)), new Position(getCurrentPosition(), currentLine, currentColumn)); } super.exit(); positionStack.pop(); }
/** Source file positions in CRT are integers in the format: * {@literal line-number << LINESHIFT + column-number } */ private int encodePosition(int pos, Position.LineMap lineMap, Log log) { int line = lineMap.getLineNumber(pos); int col = lineMap.getColumnNumber(pos); int new_pos = Position.encodePosition(line, col); if (crtDebug) { System.out.println(", line = " + line + ", column = " + col + ", new_pos = " + new_pos); } if (new_pos == Position.NOPOS) log.warning(pos, "position.overflow", line); return new_pos; }
/** Source file positions in CRT are integers in the format: * line-number << LINESHIFT + column-number */ private int encodePosition(int pos, Position.LineMap lineMap, Log log) { int line = lineMap.getLineNumber(pos); int col = lineMap.getColumnNumber(pos); int new_pos = Position.encodePosition(line, col); if (crtDebug) { System.out.println(", line = " + line + ", column = " + col + ", new_pos = " + new_pos); } if (new_pos == Position.NOPOS) log.warning(pos, "position.overflow", line); return new_pos; }
public int getColumn() { return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1; }
/** Source file positions in CRT are integers in the format: * line-number << LINESHIFT + column-number */ private int encodePosition(int pos, Position.LineMap lineMap, Log log) { int line = lineMap.getLineNumber(pos); int col = lineMap.getColumnNumber(pos); int new_pos = Position.encodePosition(line, col); if (crtDebug) { System.out.println(", line = " + line + ", column = " + col + ", new_pos = " + new_pos); } if (new_pos == Position.NOPOS) log.warning(pos, "position.overflow", line); return new_pos; }
/** Source file positions in CRT are integers in the format: * {@literal line-number << LINESHIFT + column-number } */ private int encodePosition(int pos, Position.LineMap lineMap, Log log) { int line = lineMap.getLineNumber(pos); int col = lineMap.getColumnNumber(pos); int new_pos = Position.encodePosition(line, col); if (crtDebug) { System.out.println(", line = " + line + ", column = " + col + ", new_pos = " + new_pos); } if (new_pos == Position.NOPOS) log.warning(pos, "position.overflow", line); return new_pos; }
public int getColumn() { return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1; }
public int getColumn() { return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1; }
/** The column in the source file. The first column is * numbered 1; 0 means no column information is available. * Columns count characters in the input stream; a tab * advances the column number to the next 8-column tab stop. */ public int column() { if (lineMap == null) { return 0; }else { return lineMap.getColumnNumber(position); } }
public int getColumn() { return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1; }