org.antlr.tool
Class ErrorManager

java.lang.Object
  extended by org.antlr.tool.ErrorManager

public class ErrorManager
extends java.lang.Object

Defines all the errors ANTLR can generator for both the tool and for issues with a grammar. Here is a list of language names: http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt Here is a list of country names: http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html I use constants not strings to identify messages as the compiler will find any errors/mismatches rather than leaving a mistyped string in the code to be found randomly in the future. Further, Intellij can do field name expansion to save me some typing. I have to map int constants to template names, however, which could introduce a mismatch. Someone could provide a .stg file that had a template name wrong. When I load the group, then, I must verify that all messages are there. This is essentially the functionality of the resource bundle stuff Java has, but I don't want to load a property file--I want to load a template group file and this is so simple, why mess with their junk. I use the default Locale as defined by java to compute a group file name in the org/antlr/tool/templates/messages dir called en_US.stg and so on. Normally we want to use the default locale, but often a message file will not exist for it so we must fall back on the US local. During initialization of this class, all errors go straight to System.err. There is no way around this. If I have not set up the error system, how can I do errors properly? For example, if the string template group file full of messages has an error, how could I print to anything but System.err? TODO: how to map locale to a file encoding for the stringtemplate group file? StringTemplate knows how to pay attention to the default encoding so it should probably just work unless a GUI sets the local to some chinese variation but System.getProperty("file.encoding") is US. Hmm... TODO: get antlr.g etc.. parsing errors to come here.


Field Summary
static java.util.Map emitSingleError
          Only one error can be emitted for any entry in this table.
static BitSet ERRORS_FORCING_NO_ANALYSIS
          Do not do perform analysis if one of these happens
static BitSet ERRORS_FORCING_NO_CODEGEN
          Do not do code gen if one of these happens
static int MAX_MESSAGE_NUMBER
           
static int MSG_ACTION_REDEFINITION
           
static int MSG_ANALYSIS_ABORTED
           
static int MSG_ARG_INIT_VALUES_ILLEGAL
           
static int MSG_ARG_RETVAL_CONFLICT
           
static int MSG_ARGS_ON_TOKEN_REF
           
static int MSG_AST_OP_IN_ALT_WITH_REWRITE
           
static int MSG_AST_OP_WITH_NON_AST_OUTPUT_OPTION
           
static int MSG_ATTRIBUTE_CONFLICTS_WITH_RULE
           
static int MSG_ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL
           
static int MSG_ATTRIBUTE_REF_NOT_IN_RULE
           
static int MSG_BAD_ACTION_AST_STRUCTURE
           
static int MSG_BAD_AST_STRUCTURE
           
static int MSG_CANNOT_ALIAS_TOKENS_IN_LEXER
           
static int MSG_CANNOT_CLOSE_FILE
           
static int MSG_CANNOT_CREATE_TARGET_GENERATOR
           
static int MSG_CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL
           
static int MSG_CANNOT_FIND_TOKENS_FILE
           
static int MSG_CANNOT_GEN_DOT_FILE
           
static int MSG_CANNOT_OPEN_FILE
           
static int MSG_CANNOT_WRITE_FILE
           
static int MSG_CODE_GEN_TEMPLATES_INCOMPLETE
           
static int MSG_DANGLING_STATE
           
static int MSG_DIR_NOT_FOUND
           
static int MSG_DOUBLE_QUOTES_ILLEGAL
           
static int MSG_DUPLICATE_SET_ENTRY
           
static int MSG_EMPTY_COMPLEMENT
           
static int MSG_ERROR_CREATING_ARTIFICIAL_RULE
           
static int MSG_ERROR_READING_TOKENS_FILE
           
static int MSG_FILE_AND_GRAMMAR_NAME_DIFFER
           
static int MSG_FILENAME_EXTENSION_ERROR
           
static int MSG_FORWARD_ELEMENT_REF
           
static int MSG_GRAMMAR_NONDETERMINISM
           
static int MSG_HETERO_ILLEGAL_IN_REWRITE_ALT
           
