From d29f5a9e7ea64dd0436294e66fa1b786f2a5005a Mon Sep 17 00:00:00 2001 From: yueyuankun Date: Wed, 27 Aug 2025 11:42:22 +0800 Subject: [PATCH] 1.fix syntax error on SymbolKind.toString method 2.fix interface syntax error (cherry picked from commit afbb64bdb0b795d7622645ef86f46894f96e365b) --- backport-fix-interface-syntax-error.patch | 55 +++++++++++++++++++ ...-error-on-SymbolKind.toString-method.patch | 38 +++++++++++++ bison.spec | 13 ++++- 3 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 backport-fix-interface-syntax-error.patch create mode 100644 backport-fix-syntax-error-on-SymbolKind.toString-method.patch diff --git a/backport-fix-interface-syntax-error.patch b/backport-fix-interface-syntax-error.patch new file mode 100644 index 0000000..6248db7 --- /dev/null +++ b/backport-fix-interface-syntax-error.patch @@ -0,0 +1,55 @@ +From be4528096ec05f0d58bd9ff53a293e1ec3193a85 Mon Sep 17 00:00:00 2001 +From: Adela Vais +Date: Mon, 19 Sep 2022 15:12:39 +0200 +Subject: d: fix interface syntax error + +Fix syntax error regarding interface inheritance of the Lexer. It +appeared when the `%code lexer` option was used. + +Reported by ledaniel2. + + +* data/skeletons/lalr1.d: Fix syntax. +* tests/d.at: Test it. +--- + data/skeletons/lalr1.d | 5 +++-- + tests/d.at | 7 +++++++ + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d +index 3195dbf8..01175325 100644 +--- a/data/skeletons/lalr1.d ++++ b/data/skeletons/lalr1.d +@@ -269,9 +269,10 @@ b4_user_union_members + } + }]])[ + +-]b4_lexer_if([[ private class YYLexer implements Lexer { ++]b4_lexer_if([[private class YYLexer: Lexer ++{ + ]b4_percent_code_get([[lexer]])[ +- } ++} + ]])[ + /** The object doing lexical analysis for us. */ + private Lexer yylexer; +diff --git a/tests/d.at b/tests/d.at +index 6be53eef..347e868c 100644 +--- a/tests/d.at ++++ b/tests/d.at +@@ -112,6 +112,13 @@ AT_CHECK_D_GREP([[class YYParser : BaseClass]]) + AT_CHECK_D_MINIMAL([%define api.parser.extends {Interface}], [], [], [interface Interface {}]) + AT_CHECK_D_GREP([[class YYParser : Interface]]) + ++AT_CHECK_D_MINIMAL([%code lexer ++{ ++ Symbol yylex () {return Symbol();} ++ void yyerror (string s) {import std.stdio;writeln(s);} ++}], [], [], []) ++AT_CHECK_D_GREP([[private class YYLexer: Lexer]]) ++ + AT_CHECK_D_MINIMAL( + [%define api.parser.extends {BaseClass} + %define api.parser.implements {Interface}], [], [], +-- +cgit v1.2.3 diff --git a/backport-fix-syntax-error-on-SymbolKind.toString-method.patch b/backport-fix-syntax-error-on-SymbolKind.toString-method.patch new file mode 100644 index 0000000..1f1df9a --- /dev/null +++ b/backport-fix-syntax-error-on-SymbolKind.toString-method.patch @@ -0,0 +1,38 @@ +From 0faf3719926defc459c10b0a8d04d6a29c47a53f Mon Sep 17 00:00:00 2001 +From: Adela Vais +Date: Mon, 19 Sep 2022 19:09:20 +0200 +Subject: d: fix syntax error on SymbolKind.toString method + +Reported by ledaniel2. + + +* data/skeletons/d.m4: Here. +--- + data/skeletons/d.m4 | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/data/skeletons/d.m4 b/data/skeletons/d.m4 +index 9354b0fe..e82f87e5 100644 +--- a/data/skeletons/d.m4 ++++ b/data/skeletons/d.m4 +@@ -284,8 +284,7 @@ m4_define([b4_declare_symbol_enum], + that double-quoting is unnecessary unless the string contains an + apostrophe, a comma, or backslash (other than backslash-backslash). + YYSTR is taken from yytname. */ +- final void toString(W)(W sink) const +- if (isOutputRange!(W, char)) ++ final void toString(void delegate(const(char)[]) sink) const + { + immutable string[] yy_sname = @{ + ]b4_symbol_names[ +@@ -296,7 +295,7 @@ m4_define([b4_declare_symbol_enum], + ]b4_translatable[ + @};]])[ + +- put(sink, yy_sname[yycode_]); ++ sink.formattedWrite!"%s"(yy_sname[yycode_]); + } + } + ]]) +-- +cgit v1.2.3 diff --git a/bison.spec b/bison.spec index 195fc54..fc4a672 100644 --- a/bison.spec +++ b/bison.spec @@ -1,12 +1,14 @@ Name: bison Version: 3.8.2 -Release: 2 +Release: 3 Summary: A GNU general-purpose parser generator License: GPLv3+ URL: http://www.gnu.org/software/bison/ Source0: https://ftp.gnu.org/gnu/bison/bison-%{version}.tar.xz -Patch1: backport-tests-make-it-easier-to-spot-failures.patch +Patch6001: backport-tests-make-it-easier-to-spot-failures.patch +Patch6002: backport-fix-syntax-error-on-SymbolKind.toString-method.patch +Patch6003: backport-fix-interface-syntax-error.patch BuildRequires: gcc-c++ autoconf automake m4 flex Requires(post): info @@ -91,6 +93,13 @@ fi %{_datadir}/locale/*/LC_MESSAGES/bison-gnulib.mo %changelog +* Tue Aug 26 2025 yueyuankun - 3.8.2-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix syntax error on SymbolKind.toString method + fix interface syntax error + * Sat Oct 22 2022 yixiangzhike - 3.8.2-2 - Type:bugfix - ID:NA -- Gitee