[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
#line directives are incorrectly inserted in the middle of a line in sem
From: |
Rici Lake |
Subject: |
#line directives are incorrectly inserted in the middle of a line in semantic predicate tests. |
Date: |
Mon, 28 May 2018 00:23:57 -0500 |
Collected from Stack Overflow question
https://stackoverflow.com/questions/50550637/bison-semantic-predicate-syntax-error-stray
Version: 3.04 (also fails on 3.01 and 3.02)
Platform: Linux but I think it would be the same on any platform
To reproduce, it is possible to use the semantic predicate test snippet
already in the bison test suite:
%glr-parser
%expect-rr 1
%%
// Exercise "%?{...}" and "%? {...}".
widget:
%? {new_syntax} "widget" id new_args { $$ = f($3, $4); }
| %?{!new_syntax} "widget" id old_args { $$ = f($3, $4); }
;
id:;
new_args:;
old_args:;
%%
produces (at line 789):
case 2:
if (! (#line 6 "sempred.y" /* glr.c:816 */
new_syntax)) YYERROR;
#line 793 "sempred.tab.c" /* glr.c:816 */
break;
which of course produces a compiler error.
As a quick workaround, I fixed the problem by altering line 462 of
data/c.m4 to read
if (! (
$2)) YYERROR;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- #line directives are incorrectly inserted in the middle of a line in semantic predicate tests.,
Rici Lake <=