summaryrefslogtreecommitdiff
path: root/src/genjsbind-parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/genjsbind-parser.y')
-rw-r--r--src/genjsbind-parser.y24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/genjsbind-parser.y b/src/genjsbind-parser.y
index c3122ea..1a342ae 100644
--- a/src/genjsbind-parser.y
+++ b/src/genjsbind-parser.y
@@ -1,10 +1,9 @@
+%{
/*
* This is a bison parser for genbind
*
*/
-%{
-
#include <stdio.h>
#include <string.h>
@@ -13,9 +12,11 @@
#include "webidl-ast.h"
#include "jsapi-binding.h"
+char *errtxt;
+
static void genjsbind_error(const char *str)
{
- fprintf(stderr,"error: %s\n",str);
+ errtxt = strdup(str);
}
@@ -24,11 +25,11 @@ int genjsbind_wrap()
return 1;
}
-
-
%}
+%locations
%define api.pure
+%error-verbose
%union
{
@@ -55,8 +56,17 @@ int genjsbind_wrap()
/* [1] start with Statements */
Statements
- : Statement
- | Statements Statement
+ :
+ Statement
+ |
+ Statements Statement
+ |
+ error ';'
+ {
+ fprintf(stderr, "%d: %s\n", yylloc.first_line, errtxt);
+ free(errtxt);
+ YYABORT ;
+ }
;
Statement