Class ErrorManager

java.lang.Object
org.antlr.v4.tool.ErrorManager

public class ErrorManager extends Object
  • Field Details

    • loadedFormats

      private static final Map<String,org.stringtemplate.v4.STGroupFile> loadedFormats
    • FORMATS_DIR

      public static final String FORMATS_DIR
      See Also:
    • tool

      public Tool tool
    • errors

      public int errors
    • warnings

      public int warnings
    • errorTypes

      public 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

      String formatName
    • initSTListener

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

    • ErrorManager

      public ErrorManager(Tool tool)
  • Method Details

    • 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(String msg)
    • syntaxError

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

      public static void fatalInternalError(String error, Throwable e)
    • internalError

      public static void internalError(String error, Throwable e)
    • internalError

      public static void internalError(String error)
    • toolError

      public void toolError(ErrorType errorType, 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, Throwable e, Object... args)
    • grammarError

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

      public void leftRecursionCycles(String fileName, Collection<? extends Collection<Rule>> cycles)
    • getNumErrors

      public int getNumErrors()
    • getLastNonErrorManagerCodeLocation

      private static StackTraceElement getLastNonErrorManagerCodeLocation(Throwable e)
      Return first non ErrorManager code location for generating messages
    • emit

      public void emit(ErrorType etype, ANTLRMessage msg)
    • setFormat

      public void setFormat(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(String msg)
      If there are errors during ErrorManager init, we have no choice but to go to System.err.
    • rawError

      static void rawError(String msg, Throwable e)
    • panic

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

      public static void panic(String msg)
    • panic

      public static void panic()