From 2dfb4daf9b3032f4740d1f8d4906077ecc72bdef Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 5 Dec 2001 09:16:07 +0000 Subject: [PATCH] * src/gram.c, src/gram.h (ritem_print): New. * src/gram.c (dummy): Remove, now there is actual code in gram.c. (This useless function was defined only to work around VMS linkers that can't handle compilation units with variables only). * src/reduce.c (dump_grammar): Use it to trace the construction of ritem. --- ChangeLog | 9 +++++++++ po/de.po | 6 +++--- po/es.po | 6 +++--- po/et.po | 6 +++--- po/fr.po | 6 +++--- po/ja.po | 6 +++--- po/nl.po | 6 +++--- po/ru.po | 6 +++--- po/sv.po | 6 +++--- po/tr.po | 6 +++--- src/gram.c | 14 ++++++++++---- src/gram.h | 4 ++++ src/reader.c | 3 +++ src/reduce.c | 20 ++++++++++++-------- 14 files changed, 65 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a7be67b..821bf525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-12-05 Akim Demaille + + * src/gram.c, src/gram.h (ritem_print): New. + * src/gram.c (dummy): Remove, now there is actual code in gram.c. + (This useless function was defined only to work around VMS linkers + that can't handle compilation units with variables only). + * src/reduce.c (dump_grammar): Use it to trace the construction of + ritem. + 2001-12-04 Paul Eggert * src/bison.simple (union yyalloc): Change member names diff --git a/po/de.po b/po/de.po index 5e58b928..1722653f 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-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 1996-10-10 17:54 MET DST\n" "Last-Translator: Ulrich Drepper \n" "Language-Team: German \n" @@ -761,11 +761,11 @@ msgstr "%s: Hauptspeicher ersch #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "" diff --git a/po/es.po b/po/es.po index 6d0d02d0..9dfd85f0 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-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 1998-09-21 10:19+0200\n" "Last-Translator: Nicolás García-Pedrajas \n" "Language-Team: Spanish \n" @@ -874,11 +874,11 @@ msgstr "%s: memoria agotada\n" #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "" diff --git a/po/et.po b/po/et.po index 3bc224d2..97e37d37 100644 --- a/po/et.po +++ b/po/et.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.30d\n" -"POT-Creation-Date: 2001-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 2001-11-21 17:33+0200\n" "Last-Translator: Toomas Soome \n" "Language-Team: Estonian \n" @@ -752,11 +752,11 @@ msgstr "m #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "`" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "'" diff --git a/po/fr.po b/po/fr.po index d35ae291..0ca72a60 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU bison 1.30d\n" -"POT-Creation-Date: 2001-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 2001-11-21 08:00-0500\n" "Last-Translator: Michel Robitaille \n" "Language-Team: French \n" @@ -756,11 +756,11 @@ msgstr "m #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "`" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "'" diff --git a/po/ja.po b/po/ja.po index 47ccc7b8..eaf9c1f5 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-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 1999-09-28 21:10+0900\n" "Last-Translator: Daisuke Yamashita \n" "Language-Team: Japanese \n" @@ -757,11 +757,11 @@ msgstr "%s: #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "" diff --git a/po/nl.po b/po/nl.po index c75494ad..07224bda 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-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 1996-08-27 15:34 MET DST\n" "Last-Translator: Erick Branderhorst \n" "Language-Team: Dutch \n" @@ -760,11 +760,11 @@ msgstr "%s: geen geheugen meer beschikbaar\n" #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "" diff --git a/po/ru.po b/po/ru.po index 3ad7aa0e..5b51e6dd 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-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 2001-09-09 13:49+04:00\n" "Last-Translator: Dmitry S. Sivachenko \n" "Language-Team: Russian \n" @@ -755,11 +755,11 @@ msgstr " #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "`" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "'" diff --git a/po/sv.po b/po/sv.po index ba1798a9..e7a932ea 100644 --- a/po/sv.po +++ b/po/sv.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.30d\n" -"POT-Creation-Date: 2001-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 2001-11-21 22:10+0100\n" "Last-Translator: Göran Uddeborg \n" "Language-Team: Swedish \n" @@ -764,11 +764,11 @@ msgstr "minnet slut" #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "\"" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "\"" diff --git a/po/tr.po b/po/tr.po index 11f8ad6f..49bce1af 100644 --- a/po/tr.po +++ b/po/tr.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: bison 1.30\n" -"POT-Creation-Date: 2001-11-30 12:41+0100\n" +"POT-Creation-Date: 2001-11-30 16:11+0100\n" "PO-Revision-Date: 2001-11-02 14:49GMT\n" "Last-Translator: Altug Bayram \n" "Language-Team: Turkish \n" @@ -757,11 +757,11 @@ msgstr "bellek t #. MARK). A British English Unicode locale should instead #. translate these to U+2018 (LEFT SINGLE QUOTATION MARK) and #. U+2019 (RIGHT SINGLE QUOTATION MARK), respectively. -#: lib/quotearg.c:268 +#: lib/quotearg.c:274 msgid "`" msgstr "`" -#: lib/quotearg.c:269 +#: lib/quotearg.c:275 msgid "'" msgstr "'" diff --git a/src/gram.c b/src/gram.c index 1df89a02..35302616 100644 --- a/src/gram.c +++ b/src/gram.c @@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ #include "system.h" #include "gram.h" +#include "reader.h" void dummy PARAMS((void)); @@ -52,10 +53,15 @@ int pure_parser; int error_token_number; -/* This is to avoid linker problems which occur on VMS when using GCC, - when the file in question contains data definitions only. */ - void -dummy (void) +ritem_print (FILE *out) { + int i; + fputs ("RITEM\n", out); + for (i = 0; ritem[i]; ++i) + if (ritem[i] > 0) + fprintf (out, " %s", tags[ritem[i]]); + else + fprintf (out, " (rule %d)\n", -ritem[i]); + fputs ("\n\n", out); } diff --git a/src/gram.h b/src/gram.h index ca55d007..516907c2 100644 --- a/src/gram.h +++ b/src/gram.h @@ -147,4 +147,8 @@ extern int pure_parser; /* ERROR_TOKEN_NUMBER is the token number of the error token. */ extern int error_token_number; + + +/* Dump RITEM for traces. */ +void ritem_print (FILE *out); #endif /* !GRAM_H_ */ diff --git a/src/reader.c b/src/reader.c index 6b647668..028ffc0b 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1911,6 +1911,9 @@ packgram (void) } ritem[itemno] = 0; + + if (trace_flag) + ritem_print (stderr); } /*-------------------------------------------------------------------. diff --git a/src/reduce.c b/src/reduce.c index 190f3577..048f5a63 100644 --- a/src/reduce.c +++ b/src/reduce.c @@ -455,18 +455,22 @@ dump_grammar (FILE *out) fprintf (out, "%5d %5d %5d %s\n", i, sprec[i], sassoc[i], tags[i]); fprintf (out, "\n\n"); fprintf (out, "Rules\n-----\n\n"); - fprintf (out, "Num (Prec, Assoc) Lhs : (@Rhs) Ritems [Num?]\n"); + fprintf (out, "Num (Prec, Assoc, Useful, Ritem Range) Lhs -> Rhs (Ritem range) [Num]\n"); for (i = 1; i <= nrules; i++) { - fprintf (out, "%-5d(%5d%5d)%5d : (@%-5d)", + int rhs_count = 0; + /* Find the last RHS index in ritems. */ + for (r = &ritem[rule_table[i].rhs]; *r > 0; ++r) + ++rhs_count; + fprintf (out, "%3d (%2d, %2d, %2d, %2d-%2d) %2d ->", i, - rule_table[i].prec, - rule_table[i].assoc, - rule_table[i].lhs, - rule_table[i].rhs); + rule_table[i].prec, rule_table[i].assoc, rule_table[i].useful, + rule_table[i].rhs, rule_table[i].rhs + rhs_count - 1, + rule_table[i].lhs); + /* Dumped the RHS. */ for (r = &ritem[rule_table[i].rhs]; *r > 0; r++) - fprintf (out, "%5d", *r); - fprintf (out, " [%d]\n", -(*r)); + fprintf (out, "%3d", *r); + fprintf (out, " [%d]\n", -(*r)); } fprintf (out, "\n\n"); fprintf (out, "Rules interpreted\n-----------------\n\n"); -- 2.50.0