squareball
0.2.0.53-dd5b
A general-purpose library for C99
|
Parser error object. More...
#include <stdarg.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | sb_parser_error_t |
Functions | |
sb_error_t * | sb_parser_error_new (const char *src, size_t src_len, size_t pos, const char *msg) |
sb_error_t * | sb_parser_error_new_printf (const char *src, size_t src_len, size_t pos, const char *format,...) |
Parser error object.
This is an implementation of sb_error_t object, that is suitable to report errors in parsers, including context of the point of the source where the error happened.
It is used by our configuration parser implementation, that is a good usage example of this error object.
sb_error_t* sb_parser_error_new | ( | const char * | src, |
size_t | src_len, | ||
size_t | pos, | ||
const char * | msg | ||
) |
Function that creates a new error object with message and parser current position details.
src | String with source that was being parsed. |
src_len | Source string size. |
pos | Current parser position, stating from 0 . |
msg | String with error message. |
sb_error_t* sb_parser_error_new_printf | ( | const char * | src, |
size_t | src_len, | ||
size_t | pos, | ||
const char * | format, | ||
... | |||
) |
Function that creates a new error object, with printf(3)-like message formatting and parser current position details.
src | String with source that was being parsed. |
src_len | Source string size. |
pos | Current parser position, stating from 0 . |
format | Format for human-readable error message. |
... | One or more printf(3)-like parameters. |