Module dev.civl.abc

Class SourceFormatter

java.lang.Object
dev.civl.abc.token.IF.SourceFormatter

public class SourceFormatter extends Object
Methods for printing source information in various related tools.
  • Field Details

    • plain

      public static final boolean plain
      Always use plain text output? If this is true, only ASCII text will be used for diagnostics. Otherwise, special color characters will be inserted *if* a console (terminal) is detected as the output device. If the output device is not a terminal, plain text will be used in any case.
      See Also:
    • MAX_SOURCE_CHARS

      public static final int MAX_SOURCE_CHARS
      After quoted source exceeds this number of characters, the quote will be elided using an ellipsis ("...")
      See Also:
  • Constructor Details

  • Method Details

    • openSource

      public static String openSource()
      This code is placed before source code excerpts to highlight the code properly.
    • closeSource

      public static String closeSource()
    • openErr

      public static String openErr()
      This code is placed before an error message to highlight it properly.
    • closeErr

      public static String closeErr()
    • quoteSource

      public static String quoteSource(String text, boolean clear)
    • addLocator

      public static void addLocator(StringBuffer buf, String filename, int lineno, int startCol, int stopCol)
    • addLocator

      public static void addLocator(StringBuffer buf, String filename, int lineno, int startCol)
    • addLocator

      public static void addLocator(StringBuffer buf, String filename, int lineno)
    • locator

      public static String locator(String filename, int lineno, int startCol, int stopCol)
    • locator

      public static String locator(String filename, int lineno, int startCol)
    • locator

      public static String locator(String filename, int lineno)
    • errorify

      public static String errorify(String str)
      Put string in the right color/format for an error message.
      Parameters:
      str - a non-null String
      Returns:
      a new String with same content as original except for color/formatting
    • addContent

      public void addContent(StringBuffer buf)
    • getContent

      public String getContent()
    • getLocator

      public String getLocator(boolean abbrev)
    • getDetailedReport

      public void getDetailedReport(StringBuffer buf)
    • getShortString

      public String getShortString(boolean abbrev)
      Produces a short locator string based on first token, followed by the complete text of the segments, all on one line.
      Returns:
      single-line string representation of source