static int MSG_ILLEGAL_OPTION
           
static int MSG_IMPORT_NAME_CLASH
           
static int MSG_IMPORTED_TOKENS_RULE_EMPTY
           
static int MSG_INSUFFICIENT_PREDICATES
           
static int MSG_INTERNAL_ERROR
           
static int MSG_INTERNAL_WARNING
           
static int MSG_INVALID_ACTION_SCOPE
           
static int MSG_INVALID_IMPORT
           
static int MSG_INVALID_RULE_PARAMETER_REF
           
static int MSG_INVALID_RULE_SCOPE_ATTRIBUTE_REF
           
static int MSG_INVALID_TEMPLATE_ACTION
           
static int MSG_ISOLATED_RULE_ATTRIBUTE
           
static int MSG_ISOLATED_RULE_SCOPE
           
static int MSG_LABEL_CONFLICTS_WITH_RULE
           
static int MSG_LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL
           
static int MSG_LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE
           
static int MSG_LABEL_CONFLICTS_WITH_TOKEN
           
static int MSG_LABEL_TYPE_CONFLICT
           
static int MSG_LEFT_RECURSION
           
static int MSG_LEFT_RECURSION_CYCLES
           
static int MSG_LEXER_RULES_NOT_ALLOWED
           
static int MSG_LIST_LABEL_INVALID_UNLESS_RETVAL_STRUCT
           
static int MSG_LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE
           
static int MSG_MISSING_AST_TYPE_IN_TREE_GRAMMAR
           
static int MSG_MISSING_ATTRIBUTE_NAME
           
static int MSG_MISSING_CODE_GEN_TEMPLATES
           
static int MSG_MISSING_CYCLIC_DFA_CODE_GEN_TEMPLATES
           
static int MSG_MISSING_RULE_ARGS
           
static int MSG_NO_GRAMMAR_START_RULE
           
static int MSG_NO_RULES
           
static int MSG_NO_SUCH_GRAMMAR_SCOPE
           
static int MSG_NO_SUCH_RULE_IN_SCOPE
           
static int MSG_NO_TOKEN_DEFINITION
           
static int MSG_NONREGULAR_DECISION
           
static int MSG_NONUNIQUE_REF
           
static int MSG_OUTPUT_DIR_IS_FILE
           
static int MSG_PARSER_RULES_NOT_ALLOWED
           
static int MSG_RECURSION_OVERLOW
           
static int MSG_REWRITE_ELEMENT_NOT_PRESENT_ON_LHS
           
static int MSG_REWRITE_FOR_MULTI_ELEMENT_ALT
           
static int MSG_REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION
           
static int MSG_RULE_HAS_NO_ARGS
           
static int MSG_RULE_INVALID_SET
           
static int MSG_RULE_REDEFINITION
           
static int MSG_RULE_REF_AMBIG_WITH_RULE_IN_ALT
           
static int MSG_SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE
           
static int MSG_SYNTAX_ERROR
           
static int MSG_TOKEN_ALIAS_CONFLICT
           
static int MSG_TOKEN_ALIAS_REASSIGNMENT
           
static int MSG_TOKEN_NONDETERMINISM
           
static int MSG_TOKEN_VOCAB_IN_DELEGATE
           
static int MSG_TOKENS_FILE_SYNTAX_ERROR
           
static int MSG_UNDEFINED_LABEL_REF_IN_REWRITE
           
static int MSG_UNDEFINED_RULE_REF
           
static int MSG_UNDEFINED_TOKEN_REF_IN_REWRITE
           
static int MSG_UNKNOWN_ATTRIBUTE_IN_SCOPE
           
static int MSG_UNKNOWN_DYNAMIC_SCOPE
           
static int MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE
           
static int MSG_UNKNOWN_RULE_ATTRIBUTE
           
static int MSG_UNKNOWN_SIMPLE_ATTRIBUTE
           
static int MSG_UNREACHABLE_ALTS
           
static int MSG_UNREACHABLE_TOKENS
           
