glr2.cc: reorganize the skeleton

Restore a more natural order: first define the macros and then use
them.  Currently, some macros were defined between the moment the
header is issued, and then the implementation file.  As a result, it
was possible for the header and the implementation to not use the same
versions of the macros.

* data/skeletons/glr2.cc: Define the macros first, then use them.
* data/skeletons/lalr1.cc: Minor comment and quoting changes.
This commit is contained in:
Akim Demaille
2020-12-26 16:47:09 +01:00
parent 89296e3962
commit 2777b73166
2 changed files with 115 additions and 103 deletions

View File

@@ -493,16 +493,21 @@ m4_define([b4_shared_declarations],
]b4_namespace_close[
]b4_percent_code_get([[provides]])[
]])
]])[
## -------------- ##
## Output files. ##
## -------------- ##
b4_header_if(
[b4_output_begin([b4_spec_header_file])
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
[
# ------------- #
# Header file. #
# ------------- #
]b4_header_if([[
]b4_output_begin([b4_spec_header_file])[
]b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])[
/**
** \file ]b4_spec_mapped_header_file[
** Define the ]b4_namespace_ref[::parser class.
@@ -515,10 +520,14 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
]b4_shared_declarations(hh)[
]b4_cpp_guard_close([b4_spec_mapped_header_file])[
]b4_output_end[
]])
]])[
b4_output_begin([b4_parser_file_name])[
# --------------------- #
# Implementation file. #
# --------------------- #
]b4_output_begin([b4_parser_file_name])[
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++])[
]b4_disclaimer[
]b4_percent_code_get([[top]])[]dnl