ANTLR3C  3.3.1
ANTLR3_EXCEPTION_struct Struct Reference

Base structure for an ANTLR3 exception tracker. More...

#include <antlr3exception.h>

Collaboration diagram for ANTLR3_EXCEPTION_struct:

Data Fields

ANTLR3_UCHAR c
 The current character when an error occurred - for lexers. More...
 
ANTLR3_INT32 charPositionInLine
 Character position in the line where the error occurred. More...
 
void * custom
 Pointer for you, the programmer to add anything you like to an exception. More...
 
ANTLR3_UINT32 decisionNum
 decision number for NVE More...
 
ANTLR3_UINT32 expecting
 Indicates the token we were expecting to see next when the error occurred. More...
 
pANTLR3_BITSET_LIST expectingSet
 Indicates a set of tokens that we were expecting to see one of when the error occurred. More...
 
void(* freeCustom )(void *custom)
 Pointer to a routine that is called to free the custom exception structure when the exception is destroyed. More...
 
void(* freeEx )(struct ANTLR3_EXCEPTION_struct *ex)
 
ANTLR3_BOOLEAN freeMessage
 If set to ANTLR3_TRUE, this indicates that the message element of this structure should be freed by calling ANTLR3_FREE() when the exception is destroyed. More...
 
ANTLR3_MARKER index
 Indicates the index of the 'token' we were looking at when the exception occurred. More...
 
pANTLR3_INT_STREAM input
 Pointer to the input stream that this exception occurred in. More...
 
ANTLR3_UINT32 line
 Track the line at which the error occurred in case this is generated from a lexer. More...
 
void * message
 The printable message that goes with this exception, in your preferred encoding format. More...
 
void * name
 The string name of the exception. More...
 
struct ANTLR3_EXCEPTION_structnextException
 Pointer to the next exception in the chain (if any) More...
 
void * node
 If this is a tree parser exception then the node is set to point to the node that caused the issue. More...
 
void(* print )(struct ANTLR3_EXCEPTION_struct *ex)
 
void * ruleName
 Rule name for failed predicate exception. More...
 
ANTLR3_UINT32 state
 State for NVE. More...
 
pANTLR3_STRING streamName
 Name of the file/input source for reporting. More...
 
void * token
 Indicates what the current token/tree was when the error occurred. More...
 
ANTLR3_UINT32 type
 Set to one of the exception type defines: More...
 

Detailed Description

Base structure for an ANTLR3 exception tracker.

Field Documentation

◆ c

ANTLR3_UCHAR ANTLR3_EXCEPTION_struct::c

The current character when an error occurred - for lexers.

Referenced by antlr3RecognitionExceptionNew(), and displayRecognitionError().

◆ charPositionInLine

ANTLR3_INT32 ANTLR3_EXCEPTION_struct::charPositionInLine

Character position in the line where the error occurred.

Referenced by antlr3RecognitionExceptionNew(), displayRecognitionError(), and recognitionException().

◆ custom

void* ANTLR3_EXCEPTION_struct::custom

Pointer for you, the programmer to add anything you like to an exception.

Referenced by antlr3ExceptionFree().

◆ decisionNum

ANTLR3_UINT32 ANTLR3_EXCEPTION_struct::decisionNum

decision number for NVE

Referenced by noViableAlt().

◆ expecting

ANTLR3_UINT32 ANTLR3_EXCEPTION_struct::expecting

Indicates the token we were expecting to see next when the error occurred.

Referenced by displayRecognitionError(), mismatch(), mismatchIsUnwantedToken(), and recoverFromMismatchedToken().

◆ expectingSet

pANTLR3_BITSET_LIST ANTLR3_EXCEPTION_struct::expectingSet

Indicates a set of tokens that we were expecting to see one of when the error occurred.

It is a following bitset list, so you can use load it and use ->toIntList() on it to generate an array of integer tokens that it represents.

