mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
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:
@@ -59,7 +59,7 @@ int
|
||||
]AT_NAME_PREFIX[parse (]AT_PARAM_IF([semantic_value *result, int *count]))[
|
||||
{
|
||||
]AT_NAME_PREFIX[::parser parser]AT_PARAM_IF([ (result, count)])[;
|
||||
#if YYDEBUG
|
||||
#if ]AT_API_PREFIX[DEBUG
|
||||
parser.set_debug_level (1);
|
||||
#endif
|
||||
return parser.parse ();
|
||||
@@ -113,7 +113,7 @@ static int get_char (]AT_YYLEX_FORMALS[);
|
||||
static void unget_char (]AT_YYLEX_PRE_FORMALS[ int c);
|
||||
|
||||
]AT_LOCATION_IF([
|
||||
static YYLTYPE last_yylloc;
|
||||
static AT_YYLTYPE last_yylloc;
|
||||
])[
|
||||
static int
|
||||
get_char (]AT_YYLEX_FORMALS[)
|
||||
@@ -264,15 +264,11 @@ AT_SKEL_CC_IF(
|
||||
|
||||
%code provides
|
||||
{
|
||||
#include <stdio.h>
|
||||
/* The input. */
|
||||
extern FILE *input;
|
||||
extern semantic_value global_result;
|
||||
extern int global_count;]AT_SKEL_CC_IF([[
|
||||
#ifndef YYLTYPE
|
||||
# define YYLTYPE ]AT_NAME_PREFIX[::parser::location_type
|
||||
#endif
|
||||
]])[
|
||||
#include <stdio.h>
|
||||
/* The input. */
|
||||
extern FILE *input;
|
||||
extern semantic_value global_result;
|
||||
extern int global_count;
|
||||
}
|
||||
|
||||
%code
|
||||
@@ -285,7 +281,7 @@ FILE *input;
|
||||
static int power (int base, int exponent);
|
||||
|
||||
]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, ])
|
||||
const char *s
|
||||
);])[
|
||||
@@ -373,7 +369,7 @@ power (int base, int exponent)
|
||||
AT_YYERROR_DEFINE],
|
||||
[/* A C error reporting function. */
|
||||
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, ])
|
||||
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 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([%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 %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.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([%locations])
|
||||
AT_CHECK_CALC_GLR([%name-prefix "calc"])
|
||||
AT_CHECK_CALC_GLR([%define api.prefix "calc"])
|
||||
AT_CHECK_CALC_GLR([%verbose])
|
||||
AT_CHECK_CALC_GLR([%yacc])
|
||||
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([%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 %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 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 %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 %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" %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 %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([%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 %define api.prefix "calc" %verbose %yacc])
|
||||
|
||||
AT_CHECK_CALC_GLR_CC([%debug])
|
||||
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" %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}])
|
||||
|
||||
@@ -124,15 +124,16 @@ AT_CLEANUP
|
||||
|
||||
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
|
||||
# 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_DATA_GRAMMAR([$1.AT_SKEL_CC_IF([yy], [y])],
|
||||
[[%define api.prefix "$1_"
|
||||
$2
|
||||
%error-verbose
|
||||
%union
|
||||
{
|
||||
int integer;
|
||||
@@ -150,6 +151,8 @@ exp:
|
||||
| 'x' '4' { printf ("x4\n"); }
|
||||
| 'x' '5' { printf ("x5\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_CHECK([$EGREP yy $1.h], [1])])
|
||||
|
||||
# Ignore comments. Ignore YYPARSE_PARAM. YYDEBUG (not renamed) can be
|
||||
# read, but not changed.
|
||||
# Ignore comments. Ignore YYPARSE_PARAM (obsolete) and
|
||||
# YYPUSH_MORE(_DEFINED)? (whose definition is constant).
|
||||
#
|
||||
# YYDEBUG (not renamed) can be read, but not changed.
|
||||
AT_CHECK([[$PERL -0777 -e 's{/\*.*?\*/}{}sg;s,//.*,,;' \
|
||||
]$1.AT_SKEL_CC_IF([hh], [h])[ |
|
||||
grep 'YY' |
|
||||
$EGREP -wv '(YYPARSE_PARAM|defined YYDEBUG|if YYDEBUG)']],
|
||||
$EGREP -wv 'YY(PARSE_PARAM|PUSH_MORE(_DEFINED)?)|(defined|if) YYDEBUG']],
|
||||
[1])
|
||||
AT_LANG_COMPILE([$1.o])
|
||||
|
||||
AT_CHECK([[echo "$1" >>expout]])
|
||||
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
])
|
||||
])# AT_TEST
|
||||
|
||||
AT_DATA([main.cc],
|
||||
[AT_DATA_SOURCE_PROLOGUE
|
||||
@@ -181,47 +189,51 @@ AT_DATA([main.cc],
|
||||
#include "x2.h"
|
||||
#include "x3.h"
|
||||
#include "x4.h"
|
||||
#include "x6.h"
|
||||
#include "x7.h"
|
||||
#include "x8.h"
|
||||
}
|
||||
#include "x5.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
|
||||
main (void)
|
||||
{
|
||||
ECHO(x1_parse());
|
||||
ECHO(x2_parse());
|
||||
ECHO(x3_parse());
|
||||
ECHO(x4_parse());
|
||||
RUN(x1_parse());
|
||||
RUN(x2_parse());
|
||||
RUN(x3_parse());
|
||||
RUN(x4_parse());
|
||||
x5_::parser p5;
|
||||
ECHO(p5.parse());
|
||||
RUN(p5.parse());
|
||||
RUN(x6_parse());
|
||||
RUN(x7_parse());
|
||||
RUN(x8_parse());
|
||||
// x6_::parser p6;
|
||||
// ECHO(p6.parse());
|
||||
// RUN(p6.parse());
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
]])# main.cc
|
||||
|
||||
AT_DATA_GRAMMAR_SEVERAL([x1], [])
|
||||
AT_DATA_GRAMMAR_SEVERAL([x2], [%locations %debug])
|
||||
AT_DATA_GRAMMAR_SEVERAL([x3], [%glr-parser])
|
||||
AT_DATA_GRAMMAR_SEVERAL([x4], [%locations %debug %glr-parser])
|
||||
AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %debug %language "c++"])
|
||||
#AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %language "c++" %glr-parser])
|
||||
AT_TEST([x1], [])
|
||||
AT_TEST([x2], [%locations %debug])
|
||||
AT_TEST([x3], [%glr-parser])
|
||||
AT_TEST([x4], [%locations %debug %glr-parser])
|
||||
AT_TEST([x5], [%locations %debug %language "c++"])
|
||||
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_CHECK([./parser], [0],
|
||||
[[x1
|
||||
x2
|
||||
x3
|
||||
x4
|
||||
x5
|
||||
]],
|
||||
[[x1_parse(): 0
|
||||
x2_parse(): 0
|
||||
x3_parse(): 0
|
||||
x4_parse(): 0
|
||||
p5.parse(): 0
|
||||
]])
|
||||
AT_COMPILE_CXX([parser], [[x[1-8].o main.cc]])
|
||||
AT_CHECK([./parser], [0], [[expout]])
|
||||
|
||||
m4_popdef([AT_TEST])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -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_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
|
||||
|
||||
@@ -344,7 +344,7 @@ static
|
||||
# Must be called inside a AT_BISON_OPTION_PUSHDEFS/POPDEFS pair.
|
||||
m4_define([AT_YYERROR_FORMALS],
|
||||
[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],
|
||||
@@ -599,7 +599,8 @@ AT_CHECK(m4_join([ ],
|
||||
# is not installed.
|
||||
m4_define([AT_JAVA_COMPILE],
|
||||
[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],
|
||||
[[0]], [ignore], [ignore])])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user