* data/glr.c, data/glr.cc, data/lalr1.cc, data/yacc.c:

Allow multiple %union directives, whose contents concatenate.
* src/parse-gram.y (grammar_declaration): Likewise.
Use muscle_code_grow, so that we don't need stype_line any more.
All uses changed.
This commit is contained in:
Paul Eggert
2006-01-03 20:25:54 +00:00
parent ff5150d9a4
commit 1221b78adb
6 changed files with 45 additions and 21 deletions

View File

@@ -173,10 +173,11 @@ m4_define([b4_shared_declarations],
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
[typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])
b4_stype
/* Line __line__ of glr.c. */
b4_syncline([@oline@], [@ofile@])],
b4_syncline([@oline@], [@ofile@])
YYSTYPE;],
[typedef int YYSTYPE;])[
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1

View File

@@ -296,10 +296,11 @@ namespace yy
/// Symbol semantic values.
#if ! defined (YYSTYPE)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_file_name])
union semantic_type b4_stype;
[ union semantic_type
b4_stype
/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])],
b4_syncline([@oline@], [@ofile@])
;],
[ typedef int semantic_type;])[
#else
typedef YYSTYPE semantic_type;

View File

@@ -2,7 +2,7 @@ m4_divert(-1)
# C++ skeleton for Bison
# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
# Copyright (C) 2002, 2003, 2004, 2005, 2006 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
@@ -30,7 +30,7 @@ m4_divert(0)dnl
m4_if(b4_defines_flag, 0, [],
[@output @output_header_name@
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
[2002, 2003, 2004, 2005])
[2002, 2003, 2004, 2005, 2006])
dnl FIXME: This is wrong, we want computed header guards.
[
/* C++ LALR(1) parser skeleton written by Akim Demaille. */
@@ -104,10 +104,11 @@ namespace yy
/// Symbol semantic values.
#if ! defined (YYSTYPE)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_file_name])
union semantic_type b4_stype;
[ union semantic_type
b4_stype
/* Line __line__ of lalr1.cc. */
b4_syncline([@oline@], [@ofile@])],
b4_syncline([@oline@], [@ofile@])
;],
[ typedef int semantic_type;])[
#else
typedef YYSTYPE semantic_type;
@@ -295,7 +296,7 @@ b4_error_verbose_if([, int tok])[);
])dnl
@output @output_parser_name@
b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison],
[2002, 2003, 2004, 2005])
[2002, 2003, 2004, 2005, 2006])
m4_if(b4_prefix[], [yy], [],
[
// Take the name prefix into account.
@@ -1048,7 +1049,8 @@ b4_error_verbose_if([, int tok])[)
]b4_epilogue
dnl
@output b4_dir_prefix[]stack.hh
b4_copyright([stack handling for Bison C++ parsers], [2002, 2003, 2004, 2005])[
b4_copyright([stack handling for Bison C++ parsers],
[2002, 2003, 2004, 2005, 2006])[
#ifndef BISON_STACK_HH
# define BISON_STACK_HH

View File

@@ -189,10 +189,11 @@ b4_location_if([#define yylloc b4_prefix[]lloc])])[
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
]m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
[typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])
b4_stype
/* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])],
b4_syncline([@oline@], [@ofile@])
YYSTYPE;],
[typedef int YYSTYPE;])[
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -1508,10 +1509,11 @@ b4_token_enums_defines(b4_tokens)
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
m4_ifdef([b4_stype],
[b4_syncline([b4_stype_line], [b4_file_name])
typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])b4_stype YYSTYPE;
[typedef union m4_bregexp(b4_stype, [^{], [YYSTYPE ])
b4_stype
/* Line __line__ of yacc.c. */
b4_syncline([@oline@], [@ofile@])],
b4_syncline([@oline@], [@ofile@])
YYSTYPE;],
[typedef int YYSTYPE;])
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1