%merge: delegate the generation of calls to mergers to m4

Don't generate C code from bison, leave that to the skeletons.

* src/output.c (merger_output): Emit invocations to b4_call_merger.
* data/skeletons/glr.c, data/skeletons/glr2.cc (b4_call_merger): New.
This commit is contained in:
Akim Demaille
2020-12-30 09:10:05 +01:00
parent ac3d5b76f7
commit c09f2e4c7b
3 changed files with 20 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
-*- C -*-
# -*- C -*-
# GLR skeleton for Bison
@@ -147,6 +147,15 @@ m4_define([b4_rhs_location],
[(b4_rhs_data([$1], [$2]).yyloc)])
# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM)
# ---------------------------------------------------
m4_define([b4_call_merger],
[b4_case([$1],
[ b4_symbol_if([$3], [has_type],
[yy0->b4_symbol($3, type) = $2 (*yy0, *yy1);],
[*yy0 = $2 (*yy0, *yy1);])])])
## -------------- ##
## Declarations. ##
## -------------- ##

View File

@@ -122,6 +122,14 @@ m4_define([b4_rhs_location],
[(b4_rhs_data([$1], [$2]).yyloc)])
# b4_call_merger(MERGER-NUM, MERGER-NAME, SYMBOL-SUM)
# ---------------------------------------------------
m4_define([b4_call_merger],
[b4_case([$1],
[ b4_symbol_if([$3], [has_type],
[yy0->b4_symbol($3, type) = $2 (*yy0, *yy1);],
[*yy0 = $2 (*yy0, *yy1);])])])
# b4_lex
# ------
# Call yylex.