From 5bac3ddcee7c6eebb4833d1954f614fced475073 Mon Sep 17 00:00:00 2001 From: Adela Vais Date: Tue, 5 Jan 2021 16:47:29 +0200 Subject: [PATCH] d: remove yytnamerr usage It is a backwards-compatible feature for the other parsers. D should not support this option. * data/skeletons/d.m4: Here. --- data/skeletons/d.m4 | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/data/skeletons/d.m4 b/data/skeletons/d.m4 index 5320c483..cfb87944 100644 --- a/data/skeletons/d.m4 +++ b/data/skeletons/d.m4 @@ -243,12 +243,6 @@ m4_define([b4_declare_symbol_enum], yycode_ = code; } - /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at \a YYNTOKENS_, nonterminals. */ - static immutable string[] yytname_ = @{ - ]b4_tname[ - @}; - /* Return YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an @@ -264,37 +258,9 @@ m4_define([b4_declare_symbol_enum], internationalizable. */ immutable ]b4_int_type_for([b4_translatable])[[] yytranslatable = @{ ]b4_translatable[ - @}; + @};]])[ - put(sink, yy_sname[yycode_]);]], [[ - string yystr = yytname_[yycode_]; - if (yystr[0] == '"') - { - strip_quotes: - for (int i = 1; i < yystr.length; i++) - switch (yystr[i]) - { - case '\'': - case ',': - break strip_quotes; - - case '\\': - if (yystr[++i] != '\\') - break strip_quotes; - goto default; - default: - put(sink, yystr[i]); - break; - - case '"': - return; - } - } - else if (yystr == "$end") - { - put(sink, "end of input"); - return; - }]])[ + put(sink, yy_sname[yycode_]); } } ]])