yacc.c: emit the header before the implementation file

* 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).
This commit is contained in:
Akim Demaille
2019-03-05 07:35:20 +01:00
parent 91bbf4219d
commit e5ec21215e

View File

@@ -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