mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-09 02:35:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
702c92a80b | ||
|
|
a728075710 |
+1
-10
@@ -1,16 +1,7 @@
|
||||
*.eps
|
||||
*.log
|
||||
*.o
|
||||
*.pdf
|
||||
*.png
|
||||
*.stamp
|
||||
*.trs
|
||||
*~
|
||||
.deps
|
||||
.dirstamp
|
||||
/*.cache
|
||||
/*.flc
|
||||
/*.prj
|
||||
/*~
|
||||
/.tarball-version
|
||||
/.version
|
||||
/ABOUT-NLS
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3.0.1
|
||||
3.0
|
||||
|
||||
@@ -1,59 +1,7 @@
|
||||
GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** Generated source files when errors are reported
|
||||
|
||||
When warnings are issued and -Werror is set, bison would still generate
|
||||
the source files (*.c, *.h...). As a consequence, some runs of "make"
|
||||
could fail the first time, but not the second (as the files were generated
|
||||
anyway).
|
||||
|
||||
This is fixed: bison no longer generates this source files, but, of
|
||||
course, still produces the various reports (*.output, *.xml, etc.).
|
||||
|
||||
*** %empty is used in reports
|
||||
|
||||
Empty right-hand sides are denoted by '%empty' in all the reports (text,
|
||||
dot, XML and formats derived from it).
|
||||
|
||||
*** YYERROR and variants
|
||||
|
||||
When C++ variant support is enabled, an error triggered via YYERROR, but
|
||||
not caught via error recovery, resulted in a double deletion.
|
||||
|
||||
* Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
*** Errors in caret diagnostics
|
||||
|
||||
On some platforms, some errors could result in endless diagnostics.
|
||||
|
||||
*** Fixes of the -Werror option
|
||||
|
||||
Options such as "-Werror -Wno-error=foo" were still turning "foo"
|
||||
diagnostics into errors instead of warnings. This is fixed.
|
||||
|
||||
Actually, for consistency with GCC, "-Wno-error=foo -Werror" now also
|
||||
leaves "foo" diagnostics as warnings. Similarly, with "-Werror=foo
|
||||
-Wno-error", "foo" diagnostics are now errors.
|
||||
|
||||
*** GLR Predicates
|
||||
|
||||
As demonstrated in the documentation, one can now leave spaces between
|
||||
"%?" and its "{".
|
||||
|
||||
*** Installation
|
||||
|
||||
The yacc.1 man page is no longer installed if --disable-yacc was
|
||||
specified.
|
||||
|
||||
*** Fixes in the test suite
|
||||
|
||||
Bugs and portability issues.
|
||||
|
||||
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
|
||||
|
||||
|
||||
@@ -62,22 +62,13 @@ tools we depend upon, including:
|
||||
- Gettext <http://www.gnu.org/software/gettext/>
|
||||
- Graphviz <http://www.graphviz.org>
|
||||
- Gzip <http://www.gnu.org/software/gzip/>
|
||||
- Help2man <http://www.gnu.org/software/help2man/>
|
||||
- Perl <http://www.cpan.org/>
|
||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||
- Tar <http://www.gnu.org/software/tar/>
|
||||
- Texinfo <http://www.gnu.org/software/texinfo/>
|
||||
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
||||
your architecture.
|
||||
|
||||
If you're using a GNU/Linux distribution, the easiest way to install the
|
||||
above packages depends on your system. The following shell command should
|
||||
work for Debian-based systems such as Ubuntu:
|
||||
|
||||
sudo apt-get install \
|
||||
autoconf automake autopoint flex graphviz help2man texinfo valgrind
|
||||
|
||||
Bison is written using Bison grammars, so there are bootstrapping issues.
|
||||
The bootstrap script attempts to discover when the C code generated from the
|
||||
grammars is out of date, and to bootstrap with an out-of-date version of the
|
||||
|
||||
@@ -31,7 +31,6 @@ Cris van Pelt [email protected]
|
||||
Csaba Raduly [email protected]
|
||||
Dagobert Michelsen [email protected]
|
||||
Daniel Frużyński [email protected]
|
||||
Daniel Galloway [email protected]
|
||||
Daniel Hagerty [email protected]
|
||||
David J. MacKenzie [email protected]
|
||||
David Kastrup [email protected]
|
||||
@@ -66,7 +65,6 @@ Johan van Selst [email protected]
|
||||
Jonathan Fabrizio [email protected]
|
||||
Jonathan Nieder [email protected]
|
||||
Juan Manuel Guerrero [email protected]
|
||||
Ken Moffat [email protected]
|
||||
Kees Zeelenberg [email protected]
|
||||
Keith Browne [email protected]
|
||||
Laurent Mascherpa [email protected]
|
||||
@@ -80,7 +78,6 @@ Martin Mokrejs [email protected]
|
||||
Martin Nylin [email protected]
|
||||
Matt Kraai [email protected]
|
||||
Matt Rosing [email protected]
|
||||
Michael Felt [email protected]
|
||||
Michael Hayes [email protected]
|
||||
Michael Raskin [email protected]
|
||||
Michiel De Wilde [email protected]
|
||||
@@ -96,7 +93,6 @@ Odd Arild Olsen [email protected]
|
||||
Oleg Smolsky [email protected]
|
||||
Oleksii Taran [email protected]
|
||||
Paolo Bonzini [email protected]
|
||||
Paolo Simone Gasparello [email protected]
|
||||
Pascal Bart [email protected]
|
||||
Paul Eggert [email protected]
|
||||
Paul Hilfinger [email protected]
|
||||
@@ -113,7 +109,6 @@ R Blake [email protected]
|
||||
Raja R Harinath [email protected]
|
||||
Ralf Wildenhues [email protected]
|
||||
Richard Stallman [email protected]
|
||||
Rici Lake [email protected]
|
||||
Rob Vermaas [email protected]
|
||||
Robert Anisko [email protected]
|
||||
Rob Conde [email protected]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2013-08-15.22; # UTC
|
||||
scriptversion=2013-07-03.20; # UTC
|
||||
|
||||
# Bootstrap this package from checked-out sources.
|
||||
|
||||
@@ -209,16 +209,12 @@ bootstrap_sync=false
|
||||
# Use git to update gnulib sources
|
||||
use_git=true
|
||||
|
||||
check_exists() {
|
||||
($1 --version </dev/null) >/dev/null 2>&1
|
||||
test $? -lt 126
|
||||
}
|
||||
|
||||
# find_tool ENVVAR NAMES...
|
||||
# -------------------------
|
||||
# Search for a required program. Use the value of ENVVAR, if set,
|
||||
# otherwise find the first of the NAMES that can be run.
|
||||
# If found, set ENVVAR to the program name, die otherwise.
|
||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||
# supports --version). If found, set ENVVAR to the program name,
|
||||
# die otherwise.
|
||||
#
|
||||
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||
find_tool ()
|
||||
@@ -228,21 +224,27 @@ find_tool ()
|
||||
find_tool_names=$@
|
||||
eval "find_tool_res=\$$find_tool_envvar"
|
||||
if test x"$find_tool_res" = x; then
|
||||
for i; do
|
||||
if check_exists $i; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
for i
|
||||
do
|
||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
||||
find_tool_res=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||
fi
|
||||
if test x"$find_tool_res" = x; then
|
||||
warn_ "one of these is required: $find_tool_names;"
|
||||
die "alternatively set $find_tool_envvar to a compatible tool"
|
||||
fi
|
||||
test x"$find_tool_res" != x \
|
||||
|| die "one of these is required: $find_tool_names"
|
||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||
eval "$find_tool_envvar=\$find_tool_res"
|
||||
eval "export $find_tool_envvar"
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
|
||||
find_tool SHA1SUM sha1sum gsha1sum shasum
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
# Make sure that bootstrap.conf is sourced from the current directory
|
||||
# if we were invoked as "sh bootstrap".
|
||||
@@ -324,7 +326,7 @@ insert_if_absent() {
|
||||
die "Error: Duplicate entries in $file: " $duplicate_entries
|
||||
fi
|
||||
linesold=$(gitignore_entries $file | wc -l)
|
||||
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
|
||||
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
|
||||
if [ $linesold != $linesnew ] ; then
|
||||
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
||||
|| die "insert_if_absent $file $str: failed"
|
||||
@@ -467,7 +469,8 @@ check_versions() {
|
||||
if [ "$req_ver" = "-" ]; then
|
||||
# Merely require app to exist; not all prereq apps are well-behaved
|
||||
# so we have to rely on $? rather than get_version.
|
||||
if ! check_exists $app; then
|
||||
$app --version >/dev/null 2>&1
|
||||
if [ 126 -le $? ]; then
|
||||
warn_ "Error: '$app' not found"
|
||||
ret=1
|
||||
fi
|
||||
@@ -500,12 +503,6 @@ print_versions() {
|
||||
# can't depend on column -t
|
||||
}
|
||||
|
||||
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
|
||||
# Also find the compatible sha1 utility on the BSDs
|
||||
if test x"$SKIP_PO" = x; then
|
||||
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
|
||||
fi
|
||||
|
||||
use_libtool=0
|
||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
||||
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||
@@ -554,10 +551,10 @@ fi
|
||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||
|
||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||
if $use_git && test -d .git && check_exists git; then
|
||||
if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||
:
|
||||
elif check_exists git-merge-changelog; then
|
||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
||||
echo "$0: initializing git-merge-changelog driver"
|
||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||
@@ -695,10 +692,11 @@ update_po_files() {
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
||||
! $SHA1SUM -c --status "$cksum_file" \
|
||||
< "$new_po" > /dev/null; then
|
||||
echo "$me: updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" \
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
+1
-2
@@ -34,8 +34,7 @@ gnulib_modules='
|
||||
readme-release
|
||||
realloc-posix
|
||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||
unistd unistd-safer unlink unlocked-io
|
||||
update-copyright unsetenv verify
|
||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
||||
warnings
|
||||
xalloc
|
||||
xalloc-die
|
||||
|
||||
+18
-10
@@ -33,7 +33,11 @@ AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# We use Automake 1.14's %D% and %C%.
|
||||
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
||||
#
|
||||
# http://thread.gmane.org/gmane.comp.sysutils.autotools.announce/131
|
||||
#
|
||||
# To avoid 1.11, we make 1.11.1 the minimum version.
|
||||
#
|
||||
# We want gnits strictness only when rolling a stable release. For
|
||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||
@@ -41,7 +45,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
# releases, we want to be able run make dist without being required to
|
||||
# add a bogus NEWS entry. In that case, the version string
|
||||
# automatically contains a dash, which we also let disable gnits.
|
||||
AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
|
||||
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
|
||||
color-tests parallel-tests
|
||||
silent-rules]
|
||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||
@@ -78,7 +82,7 @@ AC_ARG_ENABLE([gcc-warnings],
|
||||
esac],
|
||||
[enable_gcc_warnings=no])
|
||||
if test "$enable_gcc_warnings" = yes; then
|
||||
warn_common='-Wall-Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
|
||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
||||
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||
warn_cxx='-Wnoexcept'
|
||||
@@ -157,17 +161,21 @@ AC_ARG_ENABLE([yacc],
|
||||
[AC_HELP_STRING([--disable-yacc],
|
||||
[do not build a yacc command or an -ly library])],
|
||||
, [enable_yacc=yes])
|
||||
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||
case $enable_yacc in
|
||||
yes)
|
||||
YACC_SCRIPT=src/yacc
|
||||
YACC_LIBRARY=lib/liby.a;;
|
||||
*)
|
||||
YACC_SCRIPT=
|
||||
YACC_LIBRARY=;;
|
||||
esac
|
||||
AC_SUBST([YACC_SCRIPT])
|
||||
AC_SUBST([YACC_LIBRARY])
|
||||
|
||||
# Checks for programs.
|
||||
AM_MISSING_PROG([DOT], [dot])
|
||||
AC_PROG_LEX
|
||||
$LEX_IS_FLEX || test "X$LEX" = X: || {
|
||||
AC_MSG_WARN([bypassing lex because flex is required])
|
||||
LEX=:
|
||||
}
|
||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
||||
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
||||
AC_PROG_YACC
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_GNU_M4
|
||||
|
||||
@@ -205,32 +205,13 @@ m4_define([b4_table_value_equals],
|
||||
|
||||
# b4_attribute_define
|
||||
# -------------------
|
||||
# Provide portable compiler "attributes".
|
||||
# Provide portability for __attribute__.
|
||||
m4_define([b4_attribute_define],
|
||||
[#ifndef YY_ATTRIBUTE
|
||||
# if (defined __GNUC__ \
|
||||
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|
||||
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
|
||||
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
|
||||
# else
|
||||
# define YY_ATTRIBUTE(Spec) /* empty */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef YY_ATTRIBUTE_PURE
|
||||
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
|
||||
#endif
|
||||
|
||||
#ifndef YY_ATTRIBUTE_UNUSED
|
||||
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
|
||||
#endif
|
||||
|
||||
#if !defined _Noreturn \
|
||||
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
|
||||
# if defined _MSC_VER && 1200 <= _MSC_VER
|
||||
# define _Noreturn __declspec (noreturn)
|
||||
# else
|
||||
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
|
||||
[#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -269,14 +250,14 @@ m4_define([b4_attribute_define],
|
||||
|
||||
# b4_null_define
|
||||
# --------------
|
||||
# Portability issues: define a YY_NULLPTR appropriate for the current
|
||||
# Portability issues: define a YY_NULL appropriate for the current
|
||||
# language (C, C++98, or C++11).
|
||||
m4_define([b4_null_define],
|
||||
[# ifndef YY_NULLPTR
|
||||
[# ifndef YY_NULL
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# define YY_NULL nullptr
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# define YY_NULL 0
|
||||
# endif
|
||||
# endif[]dnl
|
||||
])
|
||||
@@ -285,7 +266,7 @@ m4_define([b4_null_define],
|
||||
# b4_null
|
||||
# -------
|
||||
# Return a null pointer constant.
|
||||
m4_define([b4_null], [YY_NULLPTR])
|
||||
m4_define([b4_null], [YY_NULL])
|
||||
|
||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||
# -------------------------------------------------------------
|
||||
@@ -802,7 +783,7 @@ m4_define([b4_yy_location_print_define],
|
||||
|
||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||
|
||||
YY_ATTRIBUTE_UNUSED
|
||||
__attribute__((__unused__))
|
||||
]b4_function_define([yy_location_print_],
|
||||
[static unsigned],
|
||||
[[FILE *yyo], [yyo]],
|
||||
|
||||
+79
-81
@@ -445,9 +445,9 @@ int yydebug;
|
||||
|
||||
struct yyGLRStack;
|
||||
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
|
||||
YY_ATTRIBUTE_UNUSED;
|
||||
__attribute__ ((__unused__));
|
||||
static void yypdumpstack (struct yyGLRStack* yystackp)
|
||||
YY_ATTRIBUTE_UNUSED;
|
||||
__attribute__ ((__unused__));
|
||||
|
||||
#else /* !]b4_api_PREFIX[DEBUG */
|
||||
|
||||
@@ -669,15 +669,19 @@ struct yyGLRStack {
|
||||
static void yyexpandGLRStack (yyGLRStack* yystackp);
|
||||
#endif
|
||||
|
||||
static _Noreturn void
|
||||
static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void
|
||||
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
||||
{
|
||||
if (yymsg != YY_NULLPTR)
|
||||
if (yymsg != YY_NULL)
|
||||
yyerror (]b4_yyerror_args[yymsg);
|
||||
YYLONGJMP (yystackp->yyexception_buffer, 1);
|
||||
}
|
||||
|
||||
static _Noreturn void
|
||||
static void yyMemoryExhausted (yyGLRStack* yystackp)
|
||||
__attribute__ ((__noreturn__));
|
||||
static void
|
||||
yyMemoryExhausted (yyGLRStack* yystackp)
|
||||
{
|
||||
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
||||
@@ -698,7 +702,7 @@ yytokenName (yySymbol yytoken)
|
||||
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
|
||||
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
|
||||
* containing the pointer to the next state in the chain. */
|
||||
static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
|
||||
static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
|
||||
static void
|
||||
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
||||
{
|
||||
@@ -715,7 +719,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
||||
else
|
||||
/* The effect of using yysval or yyloc (in an immediate rule) is
|
||||
* undefined. */
|
||||
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
|
||||
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[
|
||||
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
||||
s = yyvsp[i].yystate.yypred = s->yypred;
|
||||
}
|
||||
@@ -725,7 +729,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
||||
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
|
||||
* For convenience, always return YYLOW1. */
|
||||
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
|
||||
YY_ATTRIBUTE_UNUSED;
|
||||
__attribute__ ((__unused__));
|
||||
static inline int
|
||||
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
||||
{
|
||||
@@ -747,7 +751,8 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
||||
yyGLRStack* yystackp,
|
||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||
{
|
||||
yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR);
|
||||
yybool yynormal __attribute__ ((__unused__)) =
|
||||
(yystackp->yysplitPoint == YY_NULL);
|
||||
int yylow;
|
||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||
[ YYUSE (yyrhslen);
|
||||
@@ -831,10 +836,12 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
||||
if (yydebug)
|
||||
{
|
||||
if (yys->yysemantics.yyfirstVal)
|
||||
YYFPRINTF (stderr, "%s unresolved", yymsg);
|
||||
YYFPRINTF (stderr, "%s unresolved ", yymsg);
|
||||
else
|
||||
YYFPRINTF (stderr, "%s incomplete", yymsg);
|
||||
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
|
||||
YYFPRINTF (stderr, "%s incomplete ", yymsg);
|
||||
yy_symbol_print (stderr, yystos[yys->yylrState],
|
||||
YY_NULL]b4_locuser_args([&yys->yyloc])[);
|
||||
YYFPRINTF (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -910,18 +917,14 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
||||
}
|
||||
}
|
||||
|
||||
/** Compute post-reduction state.
|
||||
* \param yystate the current state
|
||||
* \param yysym the nonterminal to push on the stack
|
||||
*/
|
||||
static inline yyStateNum
|
||||
yyLRgotoState (yyStateNum yystate, yySymbol yysym)
|
||||
yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
|
||||
{
|
||||
int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
|
||||
int yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
||||
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
||||
return yytable[yyr];
|
||||
else
|
||||
return yydefgoto[yysym - YYNTOKENS];
|
||||
return yydefgoto[yylhs - YYNTOKENS];
|
||||
}
|
||||
|
||||
static inline yybool
|
||||
@@ -963,7 +966,6 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
|
||||
{
|
||||
yySemanticOption* yynewOption =
|
||||
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
||||
YYASSERT (!yynewOption->yyisState);
|
||||
yynewOption->yystate = yyrhs;
|
||||
yynewOption->yyrule = yyrule;
|
||||
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
||||
@@ -991,7 +993,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
|
||||
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
|
||||
if (! yyset->yystates)
|
||||
return yyfalse;
|
||||
yyset->yystates[0] = YY_NULLPTR;
|
||||
yyset->yystates[0] = YY_NULL;
|
||||
yyset->yylookaheadNeeds =
|
||||
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
|
||||
if (! yyset->yylookaheadNeeds)
|
||||
@@ -1021,8 +1023,8 @@ yyinitGLRStack (yyGLRStack* yystackp, size_t yysize)
|
||||
if (!yystackp->yyitems)
|
||||
return yyfalse;
|
||||
yystackp->yynextFree = yystackp->yyitems;
|
||||
yystackp->yysplitPoint = YY_NULLPTR;
|
||||
yystackp->yylastDeleted = YY_NULLPTR;
|
||||
yystackp->yysplitPoint = YY_NULL;
|
||||
yystackp->yylastDeleted = YY_NULL;
|
||||
return yyinitStateSet (&yystackp->yytops);
|
||||
}
|
||||
|
||||
@@ -1061,10 +1063,10 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
||||
{
|
||||
yyGLRState* yys0 = &yyp0->yystate;
|
||||
yyGLRState* yys1 = &yyp1->yystate;
|
||||
if (yys0->yypred != YY_NULLPTR)
|
||||
if (yys0->yypred != YY_NULL)
|
||||
yys1->yypred =
|
||||
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
|
||||
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
|
||||
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
|
||||
yys1->yysemantics.yyfirstVal =
|
||||
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
|
||||
}
|
||||
@@ -1072,18 +1074,18 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
||||
{
|
||||
yySemanticOption* yyv0 = &yyp0->yyoption;
|
||||
yySemanticOption* yyv1 = &yyp1->yyoption;
|
||||
if (yyv0->yystate != YY_NULLPTR)
|
||||
if (yyv0->yystate != YY_NULL)
|
||||
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
|
||||
if (yyv0->yynext != YY_NULLPTR)
|
||||
if (yyv0->yynext != YY_NULL)
|
||||
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
|
||||
}
|
||||
}
|
||||
if (yystackp->yysplitPoint != YY_NULLPTR)
|
||||
if (yystackp->yysplitPoint != YY_NULL)
|
||||
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
|
||||
yystackp->yysplitPoint, yystate);
|
||||
yystackp->yysplitPoint, yystate);
|
||||
|
||||
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
|
||||
if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
|
||||
if (yystackp->yytops.yystates[yyn] != YY_NULL)
|
||||
yystackp->yytops.yystates[yyn] =
|
||||
YYRELOC (yystackp->yyitems, yynewItems,
|
||||
yystackp->yytops.yystates[yyn], yystate);
|
||||
@@ -1107,7 +1109,7 @@ yyfreeGLRStack (yyGLRStack* yystackp)
|
||||
static inline void
|
||||
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
||||
{
|
||||
if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
|
||||
if (yystackp->yysplitPoint != YY_NULL && yystackp->yysplitPoint > yys)
|
||||
yystackp->yysplitPoint = yys;
|
||||
}
|
||||
|
||||
@@ -1115,9 +1117,9 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
||||
static inline void
|
||||
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
||||
{
|
||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||
if (yystackp->yytops.yystates[yyk] != YY_NULL)
|
||||
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
||||
yystackp->yytops.yystates[yyk] = YY_NULLPTR;
|
||||
yystackp->yytops.yystates[yyk] = YY_NULL;
|
||||
}
|
||||
|
||||
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
|
||||
@@ -1126,12 +1128,12 @@ yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
||||
static void
|
||||
yyundeleteLastStack (yyGLRStack* yystackp)
|
||||
{
|
||||
if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
|
||||
if (yystackp->yylastDeleted == YY_NULL || yystackp->yytops.yysize != 0)
|
||||
return;
|
||||
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
||||
yystackp->yytops.yysize = 1;
|
||||
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
||||
yystackp->yylastDeleted = YY_NULLPTR;
|
||||
yystackp->yylastDeleted = YY_NULL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -1141,7 +1143,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
||||
yyi = yyj = 0;
|
||||
while (yyj < yystackp->yytops.yysize)
|
||||
{
|
||||
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
|
||||
if (yystackp->yytops.yystates[yyi] == YY_NULL)
|
||||
{
|
||||
if (yyi == yyj)
|
||||
{
|
||||
@@ -1199,13 +1201,12 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
||||
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
||||
{
|
||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||
YYASSERT (yynewState->yyisState);
|
||||
|
||||
yynewState->yylrState = yylrState;
|
||||
yynewState->yyposn = yyposn;
|
||||
yynewState->yyresolved = yyfalse;
|
||||
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
||||
yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
|
||||
yynewState->yysemantics.yyfirstVal = YY_NULL;
|
||||
yystackp->yytops.yystates[yyk] = yynewState;
|
||||
|
||||
/* Invokes YY_RESERVE_GLRSTACK. */
|
||||
@@ -1265,7 +1266,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
{
|
||||
int yynrhs = yyrhsLength (yyrule);
|
||||
|
||||
if (yystackp->yysplitPoint == YY_NULLPTR)
|
||||
if (yystackp->yysplitPoint == YY_NULL)
|
||||
{
|
||||
/* Standard special case: single stack. */
|
||||
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
||||
@@ -1317,13 +1318,14 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
{
|
||||
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
||||
|
||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
|
||||
{
|
||||
YYSTYPE yysval;]b4_locations_if([[
|
||||
YYLTYPE yyloc;]])[
|
||||
YYRESULTTAG yyflag;
|
||||
YYSTYPE yysval;]b4_locations_if([
|
||||
YYLTYPE yyloc;])[
|
||||
|
||||
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
||||
yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL)
|
||||
{
|
||||
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
|
||||
(unsigned long int) yyk, yyrule - 1));
|
||||
@@ -1356,7 +1358,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
"Now in state %d.\n",
|
||||
(unsigned long int) yyk, yyrule - 1, yynewLRState));
|
||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
|
||||
{
|
||||
yyGLRState *yysplit = yystackp->yysplitPoint;
|
||||
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
|
||||
@@ -1383,7 +1385,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
||||
static size_t
|
||||
yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
||||
{
|
||||
if (yystackp->yysplitPoint == YY_NULLPTR)
|
||||
if (yystackp->yysplitPoint == YY_NULL)
|
||||
{
|
||||
YYASSERT (yyk == 0);
|
||||
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
||||
@@ -1393,7 +1395,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
||||
yyGLRState** yynewStates;
|
||||
yybool* yynewLookaheadNeeds;
|
||||
|
||||
yynewStates = YY_NULLPTR;
|
||||
yynewStates = YY_NULL;
|
||||
|
||||
if (yystackp->yytops.yycapacity
|
||||
> (YYSIZEMAX / (2 * sizeof yynewStates[0])))
|
||||
@@ -1404,7 +1406,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
||||
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
|
||||
(yystackp->yytops.yycapacity
|
||||
* sizeof yynewStates[0]));
|
||||
if (yynewStates == YY_NULLPTR)
|
||||
if (yynewStates == YY_NULL)
|
||||
yyMemoryExhausted (yystackp);
|
||||
yystackp->yytops.yystates = yynewStates;
|
||||
|
||||
@@ -1412,7 +1414,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
||||
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
||||
(yystackp->yytops.yycapacity
|
||||
* sizeof yynewLookaheadNeeds[0]));
|
||||
if (yynewLookaheadNeeds == YY_NULLPTR)
|
||||
if (yynewLookaheadNeeds == YY_NULL)
|
||||
yyMemoryExhausted (yystackp);
|
||||
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
||||
}
|
||||
@@ -1476,9 +1478,9 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
||||
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
||||
while (yytrue)
|
||||
{
|
||||
if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
|
||||
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
|
||||
break;
|
||||
else if (*yyz0p == YY_NULLPTR)
|
||||
else if (*yyz0p == YY_NULL)
|
||||
{
|
||||
*yyz0p = yyz1;
|
||||
break;
|
||||
@@ -1599,7 +1601,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
||||
|
||||
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
|
||||
yystates[yyi] = yys;
|
||||
if (yys == YY_NULLPTR)
|
||||
if (yys == YY_NULL)
|
||||
{
|
||||
yyleftmost_state.yyposn = 0;
|
||||
yystates[0] = &yyleftmost_state;
|
||||
@@ -1670,7 +1672,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
||||
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||
int yynrhs;
|
||||
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
||||
YYASSERT (yyoption != YY_NULLPTR);
|
||||
YYASSERT (yyoption != YY_NULL);
|
||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||
if (yynrhs > 0)
|
||||
{
|
||||
@@ -1729,7 +1731,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
||||
YYRESULTTAG yyflag;]b4_locations_if([
|
||||
YYLTYPE *yylocp = &yys->yyloc;])[
|
||||
|
||||
for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
|
||||
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
|
||||
{
|
||||
yySemanticOption* yyp = *yypp;
|
||||
|
||||
@@ -1771,7 +1773,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
||||
int yyprec = yydprec[yybest->yyrule];
|
||||
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
||||
if (yyflag == yyok)
|
||||
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
|
||||
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
|
||||
{
|
||||
if (yyprec == yydprec[yyp->yyrule])
|
||||
{
|
||||
@@ -1798,14 +1800,14 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
||||
yys->yysemantics.yysval = yysval;
|
||||
}
|
||||
else
|
||||
yys->yysemantics.yyfirstVal = YY_NULLPTR;
|
||||
yys->yysemantics.yyfirstVal = YY_NULL;
|
||||
return yyflag;
|
||||
}
|
||||
|
||||
static YYRESULTTAG
|
||||
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
|
||||
{
|
||||
if (yystackp->yysplitPoint != YY_NULLPTR)
|
||||
if (yystackp->yysplitPoint != YY_NULL)
|
||||
{
|
||||
yyGLRState* yys;
|
||||
int yyn;
|
||||
@@ -1825,10 +1827,10 @@ yycompressStack (yyGLRStack* yystackp)
|
||||
{
|
||||
yyGLRState* yyp, *yyq, *yyr;
|
||||
|
||||
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
|
||||
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULL)
|
||||
return;
|
||||
|
||||
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
|
||||
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULL;
|
||||
yyp != yystackp->yysplitPoint;
|
||||
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
||||
yyp->yypred = yyr;
|
||||
@@ -1836,10 +1838,10 @@ yycompressStack (yyGLRStack* yystackp)
|
||||
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
||||
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
|
||||
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
|
||||
yystackp->yysplitPoint = YY_NULLPTR;
|
||||
yystackp->yylastDeleted = YY_NULLPTR;
|
||||
yystackp->yysplitPoint = YY_NULL;
|
||||
yystackp->yylastDeleted = YY_NULL;
|
||||
|
||||
while (yyr != YY_NULLPTR)
|
||||
while (yyr != YY_NULL)
|
||||
{
|
||||
yystackp->yynextFree->yystate = *yyr;
|
||||
yyr = yyr->yypred;
|
||||
@@ -1854,7 +1856,7 @@ static YYRESULTTAG
|
||||
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||
size_t yyposn]b4_pure_formals[)
|
||||
{
|
||||
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||
while (yystackp->yytops.yystates[yyk] != YY_NULL)
|
||||
{
|
||||
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
||||
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
|
||||
@@ -1976,13 +1978,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
#else
|
||||
{
|
||||
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
||||
size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
|
||||
size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken));
|
||||
size_t yysize = yysize0;
|
||||
yybool yysize_overflow = yyfalse;
|
||||
char* yymsg = YY_NULLPTR;
|
||||
char* yymsg = YY_NULL;
|
||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||
/* Internationalized format string. */
|
||||
const char *yyformat = YY_NULLPTR;
|
||||
const char *yyformat = YY_NULL;
|
||||
/* Arguments of yyformat. */
|
||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||
/* Number of reported tokens (one for the "unexpected", one per
|
||||
@@ -2038,7 +2040,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
}
|
||||
yyarg[yycount++] = yytokenName (yyx);
|
||||
{
|
||||
size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx));
|
||||
size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
|
||||
yysize_overflow |= yysz < yysize;
|
||||
yysize = yysz;
|
||||
}
|
||||
@@ -2116,7 +2118,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
{
|
||||
yySymbol yytoken;
|
||||
if (yychar == YYEOF)
|
||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
||||
if (yychar != YYEMPTY)
|
||||
{]b4_locations_if([[
|
||||
/* We throw away the lookahead, but the error range
|
||||
@@ -2157,10 +2159,10 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
|
||||
/* Reduce to one stack. */
|
||||
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||
if (yystackp->yytops.yystates[yyk] != YY_NULL)
|
||||
break;
|
||||
if (yyk >= yystackp->yytops.yysize)
|
||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
||||
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||
yymarkStackDeleted (yystackp, yyk);
|
||||
yyremoveDeletes (yystackp);
|
||||
@@ -2168,7 +2170,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
|
||||
/* Now pop stack until we find a state that shifts the error token. */
|
||||
yystackp->yyerrState = 3;
|
||||
while (yystackp->yytops.yystates[0] != YY_NULLPTR)
|
||||
while (yystackp->yytops.yystates[0] != YY_NULL)
|
||||
{
|
||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||
yyj = yypact[yys->yylrState];
|
||||
@@ -2192,14 +2194,14 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
||||
}
|
||||
}]b4_locations_if([[
|
||||
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||
if (yys->yypred != YY_NULLPTR)
|
||||
if (yys->yypred != YY_NULL)
|
||||
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
||||
yystackp->yytops.yystates[0] = yys->yypred;
|
||||
yystackp->yynextFree -= 1;
|
||||
yystackp->yyspaceLeft += 1;
|
||||
}
|
||||
if (yystackp->yytops.yystates[0] == YY_NULLPTR)
|
||||
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||
if (yystackp->yytops.yystates[0] == YY_NULL)
|
||||
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
||||
}
|
||||
|
||||
#define YYCHK1(YYE) \
|
||||
@@ -2442,7 +2444,7 @@ b4_dollar_popdef])[]dnl
|
||||
{
|
||||
yyGLRState *yys = yystates[yyk];
|
||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
||||
)[ if (yys->yypred != YY_NULLPTR)
|
||||
)[ if (yys->yypred != YY_NULL)
|
||||
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
||||
yystates[yyk] = yys->yypred;
|
||||
yystack.yynextFree -= 1;
|
||||
@@ -2474,7 +2476,7 @@ yy_yypstack (yyGLRState* yys)
|
||||
static void
|
||||
yypstates (yyGLRState* yyst)
|
||||
{
|
||||
if (yyst == YY_NULLPTR)
|
||||
if (yyst == YY_NULL)
|
||||
YYFPRINTF (stderr, "<null>");
|
||||
else
|
||||
yy_yypstack (yyst);
|
||||
@@ -2488,7 +2490,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk)
|
||||
}
|
||||
|
||||
#define YYINDEX(YYX) \
|
||||
((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
|
||||
((YYX) == YY_NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
|
||||
|
||||
|
||||
static void
|
||||
@@ -2502,8 +2504,6 @@ yypdumpstack (yyGLRStack* yystackp)
|
||||
(unsigned long int) (yyp - yystackp->yyitems));
|
||||
if (*(yybool *) yyp)
|
||||
{
|
||||
YYASSERT (yyp->yystate.yyisState);
|
||||
YYASSERT (yyp->yyoption.yyisState);
|
||||
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
||||
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
||||
(unsigned long int) yyp->yystate.yyposn,
|
||||
@@ -2515,8 +2515,6 @@ yypdumpstack (yyGLRStack* yystackp)
|
||||
}
|
||||
else
|
||||
{
|
||||
YYASSERT (!yyp->yystate.yyisState);
|
||||
YYASSERT (!yyp->yyoption.yyisState);
|
||||
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
||||
yyp->yyoption.yyrule - 1,
|
||||
(long int) YYINDEX (yyp->yyoption.yystate),
|
||||
|
||||
+63
-62
@@ -157,7 +157,6 @@ m4_define([b4_shared_declarations],
|
||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||
]b4_variant_if([b4_variant_includes])[
|
||||
|
||||
]b4_attribute_define[
|
||||
]b4_YYDEBUG_define[
|
||||
|
||||
]b4_namespace_open[
|
||||
@@ -184,14 +183,14 @@ b4_location_define])])[
|
||||
|
||||
#if ]b4_api_PREFIX[DEBUG
|
||||
/// The current debugging stream.
|
||||
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
|
||||
std::ostream& debug_stream () const;
|
||||
/// Set the current debugging stream.
|
||||
void set_debug_stream (std::ostream &);
|
||||
|
||||
/// Type for debugging levels.
|
||||
typedef int debug_level_type;
|
||||
/// The current debugging level.
|
||||
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
|
||||
debug_level_type debug_level () const;
|
||||
/// Set the current debugging level.
|
||||
void set_debug_level (debug_level_type l);
|
||||
#endif
|
||||
@@ -220,8 +219,8 @@ b4_location_define])])[
|
||||
|
||||
/// Compute post-reduction state.
|
||||
/// \param yystate the current state
|
||||
/// \param yysym the nonterminal to push on the stack
|
||||
state_type yy_lr_goto_state_ (state_type yystate, int yysym);
|
||||
/// \param yylhs the nonterminal to push on the stack
|
||||
state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
|
||||
|
||||
/// Whether the given \c yypact_ value indicates a defaulted state.
|
||||
/// \param yyvalue the value to check
|
||||
@@ -268,7 +267,7 @@ b4_location_define])])[
|
||||
/// \brief Reclaim the memory associated to a symbol.
|
||||
/// \param yymsg Why this token is reclaimed.
|
||||
/// If null, print nothing.
|
||||
/// \param yysym The symbol.
|
||||
/// \param s The symbol.
|
||||
template <typename Base>
|
||||
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
||||
|
||||
@@ -342,13 +341,13 @@ b4_location_define])])[
|
||||
enum
|
||||
{
|
||||
yyeof_ = 0,
|
||||
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
||||
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
||||
yylast_ = ]b4_last[, //< Last index in yytable_.
|
||||
yynnts_ = ]b4_nterms_number[, //< Number of nonterminal symbols.
|
||||
yyempty_ = -2,
|
||||
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
||||
yyfinal_ = ]b4_final_state_number[, //< Termination state number.
|
||||
yyterror_ = 1,
|
||||
yyerrcode_ = 256,
|
||||
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
||||
yyntokens_ = ]b4_tokens_number[ //< Number of tokens.
|
||||
};
|
||||
|
||||
]b4_parse_param_vars[
|
||||
@@ -671,13 +670,13 @@ m4_if(b4_prefix, [yy], [],
|
||||
#endif // ]b4_api_PREFIX[DEBUG
|
||||
|
||||
inline ]b4_parser_class_name[::state_type
|
||||
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
||||
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
|
||||
{
|
||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||
int yyr = yypgoto_[yylhs - yyntokens_] + yystate;
|
||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||
return yytable_[yyr];
|
||||
else
|
||||
return yydefgoto_[yysym - yyntokens_];
|
||||
return yydefgoto_[yylhs - yyntokens_];
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -700,7 +699,6 @@ m4_if(b4_prefix, [yy], [],
|
||||
|
||||
// State.
|
||||
int yyn;
|
||||
/// Length of the RHS of the rule being reduced.
|
||||
int yylen = 0;
|
||||
|
||||
// Error handling.
|
||||
@@ -713,6 +711,9 @@ m4_if(b4_prefix, [yy], [],
|
||||
/// The locations where the error started and ended.
|
||||
stack_symbol_type yyerror_range[3];]])[
|
||||
|
||||
/// $$ and @@$.
|
||||
stack_symbol_type yylhs;
|
||||
|
||||
/// The return value of parse ().
|
||||
int yyresult;
|
||||
|
||||
@@ -733,7 +734,7 @@ b4_dollar_popdef])[]dnl
|
||||
location values to have been already stored, initialize these
|
||||
stacks with a primary value. */
|
||||
yystack_.clear ();
|
||||
yypush_ (YY_NULLPTR, 0, yyla);
|
||||
yypush_ (YY_NULL, 0, yyla);
|
||||
|
||||
// A new symbol was pushed on the stack.
|
||||
yynewstate:
|
||||
@@ -813,55 +814,52 @@ b4_dollar_popdef])[]dnl
|
||||
`-----------------------------*/
|
||||
yyreduce:
|
||||
yylen = yyr2_[yyn];
|
||||
{
|
||||
stack_symbol_type yylhs;
|
||||
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||
/* Variants are always initialized to an empty instance of the
|
||||
correct type. The default '$$ = $1' action is NOT applied
|
||||
when using variants. */
|
||||
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])], [
|
||||
/* If YYLEN is nonzero, implement the default value of the
|
||||
action: '$$ = $1'. Otherwise, use the top of the stack.
|
||||
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||
/* Variants are always initialized to an empty instance of the
|
||||
correct type. The default $$=$1 action is NOT applied when using
|
||||
variants. */
|
||||
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
|
||||
/* If YYLEN is nonzero, implement the default value of the action:
|
||||
'$$ = $1'. Otherwise, use the top of the stack.
|
||||
|
||||
Otherwise, the following line sets YYLHS.VALUE to garbage.
|
||||
This behavior is undocumented and Bison users should not rely
|
||||
upon it. */
|
||||
if (yylen)
|
||||
yylhs.value = yystack_@{yylen - 1@}.value;
|
||||
else
|
||||
yylhs.value = yystack_@{0@}.value;])[
|
||||
Otherwise, the following line sets YYLHS.VALUE to garbage.
|
||||
This behavior is undocumented and Bison
|
||||
users should not rely upon it. */
|
||||
if (yylen)
|
||||
yylhs.value = yystack_@{yylen - 1@}.value;
|
||||
else
|
||||
yylhs.value = yystack_@{0@}.value;])[
|
||||
]b4_locations_if([dnl
|
||||
[
|
||||
// Compute the default @@$.
|
||||
// Compute the default @@$.
|
||||
{
|
||||
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
||||
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
||||
}]])[
|
||||
|
||||
// Perform the reduction.
|
||||
YY_REDUCE_PRINT (yyn);
|
||||
try
|
||||
{
|
||||
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
||||
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
||||
}]])[
|
||||
|
||||
// Perform the reduction.
|
||||
YY_REDUCE_PRINT (yyn);
|
||||
try
|
||||
{
|
||||
switch (yyn)
|
||||
{
|
||||
switch (yyn)
|
||||
{
|
||||
]b4_user_actions[
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (const syntax_error& yyexc)
|
||||
{
|
||||
error (yyexc);
|
||||
YYERROR;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
||||
yypop_ (yylen);
|
||||
yylen = 0;
|
||||
YY_STACK_PRINT ();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (const syntax_error& yyexc)
|
||||
{
|
||||
error (yyexc);
|
||||
YYERROR;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
||||
yypop_ (yylen);
|
||||
yylen = 0;
|
||||
YY_STACK_PRINT ();
|
||||
|
||||
// Shift the result of the reduction.
|
||||
yypush_ (YY_NULLPTR, yylhs);
|
||||
}
|
||||
// Shift the result of the reduction.
|
||||
yypush_ (YY_NULL, yylhs);
|
||||
goto yynewstate;
|
||||
|
||||
/*--------------------------------------.
|
||||
@@ -908,7 +906,10 @@ b4_dollar_popdef])[]dnl
|
||||
code. */
|
||||
if (false)
|
||||
goto yyerrorlab;]b4_locations_if([[
|
||||
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
|
||||
yyerror_range[1].location = yystack_[yylen - 1].location;]])b4_variant_if([[
|
||||
/* $$ was initialized before running the user action. */
|
||||
YY_SYMBOL_PRINT ("Error: discarding", yylhs);
|
||||
yylhs.~stack_symbol_type();]])[
|
||||
/* Do not reclaim the symbols of the rule whose action triggered
|
||||
this YYERROR. */
|
||||
yypop_ (yylen);
|
||||
@@ -987,11 +988,11 @@ b4_dollar_popdef])[]dnl
|
||||
// Do not try to display the values of the reclaimed symbols,
|
||||
// as their printer might throw an exception.
|
||||
if (!yyempty)
|
||||
yy_destroy_ (YY_NULLPTR, yyla);
|
||||
yy_destroy_ (YY_NULL, yyla);
|
||||
|
||||
while (1 < yystack_.size ())
|
||||
{
|
||||
yy_destroy_ (YY_NULLPTR, yystack_[0]);
|
||||
yy_destroy_ (YY_NULL, yystack_[0]);
|
||||
yypop_ ();
|
||||
}
|
||||
throw;
|
||||
@@ -1073,7 +1074,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
||||
}
|
||||
}
|
||||
|
||||
char const* yyformat = YY_NULLPTR;
|
||||
char const* yyformat = YY_NULL;
|
||||
switch (yycount)
|
||||
{
|
||||
#define YYCASE_(N, S) \
|
||||
|
||||
+8
-14
@@ -453,19 +453,6 @@ b4_define_state])[
|
||||
return yyerrstatus_ == 0;
|
||||
}
|
||||
|
||||
/** Compute post-reduction state.
|
||||
* @@param yystate the current state
|
||||
* @@param yysym the nonterminal to push on the stack
|
||||
*/
|
||||
private int yy_lr_goto_state_ (int yystate, int yysym)
|
||||
{
|
||||
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||
return yytable_[yyr];
|
||||
else
|
||||
return yydefgoto_[yysym - yyntokens_];
|
||||
}
|
||||
|
||||
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
||||
{
|
||||
]b4_yystype[ yyval;
|
||||
@@ -496,7 +483,14 @@ b4_define_state])[
|
||||
yylen = 0;
|
||||
|
||||
/* Shift the result of the reduction. */
|
||||
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), yyr1_[yyn]);
|
||||
yyn = yyr1_[yyn];
|
||||
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
||||
if (0 <= yystate && yystate <= yylast_
|
||||
&& yycheck_[yystate] == yystack.stateAt (0))
|
||||
yystate = yytable_[yystate];
|
||||
else
|
||||
yystate = yydefgoto_[yyn - yyntokens_];
|
||||
|
||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||
return YYNEWSTATE;
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ m4_define([b4_position_define],
|
||||
{
|
||||
public:]m4_ifdef([b4_location_constructors], [[
|
||||
/// Construct a position.
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
: filename (f)
|
||||
@@ -38,7 +38,7 @@ m4_define([b4_position_define],
|
||||
|
||||
]])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ m4_define([b4_location_define],
|
||||
|
||||
])[
|
||||
/// Initialization.
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
||||
unsigned int l = ]b4_location_initial_line[u,
|
||||
unsigned int c = ]b4_location_initial_column[u)
|
||||
{
|
||||
|
||||
+5
-3
@@ -95,7 +95,7 @@ m4_define([b4_variant_define],
|
||||
|
||||
/// Empty construction.
|
||||
variant ()]b4_parse_assert_if([
|
||||
: yytname_ (YY_NULLPTR)])[
|
||||
: yytname_ (YY_NULL)])[
|
||||
{}
|
||||
|
||||
/// Construct and fill.
|
||||
@@ -178,7 +178,8 @@ m4_define([b4_variant_define],
|
||||
template <typename T>
|
||||
void
|
||||
move (self_type& other)
|
||||
{
|
||||
{]b4_parse_assert_if([
|
||||
YYASSERT (!yytname_);])[
|
||||
build<T> ();
|
||||
swap<T> (other);
|
||||
other.destroy<T> ();
|
||||
@@ -198,7 +199,7 @@ m4_define([b4_variant_define],
|
||||
destroy ()
|
||||
{
|
||||
as<T> ().~T ();]b4_parse_assert_if([
|
||||
yytname_ = YY_NULLPTR;])[
|
||||
yytname_ = YY_NULL;])[
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -320,6 +321,7 @@ b4_join(b4_symbol_if([$1], [has_type],
|
||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||
b4_symbol_if([$1], [has_type], [v]),
|
||||
b4_locations_if([l])));
|
||||
|
||||
}
|
||||
|
||||
])])])
|
||||
|
||||
@@ -201,8 +201,6 @@
|
||||
<xsl:if test="$point = 0">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<!-- RHS -->
|
||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="$point = position()">
|
||||
@@ -216,9 +214,7 @@
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="empty">
|
||||
<xsl:text> %empty</xsl:text>
|
||||
</xsl:template>
|
||||
<xsl:template match="empty"/>
|
||||
|
||||
<xsl:template match="lookaheads">
|
||||
<xsl:text> [</xsl:text>
|
||||
|
||||
@@ -350,7 +350,12 @@
|
||||
<xsl:if test="position() = $point + 1">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$itemset != 'true'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:if test="position() = last() and position() = $point">
|
||||
<xsl:text> .</xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
@@ -532,7 +532,12 @@
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="point">.</span>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="."/>
|
||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$itemset != 'true'">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:if>
|
||||
<xsl:if test="position() = last() and position() = $point">
|
||||
<xsl:text> </xsl:text>
|
||||
<span class="point">.</span>
|
||||
@@ -558,7 +563,7 @@
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="empty">
|
||||
<xsl:text> %empty</xsl:text>
|
||||
<xsl:text> ε</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="lookaheads">
|
||||
|
||||
+6
-6
@@ -1108,11 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
||||
{
|
||||
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
||||
YYSIZE_T yysize = yysize0;
|
||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||
/* Internationalized format string. */
|
||||
const char *yyformat = YY_NULLPTR;
|
||||
const char *yyformat = YY_NULL;
|
||||
/* Arguments of yyformat. */
|
||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||
/* Number of reported tokens (one for the "unexpected", one per
|
||||
@@ -1187,7 +1187,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
}
|
||||
yyarg[yycount++] = yytname[yyx];
|
||||
{
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
||||
if (! (yysize <= yysize1
|
||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||
return 2;
|
||||
@@ -1271,7 +1271,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([
|
||||
|
||||
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
{
|
||||
return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param],
|
||||
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
|
||||
[[, ]b4_args(b4_parse_param)])[);
|
||||
}
|
||||
|
||||
@@ -1313,10 +1313,10 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||
{
|
||||
yypstate *yyps;]b4_pure_if([], [[
|
||||
if (yypstate_allocated)
|
||||
return YY_NULLPTR;]])[
|
||||
return YY_NULL;]])[
|
||||
yyps = (yypstate *) malloc (sizeof *yyps);
|
||||
if (!yyps)
|
||||
return YY_NULLPTR;
|
||||
return YY_NULL;
|
||||
yyps->yynew = 1;]b4_pure_if([], [[
|
||||
yypstate_allocated = 1;]])[
|
||||
return yyps;
|
||||
|
||||
+8
-14
@@ -10065,16 +10065,18 @@ A category can be turned off by prefixing its name with @samp{no-}. For
|
||||
instance, @option{-Wno-yacc} will hide the warnings about
|
||||
POSIX Yacc incompatibilities.
|
||||
|
||||
@item -Werror
|
||||
Turn enabled warnings for every @var{category} into errors, unless they are
|
||||
explicitly disabled by @option{-Wno-error=@var{category}}.
|
||||
|
||||
@item -Werror=@var{category}
|
||||
Enable warnings falling in @var{category}, and treat them as errors.
|
||||
@item -Werror[=@var{category}]
|
||||
@itemx -Wno-error[=@var{category}]
|
||||
Enable warnings falling in @var{category}, and treat them as errors. If no
|
||||
@var{category} is given, it defaults to making all enabled warnings into errors.
|
||||
|
||||
@var{category} is the same as for @option{--warnings}, with the exception that
|
||||
it may not be prefixed with @samp{no-} (see above).
|
||||
|
||||
Prefixed with @samp{no}, it deactivates the error treatment for this
|
||||
@var{category}. However, the warning itself won't be disabled, or enabled, by
|
||||
this option.
|
||||
|
||||
Note that the precedence of the @samp{=} and @samp{,} operators is such that
|
||||
the following commands are @emph{not} equivalent, as the first will not treat
|
||||
S/R conflicts as errors.
|
||||
@@ -10084,14 +10086,6 @@ $ bison -Werror=yacc,conflicts-sr input.y
|
||||
$ bison -Werror=yacc,error=conflicts-sr input.y
|
||||
@end example
|
||||
|
||||
@item -Wno-error
|
||||
Do not turn enabled warnings for every @var{category} into errors, unless
|
||||
they are explicitly enabled by @option{-Werror=@var{category}}.
|
||||
|
||||
@item -Wno-error=@var{category}
|
||||
Deactivate the error treatment for this @var{category}. However, the warning
|
||||
itself won't be disabled, or enabled, by this option.
|
||||
|
||||
@item -f [@var{feature}]
|
||||
@itemx --feature[=@var{feature}]
|
||||
Activate miscellaneous @var{feature}. @var{feature} can be one of:
|
||||
|
||||
@@ -118,9 +118,7 @@ $(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
||||
fi
|
||||
$(AM_V_at)rm -f $@*.t
|
||||
|
||||
if ENABLE_YACC
|
||||
nodist_man_MANS = doc/yacc.1
|
||||
endif
|
||||
|
||||
## ----------------------------- ##
|
||||
## Graphviz examples generation. ##
|
||||
|
||||
+25
-25
@@ -19,7 +19,7 @@
|
||||
|
||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||
# in srcdir, including during distcheck, which is forbidden.
|
||||
%D%/calc++-parser.stamp: $(BISON_IN)
|
||||
examples/calc++/calc++-parser.stamp: $(BISON_IN)
|
||||
SUFFIXES += .yy .stamp
|
||||
.yy.stamp:
|
||||
$(AM_V_YACC)rm -f $@
|
||||
@@ -27,14 +27,14 @@ SUFFIXES += .yy .stamp
|
||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||
$(AM_V_at)mv -f $@.tmp $@
|
||||
|
||||
$(calc_sources_generated): %D%/calc++-parser.stamp
|
||||
@test -f $@ || rm -f %D%/calc++-parser.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp
|
||||
$(calc_sources_generated): examples/calc++/calc++-parser.stamp
|
||||
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
|
||||
CLEANFILES += \
|
||||
$(calc_sources_generated) \
|
||||
%D%/calc++-parser.output \
|
||||
%D%/calc++-parser.stamp \
|
||||
%D%/calc++-scanner.cc
|
||||
examples/calc++/calc++-parser.output \
|
||||
examples/calc++/calc++-parser.stamp \
|
||||
examples/calc++/calc++-scanner.cc
|
||||
|
||||
|
||||
## -------------------- ##
|
||||
@@ -42,35 +42,35 @@ CLEANFILES += \
|
||||
## -------------------- ##
|
||||
|
||||
# Avoid using BUILT_SOURCES which is too global.
|
||||
$(%C%_calc___OBJECTS): $(calc_sources_generated)
|
||||
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
||||
|
||||
calc_sources_extracted = \
|
||||
%D%/calc++-driver.cc \
|
||||
%D%/calc++-driver.hh \
|
||||
%D%/calc++-scanner.ll \
|
||||
%D%/calc++.cc
|
||||
examples/calc++/calc++-driver.cc \
|
||||
examples/calc++/calc++-driver.hh \
|
||||
examples/calc++/calc++-scanner.ll \
|
||||
examples/calc++/calc++.cc
|
||||
calc_extracted = \
|
||||
$(calc_sources_extracted) \
|
||||
%D%/calc++-parser.yy
|
||||
examples/calc++/calc++-parser.yy
|
||||
extracted += $(calc_extracted)
|
||||
calc_sources_generated = \
|
||||
%D%/calc++-parser.cc \
|
||||
%D%/calc++-parser.hh \
|
||||
%D%/location.hh \
|
||||
%D%/position.hh \
|
||||
%D%/stack.hh
|
||||
examples/calc++/calc++-parser.cc \
|
||||
examples/calc++/calc++-parser.hh \
|
||||
examples/calc++/location.hh \
|
||||
examples/calc++/position.hh \
|
||||
examples/calc++/stack.hh
|
||||
calc_sources = \
|
||||
$(calc_sources_extracted) \
|
||||
$(calc_sources_generated)
|
||||
|
||||
if FLEX_CXX_WORKS
|
||||
check_PROGRAMS += %D%/calc++
|
||||
nodist_%C%_calc___SOURCES = \
|
||||
if BISON_CXX_WORKS
|
||||
check_PROGRAMS += examples/calc++/calc++
|
||||
nodist_examples_calc___calc___SOURCES = \
|
||||
$(calc_sources)
|
||||
|
||||
%C%_calc___CPPFLAGS = -I$(top_builddir)/%D%
|
||||
%C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
||||
dist_TESTS += %D%/calc++.test
|
||||
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
||||
examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
||||
dist_TESTS += examples/calc++/calc++.test
|
||||
else
|
||||
EXTRA_DIST += %D%/calc++.test
|
||||
EXTRA_DIST += examples/calc++/calc++.test
|
||||
endif
|
||||
|
||||
+12
-12
@@ -13,8 +13,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
||||
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
|
||||
dist_noinst_SCRIPTS = examples/extexi examples/test
|
||||
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
||||
|
||||
AM_CXXFLAGS = \
|
||||
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
||||
@@ -24,20 +24,20 @@ AM_CXXFLAGS = \
|
||||
## ------------ ##
|
||||
|
||||
doc = $(top_srcdir)/doc/bison.texi
|
||||
extexi = $(top_srcdir)/%D%/extexi
|
||||
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(doc) --
|
||||
extexi = $(top_srcdir)/examples/extexi
|
||||
extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) --
|
||||
extracted =
|
||||
CLEANFILES += $(extracted) %D%/extracted.stamp
|
||||
%D%/extracted.stamp: $(doc) $(extexi)
|
||||
CLEANFILES += $(extracted) examples/extracted.stamp
|
||||
examples/extracted.stamp: $(doc) $(extexi)
|
||||
$(AM_V_GEN)rm -f $@ $@.tmp
|
||||
$(AM_V_at)touch $@.tmp
|
||||
$(AM_V_at)$(extract) $(extracted)
|
||||
$(AM_V_at)mv $@.tmp $@
|
||||
|
||||
$(extracted): %D%/extracted.stamp
|
||||
@test -f $@ || rm -f %D%/extracted.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
||||
$(extracted): examples/extracted.stamp
|
||||
@test -f $@ || rm -f examples/extracted.stamp
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
|
||||
|
||||
include %D%/calc++/local.mk
|
||||
include %D%/mfcalc/local.mk
|
||||
include %D%/rpcalc/local.mk
|
||||
include examples/calc++/local.mk
|
||||
include examples/mfcalc/local.mk
|
||||
include examples/rpcalc/local.mk
|
||||
|
||||
@@ -18,15 +18,19 @@
|
||||
## -------------------- ##
|
||||
|
||||
BUILT_SOURCES += $(mfcalc_sources)
|
||||
CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
|
||||
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output
|
||||
|
||||
mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
|
||||
mfcalc_sources = $(mfcalc_extracted)
|
||||
mfcalc_extracted = \
|
||||
examples/mfcalc/calc.h \
|
||||
examples/mfcalc/mfcalc.y
|
||||
mfcalc_sources = \
|
||||
$(mfcalc_extracted)
|
||||
extracted += $(mfcalc_extracted)
|
||||
|
||||
check_PROGRAMS += %D%/mfcalc
|
||||
%C%_mfcalc_LDADD = -lm
|
||||
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
||||
check_PROGRAMS += examples/mfcalc/mfcalc
|
||||
examples_mfcalc_mfcalc_LDADD = -lm
|
||||
nodist_examples_mfcalc_mfcalc_SOURCES = \
|
||||
$(mfcalc_sources)
|
||||
|
||||
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||
dist_TESTS += %D%/mfcalc.test
|
||||
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
|
||||
dist_TESTS += examples/mfcalc/mfcalc.test
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/calc.h
|
||||
/rpcalc
|
||||
/rpcalc.c
|
||||
/rpcalc.h
|
||||
/rpcalc.output
|
||||
|
||||
@@ -18,15 +18,18 @@
|
||||
## -------------------- ##
|
||||
|
||||
BUILT_SOURCES += $(rpcalc_sources)
|
||||
CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
|
||||
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output
|
||||
|
||||
rpcalc_extracted = %D%/rpcalc.y
|
||||
rpcalc_sources = $(rpcalc_extracted)
|
||||
rpcalc_extracted = \
|
||||
examples/rpcalc/rpcalc.y
|
||||
rpcalc_sources = \
|
||||
$(rpcalc_extracted)
|
||||
extracted += $(rpcalc_extracted)
|
||||
|
||||
check_PROGRAMS += %D%/rpcalc
|
||||
%C%_rpcalc_LDADD = -lm
|
||||
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
|
||||
check_PROGRAMS += examples/rpcalc/rpcalc
|
||||
examples_rpcalc_rpcalc_LDADD = -lm
|
||||
nodist_examples_rpcalc_rpcalc_SOURCES = \
|
||||
$(rpcalc_sources)
|
||||
|
||||
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||
dist_TESTS += %D%/rpcalc.test
|
||||
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
|
||||
dist_TESTS += examples/rpcalc/rpcalc.test
|
||||
|
||||
+5
-11
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
%debug
|
||||
%language "c++"
|
||||
%skeleton "lalr1.cc"
|
||||
%defines
|
||||
%define api.token.constructor
|
||||
%define api.value.type variant
|
||||
@@ -48,17 +48,11 @@ typedef std::list<std::string> strings_type;
|
||||
namespace std
|
||||
{
|
||||
std::ostream&
|
||||
operator<< (std::ostream& o, const strings_type& ss)
|
||||
operator<< (std::ostream& o, const strings_type& s)
|
||||
{
|
||||
o << "(" << &ss << ") {";
|
||||
const char *sep = "";
|
||||
for (strings_type::const_iterator i = ss.begin(), end = ss.end();
|
||||
i != end; ++i)
|
||||
{
|
||||
o << sep << *i;
|
||||
sep = ", ";
|
||||
}
|
||||
return o << "}";
|
||||
std::copy (s.begin (), s.end (),
|
||||
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
Submodule gnulib updated: 74540d44dc...03e96cc338
@@ -272,5 +272,3 @@
|
||||
/sig-handler.c
|
||||
/unistd.c
|
||||
/wctype-h.c
|
||||
/lstat.c
|
||||
/unlink.c
|
||||
|
||||
+1
-3
@@ -51,8 +51,6 @@ lib_libbison_a_SOURCES += \
|
||||
lib/get-errno.c
|
||||
|
||||
# The Yacc compatibility library.
|
||||
if ENABLE_YACC
|
||||
lib_LIBRARIES = lib/liby.a
|
||||
lib_LIBRARIES = $(YACC_LIBRARY)
|
||||
EXTRA_LIBRARIES = lib/liby.a
|
||||
lib_liby_a_SOURCES = lib/main.c lib/yyerror.c
|
||||
endif
|
||||
|
||||
@@ -180,6 +180,3 @@
|
||||
/obstack-printf.m4
|
||||
/extern-inline.m4
|
||||
/non-recursive-gnulib-prefix-hack.m4
|
||||
/absolute-header.m4
|
||||
/lstat.m4
|
||||
/unlink.m4
|
||||
|
||||
+12
-15
@@ -242,7 +242,7 @@ AnnotationList__computePredecessorAnnotations (AnnotationList *self, state *s,
|
||||
{
|
||||
symbol_number contribution_token =
|
||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
||||
->number;
|
||||
->content->number;
|
||||
if (AnnotationList__isContributionAlways (self, ci))
|
||||
{
|
||||
annotation_node->contributions[ci] = NULL;
|
||||
@@ -541,19 +541,15 @@ AnnotationList__compute_from_inadequacies (
|
||||
{
|
||||
InadequacyList__prependTo (conflict_node,
|
||||
&inadequacy_lists[s->number]);
|
||||
{
|
||||
bool b =
|
||||
AnnotationList__insertInto (annotation_node,
|
||||
&annotation_lists[s->number],
|
||||
s->nitems);
|
||||
aver (b);
|
||||
}
|
||||
aver (AnnotationList__insertInto (
|
||||
annotation_node, &annotation_lists[s->number],
|
||||
s->nitems));
|
||||
/* This aver makes sure the
|
||||
AnnotationList__computeDominantContribution check above
|
||||
does discard annotations in the simplest case of a S/R
|
||||
conflict with no token precedence. */
|
||||
aver (!bitset_test (shift_tokens, conflicted_token)
|
||||
|| symbols[conflicted_token]->prec);
|
||||
|| symbols[conflicted_token]->content->prec);
|
||||
++annotation_counts[s->number];
|
||||
if (contribution_count > *max_contributionsp)
|
||||
*max_contributionsp = contribution_count;
|
||||
@@ -599,7 +595,7 @@ AnnotationList__debug (AnnotationList const *self, size_t nitems, int spaces)
|
||||
{
|
||||
symbol_number token =
|
||||
InadequacyList__getContributionToken (a->inadequacyNode, ci)
|
||||
->number;
|
||||
->content->number;
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j < spaces+2; ++j)
|
||||
@@ -648,7 +644,7 @@ AnnotationList__computeLookaheadFilter (AnnotationList const *self,
|
||||
Sbitset biter;
|
||||
symbol_number token =
|
||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
||||
->number;
|
||||
->content->number;
|
||||
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
|
||||
bitset_set (lookahead_filter[item], token);
|
||||
}
|
||||
@@ -683,7 +679,8 @@ AnnotationList__stateMakesContribution (AnnotationList const *self,
|
||||
return false;
|
||||
{
|
||||
symbol_number token =
|
||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)->number;
|
||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
||||
->content->number;
|
||||
Sbitset__Index item;
|
||||
Sbitset biter;
|
||||
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
|
||||
@@ -713,7 +710,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
||||
ContributionIndex ci;
|
||||
int actioni;
|
||||
ContributionIndex ci_rr_dominator = ContributionIndex__none;
|
||||
int shift_precedence = token->prec;
|
||||
int shift_precedence = token->content->prec;
|
||||
|
||||
/* If the token has no precedence set, shift is always chosen. */
|
||||
if (!shift_precedence)
|
||||
@@ -743,7 +740,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
||||
if (reduce_precedence
|
||||
&& (reduce_precedence < shift_precedence
|
||||
|| (reduce_precedence == shift_precedence
|
||||
&& token->assoc == right_assoc)))
|
||||
&& token->content->assoc == right_assoc)))
|
||||
continue;
|
||||
if (!AnnotationList__stateMakesContribution (self, nitems, ci,
|
||||
lookaheads))
|
||||
@@ -751,7 +748,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
||||
/* This uneliminated reduction contributes, so see if it can cause
|
||||
an error action. */
|
||||
if (reduce_precedence == shift_precedence
|
||||
&& token->assoc == non_assoc)
|
||||
&& token->content->assoc == non_assoc)
|
||||
{
|
||||
/* It's not possible to find split-stable domination over
|
||||
shift after a potential %nonassoc. */
|
||||
|
||||
+212
-98
@@ -35,33 +35,39 @@ err_status complaint_status = status_none;
|
||||
|
||||
bool warnings_are_errors = false;
|
||||
|
||||
/** Whether -Werror/-Wno-error was applied to a warning. */
|
||||
typedef enum
|
||||
{
|
||||
errority_unset = 0, /** No explict status. */
|
||||
errority_disabled = 1, /** Explictly disabled with -Wno-error=foo. */
|
||||
errority_enabled = 2 /** Explictly enabled with -Werror=foo. */
|
||||
} errority;
|
||||
|
||||
/** For each warning type, its errority. */
|
||||
static errority errority_flag[warnings_size];
|
||||
|
||||
/** Diagnostics severity. */
|
||||
typedef enum
|
||||
{
|
||||
severity_disabled = 0, /**< Explicitly disabled via -Wno-foo. */
|
||||
severity_unset = 1, /**< Unspecified status. */
|
||||
severity_warning = 2, /**< A warning. */
|
||||
severity_error = 3, /**< An error (continue, but die soon). */
|
||||
severity_fatal = 4 /**< Fatal error (die now). */
|
||||
severity_disabled = 0,
|
||||
severity_unset = 1,
|
||||
severity_warning = 2,
|
||||
severity_error = 3,
|
||||
severity_fatal = 4
|
||||
} severity;
|
||||
|
||||
|
||||
/** Struct to sort the warnings according to location. */
|
||||
typedef struct
|
||||
{
|
||||
location *loc;
|
||||
char *message;
|
||||
} warning;
|
||||
|
||||
warning **warning_list;
|
||||
|
||||
struct obstack obstack_warning;
|
||||
|
||||
#define WARNING_LIST_INCREMENT 100
|
||||
|
||||
int warning_count = 0;
|
||||
|
||||
/** For each warning type, its severity. */
|
||||
static severity warnings_flag[warnings_size];
|
||||
|
||||
static unsigned *indent_ptr = 0;
|
||||
|
||||
static const location *complain_loc;
|
||||
|
||||
/*------------------------.
|
||||
| --warnings's handling. |
|
||||
`------------------------*/
|
||||
@@ -114,26 +120,32 @@ warning_argmatch (char const *arg, size_t no, size_t err)
|
||||
no = !no;
|
||||
}
|
||||
|
||||
size_t b;
|
||||
for (b = 0; b < warnings_size; ++b)
|
||||
if (value & 1 << b)
|
||||
{
|
||||
if (err && no)
|
||||
/* -Wno-error=foo. */
|
||||
errority_flag[b] = errority_disabled;
|
||||
else if (err && !no)
|
||||
if (no)
|
||||
{
|
||||
size_t b;
|
||||
for (b = 0; b < warnings_size; ++b)
|
||||
if (value & 1 << b)
|
||||
{
|
||||
/* -Werror=foo: enables -Wfoo. */
|
||||
errority_flag[b] = errority_enabled;
|
||||
warnings_flag[b] = severity_warning;
|
||||
if (err)
|
||||
{
|
||||
/* -Wno-error=foo: if foo enabled as an error,
|
||||
make it a warning. */
|
||||
if (warnings_flag[b] == severity_error)
|
||||
warnings_flag[b] = severity_warning;
|
||||
}
|
||||
else
|
||||
/* -Wno-foo. */
|
||||
warnings_flag[b] = severity_disabled;
|
||||
}
|
||||
else if (no)
|
||||
/* -Wno-foo. */
|
||||
warnings_flag[b] = severity_disabled;
|
||||
else
|
||||
/* -Wfoo. */
|
||||
warnings_flag[b] = severity_warning;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t b;
|
||||
for (b = 0; b < warnings_size; ++b)
|
||||
if (value & 1 << b)
|
||||
/* -Wfoo and -Werror=foo. */
|
||||
warnings_flag[b] = err ? severity_error : severity_warning;
|
||||
}
|
||||
}
|
||||
|
||||
/** Decode a comma-separated list of arguments from -W.
|
||||
@@ -150,13 +162,13 @@ warnings_argmatch (char *args)
|
||||
if (STREQ (args, "error"))
|
||||
warnings_are_errors = true;
|
||||
else if (STREQ (args, "no-error"))
|
||||
warnings_are_errors = false;
|
||||
{
|
||||
warnings_are_errors = false;
|
||||
warning_argmatch ("no-error=everything", 3, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The length of the possible 'no-' prefix: 3, or 0. */
|
||||
size_t no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
|
||||
/* The length of the possible 'error=' (possibly after
|
||||
'no-') prefix: 6, or 0. */
|
||||
size_t err = STRPREFIX_LIT ("error=", args + no) ? 6 : 0;
|
||||
|
||||
warning_argmatch (args, no, err);
|
||||
@@ -178,46 +190,30 @@ complain_init (void)
|
||||
|
||||
size_t b;
|
||||
for (b = 0; b < warnings_size; ++b)
|
||||
{
|
||||
warnings_flag[b] = (1 << b & warnings_default
|
||||
? severity_warning
|
||||
: severity_unset);
|
||||
errority_flag[b] = errority_unset;
|
||||
}
|
||||
warnings_flag[b] = (1 << b & warnings_default
|
||||
? severity_warning
|
||||
: severity_unset);
|
||||
|
||||
warning_list = xmalloc (WARNING_LIST_INCREMENT * sizeof (*warning_list));
|
||||
obstack_init (&obstack_warning);
|
||||
}
|
||||
|
||||
|
||||
/* A diagnostic with FLAGS is about to be issued. With what severity?
|
||||
(severity_fatal, severity_error, severity_disabled, or
|
||||
severity_warning.) */
|
||||
|
||||
static severity
|
||||
warning_severity (warnings flags)
|
||||
{
|
||||
if (flags & fatal)
|
||||
/* Diagnostics about fatal errors. */
|
||||
return severity_fatal;
|
||||
else if (flags & complaint)
|
||||
/* Diagnostics about errors. */
|
||||
return severity_error;
|
||||
else
|
||||
{
|
||||
/* Diagnostics about warnings. */
|
||||
severity res = severity_disabled;
|
||||
size_t b;
|
||||
for (b = 0; b < warnings_size; ++b)
|
||||
if (flags & 1 << b)
|
||||
{
|
||||
res = res < warnings_flag[b] ? warnings_flag[b] : res;
|
||||
/* If the diagnostic is enabled, and -Werror is enabled,
|
||||
and -Wno-error=foo was not explicitly requested, this
|
||||
is an error. */
|
||||
if (res == severity_warning
|
||||
&& (errority_flag[b] == errority_enabled
|
||||
|| (warnings_are_errors
|
||||
&& errority_flag[b] != errority_disabled)))
|
||||
res = severity_error;
|
||||
}
|
||||
res = res < warnings_flag[b] ? warnings_flag[b] : res;
|
||||
if (res == severity_warning && warnings_are_errors)
|
||||
res = severity_error;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -235,7 +231,7 @@ warning_is_unset (warnings flags)
|
||||
/** Display a "[-Wyacc]" like message on \a f. */
|
||||
|
||||
static void
|
||||
warnings_print_categories (warnings warn_flags, FILE *f)
|
||||
warnings_print_categories (warnings warn_flags, struct obstack *obs)
|
||||
{
|
||||
/* Display only the first match, the second is "-Wall". */
|
||||
size_t i;
|
||||
@@ -243,13 +239,79 @@ warnings_print_categories (warnings warn_flags, FILE *f)
|
||||
if (warn_flags & warnings_types[i])
|
||||
{
|
||||
severity s = warning_severity (warnings_types[i]);
|
||||
fprintf (f, " [-W%s%s]",
|
||||
obstack_printf (obs, " [-W%s%s]",
|
||||
s == severity_error ? "error=" : "",
|
||||
warnings_args[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
start_error (const location *loc, warnings flags, const char *prefix,
|
||||
const char *message, va_list args)
|
||||
{
|
||||
unsigned pos = 0;
|
||||
|
||||
if (loc)
|
||||
pos += location_obstack_print (*loc, &obstack_warning);
|
||||
else
|
||||
pos += obstack_printf (&obstack_warning, "%s", current_file ? current_file
|
||||
: program_name);
|
||||
pos += obstack_printf (&obstack_warning, ": ");
|
||||
|
||||
if (indent_ptr)
|
||||
{
|
||||
if (*indent_ptr)
|
||||
prefix = NULL;
|
||||
if (!*indent_ptr)
|
||||
*indent_ptr = pos;
|
||||
else if (*indent_ptr > pos)
|
||||
obstack_printf (&obstack_warning, "%*s", *indent_ptr - pos, "");
|
||||
indent_ptr = 0;
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
obstack_printf (&obstack_warning, "%s: ", prefix);
|
||||
|
||||
obstack_vprintf (&obstack_warning, message, args);
|
||||
if (! (flags & silent))
|
||||
warnings_print_categories (flags, &obstack_warning);
|
||||
{
|
||||
size_t l = strlen (message);
|
||||
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
||||
{
|
||||
obstack_1grow (&obstack_warning, '\n');
|
||||
if (loc && feature_flag & feature_caret && !(flags & no_caret))
|
||||
location_obstack_caret (*loc, &obstack_warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (!complain_loc)
|
||||
complain_loc = loc;
|
||||
}
|
||||
|
||||
void
|
||||
finish_complaint (void)
|
||||
{
|
||||
|
||||
if (!((warning_count + 1) % WARNING_LIST_INCREMENT))
|
||||
warning_list = xnrealloc (warning_list, warning_count + 1
|
||||
+ WARNING_LIST_INCREMENT, sizeof (*warning_list));
|
||||
warning_list[warning_count] = xmalloc (sizeof **warning_list);
|
||||
warning *w = warning_list[warning_count];
|
||||
if (complain_loc)
|
||||
{
|
||||
w->loc = xmalloc (sizeof *w->loc);
|
||||
*w->loc = *complain_loc;
|
||||
}
|
||||
else
|
||||
w->loc = NULL;
|
||||
complain_loc = NULL;
|
||||
w->message = obstack_finish0 (&obstack_warning);
|
||||
warning_count ++;
|
||||
}
|
||||
|
||||
|
||||
/** Report an error message.
|
||||
*
|
||||
* \param loc the location, defaulting to the current file,
|
||||
@@ -267,44 +329,38 @@ void
|
||||
error_message (const location *loc, warnings flags, const char *prefix,
|
||||
const char *message, va_list args)
|
||||
{
|
||||
unsigned pos = 0;
|
||||
start_error (loc, flags, prefix, message, args);
|
||||
finish_complaint ();
|
||||
}
|
||||
|
||||
if (loc)
|
||||
pos += location_print (*loc, stderr);
|
||||
else
|
||||
pos += fprintf (stderr, "%s", current_file ? current_file : program_name);
|
||||
pos += fprintf (stderr, ": ");
|
||||
|
||||
if (indent_ptr)
|
||||
/** Start an error message, but don't conclude it. That can be a fatal error,
|
||||
an error or just a warning. */
|
||||
|
||||
static void
|
||||
start_complains (const location *loc, warnings flags, const char *message,
|
||||
va_list args)
|
||||
{
|
||||
severity s = warning_severity (flags);
|
||||
if ((flags & complaint) && complaint_status < status_complaint)
|
||||
complaint_status = status_complaint;
|
||||
|
||||
if (severity_warning <= s)
|
||||
{
|
||||
if (*indent_ptr)
|
||||
prefix = NULL;
|
||||
if (!*indent_ptr)
|
||||
*indent_ptr = pos;
|
||||
else if (*indent_ptr > pos)
|
||||
fprintf (stderr, "%*s", *indent_ptr - pos, "");
|
||||
indent_ptr = 0;
|
||||
const char* prefix =
|
||||
s == severity_fatal ? _("fatal error")
|
||||
: s == severity_error ? _("error")
|
||||
: _("warning");
|
||||
if (severity_error <= s && ! complaint_status)
|
||||
complaint_status = status_warning_as_error;
|
||||
start_error (loc, flags, prefix, message, args);
|
||||
}
|
||||
|
||||
if (prefix)
|
||||
fprintf (stderr, "%s: ", prefix);
|
||||
|
||||
vfprintf (stderr, message, args);
|
||||
if (! (flags & silent))
|
||||
warnings_print_categories (flags, stderr);
|
||||
{
|
||||
size_t l = strlen (message);
|
||||
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
||||
{
|
||||
putc ('\n', stderr);
|
||||
fflush (stderr);
|
||||
if (loc && feature_flag & feature_caret && !(flags & no_caret))
|
||||
location_caret (*loc, stderr);
|
||||
}
|
||||
}
|
||||
fflush (stderr);
|
||||
if (flags & fatal)
|
||||
print_warnings_and_exit (stderr, EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
/** Raise a complaint. That can be a fatal error, an error or just a
|
||||
warning. */
|
||||
|
||||
@@ -328,7 +384,7 @@ complains (const location *loc, warnings flags, const char *message,
|
||||
}
|
||||
|
||||
if (flags & fatal)
|
||||
exit (EXIT_FAILURE);
|
||||
print_warnings_and_exit (stderr, EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -340,6 +396,15 @@ complain (location const *loc, warnings flags, const char *message, ...)
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
start_complain (location const *loc, warnings flags, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, message);
|
||||
start_complains (loc, flags, message, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
const char *message, ...)
|
||||
@@ -351,6 +416,17 @@ complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
start_complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
indent_ptr = indent;
|
||||
va_start (args, message);
|
||||
start_complains (loc, flags, message, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
complain_args (location const *loc, warnings w, unsigned *indent,
|
||||
int argc, char *argv[])
|
||||
@@ -397,7 +473,45 @@ duplicate_directive (char const *directive,
|
||||
location first, location second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
complain (&second, complaint, _("only one %s allowed per rule"), directive);
|
||||
start_complain (&second, complaint, _("only one %s allowed per rule"), directive);
|
||||
i += SUB_INDENT;
|
||||
complain_indent (&first, complaint, &i, _("previous declaration"));
|
||||
}
|
||||
|
||||
/** Compare warnings, to sort them. */
|
||||
static int
|
||||
warning_cmp (void const *a, void const *b)
|
||||
{
|
||||
warning *wa = *(warning * const *)a, *wb = *(warning * const *)b;
|
||||
if (wa->loc && wb->loc)
|
||||
return location_cmp (*wa->loc, *wb->loc);
|
||||
/* Undefined location/line number at the end. */
|
||||
else if (wa->loc)
|
||||
return -1;
|
||||
else if (wb->loc)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
print_warnings (FILE *f)
|
||||
{
|
||||
if (obstack_object_size (&obstack_warning))
|
||||
finish_complaint ();
|
||||
qsort (warning_list, warning_count, sizeof *warning_list, warning_cmp);
|
||||
for (int i = 0; i < warning_count; ++i)
|
||||
{
|
||||
fprintf (f, "%s", warning_list[i]->message);
|
||||
free (warning_list[i]->loc);
|
||||
free (warning_list[i]);
|
||||
}
|
||||
free (warning_list);
|
||||
obstack_free (&obstack_warning, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
print_warnings_and_exit (FILE *f, int exit_status)
|
||||
{
|
||||
print_warnings (f);
|
||||
exit (exit_status);
|
||||
}
|
||||
|
||||
+26
-6
@@ -106,6 +106,12 @@ typedef enum
|
||||
(Never enabled, never disabled). */
|
||||
bool warning_is_unset (warnings flags);
|
||||
|
||||
/** Start a complaint, with maybe a location, but don't finish it until a
|
||||
normal complaint or a call to finish_complaint. */
|
||||
void start_complain (location const *loc, warnings flags, char const *message,
|
||||
...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
|
||||
/** Make a complaint, with maybe a location. */
|
||||
void complain (location const *loc, warnings flags, char const *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||
@@ -114,11 +120,19 @@ void complain (location const *loc, warnings flags, char const *message, ...)
|
||||
void complain_args (location const *loc, warnings w, unsigned *indent,
|
||||
int argc, char *arg[]);
|
||||
|
||||
/** Start a complaint message with location and some indentation, but don't
|
||||
finish it until a normal complaint or a call to finish_complaint. */
|
||||
void start_complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
char const *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 4, 5)));
|
||||
|
||||
/** Make a complaint with location and some indentation. */
|
||||
void complain_indent (location const *loc, warnings flags, unsigned *indent,
|
||||
char const *message, ...)
|
||||
__attribute__ ((__format__ (__printf__, 4, 5)));
|
||||
|
||||
/** Finish the current complaint. */
|
||||
void finish_complaint (void);
|
||||
|
||||
/** Report an obsolete syntax, suggest the updated one. */
|
||||
void deprecated_directive (location const *loc,
|
||||
@@ -128,17 +142,23 @@ void deprecated_directive (location const *loc,
|
||||
void duplicate_directive (char const *directive,
|
||||
location first, location second);
|
||||
|
||||
/** Warnings treated as errors shouldn't stop the execution as regular
|
||||
errors should (because due to their nature, it is safe to go
|
||||
on). Thus, there are three possible execution statuses. */
|
||||
/** Warnings treated as errors shouldn't stop the execution as regular errors
|
||||
should (because due to their nature, it is safe to go on). Thus, there are
|
||||
three possible execution statuses. */
|
||||
typedef enum
|
||||
{
|
||||
status_none, /**< No diagnostic issued so far. */
|
||||
status_warning_as_error, /**< A warning was issued (but no error). */
|
||||
status_complaint /**< An error was issued. */
|
||||
status_none,
|
||||
status_warning_as_error,
|
||||
status_complaint
|
||||
} err_status;
|
||||
|
||||
/** Whether an error was reported. */
|
||||
extern err_status complaint_status;
|
||||
|
||||
/** Sort and print warnings, and free them. */
|
||||
void print_warnings (FILE *f);
|
||||
|
||||
/** Sort and print warnings, free them, then exit. */
|
||||
void print_warnings_and_exit (FILE *f, int exit_status);
|
||||
|
||||
#endif /* !COMPLAIN_H_ */
|
||||
|
||||
+8
-8
@@ -104,7 +104,7 @@ log_resolution (rule *r, symbol_number token,
|
||||
case shift_resolution:
|
||||
obstack_printf (&solved_conflicts_obstack,
|
||||
" (%s < %s)",
|
||||
r->prec->tag,
|
||||
r->prec->symbol->tag,
|
||||
symbols[token]->tag);
|
||||
break;
|
||||
|
||||
@@ -112,7 +112,7 @@ log_resolution (rule *r, symbol_number token,
|
||||
obstack_printf (&solved_conflicts_obstack,
|
||||
" (%s < %s)",
|
||||
symbols[token]->tag,
|
||||
r->prec->tag);
|
||||
r->prec->symbol->tag);
|
||||
break;
|
||||
|
||||
case left_resolution:
|
||||
@@ -176,7 +176,7 @@ log_resolution (rule *r, symbol_number token,
|
||||
case shift_resolution:
|
||||
obstack_printf (&solved_conflicts_xml_obstack,
|
||||
"%s < %s",
|
||||
xml_escape_n (0, r->prec->tag),
|
||||
xml_escape_n (0, r->prec->symbol->tag),
|
||||
xml_escape_n (1, symbols[token]->tag));
|
||||
break;
|
||||
|
||||
@@ -184,7 +184,7 @@ log_resolution (rule *r, symbol_number token,
|
||||
obstack_printf (&solved_conflicts_xml_obstack,
|
||||
"%s < %s",
|
||||
xml_escape_n (0, symbols[token]->tag),
|
||||
xml_escape_n (1, r->prec->tag));
|
||||
xml_escape_n (1, r->prec->symbol->tag));
|
||||
break;
|
||||
|
||||
case left_resolution:
|
||||
@@ -269,18 +269,18 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs)
|
||||
for (i = 0; i < ntokens; i++)
|
||||
if (bitset_test (lookahead_tokens, i)
|
||||
&& bitset_test (lookahead_set, i)
|
||||
&& symbols[i]->prec)
|
||||
&& symbols[i]->content->prec)
|
||||
{
|
||||
/* Shift-reduce conflict occurs for token number i
|
||||
and it has a precedence.
|
||||
The precedence of shifting is that of token i. */
|
||||
if (symbols[i]->prec < redprec)
|
||||
if (symbols[i]->content->prec < redprec)
|
||||
{
|
||||
register_precedence (redrule->prec->number, i);
|
||||
log_resolution (redrule, i, reduce_resolution);
|
||||
flush_shift (s, i);
|
||||
}
|
||||
else if (symbols[i]->prec > redprec)
|
||||
else if (symbols[i]->content->prec > redprec)
|
||||
{
|
||||
register_precedence (i, redrule->prec->number);
|
||||
log_resolution (redrule, i, shift_resolution);
|
||||
@@ -294,7 +294,7 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs)
|
||||
For right associativity, keep only the shift.
|
||||
For nonassociativity, keep neither. */
|
||||
|
||||
switch (symbols[i]->assoc)
|
||||
switch (symbols[i]->content->assoc)
|
||||
{
|
||||
case undef_assoc:
|
||||
abort ();
|
||||
|
||||
+15
-35
@@ -51,17 +51,8 @@ char *spec_defines_file = NULL; /* for --defines. */
|
||||
char *parser_file_name;
|
||||
|
||||
/* All computed output file names. */
|
||||
typedef struct generated_file
|
||||
{
|
||||
/** File name. */
|
||||
char *name;
|
||||
/** Whether is a generated source file (e.g., *.c, *.java...), as
|
||||
opposed to the report file (e.g., *.output). When late errors
|
||||
are detected, generated source files are removed. */
|
||||
bool is_source;
|
||||
} generated_file;
|
||||
static generated_file *generated_files = NULL;
|
||||
static int generated_files_size = 0;
|
||||
static char **file_names = NULL;
|
||||
static int file_names_count = 0;
|
||||
|
||||
uniqstr grammar_file = NULL;
|
||||
uniqstr current_file = NULL;
|
||||
@@ -341,21 +332,21 @@ compute_output_file_names (void)
|
||||
{
|
||||
if (! spec_graph_file)
|
||||
spec_graph_file = concat2 (all_but_tab_ext, ".dot");
|
||||
output_file_name_check (&spec_graph_file, false);
|
||||
output_file_name_check (&spec_graph_file);
|
||||
}
|
||||
|
||||
if (xml_flag)
|
||||
{
|
||||
if (! spec_xml_file)
|
||||
spec_xml_file = concat2 (all_but_tab_ext, ".xml");
|
||||
output_file_name_check (&spec_xml_file, false);
|
||||
output_file_name_check (&spec_xml_file);
|
||||
}
|
||||
|
||||
if (report_flag)
|
||||
{
|
||||
if (!spec_verbose_file)
|
||||
spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
|
||||
output_file_name_check (&spec_verbose_file, false);
|
||||
output_file_name_check (&spec_verbose_file);
|
||||
}
|
||||
|
||||
free (all_but_tab_ext);
|
||||
@@ -364,7 +355,7 @@ compute_output_file_names (void)
|
||||
}
|
||||
|
||||
void
|
||||
output_file_name_check (char **file_name, bool source)
|
||||
output_file_name_check (char **file_name)
|
||||
{
|
||||
bool conflict = false;
|
||||
if (STREQ (*file_name, grammar_file))
|
||||
@@ -376,11 +367,11 @@ output_file_name_check (char **file_name, bool source)
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < generated_files_size; i++)
|
||||
if (STREQ (generated_files[i].name, *file_name))
|
||||
for (i = 0; i < file_names_count; i++)
|
||||
if (STREQ (file_names[i], *file_name))
|
||||
{
|
||||
complain (NULL, Wother, _("conflicting outputs to file %s"),
|
||||
quote (generated_files[i].name));
|
||||
quote (*file_name));
|
||||
conflict = true;
|
||||
}
|
||||
}
|
||||
@@ -391,23 +382,12 @@ output_file_name_check (char **file_name, bool source)
|
||||
}
|
||||
else
|
||||
{
|
||||
generated_files = xnrealloc (generated_files, ++generated_files_size,
|
||||
sizeof *generated_files);
|
||||
generated_files[generated_files_size-1].name = xstrdup (*file_name);
|
||||
generated_files[generated_files_size-1].is_source = source;
|
||||
file_names = xnrealloc (file_names, ++file_names_count,
|
||||
sizeof *file_names);
|
||||
file_names[file_names_count-1] = xstrdup (*file_name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
unlink_generated_sources (void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < generated_files_size; i++)
|
||||
if (generated_files[i].is_source)
|
||||
/* Ignore errors. The file might not even exist. */
|
||||
unlink (generated_files[i].name);
|
||||
}
|
||||
|
||||
void
|
||||
output_file_names_free (void)
|
||||
{
|
||||
@@ -420,8 +400,8 @@ output_file_names_free (void)
|
||||
free (dir_prefix);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < generated_files_size; i++)
|
||||
free (generated_files[i].name);
|
||||
for (i = 0; i < file_names_count; i++)
|
||||
free (file_names[i]);
|
||||
}
|
||||
free (generated_files);
|
||||
free (file_names);
|
||||
}
|
||||
|
||||
+1
-9
@@ -63,15 +63,7 @@ extern char *all_but_ext;
|
||||
|
||||
void compute_output_file_names (void);
|
||||
void output_file_names_free (void);
|
||||
|
||||
/** Record that we generate file \a file_name.
|
||||
* \param source whether this is a source file (*c, *.java...)
|
||||
* as opposed to a report (*.output, *.dot...).
|
||||
*/
|
||||
void output_file_name_check (char **file_name, bool source);
|
||||
|
||||
/** Remove all the generated source files. */
|
||||
void unlink_generated_sources (void);
|
||||
void output_file_name_check (char **file_name);
|
||||
|
||||
FILE *xfopen (const char *name, char const *mode);
|
||||
void xfclose (FILE *ptr);
|
||||
|
||||
+8
-8
@@ -65,19 +65,19 @@ rule_useless_in_parser_p (rule const *r)
|
||||
}
|
||||
|
||||
void
|
||||
rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out)
|
||||
rule_lhs_print (rule const *r, sym_content const *previous_lhs, FILE *out)
|
||||
{
|
||||
fprintf (out, " %3d ", r->number);
|
||||
if (previous_lhs != r->lhs)
|
||||
fprintf (out, "%s:", r->lhs->tag);
|
||||
fprintf (out, "%s:", r->lhs->symbol->tag);
|
||||
else
|
||||
fprintf (out, "%*s|", (int) strlen (previous_lhs->tag), "");
|
||||
fprintf (out, "%*s|", (int) strlen (previous_lhs->symbol->tag), "");
|
||||
}
|
||||
|
||||
void
|
||||
rule_lhs_print_xml (rule const *r, FILE *out, int level)
|
||||
{
|
||||
xml_printf (out, level, "<lhs>%s</lhs>", r->lhs->tag);
|
||||
xml_printf (out, level, "<lhs>%s</lhs>", r->lhs->symbol->tag);
|
||||
}
|
||||
|
||||
size_t
|
||||
@@ -158,7 +158,7 @@ grammar_rules_partial_print (FILE *out, const char *title,
|
||||
{
|
||||
rule_number r;
|
||||
bool first = true;
|
||||
symbol *previous_lhs = NULL;
|
||||
sym_content *previous_lhs = NULL;
|
||||
|
||||
/* rule # : LHS -> RHS */
|
||||
for (r = 0; r < nrules + nuseless_productions; r++)
|
||||
@@ -209,7 +209,7 @@ grammar_rules_print_xml (FILE *out, int level)
|
||||
rules[r].number, usefulness);
|
||||
if (rules[r].precsym)
|
||||
fprintf (out, " percent_prec=\"%s\"",
|
||||
xml_escape (rules[r].precsym->tag));
|
||||
xml_escape (rules[r].precsym->symbol->tag));
|
||||
fputs (">\n", out);
|
||||
}
|
||||
rule_lhs_print_xml (&rules[r], out, level + 3);
|
||||
@@ -239,7 +239,7 @@ grammar_dump (FILE *out, const char *title)
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
fprintf (out, "%5d %5d %5d %s\n",
|
||||
i,
|
||||
symbols[i]->prec, symbols[i]->assoc,
|
||||
symbols[i]->content->prec, symbols[i]->content->assoc,
|
||||
symbols[i]->tag);
|
||||
fprintf (out, "\n\n");
|
||||
}
|
||||
@@ -280,7 +280,7 @@ grammar_dump (FILE *out, const char *title)
|
||||
rule_number r;
|
||||
for (r = 0; r < nrules + nuseless_productions; r++)
|
||||
{
|
||||
fprintf (out, "%-5d %s:", r, rules[r].lhs->tag);
|
||||
fprintf (out, "%-5d %s:", r, rules[r].lhs->symbol->tag);
|
||||
rule_rhs_print (&rules[r], out);
|
||||
fprintf (out, "\n");
|
||||
}
|
||||
|
||||
+5
-4
@@ -180,17 +180,17 @@ typedef struct
|
||||
except if some rules are useless. */
|
||||
rule_number number;
|
||||
|
||||
symbol *lhs;
|
||||
sym_content *lhs;
|
||||
item_number *rhs;
|
||||
|
||||
/* This symbol provides both the associativity, and the precedence. */
|
||||
symbol *prec;
|
||||
sym_content *prec;
|
||||
|
||||
int dprec;
|
||||
int merger;
|
||||
|
||||
/* This symbol was attached to the rule via %prec. */
|
||||
symbol *precsym;
|
||||
sym_content *precsym;
|
||||
|
||||
location location;
|
||||
bool useful;
|
||||
@@ -220,7 +220,8 @@ bool rule_useless_in_parser_p (rule const *r);
|
||||
/* Print this rule's number and lhs on OUT. If a PREVIOUS_LHS was
|
||||
already displayed (by a previous call for another rule), avoid
|
||||
useless repetitions. */
|
||||
void rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out);
|
||||
void rule_lhs_print (rule const *r, sym_content const *previous_lhs,
|
||||
FILE *out);
|
||||
void rule_lhs_print_xml (rule const *r, FILE *out, int level);
|
||||
|
||||
/* Return the length of the RHS. */
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ no_reduce_bitset_init (state const *s, bitset *no_reduce_set)
|
||||
bitset_set (*no_reduce_set, TRANSITION_SYMBOL (s->transitions, n));
|
||||
for (n = 0; n < s->errs->num; ++n)
|
||||
if (s->errs->symbols[n])
|
||||
bitset_set (*no_reduce_set, s->errs->symbols[n]->number);
|
||||
bitset_set (*no_reduce_set, s->errs->symbols[n]->content->number);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+2
-2
@@ -424,7 +424,7 @@ ielr_item_has_lookahead (state *s, symbol_number lhs, size_t item,
|
||||
if (item_number_is_rule_number (ritem[s->items[item] - 2]))
|
||||
{
|
||||
state **predecessor;
|
||||
aver (lhs != accept->number);
|
||||
aver (lhs != accept->content->number);
|
||||
for (predecessor = predecessors[s->number];
|
||||
*predecessor;
|
||||
++predecessor)
|
||||
@@ -580,7 +580,7 @@ typedef struct state_list {
|
||||
static void
|
||||
ielr_compute_goto_follow_set (bitsetv follow_kernel_items,
|
||||
bitsetv always_follows, state_list *s,
|
||||
symbol *n, bitset follow_set)
|
||||
sym_content *n, bitset follow_set)
|
||||
{
|
||||
goto_number n_goto = map_goto (s->lr0Isocore->state->number, n->number);
|
||||
bitset_copy (follow_set, always_follows[n_goto]);
|
||||
|
||||
+23
-19
@@ -67,13 +67,17 @@ static goto_number **includes;
|
||||
static goto_list **lookback;
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
set_goto_map (void)
|
||||
{
|
||||
state_number s;
|
||||
goto_number *temp_map = xnmalloc (nvars + 1, sizeof *temp_map);
|
||||
goto_number *temp_map;
|
||||
|
||||
goto_map = xcalloc (nvars + 1, sizeof *goto_map);
|
||||
temp_map = xnmalloc (nvars + 1, sizeof *temp_map);
|
||||
|
||||
ngotos = 0;
|
||||
for (s = 0; s < nstates; ++s)
|
||||
{
|
||||
@@ -128,13 +132,16 @@ set_goto_map (void)
|
||||
goto_number
|
||||
map_goto (state_number s0, symbol_number sym)
|
||||
{
|
||||
goto_number low = goto_map[sym - ntokens];
|
||||
goto_number high = goto_map[sym - ntokens + 1] - 1;
|
||||
goto_number high;
|
||||
goto_number low;
|
||||
goto_number middle;
|
||||
state_number s;
|
||||
|
||||
low = goto_map[sym - ntokens];
|
||||
high = goto_map[sym - ntokens + 1] - 1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
goto_number middle;
|
||||
state_number s;
|
||||
aver (low <= high);
|
||||
middle = (low + high) / 2;
|
||||
s = from_state[middle];
|
||||
@@ -405,6 +412,7 @@ static void
|
||||
lookahead_tokens_print (FILE *out)
|
||||
{
|
||||
state_number i;
|
||||
int j, k;
|
||||
fprintf (out, "Lookahead tokens: BEGIN\n");
|
||||
for (i = 0; i < nstates; ++i)
|
||||
{
|
||||
@@ -413,25 +421,21 @@ lookahead_tokens_print (FILE *out)
|
||||
int n_lookahead_tokens = 0;
|
||||
|
||||
if (reds->lookahead_tokens)
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j < reds->num; ++j)
|
||||
if (reds->lookahead_tokens[j])
|
||||
++n_lookahead_tokens;
|
||||
}
|
||||
for (k = 0; k < reds->num; ++k)
|
||||
if (reds->lookahead_tokens[k])
|
||||
++n_lookahead_tokens;
|
||||
|
||||
fprintf (out, "State %d: %d lookahead tokens\n",
|
||||
i, n_lookahead_tokens);
|
||||
|
||||
if (reds->lookahead_tokens)
|
||||
{
|
||||
int j, k;
|
||||
for (j = 0; j < reds->num; ++j)
|
||||
BITSET_FOR_EACH (iter, reds->lookahead_tokens[j], k, 0)
|
||||
fprintf (out, " on %d (%s) -> rule %d\n",
|
||||
k, symbols[k]->tag,
|
||||
reds->rules[j]->number);
|
||||
}
|
||||
for (j = 0; j < reds->num; ++j)
|
||||
BITSET_FOR_EACH (iter, reds->lookahead_tokens[j], k, 0)
|
||||
{
|
||||
fprintf (out, " on %d (%s) -> rule %d\n",
|
||||
k, symbols[k]->tag,
|
||||
reds->rules[j]->number);
|
||||
};
|
||||
}
|
||||
fprintf (out, "Lookahead tokens: END\n");
|
||||
}
|
||||
|
||||
+1
-3
@@ -111,9 +111,7 @@ BUILT_SOURCES += \
|
||||
## yacc. ##
|
||||
## ------ ##
|
||||
|
||||
if ENABLE_YACC
|
||||
bin_SCRIPTS = src/yacc
|
||||
endif
|
||||
bin_SCRIPTS = $(YACC_SCRIPT)
|
||||
EXTRA_SCRIPTS = src/yacc
|
||||
MOSTLYCLEANFILES += src/yacc
|
||||
|
||||
|
||||
+101
-1
@@ -137,6 +137,48 @@ location_print (location loc, FILE *out)
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
location_obstack_print (location loc, struct obstack *obs)
|
||||
{
|
||||
unsigned res = 0;
|
||||
int end_col = 0 != loc.end.column ? loc.end.column - 1 : 0;
|
||||
res += obstack_printf (obs, "%s",
|
||||
quotearg_n_style (3, escape_quoting_style, loc.start.file));
|
||||
if (0 <= loc.start.line)
|
||||
{
|
||||
res += obstack_printf (obs, ":%d", loc.start.line);
|
||||
if (0 <= loc.start.column)
|
||||
res += obstack_printf (obs, ".%d", loc.start.column);
|
||||
}
|
||||
if (loc.start.file != loc.end.file)
|
||||
{
|
||||
res += obstack_printf (obs, "-%s",
|
||||
quotearg_n_style (3, escape_quoting_style,
|
||||
loc.end.file));
|
||||
if (0 <= loc.end.line)
|
||||
{
|
||||
res += obstack_printf (obs, ":%d", loc.end.line);
|
||||
if (0 <= end_col)
|
||||
res += obstack_printf (obs, ".%d", end_col);
|
||||
}
|
||||
}
|
||||
else if (0 <= loc.end.line)
|
||||
{
|
||||
if (loc.start.line < loc.end.line)
|
||||
{
|
||||
res += obstack_printf (obs, "-%d", loc.end.line);
|
||||
if (0 <= end_col)
|
||||
res += obstack_printf (obs, ".%d", end_col);
|
||||
}
|
||||
else if (0 <= end_col && loc.start.column < end_col)
|
||||
res += obstack_printf (obs, "-%d", end_col);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Persistant data used by location_caret to avoid reopening and rereading the
|
||||
same file all over for each error. */
|
||||
struct caret_info
|
||||
@@ -188,7 +230,7 @@ location_caret (location loc, FILE *out)
|
||||
/* Read the actual line. Don't update the offset, so that we keep a pointer
|
||||
to the start of the line. */
|
||||
{
|
||||
int c = getc (caret_info.source);
|
||||
char c = getc (caret_info.source);
|
||||
if (c != EOF)
|
||||
{
|
||||
/* Quote the file, indent by a single column. */
|
||||
@@ -215,6 +257,64 @@ location_caret (location loc, FILE *out)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
location_obstack_caret (location loc, struct obstack *obs)
|
||||
{
|
||||
/* FIXME: find a way to support multifile locations, and only open once each
|
||||
file. That would make the procedure future-proof. */
|
||||
if (! (caret_info.source
|
||||
|| (caret_info.source = fopen (loc.start.file, "r")))
|
||||
|| loc.start.column == -1 || loc.start.line == -1)
|
||||
return;
|
||||
|
||||
/* If the line we want to quote is seekable (the same line as the previous
|
||||
location), just seek it. If it was a previous line, we lost track of it,
|
||||
so return to the start of file. */
|
||||
if (caret_info.line <= loc.start.line)
|
||||
fseek (caret_info.source, caret_info.offset, SEEK_SET);
|
||||
else
|
||||
{
|
||||
caret_info.line = 1;
|
||||
caret_info.offset = 0;
|
||||
fseek (caret_info.source, caret_info.offset, SEEK_SET);
|
||||
}
|
||||
|
||||
/* Advance to the line's position, keeping track of the offset. */
|
||||
while (caret_info.line < loc.start.line)
|
||||
caret_info.line += getc (caret_info.source) == '\n';
|
||||
caret_info.offset = ftell (caret_info.source);
|
||||
|
||||
/* Read the actual line. Don't update the offset, so that we keep a pointer
|
||||
to the start of the line. */
|
||||
{
|
||||
char c = getc (caret_info.source);
|
||||
if (c != EOF)
|
||||
{
|
||||
/* Quote the file, indent by a single column. */
|
||||
obstack_1grow (obs, ' ');
|
||||
do
|
||||
obstack_1grow (obs, c);
|
||||
while ((c = getc (caret_info.source)) != EOF && c != '\n');
|
||||
obstack_1grow (obs, '\n');
|
||||
|
||||
{
|
||||
/* The caret of a multiline location ends with the first line. */
|
||||
size_t len = loc.start.line != loc.end.line
|
||||
? ftell (caret_info.source) - caret_info.offset
|
||||
: loc.end.column;
|
||||
int i;
|
||||
|
||||
/* Print the carets (at least one), with the same indent as above.*/
|
||||
obstack_printf (obs, " %*s", loc.start.column - 1, "");
|
||||
for (i = loc.start.column; i == loc.start.column || i < len; ++i)
|
||||
obstack_1grow (obs, '^');
|
||||
}
|
||||
obstack_1grow (obs, '\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
boundary_set_from_string (boundary *bound, char *loc_str)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
# include <stdio.h>
|
||||
# include <string.h> /* strcmp */
|
||||
|
||||
# include "system.h"
|
||||
|
||||
# include "uniqstr.h"
|
||||
|
||||
/* A boundary between two characters. */
|
||||
@@ -107,6 +109,9 @@ void location_compute (location *loc,
|
||||
Warning: uses quotearg's slot 3. */
|
||||
unsigned location_print (location loc, FILE *out);
|
||||
|
||||
/* Same as location_print, only to an obstack. */
|
||||
unsigned location_obstack_print (location loc, struct obstack *obs);
|
||||
|
||||
/* Free any allocated ressources and close any open file handles that are
|
||||
left-over by the usage of location_caret. */
|
||||
void cleanup_caret (void);
|
||||
@@ -114,6 +119,9 @@ void cleanup_caret (void);
|
||||
/* Output to OUT the line and caret corresponding to location LOC. */
|
||||
void location_caret (location loc, FILE *out);
|
||||
|
||||
/* Same as location_caret, only with an obstack. */
|
||||
void location_obstack_caret (location loc, struct obstack *obs);
|
||||
|
||||
/* Return -1, 0, 1, depending whether a is before, equal, or
|
||||
after b. */
|
||||
static inline int
|
||||
|
||||
+3
-1
@@ -203,7 +203,6 @@ main (int argc, char *argv[])
|
||||
contains things such as user actions, prologue, epilogue etc. */
|
||||
gram_scanner_free ();
|
||||
muscle_free ();
|
||||
uniqstrs_free ();
|
||||
code_scanner_free ();
|
||||
skel_scanner_free ();
|
||||
quotearg_free ();
|
||||
@@ -218,6 +217,9 @@ main (int argc, char *argv[])
|
||||
timevar_stop (TV_TOTAL);
|
||||
timevar_print (stderr);
|
||||
|
||||
print_warnings (stderr);
|
||||
|
||||
uniqstrs_free ();
|
||||
cleanup_caret ();
|
||||
|
||||
return complaint_status ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
|
||||
+8
-9
@@ -299,9 +299,8 @@ muscle_location_grow (char const *key, location loc)
|
||||
|
||||
#define COMMON_DECODE(Value) \
|
||||
case '$': \
|
||||
++(Value); aver (*(Value) == '['); \
|
||||
++(Value); aver (*(Value) == ']'); \
|
||||
++(Value); aver (*(Value) == '['); \
|
||||
aver (*++(Value) == ']'); \
|
||||
aver (*++(Value) == '['); \
|
||||
obstack_sgrow (&muscle_obstack, "$"); \
|
||||
break; \
|
||||
case '@': \
|
||||
@@ -350,7 +349,7 @@ location_decode (char const *value)
|
||||
location loc;
|
||||
aver (value);
|
||||
aver (*value == '[');
|
||||
++value; aver (*value == '[');
|
||||
aver (*++value == '[');
|
||||
while (*++value)
|
||||
switch (*value)
|
||||
{
|
||||
@@ -361,16 +360,16 @@ location_decode (char const *value)
|
||||
case ']':
|
||||
{
|
||||
char *boundary_str;
|
||||
++value; aver (*value == ']');
|
||||
aver (*++value == ']');
|
||||
boundary_str = obstack_finish0 (&muscle_obstack);
|
||||
switch (*++value)
|
||||
{
|
||||
case ',':
|
||||
boundary_set_from_string (&loc.start, boundary_str);
|
||||
obstack_free (&muscle_obstack, boundary_str);
|
||||
++value; aver (*value == ' ');
|
||||
++value; aver (*value == '[');
|
||||
++value; aver (*value == '[');
|
||||
aver (*++value == ' ');
|
||||
aver (*++value == '[');
|
||||
aver (*++value == '[');
|
||||
break;
|
||||
case '\0':
|
||||
boundary_set_from_string (&loc.end, boundary_str);
|
||||
@@ -510,7 +509,7 @@ muscle_percent_define_insert (char const *var, location variable_loc,
|
||||
unsigned i = 0;
|
||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||
goto end;
|
||||
complain_indent (&variable_loc, complaint, &i,
|
||||
start_complain_indent (&variable_loc, complaint, &i,
|
||||
_("%%define variable %s redefined"),
|
||||
quote (variable));
|
||||
i += SUB_INDENT;
|
||||
|
||||
+12
-15
@@ -149,7 +149,7 @@ prepare_symbols (void)
|
||||
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
||||
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
||||
MUSCLE_INSERT_INT ("symbols_number", nsyms);
|
||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
|
||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->content->number);
|
||||
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
||||
|
||||
muscle_insert_symbol_number_table ("translate",
|
||||
@@ -197,7 +197,7 @@ prepare_symbols (void)
|
||||
int i;
|
||||
int *values = xnmalloc (ntokens, sizeof *values);
|
||||
for (i = 0; i < ntokens; ++i)
|
||||
values[i] = symbols[i]->user_token_number;
|
||||
values[i] = symbols[i]->content->user_token_number;
|
||||
muscle_insert_int_table ("toknum", values,
|
||||
values[0], 1, ntokens);
|
||||
free (values);
|
||||
@@ -283,9 +283,9 @@ prepare_states (void)
|
||||
static int
|
||||
symbol_type_name_cmp (const symbol **lhs, const symbol **rhs)
|
||||
{
|
||||
int res = uniqstr_cmp ((*lhs)->type_name, (*rhs)->type_name);
|
||||
int res = uniqstr_cmp ((*lhs)->content->type_name, (*rhs)->content->type_name);
|
||||
if (!res)
|
||||
res = (*lhs)->number - (*rhs)->number;
|
||||
res = (*lhs)->content->number - (*rhs)->content->number;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -320,8 +320,9 @@ type_names_output (FILE *out)
|
||||
/* The index of the first symbol of the current type-name. */
|
||||
int i0 = i;
|
||||
fputs (i ? ",\n[" : "[", out);
|
||||
for (; i < nsyms && syms[i]->type_name == syms[i0]->type_name; ++i)
|
||||
fprintf (out, "%s%d", i != i0 ? ", " : "", syms[i]->number);
|
||||
for (; i < nsyms
|
||||
&& syms[i]->content->type_name == syms[i0]->content->type_name; ++i)
|
||||
fprintf (out, "%s%d", i != i0 ? ", " : "", syms[i]->content->number);
|
||||
fputs ("]", out);
|
||||
}
|
||||
fputs ("])\n\n", out);
|
||||
@@ -428,20 +429,21 @@ prepare_symbol_definitions (void)
|
||||
MUSCLE_INSERT_STRING (key, sym->tag);
|
||||
|
||||
SET_KEY ("user_number");
|
||||
MUSCLE_INSERT_INT (key, sym->user_token_number);
|
||||
MUSCLE_INSERT_INT (key, sym->content->user_token_number);
|
||||
|
||||
SET_KEY ("is_token");
|
||||
MUSCLE_INSERT_INT (key,
|
||||
i < ntokens && sym != errtoken && sym != undeftoken);
|
||||
|
||||
SET_KEY ("number");
|
||||
MUSCLE_INSERT_INT (key, sym->number);
|
||||
MUSCLE_INSERT_INT (key, sym->content->number);
|
||||
|
||||
SET_KEY ("has_type");
|
||||
MUSCLE_INSERT_INT (key, !!sym->type_name);
|
||||
MUSCLE_INSERT_INT (key, !!sym->content->type_name);
|
||||
|
||||
SET_KEY ("type");
|
||||
MUSCLE_INSERT_STRING (key, sym->type_name ? sym->type_name : "");
|
||||
MUSCLE_INSERT_STRING (key, sym->content->type_name
|
||||
? sym->content->type_name : "");
|
||||
|
||||
{
|
||||
int j;
|
||||
@@ -704,11 +706,6 @@ output (void)
|
||||
/* Process the selected skeleton file. */
|
||||
output_skeleton ();
|
||||
|
||||
/* If late errors were generated, destroy the generated source
|
||||
files. */
|
||||
if (complaint_status)
|
||||
unlink_generated_sources ();
|
||||
|
||||
obstack_free (&format_obstack, NULL);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -80,11 +80,11 @@
|
||||
|
||||
#line 82 "src/parse-gram.c" /* yacc.c:339 */
|
||||
|
||||
# ifndef YY_NULLPTR
|
||||
# ifndef YY_NULL
|
||||
# if defined __cplusplus && 201103L <= __cplusplus
|
||||
# define YY_NULLPTR nullptr
|
||||
# define YY_NULL nullptr
|
||||
# else
|
||||
# define YY_NULLPTR 0
|
||||
# define YY_NULL 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -639,7 +639,7 @@ static const char *const yytname[] =
|
||||
"symbols.1", "generic_symlist", "generic_symlist_item", "tag",
|
||||
"symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
|
||||
"rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value",
|
||||
"id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULLPTR
|
||||
"id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1569,11 +1569,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||
YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken)
|
||||
{
|
||||
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
||||
YYSIZE_T yysize = yysize0;
|
||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||
/* Internationalized format string. */
|
||||
const char *yyformat = YY_NULLPTR;
|
||||
const char *yyformat = YY_NULL;
|
||||
/* Arguments of yyformat. */
|
||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||
/* Number of reported tokens (one for the "unexpected", one per
|
||||
@@ -1628,7 +1628,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
||||
}
|
||||
yyarg[yycount++] = yytname[yyx];
|
||||
{
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
||||
if (! (yysize <= yysize1
|
||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||
return 2;
|
||||
|
||||
+37
-37
@@ -65,39 +65,40 @@ print_core (FILE *out, int level, state *s)
|
||||
sitems = itemset;
|
||||
snritems = nitemset;
|
||||
|
||||
if (!snritems)
|
||||
{
|
||||
xml_puts (out, level, "<itemset/>");
|
||||
return;
|
||||
}
|
||||
if (!snritems) {
|
||||
xml_puts (out, level, "<itemset/>");
|
||||
return;
|
||||
}
|
||||
|
||||
xml_puts (out, level, "<itemset>");
|
||||
|
||||
for (i = 0; i < snritems; i++)
|
||||
{
|
||||
bool printed = false;
|
||||
item_number *sp1 = ritem + sitems[i];
|
||||
item_number *sp = sp1;
|
||||
rule *r;
|
||||
item_number *sp;
|
||||
item_number *sp1;
|
||||
rule_number r;
|
||||
|
||||
while (0 <= *sp)
|
||||
sp1 = sp = ritem + sitems[i];
|
||||
|
||||
while (*sp >= 0)
|
||||
sp++;
|
||||
|
||||
r = &rules[item_number_as_rule_number (*sp)];
|
||||
sp = r->rhs;
|
||||
r = item_number_as_rule_number (*sp);
|
||||
sp = rules[r].rhs;
|
||||
|
||||
/* Display the lookahead tokens? */
|
||||
if (item_number_is_rule_number (*sp1))
|
||||
{
|
||||
reductions *reds = s->reductions;
|
||||
int red = state_reduction_find (s, r);
|
||||
int red = state_reduction_find (s, &rules[r]);
|
||||
/* Print item with lookaheads if there are. */
|
||||
if (reds->lookahead_tokens && red != -1)
|
||||
{
|
||||
xml_printf (out, level + 1,
|
||||
"<item rule-number=\"%d\" point=\"%d\">",
|
||||
r->number, sp1 - sp);
|
||||
state_rule_lookahead_tokens_print_xml (s, r,
|
||||
rules[r].number, sp1 - sp);
|
||||
state_rule_lookahead_tokens_print_xml (s, &rules[r],
|
||||
out, level + 2);
|
||||
xml_puts (out, level + 1, "</item>");
|
||||
printed = true;
|
||||
@@ -105,10 +106,12 @@ print_core (FILE *out, int level, state *s)
|
||||
}
|
||||
|
||||
if (!printed)
|
||||
xml_printf (out, level + 1,
|
||||
"<item rule-number=\"%d\" point=\"%d\"/>",
|
||||
r->number,
|
||||
sp1 - sp);
|
||||
{
|
||||
xml_printf (out, level + 1,
|
||||
"<item rule-number=\"%d\" point=\"%d\"/>",
|
||||
rules[r].number,
|
||||
sp1 - sp);
|
||||
}
|
||||
}
|
||||
xml_puts (out, level, "</itemset>");
|
||||
}
|
||||
@@ -133,11 +136,10 @@ print_transitions (state *s, FILE *out, int level)
|
||||
}
|
||||
|
||||
/* Nothing to report. */
|
||||
if (!n)
|
||||
{
|
||||
xml_puts (out, level, "<transitions/>");
|
||||
return;
|
||||
}
|
||||
if (!n) {
|
||||
xml_puts (out, level, "<transitions/>");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Report lookahead tokens and shifts. */
|
||||
xml_puts (out, level, "<transitions>");
|
||||
@@ -188,11 +190,10 @@ print_errs (FILE *out, int level, state *s)
|
||||
count = true;
|
||||
|
||||
/* Nothing to report. */
|
||||
if (!count)
|
||||
{
|
||||
xml_puts (out, level, "<errors/>");
|
||||
return;
|
||||
}
|
||||
if (!count) {
|
||||
xml_puts (out, level, "<errors/>");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Report lookahead tokens and errors. */
|
||||
xml_puts (out, level, "<errors>");
|
||||
@@ -259,7 +260,7 @@ print_reductions (FILE *out, int level, state *s)
|
||||
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
|
||||
for (i = 0; i < s->errs->num; ++i)
|
||||
if (s->errs->symbols[i])
|
||||
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
|
||||
bitset_set (no_reduce_set, s->errs->symbols[i]->content->number);
|
||||
|
||||
if (default_reduction)
|
||||
report = true;
|
||||
@@ -286,11 +287,10 @@ print_reductions (FILE *out, int level, state *s)
|
||||
}
|
||||
|
||||
/* Nothing to report. */
|
||||
if (!report)
|
||||
{
|
||||
xml_puts (out, level, "<reductions/>");
|
||||
return;
|
||||
}
|
||||
if (!report) {
|
||||
xml_puts (out, level, "<reductions/>");
|
||||
return;
|
||||
}
|
||||
|
||||
xml_puts (out, level, "<reductions>");
|
||||
|
||||
@@ -388,11 +388,11 @@ print_grammar (FILE *out, int level)
|
||||
/* Terminals */
|
||||
xml_puts (out, level + 1, "<terminals>");
|
||||
for (i = 0; i < max_user_token_number + 1; i++)
|
||||
if (token_translations[i] != undeftoken->number)
|
||||
if (token_translations[i] != undeftoken->content->number)
|
||||
{
|
||||
char const *tag = symbols[token_translations[i]]->tag;
|
||||
int precedence = symbols[token_translations[i]]->prec;
|
||||
assoc associativity = symbols[token_translations[i]]->assoc;
|
||||
int precedence = symbols[token_translations[i]]->content->prec;
|
||||
assoc associativity = symbols[token_translations[i]]->content->assoc;
|
||||
xml_indent (out, level + 2);
|
||||
fprintf (out,
|
||||
"<terminal symbol-number=\"%d\" token-number=\"%d\""
|
||||
|
||||
+7
-9
@@ -72,7 +72,7 @@ print_core (FILE *out, state *s)
|
||||
size_t i;
|
||||
item_number *sitems = s->items;
|
||||
size_t snritems = s->nitems;
|
||||
symbol *previous_lhs = NULL;
|
||||
sym_content *previous_lhs = NULL;
|
||||
|
||||
/* Output all the items of a state, not only its kernel. */
|
||||
if (report_flag & report_itemsets)
|
||||
@@ -106,11 +106,8 @@ print_core (FILE *out, state *s)
|
||||
for (sp = rules[r].rhs; sp < sp1; sp++)
|
||||
fprintf (out, " %s", symbols[*sp]->tag);
|
||||
fputs (" .", out);
|
||||
if (0 <= *rules[r].rhs)
|
||||
for (/* Nothing */; 0 <= *sp; ++sp)
|
||||
fprintf (out, " %s", symbols[*sp]->tag);
|
||||
else
|
||||
fprintf (out, " %%empty");
|
||||
for (/* Nothing */; *sp >= 0; ++sp)
|
||||
fprintf (out, " %s", symbols[*sp]->tag);
|
||||
|
||||
/* Display the lookahead tokens? */
|
||||
if (report_flag & report_lookahead_tokens
|
||||
@@ -226,7 +223,8 @@ print_reduction (FILE *out, size_t width,
|
||||
if (!enabled)
|
||||
fputc ('[', out);
|
||||
if (r->number)
|
||||
fprintf (out, _("reduce using rule %d (%s)"), r->number, r->lhs->tag);
|
||||
fprintf (out, _("reduce using rule %d (%s)"), r->number,
|
||||
r->lhs->symbol->tag);
|
||||
else
|
||||
fprintf (out, _("accept"));
|
||||
if (!enabled)
|
||||
@@ -260,7 +258,7 @@ print_reductions (FILE *out, state *s)
|
||||
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
|
||||
for (i = 0; i < s->errs->num; ++i)
|
||||
if (s->errs->symbols[i])
|
||||
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
|
||||
bitset_set (no_reduce_set, s->errs->symbols[i]->content->number);
|
||||
|
||||
/* Compute the width of the lookahead token column. */
|
||||
if (default_reduction)
|
||||
@@ -411,7 +409,7 @@ print_grammar (FILE *out)
|
||||
/* TERMINAL (type #) : rule #s terminal is on RHS */
|
||||
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
|
||||
for (i = 0; i < max_user_token_number + 1; i++)
|
||||
if (token_translations[i] != undeftoken->number)
|
||||
if (token_translations[i] != undeftoken->content->number)
|
||||
{
|
||||
const char *tag = symbols[token_translations[i]]->tag;
|
||||
rule_number r;
|
||||
|
||||
+7
-9
@@ -46,7 +46,7 @@ static void
|
||||
print_core (struct obstack *oout, state *s)
|
||||
{
|
||||
item_number const *sitems = s->items;
|
||||
symbol *previous_lhs = NULL;
|
||||
sym_content *previous_lhs = NULL;
|
||||
size_t i;
|
||||
size_t snritems = s->nitems;
|
||||
|
||||
@@ -72,11 +72,12 @@ print_core (struct obstack *oout, state *s)
|
||||
r = &rules[item_number_as_rule_number (*sp)];
|
||||
|
||||
obstack_printf (oout, "%3d ", r->number);
|
||||
if (previous_lhs && UNIQSTR_EQ (previous_lhs->tag, r->lhs->tag))
|
||||
if (previous_lhs && UNIQSTR_EQ (previous_lhs->symbol->tag,
|
||||
r->lhs->symbol->tag))
|
||||
obstack_printf (oout, "%*s| ",
|
||||
(int) strlen (previous_lhs->tag), "");
|
||||
(int) strlen (previous_lhs->symbol->tag), "");
|
||||
else
|
||||
obstack_printf (oout, "%s: ", escape (r->lhs->tag));
|
||||
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
|
||||
previous_lhs = r->lhs;
|
||||
|
||||
for (sp = r->rhs; sp < sp1; sp++)
|
||||
@@ -84,11 +85,8 @@ print_core (struct obstack *oout, state *s)
|
||||
|
||||
obstack_1grow (oout, '.');
|
||||
|
||||
if (0 <= *r->rhs)
|
||||
for (/* Nothing */; *sp >= 0; ++sp)
|
||||
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||
else
|
||||
obstack_printf (oout, " %%empty");
|
||||
for (/* Nothing */; *sp >= 0; ++sp)
|
||||
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||
|
||||
/* Experimental feature: display the lookahead tokens. */
|
||||
if (report_flag & report_lookahead_tokens
|
||||
|
||||
+28
-27
@@ -129,7 +129,7 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
||||
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
|
||||
{
|
||||
unsigned indent = 0;
|
||||
complain_indent (&declaration_loc, complaint, &indent,
|
||||
start_complain_indent (&declaration_loc, complaint, &indent,
|
||||
_("result type clash on merge function %s: "
|
||||
"<%s> != <%s>"),
|
||||
quote (merge_function->name), type,
|
||||
@@ -240,13 +240,13 @@ grammar_current_rule_begin (symbol *lhs, location loc,
|
||||
current_rule = grammar_end;
|
||||
|
||||
/* Mark the rule's lhs as a nonterminal if not already so. */
|
||||
if (lhs->class == unknown_sym)
|
||||
if (lhs->content->class == unknown_sym)
|
||||
{
|
||||
lhs->class = nterm_sym;
|
||||
lhs->number = nvars;
|
||||
lhs->content->class = nterm_sym;
|
||||
lhs->content->number = nvars;
|
||||
++nvars;
|
||||
}
|
||||
else if (lhs->class == token_sym)
|
||||
else if (lhs->content->class == token_sym)
|
||||
complain (&loc, complaint, _("rule given for %s, which is a token"),
|
||||
lhs->tag);
|
||||
}
|
||||
@@ -292,15 +292,15 @@ grammar_rule_check (const symbol_list *r)
|
||||
|
||||
Don't worry about the default action if $$ is untyped, since $$'s
|
||||
value can't be used. */
|
||||
if (!r->action_props.code && r->content.sym->type_name)
|
||||
if (!r->action_props.code && r->content.sym->content->type_name)
|
||||
{
|
||||
symbol *first_rhs = r->next->content.sym;
|
||||
/* If $$ is being set in default way, report if any type mismatch. */
|
||||
if (first_rhs)
|
||||
{
|
||||
char const *lhs_type = r->content.sym->type_name;
|
||||
char const *lhs_type = r->content.sym->content->type_name;
|
||||
const char *rhs_type =
|
||||
first_rhs->type_name ? first_rhs->type_name : "";
|
||||
first_rhs->content->type_name ? first_rhs->content->type_name : "";
|
||||
if (!UNIQSTR_EQ (lhs_type, rhs_type))
|
||||
complain (&r->location, Wother,
|
||||
_("type clash on default action: <%s> != <%s>"),
|
||||
@@ -350,7 +350,8 @@ grammar_rule_check (const symbol_list *r)
|
||||
it for char literals and strings, which are always tokens. */
|
||||
if (r->ruleprec
|
||||
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
|
||||
&& r->ruleprec->status != declared && !r->ruleprec->prec)
|
||||
&& r->ruleprec->content->status != declared
|
||||
&& !r->ruleprec->content->prec)
|
||||
complain (&r->location, Wother,
|
||||
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
|
||||
}
|
||||
@@ -517,8 +518,8 @@ grammar_current_rule_symbol_append (symbol *sym, location loc,
|
||||
p = grammar_symbol_append (sym, loc);
|
||||
if (name)
|
||||
assign_named_ref (p, name);
|
||||
if (sym->status == undeclared || sym->status == used)
|
||||
sym->status = needed;
|
||||
if (sym->content->status == undeclared || sym->content->status == used)
|
||||
sym->content->status = needed;
|
||||
}
|
||||
|
||||
/* Attach an ACTION to the current rule. */
|
||||
@@ -558,11 +559,11 @@ packgram (void)
|
||||
for (p = grammar; p; p = p->next)
|
||||
{
|
||||
symbol *ruleprec = p->ruleprec;
|
||||
record_merge_function_type (p->merger, p->content.sym->type_name,
|
||||
record_merge_function_type (p->merger, p->content.sym->content->type_name,
|
||||
p->merger_declaration_location);
|
||||
rules[ruleno].user_number = ruleno;
|
||||
rules[ruleno].number = ruleno;
|
||||
rules[ruleno].lhs = p->content.sym;
|
||||
rules[ruleno].lhs = p->content.sym->content;
|
||||
rules[ruleno].rhs = ritem + itemno;
|
||||
rules[ruleno].prec = NULL;
|
||||
rules[ruleno].dprec = p->dprec;
|
||||
@@ -604,11 +605,11 @@ packgram (void)
|
||||
/* item_number = symbol_number.
|
||||
But the former needs to contain more: negative rule numbers. */
|
||||
ritem[itemno++] =
|
||||
symbol_number_as_item_number (p->content.sym->number);
|
||||
symbol_number_as_item_number (p->content.sym->content->number);
|
||||
/* A rule gets by default the precedence and associativity
|
||||
of its last token. */
|
||||
if (p->content.sym->class == token_sym && default_prec)
|
||||
rules[ruleno].prec = p->content.sym;
|
||||
if (p->content.sym->content->class == token_sym && default_prec)
|
||||
rules[ruleno].prec = p->content.sym->content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,8 +617,8 @@ packgram (void)
|
||||
the specified symbol's precedence replaces the default. */
|
||||
if (ruleprec)
|
||||
{
|
||||
rules[ruleno].precsym = ruleprec;
|
||||
rules[ruleno].prec = ruleprec;
|
||||
rules[ruleno].precsym = ruleprec->content;
|
||||
rules[ruleno].prec = ruleprec->content;
|
||||
}
|
||||
/* An item ends by the rule number (negated). */
|
||||
ritem[itemno++] = rule_number_as_item_number (ruleno);
|
||||
@@ -647,19 +648,19 @@ reader (void)
|
||||
|
||||
/* Construct the accept symbol. */
|
||||
accept = symbol_get ("$accept", empty_location);
|
||||
accept->class = nterm_sym;
|
||||
accept->number = nvars++;
|
||||
accept->content->class = nterm_sym;
|
||||
accept->content->number = nvars++;
|
||||
|
||||
/* Construct the error token */
|
||||
errtoken = symbol_get ("error", empty_location);
|
||||
errtoken->class = token_sym;
|
||||
errtoken->number = ntokens++;
|
||||
errtoken->content->class = token_sym;
|
||||
errtoken->content->number = ntokens++;
|
||||
|
||||
/* Construct a token that represents all undefined literal tokens.
|
||||
It is always token number 2. */
|
||||
undeftoken = symbol_get ("$undefined", empty_location);
|
||||
undeftoken->class = token_sym;
|
||||
undeftoken->number = ntokens++;
|
||||
undeftoken->content->class = token_sym;
|
||||
undeftoken->content->number = ntokens++;
|
||||
|
||||
gram_in = xfopen (grammar_file, "r");
|
||||
|
||||
@@ -721,10 +722,10 @@ check_and_convert_grammar (void)
|
||||
if (!endtoken)
|
||||
{
|
||||
endtoken = symbol_get ("$end", empty_location);
|
||||
endtoken->class = token_sym;
|
||||
endtoken->number = 0;
|
||||
endtoken->content->class = token_sym;
|
||||
endtoken->content->number = 0;
|
||||
/* Value specified by POSIX. */
|
||||
endtoken->user_token_number = 0;
|
||||
endtoken->content->user_token_number = 0;
|
||||
}
|
||||
|
||||
/* Report any undefined symbols and consider them nonterminals. */
|
||||
|
||||
+9
-9
@@ -163,9 +163,9 @@ inaccessable_symbols (void)
|
||||
Pp = bitset_create (nrules, BITSET_FIXED);
|
||||
|
||||
/* If the start symbol isn't useful, then nothing will be useful. */
|
||||
if (bitset_test (N, accept->number - ntokens))
|
||||
if (bitset_test (N, accept->content->number - ntokens))
|
||||
{
|
||||
bitset_set (V, accept->number);
|
||||
bitset_set (V, accept->content->number);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -196,9 +196,9 @@ inaccessable_symbols (void)
|
||||
V = Vp;
|
||||
|
||||
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
|
||||
bitset_set (V, endtoken->number); /* end-of-input token */
|
||||
bitset_set (V, errtoken->number); /* error token */
|
||||
bitset_set (V, undeftoken->number); /* some undefined token */
|
||||
bitset_set (V, endtoken->content->number); /* end-of-input token */
|
||||
bitset_set (V, errtoken->content->number); /* error token */
|
||||
bitset_set (V, undeftoken->content->number); /* some undefined token */
|
||||
|
||||
bitset_free (P);
|
||||
P = Pp;
|
||||
@@ -298,7 +298,7 @@ nonterminals_reduce (void)
|
||||
if (!bitset_test (V, i))
|
||||
{
|
||||
nontermmap[i - ntokens] = n++;
|
||||
if (symbols[i]->status != used)
|
||||
if (symbols[i]->content->status != used)
|
||||
complain (&symbols[i]->location, Wother,
|
||||
_("nonterminal useless in grammar: %s"),
|
||||
symbols[i]->tag);
|
||||
@@ -310,7 +310,7 @@ nonterminals_reduce (void)
|
||||
symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted);
|
||||
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
symbols[i]->number = nontermmap[i - ntokens];
|
||||
symbols[i]->content->number = nontermmap[i - ntokens];
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
symbols_sorted[nontermmap[i - ntokens] - ntokens] = symbols[i];
|
||||
for (i = ntokens; i < nsyms; i++)
|
||||
@@ -328,7 +328,7 @@ nonterminals_reduce (void)
|
||||
*rhsp = symbol_number_as_item_number (nontermmap[*rhsp
|
||||
- ntokens]);
|
||||
}
|
||||
accept->number = nontermmap[accept->number - ntokens];
|
||||
accept->content->number = nontermmap[accept->content->number - ntokens];
|
||||
}
|
||||
|
||||
nsyms -= nuseless_nonterminals;
|
||||
@@ -415,7 +415,7 @@ reduce_grammar (void)
|
||||
|
||||
reduce_print ();
|
||||
|
||||
if (!bitset_test (N, accept->number - ntokens))
|
||||
if (!bitset_test (N, accept->content->number - ntokens))
|
||||
complain (&startsymbol_location, fatal,
|
||||
_("start symbol %s does not derive any sentence"),
|
||||
startsymbol->tag);
|
||||
|
||||
+16
-21
@@ -335,26 +335,15 @@ show_sub_message (warnings warning,
|
||||
const char *at_spec = get_at_spec (var->symbol_index);
|
||||
|
||||
if (var->err == 0)
|
||||
complain_indent (&var->loc, warning, &indent,
|
||||
start_complain_indent (&var->loc, warning, &indent,
|
||||
_("refers to: %c%s at %s"), dollar_or_at,
|
||||
var->id, at_spec);
|
||||
else
|
||||
{
|
||||
static struct obstack msg_buf;
|
||||
const char *tail = explicit_bracketing ? "" : cp + strlen (var->id);
|
||||
const char *id;
|
||||
location id_loc;
|
||||
|
||||
if (var->hidden_by)
|
||||
{
|
||||
id = var->hidden_by->id;
|
||||
id_loc = var->hidden_by->loc;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = var->id;
|
||||
id_loc = var->loc;
|
||||
}
|
||||
const char *id = var->hidden_by ? var->hidden_by->id : var->id;
|
||||
location id_loc = var->hidden_by ? var->hidden_by->loc : var->loc;
|
||||
|
||||
/* Create the explanation message. */
|
||||
obstack_init (&msg_buf);
|
||||
@@ -383,7 +372,7 @@ show_sub_message (warnings warning,
|
||||
_(", cannot be accessed from mid-rule action at $%d"),
|
||||
midrule_rhs_index);
|
||||
|
||||
complain_indent (&id_loc, warning, &indent, "%s",
|
||||
start_complain_indent (&id_loc, warning, &indent, "%s",
|
||||
obstack_finish0 (&msg_buf));
|
||||
obstack_free (&msg_buf, 0);
|
||||
}
|
||||
@@ -526,7 +515,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
cp_end - cp : ref_tail_fields - cp;
|
||||
unsigned indent = 0;
|
||||
|
||||
complain_indent (&text_loc, complaint, &indent,
|
||||
start_complain_indent (&text_loc, complaint, &indent,
|
||||
_("invalid reference: %s"), quote (text));
|
||||
indent += SUB_INDENT;
|
||||
if (len == 0)
|
||||
@@ -534,18 +523,18 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
location sym_loc = text_loc;
|
||||
sym_loc.start.column += 1;
|
||||
sym_loc.end = sym_loc.start;
|
||||
complain_indent (&sym_loc, complaint, &indent,
|
||||
start_complain_indent (&sym_loc, complaint, &indent,
|
||||
_("syntax error after '%c', expecting integer, "
|
||||
"letter, '_', '[', or '$'"),
|
||||
dollar_or_at);
|
||||
}
|
||||
else if (midrule_rhs_index)
|
||||
complain_indent (&rule->location, complaint, &indent,
|
||||
start_complain_indent (&rule->location, complaint, &indent,
|
||||
_("symbol not found in production before $%d: "
|
||||
"%.*s"),
|
||||
midrule_rhs_index, len, cp);
|
||||
else
|
||||
complain_indent (&rule->location, complaint, &indent,
|
||||
start_complain_indent (&rule->location, complaint, &indent,
|
||||
_("symbol not found in production: %.*s"),
|
||||
len, cp);
|
||||
|
||||
@@ -553,6 +542,7 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
show_sub_messages (complaint,
|
||||
cp, explicit_bracketing, midrule_rhs_index,
|
||||
dollar_or_at, indent);
|
||||
finish_complaint ();
|
||||
return INVALID_REF;
|
||||
}
|
||||
case 1:
|
||||
@@ -560,11 +550,12 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
unsigned indent = 0;
|
||||
if (variant_count > 1)
|
||||
{
|
||||
complain_indent (&text_loc, Wother, &indent,
|
||||
start_complain_indent (&text_loc, Wother, &indent,
|
||||
_("misleading reference: %s"), quote (text));
|
||||
show_sub_messages (Wother,
|
||||
cp, explicit_bracketing, midrule_rhs_index,
|
||||
dollar_or_at, indent + SUB_INDENT);
|
||||
finish_complaint ();
|
||||
}
|
||||
{
|
||||
unsigned symbol_index =
|
||||
@@ -576,14 +567,18 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
||||
default:
|
||||
{
|
||||
unsigned indent = 0;
|
||||
complain_indent (&text_loc, complaint, &indent,
|
||||
start_complain_indent (&text_loc, complaint, &indent,
|
||||
_("ambiguous reference: %s"), quote (text));
|
||||
show_sub_messages (complaint,
|
||||
cp, explicit_bracketing, midrule_rhs_index,
|
||||
dollar_or_at, indent + SUB_INDENT);
|
||||
finish_complaint ();
|
||||
return INVALID_REF;
|
||||
}
|
||||
}
|
||||
|
||||
/* Not reachable. */
|
||||
return INVALID_REF;
|
||||
}
|
||||
|
||||
/* Keeps track of the maximum number of semantic values to the left of
|
||||
|
||||
+1
-1
@@ -266,7 +266,7 @@ eqopt ([[:space:]]*=)?
|
||||
"%pure"[-_]"parser" DEPRECATED("%pure-parser");
|
||||
"%token"[-_]"table" DEPRECATED("%token-table");
|
||||
|
||||
"%"{id} {
|
||||
"%"{id}|"%"{notletter}([[:graph:]])+ {
|
||||
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -244,9 +244,8 @@ at_output (int argc, char *argv[], char **out_namep, int *out_linenop)
|
||||
xfclose (yyout);
|
||||
}
|
||||
*out_namep = xstrdup (argv[1]);
|
||||
output_file_name_check (out_namep, true);
|
||||
/* If there were errors, do not generate the output. */
|
||||
yyout = xfopen (complaint_status ? "/dev/null" : *out_namep, "w");
|
||||
output_file_name_check (out_namep);
|
||||
yyout = xfopen (*out_namep, "w");
|
||||
*out_linenop = 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -135,7 +135,7 @@ typedef struct
|
||||
/* Is the TRANSITIONS->states[Num] labelled by the error token? */
|
||||
|
||||
# define TRANSITION_IS_ERROR(Transitions, Num) \
|
||||
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->number)
|
||||
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->content->number)
|
||||
|
||||
/* When resolving a SR conflicts, if the reduction wins, the shift is
|
||||
disabled. */
|
||||
|
||||
+3
-3
@@ -205,7 +205,7 @@ symbol_list_n_type_name_get (symbol_list *l, location loc, int n)
|
||||
return NULL;
|
||||
}
|
||||
aver (l->content_type == SYMLIST_SYMBOL);
|
||||
return l->content.sym->type_name;
|
||||
return l->content.sym->content->type_name;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -223,8 +223,8 @@ symbol_list_code_props_set (symbol_list *node, code_props_type kind,
|
||||
{
|
||||
case SYMLIST_SYMBOL:
|
||||
symbol_code_props_set (node->content.sym, kind, cprops);
|
||||
if (node->content.sym->status == undeclared)
|
||||
node->content.sym->status = used;
|
||||
if (node->content.sym->content->status == undeclared)
|
||||
node->content.sym->content->status = used;
|
||||
break;
|
||||
case SYMLIST_TYPE:
|
||||
semantic_type_code_props_set
|
||||
|
||||
+140
-161
@@ -58,6 +58,35 @@ static symgraph **prec_nodes;
|
||||
|
||||
bool *used_assoc = NULL;
|
||||
|
||||
/*--------------------------.
|
||||
| Create a new sym_content. |
|
||||
`--------------------------*/
|
||||
|
||||
static sym_content *
|
||||
sym_content_new (symbol *s)
|
||||
{
|
||||
sym_content *res = xmalloc (sizeof *res);
|
||||
|
||||
res->symbol = s;
|
||||
|
||||
res->type_name = NULL;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
}
|
||||
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec = 0;
|
||||
res->assoc = undef_assoc;
|
||||
res->user_token_number = USER_NUMBER_UNDEFINED;
|
||||
|
||||
res->class = unknown_sym;
|
||||
res->status = undeclared;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*---------------------------------.
|
||||
| Create a new symbol, named TAG. |
|
||||
`---------------------------------*/
|
||||
@@ -76,22 +105,9 @@ symbol_new (uniqstr tag, location loc)
|
||||
|
||||
res->tag = tag;
|
||||
res->location = loc;
|
||||
|
||||
res->type_name = NULL;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
code_props_none_init (&res->props[i]);
|
||||
}
|
||||
|
||||
res->number = NUMBER_UNDEFINED;
|
||||
res->prec = 0;
|
||||
res->assoc = undef_assoc;
|
||||
res->user_token_number = USER_NUMBER_UNDEFINED;
|
||||
|
||||
res->alias = NULL;
|
||||
res->class = unknown_sym;
|
||||
res->status = undeclared;
|
||||
res->content = sym_content_new (res);
|
||||
res->is_alias = false;
|
||||
|
||||
if (nsyms == SYMBOL_NUMBER_MAXIMUM)
|
||||
complain (NULL, fatal, _("too many symbols in input grammar (limit is %d)"),
|
||||
@@ -100,6 +116,30 @@ symbol_new (uniqstr tag, location loc)
|
||||
return res;
|
||||
}
|
||||
|
||||
/*--------------------.
|
||||
| Free a sym_content. |
|
||||
`--------------------*/
|
||||
|
||||
static void
|
||||
sym_content_free (sym_content *sym)
|
||||
{
|
||||
free (sym);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------.
|
||||
| Free a symbol and its associated content if appropriate. |
|
||||
`---------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
symbol_free (void *ptr)
|
||||
{
|
||||
symbol *sym = (symbol *)ptr;
|
||||
if (!sym->is_alias)
|
||||
sym_content_free (sym->content);
|
||||
free (sym);
|
||||
}
|
||||
|
||||
char const *
|
||||
code_props_type_string (code_props_type kind)
|
||||
{
|
||||
@@ -141,12 +181,12 @@ semantic_type_new (uniqstr tag, const location *loc)
|
||||
`-----------------*/
|
||||
|
||||
#define SYMBOL_ATTR_PRINT(Attr) \
|
||||
if (s->Attr) \
|
||||
fprintf (f, " %s { %s }", #Attr, s->Attr)
|
||||
if (s->content->Attr) \
|
||||
fprintf (f, " %s { %s }", #Attr, s->content->Attr)
|
||||
|
||||
#define SYMBOL_CODE_PRINT(Attr) \
|
||||
if (s->props[Attr].code) \
|
||||
fprintf (f, " %s { %s }", #Attr, s->props[Attr].code)
|
||||
if (s->content->props[Attr].code) \
|
||||
fprintf (f, " %s { %s }", #Attr, s->content->props[Attr].code)
|
||||
|
||||
void
|
||||
symbol_print (symbol const *s, FILE *f)
|
||||
@@ -193,7 +233,7 @@ is_identifier (uniqstr s)
|
||||
uniqstr
|
||||
symbol_id_get (symbol const *sym)
|
||||
{
|
||||
aver (sym->user_token_number != USER_NUMBER_HAS_STRING_ALIAS);
|
||||
aver (sym->content->user_token_number != USER_NUMBER_HAS_STRING_ALIAS);
|
||||
if (sym->alias)
|
||||
sym = sym->alias;
|
||||
return is_identifier (sym->tag) ? sym->tag : 0;
|
||||
@@ -210,7 +250,7 @@ symbol_redeclaration (symbol *s, const char *what, location first,
|
||||
location second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
complain_indent (&second, complaint, &i,
|
||||
start_complain_indent (&second, complaint, &i,
|
||||
_("%s redeclaration for %s"), what, s->tag);
|
||||
i += SUB_INDENT;
|
||||
complain_indent (&first, complaint, &i,
|
||||
@@ -222,7 +262,7 @@ semantic_type_redeclaration (semantic_type *s, const char *what, location first,
|
||||
location second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
complain_indent (&second, complaint, &i,
|
||||
start_complain_indent (&second, complaint, &i,
|
||||
_("%s redeclaration for <%s>"), what, s->tag);
|
||||
i += SUB_INDENT;
|
||||
complain_indent (&first, complaint, &i,
|
||||
@@ -241,13 +281,13 @@ symbol_type_set (symbol *sym, uniqstr type_name, location loc)
|
||||
{
|
||||
if (type_name)
|
||||
{
|
||||
if (sym->type_name)
|
||||
symbol_redeclaration (sym, "%type", sym->type_location, loc);
|
||||
if (sym->content->type_name)
|
||||
symbol_redeclaration (sym, "%type", sym->content->type_location, loc);
|
||||
else
|
||||
{
|
||||
uniqstr_assert (type_name);
|
||||
sym->type_name = type_name;
|
||||
sym->type_location = loc;
|
||||
sym->content->type_name = type_name;
|
||||
sym->content->type_location = loc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,12 +300,12 @@ void
|
||||
symbol_code_props_set (symbol *sym, code_props_type kind,
|
||||
code_props const *code)
|
||||
{
|
||||
if (sym->props[kind].code)
|
||||
if (sym->content->props[kind].code)
|
||||
symbol_redeclaration (sym, code_props_type_string (kind),
|
||||
sym->props[kind].location,
|
||||
sym->content->props[kind].location,
|
||||
code->location);
|
||||
else
|
||||
sym->props[kind] = *code;
|
||||
sym->content->props[kind] = *code;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------.
|
||||
@@ -293,14 +333,14 @@ code_props *
|
||||
symbol_code_props_get (symbol *sym, code_props_type kind)
|
||||
{
|
||||
/* Per-symbol code props. */
|
||||
if (sym->props[kind].code)
|
||||
return &sym->props[kind];
|
||||
if (sym->content->props[kind].code)
|
||||
return &sym->content->props[kind];
|
||||
|
||||
/* Per-type code props. */
|
||||
if (sym->type_name)
|
||||
if (sym->content->type_name)
|
||||
{
|
||||
code_props *code =
|
||||
&semantic_type_get (sym->type_name, NULL)->props[kind];
|
||||
&semantic_type_get (sym->content->type_name, NULL)->props[kind];
|
||||
if (code->code)
|
||||
return code;
|
||||
}
|
||||
@@ -308,8 +348,8 @@ symbol_code_props_get (symbol *sym, code_props_type kind)
|
||||
/* Apply default code props's only to user-defined symbols. */
|
||||
if (sym->tag[0] != '$' && sym != errtoken)
|
||||
{
|
||||
code_props *code =
|
||||
&semantic_type_get (sym->type_name ? "*" : "", NULL)->props[kind];
|
||||
code_props *code = &semantic_type_get (sym->content->type_name ? "*" : "",
|
||||
NULL)->props[kind];
|
||||
if (code->code)
|
||||
return code;
|
||||
}
|
||||
@@ -324,16 +364,17 @@ symbol_code_props_get (symbol *sym, code_props_type kind)
|
||||
void
|
||||
symbol_precedence_set (symbol *sym, int prec, assoc a, location loc)
|
||||
{
|
||||
sym_content *s = sym->content;
|
||||
if (a != undef_assoc)
|
||||
{
|
||||
if (sym->prec)
|
||||
symbol_redeclaration (sym, assoc_to_string (a), sym->prec_location,
|
||||
loc);
|
||||
if (s->prec)
|
||||
symbol_redeclaration (sym, assoc_to_string (a),
|
||||
s->prec_location, loc);
|
||||
else
|
||||
{
|
||||
sym->prec = prec;
|
||||
sym->assoc = a;
|
||||
sym->prec_location = loc;
|
||||
s->prec = prec;
|
||||
s->assoc = a;
|
||||
s->prec_location = loc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,26 +391,26 @@ void
|
||||
symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
||||
{
|
||||
bool warned = false;
|
||||
if (sym->class != unknown_sym && sym->class != class)
|
||||
if (sym->content->class != unknown_sym && sym->content->class != class)
|
||||
{
|
||||
complain (&loc, complaint, _("symbol %s redefined"), sym->tag);
|
||||
/* Don't report both "redefined" and "redeclared". */
|
||||
warned = true;
|
||||
}
|
||||
|
||||
if (class == nterm_sym && sym->class != nterm_sym)
|
||||
sym->number = nvars++;
|
||||
else if (class == token_sym && sym->number == NUMBER_UNDEFINED)
|
||||
sym->number = ntokens++;
|
||||
if (class == nterm_sym && sym->content->class != nterm_sym)
|
||||
sym->content->number = nvars++;
|
||||
else if (class == token_sym && sym->content->number == NUMBER_UNDEFINED)
|
||||
sym->content->number = ntokens++;
|
||||
|
||||
sym->class = class;
|
||||
sym->content->class = class;
|
||||
|
||||
if (declaring)
|
||||
{
|
||||
if (sym->status == declared && !warned)
|
||||
if (sym->content->status == declared && !warned)
|
||||
complain (&loc, Wother, _("symbol %s redeclared"), sym->tag);
|
||||
else
|
||||
sym->status = declared;
|
||||
sym->content->status = declared;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,10 +424,7 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
||||
{
|
||||
int *user_token_numberp;
|
||||
|
||||
if (sym->user_token_number != USER_NUMBER_HAS_STRING_ALIAS)
|
||||
user_token_numberp = &sym->user_token_number;
|
||||
else
|
||||
user_token_numberp = &sym->alias->user_token_number;
|
||||
user_token_numberp = &sym->content->user_token_number;
|
||||
if (*user_token_numberp != USER_NUMBER_UNDEFINED
|
||||
&& *user_token_numberp != user_token_number)
|
||||
complain (&loc, complaint, _("redefining user token number of %s"),
|
||||
@@ -396,12 +434,12 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
||||
/* User defined $end token? */
|
||||
if (user_token_number == 0)
|
||||
{
|
||||
endtoken = sym;
|
||||
endtoken = sym->content->symbol;
|
||||
/* It is always mapped to 0, so it was already counted in
|
||||
NTOKENS. */
|
||||
if (endtoken->number != NUMBER_UNDEFINED)
|
||||
if (endtoken->content->number != NUMBER_UNDEFINED)
|
||||
--ntokens;
|
||||
endtoken->number = 0;
|
||||
endtoken->content->number = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,16 +452,17 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
||||
static inline bool
|
||||
symbol_check_defined (symbol *sym)
|
||||
{
|
||||
if (sym->class == unknown_sym)
|
||||
sym_content *s = sym->content;
|
||||
if (s->class == unknown_sym)
|
||||
{
|
||||
assert (sym->status != declared);
|
||||
assert (s->status != declared);
|
||||
complain (&sym->location,
|
||||
sym->status == needed ? complaint : Wother,
|
||||
s->status == needed ? complaint : Wother,
|
||||
_("symbol %s is used, but is not defined as a token"
|
||||
" and has no rules"),
|
||||
sym->tag);
|
||||
sym->class = nterm_sym;
|
||||
sym->number = nvars++;
|
||||
s->class = nterm_sym;
|
||||
s->number = nvars++;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -434,9 +473,9 @@ symbol_check_defined (symbol *sym)
|
||||
|
||||
/* Set the semantic type status associated to the current symbol to
|
||||
'declared' so that we could check semantic types unnecessary uses. */
|
||||
if (sym->type_name)
|
||||
if (s->type_name)
|
||||
{
|
||||
semantic_type *sem_type = semantic_type_get (sym->type_name, NULL);
|
||||
semantic_type *sem_type = semantic_type_get (s->type_name, NULL);
|
||||
if (sem_type)
|
||||
sem_type->status = declared;
|
||||
}
|
||||
@@ -493,71 +532,16 @@ symbol_make_alias (symbol *sym, symbol *str, location loc)
|
||||
_("symbol %s given more than one literal string"), sym->tag);
|
||||
else
|
||||
{
|
||||
str->class = token_sym;
|
||||
str->user_token_number = sym->user_token_number;
|
||||
sym->user_token_number = USER_NUMBER_HAS_STRING_ALIAS;
|
||||
sym_content_free (str->content);
|
||||
str->content = sym->content;
|
||||
str->content->symbol = str;
|
||||
str->is_alias = true;
|
||||
str->alias = sym;
|
||||
sym->alias = str;
|
||||
str->number = sym->number;
|
||||
symbol_type_set (str, sym->type_name, loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------.
|
||||
| Check that THIS, and its alias, have same precedence and |
|
||||
| associativity. |
|
||||
`---------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
symbol_check_alias_consistency (symbol *this)
|
||||
{
|
||||
symbol *sym = this;
|
||||
symbol *str = this->alias;
|
||||
|
||||
/* Check only the symbol in the symbol-string pair. */
|
||||
if (!(this->alias
|
||||
&& this->user_token_number == USER_NUMBER_HAS_STRING_ALIAS))
|
||||
return;
|
||||
|
||||
if (str->type_name != sym->type_name)
|
||||
{
|
||||
if (str->type_name)
|
||||
symbol_type_set (sym, str->type_name, str->type_location);
|
||||
else
|
||||
symbol_type_set (str, sym->type_name, sym->type_location);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < CODE_PROPS_SIZE; ++i)
|
||||
if (str->props[i].code)
|
||||
symbol_code_props_set (sym, i, &str->props[i]);
|
||||
else if (sym->props[i].code)
|
||||
symbol_code_props_set (str, i, &sym->props[i]);
|
||||
}
|
||||
|
||||
if (sym->prec || str->prec)
|
||||
{
|
||||
if (str->prec)
|
||||
symbol_precedence_set (sym, str->prec, str->assoc,
|
||||
str->prec_location);
|
||||
else
|
||||
symbol_precedence_set (str, sym->prec, sym->assoc,
|
||||
sym->prec_location);
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
symbol_check_alias_consistency_processor (void *this,
|
||||
void *null ATTRIBUTE_UNUSED)
|
||||
{
|
||||
symbol_check_alias_consistency (this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------.
|
||||
| Assign a symbol number, and write the definition of the token name |
|
||||
| into FDEFINES. Put in SYMBOLS. |
|
||||
@@ -566,13 +550,13 @@ symbol_check_alias_consistency_processor (void *this,
|
||||
static inline bool
|
||||
symbol_pack (symbol *this)
|
||||
{
|
||||
aver (this->number != NUMBER_UNDEFINED);
|
||||
if (this->class == nterm_sym)
|
||||
this->number += ntokens;
|
||||
else if (this->user_token_number == USER_NUMBER_HAS_STRING_ALIAS)
|
||||
aver (this->content->number != NUMBER_UNDEFINED);
|
||||
if (this->content->class == nterm_sym)
|
||||
this->content->number += ntokens;
|
||||
else if (this->content->user_token_number == USER_NUMBER_HAS_STRING_ALIAS)
|
||||
return true;
|
||||
|
||||
symbols[this->number] = this;
|
||||
symbols[this->content->number] = this->content->symbol;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -582,7 +566,6 @@ symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED)
|
||||
return symbol_pack (this);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
||||
{
|
||||
@@ -598,7 +581,7 @@ user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
||||
first = second;
|
||||
second = tmp;
|
||||
}
|
||||
complain_indent (&second->location, complaint, &i,
|
||||
start_complain_indent (&second->location, complaint, &i,
|
||||
_("user token number %d redeclaration for %s"),
|
||||
num, second->tag);
|
||||
i += SUB_INDENT;
|
||||
@@ -615,17 +598,18 @@ static inline bool
|
||||
symbol_translation (symbol *this)
|
||||
{
|
||||
/* Non-terminal? */
|
||||
if (this->class == token_sym
|
||||
&& this->user_token_number != USER_NUMBER_HAS_STRING_ALIAS)
|
||||
if (this->content->class == token_sym
|
||||
&& !this->is_alias)
|
||||
{
|
||||
/* A token which translation has already been set? */
|
||||
if (token_translations[this->user_token_number] != undeftoken->number)
|
||||
/* A token which translation has already been set?*/
|
||||
if (token_translations[this->content->user_token_number]
|
||||
!= undeftoken->content->number)
|
||||
user_token_number_redeclaration
|
||||
(this->user_token_number,
|
||||
symbols[token_translations[this->user_token_number]],
|
||||
this);
|
||||
(this->content->user_token_number,
|
||||
symbols[token_translations[this->content->user_token_number]], this);
|
||||
else
|
||||
token_translations[this->user_token_number] = this->number;
|
||||
token_translations[this->content->user_token_number]
|
||||
= this->content->number;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -711,7 +695,7 @@ symbols_new (void)
|
||||
NULL,
|
||||
hash_symbol_hasher,
|
||||
hash_symbol_comparator,
|
||||
free);
|
||||
symbol_free);
|
||||
semantic_type_table = hash_initialize (HT_INITIAL_CAPACITY,
|
||||
NULL,
|
||||
hash_semantic_type_hasher,
|
||||
@@ -811,8 +795,8 @@ dummy_symbol_get (location loc)
|
||||
|
||||
sprintf (buf, "$@%d", ++dummy_count);
|
||||
sym = symbol_get (buf, loc);
|
||||
sym->class = nterm_sym;
|
||||
sym->number = nvars++;
|
||||
sym->content->class = nterm_sym;
|
||||
sym->content->number = nvars++;
|
||||
return sym;
|
||||
}
|
||||
|
||||
@@ -902,7 +886,7 @@ symbols_token_translations_init (void)
|
||||
max_user_token_number = 0;
|
||||
for (i = 0; i < ntokens; ++i)
|
||||
{
|
||||
symbol *this = symbols[i];
|
||||
sym_content *this = symbols[i]->content;
|
||||
if (this->user_token_number != USER_NUMBER_UNDEFINED)
|
||||
{
|
||||
if (this->user_token_number > max_user_token_number)
|
||||
@@ -914,8 +898,8 @@ symbols_token_translations_init (void)
|
||||
|
||||
/* If 256 is not used, assign it to error, to follow POSIX. */
|
||||
if (num_256_available_p
|
||||
&& errtoken->user_token_number == USER_NUMBER_UNDEFINED)
|
||||
errtoken->user_token_number = 256;
|
||||
&& errtoken->content->user_token_number == USER_NUMBER_UNDEFINED)
|
||||
errtoken->content->user_token_number = 256;
|
||||
|
||||
/* Set the missing user numbers. */
|
||||
if (max_user_token_number < 256)
|
||||
@@ -923,7 +907,7 @@ symbols_token_translations_init (void)
|
||||
|
||||
for (i = 0; i < ntokens; ++i)
|
||||
{
|
||||
symbol *this = symbols[i];
|
||||
sym_content *this = symbols[i]->content;
|
||||
if (this->user_token_number == USER_NUMBER_UNDEFINED)
|
||||
this->user_token_number = ++max_user_token_number;
|
||||
if (this->user_token_number > max_user_token_number)
|
||||
@@ -936,7 +920,7 @@ symbols_token_translations_init (void)
|
||||
/* Initialize all entries for literal tokens to the internal token
|
||||
number for $undefined, which represents all invalid inputs. */
|
||||
for (i = 0; i < max_user_token_number + 1; i++)
|
||||
token_translations[i] = undeftoken->number;
|
||||
token_translations[i] = undeftoken->content->number;
|
||||
symbols_do (symbol_translation_processor, NULL,
|
||||
symbol_table, &symbols_sorted);
|
||||
}
|
||||
@@ -950,9 +934,6 @@ symbols_token_translations_init (void)
|
||||
void
|
||||
symbols_pack (void)
|
||||
{
|
||||
symbols_do (symbol_check_alias_consistency_processor, NULL,
|
||||
symbol_table, &symbols_sorted);
|
||||
|
||||
symbols = xcalloc (nsyms, sizeof *symbols);
|
||||
symbols_do (symbol_pack_processor, NULL, symbol_table, &symbols_sorted);
|
||||
|
||||
@@ -971,9 +952,7 @@ symbols_pack (void)
|
||||
else
|
||||
{
|
||||
symbols[writei] = symbols[readi];
|
||||
symbols[writei]->number = writei;
|
||||
if (symbols[writei]->alias)
|
||||
symbols[writei]->alias->number = writei;
|
||||
symbols[writei]->content->number = writei;
|
||||
writei += 1;
|
||||
}
|
||||
}
|
||||
@@ -982,11 +961,11 @@ symbols_pack (void)
|
||||
|
||||
symbols_token_translations_init ();
|
||||
|
||||
if (startsymbol->class == unknown_sym)
|
||||
if (startsymbol->content->class == unknown_sym)
|
||||
complain (&startsymbol_location, fatal,
|
||||
_("the start symbol %s is undefined"),
|
||||
startsymbol->tag);
|
||||
else if (startsymbol->class == token_sym)
|
||||
else if (startsymbol->content->class == token_sym)
|
||||
complain (&startsymbol_location, fatal,
|
||||
_("the start symbol %s is a token"),
|
||||
startsymbol->tag);
|
||||
@@ -1123,9 +1102,9 @@ static inline bool
|
||||
is_assoc_useless (symbol *s)
|
||||
{
|
||||
return s
|
||||
&& s->assoc != undef_assoc
|
||||
&& s->assoc != precedence_assoc
|
||||
&& !used_assoc[s->number];
|
||||
&& s->content->assoc != undef_assoc
|
||||
&& s->content->assoc != precedence_assoc
|
||||
&& !used_assoc[s->content->number];
|
||||
}
|
||||
|
||||
/*-------------------------------.
|
||||
@@ -1157,19 +1136,19 @@ print_precedence_warnings (void)
|
||||
{
|
||||
symbol *s = symbols[i];
|
||||
if (s
|
||||
&& s->prec != 0
|
||||
&& s->content->prec != 0
|
||||
&& !prec_nodes[i]->pred
|
||||
&& !prec_nodes[i]->succ)
|
||||
{
|
||||
if (is_assoc_useless (s))
|
||||
complain (&s->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
_("useless precedence and associativity for %s"), s->tag);
|
||||
else if (s->assoc == precedence_assoc)
|
||||
complain (&s->prec_location, Wprecedence,
|
||||
else if (s->content->assoc == precedence_assoc)
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
_("useless precedence for %s"), s->tag);
|
||||
}
|
||||
else if (is_assoc_useless (s))
|
||||
complain (&s->prec_location, Wprecedence,
|
||||
complain (&s->content->prec_location, Wprecedence,
|
||||
_("useless associativity for %s, use %%precedence"), s->tag);
|
||||
}
|
||||
free (used_assoc);
|
||||
|
||||
+15
-6
@@ -50,6 +50,7 @@ typedef int symbol_number;
|
||||
|
||||
|
||||
typedef struct symbol symbol;
|
||||
typedef struct sym_content sym_content;
|
||||
|
||||
/* Declaration status of a symbol.
|
||||
|
||||
@@ -82,8 +83,6 @@ enum code_props_type
|
||||
|
||||
enum { CODE_PROPS_SIZE = 2 };
|
||||
|
||||
/* When extending this structure, be sure to complete
|
||||
symbol_check_alias_consistency. */
|
||||
struct symbol
|
||||
{
|
||||
/** The key, name of the symbol. */
|
||||
@@ -91,6 +90,20 @@ struct symbol
|
||||
/** The location of its first occurrence. */
|
||||
location location;
|
||||
|
||||
/* Points to the other in the symbol-string pair for an alias. */
|
||||
symbol *alias;
|
||||
|
||||
/** Whether this symbol is the alias of another or not. */
|
||||
bool is_alias;
|
||||
|
||||
/** All the info about the pointed symbol is there. */
|
||||
sym_content *content;
|
||||
};
|
||||
|
||||
struct sym_content
|
||||
{
|
||||
symbol *symbol;
|
||||
|
||||
/** Its \c \%type.
|
||||
|
||||
Beware that this is the type_name as was entered by the user,
|
||||
@@ -117,10 +130,6 @@ struct symbol
|
||||
assoc assoc;
|
||||
int user_token_number;
|
||||
|
||||
/* Points to the other in the symbol-string pair for an alias.
|
||||
Special value USER_NUMBER_HAS_STRING_ALIAS in the symbol half of the
|
||||
symbol-string pair for an alias. */
|
||||
symbol *alias;
|
||||
symbol_class class;
|
||||
status status;
|
||||
};
|
||||
|
||||
+2
-2
@@ -290,7 +290,7 @@ action_row (state *s)
|
||||
|
||||
/* Do not use any default reduction if there is a shift for
|
||||
error */
|
||||
if (sym == errtoken->number)
|
||||
if (sym == errtoken->content->number)
|
||||
nodefault = true;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ action_row (state *s)
|
||||
for (i = 0; i < errp->num; i++)
|
||||
{
|
||||
symbol *sym = errp->symbols[i];
|
||||
actrow[sym->number] = ACTION_NUMBER_MINIMUM;
|
||||
actrow[sym->content->number] = ACTION_NUMBER_MINIMUM;
|
||||
}
|
||||
|
||||
/* Turn off default reductions where requested by the user. See
|
||||
|
||||
+1
-2
@@ -77,8 +77,7 @@ uniqstr_vsprintf (char const *format, ...)
|
||||
void
|
||||
uniqstr_assert (char const *str)
|
||||
{
|
||||
uniqstr s = hash_lookup (uniqstrs_table, str);
|
||||
if (!s || s != str)
|
||||
if (!hash_lookup (uniqstrs_table, str))
|
||||
{
|
||||
error (0, 0,
|
||||
"not a uniqstr: %s", quotearg (str));
|
||||
|
||||
+1
-3
@@ -20,8 +20,6 @@
|
||||
#ifndef UNIQSTR_H_
|
||||
# define UNIQSTR_H_
|
||||
|
||||
# include <stdio.h>
|
||||
|
||||
/*-----------------------------------------.
|
||||
| Pointers to unique copies of C strings. |
|
||||
`-----------------------------------------*/
|
||||
@@ -35,7 +33,7 @@ uniqstr uniqstr_new (char const *str);
|
||||
strings, use UNIQSTR_CONCAT, which is a convenient wrapper around
|
||||
this function. */
|
||||
uniqstr uniqstr_vsprintf (char const *format, ...)
|
||||
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 2);
|
||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
|
||||
/* Two uniqstr values have the same value iff they are the same. */
|
||||
# define UNIQSTR_EQ(Ustr1, Ustr2) (!!((Ustr1) == (Ustr2)))
|
||||
|
||||
+5
-5
@@ -596,7 +596,7 @@ thing:
|
||||
;
|
||||
%%
|
||||
/* Alias to ARGV[1]. */
|
||||
const char *source = YY_NULLPTR;
|
||||
const char *source = YY_NULL;
|
||||
|
||||
]AT_YYERROR_DEFINE[
|
||||
|
||||
@@ -1385,8 +1385,8 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_BISON_CHECK([-o input.c input.y], 0,,
|
||||
[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
|
||||
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||
@@ -1396,12 +1396,12 @@ AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||
input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
|
||||
%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
|
||||
^^^
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
{ @$ = 4; } // Only used.
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
{ USE ($$); @$ = 3; } // Only set.
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
{ @$ = 4; } // Only used.
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
]])
|
||||
|
||||
AT_COMPILE([input])
|
||||
|
||||
+2
-1
@@ -72,12 +72,13 @@ int main ()
|
||||
std::cout << "Works" << std::endl;
|
||||
}
|
||||
EOF
|
||||
ls
|
||||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
|
||||
case $? in
|
||||
0);;
|
||||
*) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
|
||||
esac
|
||||
rm -fr conftest*
|
||||
rm -f conftest*
|
||||
fi
|
||||
|
||||
# Whether the compiler supports POSIXLY_CORRECT defined.
|
||||
|
||||
+47
-62
@@ -174,10 +174,11 @@ AT_CLEANUP
|
||||
m4_pushdef([AT_TEST],
|
||||
[AT_SETUP([Variants $1])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS([%debug $1])
|
||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" %debug $1])
|
||||
# Store strings and integers in a list of strings.
|
||||
AT_DATA_GRAMMAR([list.y],
|
||||
[[%debug
|
||||
%skeleton "lalr1.cc"
|
||||
%define api.value.type variant
|
||||
]m4_bpatsubst([$1], [\\n], [
|
||||
])[
|
||||
@@ -243,7 +244,7 @@ typedef std::list<std::string> strings_type;
|
||||
// digraph for the left square bracket.
|
||||
%type <::std::list<std::string>> list result;
|
||||
|
||||
%printer { yyo << $$; }
|
||||
%printer { yyo << $][$; }
|
||||
<int> <::std::string> <::std::list<std::string>>;
|
||||
%%
|
||||
|
||||
@@ -253,13 +254,13 @@ result:
|
||||
|
||||
list:
|
||||
/* nothing */ { /* Generates an empty string list */ }
|
||||
| list item { std::swap ($$,$][1); $$.push_back ($][2); }
|
||||
| list error { std::swap ($$,$][1); }
|
||||
| list item { std::swap ($][$,$][1); $$.push_back ($][2); }
|
||||
| list error { std::swap ($][$,$][1); }
|
||||
;
|
||||
|
||||
item:
|
||||
TEXT { std::swap ($$,$][1); }
|
||||
| NUMBER { if ($][1 == 3) YYERROR; else $$ = string_cast ($][1); }
|
||||
TEXT { std::swap ($][$,$][1); }
|
||||
| NUMBER { if ($][1 == 3) YYERROR; else $][$ = string_cast ($][1); }
|
||||
;
|
||||
%%
|
||||
]AT_TOKEN_CTOR_IF([],
|
||||
@@ -319,13 +320,13 @@ AT_BISON_OPTION_POPDEFS
|
||||
AT_CLEANUP
|
||||
])
|
||||
|
||||
AT_TEST([[%skeleton "lalr1.cc" ]])
|
||||
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert]])
|
||||
AT_TEST([[%skeleton "lalr1.cc" %locations %define parse.assert]])
|
||||
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %code {\n#define TWO_STAGE_BUILD\n}]])
|
||||
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %define api.token.constructor]])
|
||||
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
||||
AT_TEST([[%skeleton "lalr1.cc" %locations %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
||||
AT_TEST([])
|
||||
AT_TEST([%define parse.assert])
|
||||
AT_TEST([%locations %define parse.assert])
|
||||
AT_TEST([[%define parse.assert %code {\n#define TWO_STAGE_BUILD\n}]])
|
||||
AT_TEST([[%define parse.assert %define api.token.constructor]])
|
||||
AT_TEST([[%define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
||||
AT_TEST([[%locations %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
||||
|
||||
m4_popdef([AT_TEST])
|
||||
|
||||
@@ -649,14 +650,11 @@ AT_CLEANUP
|
||||
## Exception safety. ##
|
||||
## ------------------ ##
|
||||
|
||||
# AT_TEST([BISON-DIRECTIVES = ''], [WITH-RECOVERY = "with"])
|
||||
# ----------------------------------------------------------
|
||||
# AT_TEST([BISON-DIRECTIVES])
|
||||
# ---------------------------
|
||||
# Check that no object is leaked when exceptions are thrown.
|
||||
# WITH-RECOVERY = "with" or "without".
|
||||
m4_pushdef([AT_TEST],
|
||||
[AT_SETUP([[Exception safety $2 error recovery $1]])
|
||||
|
||||
AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR
|
||||
[AT_SETUP([[Exception safety $1]])
|
||||
|
||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" $1])
|
||||
|
||||
@@ -670,43 +668,27 @@ $1
|
||||
#include <cassert>
|
||||
#include <cstdlib> // size_t and getenv.
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
bool debug = false;
|
||||
|
||||
/// A class that tracks its instances.
|
||||
/// A class that counts its number of instances.
|
||||
struct Object
|
||||
{
|
||||
char val;
|
||||
|
||||
Object ()
|
||||
: val ('?')
|
||||
{
|
||||
log (this, "Object::Object");
|
||||
Object::instances.insert (this);
|
||||
}
|
||||
|
||||
Object (const Object& that)
|
||||
: val (that.val)
|
||||
{
|
||||
log (this, "Object::Object");
|
||||
Object::instances.insert (this);
|
||||
}
|
||||
|
||||
Object (char v)
|
||||
: val (v)
|
||||
{
|
||||
Object::instances.push_back(this);
|
||||
log (this, "Object::Object");
|
||||
Object::instances.insert (this);
|
||||
}
|
||||
|
||||
~Object ()
|
||||
Object ()
|
||||
: val ('?')
|
||||
{
|
||||
log (this, "Object::~Object");
|
||||
objects::const_iterator i = instances.find (this);
|
||||
// Make sure this object is alive.
|
||||
assert (i != instances.end ());
|
||||
Object::instances.erase (i);
|
||||
Object::instances.push_back(this);
|
||||
log (this, "Object::Object");
|
||||
}
|
||||
|
||||
Object& operator= (char v)
|
||||
@@ -715,8 +697,14 @@ $1
|
||||
return *this;
|
||||
}
|
||||
|
||||
~Object ()
|
||||
{
|
||||
Object::instances.remove (this);
|
||||
log (this, "Object::~Object");
|
||||
}
|
||||
|
||||
// Static part.
|
||||
typedef std::set<const Object*> objects;
|
||||
typedef std::list<const Object*> objects;
|
||||
static objects instances;
|
||||
|
||||
static bool
|
||||
@@ -796,23 +784,22 @@ $1
|
||||
start: list {]AT_VARIANT_IF([], [ delete $][1]; )[};
|
||||
|
||||
list:
|
||||
item { $$ = $][1; }
|
||||
item { $][$ = $][1; }
|
||||
// Right recursion to load the stack.
|
||||
| item list { $$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
|
||||
| item list { $][$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
|
||||
;
|
||||
|
||||
item:
|
||||
'a' { $$ = $][1; }
|
||||
| 'e' { YYUSE ($$); YYUSE($][1); error ("syntax error"); }
|
||||
'a' { $$][ = $][1; }
|
||||
| 'e' { YYUSE ($][$); YYUSE($][1); error ("syntax error"); }
|
||||
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
|
||||
// then the stack is emptied, defeating the point of the test.
|
||||
| 'E' 'a' { YYUSE($][1); $$ = $][2; }
|
||||
| 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
|
||||
| 'p' { $$ = $][1; }
|
||||
| 's' { $$ = $][1; throw std::runtime_error ("reduction"); }
|
||||
| 'T' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
|
||||
]m4_if([$2], [with],
|
||||
[[| error { $$ = ]AT_VARIANT_IF([], [new ])[Object ('R'); yyerrok; }]])[
|
||||
| 'E' 'a' { YYUSE($][1); $][$ = $][2; }
|
||||
| 'R' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYERROR; }
|
||||
| 'p' { $][$ = $][1; }
|
||||
| 's' { $][$ = $][1; throw std::runtime_error ("reduction"); }
|
||||
| 'T' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYABORT; }
|
||||
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULL; ])[yyerrok; }
|
||||
;
|
||||
%%
|
||||
|
||||
@@ -832,8 +819,7 @@ yylex (yy::parser::semantic_type *lvalp)
|
||||
case 'l':
|
||||
throw std::runtime_error ("yylex");
|
||||
default:
|
||||
lvalp->]AT_VARIANT_IF([build (Object (res))],
|
||||
[obj = new Object (res)])[;
|
||||
lvalp]AT_VARIANT_IF([->build (res)], [->obj = new Object (res)])[;
|
||||
// Fall through.
|
||||
case 0:
|
||||
return res;
|
||||
@@ -880,7 +866,7 @@ main (int argc, const char *argv[])
|
||||
{
|
||||
std::cerr << "unknown exception caught" << std::endl;
|
||||
}
|
||||
Object::log (YY_NULLPTR, "end");
|
||||
Object::log (YY_NULL, "end");
|
||||
assert (Object::empty());
|
||||
return res;
|
||||
}
|
||||
@@ -915,17 +901,16 @@ AT_PARSER_CHECK([[./input aaaaE]], [[2]], [[]],
|
||||
|
||||
AT_PARSER_CHECK([[./input aaaaT]], [[1]])
|
||||
|
||||
AT_PARSER_CHECK([[./input aaaaR]], [m4_if([$2], [with], [0], [1])])
|
||||
# There is error-recovery, so exit success.
|
||||
AT_PARSER_CHECK([[./input aaaaR]], [[0]])
|
||||
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
AT_CLEANUP
|
||||
])
|
||||
|
||||
AT_TEST([], [with])
|
||||
AT_TEST([], [without])
|
||||
AT_TEST([%define api.value.type variant], [with])
|
||||
AT_TEST([%define api.value.type variant], [without])
|
||||
AT_TEST
|
||||
AT_TEST([%define api.value.type variant])
|
||||
|
||||
m4_popdef([AT_TEST])
|
||||
|
||||
|
||||
+35
-35
@@ -243,18 +243,18 @@ f: B
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
|
||||
[[input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
|
||||
%nonassoc U
|
||||
^^^^^^^^^
|
||||
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
|
||||
%right V
|
||||
^^^^^^
|
||||
[[input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
|
||||
%precedence Z
|
||||
^^^^^^^^^^^
|
||||
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
|
||||
%left W
|
||||
^^^^^
|
||||
input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
|
||||
%precedence Z
|
||||
^^^^^^^^^^^
|
||||
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
|
||||
%right V
|
||||
^^^^^^
|
||||
input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
|
||||
%nonassoc U
|
||||
^^^^^^^^^
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1006,8 +1006,8 @@ cond:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-o input.c input.y], 0, [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1050,8 +1050,8 @@ id : '0';
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-o input.c --report=all input.y], 0, [],
|
||||
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y:4.6-8: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
]])
|
||||
|
||||
# Check the contents of the report.
|
||||
@@ -1265,9 +1265,9 @@ e: e '+' e
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-Wall -o input.c input.y], 0, [],
|
||||
[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
|
||||
[[input.y:1.1-5: warning: useless precedence and associativity for '+' [-Wprecedence]
|
||||
input.y:2.1-5: warning: useless precedence and associativity for '*' [-Wprecedence]
|
||||
input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
|
||||
]])
|
||||
AT_CLEANUP
|
||||
|
||||
@@ -1369,15 +1369,15 @@ reported_conflicts:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[--report=all input.y]], 0, [],
|
||||
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y:12.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:20.5-20: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:21.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:25.13: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:25.16: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:31.5-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:32.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
|
||||
input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
]])
|
||||
|
||||
AT_CHECK([[cat input.output]], 0,
|
||||
@@ -1447,7 +1447,7 @@ State 0
|
||||
0 $accept: . start $end
|
||||
1 start: . resolved_conflict 'a' reported_conflicts 'a'
|
||||
2 resolved_conflict: . 'a' unreachable1
|
||||
3 | . %empty ['a']
|
||||
3 | . ['a']
|
||||
|
||||
$default reduce using rule 3 (resolved_conflict)
|
||||
|
||||
@@ -1483,7 +1483,7 @@ State 4
|
||||
1 start: resolved_conflict 'a' . reported_conflicts 'a'
|
||||
8 reported_conflicts: . 'a'
|
||||
9 | . 'a'
|
||||
10 | . %empty ['a']
|
||||
10 | . ['a']
|
||||
|
||||
'a' shift, and go to state 5
|
||||
|
||||
@@ -1522,12 +1522,12 @@ AT_DATA([[input-keep.y]],
|
||||
AT_CHECK([[cat input.y >> input-keep.y]])
|
||||
|
||||
AT_BISON_CHECK([[input-keep.y]], 0, [],
|
||||
[[input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input-keep.y:22.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:26.16: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:32.5-7: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y:33.4: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input-keep.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input-keep.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1576,11 +1576,11 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
||||
6 | . empty_c1 'c'
|
||||
7 | . empty_c2 'c'
|
||||
8 | . empty_c3 'c'
|
||||
9 empty_a: . %empty ['a']
|
||||
10 empty_b: . %empty []
|
||||
11 empty_c1: . %empty []
|
||||
12 empty_c2: . %empty []
|
||||
13 empty_c3: . %empty ['c']
|
||||
9 empty_a: . ['a']
|
||||
10 empty_b: . []
|
||||
11 empty_c1: . []
|
||||
12 empty_c2: . []
|
||||
13 empty_c3: . ['c']
|
||||
|
||||
'b' shift, and go to state 1
|
||||
|
||||
@@ -1652,11 +1652,11 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
||||
6 | . empty_c1 'c'
|
||||
7 | . empty_c2 'c'
|
||||
8 | . empty_c3 'c'
|
||||
9 empty_a: . %empty []
|
||||
10 empty_b: . %empty []
|
||||
11 empty_c1: . %empty []
|
||||
12 empty_c2: . %empty ['c']
|
||||
13 empty_c3: . %empty ['c']
|
||||
9 empty_a: . []
|
||||
10 empty_b: . []
|
||||
11 empty_c1: . []
|
||||
12 empty_c2: . ['c']
|
||||
13 empty_c3: . ['c']
|
||||
|
||||
'a' error (nonassociative)
|
||||
'b' error (nonassociative)
|
||||
@@ -1705,9 +1705,9 @@ exp: 'a' | 'a';
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[2.y]], [[0]], [],
|
||||
[[2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
|
||||
[[2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
||||
2.y: warning: %expect-rr applies only to GLR parsers [-Wother]
|
||||
2.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
|
||||
2.y:3.12-14: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+7
-7
@@ -94,19 +94,19 @@ prog :
|
||||
|
||||
stmt : expr ';' $2 { $$ = ]$[1; }
|
||||
| decl $3
|
||||
| error ';' { $$ = new_nterm ("<error>", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); }
|
||||
| error ';' { $$ = new_nterm ("<error>", YY_NULL, YY_NULL, YY_NULL); }
|
||||
| '@' { YYACCEPT; }
|
||||
;
|
||||
|
||||
expr : ID
|
||||
| TYPENAME '(' expr ')'
|
||||
{ $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, YY_NULLPTR); }
|
||||
| expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); }
|
||||
| expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); }
|
||||
{ $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, YY_NULL); }
|
||||
| expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULL); }
|
||||
| expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULL); }
|
||||
;
|
||||
|
||||
decl : TYPENAME declarator ';'
|
||||
{ $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, YY_NULLPTR); }
|
||||
{ $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, YY_NULL); }
|
||||
| TYPENAME declarator '=' expr ';'
|
||||
{ $$ = new_nterm ("<init-declare>(%s,%s,%s)", ]$[1,
|
||||
]$[2, ]$[4); }
|
||||
@@ -195,7 +195,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
colNum += 1;
|
||||
tok = c;
|
||||
yylval = YY_NULLPTR;
|
||||
yylval = YY_NULL;
|
||||
}]AT_LOCATION_IF([[
|
||||
yylloc.last_column = colNum-1;]])[
|
||||
return tok;
|
||||
@@ -287,7 +287,7 @@ m4_bmatch([$2], [stmtMerge],
|
||||
[[static YYSTYPE
|
||||
stmtMerge (YYSTYPE x0, YYSTYPE x1)
|
||||
{
|
||||
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULLPTR);
|
||||
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULL);
|
||||
}
|
||||
]])
|
||||
)
|
||||
|
||||
+84
-84
@@ -426,7 +426,25 @@ dnl don't like even 'print $!4;'.
|
||||
[[LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';']],
|
||||
|
||||
dnl BISON-STDERR
|
||||
[[input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
[[input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
|
||||
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
|
||||
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
|
||||
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
|
||||
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
|
||||
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
|
||||
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
|
||||
input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:169.8: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:174.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:179.13: warning: empty rule without %empty [-Wempty-rule]
|
||||
@@ -439,24 +457,6 @@ input.y:322.9: warning: empty rule without %empty [-Wempty-rule]
|
||||
]AT_COND_CASE([[canonical LR]],
|
||||
[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
|
||||
[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
|
||||
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
|
||||
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
|
||||
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
|
||||
input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
|
||||
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
|
||||
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
|
||||
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
|
||||
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
|
||||
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
|
||||
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
|
||||
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
|
||||
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
|
||||
]],
|
||||
|
||||
dnl LAST-STATE
|
||||
@@ -1395,7 +1395,13 @@ dnl INPUT
|
||||
[[]],
|
||||
|
||||
dnl BISON-STDERR
|
||||
[[input.y:128.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
[[input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
|
||||
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
|
||||
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
|
||||
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
|
||||
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
|
||||
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
|
||||
input.y:128.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:137.10: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:142.8: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:161.15: warning: empty rule without %empty [-Wempty-rule]
|
||||
@@ -1422,12 +1428,6 @@ input.y:591.14: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
|
||||
[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
|
||||
input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
|
||||
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
|
||||
input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
|
||||
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
|
||||
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
|
||||
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
|
||||
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
|
||||
]],
|
||||
|
||||
dnl LAST-STATE
|
||||
@@ -2009,57 +2009,27 @@ dnl without being followed by "of".)
|
||||
[[VARIABLE, '=', LABEL, LEFT, DOT_X]],
|
||||
|
||||
dnl BISON-STDERR
|
||||
[[input.y:202.19: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:270.6: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:292.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:309.17: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:382.13: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
|
||||
[[input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
|
||||
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence]
|
||||
input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
|
||||
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
|
||||
input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence]
|
||||
@@ -2071,12 +2041,43 @@ input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wpr
|
||||
input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence]
|
||||
input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence]
|
||||
input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence]
|
||||
@@ -2084,18 +2085,17 @@ input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wpre
|
||||
input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence]
|
||||
input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence]
|
||||
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
|
||||
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
|
||||
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
|
||||
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
|
||||
input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
|
||||
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
|
||||
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
|
||||
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
|
||||
input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
|
||||
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
|
||||
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
|
||||
input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
|
||||
input.y:202.19: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:270.6: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:292.12: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:309.17: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:382.13: warning: empty rule without %empty [-Wempty-rule]
|
||||
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
|
||||
]],
|
||||
|
||||
dnl LAST-STATE
|
||||
|
||||
+2
-32
@@ -67,7 +67,7 @@ static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *input = YY_NULLPTR;
|
||||
const char *input = YY_NULL;
|
||||
|
||||
int
|
||||
main (int argc, const char* argv[])
|
||||
@@ -304,7 +304,7 @@ MergeRule (int x0, int x1)
|
||||
}
|
||||
]AT_YYERROR_DEFINE[
|
||||
|
||||
FILE *input = YY_NULLPTR;
|
||||
FILE *input = YY_NULL;
|
||||
|
||||
int P[] = { P1, P2 };
|
||||
int O[] = { O1, O2 };
|
||||
@@ -1749,33 +1749,3 @@ Cleanup: popping token 'a' ()
|
||||
])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ----------------------------------------------------------------- ##
|
||||
## Predicates. ##
|
||||
## ##
|
||||
## http://lists.gnu.org/archive/html/bug-bison/2013-10/msg00004.html ##
|
||||
## ----------------------------------------------------------------- ##
|
||||
|
||||
AT_SETUP([Predicates])
|
||||
|
||||
# FIXME: We need genuine test cases with uses of %?.
|
||||
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[[%glr-parser
|
||||
%expect-rr 1
|
||||
%%
|
||||
// Exercise "%?{...}" and "%? {...}".
|
||||
widget:
|
||||
%? {new_syntax} "widget" id new_args { $$ = f($3, $4); }
|
||||
| %?{!new_syntax} "widget" id old_args { $$ = f($3, $4); }
|
||||
;
|
||||
id:;
|
||||
new_args:;
|
||||
old_args:;
|
||||
%%
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+2
-6
@@ -223,13 +223,9 @@ AT_CHECK([[$PERL -n -0777 -e '
|
||||
s{/\*.*?\*/}{}gs;
|
||||
s{//.*}{}g;
|
||||
s{\b(YYChar
|
||||
|YYPUSH_MORE(?:_DEFINED)?
|
||||
|YYUSE
|
||||
|YY_ATTRIBUTE(?:_PURE|_UNUSED)?
|
||||
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|
||||
|YY_INITIAL_VALUE
|
||||
|YYPUSH_MORE(_DEFINED)?
|
||||
|YY_\w+_INCLUDED
|
||||
|YY_NULLPTR
|
||||
|YY_NULL
|
||||
|(defined|if)\ YYDEBUG
|
||||
)\b}{}gx;
|
||||
while (/^(.*YY.*)$/gm)
|
||||
|
||||
+75
-81
@@ -142,15 +142,15 @@ exp: foo { $$; } foo { $2; } foo
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
||||
[[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
|
||||
[[input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^
|
||||
input.y:5.24-25: error: $2 of 'exp' has no declared type
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^
|
||||
input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
|
||||
exp: foo { $$; } foo { $2; } foo
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
|
||||
| foo
|
||||
^^^
|
||||
@@ -208,12 +208,12 @@ _AT_UNUSED_VALUES_DECLARATIONS])
|
||||
|
||||
AT_BISON_CHECK(m4_ifval($2, [--warnings=midrule-values ])[-fcaret input.y],
|
||||
[0], [],
|
||||
[[input.y:11.10-32: warning: unset value: $][$ [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:11.10-12: warning: unused value: $][1 [-Wother]
|
||||
[[input.y:11.10-12: warning: unused value: $][1 [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^
|
||||
input.y:11.10-32: warning: unset value: $][$ [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:11.18-20: warning: unused value: $][3 [-Wother]
|
||||
a: INT | INT { } INT { } INT { };
|
||||
^^^
|
||||
@@ -223,28 +223,28 @@ input.y:11.26-28: warning: unused value: $][5 [-Wother]
|
||||
input.y:12.10-15: warning: empty rule for typed nonterminal, and no action [-Wother]
|
||||
b: INT | %empty;
|
||||
^^^^^^
|
||||
input.y:13.10-62: warning: unset value: $][$ [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
]]m4_ifval($2, [[[input.y:13.14-20: warning: unset value: $][$ [-Wmidrule-values]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^
|
||||
input.y:13.26-41: warning: unset value: $][$ [-Wmidrule-values]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^
|
||||
]]])[[input.y:13.10-62: warning: unset value: $][$ [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:13.22-24: warning: unused value: $][3 [-Wother]
|
||||
]]])[[input.y:13.22-24: warning: unused value: $][3 [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^
|
||||
input.y:13.43-45: warning: unused value: $][5 [-Wother]
|
||||
]]m4_ifval($2, [[[input.y:13.26-41: warning: unset value: $][$ [-Wmidrule-values]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^^^^^^^^^^^^^^
|
||||
]]])[[input.y:13.43-45: warning: unused value: $][5 [-Wother]
|
||||
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
|
||||
^^^
|
||||
input.y:14.10-49: warning: unset value: $][$ [-Wother]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
]]m4_ifval($2, [[[input.y:14.14-16: warning: unset value: $][$ [-Wmidrule-values]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^
|
||||
]]])[[input.y:14.10-49: warning: unset value: $][$ [-Wother]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:14.18-20: warning: unused value: $][3 [-Wother]
|
||||
]]])[[input.y:14.18-20: warning: unused value: $][3 [-Wother]
|
||||
d: INT | INT { } INT { $][1; } INT { $<integer>2; };
|
||||
^^^
|
||||
input.y:14.30-32: warning: unused value: $][5 [-Wother]
|
||||
@@ -259,12 +259,12 @@ input.y:15.18-20: warning: unused value: $][3 [-Wother]
|
||||
input.y:15.27-29: warning: unused value: $][5 [-Wother]
|
||||
e: INT | INT { } INT { } INT { $][1; };
|
||||
^^^
|
||||
input.y:17.10-58: warning: unset value: $][$ [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:17.10-12: warning: unused value: $][1 [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^
|
||||
input.y:17.10-58: warning: unset value: $][$ [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
]]m4_ifval($2, [[[input.y:17.14-29: warning: unused value: $][2 [-Wmidrule-values]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^^^^^^^^^^^^^^
|
||||
@@ -277,12 +277,12 @@ input.y:17.10-12: warning: unused value: $][1 [-Wother]
|
||||
]]])[[input.y:17.52-54: warning: unused value: $][5 [-Wother]
|
||||
g: INT | INT { $<integer>$; } INT { $<integer>$; } INT { };
|
||||
^^^
|
||||
input.y:18.10-72: warning: unset value: $][$ [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:18.10-12: warning: unused value: $][1 [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^
|
||||
input.y:18.10-72: warning: unset value: $][$ [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:18.31-33: warning: unused value: $][3 [-Wother]
|
||||
h: INT | INT { $<integer>$; } INT { $<integer>$ = $<integer>2; } INT { };
|
||||
^^^
|
||||
@@ -295,12 +295,12 @@ input.y:18.31-33: warning: unused value: $][3 [-Wother]
|
||||
]]m4_ifval($2, [[[input.y:20.18-37: warning: unused value: $][3 [-Wmidrule-values]
|
||||
j: INT | INT INT { $<integer>$ = 1; } { $][$ = $][1 + $][2; };
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
]]])[[input.y:21.10-68: warning: unset value: $][$ [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:21.10-12: warning: unused value: $][1 [-Wother]
|
||||
]]])[[input.y:21.10-12: warning: unused value: $][1 [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^
|
||||
input.y:21.10-68: warning: unset value: $][$ [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
input.y:21.14-16: warning: unused value: $][2 [-Wother]
|
||||
k: INT | INT INT { $<integer>$; } { $<integer>$ = $<integer>3; } { };
|
||||
^^^
|
||||
@@ -458,15 +458,15 @@ exp: bar;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
||||
[[input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
|
||||
%destructor {} bar
|
||||
^^^
|
||||
[[input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
|
||||
%printer {} foo baz
|
||||
^^^
|
||||
input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother]
|
||||
%printer {} foo baz
|
||||
^^^
|
||||
input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother]
|
||||
%printer {} foo baz
|
||||
^^^
|
||||
input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules
|
||||
%destructor {} bar
|
||||
^^^
|
||||
input.y:3.13-15: warning: symbol qux is used, but is not defined as a token and has no rules [-Wother]
|
||||
%type <foo> qux
|
||||
^^^
|
||||
@@ -672,25 +672,25 @@ exp: foo;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
||||
[[input.y:8.7-11: error: %type redeclaration for foo
|
||||
[[input.y:8.7-11: error: %type redeclaration for "foo"
|
||||
%type <baz> "foo"
|
||||
^^^^^
|
||||
input.y:3.7-11: previous declaration
|
||||
%type <bar> foo
|
||||
^^^^^
|
||||
input.y:10.13-17: error: %destructor redeclaration for foo
|
||||
%destructor {baz} "foo"
|
||||
^^^^^
|
||||
input.y:5.13-17: previous declaration
|
||||
%destructor {bar} foo
|
||||
^^^^^
|
||||
input.y:9.10-14: error: %printer redeclaration for foo
|
||||
input.y:9.10-14: error: %printer redeclaration for "foo"
|
||||
%printer {baz} "foo"
|
||||
^^^^^
|
||||
input.y:4.10-14: previous declaration
|
||||
%printer {bar} foo
|
||||
^^^^^
|
||||
input.y:11.1-5: error: %left redeclaration for foo
|
||||
input.y:10.13-17: error: %destructor redeclaration for "foo"
|
||||
%destructor {baz} "foo"
|
||||
^^^^^
|
||||
input.y:5.13-17: previous declaration
|
||||
%destructor {bar} foo
|
||||
^^^^^
|
||||
input.y:11.1-5: error: %left redeclaration for "foo"
|
||||
%left "foo"
|
||||
^^^^^
|
||||
input.y:6.1-5: previous declaration
|
||||
@@ -956,9 +956,15 @@ without_period: "WITHOUT.PERIOD";
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
# POSIX Yacc accept periods, but not dashes.
|
||||
AT_BISON_CHECK([--yacc input.y], [1], [],
|
||||
[[input.y:9.8-16: error: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Werror=yacc]
|
||||
input.y:20.8-16: error: POSIX Yacc forbids dashes in symbol names: with-dash [-Werror=yacc]
|
||||
AT_BISON_CHECK([--yacc -Wno-error input.y], [], [],
|
||||
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
|
||||
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
|
||||
]])
|
||||
|
||||
# So warn about them.
|
||||
AT_BISON_CHECK([-Wyacc input.y], [], [],
|
||||
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
|
||||
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
|
||||
]])
|
||||
|
||||
# Dashes are fine for GNU Bison.
|
||||
@@ -1411,9 +1417,9 @@ start: TOK;
|
||||
|
||||
AT_BISON_CHECK([[input.yy]], [0], [],
|
||||
[[input.yy:2.9-25: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:4.9-18: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:5.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
|
||||
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
|
||||
]])
|
||||
])
|
||||
|
||||
@@ -1442,11 +1448,11 @@ exp: %empty
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], [0], [],
|
||||
[[input.y:5.9-15: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated]
|
||||
[[input.y:1.9-16: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated]
|
||||
input.y:2.9-21: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated]
|
||||
input.y:3.9-28: warning: %define variable 'lr.default-reduction' requires keyword values [-Wdeprecated]
|
||||
input.y:4.9-33: warning: %define variable 'lr.keep-unreachable-state' requires keyword values [-Wdeprecated]
|
||||
input.y:2.9-21: warning: %define variable 'api.push-pull' requires keyword values [-Wdeprecated]
|
||||
input.y:1.9-16: warning: %define variable 'api.pure' requires keyword values [-Wdeprecated]
|
||||
input.y:5.9-15: warning: %define variable 'lr.type' requires keyword values [-Wdeprecated]
|
||||
]])
|
||||
])
|
||||
|
||||
@@ -1711,26 +1717,26 @@ AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
||||
|| exit 77]])
|
||||
|
||||
AT_BISON_CHECK([input.y], [1], [],
|
||||
[[input.y:2.9-12: error: invalid number after \-escape: 777
|
||||
input.y:2.8-13: warning: empty character literal [-Wother]
|
||||
input.y:2.16-17: error: invalid number after \-escape: 0
|
||||
[[input.y:2.8-13: warning: empty character literal [-Wother]
|
||||
input.y:2.9-12: error: invalid number after \-escape: 777
|
||||
input.y:2.15-18: warning: empty character literal [-Wother]
|
||||
input.y:2.21-25: error: invalid number after \-escape: xfff
|
||||
input.y:2.16-17: error: invalid number after \-escape: 0
|
||||
input.y:2.20-26: warning: empty character literal [-Wother]
|
||||
input.y:2.29-31: error: invalid number after \-escape: x0
|
||||
input.y:2.21-25: error: invalid number after \-escape: xfff
|
||||
input.y:2.28-32: warning: empty character literal [-Wother]
|
||||
input.y:3.9-14: error: invalid number after \-escape: uffff
|
||||
input.y:2.29-31: error: invalid number after \-escape: x0
|
||||
input.y:3.8-15: warning: empty character literal [-Wother]
|
||||
input.y:3.18-23: error: invalid number after \-escape: u0000
|
||||
input.y:3.9-14: error: invalid number after \-escape: uffff
|
||||
input.y:3.17-24: warning: empty character literal [-Wother]
|
||||
input.y:3.27-36: error: invalid number after \-escape: Uffffffff
|
||||
input.y:3.18-23: error: invalid number after \-escape: u0000
|
||||
input.y:3.26-37: warning: empty character literal [-Wother]
|
||||
input.y:3.40-49: error: invalid number after \-escape: U00000000
|
||||
input.y:3.27-36: error: invalid number after \-escape: Uffffffff
|
||||
input.y:3.39-50: warning: empty character literal [-Wother]
|
||||
input.y:4.9-10: error: invalid character after \-escape: ' '
|
||||
input.y:3.40-49: error: invalid number after \-escape: U00000000
|
||||
input.y:4.8-11: warning: empty character literal [-Wother]
|
||||
input.y:4.14-15: error: invalid character after \-escape: A
|
||||
input.y:4.9-10: error: invalid character after \-escape: ' '
|
||||
input.y:4.13-16: warning: empty character literal [-Wother]
|
||||
input.y:4.14-15: error: invalid character after \-escape: A
|
||||
input.y:5.9-16: error: invalid character after \-escape: \t
|
||||
input.y:5.17: error: invalid character after \-escape: \f
|
||||
input.y:5.18: error: invalid character after \-escape: \0
|
||||
@@ -1762,11 +1768,11 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## ---------------------- ##
|
||||
## -Werror combinations. ##
|
||||
## ---------------------- ##
|
||||
## --------------------------------------------- ##
|
||||
## -Werror is not affected by -Wnone and -Wall. ##
|
||||
## --------------------------------------------- ##
|
||||
|
||||
AT_SETUP([[-Werror combinations]])
|
||||
AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%%
|
||||
@@ -1792,18 +1798,6 @@ AT_BISON_CHECK([[-Werror,no-all,other input.y]], [[1]], [[]],
|
||||
[[input.y:2.15: error: stray '$' [-Werror=other]
|
||||
]])
|
||||
|
||||
# Check that -Wno-error keeps warnings enabled, but non fatal.
|
||||
AT_BISON_CHECK([[-Werror -Wno-error=other input.y]], [[0]], [[]],
|
||||
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Wno-error=other -Werror input.y]], [[0]], [[]],
|
||||
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Werror=other -Wno-other input.y]], [[0]], [[]],
|
||||
[[]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
@@ -2013,12 +2007,12 @@ AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
||||
input.y:11.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
|
||||
input.y:12.15-24: warning: deprecated directive: '%expect_rr', use '%expect-rr' [-Wdeprecated]
|
||||
input.y:13.1-14: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:13.11-21: error: %define variable 'parse.error' redefined
|
||||
input.y:13-6: previous definition
|
||||
input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:13.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
input.y:14.11-21: error: %define variable 'parse.error' redefined
|
||||
input.y:13.11-21: previous definition
|
||||
input.y:14.16-29: warning: deprecated directive: '%error_verbose', use '%define parse.error verbose' [-Wdeprecated]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
+4
-9
@@ -725,23 +725,18 @@ AT_CLEANUP
|
||||
|
||||
AT_SETUP([Java constructor init and init_throws])
|
||||
|
||||
m4_pushdef([AT_Witness],
|
||||
[super("Test Thread"); if (true) throw new InterruptedException();])
|
||||
|
||||
AT_CHECK_JAVA_MINIMAL([[
|
||||
%define extends {Thread}
|
||||
%code init { ]AT_Witness[ }
|
||||
%code init { super("Test Thread"); if (true) throw new InterruptedException(); }
|
||||
%define init_throws {InterruptedException}
|
||||
%lex-param {int lex_param}]])
|
||||
AT_CHECK([[grep ']AT_Witness[' YYParser.java]], 0, [ignore])
|
||||
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
|
||||
|
||||
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
||||
%define extends {Thread}
|
||||
%code init { ]AT_Witness[ }
|
||||
%code init { super("Test Thread"); if (true) throw new InterruptedException(); }
|
||||
%define init_throws {InterruptedException}]], [], [[return EOF;]])
|
||||
AT_CHECK([[grep ']AT_Witness[' YYParser.java]], 0, [ignore])
|
||||
|
||||
m4_popdef([AT_Witness])
|
||||
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
+1
-47
@@ -635,12 +635,9 @@ m4_define([AT_BISON_CHECK_],
|
||||
# ----------------------------------------------------------
|
||||
# Check that warnings (if some are expected) are correctly
|
||||
# turned into errors with -Werror, etc.
|
||||
#
|
||||
# When -Wno-error is used, the rules are really different, don't try.
|
||||
m4_define([AT_BISON_CHECK_WARNINGS],
|
||||
[m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
|
||||
m4_bregexp([$1], [-Wno-error=]), [-1],
|
||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||
|
||||
m4_define([AT_BISON_CHECK_WARNINGS_],
|
||||
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
|
||||
@@ -875,49 +872,6 @@ AT_PARSER_CHECK([./c-and-cxx])
|
||||
])
|
||||
|
||||
|
||||
# AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR
|
||||
# ------------------------------------
|
||||
# Check that we can expect exceptions to be handled properly.
|
||||
# GCC 4.3 and 4.4 fail https://trac.macports.org/ticket/40853.
|
||||
m4_define([AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR],
|
||||
[AT_DATA_SOURCE([exception.cc],
|
||||
[[#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
void foo()
|
||||
{
|
||||
try
|
||||
{
|
||||
throw std::runtime_error("foo");
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Inner caught" << std::endl;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
foo();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << "Outer caught" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
]])
|
||||
AT_COMPILE_CXX([exception])
|
||||
# The "empty" quadrigraph is to protect from cfg.mk's
|
||||
# sc_at_parser_check.
|
||||
AT_CHECK([@&t@./exception || exit 77], [0], [], [ignore])
|
||||
])
|
||||
|
||||
|
||||
## ---------------------------- ##
|
||||
## Running a generated parser. ##
|
||||
## ---------------------------- ##
|
||||
|
||||
+1
-4
@@ -85,7 +85,7 @@ $(TESTSUITE): $(TESTSUITE_AT)
|
||||
# Move into tests/ so that testsuite.dir etc. be created there.
|
||||
RUN_TESTSUITE = $(TESTSUITE) -C tests $(TESTSUITEFLAGS)
|
||||
check_SCRIPTS = $(BISON) tests/atconfig tests/atlocal
|
||||
RUN_TESTSUITE_deps = all $(TESTSUITE) $(check_SCRIPTS)
|
||||
RUN_TESTSUITE_deps = $(TESTSUITE) $(check_SCRIPTS)
|
||||
|
||||
clean-local: clean-local-tests
|
||||
clean-local-tests:
|
||||
@@ -126,6 +126,3 @@ maintainer-push-check:
|
||||
maintainer-xml-check:
|
||||
$(MAKE) $(AM_MAKEFLAGS) maintainer-check \
|
||||
TESTSUITEFLAGS='BISON_TEST_XML=1 $(TESTSUITEFLAGS)'
|
||||
|
||||
.PHONY: maintainer-release-check
|
||||
maintainer-release-check: maintainer-check maintainer-push-check maintainer-xml-check
|
||||
|
||||
+19
-38
@@ -17,23 +17,12 @@
|
||||
|
||||
AT_BANNER([[Output file names.]])
|
||||
|
||||
# AT_CHECK_FILES(EXPECTED-FILES, [IGNORED-FILES])
|
||||
# -----------------------------------------------
|
||||
# Check that the current directory contains FILE... (sorted).
|
||||
m4_define([AT_CHECK_FILES],
|
||||
[AT_CHECK([[find . -type f |
|
||||
$PERL -ne '
|
||||
s,\./,,; chomp;
|
||||
push @file, $_ unless m{^($2|testsuite.log)$};
|
||||
END { print join (" ", sort @file), "\n" }']],
|
||||
[], [$1
|
||||
])])
|
||||
|
||||
# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [STATUS],
|
||||
# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [SHELLIO],
|
||||
# [ADDITIONAL-TESTS], [PRE-TESTS])
|
||||
# -----------------------------------------------------------------------------
|
||||
m4_define([AT_CHECK_OUTPUT],
|
||||
[AT_SETUP([[Output files: ]$2 $3])[
|
||||
[AT_SETUP([[Output files: ]$2 $3 $5])[
|
||||
]$7[
|
||||
for file in ]$1 $4[; do
|
||||
case $file in
|
||||
@@ -43,12 +32,18 @@ done
|
||||
]AT_DATA([$1],
|
||||
[$2[
|
||||
%%
|
||||
foo: %empty {};
|
||||
foo: {};
|
||||
]])[
|
||||
|
||||
]AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
|
||||
]AT_BISON_CHECK([$3 $1 $5], 0)[
|
||||
# Ignore the files non-generated files
|
||||
]AT_CHECK_FILES([$4], [$1])[
|
||||
]AT_CHECK([[find . -type f |
|
||||
$PERL -ne '
|
||||
s,\./,,; chomp;
|
||||
push @file, $_ unless m{^($1|testsuite.log)$};
|
||||
END { print join (" ", sort @file), "\n" }']],
|
||||
[], [$4
|
||||
])[
|
||||
]$6[
|
||||
]AT_CLEANUP[
|
||||
]])
|
||||
@@ -59,9 +54,9 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv],
|
||||
# Some versions of Valgrind (at least valgrind-3.6.0.SVN-Debian) report
|
||||
# "fgrep: write error: Bad file descriptor" when stdout is closed, so we
|
||||
# skip this test group during maintainer-check-valgrind.
|
||||
AT_CHECK_OUTPUT([foo.y], [], [-dv >&-],
|
||||
AT_CHECK_OUTPUT([foo.y], [], [-dv],
|
||||
[foo.output foo.tab.c foo.tab.h],
|
||||
[], [],
|
||||
[>&-], [],
|
||||
[AT_CHECK([[case "$PREBISON" in *valgrind*) exit 77;; esac]])])
|
||||
|
||||
AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
|
||||
@@ -119,20 +114,6 @@ AT_CHECK_OUTPUT([foo.yy], [],
|
||||
[-o foo.c++ --graph=foo.gph],
|
||||
[foo.c++ foo.gph])
|
||||
|
||||
# Do not generate code when there are early errors (even warnings as
|
||||
# errors).
|
||||
AT_CHECK_OUTPUT([foo.y], [%type <foo> useless],
|
||||
[--defines --graph --xml --report=all -Wall -Werror],
|
||||
[foo.dot foo.output foo.xml],
|
||||
[1])
|
||||
|
||||
# Do not generate code when there are late errors (even warnings as
|
||||
# errors).
|
||||
AT_CHECK_OUTPUT([foo.y], [%define useless],
|
||||
[--defines --graph --xml --report=all -Wall -Werror],
|
||||
[foo.dot foo.output foo.xml],
|
||||
[1])
|
||||
|
||||
|
||||
## ------------ ##
|
||||
## C++ output. ##
|
||||
@@ -309,7 +290,7 @@ a: ;
|
||||
b: 'b';
|
||||
]],
|
||||
[[
|
||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: . %empty\l"]
|
||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: .\l"]
|
||||
0 -> 1 [style=dashed label="exp"]
|
||||
0 -> 2 [style=dashed label="a"]
|
||||
0 -> "0R2" [style=solid]
|
||||
@@ -351,7 +332,7 @@ empty_b: %prec 'b';
|
||||
empty_c: %prec 'c';
|
||||
]],
|
||||
[[
|
||||
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . %empty ['a']\l 8 empty_b: . %empty ['b']\l 9 empty_c: . %empty ['c']\l"]
|
||||
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . ['b']\l 9 empty_c: . ['c']\l"]
|
||||
0 -> 1 [style=solid label="'a'"]
|
||||
0 -> 2 [style=solid label="'b'"]
|
||||
0 -> 3 [style=solid label="'c'"]
|
||||
@@ -418,7 +399,7 @@ empty_b: %prec 'b';
|
||||
empty_c: %prec 'c';
|
||||
]],
|
||||
[[
|
||||
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . %empty ['a']\l 8 empty_b: . %empty []\l 9 empty_c: . %empty []\l"]
|
||||
0 [label="State 0\n\l 0 $accept: . start $end\l 1 start: . 'a'\l 2 | . empty_a 'a'\l 3 | . 'b'\l 4 | . empty_b 'b'\l 5 | . 'c'\l 6 | . empty_c 'c'\l 7 empty_a: . ['a']\l 8 empty_b: . []\l 9 empty_c: . []\l"]
|
||||
0 -> 1 [style=solid label="'b'"]
|
||||
0 -> 2 [style=solid label="'c'"]
|
||||
0 -> 3 [style=dashed label="start"]
|
||||
@@ -466,7 +447,7 @@ a: ;
|
||||
b: ;
|
||||
]],
|
||||
[[
|
||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a\l 2 | . b\l 3 a: . %empty [$end]\l 4 b: . %empty [$end]\l"]
|
||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a\l 2 | . b\l 3 a: . [$end]\l 4 b: . [$end]\l"]
|
||||
0 -> 1 [style=dashed label="exp"]
|
||||
0 -> 2 [style=dashed label="a"]
|
||||
0 -> 3 [style=dashed label="b"]
|
||||
@@ -499,7 +480,7 @@ b: ;
|
||||
c: ;
|
||||
]],
|
||||
[[
|
||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a ';'\l 2 | . a ';'\l 3 | . a '.'\l 4 | . b '?'\l 5 | . b '!'\l 6 | . c '?'\l 7 | . c ';'\l 8 a: . %empty [';', '.']\l 9 b: . %empty ['?', '!']\l 10 c: . %empty [';', '?']\l"]
|
||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a ';'\l 2 | . a ';'\l 3 | . a '.'\l 4 | . b '?'\l 5 | . b '!'\l 6 | . c '?'\l 7 | . c ';'\l 8 a: . [';', '.']\l 9 b: . ['?', '!']\l 10 c: . [';', '?']\l"]
|
||||
0 -> 1 [style=dashed label="exp"]
|
||||
0 -> 2 [style=dashed label="a"]
|
||||
0 -> 3 [style=dashed label="b"]
|
||||
@@ -614,7 +595,7 @@ imm: '0';
|
||||
"11R7d" [label="R7", fillcolor=5, shape=diamond, style=filled]
|
||||
11 -> "11R7" [style=solid]
|
||||
"11R7" [label="R7", fillcolor=3, shape=diamond, style=filled]
|
||||
12 [label="State 12\n\l 4 ifexp: \"if\" exp \"then\" exp . elseexp\l 5 elseexp: . \"else\" exp\l 6 | . %empty [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"]
|
||||
12 [label="State 12\n\l 4 ifexp: \"if\" exp \"then\" exp . elseexp\l 5 elseexp: . \"else\" exp\l 6 | . [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"]
|
||||
12 -> 13 [style=solid label="\"else\""]
|
||||
12 -> 9 [style=solid label="'+'"]
|
||||
12 -> 14 [style=dashed label="elseexp"]
|
||||
|
||||
+5
-5
@@ -57,12 +57,12 @@ main (void)
|
||||
/* yypstate_delete used to leak ps->yyss if the stack was reallocated but the
|
||||
parse did not return on success, syntax error, or memory exhaustion. */
|
||||
ps = yypstate_new ();
|
||||
assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
|
||||
assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
|
||||
yypstate_delete (ps);
|
||||
|
||||
ps = yypstate_new ();
|
||||
assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
|
||||
assert (yypush_parse (ps, 'b', YY_NULLPTR) == YYPUSH_MORE);
|
||||
assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
|
||||
assert (yypush_parse (ps, 'b', YY_NULL) == YYPUSH_MORE);
|
||||
yypstate_delete (ps);
|
||||
|
||||
return 0;
|
||||
@@ -111,11 +111,11 @@ main (void)
|
||||
{
|
||||
yypstate *ps = yypstate_new ();
|
||||
assert (ps);
|
||||
assert (yypstate_new () == YY_NULLPTR);
|
||||
assert (yypstate_new () == YY_NULL);
|
||||
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
|
||||
yychar = 0;
|
||||
assert (yypush_parse (ps) == 0);
|
||||
assert (yypstate_new () == YY_NULLPTR);
|
||||
assert (yypstate_new () == YY_NULL);
|
||||
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
|
||||
yypstate_delete (ps);
|
||||
}
|
||||
|
||||
+46
-46
@@ -88,8 +88,7 @@ exp: useful;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 0, [],
|
||||
[[input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
input.y:4.8-15: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
[[input.y:4.8-15: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
input.y:5.8-15: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||
input.y:6.8-15: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||
input.y:7.8-15: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||
@@ -98,6 +97,7 @@ input.y:9.8-15: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||
input.y:10.8-15: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||
input.y:11.8-15: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||
input.y:12.8-15: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||
input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
|
||||
@@ -143,62 +143,62 @@ useless9: '9';
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret input.y]], 0, [],
|
||||
[[input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 9 rules useless in grammar [-Wother]
|
||||
input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
[[input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||
useless1: '1';
|
||||
^^^^^^^^
|
||||
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||
useless2: '2';
|
||||
^^^^^^^^
|
||||
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||
useless3: '3';
|
||||
^^^^^^^^
|
||||
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||
useless4: '4';
|
||||
^^^^^^^^
|
||||
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
|
||||
useless5: '5';
|
||||
^^^^^^^^
|
||||
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||
useless6: '6';
|
||||
^^^^^^^^
|
||||
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||
useless7: '7';
|
||||
^^^^^^^^
|
||||
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||
useless8: '8';
|
||||
^^^^^^^^
|
||||
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||
useless9: '9';
|
||||
^^^^^^^^
|
||||
input.y:6.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless1: '1';
|
||||
^^^
|
||||
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||
useless2: '2';
|
||||
^^^^^^^^
|
||||
input.y:7.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless2: '2';
|
||||
^^^
|
||||
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||
useless3: '3';
|
||||
^^^^^^^^
|
||||
input.y:8.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless3: '3';
|
||||
^^^
|
||||
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||
useless4: '4';
|
||||
^^^^^^^^
|
||||
input.y:9.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless4: '4';
|
||||
^^^
|
||||
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
|
||||
useless5: '5';
|
||||
^^^^^^^^
|
||||
input.y:10.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless5: '5';
|
||||
^^^
|
||||
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||
useless6: '6';
|
||||
^^^^^^^^
|
||||
input.y:11.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless6: '6';
|
||||
^^^
|
||||
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||
useless7: '7';
|
||||
^^^^^^^^
|
||||
input.y:12.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless7: '7';
|
||||
^^^
|
||||
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||
useless8: '8';
|
||||
^^^^^^^^
|
||||
input.y:13.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless8: '8';
|
||||
^^^
|
||||
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||
useless9: '9';
|
||||
^^^^^^^^
|
||||
input.y:14.11-13: warning: rule useless in grammar [-Wother]
|
||||
useless9: '9';
|
||||
^^^
|
||||
input.y: warning: 9 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 9 rules useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
|
||||
@@ -276,23 +276,23 @@ non_productive: non_productive useless_token
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-fcaret not-reduced.y]], 0, [],
|
||||
[[not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
|
||||
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
|
||||
not_reachable: useful { /* A not reachable action. */ }
|
||||
^^^^^^^^^^^^^
|
||||
not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive [-Wother]
|
||||
[[not-reduced.y:11.6-19: warning: nonterminal useless in grammar: non_productive [-Wother]
|
||||
| non_productive { /* A non productive action. */ }
|
||||
^^^^^^^^^^^^^^
|
||||
not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
|
||||
| non_productive { /* A non productive action. */ }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
|
||||
not_reachable: useful { /* A not reachable action. */ }
|
||||
^^^^^^^^^^^^^
|
||||
not-reduced.y:14.16-56: warning: rule useless in grammar [-Wother]
|
||||
not_reachable: useful { /* A not reachable action. */ }
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
not-reduced.y:17.17-18.63: warning: rule useless in grammar [-Wother]
|
||||
non_productive: non_productive useless_token
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
not-reduced.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
|
||||
@@ -361,13 +361,13 @@ indirection: underivable;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 0, [],
|
||||
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 3 rules useless in grammar [-Wother]
|
||||
input.y:5.15-25: warning: nonterminal useless in grammar: underivable [-Wother]
|
||||
input.y:6.14-24: warning: nonterminal useless in grammar: indirection [-Wother]
|
||||
[[input.y:5.15-25: warning: nonterminal useless in grammar: underivable [-Wother]
|
||||
input.y:5.15-25: warning: rule useless in grammar [-Wother]
|
||||
input.y:6.14-24: warning: nonterminal useless in grammar: indirection [-Wother]
|
||||
input.y:6.14-24: warning: rule useless in grammar [-Wother]
|
||||
input.y:7.14-24: warning: rule useless in grammar [-Wother]
|
||||
input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 3 rules useless in grammar [-Wother]
|
||||
]])
|
||||
|
||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
|
||||
@@ -397,9 +397,9 @@ exp: exp;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], 1, [],
|
||||
[[input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
[[input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
|
||||
input.y: warning: 2 nonterminals useless in grammar [-Wother]
|
||||
input.y: warning: 2 rules useless in grammar [-Wother]
|
||||
input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1057,7 +1057,7 @@ State 12
|
||||
|
||||
4 A: 'a' 'a' . B
|
||||
5 B: . 'a'
|
||||
6 | . %empty ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[
|
||||
6 | . ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[
|
||||
|
||||
]AT_COND_CASE([[canonical LR]], [['a']],
|
||||
[[$default]])[ reduce using rule 6 (B)
|
||||
@@ -1087,7 +1087,7 @@ State 15
|
||||
|
||||
4 A: 'a' 'a' . B
|
||||
5 B: . 'a'
|
||||
6 | . %empty [$end]
|
||||
6 | . [$end]
|
||||
7 c: 'a' 'a' . 'b'
|
||||
|
||||
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[20]],
|
||||
@@ -1150,7 +1150,7 @@ State 22]])[
|
||||
|
||||
4 A: 'a' 'a' . B
|
||||
5 B: . 'a'
|
||||
6 | . %empty ['b']
|
||||
6 | . ['b']
|
||||
|
||||
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[23]],
|
||||
[[16]])[
|
||||
@@ -1575,8 +1575,8 @@ State 3
|
||||
1 start: a . b
|
||||
2 | a . b 'a'
|
||||
3 | a . c 'b'
|
||||
5 b: . %empty [$end, 'a']
|
||||
6 c: . %empty ['b']]AT_COND_CASE([[most]], [[
|
||||
5 b: . [$end, 'a']
|
||||
6 c: . ['b']]AT_COND_CASE([[most]], [[
|
||||
|
||||
'b' reduce using rule 6 (c)
|
||||
$default reduce using rule 5 (b)]], [[
|
||||
|
||||
+3
-3
@@ -770,7 +770,7 @@ static const yytype_uint8 yyrline[] =
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
|
||||
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULLPTR
|
||||
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULL
|
||||
};
|
||||
static const yytype_uint16 yytoknum[] =
|
||||
{
|
||||
@@ -1147,9 +1147,9 @@ sr_conflict:
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Wall -o input.c input.y]], [[0]],,
|
||||
[[input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
|
||||
[[input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
|
||||
input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:28.5-19: warning: rule useless in parser due to conflicts [-Wother]
|
||||
input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
|
||||
]])
|
||||
AT_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[./input]])
|
||||
|
||||
+4
-4
@@ -186,10 +186,10 @@ start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input1.y]], [[1]], [[]],
|
||||
[[input1.y: warning: foow fubar [-Wother]
|
||||
[[fooc.y:1.1-10.5: error: foocat fubar
|
||||
foow.y:2.3-5.3: warning: foowat fubar [-Wother]
|
||||
input1.y: warning: foow fubar [-Wother]
|
||||
input1.y: error: fooc fubar
|
||||
fooc.y:1.1-10.5: error: foocat fubar
|
||||
input1.y: fatal error: foof fubar
|
||||
]])
|
||||
|
||||
@@ -276,8 +276,8 @@ start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input2.y]], [[1]], [[]],
|
||||
[[input2.y: warning: morning [-Wother]
|
||||
foo.y:1.5-6: fatal error: M4 should exit immediately here
|
||||
[[foo.y:1.5-6: fatal error: M4 should exit immediately here
|
||||
input2.y: warning: morning [-Wother]
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user