Class Messages


  • public class Messages
    extends java.lang.Object
    Class Messages handles messages (informations, warnings and fatal errors), printing a message to the user and handling it appropriately.

    Class maintains state, and is not supposed to be run in parallel threads (on the same grammar).

    • Constructor Summary

      Constructors 
      Constructor Description
      Messages()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int errorCount()  
      static void hardErr​(java.lang.String s)
      Prints on System.err a fatal error message and the stack trace.
      static void hardErr​(java.lang.String s, java.lang.Throwable t)
      Prints on System.err a fatal error message and the stack trace.
      void info​(java.lang.String s)
      Prints on System.out an information text.
      void info​(java.lang.String s, int lineNum, int colNum)
      Prints on System.out an information text and its line number.
      int infoCount()  
      void printSummary()
      Prints on System.err the number of informations, warnings and errors
      void resetCounts()
      Resets to zero the number of errors and warnings.
      void softErr​(java.lang.String s)
      Prints on System.err a soft (non fatal) error text.
      void softErr​(java.lang.String s, int lineNum, int colNum)
      Prints on System.err a soft (non fatal) error text and its line number.
      void warning​(java.lang.String s)
      Prints on System.err a warning text.
      void warning​(java.lang.String s, int lineNum, int colNum)
      Prints on System.err a warning text and its line number.
      int warningCount()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Messages

        public Messages()
    • Method Detail

      • printSummary

        public void printSummary()
        Prints on System.err the number of informations, warnings and errors
      • info

        public void info​(java.lang.String s)
        Prints on System.out an information text.
        Parameters:
        s - - the information text
      • info

        public void info​(java.lang.String s,
                         int lineNum,
                         int colNum)
        Prints on System.out an information text and its line number.
        Parameters:
        s - - the information text
        lineNum - - the information line number
        colNum - - the information column number
      • warning

        public void warning​(java.lang.String s)
        Prints on System.err a warning text.
        Parameters:
        s - - the warning text
      • warning

        public void warning​(java.lang.String s,
                            int lineNum,
                            int colNum)
        Prints on System.err a warning text and its line number.
        Parameters:
        s - - the warning text
        lineNum - - the warning line number
        colNum - - the warning column number
      • softErr

        public void softErr​(java.lang.String s)
        Prints on System.err a soft (non fatal) error text.
        Parameters:
        s - - an error text
      • softErr

        public void softErr​(java.lang.String s,
                            int lineNum,
                            int colNum)
        Prints on System.err a soft (non fatal) error text and its line number.
        Parameters:
        s - - the error text
        lineNum - - the error line number
        colNum - - the error column number
      • hardErr

        public static void hardErr​(java.lang.String s)
        Prints on System.err a fatal error message and the stack trace.
        Parameters:
        s - - a message
      • hardErr

        public static void hardErr​(java.lang.String s,
                                   java.lang.Throwable t)
        Prints on System.err a fatal error message and the stack trace.
        Parameters:
        s - - a message
        t - - a Throwable
      • infoCount

        public int infoCount()
        Returns:
        the number of informations
      • warningCount

        public int warningCount()
        Returns:
        the number of warnings
      • errorCount

        public int errorCount()
        Returns:
        the number of errors
      • resetCounts

        public void resetCounts()
        Resets to zero the number of errors and warnings.