]> git.saurik.com Git - bison.git/blobdiff - data/glr.c
* src/muscle_tab.c (muscle_percent_define_invalid_value): Replace
[bison.git] / data / glr.c
index 5c85bcb44c8097df11d567e157379fc78c2af0a1..0cd87cf2cad323a2d596335a6505f5f1d59c1960 100644 (file)
@@ -1,7 +1,8 @@
                                                                     -*- C -*-
 
 # GLR skeleton for Bison
                                                                     -*- C -*-
 
 # GLR skeleton for Bison
-# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
+# Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 m4_include(b4_pkgdatadir/[c.m4])
 
 
 m4_include(b4_pkgdatadir/[c.m4])
 
-# glr.cc checks %define variables also.
-m4_if(b4_skeleton, [["glr.c"]], [b4_check_percent_define_variables])
-
-b4_check_percent_code_qualifiers([[requires]],
-                                 [[provides]],
-                                 [[top]])
-
 b4_push_if([
 b4_complain([[non-deterministic push parsers are not yet supported]])])
 
 b4_push_if([
 b4_complain([[non-deterministic push parsers are not yet supported]])])
 
@@ -160,9 +154,7 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
 
 ]b4_identification
 
 
 ]b4_identification
 
-m4_ifdef([b4_percent_code_top],
-[[/* Copy the %code "top" blocks.  */
-]b4_user_code([b4_percent_code_top])])[]dnl
+b4_percent_code_get([[top]])[]dnl
 m4_if(b4_prefix, [yy], [],
 [/* Substitute the variable and function names.  */
 #define yyparse b4_prefix[]parse
 m4_if(b4_prefix, [yy], [],
 [/* Substitute the variable and function names.  */
 #define yyparse b4_prefix[]parse
@@ -182,17 +174,16 @@ dnl # ----------------------
 dnl # Declaration that might either go into the header (if --defines)
 dnl # or open coded in the parser body.
 m4_define([b4_shared_declarations],
 dnl # Declaration that might either go into the header (if --defines)
 dnl # or open coded in the parser body.
 m4_define([b4_shared_declarations],
-[m4_ifdef([b4_percent_code_requires],
-[[/* Copy the %code "requires" blocks.  */
-]b4_user_code([b4_percent_code_requires])])[]dnl
+[b4_percent_code_get([[requires]])[]dnl
 
 b4_token_enums(b4_tokens)
 
 [#ifndef YYSTYPE
 ]m4_ifdef([b4_stype],
 [[typedef union ]b4_union_name[
 
 b4_token_enums(b4_tokens)
 
 [#ifndef YYSTYPE
 ]m4_ifdef([b4_stype],
 [[typedef union ]b4_union_name[
+{
 ]b4_user_stype[
 ]b4_user_stype[
-       YYSTYPE;
+} YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1]],
 [m4_if(b4_tag_seen_flag, 0,
 [[typedef int YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1]],
 [m4_if(b4_tag_seen_flag, 0,
 [[typedef int YYSTYPE;
@@ -215,9 +206,7 @@ typedef struct YYLTYPE
 # define YYLTYPE_IS_TRIVIAL 1
 #endif
 
 # define YYLTYPE_IS_TRIVIAL 1
 #endif
 
-]m4_ifdef([b4_percent_code_provides],
-[[/* Copy the %code "provides" blocks.  */
-]b4_user_code([b4_percent_code_provides])])[]dnl
+]b4_percent_code_get([[provides]])[]dnl
 ])
 
 b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
 ])
 
 b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
@@ -250,10 +239,7 @@ static YYSTYPE yyval_default;
 
 /* Copy the second part of user declarations.  */
 ]b4_user_post_prologue
 
 /* Copy the second part of user declarations.  */
 ]b4_user_post_prologue
-m4_ifdef([b4_percent_code],
-[[/* Copy the unqualified %code blocks.  */
-]b4_user_code([b4_percent_code])
-])[]dnl
+b4_percent_code_get[]dnl
 
 [#include <stdio.h>
 #include <stdlib.h>
 
 [#include <stdio.h>
 #include <stdlib.h>
@@ -1456,12 +1442,12 @@ yy_reduce_print (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
                       b4_user_args[);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &]b4_rhs_value(yynrhs, yyi + 1)[
                       ]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
                       b4_user_args[);
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 #endif
     }
 }
 #endif
@@ -2652,7 +2638,8 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C],
 
 b4_shared_declarations
 
 
 b4_shared_declarations
 
-extern YYSTYPE b4_prefix[]lval;
+b4_pure_if([],
+[[extern YYSTYPE b4_prefix][lval;]])
 
 b4_locations_if([b4_pure_if([],
 [extern YYLTYPE b4_prefix[]lloc;])
 
 b4_locations_if([b4_pure_if([],
 [extern YYLTYPE b4_prefix[]lloc;])