ANTLR3C
3.3.1
|
Contains default functions for creating and destroying as well as otherwise handling ANTLR3 standard exception structures. More...
#include <antlr3exception.h>
Functions | |
static void | antlr3ExceptionFree (pANTLR3_EXCEPTION ex) |
Frees up a chain of ANTLR3 exceptions. | |
pANTLR3_EXCEPTION | antlr3ExceptionNew (ANTLR3_UINT32 exception, void *name, void *message, ANTLR3_BOOLEAN freeMessage) |
Creates a new ANTLR3 exception structure. | |
static void | antlr3ExceptionPrint (pANTLR3_EXCEPTION ex) |
Prints out the message in all the exceptions in the supplied chain. |
Contains default functions for creating and destroying as well as otherwise handling ANTLR3 standard exception structures.
static void antlr3ExceptionFree | ( | pANTLR3_EXCEPTION | ex | ) | [static] |
Frees up a chain of ANTLR3 exceptions.
[in] | ex | Pointer to the first exception in the chain to free. |
References ANTLR3_FREE, ANTLR3_TRUE, ANTLR3_EXCEPTION_struct::custom, ANTLR3_EXCEPTION_struct::freeCustom, ANTLR3_EXCEPTION_struct::freeMessage, ANTLR3_EXCEPTION_struct::message, next(), and ANTLR3_EXCEPTION_struct::nextException.
Referenced by antlr3ExceptionNew().
pANTLR3_EXCEPTION antlr3ExceptionNew | ( | ANTLR3_UINT32 | exception, |
void * | name, | ||
void * | message, | ||
ANTLR3_BOOLEAN | freeMessage | ||
) |
Creates a new ANTLR3 exception structure.
[in] | exception | One of the ANTLR3_xxx_EXCEPTION indicators such as ANTLR3_RECOGNITION_EXCEPTION |
[in] | message | Pointer to message string |
[in] | freeMessage | Set to ANTLR3_TRUE if the message parameter should be freed by a call to ANTLR3_FREE() when the exception is destroyed. |
An exception is 'thrown' by a recognizer when input is seen that is not predicted by the grammar productions or when some other error condition occurs. In C we do not have the luxury of try and catch blocks, so exceptions are added in the order they occur to a list in the baserecognizer structure. The last one to be thrown is inserted at the head of the list and the one currently installed is pointed to by the newly installed exception.
References ANTLR3_CALLOC, antlr3ExceptionFree(), antlr3ExceptionPrint(), ANTLR3_EXCEPTION_struct::freeEx, ANTLR3_EXCEPTION_struct::freeMessage, ANTLR3_EXCEPTION_struct::message, ANTLR3_EXCEPTION_struct::name, ANTLR3_EXCEPTION_struct::print, and ANTLR3_EXCEPTION_struct::type.
Referenced by antlr3RecognitionExceptionNew().
static void antlr3ExceptionPrint | ( | pANTLR3_EXCEPTION | ex | ) | [static] |
Prints out the message in all the exceptions in the supplied chain.
[in] | ex | Pointer to the exception structure to print. |
References ANTLR3_FPRINTF, ANTLR3_EXCEPTION_struct::message, ANTLR3_EXCEPTION_struct::nextException, and ANTLR3_EXCEPTION_struct::type.
Referenced by antlr3ExceptionNew().