Merge remote-tracking branch 'origin/maint'

* origin/maint:
  maint: update release instructions
  maint: post-release administrivia
  version 2.5.90
  build: fix gen-ChangeLog call.
  gnulib: update.
  tests: fix SKIP_IF for Java.
  api.prefix: incompatible with %name-prefix.
  api.prefix: strengthen the tests and fix push-parsers.
  skeletons: style changes.
  NEWS: minor changes.
  api.prefix: improve the documentation for YYDEBUG.
  gnulib: update.

Conflicts:
	NEWS
	cfg.mk
	data/bison.m4
	doc/bison.texi
	m4/.gitignore
	tests/calc.at
	tests/headers.at
This commit is contained in:
Akim Demaille
2012-07-06 10:58:26 +02:00
15 changed files with 226 additions and 119 deletions

View File

@@ -1 +1 @@
2.5.1 2.5.90

View File

@@ -88,13 +88,14 @@ update-package-copyright-year:
gen_start_date = 2012-01-16 gen_start_date = 2012-01-16
.PHONY: gen-ChangeLog .PHONY: gen-ChangeLog
gen-ChangeLog: gen-ChangeLog:
$(AM_V_GEN)if test -d $(srcdir)/.git; then \ $(AM_V_GEN)if test -d $(srcdir)/.git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \ cl=$(distdir)/ChangeLog && \
--strip-tab \ rm -f $$cl.tmp && \
--strip-cherry-picked \ $(top_srcdir)/build-aux/gitlog-to-changelog \
--no-cluster \ --strip-tab \
--amend=$(srcdir)/build-aux/git-log-fix \ --strip-cherry-pick \
--since=$(gen_start_date) > $(distdir)/cl-t; \ --no-cluster \
rm -f $(distdir)/ChangeLog; \ --amend=$(srcdir)/build-aux/git-log-fix \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \ --since=$(gen_start_date) > $$cl.tmp && \
mv -f $$cl.tmp $$cl; \
fi fi

5
NEWS
View File

@@ -121,7 +121,8 @@ GNU Bison NEWS
* Noteworthy changes in release ?.? (????-??-??) [?] * Noteworthy changes in release ?.? (????-??-??) [?]
** Future changes
* Noteworthy changes in release 2.5.90 (2012-07-05) [beta]
The next major release of Bison will drop support for the following The next major release of Bison will drop support for the following
deprecated features. Please report disagreements to bug-bison@gnu.org. deprecated features. Please report disagreements to bug-bison@gnu.org.
@@ -151,7 +152,7 @@ GNU Bison NEWS
because existing versions of ylwrap (e.g., Automake 1.12.1) do not support because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
it. it.
** Headers ** Generated Parser Headers
*** Guards (yacc.c, glr.c, glr.cc) *** Guards (yacc.c, glr.c, glr.cc)

View File

@@ -259,7 +259,10 @@ that the skeletons insert into generated parsers, and check all
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac. occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
** Update NEWS, commit and tag. ** Update NEWS, commit and tag.
See do-release-commit-and-tag in README-release. See do-release-commit-and-tag in README-release. For a while, we used
beta names such as "2.6_rc1". Now that we use gnulib in the release
procedure, we must use "2.5.90", which has the additional benefit of
being properly sorted in "git tag -l".
** make alpha, beta, or stable ** make alpha, beta, or stable
See README-release. See README-release.

