* data/bison.simple (b4_symbol_actions): New, replaces...

(b4_symbol_destructor, b4_symbol_printer): these.
(yysymprint): Be sure to call YYPRINT only for tokens, and using
user token numbers.
This commit is contained in:
Akim Demaille
2002-06-20 11:46:59 +00:00
parent 87542d29a5
commit 1ae7286376
13 changed files with 104 additions and 103 deletions

View File

@@ -1,3 +1,10 @@
2002-06-20 Akim Demaille <akim@epita.fr>
* data/bison.simple (b4_symbol_actions): New, replaces...
(b4_symbol_destructor, b4_symbol_printer): these.
(yysymprint): Be sure to call YYPRINT only for tokens, and using
user token numbers.
2002-06-20 Akim Demaille <akim@epita.fr>
* data/bison.simple (yydestructor): Rename as...

View File

@@ -143,6 +143,28 @@ m4_map([b4_token_define], [$@])
])
## --------------------------------------------------------- ##
## Defining symbol actions, e.g., printers and destructors. ##
## --------------------------------------------------------- ##
# b4_symbol_actions(FILENAME, LINENO,
# SYMBOL-TAG, SYMBOL-NUM,
# SYMBOL-ACTION, SYMBOL-TYPENAME)
# -------------------------------------------------
m4_define([b4_symbol_actions],
[m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
m4_pushdef([b4_at_dollar], [yylocation])dnl
case $4: /* $3 */
#line $2 "$1"
$5;
#line __oline__ "__ofile__"
break;
m4_popdef([b4_at_dollar])dnl
m4_popdef([b4_dollar_dollar])dnl
])
m4_divert(0)dnl
#output "b4_output_parser_name"
/* A Bison parser, made from b4_filename
@@ -1221,28 +1243,13 @@ yyreturn:
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
m4_divert_push([KILL])# M4 code.
# b4_symbol_destructor(SYMBOL-NUMBER, DESTRUCTOR, TYPE-NAME)
# ----------------------------------------------------------
m4_define([b4_symbol_destructor],
[m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
m4_pushdef([b4_at_dollar], [yylocation])dnl
case $4: /* $3 */
#line $2 "$1"
$5;
#line __oline__ "__ofile__"
break;
m4_popdef([b4_at_dollar])dnl
m4_popdef([b4_dollar_dollar])])
m4_divert_pop([KILL])dnl# End of M4 code.
static void
yydestruct (int yytype,
YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation]))
{
switch (yytype)
{
m4_map([b4_symbol_destructor], m4_defn([b4_symbol_destructors]))dnl
m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))dnl
default:
break;
}
@@ -1254,39 +1261,26 @@ m4_map([b4_symbol_destructor], m4_defn([b4_symbol_destructors]))dnl
| Print this symbol on YYOUT. |
`-----------------------------*/
m4_divert_push([KILL])# M4 code.
# b4_symbol_printer(SYMBOL-NUMBER, PRINTER, TYPE-NAME)
# ----------------------------------------------------------
m4_define([b4_symbol_printer],
[m4_pushdef([b4_dollar_dollar], [yyvalue.$6])dnl
m4_pushdef([b4_at_dollar], [yylocation])dnl
case $4: /* $3 */
#line $2 "$1"
$5;
#line __oline__ "__ofile__"
break;
m4_popdef([b4_at_dollar])dnl
m4_popdef([b4_dollar_dollar])])
m4_divert_pop([KILL])dnl# End of M4 code.
static void
yysymprint (FILE* yyout, int yytype,
YYSTYPE yyvalue[]b4_location_if([, YYLTYPE yylocation]))
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyout, "token %s (", yytname[[yytype]]);
{
YYFPRINTF (yyout, "token %s (", yytname[[yytype]]);
# ifdef YYPRINT
YYPRINT (yyout, yytoknum[[yytype]], yyvalue);
# endif
}
else
YYFPRINTF (yyout, "nterm %s (", yytname[[yytype]]);
# ifdef YYPRINT
YYPRINT (yyout, yytype, yyvalue);
# else
switch (yytype)
{
m4_map([b4_symbol_printer], m4_defn([b4_symbol_printers]))dnl
m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
default:
break;
}
# endif /* !defined YYPRINT. */
YYFPRINTF (yyout, ")");
}
#endif /* YYDEBUG. */

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.35\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-04-26 11:58:57+0200\n"
"Last-Translator: Michael Piefel <piefel@informatik.hu-berlin.de>\n"
"Language-Team: German <de@li.org>\n"
@@ -327,24 +327,24 @@ msgstr "mehr als eine %s-Deklaration"
msgid "rule given for %s, which is a token"
msgstr "Regel für %s vorhanden, welches aber ein Token ist"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "Typkonflikt (»%s« »%s«) bei Default-Aktion"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "leere Regel für Nicht-Terminal mit Typ und keine Aktion"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "zwei @prec-Anweisungen nacheinander"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "Eingabegrammatik enthält keine Regeln"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "zu viele Symbole (Token plus Nicht-Terminale); Maximum %d"

View File

@@ -29,7 +29,7 @@
msgid ""
msgstr ""
"Project-Id-Version: GNU bison 1.35\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-04-03 10:19+0200\n"
"Last-Translator: Nicolás García-Pedrajas <ngarcia-pedrajas@acm.org>\n"
"Language-Team: Spanish <es@li.org>\n"
@@ -389,24 +389,24 @@ msgstr "m
msgid "rule given for %s, which is a token"
msgstr "se ha dado una regla para %s, que es un terminal"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "los tipos (`%s' `%s') no concuerdan en la acción por defecto"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "regla vacía para un no terminal con tipo y no hay ninguna acción"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "dos @prec en una línea"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "no hay reglas en la gramática de entrada"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "demasiados símbolos (terminales y no terminales); máximo %d"

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.33b\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-03-05 16:27+0200\n"
"Last-Translator: Toomas Soome <tsoome@ut.ee>\n"
"Language-Team: Estonian <et@li.org>\n"
@@ -319,24 +319,24 @@ msgstr "korduvad %s deklaratsioonid"
msgid "rule given for %s, which is a token"
msgstr "%s jaoks on antud reegel, aga see on märk"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "vaikimisi tegevuse tüübikonflikt (`%s' `%s')"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "tüübiga mitteterminalil on tühi reegel ja puudub tegevus"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "kaks @prec ühel real"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "sisendgrammatikas pole reegleid"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "liiga palju sümboleid (märgid ja mitteterminalid); maksimaalne on %d"

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: GNU bison 1.34a\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-03-21 15:00-0500\n"
"Last-Translator: Michel Robitaille <robitail@IRO.UMontreal.CA>\n"
"Language-Team: French <traduc@traduc.org>\n"
@@ -328,24 +328,24 @@ msgstr "multiples d
msgid "rule given for %s, which is a token"
msgstr "la règle pour %s, qui est un terminal"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "conflit de type (« %s » « %s ») pour l'action par défaut"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "règle vide pour une catégorie typée et aucune action"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "deux @prec de suite"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "la grammaire n'a pas de règles"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "trop de symboles (jeton plus non terminaux); maximum %d"

