mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 11:45:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d3f7eaf1d | ||
|
|
2ead0fb793 | ||
|
|
63951be29f | ||
|
|
0a36880ad1 | ||
|
|
5a000c51f7 | ||
|
|
3154ff8ef6 | ||
|
|
d03c0413f0 | ||
|
|
41a4806a82 | ||
|
|
8aaa0c2f86 | ||
|
|
63e8426ac6 | ||
|
|
a1d1ab50a0 | ||
|
|
3237f57096 | ||
|
|
7d846072c7 | ||
|
|
8b49e6bfc5 | ||
|
|
0e1ccdfae0 | ||
|
|
86649705b4 | ||
|
|
7dbb8d8aba | ||
|
|
3472de825e | ||
|
|
3112e7a82b | ||
|
|
95066e9208 | ||
|
|
baf0bd6145 | ||
|
|
623a5147e6 | ||
|
|
b720fedf83 | ||
|
|
a7ab55af2a | ||
|
|
003db649bb | ||
|
|
a21733f2b4 | ||
|
|
a68b1f237e | ||
|
|
0fb7b95c5f | ||
|
|
4f4a54ab92 | ||
|
|
bb8674a537 | ||
|
|
5fb07775a1 | ||
|
|
e0992e5458 | ||
|
|
54dccdb2ca | ||
|
|
324a557651 | ||
|
|
94843f0aa3 | ||
|
|
20df0160bc | ||
|
|
e73ac5a09b | ||
|
|
851e3f8468 | ||
|
|
6f1360bd89 |
+1
-1
@@ -1 +1 @@
|
|||||||
2.6.3
|
2.6.4
|
||||||
|
|||||||
@@ -1,5 +1,24 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
|
||||||
|
|
||||||
|
We consider compiler warnings about Bison generated parsers to be bugs.
|
||||||
|
Rather than working around them in your own project, please consider
|
||||||
|
reporting them to us.
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Warnings about uninitialized yylval and/or yylloc for push parsers with a
|
||||||
|
pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
|
||||||
|
3.2.
|
||||||
|
|
||||||
|
Other issues in the test suite have been addressed.
|
||||||
|
|
||||||
|
Nul characters are correctly displayed in error messages.
|
||||||
|
|
||||||
|
When possible, yylloc is correctly initialized before calling yylex. It
|
||||||
|
is no longer necessary to initialize it in the %initial-action.
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
|
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
|
||||||
|
|
||||||
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ Laurent Mascherpa [email protected]
|
|||||||
Lie Yan [email protected]
|
Lie Yan [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
|
Marc Mendiola [email protected]
|
||||||
Martin Jacobs [email protected]
|
Martin Jacobs [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
@@ -87,6 +88,7 @@ Paul Hilfinger [email protected]
|
|||||||
Per Allansson [email protected]
|
Per Allansson [email protected]
|
||||||
Peter Fales [email protected]
|
Peter Fales [email protected]
|
||||||
Peter Hamorsky [email protected]
|
Peter Hamorsky [email protected]
|
||||||
|
Peter Simons [email protected]
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
|
|||||||
+18
-1
@@ -72,6 +72,18 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
-Wshadow -Wstrict-prototypes'
|
-Wshadow -Wstrict-prototypes'
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
|
# Clang supports many of GCC's -W options, but only issues warnings
|
||||||
|
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
||||||
|
# thinks the option is supported, and unknown options are then added
|
||||||
|
# to CFLAGS. But then, when -Werror is added in the test suite for
|
||||||
|
# instance, the warning about the unknown option turns into an
|
||||||
|
# error.
|
||||||
|
#
|
||||||
|
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
||||||
|
# meanwhile, turn warnings about unknown options into errors in
|
||||||
|
# CFLAGS, and restore CFLAGS after the tests.
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||||
for i in $warn_common $warn_c;
|
for i in $warn_common $warn_c;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||||
@@ -80,24 +92,29 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
AC_LANG_POP([C])
|
AC_LANG_POP([C])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||||
for i in $warn_common $warn_cxx;
|
for i in $warn_common $warn_cxx;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||||
done
|
done
|
||||||
gl_WARN_ADD([ -Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
[AC_LANG_PROGRAM([], [nullptr])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
||||||
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
|
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ m4_define([b4_YYDEBUG_define],
|
|||||||
# endif
|
# endif
|
||||||
# else /* ! defined YYDEBUG */
|
# else /* ! defined YYDEBUG */
|
||||||
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
|
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
|
||||||
# endif /* ! defined ]b4_api_PREFIX[DEBUG */
|
# endif /* ! defined YYDEBUG */
|
||||||
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -643,3 +643,46 @@ m4_define([b4_yylloc_default_define],
|
|||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# b4_yy_location_print_define
|
||||||
|
# ---------------------------
|
||||||
|
# Define YY_LOCATION_PRINT.
|
||||||
|
m4_define([b4_yy_location_print_define],
|
||||||
|
[b4_locations_if([[
|
||||||
|
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||||
|
This macro was not mandated originally: define only if we know
|
||||||
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
|
do { \
|
||||||
|
fprintf (File, "%d.%d", (Loc).first_line, (Loc).first_column); \
|
||||||
|
if ((Loc).first_line < (Loc).last_line) \
|
||||||
|
fprintf (File, "-%d.%d", (Loc).last_line, (Loc).last_column - 1); \
|
||||||
|
else if ((Loc).first_column < (Loc).last_column - 1) \
|
||||||
|
fprintf (File, "-%d", (Loc).last_column - 1); \
|
||||||
|
} while (0)
|
||||||
|
# else
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
# endif
|
||||||
|
#endif]],
|
||||||
|
[[/* This macro is provided for backward compatibility. */
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
#endif]])
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_yyloc_default
|
||||||
|
# ----------------
|
||||||
|
# Expand to a possible default value for yylloc.
|
||||||
|
m4_define([b4_yyloc_default],
|
||||||
|
[[
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
= { ]m4_join([, ],
|
||||||
|
m4_defn([b4_location_initial_line]),
|
||||||
|
m4_defn([b4_location_initial_column]),
|
||||||
|
m4_defn([b4_location_initial_line]),
|
||||||
|
m4_defn([b4_location_initial_column]))[ }
|
||||||
|
# endif
|
||||||
|
]])
|
||||||
|
|||||||
+10
-33
@@ -223,11 +223,11 @@ b4_percent_code_get([[top]])[
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Default (constant) value used for initialization for null
|
/* Default (constant) value used for initialization for null
|
||||||
right-hand sides. Unlike the standard yacc.c template,
|
right-hand sides. Unlike the standard yacc.c template, here we set
|
||||||
here we set the default value of $$ to a zeroed-out value.
|
the default value of $$ to a zeroed-out value. Since the default
|
||||||
Since the default value is undefined, this behavior is
|
value is undefined, this behavior is technically correct. */
|
||||||
technically correct. */
|
static YYSTYPE yyval_default;]b4_locations_if([[
|
||||||
static YYSTYPE yyval_default;
|
static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -475,28 +475,10 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
|||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
#ifndef YYLLOC_DEFAULT
|
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
# define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
# define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
|
]])[
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
]b4_yy_location_print_define[
|
||||||
This macro was not mandated originally: define only if we know
|
|
||||||
we won't break user code: when these are the locations we know. */
|
|
||||||
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
|
||||||
(Loc).first_line, (Loc).first_column, \
|
|
||||||
(Loc).last_line, (Loc).last_column)
|
|
||||||
#endif
|
|
||||||
]],[
|
|
||||||
#ifndef YYLLOC_DEFAULT
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0)
|
|
||||||
#endif
|
|
||||||
])[
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||||
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
||||||
@@ -2295,14 +2277,9 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yylval = yyval_default;
|
yylval = yyval_default;]b4_locations_if([
|
||||||
]b4_locations_if([
|
yylloc = yyloc_default;])[
|
||||||
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
]m4_ifdef([b4_initial_action], [
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
|
||||||
#endif
|
|
||||||
])
|
|
||||||
m4_ifdef([b4_initial_action], [
|
|
||||||
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
|
|||||||
+7
-2
@@ -87,12 +87,17 @@ m4_define([b4_yy_symbol_print_generate],
|
|||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
}
|
}
|
||||||
]])
|
]])[
|
||||||
|
|
||||||
|
# Hijack the initial action to initialize the locations.
|
||||||
|
]b4_locations_if([b4_percent_define_ifdef([[location_type]], [],
|
||||||
|
[m4_define([b4_initial_action],
|
||||||
|
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||||
|
m4_defn([b4_initial_action])]))])])[
|
||||||
|
|
||||||
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||||
# and declaration of yyerror.
|
# and declaration of yyerror.
|
||||||
m4_append([b4_post_prologue],
|
]m4_append([b4_post_prologue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
|
|||||||
+4
-4
@@ -510,17 +510,18 @@ do { \
|
|||||||
int yychar = yyempty_;
|
int yychar = yyempty_;
|
||||||
int yytoken = 0;
|
int yytoken = 0;
|
||||||
|
|
||||||
/* State. */
|
// State.
|
||||||
int yyn;
|
int yyn;
|
||||||
int yylen = 0;
|
int yylen = 0;
|
||||||
int yystate = 0;
|
int yystate = 0;
|
||||||
|
|
||||||
/* Error handling. */
|
// Error handling.
|
||||||
int yynerrs_ = 0;
|
int yynerrs_ = 0;
|
||||||
int yyerrstatus_ = 0;
|
int yyerrstatus_ = 0;
|
||||||
|
|
||||||
/// Semantic value of the lookahead.
|
/// Semantic value of the lookahead.
|
||||||
semantic_type yylval;
|
static semantic_type yyval_default;
|
||||||
|
semantic_type yylval = yyval_default;
|
||||||
/// Location of the lookahead.
|
/// Location of the lookahead.
|
||||||
location_type yylloc;
|
location_type yylloc;
|
||||||
/// The locations where the error started and ended.
|
/// The locations where the error started and ended.
|
||||||
@@ -580,7 +581,6 @@ b4_locations_if([, [[location*], [&yylloc]]])dnl
|
|||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
if (yychar <= yyeof_)
|
if (yychar <= yyeof_)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -87,7 +87,7 @@ b4_copyright([Positions for Bison parsers in C++],
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add and assign a position.
|
||||||
inline const position&
|
inline position&
|
||||||
operator+= (position& res, const int width)
|
operator+= (position& res, const int width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
@@ -103,7 +103,7 @@ b4_copyright([Positions for Bison parsers in C++],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add and assign a position.
|
||||||
inline const position&
|
inline position&
|
||||||
operator-= (position& res, const int width)
|
operator-= (position& res, const int width)
|
||||||
{
|
{
|
||||||
return res += -width;
|
return res += -width;
|
||||||
|
|||||||
+24
-59
@@ -171,10 +171,11 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
|||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
#if defined __GNUC__ && (4 < __GNUC__ + (6 <= __GNUC_MINOR__))
|
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
_Pragma ("GCC diagnostic push") \
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
_Pragma ("GCC diagnostic pop")
|
_Pragma ("GCC diagnostic pop")
|
||||||
@@ -182,21 +183,22 @@ int yychar;
|
|||||||
/* Default value used for initialization, for pacifying older GCCs
|
/* Default value used for initialization, for pacifying older GCCs
|
||||||
or non-GCC compilers. */
|
or non-GCC compilers. */
|
||||||
static YYSTYPE yyval_default;
|
static YYSTYPE yyval_default;
|
||||||
# define YYLVAL_INITIALIZE() (yylval = yyval_default)
|
# define YY_INITIAL_VALUE(Value) = Value
|
||||||
#endif]])[
|
#endif]])[
|
||||||
#ifndef YYLVAL_INITIALIZE
|
|
||||||
# define YYLVAL_INITIALIZE()
|
|
||||||
#endif
|
|
||||||
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef YY_INITIAL_VALUE
|
||||||
|
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The semantic value of the lookahead symbol. */
|
/* The semantic value of the lookahead symbol. */
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);]b4_locations_if([[
|
||||||
|
|
||||||
/* Location data for the lookahead symbol. */
|
/* Location data for the lookahead symbol. */
|
||||||
YYLTYPE yylloc;]])b4_pure_if([], [[
|
YYLTYPE yylloc][]b4_yyloc_default[;
|
||||||
|
]])b4_pure_if([], [[
|
||||||
|
|
||||||
/* Number of syntax errors so far. */
|
/* Number of syntax errors so far. */
|
||||||
int yynerrs;]])])
|
int yynerrs;]])])
|
||||||
@@ -264,7 +266,7 @@ typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
|||||||
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
||||||
[[[int pushed_char]], [[pushed_char]]],
|
[[[int pushed_char]], [[pushed_char]]],
|
||||||
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
||||||
[[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[b4_api_PREFIX[LTYPE *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 *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
||||||
@@ -765,40 +767,17 @@ do \
|
|||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
|
|
||||||
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
]b4_locations_if([[
|
]])[
|
||||||
|
]b4_yy_location_print_define[
|
||||||
|
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
|
||||||
This macro was not mandated originally: define only if we know
|
|
||||||
we won't break user code: when these are the locations we know. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
|
||||||
(Loc).first_line, (Loc).first_column, \
|
|
||||||
(Loc).last_line, (Loc).last_column)
|
|
||||||
# else
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
# endif
|
|
||||||
#endif]], [[
|
|
||||||
|
|
||||||
|
|
||||||
/* This macro is provided for backward compatibility. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
#endif]])[
|
|
||||||
|
|
||||||
|
|
||||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||||
|
|
||||||
#ifdef YYLEX_PARAM
|
#ifdef YYLEX_PARAM
|
||||||
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
||||||
#else
|
#else
|
||||||
@@ -1431,7 +1410,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yypstate *yyps_local;]b4_pure_if([[
|
yypstate *yyps_local;]b4_pure_if([[
|
||||||
int yychar;
|
int yychar;
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
YYLTYPE yylloc;]])])[
|
YYLTYPE yylloc][]b4_yyloc_default[;]])])[
|
||||||
if (yyps)
|
if (yyps)
|
||||||
yyps_local = yyps;
|
yyps_local = yyps;
|
||||||
else
|
else
|
||||||
@@ -1511,7 +1490,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
||||||
[[[int yypushed_char]], [[yypushed_char]]],
|
[[[int yypushed_char]], [[yypushed_char]]],
|
||||||
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
||||||
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[[YYLTYPE *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))], [[
|
b4_parse_param]))], [[
|
||||||
|
|
||||||
|
|
||||||
@@ -1562,9 +1541,9 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
yyss = yyssa;
|
yyssp = yyss = yyssa;
|
||||||
yyvs = yyvsa;]b4_locations_if([[
|
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
||||||
yyls = yylsa;]])[
|
yylsp = yyls = yylsa;]])[
|
||||||
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
||||||
|
|
||||||
yyes = yyesa;
|
yyes = yyesa;
|
||||||
@@ -1578,31 +1557,17 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yyerrstatus = 0;
|
yyerrstatus = 0;
|
||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||||
|
]m4_ifdef([b4_initial_action], [
|
||||||
/* Initialize stack pointers.
|
|
||||||
Waste one element of value and location stack
|
|
||||||
so that they stay on the same level as the state stack.
|
|
||||||
The wasted elements are never initialized. */
|
|
||||||
yyssp = yyss;
|
|
||||||
yyvsp = yyvs;]b4_locations_if([[
|
|
||||||
yylsp = yyls;]])[
|
|
||||||
|
|
||||||
YYLVAL_INITIALIZE ();]b4_locations_if([[
|
|
||||||
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
/* Initialize the default location before parsing starts. */
|
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
|
||||||
#endif]])
|
|
||||||
m4_ifdef([b4_initial_action],[
|
|
||||||
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
||||||
[m4_define([b4_at_dollar_used])yylloc])dnl
|
[m4_define([b4_at_dollar_used])dnl
|
||||||
|
b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef[]dnl
|
b4_dollar_popdef[]dnl
|
||||||
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
||||||
]])dnl
|
|
||||||
m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
|
||||||
]])])dnl
|
]])])dnl
|
||||||
|
b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])[;
|
||||||
|
]])dnl
|
||||||
[ goto yysetstate;
|
[ goto yysetstate;
|
||||||
|
|
||||||
/*------------------------------------------------------------.
|
/*------------------------------------------------------------.
|
||||||
|
|||||||
+2
-2
@@ -9528,8 +9528,8 @@ factor both as follows.
|
|||||||
// Tell Flex the lexer's prototype ...
|
// Tell Flex the lexer's prototype ...
|
||||||
# define YY_DECL \
|
# define YY_DECL \
|
||||||
yy::calcxx_parser::token_type \
|
yy::calcxx_parser::token_type \
|
||||||
yylex (yy::calcxx_parser::semantic_type* yylval, \
|
yylex (yy::calcxx_parser::semantic_type *yylval, \
|
||||||
yy::calcxx_parser::location_type* yylloc, \
|
yy::calcxx_parser::location_type *yylloc, \
|
||||||
calcxx_driver& driver)
|
calcxx_driver& driver)
|
||||||
// ... and declare it for the parser's sake.
|
// ... and declare it for the parser's sake.
|
||||||
YY_DECL;
|
YY_DECL;
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: d245e6ddd6...daf7f8c022
@@ -25,3 +25,47 @@ AC_DEFUN([BISON_TEST_FOR_WORKING_C_COMPILER], [
|
|||||||
[],
|
[],
|
||||||
[AC_MSG_FAILURE([cannot compile a simple C program])])
|
[AC_MSG_FAILURE([cannot compile a simple C program])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# BISON_CHECK_WITH_POSIXLY_CORRECT(CODE)
|
||||||
|
# --------------------------------------
|
||||||
|
# Run the Autoconf CODE with POSIXLY_CORRECT set to 1, and restored to
|
||||||
|
# its initial value afterwards.
|
||||||
|
AC_DEFUN([BISON_CHECK_WITH_POSIXLY_CORRECT],
|
||||||
|
[gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
|
||||||
|
case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
|
||||||
|
xx) gl_had_POSIXLY_CORRECT=exported ;;
|
||||||
|
x) gl_had_POSIXLY_CORRECT=yes ;;
|
||||||
|
*) gl_had_POSIXLY_CORRECT= ;;
|
||||||
|
esac
|
||||||
|
POSIXLY_CORRECT=1
|
||||||
|
export POSIXLY_CORRECT
|
||||||
|
$1
|
||||||
|
case $gl_had_POSIXLY_CORRECT in
|
||||||
|
exported) ;;
|
||||||
|
yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
|
||||||
|
*) AS_UNSET([POSIXLY_CORRECT]) ;;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
|
||||||
|
# BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
|
# --------------------------------
|
||||||
|
# Whether the compiler supports -g in POSIXLY_CORRECT mode. clang-2.9
|
||||||
|
# on OS X does not, because "clang-mp-2.9 -o test -g test.c" launches
|
||||||
|
# "/usr/bin/dsymutil test -o test.dSYM" which fails with "error:
|
||||||
|
# unable to open executable '-o'".
|
||||||
|
#
|
||||||
|
# Sets C_COMPILER_POSIXLY_CORRECT to true/false.
|
||||||
|
AC_DEFUN([BISON_C_COMPILER_POSIXLY_CORRECT],
|
||||||
|
[AC_CACHE_CHECK([whether $CC supports POSIXLY_CORRECT=1],
|
||||||
|
[bison_cv_cc_supports_posixly_correct],
|
||||||
|
[BISON_CHECK_WITH_POSIXLY_CORRECT(
|
||||||
|
[AC_LANG_PUSH([C])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM],
|
||||||
|
[bison_cv_cc_supports_posixly_correct=yes],
|
||||||
|
[bison_cv_cc_supports_posixly_correct=no])
|
||||||
|
AC_LANG_POP([C])])])
|
||||||
|
case $bison_cv_cc_supports_posixly_correct in
|
||||||
|
yes) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [true]) ;;
|
||||||
|
no) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [false]);;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
|||||||
+2
-2
@@ -49,7 +49,7 @@
|
|||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "uniqstr.h"
|
#include "uniqstr.h"
|
||||||
|
|
||||||
bool debug_flag;
|
bool debug;
|
||||||
bool defines_flag;
|
bool defines_flag;
|
||||||
bool graph_flag;
|
bool graph_flag;
|
||||||
bool xml_flag;
|
bool xml_flag;
|
||||||
@@ -664,7 +664,7 @@ getargs (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
debug_flag = true;
|
debug = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ extern int skeleton_prio;
|
|||||||
/* for -I */
|
/* for -I */
|
||||||
extern char const *include;
|
extern char const *include;
|
||||||
|
|
||||||
extern bool debug_flag; /* for -t */
|
extern bool debug; /* for -t */
|
||||||
extern bool defines_flag; /* for -d */
|
extern bool defines_flag; /* for -d */
|
||||||
extern bool graph_flag; /* for -g */
|
extern bool graph_flag; /* for -g */
|
||||||
extern bool xml_flag; /* for -x */
|
extern bool xml_flag; /* for -x */
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ typedef struct
|
|||||||
|
|
||||||
} location;
|
} location;
|
||||||
|
|
||||||
#define YYLTYPE location
|
#define GRAM_LTYPE location
|
||||||
|
|
||||||
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
|
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
|
||||||
extern location const empty_location;
|
extern location const empty_location;
|
||||||
|
|||||||
+1
-1
@@ -628,7 +628,7 @@ prepare (void)
|
|||||||
use_push_for_pull_flag = true;
|
use_push_for_pull_flag = true;
|
||||||
|
|
||||||
/* Flags. */
|
/* Flags. */
|
||||||
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
|
MUSCLE_INSERT_BOOL ("debug_flag", debug);
|
||||||
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
||||||
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
||||||
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
||||||
|
|||||||
+227
-223
File diff suppressed because it is too large
Load Diff
+31
-23
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.6.3.3-b10d3. */
|
/* A Bison parser, made by GNU Bison 2.6.4.37-63951. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -33,19 +33,27 @@
|
|||||||
#ifndef YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
#ifndef YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
# define YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
# define YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef GRAM_DEBUG
|
||||||
# define YYDEBUG 1
|
# if defined YYDEBUG
|
||||||
#endif
|
# if YYDEBUG
|
||||||
#if YYDEBUG
|
# define GRAM_DEBUG 1
|
||||||
|
# else
|
||||||
|
# define GRAM_DEBUG 0
|
||||||
|
# endif
|
||||||
|
# else /* ! defined YYDEBUG */
|
||||||
|
# define GRAM_DEBUG 1
|
||||||
|
# endif /* ! defined YYDEBUG */
|
||||||
|
#endif /* ! defined GRAM_DEBUG */
|
||||||
|
#if GRAM_DEBUG
|
||||||
extern int gram_debug;
|
extern int gram_debug;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef GRAM_TOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define GRAM_TOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum yytokentype {
|
enum gram_tokentype {
|
||||||
GRAM_EOF = 0,
|
GRAM_EOF = 0,
|
||||||
STRING = 258,
|
STRING = 258,
|
||||||
INT = 259,
|
INT = 259,
|
||||||
@@ -164,10 +172,10 @@ extern int gram_debug;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
|
||||||
typedef union YYSTYPE
|
typedef union GRAM_STYPE
|
||||||
{
|
{
|
||||||
/* Line 2077 of yacc.c */
|
/* Line 2042 of yacc.c */
|
||||||
#line 115 "parse-gram.y"
|
#line 115 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
@@ -181,25 +189,25 @@ typedef union YYSTYPE
|
|||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
|
|
||||||
|
|
||||||
/* Line 2077 of yacc.c */
|
/* Line 2042 of yacc.c */
|
||||||
#line 186 "parse-gram.h"
|
#line 194 "parse-gram.h"
|
||||||
} YYSTYPE;
|
} GRAM_STYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define GRAM_STYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define gram_stype GRAM_STYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define GRAM_STYPE_IS_DECLARED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
#if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
|
||||||
typedef struct YYLTYPE
|
typedef struct GRAM_LTYPE
|
||||||
{
|
{
|
||||||
int first_line;
|
int first_line;
|
||||||
int first_column;
|
int first_column;
|
||||||
int last_line;
|
int last_line;
|
||||||
int last_column;
|
int last_column;
|
||||||
} YYLTYPE;
|
} GRAM_LTYPE;
|
||||||
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
# define gram_ltype GRAM_LTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
# define GRAM_LTYPE_IS_DECLARED 1
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
# define GRAM_LTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -94,14 +94,14 @@ current_lhs(symbol *sym, location loc, named_ref *ref)
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%debug
|
%debug
|
||||||
%verbose
|
%define api.prefix "gram_"
|
||||||
%defines
|
%define api.pure
|
||||||
%locations
|
|
||||||
%pure-parser
|
|
||||||
%error-verbose
|
|
||||||
%define parse.lac full
|
%define parse.lac full
|
||||||
%name-prefix="gram_"
|
%defines
|
||||||
|
%error-verbose
|
||||||
%expect 0
|
%expect 0
|
||||||
|
%locations
|
||||||
|
%verbose
|
||||||
|
|
||||||
%initial-action
|
%initial-action
|
||||||
{
|
{
|
||||||
@@ -252,7 +252,7 @@ prologue_declaration:
|
|||||||
plain_code.code, @1);
|
plain_code.code, @1);
|
||||||
code_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
}
|
}
|
||||||
| "%debug" { debug_flag = true; }
|
| "%debug" { debug = true; }
|
||||||
| "%define" variable content.opt
|
| "%define" variable content.opt
|
||||||
{
|
{
|
||||||
muscle_percent_define_insert ($2, @2, $3,
|
muscle_percent_define_insert ($2, @2, $3,
|
||||||
|
|||||||
+2
-2
@@ -51,9 +51,9 @@ void grammar_current_rule_prec_set (symbol *precsym, location loc);
|
|||||||
void grammar_current_rule_dprec_set (int dprec, location loc);
|
void grammar_current_rule_dprec_set (int dprec, location loc);
|
||||||
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
||||||
void grammar_current_rule_symbol_append (symbol *sym, location loc,
|
void grammar_current_rule_symbol_append (symbol *sym, location loc,
|
||||||
named_ref *named_ref);
|
named_ref *nref);
|
||||||
void grammar_current_rule_action_append (const char *action, location loc,
|
void grammar_current_rule_action_append (const char *action, location loc,
|
||||||
named_ref *named_ref);
|
named_ref *nref);
|
||||||
void reader (void);
|
void reader (void);
|
||||||
void free_merger_functions (void);
|
void free_merger_functions (void);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ void gram_scanner_last_string_free (void);
|
|||||||
extern FILE *gram_out;
|
extern FILE *gram_out;
|
||||||
extern int gram_lineno;
|
extern int gram_lineno;
|
||||||
|
|
||||||
# define GRAM_LEX_DECL int gram_lex (YYSTYPE *val, location *loc)
|
# define GRAM_LEX_DECL int gram_lex (GRAM_STYPE *val, location *loc)
|
||||||
GRAM_LEX_DECL;
|
GRAM_LEX_DECL;
|
||||||
|
|
||||||
#endif /* !SCAN_GRAM_H_ */
|
#endif /* !SCAN_GRAM_H_ */
|
||||||
|
|||||||
+2
-2
@@ -291,7 +291,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
}
|
}
|
||||||
|
|
||||||
. {
|
. {
|
||||||
complain_at (*loc, _("invalid character: %s"), quote (yytext));
|
complain_at (*loc, _("invalid character: %s"), quote_mem (yytext, yyleng));
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
@@ -375,7 +375,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
}
|
}
|
||||||
. {
|
. {
|
||||||
complain_at (*loc, _("invalid character in bracketed name: %s"),
|
complain_at (*loc, _("invalid character in bracketed name: %s"),
|
||||||
quote (yytext));
|
quote_mem (yytext, yyleng));
|
||||||
}
|
}
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
BEGIN bracketed_id_context_state;
|
BEGIN bracketed_id_context_state;
|
||||||
|
|||||||
+1
-1
Submodule submodules/autoconf updated: 0db9c1a19f...26cb0918d3
+96
-46
@@ -69,6 +69,76 @@ AT_PARSER_CHECK([./input], 0,
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------ ##
|
||||||
|
## Initial location. ##
|
||||||
|
## ------------------ ##
|
||||||
|
|
||||||
|
# AT_TEST(SKELETON-NAME, DIRECTIVES)
|
||||||
|
# ----------------------------------
|
||||||
|
# Check that the initial location is correct.
|
||||||
|
m4_pushdef([AT_TEST],
|
||||||
|
[AT_SETUP([Initial location: $1 $2])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%locations %skeleton "$1" $2 %parse-param { int x }])
|
||||||
|
AT_DATA_GRAMMAR([[input.y]],
|
||||||
|
[[%defines /* FIXME: Required by lalr1.cc in Bison 2.6. */
|
||||||
|
%locations
|
||||||
|
%debug
|
||||||
|
%skeleton "$1"
|
||||||
|
$2
|
||||||
|
%parse-param { int x } // Useless, but used to force yyerror purity.
|
||||||
|
%code
|
||||||
|
{
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <stdlib.h> // getenv
|
||||||
|
]AT_YYERROR_DECLARE[
|
||||||
|
]AT_YYLEX_DECLARE[
|
||||||
|
}
|
||||||
|
%%
|
||||||
|
exp: { ]AT_SKEL_CC_IF([[std::cerr << @$ << std::endl]],
|
||||||
|
[[YY_LOCATION_PRINT(stderr, @$); fputc ('\n', stderr)]])[; }
|
||||||
|
%%
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
|
|
||||||
|
]AT_YYLEX_PROTOTYPE[
|
||||||
|
{]AT_PURE_IF([
|
||||||
|
YYUSE(lvalp);
|
||||||
|
YYUSE(llocp);], [AT_SKEL_CC_IF([
|
||||||
|
YYUSE(lvalp);
|
||||||
|
YYUSE(llocp);])])[
|
||||||
|
return 'x';
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{]AT_SKEL_CC_IF([[
|
||||||
|
yy::parser p (0);
|
||||||
|
p.set_debug_level (!!getenv("YYDEBUG"));
|
||||||
|
return p.parse ();]], [[
|
||||||
|
yydebug = !!getenv("YYDEBUG");
|
||||||
|
return !!yyparse (0);]])[
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_FULL_COMPILE([input])
|
||||||
|
AT_PARSER_CHECK([./input], 1, [],
|
||||||
|
[[1.1
|
||||||
|
1.1: syntax error
|
||||||
|
]])
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
AT_CLEANUP
|
||||||
|
])
|
||||||
|
|
||||||
|
## FIXME: test Java, and iterate over skeletons.
|
||||||
|
AT_TEST([yacc.c])
|
||||||
|
AT_TEST([yacc.c], [%define api.pure])
|
||||||
|
AT_TEST([yacc.c], [%define api.push-pull both])
|
||||||
|
AT_TEST([yacc.c], [%define api.push-pull both %define api.pure])
|
||||||
|
AT_TEST([glr.c])
|
||||||
|
AT_TEST([lalr1.cc])
|
||||||
|
AT_TEST([glr.cc])
|
||||||
|
|
||||||
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -159,8 +229,7 @@ main (void)
|
|||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[-o input.c input.y]])
|
AT_FULL_COMPILE([input])
|
||||||
AT_COMPILE([[input]])
|
|
||||||
AT_PARSER_CHECK([[./input]], [[0]],
|
AT_PARSER_CHECK([[./input]], [[0]],
|
||||||
[[6
|
[[6
|
||||||
]])
|
]])
|
||||||
@@ -305,7 +374,7 @@ line:
|
|||||||
$$ = -1;
|
$$ = -1;
|
||||||
V(line, $$, @$, ": ");
|
V(line, $$, @$, ": ");
|
||||||
V('(', $1, @1, " ");
|
V('(', $1, @1, " ");
|
||||||
fprintf (stderr, "error (@%d-%d) ", RANGE(@2));
|
fprintf (stderr, "error (@%d-%d) ", RANGE (@2));
|
||||||
V(')', $3, @3, "\n");
|
V(')', $3, @3, "\n");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -557,7 +626,7 @@ AT_BISON_OPTION_POPDEFS
|
|||||||
# AT_CHECK_PRINTER_AND_DESTRUCTOR([BISON-OPTIONS], [UNION-FLAG], [SKIP_FLAG])
|
# AT_CHECK_PRINTER_AND_DESTRUCTOR([BISON-OPTIONS], [UNION-FLAG], [SKIP_FLAG])
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
m4_define([AT_CHECK_PRINTER_AND_DESTRUCTOR],
|
m4_define([AT_CHECK_PRINTER_AND_DESTRUCTOR],
|
||||||
[AT_SETUP([Printers and Destructors $2: $1])
|
[AT_SETUP([Printers and Destructors$2]m4_ifval([$1], [[: $1]]))
|
||||||
|
|
||||||
$3
|
$3
|
||||||
_AT_CHECK_PRINTER_AND_DESTRUCTOR($[1], $[2], $[3], $[4],
|
_AT_CHECK_PRINTER_AND_DESTRUCTOR($[1], $[2], $[3], $[4],
|
||||||
@@ -572,13 +641,13 @@ AT_CLEANUP
|
|||||||
|
|
||||||
|
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([])
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([], [with union])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union])
|
||||||
|
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [with union])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union])
|
||||||
|
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -595,10 +664,6 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
[[%error-verbose
|
[[%error-verbose
|
||||||
%debug
|
%debug
|
||||||
%locations
|
%locations
|
||||||
%initial-action {
|
|
||||||
@$.first_line = @$.last_line = 1;
|
|
||||||
@$.first_column = @$.last_column = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
@@ -656,29 +721,29 @@ AT_PARSER_CHECK([./input], 1,
|
|||||||
]],
|
]],
|
||||||
[[Starting parse
|
[[Starting parse
|
||||||
Entering state 0
|
Entering state 0
|
||||||
Reading a token: Next token is token 'a' (1.1-1.1: <> printer for 'a' @ 1)
|
Reading a token: Next token is token 'a' (1.1: <> printer for 'a' @ 1)
|
||||||
Shifting token 'a' (1.1-1.1: <> printer for 'a' @ 1)
|
Shifting token 'a' (1.1: <> printer for 'a' @ 1)
|
||||||
Entering state 1
|
Entering state 1
|
||||||
Reading a token: Next token is token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2)
|
Reading a token: Next token is token 'b' (1.2: 'b'/'c' printer for 'b' @ 2)
|
||||||
Shifting token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2)
|
Shifting token 'b' (1.2: 'b'/'c' printer for 'b' @ 2)
|
||||||
Entering state 3
|
Entering state 3
|
||||||
Reading a token: Next token is token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3)
|
Reading a token: Next token is token 'c' (1.3: 'b'/'c' printer for 'c' @ 3)
|
||||||
Shifting token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3)
|
Shifting token 'c' (1.3: 'b'/'c' printer for 'c' @ 3)
|
||||||
Entering state 5
|
Entering state 5
|
||||||
Reading a token: Next token is token 'd' (1.4-1.4: <> printer for 'd' @ 4)
|
Reading a token: Next token is token 'd' (1.4: <> printer for 'd' @ 4)
|
||||||
Shifting token 'd' (1.4-1.4: <> printer for 'd' @ 4)
|
Shifting token 'd' (1.4: <> printer for 'd' @ 4)
|
||||||
Entering state 6
|
Entering state 6
|
||||||
Reading a token: Now at end of input.
|
Reading a token: Now at end of input.
|
||||||
1.5-4: syntax error, unexpected $end, expecting 'e'
|
1.5: syntax error, unexpected $end, expecting 'e'
|
||||||
Error: popping token 'd' (1.4-1.4: <> printer for 'd' @ 4)
|
Error: popping token 'd' (1.4: <> printer for 'd' @ 4)
|
||||||
Stack now 0 1 3 5
|
Stack now 0 1 3 5
|
||||||
Error: popping token 'c' (1.3-1.3: 'b'/'c' printer for 'c' @ 3)
|
Error: popping token 'c' (1.3: 'b'/'c' printer for 'c' @ 3)
|
||||||
Stack now 0 1 3
|
Stack now 0 1 3
|
||||||
Error: popping token 'b' (1.2-1.2: 'b'/'c' printer for 'b' @ 2)
|
Error: popping token 'b' (1.2: 'b'/'c' printer for 'b' @ 2)
|
||||||
Stack now 0 1
|
Stack now 0 1
|
||||||
Error: popping token 'a' (1.1-1.1: <> printer for 'a' @ 1)
|
Error: popping token 'a' (1.1: <> printer for 'a' @ 1)
|
||||||
Stack now 0
|
Stack now 0
|
||||||
Cleanup: discarding lookahead token $end (1.5-1.5: )
|
Cleanup: discarding lookahead token $end (1.5: )
|
||||||
Stack now 0
|
Stack now 0
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -829,10 +894,6 @@ AT_DATA_GRAMMAR([[input]]$1[[.y]],
|
|||||||
[[%error-verbose
|
[[%error-verbose
|
||||||
%debug
|
%debug
|
||||||
%locations
|
%locations
|
||||||
%initial-action {
|
|
||||||
@$.first_line = @$.last_line = 1;
|
|
||||||
@$.first_column = @$.last_column = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
@@ -899,16 +960,16 @@ AT_PARSER_CHECK([./input$1], 0,
|
|||||||
]],
|
]],
|
||||||
[[Starting parse
|
[[Starting parse
|
||||||
Entering state 0
|
Entering state 0
|
||||||
Reducing stack by rule 1 (line 46):
|
Reducing stack by rule 1 (line 42):
|
||||||
-> $$ = nterm start (1.1-1.1: <]]kind[[> for 'S' @ 1)
|
-> $$ = nterm start (1.1: <]]kind[[> for 'S' @ 1)
|
||||||
Stack now 0
|
Stack now 0
|
||||||
Entering state 1
|
Entering state 1
|
||||||
Reading a token: Now at end of input.
|
Reading a token: Now at end of input.
|
||||||
Shifting token END (1.1-1.1: <]]kind[[> for 'E' @ 1)
|
Shifting token END (1.1: <]]kind[[> for 'E' @ 1)
|
||||||
Entering state 2
|
Entering state 2
|
||||||
Stack now 0 1 2
|
Stack now 0 1 2
|
||||||
Cleanup: popping token END (1.1-1.1: <]]kind[[> for 'E' @ 1)
|
Cleanup: popping token END (1.1: <]]kind[[> for 'E' @ 1)
|
||||||
Cleanup: popping nterm start (1.1-1.1: <]]kind[[> for 'S' @ 1)
|
Cleanup: popping nterm start (1.1: <]]kind[[> for 'S' @ 1)
|
||||||
]])
|
]])
|
||||||
|
|
||||||
m4_popdef([kind])
|
m4_popdef([kind])
|
||||||
@@ -1237,7 +1298,7 @@ AT_CHECK_ACTION_LOCATIONS([[%printer]])
|
|||||||
# Check that we can used qualified $$ (v.g., $<type>$) not only in
|
# Check that we can used qualified $$ (v.g., $<type>$) not only in
|
||||||
# rule actions, but also where $$ is valid: %printer and %destructor.
|
# rule actions, but also where $$ is valid: %printer and %destructor.
|
||||||
#
|
#
|
||||||
# FIXME: Not actually checking %desctructor, but it's the same code as
|
# FIXME: Not actually checking %destructor, but it's the same code as
|
||||||
# %printer...
|
# %printer...
|
||||||
#
|
#
|
||||||
# To do that, use a semantic value that has two fields (sem_type),
|
# To do that, use a semantic value that has two fields (sem_type),
|
||||||
@@ -1295,17 +1356,6 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
%printer { report (yyo, $<ival>$, $$ ); } <fval>;
|
%printer { report (yyo, $<ival>$, $$ ); } <fval>;
|
||||||
%printer { report (yyo, $<ival>$, $<fval>$); } <>;
|
%printer { report (yyo, $<ival>$, $<fval>$); } <>;
|
||||||
|
|
||||||
]AT_SKEL_CC_IF([[
|
|
||||||
/* The lalr1.cc skeleton, for backward compatibility, defines
|
|
||||||
a constructor for position that initializes the filename. The
|
|
||||||
glr.cc skeleton does not (and in fact cannot: location/position
|
|
||||||
are stored in a union, from which objects with constructors are
|
|
||||||
excluded in C++). */
|
|
||||||
%initial-action {
|
|
||||||
@$.initialize ();
|
|
||||||
}
|
|
||||||
]])[
|
|
||||||
|
|
||||||
%initial-action
|
%initial-action
|
||||||
{
|
{
|
||||||
$<ival>$ = 42;
|
$<ival>$ = 42;
|
||||||
|
|||||||
@@ -79,3 +79,13 @@ LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
|
|||||||
: ${XSLTPROC='@XSLTPROC@'}
|
: ${XSLTPROC='@XSLTPROC@'}
|
||||||
|
|
||||||
: ${PERL='@PERL@'}
|
: ${PERL='@PERL@'}
|
||||||
|
|
||||||
|
# Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
|
||||||
|
# as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
|
||||||
|
# the environment variable.
|
||||||
|
: ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
|
||||||
|
if env | grep '^POSIXLY_CORRECT=' >/dev/null; then
|
||||||
|
POSIXLY_CORRECT_IS_EXPORTED=true
|
||||||
|
else
|
||||||
|
POSIXLY_CORRECT_IS_EXPORTED=false
|
||||||
|
fi
|
||||||
|
|||||||
+14
-50
@@ -178,18 +178,7 @@ read_signed_integer (]AT_YYLEX_FORMALS[)
|
|||||||
|
|
||||||
]AT_YYLEX_PROTOTYPE[
|
]AT_YYLEX_PROTOTYPE[
|
||||||
{
|
{
|
||||||
static int init = 1;
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (init)
|
|
||||||
{
|
|
||||||
init = 0;
|
|
||||||
]AT_LOCATION_IF([
|
|
||||||
AT_LOC_LAST_COLUMN = 1;
|
|
||||||
AT_LOC_LAST_LINE = 1;
|
|
||||||
])[
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip current token, then white spaces. */
|
/* Skip current token, then white spaces. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -261,6 +250,8 @@ AT_SKEL_CC_IF(
|
|||||||
{
|
{
|
||||||
semantic_value ival;
|
semantic_value ival;
|
||||||
};
|
};
|
||||||
|
%printer { ]AT_SKEL_CC_IF([[yyoutput << $$]],
|
||||||
|
[[fprintf (yyoutput, "%d", $$)]])[; } <ival>;
|
||||||
|
|
||||||
%code provides
|
%code provides
|
||||||
{
|
{
|
||||||
@@ -280,24 +271,16 @@ AT_SKEL_CC_IF(
|
|||||||
FILE *input;
|
FILE *input;
|
||||||
static int power (int base, int exponent);
|
static int power (int base, int exponent);
|
||||||
|
|
||||||
]AT_SKEL_CC_IF(,
|
]AT_YYERROR_DECLARE[
|
||||||
[static void yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
|
|
||||||
AT_PARAM_IF([semantic_value *result, int *count, ])
|
|
||||||
const char *s
|
|
||||||
);])[
|
|
||||||
]AT_YYLEX_DECLARE_EXTERN[
|
]AT_YYLEX_DECLARE_EXTERN[
|
||||||
}
|
}
|
||||||
|
|
||||||
]AT_SKEL_CC_IF([AT_LOCATION_TYPE_IF([], [[
|
]AT_SKEL_CC_IF([AT_LOCATION_TYPE_IF([[
|
||||||
/* The lalr1.cc skeleton, for backward compatibility, defines
|
%initial-action
|
||||||
a constructor for position that initializes the filename. The
|
{
|
||||||
glr.cc skeleton does not (and in fact cannot: location/position
|
@$.first.l = @$.first.c = 1;
|
||||||
are stored in a union, from which objects with constructors are
|
@$.last = @$.first;
|
||||||
excluded in C++). */
|
}]])])[
|
||||||
%initial-action {
|
|
||||||
@$.initialize ();
|
|
||||||
}
|
|
||||||
]])])[
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
/* Bison Declarations */
|
||||||
%token CALC_EOF 0 "end of input"
|
%token CALC_EOF 0 "end of input"
|
||||||
@@ -365,27 +348,8 @@ power (int base, int exponent)
|
|||||||
o << '-' << s.last.c - 1;
|
o << '-' << s.last.c - 1;
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
]])
|
]])])[
|
||||||
AT_YYERROR_DEFINE],
|
]AT_YYERROR_DEFINE[
|
||||||
[/* A C error reporting function. */
|
|
||||||
static void
|
|
||||||
yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
|
|
||||||
AT_PARAM_IF([semantic_value *result, int *count, ])
|
|
||||||
const char *s)
|
|
||||||
{
|
|
||||||
AT_PARAM_IF([(void) result; (void) count;])
|
|
||||||
AT_YYERROR_SEES_LOC_IF([
|
|
||||||
fprintf (stderr, "%d.%d",
|
|
||||||
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);
|
|
||||||
if (AT_LOC_FIRST_LINE != AT_LOC_LAST_LINE)
|
|
||||||
fprintf (stderr, "-%d.%d",
|
|
||||||
AT_LOC_LAST_LINE, AT_LOC_LAST_COLUMN - 1);
|
|
||||||
else if (AT_LOC_FIRST_COLUMN != AT_LOC_LAST_COLUMN - 1)
|
|
||||||
fprintf (stderr, "-%d",
|
|
||||||
AT_LOC_LAST_COLUMN - 1);
|
|
||||||
fprintf (stderr, ": ");])
|
|
||||||
fprintf (stderr, "%s\n", s);
|
|
||||||
}])[
|
|
||||||
]AT_DEFINES_IF([],
|
]AT_DEFINES_IF([],
|
||||||
[AT_CALC_LEX
|
[AT_CALC_LEX
|
||||||
AT_CALC_MAIN])])
|
AT_CALC_MAIN])])
|
||||||
@@ -550,7 +514,7 @@ _AT_CHECK_CALC([$1],
|
|||||||
[842])
|
[842])
|
||||||
|
|
||||||
# Some syntax errors.
|
# Some syntax errors.
|
||||||
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [15],
|
_AT_CHECK_CALC_ERROR([$1], [1], [1 2], [15],
|
||||||
[1.3: syntax error, unexpected number])
|
[1.3: syntax error, unexpected number])
|
||||||
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
|
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
|
||||||
[1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!'])
|
[1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!'])
|
||||||
@@ -594,10 +558,10 @@ calc: error: 4444 != 1])
|
|||||||
|
|
||||||
# The same, but this time exercising explicitly triggered syntax errors.
|
# The same, but this time exercising explicitly triggered syntax errors.
|
||||||
# POSIX says the lookahead causing the error should not be discarded.
|
# POSIX says the lookahead causing the error should not be discarded.
|
||||||
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102],
|
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (1 2) = 1], [102],
|
||||||
[1.10: syntax error, unexpected number
|
[1.10: syntax error, unexpected number
|
||||||
calc: error: 2222 != 1])
|
calc: error: 2222 != 1])
|
||||||
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
|
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (1 2) = 1], [113],
|
||||||
[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
|
[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
|
||||||
1.12: syntax error, unexpected number
|
1.12: syntax error, unexpected number
|
||||||
calc: error: 2222 != 1])
|
calc: error: 2222 != 1])
|
||||||
|
|||||||
+2
-2
@@ -376,7 +376,7 @@ m4_define([_AT_GLR_STDERR],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_GLR_STDERR_WITH_LOC],
|
m4_define([_AT_GLR_STDERR_WITH_LOC],
|
||||||
[[17.5-4: syntax error
|
[[17.5: syntax error
|
||||||
]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_VERBOSE_GLR_STDERR],
|
m4_define([_AT_VERBOSE_GLR_STDERR],
|
||||||
@@ -384,7 +384,7 @@ m4_define([_AT_VERBOSE_GLR_STDERR],
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_VERBOSE_GLR_STDERR_WITH_LOC],
|
m4_define([_AT_VERBOSE_GLR_STDERR_WITH_LOC],
|
||||||
[[17.5-4: syntax error, unexpected ID, expecting '=' or '+' or ')'
|
[[17.5: syntax error, unexpected ID, expecting '=' or '+' or ')'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
## ---------------------------------------------------- ##
|
## ---------------------------------------------------- ##
|
||||||
|
|||||||
@@ -1543,13 +1543,6 @@ AT_DATA_GRAMMAR([glr-regr17.y],
|
|||||||
]AT_YYLEX_DECLARE[
|
]AT_YYLEX_DECLARE[
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%initial-action {
|
|
||||||
@$.first_line = 1;
|
|
||||||
@$.first_column = 1;
|
|
||||||
@$.last_line = 1;
|
|
||||||
@$.last_column = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
/* Tests the case of an empty RHS that has inherited the location of the
|
/* Tests the case of an empty RHS that has inherited the location of the
|
||||||
|
|||||||
+6
-3
@@ -240,9 +240,6 @@ AT_TEST([x7], [%define api.push-pull both])
|
|||||||
AT_TEST([x8], [%define api.pure %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_TEST([x5], [%locations %language "c++" %glr-parser])
|
||||||
|
|
||||||
AT_COMPILE_CXX([parser], [[x[1-8].o -DCC_IS_CXX=$CC_IS_CXX main.cc]])
|
|
||||||
AT_CHECK([./parser], [0], [[expout]])
|
|
||||||
|
|
||||||
# Check that the headers are self-contained, and protected against
|
# Check that the headers are self-contained, and protected against
|
||||||
# multiple inclusions. While at it, check they are sane for C++.
|
# multiple inclusions. While at it, check they are sane for C++.
|
||||||
for h in *.h *.hh
|
for h in *.h *.hh
|
||||||
@@ -256,6 +253,12 @@ EOF
|
|||||||
AT_COMPILE_CXX([$h.o])
|
AT_COMPILE_CXX([$h.o])
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Do this late, so that other checks have been performed.
|
||||||
|
AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
|
||||||
|
|
||||||
|
AT_COMPILE_CXX([parser], [[x[1-8].o -DCC_IS_CXX=$CC_IS_CXX main.cc]])
|
||||||
|
AT_CHECK([./parser], [0], [[expout]])
|
||||||
|
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
@@ -20,6 +20,67 @@ AT_BANNER([[Input Processing.]])
|
|||||||
# Mostly test that we are robust to mistakes.
|
# Mostly test that we are robust to mistakes.
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Invalid inputs. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
AT_SETUP([Invalid inputs])
|
||||||
|
|
||||||
|
AT_DATA([input.y],
|
||||||
|
[[\000\001\002\377?
|
||||||
|
%%
|
||||||
|
?
|
||||||
|
default: 'a' }
|
||||||
|
%&
|
||||||
|
%a-does-not-exist
|
||||||
|
%-
|
||||||
|
%{
|
||||||
|
]])
|
||||||
|
AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
|
[[input.y:1.1: invalid character: '\0'
|
||||||
|
input.y:1.1: invalid character: '\001'
|
||||||
|
input.y:1.1: invalid character: '\002'
|
||||||
|
input.y:1.1: invalid character: '\377'
|
||||||
|
input.y:1.2: invalid character: '?'
|
||||||
|
input.y:3.1: invalid character: '?'
|
||||||
|
input.y:4.14: invalid character: '}'
|
||||||
|
input.y:5.1: invalid character: '%'
|
||||||
|
input.y:5.2: invalid character: '&'
|
||||||
|
input.y:6.1-17: invalid directive: '%a-does-not-exist'
|
||||||
|
input.y:7.1: invalid character: '%'
|
||||||
|
input.y:7.2: invalid character: '-'
|
||||||
|
input.y:8.1-9.0: missing '%}' at end of file
|
||||||
|
input.y:8.1-9.0: syntax error, unexpected %{...%}
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
AT_SETUP([Invalid inputs with {}])
|
||||||
|
|
||||||
|
# We used to SEGV here. See
|
||||||
|
# http://lists.gnu.org/archive/html/bug-bison/2005-07/msg00053.html
|
||||||
|
|
||||||
|
AT_DATA([input.y],
|
||||||
|
[[
|
||||||
|
%destructor
|
||||||
|
%initial-action
|
||||||
|
%lex-param
|
||||||
|
%parse-param
|
||||||
|
%printer
|
||||||
|
%union
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
|
[[input.y:3.1-15: syntax error, unexpected %initial-action, expecting {...}
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Invalid $n. ##
|
## Invalid $n. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|||||||
+60
-16
@@ -119,6 +119,7 @@ m4_pushdef([AT_SKEL_CC_IF],
|
|||||||
[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])])
|
[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1], [$2])])
|
||||||
m4_pushdef([AT_SKEL_JAVA_IF],
|
m4_pushdef([AT_SKEL_JAVA_IF],
|
||||||
[m4_bmatch([$3], [%language "[Jj][Aa][Vv][Aa]"\|%skeleton "[a-z0-9]+\.java"], [$1], [$2])])
|
[m4_bmatch([$3], [%language "[Jj][Aa][Vv][Aa]"\|%skeleton "[a-z0-9]+\.java"], [$1], [$2])])
|
||||||
|
# The target language: "c", "c++", or "java".
|
||||||
m4_pushdef([AT_LANG],
|
m4_pushdef([AT_LANG],
|
||||||
[AT_SKEL_JAVA_IF([java],
|
[AT_SKEL_JAVA_IF([java],
|
||||||
[AT_SKEL_CC_IF([c++],
|
[AT_SKEL_CC_IF([c++],
|
||||||
@@ -140,6 +141,12 @@ m4_pushdef([AT_LOCATION_TYPE_IF],
|
|||||||
[m4_bmatch([$3], [%define location_type], [$1], [$2])])
|
[m4_bmatch([$3], [%define location_type], [$1], [$2])])
|
||||||
m4_pushdef([AT_PARAM_IF],
|
m4_pushdef([AT_PARAM_IF],
|
||||||
[m4_bmatch([$3], [%parse-param], [$1], [$2])])
|
[m4_bmatch([$3], [%parse-param], [$1], [$2])])
|
||||||
|
# Comma-terminated list of formals parse-parameters.
|
||||||
|
# E.g., %parse-param { int x } {int y} -> "int x, int y, ".
|
||||||
|
m4_pushdef([AT_PARSE_PARAMS])
|
||||||
|
m4_bpatsubst([$3], [%parse-param { *\([^{}]*[^{} ]\) *}],
|
||||||
|
[m4_append([AT_PARSE_PARAMS], [\1, ])])
|
||||||
|
|
||||||
m4_pushdef([AT_PURE_IF],
|
m4_pushdef([AT_PURE_IF],
|
||||||
[m4_bmatch([$3], [%define *api\.pure\|%pure-parser],
|
[m4_bmatch([$3], [%define *api\.pure\|%pure-parser],
|
||||||
[m4_bmatch([$3], [%define *api\.pure *"?false"?], [$2], [$1])],
|
[m4_bmatch([$3], [%define *api\.pure *"?false"?], [$2], [$1])],
|
||||||
@@ -241,6 +248,7 @@ m4_popdef([AT_GLR_OR_PARAM_IF])
|
|||||||
m4_popdef([AT_PURE_AND_LOC_IF])
|
m4_popdef([AT_PURE_AND_LOC_IF])
|
||||||
m4_popdef([AT_LOCATION_TYPE_IF])
|
m4_popdef([AT_LOCATION_TYPE_IF])
|
||||||
m4_popdef([AT_LOCATION_IF])
|
m4_popdef([AT_LOCATION_IF])
|
||||||
|
m4_popdef([AT_PARSE_PARAMS])
|
||||||
m4_popdef([AT_PARAM_IF])
|
m4_popdef([AT_PARAM_IF])
|
||||||
m4_popdef([AT_LEXPARAM_IF])
|
m4_popdef([AT_LEXPARAM_IF])
|
||||||
m4_popdef([AT_YACC_IF])
|
m4_popdef([AT_YACC_IF])
|
||||||
@@ -350,7 +358,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([AT_YYLTYPE *llocp, ])[const char *msg]])[]dnl
|
[c], [AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])AT_PARSE_PARAMS [const char *msg]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
m4_define([AT_YYERROR_PROTOTYPE],
|
m4_define([AT_YYERROR_PROTOTYPE],
|
||||||
@@ -374,16 +382,11 @@ m4_define([AT_YYERROR_DEFINE],
|
|||||||
/* A C error reporting function. */
|
/* A C error reporting function. */
|
||||||
static
|
static
|
||||||
]AT_YYERROR_PROTOTYPE[
|
]AT_YYERROR_PROTOTYPE[
|
||||||
{
|
{]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
|
||||||
]AT_YYERROR_SEES_LOC_IF([[
|
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\), *], [
|
||||||
fprintf (stderr, "%d.%d",
|
YYUSE(\1);])dnl
|
||||||
]AT_LOC_FIRST_LINE[, ]AT_LOC_FIRST_COLUMN[);
|
AT_YYERROR_SEES_LOC_IF([[
|
||||||
if (]AT_LOC_FIRST_LINE[ != ]AT_LOC_LAST_LINE[)
|
YY_LOCATION_PRINT (stderr, ]AT_LOC[);
|
||||||
fprintf (stderr, "-%d.%d",
|
|
||||||
]AT_LOC_LAST_LINE[, ]AT_LOC_LAST_COLUMN[ - 1);
|
|
||||||
else if (]AT_LOC_FIRST_COLUMN[ != ]AT_LOC_LAST_COLUMN[ - 1)
|
|
||||||
fprintf (stderr, "-%d",
|
|
||||||
]AT_LOC_LAST_COLUMN[ - 1);
|
|
||||||
fprintf (stderr, ": ");]])[
|
fprintf (stderr, ": ");]])[
|
||||||
fprintf (stderr, "%s\n", msg);
|
fprintf (stderr, "%s\n", msg);
|
||||||
}]],
|
}]],
|
||||||
@@ -462,10 +465,10 @@ m4_define([AT_BISON_CHECK_WARNINGS],
|
|||||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||||
|
|
||||||
m4_define([AT_BISON_CHECK_WARNINGS_],
|
m4_define([AT_BISON_CHECK_WARNINGS_],
|
||||||
[[# Defining POSIXLY_CORRECT causes bison to complain if options
|
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
|
||||||
# are added after the grammar file name, so skip these checks
|
# added after the grammar file name, so skip these checks in that
|
||||||
# in that case.
|
# case.
|
||||||
if test -z "${POSIXLY_CORRECT+set}"; then
|
if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
|
||||||
]AT_SAVE_SPECIAL_FILES[
|
]AT_SAVE_SPECIAL_FILES[
|
||||||
|
|
||||||
# To avoid expanding it repeatedly, store specified stdout.
|
# To avoid expanding it repeatedly, store specified stdout.
|
||||||
@@ -590,7 +593,10 @@ m4_define([AT_QUELL_VALGRIND],
|
|||||||
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
|
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
|
||||||
# with trailing .o removed, and ".c" appended.
|
# with trailing .o removed, and ".c" appended.
|
||||||
m4_define([AT_COMPILE],
|
m4_define([AT_COMPILE],
|
||||||
[AT_CHECK(m4_join([ ],
|
[AT_CHECK([case $POSIXLY_CORRECT_IS_EXPORTED:$C_COMPILER_POSIXLY_CORRECT in
|
||||||
|
true:false) echo 'cannot compile properly with POSIXLY_CORRECT' && exit 77;;
|
||||||
|
esac])
|
||||||
|
AT_CHECK(m4_join([ ],
|
||||||
[$CC $CFLAGS $CPPFLAGS],
|
[$CC $CFLAGS $CPPFLAGS],
|
||||||
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
|
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
|
||||||
[-o $1],
|
[-o $1],
|
||||||
@@ -676,6 +682,44 @@ m4_define([AT_FULL_COMPILE],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
|
||||||
|
# --------------------------------
|
||||||
|
# Check that we can link together C and C++ objects.
|
||||||
|
m4_define([AT_SKIP_IF_CANNOT_LINK_C_AND_CXX],
|
||||||
|
[AT_DATA([c-and-cxx.h],
|
||||||
|
[[#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
int fortytwo (void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
]])
|
||||||
|
AT_DATA([c-only.c],
|
||||||
|
[[#include "c-and-cxx.h"
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
return fortytwo () == 42 ? 0 : 1;
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
AT_DATA([cxx-only.cc],
|
||||||
|
[[#include "c-and-cxx.h"
|
||||||
|
int fortytwo ()
|
||||||
|
{
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
AT_COMPILE([c-only.o], [c-only.c])
|
||||||
|
AT_COMPILE_CXX([cxx-only.o], [cxx-only.cc])
|
||||||
|
AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS c-only.o cxx-only.o -o c-and-cxx ||
|
||||||
|
exit 77], [ignore], [ignore])
|
||||||
|
AT_CHECK([./c-and-cxx])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## ---------------------------- ##
|
## ---------------------------- ##
|
||||||
## Running a generated parser. ##
|
## Running a generated parser. ##
|
||||||
## ---------------------------- ##
|
## ---------------------------- ##
|
||||||
|
|||||||
+6
-1
@@ -443,14 +443,19 @@ AT_SETUP([Stray symbols in brackets])
|
|||||||
AT_DATA_GRAMMAR([test.y],
|
AT_DATA_GRAMMAR([test.y],
|
||||||
[[
|
[[
|
||||||
%%
|
%%
|
||||||
start: foo[ /* aaa */ *&-.+ ] bar
|
start: foo[ /* aaa */ *&-.+\000\001\002\377 ] bar
|
||||||
{ s = $foo; }
|
{ s = $foo; }
|
||||||
]])
|
]])
|
||||||
|
AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77]])
|
||||||
AT_BISON_CHECK([-o test.c test.y], 1, [],
|
AT_BISON_CHECK([-o test.c test.y], 1, [],
|
||||||
[[test.y:11.23: invalid character in bracketed name: '*'
|
[[test.y:11.23: invalid character in bracketed name: '*'
|
||||||
test.y:11.24: invalid character in bracketed name: '&'
|
test.y:11.24: invalid character in bracketed name: '&'
|
||||||
test.y:11.25: invalid character in bracketed name: '-'
|
test.y:11.25: invalid character in bracketed name: '-'
|
||||||
test.y:11.27: invalid character in bracketed name: '+'
|
test.y:11.27: invalid character in bracketed name: '+'
|
||||||
|
test.y:11.28: invalid character in bracketed name: '\0'
|
||||||
|
test.y:11.28: invalid character in bracketed name: '\001'
|
||||||
|
test.y:11.28: invalid character in bracketed name: '\002'
|
||||||
|
test.y:11.28: invalid character in bracketed name: '\377'
|
||||||
]])
|
]])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|||||||
+9
-69
@@ -383,58 +383,6 @@ AT_CLEANUP
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## Invalid inputs. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
AT_SETUP([Invalid inputs])
|
|
||||||
|
|
||||||
AT_DATA([input.y],
|
|
||||||
[[%%
|
|
||||||
?
|
|
||||||
default: 'a' }
|
|
||||||
%&
|
|
||||||
%a-does-not-exist
|
|
||||||
%-
|
|
||||||
%{
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
|
||||||
[[input.y:2.1: invalid character: '?'
|
|
||||||
input.y:3.14: invalid character: '}'
|
|
||||||
input.y:4.1: invalid character: '%'
|
|
||||||
input.y:4.2: invalid character: '&'
|
|
||||||
input.y:5.1-17: invalid directive: '%a-does-not-exist'
|
|
||||||
input.y:6.1: invalid character: '%'
|
|
||||||
input.y:6.2: invalid character: '-'
|
|
||||||
input.y:7.1-8.0: missing '%}' at end of file
|
|
||||||
input.y:7.1-8.0: syntax error, unexpected %{...%}
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
|
|
||||||
AT_SETUP([Invalid inputs with {}])
|
|
||||||
|
|
||||||
AT_DATA([input.y],
|
|
||||||
[[
|
|
||||||
%destructor
|
|
||||||
%initial-action
|
|
||||||
%lex-param
|
|
||||||
%parse-param
|
|
||||||
%printer
|
|
||||||
%union
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
|
||||||
[[input.y:3.1-15: syntax error, unexpected %initial-action, expecting {...}
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
## Token definitions. ##
|
## Token definitions. ##
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
@@ -1597,14 +1545,14 @@ AT_CLEANUP
|
|||||||
m4_pushdef([AT_TEST],
|
m4_pushdef([AT_TEST],
|
||||||
[AT_SETUP([[Lex and parse params: $1]])
|
[AT_SETUP([[Lex and parse params: $1]])
|
||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([%locations %skeleton $1])
|
AT_BISON_OPTION_PUSHDEFS([%locations %skeleton "$1" %parse-param { int x } %parse-param { int y }])
|
||||||
|
|
||||||
## FIXME: Improve parsing of parse-param and use the generated
|
## FIXME: Improve parsing of parse-param and use the generated
|
||||||
## yyerror.
|
## yyerror.
|
||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[%defines
|
[[%defines
|
||||||
%locations
|
%locations
|
||||||
%skeleton $1
|
%skeleton "$1"
|
||||||
%union { int ival; }
|
%union { int ival; }
|
||||||
%parse-param { int x }
|
%parse-param { int x }
|
||||||
// Spaces, tabs, and new lines.
|
// Spaces, tabs, and new lines.
|
||||||
@@ -1618,26 +1566,18 @@ AT_DATA_GRAMMAR([input.y],
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
]AT_SKEL_CC_IF([], [[
|
]AT_YYERROR_DECLARE[
|
||||||
static
|
|
||||||
void
|
|
||||||
yyerror (int x, int y, const char *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "x: %d, y: %d, %s\n", x, y, msg);
|
|
||||||
}]])[
|
|
||||||
|
|
||||||
]AT_YYLEX_DECLARE[
|
]AT_YYLEX_DECLARE[
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
exp: 'a' { fprintf (stdout, "x: %d, y: %d\n", x, y); };
|
exp: 'a' { fprintf (stdout, "x: %d, y: %d\n", x, y); };
|
||||||
%%
|
%%
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
]AT_YYLEX_DEFINE(["a"])[
|
]AT_YYLEX_DEFINE(["a"])[
|
||||||
|
|
||||||
]AT_SKEL_CC_IF(
|
]AT_SKEL_CC_IF(
|
||||||
[AT_YYERROR_DEFINE
|
[int
|
||||||
|
|
||||||
int
|
|
||||||
yyparse (int x, int y)
|
yyparse (int x, int y)
|
||||||
{
|
{
|
||||||
yy::parser parser(x, y);
|
yy::parser parser(x, y);
|
||||||
@@ -1661,9 +1601,9 @@ AT_CLEANUP
|
|||||||
])
|
])
|
||||||
|
|
||||||
## FIXME: test Java, and iterate over skeletons.
|
## FIXME: test Java, and iterate over skeletons.
|
||||||
AT_TEST("yacc.c")
|
AT_TEST([yacc.c])
|
||||||
AT_TEST("glr.c")
|
AT_TEST([glr.c])
|
||||||
AT_TEST("lalr1.cc")
|
AT_TEST([lalr1.cc])
|
||||||
AT_TEST("glr.cc")
|
AT_TEST([glr.cc])
|
||||||
|
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
|
|||||||
+1
-1
@@ -431,7 +431,7 @@ int
|
|||||||
main (int argc, const char **argv)
|
main (int argc, const char **argv)
|
||||||
{
|
{
|
||||||
YYSTYPE yylval_init = get_args (argc, argv);
|
YYSTYPE yylval_init = get_args (argc, argv);
|
||||||
int status;
|
int status = 0;
|
||||||
int count;
|
int count;
|
||||||
]m4_bmatch([$2], [api.push-pull both],
|
]m4_bmatch([$2], [api.push-pull both],
|
||||||
[[ yypstate *ps = yypstate_new ();
|
[[ yypstate *ps = yypstate_new ();
|
||||||
|
|||||||
Reference in New Issue
Block a user