bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] yacc.c: emit the header before the implementation file


From: Akim Demaille
Subject: [PATCH 2/4] yacc.c: emit the header before the implementation file
Date: Sat, 16 Mar 2019 10:02:07 +0100

* data/skeletons/yacc.c: here.
This is more logical for the time stamps, but it's also required by
following patches: the shared declarations are also in charge of
handling api.value.type=union.  So far, they are run in the
implementation file in both cases (with or without header).  But if we
run them only in the header, then the implementation file is emited
with incorrect support for api.value.type=union.
Arguably we should not have such dependencies.  This is because we
have side-effects in our backend (redefining the symbols' type and
type_tag).  In the future we should find a better solution for this,
without sacrificing the independence of the backend from bison
itself (i.e., I don't think we should handle api.value.type=union in
bison, leave it to m4).
---
 data/skeletons/yacc.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 34e18618..fb3cf54a 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -298,6 +298,15 @@ m4_define([b4_shared_declarations],
 ## Output files.  ##
 ## -------------- ##
 
+
+b4_defines_if([[
+]b4_output_begin([b4_spec_defines_file])[
+]b4_copyright([Bison interface for Yacc-like parsers in C])[
+]b4_disclaimer[
+]b4_shared_declarations[
+]b4_output_end[
+]])# b4_defines_if
+
 b4_output_begin([b4_parser_file_name])[
 ]b4_copyright([Bison implementation for Yacc-like parsers in C])[
 /* C LALR(1) parser skeleton written by Richard Stallman, by
@@ -1926,11 +1935,3 @@ yypushreturn:]])[
 }
 ]b4_epilogue[]dnl
 b4_output_end
-
-b4_defines_if([[
-]b4_output_begin([b4_spec_defines_file])[
-]b4_copyright([Bison interface for Yacc-like parsers in C])[
-]b4_disclaimer[
-]b4_shared_declarations[
-]b4_output_end[
-]])# b4_defines_if
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]