Package jflex.logging
Class Out
- java.lang.Object
-
- jflex.logging.Out
-
public final class Out extends java.lang.ObjectIn this class all output to the java console is filtered.Use the switches verbose, time and DUMP at compile time to determine the verbosity of JFlex output. There is no switch for suppressing error messages. verbose and time can be overridden by command line parameters.
Redirects output to a TextArea in GUI mode.
Counts error and warning messages.
- Version:
- JFlex 1.9.1
-
-
Field Summary
Fields Modifier and Type Field Description private static interrorscount total errorsstatic java.lang.StringNLPlatform specific newline.private static StdOutWriteroutoutput deviceprivate static intwarningscount total warnings
-
Constructor Summary
Constructors Modifier Constructor Description privateOut()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidcheckErrors()throws a GeneratorException if there are any errors recordedstatic voiddebug(java.lang.String message)Dump debug information to System.outstatic voiddump(java.lang.String message)All parts of JFlex, that want to provide dump information should use this method for their output.static voiderr(java.lang.String message)All parts of JFlex, that want to report error messages should use this method for their output.static voiderror(java.io.File file, ErrorMessages message, int line, int column)print error message with location informationstatic voiderror(java.lang.String message)print error message (string)static voiderror(ErrorMessages message)print error message (code)static voiderror(ErrorMessages message, java.io.File file)IO error message for a file (displays file name in parentheses).static voiderror(ErrorMessages message, java.lang.String data)print error message with dataprivate static java.lang.StringgetLine(java.io.File file, int line)get one line from a filestatic voidprint(java.lang.String message)Report generation progress.static voidprintln(java.lang.String message)Report generation progress.static voidprintln(ErrorMessages message, int data)Report generation progress.static voidprintln(ErrorMessages message, java.lang.String data)Report generation progress.static voidresetCounters()reset error and warning countersstatic voidsetGUIMode(java.awt.TextArea text)Switches to GUI mode iftext</code> is not <code>nullstatic voidsetOutputStream(java.io.OutputStream stream)Sets a new output stream and switches to non-gui mode.static voidshowPosition(java.io.File file, int line)print a line of a filestatic voidshowPosition(java.io.File file, int line, int column)prints a line of a file with marked position.static voidstatistics()print error and warning statisticsstatic voidtime(java.lang.String message)Report time statistic data.static voidtime(ErrorMessages message, Timer time)Report time statistic data.static voidwarning(java.io.File file, ErrorMessages message, int line, int column)print warning message with location informationstatic voidwarning(java.lang.String message)Deprecated.usewarning(ErrorMessages)insteadstatic voidwarning(ErrorMessages message)print a warning message without line informationstatic voidwarning(ErrorMessages message, int line)Print a warning with line information.static voidwarning(ErrorMessages message, int line, java.lang.Object... args)Print a warning with line information and arguments.static voidwarning(ErrorMessages message, java.lang.Object... args)Print a warning message with arguments without line information
-
-
-
Field Detail
-
NL
public static final java.lang.String NL
Platform specific newline.
-
warnings
private static int warnings
count total warnings
-
errors
private static int errors
count total errors
-
out
private static StdOutWriter out
output device
-
-
Method Detail
-
setGUIMode
public static void setGUIMode(java.awt.TextArea text)
Switches to GUI mode iftext</code> is not <code>null- Parameters:
text- the message TextArea of the JFlex GUI
-
setOutputStream
public static void setOutputStream(java.io.OutputStream stream)
Sets a new output stream and switches to non-gui mode.- Parameters:
stream- the new output stream
-
time
public static void time(ErrorMessages message, Timer time)
Report time statistic data.- Parameters:
message- the message to be printedtime- elapsed time
-
time
public static void time(java.lang.String message)
Report time statistic data.- Parameters:
message- the message to be printed
-
println
public static void println(java.lang.String message)
Report generation progress.- Parameters:
message- the message to be printed
-
println
public static void println(ErrorMessages message, java.lang.String data)
Report generation progress.- Parameters:
message- the message to be printeddata- data to be inserted into the message
-
println
public static void println(ErrorMessages message, int data)
Report generation progress.- Parameters:
message- the message to be printeddata- data to be inserted into the message
-
print
public static void print(java.lang.String message)
Report generation progress.- Parameters:
message- the message to be printed
-
debug
public static void debug(java.lang.String message)
Dump debug information to System.outUse like this
if (Out.DEBUG) Out.debug(message)to save performance during normal operation (when DEBUG is turned off).- Parameters:
message- aStringobject.
-
dump
public static void dump(java.lang.String message)
All parts of JFlex, that want to provide dump information should use this method for their output.- Parameters:
message- the message to be printed
-
err
public static void err(java.lang.String message)
All parts of JFlex, that want to report error messages should use this method for their output.- Parameters:
message- the message to be printed
-
checkErrors
public static void checkErrors()
throws a GeneratorException if there are any errors recorded
-
statistics
public static void statistics()
print error and warning statistics
-
resetCounters
public static void resetCounters()
reset error and warning counters
-
warning
@Deprecated public static void warning(java.lang.String message)
Deprecated.usewarning(ErrorMessages)insteadPrint a warning without position information. Use only for testing.- Parameters:
message- the warning message
-
warning
public static void warning(ErrorMessages message)
print a warning message without line information- Parameters:
message- code of the warning message- See Also:
ErrorMessages
-
warning
public static void warning(ErrorMessages message, java.lang.Object... args)
Print a warning message with arguments without line information- Parameters:
message- code of the warning messageargs- arguments of the warning message- See Also:
ErrorMessages
-
warning
public static void warning(ErrorMessages message, int line)
Print a warning with line information.- Parameters:
message- code of the warning messageline- the line information- See Also:
ErrorMessages
-
warning
public static void warning(ErrorMessages message, int line, java.lang.Object... args)
Print a warning with line information and arguments.- Parameters:
message- code of the warning messageline- the line informationargs- arguments to the warning message- See Also:
ErrorMessages
-
warning
public static void warning(java.io.File file, ErrorMessages message, int line, int column)print warning message with location information- Parameters:
file- the file the warning is issued formessage- the code of the message to printline- the line number of the positioncolumn- the column of the position
-
error
public static void error(java.lang.String message)
print error message (string)- Parameters:
message- the message to print
-
error
public static void error(ErrorMessages message)
print error message (code)- Parameters:
message- the code of the error message- See Also:
ErrorMessages
-
error
public static void error(ErrorMessages message, java.lang.String data)
print error message with data- Parameters:
data- data to insert into the messagemessage- the code of the error message- See Also:
ErrorMessages
-
error
public static void error(ErrorMessages message, java.io.File file)
IO error message for a file (displays file name in parentheses).- Parameters:
message- the code of the error messagefile- the file it occurred for
-
error
public static void error(java.io.File file, ErrorMessages message, int line, int column)print error message with location information- Parameters:
file- the file the error occurred formessage- the code of the error message to printline- the line number of error positioncolumn- the column of error position
-
showPosition
public static void showPosition(java.io.File file, int line, int column)prints a line of a file with marked position.- Parameters:
file- the file of which to show the lineline- the line to showcolumn- the column in which to show the marker
-
showPosition
public static void showPosition(java.io.File file, int line)print a line of a file- Parameters:
file- the file to showline- the line number
-
getLine
private static java.lang.String getLine(java.io.File file, int line) throws java.io.IOExceptionget one line from a file- Parameters:
file- the file to readline- the line number to get- Throws:
java.io.IOException- if any error occurs
-
-