From 7ba968e4c33d3a05ff9b23b8e593b400e34a4cad Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 7 Sep 2012 16:51:43 +0100 Subject: fixup error reporting to give linenumber --- src/webidl-parser.y | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/webidl-parser.y') diff --git a/src/webidl-parser.y b/src/webidl-parser.y index c4e25f1..1a40e41 100644 --- a/src/webidl-parser.y +++ b/src/webidl-parser.y @@ -14,11 +14,11 @@ #include "webidl-parser.h" #include "webidl-lexer.h" - +char *errtxt; static void webidl_error(const char *str) { - fprintf(stderr,"error: %s\n",str); + errtxt = strdup(str); } int webidl_wrap() @@ -26,12 +26,11 @@ int webidl_wrap() return 1; } - - %} %locations %define api.pure +%error-verbose /* the w3c grammar results in 10 shift/reduce, 2 reduce/reduce conflicts * The reduce/reduce error are both the result of empty sequences @@ -118,6 +117,13 @@ Definitions: /* empty */ | ExtendedAttributeList Definition Definitions + | + error ';' + { + fprintf(stderr, "%d: %s\n", yylloc.first_line, errtxt); + free(errtxt); + YYABORT ; + } ; /* [2] */ -- cgit v1.2.3