Referenced by displayRecognitionError().

◆ freeCustom

void(* ANTLR3_EXCEPTION_struct::freeCustom) (void *custom)

Pointer to a routine that is called to free the custom exception structure when the exception is destroyed.

Set to NULL if nothing should be done.

Referenced by antlr3ExceptionFree().

◆ freeEx

void(* ANTLR3_EXCEPTION_struct::freeEx) (struct ANTLR3_EXCEPTION_struct *ex)

Referenced by antlr3ExceptionNew(), freeBR(), and reset().

◆ freeMessage

ANTLR3_BOOLEAN ANTLR3_EXCEPTION_struct::freeMessage

If set to ANTLR3_TRUE, this indicates that the message element of this structure should be freed by calling ANTLR3_FREE() when the exception is destroyed.

Referenced by antlr3ExceptionFree(), and antlr3ExceptionNew().

◆ index

ANTLR3_MARKER ANTLR3_EXCEPTION_struct::index

Indicates the index of the 'token' we were looking at when the exception occurred.

Referenced by antlr3RecognitionExceptionNew(), displayRecognitionError(), and recognitionException().

◆ input

pANTLR3_INT_STREAM ANTLR3_EXCEPTION_struct::input

Pointer to the input stream that this exception occurred in.

Referenced by antlr3RecognitionExceptionNew().

◆ line

ANTLR3_UINT32 ANTLR3_EXCEPTION_struct::line

Track the line at which the error occurred in case this is generated from a lexer.

We need to track this since the unexpected char doesn't carry the line info.

Referenced by antlr3RecognitionExceptionNew(), displayRecognitionError(), and recognitionException().

◆ message

void* ANTLR3_EXCEPTION_struct::message

The printable message that goes with this exception, in your preferred encoding format.

ANTLR just uses ASCII by default but you can ignore these messages or convert them to another format or whatever of course. They are really internal messages that you then decide how to print out in a form that the users of your product will understand, as they are unlikely to know what to do with "Recognition exception at: [[TOK_GERUND..... " ;-)

Referenced by antlr3ExceptionFree(), antlr3ExceptionNew(), antlr3ExceptionPrint(), antlr3RecognitionExceptionNew(), displayRecognitionError(), noViableAlt(), and recoverFromMismatchedToken().

◆ name

void* ANTLR3_EXCEPTION_struct::name

◆ nextException

struct ANTLR3_EXCEPTION_struct* ANTLR3_EXCEPTION_struct::nextException

Pointer to the next exception in the chain (if any)

Referenced by antlr3ExceptionFree(), antlr3ExceptionPrint(), and antlr3RecognitionExceptionNew().

◆ node

void* ANTLR3_EXCEPTION_struct::node

If this is a tree parser exception then the node is set to point to the node that caused the issue.

◆ print

void(* ANTLR3_EXCEPTION_struct::print) (struct ANTLR3_EXCEPTION_struct *ex)

Referenced by antlr3ExceptionNew().

◆ ruleName

void* ANTLR3_EXCEPTION_struct::ruleName

Rule name for failed predicate exception.

◆ state

ANTLR3_UINT32 ANTLR3_EXCEPTION_struct::state

State for NVE.

Referenced by noViableAlt().

◆ streamName

pANTLR3_STRING ANTLR3_EXCEPTION_struct::streamName

Name of the file/input source for reporting.

Note that this may be NULL!!

Referenced by antlr3RecognitionExceptionNew(), and displayRecognitionError().

◆ token

void* ANTLR3_EXCEPTION_struct::token

Indicates what the current token/tree was when the error occurred.

Since not all input streams will be able to retrieve the nth token, we track it here instead. This is for parsers, and even tree parsers may set this.

Referenced by antlr3RecognitionExceptionNew(), displayRecognitionError(), recoverFromMismatchedSet(), and recoverFromMismatchedToken().

◆ type


The documentation for this struct was generated from the following file: