Top Fields Constructors Methods
org.antlr.v4.tool

public Class ErrorManager

extends Object
Class Inheritance
Imports
org.antlr.v4.Tool, org.stringtemplate.v4.ST, .STGroup, .STGroupFile, org.stringtemplate.v4.misc.ErrorBuffer, java.io.File, java.net.URL, java.util.*

Field Summary

Modifier and TypeField and Description
public int
public Set<ErrorType>
errorTypes

All errors that have been generated

pack-priv STGroup
format

The group of templates that represent the current message format.

pack-priv String
public static final String
pack-priv ErrorBuffer
private static final Map<String, STGroupFile>
public Tool
public int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public static void
public boolean
private static StackTraceElement
getLastNonErrorManagerCodeLocation(Throwable e)

Return first non ErrorManager code location for generating messages

public ST
getLocationFormat()

Return a StringTemplate that refers to the current format used for emitting messages.

public ST
public ST
public int
public ST
public void
grammarError(ErrorType etype, String fileName, Token token, Object... args)

public void
info(String msg)

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

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

public static void
public static void
pack-priv static void
rawError(String msg)

If there are errors during ErrorManager init, we have no choice but to go to System.err.

pack-priv static void
public void
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".

public void
syntaxError(ErrorType etype, String fileName, Token token, RecognitionException antlrException, Object... args)

public void
toolError(ErrorType
The Message Descriptor
errorType
,
Object...
The arguments to pass to the StringTemplate
args
)

Raise a predefined message with some number of parameters for the StringTemplate but for which there is no location information possible.

public void
toolError(ErrorType errorType, Throwable e, Object... args)

protected boolean
verifyFormat()

Verify the message format template group

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

errorsback to summary
public int errors
errorTypesback to summary
public Set<ErrorType> errorTypes

All errors that have been generated

formatback to summary
pack-priv STGroup format

The group of templates that represent the current message format.

formatNameback to summary
pack-priv String formatName
FORMATS_DIRback to summary
public static final String FORMATS_DIR
initSTListenerback to summary
pack-priv ErrorBuffer initSTListener
loadedFormatsback to summary
private static final Map<String, STGroupFile> loadedFormats
toolback to summary
public Tool tool
warningsback to summary
public int warnings

Constructor Detail

ErrorManagerback to summary
public ErrorManager(Tool tool)

Method Detail

emitback to summary
public void emit(ErrorType etype, ANTLRMessage msg)
Annotations
@SuppressWarnings:fallthrough
fatalInternalErrorback to summary
public static void fatalInternalError(String error, Throwable e)
formatWantsSingleLineMessageback to summary
public boolean formatWantsSingleLineMessage()
getLastNonErrorManagerCodeLocationback to summary
private static StackTraceElement getLastNonErrorManagerCodeLocation(Throwable e)

Return first non ErrorManager code location for generating messages

getLocationFormatback to summary
public ST getLocationFormat()

Return a StringTemplate that refers to the current format used for emitting messages.

getMessageFormatback to summary
public ST getMessageFormat()
getMessageTemplateback to summary
public ST getMessageTemplate(ANTLRMessage msg)
getNumErrorsback to summary
public int getNumErrors()
getReportFormatback to summary
public ST getReportFormat(ErrorSeverity severity)
grammarErrorback to summary
public void grammarError(ErrorType etype, String fileName, Token token, Object... args)
infoback to summary
public void info(String msg)
internalErrorback to summary
public static void internalError(String error, Throwable e)
internalErrorback to summary
public static void internalError(String error)
leftRecursionCyclesback to summary
public void leftRecursionCycles(String fileName, Collection<? extends Collection<Rule>> cycles)
panicback to summary
public void panic(ErrorType errorType, Object... args)
panicback to summary
public static void panic(String msg)
panicback to summary
public static void panic()
rawErrorback to summary
pack-priv static void rawError(String msg)

If there are errors during ErrorManager init, we have no choice but to go to System.err.

rawErrorback to summary
pack-priv static void rawError(String msg, Throwable e)
resetErrorStateback to summary
public void resetErrorState()
setFormatback to summary
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".

syntaxErrorback to summary
public void syntaxError(ErrorType etype, String fileName, Token token, RecognitionException antlrException, Object... args)
toolErrorback to summary
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:ErrorType

The Message Descriptor

args:Object[]

The arguments to pass to the StringTemplate

toolErrorback to summary
public void toolError(ErrorType errorType, Throwable e, Object... args)
verifyFormatback to summary
protected boolean verifyFormat()

Verify the message format template group