From: Akim Demaille Date: Thu, 20 Jun 2002 11:46:59 +0000 (+0000) Subject: * data/bison.simple (b4_symbol_actions): New, replaces... X-Git-Tag: BISON-1_49b~137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ae728637603d1e87ab247bbfe902cd91338000d;p=platform%2Fupstream%2Fbison.git * 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. --- diff --git a/ChangeLog b/ChangeLog index acac4a6..644548c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2002-06-20 Akim Demaille + * 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 + * data/bison.simple (yydestructor): Rename as... (yydestruct): this. diff --git a/data/bison.simple b/data/bison.simple index 687467e..5a4091e 100644 --- a/data/bison.simple +++ b/data/bison.simple @@ -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. */ diff --git a/po/de.po b/po/de.po index d8bf4d0..ca49ea5 100644 --- a/po/de.po +++ b/po/de.po @@ -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 \n" "Language-Team: German \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" diff --git a/po/es.po b/po/es.po index b8acb87..f2c31ad 100644 --- a/po/es.po +++ b/po/es.po @@ -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 \n" "Language-Team: Spanish \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" diff --git a/po/et.po b/po/et.po index 64c748a..7934db9 100644 --- a/po/et.po +++ b/po/et.po @@ -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 \n" "Language-Team: Estonian \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" diff --git a/po/fr.po b/po/fr.po index 7cf9b4e..fa2f969 100644 --- a/po/fr.po +++ b/po/fr.po @@ -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 \n" "Language-Team: French \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" diff --git a/po/hr.po b/po/hr.po index b880be8..2db8b3c 100644 --- a/po/hr.po +++ b/po/hr.po @@ -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 \n" "Language-Team: Croatian \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" diff --git a/po/it.po b/po/it.po index 77ab1bb..0f2c793 100644 --- a/po/it.po +++ b/po/it.po @@ -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 \n" "Language-Team: Italian \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" diff --git a/po/ja.po b/po/ja.po index 22cffce..3128d55 100644 --- a/po/ja.po +++ b/po/ja.po @@ -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 \n" "Language-Team: Japanese \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" diff --git a/po/nl.po b/po/nl.po index 111e0ba..2ddbb58 100644 --- a/po/nl.po +++ b/po/nl.po @@ -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 \n" "Language-Team: Dutch \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" diff --git a/po/ru.po b/po/ru.po index ad2e045..70c03d4 100644 --- a/po/ru.po +++ b/po/ru.po @@ -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 \n" "Language-Team: Russian \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" diff --git a/po/sv.po b/po/sv.po index fb3731b..7bb86ba 100644 --- a/po/sv.po +++ b/po/sv.po @@ -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 \n" "Language-Team: Swedish \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" diff --git a/po/tr.po b/po/tr.po index b9f2147..95c75b5 100644 --- a/po/tr.po +++ b/po/tr.po @@ -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 \n" "Language-Team: Turkish \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"