summaryrefslogtreecommitdiffstats
path: root/grammar/testdriver.c
diff options
context:
space:
mode:
Diffstat (limited to 'grammar/testdriver.c')
-rw-r--r--grammar/testdriver.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/grammar/testdriver.c b/grammar/testdriver.c
index e1623829..915b5942 100644
--- a/grammar/testdriver.c
+++ b/grammar/testdriver.c
@@ -24,9 +24,39 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <libestr.h>
#include "parserif.h"
+extern int yylineno;
+
+void
+parser_errmsg(char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ printf("error on or before line %d: ", yylineno);
+ vprintf(fmt, ap);
+ printf("\n");
+ va_end(ap);
+}
+
+int
+yyerror(char *s)
+{
+ parser_errmsg("%s", s);
+ return 0;
+}
+
+void
+dbgprintf(char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+}
+
void
cstrPrint(char *text, es_str_t *estr)
{