From 18f704edd0938355622049d853c1ce3cdfaee168 Mon Sep 17 00:00:00 2001 From: Marius Nita Date: Tue, 3 Sep 2002 08:57:35 +0000 Subject: better error reporting. epist now reports the line number and token a parser error occurs at, as well as invalid actions. --- util/epist/epist.y | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'util/epist/epist.y') diff --git a/util/epist/epist.y b/util/epist/epist.y index d187e96f..243e4168 100644 --- a/util/epist/epist.y +++ b/util/epist/epist.y @@ -9,7 +9,10 @@ #define YYPARSE_PARAM parser_obj #define YYSTYPE char* - + +extern int yylineno; +extern char *yytext; + extern "C" { int yylex(); int yywrap() { @@ -17,14 +20,15 @@ extern "C" { } } -void yyerror(const char *c) { - printf("ERROR: %s\n", c); +void yyerror(const char *c) +{ + printf("ERROR: %s, on line %d, near %s\n", c, yylineno, yytext); } - %} %token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING OPTIONS TRUE FALSE +%expect 1 %% -- cgit v1.2.3