bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glr: include the created header


From: Joel E. Denny
Subject: Re: glr: include the created header
Date: Fri, 16 Jun 2006 00:41:46 -0400 (EDT)

On Thu, 15 Jun 2006, Joel E. Denny wrote:

> On Thu, 15 Jun 2006, Paul Eggert wrote:
> 
> > A nice solution but whew! it's kinda complicated when you step back
> > and look at it.
> 
> It seemed simple at first... but then I got a little worried when I wrote 
> the NEWS entry.  Looking at it again, I think I agree with you.

I've made some changes to my solution.  Based on the new NEWS entry, I 
think it's getting easier to understand.

> Maybe a simplier way is just to make header pre-prologue and post-prologue 
> blocks explicit:
> 
>   %{
>     /* Non-header pre-prologue block.  */
>   %}
>   %header-pre {
>     /* Header pre-prologue block.  */
>   }
>   %union {
>     int val;
>   }
>   %header-post {
>     /* Header post-prologue block.  */
>   }
>   %{
>     /* Non-header post-prologue block.  */
>   %}

I've implemented this but with a few changes.  First, I decided the header 
prologue vs. non-header prologue terminology is confusing.  I think it's 
better to leave the term prologue for %{...%} blocks and to call the new 
blocks something else.  Second...

> Since %header-pre and %header-post would not guarantee the generation of a 
> header file, I'm wondering if they should be renamed.  Maybe %decls-pre 
> and %decls-post?  That is, it's code placed before or after 
> Bison-generated declarations like the enum, semantic type, and location 
> type.

They're definitions mostly as opposed to just declarations.  I imagine 
that's why it's called %defines and --defines.  So, I decided %pre-defines 
and %post-defines makes more sense.

Here's another uncommitted patch for discussion.

Joel

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1504
diff -p -u -r1.1504 ChangeLog
--- ChangeLog   11 Jun 2006 18:27:44 -0000      1.1504
+++ ChangeLog   16 Jun 2006 03:55:51 -0000
@@ -1,3 +1,55 @@
+2006-??-??  Joel E. Denny  <address@hidden>
+
+       Don't put the pre-prologue in the header file.  For the yacc.c code
+       file and the glr.c header and code files, move the pre-prologue before
+       the token definitions.  Add new %pre-defines and %post-defines to
+       declare code that will go in both the header file and code file.
+       Discussed at
+       <http://lists.gnu.org/archive/html/bison-patches/2005-12/msg00000.html>,
+       <http://lists.gnu.org/archive/html/bison-patches/2006-01/msg00016.html>,
+       and
+       <http://lists.gnu.org/archive/html/bison-patches/2006-06/msg00055.html>.
+       * NEWS (2.3+): Describe these changes.
+       * doc/bison.texinfo: NEEDS TO BE UPDATED
+       (Calc++ Parser): Forward declare driver in a %pre-defines rather than
+       in the pre-prologue so that make check succeeds.
+       * data/glr.c (b4_pre_prologue): Move from within to before...
+       (b4_shared_declarations): ... this.
+       Add new b4_pre_defines before b4_token_enums.
+       Add new b4_post_defines at the end.
+       * data/glr.cc (b4_pre_prologue): Replace with...
+       (b4_pre_defines): ... this in the header file.
+       (b4_post_defines): New near the end of the header file.
+       * data/lalr1.cc (b4_pre_prologue): Move from the header file to the
+       code file right before including the header file.
+       (b4_pre_defines): New in the previous position of b4_pre_prologue in
+       the header file.
+       (b4_post_defines): New near the end of the header file.
+       * data/yacc.c: Clean up some m4 quoting especially in the header file.
+       (b4_token_enums_defines): In the code file, move to right before
+       YYSTYPE for consistency with the header file.
+       (b4_pre_defines): New right before b4_token_enums_defines in both the
+       header and code file.
+       (b4_post_defines): New right after YYLTYPE and yylloc in both the
+       header and code file.
+       * src/parse-gram.y (PERCENT_PRE_DEFINES): New token for %pre-defines.
+       (PERCENT_POST_DEFINES): New token for %post-defines.
+       (declaration): Parse those declarations and append to b4_pre_defines
+       and b4_post_defines, respectively.
+       * src/reader.c (pre_defines, post_defines): New bools to track whether
+       those declarations have been seen.
+       (prologue_augment): Add to the post-prologue if %union, %pre-defines,
+       or %post-defines has been seen.
+       * src/reader.h (pre_defines, post_defines): New extern's.
+       * src/scan-gram.l: Scan the new declarations.
+       * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Place the second
+       prologue block in a %pre-defines or a %post-defines based on whether
+       the %union is declared.
+       * tests/regression.at (Early token definitions with --yacc, Early token
+       definitions without --yacc): Move tests for token definitions into the
+       post-prologue since token names are no longer defined in the
+       pre-prologue.
+
 2006-06-11  Joel E. Denny  <address@hidden>
 
        For associating token numbers with token names for "yacc.c", don't use
Index: NEWS
===================================================================
RCS file: /sources/bison/bison/NEWS,v
retrieving revision 1.151
diff -p -u -r1.151 NEWS
--- NEWS        11 Jun 2006 18:27:44 -0000      1.151
+++ NEWS        16 Jun 2006 03:55:52 -0000
@@ -9,6 +9,65 @@ Changes in version 2.3+:
   helps to sanitize the global namespace during preprocessing, but POSIX Yacc
   requires them.  Bison still generates an enum for token names in all cases.
 
+* Handling of prologue blocks is now more consistent but potentially backward
+  incompatible.
+
+  As before, prologue blocks are declared with the `%{...%}' syntax.  To
+  generate the pre-prologue, Bison concatenates all prologue blocks that you
+  declared before any %union declaration.  If you declared a %union, Bison
+  concatenates all prologue blocks that you declared after it to generate the
+  post-prologue.  (See the next NEWS item for a description of how the new
+  %pre-defines and %post-defines have a similar effect as %union on the
+  prologues.)
+
+  Previously, Bison inserted the pre-prologue into both the header file and the
+  code file in all cases except for LALR(1) parsers in C.  In the latter case,
+  Bison inserted it only into the code file.  For parsers in C++, the point of
+  insertion was before any token definitions (which associate token numbers
+  with names).  For parsers in C, the point of insertion was after the token
+  definitions.
+
+  Now, Bison never inserts the pre-prologue into the header file.  In the code
+  file, it always inserts it before the token definitions.
+
+* Bison now provides the %pre-defines and %post-defines declarations.  
+
+  Each such declaration is followed by a block of braced code (code between `{'
+  and `}').  Bison inserts all %pre-defines blocks into both the header file
+  and the code file before any Bison-generated token, semantic type, location
+  type, and class definitions.  It inserts all %post-defines blocks into both
+  files after all these definitions.  Finally, in the code file only, it
+  inserts the pre-prologue and the post-prologue before all the
+  %pre-defines blocks and after all the %post-defines blocks, respectively.
+
+  Below are some example declarations:
+
+    %{
+      /* A pre-prologue block.  For Yacc portability, Bison doesn't put this in
+       * your header file.  */
+    %}
+    %pre-defines {
+      /* Bison will put this in your header file and your code file.  This is
+       * the right place to declare %union dependencies.  */
+    }
+    %union {
+      /* Previously, the first %union separated the pre-prologue blocks from
+       * the post-prologue blocks.  Now, the first %union, %pre-defines, or
+       * %post-defines does that.  */
+    }
+    %post-defines {
+      /* If you want something in your header file and in your code file and it
+       * depends on Bison-generated definitions, put it here.  */
+    }
+    %{
+      /* If you want something in your code file but *not* in your header file
+         and it depends on Bison-generated definitions, put it here.  */
+    %}
+
+  Declaring %pre-defines or %post-defines does not imply that Bison should
+  necessarily generate a header file.  As before, use the %defines declaration
+  or the `-d' or `--defines' flag for that.
+
 * The option `--report=look-ahead' has been changed to `--report=lookahead'.
   The old spelling still works, but is not documented and may be removed
   in a future release.
Index: data/glr.c
===================================================================
RCS file: /sources/bison/bison/data/glr.c,v
retrieving revision 1.179
diff -p -u -r1.179 glr.c
--- data/glr.c  10 Jun 2006 03:02:22 -0000      1.179
+++ data/glr.c  16 Jun 2006 03:55:53 -0000
@@ -159,19 +159,23 @@ m4_if(b4_prefix, [yy], [],
 #define yychar  b4_prefix[]char
 #define yydebug b4_prefix[]debug
 #define yynerrs b4_prefix[]nerrs
-#define yylloc  b4_prefix[]lloc])
+#define yylloc  b4_prefix[]lloc])[
+
+/* Copy the first part of user declarations.  */
+]b4_pre_prologue
 
 dnl # b4_shared_declarations
 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],
-[b4_token_enums(b4_tokens)[
+[m4_ifdef([b4_pre_defines],
+[[/* Copy the %pre-defines blocks.  */
+]b4_pre_defines])[]dnl
 
-/* Copy the first part of user declarations.  */
-]b4_pre_prologue[
+b4_token_enums(b4_tokens)
 
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 ]m4_ifdef([b4_stype],
 [typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])
 b4_stype
@@ -198,7 +202,11 @@ typedef struct YYLTYPE
 # define YYLTYPE_IS_DECLARED 1
 # define YYLTYPE_IS_TRIVIAL 1
 #endif
-]])
+
+]m4_ifdef([b4_post_defines],
+[[/* Copy the %post-defines blocks.  */
+]b4_post_defines])[]dnl
+])
 
 b4_defines_if([#include @address@hidden,
              [b4_shared_declarations])[
Index: data/glr.cc
===================================================================
RCS file: /sources/bison/bison/data/glr.cc,v
retrieving revision 1.19
diff -p -u -r1.19 glr.cc
--- data/glr.cc 14 May 2006 20:48:24 -0000      1.19
+++ data/glr.cc 16 Jun 2006 03:55:53 -0000
@@ -214,7 +214,6 @@ m4_defn([b4_parse_param])))],
 m4_include(b4_pkgdatadir/[glr.c])
 m4_popdef([b4_parse_param])
 
