java.lang.Object
dev.civl.abc.token.IF.SourceFormatter
Methods for printing source information in various related tools.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAfter quoted source exceeds this number of characters, the quote will be elided using an ellipsis ("...")static final booleanAlways use plain text output? If this is true, only ASCII text will be used for diagnostics. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContent(StringBuffer buf) static voidaddLocator(StringBuffer buf, String filename, int lineno) static voidaddLocator(StringBuffer buf, String filename, int lineno, int startCol) static voidaddLocator(StringBuffer buf, String filename, int lineno, int startCol, int stopCol) static StringcloseErr()static Stringstatic StringPut string in the right color/format for an error message.voidgetLocator(boolean abbrev) getShortString(boolean abbrev) Produces a short locator string based on first token, followed by the complete text of the segments, all on one line.static Stringstatic Stringstatic Stringstatic StringopenErr()This code is placed before an error message to highlight it properly.static StringThis code is placed before source code excerpts to highlight the code properly.static StringquoteSource(String text, boolean clear)
-
Field Details
-
plain
public static final boolean plainAlways 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_CHARSAfter quoted source exceeds this number of characters, the quote will be elided using an ellipsis ("...")- See Also:
-
-
Constructor Details
-
SourceFormatter
-
-
Method Details
-
openSource
This code is placed before source code excerpts to highlight the code properly. -
closeSource
-
openErr
This code is placed before an error message to highlight it properly. -
closeErr
-
quoteSource
-
addLocator
public static void addLocator(StringBuffer buf, String filename, int lineno, int startCol, int stopCol) -
addLocator
-
addLocator
-
locator
-
locator
-
locator
-
errorify
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
-
getContent
-
getLocator
-
getDetailedReport
-
getShortString
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
-