View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Print a version string. # Print a version string.
scriptversion=2012-05-15.06; # UTC scriptversion=2012-07-03.20; # UTC
# Bootstrap this package from checked-out sources. # Bootstrap this package from checked-out sources.
@@ -215,7 +215,7 @@ find_tool ()
eval "export $find_tool_envvar" eval "export $find_tool_envvar"
} }
# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6. # Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary. # Override the default configuration, if necessary.
@@ -230,7 +230,6 @@ esac
test -z "${gnulib_extra_files}" && \ test -z "${gnulib_extra_files}" && \
gnulib_extra_files=" gnulib_extra_files="
$build_aux/install-sh $build_aux/install-sh
$build_aux/missing
$build_aux/mdate-sh $build_aux/mdate-sh
$build_aux/texinfo.tex $build_aux/texinfo.tex
$build_aux/depcomp $build_aux/depcomp
@@ -855,7 +854,8 @@ echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules && $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
for file in $gnulib_files; do for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file || exit symlink_to_dir "$GNULIB_SRCDIR" $file \
|| { echo "$0: failed to symlink $file" 1>&2; exit 1; }
done done
bootstrap_post_import_hook \ bootstrap_post_import_hook \
@@ -896,7 +896,8 @@ for file in $gnulib_extra_files; do
build-aux/*) dst=$build_aux/${file#build-aux/};; build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;; *) dst=$file;;
esac esac
symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|| { echo "$0: failed to symlink $file" 1>&2; exit 1; }
done done
if test $with_gettext = yes; then if test $with_gettext = yes; then

2
cfg.mk
View File

@@ -66,5 +66,5 @@ $(call exclude, \
prohibit_strcmp=^doc/bison\.texinfo$$ \ prohibit_strcmp=^doc/bison\.texinfo$$ \
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \ require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
space_tab=^tests/(input|c\+\+)\.at$$ \ space_tab=^tests/(input|c\+\+)\.at$$ \
unmarked_diagnostics=^djgpp/ \ unmarked_diagnostics=^(djgpp/|doc/bison.texi$$) \
) )

View File

@@ -186,21 +186,6 @@ m4_define([b4_fatal_at],
m4_exit(1)]) m4_exit(1)])
## ---------------- ##
## Default values. ##
## ---------------- ##
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
m4_define_default([b4_pre_prologue], [])
m4_define_default([b4_post_prologue], [])
m4_define_default([b4_epilogue], [])
m4_define_default([b4_parse_param], [])
# The initial column and line.
m4_define_default([b4_location_initial_column], [1])
m4_define_default([b4_location_initial_line], [1])
## ------------ ## ## ------------ ##
## Data Types. ## ## Data Types. ##
## ------------ ## ## ------------ ##
@@ -822,3 +807,26 @@ m4_wrap_lifo([
b4_check_user_names_wrap([[define]], [[variable]]) b4_check_user_names_wrap([[define]], [[variable]])
b4_check_user_names_wrap([[code]], [[qualifier]]) b4_check_user_names_wrap([[code]], [[qualifier]])
]) ])
## ---------------- ##
## Default values. ##
## ---------------- ##
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
m4_define_default([b4_pre_prologue], [])
m4_define_default([b4_post_prologue], [])
m4_define_default([b4_epilogue], [])
m4_define_default([b4_parse_param], [])
# The initial column and line.
m4_define_default([b4_location_initial_column], [1])
m4_define_default([b4_location_initial_line], [1])
# Sanity checks.
b4_percent_define_ifdef([api.prefix],
[m4_ifdef([b4_prefix],
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
[['%s' and '%s' cannot be used together]],
[%name-prefix],
[%define api.prefix])])])

View File

@@ -232,22 +232,27 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
# Declaration of yyparse (and dependencies) when using the push parser # Declaration of yyparse (and dependencies) when using the push parser
# (including in pull mode). # (including in pull mode).
m4_define([b4_declare_yyparse_push_], m4_define([b4_declare_yyparse_push_],
[[typedef struct ]b4_prefix[pstate ]b4_prefix[pstate; [[#ifndef YYPUSH_MORE_DEFINED
# define YYPUSH_MORE_DEFINED
enum { YYPUSH_MORE = 4 }; enum { YYPUSH_MORE = 4 };
#endif
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param) ]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
])b4_c_function_decl([b4_prefix[push_parse]], [[int]], ])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
[[b4_prefix[pstate *yyps]], [[yyps]]]b4_pure_if([, [[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
[[[int yypushed_char]], [[yypushed_char]]], [[[int pushed_char]], [[pushed_char]]],
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([, [[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [, [[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
b4_parse_param])) b4_parse_param]))
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]], b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
[[b4_prefix[pstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [, [[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
b4_parse_param]))]) b4_parse_param]))])
b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]], b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
[[[void]], []]) [[[void]], []])
b4_c_function_decl([b4_prefix[pstate_delete]], [[void]], b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
[[b4_prefix[pstate *yyps]], [[yyps]]])dnl [[b4_prefix[pstate *ps]], [[ps]]])dnl
]) ])
# b4_declare_yyparse_ # b4_declare_yyparse_

View File

@@ -5156,7 +5156,7 @@ default location or at the location specified by @var{qualifier}.
@end deffn @end deffn
@deffn {Directive} %debug @deffn {Directive} %debug
Instrument the output parser for traces. Obsoleted by @samp{%define Instrument the parser for traces. Obsoleted by @samp{%define
parse.trace}. parse.trace}.
@xref{Tracing, ,Tracing Your Parser}. @xref{Tracing, ,Tracing Your Parser}.
@end deffn @end deffn
@@ -5465,6 +5465,8 @@ The parser namespace is @code{foo} and @code{yylex} is referenced as
@item Accepted Values: String @item Accepted Values: String
@item Default Value: @code{yy} @item Default Value: @code{yy}
@item History: introduced in Bison 2.6
@end itemize @end itemize
@c ================================================== api.pure @c ================================================== api.pure
@@ -5690,12 +5692,16 @@ syntax error handling. @xref{LAC}.
@findex %define parse.trace @findex %define parse.trace
@itemize @itemize
@item Languages(s): C, C++ @item Languages(s): C, C++, Java
@item Purpose: Require parser instrumentation for tracing. @item Purpose: Require parser instrumentation for tracing.
In C/C++, define the macro @code{YYDEBUG} to 1 in the parser implementation @xref{Tracing, ,Tracing Your Parser}.
In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with
@samp{%define api.prefix @var{prefix}}), see @ref{Multiple Parsers,
,Multiple Parsers in the Same Program}) to 1 in the parser implementation
file if it is not already defined, so that the debugging facilities are file if it is not already defined, so that the debugging facilities are
compiled. @xref{Tracing, ,Tracing Your Parser}. compiled.
@item Accepted Values: Boolean @item Accepted Values: Boolean
@@ -5852,20 +5858,22 @@ also need to avoid conflicts on types and macros (e.g., @code{YYSTYPE})
exported in the generated header. exported in the generated header.
The easy way to do this is to define the @code{%define} variable The easy way to do this is to define the @code{%define} variable
@code{api.prefix} (possibly using the option @code{api.prefix}. With different @code{api.prefix}s it is guaranteed that
@samp{-Dapi.prefix=@var{prefix}}, see @ref{Invocation, ,Invoking Bison}). headers do not conflict when included together, and that compiled objects
This renames the interface functions and variables of the Bison parser to can be linked together too. Specifying @samp{%define api.prefix
start with @var{prefix} instead of @samp{yy}, and all the macros to start by @var{prefix}} (or passing the option @samp{-Dapi.prefix=@var{prefix}}, see
@var{PREFIX} (i.e., @var{prefix} upper cased) instead of @samp{YY}. You can @ref{Invocation, ,Invoking Bison}) renames the interface functions and
use this to give each parser distinct names that do not conflict. variables of the Bison parser to start with @var{prefix} instead of
@samp{yy}, and all the macros to start by @var{PREFIX} (i.e., @var{prefix}
upper-cased) instead of @samp{YY}.
The renamed symbols include @code{yyparse}, @code{yylex}, @code{yyerror}, The renamed symbols include @code{yyparse}, @code{yylex}, @code{yyerror},
@code{yynerrs}, @code{yylval}, @code{yylloc}, @code{yychar} and @code{yynerrs}, @code{yylval}, @code{yylloc}, @code{yychar} and
@code{yydebug}. If you use a push parser, @code{yypush_parse}, @code{yydebug}. If you use a push parser, @code{yypush_parse},
@code{yypull_parse}, @code{yypstate}, @code{yypstate_new} and @code{yypull_parse}, @code{yypstate}, @code{yypstate_new} and
@code{yypstate_delete} will also be renamed. The renamed macros include @code{yypstate_delete} will also be renamed. The renamed macros include
@code{YYSTYPE}, @code{YYSTYPE_IS_TRIVIAL}, @code{YYSTYPE_IS_DECLARED}, @code{YYSTYPE}, @code{YYLTYPE}, and @code{YYDEBUG}, which is treated
@code{YYLTYPE}, @code{YYLTYPE_IS_TRIVIAL}, and @code{YYLTYPE_IS_DECLARED}. specifically --- more about this below.
For example, if you use @samp{%define api.prefix c}, the names become For example, if you use @samp{%define api.prefix c}, the names become
@code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so @code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
@@ -5897,9 +5905,33 @@ extern CSTYPE clval;
int cparse (void); int cparse (void);
@end example @end example
Previously, a similar feature was provided by the obsoleted directive The macro @code{YYDEBUG} is commonly used to enable the tracing support in
@code{%name-prefix} (@pxref{Table of Symbols, ,Bison Symbols}) and option parsers. To comply with this tradition, when @code{api.prefix} is used,
@code{--name-prefix} (@pxref{Bison Options}). @code{YYDEBUG} (not renamed) is used as a default value:
@example
/* Enabling traces. */
#ifndef CDEBUG
# if defined YYDEBUG
# if YYDEBUG
# define CDEBUG 1
# else
# define CDEBUG 0
# endif
# else
# define CDEBUG 0
# endif
#endif
#if CDEBUG
extern int cdebug;
#endif
@end example
@sp 2
Prior to Bison 2.6, a feature similar to @code{api.prefix} was provided by
the obsolete directive @code{%name-prefix} (@pxref{Table of Symbols, ,Bison
Symbols}) and the option @code{--name-prefix} (@pxref{Bison Options}).
@node Interface @node Interface
@chapter Parser C-Language Interface @chapter Parser C-Language Interface
@@ -6015,9 +6047,9 @@ function is available if either the @samp{%define api.push-pull push} or
@xref{Push Decl, ,A Push Parser}. @xref{Push Decl, ,A Push Parser}.
@deftypefun int yypush_parse (yypstate *yyps) @deftypefun int yypush_parse (yypstate *yyps)
The value returned by @code{yypush_parse} is the same as for yyparse with the The value returned by @code{yypush_parse} is the same as for yyparse with
following exception. @code{yypush_parse} will return YYPUSH_MORE if more input the following exception: it returns @code{YYPUSH_MORE} if more input is
is required to finish parsing the grammar. required to finish parsing the grammar.
@end deftypefun @end deftypefun
@node Pull Parser Function @node Pull Parser Function
@@ -8788,9 +8820,17 @@ parser. This is compliant with POSIX Yacc. You could use
YYDEBUG 1} in the prologue of the grammar file (@pxref{Prologue, , The YYDEBUG 1} in the prologue of the grammar file (@pxref{Prologue, , The
Prologue}). Prologue}).
@item the option @option{-t}, @option{--debug} If the @code{%define} variable @code{api.prefix} is used (@xref{Multiple
Use the @samp{-t} option when you run Bison (@pxref{Invocation, Parsers, ,Multiple Parsers in the Same Program}), for instance @samp{%define
,Invoking Bison}). This is POSIX compliant too. api.prefix x}, then if @code{CDEBUG} is defined, its value controls the
tracing feature (enabled iff nonzero); otherwise tracing is enabled iff
@code{YYDEBUG} is nonzero.
@item the option @option{-t} (POSIX Yacc compliant)
@itemx the option @option{--debug} (Bison extension)
Use the @samp{-t} option when you run Bison (@pxref{Invocation, ,Invoking
Bison}). With @samp{%define api.prefix c}, it defines @code{CDEBUG} to 1,
otherwise it defines @code{YYDEBUG} to 1.
@item the directive @samp{%debug} @item the directive @samp{%debug}
@findex %debug @findex %debug

