From 7742ddebf1f73cc15138d41c11a39f32b43c3ef5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 27 Dec 2001 18:04:28 +0000 Subject: [PATCH] * src/output.c (prepare): Drop the muscle `ntbase' which duplicates ntokens. * src/bison.simple: Formatting/comment changes. Use YYNTOKENS only, which is documented, but not YYNTBASE, which is an undocumented synonym. --- ChangeLog | 9 +++++++++ po/de.po | 10 +++++----- po/es.po | 10 +++++----- po/et.po | 10 +++++----- po/fr.po | 10 +++++----- po/ja.po | 10 +++++----- po/nl.po | 10 +++++----- po/ru.po | 10 +++++----- po/sv.po | 10 +++++----- po/tr.po | 10 +++++----- src/bison.simple | 51 +++++++++++++++++++++++++++++++----------------- src/output.c | 3 +-- src/reader.c | 4 ++-- 13 files changed, 90 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index be937d51..8f86c129 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-12-27 Akim Demaille + + * src/output.c (prepare): Drop the muscle `ntbase' which + duplicates ntokens. + * src/bison.simple: Formatting/comment changes. + Use YYNTOKENS only, which is documented, but not YYNTBASE, which + is an undocumented synonym. + + 2001-12-22 Akim Demaille * src/output.c (output_table_data): Change the prototype to use diff --git a/po/de.po b/po/de.po index 4a052ed1..4b32d107 100644 --- a/po/de.po +++ b/po/de.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.25\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 1996-10-10 17:54 MET DST\n" "Last-Translator: Ulrich Drepper \n" "Language-Team: German \n" @@ -97,12 +97,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d Schiebe/Reduziere Konflikte" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[reduziere mit Regel %d (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -111,12 +111,12 @@ msgstr "" " $default\treduziere mit Regel %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\treduziere mit Tegel %d (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $default\treduziere mit Regel %d (%s)\n" diff --git a/po/es.po b/po/es.po index 4f218af2..98b57726 100644 --- a/po/es.po +++ b/po/es.po @@ -30,7 +30,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU bison 1.25\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 1998-09-21 10:19+0200\n" "Last-Translator: Nicolás García-Pedrajas \n" "Language-Team: Spanish \n" @@ -155,12 +155,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d conflictos desplazamiento/reducción" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[reduce usando la regla %d (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -169,12 +169,12 @@ msgstr "" " $default\treduce usando la regla %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\treduce usando la regla %d (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $default\treduce usando la regla %d (%s)\n" diff --git a/po/et.po b/po/et.po index 77796087..591286b7 100644 --- a/po/et.po +++ b/po/et.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.28d\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 2001-08-29 17:06+02:00\n" "Last-Translator: Toomas Soome \n" "Language-Team: Estonian \n" @@ -96,12 +96,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d nihutamine/redutseerimine konflikti" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[redutseerin, kasutades reeglit %d (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -110,12 +110,12 @@ msgstr "" " $default\tredutseerin kasutades reeglit %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\tredutseerin kasutades reeglit %d (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $default\tredutseerin kasutades reeglit %d (%s)\n" diff --git a/po/fr.po b/po/fr.po index 523ec176..aecf3b1e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU bison 1.28d\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 2001-08-29 20:00-0500\n" "Last-Translator: Michel Robitaille \n" "Language-Team: French \n" @@ -98,12 +98,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d conflits décalage/réduction" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[réduction par la règle %d (%s)\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -112,12 +112,12 @@ msgstr "" " $défaut\tréduction par la règle %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\tréduction par la règle %d (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $défaut\tréduction par la règle %d (%s)\n" diff --git a/po/ja.po b/po/ja.po index 4fe35e84..2ad5c4a5 100644 --- a/po/ja.po +++ b/po/ja.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU bison 1.28\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 1999-09-28 21:10+0900\n" "Last-Translator: Daisuke Yamashita \n" "Language-Team: Japanese \n" @@ -97,12 +97,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d ¥·¥Õ¥È/´Ô¸µ¾×ÆÍ" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[µ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -111,12 +111,12 @@ msgstr "" " $default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $default\tµ¬Â§ %d ¤òÍøÍѤ·¤Æ´Ô¸µ (%s)\n" diff --git a/po/nl.po b/po/nl.po index d4ffa53f..215bb2d7 100644 --- a/po/nl.po +++ b/po/nl.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.25\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 1996-08-27 15:34 MET DST\n" "Last-Translator: Erick Branderhorst \n" "Language-Team: Dutch \n" @@ -97,12 +97,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d verschuif/reduceer conflicten" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[reduceer gebruikt regel %d (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -111,12 +111,12 @@ msgstr "" " $default\treduce using rule %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr "" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr "" diff --git a/po/ru.po b/po/ru.po index 0ceac8fc..72b5eaa2 100644 --- a/po/ru.po +++ b/po/ru.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.29\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 2001-09-09 13:49+04:00\n" "Last-Translator: Dmitry S. Sivachenko \n" "Language-Team: Russian \n" @@ -97,12 +97,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d ËÏÎÆÌÉËÔÏ× ÓÄ×ÉÇÁ/×Ù×ÏÄÁ" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -111,12 +111,12 @@ msgstr "" " $default\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $default\t×Ù×ÏÄ Ó ÉÓÐÏÌØÚÏ×ÁÎÉÅÍ ÐÒÁ×ÉÌÁ %d (%s)\n" diff --git a/po/sv.po b/po/sv.po index cc42203c..69648f0a 100644 --- a/po/sv.po +++ b/po/sv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.30c\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 2001-11-18 15:17+0100\n" "Last-Translator: Göran Uddeborg \n" "Language-Team: Swedish \n" @@ -101,12 +101,12 @@ msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] "förväntade %d skifta/reducerakonflikt" msgstr[1] "förväntade %d skifta/reducerakonflikter" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[reducera med regel %d (%s)]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -115,12 +115,12 @@ msgstr "" " $standard\treducera med regel %d (%s)\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\treducera med regel %d (%s)\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $standard\treducera med regel %d (%s)\n" diff --git a/po/tr.po b/po/tr.po index b8e9f08a..f7a84806 100644 --- a/po/tr.po +++ b/po/tr.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.28c\n" -"POT-Creation-Date: 2001-12-17 18:27+0100\n" +"POT-Creation-Date: 2001-12-22 17:25+0100\n" "PO-Revision-Date: 2001-09-10 10:54GMT\n" "Last-Translator: Altug Bayram \n" "Language-Team: Turkish \n" @@ -99,12 +99,12 @@ msgid "expected %d shift/reduce conflict\n" msgid_plural "expected %d shift/reduce conflicts\n" msgstr[0] " %d öteleme/indirgeme çeliþkisi" -#: src/conflicts.c:451 src/conflicts.c:528 +#: src/conflicts.c:450 src/conflicts.c:527 #, c-format msgid " %-4s\t[reduce using rule %d (%s)]\n" msgstr " %-4s\t[indirgeme kural %d (%s)'i kullanýyor]\n" -#: src/conflicts.c:455 src/print.c:147 +#: src/conflicts.c:454 src/print.c:147 #, c-format msgid "" " $default\treduce using rule %d (%s)\n" @@ -113,12 +113,12 @@ msgstr "" " $default\tindirgeme kural %d (%s)'i kullanýyor\n" "\n" -#: src/conflicts.c:509 src/conflicts.c:522 +#: src/conflicts.c:508 src/conflicts.c:521 #, c-format msgid " %-4s\treduce using rule %d (%s)\n" msgstr " %-4s\tindirgeme kural %d (%s)'i kullanýyor\n" -#: src/conflicts.c:538 +#: src/conflicts.c:537 #, c-format msgid " $default\treduce using rule %d (%s)\n" msgstr " $default\tindirgeme kural %d (%s)'i kullanýyor\n" diff --git a/src/bison.simple b/src/bison.simple index 7625bde0..593eadf3 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -190,32 +190,39 @@ union yyalloc /* Tokens. */ %%tokendef -#define YYFINAL %%final -#define YYFLAG %%flag -#define YYNTBASE %%ntbase -#define YYLAST %%last - -#define YYNTOKENS %%ntokens -#define YYNNTS %%nnts -#define YYNRULES %%nrules -#define YYNSTATES %%nstates -#define YYMAXUTOK %%maxtok - -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL %%final +#define YYFLAG %%flag +#define YYLAST %%last + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS %%ntokens +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS %%nnts +/* YYNRULES -- Number of rules. */ +#define YYNRULES %%nrules +/* YYNRULES -- Number of states. */ +#define YYNSTATES %%nstates +#define YYMAXUTOK %%maxtok + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym) -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const char yytranslate[] = { %%translate }; #if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ static const short yyprhs[] = { %%prhs }; +/* YYRHS -- A `0'-separated list of the rules' RHS. */ static const short yyrhs[] = { %%rhs @@ -229,7 +236,8 @@ static const short yyrline[] = #endif #if (YYDEBUG) || YYERROR_VERBOSE -/* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { %%tname @@ -262,21 +270,28 @@ static const short yydefact[] = %%defact }; +/* YYPGOTO[NTERM-NUM]. */ static const short yydefgoto[] = { %%defgoto }; +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const short yypact[] = { %%pact }; +/* YYPGOTO[NTERM-NUM]. */ static const short yypgoto[] = { %%pgoto }; +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. */ static const short yytable[] = { %%table @@ -331,14 +346,14 @@ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ - yylval = (Value); \ + yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ - yyerror ("syntax error: cannot back up"); \ + yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) @@ -928,11 +943,11 @@ yyreduce: yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; diff --git a/src/output.c b/src/output.c index afb9881d..fd2bf3c4 100644 --- a/src/output.c +++ b/src/output.c @@ -1012,7 +1012,6 @@ prepare (void) MUSCLE_INSERT_INT ("debug", debug_flag); MUSCLE_INSERT_INT ("final", final_state); MUSCLE_INSERT_INT ("maxtok", max_user_token_number); - MUSCLE_INSERT_INT ("ntbase", ntokens); MUSCLE_INSERT_INT ("error-verbose", error_verbose); MUSCLE_INSERT_STRING ("prefix", spec_name_prefix); @@ -1057,7 +1056,7 @@ yystype;\n\ for (i = ntokens; i < nsyms; i++) /* don't make these for dummy nonterminals made by gensym. */ if (*tags[i] != '@') - fprintf (out, "# define\tNT%s\t%d\n", tags[i], i); + fprintf (out, "# define NT%s\t%d\n", tags[i], i); } fprintf (out, "\n#endif /* not %s */\n", macro_name); diff --git a/src/reader.c b/src/reader.c index 4fa1aaea..9bec971a 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1738,12 +1738,12 @@ symbols_save (void) if (c != '\0') continue; - obstack_fgrow2 (&tokendefs, "# define\t%s\t%d\n", + obstack_fgrow2 (&tokendefs, "# define %s\t%d\n", symbol, bp->user_token_number); if (semantic_parser) /* FIXME: This is probably wrong, and should be just as above. --akim. */ - obstack_fgrow2 (&tokendefs, "# define\tT%s\t%d\n", symbol, bp->value); + obstack_fgrow2 (&tokendefs, "# define T%s\t%d\n", symbol, bp->value); } obstack_1grow (&tokendefs, 0); -- 2.45.2