mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-16 06:05:14 +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 | ||
|
|
0ac1584946 | ||
|
|
40a1cd37f3 | ||
|
|
468455e12b | ||
|
|
a4eb820f17 | ||
|
|
6eb8f74f8f | ||
|
|
cc5a986ce4 | ||
|
|
ae2199381e | ||
|
|
7b70847e58 | ||
|
|
19d9b60787 | ||
|
|
8f8439cee1 | ||
|
|
fa5303b8ff | ||
|
|
39845e8e40 | ||
|
|
5b34bb3110 | ||
|
|
c955769a75 | ||
|
|
82443642d2 | ||
|
|
e272d9dc80 | ||
|
|
9a50c55af7 | ||
|
|
e28ce5def0 | ||
|
|
7aa15a0026 | ||
|
|
90b1335aed | ||
|
|
ddbd0c40dc | ||
|
|
c473e022d9 | ||
|
|
6192d2c6de | ||
|
|
3746fc33c4 | ||
|
|
36cdaaac53 | ||
|
|
63fec1eeba | ||
|
|
6b4cb804b5 | ||
|
|
53425dbfaa | ||
|
|
403ddfb7e0 | ||
|
|
76e5017732 | ||
|
|
592bdad15e | ||
|
|
457bf91968 | ||
|
|
2e350a617f | ||
|
|
d740d2b541 | ||
|
|
e411069eee | ||
|
|
ae62d0fc4f | ||
|
|
e3f8c4ef69 | ||
|
|
933ec5449f |
+1
-1
@@ -1 +1 @@
|
|||||||
2.6.1
|
2.6.4
|
||||||
|
|||||||
@@ -1,5 +1,72 @@
|
|||||||
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]
|
||||||
|
|
||||||
|
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Bugs and portability issues in the test suite have been fixed.
|
||||||
|
|
||||||
|
Some errors in translations have been addressed, and --help now directs
|
||||||
|
users to the appropriate place to report them.
|
||||||
|
|
||||||
|
Stray Info files shipped by accident are removed.
|
||||||
|
|
||||||
|
Incorrect definitions of YY_, issued by yacc.c when no parser header is
|
||||||
|
generated, are removed.
|
||||||
|
|
||||||
|
All the generated headers are self-contained.
|
||||||
|
|
||||||
|
** Header guards (yacc.c, glr.c, glr.cc)
|
||||||
|
|
||||||
|
In order to avoid collisions, the header guards are now
|
||||||
|
YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
|
||||||
|
For instance the header generated from
|
||||||
|
|
||||||
|
%define api.prefix "calc"
|
||||||
|
%defines "lib/parse.h"
|
||||||
|
|
||||||
|
will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
|
||||||
|
|
||||||
|
** Fix compiler warnings in the generated parser (yacc.c, glr.c)
|
||||||
|
|
||||||
|
The compilation of pure parsers (%define api.pure) can trigger GCC
|
||||||
|
warnings such as:
|
||||||
|
|
||||||
|
input.c: In function 'yyparse':
|
||||||
|
input.c:1503:12: warning: 'yylval' may be used uninitialized in this
|
||||||
|
function [-Wmaybe-uninitialized]
|
||||||
|
*++yyvsp = yylval;
|
||||||
|
^
|
||||||
|
|
||||||
|
This is now fixed; pragmas to avoid these warnings are no longer needed.
|
||||||
|
|
||||||
|
Warnings from clang ("equality comparison with extraneous parentheses" and
|
||||||
|
"function declared 'noreturn' should not return") have also been
|
||||||
|
addressed.
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1857,7 +1924,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
||||||
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
||||||
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
||||||
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp
|
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp calc yyo fval
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
|||||||
@@ -168,6 +168,19 @@ decide whether to update.
|
|||||||
** make check
|
** make check
|
||||||
Use liberally.
|
Use liberally.
|
||||||
|
|
||||||
|
** Typical errors
|
||||||
|
If the test suite shows failures such as the following one
|
||||||
|
|
||||||
|
.../bison/lib/getopt.h:196:8: error: redefinition of 'struct option'
|
||||||
|
/usr/include/getopt.h:54:8: error: previous definition of 'struct option'
|
||||||
|
|
||||||
|
it probably means that some file was compiled without
|
||||||
|
AT_DATA_SOURCE_PROLOGUE. This error is due to the fact that our -I options
|
||||||
|
pick up gnulib's replacement headers, such as getopt.h, and this will go
|
||||||
|
wrong if config.h was not included first.
|
||||||
|
|
||||||
|
See tests/local.at for details.
|
||||||
|
|
||||||
** make maintainer-check-valgrind
|
** make maintainer-check-valgrind
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Airy Andre [email protected]
|
|||||||
Akim Demaille [email protected]
|
Akim Demaille [email protected]
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Alexandre Duret-Lutz adl@src.lip6.fr
|
Alexandre Duret-Lutz adl@lrde.epita.fr
|
||||||
Andreas Schwab [email protected]
|
Andreas Schwab [email protected]
|
||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
Angelo Borsotti [email protected]
|
||||||
@@ -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,12 +88,14 @@ 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]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
|
Rob Vermaas [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
|
|||||||
+22
-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],
|
||||||
@@ -123,6 +140,10 @@ AC_PROG_GNU_M4
|
|||||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||||
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
||||||
supports -g, otherwise to "".])
|
supports -g, otherwise to "".])
|
||||||
|
AC_PATH_PROG([PERL], [perl])
|
||||||
|
if test -z "$PERL"; then
|
||||||
|
AC_MSG_ERROR([perl not found])
|
||||||
|
fi
|
||||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||||
AC_SUBST([XSLTPROC])
|
AC_SUBST([XSLTPROC])
|
||||||
|
|||||||
@@ -30,19 +30,21 @@ m4_define([b4_tocpp],
|
|||||||
# ------------------
|
# ------------------
|
||||||
# A valid C macro name to use as a CPP header guard for FILE.
|
# A valid C macro name to use as a CPP header guard for FILE.
|
||||||
m4_define([b4_cpp_guard],
|
m4_define([b4_cpp_guard],
|
||||||
[b4_tocpp(m4_defn([b4_prefix])/[$1])])
|
[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
|
||||||
|
|
||||||
|
|
||||||
# b4_cpp_guard_open(FILE)
|
# b4_cpp_guard_open(FILE)
|
||||||
# b4_cpp_guard_close(FILE)
|
# b4_cpp_guard_close(FILE)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Open/close CPP inclusion guards for FILE.
|
# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
|
||||||
m4_define([b4_cpp_guard_open],
|
m4_define([b4_cpp_guard_open],
|
||||||
|
[m4_ifval(m4_quote($1),
|
||||||
[#ifndef b4_cpp_guard([$1])
|
[#ifndef b4_cpp_guard([$1])
|
||||||
# define b4_cpp_guard([$1])])
|
# define b4_cpp_guard([$1])])])
|
||||||
|
|
||||||
m4_define([b4_cpp_guard_close],
|
m4_define([b4_cpp_guard_close],
|
||||||
[#endif b4_comment([!b4_cpp_guard([$1])])])
|
[m4_ifval(m4_quote($1),
|
||||||
|
[#endif b4_comment([!b4_cpp_guard([$1])])])])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -182,7 +184,7 @@ m4_define([b4_table_value_equals],
|
|||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
||||||
[[YYID (0)]],
|
[[YYID (0)]],
|
||||||
[[((]$2[) == (]$3[))]])])
|
[(!!(($2) == ($3)))])])
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
@@ -600,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
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -641,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
|
||||||
|
]])
|
||||||
|
|||||||
+23
-45
@@ -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
|
||||||
@@ -241,24 +241,24 @@ b4_percent_code_get[]dnl
|
|||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YY_
|
# ifndef YY_
|
||||||
# define YY_(msgid) msgid
|
# define YY_(Msgid) Msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#if ! defined lint || defined __GNUC__
|
#if ! defined lint || defined __GNUC__
|
||||||
# define YYUSE(e) ((void) (e))
|
# define YYUSE(E) ((void) (E))
|
||||||
#else
|
#else
|
||||||
# define YYUSE(e) /* empty */
|
# define YYUSE(E) /* empty */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Identity function, used to suppress warnings about constant conditions. */
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
# define YYID(n) (n)
|
# define YYID(N) (N)
|
||||||
#else
|
#else
|
||||||
]b4_c_function_def([YYID], [static int], [[int i], [i]])[
|
]b4_c_function_def([YYID], [static int], [[int i], [i]])[
|
||||||
{
|
{
|
||||||
@@ -289,8 +289,9 @@ b4_percent_code_get[]dnl
|
|||||||
#ifndef YYSETJMP
|
#ifndef YYSETJMP
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
# define YYJMP_BUF jmp_buf
|
# define YYJMP_BUF jmp_buf
|
||||||
# define YYSETJMP(env) setjmp (env)
|
# define YYSETJMP(Env) setjmp (Env)
|
||||||
# define YYLONGJMP(env, val) longjmp (env, val)
|
// Pacify clang.
|
||||||
|
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------.
|
/*-----------------.
|
||||||
@@ -313,7 +314,7 @@ b4_percent_code_get[]dnl
|
|||||||
#endif])[
|
#endif])[
|
||||||
|
|
||||||
#ifndef YYASSERT
|
#ifndef YYASSERT
|
||||||
# define YYASSERT(condition) ((void) ((condition) || (abort (), 0)))
|
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
@@ -474,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)[
|
||||||
@@ -972,8 +955,8 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
return yyr1[yyrule];
|
return yyr1[yyrule];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yypact_value_is_default(Yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
/** True iff LR state STATE has only a default reduction (regardless
|
/** True iff LR state STATE has only a default reduction (regardless
|
||||||
* of token). */
|
* of token). */
|
||||||
@@ -990,8 +973,8 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
return yydefact[yystate];
|
return yydefact[yystate];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
@@ -2294,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_)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-5
@@ -30,7 +30,7 @@ b4_copyright([Positions for Bison parsers in C++],
|
|||||||
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||||
|
|
||||||
# include <algorithm> // std::max
|
# include <algorithm> // std::max
|
||||||
# include <iosfwd>
|
# include <iostream>
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
@@ -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;
|
||||||
@@ -159,8 +159,6 @@ b4_copyright([Locations for Bison parsers in C++],
|
|||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
||||||
|
|
||||||
# include <iostream>
|
|
||||||
# include <string>
|
|
||||||
# include "position.hh"
|
# include "position.hh"
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|||||||
+59
-66
@@ -170,11 +170,35 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
|||||||
/* The lookahead symbol. */
|
/* The lookahead symbol. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
|
]b4_pure_if([[
|
||||||
|
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#else
|
||||||
|
/* Default value used for initialization, for pacifying older GCCs
|
||||||
|
or non-GCC compilers. */
|
||||||
|
static YYSTYPE yyval_default;
|
||||||
|
# define YY_INITIAL_VALUE(Value) = Value
|
||||||
|
#endif]])[
|
||||||
|
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
|
#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;]])])
|
||||||
@@ -242,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], [,
|
||||||
@@ -345,9 +369,11 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* In a future release of Bison, this section will be replaced
|
]m4_ifval(m4_quote(b4_spec_defines_file),
|
||||||
|
[[/* In a future release of Bison, this section will be replaced
|
||||||
by #include "@basename(]b4_spec_defines_file[@)". */
|
by #include "@basename(]b4_spec_defines_file[@)". */
|
||||||
]b4_shared_declarations[
|
]])dnl
|
||||||
|
b4_shared_declarations[
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -402,24 +428,24 @@ typedef short int yytype_int16;
|
|||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YY_
|
# ifndef YY_
|
||||||
# define YY_(msgid) msgid
|
# define YY_(Msgid) Msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#if ! defined lint || defined __GNUC__
|
#if ! defined lint || defined __GNUC__
|
||||||
# define YYUSE(e) ((void) (e))
|
# define YYUSE(E) ((void) (E))
|
||||||
#else
|
#else
|
||||||
# define YYUSE(e) /* empty */
|
# define YYUSE(E) /* empty */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Identity function, used to suppress warnings about constant conditions. */
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
# define YYID(n) (n)
|
# define YYID(N) (N)
|
||||||
#else
|
#else
|
||||||
]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
|
]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
|
||||||
{
|
{
|
||||||
@@ -678,11 +704,11 @@ static const ]b4_int_type_for([b4_table])[ yytable[] =
|
|||||||
]b4_table[
|
]b4_table[
|
||||||
};
|
};
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yypact_value_is_default(Yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
||||||
{
|
{
|
||||||
@@ -741,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
|
||||||
@@ -1407,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
|
||||||
@@ -1487,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]))], [[
|
||||||
|
|
||||||
|
|
||||||
@@ -1513,7 +1516,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
int yyn;
|
int yyn;
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead token as an internal (translated) token number. */
|
||||||
int yytoken;
|
int yytoken = 0;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
YYSTYPE yyval;]b4_locations_if([[
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
@@ -1538,10 +1541,9 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
yytoken = 0;
|
yyssp = yyss = yyssa;
|
||||||
yyss = yyssa;
|
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
||||||
yyvs = yyvsa;]b4_locations_if([[
|
yylsp = yyls = yylsa;]])[
|
||||||
yyls = yylsa;]])[
|
|
||||||
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
||||||
|
|
||||||
yyes = yyesa;
|
yyes = yyesa;
|
||||||
@@ -1555,30 +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;
|
|
||||||
|
|
||||||
#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;
|
||||||
|
|
||||||
/*------------------------------------------------------------.
|
/*------------------------------------------------------------.
|
||||||
@@ -1749,7 +1738,9 @@ yyread_pushed_token:]])[
|
|||||||
YY_LAC_DISCARD ("shift");]])[
|
YY_LAC_DISCARD ("shift");]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([ *++yylsp = yylloc;])[
|
]b4_locations_if([ *++yylsp = yylloc;])[
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -1969,7 +1960,9 @@ yyerrlab1:
|
|||||||
current lookahead token, the shift below will for sure. */
|
current lookahead token, the shift below will for sure. */
|
||||||
YY_LAC_DISCARD ("error recovery");]])[
|
YY_LAC_DISCARD ("error recovery");]])[
|
||||||
|
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[2] = yylloc;
|
||||||
/* Using YYLLOC is tempting, but would change the location of
|
/* Using YYLLOC is tempting, but would change the location of
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,3 @@
|
|||||||
/*.info*
|
|
||||||
/*~
|
/*~
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
/Makefile
|
/Makefile
|
||||||
@@ -10,6 +9,7 @@
|
|||||||
/bison.dvi
|
/bison.dvi
|
||||||
/bison.fn
|
/bison.fn
|
||||||
/bison.html
|
/bison.html
|
||||||
|
/bison.info
|
||||||
/bison.ky
|
/bison.ky
|
||||||
/bison.log
|
/bison.log
|
||||||
/bison.pdf
|
/bison.pdf
|
||||||
|
|||||||
+1
-1
@@ -940,7 +940,7 @@ EXTERNAL_GROUPS = YES
|
|||||||
# The PERL_PATH should be the absolute path and name of the perl script
|
# The PERL_PATH should be the absolute path and name of the perl script
|
||||||
# interpreter (i.e. the result of `which perl').
|
# interpreter (i.e. the result of `which perl').
|
||||||
|
|
||||||
PERL_PATH = /usr/bin/perl
|
PERL_PATH = @PERL@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the dot tool
|
# Configuration options related to the dot tool
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ $(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL)
|
|||||||
$(AM_V_at)rm -f $@.tmp
|
$(AM_V_at)rm -f $@.tmp
|
||||||
$(AM_V_at)cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
$(AM_V_at)cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
$(AM_V_at)$(top_builddir)/src/bison --help \
|
$(AM_V_at)$(top_builddir)/src/bison --help \
|
||||||
| perl $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
| $(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
||||||
$(AM_V_at)diff -u $@~ $@.tmp || true
|
$(AM_V_at)diff -u $@~ $@.tmp || true
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
||||||
|
|||||||
+39
-11
@@ -5076,7 +5076,7 @@ default location or at the location specified by @var{qualifier}.
|
|||||||
|
|
||||||
@deffn {Directive} %debug
|
@deffn {Directive} %debug
|
||||||
In the parser implementation file, define the macro @code{YYDEBUG} (or
|
In the parser implementation file, define the macro @code{YYDEBUG} (or
|
||||||
@code{@var{prefix}DEBUG} with @samp{%define api.prefix @var{prefix}}), see
|
@code{@var{prefix}DEBUG} with @samp{%define api.prefix @var{prefix}}, see
|
||||||
@ref{Multiple Parsers, ,Multiple Parsers in the Same Program}) to 1 if it is
|
@ref{Multiple Parsers, ,Multiple Parsers in the Same Program}) to 1 if it is
|
||||||
not already defined, so that the debugging facilities are compiled.
|
not already defined, so that the debugging facilities are compiled.
|
||||||
@xref{Tracing, ,Tracing Your Parser}.
|
@xref{Tracing, ,Tracing Your Parser}.
|
||||||
@@ -5124,6 +5124,23 @@ Values, ,Semantic Values of Tokens}.
|
|||||||
If you have declared @code{%code requires} or @code{%code provides}, the output
|
If you have declared @code{%code requires} or @code{%code provides}, the output
|
||||||
header also contains their code.
|
header also contains their code.
|
||||||
@xref{%code Summary}.
|
@xref{%code Summary}.
|
||||||
|
|
||||||
|
@cindex Header guard
|
||||||
|
The generated header is protected against multiple inclusions with a C
|
||||||
|
preprocessor guard: @samp{YY_@var{PREFIX}_@var{FILE}_INCLUDED}, where
|
||||||
|
@var{PREFIX} and @var{FILE} are the prefix (@pxref{Multiple Parsers,
|
||||||
|
,Multiple Parsers in the Same Program}) and generated file name turned
|
||||||
|
uppercase, with each series of non alphanumerical characters converted to a
|
||||||
|
single underscore.
|
||||||
|
|
||||||
|
For instance with @samp{%define api.prefix "calc"} and @samp{%defines
|
||||||
|
"lib/parse.h"}, the header will be guarded as follows.
|
||||||
|
@example
|
||||||
|
#ifndef YY_CALC_LIB_PARSE_H_INCLUDED
|
||||||
|
# define YY_CALC_LIB_PARSE_H_INCLUDED
|
||||||
|
...
|
||||||
|
#endif /* ! YY_CALC_LIB_PARSE_H_INCLUDED */
|
||||||
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} %defines @var{defines-file}
|
@deffn {Directive} %defines @var{defines-file}
|
||||||
@@ -8502,8 +8519,8 @@ Prologue}).
|
|||||||
If the @code{%define} variable @code{api.prefix} is used (@pxref{Multiple
|
If the @code{%define} variable @code{api.prefix} is used (@pxref{Multiple
|
||||||
Parsers, ,Multiple Parsers in the Same Program}), for instance @samp{%define
|
Parsers, ,Multiple Parsers in the Same Program}), for instance @samp{%define
|
||||||
api.prefix x}, then if @code{CDEBUG} is defined, its value controls the
|
api.prefix x}, then if @code{CDEBUG} is defined, its value controls the
|
||||||
tracing feature (enabled iff nonzero); otherwise tracing is enabled iff
|
tracing feature (enabled if and only if nonzero); otherwise tracing is
|
||||||
@code{YYDEBUG} is nonzero.
|
enabled if and only if @code{YYDEBUG} is nonzero.
|
||||||
|
|
||||||
@item the option @option{-t} (POSIX Yacc compliant)
|
@item the option @option{-t} (POSIX Yacc compliant)
|
||||||
@itemx the option @option{--debug} (Bison extension)
|
@itemx the option @option{--debug} (Bison extension)
|
||||||
@@ -9055,13 +9072,23 @@ separated list of @var{things} among:
|
|||||||
Description of the grammar, conflicts (resolved and unresolved), and
|
Description of the grammar, conflicts (resolved and unresolved), and
|
||||||
parser's automaton.
|
parser's automaton.
|
||||||
|
|
||||||
|
@item itemset
|
||||||
|
Implies @code{state} and augments the description of the automaton with
|
||||||
|
the full set of items for each state, instead of its core only.
|
||||||
|
|
||||||
@item lookahead
|
@item lookahead
|
||||||
Implies @code{state} and augments the description of the automaton with
|
Implies @code{state} and augments the description of the automaton with
|
||||||
each rule's lookahead set.
|
each rule's lookahead set.
|
||||||
|
|
||||||
@item itemset
|
@item solved
|
||||||
Implies @code{state} and augments the description of the automaton with
|
Implies @code{state}. Explain how conflicts were solved thanks to
|
||||||
the full set of items for each state, instead of its core only.
|
precedence and associativity directives.
|
||||||
|
|
||||||
|
@item all
|
||||||
|
Enable all the items.
|
||||||
|
|
||||||
|
@item none
|
||||||
|
Do not generate the report.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@item --report-file=@var{file}
|
@item --report-file=@var{file}
|
||||||
@@ -9501,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;
|
||||||
@@ -11761,10 +11788,11 @@ London, Department of Computer Science, TR-00-12 (December 2000).
|
|||||||
@c LocalWords: toString deftypeivar deftypeivarx deftypeop YYParser strictfp
|
@c LocalWords: toString deftypeivar deftypeivarx deftypeop YYParser strictfp
|
||||||
@c LocalWords: superclasses boolean getErrorVerbose setErrorVerbose deftypecv
|
@c LocalWords: superclasses boolean getErrorVerbose setErrorVerbose deftypecv
|
||||||
@c LocalWords: getDebugStream setDebugStream getDebugLevel setDebugLevel url
|
@c LocalWords: getDebugStream setDebugStream getDebugLevel setDebugLevel url
|
||||||
@c LocalWords: bisonVersion deftypecvx bisonSkeleton getStartPos getEndPos
|
@c LocalWords: bisonVersion deftypecvx bisonSkeleton getStartPos getEndPos uint
|
||||||
@c LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt Corbett LALR's
|
@c LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt Corbett LALR's
|
||||||
@c LocalWords: subdirectory Solaris nonassociativity perror schemas Malloy
|
@c LocalWords: subdirectory Solaris nonassociativity perror schemas Malloy ints
|
||||||
@c LocalWords: Scannerless ispell american
|
@c LocalWords: Scannerless ispell american ChangeLog smallexample CSTYPE CLTYPE
|
||||||
|
@c LocalWords: clval CDEBUG cdebug deftypeopx yyterminate
|
||||||
|
|
||||||
@c Local Variables:
|
@c Local Variables:
|
||||||
@c ispell-dictionary: "american"
|
@c ispell-dictionary: "american"
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
external: gnulib
|
|
||||||
+1
-1
Submodule gnulib updated: bd54a45e6e...daf7f8c022
@@ -269,3 +269,6 @@
|
|||||||
/xmemdup0.h
|
/xmemdup0.h
|
||||||
/sys_types.in.h
|
/sys_types.in.h
|
||||||
/obstack_printf.c
|
/obstack_printf.c
|
||||||
|
/binary-io.c
|
||||||
|
/mbuiter.c
|
||||||
|
/xsize.c
|
||||||
|
|||||||
@@ -180,3 +180,4 @@
|
|||||||
/xsize.m4
|
/xsize.m4
|
||||||
/xstrndup.m4
|
/xstrndup.m4
|
||||||
/obstack-printf.m4
|
/obstack-printf.m4
|
||||||
|
/extern-inline.m4
|
||||||
|
|||||||
@@ -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
|
||||||
|
])
|
||||||
|
|||||||
+21
-3
@@ -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;
|
||||||
@@ -361,7 +361,25 @@ THINGS is a list of comma separated words that can include:\n\
|
|||||||
`none' disable the report\n\
|
`none' disable the report\n\
|
||||||
"), stdout);
|
"), stdout);
|
||||||
|
|
||||||
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
|
putc ('\n', stdout);
|
||||||
|
printf (_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
|
||||||
|
printf (_("%s home page: <%s>.\n"), PACKAGE_NAME, PACKAGE_URL);
|
||||||
|
fputs (_("General help using GNU software: "
|
||||||
|
"<http://www.gnu.org/gethelp/>.\n"),
|
||||||
|
stdout);
|
||||||
|
/* Don't output this redundant message for English locales.
|
||||||
|
Note we still output for 'C' so that it gets included in the
|
||||||
|
man page. */
|
||||||
|
const char *lc_messages = setlocale (LC_MESSAGES, NULL);
|
||||||
|
if (lc_messages && strcmp (lc_messages, "en_"))
|
||||||
|
/* TRANSLATORS: Replace LANG_CODE in this URL with your language
|
||||||
|
code <http://translationproject.org/team/LANG_CODE.html> to
|
||||||
|
form one of the URLs at http://translationproject.org/team/.
|
||||||
|
Otherwise, replace the entire URL with your translation team's
|
||||||
|
email address. */
|
||||||
|
fputs (_("Report translation bugs to "
|
||||||
|
"<http://translationproject.org/team/>.\n"), stdout);
|
||||||
|
fputs (_("For complete documentation, run: info bison.\n"), stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit (status);
|
exit (status);
|
||||||
@@ -646,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);
|
||||||
|
|||||||
+401
-370
File diff suppressed because it is too large
Load Diff
+35
-27
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.6.1.12-3153-dirty. */
|
/* 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
|
||||||
|
|
||||||
@@ -30,22 +30,30 @@
|
|||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
#ifndef GRAM__________SRC_PARSE_GRAM_H
|
#ifndef YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
# define GRAM__________SRC_PARSE_GRAM_H
|
# 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,11 +172,11 @@ 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 2049 of yacc.c */
|
/* Line 2042 of yacc.c */
|
||||||
#line 114 "parse-gram.y"
|
#line 115 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
symbol_list *list;
|
symbol_list *list;
|
||||||
@@ -181,25 +189,25 @@ typedef union YYSTYPE
|
|||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
|
|
||||||
|
|
||||||
/* Line 2049 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
|
||||||
|
|
||||||
|
|
||||||
@@ -217,4 +225,4 @@ int gram_parse ();
|
|||||||
#endif
|
#endif
|
||||||
#endif /* ! YYPARSE_PARAM */
|
#endif /* ! YYPARSE_PARAM */
|
||||||
|
|
||||||
#endif /* !GRAM__________SRC_PARSE_GRAM_H */
|
#endif /* !YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED */
|
||||||
|
|||||||
+10
-9
@@ -20,6 +20,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
|
#include "c-ctype.h"
|
||||||
#include "complain.h"
|
#include "complain.h"
|
||||||
#include "conflicts.h"
|
#include "conflicts.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
@@ -93,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
|
||||||
{
|
{
|
||||||
@@ -251,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,
|
||||||
@@ -735,11 +736,11 @@ add_param (char const *type, char *decl, location loc)
|
|||||||
/* Strip the surrounding '{' and '}', and any blanks just inside
|
/* Strip the surrounding '{' and '}', and any blanks just inside
|
||||||
the braces. */
|
the braces. */
|
||||||
--p;
|
--p;
|
||||||
while (isspace ((unsigned char) *p))
|
while (c_isspace ((unsigned char) *p))
|
||||||
--p;
|
--p;
|
||||||
p[1] = '\0';
|
p[1] = '\0';
|
||||||
++decl;
|
++decl;
|
||||||
while (isspace ((unsigned char) *decl))
|
while (c_isspace ((unsigned char) *decl))
|
||||||
++decl;
|
++decl;
|
||||||
|
|
||||||
if (! name_start)
|
if (! name_start)
|
||||||
|
|||||||
+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_ */
|
||||||
|
|||||||
+4
-4
@@ -36,7 +36,7 @@
|
|||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "uniqstr.h"
|
#include "uniqstr.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <c-ctype.h>
|
||||||
#include <mbswidth.h>
|
#include <mbswidth.h>
|
||||||
#include <quote.h>
|
#include <quote.h>
|
||||||
|
|
||||||
@@ -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;
|
||||||
@@ -560,7 +560,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
\\(.|\n) {
|
\\(.|\n) {
|
||||||
char const *p = yytext + 1;
|
char const *p = yytext + 1;
|
||||||
/* Quote only if escaping won't make the character visible. */
|
/* Quote only if escaping won't make the character visible. */
|
||||||
if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p))
|
if (c_isspace ((unsigned char) *p) && c_isprint ((unsigned char) *p))
|
||||||
p = quote (p);
|
p = quote (p);
|
||||||
else
|
else
|
||||||
p = quotearg_style_mem (escape_quoting_style, p, 1);
|
p = quotearg_style_mem (escape_quoting_style, p, 1);
|
||||||
|
|||||||
@@ -38,11 +38,6 @@
|
|||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
|
||||||
# if HAVE_SYS_TYPES_H
|
|
||||||
# include <sys/types.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
|
|
||||||
@@ -105,7 +100,6 @@ typedef size_t uintptr_t;
|
|||||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define FUNCTION_PRINT() fprintf (stderr, "%s: ", __func__)
|
|
||||||
|
|
||||||
/*------.
|
/*------.
|
||||||
| NLS. |
|
| NLS. |
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
|
|||||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||||
|
|
||||||
/* Two uniqstr values have the same value iff they are the same. */
|
/* Two uniqstr values have the same value iff they are the same. */
|
||||||
#define UNIQSTR_EQ(USTR1, USTR2) ((USTR1) == (USTR2))
|
#define UNIQSTR_EQ(USTR1, USTR2) (!!((USTR1) == (USTR2)))
|
||||||
|
|
||||||
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and
|
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and
|
||||||
positive for >. Undefined order, relies on addresses. */
|
positive for >. Undefined order, relies on addresses. */
|
||||||
|
|||||||
+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;
|
||||||
|
|||||||
+23
-18
@@ -29,16 +29,10 @@ CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@"
|
|||||||
# Is the compiler GCC?
|
# Is the compiler GCC?
|
||||||
GCC='@GCC@'
|
GCC='@GCC@'
|
||||||
|
|
||||||
# We want no optimization, as they uncover warnings (therefore,
|
|
||||||
# failures) about uninitialized variables in the test suite. FIXME:
|
|
||||||
# fix the warnings, not the flags.
|
|
||||||
O0CFLAGS=`echo '@CFLAGS@' | sed 's/-O[0-9s] *//g'`
|
|
||||||
O0CXXFLAGS=`echo '@CXXFLAGS@' | sed 's/-O[0-9s] *//g'`
|
|
||||||
|
|
||||||
# Sometimes a test group needs to ignore gcc warnings, so it locally
|
# Sometimes a test group needs to ignore gcc warnings, so it locally
|
||||||
# sets CFLAGS to this.
|
# sets CFLAGS to this.
|
||||||
NO_WERROR_CFLAGS="$O0CFLAGS @WARN_CFLAGS@ @WARN_CFLAGS_TEST@"
|
NO_WERROR_CFLAGS='@CFLAGS@ @WARN_CFLAGS@ @WARN_CFLAGS_TEST@'
|
||||||
NO_WERROR_CXXFLAGS="$O0CXXFLAGS @WARN_CXXFLAGS@ @WARN_CXXFLAGS_TEST@"
|
NO_WERROR_CXXFLAGS='@CXXFLAGS@ @WARN_CXXFLAGS@ @WARN_CXXFLAGS_TEST@'
|
||||||
|
|
||||||
# But most of the time, we want -Werror.
|
# But most of the time, we want -Werror.
|
||||||
CFLAGS="$NO_WERROR_CFLAGS @WERROR_CFLAGS@"
|
CFLAGS="$NO_WERROR_CFLAGS @WERROR_CFLAGS@"
|
||||||
@@ -51,7 +45,6 @@ BISON_CXX_WORKS='@BISON_CXX_WORKS@'
|
|||||||
if "$at_arg_compile_c_with_cxx"; then
|
if "$at_arg_compile_c_with_cxx"; then
|
||||||
CC_IS_CXX=1
|
CC_IS_CXX=1
|
||||||
CC=$CXX
|
CC=$CXX
|
||||||
O0CFLAGS=$O0CXXFLAGS
|
|
||||||
NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS
|
NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS
|
||||||
CFLAGS=$CXXFLAGS
|
CFLAGS=$CXXFLAGS
|
||||||
else
|
else
|
||||||
@@ -63,24 +56,36 @@ fi
|
|||||||
## Other. ##
|
## Other. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
|
|
||||||
# Are special link options needed?
|
|
||||||
LDFLAGS='@LDFLAGS@'
|
|
||||||
|
|
||||||
# Are special libraries needed?
|
|
||||||
LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
|
|
||||||
|
|
||||||
# Empty if no javac was found
|
# Empty if no javac was found
|
||||||
CONF_JAVAC='@CONF_JAVAC@'
|
CONF_JAVAC='@CONF_JAVAC@'
|
||||||
|
|
||||||
# Empty if no Java VM was found
|
# Empty if no Java VM was found
|
||||||
CONF_JAVA='@CONF_JAVA@'
|
CONF_JAVA='@CONF_JAVA@'
|
||||||
|
|
||||||
# Empty if no xsltproc was found
|
|
||||||
: ${XSLTPROC='@XSLTPROC@'}
|
|
||||||
|
|
||||||
# We need egrep.
|
# We need egrep.
|
||||||
: ${EGREP='@EGREP@'}
|
: ${EGREP='@EGREP@'}
|
||||||
|
|
||||||
# Use simple quotes (lib/quote.c).
|
# Use simple quotes (lib/quote.c).
|
||||||
LC_CTYPE=C
|
LC_CTYPE=C
|
||||||
export LC_CTYPE
|
export LC_CTYPE
|
||||||
|
|
||||||
|
# Are special link options needed?
|
||||||
|
LDFLAGS='@LDFLAGS@'
|
||||||
|
|
||||||
|
# Are special libraries needed?
|
||||||
|
LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
|
||||||
|
|
||||||
|
# Empty if no xsltproc was found
|
||||||
|
: ${XSLTPROC='@XSLTPROC@'}
|
||||||
|
|
||||||
|
: ${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
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
abs_top_srcdir='@abs_top_srcdir@'
|
abs_top_srcdir='@abs_top_srcdir@'
|
||||||
abs_top_builddir='@abs_top_builddir@'
|
abs_top_builddir='@abs_top_builddir@'
|
||||||
: ${PERL=perl}
|
: ${PERL='@PERL@'}
|
||||||
|
|
||||||
# Use the shipped files, not those installed.
|
# Use the shipped files, not those installed.
|
||||||
BISON_PKGDATADIR=$abs_top_srcdir/data
|
BISON_PKGDATADIR=$abs_top_srcdir/data
|
||||||
|
|||||||
+4
-5
@@ -1,4 +1,4 @@
|
|||||||
# Checking the output filenames. -*- Autotest -*-
|
# Checking the C++ Features. -*- Autotest -*-
|
||||||
|
|
||||||
# Copyright (C) 2004-2005, 2007, 2009-2012 Free Software Foundation,
|
# Copyright (C) 2004-2005, 2007, 2009-2012 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
@@ -30,6 +30,7 @@ m4_define([AT_CHECK_DOXYGEN],
|
|||||||
[m4_fatal([invalid argument: $1])])
|
[m4_fatal([invalid argument: $1])])
|
||||||
AT_SETUP([Doxygen $1 Documentation])
|
AT_SETUP([Doxygen $1 Documentation])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc"])
|
||||||
AT_DATA([input.yy],
|
AT_DATA([input.yy],
|
||||||
[[%skeleton "lalr1.cc"
|
[[%skeleton "lalr1.cc"
|
||||||
%locations
|
%locations
|
||||||
@@ -38,10 +39,7 @@ AT_DATA([input.yy],
|
|||||||
%%
|
%%
|
||||||
exp:;
|
exp:;
|
||||||
%%
|
%%
|
||||||
yy::parser::error (const location& l, const std::string& m)
|
]AT_YYERROR_DEFINE[
|
||||||
{
|
|
||||||
std::cerr << l << s << std::endl;
|
|
||||||
}
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.cc input.yy], 0)
|
AT_BISON_CHECK([-o input.cc input.yy], 0)
|
||||||
@@ -94,6 +92,7 @@ EXTRACT_STATIC = AT_DOXYGEN_PRIVATE
|
|||||||
AT_CHECK([doxygen --version || exit 77], 0, ignore)
|
AT_CHECK([doxygen --version || exit 77], 0, ignore)
|
||||||
AT_CHECK([doxygen], 0, [], [ignore])
|
AT_CHECK([doxygen], 0, [], [ignore])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
m4_popdef([AT_DOXYGEN_PRIVATE])
|
m4_popdef([AT_DOXYGEN_PRIVATE])
|
||||||
|
|||||||
+23
-56
@@ -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])])
|
||||||
@@ -503,12 +467,15 @@ AT_CHECK([cat stderr], 0, [expout])
|
|||||||
# Make sure we did not introduce bad spaces. Checked here because all
|
# Make sure we did not introduce bad spaces. Checked here because all
|
||||||
# the skeletons are (or should be) exercized here.
|
# the skeletons are (or should be) exercized here.
|
||||||
m4_define([AT_CHECK_SPACES],
|
m4_define([AT_CHECK_SPACES],
|
||||||
[# No initial empty lines.
|
[AT_CHECK([$PERL -ne '
|
||||||
AT_CHECK([sed -ne '/./q;=;p;' $1])
|
chomp;
|
||||||
# No trailing spaces.
|
print "$.: {$_}\n"
|
||||||
# FIXME: For 2.7: AT_CHECK([sed -ne '/[ ]$/{=;p;}' $1])
|
if (# No starting/ending empty lines.
|
||||||
# No final empty lines.
|
(eof || $. == 1) && /^\s*$/
|
||||||
AT_CHECK([sed -ne '${/^$/{=;p;};}' $1])
|
# No trailing space. FIXME: not ready for "maint".
|
||||||
|
# || /\s$/
|
||||||
|
)' $1
|
||||||
|
])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -547,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 '!'])
|
||||||
@@ -591,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 ')'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
## ---------------------------------------------------- ##
|
## ---------------------------------------------------- ##
|
||||||
|
|||||||
+4
-1
@@ -35,7 +35,10 @@ dnl time comes, just use sed to drop the line numbers. For now, as LR(1)
|
|||||||
dnl support is rapidly evolving, let's keep that information to be careful.
|
dnl support is rapidly evolving, let's keep that information to be careful.
|
||||||
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
|
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
|
||||||
m4_pushdef([AT_LALR1_DIFF_CHECK],
|
m4_pushdef([AT_LALR1_DIFF_CHECK],
|
||||||
[AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
|
[dnl We need diff -u, which is not portable.
|
||||||
|
AT_CHECK([diff -u /dev/null /dev/null || exit 77], [0], [ignore])
|
||||||
|
|
||||||
|
AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
|
||||||
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
|
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
|
||||||
AT_CHECK([[diff -u input-lalr.output input.output \
|
AT_CHECK([[diff -u input-lalr.output input.output \
|
||||||
| sed -n '/^@@/,$p' | sed 's/^ $//']],
|
| sed -n '/^@@/,$p' | sed 's/^ $//']],
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+26
-6
@@ -126,8 +126,9 @@ AT_SETUP([Several parsers])
|
|||||||
|
|
||||||
# AT_TEST([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 (allowed) YY*
|
||||||
# the header (but YYDEBUG and YYPARSE_PARAM).
|
# nor yy* identifiers in the header. Check that headers are
|
||||||
|
# self-contained, and can be compiled by a C++ compiler.
|
||||||
m4_pushdef([AT_TEST],
|
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])],
|
||||||
@@ -161,20 +162,23 @@ exp:
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-d -o AT_SKEL_CC_IF([$1.cc $1.yy], [$1.c $1.y])])
|
AT_BISON_CHECK([-d -o AT_SKEL_CC_IF([$1.cc $1.yy], [$1.c $1.y])])
|
||||||
|
|
||||||
|
# Check there is no 'yy' left.
|
||||||
# C++ output relies on namespaces and still uses yy a lot.
|
# C++ output relies on namespaces and still uses yy a lot.
|
||||||
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 (obsolete) and
|
# Check there is not 'YY' left.
|
||||||
# YYPUSH_MORE(_DEFINED)? (whose definition is constant).
|
# Ignore comments, YYPARSE_PARAM (obsolete), YYPUSH_MORE(_DEFINED)?
|
||||||
|
# (constant definition), YY_\w+_INCLUDED (header guards).
|
||||||
#
|
#
|
||||||
# YYDEBUG (not renamed) can be read, but not changed.
|
# YYDEBUG (not renamed) can be read, but not changed.
|
||||||
AT_CHECK([[sed -ne 's,/\*[^*]*\*/,,g;s,//.*,,' \
|
AT_CHECK([[sed -ne 's,/\*[^*]*\*/,,g;s,//.*,,' \
|
||||||
-e '/YY/p' ]$1.AT_SKEL_CC_IF([hh], [h])[ |
|
-e '/YY/p' ]$1.AT_SKEL_CC_IF([hh], [h])[ |
|
||||||
$EGREP -wv 'YY(PARSE_PARAM|PUSH_MORE(_DEFINED)?)|(defined|if) YYDEBUG']],
|
$EGREP -wv 'YY(PARSE_PARAM|PUSH_MORE(_DEFINED)?|_[0-9A-Z_]+_INCLUDED)|(defined|if) YYDEBUG']],
|
||||||
[1])
|
[1])
|
||||||
AT_LANG_COMPILE([$1.o])
|
|
||||||
|
|
||||||
|
AT_LANG_COMPILE([$1.o])
|
||||||
AT_CHECK([[echo "$1" >>expout]])
|
AT_CHECK([[echo "$1" >>expout]])
|
||||||
|
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
@@ -236,6 +240,22 @@ 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])
|
||||||
|
|
||||||
|
# Check that the headers are self-contained, and protected against
|
||||||
|
# multiple inclusions. While at it, check they are sane for C++.
|
||||||
|
for h in *.h *.hh
|
||||||
|
do
|
||||||
|
# No shell expansion with AT_DATA.
|
||||||
|
cat >$h.cc <<EOF
|
||||||
|
AT_DATA_SOURCE_PROLOGUE
|
||||||
|
#include "$h"
|
||||||
|
#include "$h"
|
||||||
|
EOF
|
||||||
|
AT_COMPILE_CXX([$h.o])
|
||||||
|
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_COMPILE_CXX([parser], [[x[1-8].o -DCC_IS_CXX=$CC_IS_CXX main.cc]])
|
||||||
AT_CHECK([./parser], [0], [[expout]])
|
AT_CHECK([./parser], [0], [[expout]])
|
||||||
|
|
||||||
|
|||||||
+65
-4
@@ -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. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -1194,7 +1255,7 @@ AT_DATA([empty.y],
|
|||||||
start: '';
|
start: '';
|
||||||
start: '
|
start: '
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl -e "print 'start: \'';" >> empty.y || exit 77]])
|
AT_CHECK([[$PERL -e "print 'start: \'';" >> empty.y || exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([empty.y], [1], [],
|
AT_BISON_CHECK([empty.y], [1], [],
|
||||||
[[empty.y:2.8-9: warning: empty character literal
|
[[empty.y:2.8-9: warning: empty character literal
|
||||||
@@ -1209,7 +1270,7 @@ AT_DATA([two.y],
|
|||||||
start: 'ab';
|
start: 'ab';
|
||||||
start: 'ab
|
start: 'ab
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl -e "print 'start: \'ab';" >> two.y || exit 77]])
|
AT_CHECK([[$PERL -e "print 'start: \'ab';" >> two.y || exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([two.y], [1], [],
|
AT_BISON_CHECK([two.y], [1], [],
|
||||||
[[two.y:2.8-11: warning: extra characters in character literal
|
[[two.y:2.8-11: warning: extra characters in character literal
|
||||||
@@ -1224,7 +1285,7 @@ AT_DATA([three.y],
|
|||||||
start: 'abc';
|
start: 'abc';
|
||||||
start: 'abc
|
start: 'abc
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl -e "print 'start: \'abc';" >> three.y || exit 77]])
|
AT_CHECK([[$PERL -e "print 'start: \'abc';" >> three.y || exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([three.y], [1], [],
|
AT_BISON_CHECK([three.y], [1], [],
|
||||||
[[three.y:2.8-12: warning: extra characters in character literal
|
[[three.y:2.8-12: warning: extra characters in character literal
|
||||||
@@ -1253,7 +1314,7 @@ start: '\777' '\0' '\xfff' '\x0'
|
|||||||
# Beside we cannot even expect "echo '\0'" to output two characters
|
# Beside we cannot even expect "echo '\0'" to output two characters
|
||||||
# (well three with \n): at least Bash 3.2 converts the two-character
|
# (well three with \n): at least Bash 3.2 converts the two-character
|
||||||
# sequence "\0" into a single NUL character.
|
# sequence "\0" into a single NUL character.
|
||||||
AT_CHECK([[perl -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
||||||
|| exit 77]])
|
|| exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
|
|||||||
+63
-18
@@ -38,7 +38,7 @@ m4_define([m4_null_if],
|
|||||||
# Expect COUNT matches of the PERL-REGEXP in FILE. The file is
|
# Expect COUNT matches of the PERL-REGEXP in FILE. The file is
|
||||||
# taken in "slurp" mode, i.e., one can match end-of-lines.
|
# taken in "slurp" mode, i.e., one can match end-of-lines.
|
||||||
m4_define([AT_MATCHES_CHECK],
|
m4_define([AT_MATCHES_CHECK],
|
||||||
[AT_CHECK([perl -0777 -ne '
|
[AT_CHECK([$PERL -0777 -ne '
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
s{$2}{ ++$count; "" }gem;
|
s{$2}{ ++$count; "" }gem;
|
||||||
printf "$count\n";' $1], [0], [$3
|
printf "$count\n";' $1], [0], [$3
|
||||||
@@ -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);
|
||||||
}]],
|
}]],
|
||||||
@@ -405,7 +408,8 @@ void
|
|||||||
public void yyerror (String s)
|
public void yyerror (String s)
|
||||||
{
|
{
|
||||||
System.err.println (s);
|
System.err.println (s);
|
||||||
}]])])dnl
|
}]])],
|
||||||
|
[m4_fatal([$0: invalid language: ]AT_LANG)])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -461,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.
|
||||||
@@ -589,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],
|
||||||
@@ -675,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
|
||||||
|
|
||||||
|
|||||||
+12
-72
@@ -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. ##
|
||||||
## ------------------- ##
|
## ------------------- ##
|
||||||
@@ -1481,17 +1429,17 @@ AT_CHECK([[grep 'syntax error,' stderr.txt]], [[0]],
|
|||||||
|
|
||||||
# Check number of default reductions in inconsistent states to be sure
|
# Check number of default reductions in inconsistent states to be sure
|
||||||
# syntax error is detected before unnecessary reductions are performed.
|
# syntax error is detected before unnecessary reductions are performed.
|
||||||
AT_CHECK([[perl -0777 -ne 'print s/inconsistent default reduction//g;' \
|
AT_CHECK([[$PERL -0777 -ne 'print s/inconsistent default reduction//g;' \
|
||||||
< stdout.txt || exit 77]], [[0]], [[14]])
|
< stdout.txt || exit 77]], [[0]], [[14]])
|
||||||
|
|
||||||
# Check number of default reductions in consistent states to be sure
|
# Check number of default reductions in consistent states to be sure
|
||||||
# it is performed before the syntax error is detected.
|
# it is performed before the syntax error is detected.
|
||||||
AT_CHECK([[perl -0777 -ne 'print s/\bconsistent default reduction//g;' \
|
AT_CHECK([[$PERL -0777 -ne 'print s/\bconsistent default reduction//g;' \
|
||||||
< stdout.txt || exit 77]], [[0]], [[2]])
|
< stdout.txt || exit 77]], [[0]], [[2]])
|
||||||
|
|
||||||
# Check number of reallocs to be sure reallocated memory isn't somehow
|
# Check number of reallocs to be sure reallocated memory isn't somehow
|
||||||
# lost between LAC invocations.
|
# lost between LAC invocations.
|
||||||
AT_CHECK([[perl -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
|
AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
|
||||||
|| exit 77]], [[0]], [[3]])
|
|| exit 77]], [[0]], [[3]])
|
||||||
|
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
@@ -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
@@ -315,7 +315,7 @@ print '@output(@,@)', "\n";
|
|||||||
(print "garbage"x10, "\n") for (1..1000);
|
(print "garbage"x10, "\n") for (1..1000);
|
||||||
print "${M4}_divert_pop(0)\n";
|
print "${M4}_divert_pop(0)\n";
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl gen-skel.pl > skel.c || exit 77]])
|
AT_CHECK([[$PERL gen-skel.pl > skel.c || exit 77]])
|
||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%skeleton "./skel.c"
|
[[%skeleton "./skel.c"
|
||||||
|
|||||||
+51
-1
@@ -64,7 +64,7 @@ m4_define([AT_SYNCLINES_COMPILE],
|
|||||||
# distcc[35882] (dcc_connect_by_name) ERROR: failed to look up host "chrisimac": Unknown host
|
# distcc[35882] (dcc_connect_by_name) ERROR: failed to look up host "chrisimac": Unknown host
|
||||||
# distcc[35882] Warning: failed to distribute input.c to chrisimac/4, running locally instead
|
# distcc[35882] Warning: failed to distribute input.c to chrisimac/4, running locally instead
|
||||||
|
|
||||||
AT_CHECK([[perl -p -0777 - stderr <<\EOF
|
AT_CHECK([[$PERL -p -0777 - stderr <<\EOF
|
||||||
s/^distcc\[\d+\] .*\n//gm;
|
s/^distcc\[\d+\] .*\n//gm;
|
||||||
s/^([^:]+:\d+)[.:][^:]+:(.+)$/$][1:$][2/gm;
|
s/^([^:]+:\d+)[.:][^:]+:(.+)$/$][1:$][2/gm;
|
||||||
s/^([^:]+:\d+):[^#]*( #error)/$][1:$][2/gm;
|
s/^([^:]+:\d+):[^#]*( #error)/$][1:$][2/gm;
|
||||||
@@ -216,4 +216,54 @@ exp: '0';
|
|||||||
[input.y:8: #error "8"
|
[input.y:8: #error "8"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
## -------------------- ##
|
||||||
|
## %code top syncline. ##
|
||||||
|
## -------------------- ##
|
||||||
|
|
||||||
|
AT_TEST([%code top syncline],
|
||||||
|
[[%code top {
|
||||||
|
#error "2"
|
||||||
|
}
|
||||||
|
%{
|
||||||
|
]AT_YYERROR_DECLARE_EXTERN[
|
||||||
|
]AT_YYLEX_DECLARE_EXTERN[
|
||||||
|
%}
|
||||||
|
%%
|
||||||
|
exp: '0';
|
||||||
|
%%
|
||||||
|
]],
|
||||||
|
[input.y:2: #error "2"
|
||||||
|
])
|
||||||
|
|
||||||
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## %no-lines. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
m4_pushdef([AT_TEST],
|
||||||
|
[AT_SETUP([%no-lines])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "$1" %defines])
|
||||||
|
AT_DATA_GRAMMAR([input.y],
|
||||||
|
[%skeleton "$1" %defines
|
||||||
|
%{
|
||||||
|
]AT_YYERROR_DECLARE_EXTERN[
|
||||||
|
]AT_YYLEX_DECLARE_EXTERN[
|
||||||
|
%}
|
||||||
|
%%
|
||||||
|
exp: '0'
|
||||||
|
])
|
||||||
|
AT_BISON_CHECK([--no-lines -o input.AT_SKEL_CC_IF([cc], [c]) -d input.y])
|
||||||
|
AT_CHECK([[grep '#line' ]AT_SKEL_CC_IF([*.cc *.hh], [*.c *.h])], 1)
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
])
|
||||||
|
|
||||||
|
AT_TEST([yacc.c])
|
||||||
|
AT_TEST([glr.c])
|
||||||
|
AT_TEST([lalr1.cc])
|
||||||
|
AT_TEST([glr.cc])
|
||||||
|
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
|
|||||||
+37
-31
@@ -125,7 +125,7 @@ EOF
|
|||||||
]])
|
]])
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||||
mv stdout $1
|
mv stdout $1
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ main (void)
|
|||||||
EOF
|
EOF
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||||
mv stdout $1
|
mv stdout $1
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
])
|
])
|
||||||
@@ -350,7 +350,7 @@ main (void)
|
|||||||
EOF
|
EOF
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
|
||||||
mv stdout $1
|
mv stdout $1
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
])
|
])
|
||||||
@@ -412,38 +412,44 @@ yylex (void)
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return argv[1] as an int. */
|
||||||
|
static int
|
||||||
|
get_args (int argc, const char **argv)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
char *endp;
|
||||||
|
assert (argc == 2);
|
||||||
|
res = strtol (argv[1], &endp, 10);
|
||||||
|
assert (argv[1] != endp);
|
||||||
|
assert (0 <= res);
|
||||||
|
assert (res <= INT_MAX);
|
||||||
|
assert (errno != ERANGE);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, const char **argv)
|
main (int argc, const char **argv)
|
||||||
{
|
{
|
||||||
char *endp;
|
YYSTYPE yylval_init = get_args (argc, argv);
|
||||||
YYSTYPE yylval_init;
|
int status = 0;
|
||||||
assert (argc == 2);
|
int count;
|
||||||
yylval_init = strtol (argv[1], &endp, 10);
|
]m4_bmatch([$2], [api.push-pull both],
|
||||||
assert (argv[1] != endp);
|
[[ yypstate *ps = yypstate_new ();
|
||||||
assert (0 <= yylval_init);
|
]])[ yydebug = 1;
|
||||||
assert (yylval_init <= INT_MAX);
|
for (count = 0; count < 2; ++count)
|
||||||
assert (errno != ERANGE);
|
{
|
||||||
yydebug = 1;
|
int new_status;
|
||||||
{
|
yylval = yylval_init;
|
||||||
int count;
|
new_status = ]m4_bmatch([$2], [api.push-pull both],
|
||||||
int status;
|
[[yypull_parse (ps)]],
|
||||||
]m4_bmatch([$2], [%push-],
|
[[yyparse ()]])[;
|
||||||
[[ yypstate *ps = yypstate_new ();
|
if (count == 0)
|
||||||
]])[ for (count = 0; count < 2; ++count)
|
|
||||||
{
|
|
||||||
int new_status;
|
|
||||||
yylval = yylval_init;
|
|
||||||
]m4_bmatch([$2], [%push-],
|
|
||||||
[[ new_status = yypull_parse (ps);
|
|
||||||
]],
|
|
||||||
[[ new_status = yyparse ();
|
|
||||||
]])[ assert (0 <= count || new_status == status);
|
|
||||||
status = new_status;
|
status = new_status;
|
||||||
}
|
else
|
||||||
]m4_bmatch([$2], [%push-],
|
assert (new_status == status);
|
||||||
[[ yypstate_delete (ps);
|
}]m4_bmatch([$2], [api.push-pull both],[[
|
||||||
]])[ return status;
|
yypstate_delete (ps);]])[
|
||||||
}
|
return status;
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
AT_BISON_OPTION_POPDEFS([$2])
|
AT_BISON_OPTION_POPDEFS([$2])
|
||||||
|
|||||||
Reference in New Issue
Block a user