2
gnulib

Submodule gnulib updated: b42157dd01...be2b039116

3
m4/.gitignore vendored
View File

@@ -180,3 +180,6 @@
/xalloc.m4 /xalloc.m4
/xsize.m4 /xsize.m4
/xstrndup.m4 /xstrndup.m4
/off_t.m4
/sys_types_h.m4
/fseterr.m4

View File

@@ -59,7 +59,7 @@ int
]AT_NAME_PREFIX[parse (]AT_PARAM_IF([semantic_value *result, int *count]))[ ]AT_NAME_PREFIX[parse (]AT_PARAM_IF([semantic_value *result, int *count]))[
{ {
]AT_NAME_PREFIX[::parser parser]AT_PARAM_IF([ (result, count)])[; ]AT_NAME_PREFIX[::parser parser]AT_PARAM_IF([ (result, count)])[;
#if YYDEBUG #if ]AT_API_PREFIX[DEBUG
parser.set_debug_level (1); parser.set_debug_level (1);
#endif #endif
return parser.parse (); return parser.parse ();
@@ -113,7 +113,7 @@ static int get_char (]AT_YYLEX_FORMALS[);
static void unget_char (]AT_YYLEX_PRE_FORMALS[ int c); static void unget_char (]AT_YYLEX_PRE_FORMALS[ int c);
]AT_LOCATION_IF([ ]AT_LOCATION_IF([
static YYLTYPE last_yylloc; static AT_YYLTYPE last_yylloc;
])[ ])[
static int static int
get_char (]AT_YYLEX_FORMALS[) get_char (]AT_YYLEX_FORMALS[)
@@ -264,15 +264,11 @@ AT_SKEL_CC_IF(
%code provides %code provides
{ {
#include <stdio.h> #include <stdio.h>
/* The input. */ /* The input. */
extern FILE *input; extern FILE *input;
extern semantic_value global_result; extern semantic_value global_result;
extern int global_count;]AT_SKEL_CC_IF([[ extern int global_count;
#ifndef YYLTYPE
# define YYLTYPE ]AT_NAME_PREFIX[::parser::location_type
#endif
]])[
} }
%code %code
@@ -285,7 +281,7 @@ FILE *input;
static int power (int base, int exponent); static int power (int base, int exponent);
]AT_SKEL_CC_IF(, ]AT_SKEL_CC_IF(,
[static void yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ]) [static void yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
AT_PARAM_IF([semantic_value *result, int *count, ]) AT_PARAM_IF([semantic_value *result, int *count, ])
const char *s const char *s
);])[ );])[
@@ -373,7 +369,7 @@ power (int base, int exponent)
AT_YYERROR_DEFINE], AT_YYERROR_DEFINE],
[/* A C error reporting function. */ [/* A C error reporting function. */
static void static void
yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ]) yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
AT_PARAM_IF([semantic_value *result, int *count, ]) AT_PARAM_IF([semantic_value *result, int *count, ])
const char *s) const char *s)
{ {
@@ -631,16 +627,17 @@ AT_CHECK_CALC_LALR([%define api.pure %locations])
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %locations]) AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %locations])
AT_CHECK_CALC_LALR([%define parse.error verbose %locations]) AT_CHECK_CALC_LALR([%define parse.error verbose %locations])
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %define api.prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_LALR([%debug]) AT_CHECK_CALC_LALR([%debug])
AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
# ----------------------- # # ----------------------- #
@@ -662,6 +659,7 @@ AT_CHECK_CALC_GLR()
AT_CHECK_CALC_GLR([%defines]) AT_CHECK_CALC_GLR([%defines])
AT_CHECK_CALC_GLR([%locations]) AT_CHECK_CALC_GLR([%locations])
AT_CHECK_CALC_GLR([%name-prefix "calc"]) AT_CHECK_CALC_GLR([%name-prefix "calc"])
AT_CHECK_CALC_GLR([%define api.prefix "calc"])
AT_CHECK_CALC_GLR([%verbose]) AT_CHECK_CALC_GLR([%verbose])
AT_CHECK_CALC_GLR([%yacc]) AT_CHECK_CALC_GLR([%yacc])
AT_CHECK_CALC_GLR([%define parse.error verbose]) AT_CHECK_CALC_GLR([%define parse.error verbose])
@@ -673,11 +671,12 @@ AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix
AT_CHECK_CALC_GLR([%debug]) AT_CHECK_CALC_GLR([%debug])
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
# ----------------------------- # # ----------------------------- #
@@ -701,12 +700,14 @@ AT_CHECK_CALC_LALR1_CC([%locations])
AT_CHECK_CALC_LALR1_CC([%locations %define location_type Span]) AT_CHECK_CALC_LALR1_CC([%locations %define location_type Span])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_LALR1_CC([%locations %pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
@@ -729,6 +730,7 @@ m4_define([AT_CHECK_CALC_GLR_CC],
AT_CHECK_CALC_GLR_CC([]) AT_CHECK_CALC_GLR_CC([])
AT_CHECK_CALC_GLR_CC([%define location_type Span]) AT_CHECK_CALC_GLR_CC([%define location_type Span])
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR_CC([%define parse.error verbose %name-prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix "calc" %verbose %yacc])
AT_CHECK_CALC_GLR_CC([%debug]) AT_CHECK_CALC_GLR_CC([%debug])
AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose %yacc]) AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
@@ -737,3 +739,4 @@ AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-pref
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc]) AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %define api.tokens.prefix "TOK_" %verbose %yacc])
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}]) AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
AT_CHECK_CALC_GLR_CC([%pure-parser %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])

