[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
b4_symbol_actions
From: |
Akim Demaille |
Subject: |
b4_symbol_actions |
Date: |
20 Jun 2002 13:47:08 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter) |
Index: ChangeLog
from Akim Demaille <address@hidden>
* 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.
Index: data/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/data/bison.simple,v
retrieving revision 1.46
diff -u -u -r1.46 bison.simple
--- data/bison.simple 20 Jun 2002 11:28:33 -0000 1.46
+++ data/bison.simple 20 Jun 2002 11:39:57 -0000
@@ -143,6 +143,28 @@
])
+## --------------------------------------------------------- ##
+## 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 @@
| 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 @@
| 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. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- b4_symbol_actions,
Akim Demaille <=