]> git.saurik.com Git - bison.git/blobdiff - data/c.m4
regen
[bison.git] / data / c.m4
index 0b2699a1f22c0146665eab6dc1e0049f49b3df52..45468e3cac1305dbd5f398f8467978745c13e2d8 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -17,6 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+m4_include(b4_pkgdatadir/[c-like.m4])
 
 # b4_tocpp(STRING)
 # ----------------
@@ -421,17 +422,18 @@ $2
 #                   SYMBOL-TAG, SYMBOL-NUM,
 #                   SYMBOL-ACTION, SYMBOL-TYPENAME)
 # -------------------------------------------------
+# Issue the code for a symbol action (e.g., %printer).
+#
+# Define b4_dollar_dollar([TYPE-NAME]), and b4_at_dollar, which are
+# invoked where $<TYPE-NAME>$ and @$ were specified by the user.
 m4_define([b4_symbol_actions],
-[m4_pushdef([b4_dollar_dollar],
-   [m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
-m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
+[b4_dollar_pushdef([(*yyvaluep)], [$6], [(*yylocationp)])dnl
       case $4: /* $3 */
 b4_syncline([$2], [$1])
        $5;
 b4_syncline([@oline@], [@ofile@])
        break;
-m4_popdef([b4_at_dollar])dnl
-m4_popdef([b4_dollar_dollar])dnl
+b4_dollar_popdef[]dnl
 ])
 
 
@@ -581,14 +583,61 @@ b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
 ]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
 ])
 
-# b4_declare_yydebug
+# b4_YYDEBUG_define
 # ------------------
-m4_define([b4_declare_yydebug],
+m4_define([b4_YYDEBUG_define],
 [[/* Enabling traces.  */
-#ifndef YYDEBUG
+]m4_if(b4_api_prefix, [yy],
+[[#ifndef YYDEBUG
 # define YYDEBUG ]b4_debug_flag[
-#endif
-#if YYDEBUG
+#endif]],
+[[#ifndef ]b4_api_PREFIX[DEBUG
+# if defined YYDEBUG
+#  if YYDEBUG
+#   define ]b4_api_PREFIX[DEBUG 1
+#  else
+#   define ]b4_api_PREFIX[DEBUG 0
+#  endif
+# else /* ! defined YYDEBUG */
+#  define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
+# endif /* ! defined ]b4_api_PREFIX[DEBUG */
+#endif  /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
+])
+
+# b4_declare_yydebug
+# ------------------
+m4_define([b4_declare_yydebug],
+[b4_YYDEBUG_define[
+#if ]b4_api_PREFIX[DEBUG
 extern int ]b4_prefix[debug;
 #endif][]dnl
 ])
+
+# b4_yylloc_default_define
+# ------------------------
+# Define YYLLOC_DEFAULT.
+m4_define([b4_yylloc_default_define],
+[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
+    do                                                                  \
+      if (YYID (N))                                                     \
+        {                                                               \
+          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          (Current).first_line   = (Current).last_line   =              \
+            YYRHSLOC (Rhs, 0).last_line;                                \
+          (Current).first_column = (Current).last_column =              \
+            YYRHSLOC (Rhs, 0).last_column;                              \
+        }                                                               \
+    while (YYID (0))
+#endif
+]])