2006-10-16 Paolo Bonzini <bonzini@gnu.org>

* data/bison.m4 (b4_user_requires, b4_user_provides): New.
	(b4_user_start_header): Remove.
	* data/glr.c: Use new macros instead of b4_*start_header
	and b4_*end_header.
	* data/glr.cc: Likewise.
	* data/lalr1.cc: Likewise.
	* data/push.c: Likewise.
	* data/yacc.c: Likewise.

	* doc/bison.texinfo: Remove %before-header, rename
	%{start,end,after}-header to %requires, %provides, %code.

	* src/parse-gram.y: Likewise (also rename token names accordingly).
	* src/scan-gram.l: Likewise.
	* tests/actions.at: Likewise.
This commit is contained in:
Paolo Bonzini
2006-10-15 12:37:07 +00:00
parent 10f429ef19
commit 136a0f766b
13 changed files with 887 additions and 776 deletions

View File

@@ -178,14 +178,18 @@ m4_define([b4_define_user_code],
# b4_user_actions
# b4_user_initial_action
# b4_user_post_prologue
# b4_user_start_header
# b4_user_pre_prologue
# b4_user_provides
# b4_user_requires
# b4_user_stype
# ----------------------
# Macros that issue user code, ending with synclines.
b4_define_user_code([actions])
b4_define_user_code([initial_action])
b4_define_user_code([post_prologue])
b4_define_user_code([start_header])
b4_define_user_code([pre_prologue])
b4_define_user_code([provides])
b4_define_user_code([requires])
b4_define_user_code([stype])

View File

@@ -162,16 +162,16 @@ m4_if(b4_prefix, [yy], [],
#define yylloc b4_prefix[]lloc])[
/* Copy the first part of user declarations. */
]b4_pre_prologue
]b4_user_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],
[m4_ifdef([b4_start_header],
[[/* Copy the %start-header blocks. */
]b4_start_header])[]dnl
[m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[]dnl
b4_token_enums(b4_tokens)
@@ -202,9 +202,9 @@ typedef struct YYLTYPE
# define YYLTYPE_IS_TRIVIAL 1
#endif
]m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
]m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
])
b4_defines_if([#include @output_header_name@],

View File

@@ -225,9 +225,9 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H
]m4_ifdef([b4_start_header],
[[/* Copy the %start-header blocks. */
]b4_user_start_header])[
]m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[
#include <string>
#include <iostream>
@@ -373,8 +373,8 @@ m4_ifset([b4_global_tokens_and_yystype],
}
]m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
]m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
[#endif /* ! defined PARSER_HEADER_H */]

View File

@@ -43,9 +43,9 @@ dnl FIXME: This is wrong, we want computed header guards.
#ifndef PARSER_HEADER_H
# define PARSER_HEADER_H
]m4_ifdef([b4_start_header],
[[/* Copy the %start-header blocks. */
]b4_user_start_header])[
]m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[
#include <string>
#include <iostream>
@@ -295,9 +295,9 @@ b4_error_verbose_if([, int tok])[);
# define YYSTYPE b4_namespace::b4_parser_class_name::semantic_type
#endif
])
m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
[#endif /* ! defined PARSER_HEADER_H */]
])dnl
@@ -310,7 +310,7 @@ m4_if(b4_prefix, [yy], [],
#define yylex b4_prefix[]lex])[
/* First part of user declarations. */
]b4_pre_prologue
]b4_user_pre_prologue
b4_defines_if([
#include @output_header_name@])[

View File

@@ -168,7 +168,7 @@ b4_push_if([
#define yylloc_set b4_prefix[]lloc_set])])[
/* Copy the first part of user declarations. */
]b4_pre_prologue[
]b4_user_pre_prologue[
/* Enabling traces. */
#ifndef YYDEBUG
@@ -188,9 +188,9 @@ b4_push_if([
# define YYTOKEN_TABLE ]b4_token_table[
#endif
]m4_ifdef([b4_start_header],
[[/* Copy the %start-header blocks. */
]b4_start_header])[]dnl
]m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[]dnl
b4_token_enums_defines(b4_tokens)[
@@ -220,9 +220,9 @@ typedef struct YYLTYPE
# define YYLTYPE_IS_TRIVIAL 1
#endif])
m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
[/* Copy the second part of user declarations. */
]b4_user_post_prologue[
@@ -1710,9 +1710,9 @@ 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
m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[]dnl
b4_token_enums_defines(b4_tokens)
@@ -1752,7 +1752,7 @@ enum { YYPUSH_MORE = 4 };])[
[extern YYLTYPE b4_prefix[]lloc;])
)dnl b4_locations_if
m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
])dnl b4_defines_if

View File

@@ -161,7 +161,7 @@ m4_if(b4_prefix, [yy], [],
b4_locations_if([#define yylloc b4_prefix[]lloc])])[
/* Copy the first part of user declarations. */
]b4_pre_prologue[
]b4_user_pre_prologue[
/* Enabling traces. */
#ifndef YYDEBUG
@@ -181,9 +181,9 @@ 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
]m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[]dnl
b4_token_enums_defines(b4_tokens)[
@@ -213,9 +213,9 @@ typedef struct YYLTYPE
# define YYLTYPE_IS_TRIVIAL 1
#endif])
m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
[/* Copy the second part of user declarations. */
]b4_user_post_prologue[
@@ -1489,9 +1489,9 @@ 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
m4_ifdef([b4_requires],
[[/* Copy the %requires blocks. */
]b4_user_requires])[]dnl
b4_token_enums_defines(b4_tokens)
@@ -1529,7 +1529,7 @@ typedef struct YYLTYPE
[extern YYLTYPE b4_prefix[]lloc;])
)dnl b4_locations_if
m4_ifdef([b4_end_header],
[[/* Copy the %end-header blocks. */
]b4_end_header])[]dnl
m4_ifdef([b4_provides],
[[/* Copy the %provides blocks. */
]b4_user_provides])[]dnl
])dnl b4_defines_if