]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
* data/c.m4 (b4_location_initial_column, b4_location_initial_line):
[bison.git] / data / yacc.c
index 7b1e12c46f9ecff6e58b3e266d37f01141d9de6f..2b1cadbaec710e05b45f93ba1dc23dbb38d82906 100644 (file)
@@ -160,8 +160,6 @@ m4_if(b4_prefix, [yy], [],
 #define yynerrs b4_prefix[]nerrs
 b4_locations_if([#define yylloc b4_prefix[]lloc])])[
 
-]b4_token_enums_defines(b4_tokens)[
-
 /* Copy the first part of user declarations.  */
 ]b4_pre_prologue[
 
@@ -183,12 +181,16 @@ b4_locations_if([#define yylloc b4_prefix[]lloc])])[
 # define YYTOKEN_TABLE ]b4_token_table[
 #endif
 
+]m4_ifdef([b4_start_header],
+[[/* Copy the %start-header blocks.  */
+]b4_start_header])[]dnl
+
+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@])
+[[typedef union ]b4_union_name
+b4_user_stype
        YYSTYPE;],
 [typedef int YYSTYPE;])[
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -207,14 +209,14 @@ typedef struct YYLTYPE
 # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
 # define YYLTYPE_IS_DECLARED 1
 # define YYLTYPE_IS_TRIVIAL 1
-#endif
-])[
+#endif])
 
-/* Copy the second part of user declarations.  */
-]b4_post_prologue
+m4_ifdef([b4_end_header],
+[[/* Copy the %end-header blocks.  */
+]b4_end_header])[]dnl
 
-/* Line __line__ of yacc.c.  */
-b4_syncline([@oline@], [@ofile@])[
+[/* Copy the second part of user declarations.  */
+]b4_user_post_prologue[
 
 #ifdef short
 # undef short
@@ -1062,20 +1064,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;
@@ -1263,9 +1262,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);
@@ -1491,22 +1488,24 @@ b4_defines_if(
 b4_copyright([Skeleton interface for Bison's Yacc-like parsers in C],dnl '
   [1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006])
 
+m4_ifdef([b4_start_header],
+[[/* Copy the %start-header blocks.  */
+]b4_start_header])[]dnl
+
 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@])
+[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+]m4_ifdef([b4_stype],
+[[typedef union ]b4_union_name
+b4_user_stype
        YYSTYPE;],
-[typedef int YYSTYPE;])
+[typedef int YYSTYPE;])[
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 # define YYSTYPE_IS_TRIVIAL 1
 #endif
 
-b4_pure_if([],
+]b4_pure_if([],
 [extern YYSTYPE b4_prefix[]lval;])
 
 b4_locations_if(
@@ -1523,7 +1522,11 @@ typedef struct YYLTYPE
 # define YYLTYPE_IS_TRIVIAL 1
 #endif
 
-b4_pure_if([],
+]b4_pure_if([],
           [extern YYLTYPE b4_prefix[]lloc;])
-])dnl b4_locations_if
+)dnl b4_locations_if
+
+m4_ifdef([b4_end_header],
+[[/* Copy the %end-header blocks.  */
+]b4_end_header])[]dnl
 ])dnl b4_defines_if