-
 @output @output_header_name@
 b4_copyright([Skeleton interface for Bison GLR parsers in C++],
   [2002, 2003, 2004, 2005, 2006])[
@@ -236,11 +235,12 @@ namespace ]b4_namespace[
   class location;
 }
 
-/* Copy the first part of user declarations.  */
-]b4_pre_prologue[
+]m4_ifdef([b4_pre_defines],
+[[/* Copy the %pre-defines blocks.  */
+]b4_pre_defines])[]dnl
 
-]/* Line __line__ of glr.cc.  */
-b4_syncline(address@hidden@], address@hidden@])[
+[/* Line __line__ of glr.cc.  */
+]b4_syncline(address@hidden@], address@hidden@])[
 
 #include "location.hh"
 
@@ -386,4 +386,8 @@ m4_ifset([b4_global_tokens_and_yystype],
 
 }
 
-#endif /* ! defined PARSER_HEADER_H */]
+]m4_ifdef([b4_post_defines],
+[[/* Copy the %post-defines blocks.  */
+]b4_post_defines])[]dnl
+
+[#endif /* ! defined PARSER_HEADER_H */]
Index: data/lalr1.cc
===================================================================
RCS file: /sources/bison/bison/data/lalr1.cc,v
retrieving revision 1.132
diff -p -u -r1.132 lalr1.cc
--- data/lalr1.cc       10 Jun 2006 03:02:23 -0000      1.132
+++ data/lalr1.cc       16 Jun 2006 03:55:53 -0000
@@ -53,11 +53,12 @@ namespace ]b4_namespace[
   class location;
 }
 
-/* First part of user declarations.  */
-]b4_pre_prologue[
+]m4_ifdef([b4_pre_defines],
+[[/* Copy the %pre-defines blocks.  */
+]b4_pre_defines])[]dnl
 
-]/* Line __line__ of lalr1.cc.  */
-b4_syncline(address@hidden@], address@hidden@])[
+[/* Line __line__ of lalr1.cc.  */
+]b4_syncline(address@hidden@], address@hidden@])[
 
 ]dnl Include location.hh here: it might depend on headers included above.
 [#include "location.hh"
@@ -298,8 +299,12 @@ b4_error_verbose_if([, int tok])[);
  /* Redirection for backward compatibility.  */
 # define YYSTYPE b4_namespace::b4_parser_class_name::semantic_type
 #endif
-])[
-#endif /* ! defined PARSER_HEADER_H */]
+])
+m4_ifdef([b4_post_defines],
+[[/* Copy the %post-defines blocks.  */
+]b4_post_defines])[]dnl
+
+[#endif /* ! defined PARSER_HEADER_H */]
 ])dnl
 @output @output_parser_name@
 b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
@@ -307,7 +312,11 @@ b4_copyright([Skeleton implementation fo
 m4_if(b4_prefix, [yy], [],
 [
 // Take the name prefix into account.
-#define yylex   b4_prefix[]lex])
+#define yylex   b4_prefix[]lex])[
+
+/* First part of user declarations.  */
+]b4_pre_prologue
+
 b4_defines_if([
 #include @address@hidden)[
 
Index: data/yacc.c
===================================================================
RCS file: /sources/bison/bison/data/yacc.c,v
retrieving revision 1.143
diff -p -u -r1.143 yacc.c
--- data/yacc.c 10 Jun 2006 03:02:23 -0000      1.143
+++ data/yacc.c 16 Jun 2006 03:55:53 -0000
@@ -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,6 +181,12 @@ b4_locations_if([#define yylloc b4_prefi
 # define YYTOKEN_TABLE ]b4_token_table[
 #endif
 
+]m4_ifdef([b4_pre_defines],
+[[/* Copy the %pre-defines blocks.  */
+]b4_pre_defines])[]dnl
+
+b4_token_enums_defines(b4_tokens)[
+
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 ]m4_ifdef([b4_stype],
 [typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE])
@@ -207,14 +211,17 @@ 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.  */
+m4_ifdef([b4_post_defines],
+[[/* Copy the %post-defines blocks.  */
+]b4_post_defines])[]dnl
+
+[/* Copy the second part of user declarations.  */
 ]b4_post_prologue
 
-/* Line __line__ of yacc.c.  */
-b4_syncline(address@hidden@], address@hidden@])[
+[/* Line __line__ of yacc.c.  */
+]b4_syncline(address@hidden@], address@hidden@])[
 
 #ifdef short
 # undef short
@@ -1491,22 +1498,26 @@ 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_pre_defines],
+[[/* Copy the %pre-defines blocks.  */
+]b4_pre_defines])[]dnl
+
 b4_token_enums_defines(b4_tokens)
 
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-m4_ifdef([b4_stype],
+[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+]m4_ifdef([b4_stype],
 [typedef union[]m4_bregexp(b4_stype, [^{], [ YYSTYPE])
 b4_stype
 /* Line __line__ of yacc.c.  */
 b4_syncline(address@hidden@], address@hidden@])
        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 +1534,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_post_defines],
+[[/* Copy the %post-defines blocks.  */
+]b4_post_defines])[]dnl
 ])dnl b4_defines_if
Index: doc/bison.texinfo
===================================================================
RCS file: /sources/bison/bison/doc/bison.texinfo,v
retrieving revision 1.193
diff -p -u -r1.193 bison.texinfo
--- doc/bison.texinfo   11 Jun 2006 18:27:44 -0000      1.193
+++ doc/bison.texinfo   16 Jun 2006 03:55:57 -0000
@@ -7437,10 +7437,10 @@ use a forward declaration of the driver.
 
 @comment file: calc++-parser.yy
 @example
address@hidden
+%pre-defines @{
 # include <string>
 class calcxx_driver;
address@hidden
address@hidden
 @end example
 
 @noindent
Index: src/parse-gram.y
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.y,v
retrieving revision 1.75
diff -p -u -r1.75 parse-gram.y
--- src/parse-gram.y    6 Jun 2006 16:40:06 -0000       1.75
+++ src/parse-gram.y    16 Jun 2006 03:55:58 -0000
@@ -138,6 +138,8 @@ static int current_prec = 0;
   PERCENT_EXPECT_RR      "%expect-rr"
   PERCENT_FILE_PREFIX     "%file-prefix"
   PERCENT_GLR_PARSER      "%glr-parser"
+  PERCENT_PRE_DEFINES     "%pre-defines"
+  PERCENT_POST_DEFINES    "%post-defines"
   PERCENT_INITIAL_ACTION  "%initial-action"
   PERCENT_LEX_PARAM       "%lex-param"
   PERCENT_LOCATIONS       "%locations"
@@ -225,6 +227,20 @@ declaration:
       nondeterministic_parser = true;
       glr_parser = true;
     }
