Package jflex.logging

Class Out

java.lang.Object
jflex.logging.Out

public final class Out extends Object
In 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 int
    count total errors
    static final String
    Platform specific newline.
    private static StdOutWriter
    output device
    private static int
    count total warnings
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Out()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    throws a GeneratorException if there are any errors recorded
    static void
    debug(String message)
    Dump debug information to System.out
    static void
    dump(String message)
    All parts of JFlex, that want to provide dump information should use this method for their output.
    static void
    err(String message)
    All parts of JFlex, that want to report error messages should use this method for their output.
    static void
    error(File file, ErrorMessages message, int line, int column)
    print error message with location information
    static void
    error(String message)
    print error message (string)
    static void
    print error message (code)
    static void
    error(ErrorMessages message, File file)
    IO error message for a file (displays file name in parentheses).
    static void
    error(ErrorMessages message, String data)
    print error message with data
    private static String
    getLine(File file, int line)
    get one line from a file
    static void
    print(String message)
    Report generation progress.
    static void
    println(String message)
    Report generation progress.
    static void
    println(ErrorMessages message, int data)
    Report generation progress.
    static void
    println(ErrorMessages message, String data)
    Report generation progress.
    static void
    reset error and warning counters
    static void
    Switches to GUI mode if text</code> is not <code>null
    static void
    Sets a new output stream and switches to non-gui mode.
    static void
    showPosition(File file, int line)
    print a line of a file
    static void
    showPosition(File file, int line, int column)
    prints a line of a file with marked position.
    static void
    print error and warning statistics
    static void
    time(String message)
    Report time statistic data.
    static void
    time(ErrorMessages message, Timer time)
    Report time statistic data.
    static void
    warning(File file, ErrorMessages message, int line, int column)
    print warning message with location information
    static void
    warning(String message)
    Deprecated.
    static void
    print a warning message without line information
    static void
    warning(ErrorMessages message, int line)
    Print a warning with line information.
    static void
    warning(ErrorMessages message, int line, Object... args)
    Print a warning with line information and arguments.
    static void
    warning(ErrorMessages message, Object... args)
    Print a warning message with arguments without line information

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NL

      public static final 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
  • Constructor Details

    • Out

      private Out()
  • Method Details

    • setGUIMode

      public static void setGUIMode(TextArea text)
      Switches to GUI mode if text</code> is not <code>null
      Parameters:
      text - the message TextArea of the JFlex GUI
    • setOutputStream

      public static void setOutputStream(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 printed
      time - elapsed time
    • time

      public static void time(String message)
      Report time statistic data.
      Parameters:
      message - the message to be printed
    • println

      public static void println(String message)
      Report generation progress.
      Parameters:
      message - the message to be printed
    • println

      public static void println(ErrorMessages message, String data)
      Report generation progress.
      Parameters:
      message - the message to be printed
      data - 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 printed
      data - data to be inserted into the message
    • print

      public static void print(String message)
      Report generation progress.
      Parameters:
      message - the message to be printed
    • debug

      public static void debug(String message)
      Dump debug information to System.out

      Use like this if (Out.DEBUG) Out.debug(message) to save performance during normal operation (when DEBUG is turned off).

      Parameters:
      message - a String object.
    • dump

      public static void dump(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(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(String message)
      Deprecated.
      Print 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:
    • warning

      public static void warning(ErrorMessages message, Object... args)
      Print a warning message with arguments without line information
      Parameters:
      message - code of the warning message
      args - arguments of the warning message
      See Also:
    • warning

      public static void warning(ErrorMessages message, int line)
      Print a warning with line information.
      Parameters:
      message - code of the warning message
      line - the line information
      See Also:
    • warning

      public static void warning(ErrorMessages message, int line, Object... args)
      Print a warning with line information and arguments.
      Parameters:
      message - code of the warning message
      line - the line information
      args - arguments to the warning message
      See Also:
    • warning

      public static void warning(File file, ErrorMessages message, int line, int column)
      print warning message with location information
      Parameters:
      file - the file the warning is issued for
      message - the code of the message to print
      line - the line number of the position
      column - the column of the position
    • error

      public static void error(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:
    • error

      public static void error(ErrorMessages message, String data)
      print error message with data
      Parameters:
      message - the code of the error message
      data - data to insert into the message
      See Also:
    • error

      public static void error(ErrorMessages message, File file)
      IO error message for a file (displays file name in parentheses).
      Parameters:
      message - the code of the error message
      file - the file it occurred for
    • error

      public static void error(File file, ErrorMessages message, int line, int column)
      print error message with location information
      Parameters:
      file - the file the error occurred for
      message - the code of the error message to print
      line - the line number of error position
      column - the column of error position
    • showPosition

      public static void showPosition(File file, int line, int column)
      prints a line of a file with marked position.
      Parameters:
      file - the file of which to show the line
      line - the line to show
      column - the column in which to show the marker
    • showPosition

      public static void showPosition(File file, int line)
      print a line of a file
      Parameters:
      file - the file to show
      line - the line number
    • getLine

      private static String getLine(File file, int line) throws IOException
      get one line from a file
      Parameters:
      file - the file to read
      line - the line number to get
      Throws:
      IOException - if any error occurs