formatString = getErrorFormat(); break; case WARNING: formatString = getWarningFormat(); break; default: assert false; formatString = getErrorFormat(); formatString = getSyntaxErrorFormat(); break; case INTERNAL_ERROR: formatString = getInternalErrorFormat(); break; default:
private String getLocationString(String filePath, int line, int col) { if (filePath == null) return ""; String location = filePath; if (line != -1) location = String.format(getLocationFormat(), location, (line + 1), (col + 1)); assert location != null; return location; }
/** * @return the string used to format messages categorized as syntax errors. */ private String getSyntaxErrorFormat() { return getMessage(SYNTAXERROR_FORMAT_ID); }
@Override public int mainNoExit(final String[] args, List<ICompilerProblem> problems, Boolean printProblems) { int exitCode = -1; try { exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems); } catch (Exception e) { System.err.println(e.toString()); } finally { if (problems != null && !problems.isEmpty()) { if (printProblems) { final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter( workspace); final ProblemPrinter printer = new ProblemPrinter(formatter); printer.printProblems(problems); } } } return exitCode; }
final String locationString = getLocationString(problem.getSourcePath(), problem.getLine(), problem.getColumn()); if (!locationString.isEmpty()) description = String.format(getProblemFormat(problem), description); buffer.append(NEW_LINE); final String lineText = getLineText(problem); if (lineText != null) buffer.append(getLinePointer(lineText, problem.getColumn())); buffer.append(NEW_LINE);
@Override public int mainNoExit(final String[] args, List<ICompilerProblem> problems, Boolean printProblems) { int exitCode = -1; try { exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems); } catch (Exception e) { System.err.println(e.toString()); } finally { if (problems != null && !problems.isEmpty()) { if (printProblems) { final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter( workspace); final ProblemPrinter printer = new ProblemPrinter(formatter); printer.printProblems(problems); } } } return exitCode; }
final String locationString = getLocationString(problem.getSourcePath(), problem.getLine(), problem.getColumn()); if (!locationString.isEmpty()) description = String.format(getProblemFormat(problem), description); buffer.append(NEW_LINE); final String lineText = getLineText(problem); if (lineText != null) buffer.append(getLinePointer(lineText, problem.getColumn())); buffer.append(NEW_LINE);
@Override public int mainNoExit(final String[] args, List<ICompilerProblem> problems, Boolean printProblems) { int exitCode = -1; try { exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems); } catch (Exception e) { System.err.println(e.toString()); } finally { if (problems != null && !problems.isEmpty()) { if (printProblems) { final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter( workspace); final ProblemPrinter printer = new ProblemPrinter(formatter); printer.printProblems(problems); } } } return exitCode; }
formatString = getErrorFormat(); break; case WARNING: formatString = getWarningFormat(); break; default: assert false; formatString = getErrorFormat(); formatString = getSyntaxErrorFormat(); break; case INTERNAL_ERROR: formatString = getInternalErrorFormat(); break; default:
/** * @return the string used to format messages categorized as errors. */ private String getErrorFormat() { return getMessage(ERROR_FORMAT_ID); }
private String getLocationString(String filePath, int line, int col) { if (filePath == null) return ""; String location = filePath; if (line != -1) location = String.format(getLocationFormat(), location, (line + 1), (col + 1)); assert location != null; return location; }
@Override public int mainNoExit(final String[] args, List<ICompilerProblem> problems, Boolean printProblems) { int exitCode = -1; try { exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems); } catch (Exception e) { System.err.println(e.toString()); } finally { if (problems != null && !problems.isEmpty()) { if (printProblems) { final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter( workspace); final ProblemPrinter printer = new ProblemPrinter(formatter); printer.printProblems(problems); } } } return exitCode; }
/** * @return the string used to format messages categorized as warnings. */ private String getWarningFormat() { return getMessage(WARNING_FORMAT_ID); }
@Override public int mainNoExit(final String[] args, List<ICompilerProblem> problems, Boolean printProblems) { int exitCode = -1; try { exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems); } catch (Exception e) { System.err.println(e.toString()); } finally { if (problems != null && !problems.isEmpty()) { if (printProblems) { final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter( workspace); final ProblemPrinter printer = new ProblemPrinter(formatter); printer.printProblems(problems); } } } return exitCode; }
/** * @return the string used to format messages categorized as syntax errors. */ private String getSyntaxErrorFormat() { return getMessage(SYNTAXERROR_FORMAT_ID); }
@Override public int mainNoExit(final String[] args, List<ICompilerProblem> problems, Boolean printProblems) { int exitCode = -1; try { exitCode = _mainNoExit(ArgumentUtil.fixArgs(args), problems); } catch (Exception e) { System.err.println(e.toString()); } finally { if (problems != null && !problems.isEmpty()) { if (printProblems) { final WorkspaceProblemFormatter formatter = new WorkspaceProblemFormatter( workspace, createProblemCategorizer()); final ProblemPrinter printer = new ProblemPrinter(formatter); printer.printProblems(problems); } } } return exitCode; }
/** * @return the string used to format messages categorized as internal errors. */ private String getInternalErrorFormat() { return getMessage(INTERNALERROR_FORMAT_ID); }
/** * Print out problems to standard output. * * @param problems */ private void printProblems(Collection<ICompilerProblem> problems) { CompilerProblemCategorizer categorizer = new CompilerProblemCategorizer(); ProblemFormatter formatter = new WorkspaceProblemFormatter(new Workspace(), categorizer); ProblemPrinter printer = new ProblemPrinter(formatter, System.err); printer.printProblems(problems); }
/** * @return the string used to format messages categorized as warnings. */ private String getWarningFormat() { return getMessage(WARNING_FORMAT_ID); }
/** * Print out problems to standard output. * * @param problems */ private void printProblems(Collection<ICompilerProblem> problems) { CompilerProblemCategorizer categorizer = new CompilerProblemCategorizer(); ProblemFormatter formatter = new WorkspaceProblemFormatter(new Workspace(), categorizer); ProblemPrinter printer = new ProblemPrinter(formatter, System.err); printer.printProblems(problems); }