antlr3exception.c man page

src/antlr3exception.c — Contains default functions for creating and destroying as well as otherwise handling ANTLR3 standard exception structures.

Synopsis

#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.

Detailed Description

Contains default functions for creating and destroying as well as otherwise handling ANTLR3 standard exception structures.

Function Documentation

static void antlr3ExceptionFree (pANTLR3_EXCEPTION ex) [static]

Frees up a chain of ANTLR3 exceptions.

Parameters:

ex Pointer to the first exception in the chain to free.

See also:

ANTLR3_EXCEPTION

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.

Parameters:

exception One of the ANTLR3_xxx_EXCEPTION indicators such as ANTLR3_RECOGNITION_EXCEPTION
message Pointer to message string
freeMessage Set to ANTLR3_TRUE if the message parameter should be freed by a call to ANTLR3_FREE() when the exception is destroyed.

Returns:

Pointer to newly initialized exception structure, or an ANTLR3_ERR_xx defined value upon failure.

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.

Remarks:

After an exception is created, you may add a pointer to your own structure and a pointer to a function to free this structure when the exception is destroyed.

See also:

ANTLR3_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.

Parameters:

ex Pointer to the exception structure to print.

Remarks:

You may wish to override this function by installing a pointer to a new function in the base recognizer context structure.

See also:

ANTLR3_BASE_RECOGNIZER

References ANTLR3_FPRINTF, ANTLR3_EXCEPTION_struct::message, ANTLR3_EXCEPTION_struct::nextException, and ANTLR3_EXCEPTION_struct::type.

Referenced by antlr3ExceptionNew().

Author

Generated automatically by Doxygen for ANTLR3C from the source code.

Referenced By

antlr3ExceptionFree(3) and antlr3ExceptionPrint(3) are aliases of antlr3exception.c(3).

Tue Oct 4 2016 Version 3.3.1 ANTLR3C