proper errors

This commit is contained in:
anon 2024-09-15 02:19:01 +02:00
parent 30887a4400
commit 8a85558cf9
2 changed files with 13 additions and 5 deletions

View File

@ -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;

View File

@ -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);
}