]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
* src/complain.c (error_message, ERROR_MESSAGE): New.
[bison.git] / data / yacc.c
index 357588ce65cf550309c0e2277874310d4ac79d17..cdc6920390f36fb659c4fbbf4f4a2c1f06cc9200 100644 (file)
@@ -189,15 +189,15 @@ b4_token_enums_defines(b4_tokens)[
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 ]m4_ifdef([b4_stype],
-[[typedef union ]b4_union_name
-b4_stype
-/* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])
-       YYSTYPE;],
-[typedef int YYSTYPE;])[
+[[typedef union ]b4_union_name[
+]b4_user_stype[
+       YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1]],
+[m4_if(b4_tag_seen_flag, 0,
+[[typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1]])])[
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 ]b4_locations_if([#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
@@ -218,10 +218,7 @@ m4_ifdef([b4_end_header],
 ]b4_end_header])[]dnl
 
 [/* Copy the second part of user declarations.  */
-]b4_post_prologue
-
-[/* Line __line__ of yacc.c.  */
-]b4_syncline([@oline@], [@ofile@])[
+]b4_user_post_prologue[
 
 #ifdef short
 # undef short
@@ -291,9 +288,9 @@ typedef short int yytype_int16;
 #ifndef lint
 # define YYID(n) (n)
 #else
-]b4_c_function_def([YYID], [static int], [[int i], [i]])[
+]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
 {
-  return i;
+  return yyi;
 }
 #endif
 
@@ -678,12 +675,15 @@ do {                                                                        \
 `------------------------------------------------------------------*/
 
 ]b4_c_function_def([yy_stack_print], [static void],
-                  [[yytype_int16 *bottom], [bottom]],
-                  [[yytype_int16 *top],    [top]])[
+                  [[yytype_int16 *yybottom], [yybottom]],
+                  [[yytype_int16 *yytop],    [yytop]])[
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 
@@ -1069,20 +1069,17 @@ b4_c_function_def([yyparse], [int], b4_parse_param)
 ]b4_locations_if([[  yylsp = yyls;
 #if YYLTYPE_IS_TRIVIAL
   /* Initialize the default location before parsing starts.  */
-  yylloc.first_line   = yylloc.last_line   = 1;
-  yylloc.first_column = yylloc.last_column = 0;
+  yylloc.first_line   = yylloc.last_line   = ]b4_location_initial_line[;
+  yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
 #endif
 ]])
 m4_ifdef([b4_initial_action], [
 m4_pushdef([b4_at_dollar],     [m4_define([b4_at_dollar_used])yylloc])dnl
 m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
   /* User initialization code.  */
-b4_initial_action
+  b4_user_initial_action
 m4_popdef([b4_dollar_dollar])dnl
-m4_popdef([b4_at_dollar])dnl
-/* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])
-])dnl
+m4_popdef([b4_at_dollar])])dnl
 m4_ifdef([b4_dollar_dollar_used],[[  yyvsp[0] = yylval;
 ]])dnl
 m4_ifdef([b4_at_dollar_used], [[  yylsp[0] = yylloc;
@@ -1270,9 +1267,7 @@ yyreduce:
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-      ]b4_actions
-/* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])[
+      ]b4_user_actions[
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1506,15 +1501,15 @@ b4_token_enums_defines(b4_tokens)
 
 [#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 ]m4_ifdef([b4_stype],
-[[typedef union ]b4_union_name
-b4_stype
-/* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])
-       YYSTYPE;],
-[typedef int YYSTYPE;])[
+[[typedef union ]b4_union_name[
+]b4_user_stype[
+       YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1]],
+[m4_if(b4_tag_seen_flag, 0,
+[[typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1]])])[
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 ]b4_pure_if([],