public int getColumn(int offset) { int lb = getRelevantStartLinebreakEntry(offset); return offset - linebreaks[lb]; }
/** * Returns a multi line message that includes the manifest extract that gave * rise to the problem. * * @return a multi line string */ public String toStringWithContext() { int relevantLine = context.getLine(startoffset); String relevantLineData = context.getLineAsString(relevantLine); String theMessage = problemKind.format(context.getLine(startoffset), context.getColumn(startoffset), inserts); StringBuilder beautifulMessage = new StringBuilder(); beautifulMessage.append(relevantLineData); int scol = context.getColumn(startoffset); int ecol = context.getColumn(endoffset); int where = 0; for (where = 0; where < scol; where++) { beautifulMessage.append(' '); } beautifulMessage.append('^'); if (ecol != scol) { where++; for (; where < ecol; where++) { beautifulMessage.append(' '); } beautifulMessage.append('^'); } beautifulMessage.append('\n'); beautifulMessage.append(theMessage); return beautifulMessage.toString(); }
this.context = new SourceContext(str); tokenStream.getSourceContext().setLinebreaks(linebreaks);
public int getEndLine(Token token) { return getRelevantEndLinebreakEntry(token.getEndOffset()) + 1; }
public int getEndColumn() { return context.getColumn(endoffset); }
public int getStartLine() { return context.getLine(startoffset); }
public int getEndColumn(ManifestProblem manifestParserProblemInstance) { int lb = getRelevantEndLinebreakEntry(manifestParserProblemInstance.getEndOffset()); return manifestParserProblemInstance.getEndOffset() - linebreaks[lb]; }
public int getStartColumn() { return context.getColumn(startoffset); }
public int getEndLine() { return context.getLine(endoffset); }
public int getLine(int offset) { return getRelevantStartLinebreakEntry(offset) + 1; }
public int getEndColumn(Token token) { int lb = getRelevantEndLinebreakEntry(token.getEndOffset()); return token.getEndOffset() - linebreaks[lb]; }
/** * Compute the line that the token is on, using the linebreak information * and the tokens offset * @param token on the line * @return the line number */ public int getLine(Token token) { return getRelevantStartLinebreakEntry(token.getStartOffset()) + 1; }
public int getLine(ManifestProblem manifestParserProblemInstance) { return getRelevantStartLinebreakEntry(manifestParserProblemInstance.getStartOffset()) + 1; }
public int getStartColumn(Token token) { int lb = getRelevantStartLinebreakEntry(token.getStartOffset()); return token.getStartOffset() - linebreaks[lb]; }
public int getStartColumn(ManifestProblem manifestParserProblemInstance) { int lb = getRelevantStartLinebreakEntry(manifestParserProblemInstance.getStartOffset()); return manifestParserProblemInstance.getStartOffset() - linebreaks[lb]; }