View File

@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.34a\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-04-10 22:20+01\n"
"Last-Translator: Denis Lackovic <delacko@fly.srk.fer.hr>\n"
"Language-Team: Croatian <lokalizacija@linux.hr>\n"
@@ -322,24 +322,24 @@ msgstr "vi
msgid "rule given for %s, which is a token"
msgstr "pravilo dato za %s, a to je znak"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "sudar tipova (`%s' `%s') na deaultnoj akciji"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "prazno pravilo za nezavr¹ni znak, i nema akcije"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "dva @prec's u retku"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "nema pravila u ulaznoj gramatici"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "previ¹e simbola (znakovi plus nezavr¹ni znakovi); maksimalno %d"

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.31\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-01-18 12:40 CET\n"
"Last-Translator: Paolo Bonzini <bonzini@gnu.org>\n"
"Language-Team: Italian <it@li.org>\n"
@@ -322,24 +322,24 @@ msgstr "dichiarazioni multiple per %s"
msgid "rule given for %s, which is a token"
msgstr "fornita una regola per il token %s"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "conflitto di tipo (`%s' e `%s') nell'azione di default"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "regola vuota e nessuna azione per un nonterminale con tipo"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "due @prec di seguito"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "nessuna regola nella grammatica di input"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "troppi simboli (token e nonterminali); il massimo è %d"

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: GNU bison 1.30f\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2001-12-10 15:59+0900\n"
"Last-Translator: Daisuke Yamashita <yamad@mb.infoweb.ne.jp>\n"
"Language-Team: Japanese <ja@li.org>\n"
@@ -318,24 +318,24 @@ msgstr "%s
msgid "rule given for %s, which is a token"
msgstr "%s に規則が与えられ、それはトークンとなります"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "初期状態の動作では型 (`%s' `%s') が衝突します"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "空の型付き非終端アイテム用規則であり、動作が起りません"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "@prec のもの二つが同列になっています"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "入力した文法に規則が定義されていません"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "シンボルが多すぎます (トークン + 非終端アイテム) -- 最大 %d"

