public int getEndColumn(ManifestProblem manifestParserProblemInstance) { int lb = getRelevantEndLinebreakEntry(manifestParserProblemInstance.getEndOffset()); return manifestParserProblemInstance.getEndOffset() - linebreaks[lb]; }
public int getStartColumn(ManifestProblem manifestParserProblemInstance) { int lb = getRelevantStartLinebreakEntry(manifestParserProblemInstance.getStartOffset()); return manifestParserProblemInstance.getStartOffset() - linebreaks[lb]; }
/** * Logs the ManifestProblem <code>problem</code>. */ private void logManifestProblem(ManifestProblem problem) { TOSCAMetaFileParser.LOGGER.warn(problem.toString()); } }
private void recordProblem(ManifestProblemKind problemKind, int start, int end, String... inserts) { tokenStream.recordProblem(new ManifestProblem(problemKind, context, start, end, inserts)); }
public static ManifestContents getManifest(Reader reader) { ManifestParser parser = new RecoveringManifestParser(); try { ManifestContents manifest = parser.parse(reader); if (parser.foundProblems()) { for (ManifestProblem problem : parser.getProblems()) { System.err.println(problem.toStringWithContext()); System.err.println(); } throw new RuntimeException("There was a problem with the manifest"); } return manifest; } catch (IOException e) { throw new RuntimeException(e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { // Nothing to do } } } }
/** * Record a problem with parsing. * * @param parseProblem the kind of problem that occurred * @param startOffset the start offset of the problem * @param endOffset the end offset of the problem * @param inserts the inserts for the problem message text */ private void recordProblem(ManifestProblemKind parseProblem, int startOffset, int endOffset, String... inserts) { tokenStream .recordProblem(new ManifestProblem(parseProblem, tokenStream.getSourceContext(), startOffset, endOffset, inserts)); }
public int getLine(ManifestProblem manifestParserProblemInstance) { return getRelevantStartLinebreakEntry(manifestParserProblemInstance.getStartOffset()) + 1; }