+| "%pre-defines" "{...}"
+    {
+      pre_defines = true;
+      /* Remove the '{', and replace the '}' with '\n'.  */
+      $2[strlen ($2) - 1] = '\n';
+      muscle_code_grow ("pre_defines", $2+1, @2);
+    }
+| "%post-defines" "{...}"
+    {
+      post_defines = true;
+      /* Remove the '{', and replace the '}' with '\n'.  */
+      $2[strlen ($2) - 1] = '\n';
+      muscle_code_grow ("post_defines", $2+1, @2);
+    }
 | "%initial-action" "{...}"
     {
       muscle_code_grow ("initial_action", translate_symbol_action ($2, @2), 
@2);
Index: src/reader.c
===================================================================
RCS file: /sources/bison/bison/src/reader.c,v
retrieving revision 1.255
diff -p -u -r1.255 reader.c
--- src/reader.c        6 Jun 2006 16:40:06 -0000       1.255
+++ src/reader.c        16 Jun 2006 03:55:59 -0000
@@ -44,8 +44,10 @@ static symbol_list *grammar = NULL;
 static bool start_flag = false;
 merger_list *merge_functions;
 
-/* Was %union seen?  */
+/* Was %union, %pre-defines, or %post-defines seen?  */
 bool typed = false;
+bool pre_defines = false;
+bool post_defines = false;
 
 /* Should rules have a default precedence?  */
 bool default_prec = true;
@@ -68,16 +70,17 @@ grammar_start_symbol_set (symbol *sym, l
 }
 
 
-/*----------------------------------------------------------------.
-| There are two prologues: one before %union, one after.  Augment |
-| the current one.                                                |
-`----------------------------------------------------------------*/
+/*-----------------------------------------------------------------------.
+| There are two prologues: one before the first %union, %pre-defines, or |
+| %post-defines; and one after.  Augment the current one.                |
+`-----------------------------------------------------------------------*/
 
 void
 prologue_augment (const char *prologue, location loc)
 {
   struct obstack *oout =
-    !typed ? &pre_prologue_obstack : &post_prologue_obstack;
+    !(typed || pre_defines || post_defines)
+    ? &pre_prologue_obstack : &post_prologue_obstack;
 
   obstack_fgrow1 (oout, "]b4_syncline(%d, [[", loc.start.line);
   /* FIXME: Protection of M4 characters missing here.  See
Index: src/reader.h
===================================================================
RCS file: /sources/bison/bison/src/reader.h,v
retrieving revision 1.50
diff -p -u -r1.50 reader.h
--- src/reader.h        6 Jun 2006 16:40:06 -0000       1.50
+++ src/reader.h        16 Jun 2006 03:55:59 -0000
@@ -58,8 +58,10 @@ void free_merger_functions (void);
 
 extern merger_list *merge_functions;
 
-/* Was %union seen?  */
+/* Was %union, %pre-defines, or %post-defines seen?  */
 extern bool typed;
+extern bool pre_defines;
+extern bool post_defines;
 
 /* Should rules have a default precedence?  */
 extern bool default_prec;
Index: src/scan-gram.l
===================================================================
RCS file: /sources/bison/bison/src/scan-gram.l,v
retrieving revision 1.90
diff -p -u -r1.90 scan-gram.l
--- src/scan-gram.l     7 Jun 2006 21:17:35 -0000       1.90
+++ src/scan-gram.l     16 Jun 2006 03:55:59 -0000
@@ -182,6 +182,8 @@ splice       (\\[ \f\t\v]*\n)*
   "%expect"[-_]"rr"      return PERCENT_EXPECT_RR;
   "%file-prefix"          return PERCENT_FILE_PREFIX;
   "%fixed"[-_]"output"[-_]"files"   return PERCENT_YACC;
+  "%pre-defines"          /* FIXME: Remove once %union handled differently.  
*/ token_type = BRACED_CODE; return PERCENT_PRE_DEFINES;
+  "%post-defines"         /* FIXME: Remove once %union handled differently.  
*/ token_type = BRACED_CODE; return PERCENT_POST_DEFINES;
   "%initial-action"       /* FIXME: Remove once %union handled differently.  
*/ token_type = BRACED_CODE; return PERCENT_INITIAL_ACTION;
   "%glr-parser"           return PERCENT_GLR_PARSER;
   "%left"                 return PERCENT_LEFT;
Index: tests/actions.at
===================================================================
RCS file: /sources/bison/bison/tests/actions.at,v
retrieving revision 1.58
diff -p -u -r1.58 actions.at
--- tests/actions.at    4 Jan 2006 09:18:37 -0000       1.58
+++ tests/actions.at    16 Jun 2006 03:55:59 -0000
@@ -172,7 +172,7 @@ m4_if([$1$2$3], $[1]$[2]$[3], [],
 # helping macros.  So don't put any directly in the Bison file.
 AT_BISON_OPTION_PUSHDEFS([$5])
 AT_DATA_GRAMMAR([[input.y]],
-[[%{
+[[%pre-defines {
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
@@ -182,7 +182,7 @@ AT_DATA_GRAMMAR([[input.y]],
 ]AT_LALR1_CC_IF(
   [#define RANGE(Location) (Location).begin.line, (Location).end.line],
   [#define RANGE(Location) (Location).first_line, (Location).last_line])
-[%}
+[}
 
 $5]
 m4_ifval([$6], [%union
@@ -190,13 +190,12 @@ m4_ifval([$6], [%union
   int ival;
 }])
 AT_LALR1_CC_IF([%define "global_tokens_and_yystype"])
-[
-%{
-]AT_LALR1_CC_IF([typedef yy::location YYLTYPE;
+m4_ifval([$6], [[%post-defines {]], [[%pre-defines {]])
+AT_LALR1_CC_IF([typedef yy::location YYLTYPE;
                 m4_ifval([$6], , [#define YYSTYPE int])])
 [static int yylex (]AT_LEX_FORMALS[);
 ]AT_LALR1_CC_IF([], [static void yyerror (const char *msg);])
-[%}
+[}
 
 ]m4_ifval([$6], [%type <ival> '(' 'x' 'y' ')' ';' thing line input])[
 
Index: tests/regression.at
===================================================================
RCS file: /sources/bison/bison/tests/regression.at,v
retrieving revision 1.100
diff -p -u -r1.100 regression.at
--- tests/regression.at 11 Jun 2006 18:27:44 -0000      1.100
+++ tests/regression.at 16 Jun 2006 03:55:59 -0000
@@ -63,15 +63,17 @@ AT_DATA_GRAMMAR([input.y],
 [[%{
 void yyerror (const char *s);
 int yylex (void);
-#ifndef MY_TOKEN
-# error "MY_TOKEN not defined."
-#endif
 %}
 
 %union
 {
   int val;
 };
+%{
+#ifndef MY_TOKEN
+# error "MY_TOKEN not defined."
+#endif
+%}
 %token MY_TOKEN
 %%
 exp: MY_TOKEN;
@@ -101,6 +103,13 @@ AT_DATA_GRAMMAR([input.y],
 void yyerror (const char *s);
 int yylex (void);
 void print_my_token (void);
+%}
+
+%union
+{
+  int val;
+};
+%{
 void
 print_my_token (void)
 {
@@ -108,11 +117,6 @@ print_my_token (void)
   printf ("%d\n", my_token);
 }
 %}
-
-%union
-{
-  int val;
-};
 %token MY_TOKEN
 %%
 exp: MY_TOKEN;
Index: src/parse-gram.c
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.c,v
retrieving revision 1.115
diff -p -u -r1.115 parse-gram.c
--- src/parse-gram.c    10 Jun 2006 03:02:23 -0000      1.115
+++ src/parse-gram.c    16 Jun 2006 03:55:58 -0000
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 2.1b.  */
+/* A Bison parser, made by GNU Bison 2.3+.  */
 
 /* Skeleton implementation for Bison's Yacc-like parsers in C
 
@@ -47,7 +47,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.1b"
+#define YYBISON_VERSION "2.3+"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -68,121 +68,8 @@
 #define yynerrs gram_nerrs
 #define yylloc gram_lloc
 
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     GRAM_EOF = 0,
-     STRING = 258,
-     INT = 259,
-     PERCENT_TOKEN = 260,
-     PERCENT_NTERM = 261,
-     PERCENT_TYPE = 262,
-     PERCENT_DESTRUCTOR = 263,
-     PERCENT_PRINTER = 264,
-     PERCENT_UNION = 265,
-     PERCENT_LEFT = 266,
-     PERCENT_RIGHT = 267,
-     PERCENT_NONASSOC = 268,
-     PERCENT_PREC = 269,
-     PERCENT_DPREC = 270,
-     PERCENT_MERGE = 271,
-     PERCENT_DEBUG = 272,
-     PERCENT_DEFAULT_PREC = 273,
-     PERCENT_DEFINE = 274,
-     PERCENT_DEFINES = 275,
-     PERCENT_ERROR_VERBOSE = 276,
-     PERCENT_EXPECT = 277,
-     PERCENT_EXPECT_RR = 278,
-     PERCENT_FILE_PREFIX = 279,
-     PERCENT_GLR_PARSER = 280,
-     PERCENT_INITIAL_ACTION = 281,
-     PERCENT_LEX_PARAM = 282,
-     PERCENT_LOCATIONS = 283,
-     PERCENT_NAME_PREFIX = 284,
-     PERCENT_NO_DEFAULT_PREC = 285,
-     PERCENT_NO_LINES = 286,
-     PERCENT_NONDETERMINISTIC_PARSER = 287,
-     PERCENT_OUTPUT = 288,
-     PERCENT_PARSE_PARAM = 289,
-     PERCENT_PURE_PARSER = 290,
-     PERCENT_REQUIRE = 291,
-     PERCENT_SKELETON = 292,
-     PERCENT_START = 293,
-     PERCENT_TOKEN_TABLE = 294,
-     PERCENT_VERBOSE = 295,
-     PERCENT_YACC = 296,
-     TYPE = 297,
-     EQUAL = 298,
-     SEMICOLON = 299,
-     PIPE = 300,
-     ID = 301,
-     ID_COLON = 302,
-     PERCENT_PERCENT = 303,
-     PROLOGUE = 304,
-     EPILOGUE = 305,
-     BRACED_CODE = 306
-   };
-#endif
-/* Tokens.  */
-#define GRAM_EOF 0
-#define STRING 258
-#define INT 259
-#define PERCENT_TOKEN 260
-#define PERCENT_NTERM 261
-#define PERCENT_TYPE 262
-#define PERCENT_DESTRUCTOR 263
-#define PERCENT_PRINTER 264
-#define PERCENT_UNION 265
-#define PERCENT_LEFT 266
-#define PERCENT_RIGHT 267
-#define PERCENT_NONASSOC 268
-#define PERCENT_PREC 269
-#define PERCENT_DPREC 270
-#define PERCENT_MERGE 271
-#define PERCENT_DEBUG 272
-#define PERCENT_DEFAULT_PREC 273
-#define PERCENT_DEFINE 274
-#define PERCENT_DEFINES 275
-#define PERCENT_ERROR_VERBOSE 276
-#define PERCENT_EXPECT 277
-#define PERCENT_EXPECT_RR 278
-#define PERCENT_FILE_PREFIX 279
-#define PERCENT_GLR_PARSER 280
-#define PERCENT_INITIAL_ACTION 281
-#define PERCENT_LEX_PARAM 282
-#define PERCENT_LOCATIONS 283
-#define PERCENT_NAME_PREFIX 284
-#define PERCENT_NO_DEFAULT_PREC 285
-#define PERCENT_NO_LINES 286
-#define PERCENT_NONDETERMINISTIC_PARSER 287
-#define PERCENT_OUTPUT 288
-#define PERCENT_PARSE_PARAM 289
-#define PERCENT_PURE_PARSER 290
-#define PERCENT_REQUIRE 291
-#define PERCENT_SKELETON 292
-#define PERCENT_START 293
-#define PERCENT_TOKEN_TABLE 294
-#define PERCENT_VERBOSE 295
-#define PERCENT_YACC 296
-#define TYPE 297
-#define EQUAL 298
-#define SEMICOLON 299
-#define PIPE 300
-#define ID 301
-#define ID_COLON 302
-#define PERCENT_PERCENT 303
-#define PROLOGUE 304
-#define EPILOGUE 305
-#define BRACED_CODE 306
-
-
-
-
 /* Copy the first part of user declarations.  */
-#line 1 "../../src/parse-gram.y"
+#line 1 "parse-gram.y"
 /* Bison Grammar Parser                             -*- C -*-
 
    Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -276,9 +163,127 @@ static int current_prec = 0;
 # define YYTOKEN_TABLE 0
 #endif
 
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     GRAM_EOF = 0,
+     STRING = 258,
+     INT = 259,
+     PERCENT_TOKEN = 260,
+     PERCENT_NTERM = 261,
+     PERCENT_TYPE = 262,
+     PERCENT_DESTRUCTOR = 263,
+     PERCENT_PRINTER = 264,
+     PERCENT_UNION = 265,
+     PERCENT_LEFT = 266,
+     PERCENT_RIGHT = 267,
+     PERCENT_NONASSOC = 268,
+     PERCENT_PREC = 269,
+     PERCENT_DPREC = 270,
+     PERCENT_MERGE = 271,
+     PERCENT_DEBUG = 272,
+     PERCENT_DEFAULT_PREC = 273,
+     PERCENT_DEFINE = 274,
+     PERCENT_DEFINES = 275,
+     PERCENT_ERROR_VERBOSE = 276,
+     PERCENT_EXPECT = 277,
+     PERCENT_EXPECT_RR = 278,
+     PERCENT_FILE_PREFIX = 279,
+     PERCENT_GLR_PARSER = 280,
+     PERCENT_PRE_DEFINES = 281,
+     PERCENT_POST_DEFINES = 282,
+     PERCENT_INITIAL_ACTION = 283,
+     PERCENT_LEX_PARAM = 284,
+     PERCENT_LOCATIONS = 285,
+     PERCENT_NAME_PREFIX = 286,
+     PERCENT_NO_DEFAULT_PREC = 287,
+     PERCENT_NO_LINES = 288,
+     PERCENT_NONDETERMINISTIC_PARSER = 289,
+     PERCENT_OUTPUT = 290,
+     PERCENT_PARSE_PARAM = 291,
+     PERCENT_PURE_PARSER = 292,
+     PERCENT_REQUIRE = 293,
+     PERCENT_SKELETON = 294,
+     PERCENT_START = 295,
+     PERCENT_TOKEN_TABLE = 296,
+     PERCENT_VERBOSE = 297,
+     PERCENT_YACC = 298,
+     TYPE = 299,
+     EQUAL = 300,
+     SEMICOLON = 301,
+     PIPE = 302,
+     ID = 303,
+     ID_COLON = 304,
+     PERCENT_PERCENT = 305,
+     PROLOGUE = 306,
+     EPILOGUE = 307,
+     BRACED_CODE = 308
+   };
+#endif
+/* Tokens.  */
+#define GRAM_EOF 0
+#define STRING 258
+#define INT 259
+#define PERCENT_TOKEN 260
+#define PERCENT_NTERM 261
+#define PERCENT_TYPE 262
+#define PERCENT_DESTRUCTOR 263
+#define PERCENT_PRINTER 264
+#define PERCENT_UNION 265
+#define PERCENT_LEFT 266
+#define PERCENT_RIGHT 267
+#define PERCENT_NONASSOC 268
+#define PERCENT_PREC 269
+#define PERCENT_DPREC 270
+#define PERCENT_MERGE 271
+#define PERCENT_DEBUG 272
+#define PERCENT_DEFAULT_PREC 273
+#define PERCENT_DEFINE 274
+#define PERCENT_DEFINES 275
+#define PERCENT_ERROR_VERBOSE 276
+#define PERCENT_EXPECT 277
+#define PERCENT_EXPECT_RR 278
+#define PERCENT_FILE_PREFIX 279
+#define PERCENT_GLR_PARSER 280
+#define PERCENT_PRE_DEFINES 281
+#define PERCENT_POST_DEFINES 282
+#define PERCENT_INITIAL_ACTION 283
+#define PERCENT_LEX_PARAM 284
+#define PERCENT_LOCATIONS 285
+#define PERCENT_NAME_PREFIX 286
+#define PERCENT_NO_DEFAULT_PREC 287
+#define PERCENT_NO_LINES 288
+#define PERCENT_NONDETERMINISTIC_PARSER 289
+#define PERCENT_OUTPUT 290
+#define PERCENT_PARSE_PARAM 291
+#define PERCENT_PURE_PARSER 292
+#define PERCENT_REQUIRE 293
+#define PERCENT_SKELETON 294
+#define PERCENT_START 295
+#define PERCENT_TOKEN_TABLE 296
+#define PERCENT_VERBOSE 297
+#define PERCENT_YACC 298
+#define TYPE 299
+#define EQUAL 300
+#define SEMICOLON 301
+#define PIPE 302
+#define ID 303
+#define ID_COLON 304
+#define PERCENT_PERCENT 305
+#define PROLOGUE 306
+#define EPILOGUE 307
+#define BRACED_CODE 308
+
+
+
+
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 95 "../../src/parse-gram.y"
+#line 95 "parse-gram.y"
 {
   symbol *symbol;
   symbol_list *list;
@@ -287,8 +292,8 @@ typedef union YYSTYPE
   assoc assoc;
   uniqstr uniqstr;
 }
-/* Line 193 of yacc.c.  */
-#line 292 "../../src/parse-gram.c"
+/* Line 197 of yacc.c.  */
+#line 297 "parse-gram.c"
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -312,8 +317,8 @@ typedef struct YYLTYPE
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 317 "../../src/parse-gram.c"
+/* Line __line__ of yacc.c.  */
+#line 322 "parse-gram.c"
 
 #ifdef short
 # undef short
@@ -530,20 +535,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   164
+#define YYLAST   170
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  52
+#define YYNTOKENS  54
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  24
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  80
+#define YYNRULES  82
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  114
+#define YYNSTATES  118
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   306
+#define YYMAXUTOK   308
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -581,7 +586,7 @@ static const yytype_uint8 yytranslate[] 
       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
-      45,    46,    47,    48,    49,    50,    51
+      45,    46,    47,    48,    49,    50,    51,    52,    53
 };
 
 #if YYDEBUG
@@ -590,54 +595,55 @@ static const yytype_uint8 yytranslate[] 
 static const yytype_uint8 yyprhs[] =
 {
        0,     0,     3,     8,     9,    12,    14,    16,    18,    21,
-      25,    27,    29,    32,    35,    39,    41,    44,    47,    49,
-      53,    55,    57,    61,    64,    66,    69,    72,    74,    76,
-      78,    80,    82,    84,    87,    89,    93,    97,    99,   101,
-     102,   106,   107,   111,   115,   119,   121,   123,   125,   126,
-     128,   130,   133,   135,   137,   140,   143,   147,   149,   152,
-     154,   157,   159,   162,   165,   166,   170,   172,   176,   179,
-     180,   183,   186,   190,   194,   198,   200,   202,   204,   206,
-     207
+      25,    27,    29,    32,    35,    39,    41,    44,    47,    50,
+      53,    55,    59,    61,    63,    67,    70,    72,    75,    78,
+      80,    82,    84,    86,    88,    90,    93,    95,    99,   103,
+     105,   107,   108,   112,   113,   117,   121,   125,   127,   129,
+     131,   132,   134,   136,   139,   141,   143,   146,   149,   153,
+     155,   158,   160,   163,   165,   168,   171,   172,   176,   178,
+     182,   185,   186,   189,   192,   196,   200,   204,   206,   208,
+     210,   212,   213
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
-      53,     0,    -1,    54,    48,    66,    75,    -1,    -1,    54,
-      55,    -1,    56,    -1,    49,    -1,    17,    -1,    19,    74,
-      -1,    19,    74,    74,    -1,    20,    -1,    21,    -1,    22,
-       4,    -1,    23,     4,    -1,    24,    43,    74,    -1,    25,
-      -1,    26,    51,    -1,    27,    51,    -1,    28,    -1,    29,
-      43,    74,    -1,    31,    -1,    32,    -1,    33,    43,    74,
-      -1,    34,    51,    -1,    35,    -1,    36,    74,    -1,    37,
-      74,    -1,    39,    -1,    40,    -1,    41,    -1,    44,    -1,
-      60,    -1,    57,    -1,    38,    72,    -1,    10,    -1,     8,
-      51,    63,    -1,     9,    51,    63,    -1,    18,    -1,    30,
-      -1,    -1,     6,    58,    65,    -1,    -1,     5,    59,    65,
-      -1,     7,    42,    63,    -1,    61,    62,    63,    -1,    11,
-      -1,    12,    -1,    13,    -1,    -1,    42,    -1,    72,    -1,
-      63,    72,    -1,    42,    -1,    46,    -1,    46,     4,    -1,
-      46,    73,    -1,    46,     4,    73,    -1,    64,    -1,    65,
-      64,    -1,    67,    -1,    66,    67,    -1,    68,    -1,    56,
-      44,    -1,     1,    44,    -1,    -1,    47,    69,    70,    -1,
-      71,    -1,    70,    45,    71,    -1,    70,    44,    -1,    -1,
-      71,    72,    -1,    71,    51,    -1,    71,    14,    72,    -1,
-      71,    15,     4,    -1,    71,    16,    42,    -1,    46,    -1,
-      73,    -1,     3,    -1,     3,    -1,    -1,    48,    50,    -1
+      55,     0,    -1,    56,    50,    68,    77,    -1,    -1,    56,
+      57,    -1,    58,    -1,    51,    -1,    17,    -1,    19,    76,
+      -1,    19,    76,    76,    -1,    20,    -1,    21,    -1,    22,
+       4,    -1,    23,     4,    -1,    24,    45,    76,    -1,    25,
+      -1,    26,    53,    -1,    27,    53,    -1,    28,    53,    -1,
+      29,    53,    -1,    30,    -1,    31,    45,    76,    -1,    33,
+      -1,    34,    -1,    35,    45,    76,    -1,    36,    53,    -1,
+      37,    -1,    38,    76,    -1,    39,    76,    -1,    41,    -1,
+      42,    -1,    43,    -1,    46,    -1,    62,    -1,    59,    -1,
+      40,    74,    -1,    10,    -1,     8,    53,    65,    -1,     9,
+      53,    65,    -1,    18,    -1,    32,    -1,    -1,     6,    60,
+      67,    -1,    -1,     5,    61,    67,    -1,     7,    44,    65,
+      -1,    63,    64,    65,    -1,    11,    -1,    12,    -1,    13,
+      -1,    -1,    44,    -1,    74,    -1,    65,    74,    -1,    44,
+      -1,    48,    -1,    48,     4,    -1,    48,    75,    -1,    48,
+       4,    75,    -1,    66,    -1,    67,    66,    -1,    69,    -1,
+      68,    69,    -1,    70,    -1,    58,    46,    -1,     1,    46,
+      -1,    -1,    49,    71,    72,    -1,    73,    -1,    72,    47,
+      73,    -1,    72,    46,    -1,    -1,    73,    74,    -1,    73,
+      53,    -1,    73,    14,    74,    -1,    73,    15,     4,    -1,
+      73,    16,    44,    -1,    48,    -1,    75,    -1,     3,    -1,
+       3,    -1,    -1,    50,    52,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   194,   194,   202,   204,   208,   209,   211,   212,   217,
-     218,   219,   220,   221,   222,   223,   228,   232,   233,   234,
-     235,   236,   237,   238,   239,   240,   241,   242,   243,   244,
-     245,   249,   250,   251,   255,   271,   279,   287,   291,   298,
-     298,   303,   303,   308,   318,   333,   334,   335,   339,   340,
-     345,   346,   351,   355,   360,   366,   372,   383,   384,   393,
-     394,   400,   401,   402,   409,   409,   413,   414,   415,   420,
-     421,   423,   426,   428,   430,   435,   436,   441,   450,   455,
-     457
+       0,   196,   196,   204,   206,   210,   211,   213,   214,   219,
+     220,   221,   222,   223,   224,   225,   230,   237,   244,   248,
+     249,   250,   251,   252,   253,   254,   255,   256,   257,   258,
+     259,   260,   261,   265,   266,   267,   271,   287,   295,   303,
+     307,   314,   314,   319,   319,   324,   334,   349,   350,   351,
+     355,   356,   361,   362,   367,   371,   376,   382,   388,   399,
+     400,   409,   410,   416,   417,   418,   425,   425,   429,   430,
+     431,   436,   437,   439,   442,   444,   446,   451,   452,   457,
+     466,   471,   473
 };
 #endif
 
@@ -652,14 +658,14 @@ static const char *const yytname[] =
   "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", "\"%debug\"",
   "\"%default-prec\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"",
   "\"%expect\"", "\"%expect-rr\"", "\"%file-prefix\"", "\"%glr-parser\"",
-  "\"%initial-action\"", "\"%lex-param\"", "\"%locations\"",
-  "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"",
-  "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param\"",
-  "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"",
-  "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"",
-  "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"",
-  "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input",
-  "declarations", "declaration", "grammar_declaration",
+  "\"%pre-defines\"", "\"%post-defines\"", "\"%initial-action\"",
+  "\"%lex-param\"", "\"%locations\"", "\"%name-prefix\"",
+  "\"%no-default-prec\"", "\"%no-lines\"", "\"%nondeterministic-parser\"",
+  "\"%output\"", "\"%parse-param\"", "\"%pure-parser\"", "\"%require\"",
+  "\"%skeleton\"", "\"%start\"", "\"%token-table\"", "\"%verbose\"",
+  "\"%yacc\"", "\"type\"", "\"=\"", "\";\"", "\"|\"", "\"identifier\"",
+  "\"identifier:\"", "\"%%\"", "\"%{...%}\"", "\"epilogue\"", "\"{...}\"",
+  "$accept", "input", "declarations", "declaration", "grammar_declaration",
   "symbol_declaration", "@1", "@2", "precedence_declaration",
   "precedence_declarator", "type.opt", "symbols.1", "symbol_def",
   "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules",
@@ -678,36 +684,36 @@ static const yytype_uint16 yytoknum[] =
      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
-     305,   306
+     305,   306,   307,   308
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,    52,    53,    54,    54,    55,    55,    55,    55,    55,
-      55,    55,    55,    55,    55,    55,    55,    55,    55,    55,
-      55,    55,    55,    55,    55,    55,    55,    55,    55,    55,
-      55,    56,    56,    56,    56,    56,    56,    56,    56,    58,
-      57,    59,    57,    57,    60,    61,    61,    61,    62,    62,
-      63,    63,    64,    64,    64,    64,    64,    65,    65,    66,
-      66,    67,    67,    67,    69,    68,    70,    70,    70,    71,
-      71,    71,    71,    71,    71,    72,    72,    73,    74,    75,
-      75
+       0,    54,    55,    56,    56,    57,    57,    57,    57,    57,
+      57,    57,    57,    57,    57,    57,    57,    57,    57,    57,
+      57,    57,    57,    57,    57,    57,    57,    57,    57,    57,
+      57,    57,    57,    58,    58,    58,    58,    58,    58,    58,
+      58,    60,    59,    61,    59,    59,    62,    63,    63,    63,
+      64,    64,    65,    65,    66,    66,    66,    66,    66,    67,
+      67,    68,    68,    69,    69,    69,    71,    70,    72,    72,
+      72,    73,    73,    73,    73,    73,    73,    74,    74,    75,
+      76,    77,    77
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
        0,     2,     4,     0,     2,     1,     1,     1,     2,     3,
-       1,     1,     2,     2,     3,     1,     2,     2,     1,     3,
-       1,     1,     3,     2,     1,     2,     2,     1,     1,     1,
-       1,     1,     1,     2,     1,     3,     3,     1,     1,     0,
-       3,     0,     3,     3,     3,     1,     1,     1,     0,     1,
-       1,     2,     1,     1,     2,     2,     3,     1,     2,     1,
-       2,     1,     2,     2,     0,     3,     1,     3,     2,     0,
-       2,     2,     3,     3,     3,     1,     1,     1,     1,     0,
-       2
+       1,     1,     2,     2,     3,     1,     2,     2,     2,     2,
+       1,     3,     1,     1,     3,     2,     1,     2,     2,     1,
+       1,     1,     1,     1,     1,     2,     1,     3,     3,     1,
+       1,     0,     3,     0,     3,     3,     3,     1,     1,     1,
+       0,     1,     1,     2,     1,     1,     2,     2,     3,     1,
+       2,     1,     2,     1,     2,     2,     0,     3,     1,     3,
+       2,     0,     2,     2,     3,     3,     3,     1,     1,     1,
+       1,     0,     2
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -715,118 +721,120 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       3,     0,     0,     1,    41,    39,     0,     0,     0,    34,
-      45,    46,    47,     7,    37,     0,    10,    11,     0,     0,
-       0,    15,     0,     0,    18,     0,    38,    20,    21,     0,
-       0,    24,     0,     0,     0,    27,    28,    29,    30,     0,
-       6,     4,     5,    32,    31,    48,     0,     0,     0,     0,
-       0,    78,     8,    12,    13,     0,    16,    17,     0,     0,
-      23,    25,    26,    77,    75,    33,    76,     0,    64,     0,
-       0,    59,    61,    49,     0,    52,    53,    57,    42,    40,
-      43,    50,    35,    36,     9,    14,    19,    22,    63,    69,
-      62,     0,    60,     2,    44,    54,    55,    58,    51,    65,
-      66,    80,    56,    68,    69,     0,     0,     0,    71,    70,
-      67,    72,    73,    74
+       3,     0,     0,     1,    43,    41,     0,     0,     0,    36,
+      47,    48,    49,     7,    39,     0,    10,    11,     0,     0,
+       0,    15,     0,     0,     0,     0,    20,     0,    40,    22,
+      23,     0,     0,    26,     0,     0,     0,    29,    30,    31,
+      32,     0,     6,     4,     5,    34,    33,    50,     0,     0,
+       0,     0,     0,    80,     8,    12,    13,     0,    16,    17,
+      18,    19,     0,     0,    25,    27,    28,    79,    77,    35,
+      78,     0,    66,     0,     0,    61,    63,    51,     0,    54,
+      55,    59,    44,    42,    45,    52,    37,    38,     9,    14,
+      21,    24,    65,    71,    64,     0,    62,     2,    46,    56,
+      57,    60,    53,    67,    68,    82,    58,    70,    71,     0,
+       0,     0,    73,    72,    69,    74,    75,    76
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-      -1,     1,     2,    41,    69,    43,    47,    46,    44,    45,
-      74,    80,    77,    78,    70,    71,    72,    89,    99,   100,
-      81,    66,    52,    93
+      -1,     1,     2,    43,    73,    45,    49,    48,    46,    47,
+      78,    84,    81,    82,    74,    75,    76,    93,   103,   104,
+      85,    70,    54,    97
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -72
+#define YYPACT_NINF -74
 static const yytype_int8 yypact[] =
 {
-     -72,     7,   115,   -72,   -72,   -72,   -22,   -17,   -16,   -72,
-     -72,   -72,   -72,   -72,   -72,    26,   -72,   -72,    32,    33,
-      -3,   -72,    -8,    -6,   -72,     4,   -72,   -72,   -72,     9,
-       2,   -72,    26,    26,    -2,   -72,   -72,   -72,   -72,    72,
-     -72,   -72,   -72,   -72,   -72,    12,   -40,   -40,    -2,    -2,
-      -2,   -72,    26,   -72,   -72,    26,   -72,   -72,    26,    26,
-     -72,   -72,   -72,   -72,   -72,   -72,   -72,    11,   -72,    13,
-       3,   -72,   -72,   -72,    -2,   -72,    19,   -72,   -40,   -40,
-      -2,   -72,    -2,    -2,   -72,   -72,   -72,   -72,   -72,   -72,
-     -72,    18,   -72,   -72,    -2,    53,   -72,   -72,   -72,   -19,
-      16,   -72,   -72,   -72,   -72,    -2,    55,    21,   -72,   -72,
-      16,   -72,   -72,   -72
+     -74,     2,   119,   -74,   -74,   -74,   -17,   -13,   -12,   -74,
+     -74,   -74,   -74,   -74,   -74,    26,   -74,   -74,    38,    41,
+       4,   -74,    -6,     1,     5,     6,   -74,    10,   -74,   -74,
+     -74,    11,     7,   -74,    26,    26,    -2,   -74,   -74,   -74,
+     -74,    74,   -74,   -74,   -74,   -74,   -74,    13,   -24,   -24,
+      -2,    -2,    -2,   -74,    26,   -74,   -74,    26,   -74,   -74,
+     -74,   -74,    26,    26,   -74,   -74,   -74,   -74,   -74,   -74,
+     -74,    15,   -74,    17,     3,   -74,   -74,   -74,    -2,   -74,
+      19,   -74,   -24,   -24,    -2,   -74,    -2,    -2,   -74,   -74,
+     -74,   -74,   -74,   -74,   -74,    14,   -74,   -74,    -2,    62,
+     -74,   -74,   -74,   -10,    16,   -74,   -74,   -74,   -74,    -2,
+      63,    27,   -74,   -74,    16,   -74,   -74,   -74
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -72,   -72,   -72,   -72,    67,   -72,   -72,   -72,   -72,   -72,
-     -72,   -32,   -51,    23,   -72,     5,   -72,   -72,   -72,   -30,
-     -34,   -71,     6,   -72
+     -74,   -74,   -74,   -74,    68,   -74,   -74,   -74,   -74,   -74,
+     -74,   -34,   -44,    23,   -74,     0,   -74,   -74,   -74,   -32,
+     -36,   -73,   -29,   -74
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -80
+#define YYTABLE_NINF -82
 static const yytype_int8 yytable[] =
 {
-      65,    63,    75,   -79,    67,    96,    76,     3,     4,     5,
-       6,     7,     8,     9,    10,    11,    12,    82,    83,    63,
-      48,    14,    63,    95,   102,   103,   104,    97,    97,    51,
-     105,   106,   107,    26,    49,    50,    53,    54,    61,    62,
-      55,    34,    94,    56,    64,    57,    98,    58,    98,    98,
-      68,    91,    59,    60,    73,    88,    63,    90,    84,   112,
-      98,    85,    64,   113,    86,    87,   109,   108,   101,    42,
-      79,   111,     0,    67,   110,    92,   109,     4,     5,     6,
-       7,     8,     9,    10,    11,    12,     0,     0,     0,     0,
-      14,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,    26,     0,     0,     0,     0,     0,     0,     0,
-      34,     0,     0,     0,     0,     0,     0,     0,     0,    68,
-       4,     5,     6,     7,     8,     9,    10,    11,    12,     0,
-       0,     0,    13,    14,    15,    16,    17,    18,    19,    20,
-      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
-      31,    32,    33,    34,    35,    36,    37,     0,     0,    38,
-       0,     0,     0,    39,    40
+      69,    67,     3,   -81,    71,    65,    66,   100,     4,     5,
+       6,     7,     8,     9,    10,    11,    12,    86,    87,    67,
+      79,    14,    67,    99,    80,    88,   106,    50,    89,    53,
+     109,   110,   111,    90,    91,    28,   107,   108,   101,   101,
+      51,    52,    55,    36,    98,    56,    68,    58,   102,    57,
+     102,   102,    72,    95,    59,    62,    63,    77,    60,    61,
+      64,    92,   102,    94,    68,    67,   105,   116,   113,   112,
+      44,   117,    83,   115,    96,    71,   114,     0,   113,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,     0,     0,
+       0,     0,    14,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    28,     0,     0,     0,
+       0,     0,     0,     0,    36,     0,     0,     0,     0,     0,
+       0,     0,     0,    72,     4,     5,     6,     7,     8,     9,
+      10,    11,    12,     0,     0,     0,    13,    14,    15,    16,
+      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+      37,    38,    39,     0,     0,    40,     0,     0,     0,    41,
+      42
 };
 
 static const yytype_int8 yycheck[] =
 {
-      34,     3,    42,     0,     1,    76,    46,     0,     5,     6,
-       7,     8,     9,    10,    11,    12,    13,    49,    50,     3,
-      42,    18,     3,     4,    95,    44,    45,    78,    79,     3,
-      14,    15,    16,    30,    51,    51,     4,     4,    32,    33,
-      43,    38,    74,    51,    46,    51,    80,    43,    82,    83,
-      47,    48,    43,    51,    42,    44,     3,    44,    52,     4,
-      94,    55,    46,    42,    58,    59,   100,    51,    50,     2,
-      47,   105,    -1,     1,   104,    70,   110,     5,     6,     7,
-       8,     9,    10,    11,    12,    13,    -1,    -1,    -1,    -1,
-      18,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    30,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      38,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    47,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    -1,
-      -1,    -1,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-      35,    36,    37,    38,    39,    40,    41,    -1,    -1,    44,
-      -1,    -1,    -1,    48,    49
+      36,     3,     0,     0,     1,    34,    35,    80,     5,     6,
+       7,     8,     9,    10,    11,    12,    13,    51,    52,     3,
+      44,    18,     3,     4,    48,    54,    99,    44,    57,     3,
+      14,    15,    16,    62,    63,    32,    46,    47,    82,    83,
+      53,    53,     4,    40,    78,     4,    48,    53,    84,    45,
+      86,    87,    49,    50,    53,    45,    45,    44,    53,    53,
+      53,    46,    98,    46,    48,     3,    52,     4,   104,    53,
+       2,    44,    49,   109,    74,     1,   108,    -1,   114,     5,
+       6,     7,     8,     9,    10,    11,    12,    13,    -1,    -1,
+      -1,    -1,    18,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    32,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    40,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    49,     5,     6,     7,     8,     9,    10,
+      11,    12,    13,    -1,    -1,    -1,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
+      41,    42,    43,    -1,    -1,    46,    -1,    -1,    -1,    50,
+      51
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    53,    54,     0,     5,     6,     7,     8,     9,    10,
+       0,    55,    56,     0,     5,     6,     7,     8,     9,    10,
       11,    12,    13,    17,    18,    19,    20,    21,    22,    23,
       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
-      34,    35,    36,    37,    38,    39,    40,    41,    44,    48,
-      49,    55,    56,    57,    60,    61,    59,    58,    42,    51,
-      51,     3,    74,     4,     4,    43,    51,    51,    43,    43,
-      51,    74,    74,     3,    46,    72,    73,     1,    47,    56,
-      66,    67,    68,    42,    62,    42,    46,    64,    65,    65,
-      63,    72,    63,    63,    74,    74,    74,    74,    44,    69,
-      44,    48,    67,    75,    63,     4,    73,    64,    72,    70,
-      71,    50,    73,    44,    45,    14,    15,    16,    51,    72,
-      71,    72,     4,    42
+      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
+      46,    50,    51,    57,    58,    59,    62,    63,    61,    60,
+      44,    53,    53,     3,    76,     4,     4,    45,    53,    53,
+      53,    53,    45,    45,    53,    76,    76,     3,    48,    74,
+      75,     1,    49,    58,    68,    69,    70,    44,    64,    44,
+      48,    66,    67,    67,    65,    74,    65,    65,    76,    76,
+      76,    76,    46,    71,    46,    50,    69,    77,    65,     4,
+      75,    66,    74,    72,    73,    52,    75,    46,    47,    14,
+      15,    16,    53,    74,    73,    74,     4,    44
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -975,64 +983,64 @@ yy_symbol_value_print (yyoutput, yytype,
   switch (yytype)
     {
       case 3: /* "\"string\"" */
-#line 175 "../../src/parse-gram.y"
+#line 177 "parse-gram.y"
        { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); };
-#line 981 "../../src/parse-gram.c"
+#line 989 "parse-gram.c"
        break;
       case 4: /* "\"integer\"" */
-#line 184 "../../src/parse-gram.y"
+#line 186 "parse-gram.y"
        { fprintf (stderr, "%d", (yyvaluep->integer)); };
-#line 986 "../../src/parse-gram.c"
+#line 994 "parse-gram.c"
        break;
       case 10: /* "\"%union {...}\"" */
-#line 177 "../../src/parse-gram.y"
+#line 179 "parse-gram.y"
        { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
-#line 991 "../../src/parse-gram.c"
+#line 999 "parse-gram.c"
        break;
-      case 42: /* "\"type\"" */
-#line 182 "../../src/parse-gram.y"
+      case 44: /* "\"type\"" */
+#line 184 "parse-gram.y"
        { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); };
-#line 996 "../../src/parse-gram.c"
+#line 1004 "parse-gram.c"
        break;
-      case 46: /* "\"identifier\"" */
-#line 186 "../../src/parse-gram.y"
+      case 48: /* "\"identifier\"" */
+#line 188 "parse-gram.y"
        { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
-#line 1001 "../../src/parse-gram.c"
+#line 1009 "parse-gram.c"
        break;
-      case 47: /* "\"identifier:\"" */
-#line 188 "../../src/parse-gram.y"
+      case 49: /* "\"identifier:\"" */
+#line 190 "parse-gram.y"
        { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); };
-#line 1006 "../../src/parse-gram.c"
+#line 1014 "parse-gram.c"
        break;
-      case 49: /* "\"%{...%}\"" */
-#line 177 "../../src/parse-gram.y"
+      case 51: /* "\"%{...%}\"" */
+#line 179 "parse-gram.y"
        { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
-#line 1011 "../../src/parse-gram.c"
+#line 1019 "parse-gram.c"
        break;
-      case 50: /* "\"epilogue\"" */
-#line 177 "../../src/parse-gram.y"
+      case 52: /* "\"epilogue\"" */
+#line 179 "parse-gram.y"
        { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
-#line 1016 "../../src/parse-gram.c"
+#line 1024 "parse-gram.c"
        break;
-      case 51: /* "\"{...}\"" */
-#line 177 "../../src/parse-gram.y"
+      case 53: /* "\"{...}\"" */
+#line 179 "parse-gram.y"
        { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); };
-#line 1021 "../../src/parse-gram.c"
+#line 1029 "parse-gram.c"
        break;
-      case 72: /* "symbol" */
-#line 186 "../../src/parse-gram.y"
+      case 74: /* "symbol" */
+#line 188 "parse-gram.y"
        { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
-#line 1026 "../../src/parse-gram.c"
+#line 1034 "parse-gram.c"
        break;
-      case 73: /* "string_as_id" */
-#line 186 "../../src/parse-gram.y"
+      case 75: /* "string_as_id" */
+#line 188 "parse-gram.y"
        { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); };
-#line 1031 "../../src/parse-gram.c"
+#line 1039 "parse-gram.c"
        break;
-      case 74: /* "string_content" */
-#line 175 "../../src/parse-gram.y"
+      case 76: /* "string_content" */
+#line 177 "parse-gram.y"
        { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); };
-#line 1036 "../../src/parse-gram.c"
+#line 1044 "parse-gram.c"
        break;
       default:
        break;
@@ -1542,15 +1550,15 @@ YYLTYPE yylloc;
 
 
   /* User initialization code.  */
-#line 86 "../../src/parse-gram.y"
+#line 86 "parse-gram.y"
 {
   /* Bison's grammar can initial empty locations, hence a default
      location is needed. */
   boundary_set (&yylloc.start, current_file, 1, 0);
   boundary_set (&yylloc.end, current_file, 1, 0);
 }
-/* Line 1078 of yacc.c.  */
-#line 1554 "../../src/parse-gram.c"
+/* Line 1085 of yacc.c.  */
+#line 1562 "parse-gram.c"
   yylsp[0] = yylloc;
   goto yysetstate;
 
@@ -1735,18 +1743,18 @@ yyreduce:
   switch (yyn)
     {
         case 6:
-#line 209 "../../src/parse-gram.y"
+#line 211 "parse-gram.y"
     { prologue_augment (translate_code ((yyvsp[(1) - (1)].chars), (yylsp[(1) - 
(1)])),
                                                       (yylsp[(1) - (1)])); }
     break;
 
   case 7:
-#line 211 "../../src/parse-gram.y"
+#line 213 "parse-gram.y"
     { debug_flag = true; }
     break;
 
   case 8:
-#line 213 "../../src/parse-gram.y"
+#line 215 "parse-gram.y"
     {
       static char one[] = "1";
       muscle_insert ((yyvsp[(2) - (2)].chars), one);
@@ -1754,37 +1762,37 @@ yyreduce:
     break;
 
   case 9:
-#line 217 "../../src/parse-gram.y"
+#line 219 "parse-gram.y"
     { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); }
     break;
 
   case 10:
-#line 218 "../../src/parse-gram.y"
+#line 220 "parse-gram.y"
     { defines_flag = true; }
     break;
 
   case 11:
-#line 219 "../../src/parse-gram.y"
+#line 221 "parse-gram.y"
     { error_verbose = true; }
     break;
 
   case 12:
-#line 220 "../../src/parse-gram.y"
+#line 222 "parse-gram.y"
     { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); }
     break;
 
   case 13:
-#line 221 "../../src/parse-gram.y"
+#line 223 "parse-gram.y"
     { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); }
     break;
 
   case 14:
-#line 222 "../../src/parse-gram.y"
+#line 224 "parse-gram.y"
     { spec_file_prefix = (yyvsp[(3) - (3)].chars); }
     break;
 
   case 15:
-#line 224 "../../src/parse-gram.y"
+#line 226 "parse-gram.y"
     {
       nondeterministic_parser = true;
       glr_parser = true;
@@ -1792,86 +1800,106 @@ yyreduce:
     break;
 
   case 16:
-#line 229 "../../src/parse-gram.y"
+#line 231 "parse-gram.y"
     {
-      muscle_code_grow ("initial_action", translate_symbol_action ((yyvsp[(2) 
- (2)].chars), (yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
+      pre_defines = true;
+      /* Remove the '{', and replace the '}' with '\n'.  */
+      (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n';
+      muscle_code_grow ("pre_defines", (yyvsp[(2) - (2)].chars)+1, (yylsp[(2) 
- (2)]));
     }
     break;
 
   case 17:
-#line 232 "../../src/parse-gram.y"
-    { add_param ("lex_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); }
+#line 238 "parse-gram.y"
+    {
+      post_defines = true;
+      /* Remove the '{', and replace the '}' with '\n'.  */
+      (yyvsp[(2) - (2)].chars)[strlen ((yyvsp[(2) - (2)].chars)) - 1] = '\n';
+      muscle_code_grow ("post_defines", (yyvsp[(2) - (2)].chars)+1, (yylsp[(2) 
- (2)]));
+    }
     break;
 
   case 18:
-#line 233 "../../src/parse-gram.y"
-    { locations_flag = true; }
+#line 245 "parse-gram.y"
+    {
+      muscle_code_grow ("initial_action", translate_symbol_action ((yyvsp[(2) 
- (2)].chars), (yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
+    }
     break;
 
   case 19:
-#line 234 "../../src/parse-gram.y"
-    { spec_name_prefix = (yyvsp[(3) - (3)].chars); }
+#line 248 "parse-gram.y"
+    { add_param ("lex_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); }
     break;
 
   case 20:
-#line 235 "../../src/parse-gram.y"
-    { no_lines_flag = true; }
+#line 249 "parse-gram.y"
+    { locations_flag = true; }
     break;
 
   case 21:
-#line 236 "../../src/parse-gram.y"
-    { nondeterministic_parser = true; }
+#line 250 "parse-gram.y"
+    { spec_name_prefix = (yyvsp[(3) - (3)].chars); }
     break;
 
   case 22:
-#line 237 "../../src/parse-gram.y"
-    { spec_outfile = (yyvsp[(3) - (3)].chars); }
+#line 251 "parse-gram.y"
+    { no_lines_flag = true; }
     break;
 
   case 23:
-#line 238 "../../src/parse-gram.y"
-    { add_param ("parse_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); 
}
+#line 252 "parse-gram.y"
+    { nondeterministic_parser = true; }
     break;
 
   case 24:
-#line 239 "../../src/parse-gram.y"
-    { pure_parser = true; }
+#line 253 "parse-gram.y"
+    { spec_outfile = (yyvsp[(3) - (3)].chars); }
     break;
 
   case 25:
-#line 240 "../../src/parse-gram.y"
-    { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
+#line 254 "parse-gram.y"
+    { add_param ("parse_param", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); 
}
     break;
 
   case 26:
-#line 241 "../../src/parse-gram.y"
-    { skeleton = (yyvsp[(2) - (2)].chars); }
+#line 255 "parse-gram.y"
+    { pure_parser = true; }
     break;
 
   case 27:
-#line 242 "../../src/parse-gram.y"
-    { token_table_flag = true; }
+#line 256 "parse-gram.y"
+    { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); }
     break;
 
   case 28:
-#line 243 "../../src/parse-gram.y"
-    { report_flag = report_states; }
+#line 257 "parse-gram.y"
+    { skeleton = (yyvsp[(2) - (2)].chars); }
     break;
 
   case 29:
-#line 244 "../../src/parse-gram.y"
+#line 258 "parse-gram.y"
+    { token_table_flag = true; }
+    break;
+
+  case 30:
+#line 259 "parse-gram.y"
+    { report_flag = report_states; }
+    break;
+
+  case 31:
+#line 260 "parse-gram.y"
     { yacc_flag = true; }
     break;
 
-  case 33:
-#line 252 "../../src/parse-gram.y"
+  case 35:
+#line 268 "parse-gram.y"
     {
       grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)]));
     }
     break;
 
-  case 34:
-#line 256 "../../src/parse-gram.y"
+  case 36:
+#line 272 "parse-gram.y"
     {
       char const *body = (yyvsp[(1) - (1)].chars);
 
@@ -1889,8 +1917,8 @@ yyreduce:
     }
     break;
 
-  case 35:
-#line 272 "../../src/parse-gram.y"
+  case 37:
+#line 288 "parse-gram.y"
     {
       symbol_list *list;
       const char *action = translate_symbol_action ((yyvsp[(2) - (3)].chars), 
(yylsp[(2) - (3)]));
@@ -1900,8 +1928,8 @@ yyreduce:
     }
     break;
 
-  case 36:
-#line 280 "../../src/parse-gram.y"
+  case 38:
+#line 296 "parse-gram.y"
     {
       symbol_list *list;
       const char *action = translate_symbol_action ((yyvsp[(2) - (3)].chars), 
(yylsp[(2) - (3)]));
@@ -1911,48 +1939,48 @@ yyreduce:
     }
     break;
 
-  case 37:
-#line 288 "../../src/parse-gram.y"
+  case 39:
+#line 304 "parse-gram.y"
     {
       default_prec = true;
     }
     break;
 
-  case 38:
-#line 292 "../../src/parse-gram.y"
+  case 40:
+#line 308 "parse-gram.y"
     {
       default_prec = false;
     }
     break;
 
-  case 39:
-#line 298 "../../src/parse-gram.y"
+  case 41:
+#line 314 "parse-gram.y"
     { current_class = nterm_sym; }
     break;
 
-  case 40:
-#line 299 "../../src/parse-gram.y"
+  case 42:
+#line 315 "parse-gram.y"
     {
       current_class = unknown_sym;
       current_type = NULL;
     }
     break;
 
-  case 41:
-#line 303 "../../src/parse-gram.y"
+  case 43:
+#line 319 "parse-gram.y"
     { current_class = token_sym; }
     break;
 
-  case 42:
-#line 304 "../../src/parse-gram.y"
+  case 44:
+#line 320 "parse-gram.y"
     {
       current_class = unknown_sym;
       current_type = NULL;
     }
     break;
 
-  case 43:
-#line 309 "../../src/parse-gram.y"
+  case 45:
+#line 325 "parse-gram.y"
     {
       symbol_list *list;
       for (list = (yyvsp[(3) - (3)].list); list; list = list->next)
@@ -1961,8 +1989,8 @@ yyreduce:
     }
     break;
 
-  case 44:
-#line 319 "../../src/parse-gram.y"
+  case 46:
+#line 335 "parse-gram.y"
     {
       symbol_list *list;
       ++current_prec;
@@ -1976,58 +2004,58 @@ yyreduce:
     }
     break;
 
-  case 45:
-#line 333 "../../src/parse-gram.y"
+  case 47:
+#line 349 "parse-gram.y"
     { (yyval.assoc) = left_assoc; }
     break;
 
-  case 46:
-#line 334 "../../src/parse-gram.y"
+  case 48:
+#line 350 "parse-gram.y"
     { (yyval.assoc) = right_assoc; }
     break;
 
-  case 47:
-#line 335 "../../src/parse-gram.y"
+  case 49:
+#line 351 "parse-gram.y"
     { (yyval.assoc) = non_assoc; }
     break;
 
-  case 48:
-#line 339 "../../src/parse-gram.y"
+  case 50:
+#line 355 "parse-gram.y"
     { current_type = NULL; }
     break;
 
-  case 49:
-#line 340 "../../src/parse-gram.y"
+  case 51:
+#line 356 "parse-gram.y"
     { current_type = (yyvsp[(1) - (1)].uniqstr); }
     break;
 
-  case 50:
-#line 345 "../../src/parse-gram.y"
+  case 52:
+#line 361 "parse-gram.y"
     { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - 
(1)])); }
     break;
 
-  case 51:
-#line 346 "../../src/parse-gram.y"
+  case 53:
+#line 362 "parse-gram.y"
     { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) 
- (2)].symbol), (yylsp[(2) - (2)])); }
     break;
 
-  case 52:
-#line 352 "../../src/parse-gram.y"
+  case 54:
+#line 368 "parse-gram.y"
     {
        current_type = (yyvsp[(1) - (1)].uniqstr);
      }
     break;
 
-  case 53:
-#line 356 "../../src/parse-gram.y"
+  case 55:
+#line 372 "parse-gram.y"
     {
        symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) 
- (1)]), true);
        symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - 
(1)]));
      }
     break;
 
-  case 54:
-#line 361 "../../src/parse-gram.y"
+  case 56:
+#line 377 "parse-gram.y"
     {
       symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - 
(2)]), true);
       symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - 
(2)]));
@@ -2035,8 +2063,8 @@ yyreduce:
     }
     break;
 
-  case 55:
-#line 367 "../../src/parse-gram.y"
+  case 57:
+#line 383 "parse-gram.y"
     {
       symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - 
(2)]), true);
       symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - 
(2)]));
@@ -2044,8 +2072,8 @@ yyreduce:
     }
     break;
 
-  case 56:
-#line 373 "../../src/parse-gram.y"
+  case 58:
+#line 389 "parse-gram.y"
     {
       symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - 
(3)]), true);
       symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - 
(3)]));
@@ -2054,84 +2082,84 @@ yyreduce:
     }
     break;
 
-  case 63:
-#line 403 "../../src/parse-gram.y"
+  case 65:
+#line 419 "parse-gram.y"
     {
       yyerrok;
     }
     break;
 
-  case 64:
-#line 409 "../../src/parse-gram.y"
+  case 66:
+#line 425 "parse-gram.y"
     { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = 
(yylsp[(1) - (1)]); }
     break;
 
-  case 66:
-#line 413 "../../src/parse-gram.y"
+  case 68:
+#line 429 "parse-gram.y"
     { grammar_current_rule_end ((yylsp[(1) - (1)])); }
     break;
 
-  case 67:
-#line 414 "../../src/parse-gram.y"
+  case 69:
+#line 430 "parse-gram.y"
     { grammar_current_rule_end ((yylsp[(3) - (3)])); }
     break;
 
-  case 69:
-#line 420 "../../src/parse-gram.y"
+  case 71:
+#line 436 "parse-gram.y"
     { grammar_current_rule_begin (current_lhs, current_lhs_location); }
     break;
 
-  case 70:
-#line 422 "../../src/parse-gram.y"
+  case 72:
+#line 438 "parse-gram.y"
     { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), 
(yylsp[(2) - (2)])); }
     break;
 
-  case 71:
-#line 424 "../../src/parse-gram.y"
+  case 73:
+#line 440 "parse-gram.y"
     { grammar_current_rule_action_append (gram_last_string,
                                          gram_last_braced_code_loc); }
     break;
 
-  case 72:
-#line 427 "../../src/parse-gram.y"
+  case 74:
+#line 443 "parse-gram.y"
     { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - 
(3)])); }
     break;
 