View File

@@ -124,15 +124,16 @@ AT_CLEANUP
AT_SETUP([Several parsers]) AT_SETUP([Several parsers])
# AT_DATA_GRAMMAR_SEVERAL([PREFIX], [DIRECTIVES]) # AT_TEST([PREFIX], [DIRECTIVES])
# ----------------------------------------------- # -------------------------------
# Generate and compile to *.o. Make sure there is no YY* nor yy* in # Generate and compile to *.o. Make sure there is no YY* nor yy* in
# the header (but YYDEBUG and YYPARSE_PARAM). # the header (but YYDEBUG and YYPARSE_PARAM).
m4_define([AT_DATA_GRAMMAR_SEVERAL], m4_pushdef([AT_TEST],
[AT_BISON_OPTION_PUSHDEFS([%define api.prefix "$1_" $2]) [AT_BISON_OPTION_PUSHDEFS([%define api.prefix "$1_" $2])
AT_DATA_GRAMMAR([$1.AT_SKEL_CC_IF([yy], [y])], AT_DATA_GRAMMAR([$1.AT_SKEL_CC_IF([yy], [y])],
[[%define api.prefix "$1_" [[%define api.prefix "$1_"
$2 $2
%error-verbose
%union %union
{ {
int integer; int integer;
@@ -150,6 +151,8 @@ exp:
| 'x' '4' { printf ("x4\n"); } | 'x' '4' { printf ("x4\n"); }
| 'x' '5' { printf ("x5\n"); } | 'x' '5' { printf ("x5\n"); }
| 'x' '6' { printf ("x6\n"); } | 'x' '6' { printf ("x6\n"); }
| 'x' '7' { printf ("x7\n"); }
| 'x' '8' { printf ("x8\n"); }
; ;
%% %%
@@ -162,16 +165,21 @@ AT_BISON_CHECK([-d -o AT_SKEL_CC_IF([$1.cc $1.yy], [$1.c $1.y])])
AT_SKEL_CC_IF([], AT_SKEL_CC_IF([],
[AT_CHECK([$EGREP yy $1.h], [1])]) [AT_CHECK([$EGREP yy $1.h], [1])])
# Ignore comments. Ignore YYPARSE_PARAM. YYDEBUG (not renamed) can be # Ignore comments. Ignore YYPARSE_PARAM (obsolete) and
# read, but not changed. # YYPUSH_MORE(_DEFINED)? (whose definition is constant).
#
# YYDEBUG (not renamed) can be read, but not changed.
AT_CHECK([[$PERL -0777 -e 's{/\*.*?\*/}{}sg;s,//.*,,;' \ AT_CHECK([[$PERL -0777 -e 's{/\*.*?\*/}{}sg;s,//.*,,;' \
]$1.AT_SKEL_CC_IF([hh], [h])[ | ]$1.AT_SKEL_CC_IF([hh], [h])[ |
grep 'YY' | grep 'YY' |
$EGREP -wv '(YYPARSE_PARAM|defined YYDEBUG|if YYDEBUG)']], $EGREP -wv 'YY(PARSE_PARAM|PUSH_MORE(_DEFINED)?)|(defined|if) YYDEBUG']],
[1]) [1])
AT_LANG_COMPILE([$1.o]) AT_LANG_COMPILE([$1.o])
AT_CHECK([[echo "$1" >>expout]])
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
]) ])# AT_TEST
AT_DATA([main.cc], AT_DATA([main.cc],
[AT_DATA_SOURCE_PROLOGUE [AT_DATA_SOURCE_PROLOGUE
@@ -181,47 +189,51 @@ AT_DATA([main.cc],
#include "x2.h" #include "x2.h"
#include "x3.h" #include "x3.h"
#include "x4.h" #include "x4.h"
#include "x6.h"
#include "x7.h"
#include "x8.h"
} }
#include "x5.hh" #include "x5.hh"
//#include "x6.hh" //#include "x6.hh"
#define ECHO(S) std::cerr << #S": " << S << std::endl; #define RUN(S) \
do { \
int res = S; \
if (res) \
std::cerr << #S": " << res << std::endl; \
} while (false)
int int
main (void) main (void)
{ {
ECHO(x1_parse()); RUN(x1_parse());
ECHO(x2_parse()); RUN(x2_parse());
ECHO(x3_parse()); RUN(x3_parse());
ECHO(x4_parse()); RUN(x4_parse());
x5_::parser p5; x5_::parser p5;
ECHO(p5.parse()); RUN(p5.parse());
RUN(x6_parse());
RUN(x7_parse());
RUN(x8_parse());
// x6_::parser p6; // x6_::parser p6;
// ECHO(p6.parse()); // RUN(p6.parse());
return 0; return 0;
} }
]]) ]])# main.cc
AT_DATA_GRAMMAR_SEVERAL([x1], []) AT_TEST([x1], [])
AT_DATA_GRAMMAR_SEVERAL([x2], [%locations %debug]) AT_TEST([x2], [%locations %debug])
AT_DATA_GRAMMAR_SEVERAL([x3], [%glr-parser]) AT_TEST([x3], [%glr-parser])
AT_DATA_GRAMMAR_SEVERAL([x4], [%locations %debug %glr-parser]) AT_TEST([x4], [%locations %debug %glr-parser])
AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %debug %language "c++"]) AT_TEST([x5], [%locations %debug %language "c++"])
#AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %language "c++" %glr-parser]) AT_TEST([x6], [%define api.pure])
AT_TEST([x7], [%define api.push-pull both])
AT_TEST([x8], [%define api.pure %define api.push-pull both])
#AT_TEST([x5], [%locations %language "c++" %glr-parser])
AT_COMPILE_CXX([parser], [x1.o x2.o x3.o x4.o x5.o main.cc]) AT_COMPILE_CXX([parser], [[x[1-8].o main.cc]])
AT_CHECK([./parser], [0], AT_CHECK([./parser], [0], [[expout]])
[[x1
x2 m4_popdef([AT_TEST])
x3
x4
x5
]],
[[x1_parse(): 0
x2_parse(): 0
x3_parse(): 0
x4_parse(): 0
p5.parse(): 0
]])
AT_CLEANUP AT_CLEANUP

View File

@@ -1442,3 +1442,32 @@ input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wya
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]]) AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
AT_CLEANUP AT_CLEANUP
## ------------------------------------------------------ ##
## %name-prefix and %define api.prefix are incompatible. ##
## ------------------------------------------------------ ##
AT_SETUP([[%name-prefix and %define api.prefix are incompatible]])
# AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION)
# --------------------------------------------
m4_pushdef([AT_TEST],
[AT_DATA([[input.y]],
[[$1
%%
exp:;
]])
AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
[[$3: '%name-prefix' and '%define api.prefix' cannot be used together
]])
])
AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18])
AT_TEST([], [-Dapi.prefix=foo -p bar], [<command line>:2])
AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [<command line>:2])
AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
m4_popdef([AT_TEST])
AT_CLEANUP

View File

@@ -344,7 +344,7 @@ static
# Must be called inside a AT_BISON_OPTION_PUSHDEFS/POPDEFS pair. # Must be called inside a AT_BISON_OPTION_PUSHDEFS/POPDEFS pair.
m4_define([AT_YYERROR_FORMALS], m4_define([AT_YYERROR_FORMALS],
[m4_case(AT_LANG, [m4_case(AT_LANG,
[c], [AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])[const char *msg]])[]dnl [c], [AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])[const char *msg]])[]dnl
]) ])
m4_define([AT_YYERROR_PROTOTYPE], m4_define([AT_YYERROR_PROTOTYPE],
@@ -599,7 +599,8 @@ AT_CHECK(m4_join([ ],
# is not installed. # is not installed.
m4_define([AT_JAVA_COMPILE], m4_define([AT_JAVA_COMPILE],
[AT_KEYWORDS(java) [AT_KEYWORDS(java)
AT_SKIP_IF([[test -z "$CONF_JAVA$CONF_JAVAC"]]) AT_SKIP_IF([[test -z "$CONF_JAVAC"]])
AT_SKIP_IF([[test -z "$CONF_JAVA"]])
AT_CHECK([[$SHELL ../../../javacomp.sh ]$1], AT_CHECK([[$SHELL ../../../javacomp.sh ]$1],
[[0]], [ignore], [ignore])]) [[0]], [ignore], [ignore])])