static int MSG_WRITE_TO_READONLY_ATTR
           
 
Constructor Summary
ErrorManager()
           
 
Method Summary
static void analysisAborted(DecisionProbe probe)
           
static void assertTrue(boolean condition, java.lang.String message)
           
static void danglingState(DecisionProbe probe, DFAState d)
           
static boolean doNotAttemptAnalysis()
           
static boolean doNotAttemptCodeGen()
           
static void error(int msgID)
           
static void error(int msgID, java.lang.Object arg)
           
static void error(int msgID, java.lang.Object arg, java.lang.Object arg2)
           
static void error(int msgID, java.lang.Object arg, java.lang.Throwable e)
           
static void error(int msgID, java.lang.Throwable e)
           
static boolean formatWantsSingleLineMessage()
           
static ANTLRErrorListener getErrorListener()
           
static org.antlr.tool.ErrorManager.ErrorState getErrorState()
           
static StringTemplate getLocationFormat()
          Return a StringTemplate that refers to the current format used for emitting messages.
static StringTemplate getMessage(int msgID)
          Given a message ID, return a StringTemplate that somebody can fill with data.
static StringTemplate getMessageFormat()
           
static java.lang.String getMessageType(int msgID)
           
static int getNumErrors()
           
static StringTemplate getReportFormat()
           
static StringTemplateErrorListener getStringTemplateErrorListener()
           
static void grammarError(int msgID, Grammar g, antlr.Token token)
           
static void grammarError(int msgID, Grammar g, antlr.Token token, java.lang.Object arg)
           
static void grammarError(int msgID, Grammar g, antlr.Token token, java.lang.Object arg, java.lang.Object arg2)
           
static void grammarWarning(int msgID, Grammar g, antlr.Token token)
           
static void grammarWarning(int msgID, Grammar g, antlr.Token token, java.lang.Object arg)
           
static void grammarWarning(int msgID, Grammar g, antlr.Token token, java.lang.Object arg, java.lang.Object arg2)
           
static void info(java.lang.String msg)
           
protected static boolean initIdToMessageNameMapping()
           
static void insufficientPredicates(DecisionProbe probe, DFAState d, java.util.Map<java.lang.Integer,java.util.Set<antlr.Token>> altToUncoveredLocations)
           
static void internalError(java.lang.Object error)
           
static void internalError(java.lang.Object error, java.lang.Throwable e)
           
static void leftRecursionCycles(java.util.Collection cycles)
           
static void nondeterminism(DecisionProbe probe, DFAState d)
           
static void nonLLStarDecision(DecisionProbe probe)
           
static void panic()
          I *think* this will allow Tool subclasses to exit gracefully for GUIs etc...
static void recursionOverflow(DecisionProbe probe, DFAState sampleBadState, int alt, java.util.Collection targetRules, java.util.Collection callSiteStates)
           
static void removeErrorListener()
           
static void resetErrorState()
           
static void setErrorListener(ANTLRErrorListener listener)
          In general, you'll want all errors to go to a single spot.
static 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".
static void setLocale(java.util.Locale locale)
          We really only need a single locale for entire running ANTLR code in a single VM.
static void setTool(Tool tool)
           
static void syntaxError(int msgID, Grammar grammar, antlr.Token token, java.lang.Object arg, antlr.RecognitionException re)
           
static void unreachableAlts(DecisionProbe probe, java.util.List alts)
           
protected static boolean verifyFormat()
          Verify the message format template group
protected static boolean verifyMessages()
          Use reflection to find list of MSG_ fields and then verify a template exists for each one from the locale's group.
