mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* 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:
@@ -1,5 +1,13 @@
|
||||
2006-01-03 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* 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.
|
||||
|
||||
* src/muscle_tab.c (muscle_grow): Fix comment.
|
||||
|
||||
* ChangeLog, data/c.m4, data/glr.c, data/glr.cc, data/location.cc:
|
||||
* data/yacc.c, src/getargs.c, src/output.c, tests/cxx-type.at:
|
||||
Update copyright year to 2006.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
14
data/yacc.c
14
data/yacc.c
@@ -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
|
||||
|
||||
@@ -247,9 +247,19 @@ grammar_declaration:
|
||||
}
|
||||
| "%union {...}"
|
||||
{
|
||||
char const *body = $1;
|
||||
|
||||
if (typed)
|
||||
{
|
||||
/* Concatenate the union bodies, turning the first one's
|
||||
trailing '}' into '\n', and omitting the second one's '{'. */
|
||||
char *code = muscle_find ("stype");
|
||||
code[strlen (code) - 1] = '\n';
|
||||
body++;
|
||||
}
|
||||
|
||||
typed = true;
|
||||
MUSCLE_INSERT_INT ("stype_line", @1.start.line);
|
||||
muscle_insert ("stype", $1);
|
||||
muscle_code_grow ("stype", body, @1);
|
||||
}
|
||||
| "%destructor {...}" symbols.1
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user