-  case 73:
-#line 429 "../../src/parse-gram.y"
+  case 75:
+#line 445 "parse-gram.y"
     { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - 
(3)])); }
     break;
 
-  case 74:
-#line 431 "../../src/parse-gram.y"
+  case 76:
+#line 447 "parse-gram.y"
     { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - 
(3)])); }
     break;
 
-  case 75:
-#line 435 "../../src/parse-gram.y"
+  case 77:
+#line 451 "parse-gram.y"
     { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
     break;
 
-  case 76:
-#line 436 "../../src/parse-gram.y"
+  case 78:
+#line 452 "parse-gram.y"
     { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); }
     break;
 
-  case 77:
-#line 442 "../../src/parse-gram.y"
+  case 79:
+#line 458 "parse-gram.y"
     {
       (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) 
- (1)].chars)), (yylsp[(1) - (1)]));
       symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false);
     }
     break;
 
-  case 78:
-#line 451 "../../src/parse-gram.y"
+  case 80:
+#line 467 "parse-gram.y"
     { (yyval.chars) = (yyvsp[(1) - (1)].chars); }
     break;
 
-  case 80:
-#line 458 "../../src/parse-gram.y"
+  case 82:
+#line 474 "parse-gram.y"
     {
       muscle_code_grow ("epilogue", translate_code ((yyvsp[(2) - (2)].chars), 
(yylsp[(2) - (2)])), (yylsp[(2) - (2)]));
       gram_scanner_last_string_free ();
@@ -2139,8 +2167,8 @@ yyreduce:
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 2144 "../../src/parse-gram.c"
+/* Line 1274 of yacc.c.  */
+#line 2172 "parse-gram.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2360,7 +2388,7 @@ yyreturn:
 }
 
 
-#line 464 "../../src/parse-gram.y"
+#line 480 "parse-gram.y"
 
 
 
Index: src/parse-gram.h
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.h,v
retrieving revision 1.96
diff -p -u -r1.96 parse-gram.h
--- src/parse-gram.h    6 Jun 2006 16:40:06 -0000       1.96
+++ src/parse-gram.h    16 Jun 2006 03:55:58 -0000
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 2.1b.  */
+/* A Bison parser, made by GNU Bison 2.3+.  */
 
 /* Skeleton interface for Bison's Yacc-like parsers in C
 
@@ -33,6 +33,7 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
@@ -63,32 +64,34 @@
      PERCENT_EXPECT_RR = 278,
      PERCENT_FILE_PREFIX = 279,
      PERCENT_GLR_PARSER = 280,
-     PERCENT_INITIAL_ACTION = 281,
-     PERCENT_LEX_PARAM = 282,
-     PERCENT_LOCATIONS = 283,
-     PERCENT_NAME_PREFIX = 284,
-     PERCENT_NO_DEFAULT_PREC = 285,
-     PERCENT_NO_LINES = 286,
-     PERCENT_NONDETERMINISTIC_PARSER = 287,
-     PERCENT_OUTPUT = 288,
-     PERCENT_PARSE_PARAM = 289,
-     PERCENT_PURE_PARSER = 290,
-     PERCENT_REQUIRE = 291,
-     PERCENT_SKELETON = 292,
-     PERCENT_START = 293,
-     PERCENT_TOKEN_TABLE = 294,
-     PERCENT_VERBOSE = 295,
-     PERCENT_YACC = 296,
-     TYPE = 297,
-     EQUAL = 298,
-     SEMICOLON = 299,
-     PIPE = 300,
-     ID = 301,
-     ID_COLON = 302,
-     PERCENT_PERCENT = 303,
-     PROLOGUE = 304,
-     EPILOGUE = 305,
-     BRACED_CODE = 306
+     PERCENT_PRE_DEFINES = 281,
+     PERCENT_POST_DEFINES = 282,
+     PERCENT_INITIAL_ACTION = 283,
+     PERCENT_LEX_PARAM = 284,
+     PERCENT_LOCATIONS = 285,
+     PERCENT_NAME_PREFIX = 286,
+     PERCENT_NO_DEFAULT_PREC = 287,
+     PERCENT_NO_LINES = 288,
+     PERCENT_NONDETERMINISTIC_PARSER = 289,
+     PERCENT_OUTPUT = 290,
+     PERCENT_PARSE_PARAM = 291,
+     PERCENT_PURE_PARSER = 292,
+     PERCENT_REQUIRE = 293,
+     PERCENT_SKELETON = 294,
+     PERCENT_START = 295,
+     PERCENT_TOKEN_TABLE = 296,
+     PERCENT_VERBOSE = 297,
+     PERCENT_YACC = 298,
+     TYPE = 299,
+     EQUAL = 300,
+     SEMICOLON = 301,
+     PIPE = 302,
+     ID = 303,
+     ID_COLON = 304,
+     PERCENT_PERCENT = 305,
+     PROLOGUE = 306,
+     EPILOGUE = 307,
+     BRACED_CODE = 308
    };
 #endif
 /* Tokens.  */
