mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 08:13:02 +00:00
Merge remote-tracking branch 'origin/maint'
* origin/maint: (43 commits) maint: post-release administrivia version 3.0.2 gnulib: update output: do not generate source files when late errors are caught output: record what generated files are source or report files output: do not generate source files when early errors are caught xml: also use "%empty" with html output style: formatting changes xml: also display %empty for empty right-hand sides reports: display %empty in the generated pointed-rules news: YYERROR vs variants style: scope reduction in lalr.cc lalr1.cc: formatting changes lalr1.cc: fix the support of YYERROR with variants tests: check $$'s destruction with variant, YYERROR, and no error recovery tests: simplify useless obfuscation skeletons: use better names when computing a "goto" maint: post-release administrivia version 3.0.1 aver: it is no longer "protected against NDEBUG" ... Conflicts: data/glr.c
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,8 +1,10 @@
|
|||||||
*.eps
|
*.eps
|
||||||
|
*.log
|
||||||
*.o
|
*.o
|
||||||
*.pdf
|
*.pdf
|
||||||
*.png
|
*.png
|
||||||
*.stamp
|
*.stamp
|
||||||
|
*.trs
|
||||||
*~
|
*~
|
||||||
.deps
|
.deps
|
||||||
.dirstamp
|
.dirstamp
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
3.0
|
3.0.2
|
||||||
|
|||||||
54
NEWS
54
NEWS
@@ -2,9 +2,61 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.0.2 (2013-12-05) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|
||||||
Portability issues in the test suite.
|
*** 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]
|
* Noteworthy changes in release 3.0 (2013-07-25) [stable]
|
||||||
|
|
||||||
|
|||||||
@@ -62,13 +62,22 @@ tools we depend upon, including:
|
|||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
- Graphviz <http://www.graphviz.org>
|
- Graphviz <http://www.graphviz.org>
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
|
- Help2man <http://www.gnu.org/software/help2man/>
|
||||||
- Perl <http://www.cpan.org/>
|
- Perl <http://www.cpan.org/>
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
- Tar <http://www.gnu.org/software/tar/>
|
- 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
|
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
||||||
your architecture.
|
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.
|
Bison is written using Bison grammars, so there are bootstrapping issues.
|
||||||
The bootstrap script attempts to discover when the C code generated from the
|
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
|
grammars is out of date, and to bootstrap with an out-of-date version of the
|
||||||
|
|||||||
4
THANKS
4
THANKS
@@ -66,6 +66,7 @@ Johan van Selst johans@stack.nl
|
|||||||
Jonathan Fabrizio jonathan.fabrizio@lrde.epita.fr
|
Jonathan Fabrizio jonathan.fabrizio@lrde.epita.fr
|
||||||
Jonathan Nieder jrnieder@gmail.com
|
Jonathan Nieder jrnieder@gmail.com
|
||||||
Juan Manuel Guerrero juan.guerrero@gmx.de
|
Juan Manuel Guerrero juan.guerrero@gmx.de
|
||||||
|
Ken Moffat zarniwhoop@ntlworld.com
|
||||||
Kees Zeelenberg kzlg@users.sourceforge.net
|
Kees Zeelenberg kzlg@users.sourceforge.net
|
||||||
Keith Browne kbrowne@legato.com
|
Keith Browne kbrowne@legato.com
|
||||||
Laurent Mascherpa laurent.mascherpa@epita.fr
|
Laurent Mascherpa laurent.mascherpa@epita.fr
|
||||||
@@ -79,6 +80,7 @@ Martin Mokrejs mmokrejs@natur.cuni.cz
|
|||||||
Martin Nylin martin.nylin@linuxmail.org
|
Martin Nylin martin.nylin@linuxmail.org
|
||||||
Matt Kraai kraai@alumni.cmu.edu
|
Matt Kraai kraai@alumni.cmu.edu
|
||||||
Matt Rosing rosing@peakfive.com
|
Matt Rosing rosing@peakfive.com
|
||||||
|
Michael Felt mamfelt@gmail.com
|
||||||
Michael Hayes m.hayes@elec.canterbury.ac.nz
|
Michael Hayes m.hayes@elec.canterbury.ac.nz
|
||||||
Michael Raskin 7c6f434c@mail.ru
|
Michael Raskin 7c6f434c@mail.ru
|
||||||
Michiel De Wilde mdewilde.agilent@gmail.com
|
Michiel De Wilde mdewilde.agilent@gmail.com
|
||||||
@@ -94,6 +96,7 @@ Odd Arild Olsen oao@fibula.no
|
|||||||
Oleg Smolsky oleg.smolsky@pacific-simulators.co.nz
|
Oleg Smolsky oleg.smolsky@pacific-simulators.co.nz
|
||||||
Oleksii Taran oleksii.taran@gmail.com
|
Oleksii Taran oleksii.taran@gmail.com
|
||||||
Paolo Bonzini bonzini@gnu.org
|
Paolo Bonzini bonzini@gnu.org
|
||||||
|
Paolo Simone Gasparello djgaspa@gmail.com
|
||||||
Pascal Bart pascal.bart@epita.fr
|
Pascal Bart pascal.bart@epita.fr
|
||||||
Paul Eggert eggert@cs.ucla.edu
|
Paul Eggert eggert@cs.ucla.edu
|
||||||
Paul Hilfinger Hilfinger@CS.Berkeley.EDU
|
Paul Hilfinger Hilfinger@CS.Berkeley.EDU
|
||||||
@@ -110,6 +113,7 @@ R Blake blakers@mac.com
|
|||||||
Raja R Harinath harinath@cs.umn.edu
|
Raja R Harinath harinath@cs.umn.edu
|
||||||
Ralf Wildenhues Ralf.Wildenhues@gmx.de
|
Ralf Wildenhues Ralf.Wildenhues@gmx.de
|
||||||
Richard Stallman rms@gnu.org
|
Richard Stallman rms@gnu.org
|
||||||
|
Rici Lake ricilake@gmail.com
|
||||||
Rob Vermaas rob.vermaas@gmail.com
|
Rob Vermaas rob.vermaas@gmail.com
|
||||||
Robert Anisko anisko_r@epita.fr
|
Robert Anisko anisko_r@epita.fr
|
||||||
Rob Conde rob.conde@ai-solutions.com
|
Rob Conde rob.conde@ai-solutions.com
|
||||||
|
|||||||
54
bootstrap
54
bootstrap
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2013-07-03.20; # UTC
|
scriptversion=2013-08-15.22; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
@@ -209,12 +209,16 @@ bootstrap_sync=false
|
|||||||
# Use git to update gnulib sources
|
# Use git to update gnulib sources
|
||||||
use_git=true
|
use_git=true
|
||||||
|
|
||||||
|
check_exists() {
|
||||||
|
($1 --version </dev/null) >/dev/null 2>&1
|
||||||
|
test $? -lt 126
|
||||||
|
}
|
||||||
|
|
||||||
# find_tool ENVVAR NAMES...
|
# find_tool ENVVAR NAMES...
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Search for a required program. Use the value of ENVVAR, if set,
|
# Search for a required program. Use the value of ENVVAR, if set,
|
||||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
# otherwise find the first of the NAMES that can be run.
|
||||||
# supports --version). If found, set ENVVAR to the program name,
|
# If found, set ENVVAR to the program name, die otherwise.
|
||||||
# die otherwise.
|
|
||||||
#
|
#
|
||||||
# FIXME: code duplication, see also gnu-web-doc-update.
|
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||||
find_tool ()
|
find_tool ()
|
||||||
@@ -224,27 +228,21 @@ find_tool ()
|
|||||||
find_tool_names=$@
|
find_tool_names=$@
|
||||||
eval "find_tool_res=\$$find_tool_envvar"
|
eval "find_tool_res=\$$find_tool_envvar"
|
||||||
if test x"$find_tool_res" = x; then
|
if test x"$find_tool_res" = x; then
|
||||||
for i
|
for i; do
|
||||||
do
|
if check_exists $i; then
|
||||||
if ($i --version </dev/null) >/dev/null 2>&1; then
|
find_tool_res=$i
|
||||||
find_tool_res=$i
|
break
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
|
||||||
fi
|
fi
|
||||||
test x"$find_tool_res" != x \
|
if test x"$find_tool_res" = x; then
|
||||||
|| die "one of these is required: $find_tool_names"
|
warn_ "one of these is required: $find_tool_names;"
|
||||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
die "alternatively set $find_tool_envvar to a compatible tool"
|
||||||
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
fi
|
||||||
eval "$find_tool_envvar=\$find_tool_res"
|
eval "$find_tool_envvar=\$find_tool_res"
|
||||||
eval "export $find_tool_envvar"
|
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.
|
# Override the default configuration, if necessary.
|
||||||
# Make sure that bootstrap.conf is sourced from the current directory
|
# Make sure that bootstrap.conf is sourced from the current directory
|
||||||
# if we were invoked as "sh bootstrap".
|
# if we were invoked as "sh bootstrap".
|
||||||
@@ -326,7 +324,7 @@ insert_if_absent() {
|
|||||||
die "Error: Duplicate entries in $file: " $duplicate_entries
|
die "Error: Duplicate entries in $file: " $duplicate_entries
|
||||||
fi
|
fi
|
||||||
linesold=$(gitignore_entries $file | wc -l)
|
linesold=$(gitignore_entries $file | wc -l)
|
||||||
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
|
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
|
||||||
if [ $linesold != $linesnew ] ; then
|
if [ $linesold != $linesnew ] ; then
|
||||||
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
||||||
|| die "insert_if_absent $file $str: failed"
|
|| die "insert_if_absent $file $str: failed"
|
||||||
@@ -469,8 +467,7 @@ check_versions() {
|
|||||||
if [ "$req_ver" = "-" ]; then
|
if [ "$req_ver" = "-" ]; then
|
||||||
# Merely require app to exist; not all prereq apps are well-behaved
|
# Merely require app to exist; not all prereq apps are well-behaved
|
||||||
# so we have to rely on $? rather than get_version.
|
# so we have to rely on $? rather than get_version.
|
||||||
$app --version >/dev/null 2>&1
|
if ! check_exists $app; then
|
||||||
if [ 126 -le $? ]; then
|
|
||||||
warn_ "Error: '$app' not found"
|
warn_ "Error: '$app' not found"
|
||||||
ret=1
|
ret=1
|
||||||
fi
|
fi
|
||||||
@@ -503,6 +500,12 @@ print_versions() {
|
|||||||
# can't depend on column -t
|
# 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
|
use_libtool=0
|
||||||
# We'd like to use grep -E, to see if any of LT_INIT,
|
# 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,
|
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
|
||||||
@@ -551,10 +554,10 @@ fi
|
|||||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||||
|
|
||||||
# See if we can use gnulib's git-merge-changelog merge driver.
|
# See if we can use gnulib's git-merge-changelog merge driver.
|
||||||
if $use_git && test -d .git && (git --version) >/dev/null 2>/dev/null ; then
|
if $use_git && test -d .git && check_exists git; then
|
||||||
if git config merge.merge-changelog.driver >/dev/null ; then
|
if git config merge.merge-changelog.driver >/dev/null ; then
|
||||||
:
|
:
|
||||||
elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
|
elif check_exists git-merge-changelog; then
|
||||||
echo "$0: initializing git-merge-changelog driver"
|
echo "$0: initializing git-merge-changelog driver"
|
||||||
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
|
||||||
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
|
||||||
@@ -692,11 +695,10 @@ update_po_files() {
|
|||||||
cksum_file="$ref_po_dir/$po.s1"
|
cksum_file="$ref_po_dir/$po.s1"
|
||||||
if ! test -f "$cksum_file" ||
|
if ! test -f "$cksum_file" ||
|
||||||
! test -f "$po_dir/$po.po" ||
|
! test -f "$po_dir/$po.po" ||
|
||||||
! $SHA1SUM -c --status "$cksum_file" \
|
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
|
||||||
< "$new_po" > /dev/null; then
|
|
||||||
echo "$me: updated $po_dir/$po.po..."
|
echo "$me: updated $po_dir/$po.po..."
|
||||||
cp "$new_po" "$po_dir/$po.po" \
|
cp "$new_po" "$po_dir/$po.po" \
|
||||||
&& $SHA1SUM < "$new_po" > "$cksum_file"
|
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ gnulib_modules='
|
|||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
unistd unistd-safer unlink unlocked-io
|
||||||
|
update-copyright unsetenv verify
|
||||||
warnings
|
warnings
|
||||||
xalloc
|
xalloc
|
||||||
xalloc-die
|
xalloc-die
|
||||||
|
|||||||
23
configure.ac
23
configure.ac
@@ -33,11 +33,7 @@ AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
|||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
|
|
||||||
# Automake 1.10.3 and 1.11.1 fix a security flaw discussed here:
|
# We use Automake 1.14's %D% and %C%.
|
||||||
#
|
|
||||||
# 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
|
# We want gnits strictness only when rolling a stable release. For
|
||||||
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
# release candidates, we use version strings like 2.4.3_rc1, but gnits
|
||||||
@@ -45,7 +41,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
# releases, we want to be able run make dist without being required to
|
# releases, we want to be able run make dist without being required to
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
# add a bogus NEWS entry. In that case, the version string
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
# automatically contains a dash, which we also let disable gnits.
|
||||||
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
|
AM_INIT_AUTOMAKE([1.14 dist-xz nostdinc
|
||||||
color-tests parallel-tests
|
color-tests parallel-tests
|
||||||
silent-rules]
|
silent-rules]
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||||
@@ -82,7 +78,7 @@ AC_ARG_ENABLE([gcc-warnings],
|
|||||||
esac],
|
esac],
|
||||||
[enable_gcc_warnings=no])
|
[enable_gcc_warnings=no])
|
||||||
if test "$enable_gcc_warnings" = yes; then
|
if test "$enable_gcc_warnings" = yes; then
|
||||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
warn_common='-Wall-Wextra -Wno-sign-compare -Wcast-align -Wdocumentation
|
||||||
-Wformat -Wpointer-arith -Wwrite-strings'
|
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
@@ -161,16 +157,7 @@ AC_ARG_ENABLE([yacc],
|
|||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
[do not build a yacc command or an -ly library])],
|
[do not build a yacc command or an -ly library])],
|
||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
case $enable_yacc in
|
AM_CONDITIONAL([ENABLE_YACC], [test "$enable_yacc" = yes])
|
||||||
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.
|
# Checks for programs.
|
||||||
AM_MISSING_PROG([DOT], [dot])
|
AM_MISSING_PROG([DOT], [dot])
|
||||||
@@ -179,6 +166,8 @@ $LEX_IS_FLEX || test "X$LEX" = X: || {
|
|||||||
AC_MSG_WARN([bypassing lex because flex is required])
|
AC_MSG_WARN([bypassing lex because flex is required])
|
||||||
LEX=:
|
LEX=:
|
||||||
}
|
}
|
||||||
|
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||||
|
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
|
|||||||
43
data/c.m4
43
data/c.m4
@@ -205,13 +205,32 @@ m4_define([b4_table_value_equals],
|
|||||||
|
|
||||||
# b4_attribute_define
|
# b4_attribute_define
|
||||||
# -------------------
|
# -------------------
|
||||||
# Provide portability for __attribute__.
|
# Provide portable compiler "attributes".
|
||||||
m4_define([b4_attribute_define],
|
m4_define([b4_attribute_define],
|
||||||
[#ifndef __attribute__
|
[#ifndef YY_ATTRIBUTE
|
||||||
/* This feature is available in gcc versions 2.5 and later. */
|
# if (defined __GNUC__ \
|
||||||
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|
||||||
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
|
||||||
# define __attribute__(Spec) /* empty */
|
# 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__))
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -250,14 +269,14 @@ m4_define([b4_attribute_define],
|
|||||||
|
|
||||||
# b4_null_define
|
# b4_null_define
|
||||||
# --------------
|
# --------------
|
||||||
# Portability issues: define a YY_NULL appropriate for the current
|
# Portability issues: define a YY_NULLPTR appropriate for the current
|
||||||
# language (C, C++98, or C++11).
|
# language (C, C++98, or C++11).
|
||||||
m4_define([b4_null_define],
|
m4_define([b4_null_define],
|
||||||
[# ifndef YY_NULL
|
[# ifndef YY_NULLPTR
|
||||||
# if defined __cplusplus && 201103L <= __cplusplus
|
# if defined __cplusplus && 201103L <= __cplusplus
|
||||||
# define YY_NULL nullptr
|
# define YY_NULLPTR nullptr
|
||||||
# else
|
# else
|
||||||
# define YY_NULL 0
|
# define YY_NULLPTR 0
|
||||||
# endif
|
# endif
|
||||||
# endif[]dnl
|
# endif[]dnl
|
||||||
])
|
])
|
||||||
@@ -266,7 +285,7 @@ m4_define([b4_null_define],
|
|||||||
# b4_null
|
# b4_null
|
||||||
# -------
|
# -------
|
||||||
# Return a null pointer constant.
|
# Return a null pointer constant.
|
||||||
m4_define([b4_null], [YY_NULL])
|
m4_define([b4_null], [YY_NULLPTR])
|
||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
@@ -783,7 +802,7 @@ m4_define([b4_yy_location_print_define],
|
|||||||
|
|
||||||
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||||
|
|
||||||
__attribute__((__unused__))
|
YY_ATTRIBUTE_UNUSED
|
||||||
]b4_function_define([yy_location_print_],
|
]b4_function_define([yy_location_print_],
|
||||||
[static unsigned],
|
[static unsigned],
|
||||||
[[FILE *yyo], [yyo]],
|
[[FILE *yyo], [yyo]],
|
||||||
|
|||||||
137
data/glr.c
137
data/glr.c
@@ -445,9 +445,9 @@ int yydebug;
|
|||||||
|
|
||||||
struct yyGLRStack;
|
struct yyGLRStack;
|
||||||
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
|
static void yypstack (struct yyGLRStack* yystackp, size_t yyk)
|
||||||
__attribute__ ((__unused__));
|
YY_ATTRIBUTE_UNUSED;
|
||||||
static void yypdumpstack (struct yyGLRStack* yystackp)
|
static void yypdumpstack (struct yyGLRStack* yystackp)
|
||||||
__attribute__ ((__unused__));
|
YY_ATTRIBUTE_UNUSED;
|
||||||
|
|
||||||
#else /* !]b4_api_PREFIX[DEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
@@ -669,19 +669,15 @@ struct yyGLRStack {
|
|||||||
static void yyexpandGLRStack (yyGLRStack* yystackp);
|
static void yyexpandGLRStack (yyGLRStack* yystackp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
static _Noreturn void
|
||||||
__attribute__ ((__noreturn__));
|
|
||||||
static void
|
|
||||||
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
yyFail (yyGLRStack* yystackp]b4_pure_formals[, const char* yymsg)
|
||||||
{
|
{
|
||||||
if (yymsg != YY_NULL)
|
if (yymsg != YY_NULLPTR)
|
||||||
yyerror (]b4_yyerror_args[yymsg);
|
yyerror (]b4_yyerror_args[yymsg);
|
||||||
YYLONGJMP (yystackp->yyexception_buffer, 1);
|
YYLONGJMP (yystackp->yyexception_buffer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void yyMemoryExhausted (yyGLRStack* yystackp)
|
static _Noreturn void
|
||||||
__attribute__ ((__noreturn__));
|
|
||||||
static void
|
|
||||||
yyMemoryExhausted (yyGLRStack* yystackp)
|
yyMemoryExhausted (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
||||||
@@ -702,7 +698,7 @@ yytokenName (yySymbol yytoken)
|
|||||||
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
|
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
|
||||||
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
|
* at YYVSP[YYLOW0].yystate.yypred. Leaves YYVSP[YYLOW1].yystate.yypred
|
||||||
* containing the pointer to the next state in the chain. */
|
* containing the pointer to the next state in the chain. */
|
||||||
static void yyfillin (yyGLRStackItem *, int, int) __attribute__ ((__unused__));
|
static void yyfillin (yyGLRStackItem *, int, int) YY_ATTRIBUTE_UNUSED;
|
||||||
static void
|
static void
|
||||||
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
||||||
{
|
{
|
||||||
@@ -719,7 +715,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
else
|
else
|
||||||
/* The effect of using yysval or yyloc (in an immediate rule) is
|
/* The effect of using yysval or yyloc (in an immediate rule) is
|
||||||
* undefined. */
|
* undefined. */
|
||||||
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULL;]b4_locations_if([[
|
yyvsp[i].yystate.yysemantics.yyfirstVal = YY_NULLPTR;]b4_locations_if([[
|
||||||
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
yyvsp[i].yystate.yyloc = s->yyloc;]])[
|
||||||
s = yyvsp[i].yystate.yypred = s->yypred;
|
s = yyvsp[i].yystate.yypred = s->yypred;
|
||||||
}
|
}
|
||||||
@@ -729,7 +725,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
|
|||||||
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
|
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
|
||||||
* For convenience, always return YYLOW1. */
|
* For convenience, always return YYLOW1. */
|
||||||
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
|
static inline int yyfill (yyGLRStackItem *, int *, int, yybool)
|
||||||
__attribute__ ((__unused__));
|
YY_ATTRIBUTE_UNUSED;
|
||||||
static inline int
|
static inline int
|
||||||
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
yyfill (yyGLRStackItem *yyvsp, int *yylow, int yylow1, yybool yynormal)
|
||||||
{
|
{
|
||||||
@@ -751,8 +747,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
yyGLRStack* yystackp,
|
yyGLRStack* yystackp,
|
||||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
yybool yynormal __attribute__ ((__unused__)) =
|
yybool yynormal YY_ATTRIBUTE_UNUSED = (yystackp->yysplitPoint == YY_NULLPTR);
|
||||||
(yystackp->yysplitPoint == YY_NULL);
|
|
||||||
int yylow;
|
int yylow;
|
||||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||||
[ YYUSE (yyrhslen);
|
[ YYUSE (yyrhslen);
|
||||||
@@ -839,7 +834,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
YYFPRINTF (stderr, "%s unresolved", yymsg);
|
YYFPRINTF (stderr, "%s unresolved", yymsg);
|
||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%s incomplete", yymsg);
|
YYFPRINTF (stderr, "%s incomplete", yymsg);
|
||||||
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULL, &yys->yyloc);
|
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -915,14 +910,18 @@ 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
|
static inline yyStateNum
|
||||||
yyLRgotoState (yyStateNum yystate, yySymbol yylhs)
|
yyLRgotoState (yyStateNum yystate, yySymbol yysym)
|
||||||
{
|
{
|
||||||
int yyr = yypgoto[yylhs - YYNTOKENS] + yystate;
|
int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
|
||||||
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
if (0 <= yyr && yyr <= YYLAST && yycheck[yyr] == yystate)
|
||||||
return yytable[yyr];
|
return yytable[yyr];
|
||||||
else
|
else
|
||||||
return yydefgoto[yylhs - YYNTOKENS];
|
return yydefgoto[yysym - YYNTOKENS];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline yybool
|
static inline yybool
|
||||||
@@ -992,7 +991,7 @@ yyinitStateSet (yyGLRStateSet* yyset)
|
|||||||
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
|
yyset->yystates = (yyGLRState**) YYMALLOC (16 * sizeof yyset->yystates[0]);
|
||||||
if (! yyset->yystates)
|
if (! yyset->yystates)
|
||||||
return yyfalse;
|
return yyfalse;
|
||||||
yyset->yystates[0] = YY_NULL;
|
yyset->yystates[0] = YY_NULLPTR;
|
||||||
yyset->yylookaheadNeeds =
|
yyset->yylookaheadNeeds =
|
||||||
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
|
(yybool*) YYMALLOC (16 * sizeof yyset->yylookaheadNeeds[0]);
|
||||||
if (! yyset->yylookaheadNeeds)
|
if (! yyset->yylookaheadNeeds)
|
||||||
@@ -1022,8 +1021,8 @@ yyinitGLRStack (yyGLRStack* yystackp, size_t yysize)
|
|||||||
if (!yystackp->yyitems)
|
if (!yystackp->yyitems)
|
||||||
return yyfalse;
|
return yyfalse;
|
||||||
yystackp->yynextFree = yystackp->yyitems;
|
yystackp->yynextFree = yystackp->yyitems;
|
||||||
yystackp->yysplitPoint = YY_NULL;
|
yystackp->yysplitPoint = YY_NULLPTR;
|
||||||
yystackp->yylastDeleted = YY_NULL;
|
yystackp->yylastDeleted = YY_NULLPTR;
|
||||||
return yyinitStateSet (&yystackp->yytops);
|
return yyinitStateSet (&yystackp->yytops);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1062,10 +1061,10 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yyGLRState* yys0 = &yyp0->yystate;
|
yyGLRState* yys0 = &yyp0->yystate;
|
||||||
yyGLRState* yys1 = &yyp1->yystate;
|
yyGLRState* yys1 = &yyp1->yystate;
|
||||||
if (yys0->yypred != YY_NULL)
|
if (yys0->yypred != YY_NULLPTR)
|
||||||
yys1->yypred =
|
yys1->yypred =
|
||||||
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
|
YYRELOC (yyp0, yyp1, yys0->yypred, yystate);
|
||||||
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULL)
|
if (! yys0->yyresolved && yys0->yysemantics.yyfirstVal != YY_NULLPTR)
|
||||||
yys1->yysemantics.yyfirstVal =
|
yys1->yysemantics.yyfirstVal =
|
||||||
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
|
YYRELOC (yyp0, yyp1, yys0->yysemantics.yyfirstVal, yyoption);
|
||||||
}
|
}
|
||||||
@@ -1073,18 +1072,18 @@ yyexpandGLRStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yySemanticOption* yyv0 = &yyp0->yyoption;
|
yySemanticOption* yyv0 = &yyp0->yyoption;
|
||||||
yySemanticOption* yyv1 = &yyp1->yyoption;
|
yySemanticOption* yyv1 = &yyp1->yyoption;
|
||||||
if (yyv0->yystate != YY_NULL)
|
if (yyv0->yystate != YY_NULLPTR)
|
||||||
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
|
yyv1->yystate = YYRELOC (yyp0, yyp1, yyv0->yystate, yystate);
|
||||||
if (yyv0->yynext != YY_NULL)
|
if (yyv0->yynext != YY_NULLPTR)
|
||||||
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
|
yyv1->yynext = YYRELOC (yyp0, yyp1, yyv0->yynext, yyoption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yystackp->yysplitPoint != YY_NULL)
|
if (yystackp->yysplitPoint != YY_NULLPTR)
|
||||||
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
|
yystackp->yysplitPoint = YYRELOC (yystackp->yyitems, yynewItems,
|
||||||
yystackp->yysplitPoint, yystate);
|
yystackp->yysplitPoint, yystate);
|
||||||
|
|
||||||
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
|
for (yyn = 0; yyn < yystackp->yytops.yysize; yyn += 1)
|
||||||
if (yystackp->yytops.yystates[yyn] != YY_NULL)
|
if (yystackp->yytops.yystates[yyn] != YY_NULLPTR)
|
||||||
yystackp->yytops.yystates[yyn] =
|
yystackp->yytops.yystates[yyn] =
|
||||||
YYRELOC (yystackp->yyitems, yynewItems,
|
YYRELOC (yystackp->yyitems, yynewItems,
|
||||||
yystackp->yytops.yystates[yyn], yystate);
|
yystackp->yytops.yystates[yyn], yystate);
|
||||||
@@ -1108,7 +1107,7 @@ yyfreeGLRStack (yyGLRStack* yystackp)
|
|||||||
static inline void
|
static inline void
|
||||||
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint != YY_NULL && yystackp->yysplitPoint > yys)
|
if (yystackp->yysplitPoint != YY_NULLPTR && yystackp->yysplitPoint > yys)
|
||||||
yystackp->yysplitPoint = yys;
|
yystackp->yysplitPoint = yys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1116,9 +1115,9 @@ yyupdateSplit (yyGLRStack* yystackp, yyGLRState* yys)
|
|||||||
static inline void
|
static inline void
|
||||||
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
||||||
{
|
{
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULL)
|
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
yystackp->yylastDeleted = yystackp->yytops.yystates[yyk];
|
||||||
yystackp->yytops.yystates[yyk] = YY_NULL;
|
yystackp->yytops.yystates[yyk] = YY_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
|
/** Undelete the last stack in *YYSTACKP that was marked as deleted. Can
|
||||||
@@ -1127,12 +1126,12 @@ yymarkStackDeleted (yyGLRStack* yystackp, size_t yyk)
|
|||||||
static void
|
static void
|
||||||
yyundeleteLastStack (yyGLRStack* yystackp)
|
yyundeleteLastStack (yyGLRStack* yystackp)
|
||||||
{
|
{
|
||||||
if (yystackp->yylastDeleted == YY_NULL || yystackp->yytops.yysize != 0)
|
if (yystackp->yylastDeleted == YY_NULLPTR || yystackp->yytops.yysize != 0)
|
||||||
return;
|
return;
|
||||||
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
||||||
yystackp->yytops.yysize = 1;
|
yystackp->yytops.yysize = 1;
|
||||||
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
||||||
yystackp->yylastDeleted = YY_NULL;
|
yystackp->yylastDeleted = YY_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -1142,7 +1141,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
yyi = yyj = 0;
|
yyi = yyj = 0;
|
||||||
while (yyj < yystackp->yytops.yysize)
|
while (yyj < yystackp->yytops.yysize)
|
||||||
{
|
{
|
||||||
if (yystackp->yytops.yystates[yyi] == YY_NULL)
|
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
if (yyi == yyj)
|
if (yyi == yyj)
|
||||||
{
|
{
|
||||||
@@ -1206,7 +1205,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
yynewState->yyposn = yyposn;
|
yynewState->yyposn = yyposn;
|
||||||
yynewState->yyresolved = yyfalse;
|
yynewState->yyresolved = yyfalse;
|
||||||
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
yynewState->yypred = yystackp->yytops.yystates[yyk];
|
||||||
yynewState->yysemantics.yyfirstVal = YY_NULL;
|
yynewState->yysemantics.yyfirstVal = YY_NULLPTR;
|
||||||
yystackp->yytops.yystates[yyk] = yynewState;
|
yystackp->yytops.yystates[yyk] = yynewState;
|
||||||
|
|
||||||
/* Invokes YY_RESERVE_GLRSTACK. */
|
/* Invokes YY_RESERVE_GLRSTACK. */
|
||||||
@@ -1266,7 +1265,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);
|
int yynrhs = yyrhsLength (yyrule);
|
||||||
|
|
||||||
if (yystackp->yysplitPoint == YY_NULL)
|
if (yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
/* Standard special case: single stack. */
|
/* Standard special case: single stack. */
|
||||||
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
yyGLRStackItem* yyrhs = (yyGLRStackItem*) yystackp->yytops.yystates[yyk];
|
||||||
@@ -1318,13 +1317,13 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
{
|
{
|
||||||
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
size_t yyposn = yystackp->yytops.yystates[yyk]->yyposn;
|
||||||
|
|
||||||
if (yyforceEval || yystackp->yysplitPoint == YY_NULL)
|
if (yyforceEval || yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
YYSTYPE yysval;]b4_locations_if([[
|
YYSTYPE yysval;]b4_locations_if([[
|
||||||
YYLTYPE yyloc;]])[
|
YYLTYPE yyloc;]])[
|
||||||
|
|
||||||
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
||||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULL)
|
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
|
YYDPRINTF ((stderr, "Parse on stack %lu rejected by rule #%d.\n",
|
||||||
(unsigned long int) yyk, yyrule - 1));
|
(unsigned long int) yyk, yyrule - 1));
|
||||||
@@ -1357,7 +1356,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
"Now in state %d.\n",
|
"Now in state %d.\n",
|
||||||
(unsigned long int) yyk, yyrule - 1, yynewLRState));
|
(unsigned long int) yyk, yyrule - 1, yynewLRState));
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULL)
|
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyGLRState *yysplit = yystackp->yysplitPoint;
|
yyGLRState *yysplit = yystackp->yysplitPoint;
|
||||||
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
|
yyGLRState *yyp = yystackp->yytops.yystates[yyi];
|
||||||
@@ -1384,7 +1383,7 @@ yyglrReduce (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
static size_t
|
static size_t
|
||||||
yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint == YY_NULL)
|
if (yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
YYASSERT (yyk == 0);
|
YYASSERT (yyk == 0);
|
||||||
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
||||||
@@ -1394,7 +1393,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
yyGLRState** yynewStates;
|
yyGLRState** yynewStates;
|
||||||
yybool* yynewLookaheadNeeds;
|
yybool* yynewLookaheadNeeds;
|
||||||
|
|
||||||
yynewStates = YY_NULL;
|
yynewStates = YY_NULLPTR;
|
||||||
|
|
||||||
if (yystackp->yytops.yycapacity
|
if (yystackp->yytops.yycapacity
|
||||||
> (YYSIZEMAX / (2 * sizeof yynewStates[0])))
|
> (YYSIZEMAX / (2 * sizeof yynewStates[0])))
|
||||||
@@ -1405,7 +1404,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
|
(yyGLRState**) YYREALLOC (yystackp->yytops.yystates,
|
||||||
(yystackp->yytops.yycapacity
|
(yystackp->yytops.yycapacity
|
||||||
* sizeof yynewStates[0]));
|
* sizeof yynewStates[0]));
|
||||||
if (yynewStates == YY_NULL)
|
if (yynewStates == YY_NULLPTR)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yystates = yynewStates;
|
yystackp->yytops.yystates = yynewStates;
|
||||||
|
|
||||||
@@ -1413,7 +1412,7 @@ yysplitStack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
(yybool*) YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
||||||
(yystackp->yytops.yycapacity
|
(yystackp->yytops.yycapacity
|
||||||
* sizeof yynewLookaheadNeeds[0]));
|
* sizeof yynewLookaheadNeeds[0]));
|
||||||
if (yynewLookaheadNeeds == YY_NULL)
|
if (yynewLookaheadNeeds == YY_NULLPTR)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
||||||
}
|
}
|
||||||
@@ -1477,9 +1476,9 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
|||||||
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
yySemanticOption* yyz1 = yys1->yysemantics.yyfirstVal;
|
||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
if (yyz1 == *yyz0p || yyz1 == YY_NULL)
|
if (yyz1 == *yyz0p || yyz1 == YY_NULLPTR)
|
||||||
break;
|
break;
|
||||||
else if (*yyz0p == YY_NULL)
|
else if (*yyz0p == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
*yyz0p = yyz1;
|
*yyz0p = yyz1;
|
||||||
break;
|
break;
|
||||||
@@ -1600,7 +1599,7 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
|
|
||||||
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
|
for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
|
||||||
yystates[yyi] = yys;
|
yystates[yyi] = yys;
|
||||||
if (yys == YY_NULL)
|
if (yys == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyleftmost_state.yyposn = 0;
|
yyleftmost_state.yyposn = 0;
|
||||||
yystates[0] = &yyleftmost_state;
|
yystates[0] = &yyleftmost_state;
|
||||||
@@ -1719,7 +1718,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YYRESULTTAG yyflag;]b4_locations_if([
|
YYRESULTTAG yyflag;]b4_locations_if([
|
||||||
YYLTYPE *yylocp = &yys->yyloc;])[
|
YYLTYPE *yylocp = &yys->yyloc;])[
|
||||||
|
|
||||||
for (yypp = &yyoptionList->yynext; *yypp != YY_NULL; )
|
for (yypp = &yyoptionList->yynext; *yypp != YY_NULLPTR; )
|
||||||
{
|
{
|
||||||
yySemanticOption* yyp = *yypp;
|
yySemanticOption* yyp = *yypp;
|
||||||
|
|
||||||
@@ -1761,7 +1760,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
int yyprec = yydprec[yybest->yyrule];
|
int yyprec = yydprec[yybest->yyrule];
|
||||||
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
yyflag = yyresolveAction (yybest, yystackp, &yysval]b4_locuser_args[);
|
||||||
if (yyflag == yyok)
|
if (yyflag == yyok)
|
||||||
for (yyp = yybest->yynext; yyp != YY_NULL; yyp = yyp->yynext)
|
for (yyp = yybest->yynext; yyp != YY_NULLPTR; yyp = yyp->yynext)
|
||||||
{
|
{
|
||||||
if (yyprec == yydprec[yyp->yyrule])
|
if (yyprec == yydprec[yyp->yyrule])
|
||||||
{
|
{
|
||||||
@@ -1788,14 +1787,14 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yys->yysemantics.yysval = yysval;
|
yys->yysemantics.yysval = yysval;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yys->yysemantics.yyfirstVal = YY_NULL;
|
yys->yysemantics.yyfirstVal = YY_NULLPTR;
|
||||||
return yyflag;
|
return yyflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
static YYRESULTTAG
|
static YYRESULTTAG
|
||||||
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
|
yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
|
||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint != YY_NULL)
|
if (yystackp->yysplitPoint != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyGLRState* yys;
|
yyGLRState* yys;
|
||||||
int yyn;
|
int yyn;
|
||||||
@@ -1815,10 +1814,10 @@ yycompressStack (yyGLRStack* yystackp)
|
|||||||
{
|
{
|
||||||
yyGLRState* yyp, *yyq, *yyr;
|
yyGLRState* yyp, *yyq, *yyr;
|
||||||
|
|
||||||
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULL)
|
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULL;
|
for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
|
||||||
yyp != yystackp->yysplitPoint;
|
yyp != yystackp->yysplitPoint;
|
||||||
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
yyr = yyp, yyp = yyq, yyq = yyp->yypred)
|
||||||
yyp->yypred = yyr;
|
yyp->yypred = yyr;
|
||||||
@@ -1826,10 +1825,10 @@ yycompressStack (yyGLRStack* yystackp)
|
|||||||
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
|
||||||
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
|
yystackp->yynextFree = ((yyGLRStackItem*) yystackp->yysplitPoint) + 1;
|
||||||
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
|
yystackp->yyspaceLeft -= yystackp->yynextFree - yystackp->yyitems;
|
||||||
yystackp->yysplitPoint = YY_NULL;
|
yystackp->yysplitPoint = YY_NULLPTR;
|
||||||
yystackp->yylastDeleted = YY_NULL;
|
yystackp->yylastDeleted = YY_NULLPTR;
|
||||||
|
|
||||||
while (yyr != YY_NULL)
|
while (yyr != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yystackp->yynextFree->yystate = *yyr;
|
yystackp->yynextFree->yystate = *yyr;
|
||||||
yyr = yyr->yypred;
|
yyr = yyr->yypred;
|
||||||
@@ -1844,7 +1843,7 @@ static YYRESULTTAG
|
|||||||
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
yyprocessOneStack (yyGLRStack* yystackp, size_t yyk,
|
||||||
size_t yyposn]b4_pure_formals[)
|
size_t yyposn]b4_pure_formals[)
|
||||||
{
|
{
|
||||||
while (yystackp->yytops.yystates[yyk] != YY_NULL)
|
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
||||||
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
|
YYDPRINTF ((stderr, "Stack %lu Entering state %d\n",
|
||||||
@@ -1966,13 +1965,13 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
||||||
size_t yysize0 = yytnamerr (YY_NULL, yytokenName (yytoken));
|
size_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
|
||||||
size_t yysize = yysize0;
|
size_t yysize = yysize0;
|
||||||
yybool yysize_overflow = yyfalse;
|
yybool yysize_overflow = yyfalse;
|
||||||
char* yymsg = YY_NULL;
|
char* yymsg = YY_NULLPTR;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULL;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Number of reported tokens (one for the "unexpected", one per
|
||||||
@@ -2028,7 +2027,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
yyarg[yycount++] = yytokenName (yyx);
|
yyarg[yycount++] = yytokenName (yyx);
|
||||||
{
|
{
|
||||||
size_t yysz = yysize + yytnamerr (YY_NULL, yytokenName (yyx));
|
size_t yysz = yysize + yytnamerr (YY_NULLPTR, yytokenName (yyx));
|
||||||
yysize_overflow |= yysz < yysize;
|
yysize_overflow |= yysz < yysize;
|
||||||
yysize = yysz;
|
yysize = yysz;
|
||||||
}
|
}
|
||||||
@@ -2106,7 +2105,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yySymbol yytoken;
|
yySymbol yytoken;
|
||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
if (yychar != YYEMPTY)
|
if (yychar != YYEMPTY)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
/* We throw away the lookahead, but the error range
|
/* We throw away the lookahead, but the error range
|
||||||
@@ -2147,10 +2146,10 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
|
|
||||||
/* Reduce to one stack. */
|
/* Reduce to one stack. */
|
||||||
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
for (yyk = 0; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
if (yystackp->yytops.yystates[yyk] != YY_NULL)
|
if (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
break;
|
break;
|
||||||
if (yyk >= yystackp->yytops.yysize)
|
if (yyk >= yystackp->yytops.yysize)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
for (yyk += 1; yyk < yystackp->yytops.yysize; yyk += 1)
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
yyremoveDeletes (yystackp);
|
yyremoveDeletes (yystackp);
|
||||||
@@ -2158,7 +2157,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
|
|
||||||
/* Now pop stack until we find a state that shifts the error token. */
|
/* Now pop stack until we find a state that shifts the error token. */
|
||||||
yystackp->yyerrState = 3;
|
yystackp->yyerrState = 3;
|
||||||
while (yystackp->yytops.yystates[0] != YY_NULL)
|
while (yystackp->yytops.yystates[0] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
yyj = yypact[yys->yylrState];
|
yyj = yypact[yys->yylrState];
|
||||||
@@ -2182,14 +2181,14 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
}]b4_locations_if([[
|
}]b4_locations_if([[
|
||||||
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
yystackp->yyerror_range[1].yystate.yyloc = yys->yyloc;]])[
|
||||||
if (yys->yypred != YY_NULL)
|
if (yys->yypred != YY_NULLPTR)
|
||||||
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
yydestroyGLRState ("Error: popping", yys]b4_user_args[);
|
||||||
yystackp->yytops.yystates[0] = yys->yypred;
|
yystackp->yytops.yystates[0] = yys->yypred;
|
||||||
yystackp->yynextFree -= 1;
|
yystackp->yynextFree -= 1;
|
||||||
yystackp->yyspaceLeft += 1;
|
yystackp->yyspaceLeft += 1;
|
||||||
}
|
}
|
||||||
if (yystackp->yytops.yystates[0] == YY_NULL)
|
if (yystackp->yytops.yystates[0] == YY_NULLPTR)
|
||||||
yyFail (yystackp][]b4_lpure_args[, YY_NULL);
|
yyFail (yystackp][]b4_lpure_args[, YY_NULLPTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YYCHK1(YYE) \
|
#define YYCHK1(YYE) \
|
||||||
@@ -2432,7 +2431,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
{
|
{
|
||||||
yyGLRState *yys = yystates[yyk];
|
yyGLRState *yys = yystates[yyk];
|
||||||
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
]b4_locations_if([[ yystack.yyerror_range[1].yystate.yyloc = yys->yyloc;]]
|
||||||
)[ if (yys->yypred != YY_NULL)
|
)[ if (yys->yypred != YY_NULLPTR)
|
||||||
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
yydestroyGLRState ("Cleanup: popping", yys]b4_user_args[);
|
||||||
yystates[yyk] = yys->yypred;
|
yystates[yyk] = yys->yypred;
|
||||||
yystack.yynextFree -= 1;
|
yystack.yynextFree -= 1;
|
||||||
@@ -2464,7 +2463,7 @@ yy_yypstack (yyGLRState* yys)
|
|||||||
static void
|
static void
|
||||||
yypstates (yyGLRState* yyst)
|
yypstates (yyGLRState* yyst)
|
||||||
{
|
{
|
||||||
if (yyst == YY_NULL)
|
if (yyst == YY_NULLPTR)
|
||||||
YYFPRINTF (stderr, "<null>");
|
YYFPRINTF (stderr, "<null>");
|
||||||
else
|
else
|
||||||
yy_yypstack (yyst);
|
yy_yypstack (yyst);
|
||||||
@@ -2478,7 +2477,7 @@ yypstack (yyGLRStack* yystackp, size_t yyk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define YYINDEX(YYX) \
|
#define YYINDEX(YYX) \
|
||||||
((YYX) == YY_NULL ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
|
((YYX) == YY_NULLPTR ? -1 : (yyGLRStackItem*) (YYX) - yystackp->yyitems)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
125
data/lalr1.cc
125
data/lalr1.cc
@@ -157,6 +157,7 @@ m4_define([b4_shared_declarations],
|
|||||||
]b4_bison_locations_if([[# include "location.hh"]])])[
|
]b4_bison_locations_if([[# include "location.hh"]])])[
|
||||||
]b4_variant_if([b4_variant_includes])[
|
]b4_variant_if([b4_variant_includes])[
|
||||||
|
|
||||||
|
]b4_attribute_define[
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
@@ -183,14 +184,14 @@ b4_location_define])])[
|
|||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/// The current debugging stream.
|
/// The current debugging stream.
|
||||||
std::ostream& debug_stream () const;
|
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
|
||||||
/// Set the current debugging stream.
|
/// Set the current debugging stream.
|
||||||
void set_debug_stream (std::ostream &);
|
void set_debug_stream (std::ostream &);
|
||||||
|
|
||||||
/// Type for debugging levels.
|
/// Type for debugging levels.
|
||||||
typedef int debug_level_type;
|
typedef int debug_level_type;
|
||||||
/// The current debugging level.
|
/// The current debugging level.
|
||||||
debug_level_type debug_level () const;
|
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
|
||||||
/// Set the current debugging level.
|
/// Set the current debugging level.
|
||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
#endif
|
#endif
|
||||||
@@ -219,8 +220,8 @@ b4_location_define])])[
|
|||||||
|
|
||||||
/// Compute post-reduction state.
|
/// Compute post-reduction state.
|
||||||
/// \param yystate the current state
|
/// \param yystate the current state
|
||||||
/// \param yylhs the nonterminal to push on the stack
|
/// \param yysym the nonterminal to push on the stack
|
||||||
state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
|
state_type yy_lr_goto_state_ (state_type yystate, int yysym);
|
||||||
|
|
||||||
/// Whether the given \c yypact_ value indicates a defaulted state.
|
/// Whether the given \c yypact_ value indicates a defaulted state.
|
||||||
/// \param yyvalue the value to check
|
/// \param yyvalue the value to check
|
||||||
@@ -267,7 +268,7 @@ b4_location_define])])[
|
|||||||
/// \brief Reclaim the memory associated to a symbol.
|
/// \brief Reclaim the memory associated to a symbol.
|
||||||
/// \param yymsg Why this token is reclaimed.
|
/// \param yymsg Why this token is reclaimed.
|
||||||
/// If null, print nothing.
|
/// If null, print nothing.
|
||||||
/// \param s The symbol.
|
/// \param yysym The symbol.
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
|
||||||
|
|
||||||
@@ -341,13 +342,13 @@ b4_location_define])])[
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
yyeof_ = 0,
|
yyeof_ = 0,
|
||||||
yylast_ = ]b4_last[, //< Last index in yytable_.
|
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
||||||
yynnts_ = ]b4_nterms_number[, //< Number of nonterminal symbols.
|
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
||||||
yyempty_ = -2,
|
yyempty_ = -2,
|
||||||
yyfinal_ = ]b4_final_state_number[, //< Termination state number.
|
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
||||||
yyterror_ = 1,
|
yyterror_ = 1,
|
||||||
yyerrcode_ = 256,
|
yyerrcode_ = 256,
|
||||||
yyntokens_ = ]b4_tokens_number[ //< Number of tokens.
|
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
||||||
};
|
};
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
@@ -670,13 +671,13 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#endif // ]b4_api_PREFIX[DEBUG
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
inline ]b4_parser_class_name[::state_type
|
inline ]b4_parser_class_name[::state_type
|
||||||
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
|
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yysym)
|
||||||
{
|
{
|
||||||
int yyr = yypgoto_[yylhs - yyntokens_] + yystate;
|
int yyr = yypgoto_[yysym - yyntokens_] + yystate;
|
||||||
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
|
||||||
return yytable_[yyr];
|
return yytable_[yyr];
|
||||||
else
|
else
|
||||||
return yydefgoto_[yylhs - yyntokens_];
|
return yydefgoto_[yysym - yyntokens_];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
@@ -699,6 +700,7 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
|
|
||||||
// State.
|
// State.
|
||||||
int yyn;
|
int yyn;
|
||||||
|
/// Length of the RHS of the rule being reduced.
|
||||||
int yylen = 0;
|
int yylen = 0;
|
||||||
|
|
||||||
// Error handling.
|
// Error handling.
|
||||||
@@ -711,9 +713,6 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
/// The locations where the error started and ended.
|
/// The locations where the error started and ended.
|
||||||
stack_symbol_type yyerror_range[3];]])[
|
stack_symbol_type yyerror_range[3];]])[
|
||||||
|
|
||||||
/// $$ and @@$.
|
|
||||||
stack_symbol_type yylhs;
|
|
||||||
|
|
||||||
/// The return value of parse ().
|
/// The return value of parse ().
|
||||||
int yyresult;
|
int yyresult;
|
||||||
|
|
||||||
@@ -734,7 +733,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
location values to have been already stored, initialize these
|
location values to have been already stored, initialize these
|
||||||
stacks with a primary value. */
|
stacks with a primary value. */
|
||||||
yystack_.clear ();
|
yystack_.clear ();
|
||||||
yypush_ (YY_NULL, 0, yyla);
|
yypush_ (YY_NULLPTR, 0, yyla);
|
||||||
|
|
||||||
// A new symbol was pushed on the stack.
|
// A new symbol was pushed on the stack.
|
||||||
yynewstate:
|
yynewstate:
|
||||||
@@ -814,52 +813,55 @@ b4_dollar_popdef])[]dnl
|
|||||||
`-----------------------------*/
|
`-----------------------------*/
|
||||||
yyreduce:
|
yyreduce:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
{
|
||||||
/* Variants are always initialized to an empty instance of the
|
stack_symbol_type yylhs;
|
||||||
correct type. The default $$=$1 action is NOT applied when using
|
yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);]b4_variant_if([
|
||||||
variants. */
|
/* Variants are always initialized to an empty instance of the
|
||||||
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])],[
|
correct type. The default '$$ = $1' action is NOT applied
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
when using variants. */
|
||||||
'$$ = $1'. Otherwise, use the top of the stack.
|
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.
|
Otherwise, the following line sets YYLHS.VALUE to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison users should not rely
|
||||||
users should not rely upon it. */
|
upon it. */
|
||||||
if (yylen)
|
if (yylen)
|
||||||
yylhs.value = yystack_@{yylen - 1@}.value;
|
yylhs.value = yystack_@{yylen - 1@}.value;
|
||||||
else
|
else
|
||||||
yylhs.value = yystack_@{0@}.value;])[
|
yylhs.value = yystack_@{0@}.value;])[
|
||||||
]b4_locations_if([dnl
|
]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
|
|
||||||
{
|
{
|
||||||
switch (yyn)
|
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)
|
||||||
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
error (yyexc);
|
error (yyexc);
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
YY_SYMBOL_PRINT ("-> $$ =", yylhs);
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
YY_STACK_PRINT ();
|
YY_STACK_PRINT ();
|
||||||
|
|
||||||
// Shift the result of the reduction.
|
// Shift the result of the reduction.
|
||||||
yypush_ (YY_NULL, yylhs);
|
yypush_ (YY_NULLPTR, yylhs);
|
||||||
|
}
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
/*--------------------------------------.
|
/*--------------------------------------.
|
||||||
@@ -906,10 +908,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
code. */
|
code. */
|
||||||
if (false)
|
if (false)
|
||||||
goto yyerrorlab;]b4_locations_if([[
|
goto yyerrorlab;]b4_locations_if([[
|
||||||
yyerror_range[1].location = yystack_[yylen - 1].location;]])b4_variant_if([[
|
yyerror_range[1].location = yystack_[yylen - 1].location;]])[
|
||||||
/* $$ 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
|
/* Do not reclaim the symbols of the rule whose action triggered
|
||||||
this YYERROR. */
|
this YYERROR. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
@@ -988,11 +987,11 @@ b4_dollar_popdef])[]dnl
|
|||||||
// Do not try to display the values of the reclaimed symbols,
|
// Do not try to display the values of the reclaimed symbols,
|
||||||
// as their printer might throw an exception.
|
// as their printer might throw an exception.
|
||||||
if (!yyempty)
|
if (!yyempty)
|
||||||
yy_destroy_ (YY_NULL, yyla);
|
yy_destroy_ (YY_NULLPTR, yyla);
|
||||||
|
|
||||||
while (1 < yystack_.size ())
|
while (1 < yystack_.size ())
|
||||||
{
|
{
|
||||||
yy_destroy_ (YY_NULL, yystack_[0]);
|
yy_destroy_ (YY_NULLPTR, yystack_[0]);
|
||||||
yypop_ ();
|
yypop_ ();
|
||||||
}
|
}
|
||||||
throw;
|
throw;
|
||||||
@@ -1074,7 +1073,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* yyformat = YY_NULL;
|
char const* yyformat = YY_NULLPTR;
|
||||||
switch (yycount)
|
switch (yycount)
|
||||||
{
|
{
|
||||||
#define YYCASE_(N, S) \
|
#define YYCASE_(N, S) \
|
||||||
|
|||||||
@@ -453,6 +453,19 @@ b4_define_state])[
|
|||||||
return yyerrstatus_ == 0;
|
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])[
|
private int yyaction (int yyn, YYStack yystack, int yylen) ]b4_maybe_throws([b4_throws])[
|
||||||
{
|
{
|
||||||
]b4_yystype[ yyval;
|
]b4_yystype[ yyval;
|
||||||
@@ -483,14 +496,7 @@ b4_define_state])[
|
|||||||
yylen = 0;
|
yylen = 0;
|
||||||
|
|
||||||
/* Shift the result of the reduction. */
|
/* Shift the result of the reduction. */
|
||||||
yyn = yyr1_[yyn];
|
int yystate = yy_lr_goto_state_ (yystack.stateAt (0), 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])[);
|
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
||||||
return YYNEWSTATE;
|
return YYNEWSTATE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ m4_define([b4_position_define],
|
|||||||
{
|
{
|
||||||
public:]m4_ifdef([b4_location_constructors], [[
|
public:]m4_ifdef([b4_location_constructors], [[
|
||||||
/// Construct a position.
|
/// Construct a position.
|
||||||
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
explicit position (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
: filename (f)
|
: filename (f)
|
||||||
@@ -38,7 +38,7 @@ m4_define([b4_position_define],
|
|||||||
|
|
||||||
]])[
|
]])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULL,
|
void initialize (]b4_percent_define_get([[filename_type]])[* fn = YY_NULLPTR,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
{
|
{
|
||||||
@@ -178,7 +178,7 @@ m4_define([b4_location_define],
|
|||||||
|
|
||||||
])[
|
])[
|
||||||
/// Initialization.
|
/// Initialization.
|
||||||
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULL,
|
void initialize (]b4_percent_define_get([[filename_type]])[* f = YY_NULLPTR,
|
||||||
unsigned int l = ]b4_location_initial_line[u,
|
unsigned int l = ]b4_location_initial_line[u,
|
||||||
unsigned int c = ]b4_location_initial_column[u)
|
unsigned int c = ]b4_location_initial_column[u)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ m4_define([b4_variant_define],
|
|||||||
|
|
||||||
/// Empty construction.
|
/// Empty construction.
|
||||||
variant ()]b4_parse_assert_if([
|
variant ()]b4_parse_assert_if([
|
||||||
: yytname_ (YY_NULL)])[
|
: yytname_ (YY_NULLPTR)])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Construct and fill.
|
/// Construct and fill.
|
||||||
@@ -198,7 +198,7 @@ m4_define([b4_variant_define],
|
|||||||
destroy ()
|
destroy ()
|
||||||
{
|
{
|
||||||
as<T> ().~T ();]b4_parse_assert_if([
|
as<T> ().~T ();]b4_parse_assert_if([
|
||||||
yytname_ = YY_NULL;])[
|
yytname_ = YY_NULLPTR;])[
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -320,7 +320,6 @@ b4_join(b4_symbol_if([$1], [has_type],
|
|||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
b4_locations_if([l])));
|
b4_locations_if([l])));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
])])])
|
])])])
|
||||||
|
|||||||
@@ -201,6 +201,8 @@
|
|||||||
<xsl:if test="$point = 0">
|
<xsl:if test="$point = 0">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- RHS -->
|
||||||
<xsl:for-each select="rhs/symbol|rhs/empty">
|
<xsl:for-each select="rhs/symbol|rhs/empty">
|
||||||
<xsl:apply-templates select="."/>
|
<xsl:apply-templates select="."/>
|
||||||
<xsl:if test="$point = position()">
|
<xsl:if test="$point = position()">
|
||||||
@@ -214,7 +216,9 @@
|
|||||||
<xsl:value-of select="."/>
|
<xsl:value-of select="."/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty"/>
|
<xsl:template match="empty">
|
||||||
|
<xsl:text> %empty</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
<xsl:text> [</xsl:text>
|
<xsl:text> [</xsl:text>
|
||||||
|
|||||||
@@ -350,12 +350,7 @@
|
|||||||
<xsl:if test="position() = $point + 1">
|
<xsl:if test="position() = $point + 1">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
<xsl:apply-templates select="."/>
|
||||||
<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:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|||||||
@@ -532,12 +532,7 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="point">.</span>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="$itemset = 'true' and name(.) != 'empty'">
|
<xsl:apply-templates select="."/>
|
||||||
<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:if test="position() = last() and position() = $point">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<span class="point">.</span>
|
<span class="point">.</span>
|
||||||
@@ -563,7 +558,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="empty">
|
<xsl:template match="empty">
|
||||||
<xsl:text> ε</xsl:text>
|
<xsl:text> %empty</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
|
|||||||
12
data/yacc.c
12
data/yacc.c
@@ -1108,11 +1108,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
]b4_lac_if([[yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||||
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
YYSIZE_T *yyes_capacity, ]])[yytype_int16 *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULL;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* 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];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||||
if (! (yysize <= yysize1
|
if (! (yysize <= yysize1
|
||||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
return 2;
|
return 2;
|
||||||
@@ -1271,7 +1271,7 @@ static char yypstate_allocated = 0;]])b4_pull_if([
|
|||||||
|
|
||||||
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
b4_function_define([[yyparse]], [[int]], b4_parse_param)[
|
||||||
{
|
{
|
||||||
return yypull_parse (YY_NULL]m4_ifset([b4_parse_param],
|
return yypull_parse (YY_NULLPTR]m4_ifset([b4_parse_param],
|
||||||
[[, ]b4_args(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([], [[
|
yypstate *yyps;]b4_pure_if([], [[
|
||||||
if (yypstate_allocated)
|
if (yypstate_allocated)
|
||||||
return YY_NULL;]])[
|
return YY_NULLPTR;]])[
|
||||||
yyps = (yypstate *) malloc (sizeof *yyps);
|
yyps = (yypstate *) malloc (sizeof *yyps);
|
||||||
if (!yyps)
|
if (!yyps)
|
||||||
return YY_NULL;
|
return YY_NULLPTR;
|
||||||
yyps->yynew = 1;]b4_pure_if([], [[
|
yyps->yynew = 1;]b4_pure_if([], [[
|
||||||
yypstate_allocated = 1;]])[
|
yypstate_allocated = 1;]])[
|
||||||
return yyps;
|
return yyps;
|
||||||
|
|||||||
@@ -10065,18 +10065,16 @@ A category can be turned off by prefixing its name with @samp{no-}. For
|
|||||||
instance, @option{-Wno-yacc} will hide the warnings about
|
instance, @option{-Wno-yacc} will hide the warnings about
|
||||||
POSIX Yacc incompatibilities.
|
POSIX Yacc incompatibilities.
|
||||||
|
|
||||||
@item -Werror[=@var{category}]
|
@item -Werror
|
||||||
@itemx -Wno-error[=@var{category}]
|
Turn enabled warnings for every @var{category} into errors, unless they are
|
||||||
Enable warnings falling in @var{category}, and treat them as errors. If no
|
explicitly disabled by @option{-Wno-error=@var{category}}.
|
||||||
@var{category} is given, it defaults to making all enabled warnings into errors.
|
|
||||||
|
@item -Werror=@var{category}
|
||||||
|
Enable warnings falling in @var{category}, and treat them as errors.
|
||||||
|
|
||||||
@var{category} is the same as for @option{--warnings}, with the exception that
|
@var{category} is the same as for @option{--warnings}, with the exception that
|
||||||
it may not be prefixed with @samp{no-} (see above).
|
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
|
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
|
the following commands are @emph{not} equivalent, as the first will not treat
|
||||||
S/R conflicts as errors.
|
S/R conflicts as errors.
|
||||||
@@ -10086,6 +10084,14 @@ $ bison -Werror=yacc,conflicts-sr input.y
|
|||||||
$ bison -Werror=yacc,error=conflicts-sr input.y
|
$ bison -Werror=yacc,error=conflicts-sr input.y
|
||||||
@end example
|
@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}]
|
@item -f [@var{feature}]
|
||||||
@itemx --feature[=@var{feature}]
|
@itemx --feature[=@var{feature}]
|
||||||
Activate miscellaneous @var{feature}. @var{feature} can be one of:
|
Activate miscellaneous @var{feature}. @var{feature} can be one of:
|
||||||
|
|||||||
@@ -118,7 +118,9 @@ $(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
|||||||
fi
|
fi
|
||||||
$(AM_V_at)rm -f $@*.t
|
$(AM_V_at)rm -f $@*.t
|
||||||
|
|
||||||
|
if ENABLE_YACC
|
||||||
nodist_man_MANS = doc/yacc.1
|
nodist_man_MANS = doc/yacc.1
|
||||||
|
endif
|
||||||
|
|
||||||
## ----------------------------- ##
|
## ----------------------------- ##
|
||||||
## Graphviz examples generation. ##
|
## Graphviz examples generation. ##
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
# in srcdir, including during distcheck, which is forbidden.
|
||||||
examples/calc++/calc++-parser.stamp: $(BISON_IN)
|
%D%/calc++-parser.stamp: $(BISON_IN)
|
||||||
SUFFIXES += .yy .stamp
|
SUFFIXES += .yy .stamp
|
||||||
.yy.stamp:
|
.yy.stamp:
|
||||||
$(AM_V_YACC)rm -f $@
|
$(AM_V_YACC)rm -f $@
|
||||||
@@ -27,14 +27,14 @@ SUFFIXES += .yy .stamp
|
|||||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
||||||
$(AM_V_at)mv -f $@.tmp $@
|
$(AM_V_at)mv -f $@.tmp $@
|
||||||
|
|
||||||
$(calc_sources_generated): examples/calc++/calc++-parser.stamp
|
$(calc_sources_generated): %D%/calc++-parser.stamp
|
||||||
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp
|
@test -f $@ || rm -f %D%/calc++-parser.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/calc++-parser.stamp
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
$(calc_sources_generated) \
|
$(calc_sources_generated) \
|
||||||
examples/calc++/calc++-parser.output \
|
%D%/calc++-parser.output \
|
||||||
examples/calc++/calc++-parser.stamp \
|
%D%/calc++-parser.stamp \
|
||||||
examples/calc++/calc++-scanner.cc
|
%D%/calc++-scanner.cc
|
||||||
|
|
||||||
|
|
||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
@@ -42,35 +42,35 @@ CLEANFILES += \
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
# Avoid using BUILT_SOURCES which is too global.
|
# Avoid using BUILT_SOURCES which is too global.
|
||||||
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
$(%C%_calc___OBJECTS): $(calc_sources_generated)
|
||||||
|
|
||||||
calc_sources_extracted = \
|
calc_sources_extracted = \
|
||||||
examples/calc++/calc++-driver.cc \
|
%D%/calc++-driver.cc \
|
||||||
examples/calc++/calc++-driver.hh \
|
%D%/calc++-driver.hh \
|
||||||
examples/calc++/calc++-scanner.ll \
|
%D%/calc++-scanner.ll \
|
||||||
examples/calc++/calc++.cc
|
%D%/calc++.cc
|
||||||
calc_extracted = \
|
calc_extracted = \
|
||||||
$(calc_sources_extracted) \
|
$(calc_sources_extracted) \
|
||||||
examples/calc++/calc++-parser.yy
|
%D%/calc++-parser.yy
|
||||||
extracted += $(calc_extracted)
|
extracted += $(calc_extracted)
|
||||||
calc_sources_generated = \
|
calc_sources_generated = \
|
||||||
examples/calc++/calc++-parser.cc \
|
%D%/calc++-parser.cc \
|
||||||
examples/calc++/calc++-parser.hh \
|
%D%/calc++-parser.hh \
|
||||||
examples/calc++/location.hh \
|
%D%/location.hh \
|
||||||
examples/calc++/position.hh \
|
%D%/position.hh \
|
||||||
examples/calc++/stack.hh
|
%D%/stack.hh
|
||||||
calc_sources = \
|
calc_sources = \
|
||||||
$(calc_sources_extracted) \
|
$(calc_sources_extracted) \
|
||||||
$(calc_sources_generated)
|
$(calc_sources_generated)
|
||||||
|
|
||||||
if BISON_CXX_WORKS
|
if FLEX_CXX_WORKS
|
||||||
check_PROGRAMS += examples/calc++/calc++
|
check_PROGRAMS += %D%/calc++
|
||||||
nodist_examples_calc___calc___SOURCES = \
|
nodist_%C%_calc___SOURCES = \
|
||||||
$(calc_sources)
|
$(calc_sources)
|
||||||
|
|
||||||
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
%C%_calc___CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
examples_calc___calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
%C%_calc___CXXFLAGS = $(AM_CXXFLAGS) $(FLEX_SCANNER_CXXFLAGS)
|
||||||
dist_TESTS += examples/calc++/calc++.test
|
dist_TESTS += %D%/calc++.test
|
||||||
else
|
else
|
||||||
EXTRA_DIST += examples/calc++/calc++.test
|
EXTRA_DIST += %D%/calc++.test
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
dist_noinst_SCRIPTS = examples/extexi examples/test
|
dist_noinst_SCRIPTS = %D%/extexi %D%/test
|
||||||
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
TEST_LOG_COMPILER = $(top_srcdir)/%D%/test
|
||||||
|
|
||||||
AM_CXXFLAGS = \
|
AM_CXXFLAGS = \
|
||||||
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
$(WARN_CXXFLAGS) $(WARN_CXXFLAGS_TEST) $(WERROR_CXXFLAGS)
|
||||||
@@ -24,20 +24,20 @@ AM_CXXFLAGS = \
|
|||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|
||||||
doc = $(top_srcdir)/doc/bison.texi
|
doc = $(top_srcdir)/doc/bison.texi
|
||||||
extexi = $(top_srcdir)/examples/extexi
|
extexi = $(top_srcdir)/%D%/extexi
|
||||||
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(doc) --
|
extract = VERSION="$(VERSION)" $(PERL) $(extexi) $(doc) --
|
||||||
extracted =
|
extracted =
|
||||||
CLEANFILES += $(extracted) examples/extracted.stamp
|
CLEANFILES += $(extracted) %D%/extracted.stamp
|
||||||
examples/extracted.stamp: $(doc) $(extexi)
|
%D%/extracted.stamp: $(doc) $(extexi)
|
||||||
$(AM_V_GEN)rm -f $@ $@.tmp
|
$(AM_V_GEN)rm -f $@ $@.tmp
|
||||||
$(AM_V_at)touch $@.tmp
|
$(AM_V_at)touch $@.tmp
|
||||||
$(AM_V_at)$(extract) $(extracted)
|
$(AM_V_at)$(extract) $(extracted)
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
|
||||||
$(extracted): examples/extracted.stamp
|
$(extracted): %D%/extracted.stamp
|
||||||
@test -f $@ || rm -f examples/extracted.stamp
|
@test -f $@ || rm -f %D%/extracted.stamp
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
|
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %D%/extracted.stamp
|
||||||
|
|
||||||
include examples/calc++/local.mk
|
include %D%/calc++/local.mk
|
||||||
include examples/mfcalc/local.mk
|
include %D%/mfcalc/local.mk
|
||||||
include examples/rpcalc/local.mk
|
include %D%/rpcalc/local.mk
|
||||||
|
|||||||
@@ -18,19 +18,15 @@
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
BUILT_SOURCES += $(mfcalc_sources)
|
BUILT_SOURCES += $(mfcalc_sources)
|
||||||
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output
|
CLEANFILES += %D%/mfcalc.[ch] %D%/mfcalc.output
|
||||||
|
|
||||||
mfcalc_extracted = \
|
mfcalc_extracted = %D%/calc.h %D%/mfcalc.y
|
||||||
examples/mfcalc/calc.h \
|
mfcalc_sources = $(mfcalc_extracted)
|
||||||
examples/mfcalc/mfcalc.y
|
|
||||||
mfcalc_sources = \
|
|
||||||
$(mfcalc_extracted)
|
|
||||||
extracted += $(mfcalc_extracted)
|
extracted += $(mfcalc_extracted)
|
||||||
|
|
||||||
check_PROGRAMS += examples/mfcalc/mfcalc
|
check_PROGRAMS += %D%/mfcalc
|
||||||
examples_mfcalc_mfcalc_LDADD = -lm
|
%C%_mfcalc_LDADD = -lm
|
||||||
nodist_examples_mfcalc_mfcalc_SOURCES = \
|
nodist_%C%_mfcalc_SOURCES = $(mfcalc_sources)
|
||||||
$(mfcalc_sources)
|
|
||||||
|
|
||||||
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
|
%C%_mfcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
dist_TESTS += examples/mfcalc/mfcalc.test
|
dist_TESTS += %D%/mfcalc.test
|
||||||
|
|||||||
1
examples/rpcalc/.gitignore
vendored
1
examples/rpcalc/.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/calc.h
|
/calc.h
|
||||||
|
/rpcalc
|
||||||
/rpcalc.c
|
/rpcalc.c
|
||||||
/rpcalc.h
|
/rpcalc.h
|
||||||
/rpcalc.output
|
/rpcalc.output
|
||||||
|
|||||||
@@ -18,18 +18,15 @@
|
|||||||
## -------------------- ##
|
## -------------------- ##
|
||||||
|
|
||||||
BUILT_SOURCES += $(rpcalc_sources)
|
BUILT_SOURCES += $(rpcalc_sources)
|
||||||
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output
|
CLEANFILES += %D%/rpcalc.[ch] %D%/rpcalc.output
|
||||||
|
|
||||||
rpcalc_extracted = \
|
rpcalc_extracted = %D%/rpcalc.y
|
||||||
examples/rpcalc/rpcalc.y
|
rpcalc_sources = $(rpcalc_extracted)
|
||||||
rpcalc_sources = \
|
|
||||||
$(rpcalc_extracted)
|
|
||||||
extracted += $(rpcalc_extracted)
|
extracted += $(rpcalc_extracted)
|
||||||
|
|
||||||
check_PROGRAMS += examples/rpcalc/rpcalc
|
check_PROGRAMS += %D%/rpcalc
|
||||||
examples_rpcalc_rpcalc_LDADD = -lm
|
%C%_rpcalc_LDADD = -lm
|
||||||
nodist_examples_rpcalc_rpcalc_SOURCES = \
|
nodist_%C%_rpcalc_SOURCES = $(rpcalc_sources)
|
||||||
$(rpcalc_sources)
|
|
||||||
|
|
||||||
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
|
%C%_rpcalc_CPPFLAGS = -I$(top_builddir)/%D%
|
||||||
dist_TESTS += examples/rpcalc/rpcalc.test
|
dist_TESTS += %D%/rpcalc.test
|
||||||
|
|||||||
2
gnulib
2
gnulib
Submodule gnulib updated: 03e96cc338...74540d44dc
2
lib/.gitignore
vendored
2
lib/.gitignore
vendored
@@ -272,3 +272,5 @@
|
|||||||
/sig-handler.c
|
/sig-handler.c
|
||||||
/unistd.c
|
/unistd.c
|
||||||
/wctype-h.c
|
/wctype-h.c
|
||||||
|
/lstat.c
|
||||||
|
/unlink.c
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ lib_libbison_a_SOURCES += \
|
|||||||
lib/get-errno.c
|
lib/get-errno.c
|
||||||
|
|
||||||
# The Yacc compatibility library.
|
# The Yacc compatibility library.
|
||||||
lib_LIBRARIES = $(YACC_LIBRARY)
|
if ENABLE_YACC
|
||||||
|
lib_LIBRARIES = lib/liby.a
|
||||||
EXTRA_LIBRARIES = lib/liby.a
|
EXTRA_LIBRARIES = lib/liby.a
|
||||||
lib_liby_a_SOURCES = lib/main.c lib/yyerror.c
|
lib_liby_a_SOURCES = lib/main.c lib/yyerror.c
|
||||||
|
endif
|
||||||
|
|||||||
3
m4/.gitignore
vendored
3
m4/.gitignore
vendored
@@ -180,3 +180,6 @@
|
|||||||
/obstack-printf.m4
|
/obstack-printf.m4
|
||||||
/extern-inline.m4
|
/extern-inline.m4
|
||||||
/non-recursive-gnulib-prefix-hack.m4
|
/non-recursive-gnulib-prefix-hack.m4
|
||||||
|
/absolute-header.m4
|
||||||
|
/lstat.m4
|
||||||
|
/unlink.m4
|
||||||
|
|||||||
@@ -541,9 +541,13 @@ AnnotationList__compute_from_inadequacies (
|
|||||||
{
|
{
|
||||||
InadequacyList__prependTo (conflict_node,
|
InadequacyList__prependTo (conflict_node,
|
||||||
&inadequacy_lists[s->number]);
|
&inadequacy_lists[s->number]);
|
||||||
aver (AnnotationList__insertInto (
|
{
|
||||||
annotation_node, &annotation_lists[s->number],
|
bool b =
|
||||||
s->nitems));
|
AnnotationList__insertInto (annotation_node,
|
||||||
|
&annotation_lists[s->number],
|
||||||
|
s->nitems);
|
||||||
|
aver (b);
|
||||||
|
}
|
||||||
/* This aver makes sure the
|
/* This aver makes sure the
|
||||||
AnnotationList__computeDominantContribution check above
|
AnnotationList__computeDominantContribution check above
|
||||||
does discard annotations in the simplest case of a S/R
|
does discard annotations in the simplest case of a S/R
|
||||||
|
|||||||
102
src/complain.c
102
src/complain.c
@@ -35,14 +35,25 @@ err_status complaint_status = status_none;
|
|||||||
|
|
||||||
bool warnings_are_errors = false;
|
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. */
|
/** Diagnostics severity. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
severity_disabled = 0,
|
severity_disabled = 0, /**< Explicitly disabled via -Wno-foo. */
|
||||||
severity_unset = 1,
|
severity_unset = 1, /**< Unspecified status. */
|
||||||
severity_warning = 2,
|
severity_warning = 2, /**< A warning. */
|
||||||
severity_error = 3,
|
severity_error = 3, /**< An error (continue, but die soon). */
|
||||||
severity_fatal = 4
|
severity_fatal = 4 /**< Fatal error (die now). */
|
||||||
} severity;
|
} severity;
|
||||||
|
|
||||||
|
|
||||||
@@ -103,32 +114,26 @@ warning_argmatch (char const *arg, size_t no, size_t err)
|
|||||||
no = !no;
|
no = !no;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no)
|
size_t b;
|
||||||
{
|
for (b = 0; b < warnings_size; ++b)
|
||||||
size_t b;
|
if (value & 1 << 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 (err)
|
/* -Werror=foo: enables -Wfoo. */
|
||||||
{
|
errority_flag[b] = errority_enabled;
|
||||||
/* -Wno-error=foo: if foo enabled as an error,
|
warnings_flag[b] = severity_warning;
|
||||||
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)
|
||||||
else
|
/* -Wno-foo. */
|
||||||
{
|
warnings_flag[b] = severity_disabled;
|
||||||
size_t b;
|
else
|
||||||
for (b = 0; b < warnings_size; ++b)
|
/* -Wfoo. */
|
||||||
if (value & 1 << b)
|
warnings_flag[b] = severity_warning;
|
||||||
/* -Wfoo and -Werror=foo. */
|
}
|
||||||
warnings_flag[b] = err ? severity_error : severity_warning;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Decode a comma-separated list of arguments from -W.
|
/** Decode a comma-separated list of arguments from -W.
|
||||||
@@ -145,13 +150,13 @@ warnings_argmatch (char *args)
|
|||||||
if (STREQ (args, "error"))
|
if (STREQ (args, "error"))
|
||||||
warnings_are_errors = true;
|
warnings_are_errors = true;
|
||||||
else if (STREQ (args, "no-error"))
|
else if (STREQ (args, "no-error"))
|
||||||
{
|
warnings_are_errors = false;
|
||||||
warnings_are_errors = false;
|
|
||||||
warning_argmatch ("no-error=everything", 3, 6);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* The length of the possible 'no-' prefix: 3, or 0. */
|
||||||
size_t no = STRPREFIX_LIT ("no-", args) ? 3 : 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;
|
size_t err = STRPREFIX_LIT ("error=", args + no) ? 6 : 0;
|
||||||
|
|
||||||
warning_argmatch (args, no, err);
|
warning_argmatch (args, no, err);
|
||||||
@@ -173,27 +178,46 @@ complain_init (void)
|
|||||||
|
|
||||||
size_t b;
|
size_t b;
|
||||||
for (b = 0; b < warnings_size; ++b)
|
for (b = 0; b < warnings_size; ++b)
|
||||||
warnings_flag[b] = (1 << b & warnings_default
|
{
|
||||||
? severity_warning
|
warnings_flag[b] = (1 << b & warnings_default
|
||||||
: severity_unset);
|
? severity_warning
|
||||||
|
: severity_unset);
|
||||||
|
errority_flag[b] = errority_unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* A diagnostic with FLAGS is about to be issued. With what severity?
|
||||||
|
(severity_fatal, severity_error, severity_disabled, or
|
||||||
|
severity_warning.) */
|
||||||
|
|
||||||
static severity
|
static severity
|
||||||
warning_severity (warnings flags)
|
warning_severity (warnings flags)
|
||||||
{
|
{
|
||||||
if (flags & fatal)
|
if (flags & fatal)
|
||||||
|
/* Diagnostics about fatal errors. */
|
||||||
return severity_fatal;
|
return severity_fatal;
|
||||||
else if (flags & complaint)
|
else if (flags & complaint)
|
||||||
|
/* Diagnostics about errors. */
|
||||||
return severity_error;
|
return severity_error;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Diagnostics about warnings. */
|
||||||
severity res = severity_disabled;
|
severity res = severity_disabled;
|
||||||
size_t b;
|
size_t b;
|
||||||
for (b = 0; b < warnings_size; ++b)
|
for (b = 0; b < warnings_size; ++b)
|
||||||
if (flags & 1 << b)
|
if (flags & 1 << b)
|
||||||
res = res < warnings_flag[b] ? warnings_flag[b] : res;
|
{
|
||||||
if (res == severity_warning && warnings_are_errors)
|
res = res < warnings_flag[b] ? warnings_flag[b] : res;
|
||||||
res = severity_error;
|
/* 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;
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,14 +128,14 @@ void deprecated_directive (location const *loc,
|
|||||||
void duplicate_directive (char const *directive,
|
void duplicate_directive (char const *directive,
|
||||||
location first, location second);
|
location first, location second);
|
||||||
|
|
||||||
/** Warnings treated as errors shouldn't stop the execution as regular errors
|
/** Warnings treated as errors shouldn't stop the execution as regular
|
||||||
should (because due to their nature, it is safe to go on). Thus, there are
|
errors should (because due to their nature, it is safe to go
|
||||||
three possible execution statuses. */
|
on). Thus, there are three possible execution statuses. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
status_none,
|
status_none, /**< No diagnostic issued so far. */
|
||||||
status_warning_as_error,
|
status_warning_as_error, /**< A warning was issued (but no error). */
|
||||||
status_complaint
|
status_complaint /**< An error was issued. */
|
||||||
} err_status;
|
} err_status;
|
||||||
|
|
||||||
/** Whether an error was reported. */
|
/** Whether an error was reported. */
|
||||||
|
|||||||
50
src/files.c
50
src/files.c
@@ -51,8 +51,17 @@ char *spec_defines_file = NULL; /* for --defines. */
|
|||||||
char *parser_file_name;
|
char *parser_file_name;
|
||||||
|
|
||||||
/* All computed output file names. */
|
/* All computed output file names. */
|
||||||
static char **file_names = NULL;
|
typedef struct generated_file
|
||||||
static int file_names_count = 0;
|
{
|
||||||
|
/** 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;
|
||||||
|
|
||||||
uniqstr grammar_file = NULL;
|
uniqstr grammar_file = NULL;
|
||||||
uniqstr current_file = NULL;
|
uniqstr current_file = NULL;
|
||||||
@@ -332,21 +341,21 @@ compute_output_file_names (void)
|
|||||||
{
|
{
|
||||||
if (! spec_graph_file)
|
if (! spec_graph_file)
|
||||||
spec_graph_file = concat2 (all_but_tab_ext, ".dot");
|
spec_graph_file = concat2 (all_but_tab_ext, ".dot");
|
||||||
output_file_name_check (&spec_graph_file);
|
output_file_name_check (&spec_graph_file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xml_flag)
|
if (xml_flag)
|
||||||
{
|
{
|
||||||
if (! spec_xml_file)
|
if (! spec_xml_file)
|
||||||
spec_xml_file = concat2 (all_but_tab_ext, ".xml");
|
spec_xml_file = concat2 (all_but_tab_ext, ".xml");
|
||||||
output_file_name_check (&spec_xml_file);
|
output_file_name_check (&spec_xml_file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report_flag)
|
if (report_flag)
|
||||||
{
|
{
|
||||||
if (!spec_verbose_file)
|
if (!spec_verbose_file)
|
||||||
spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
|
spec_verbose_file = concat2 (all_but_tab_ext, OUTPUT_EXT);
|
||||||
output_file_name_check (&spec_verbose_file);
|
output_file_name_check (&spec_verbose_file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (all_but_tab_ext);
|
free (all_but_tab_ext);
|
||||||
@@ -355,7 +364,7 @@ compute_output_file_names (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
output_file_name_check (char **file_name)
|
output_file_name_check (char **file_name, bool source)
|
||||||
{
|
{
|
||||||
bool conflict = false;
|
bool conflict = false;
|
||||||
if (STREQ (*file_name, grammar_file))
|
if (STREQ (*file_name, grammar_file))
|
||||||
@@ -367,11 +376,11 @@ output_file_name_check (char **file_name)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < file_names_count; i++)
|
for (i = 0; i < generated_files_size; i++)
|
||||||
if (STREQ (file_names[i], *file_name))
|
if (STREQ (generated_files[i].name, *file_name))
|
||||||
{
|
{
|
||||||
complain (NULL, Wother, _("conflicting outputs to file %s"),
|
complain (NULL, Wother, _("conflicting outputs to file %s"),
|
||||||
quote (*file_name));
|
quote (generated_files[i].name));
|
||||||
conflict = true;
|
conflict = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,12 +391,23 @@ output_file_name_check (char **file_name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
file_names = xnrealloc (file_names, ++file_names_count,
|
generated_files = xnrealloc (generated_files, ++generated_files_size,
|
||||||
sizeof *file_names);
|
sizeof *generated_files);
|
||||||
file_names[file_names_count-1] = xstrdup (*file_name);
|
generated_files[generated_files_size-1].name = xstrdup (*file_name);
|
||||||
|
generated_files[generated_files_size-1].is_source = source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
output_file_names_free (void)
|
output_file_names_free (void)
|
||||||
{
|
{
|
||||||
@@ -400,8 +420,8 @@ output_file_names_free (void)
|
|||||||
free (dir_prefix);
|
free (dir_prefix);
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < file_names_count; i++)
|
for (i = 0; i < generated_files_size; i++)
|
||||||
free (file_names[i]);
|
free (generated_files[i].name);
|
||||||
}
|
}
|
||||||
free (file_names);
|
free (generated_files);
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/files.h
10
src/files.h
@@ -63,7 +63,15 @@ extern char *all_but_ext;
|
|||||||
|
|
||||||
void compute_output_file_names (void);
|
void compute_output_file_names (void);
|
||||||
void output_file_names_free (void);
|
void output_file_names_free (void);
|
||||||
void output_file_name_check (char **file_name);
|
|
||||||
|
/** 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);
|
||||||
|
|
||||||
FILE *xfopen (const char *name, char const *mode);
|
FILE *xfopen (const char *name, char const *mode);
|
||||||
void xfclose (FILE *ptr);
|
void xfclose (FILE *ptr);
|
||||||
|
|||||||
42
src/lalr.c
42
src/lalr.c
@@ -67,17 +67,13 @@ static goto_number **includes;
|
|||||||
static goto_list **lookback;
|
static goto_list **lookback;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_goto_map (void)
|
set_goto_map (void)
|
||||||
{
|
{
|
||||||
state_number s;
|
state_number s;
|
||||||
goto_number *temp_map;
|
goto_number *temp_map = xnmalloc (nvars + 1, sizeof *temp_map);
|
||||||
|
|
||||||
goto_map = xcalloc (nvars + 1, sizeof *goto_map);
|
goto_map = xcalloc (nvars + 1, sizeof *goto_map);
|
||||||
temp_map = xnmalloc (nvars + 1, sizeof *temp_map);
|
|
||||||
|
|
||||||
ngotos = 0;
|
ngotos = 0;
|
||||||
for (s = 0; s < nstates; ++s)
|
for (s = 0; s < nstates; ++s)
|
||||||
{
|
{
|
||||||
@@ -132,16 +128,13 @@ set_goto_map (void)
|
|||||||
goto_number
|
goto_number
|
||||||
map_goto (state_number s0, symbol_number sym)
|
map_goto (state_number s0, symbol_number sym)
|
||||||
{
|
{
|
||||||
goto_number high;
|
goto_number low = goto_map[sym - ntokens];
|
||||||
goto_number low;
|
goto_number high = goto_map[sym - ntokens + 1] - 1;
|
||||||
goto_number middle;
|
|
||||||
state_number s;
|
|
||||||
|
|
||||||
low = goto_map[sym - ntokens];
|
|
||||||
high = goto_map[sym - ntokens + 1] - 1;
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
goto_number middle;
|
||||||
|
state_number s;
|
||||||
aver (low <= high);
|
aver (low <= high);
|
||||||
middle = (low + high) / 2;
|
middle = (low + high) / 2;
|
||||||
s = from_state[middle];
|
s = from_state[middle];
|
||||||
@@ -412,7 +405,6 @@ static void
|
|||||||
lookahead_tokens_print (FILE *out)
|
lookahead_tokens_print (FILE *out)
|
||||||
{
|
{
|
||||||
state_number i;
|
state_number i;
|
||||||
int j, k;
|
|
||||||
fprintf (out, "Lookahead tokens: BEGIN\n");
|
fprintf (out, "Lookahead tokens: BEGIN\n");
|
||||||
for (i = 0; i < nstates; ++i)
|
for (i = 0; i < nstates; ++i)
|
||||||
{
|
{
|
||||||
@@ -421,21 +413,25 @@ lookahead_tokens_print (FILE *out)
|
|||||||
int n_lookahead_tokens = 0;
|
int n_lookahead_tokens = 0;
|
||||||
|
|
||||||
if (reds->lookahead_tokens)
|
if (reds->lookahead_tokens)
|
||||||
for (k = 0; k < reds->num; ++k)
|
{
|
||||||
if (reds->lookahead_tokens[k])
|
int j;
|
||||||
++n_lookahead_tokens;
|
for (j = 0; j < reds->num; ++j)
|
||||||
|
if (reds->lookahead_tokens[j])
|
||||||
|
++n_lookahead_tokens;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf (out, "State %d: %d lookahead tokens\n",
|
fprintf (out, "State %d: %d lookahead tokens\n",
|
||||||
i, n_lookahead_tokens);
|
i, n_lookahead_tokens);
|
||||||
|
|
||||||
if (reds->lookahead_tokens)
|
if (reds->lookahead_tokens)
|
||||||
for (j = 0; j < reds->num; ++j)
|
{
|
||||||
BITSET_FOR_EACH (iter, reds->lookahead_tokens[j], k, 0)
|
int j, k;
|
||||||
{
|
for (j = 0; j < reds->num; ++j)
|
||||||
fprintf (out, " on %d (%s) -> rule %d\n",
|
BITSET_FOR_EACH (iter, reds->lookahead_tokens[j], k, 0)
|
||||||
k, symbols[k]->tag,
|
fprintf (out, " on %d (%s) -> rule %d\n",
|
||||||
reds->rules[j]->number);
|
k, symbols[k]->tag,
|
||||||
};
|
reds->rules[j]->number);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fprintf (out, "Lookahead tokens: END\n");
|
fprintf (out, "Lookahead tokens: END\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,9 @@ BUILT_SOURCES += \
|
|||||||
## yacc. ##
|
## yacc. ##
|
||||||
## ------ ##
|
## ------ ##
|
||||||
|
|
||||||
bin_SCRIPTS = $(YACC_SCRIPT)
|
if ENABLE_YACC
|
||||||
|
bin_SCRIPTS = src/yacc
|
||||||
|
endif
|
||||||
EXTRA_SCRIPTS = src/yacc
|
EXTRA_SCRIPTS = src/yacc
|
||||||
MOSTLYCLEANFILES += src/yacc
|
MOSTLYCLEANFILES += src/yacc
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ location_caret (location loc, FILE *out)
|
|||||||
/* Read the actual line. Don't update the offset, so that we keep a pointer
|
/* Read the actual line. Don't update the offset, so that we keep a pointer
|
||||||
to the start of the line. */
|
to the start of the line. */
|
||||||
{
|
{
|
||||||
char c = getc (caret_info.source);
|
int c = getc (caret_info.source);
|
||||||
if (c != EOF)
|
if (c != EOF)
|
||||||
{
|
{
|
||||||
/* Quote the file, indent by a single column. */
|
/* Quote the file, indent by a single column. */
|
||||||
|
|||||||
@@ -299,8 +299,9 @@ muscle_location_grow (char const *key, location loc)
|
|||||||
|
|
||||||
#define COMMON_DECODE(Value) \
|
#define COMMON_DECODE(Value) \
|
||||||
case '$': \
|
case '$': \
|
||||||
aver (*++(Value) == ']'); \
|
++(Value); aver (*(Value) == '['); \
|
||||||
aver (*++(Value) == '['); \
|
++(Value); aver (*(Value) == ']'); \
|
||||||
|
++(Value); aver (*(Value) == '['); \
|
||||||
obstack_sgrow (&muscle_obstack, "$"); \
|
obstack_sgrow (&muscle_obstack, "$"); \
|
||||||
break; \
|
break; \
|
||||||
case '@': \
|
case '@': \
|
||||||
@@ -349,7 +350,7 @@ location_decode (char const *value)
|
|||||||
location loc;
|
location loc;
|
||||||
aver (value);
|
aver (value);
|
||||||
aver (*value == '[');
|
aver (*value == '[');
|
||||||
aver (*++value == '[');
|
++value; aver (*value == '[');
|
||||||
while (*++value)
|
while (*++value)
|
||||||
switch (*value)
|
switch (*value)
|
||||||
{
|
{
|
||||||
@@ -360,16 +361,16 @@ location_decode (char const *value)
|
|||||||
case ']':
|
case ']':
|
||||||
{
|
{
|
||||||
char *boundary_str;
|
char *boundary_str;
|
||||||
aver (*++value == ']');
|
++value; aver (*value == ']');
|
||||||
boundary_str = obstack_finish0 (&muscle_obstack);
|
boundary_str = obstack_finish0 (&muscle_obstack);
|
||||||
switch (*++value)
|
switch (*++value)
|
||||||
{
|
{
|
||||||
case ',':
|
case ',':
|
||||||
boundary_set_from_string (&loc.start, boundary_str);
|
boundary_set_from_string (&loc.start, boundary_str);
|
||||||
obstack_free (&muscle_obstack, boundary_str);
|
obstack_free (&muscle_obstack, boundary_str);
|
||||||
aver (*++value == ' ');
|
++value; aver (*value == ' ');
|
||||||
aver (*++value == '[');
|
++value; aver (*value == '[');
|
||||||
aver (*++value == '[');
|
++value; aver (*value == '[');
|
||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
boundary_set_from_string (&loc.end, boundary_str);
|
boundary_set_from_string (&loc.end, boundary_str);
|
||||||
|
|||||||
@@ -706,6 +706,11 @@ output (void)
|
|||||||
/* Process the selected skeleton file. */
|
/* Process the selected skeleton file. */
|
||||||
output_skeleton ();
|
output_skeleton ();
|
||||||
|
|
||||||
|
/* If late errors were generated, destroy the generated source
|
||||||
|
files. */
|
||||||
|
if (complaint_status)
|
||||||
|
unlink_generated_sources ();
|
||||||
|
|
||||||
obstack_free (&format_obstack, NULL);
|
obstack_free (&format_obstack, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,11 +80,11 @@
|
|||||||
|
|
||||||
#line 82 "src/parse-gram.c" /* yacc.c:339 */
|
#line 82 "src/parse-gram.c" /* yacc.c:339 */
|
||||||
|
|
||||||
# ifndef YY_NULL
|
# ifndef YY_NULLPTR
|
||||||
# if defined __cplusplus && 201103L <= __cplusplus
|
# if defined __cplusplus && 201103L <= __cplusplus
|
||||||
# define YY_NULL nullptr
|
# define YY_NULLPTR nullptr
|
||||||
# else
|
# else
|
||||||
# define YY_NULL 0
|
# define YY_NULLPTR 0
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -639,7 +639,7 @@ static const char *const yytname[] =
|
|||||||
"symbols.1", "generic_symlist", "generic_symlist_item", "tag",
|
"symbols.1", "generic_symlist", "generic_symlist_item", "tag",
|
||||||
"symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
|
"symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration",
|
||||||
"rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value",
|
"rules", "$@4", "rhses.1", "rhs", "named_ref.opt", "variable", "value",
|
||||||
"id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULL
|
"id", "id_colon", "symbol", "string_as_id", "epilogue.opt", YY_NULLPTR
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1569,11 +1569,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
yytype_int16 *yyesa, yytype_int16 **yyes,
|
yytype_int16 *yyesa, yytype_int16 **yyes,
|
||||||
YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken)
|
YYSIZE_T *yyes_capacity, yytype_int16 *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULL;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* 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];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||||
if (! (yysize <= yysize1
|
if (! (yysize <= yysize1
|
||||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
return 2;
|
return 2;
|
||||||
|
|||||||
@@ -65,40 +65,39 @@ print_core (FILE *out, int level, state *s)
|
|||||||
sitems = itemset;
|
sitems = itemset;
|
||||||
snritems = nitemset;
|
snritems = nitemset;
|
||||||
|
|
||||||
if (!snritems) {
|
if (!snritems)
|
||||||
xml_puts (out, level, "<itemset/>");
|
{
|
||||||
return;
|
xml_puts (out, level, "<itemset/>");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xml_puts (out, level, "<itemset>");
|
xml_puts (out, level, "<itemset>");
|
||||||
|
|
||||||
for (i = 0; i < snritems; i++)
|
for (i = 0; i < snritems; i++)
|
||||||
{
|
{
|
||||||
bool printed = false;
|
bool printed = false;
|
||||||
item_number *sp;
|
item_number *sp1 = ritem + sitems[i];
|
||||||
item_number *sp1;
|
item_number *sp = sp1;
|
||||||
rule_number r;
|
rule *r;
|
||||||
|
|
||||||
sp1 = sp = ritem + sitems[i];
|
while (0 <= *sp)
|
||||||
|
|
||||||
while (*sp >= 0)
|
|
||||||
sp++;
|
sp++;
|
||||||
|
|
||||||
r = item_number_as_rule_number (*sp);
|
r = &rules[item_number_as_rule_number (*sp)];
|
||||||
sp = rules[r].rhs;
|
sp = r->rhs;
|
||||||
|
|
||||||
/* Display the lookahead tokens? */
|
/* Display the lookahead tokens? */
|
||||||
if (item_number_is_rule_number (*sp1))
|
if (item_number_is_rule_number (*sp1))
|
||||||
{
|
{
|
||||||
reductions *reds = s->reductions;
|
reductions *reds = s->reductions;
|
||||||
int red = state_reduction_find (s, &rules[r]);
|
int red = state_reduction_find (s, r);
|
||||||
/* Print item with lookaheads if there are. */
|
/* Print item with lookaheads if there are. */
|
||||||
if (reds->lookahead_tokens && red != -1)
|
if (reds->lookahead_tokens && red != -1)
|
||||||
{
|
{
|
||||||
xml_printf (out, level + 1,
|
xml_printf (out, level + 1,
|
||||||
"<item rule-number=\"%d\" point=\"%d\">",
|
"<item rule-number=\"%d\" point=\"%d\">",
|
||||||
rules[r].number, sp1 - sp);
|
r->number, sp1 - sp);
|
||||||
state_rule_lookahead_tokens_print_xml (s, &rules[r],
|
state_rule_lookahead_tokens_print_xml (s, r,
|
||||||
out, level + 2);
|
out, level + 2);
|
||||||
xml_puts (out, level + 1, "</item>");
|
xml_puts (out, level + 1, "</item>");
|
||||||
printed = true;
|
printed = true;
|
||||||
@@ -106,12 +105,10 @@ print_core (FILE *out, int level, state *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!printed)
|
if (!printed)
|
||||||
{
|
xml_printf (out, level + 1,
|
||||||
xml_printf (out, level + 1,
|
"<item rule-number=\"%d\" point=\"%d\"/>",
|
||||||
"<item rule-number=\"%d\" point=\"%d\"/>",
|
r->number,
|
||||||
rules[r].number,
|
sp1 - sp);
|
||||||
sp1 - sp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
xml_puts (out, level, "</itemset>");
|
xml_puts (out, level, "</itemset>");
|
||||||
}
|
}
|
||||||
@@ -136,10 +133,11 @@ print_transitions (state *s, FILE *out, int level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Nothing to report. */
|
/* Nothing to report. */
|
||||||
if (!n) {
|
if (!n)
|
||||||
xml_puts (out, level, "<transitions/>");
|
{
|
||||||
return;
|
xml_puts (out, level, "<transitions/>");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Report lookahead tokens and shifts. */
|
/* Report lookahead tokens and shifts. */
|
||||||
xml_puts (out, level, "<transitions>");
|
xml_puts (out, level, "<transitions>");
|
||||||
@@ -190,10 +188,11 @@ print_errs (FILE *out, int level, state *s)
|
|||||||
count = true;
|
count = true;
|
||||||
|
|
||||||
/* Nothing to report. */
|
/* Nothing to report. */
|
||||||
if (!count) {
|
if (!count)
|
||||||
xml_puts (out, level, "<errors/>");
|
{
|
||||||
return;
|
xml_puts (out, level, "<errors/>");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Report lookahead tokens and errors. */
|
/* Report lookahead tokens and errors. */
|
||||||
xml_puts (out, level, "<errors>");
|
xml_puts (out, level, "<errors>");
|
||||||
@@ -287,10 +286,11 @@ print_reductions (FILE *out, int level, state *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Nothing to report. */
|
/* Nothing to report. */
|
||||||
if (!report) {
|
if (!report)
|
||||||
xml_puts (out, level, "<reductions/>");
|
{
|
||||||
return;
|
xml_puts (out, level, "<reductions/>");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xml_puts (out, level, "<reductions>");
|
xml_puts (out, level, "<reductions>");
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,11 @@ print_core (FILE *out, state *s)
|
|||||||
for (sp = rules[r].rhs; sp < sp1; sp++)
|
for (sp = rules[r].rhs; sp < sp1; sp++)
|
||||||
fprintf (out, " %s", symbols[*sp]->tag);
|
fprintf (out, " %s", symbols[*sp]->tag);
|
||||||
fputs (" .", out);
|
fputs (" .", out);
|
||||||
for (/* Nothing */; *sp >= 0; ++sp)
|
if (0 <= *rules[r].rhs)
|
||||||
fprintf (out, " %s", symbols[*sp]->tag);
|
for (/* Nothing */; 0 <= *sp; ++sp)
|
||||||
|
fprintf (out, " %s", symbols[*sp]->tag);
|
||||||
|
else
|
||||||
|
fprintf (out, " %%empty");
|
||||||
|
|
||||||
/* Display the lookahead tokens? */
|
/* Display the lookahead tokens? */
|
||||||
if (report_flag & report_lookahead_tokens
|
if (report_flag & report_lookahead_tokens
|
||||||
|
|||||||
@@ -85,8 +85,11 @@ print_core (struct obstack *oout, state *s)
|
|||||||
|
|
||||||
obstack_1grow (oout, '.');
|
obstack_1grow (oout, '.');
|
||||||
|
|
||||||
for (/* Nothing */; *sp >= 0; ++sp)
|
if (0 <= *r->rhs)
|
||||||
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
for (/* Nothing */; *sp >= 0; ++sp)
|
||||||
|
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||||
|
else
|
||||||
|
obstack_printf (oout, " %%empty");
|
||||||
|
|
||||||
/* Experimental feature: display the lookahead tokens. */
|
/* Experimental feature: display the lookahead tokens. */
|
||||||
if (report_flag & report_lookahead_tokens
|
if (report_flag & report_lookahead_tokens
|
||||||
|
|||||||
@@ -342,8 +342,19 @@ show_sub_message (warnings warning,
|
|||||||
{
|
{
|
||||||
static struct obstack msg_buf;
|
static struct obstack msg_buf;
|
||||||
const char *tail = explicit_bracketing ? "" : cp + strlen (var->id);
|
const char *tail = explicit_bracketing ? "" : cp + strlen (var->id);
|
||||||
const char *id = var->hidden_by ? var->hidden_by->id : var->id;
|
const char *id;
|
||||||
location id_loc = var->hidden_by ? var->hidden_by->loc : var->loc;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the explanation message. */
|
/* Create the explanation message. */
|
||||||
obstack_init (&msg_buf);
|
obstack_init (&msg_buf);
|
||||||
@@ -573,9 +584,6 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
|||||||
return INVALID_REF;
|
return INVALID_REF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not reachable. */
|
|
||||||
return INVALID_REF;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keeps track of the maximum number of semantic values to the left of
|
/* Keeps track of the maximum number of semantic values to the left of
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ eqopt ([[:space:]]*=)?
|
|||||||
"%pure"[-_]"parser" DEPRECATED("%pure-parser");
|
"%pure"[-_]"parser" DEPRECATED("%pure-parser");
|
||||||
"%token"[-_]"table" DEPRECATED("%token-table");
|
"%token"[-_]"table" DEPRECATED("%token-table");
|
||||||
|
|
||||||
"%"{id}|"%"{notletter}([[:graph:]])+ {
|
"%"{id} {
|
||||||
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
|
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -244,8 +244,9 @@ at_output (int argc, char *argv[], char **out_namep, int *out_linenop)
|
|||||||
xfclose (yyout);
|
xfclose (yyout);
|
||||||
}
|
}
|
||||||
*out_namep = xstrdup (argv[1]);
|
*out_namep = xstrdup (argv[1]);
|
||||||
output_file_name_check (out_namep);
|
output_file_name_check (out_namep, true);
|
||||||
yyout = xfopen (*out_namep, "w");
|
/* If there were errors, do not generate the output. */
|
||||||
|
yyout = xfopen (complaint_status ? "/dev/null" : *out_namep, "w");
|
||||||
*out_linenop = 1;
|
*out_linenop = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ uniqstr_vsprintf (char const *format, ...)
|
|||||||
void
|
void
|
||||||
uniqstr_assert (char const *str)
|
uniqstr_assert (char const *str)
|
||||||
{
|
{
|
||||||
uniqstr *s = hash_lookup (uniqstrs_table, str);
|
uniqstr s = hash_lookup (uniqstrs_table, str);
|
||||||
if (!s || s != (uniqstr *)str)
|
if (!s || s != str)
|
||||||
{
|
{
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
"not a uniqstr: %s", quotearg (str));
|
"not a uniqstr: %s", quotearg (str));
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
#ifndef UNIQSTR_H_
|
#ifndef UNIQSTR_H_
|
||||||
# define UNIQSTR_H_
|
# define UNIQSTR_H_
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
/*-----------------------------------------.
|
/*-----------------------------------------.
|
||||||
| Pointers to unique copies of C strings. |
|
| Pointers to unique copies of C strings. |
|
||||||
`-----------------------------------------*/
|
`-----------------------------------------*/
|
||||||
@@ -33,7 +35,7 @@ uniqstr uniqstr_new (char const *str);
|
|||||||
strings, use UNIQSTR_CONCAT, which is a convenient wrapper around
|
strings, use UNIQSTR_CONCAT, which is a convenient wrapper around
|
||||||
this function. */
|
this function. */
|
||||||
uniqstr uniqstr_vsprintf (char const *format, ...)
|
uniqstr uniqstr_vsprintf (char const *format, ...)
|
||||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
_GL_ATTRIBUTE_FORMAT_PRINTF (1, 2);
|
||||||
|
|
||||||
/* Two uniqstr values have the same value iff they are the same. */
|
/* Two uniqstr values have the same value iff they are the same. */
|
||||||
# define UNIQSTR_EQ(Ustr1, Ustr2) (!!((Ustr1) == (Ustr2)))
|
# define UNIQSTR_EQ(Ustr1, Ustr2) (!!((Ustr1) == (Ustr2)))
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ thing:
|
|||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
/* Alias to ARGV[1]. */
|
/* Alias to ARGV[1]. */
|
||||||
const char *source = YY_NULL;
|
const char *source = YY_NULLPTR;
|
||||||
|
|
||||||
]AT_YYERROR_DEFINE[
|
]AT_YYERROR_DEFINE[
|
||||||
|
|
||||||
|
|||||||
98
tests/c++.at
98
tests/c++.at
@@ -243,7 +243,7 @@ typedef std::list<std::string> strings_type;
|
|||||||
// digraph for the left square bracket.
|
// digraph for the left square bracket.
|
||||||
%type <::std::list<std::string>> list result;
|
%type <::std::list<std::string>> list result;
|
||||||
|
|
||||||
%printer { yyo << $][$; }
|
%printer { yyo << $$; }
|
||||||
<int> <::std::string> <::std::list<std::string>>;
|
<int> <::std::string> <::std::list<std::string>>;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -253,13 +253,13 @@ result:
|
|||||||
|
|
||||||
list:
|
list:
|
||||||
/* nothing */ { /* Generates an empty string list */ }
|
/* nothing */ { /* Generates an empty string list */ }
|
||||||
| list item { std::swap ($][$,$][1); $$.push_back ($][2); }
|
| list item { std::swap ($$,$][1); $$.push_back ($][2); }
|
||||||
| list error { std::swap ($][$,$][1); }
|
| list error { std::swap ($$,$][1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
item:
|
item:
|
||||||
TEXT { std::swap ($][$,$][1); }
|
TEXT { std::swap ($$,$][1); }
|
||||||
| NUMBER { if ($][1 == 3) YYERROR; else $][$ = string_cast ($][1); }
|
| NUMBER { if ($][1 == 3) YYERROR; else $$ = string_cast ($][1); }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
]AT_TOKEN_CTOR_IF([],
|
]AT_TOKEN_CTOR_IF([],
|
||||||
@@ -649,11 +649,14 @@ AT_CLEANUP
|
|||||||
## Exception safety. ##
|
## Exception safety. ##
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
|
|
||||||
# AT_TEST([BISON-DIRECTIVES])
|
# AT_TEST([BISON-DIRECTIVES = ''], [WITH-RECOVERY = "with"])
|
||||||
# ---------------------------
|
# ----------------------------------------------------------
|
||||||
# Check that no object is leaked when exceptions are thrown.
|
# Check that no object is leaked when exceptions are thrown.
|
||||||
|
# WITH-RECOVERY = "with" or "without".
|
||||||
m4_pushdef([AT_TEST],
|
m4_pushdef([AT_TEST],
|
||||||
[AT_SETUP([[Exception safety $1]])
|
[AT_SETUP([[Exception safety $2 error recovery $1]])
|
||||||
|
|
||||||
|
AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR
|
||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" $1])
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" $1])
|
||||||
|
|
||||||
@@ -667,27 +670,43 @@ $1
|
|||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdlib> // size_t and getenv.
|
#include <cstdlib> // size_t and getenv.
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <list>
|
#include <set>
|
||||||
|
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
|
||||||
/// A class that counts its number of instances.
|
/// A class that tracks its instances.
|
||||||
struct Object
|
struct Object
|
||||||
{
|
{
|
||||||
char val;
|
char val;
|
||||||
|
|
||||||
Object (char v)
|
|
||||||
: val (v)
|
|
||||||
{
|
|
||||||
Object::instances.push_back(this);
|
|
||||||
log (this, "Object::Object");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object ()
|
Object ()
|
||||||
: val ('?')
|
: val ('?')
|
||||||
{
|
{
|
||||||
Object::instances.push_back(this);
|
|
||||||
log (this, "Object::Object");
|
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)
|
||||||
|
{
|
||||||
|
log (this, "Object::Object");
|
||||||
|
Object::instances.insert (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~Object ()
|
||||||
|
{
|
||||||
|
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& operator= (char v)
|
Object& operator= (char v)
|
||||||
@@ -696,14 +715,8 @@ $1
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Object ()
|
|
||||||
{
|
|
||||||
Object::instances.remove (this);
|
|
||||||
log (this, "Object::~Object");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Static part.
|
// Static part.
|
||||||
typedef std::list<const Object*> objects;
|
typedef std::set<const Object*> objects;
|
||||||
static objects instances;
|
static objects instances;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -783,22 +796,23 @@ $1
|
|||||||
start: list {]AT_VARIANT_IF([], [ delete $][1]; )[};
|
start: list {]AT_VARIANT_IF([], [ delete $][1]; )[};
|
||||||
|
|
||||||
list:
|
list:
|
||||||
item { $][$ = $][1; }
|
item { $$ = $][1; }
|
||||||
// Right recursion to load the stack.
|
// Right recursion to load the stack.
|
||||||
| item list { $][$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
|
| item list { $$ = $][1; ]AT_VARIANT_IF([], [delete $][2]; )[}
|
||||||
;
|
;
|
||||||
|
|
||||||
item:
|
item:
|
||||||
'a' { $$][ = $][1; }
|
'a' { $$ = $][1; }
|
||||||
| 'e' { YYUSE ($][$); YYUSE($][1); error ("syntax error"); }
|
| 'e' { YYUSE ($$); YYUSE($][1); error ("syntax error"); }
|
||||||
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
|
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
|
||||||
// then the stack is emptied, defeating the point of the test.
|
// then the stack is emptied, defeating the point of the test.
|
||||||
| 'E' 'a' { YYUSE($][1); $][$ = $][2; }
|
| 'E' 'a' { YYUSE($][1); $$ = $][2; }
|
||||||
| 'R' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYERROR; }
|
| 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
|
||||||
| 'p' { $][$ = $][1; }
|
| 'p' { $$ = $][1; }
|
||||||
| 's' { $][$ = $][1; throw std::runtime_error ("reduction"); }
|
| 's' { $$ = $][1; throw std::runtime_error ("reduction"); }
|
||||||
| 'T' { ]AT_VARIANT_IF([], [$][$ = YY_NULL; delete $][1]; )[YYABORT; }
|
| 'T' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYABORT; }
|
||||||
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULL; ])[yyerrok; }
|
]m4_if([$2], [with],
|
||||||
|
[[| error { $$ = ]AT_VARIANT_IF([], [new ])[Object ('R'); yyerrok; }]])[
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -818,7 +832,8 @@ yylex (yy::parser::semantic_type *lvalp)
|
|||||||
case 'l':
|
case 'l':
|
||||||
throw std::runtime_error ("yylex");
|
throw std::runtime_error ("yylex");
|
||||||
default:
|
default:
|
||||||
lvalp]AT_VARIANT_IF([->build (res)], [->obj = new Object (res)])[;
|
lvalp->]AT_VARIANT_IF([build (Object (res))],
|
||||||
|
[obj = new Object (res)])[;
|
||||||
// Fall through.
|
// Fall through.
|
||||||
case 0:
|
case 0:
|
||||||
return res;
|
return res;
|
||||||
@@ -865,7 +880,7 @@ main (int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
std::cerr << "unknown exception caught" << std::endl;
|
std::cerr << "unknown exception caught" << std::endl;
|
||||||
}
|
}
|
||||||
Object::log (YY_NULL, "end");
|
Object::log (YY_NULLPTR, "end");
|
||||||
assert (Object::empty());
|
assert (Object::empty());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -900,16 +915,17 @@ AT_PARSER_CHECK([[./input aaaaE]], [[2]], [[]],
|
|||||||
|
|
||||||
AT_PARSER_CHECK([[./input aaaaT]], [[1]])
|
AT_PARSER_CHECK([[./input aaaaT]], [[1]])
|
||||||
|
|
||||||
# There is error-recovery, so exit success.
|
AT_PARSER_CHECK([[./input aaaaR]], [m4_if([$2], [with], [0], [1])])
|
||||||
AT_PARSER_CHECK([[./input aaaaR]], [[0]])
|
|
||||||
|
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_TEST
|
AT_TEST([], [with])
|
||||||
AT_TEST([%define api.value.type variant])
|
AT_TEST([], [without])
|
||||||
|
AT_TEST([%define api.value.type variant], [with])
|
||||||
|
AT_TEST([%define api.value.type variant], [without])
|
||||||
|
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
|||||||
@@ -1447,7 +1447,7 @@ State 0
|
|||||||
0 $accept: . start $end
|
0 $accept: . start $end
|
||||||
1 start: . resolved_conflict 'a' reported_conflicts 'a'
|
1 start: . resolved_conflict 'a' reported_conflicts 'a'
|
||||||
2 resolved_conflict: . 'a' unreachable1
|
2 resolved_conflict: . 'a' unreachable1
|
||||||
3 | . ['a']
|
3 | . %empty ['a']
|
||||||
|
|
||||||
$default reduce using rule 3 (resolved_conflict)
|
$default reduce using rule 3 (resolved_conflict)
|
||||||
|
|
||||||
@@ -1483,7 +1483,7 @@ State 4
|
|||||||
1 start: resolved_conflict 'a' . reported_conflicts 'a'
|
1 start: resolved_conflict 'a' . reported_conflicts 'a'
|
||||||
8 reported_conflicts: . 'a'
|
8 reported_conflicts: . 'a'
|
||||||
9 | . 'a'
|
9 | . 'a'
|
||||||
10 | . ['a']
|
10 | . %empty ['a']
|
||||||
|
|
||||||
'a' shift, and go to state 5
|
'a' shift, and go to state 5
|
||||||
|
|
||||||
@@ -1576,11 +1576,11 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
|||||||
6 | . empty_c1 'c'
|
6 | . empty_c1 'c'
|
||||||
7 | . empty_c2 'c'
|
7 | . empty_c2 'c'
|
||||||
8 | . empty_c3 'c'
|
8 | . empty_c3 'c'
|
||||||
9 empty_a: . ['a']
|
9 empty_a: . %empty ['a']
|
||||||
10 empty_b: . []
|
10 empty_b: . %empty []
|
||||||
11 empty_c1: . []
|
11 empty_c1: . %empty []
|
||||||
12 empty_c2: . []
|
12 empty_c2: . %empty []
|
||||||
13 empty_c3: . ['c']
|
13 empty_c3: . %empty ['c']
|
||||||
|
|
||||||
'b' shift, and go to state 1
|
'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'
|
6 | . empty_c1 'c'
|
||||||
7 | . empty_c2 'c'
|
7 | . empty_c2 'c'
|
||||||
8 | . empty_c3 'c'
|
8 | . empty_c3 'c'
|
||||||
9 empty_a: . []
|
9 empty_a: . %empty []
|
||||||
10 empty_b: . []
|
10 empty_b: . %empty []
|
||||||
11 empty_c1: . []
|
11 empty_c1: . %empty []
|
||||||
12 empty_c2: . ['c']
|
12 empty_c2: . %empty ['c']
|
||||||
13 empty_c3: . ['c']
|
13 empty_c3: . %empty ['c']
|
||||||
|
|
||||||
'a' error (nonassociative)
|
'a' error (nonassociative)
|
||||||
'b' error (nonassociative)
|
'b' error (nonassociative)
|
||||||
|
|||||||
@@ -94,19 +94,19 @@ prog :
|
|||||||
|
|
||||||
stmt : expr ';' $2 { $$ = ]$[1; }
|
stmt : expr ';' $2 { $$ = ]$[1; }
|
||||||
| decl $3
|
| decl $3
|
||||||
| error ';' { $$ = new_nterm ("<error>", YY_NULL, YY_NULL, YY_NULL); }
|
| error ';' { $$ = new_nterm ("<error>", YY_NULLPTR, YY_NULLPTR, YY_NULLPTR); }
|
||||||
| '@' { YYACCEPT; }
|
| '@' { YYACCEPT; }
|
||||||
;
|
;
|
||||||
|
|
||||||
expr : ID
|
expr : ID
|
||||||
| TYPENAME '(' expr ')'
|
| TYPENAME '(' expr ')'
|
||||||
{ $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, YY_NULL); }
|
{ $$ = new_nterm ("<cast>(%s,%s)", ]$[3, ]$[1, YY_NULLPTR); }
|
||||||
| expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULL); }
|
| expr '+' expr { $$ = new_nterm ("+(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); }
|
||||||
| expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULL); }
|
| expr '=' expr { $$ = new_nterm ("=(%s,%s)", ]$[1, ]$[3, YY_NULLPTR); }
|
||||||
;
|
;
|
||||||
|
|
||||||
decl : TYPENAME declarator ';'
|
decl : TYPENAME declarator ';'
|
||||||
{ $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, YY_NULL); }
|
{ $$ = new_nterm ("<declare>(%s,%s)", ]$[1, ]$[2, YY_NULLPTR); }
|
||||||
| TYPENAME declarator '=' expr ';'
|
| TYPENAME declarator '=' expr ';'
|
||||||
{ $$ = new_nterm ("<init-declare>(%s,%s,%s)", ]$[1,
|
{ $$ = new_nterm ("<init-declare>(%s,%s,%s)", ]$[1,
|
||||||
]$[2, ]$[4); }
|
]$[2, ]$[4); }
|
||||||
@@ -195,7 +195,7 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
colNum += 1;
|
colNum += 1;
|
||||||
tok = c;
|
tok = c;
|
||||||
yylval = YY_NULL;
|
yylval = YY_NULLPTR;
|
||||||
}]AT_LOCATION_IF([[
|
}]AT_LOCATION_IF([[
|
||||||
yylloc.last_column = colNum-1;]])[
|
yylloc.last_column = colNum-1;]])[
|
||||||
return tok;
|
return tok;
|
||||||
@@ -287,7 +287,7 @@ m4_bmatch([$2], [stmtMerge],
|
|||||||
[[static YYSTYPE
|
[[static YYSTYPE
|
||||||
stmtMerge (YYSTYPE x0, YYSTYPE x1)
|
stmtMerge (YYSTYPE x0, YYSTYPE x1)
|
||||||
{
|
{
|
||||||
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULL);
|
return new_nterm ("<OR>(%s,%s)", x0, x1, YY_NULLPTR);
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *input = YY_NULL;
|
const char *input = YY_NULLPTR;
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, const char* argv[])
|
main (int argc, const char* argv[])
|
||||||
@@ -304,7 +304,7 @@ MergeRule (int x0, int x1)
|
|||||||
}
|
}
|
||||||
]AT_YYERROR_DEFINE[
|
]AT_YYERROR_DEFINE[
|
||||||
|
|
||||||
FILE *input = YY_NULL;
|
FILE *input = YY_NULLPTR;
|
||||||
|
|
||||||
int P[] = { P1, P2 };
|
int P[] = { P1, P2 };
|
||||||
int O[] = { O1, O2 };
|
int O[] = { O1, O2 };
|
||||||
@@ -1749,3 +1749,33 @@ Cleanup: popping token 'a' ()
|
|||||||
])
|
])
|
||||||
|
|
||||||
AT_CLEANUP
|
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
|
||||||
|
|||||||
@@ -223,9 +223,13 @@ AT_CHECK([[$PERL -n -0777 -e '
|
|||||||
s{/\*.*?\*/}{}gs;
|
s{/\*.*?\*/}{}gs;
|
||||||
s{//.*}{}g;
|
s{//.*}{}g;
|
||||||
s{\b(YYChar
|
s{\b(YYChar
|
||||||
|YYPUSH_MORE(_DEFINED)?
|
|YYPUSH_MORE(?:_DEFINED)?
|
||||||
|
|YYUSE
|
||||||
|
|YY_ATTRIBUTE(?:_PURE|_UNUSED)?
|
||||||
|
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|
||||||
|
|YY_INITIAL_VALUE
|
||||||
|YY_\w+_INCLUDED
|
|YY_\w+_INCLUDED
|
||||||
|YY_NULL
|
|YY_NULLPTR
|
||||||
|(defined|if)\ YYDEBUG
|
|(defined|if)\ YYDEBUG
|
||||||
)\b}{}gx;
|
)\b}{}gx;
|
||||||
while (/^(.*YY.*)$/gm)
|
while (/^(.*YY.*)$/gm)
|
||||||
|
|||||||
@@ -956,15 +956,9 @@ without_period: "WITHOUT.PERIOD";
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
# POSIX Yacc accept periods, but not dashes.
|
# POSIX Yacc accept periods, but not dashes.
|
||||||
AT_BISON_CHECK([--yacc -Wno-error input.y], [], [],
|
AT_BISON_CHECK([--yacc input.y], [1], [],
|
||||||
[[input.y:9.8-16: warning: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Wyacc]
|
[[input.y:9.8-16: error: POSIX Yacc forbids dashes in symbol names: WITH-DASH [-Werror=yacc]
|
||||||
input.y:20.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash [-Wyacc]
|
input.y:20.8-16: error: POSIX Yacc forbids dashes in symbol names: with-dash [-Werror=yacc]
|
||||||
]])
|
|
||||||
|
|
||||||
# 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.
|
# Dashes are fine for GNU Bison.
|
||||||
@@ -1768,11 +1762,11 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
|
|||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
## --------------------------------------------- ##
|
## ---------------------- ##
|
||||||
## -Werror is not affected by -Wnone and -Wall. ##
|
## -Werror combinations. ##
|
||||||
## --------------------------------------------- ##
|
## ---------------------- ##
|
||||||
|
|
||||||
AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
|
AT_SETUP([[-Werror combinations]])
|
||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%%
|
[[%%
|
||||||
@@ -1798,6 +1792,18 @@ AT_BISON_CHECK([[-Werror,no-all,other input.y]], [[1]], [[]],
|
|||||||
[[input.y:2.15: error: stray '$' [-Werror=other]
|
[[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
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -635,9 +635,12 @@ m4_define([AT_BISON_CHECK_],
|
|||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
# Check that warnings (if some are expected) are correctly
|
# Check that warnings (if some are expected) are correctly
|
||||||
# turned into errors with -Werror, etc.
|
# 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_define([AT_BISON_CHECK_WARNINGS],
|
||||||
[m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
|
[m4_if(m4_bregexp([$4], [: warning: ]), [-1], [],
|
||||||
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
m4_bregexp([$1], [-Wno-error=]), [-1],
|
||||||
|
[m4_null_if([$2], [AT_BISON_CHECK_WARNINGS_($@)])])])
|
||||||
|
|
||||||
m4_define([AT_BISON_CHECK_WARNINGS_],
|
m4_define([AT_BISON_CHECK_WARNINGS_],
|
||||||
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
|
[[# Defining POSIXLY_CORRECT causes bison to complain if options are
|
||||||
@@ -872,6 +875,49 @@ 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. ##
|
## Running a generated parser. ##
|
||||||
## ---------------------------- ##
|
## ---------------------------- ##
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ $(TESTSUITE): $(TESTSUITE_AT)
|
|||||||
# Move into tests/ so that testsuite.dir etc. be created there.
|
# Move into tests/ so that testsuite.dir etc. be created there.
|
||||||
RUN_TESTSUITE = $(TESTSUITE) -C tests $(TESTSUITEFLAGS)
|
RUN_TESTSUITE = $(TESTSUITE) -C tests $(TESTSUITEFLAGS)
|
||||||
check_SCRIPTS = $(BISON) tests/atconfig tests/atlocal
|
check_SCRIPTS = $(BISON) tests/atconfig tests/atlocal
|
||||||
RUN_TESTSUITE_deps = $(TESTSUITE) $(check_SCRIPTS)
|
RUN_TESTSUITE_deps = all $(TESTSUITE) $(check_SCRIPTS)
|
||||||
|
|
||||||
clean-local: clean-local-tests
|
clean-local: clean-local-tests
|
||||||
clean-local-tests:
|
clean-local-tests:
|
||||||
@@ -126,3 +126,6 @@ maintainer-push-check:
|
|||||||
maintainer-xml-check:
|
maintainer-xml-check:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) maintainer-check \
|
$(MAKE) $(AM_MAKEFLAGS) maintainer-check \
|
||||||
TESTSUITEFLAGS='BISON_TEST_XML=1 $(TESTSUITEFLAGS)'
|
TESTSUITEFLAGS='BISON_TEST_XML=1 $(TESTSUITEFLAGS)'
|
||||||
|
|
||||||
|
.PHONY: maintainer-release-check
|
||||||
|
maintainer-release-check: maintainer-check maintainer-push-check maintainer-xml-check
|
||||||
|
|||||||
@@ -17,12 +17,23 @@
|
|||||||
|
|
||||||
AT_BANNER([[Output file names.]])
|
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, [SHELLIO],
|
# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [STATUS],
|
||||||
# [ADDITIONAL-TESTS], [PRE-TESTS])
|
# [ADDITIONAL-TESTS], [PRE-TESTS])
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
m4_define([AT_CHECK_OUTPUT],
|
m4_define([AT_CHECK_OUTPUT],
|
||||||
[AT_SETUP([[Output files: ]$2 $3 $5])[
|
[AT_SETUP([[Output files: ]$2 $3])[
|
||||||
]$7[
|
]$7[
|
||||||
for file in ]$1 $4[; do
|
for file in ]$1 $4[; do
|
||||||
case $file in
|
case $file in
|
||||||
@@ -32,18 +43,12 @@ done
|
|||||||
]AT_DATA([$1],
|
]AT_DATA([$1],
|
||||||
[$2[
|
[$2[
|
||||||
%%
|
%%
|
||||||
foo: {};
|
foo: %empty {};
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
]AT_BISON_CHECK([$3 $1 $5], 0)[
|
]AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
|
||||||
# Ignore the files non-generated files
|
# Ignore the files non-generated files
|
||||||
]AT_CHECK([[find . -type f |
|
]AT_CHECK_FILES([$4], [$1])[
|
||||||
$PERL -ne '
|
|
||||||
s,\./,,; chomp;
|
|
||||||
push @file, $_ unless m{^($1|testsuite.log)$};
|
|
||||||
END { print join (" ", sort @file), "\n" }']],
|
|
||||||
[], [$4
|
|
||||||
])[
|
|
||||||
]$6[
|
]$6[
|
||||||
]AT_CLEANUP[
|
]AT_CLEANUP[
|
||||||
]])
|
]])
|
||||||
@@ -54,9 +59,9 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv],
|
|||||||
# Some versions of Valgrind (at least valgrind-3.6.0.SVN-Debian) report
|
# 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
|
# "fgrep: write error: Bad file descriptor" when stdout is closed, so we
|
||||||
# skip this test group during maintainer-check-valgrind.
|
# 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],
|
[foo.output foo.tab.c foo.tab.h],
|
||||||
[>&-], [],
|
[], [],
|
||||||
[AT_CHECK([[case "$PREBISON" in *valgrind*) exit 77;; esac]])])
|
[AT_CHECK([[case "$PREBISON" in *valgrind*) exit 77;; esac]])])
|
||||||
|
|
||||||
AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
|
AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
|
||||||
@@ -114,6 +119,20 @@ AT_CHECK_OUTPUT([foo.yy], [],
|
|||||||
[-o foo.c++ --graph=foo.gph],
|
[-o foo.c++ --graph=foo.gph],
|
||||||
[foo.c++ 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. ##
|
## C++ output. ##
|
||||||
@@ -290,7 +309,7 @@ a: ;
|
|||||||
b: 'b';
|
b: 'b';
|
||||||
]],
|
]],
|
||||||
[[
|
[[
|
||||||
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: .\l"]
|
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a '?' b\l 2 a: . %empty\l"]
|
||||||
0 -> 1 [style=dashed label="exp"]
|
0 -> 1 [style=dashed label="exp"]
|
||||||
0 -> 2 [style=dashed label="a"]
|
0 -> 2 [style=dashed label="a"]
|
||||||
0 -> "0R2" [style=solid]
|
0 -> "0R2" [style=solid]
|
||||||
@@ -332,7 +351,7 @@ empty_b: %prec 'b';
|
|||||||
empty_c: %prec 'c';
|
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: . ['a']\l 8 empty_b: . ['b']\l 9 empty_c: . ['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: . %empty ['a']\l 8 empty_b: . %empty ['b']\l 9 empty_c: . %empty ['c']\l"]
|
||||||
0 -> 1 [style=solid label="'a'"]
|
0 -> 1 [style=solid label="'a'"]
|
||||||
0 -> 2 [style=solid label="'b'"]
|
0 -> 2 [style=solid label="'b'"]
|
||||||
0 -> 3 [style=solid label="'c'"]
|
0 -> 3 [style=solid label="'c'"]
|
||||||
@@ -399,7 +418,7 @@ empty_b: %prec 'b';
|
|||||||
empty_c: %prec 'c';
|
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: . ['a']\l 8 empty_b: . []\l 9 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: . %empty ['a']\l 8 empty_b: . %empty []\l 9 empty_c: . %empty []\l"]
|
||||||
0 -> 1 [style=solid label="'b'"]
|
0 -> 1 [style=solid label="'b'"]
|
||||||
0 -> 2 [style=solid label="'c'"]
|
0 -> 2 [style=solid label="'c'"]
|
||||||
0 -> 3 [style=dashed label="start"]
|
0 -> 3 [style=dashed label="start"]
|
||||||
@@ -447,7 +466,7 @@ a: ;
|
|||||||
b: ;
|
b: ;
|
||||||
]],
|
]],
|
||||||
[[
|
[[
|
||||||
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 [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 -> 1 [style=dashed label="exp"]
|
0 -> 1 [style=dashed label="exp"]
|
||||||
0 -> 2 [style=dashed label="a"]
|
0 -> 2 [style=dashed label="a"]
|
||||||
0 -> 3 [style=dashed label="b"]
|
0 -> 3 [style=dashed label="b"]
|
||||||
@@ -480,7 +499,7 @@ b: ;
|
|||||||
c: ;
|
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: . [';', '.']\l 9 b: . ['?', '!']\l 10 c: . [';', '?']\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: . %empty [';', '.']\l 9 b: . %empty ['?', '!']\l 10 c: . %empty [';', '?']\l"]
|
||||||
0 -> 1 [style=dashed label="exp"]
|
0 -> 1 [style=dashed label="exp"]
|
||||||
0 -> 2 [style=dashed label="a"]
|
0 -> 2 [style=dashed label="a"]
|
||||||
0 -> 3 [style=dashed label="b"]
|
0 -> 3 [style=dashed label="b"]
|
||||||
@@ -595,7 +614,7 @@ imm: '0';
|
|||||||
"11R7d" [label="R7", fillcolor=5, shape=diamond, style=filled]
|
"11R7d" [label="R7", fillcolor=5, shape=diamond, style=filled]
|
||||||
11 -> "11R7" [style=solid]
|
11 -> "11R7" [style=solid]
|
||||||
"11R7" [label="R7", fillcolor=3, shape=diamond, style=filled]
|
"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 | . [$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 | . %empty [$end, \"then\", \"else\", '+']\l 7 opexp: exp . '+' exp\l"]
|
||||||
12 -> 13 [style=solid label="\"else\""]
|
12 -> 13 [style=solid label="\"else\""]
|
||||||
12 -> 9 [style=solid label="'+'"]
|
12 -> 9 [style=solid label="'+'"]
|
||||||
12 -> 14 [style=dashed label="elseexp"]
|
12 -> 14 [style=dashed label="elseexp"]
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ main (void)
|
|||||||
/* yypstate_delete used to leak ps->yyss if the stack was reallocated but the
|
/* 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. */
|
parse did not return on success, syntax error, or memory exhaustion. */
|
||||||
ps = yypstate_new ();
|
ps = yypstate_new ();
|
||||||
assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
|
assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
|
|
||||||
ps = yypstate_new ();
|
ps = yypstate_new ();
|
||||||
assert (yypush_parse (ps, 'a', YY_NULL) == YYPUSH_MORE);
|
assert (yypush_parse (ps, 'a', YY_NULLPTR) == YYPUSH_MORE);
|
||||||
assert (yypush_parse (ps, 'b', YY_NULL) == YYPUSH_MORE);
|
assert (yypush_parse (ps, 'b', YY_NULLPTR) == YYPUSH_MORE);
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -111,11 +111,11 @@ main (void)
|
|||||||
{
|
{
|
||||||
yypstate *ps = yypstate_new ();
|
yypstate *ps = yypstate_new ();
|
||||||
assert (ps);
|
assert (ps);
|
||||||
assert (yypstate_new () == YY_NULL);
|
assert (yypstate_new () == YY_NULLPTR);
|
||||||
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
|
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
|
||||||
yychar = 0;
|
yychar = 0;
|
||||||
assert (yypush_parse (ps) == 0);
|
assert (yypush_parse (ps) == 0);
|
||||||
assert (yypstate_new () == YY_NULL);
|
assert (yypstate_new () == YY_NULLPTR);
|
||||||
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
|
]m4_if([$1], [[both]], [[assert (yyparse () == 2)]])[;
|
||||||
yypstate_delete (ps);
|
yypstate_delete (ps);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1057,7 +1057,7 @@ State 12
|
|||||||
|
|
||||||
4 A: 'a' 'a' . B
|
4 A: 'a' 'a' . B
|
||||||
5 B: . 'a'
|
5 B: . 'a'
|
||||||
6 | . ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[
|
6 | . %empty ]AT_COND_CASE([[LALR]], [[['a', 'b']]], [[['a']]])[
|
||||||
|
|
||||||
]AT_COND_CASE([[canonical LR]], [['a']],
|
]AT_COND_CASE([[canonical LR]], [['a']],
|
||||||
[[$default]])[ reduce using rule 6 (B)
|
[[$default]])[ reduce using rule 6 (B)
|
||||||
@@ -1087,7 +1087,7 @@ State 15
|
|||||||
|
|
||||||
4 A: 'a' 'a' . B
|
4 A: 'a' 'a' . B
|
||||||
5 B: . 'a'
|
5 B: . 'a'
|
||||||
6 | . [$end]
|
6 | . %empty [$end]
|
||||||
7 c: 'a' 'a' . 'b'
|
7 c: 'a' 'a' . 'b'
|
||||||
|
|
||||||
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[20]],
|
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[20]],
|
||||||
@@ -1150,7 +1150,7 @@ State 22]])[
|
|||||||
|
|
||||||
4 A: 'a' 'a' . B
|
4 A: 'a' 'a' . B
|
||||||
5 B: . 'a'
|
5 B: . 'a'
|
||||||
6 | . ['b']
|
6 | . %empty ['b']
|
||||||
|
|
||||||
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[23]],
|
'a' shift, and go to state ]AT_COND_CASE([[canonical LR]], [[23]],
|
||||||
[[16]])[
|
[[16]])[
|
||||||
@@ -1575,8 +1575,8 @@ State 3
|
|||||||
1 start: a . b
|
1 start: a . b
|
||||||
2 | a . b 'a'
|
2 | a . b 'a'
|
||||||
3 | a . c 'b'
|
3 | a . c 'b'
|
||||||
5 b: . [$end, 'a']
|
5 b: . %empty [$end, 'a']
|
||||||
6 c: . ['b']]AT_COND_CASE([[most]], [[
|
6 c: . %empty ['b']]AT_COND_CASE([[most]], [[
|
||||||
|
|
||||||
'b' reduce using rule 6 (c)
|
'b' reduce using rule 6 (c)
|
||||||
$default reduce using rule 5 (b)]], [[
|
$default reduce using rule 5 (b)]], [[
|
||||||
|
|||||||
@@ -770,7 +770,7 @@ static const yytype_uint8 yyrline[] =
|
|||||||
static const char *const yytname[] =
|
static const char *const yytname[] =
|
||||||
{
|
{
|
||||||
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
|
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
|
||||||
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULL
|
"\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULLPTR
|
||||||
};
|
};
|
||||||
static const yytype_uint16 yytoknum[] =
|
static const yytype_uint16 yytoknum[] =
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user