View File

@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.34a\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-03-20 12:54+0100\n"
"Last-Translator: Tim Van Holder <tim.van.holder@pandora.be>\n"
"Language-Team: Dutch <vertaling@nl.linux.org>\n"
@@ -333,24 +333,24 @@ msgstr "meerdere %s declaraties"
msgid "rule given for %s, which is a token"
msgstr "regel opgegeven voor token (%s)"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "type-conflict (`%s' `%s') bij standaardaktie"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "lege regel voor niet-eindsymbool met type, en geen actie"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "twee @prec's na elkaar"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "invoergrammatica bevat geen regels"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "teveel symbolen (tokens plus niet-eindsymbolen); het maximum is %d"

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.32\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-01-25 12:19+0300\n"
"Last-Translator: Dmitry S. Sivachenko <dima@Chg.RU>\n"
"Language-Team: Russian <ru@li.org>\n"
@@ -331,25 +331,25 @@ msgstr "
msgid "rule given for %s, which is a token"
msgstr "ÐÒÁ×ÉÌÏ ÚÁÄÁÎÏ ÄÌÑ %s, ËÏÔÏÒÙÊ Ñ×ÌÑÅÔÓÑ ÌÅËÓÅÍÏÊ"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "ËÏÎÆÌÉËÔ ÔÉÐÏ× (`%s' `%s') ÎÁ ÄÅÊÓÔ×ÉÉ ÐÏ ÕÍÏÌÞÁÎÉÀ"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr ""
"ÐÕÓÔÏÅ ÐÒÁ×ÉÌÏ ÄÌÑ ÔÉÐÉÚÉÒÏ×ÁÎÎÏÇÏ ÎÅÔÅÒÍÉÎÁÌØÎÏÇÏ ÓÉÍ×ÏÌÁ, É ÎÅÔ ÄÅÊÓÔ×ÉÑ"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "Ä×Á @prec ÐÏÄÒÑÄ"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "ÏÔÓÕÔÓÔ×ÕÀÔ ÐÒÁ×ÉÌÁ ×Ï ×ÈÏÄÎÏÊ ÇÒÁÍÍÁÔÉËÅ"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "ÓÌÉÛËÏÍ ÍÎÏÇÏ ÓÉÍ×ÏÌÏ× (ÌÅËÓÅÍÙ ÐÌÀÓ ÎÅÔÅÒÍÉÎÁÌÙ); ÍÁËÓÉÍÁÌØÎÏ %d"

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.33b\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-03-05 10:18+0100\n"
"Last-Translator: Göran Uddeborg <goeran@uddeborg.pp.se>\n"
"Language-Team: Swedish <sv@li.org>\n"
@@ -326,24 +326,24 @@ msgstr "flera %s-deklarationer"
msgid "rule given for %s, which is a token"
msgstr "regel given för %s, som är ett element"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "typkonflikt (\"%s\" \"%s\") för standardåtgärd"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr "tom regel för typad icketerminal, och ingen åtgärd"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "två @prec i rad"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "inga regler i ingrammatiken"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "för många symboler (element plus icketerminaler); max %d"

View File

@@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: bison 1.34\n"
"POT-Creation-Date: 2002-06-20 11:03+0200\n"
"POT-Creation-Date: 2002-06-20 13:40+0200\n"
"PO-Revision-Date: 2002-03-14 11:03GMT +02:00\n"
"Last-Translator: Altuð Bayram <altugbayram_2000@yahoo.com>\n"
"Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n"
@@ -331,25 +331,25 @@ msgstr "
msgid "rule given for %s, which is a token"
msgstr "bir andaç olan %s için verilen kural"
#: src/reader.c:227
#: src/reader.c:228
#, c-format
msgid "type clash (`%s' `%s') on default action"
msgstr "öntanýmlý eylem üzerinde (`%s' `%s') tip çatýþmasý"
#: src/reader.c:234
#: src/reader.c:236
msgid "empty rule for typed nonterminal, and no action"
msgstr ""
"Tipli deðiþken simge için boþ kural tanýmlanmýþ, ve eylem belirtilmemiþ"
#: src/reader.c:305
#: src/reader.c:307
msgid "two @prec's in a row"
msgstr "bir satýrda iki @prec"
#: src/reader.c:446
#: src/reader.c:448
msgid "no rules in the input grammar"
msgstr "girdi grameri içinde kurallar yok"
#: src/reader.c:478
#: src/reader.c:480
#, c-format
msgid "too many symbols (tokens plus nonterminals); maximum %d"
msgstr "çok fazla simge var (andaçlar ve deðiþken simgeler); en fazla %d"