@@ -116,39 +119,41 @@
 #define PERCENT_EXPECT_RR 278
 #define PERCENT_FILE_PREFIX 279
 #define PERCENT_GLR_PARSER 280
-#define PERCENT_INITIAL_ACTION 281
-#define PERCENT_LEX_PARAM 282
-#define PERCENT_LOCATIONS 283
-#define PERCENT_NAME_PREFIX 284
-#define PERCENT_NO_DEFAULT_PREC 285
-#define PERCENT_NO_LINES 286
-#define PERCENT_NONDETERMINISTIC_PARSER 287
-#define PERCENT_OUTPUT 288
-#define PERCENT_PARSE_PARAM 289
-#define PERCENT_PURE_PARSER 290
-#define PERCENT_REQUIRE 291
-#define PERCENT_SKELETON 292
-#define PERCENT_START 293
-#define PERCENT_TOKEN_TABLE 294
-#define PERCENT_VERBOSE 295
-#define PERCENT_YACC 296
-#define TYPE 297
-#define EQUAL 298
-#define SEMICOLON 299
-#define PIPE 300
-#define ID 301
-#define ID_COLON 302
-#define PERCENT_PERCENT 303
-#define PROLOGUE 304
-#define EPILOGUE 305
-#define BRACED_CODE 306
+#define PERCENT_PRE_DEFINES 281
+#define PERCENT_POST_DEFINES 282
+#define PERCENT_INITIAL_ACTION 283
+#define PERCENT_LEX_PARAM 284
+#define PERCENT_LOCATIONS 285
+#define PERCENT_NAME_PREFIX 286
+#define PERCENT_NO_DEFAULT_PREC 287
+#define PERCENT_NO_LINES 288
+#define PERCENT_NONDETERMINISTIC_PARSER 289
+#define PERCENT_OUTPUT 290
+#define PERCENT_PARSE_PARAM 291
+#define PERCENT_PURE_PARSER 292
+#define PERCENT_REQUIRE 293
+#define PERCENT_SKELETON 294
+#define PERCENT_START 295
+#define PERCENT_TOKEN_TABLE 296
+#define PERCENT_VERBOSE 297
+#define PERCENT_YACC 298
+#define TYPE 299
+#define EQUAL 300
+#define SEMICOLON 301
+#define PIPE 302
+#define ID 303
+#define ID_COLON 304
+#define PERCENT_PERCENT 305
+#define PROLOGUE 306
+#define EPILOGUE 307
+#define BRACED_CODE 308
 
 
 
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 95 "../../src/parse-gram.y"
+#line 95 "parse-gram.y"
 {
   symbol *symbol;
   symbol_list *list;
@@ -157,8 +162,8 @@ typedef union YYSTYPE
   assoc assoc;
   uniqstr uniqstr;
 }
-/* Line 1529 of yacc.c.  */
-#line 162 "../../src/parse-gram.h"
+/* Line 1544 of yacc.c.  */
+#line 167 "parse-gram.h"
        YYSTYPE;
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
@@ -181,3 +186,4 @@ typedef struct YYLTYPE
 #endif
 
 
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]