no-lines: avoid leaving an empty line instead of the syncline

Currently, with --no-lines, instead of "#line file line\n", we emit
"\n".  Let's emit nothing.

* data/skeletons/bison.m4 (b4_syncline): Emit at end-of-line when enabled.
* data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.cc,
* data/skeletons/lalr1.cc, src/output.c: Use dnl after b4_syncline to
avoid spurious empty lines.

* tests/synclines.at (Sync Lines): Make sure that --no-lines is like
grep -v #line.
* tests/calc.at: Make sure that a rich grammar file behaves properly
with %no-lines.
This commit is contained in:
Akim Demaille
2019-04-01 18:23:20 +02:00
parent 9832fdd6ef
commit 0f193d2d21
11 changed files with 71 additions and 37 deletions

View File

@@ -100,8 +100,8 @@ m4_defn([b4_initial_action])]))])[
# Hijack the post prologue to declare yyerror.
]m4_append([b4_post_prologue],
[b4_syncline([@oline@], [@ofile@])[
]b4_function_declare([yyerror],
[b4_syncline([@oline@], [@ofile@])dnl
b4_function_declare([yyerror],
[static void],b4_locations_if([
[[const ]b4_namespace_ref::b4_parser_class[::location_type *yylocationp],
[yylocationp]],])
@@ -128,8 +128,8 @@ m4_if(b4_prefix, [yy], [],
# Hijack the epilogue to define implementations (yyerror, parser member
# functions etc.).
m4_append([b4_epilogue],
[b4_syncline([@oline@], [@ofile@])[
[b4_syncline([@oline@], [@ofile@])dnl
[
/*------------------.
| Report an error. |
`------------------*/
@@ -234,7 +234,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
#endif
]m4_popdef([b4_parse_param])dnl
b4_namespace_close
b4_namespace_close[]dnl
])