static void warning(int msgID, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_CANNOT_WRITE_FILE

public static final int MSG_CANNOT_WRITE_FILE
See Also:
Constant Field Values

MSG_CANNOT_CLOSE_FILE

public static final int MSG_CANNOT_CLOSE_FILE
See Also:
Constant Field Values

MSG_CANNOT_FIND_TOKENS_FILE

public static final int MSG_CANNOT_FIND_TOKENS_FILE
See Also:
Constant Field Values

MSG_ERROR_READING_TOKENS_FILE

public static final int MSG_ERROR_READING_TOKENS_FILE
See Also:
Constant Field Values

MSG_DIR_NOT_FOUND

public static final int MSG_DIR_NOT_FOUND
See Also:
Constant Field Values

MSG_OUTPUT_DIR_IS_FILE

public static final int MSG_OUTPUT_DIR_IS_FILE
See Also:
Constant Field Values

MSG_CANNOT_OPEN_FILE

public static final int MSG_CANNOT_OPEN_FILE
See Also:
Constant Field Values

MSG_FILE_AND_GRAMMAR_NAME_DIFFER

public static final int MSG_FILE_AND_GRAMMAR_NAME_DIFFER
See Also:
Constant Field Values

MSG_FILENAME_EXTENSION_ERROR

public static final int MSG_FILENAME_EXTENSION_ERROR
See Also:
Constant Field Values

MSG_INTERNAL_ERROR

public static final int MSG_INTERNAL_ERROR
See Also:
Constant Field Values

MSG_INTERNAL_WARNING

public static final int MSG_INTERNAL_WARNING
See Also:
Constant Field Values

MSG_ERROR_CREATING_ARTIFICIAL_RULE

public static final int MSG_ERROR_CREATING_ARTIFICIAL_RULE
See Also:
Constant Field Values

MSG_TOKENS_FILE_SYNTAX_ERROR

public static final int MSG_TOKENS_FILE_SYNTAX_ERROR
See Also:
Constant Field Values

MSG_CANNOT_GEN_DOT_FILE

public static final int MSG_CANNOT_GEN_DOT_FILE
See Also:
Constant Field Values

MSG_BAD_AST_STRUCTURE

public static final int MSG_BAD_AST_STRUCTURE
See Also:
Constant Field Values

MSG_BAD_ACTION_AST_STRUCTURE

public static final int MSG_BAD_ACTION_AST_STRUCTURE
See Also:
Constant Field Values

MSG_MISSING_CODE_GEN_TEMPLATES

public static final int MSG_MISSING_CODE_GEN_TEMPLATES
See Also:
Constant Field Values

MSG_MISSING_CYCLIC_DFA_CODE_GEN_TEMPLATES

public static final int MSG_MISSING_CYCLIC_DFA_CODE_GEN_TEMPLATES
See Also:
Constant Field Values

MSG_CODE_GEN_TEMPLATES_INCOMPLETE

public static final int MSG_CODE_GEN_TEMPLATES_INCOMPLETE
See Also:
Constant Field Values

MSG_CANNOT_CREATE_TARGET_GENERATOR

public static final int MSG_CANNOT_CREATE_TARGET_GENERATOR
See Also:
Constant Field Values

MSG_SYNTAX_ERROR

public static final int MSG_SYNTAX_ERROR
See Also:
Constant Field Values

MSG_RULE_REDEFINITION

public static final int MSG_RULE_REDEFINITION
See Also:
Constant Field Values

MSG_LEXER_RULES_NOT_ALLOWED

public static final int MSG_LEXER_RULES_NOT_ALLOWED
See Also:
Constant Field Values

MSG_PARSER_RULES_NOT_ALLOWED

public static final int MSG_PARSER_RULES_NOT_ALLOWED
See Also:
Constant Field Values

MSG_CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL

public static final int MSG_CANNOT_FIND_ATTRIBUTE_NAME_IN_DECL
See Also:
Constant Field Values

MSG_NO_TOKEN_DEFINITION

public static final int MSG_NO_TOKEN_DEFINITION
See Also:
Constant Field Values

MSG_UNDEFINED_RULE_REF

public static final int MSG_UNDEFINED_RULE_REF
See Also:
Constant Field Values

MSG_LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE

public static final int MSG_LITERAL_NOT_ASSOCIATED_WITH_LEXER_RULE
See Also:
Constant Field Values

MSG_CANNOT_ALIAS_TOKENS_IN_LEXER

public static final int MSG_CANNOT_ALIAS_TOKENS_IN_LEXER
See Also:
Constant Field Values

MSG_ATTRIBUTE_REF_NOT_IN_RULE

public static final int MSG_ATTRIBUTE_REF_NOT_IN_RULE
See Also:
Constant Field Values

MSG_INVALID_RULE_SCOPE_ATTRIBUTE_REF

public static final int MSG_INVALID_RULE_SCOPE_ATTRIBUTE_REF
See Also:
Constant Field Values

MSG_UNKNOWN_ATTRIBUTE_IN_SCOPE

public static final int MSG_UNKNOWN_ATTRIBUTE_IN_SCOPE
See Also:
Constant Field Values

MSG_UNKNOWN_SIMPLE_ATTRIBUTE

public static final int MSG_UNKNOWN_SIMPLE_ATTRIBUTE
See Also:
Constant Field Values

MSG_INVALID_RULE_PARAMETER_REF

public static final int MSG_INVALID_RULE_PARAMETER_REF
See Also:
Constant Field Values

MSG_UNKNOWN_RULE_ATTRIBUTE

public static final int MSG_UNKNOWN_RULE_ATTRIBUTE
See Also:
Constant Field Values

MSG_ISOLATED_RULE_SCOPE

public static final int MSG_ISOLATED_RULE_SCOPE
See Also:
Constant Field Values

MSG_SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE

public static final int MSG_SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE
See Also:
Constant Field Values

MSG_LABEL_CONFLICTS_WITH_RULE

public static final int MSG_LABEL_CONFLICTS_WITH_RULE
See Also:
Constant Field Values

MSG_LABEL_CONFLICTS_WITH_TOKEN

public static final int MSG_LABEL_CONFLICTS_WITH_TOKEN
See Also:
Constant Field Values

MSG_LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE

public static final int MSG_LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE
See Also:
Constant Field Values

MSG_LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL

public static final int MSG_LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL
See Also:
Constant Field Values

MSG_ATTRIBUTE_CONFLICTS_WITH_RULE

public static final int MSG_ATTRIBUTE_CONFLICTS_WITH_RULE
See Also:
Constant Field Values

MSG_ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL

public static final int MSG_ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL
See Also:
Constant Field Values

MSG_LABEL_TYPE_CONFLICT

public static final int MSG_LABEL_TYPE_CONFLICT
See Also:
Constant Field Values

MSG_ARG_RETVAL_CONFLICT

public static final int MSG_ARG_RETVAL_CONFLICT
See Also:
Constant Field Values

MSG_NONUNIQUE_REF

public static final int MSG_NONUNIQUE_REF
See Also:
Constant Field Values

MSG_FORWARD_ELEMENT_REF

public static final int MSG_FORWARD_ELEMENT_REF
See Also:
Constant Field Values

MSG_MISSING_RULE_ARGS

public static final int MSG_MISSING_RULE_ARGS
See Also:
Constant Field Values

MSG_RULE_HAS_NO_ARGS

public static final int MSG_RULE_HAS_NO_ARGS
See Also:
Constant Field Values

MSG_ARGS_ON_TOKEN_REF

public static final int MSG_ARGS_ON_TOKEN_REF
See Also:
Constant Field Values

MSG_RULE_REF_AMBIG_WITH_RULE_IN_ALT

public static final int MSG_RULE_REF_AMBIG_WITH_RULE_IN_ALT
See Also:
Constant Field Values

MSG_ILLEGAL_OPTION

public static final int MSG_ILLEGAL_OPTION
See Also:
Constant Field Values

MSG_LIST_LABEL_INVALID_UNLESS_RETVAL_STRUCT

public static final int MSG_LIST_LABEL_INVALID_UNLESS_RETVAL_STRUCT
See Also:
Constant Field Values

MSG_UNDEFINED_TOKEN_REF_IN_REWRITE

public static final int MSG_UNDEFINED_TOKEN_REF_IN_REWRITE
See Also:
Constant Field Values

MSG_REWRITE_ELEMENT_NOT_PRESENT_ON_LHS

public static final int MSG_REWRITE_ELEMENT_NOT_PRESENT_ON_LHS
See Also:
Constant Field Values

MSG_UNDEFINED_LABEL_REF_IN_REWRITE

public static final int MSG_UNDEFINED_LABEL_REF_IN_REWRITE
See Also:
Constant Field Values

MSG_NO_GRAMMAR_START_RULE

public static final int MSG_NO_GRAMMAR_START_RULE
See Also:
Constant Field Values

MSG_EMPTY_COMPLEMENT

public static final int MSG_EMPTY_COMPLEMENT
See Also:
Constant Field Values

MSG_UNKNOWN_DYNAMIC_SCOPE

public static final int MSG_UNKNOWN_DYNAMIC_SCOPE
See Also:
Constant Field Values

MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE

public static final int MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE
See Also:
Constant Field Values

MSG_ISOLATED_RULE_ATTRIBUTE

public static final int MSG_ISOLATED_RULE_ATTRIBUTE
See Also:
Constant Field Values

MSG_INVALID_ACTION_SCOPE

public static final int MSG_INVALID_ACTION_SCOPE
See Also:
Constant Field Values

MSG_ACTION_REDEFINITION

public static final int MSG_ACTION_REDEFINITION
See Also:
Constant Field Values

MSG_DOUBLE_QUOTES_ILLEGAL

public static final int MSG_DOUBLE_QUOTES_ILLEGAL
See Also:
Constant Field Values

MSG_INVALID_TEMPLATE_ACTION

public static final int MSG_INVALID_TEMPLATE_ACTION
See Also:
Constant Field Values

MSG_MISSING_ATTRIBUTE_NAME

public static final int MSG_MISSING_ATTRIBUTE_NAME
See Also:
Constant Field Values

MSG_ARG_INIT_VALUES_ILLEGAL

public static final int MSG_ARG_INIT_VALUES_ILLEGAL
See Also:
Constant Field Values

MSG_REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION

public static final int MSG_REWRITE_OR_OP_WITH_NO_OUTPUT_OPTION
See Also:
Constant Field Values

MSG_NO_RULES

public static final int MSG_NO_RULES
See Also:
Constant Field Values

MSG_WRITE_TO_READONLY_ATTR

public static final int MSG_WRITE_TO_READONLY_ATTR
See Also:
Constant Field Values

MSG_MISSING_AST_TYPE_IN_TREE_GRAMMAR

public static final int MSG_MISSING_AST_TYPE_IN_TREE_GRAMMAR
See Also:
Constant Field Values

MSG_REWRITE_FOR_MULTI_ELEMENT_ALT

public static final int MSG_REWRITE_FOR_MULTI_ELEMENT_ALT
See Also:
Constant Field Values

MSG_RULE_INVALID_SET

public static final int MSG_RULE_INVALID_SET
See Also:
Constant Field Values

MSG_HETERO_ILLEGAL_IN_REWRITE_ALT

public static final int MSG_HETERO_ILLEGAL_IN_REWRITE_ALT
See Also:
Constant Field Values

MSG_NO_SUCH_GRAMMAR_SCOPE

public static final int MSG_NO_SUCH_GRAMMAR_SCOPE
See Also:
Constant Field Values

MSG_NO_SUCH_RULE_IN_SCOPE

public static final int MSG_NO_SUCH_RULE_IN_SCOPE
See Also:
Constant Field Values

MSG_TOKEN_ALIAS_CONFLICT

public static final int MSG_TOKEN_ALIAS_CONFLICT
See Also:
Constant Field Values

MSG_TOKEN_ALIAS_REASSIGNMENT

public static final int MSG_TOKEN_ALIAS_REASSIGNMENT
See Also:
Constant Field Values

MSG_TOKEN_VOCAB_IN_DELEGATE

public static final int MSG_TOKEN_VOCAB_IN_DELEGATE
See Also:
Constant Field Values

MSG_INVALID_IMPORT

public static final int MSG_INVALID_IMPORT
See Also:
Constant Field Values

MSG_IMPORTED_TOKENS_RULE_EMPTY

public static final int MSG_IMPORTED_TOKENS_RULE_EMPTY
See Also:
Constant Field Values

MSG_IMPORT_NAME_CLASH

public static final int MSG_IMPORT_NAME_CLASH
See Also:
Constant Field Values

MSG_AST_OP_WITH_NON_AST_OUTPUT_OPTION

public static final int MSG_AST_OP_WITH_NON_AST_OUTPUT_OPTION
See Also:
Constant Field Values

MSG_AST_OP_IN_ALT_WITH_REWRITE

public static final int MSG_AST_OP_IN_ALT_WITH_REWRITE
See Also:
Constant Field Values

MSG_GRAMMAR_NONDETERMINISM

public static final int MSG_GRAMMAR_NONDETERMINISM
See Also:
Constant Field Values

MSG_UNREACHABLE_ALTS

public static final int MSG_UNREACHABLE_ALTS
See Also:
Constant Field Values

MSG_DANGLING_STATE

public static final int MSG_DANGLING_STATE
See Also:
Constant Field Values

MSG_INSUFFICIENT_PREDICATES

public static final int MSG_INSUFFICIENT_PREDICATES
See Also:
Constant Field Values

MSG_DUPLICATE_SET_ENTRY

public static final int MSG_DUPLICATE_SET_ENTRY
See Also:
Constant Field Values

MSG_ANALYSIS_ABORTED

public static final int MSG_ANALYSIS_ABORTED
See Also:
Constant Field Values

MSG_RECURSION_OVERLOW

public static final int MSG_RECURSION_OVERLOW
See Also:
Constant Field Values

MSG_LEFT_RECURSION

public static final int MSG_LEFT_RECURSION
See Also:
Constant Field Values

MSG_UNREACHABLE_TOKENS

public static final int MSG_UNREACHABLE_TOKENS
See Also:
Constant Field Values

MSG_TOKEN_NONDETERMINISM

public static final int MSG_TOKEN_NONDETERMINISM
See Also:
Constant Field Values

MSG_LEFT_RECURSION_CYCLES

public static final int MSG_LEFT_RECURSION_CYCLES
See Also:
Constant Field Values

MSG_NONREGULAR_DECISION

public static final int MSG_NONREGULAR_DECISION
See Also:
Constant Field Values

MAX_MESSAGE_NUMBER

public static final int MAX_MESSAGE_NUMBER
See Also:
Constant Field Values

ERRORS_FORCING_NO_ANALYSIS

public static final BitSet ERRORS_FORCING_NO_ANALYSIS
Do not do perform analysis if one of these happens


ERRORS_FORCING_NO_CODEGEN

public static final BitSet ERRORS_FORCING_NO_CODEGEN
Do not do code gen if one of these happens


emitSingleError

public static final java.util.Map emitSingleError
Only one error can be emitted for any entry in this table. Map where the key is a method name like danglingState. The set is whatever that method accepts or derives like a DFA.

Constructor Detail

ErrorManager

public ErrorManager()
Method Detail

getStringTemplateErrorListener

public static StringTemplateErrorListener getStringTemplateErrorListener()

setLocale

public static void setLocale(java.util.Locale locale)
We really only need a single locale for entire running ANTLR code in a single VM. Only pay attention to the language, not the country so that French Canadians and French Frenchies all get the same template file, fr.stg. Just easier this way.


setFormat

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


setErrorListener

public static void setErrorListener(ANTLRErrorListener listener)
In general, you'll want all errors to go to a single spot. However, in a GUI, you might have two frames up with two different grammars. Two threads might launch to process the grammars--you would want errors to go to different objects depending on the thread. I store a single listener per thread.


removeErrorListener

public static void removeErrorListener()

setTool

public static void setTool(Tool tool)

getMessage

public static StringTemplate getMessage(int msgID)
Given a message ID, return a StringTemplate that somebody can fill with data. We need to convert the int ID to the name of a template in the messages ST group.


getMessageType

public static java.lang.String getMessageType(int msgID)

getLocationFormat

public static StringTemplate getLocationFormat()
Return a StringTemplate that refers to the current format used for emitting messages.


getReportFormat

public static StringTemplate getReportFormat()

getMessageFormat

public static StringTemplate getMessageFormat()

formatWantsSingleLineMessage

public static boolean formatWantsSingleLineMessage()

getErrorListener

public static ANTLRErrorListener getErrorListener()

getErrorState

public static org.antlr.tool.ErrorManager.ErrorState getErrorState()

getNumErrors

public static int getNumErrors()

resetErrorState

public static void resetErrorState()

info

public static void info(java.lang.String msg)

error

public static void error(int msgID)

error

public static void error(int msgID,
                         java.lang.Throwable e)

error

public static void error(int msgID,
                         java.lang.Object arg)

error

public static void error(int msgID,
                         java.lang.Object arg,
                         java.lang.Object arg2)

error

public static void error(int msgID,
                         java.lang.Object arg,
                         java.lang.Throwable e)

warning

public static void warning(int msgID,
                           java.lang.Object arg)

nondeterminism

public static void nondeterminism(DecisionProbe probe,
                                  DFAState d)

danglingState

public static void danglingState(DecisionProbe probe,
                                 DFAState d)

analysisAborted

public static void analysisAborted(DecisionProbe probe)

unreachableAlts

public static void unreachableAlts(DecisionProbe probe,
                                   java.util.List alts)

insufficientPredicates

public static void insufficientPredicates(DecisionProbe probe,
                                          DFAState d,
                                          java.util.Map<java.lang.Integer,java.util.Set<antlr.Token>> altToUncoveredLocations)

nonLLStarDecision

public static void nonLLStarDecision(DecisionProbe probe)

recursionOverflow

public static void recursionOverflow(DecisionProbe probe,
                                     DFAState sampleBadState,
                                     int alt,
                                     java.util.Collection targetRules,
                                     java.util.Collection callSiteStates)

leftRecursionCycles

public static void leftRecursionCycles(java.util.Collection cycles)

grammarError

public static void grammarError(int msgID,
                                Grammar g,
                                antlr.Token token,
                                java.lang.Object arg,
                                java.lang.Object arg2)

grammarError

public static void grammarError(int msgID,
                                Grammar g,
                                antlr.Token token,
                                java.lang.Object arg)

grammarError

public static void grammarError(int msgID,
                                Grammar g,
                                antlr.Token token)

grammarWarning

public static void grammarWarning(int msgID,
                                  Grammar g,
                                  antlr.Token token,
                                  java.lang.Object arg,
                                  java.lang.Object arg2)

grammarWarning

public static void grammarWarning(int msgID,
                                  Grammar g,
                                  antlr.Token token,
                                  java.lang.Object arg)

grammarWarning

public static void grammarWarning(int msgID,
                                  Grammar g,
                                  antlr.Token token)

syntaxError

public static void syntaxError(int msgID,
                               Grammar grammar,
                               antlr.Token token,
                               java.lang.Object arg,
                               antlr.RecognitionException re)

internalError

public static void internalError(java.lang.Object error,
                                 java.lang.Throwable e)

internalError

public static void internalError(java.lang.Object error)

doNotAttemptAnalysis

public static boolean doNotAttemptAnalysis()

doNotAttemptCodeGen

public static boolean doNotAttemptCodeGen()

assertTrue

public static void assertTrue(boolean condition,
                              java.lang.String message)

initIdToMessageNameMapping

protected static boolean initIdToMessageNameMapping()

verifyMessages

protected static boolean verifyMessages()
Use reflection to find list of MSG_ fields and then verify a template exists for each one from the locale's group.


verifyFormat

protected static boolean verifyFormat()
Verify the message format template group


panic

public static void panic()
I *think* this will allow Tool subclasses to exit gracefully for GUIs etc...