X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Flex.h;h=199d34c1106baccc36624b66a7901a38b94e0ae2;hb=fad06408677ccf4e01bf28c01702ab337da2ec05;hp=795d31cbcf573291d08662faaefc4d8860c65a98;hpb=f593d1be2383ca6ff2972de8def13749f6992c4d;p=bacula%2Fbacula diff --git a/bacula/src/lib/lex.h b/bacula/src/lib/lex.h index 795d31cbcf..199d34c110 100644 --- a/bacula/src/lib/lex.h +++ b/bacula/src/lib/lex.h @@ -91,6 +91,7 @@ typedef struct s_lex_context { int str_len; /* length of string */ int line_no; /* file line number */ int col_no; /* char position on line */ + int begin_line_no; /* line no of beginning of string */ enum lex_state state; /* lex_state variable */ int ch; /* last char/L_VAL returned by get_char */ int token; @@ -98,6 +99,21 @@ typedef struct s_lex_context { uint32_t pint32_val2; int32_t int32_val; int64_t int64_val; + void (*scan_error)(const char *file, int line, struct s_lex_context *lc, const char *msg, ...); + void *caller_ctx; /* caller private data */ } LEX; +typedef void (LEX_ERROR_HANDLER)(const char *file, int line, LEX *lc, const char *msg, ...); + +/* Lexical scanning errors in parsing conf files */ +#define scan_err0(lc, msg) lc->scan_error(__FILE__, __LINE__, lc, msg) +#define scan_err1(lc, msg, a1) lc->scan_error(__FILE__, __LINE__, lc, msg, a1) +#define scan_err2(lc, msg, a1, a2) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2) +#define scan_err3(lc, msg, a1, a2, a3) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2, a3) +#define scan_err4(lc, msg, a1, a2, a3, a4) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2, a3, a4) +#define scan_err5(lc, msg, a1, a2, a3, a4, a5) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2, a3, a4, a5) +#define scan_err6(lc, msg, a1, a2, a3, a4, a5, a6) lc->scan_error(__FILE__, __LINE__, lc, msg, a1, a2, a3, a4, a5, a6) + +void scan_to_eol(LEX *lc); + #endif /* _LEX_H */