Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: use the generalized default yylex.
  tests: AT_YYERROR_DEFINE: prepare for list of ints.
  skeletons: no longer define YYLSP_NEEDED.
  c++: do not export YYTOKEN_TABLE and YYERROR_VERBOSE.

Conflicts:
	data/c.m4
	data/glr.cc
	data/lalr1.cc
	doc/bison.texi
	tests/regression.at
This commit is contained in:
Akim Demaille
2012-06-28 15:29:18 +02:00
15 changed files with 95 additions and 176 deletions

View File

@@ -317,9 +317,9 @@ m4_define([b4_define_flag_if],
# _b4_define_flag_if($1, $2, FLAG)
# --------------------------------
# This macro works around the impossibility to define macros
# inside macros, because issuing `[$1]' is not possible in M4 :(.
# This sucks hard, GNU M4 should really provide M5 like $$1.
# Work around the impossibility to define macros inside macros,
# because issuing `[$1]' is not possible in M4. GNU M4 should provide
# $$1 a la M5/TeX.
m4_define([_b4_define_flag_if],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
@@ -333,8 +333,12 @@ m4_define([b4_$3_if],
b4_define_flag_if([defines]) # Whether headers are requested.
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
# yytoken_table is needed to support verbose errors.
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
## --------- ##
## Symbols. ##

View File

@@ -100,9 +100,6 @@ m4_define([b4_identification],
/* Pull parsers. */
#define YYPULL ]b4_pull_flag])[
/* Using locations. */
#define YYLSP_NEEDED ]b4_locations_if([1], [0])[
]])

View File

@@ -223,11 +223,6 @@ b4_percent_code_get([[top]])[
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
/* Default (constant) value used for initialization for null
right-hand sides. Unlike the standard yacc.c template,
here we set the default value of $$ to a zeroed-out value.
@@ -362,7 +357,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
#if YYDEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =

View File

@@ -236,9 +236,6 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
]b4_percent_define_ifdef([[location_type]], [],
[[#include "location.hh"]])[
/* Using locations. */
#define YYLSP_NEEDED ]b4_locations_if([1], [0])[
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG ]b4_parse_trace_if([1], [0])[

View File

@@ -167,19 +167,6 @@ b4_namespace_close])[
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
]b4_namespace_open[
/// A Bison parser.
@@ -244,18 +231,16 @@ b4_namespace_close])[
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
/* Tables. */
]b4_parser_tables_declare[
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/// For a symbol, its name in clear.
static const char* const yytname_[];
#endif]b4_error_verbose_if([
// Tables.
]b4_parser_tables_declare[]b4_error_verbose_if([
/// Convert the symbol name \a n to a form suitable for a diagnostic.
static std::string yytnamerr_ (const char *n);])[
#if YYDEBUG
]b4_token_table_if([], [[#if YYDEBUG]])[
/// For a symbol, its name in clear.
static const char* const yytname_[];
]b4_token_table_if([[#if YYDEBUG]])[
]b4_integral_parser_table_declare([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
/// Report on the debug stream that the rule \a r is going to be reduced.
@@ -263,10 +248,10 @@ b4_namespace_close])[
/// Print the state stack on the debug stream.
virtual void yystack_print_ ();
/* Debugging. */
// Debugging.
int yydebug_;
std::ostream* yycdebug_;
#endif
#endif // YYDEBUG
/// Convert a scanner token number \a t to a symbol number.
static inline token_number_type yytranslate_ (]b4_lex_symbol_if([token_type], [int])[ t);
@@ -654,7 +639,7 @@ b4_percent_code_get[]dnl
{
yydebug_ = l;
}
#endif
#endif // YYDEBUG
inline ]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
@@ -1099,7 +1084,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
]b4_parser_tables_define[
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
]b4_token_table_if([], [[#if YYDEBUG]])[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
const char*
@@ -1107,9 +1092,8 @@ b4_error_verbose_if([state_type yystate, int yytoken],
{
]b4_tname[
};
#endif
#if YYDEBUG
]b4_token_table_if([[#if YYDEBUG]])[
]b4_integral_parser_table_define([rline], [b4_rline])[
// Print the state stack on the debug stream.

View File

@@ -337,11 +337,6 @@ m4_if(b4_prefix, [yy], [],
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE ]b4_token_table[
#endif
/* In a future release of Bison, this section will be replaced
by #include "@basename(]b4_spec_defines_file[@)". */
]b4_shared_declarations[
@@ -594,7 +589,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
#endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
#if YYDEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =