[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cannot trace error location when %glr-parser and %pure-parser are used t
From: |
Slava Savitsky |
Subject: |
Cannot trace error location when %glr-parser and %pure-parser are used together. |
Date: |
Fri, 14 Dec 2012 21:49:18 +0400 |
Here's a problem: for a grammar with both %glr-parser and %pure-parser
declarations a location-aware error reporting function cannot be used.
Usually to track the error position one defines "yyerror(msg)" to
"print_error(message, &yylval, yychar)", right? In the pure parser
"yylval" becomes "yystackp->yylval". The problem is, yyerror(YY_(msg))
is called from the "reportAmbiguity" function which does not take the
"yystackp" argument.
A possible fix would be:
--- /usr/share/bison/glr.cssss 2012-12-14 20:07:40.516065313 +0400
+++ /usr/share/bison/glr.csss 2012-12-14 19:49:35.600065872 +0400
@@ -1788,8 +1788,7 @@
s#endif
s
s/*ARGSUSED*/ static YYRESULTTAG
-yyreportAmbiguity (yyGLRStack* yystackp,
-ssssssssssssssssss yySemanticOption* yyx0,
+yyreportAmbiguity (yySemanticOption* yyx0,
ssss sss ss yySemanticOption* yyx1]b4_pure_formals[)
s{
ss YYUSE (yyx0);
@@ -1900,7 +1899,7 @@
ssss sss {
ssss sss case 0:
ssss sssss yyresolveLocations (yys, 1, yystackp]b4_user_args[);
-sss sssss return yyreportAmbiguity (yystackp, yybest,
yyp]b4_pure_args[);
+sss sssss return yyreportAmbiguity (yybest, yyp]b4_pure_args[);
ssss sssss break;
ssss sss case 1:
ssss sssss yymerge = yytrue;
Slava Savitskiy.
- Cannot trace error location when %glr-parser and %pure-parser are used together.,
Slava Savitsky <=