mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
preserve the indentation in the ouput
Preserve the actions' initial indentation. For instance, on
| %define api.value.type {int}
| %%
| exp: exp '/' exp { if ($3)
| $$ = $1 + $3;
| else
| $$ = 0; }
we used to generate
| { if (yyvsp[0])
| yyval = yyvsp[-2] + yyvsp[0];
| else
| yyval = 0; }
now we produce
| { if (yyvsp[0])
| yyval = yyvsp[-2] + yyvsp[0];
| else
| yyval = 0; }
See https://lists.gnu.org/archive/html/bison-patches/2019-06/msg00012.html.
* data/skeletons/bison.m4 (b4_symbol_action): Output the code in
column 0, leave indentation matters to the C code.
* src/output.c (user_actions_output): Preserve the incoming
indentation in the output.
(prepare_symbol_definitions): Likewise for %printer/%destructor.
* tests/synclines.at (Output columns): New.
This commit is contained in:
@@ -449,7 +449,7 @@ m4_define([b4_symbol_action],
|
||||
[(*yylocationp)])dnl
|
||||
_b4_symbol_case([$1])[]dnl
|
||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])dnl
|
||||
b4_symbol([$1], [$2])
|
||||
b4_symbol([$1], [$2])
|
||||
b4_syncline([@oline@], [@ofile@])dnl
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user