Click or drag to resize

RecognitionException Class

The root of the ANTLR exception hierarchy.
Inheritance Hierarchy
SystemObject
  SystemException
    Stimulsoft.Data.Expressions.Antlr.RuntimeRecognitionException
      More...

Namespace:  Stimulsoft.Data.Expressions.Antlr.Runtime
Assembly:  Stimulsoft.Data (in Stimulsoft.Data.dll) Version: 2019.3.1.0
Syntax
[SerializableAttribute]
public class RecognitionException : Exception

The RecognitionException type exposes the following members.

Constructors
  NameDescription
Public methodRecognitionException
Used for remote debugger deserialization
Public methodRecognitionException(String)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(IIntStream)
Initializes a new instance of the RecognitionException class
Protected methodRecognitionException(SerializationInfo, StreamingContext)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(String, IIntStream)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(String, Exception)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(IIntStream, Int32)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(String, IIntStream, Exception)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(String, IIntStream, Int32)
Initializes a new instance of the RecognitionException class
Public methodRecognitionException(String, IIntStream, Int32, Exception)
Initializes a new instance of the RecognitionException class
Top
Properties
  NameDescription
Public propertyApproximateLineInfo
Public propertyCharacter
Public propertyCharPositionInLine
Public propertyData
Gets a collection of key/value pairs that provide additional user-defined information about the exception.
(Inherited from Exception.)
Public propertyHelpLink
Gets or sets a link to the help file associated with this exception.
(Inherited from Exception.)
Public propertyHResult
Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
(Inherited from Exception.)
Public propertyIndex
Public propertyInnerException
Gets the Exception instance that caused the current exception.
(Inherited from Exception.)
Public propertyInput
Public propertyLine
Public propertyLookahead
Public propertyMessage
Gets a message that describes the current exception.
(Inherited from Exception.)
Public propertyNode
Public propertySource
Gets or sets the name of the application or the object that causes the error.
(Inherited from Exception.)
Public propertyStackTrace
Gets a string representation of the immediate frames on the call stack.
(Inherited from Exception.)
Public propertyTargetSite
Gets the method that throws the current exception.
(Inherited from Exception.)
Public propertyToken
Public propertyUnexpectedType
Return the token type or char of the unexpected input element
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodExtractInformationFromTreeNodeStream(ITreeNodeStream)
Protected methodExtractInformationFromTreeNodeStream(ITreeNodeStream, Int32)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetBaseException
When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
(Inherited from Exception.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetObjectData (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Public methodGetType
Gets the runtime type of the current instance.
(Inherited from Exception.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Creates and returns a string representation of the current exception.
(Inherited from Exception.)
Top
Events
  NameDescription
Protected eventSerializeObjectState
Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.
(Inherited from Exception.)
Top
Remarks
To avoid English-only error messages and to generally make things as flexible as possible, these exceptions are not created with strings, but rather the information necessary to generate an error. Then the various reporting methods in Parser and Lexer can be overridden to generate a localized error message. For example, MismatchedToken exceptions are built with the expected token type. So, don't expect getMessage() to return anything. Note that as of Java 1.4, you can access the stack trace, which means that you can compute the complete trace of rules from the start symbol. This gives you considerable context information with which to generate useful error messages. ANTLR generates code that throws exceptions upon recognition error and also generates code to catch these exceptions in each rule. If you want to quit upon first error, you can turn off the automatic error handling mechanism using rulecatch action, but you still need to override methods mismatch and recoverFromMismatchSet. In general, the recognition exceptions can track where in a grammar a problem occurred and/or what was the expected input. While the parser knows its state (such as current input symbol and line info) that state can change before the exception is reported so current token index is computed and stored at exception time. From this info, you can perhaps print an entire line of input not just a single token, for example. Better to just say the recognizer had a problem and then let the parser figure out a fancy report.
See Also
Inheritance Hierarchy