Example #1
0
 /** Print the text of a message, translating newlines appropriately for the platform. */
 public static void printRawLines(PrintWriter writer, String msg) {
   int nl;
   while ((nl = msg.indexOf('\n')) != -1) {
     writer.println(msg.substring(0, nl));
     msg = msg.substring(nl + 1);
   }
   if (msg.length() != 0) writer.println(msg);
 }
Example #2
0
  /**
   * Print the faulty source code line and point to the error.
   *
   * @param pos Buffer index of the error position, must be on current line
   */
  private void printErrLine(int pos, PrintWriter writer) {
    String line = (source == null ? null : source.getLine(pos));
    if (line == null) return;
    int col = source.getColumnNumber(pos, false);

    printRawLines(writer, line);
    for (int i = 0; i < col - 1; i++) {
      writer.print((line.charAt(i) == '\t') ? "\t" : " ");
    }
    writer.println("^");
    writer.flush();
  }
Example #3
0
 public void printNewline() {
   noticeWriter.println();
 }