Click or drag to resize

BaseRecognizerGetErrorMessage Method

What error message should be generated for the various exception types?

Namespace:  Stimulsoft.Data.Expressions.Antlr.Runtime
Assembly:  Stimulsoft.Data (in Stimulsoft.Data.dll) Version: 2019.3.1.0
Syntax
public virtual string GetErrorMessage(
	RecognitionException e,
	string[] tokenNames
)

Parameters

e
Type: Stimulsoft.Data.Expressions.Antlr.RuntimeRecognitionException

[Missing <param name="e"/> documentation for "M:Stimulsoft.Data.Expressions.Antlr.Runtime.BaseRecognizer.GetErrorMessage(Stimulsoft.Data.Expressions.Antlr.Runtime.RecognitionException,System.String[])"]

tokenNames
Type: SystemString

[Missing <param name="tokenNames"/> documentation for "M:Stimulsoft.Data.Expressions.Antlr.Runtime.BaseRecognizer.GetErrorMessage(Stimulsoft.Data.Expressions.Antlr.Runtime.RecognitionException,System.String[])"]

Return Value

Type: String

[Missing <returns> documentation for "M:Stimulsoft.Data.Expressions.Antlr.Runtime.BaseRecognizer.GetErrorMessage(Stimulsoft.Data.Expressions.Antlr.Runtime.RecognitionException,System.String[])"]

Remarks
Not very object-oriented code, but I like having all error message generation within one method rather than spread among all of the exception classes. This also makes it much easier for the exception handling because the exception classes do not have to have pointers back to this object to access utility routines and so on. Also, changing the message for an exception type would be difficult because you would have to subclassing exception, but then somehow get ANTLR to make those kinds of exception objects instead of the default. This looks weird, but trust me--it makes the most sense in terms of flexibility. For grammar debugging, you will want to override this to add more information such as the stack frame with getRuleInvocationStack(e, this.getClass().getName()) and, for no viable alts, the decision description and state etc... Override this to change the message generated for one or more exception types.
See Also