proper errors
This commit is contained in:
parent
30887a4400
commit
8a85558cf9
@ -14,6 +14,18 @@ char * language = NULL;
|
||||
char * verbatim = NULL;
|
||||
char * top = NULL;
|
||||
|
||||
void yyerror(const char * const fmt, ...) {
|
||||
extern int yylineno;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
fprintf(stderr, "%s:%d: error: ", input_file_name, yylineno);
|
||||
vfprintf(stderr, fmt, args);
|
||||
fputc('\n', stderr);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void put_rule_table(const char * const name, rule_type_t type_mask) {
|
||||
char * sprint_buffer;
|
||||
int sprint_r;
|
||||
|
@ -1,7 +1,7 @@
|
||||
%{
|
||||
#include "tbsp.yy.h"
|
||||
|
||||
void yyerror([[maybe_unused]] const char * const s);
|
||||
void yyerror(const char * const s, ...);
|
||||
|
||||
extern char * language;
|
||||
extern char * top;
|
||||
@ -110,10 +110,6 @@ code_section
|
||||
|
||||
rule_vector_t rules;
|
||||
|
||||
void yyerror(const char * const s) {
|
||||
printf("error: %s", s);
|
||||
}
|
||||
|
||||
void tbsp_tab_init(void) {
|
||||
kv_init(rules);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user