Class ErrorManager


  • public class ErrorManager
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int errors  
      java.util.Set<ErrorType> errorTypes
      All errors that have been generated
      (package private) org.stringtemplate.v4.STGroup format
      The group of templates that represent the current message format.
      (package private) java.lang.String formatName  
      static java.lang.String FORMATS_DIR  
      (package private) org.stringtemplate.v4.misc.ErrorBuffer initSTListener  
      private static java.util.Map<java.lang.String,​org.stringtemplate.v4.STGroupFile> loadedFormats  
      Tool tool  
      int warnings  
    • Constructor Summary

      Constructors 
      Constructor Description
      ErrorManager​(Tool tool)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void emit​(ErrorType etype, ANTLRMessage msg)  
      static void fatalInternalError​(java.lang.String error, java.lang.Throwable e)  
      boolean formatWantsSingleLineMessage()  
      private static java.lang.StackTraceElement getLastNonErrorManagerCodeLocation​(java.lang.Throwable e)
      Return first non ErrorManager code location for generating messages
      org.stringtemplate.v4.ST getLocationFormat()
      Return a StringTemplate that refers to the current format used for emitting messages.
      org.stringtemplate.v4.ST getMessageFormat()  
      org.stringtemplate.v4.ST getMessageTemplate​(ANTLRMessage msg)  
      int getNumErrors()  
      org.stringtemplate.v4.ST getReportFormat​(ErrorSeverity severity)  
      void grammarError​(ErrorType etype, java.lang.String fileName, org.antlr.runtime.Token token, java.lang.Object... args)  
      void info​(java.lang.String msg)  
      static void internalError​(java.lang.String error)  
      static void internalError​(java.lang.String error, java.lang.Throwable e)  
      void leftRecursionCycles​(java.lang.String fileName, java.util.Collection<? extends java.util.Collection<Rule>> cycles)  
      static void panic()  
      static void panic​(java.lang.String msg)  
      void panic​(ErrorType errorType, java.lang.Object... args)  
      (package private) static void rawError​(java.lang.String msg)
      If there are errors during ErrorManager init, we have no choice but to go to System.err.
      (package private) static void rawError​(java.lang.String msg, java.lang.Throwable e)  
      void resetErrorState()  
      void setFormat​(java.lang.String formatName)
      The format gets reset either from the Tool if the user supplied a command line option to that effect Otherwise we just use the default "antlr".
      void syntaxError​(ErrorType etype, java.lang.String fileName, org.antlr.runtime.Token token, org.antlr.runtime.RecognitionException antlrException, java.lang.Object... args)  
      void toolError​(ErrorType errorType, java.lang.Object... args)
      Raise a predefined message with some number of parameters for the StringTemplate but for which there is no location information possible.
      void toolError​(ErrorType errorType, java.lang.Throwable e, java.lang.Object... args)  
      protected boolean verifyFormat()
      Verify the message format template group
      • Methods inherited from class java.lang.Object

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

      • loadedFormats

        private static final java.util.Map<java.lang.String,​org.stringtemplate.v4.STGroupFile> loadedFormats
      • tool

        public Tool tool
      • errors

        public int errors
      • warnings

        public int warnings
      • errorTypes

        public java.util.Set<ErrorType> errorTypes
        All errors that have been generated
      • format

        org.stringtemplate.v4.STGroup format
        The group of templates that represent the current message format.
      • formatName

        java.lang.String formatName
      • initSTListener

        org.stringtemplate.v4.misc.ErrorBuffer initSTListener
    • Constructor Detail

      • ErrorManager

        public ErrorManager​(Tool tool)
    • Method Detail

      • resetErrorState

        public void resetErrorState()
      • getMessageTemplate

        public org.stringtemplate.v4.ST getMessageTemplate​(ANTLRMessage msg)
      • getLocationFormat

        public org.stringtemplate.v4.ST getLocationFormat()
        Return a StringTemplate that refers to the current format used for emitting messages.
      • getReportFormat

        public org.stringtemplate.v4.ST getReportFormat​(ErrorSeverity severity)
      • getMessageFormat

        public org.stringtemplate.v4.ST getMessageFormat()
      • formatWantsSingleLineMessage

        public boolean formatWantsSingleLineMessage()
      • info

        public void info​(java.lang.String msg)
      • syntaxError

        public void syntaxError​(ErrorType etype,
                                java.lang.String fileName,
                                org.antlr.runtime.Token token,
                                org.antlr.runtime.RecognitionException antlrException,
                                java.lang.Object... args)
      • fatalInternalError

        public static void fatalInternalError​(java.lang.String error,
                                              java.lang.Throwable e)
      • internalError

        public static void internalError​(java.lang.String error,
                                         java.lang.Throwable e)
      • internalError

        public static void internalError​(java.lang.String error)
      • toolError

        public void toolError​(ErrorType errorType,
                              java.lang.Object... args)
        Raise a predefined message with some number of parameters for the StringTemplate but for which there is no location information possible.
        Parameters:
        errorType - The Message Descriptor
        args - The arguments to pass to the StringTemplate
      • toolError

        public void toolError​(ErrorType errorType,
                              java.lang.Throwable e,
                              java.lang.Object... args)
      • grammarError

        public void grammarError​(ErrorType etype,
                                 java.lang.String fileName,
                                 org.antlr.runtime.Token token,
                                 java.lang.Object... args)
      • leftRecursionCycles

        public void leftRecursionCycles​(java.lang.String fileName,
                                        java.util.Collection<? extends java.util.Collection<Rule>> cycles)
      • getNumErrors

        public int getNumErrors()
      • getLastNonErrorManagerCodeLocation

        private static java.lang.StackTraceElement getLastNonErrorManagerCodeLocation​(java.lang.Throwable e)
        Return first non ErrorManager code location for generating messages
      • setFormat

        public void setFormat​(java.lang.String formatName)
        The format gets reset either from the Tool if the user supplied a command line option to that effect Otherwise we just use the default "antlr".
      • verifyFormat

        protected boolean verifyFormat()
        Verify the message format template group
      • rawError

        static void rawError​(java.lang.String msg)
        If there are errors during ErrorManager init, we have no choice but to go to System.err.
      • rawError

        static void rawError​(java.lang.String msg,
                             java.lang.Throwable e)
      • panic

        public void panic​(ErrorType errorType,
                          java.lang.Object... args)
      • panic

        public static void panic​(java.lang.String msg)
      • panic

        public static void panic()