mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-18 07:04:26 +00:00
Compare commits
38
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2ecada32b | ||
|
|
458171e6df | ||
|
|
8d0b7cef7d | ||
|
|
afc4457605 | ||
|
|
60dcc936ce | ||
|
|
ad9d4f9f2e | ||
|
|
3cc83855d9 | ||
|
|
5407fc7d76 | ||
|
|
516652b474 | ||
|
|
026816664f | ||
|
|
265640d56e | ||
|
|
ee9cdb8595 | ||
|
|
a810712331 | ||
|
|
1a9646fc91 | ||
|
|
67411a88a0 | ||
|
|
0bfe22b6d5 | ||
|
|
3a684d611e | ||
|
|
a9733794bb | ||
|
|
19fe1aa332 | ||
|
|
39bace5da8 | ||
|
|
071863b3d8 | ||
|
|
e4678430c2 | ||
|
|
2b7fe38c36 | ||
|
|
4c4191cec2 | ||
|
|
ae7cd18c98 | ||
|
|
77482f2783 | ||
|
|
5a6e85fb8d | ||
|
|
9e87ff5472 | ||
|
|
3afe18fd1f | ||
|
|
b51cf830a6 | ||
|
|
66b03e134f | ||
|
|
3dc50b3bc2 | ||
|
|
0a244a2269 | ||
|
|
b5e27aa262 | ||
|
|
0149d39e6e | ||
|
|
1d91bfdf1c | ||
|
|
db40c3f869 | ||
|
|
b663fd5322 |
+10
-1
@@ -1,7 +1,16 @@
|
|||||||
|
*.eps
|
||||||
|
*.log
|
||||||
|
*.o
|
||||||
|
*.pdf
|
||||||
|
*.png
|
||||||
|
*.stamp
|
||||||
|
*.trs
|
||||||
|
*~
|
||||||
|
.deps
|
||||||
|
.dirstamp
|
||||||
/*.cache
|
/*.cache
|
||||||
/*.flc
|
/*.flc
|
||||||
/*.prj
|
/*.prj
|
||||||
/*~
|
|
||||||
/.tarball-version
|
/.tarball-version
|
||||||
/.version
|
/.version
|
||||||
/ABOUT-NLS
|
/ABOUT-NLS
|
||||||
|
|||||||
@@ -1,33 +1,35 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
* Noteworthy changes in release 3.0.1 (2013-11-12) [stable]
|
||||||
|
|
||||||
** New syntax: partial-order precedence relationships
|
** Bug fixes
|
||||||
|
|
||||||
Formerly, the precedence order of tokens was linear, depending only on the
|
*** Errors in caret diagnostics
|
||||||
order in which they were declared. With the new syntax, all the tokens are
|
|
||||||
not necessarily comparable. It is possible to declare a group of tokens with
|
|
||||||
no links outside of the group, and to later on add only those needed.
|
|
||||||
The uncomparability of tokens would allow for more feedback on new conflicts
|
|
||||||
silently resolved via precedence.
|
|
||||||
|
|
||||||
An example of the new syntax applied to arithmetic and boolean operators,
|
On some platforms, some errors could result in endless diagnostics.
|
||||||
with '^' serving as both numerical power and boolean XOR:
|
|
||||||
|
|
||||||
%gprec arith {
|
*** Fixes of the -Werror option
|
||||||
%left '+' '-'
|
|
||||||
%left '*' '/'
|
|
||||||
}
|
|
||||||
%gprec bool {
|
|
||||||
%left OR
|
|
||||||
%left AND
|
|
||||||
}
|
|
||||||
%gprec { %right '^' }
|
|
||||||
|
|
||||||
%precr '^' > arith
|
Options such as "-Werror -Wno-error=foo" were still turning "foo"
|
||||||
%precr OR AND > '^'
|
diagnostics into errors instead of warnings. This is fixed.
|
||||||
|
|
||||||
Here, AND is not comparable with '+', but '^' > '+' and AND > '^'
|
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
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ Cris van Pelt [email protected]
|
|||||||
Csaba Raduly [email protected]
|
Csaba Raduly [email protected]
|
||||||
Dagobert Michelsen [email protected]
|
Dagobert Michelsen [email protected]
|
||||||
Daniel Frużyński [email protected]
|
Daniel Frużyński [email protected]
|
||||||
|
Daniel Galloway [email protected]
|
||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
David Kastrup [email protected]
|
David Kastrup [email protected]
|
||||||
@@ -65,6 +66,7 @@ Johan van Selst [email protected]
|
|||||||
Jonathan Fabrizio [email protected]
|
Jonathan Fabrizio [email protected]
|
||||||
Jonathan Nieder [email protected]
|
Jonathan Nieder [email protected]
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
|
Ken Moffat [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
Keith Browne [email protected]
|
Keith Browne [email protected]
|
||||||
Laurent Mascherpa [email protected]
|
Laurent Mascherpa [email protected]
|
||||||
@@ -78,6 +80,7 @@ Martin Mokrejs [email protected]
|
|||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
Matt Kraai [email protected]
|
Matt Kraai [email protected]
|
||||||
Matt Rosing [email protected]
|
Matt Rosing [email protected]
|
||||||
|
Michael Felt [email protected]
|
||||||
Michael Hayes [email protected]
|
Michael Hayes [email protected]
|
||||||
Michael Raskin [email protected]
|
Michael Raskin [email protected]
|
||||||
Michiel De Wilde [email protected]
|
Michiel De Wilde [email protected]
|
||||||
@@ -109,6 +112,7 @@ R Blake [email protected]
|
|||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
|
Rici Lake [email protected]
|
||||||
Rob Vermaas [email protected]
|
Rob Vermaas [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
Rob Conde [email protected]
|
Rob Conde [email protected]
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-18
@@ -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,21 +157,17 @@ 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])
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
$LEX_IS_FLEX || test "X$LEX" = X: || {
|
||||||
|
AC_MSG_WARN([bypassing lex because flex is required])
|
||||||
|
LEX=:
|
||||||
|
}
|
||||||
|
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
||||||
|
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_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]],
|
||||||
|
|||||||
+74
-76
@@ -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);
|
||||||
@@ -836,12 +831,10 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
if (yys->yysemantics.yyfirstVal)
|
if (yys->yysemantics.yyfirstVal)
|
||||||
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 (stderr, yystos[yys->yylrState],
|
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
|
||||||
YY_NULL]b4_locuser_args([&yys->yyloc])[);
|
|
||||||
YYFPRINTF (stderr, "\n");
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -966,6 +959,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, size_t yyk, yyGLRState* yystate,
|
|||||||
{
|
{
|
||||||
yySemanticOption* yynewOption =
|
yySemanticOption* yynewOption =
|
||||||
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
||||||
|
YYASSERT (!yynewOption->yyisState);
|
||||||
yynewOption->yystate = yyrhs;
|
yynewOption->yystate = yyrhs;
|
||||||
yynewOption->yyrule = yyrule;
|
yynewOption->yyrule = yyrule;
|
||||||
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
||||||
@@ -993,7 +987,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)
|
||||||
@@ -1023,8 +1017,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1063,10 +1057,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);
|
||||||
}
|
}
|
||||||
@@ -1074,18 +1068,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);
|
||||||
@@ -1109,7 +1103,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1117,9 +1111,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
|
||||||
@@ -1128,12 +1122,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
|
||||||
@@ -1143,7 +1137,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)
|
||||||
{
|
{
|
||||||
@@ -1201,12 +1195,13 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
|
|||||||
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
size_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
|
YYASSERT (yynewState->yyisState);
|
||||||
|
|
||||||
yynewState->yylrState = yylrState;
|
yynewState->yylrState = 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 +1261,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,14 +1313,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)
|
||||||
{
|
{
|
||||||
YYRESULTTAG yyflag;
|
YYSTYPE yysval;]b4_locations_if([[
|
||||||
YYSTYPE yysval;]b4_locations_if([
|
YYLTYPE yyloc;]])[
|
||||||
YYLTYPE yyloc;])[
|
|
||||||
|
|
||||||
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));
|
||||||
@@ -1358,7 +1352,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];
|
||||||
@@ -1385,7 +1379,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];
|
||||||
@@ -1395,7 +1389,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])))
|
||||||
@@ -1406,7 +1400,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;
|
||||||
|
|
||||||
@@ -1414,7 +1408,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;
|
||||||
}
|
}
|
||||||
@@ -1478,9 +1472,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;
|
||||||
@@ -1601,7 +1595,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;
|
||||||
@@ -1672,7 +1666,7 @@ yyresolveLocations (yyGLRState* yys1, int yyn1,
|
|||||||
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||||
int yynrhs;
|
int yynrhs;
|
||||||
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
||||||
YYASSERT (yyoption != YY_NULL);
|
YYASSERT (yyoption != YY_NULLPTR);
|
||||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||||
if (yynrhs > 0)
|
if (yynrhs > 0)
|
||||||
{
|
{
|
||||||
@@ -1731,7 +1725,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;
|
||||||
|
|
||||||
@@ -1773,7 +1767,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])
|
||||||
{
|
{
|
||||||
@@ -1800,14 +1794,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;
|
||||||
@@ -1827,10 +1821,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;
|
||||||
@@ -1838,10 +1832,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;
|
||||||
@@ -1856,7 +1850,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",
|
||||||
@@ -1978,13 +1972,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
|
||||||
@@ -2040,7 +2034,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;
|
||||||
}
|
}
|
||||||
@@ -2118,7 +2112,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
|
||||||
@@ -2159,10 +2153,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);
|
||||||
@@ -2170,7 +2164,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];
|
||||||
@@ -2194,14 +2188,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) \
|
||||||
@@ -2444,7 +2438,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;
|
||||||
@@ -2476,7 +2470,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);
|
||||||
@@ -2490,7 +2484,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
|
||||||
@@ -2504,6 +2498,8 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
(unsigned long int) (yyp - yystackp->yyitems));
|
(unsigned long int) (yyp - yystackp->yyitems));
|
||||||
if (*(yybool *) yyp)
|
if (*(yybool *) yyp)
|
||||||
{
|
{
|
||||||
|
YYASSERT (yyp->yystate.yyisState);
|
||||||
|
YYASSERT (yyp->yyoption.yyisState);
|
||||||
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %lu, pred: %ld",
|
||||||
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
||||||
(unsigned long int) yyp->yystate.yyposn,
|
(unsigned long int) yyp->yystate.yyposn,
|
||||||
@@ -2515,6 +2511,8 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
YYASSERT (!yyp->yystate.yyisState);
|
||||||
|
YYASSERT (!yyp->yyoption.yyisState);
|
||||||
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
||||||
yyp->yyoption.yyrule - 1,
|
yyp->yyoption.yyrule - 1,
|
||||||
(long int) YYINDEX (yyp->yyoption.yystate),
|
(long int) YYINDEX (yyp->yyoption.yystate),
|
||||||
|
|||||||
+13
-12
@@ -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
|
||||||
@@ -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[
|
||||||
@@ -734,7 +735,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:
|
||||||
@@ -859,7 +860,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
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;
|
||||||
|
|
||||||
/*--------------------------------------.
|
/*--------------------------------------.
|
||||||
@@ -988,11 +989,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 +1075,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) \
|
||||||
|
|||||||
+3
-3
@@ -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)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-5
@@ -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.
|
||||||
@@ -178,8 +178,7 @@ m4_define([b4_variant_define],
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
void
|
void
|
||||||
move (self_type& other)
|
move (self_type& other)
|
||||||
{]b4_parse_assert_if([
|
{
|
||||||
YYASSERT (!yytname_);])[
|
|
||||||
build<T> ();
|
build<T> ();
|
||||||
swap<T> (other);
|
swap<T> (other);
|
||||||
other.destroy<T> ();
|
other.destroy<T> ();
|
||||||
@@ -199,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:
|
||||||
@@ -321,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])));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
])])])
|
])])])
|
||||||
|
|||||||
+6
-6
@@ -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;
|
||||||
|
|||||||
+14
-8
@@ -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. ##
|
||||||
|
|||||||
+25
-25
@@ -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
|
||||||
|
|||||||
+12
-12
@@ -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) -f $(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,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
|
||||||
|
|||||||
+11
-5
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
%debug
|
%debug
|
||||||
%skeleton "lalr1.cc"
|
%language "c++"
|
||||||
%defines
|
%defines
|
||||||
%define api.token.constructor
|
%define api.token.constructor
|
||||||
%define api.value.type variant
|
%define api.value.type variant
|
||||||
@@ -48,11 +48,17 @@ typedef std::list<std::string> strings_type;
|
|||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream& o, const strings_type& s)
|
operator<< (std::ostream& o, const strings_type& ss)
|
||||||
{
|
{
|
||||||
std::copy (s.begin (), s.end (),
|
o << "(" << &ss << ") {";
|
||||||
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
const char *sep = "";
|
||||||
return o;
|
for (strings_type::const_iterator i = ss.begin(), end = ss.end();
|
||||||
|
i != end; ++i)
|
||||||
|
{
|
||||||
|
o << sep << *i;
|
||||||
|
sep = ", ";
|
||||||
|
}
|
||||||
|
return o << "}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: 03e96cc338...d208f3ab64
+3
-1
@@ -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
|
||||||
|
|||||||
+15
-12
@@ -242,7 +242,7 @@ AnnotationList__computePredecessorAnnotations (AnnotationList *self, state *s,
|
|||||||
{
|
{
|
||||||
symbol_number contribution_token =
|
symbol_number contribution_token =
|
||||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
||||||
->content->number;
|
->number;
|
||||||
if (AnnotationList__isContributionAlways (self, ci))
|
if (AnnotationList__isContributionAlways (self, ci))
|
||||||
{
|
{
|
||||||
annotation_node->contributions[ci] = NULL;
|
annotation_node->contributions[ci] = NULL;
|
||||||
@@ -541,15 +541,19 @@ 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
|
||||||
conflict with no token precedence. */
|
conflict with no token precedence. */
|
||||||
aver (!bitset_test (shift_tokens, conflicted_token)
|
aver (!bitset_test (shift_tokens, conflicted_token)
|
||||||
|| symbols[conflicted_token]->content->prec);
|
|| symbols[conflicted_token]->prec);
|
||||||
++annotation_counts[s->number];
|
++annotation_counts[s->number];
|
||||||
if (contribution_count > *max_contributionsp)
|
if (contribution_count > *max_contributionsp)
|
||||||
*max_contributionsp = contribution_count;
|
*max_contributionsp = contribution_count;
|
||||||
@@ -595,7 +599,7 @@ AnnotationList__debug (AnnotationList const *self, size_t nitems, int spaces)
|
|||||||
{
|
{
|
||||||
symbol_number token =
|
symbol_number token =
|
||||||
InadequacyList__getContributionToken (a->inadequacyNode, ci)
|
InadequacyList__getContributionToken (a->inadequacyNode, ci)
|
||||||
->content->number;
|
->number;
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; j < spaces+2; ++j)
|
for (j = 0; j < spaces+2; ++j)
|
||||||
@@ -644,7 +648,7 @@ AnnotationList__computeLookaheadFilter (AnnotationList const *self,
|
|||||||
Sbitset biter;
|
Sbitset biter;
|
||||||
symbol_number token =
|
symbol_number token =
|
||||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
||||||
->content->number;
|
->number;
|
||||||
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
|
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
|
||||||
bitset_set (lookahead_filter[item], token);
|
bitset_set (lookahead_filter[item], token);
|
||||||
}
|
}
|
||||||
@@ -679,8 +683,7 @@ AnnotationList__stateMakesContribution (AnnotationList const *self,
|
|||||||
return false;
|
return false;
|
||||||
{
|
{
|
||||||
symbol_number token =
|
symbol_number token =
|
||||||
InadequacyList__getContributionToken (self->inadequacyNode, ci)
|
InadequacyList__getContributionToken (self->inadequacyNode, ci)->number;
|
||||||
->content->number;
|
|
||||||
Sbitset__Index item;
|
Sbitset__Index item;
|
||||||
Sbitset biter;
|
Sbitset biter;
|
||||||
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
|
SBITSET__FOR_EACH (self->contributions[ci], nitems, biter, item)
|
||||||
@@ -710,7 +713,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
|||||||
ContributionIndex ci;
|
ContributionIndex ci;
|
||||||
int actioni;
|
int actioni;
|
||||||
ContributionIndex ci_rr_dominator = ContributionIndex__none;
|
ContributionIndex ci_rr_dominator = ContributionIndex__none;
|
||||||
int shift_precedence = token->content->prec;
|
int shift_precedence = token->prec;
|
||||||
|
|
||||||
/* If the token has no precedence set, shift is always chosen. */
|
/* If the token has no precedence set, shift is always chosen. */
|
||||||
if (!shift_precedence)
|
if (!shift_precedence)
|
||||||
@@ -740,7 +743,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
|||||||
if (reduce_precedence
|
if (reduce_precedence
|
||||||
&& (reduce_precedence < shift_precedence
|
&& (reduce_precedence < shift_precedence
|
||||||
|| (reduce_precedence == shift_precedence
|
|| (reduce_precedence == shift_precedence
|
||||||
&& token->content->prec_node->assoc == right_assoc)))
|
&& token->assoc == right_assoc)))
|
||||||
continue;
|
continue;
|
||||||
if (!AnnotationList__stateMakesContribution (self, nitems, ci,
|
if (!AnnotationList__stateMakesContribution (self, nitems, ci,
|
||||||
lookaheads))
|
lookaheads))
|
||||||
@@ -748,7 +751,7 @@ AnnotationList__computeDominantContribution (AnnotationList const *self,
|
|||||||
/* This uneliminated reduction contributes, so see if it can cause
|
/* This uneliminated reduction contributes, so see if it can cause
|
||||||
an error action. */
|
an error action. */
|
||||||
if (reduce_precedence == shift_precedence
|
if (reduce_precedence == shift_precedence
|
||||||
&& token->content->prec_node->assoc == non_assoc)
|
&& token->assoc == non_assoc)
|
||||||
{
|
{
|
||||||
/* It's not possible to find split-stable domination over
|
/* It's not possible to find split-stable domination over
|
||||||
shift after a potential %nonassoc. */
|
shift after a potential %nonassoc. */
|
||||||
|
|||||||
+63
-39
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -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. */
|
||||||
|
|||||||
+60
-81
@@ -53,8 +53,7 @@ enum conflict_resolution
|
|||||||
reduce_resolution,
|
reduce_resolution,
|
||||||
left_resolution,
|
left_resolution,
|
||||||
right_resolution,
|
right_resolution,
|
||||||
nonassoc_resolution,
|
nonassoc_resolution
|
||||||
uncomparable_resolution
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -91,7 +90,6 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case nonassoc_resolution:
|
case nonassoc_resolution:
|
||||||
case uncomparable_resolution:
|
|
||||||
obstack_printf (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
_(" Conflict between rule %d and token %s"
|
_(" Conflict between rule %d and token %s"
|
||||||
" resolved as an error"),
|
" resolved as an error"),
|
||||||
@@ -106,7 +104,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
case shift_resolution:
|
case shift_resolution:
|
||||||
obstack_printf (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%s < %s)",
|
" (%s < %s)",
|
||||||
r->prec->symbol->tag,
|
r->prec->tag,
|
||||||
symbols[token]->tag);
|
symbols[token]->tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -114,7 +112,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
obstack_printf (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%s < %s)",
|
" (%s < %s)",
|
||||||
symbols[token]->tag,
|
symbols[token]->tag,
|
||||||
r->prec->symbol->tag);
|
r->prec->tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case left_resolution:
|
case left_resolution:
|
||||||
@@ -134,12 +132,6 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
" (%%nonassoc %s)",
|
" (%%nonassoc %s)",
|
||||||
symbols[token]->tag);
|
symbols[token]->tag);
|
||||||
break;
|
break;
|
||||||
case uncomparable_resolution:
|
|
||||||
obstack_printf (&solved_conflicts_obstack,
|
|
||||||
" (%s uncomparable with %s)",
|
|
||||||
r->prec->symbol->tag,
|
|
||||||
symbols[token]->tag);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_sgrow (&solved_conflicts_obstack, ".\n");
|
obstack_sgrow (&solved_conflicts_obstack, ".\n");
|
||||||
@@ -169,7 +161,6 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
xml_escape (symbols[token]->tag));
|
xml_escape (symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case uncomparable_resolution:
|
|
||||||
case nonassoc_resolution:
|
case nonassoc_resolution:
|
||||||
obstack_printf (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
" <resolution rule=\"%d\" symbol=\"%s\""
|
" <resolution rule=\"%d\" symbol=\"%s\""
|
||||||
@@ -185,7 +176,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
case shift_resolution:
|
case shift_resolution:
|
||||||
obstack_printf (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%s < %s",
|
"%s < %s",
|
||||||
xml_escape_n (0, r->prec->symbol->tag),
|
xml_escape_n (0, r->prec->tag),
|
||||||
xml_escape_n (1, symbols[token]->tag));
|
xml_escape_n (1, symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -193,7 +184,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
obstack_printf (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%s < %s",
|
"%s < %s",
|
||||||
xml_escape_n (0, symbols[token]->tag),
|
xml_escape_n (0, symbols[token]->tag),
|
||||||
xml_escape_n (1, r->prec->symbol->tag));
|
xml_escape_n (1, r->prec->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case left_resolution:
|
case left_resolution:
|
||||||
@@ -212,13 +203,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
obstack_printf (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%%nonassoc %s",
|
"%%nonassoc %s",
|
||||||
xml_escape (symbols[token]->tag));
|
xml_escape (symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
case uncomparable_resolution:
|
|
||||||
obstack_printf (&solved_conflicts_xml_obstack,
|
|
||||||
"%s uncomparable with %s",
|
|
||||||
xml_escape_n (0, symbols[token]->tag),
|
|
||||||
xml_escape_n (1, r->prec->symbol->tag));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_sgrow (&solved_conflicts_xml_obstack, "</resolution>\n");
|
obstack_sgrow (&solved_conflicts_xml_obstack, "</resolution>\n");
|
||||||
@@ -258,6 +243,7 @@ flush_reduce (bitset lookahead_tokens, int token)
|
|||||||
bitset_reset (lookahead_tokens, token);
|
bitset_reset (lookahead_tokens, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| Attempt to resolve shift-reduce conflict for one rule by means of |
|
| Attempt to resolve shift-reduce conflict for one rule by means of |
|
||||||
| precedence declarations. It has already been checked that the |
|
| precedence declarations. It has already been checked that the |
|
||||||
@@ -277,73 +263,66 @@ resolve_sr_conflict (state *s, int ruleno, symbol **errors, int *nerrs)
|
|||||||
reductions *reds = s->reductions;
|
reductions *reds = s->reductions;
|
||||||
/* Find the rule to reduce by to get precedence of reduction. */
|
/* Find the rule to reduce by to get precedence of reduction. */
|
||||||
rule *redrule = reds->rules[ruleno];
|
rule *redrule = reds->rules[ruleno];
|
||||||
prec_node *redprecsym = redrule->prec->prec_node;
|
int redprec = redrule->prec->prec;
|
||||||
bitset lookahead_tokens = reds->lookahead_tokens[ruleno];
|
bitset lookahead_tokens = reds->lookahead_tokens[ruleno];
|
||||||
|
|
||||||
for (i = 0; i < ntokens; i++)
|
for (i = 0; i < ntokens; i++)
|
||||||
if (bitset_test (lookahead_tokens, i)
|
if (bitset_test (lookahead_tokens, i)
|
||||||
&& bitset_test (lookahead_set, i))
|
&& bitset_test (lookahead_set, i)
|
||||||
|
&& symbols[i]->prec)
|
||||||
{
|
{
|
||||||
if (redprecsym && symbols[i]->content->prec_node)
|
/* Shift-reduce conflict occurs for token number i
|
||||||
|
and it has a precedence.
|
||||||
|
The precedence of shifting is that of token i. */
|
||||||
|
if (symbols[i]->prec < redprec)
|
||||||
{
|
{
|
||||||
/* Shift-reduce conflict occurs for token number i
|
register_precedence (redrule->prec->number, i);
|
||||||
and it has a precedence.
|
log_resolution (redrule, i, reduce_resolution);
|
||||||
The precedence of shifting is that of token i. */
|
flush_shift (s, i);
|
||||||
if (is_prec_superior (redprecsym, symbols[i]->content->prec_node))
|
}
|
||||||
{
|
else if (symbols[i]->prec > redprec)
|
||||||
register_precedence (redrule->prec->number, i);
|
{
|
||||||
log_resolution (redrule, i, reduce_resolution);
|
register_precedence (i, redrule->prec->number);
|
||||||
flush_shift (s, i);
|
log_resolution (redrule, i, shift_resolution);
|
||||||
}
|
flush_reduce (lookahead_tokens, i);
|
||||||
else if (is_prec_superior (symbols[i]->content->prec_node,
|
|
||||||
redprecsym))
|
|
||||||
{
|
|
||||||
register_precedence (i, redrule->prec->number);
|
|
||||||
log_resolution (redrule, i, shift_resolution);
|
|
||||||
flush_reduce (lookahead_tokens, i);
|
|
||||||
}
|
|
||||||
else if (is_prec_equal (redprecsym, symbols[i]->content->prec_node))
|
|
||||||
/* Matching precedence levels.
|
|
||||||
For non-defined associativity, keep both: unexpected
|
|
||||||
associativity conflict.
|
|
||||||
For left associativity, keep only the reduction.
|
|
||||||
For right associativity, keep only the shift.
|
|
||||||
For nonassociativity, keep neither. */
|
|
||||||
|
|
||||||
switch (symbols[i]->content->prec_node->assoc)
|
|
||||||
{
|
|
||||||
case undef_assoc:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case precedence_assoc:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case right_assoc:
|
|
||||||
register_assoc (i, redrule->prec->number);
|
|
||||||
log_resolution (redrule, i, right_resolution);
|
|
||||||
flush_reduce (lookahead_tokens, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case left_assoc:
|
|
||||||
register_assoc (i, redrule->prec->number);
|
|
||||||
log_resolution (redrule, i, left_resolution);
|
|
||||||
flush_shift (s, i);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case non_assoc:
|
|
||||||
register_assoc (i, redrule->prec->number);
|
|
||||||
log_resolution (redrule, i, nonassoc_resolution);
|
|
||||||
flush_shift (s, i);
|
|
||||||
flush_reduce (lookahead_tokens, i);
|
|
||||||
/* Record an explicit error for this token. */
|
|
||||||
errors[(*nerrs)++] = symbols[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
log_resolution (redrule, i, uncomparable_resolution);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_resolution (redrule, i, uncomparable_resolution);
|
/* Matching precedence levels.
|
||||||
|
For non-defined associativity, keep both: unexpected
|
||||||
|
associativity conflict.
|
||||||
|
For left associativity, keep only the reduction.
|
||||||
|
For right associativity, keep only the shift.
|
||||||
|
For nonassociativity, keep neither. */
|
||||||
|
|
||||||
|
switch (symbols[i]->assoc)
|
||||||
|
{
|
||||||
|
case undef_assoc:
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
case precedence_assoc:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case right_assoc:
|
||||||
|
register_assoc (i, redrule->prec->number);
|
||||||
|
log_resolution (redrule, i, right_resolution);
|
||||||
|
flush_reduce (lookahead_tokens, i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case left_assoc:
|
||||||
|
register_assoc (i, redrule->prec->number);
|
||||||
|
log_resolution (redrule, i, left_resolution);
|
||||||
|
flush_shift (s, i);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case non_assoc:
|
||||||
|
register_assoc (i, redrule->prec->number);
|
||||||
|
log_resolution (redrule, i, nonassoc_resolution);
|
||||||
|
flush_shift (s, i);
|
||||||
|
flush_reduce (lookahead_tokens, i);
|
||||||
|
/* Record an explicit error for this token. */
|
||||||
|
errors[(*nerrs)++] = symbols[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +354,7 @@ set_conflicts (state *s, symbol **errors)
|
|||||||
check for shift-reduce conflict, and try to resolve using
|
check for shift-reduce conflict, and try to resolve using
|
||||||
precedence. */
|
precedence. */
|
||||||
for (i = 0; i < reds->num; ++i)
|
for (i = 0; i < reds->num; ++i)
|
||||||
if (reds->rules[i]->prec /* && reds->rules[i]->prec->prec */
|
if (reds->rules[i]->prec && reds->rules[i]->prec->prec
|
||||||
&& !bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
&& !bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
||||||
resolve_sr_conflict (s, i, errors, &nerrs);
|
resolve_sr_conflict (s, i, errors, &nerrs);
|
||||||
|
|
||||||
|
|||||||
+9
-11
@@ -44,8 +44,6 @@ int nvars = 0;
|
|||||||
|
|
||||||
symbol_number *token_translations = NULL;
|
symbol_number *token_translations = NULL;
|
||||||
|
|
||||||
enum braces_state prec_braces = 0;
|
|
||||||
|
|
||||||
int max_user_token_number = 256;
|
int max_user_token_number = 256;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -67,19 +65,19 @@ rule_useless_in_parser_p (rule const *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rule_lhs_print (rule const *r, sym_content const *previous_lhs, FILE *out)
|
rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out)
|
||||||
{
|
{
|
||||||
fprintf (out, " %3d ", r->number);
|
fprintf (out, " %3d ", r->number);
|
||||||
if (previous_lhs != r->lhs)
|
if (previous_lhs != r->lhs)
|
||||||
fprintf (out, "%s:", r->lhs->symbol->tag);
|
fprintf (out, "%s:", r->lhs->tag);
|
||||||
else
|
else
|
||||||
fprintf (out, "%*s|", (int) strlen (previous_lhs->symbol->tag), "");
|
fprintf (out, "%*s|", (int) strlen (previous_lhs->tag), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rule_lhs_print_xml (rule const *r, FILE *out, int level)
|
rule_lhs_print_xml (rule const *r, FILE *out, int level)
|
||||||
{
|
{
|
||||||
xml_printf (out, level, "<lhs>%s</lhs>", r->lhs->symbol->tag);
|
xml_printf (out, level, "<lhs>%s</lhs>", r->lhs->tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
@@ -160,7 +158,7 @@ grammar_rules_partial_print (FILE *out, const char *title,
|
|||||||
{
|
{
|
||||||
rule_number r;
|
rule_number r;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
sym_content *previous_lhs = NULL;
|
symbol *previous_lhs = NULL;
|
||||||
|
|
||||||
/* rule # : LHS -> RHS */
|
/* rule # : LHS -> RHS */
|
||||||
for (r = 0; r < nrules + nuseless_productions; r++)
|
for (r = 0; r < nrules + nuseless_productions; r++)
|
||||||
@@ -211,7 +209,7 @@ grammar_rules_print_xml (FILE *out, int level)
|
|||||||
rules[r].number, usefulness);
|
rules[r].number, usefulness);
|
||||||
if (rules[r].precsym)
|
if (rules[r].precsym)
|
||||||
fprintf (out, " percent_prec=\"%s\"",
|
fprintf (out, " percent_prec=\"%s\"",
|
||||||
xml_escape (rules[r].precsym->symbol->tag));
|
xml_escape (rules[r].precsym->tag));
|
||||||
fputs (">\n", out);
|
fputs (">\n", out);
|
||||||
}
|
}
|
||||||
rule_lhs_print_xml (&rules[r], out, level + 3);
|
rule_lhs_print_xml (&rules[r], out, level + 3);
|
||||||
@@ -241,7 +239,7 @@ grammar_dump (FILE *out, const char *title)
|
|||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
fprintf (out, "%5d %5d %5d %s\n",
|
fprintf (out, "%5d %5d %5d %s\n",
|
||||||
i,
|
i,
|
||||||
symbols[i]->content->prec, symbols[i]->content->prec_node->assoc,
|
symbols[i]->prec, symbols[i]->assoc,
|
||||||
symbols[i]->tag);
|
symbols[i]->tag);
|
||||||
fprintf (out, "\n\n");
|
fprintf (out, "\n\n");
|
||||||
}
|
}
|
||||||
@@ -264,7 +262,7 @@ grammar_dump (FILE *out, const char *title)
|
|||||||
fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u) %2d ->",
|
fprintf (out, "%3d (%2d, %2d, %2d, %2u-%2u) %2d ->",
|
||||||
i,
|
i,
|
||||||
rule_i->prec ? rule_i->prec->prec : 0,
|
rule_i->prec ? rule_i->prec->prec : 0,
|
||||||
rule_i->prec ? rule_i->prec->prec_node->assoc : 0,
|
rule_i->prec ? rule_i->prec->assoc : 0,
|
||||||
rule_i->useful,
|
rule_i->useful,
|
||||||
rhs_itemno,
|
rhs_itemno,
|
||||||
rhs_itemno + rhs_count - 1,
|
rhs_itemno + rhs_count - 1,
|
||||||
@@ -282,7 +280,7 @@ grammar_dump (FILE *out, const char *title)
|
|||||||
rule_number r;
|
rule_number r;
|
||||||
for (r = 0; r < nrules + nuseless_productions; r++)
|
for (r = 0; r < nrules + nuseless_productions; r++)
|
||||||
{
|
{
|
||||||
fprintf (out, "%-5d %s:", r, rules[r].lhs->symbol->tag);
|
fprintf (out, "%-5d %s:", r, rules[r].lhs->tag);
|
||||||
rule_rhs_print (&rules[r], out);
|
rule_rhs_print (&rules[r], out);
|
||||||
fprintf (out, "\n");
|
fprintf (out, "\n");
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-16
@@ -117,17 +117,6 @@ typedef int item_number;
|
|||||||
extern item_number *ritem;
|
extern item_number *ritem;
|
||||||
extern unsigned int nritems;
|
extern unsigned int nritems;
|
||||||
|
|
||||||
enum braces_state
|
|
||||||
{
|
|
||||||
default_braces_state,
|
|
||||||
gprec_seen,
|
|
||||||
group_name_seen,
|
|
||||||
braces_seen
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Marker for the lexer and parser, to correctly interpret braces. */
|
|
||||||
extern enum braces_state prec_braces;
|
|
||||||
|
|
||||||
/* There is weird relationship between OT1H item_number and OTOH
|
/* There is weird relationship between OT1H item_number and OTOH
|
||||||
symbol_number and rule_number: we store the latter in
|
symbol_number and rule_number: we store the latter in
|
||||||
item_number. symbol_number values are stored as-is, while
|
item_number. symbol_number values are stored as-is, while
|
||||||
@@ -191,17 +180,17 @@ typedef struct
|
|||||||
except if some rules are useless. */
|
except if some rules are useless. */
|
||||||
rule_number number;
|
rule_number number;
|
||||||
|
|
||||||
sym_content *lhs;
|
symbol *lhs;
|
||||||
item_number *rhs;
|
item_number *rhs;
|
||||||
|
|
||||||
/* This symbol provides both the associativity, and the precedence. */
|
/* This symbol provides both the associativity, and the precedence. */
|
||||||
sym_content *prec;
|
symbol *prec;
|
||||||
|
|
||||||
int dprec;
|
int dprec;
|
||||||
int merger;
|
int merger;
|
||||||
|
|
||||||
/* This symbol was attached to the rule via %prec. */
|
/* This symbol was attached to the rule via %prec. */
|
||||||
sym_content *precsym;
|
symbol *precsym;
|
||||||
|
|
||||||
location location;
|
location location;
|
||||||
bool useful;
|
bool useful;
|
||||||
@@ -231,8 +220,7 @@ bool rule_useless_in_parser_p (rule const *r);
|
|||||||
/* Print this rule's number and lhs on OUT. If a PREVIOUS_LHS was
|
/* Print this rule's number and lhs on OUT. If a PREVIOUS_LHS was
|
||||||
already displayed (by a previous call for another rule), avoid
|
already displayed (by a previous call for another rule), avoid
|
||||||
useless repetitions. */
|
useless repetitions. */
|
||||||
void rule_lhs_print (rule const *r, sym_content const *previous_lhs,
|
void rule_lhs_print (rule const *r, symbol const *previous_lhs, FILE *out);
|
||||||
FILE *out);
|
|
||||||
void rule_lhs_print_xml (rule const *r, FILE *out, int level);
|
void rule_lhs_print_xml (rule const *r, FILE *out, int level);
|
||||||
|
|
||||||
/* Return the length of the RHS. */
|
/* Return the length of the RHS. */
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ no_reduce_bitset_init (state const *s, bitset *no_reduce_set)
|
|||||||
bitset_set (*no_reduce_set, TRANSITION_SYMBOL (s->transitions, n));
|
bitset_set (*no_reduce_set, TRANSITION_SYMBOL (s->transitions, n));
|
||||||
for (n = 0; n < s->errs->num; ++n)
|
for (n = 0; n < s->errs->num; ++n)
|
||||||
if (s->errs->symbols[n])
|
if (s->errs->symbols[n])
|
||||||
bitset_set (*no_reduce_set, s->errs->symbols[n]->content->number);
|
bitset_set (*no_reduce_set, s->errs->symbols[n]->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+2
-2
@@ -424,7 +424,7 @@ ielr_item_has_lookahead (state *s, symbol_number lhs, size_t item,
|
|||||||
if (item_number_is_rule_number (ritem[s->items[item] - 2]))
|
if (item_number_is_rule_number (ritem[s->items[item] - 2]))
|
||||||
{
|
{
|
||||||
state **predecessor;
|
state **predecessor;
|
||||||
aver (lhs != accept->content->number);
|
aver (lhs != accept->number);
|
||||||
for (predecessor = predecessors[s->number];
|
for (predecessor = predecessors[s->number];
|
||||||
*predecessor;
|
*predecessor;
|
||||||
++predecessor)
|
++predecessor)
|
||||||
@@ -580,7 +580,7 @@ typedef struct state_list {
|
|||||||
static void
|
static void
|
||||||
ielr_compute_goto_follow_set (bitsetv follow_kernel_items,
|
ielr_compute_goto_follow_set (bitsetv follow_kernel_items,
|
||||||
bitsetv always_follows, state_list *s,
|
bitsetv always_follows, state_list *s,
|
||||||
sym_content *n, bitset follow_set)
|
symbol *n, bitset follow_set)
|
||||||
{
|
{
|
||||||
goto_number n_goto = map_goto (s->lr0Isocore->state->number, n->number);
|
goto_number n_goto = map_goto (s->lr0Isocore->state->number, n->number);
|
||||||
bitset_copy (follow_set, always_follows[n_goto]);
|
bitset_copy (follow_set, always_follows[n_goto]);
|
||||||
|
|||||||
+3
-1
@@ -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
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -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. */
|
||||||
|
|||||||
+8
-7
@@ -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);
|
||||||
|
|||||||
+10
-12
@@ -149,7 +149,7 @@ prepare_symbols (void)
|
|||||||
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
||||||
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
||||||
MUSCLE_INSERT_INT ("symbols_number", nsyms);
|
MUSCLE_INSERT_INT ("symbols_number", nsyms);
|
||||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->content->number);
|
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
|
||||||
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
||||||
|
|
||||||
muscle_insert_symbol_number_table ("translate",
|
muscle_insert_symbol_number_table ("translate",
|
||||||
@@ -197,7 +197,7 @@ prepare_symbols (void)
|
|||||||
int i;
|
int i;
|
||||||
int *values = xnmalloc (ntokens, sizeof *values);
|
int *values = xnmalloc (ntokens, sizeof *values);
|
||||||
for (i = 0; i < ntokens; ++i)
|
for (i = 0; i < ntokens; ++i)
|
||||||
values[i] = symbols[i]->content->user_token_number;
|
values[i] = symbols[i]->user_token_number;
|
||||||
muscle_insert_int_table ("toknum", values,
|
muscle_insert_int_table ("toknum", values,
|
||||||
values[0], 1, ntokens);
|
values[0], 1, ntokens);
|
||||||
free (values);
|
free (values);
|
||||||
@@ -283,9 +283,9 @@ prepare_states (void)
|
|||||||
static int
|
static int
|
||||||
symbol_type_name_cmp (const symbol **lhs, const symbol **rhs)
|
symbol_type_name_cmp (const symbol **lhs, const symbol **rhs)
|
||||||
{
|
{
|
||||||
int res = uniqstr_cmp ((*lhs)->content->type_name, (*rhs)->content->type_name);
|
int res = uniqstr_cmp ((*lhs)->type_name, (*rhs)->type_name);
|
||||||
if (!res)
|
if (!res)
|
||||||
res = (*lhs)->content->number - (*rhs)->content->number;
|
res = (*lhs)->number - (*rhs)->number;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,9 +320,8 @@ type_names_output (FILE *out)
|
|||||||
/* The index of the first symbol of the current type-name. */
|
/* The index of the first symbol of the current type-name. */
|
||||||
int i0 = i;
|
int i0 = i;
|
||||||
fputs (i ? ",\n[" : "[", out);
|
fputs (i ? ",\n[" : "[", out);
|
||||||
for (; i < nsyms
|
for (; i < nsyms && syms[i]->type_name == syms[i0]->type_name; ++i)
|
||||||
&& syms[i]->content->type_name == syms[i0]->content->type_name; ++i)
|
fprintf (out, "%s%d", i != i0 ? ", " : "", syms[i]->number);
|
||||||
fprintf (out, "%s%d", i != i0 ? ", " : "", syms[i]->content->number);
|
|
||||||
fputs ("]", out);
|
fputs ("]", out);
|
||||||
}
|
}
|
||||||
fputs ("])\n\n", out);
|
fputs ("])\n\n", out);
|
||||||
@@ -429,21 +428,20 @@ prepare_symbol_definitions (void)
|
|||||||
MUSCLE_INSERT_STRING (key, sym->tag);
|
MUSCLE_INSERT_STRING (key, sym->tag);
|
||||||
|
|
||||||
SET_KEY ("user_number");
|
SET_KEY ("user_number");
|
||||||
MUSCLE_INSERT_INT (key, sym->content->user_token_number);
|
MUSCLE_INSERT_INT (key, sym->user_token_number);
|
||||||
|
|
||||||
SET_KEY ("is_token");
|
SET_KEY ("is_token");
|
||||||
MUSCLE_INSERT_INT (key,
|
MUSCLE_INSERT_INT (key,
|
||||||
i < ntokens && sym != errtoken && sym != undeftoken);
|
i < ntokens && sym != errtoken && sym != undeftoken);
|
||||||
|
|
||||||
SET_KEY ("number");
|
SET_KEY ("number");
|
||||||
MUSCLE_INSERT_INT (key, sym->content->number);
|
MUSCLE_INSERT_INT (key, sym->number);
|
||||||
|
|
||||||
SET_KEY ("has_type");
|
SET_KEY ("has_type");
|
||||||
MUSCLE_INSERT_INT (key, !!sym->content->type_name);
|
MUSCLE_INSERT_INT (key, !!sym->type_name);
|
||||||
|
|
||||||
SET_KEY ("type");
|
SET_KEY ("type");
|
||||||
MUSCLE_INSERT_STRING (key, sym->content->type_name
|
MUSCLE_INSERT_STRING (key, sym->type_name ? sym->type_name : "");
|
||||||
? sym->content->type_name : "");
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|||||||
+621
-756
File diff suppressed because it is too large
Load Diff
+57
-64
@@ -52,7 +52,7 @@ extern int gram_debug;
|
|||||||
|
|
||||||
#include "symlist.h"
|
#include "symlist.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#line 233 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 221 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ extern int gram_debug;
|
|||||||
param_parse = 1 << 1,
|
param_parse = 1 << 1,
|
||||||
param_both = param_lex | param_parse
|
param_both = param_lex | param_parse
|
||||||
} param_type;
|
} param_type;
|
||||||
#line 723 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 645 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
#include "muscle-tab.h"
|
#include "muscle-tab.h"
|
||||||
|
|
||||||
#line 68 "src/parse-gram.h" /* yacc.c:1909 */
|
#line 68 "src/parse-gram.h" /* yacc.c:1909 */
|
||||||
@@ -84,54 +84,49 @@ extern int gram_debug;
|
|||||||
PERCENT_PRECEDENCE = 267,
|
PERCENT_PRECEDENCE = 267,
|
||||||
PERCENT_PREC = 268,
|
PERCENT_PREC = 268,
|
||||||
PERCENT_DPREC = 269,
|
PERCENT_DPREC = 269,
|
||||||
PERCENT_GPREC = 270,
|
PERCENT_MERGE = 270,
|
||||||
PERCENT_PRECR = 271,
|
PERCENT_CODE = 271,
|
||||||
PERCENT_MERGE = 272,
|
PERCENT_DEFAULT_PREC = 272,
|
||||||
PERCENT_CODE = 273,
|
PERCENT_DEFINE = 273,
|
||||||
PERCENT_DEFAULT_PREC = 274,
|
PERCENT_DEFINES = 274,
|
||||||
PERCENT_DEFINE = 275,
|
PERCENT_ERROR_VERBOSE = 275,
|
||||||
PERCENT_DEFINES = 276,
|
PERCENT_EXPECT = 276,
|
||||||
PERCENT_ERROR_VERBOSE = 277,
|
PERCENT_EXPECT_RR = 277,
|
||||||
PERCENT_EXPECT = 278,
|
PERCENT_FLAG = 278,
|
||||||
PERCENT_EXPECT_RR = 279,
|
PERCENT_FILE_PREFIX = 279,
|
||||||
PERCENT_FLAG = 280,
|
PERCENT_GLR_PARSER = 280,
|
||||||
PERCENT_FILE_PREFIX = 281,
|
PERCENT_INITIAL_ACTION = 281,
|
||||||
PERCENT_GLR_PARSER = 282,
|
PERCENT_LANGUAGE = 282,
|
||||||
PERCENT_INITIAL_ACTION = 283,
|
PERCENT_NAME_PREFIX = 283,
|
||||||
PERCENT_LANGUAGE = 284,
|
PERCENT_NO_DEFAULT_PREC = 284,
|
||||||
PERCENT_NAME_PREFIX = 285,
|
PERCENT_NO_LINES = 285,
|
||||||
PERCENT_NO_DEFAULT_PREC = 286,
|
PERCENT_NONDETERMINISTIC_PARSER = 286,
|
||||||
PERCENT_NO_LINES = 287,
|
PERCENT_OUTPUT = 287,
|
||||||
PERCENT_NONDETERMINISTIC_PARSER = 288,
|
PERCENT_REQUIRE = 288,
|
||||||
PERCENT_OUTPUT = 289,
|
PERCENT_SKELETON = 289,
|
||||||
PERCENT_REQUIRE = 290,
|
PERCENT_START = 290,
|
||||||
PERCENT_SKELETON = 291,
|
PERCENT_TOKEN_TABLE = 291,
|
||||||
PERCENT_START = 292,
|
PERCENT_VERBOSE = 292,
|
||||||
PERCENT_TOKEN_TABLE = 293,
|
PERCENT_YACC = 293,
|
||||||
PERCENT_VERBOSE = 294,
|
BRACED_CODE = 294,
|
||||||
PERCENT_YACC = 295,
|
BRACED_PREDICATE = 295,
|
||||||
BRACED_CODE = 296,
|
BRACKETED_ID = 296,
|
||||||
BRACED_PREDICATE = 297,
|
CHAR = 297,
|
||||||
BRACKETED_ID = 298,
|
EPILOGUE = 298,
|
||||||
CHAR = 299,
|
EQUAL = 299,
|
||||||
EPILOGUE = 300,
|
ID = 300,
|
||||||
EQUAL = 301,
|
ID_COLON = 301,
|
||||||
ID = 302,
|
PERCENT_PERCENT = 302,
|
||||||
ID_COLON = 303,
|
PIPE = 303,
|
||||||
PERCENT_PERCENT = 304,
|
PROLOGUE = 304,
|
||||||
PIPE = 305,
|
SEMICOLON = 305,
|
||||||
PROLOGUE = 306,
|
TAG = 306,
|
||||||
SEMICOLON = 307,
|
TAG_ANY = 307,
|
||||||
GT = 308,
|
TAG_NONE = 308,
|
||||||
TAG = 309,
|
INT = 309,
|
||||||
TAG_ANY = 310,
|
PERCENT_PARAM = 310,
|
||||||
TAG_NONE = 311,
|
PERCENT_UNION = 311,
|
||||||
LBRACE = 312,
|
PERCENT_EMPTY = 312
|
||||||
RBRACE = 313,
|
|
||||||
INT = 314,
|
|
||||||
PERCENT_PARAM = 315,
|
|
||||||
PERCENT_UNION = 316,
|
|
||||||
PERCENT_EMPTY = 317
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -140,29 +135,27 @@ extern int gram_debug;
|
|||||||
typedef union GRAM_STYPE GRAM_STYPE;
|
typedef union GRAM_STYPE GRAM_STYPE;
|
||||||
union GRAM_STYPE
|
union GRAM_STYPE
|
||||||
{
|
{
|
||||||
#line 187 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 182 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
unsigned char character;
|
unsigned char character;
|
||||||
#line 191 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 186 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
char *code;
|
char *code;
|
||||||
#line 196 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 191 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
uniqstr uniqstr;
|
uniqstr uniqstr;
|
||||||
#line 204 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 199 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
int integer;
|
int integer;
|
||||||
#line 208 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 203 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
#line 213 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 208 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
assoc assoc;
|
assoc assoc;
|
||||||
#line 216 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 211 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
symbol_list *list;
|
symbol_list *list;
|
||||||
#line 219 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 214 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
#line 224 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 241 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
prec_rel_comparator prec_rel_comparator;
|
|
||||||
#line 253 "src/parse-gram.y" /* yacc.c:1909 */
|
|
||||||
param_type param;
|
param_type param;
|
||||||
#line 423 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 409 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
code_props_type code_type;
|
code_props_type code_type;
|
||||||
#line 725 "src/parse-gram.y" /* yacc.c:1909 */
|
#line 647 "src/parse-gram.y" /* yacc.c:1909 */
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@@ -170,7 +163,7 @@ code_props_type code_type;
|
|||||||
muscle_kind kind;
|
muscle_kind kind;
|
||||||
} value;
|
} value;
|
||||||
|
|
||||||
#line 174 "src/parse-gram.h" /* yacc.c:1909 */
|
#line 167 "src/parse-gram.h" /* yacc.c:1909 */
|
||||||
};
|
};
|
||||||
# define GRAM_STYPE_IS_TRIVIAL 1
|
# define GRAM_STYPE_IS_TRIVIAL 1
|
||||||
# define GRAM_STYPE_IS_DECLARED 1
|
# define GRAM_STYPE_IS_DECLARED 1
|
||||||
|
|||||||
@@ -130,8 +130,6 @@
|
|||||||
|
|
||||||
%token PERCENT_PREC "%prec"
|
%token PERCENT_PREC "%prec"
|
||||||
%token PERCENT_DPREC "%dprec"
|
%token PERCENT_DPREC "%dprec"
|
||||||
%token PERCENT_GPREC "%gprec"
|
|
||||||
%token PERCENT_PRECR "%precr"
|
|
||||||
%token PERCENT_MERGE "%merge"
|
%token PERCENT_MERGE "%merge"
|
||||||
|
|
||||||
/*----------------------.
|
/*----------------------.
|
||||||
@@ -177,12 +175,9 @@
|
|||||||
%token PIPE "|"
|
%token PIPE "|"
|
||||||
%token PROLOGUE "%{...%}"
|
%token PROLOGUE "%{...%}"
|
||||||
%token SEMICOLON ";"
|
%token SEMICOLON ";"
|
||||||
%token GT ">"
|
|
||||||
%token TAG "<tag>"
|
%token TAG "<tag>"
|
||||||
%token TAG_ANY "<*>"
|
%token TAG_ANY "<*>"
|
||||||
%token TAG_NONE "<>"
|
%token TAG_NONE "<>"
|
||||||
%token LBRACE "{"
|
|
||||||
%token RBRACE "}"
|
|
||||||
|
|
||||||
%union {unsigned char character;}
|
%union {unsigned char character;}
|
||||||
%type <character> CHAR
|
%type <character> CHAR
|
||||||
@@ -219,13 +214,6 @@
|
|||||||
%union {named_ref *named_ref;}
|
%union {named_ref *named_ref;}
|
||||||
%type <named_ref> named_ref.opt
|
%type <named_ref> named_ref.opt
|
||||||
|
|
||||||
%type <uniqstr> prec_group_name.opt string_or_id
|
|
||||||
|
|
||||||
%union {prec_rel_comparator prec_rel_comparator;}
|
|
||||||
%type <prec_rel_comparator> prec_rel_comparator
|
|
||||||
|
|
||||||
%type <list> precedence_relation_symbols precedence_symbol
|
|
||||||
|
|
||||||
/*---------.
|
/*---------.
|
||||||
| %param. |
|
| %param. |
|
||||||
`---------*/
|
`---------*/
|
||||||
@@ -377,8 +365,6 @@ params:
|
|||||||
|
|
||||||
grammar_declaration:
|
grammar_declaration:
|
||||||
precedence_declaration
|
precedence_declaration
|
||||||
| precedence_group_declaration
|
|
||||||
| precedence_relation_declaration
|
|
||||||
| symbol_declaration
|
| symbol_declaration
|
||||||
| "%start" symbol
|
| "%start" symbol
|
||||||
{
|
{
|
||||||
@@ -471,30 +457,6 @@ symbol_declaration:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/* A group of symbols for precedence declaration */
|
|
||||||
precedence_group_declaration:
|
|
||||||
"%gprec" prec_group_name.opt
|
|
||||||
{
|
|
||||||
set_current_group ($2, &@2);
|
|
||||||
}
|
|
||||||
"{" precedence_declarations "}"
|
|
||||||
{
|
|
||||||
set_current_group (DEFAULT_GROUP_NAME, NULL);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Name for the precedence group. If none is present a new unique one is
|
|
||||||
generated. */
|
|
||||||
prec_group_name.opt:
|
|
||||||
%empty { $$ = new_anonymous_group_name (); }
|
|
||||||
| variable /* Just a string, maybe there's a better way? */
|
|
||||||
;
|
|
||||||
|
|
||||||
precedence_declarations:
|
|
||||||
precedence_declaration
|
|
||||||
| precedence_declarations precedence_declaration
|
|
||||||
;
|
|
||||||
|
|
||||||
precedence_declaration:
|
precedence_declaration:
|
||||||
precedence_declarator tag.opt symbols.prec
|
precedence_declarator tag.opt symbols.prec
|
||||||
{
|
{
|
||||||
@@ -522,46 +484,6 @@ tag.opt:
|
|||||||
| TAG { current_type = $1; tag_seen = true; }
|
| TAG { current_type = $1; tag_seen = true; }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Declaration of a precedence relation between two (lists of) tokens */
|
|
||||||
precedence_relation_declaration:
|
|
||||||
"%precr" precedence_relation_symbols
|
|
||||||
{ prec_braces = default_braces_state; }
|
|
||||||
prec_rel_comparator
|
|
||||||
precedence_relation_symbols
|
|
||||||
{ declare_precedence_relation ($2, $5, $4, @4); }
|
|
||||||
;
|
|
||||||
|
|
||||||
precedence_relation_symbols:
|
|
||||||
precedence_symbol { $$ = $1; }
|
|
||||||
| precedence_relation_symbols precedence_symbol
|
|
||||||
{ $$ = symbol_list_append ($1, $2); }
|
|
||||||
;
|
|
||||||
|
|
||||||
precedence_symbol:
|
|
||||||
string_or_id
|
|
||||||
{
|
|
||||||
if (is_prec_group ($1))
|
|
||||||
$$ = expand_symbol_group (symgroup_from_uniqstr($1, &@1), @1);
|
|
||||||
else
|
|
||||||
$$ = symbol_list_sym_new (symbol_from_uniqstr ($1, @1), @1);
|
|
||||||
}
|
|
||||||
| CHAR
|
|
||||||
{
|
|
||||||
$$ = symbol_list_sym_new (symbol_from_uniqstr (uniqstr_new (char_name ($1)), @1), @1);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
string_or_id:
|
|
||||||
STRING { $$ = uniqstr_new (quotearg_style (c_quoting_style, $1)); }
|
|
||||||
| ID { $$ = $1; }
|
|
||||||
;
|
|
||||||
|
|
||||||
prec_rel_comparator:
|
|
||||||
">" { $$ = prec_superior; }
|
|
||||||
| "=" { $$ = prec_equal; }
|
|
||||||
| ">" ">" { $$ = prec_superior_strict; }
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Just like symbols.1 but accept INT for the sake of POSIX. */
|
/* Just like symbols.1 but accept INT for the sake of POSIX. */
|
||||||
symbols.prec:
|
symbols.prec:
|
||||||
symbol.prec
|
symbol.prec
|
||||||
|
|||||||
+4
-5
@@ -260,7 +260,7 @@ print_reductions (FILE *out, int level, state *s)
|
|||||||
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
|
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
|
||||||
for (i = 0; i < s->errs->num; ++i)
|
for (i = 0; i < s->errs->num; ++i)
|
||||||
if (s->errs->symbols[i])
|
if (s->errs->symbols[i])
|
||||||
bitset_set (no_reduce_set, s->errs->symbols[i]->content->number);
|
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
|
||||||
|
|
||||||
if (default_reduction)
|
if (default_reduction)
|
||||||
report = true;
|
report = true;
|
||||||
@@ -388,12 +388,11 @@ print_grammar (FILE *out, int level)
|
|||||||
/* Terminals */
|
/* Terminals */
|
||||||
xml_puts (out, level + 1, "<terminals>");
|
xml_puts (out, level + 1, "<terminals>");
|
||||||
for (i = 0; i < max_user_token_number + 1; i++)
|
for (i = 0; i < max_user_token_number + 1; i++)
|
||||||
if (token_translations[i] != undeftoken->content->number)
|
if (token_translations[i] != undeftoken->number)
|
||||||
{
|
{
|
||||||
char const *tag = symbols[token_translations[i]]->tag;
|
char const *tag = symbols[token_translations[i]]->tag;
|
||||||
int precedence = symbols[token_translations[i]]->content->prec;
|
int precedence = symbols[token_translations[i]]->prec;
|
||||||
assoc associativity = symbols[token_translations[i]]->content->prec_node
|
assoc associativity = symbols[token_translations[i]]->assoc;
|
||||||
->assoc;
|
|
||||||
xml_indent (out, level + 2);
|
xml_indent (out, level + 2);
|
||||||
fprintf (out,
|
fprintf (out,
|
||||||
"<terminal symbol-number=\"%d\" token-number=\"%d\""
|
"<terminal symbol-number=\"%d\" token-number=\"%d\""
|
||||||
|
|||||||
+4
-5
@@ -72,7 +72,7 @@ print_core (FILE *out, state *s)
|
|||||||
size_t i;
|
size_t i;
|
||||||
item_number *sitems = s->items;
|
item_number *sitems = s->items;
|
||||||
size_t snritems = s->nitems;
|
size_t snritems = s->nitems;
|
||||||
sym_content *previous_lhs = NULL;
|
symbol *previous_lhs = NULL;
|
||||||
|
|
||||||
/* Output all the items of a state, not only its kernel. */
|
/* Output all the items of a state, not only its kernel. */
|
||||||
if (report_flag & report_itemsets)
|
if (report_flag & report_itemsets)
|
||||||
@@ -223,8 +223,7 @@ print_reduction (FILE *out, size_t width,
|
|||||||
if (!enabled)
|
if (!enabled)
|
||||||
fputc ('[', out);
|
fputc ('[', out);
|
||||||
if (r->number)
|
if (r->number)
|
||||||
fprintf (out, _("reduce using rule %d (%s)"), r->number,
|
fprintf (out, _("reduce using rule %d (%s)"), r->number, r->lhs->tag);
|
||||||
r->lhs->symbol->tag);
|
|
||||||
else
|
else
|
||||||
fprintf (out, _("accept"));
|
fprintf (out, _("accept"));
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
@@ -258,7 +257,7 @@ print_reductions (FILE *out, state *s)
|
|||||||
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
|
bitset_set (no_reduce_set, TRANSITION_SYMBOL (trans, i));
|
||||||
for (i = 0; i < s->errs->num; ++i)
|
for (i = 0; i < s->errs->num; ++i)
|
||||||
if (s->errs->symbols[i])
|
if (s->errs->symbols[i])
|
||||||
bitset_set (no_reduce_set, s->errs->symbols[i]->content->number);
|
bitset_set (no_reduce_set, s->errs->symbols[i]->number);
|
||||||
|
|
||||||
/* Compute the width of the lookahead token column. */
|
/* Compute the width of the lookahead token column. */
|
||||||
if (default_reduction)
|
if (default_reduction)
|
||||||
@@ -409,7 +408,7 @@ print_grammar (FILE *out)
|
|||||||
/* TERMINAL (type #) : rule #s terminal is on RHS */
|
/* TERMINAL (type #) : rule #s terminal is on RHS */
|
||||||
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
|
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
|
||||||
for (i = 0; i < max_user_token_number + 1; i++)
|
for (i = 0; i < max_user_token_number + 1; i++)
|
||||||
if (token_translations[i] != undeftoken->content->number)
|
if (token_translations[i] != undeftoken->number)
|
||||||
{
|
{
|
||||||
const char *tag = symbols[token_translations[i]]->tag;
|
const char *tag = symbols[token_translations[i]]->tag;
|
||||||
rule_number r;
|
rule_number r;
|
||||||
|
|||||||
+4
-5
@@ -46,7 +46,7 @@ static void
|
|||||||
print_core (struct obstack *oout, state *s)
|
print_core (struct obstack *oout, state *s)
|
||||||
{
|
{
|
||||||
item_number const *sitems = s->items;
|
item_number const *sitems = s->items;
|
||||||
sym_content *previous_lhs = NULL;
|
symbol *previous_lhs = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t snritems = s->nitems;
|
size_t snritems = s->nitems;
|
||||||
|
|
||||||
@@ -72,12 +72,11 @@ print_core (struct obstack *oout, state *s)
|
|||||||
r = &rules[item_number_as_rule_number (*sp)];
|
r = &rules[item_number_as_rule_number (*sp)];
|
||||||
|
|
||||||
obstack_printf (oout, "%3d ", r->number);
|
obstack_printf (oout, "%3d ", r->number);
|
||||||
if (previous_lhs && UNIQSTR_EQ (previous_lhs->symbol->tag,
|
if (previous_lhs && UNIQSTR_EQ (previous_lhs->tag, r->lhs->tag))
|
||||||
r->lhs->symbol->tag))
|
|
||||||
obstack_printf (oout, "%*s| ",
|
obstack_printf (oout, "%*s| ",
|
||||||
(int) strlen (previous_lhs->symbol->tag), "");
|
(int) strlen (previous_lhs->tag), "");
|
||||||
else
|
else
|
||||||
obstack_printf (oout, "%s: ", escape (r->lhs->symbol->tag));
|
obstack_printf (oout, "%s: ", escape (r->lhs->tag));
|
||||||
previous_lhs = r->lhs;
|
previous_lhs = r->lhs;
|
||||||
|
|
||||||
for (sp = r->rhs; sp < sp1; sp++)
|
for (sp = r->rhs; sp < sp1; sp++)
|
||||||
|
|||||||
+26
-27
@@ -240,13 +240,13 @@ grammar_current_rule_begin (symbol *lhs, location loc,
|
|||||||
current_rule = grammar_end;
|
current_rule = grammar_end;
|
||||||
|
|
||||||
/* Mark the rule's lhs as a nonterminal if not already so. */
|
/* Mark the rule's lhs as a nonterminal if not already so. */
|
||||||
if (lhs->content->class == unknown_sym)
|
if (lhs->class == unknown_sym)
|
||||||
{
|
{
|
||||||
lhs->content->class = nterm_sym;
|
lhs->class = nterm_sym;
|
||||||
lhs->content->number = nvars;
|
lhs->number = nvars;
|
||||||
++nvars;
|
++nvars;
|
||||||
}
|
}
|
||||||
else if (lhs->content->class == token_sym)
|
else if (lhs->class == token_sym)
|
||||||
complain (&loc, complaint, _("rule given for %s, which is a token"),
|
complain (&loc, complaint, _("rule given for %s, which is a token"),
|
||||||
lhs->tag);
|
lhs->tag);
|
||||||
}
|
}
|
||||||
@@ -292,15 +292,15 @@ grammar_rule_check (const symbol_list *r)
|
|||||||
|
|
||||||
Don't worry about the default action if $$ is untyped, since $$'s
|
Don't worry about the default action if $$ is untyped, since $$'s
|
||||||
value can't be used. */
|
value can't be used. */
|
||||||
if (!r->action_props.code && r->content.sym->content->type_name)
|
if (!r->action_props.code && r->content.sym->type_name)
|
||||||
{
|
{
|
||||||
symbol *first_rhs = r->next->content.sym;
|
symbol *first_rhs = r->next->content.sym;
|
||||||
/* If $$ is being set in default way, report if any type mismatch. */
|
/* If $$ is being set in default way, report if any type mismatch. */
|
||||||
if (first_rhs)
|
if (first_rhs)
|
||||||
{
|
{
|
||||||
char const *lhs_type = r->content.sym->content->type_name;
|
char const *lhs_type = r->content.sym->type_name;
|
||||||
const char *rhs_type =
|
const char *rhs_type =
|
||||||
first_rhs->content->type_name ? first_rhs->content->type_name : "";
|
first_rhs->type_name ? first_rhs->type_name : "";
|
||||||
if (!UNIQSTR_EQ (lhs_type, rhs_type))
|
if (!UNIQSTR_EQ (lhs_type, rhs_type))
|
||||||
complain (&r->location, Wother,
|
complain (&r->location, Wother,
|
||||||
_("type clash on default action: <%s> != <%s>"),
|
_("type clash on default action: <%s> != <%s>"),
|
||||||
@@ -350,8 +350,7 @@ grammar_rule_check (const symbol_list *r)
|
|||||||
it for char literals and strings, which are always tokens. */
|
it for char literals and strings, which are always tokens. */
|
||||||
if (r->ruleprec
|
if (r->ruleprec
|
||||||
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
|
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
|
||||||
&& r->ruleprec->content->status != declared
|
&& r->ruleprec->status != declared && !r->ruleprec->prec)
|
||||||
&& !r->ruleprec->content->prec)
|
|
||||||
complain (&r->location, Wother,
|
complain (&r->location, Wother,
|
||||||
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
|
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
|
||||||
}
|
}
|
||||||
@@ -518,8 +517,8 @@ grammar_current_rule_symbol_append (symbol *sym, location loc,
|
|||||||
p = grammar_symbol_append (sym, loc);
|
p = grammar_symbol_append (sym, loc);
|
||||||
if (name)
|
if (name)
|
||||||
assign_named_ref (p, name);
|
assign_named_ref (p, name);
|
||||||
if (sym->content->status == undeclared || sym->content->status == used)
|
if (sym->status == undeclared || sym->status == used)
|
||||||
sym->content->status = needed;
|
sym->status = needed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach an ACTION to the current rule. */
|
/* Attach an ACTION to the current rule. */
|
||||||
@@ -559,11 +558,11 @@ packgram (void)
|
|||||||
for (p = grammar; p; p = p->next)
|
for (p = grammar; p; p = p->next)
|
||||||
{
|
{
|
||||||
symbol *ruleprec = p->ruleprec;
|
symbol *ruleprec = p->ruleprec;
|
||||||
record_merge_function_type (p->merger, p->content.sym->content->type_name,
|
record_merge_function_type (p->merger, p->content.sym->type_name,
|
||||||
p->merger_declaration_location);
|
p->merger_declaration_location);
|
||||||
rules[ruleno].user_number = ruleno;
|
rules[ruleno].user_number = ruleno;
|
||||||
rules[ruleno].number = ruleno;
|
rules[ruleno].number = ruleno;
|
||||||
rules[ruleno].lhs = p->content.sym->content;
|
rules[ruleno].lhs = p->content.sym;
|
||||||
rules[ruleno].rhs = ritem + itemno;
|
rules[ruleno].rhs = ritem + itemno;
|
||||||
rules[ruleno].prec = NULL;
|
rules[ruleno].prec = NULL;
|
||||||
rules[ruleno].dprec = p->dprec;
|
rules[ruleno].dprec = p->dprec;
|
||||||
@@ -605,11 +604,11 @@ packgram (void)
|
|||||||
/* item_number = symbol_number.
|
/* item_number = symbol_number.
|
||||||
But the former needs to contain more: negative rule numbers. */
|
But the former needs to contain more: negative rule numbers. */
|
||||||
ritem[itemno++] =
|
ritem[itemno++] =
|
||||||
symbol_number_as_item_number (p->content.sym->content->number);
|
symbol_number_as_item_number (p->content.sym->number);
|
||||||
/* A rule gets by default the precedence and associativity
|
/* A rule gets by default the precedence and associativity
|
||||||
of its last token. */
|
of its last token. */
|
||||||
if (p->content.sym->content->class == token_sym && default_prec)
|
if (p->content.sym->class == token_sym && default_prec)
|
||||||
rules[ruleno].prec = p->content.sym->content;
|
rules[ruleno].prec = p->content.sym;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,8 +616,8 @@ packgram (void)
|
|||||||
the specified symbol's precedence replaces the default. */
|
the specified symbol's precedence replaces the default. */
|
||||||
if (ruleprec)
|
if (ruleprec)
|
||||||
{
|
{
|
||||||
rules[ruleno].precsym = ruleprec->content;
|
rules[ruleno].precsym = ruleprec;
|
||||||
rules[ruleno].prec = ruleprec->content;
|
rules[ruleno].prec = ruleprec;
|
||||||
}
|
}
|
||||||
/* An item ends by the rule number (negated). */
|
/* An item ends by the rule number (negated). */
|
||||||
ritem[itemno++] = rule_number_as_item_number (ruleno);
|
ritem[itemno++] = rule_number_as_item_number (ruleno);
|
||||||
@@ -648,19 +647,19 @@ reader (void)
|
|||||||
|
|
||||||
/* Construct the accept symbol. */
|
/* Construct the accept symbol. */
|
||||||
accept = symbol_get ("$accept", empty_location);
|
accept = symbol_get ("$accept", empty_location);
|
||||||
accept->content->class = nterm_sym;
|
accept->class = nterm_sym;
|
||||||
accept->content->number = nvars++;
|
accept->number = nvars++;
|
||||||
|
|
||||||
/* Construct the error token */
|
/* Construct the error token */
|
||||||
errtoken = symbol_get ("error", empty_location);
|
errtoken = symbol_get ("error", empty_location);
|
||||||
errtoken->content->class = token_sym;
|
errtoken->class = token_sym;
|
||||||
errtoken->content->number = ntokens++;
|
errtoken->number = ntokens++;
|
||||||
|
|
||||||
/* Construct a token that represents all undefined literal tokens.
|
/* Construct a token that represents all undefined literal tokens.
|
||||||
It is always token number 2. */
|
It is always token number 2. */
|
||||||
undeftoken = symbol_get ("$undefined", empty_location);
|
undeftoken = symbol_get ("$undefined", empty_location);
|
||||||
undeftoken->content->class = token_sym;
|
undeftoken->class = token_sym;
|
||||||
undeftoken->content->number = ntokens++;
|
undeftoken->number = ntokens++;
|
||||||
|
|
||||||
gram_in = xfopen (grammar_file, "r");
|
gram_in = xfopen (grammar_file, "r");
|
||||||
|
|
||||||
@@ -722,10 +721,10 @@ check_and_convert_grammar (void)
|
|||||||
if (!endtoken)
|
if (!endtoken)
|
||||||
{
|
{
|
||||||
endtoken = symbol_get ("$end", empty_location);
|
endtoken = symbol_get ("$end", empty_location);
|
||||||
endtoken->content->class = token_sym;
|
endtoken->class = token_sym;
|
||||||
endtoken->content->number = 0;
|
endtoken->number = 0;
|
||||||
/* Value specified by POSIX. */
|
/* Value specified by POSIX. */
|
||||||
endtoken->content->user_token_number = 0;
|
endtoken->user_token_number = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Report any undefined symbols and consider them nonterminals. */
|
/* Report any undefined symbols and consider them nonterminals. */
|
||||||
|
|||||||
+9
-9
@@ -163,9 +163,9 @@ inaccessable_symbols (void)
|
|||||||
Pp = bitset_create (nrules, BITSET_FIXED);
|
Pp = bitset_create (nrules, BITSET_FIXED);
|
||||||
|
|
||||||
/* If the start symbol isn't useful, then nothing will be useful. */
|
/* If the start symbol isn't useful, then nothing will be useful. */
|
||||||
if (bitset_test (N, accept->content->number - ntokens))
|
if (bitset_test (N, accept->number - ntokens))
|
||||||
{
|
{
|
||||||
bitset_set (V, accept->content->number);
|
bitset_set (V, accept->number);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -196,9 +196,9 @@ inaccessable_symbols (void)
|
|||||||
V = Vp;
|
V = Vp;
|
||||||
|
|
||||||
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
|
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
|
||||||
bitset_set (V, endtoken->content->number); /* end-of-input token */
|
bitset_set (V, endtoken->number); /* end-of-input token */
|
||||||
bitset_set (V, errtoken->content->number); /* error token */
|
bitset_set (V, errtoken->number); /* error token */
|
||||||
bitset_set (V, undeftoken->content->number); /* some undefined token */
|
bitset_set (V, undeftoken->number); /* some undefined token */
|
||||||
|
|
||||||
bitset_free (P);
|
bitset_free (P);
|
||||||
P = Pp;
|
P = Pp;
|
||||||
@@ -298,7 +298,7 @@ nonterminals_reduce (void)
|
|||||||
if (!bitset_test (V, i))
|
if (!bitset_test (V, i))
|
||||||
{
|
{
|
||||||
nontermmap[i - ntokens] = n++;
|
nontermmap[i - ntokens] = n++;
|
||||||
if (symbols[i]->content->status != used)
|
if (symbols[i]->status != used)
|
||||||
complain (&symbols[i]->location, Wother,
|
complain (&symbols[i]->location, Wother,
|
||||||
_("nonterminal useless in grammar: %s"),
|
_("nonterminal useless in grammar: %s"),
|
||||||
symbols[i]->tag);
|
symbols[i]->tag);
|
||||||
@@ -310,7 +310,7 @@ nonterminals_reduce (void)
|
|||||||
symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted);
|
symbol **symbols_sorted = xnmalloc (nvars, sizeof *symbols_sorted);
|
||||||
|
|
||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
symbols[i]->content->number = nontermmap[i - ntokens];
|
symbols[i]->number = nontermmap[i - ntokens];
|
||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
symbols_sorted[nontermmap[i - ntokens] - ntokens] = symbols[i];
|
symbols_sorted[nontermmap[i - ntokens] - ntokens] = symbols[i];
|
||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
@@ -328,7 +328,7 @@ nonterminals_reduce (void)
|
|||||||
*rhsp = symbol_number_as_item_number (nontermmap[*rhsp
|
*rhsp = symbol_number_as_item_number (nontermmap[*rhsp
|
||||||
- ntokens]);
|
- ntokens]);
|
||||||
}
|
}
|
||||||
accept->content->number = nontermmap[accept->content->number - ntokens];
|
accept->number = nontermmap[accept->number - ntokens];
|
||||||
}
|
}
|
||||||
|
|
||||||
nsyms -= nuseless_nonterminals;
|
nsyms -= nuseless_nonterminals;
|
||||||
@@ -415,7 +415,7 @@ reduce_grammar (void)
|
|||||||
|
|
||||||
reduce_print ();
|
reduce_print ();
|
||||||
|
|
||||||
if (!bitset_test (N, accept->content->number - ntokens))
|
if (!bitset_test (N, accept->number - ntokens))
|
||||||
complain (&startsymbol_location, fatal,
|
complain (&startsymbol_location, fatal,
|
||||||
_("start symbol %s does not derive any sentence"),
|
_("start symbol %s does not derive any sentence"),
|
||||||
startsymbol->tag);
|
startsymbol->tag);
|
||||||
|
|||||||
+13
-5
@@ -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
|
||||||
|
|||||||
+1
-18
@@ -223,10 +223,6 @@ eqopt ([[:space:]]*=)?
|
|||||||
"%fixed-output-files" return PERCENT_YACC;
|
"%fixed-output-files" return PERCENT_YACC;
|
||||||
"%initial-action" return PERCENT_INITIAL_ACTION;
|
"%initial-action" return PERCENT_INITIAL_ACTION;
|
||||||
"%glr-parser" return PERCENT_GLR_PARSER;
|
"%glr-parser" return PERCENT_GLR_PARSER;
|
||||||
"%gprec" {
|
|
||||||
prec_braces = gprec_seen;
|
|
||||||
return PERCENT_GPREC;
|
|
||||||
}
|
|
||||||
"%language" return PERCENT_LANGUAGE;
|
"%language" return PERCENT_LANGUAGE;
|
||||||
"%left" return PERCENT_LEFT;
|
"%left" return PERCENT_LEFT;
|
||||||
"%lex-param" RETURN_PERCENT_PARAM(lex);
|
"%lex-param" RETURN_PERCENT_PARAM(lex);
|
||||||
@@ -243,7 +239,6 @@ eqopt ([[:space:]]*=)?
|
|||||||
"%parse-param" RETURN_PERCENT_PARAM(parse);
|
"%parse-param" RETURN_PERCENT_PARAM(parse);
|
||||||
"%prec" return PERCENT_PREC;
|
"%prec" return PERCENT_PREC;
|
||||||
"%precedence" return PERCENT_PRECEDENCE;
|
"%precedence" return PERCENT_PRECEDENCE;
|
||||||
"%precr" return PERCENT_PRECR;
|
|
||||||
"%printer" return PERCENT_PRINTER;
|
"%printer" return PERCENT_PRINTER;
|
||||||
"%pure-parser" RETURN_PERCENT_FLAG("api.pure");
|
"%pure-parser" RETURN_PERCENT_FLAG("api.pure");
|
||||||
"%require" return PERCENT_REQUIRE;
|
"%require" return PERCENT_REQUIRE;
|
||||||
@@ -271,24 +266,17 @@ 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
"=" return EQUAL;
|
"=" return EQUAL;
|
||||||
"|" return PIPE;
|
"|" return PIPE;
|
||||||
";" return SEMICOLON;
|
";" return SEMICOLON;
|
||||||
"}" return RBRACE;
|
|
||||||
">" return GT;
|
|
||||||
|
|
||||||
{id} {
|
{id} {
|
||||||
val->uniqstr = uniqstr_new (yytext);
|
val->uniqstr = uniqstr_new (yytext);
|
||||||
id_loc = *loc;
|
id_loc = *loc;
|
||||||
if (prec_braces == gprec_seen)
|
|
||||||
{
|
|
||||||
prec_braces = group_name_seen;
|
|
||||||
return ID;
|
|
||||||
}
|
|
||||||
bracketed_id_str = NULL;
|
bracketed_id_str = NULL;
|
||||||
BEGIN SC_AFTER_IDENTIFIER;
|
BEGIN SC_AFTER_IDENTIFIER;
|
||||||
}
|
}
|
||||||
@@ -319,11 +307,6 @@ eqopt ([[:space:]]*=)?
|
|||||||
|
|
||||||
/* Code in between braces. */
|
/* Code in between braces. */
|
||||||
"{" {
|
"{" {
|
||||||
if (prec_braces == gprec_seen || prec_braces == group_name_seen)
|
|
||||||
{
|
|
||||||
prec_braces = braces_seen;
|
|
||||||
return LBRACE;
|
|
||||||
}
|
|
||||||
STRING_GROW;
|
STRING_GROW;
|
||||||
nesting = 0;
|
nesting = 0;
|
||||||
code_start = loc->start;
|
code_start = loc->start;
|
||||||
|
|||||||
+1
-1
@@ -135,7 +135,7 @@ typedef struct
|
|||||||
/* Is the TRANSITIONS->states[Num] labelled by the error token? */
|
/* Is the TRANSITIONS->states[Num] labelled by the error token? */
|
||||||
|
|
||||||
# define TRANSITION_IS_ERROR(Transitions, Num) \
|
# define TRANSITION_IS_ERROR(Transitions, Num) \
|
||||||
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->content->number)
|
(TRANSITION_SYMBOL (Transitions, Num) == errtoken->number)
|
||||||
|
|
||||||
/* When resolving a SR conflicts, if the reduction wins, the shift is
|
/* When resolving a SR conflicts, if the reduction wins, the shift is
|
||||||
disabled. */
|
disabled. */
|
||||||
|
|||||||
+3
-3
@@ -205,7 +205,7 @@ symbol_list_n_type_name_get (symbol_list *l, location loc, int n)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
aver (l->content_type == SYMLIST_SYMBOL);
|
aver (l->content_type == SYMLIST_SYMBOL);
|
||||||
return l->content.sym->content->type_name;
|
return l->content.sym->type_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@@ -223,8 +223,8 @@ symbol_list_code_props_set (symbol_list *node, code_props_type kind,
|
|||||||
{
|
{
|
||||||
case SYMLIST_SYMBOL:
|
case SYMLIST_SYMBOL:
|
||||||
symbol_code_props_set (node->content.sym, kind, cprops);
|
symbol_code_props_set (node->content.sym, kind, cprops);
|
||||||
if (node->content.sym->content->status == undeclared)
|
if (node->content.sym->status == undeclared)
|
||||||
node->content.sym->content->status = used;
|
node->content.sym->status = used;
|
||||||
break;
|
break;
|
||||||
case SYMLIST_TYPE:
|
case SYMLIST_TYPE:
|
||||||
semantic_type_code_props_set
|
semantic_type_code_props_set
|
||||||
|
|||||||
+157
-607
File diff suppressed because it is too large
Load Diff
+8
-114
@@ -31,8 +31,6 @@
|
|||||||
# include "scan-code.h"
|
# include "scan-code.h"
|
||||||
# include "uniqstr.h"
|
# include "uniqstr.h"
|
||||||
|
|
||||||
typedef struct symbol_list symbol_list;
|
|
||||||
|
|
||||||
/*----------.
|
/*----------.
|
||||||
| Symbols. |
|
| Symbols. |
|
||||||
`----------*/
|
`----------*/
|
||||||
@@ -52,7 +50,6 @@ typedef int symbol_number;
|
|||||||
|
|
||||||
|
|
||||||
typedef struct symbol symbol;
|
typedef struct symbol symbol;
|
||||||
typedef struct sym_content sym_content;
|
|
||||||
|
|
||||||
/* Declaration status of a symbol.
|
/* Declaration status of a symbol.
|
||||||
|
|
||||||
@@ -64,8 +61,6 @@ typedef struct sym_content sym_content;
|
|||||||
When status are checked at the end, "declared" symbols are fine,
|
When status are checked at the end, "declared" symbols are fine,
|
||||||
"used" symbols trigger warnings, otherwise it's an error. */
|
"used" symbols trigger warnings, otherwise it's an error. */
|
||||||
|
|
||||||
typedef struct prec_node prec_node;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
/** Used in the input file for an unknown reason (error). */
|
/** Used in the input file for an unknown reason (error). */
|
||||||
@@ -87,6 +82,8 @@ enum code_props_type
|
|||||||
|
|
||||||
enum { CODE_PROPS_SIZE = 2 };
|
enum { CODE_PROPS_SIZE = 2 };
|
||||||
|
|
||||||
|
/* When extending this structure, be sure to complete
|
||||||
|
symbol_check_alias_consistency. */
|
||||||
struct symbol
|
struct symbol
|
||||||
{
|
{
|
||||||
/** The key, name of the symbol. */
|
/** The key, name of the symbol. */
|
||||||
@@ -94,20 +91,6 @@ struct symbol
|
|||||||
/** The location of its first occurrence. */
|
/** The location of its first occurrence. */
|
||||||
location location;
|
location location;
|
||||||
|
|
||||||
/* Points to the other in the symbol-string pair for an alias. */
|
|
||||||
symbol *alias;
|
|
||||||
|
|
||||||
/** Whether this symbol is the alias of another or not. */
|
|
||||||
bool is_alias;
|
|
||||||
|
|
||||||
/** All the info about the pointed symbol is there. */
|
|
||||||
sym_content *content;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sym_content
|
|
||||||
{
|
|
||||||
symbol *symbol;
|
|
||||||
|
|
||||||
/** Its \c \%type.
|
/** Its \c \%type.
|
||||||
|
|
||||||
Beware that this is the type_name as was entered by the user,
|
Beware that this is the type_name as was entered by the user,
|
||||||
@@ -129,21 +112,17 @@ struct sym_content
|
|||||||
code_props props[CODE_PROPS_SIZE];
|
code_props props[CODE_PROPS_SIZE];
|
||||||
|
|
||||||
symbol_number number;
|
symbol_number number;
|
||||||
|
location prec_location;
|
||||||
/* Not used anymore, to remove. */
|
|
||||||
int prec;
|
int prec;
|
||||||
|
assoc assoc;
|
||||||
int user_token_number;
|
int user_token_number;
|
||||||
|
|
||||||
|
/* Points to the other in the symbol-string pair for an alias.
|
||||||
|
Special value USER_NUMBER_HAS_STRING_ALIAS in the symbol half of the
|
||||||
|
symbol-string pair for an alias. */
|
||||||
|
symbol *alias;
|
||||||
symbol_class class;
|
symbol_class class;
|
||||||
status status;
|
status status;
|
||||||
|
|
||||||
/* The next element in the symbol precedence group. */
|
|
||||||
sym_content *group_next;
|
|
||||||
|
|
||||||
/* The graph node containing all the precedence information for this
|
|
||||||
symbol. */
|
|
||||||
prec_node *prec_node;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Undefined user number. */
|
/** Undefined user number. */
|
||||||
@@ -298,91 +277,6 @@ void print_precedence_warnings (void);
|
|||||||
|
|
||||||
void register_assoc (graphid i, graphid j);
|
void register_assoc (graphid i, graphid j);
|
||||||
|
|
||||||
|
|
||||||
/*------------------.
|
|
||||||
| Groups of symbols |
|
|
||||||
`------------------*/
|
|
||||||
|
|
||||||
#define DEFAULT_GROUP_NAME uniqstr_new ("__default__")
|
|
||||||
|
|
||||||
typedef struct symgroup symgroup;
|
|
||||||
|
|
||||||
struct symgroup
|
|
||||||
{
|
|
||||||
/** The name of the group. */
|
|
||||||
uniqstr tag;
|
|
||||||
|
|
||||||
/** The list of symbols in the group. */
|
|
||||||
sym_content * symbol_list;
|
|
||||||
|
|
||||||
location location;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
/** Get a dummy name for an anonymous group. */
|
|
||||||
uniqstr new_anonymous_group_name (void);
|
|
||||||
|
|
||||||
/** Set the current group in the token precedence declaration to a new group
|
|
||||||
* with this name */
|
|
||||||
void set_current_group (const uniqstr name, location *loc);
|
|
||||||
|
|
||||||
/** Get or create the group by that name. The location information is used for
|
|
||||||
* creation when available. */
|
|
||||||
symgroup *
|
|
||||||
symgroup_from_uniqstr (const uniqstr key, location *loc);
|
|
||||||
|
|
||||||
/** Check if there is a symbol precedence group by that name. */
|
|
||||||
bool
|
|
||||||
is_prec_group (const uniqstr key);
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------.
|
|
||||||
| Graph of precedence relationships |
|
|
||||||
`----------------------------------*/
|
|
||||||
|
|
||||||
typedef struct prec_link prec_link;
|
|
||||||
|
|
||||||
struct prec_link
|
|
||||||
{
|
|
||||||
prec_node *target;
|
|
||||||
bool transitive;
|
|
||||||
prec_link *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct prec_node
|
|
||||||
{
|
|
||||||
symbol *symbol;
|
|
||||||
/** Associativity for the symbol. */
|
|
||||||
assoc assoc;
|
|
||||||
location prec_location;
|
|
||||||
prec_link *sons;
|
|
||||||
prec_link *equals;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum prec_rel_comparator prec_rel_comparator;
|
|
||||||
|
|
||||||
enum prec_rel_comparator
|
|
||||||
{
|
|
||||||
prec_equal,
|
|
||||||
prec_superior,
|
|
||||||
prec_superior_strict,
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Declare a precedence relationship between the symbols of the two lists,
|
|
||||||
* as defined by the operator. */
|
|
||||||
void
|
|
||||||
declare_precedence_relation (symbol_list *l1, symbol_list *l2,
|
|
||||||
prec_rel_comparator c, location loc);
|
|
||||||
/** Return the list of symbols contained in the group. */
|
|
||||||
symbol_list *
|
|
||||||
expand_symbol_group (symgroup * group, location loc);
|
|
||||||
|
|
||||||
/** Check if s1 and s2 have the same precedence level. */
|
|
||||||
bool is_prec_equal (prec_node * s1, prec_node * s2);
|
|
||||||
|
|
||||||
/** Check if from > to . */
|
|
||||||
bool is_prec_superior (prec_node * from, prec_node * to);
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------.
|
/*-----------------.
|
||||||
| Semantic types. |
|
| Semantic types. |
|
||||||
`-----------------*/
|
`-----------------*/
|
||||||
|
|||||||
+2
-2
@@ -290,7 +290,7 @@ action_row (state *s)
|
|||||||
|
|
||||||
/* Do not use any default reduction if there is a shift for
|
/* Do not use any default reduction if there is a shift for
|
||||||
error */
|
error */
|
||||||
if (sym == errtoken->content->number)
|
if (sym == errtoken->number)
|
||||||
nodefault = true;
|
nodefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ action_row (state *s)
|
|||||||
for (i = 0; i < errp->num; i++)
|
for (i = 0; i < errp->num; i++)
|
||||||
{
|
{
|
||||||
symbol *sym = errp->symbols[i];
|
symbol *sym = errp->symbols[i];
|
||||||
actrow[sym->content->number] = ACTION_NUMBER_MINIMUM;
|
actrow[sym->number] = ACTION_NUMBER_MINIMUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn off default reductions where requested by the user. See
|
/* Turn off default reductions where requested by the user. See
|
||||||
|
|||||||
+2
-1
@@ -77,7 +77,8 @@ uniqstr_vsprintf (char const *format, ...)
|
|||||||
void
|
void
|
||||||
uniqstr_assert (char const *str)
|
uniqstr_assert (char const *str)
|
||||||
{
|
{
|
||||||
if (!hash_lookup (uniqstrs_table, str))
|
uniqstr s = hash_lookup (uniqstrs_table, str);
|
||||||
|
if (!s || s != str)
|
||||||
{
|
{
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
"not a uniqstr: %s", quotearg (str));
|
"not a uniqstr: %s", quotearg (str));
|
||||||
|
|||||||
+3
-1
@@ -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)))
|
||||||
|
|||||||
+1
-1
@@ -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[
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -72,13 +72,12 @@ int main ()
|
|||||||
std::cout << "Works" << std::endl;
|
std::cout << "Works" << std::endl;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
ls
|
|
||||||
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
|
$CXX $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS -o conftest conftest.cc
|
||||||
case $? in
|
case $? in
|
||||||
0);;
|
0);;
|
||||||
*) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
|
*) BISON_CXX_WORKS="as_fn_error 77 cannot-compile-simple-program";;
|
||||||
esac
|
esac
|
||||||
rm -f conftest*
|
rm -fr conftest*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Whether the compiler supports POSIXLY_CORRECT defined.
|
# Whether the compiler supports POSIXLY_CORRECT defined.
|
||||||
|
|||||||
+16
-14
@@ -174,11 +174,10 @@ AT_CLEANUP
|
|||||||
m4_pushdef([AT_TEST],
|
m4_pushdef([AT_TEST],
|
||||||
[AT_SETUP([Variants $1])
|
[AT_SETUP([Variants $1])
|
||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" %debug $1])
|
AT_BISON_OPTION_PUSHDEFS([%debug $1])
|
||||||
# Store strings and integers in a list of strings.
|
# Store strings and integers in a list of strings.
|
||||||
AT_DATA_GRAMMAR([list.y],
|
AT_DATA_GRAMMAR([list.y],
|
||||||
[[%debug
|
[[%debug
|
||||||
%skeleton "lalr1.cc"
|
|
||||||
%define api.value.type variant
|
%define api.value.type variant
|
||||||
]m4_bpatsubst([$1], [\\n], [
|
]m4_bpatsubst([$1], [\\n], [
|
||||||
])[
|
])[
|
||||||
@@ -320,13 +319,13 @@ AT_BISON_OPTION_POPDEFS
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_TEST([])
|
AT_TEST([[%skeleton "lalr1.cc" ]])
|
||||||
AT_TEST([%define parse.assert])
|
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert]])
|
||||||
AT_TEST([%locations %define parse.assert])
|
AT_TEST([[%skeleton "lalr1.cc" %locations %define parse.assert]])
|
||||||
AT_TEST([[%define parse.assert %code {\n#define TWO_STAGE_BUILD\n}]])
|
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %code {\n#define TWO_STAGE_BUILD\n}]])
|
||||||
AT_TEST([[%define parse.assert %define api.token.constructor]])
|
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %define api.token.constructor]])
|
||||||
AT_TEST([[%define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
AT_TEST([[%skeleton "lalr1.cc" %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
||||||
AT_TEST([[%locations %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
AT_TEST([[%skeleton "lalr1.cc" %locations %define parse.assert %define api.token.constructor %define api.token.prefix {TOK_}]])
|
||||||
|
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
@@ -656,6 +655,8 @@ AT_CLEANUP
|
|||||||
m4_pushdef([AT_TEST],
|
m4_pushdef([AT_TEST],
|
||||||
[AT_SETUP([[Exception safety $1]])
|
[AT_SETUP([[Exception safety $1]])
|
||||||
|
|
||||||
|
AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR
|
||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" $1])
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" $1])
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[input.yy]],
|
AT_DATA_GRAMMAR([[input.yy]],
|
||||||
@@ -795,11 +796,11 @@ item:
|
|||||||
// 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; }
|
| error { ]AT_VARIANT_IF([], [$][$ = YY_NULLPTR; ])[yyerrok; }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -819,7 +820,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;
|
||||||
@@ -866,7 +868,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,152 +17,6 @@
|
|||||||
|
|
||||||
AT_BANNER([[Conflicts.]])
|
AT_BANNER([[Conflicts.]])
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Precedence groups ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
# Sample use case of precedence groups and relations, working.
|
|
||||||
|
|
||||||
AT_SETUP([Precedence groups])
|
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[input.y]],
|
|
||||||
[[%token CARET "^"
|
|
||||||
%token NUM BOOL '^' OR AND
|
|
||||||
|
|
||||||
%left '+' '-'
|
|
||||||
%gprec {
|
|
||||||
%right CARET
|
|
||||||
}
|
|
||||||
%gprec boolean {
|
|
||||||
%left OR
|
|
||||||
%left AND
|
|
||||||
}
|
|
||||||
%left '*' '/'
|
|
||||||
|
|
||||||
%precr boolean >> "^"
|
|
||||||
%precr CARET > '*' '/' '-' '+'
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
stmt:
|
|
||||||
exp
|
|
||||||
| bool_exp
|
|
||||||
|
|
||||||
exp:
|
|
||||||
NUM
|
|
||||||
| exp '+' exp
|
|
||||||
| exp '-' exp
|
|
||||||
| exp '*' exp
|
|
||||||
| exp '/' exp
|
|
||||||
| exp "^" exp
|
|
||||||
|
|
||||||
bool_exp:
|
|
||||||
BOOL
|
|
||||||
| bool_exp AND bool_exp
|
|
||||||
| bool_exp OR bool_exp
|
|
||||||
| bool_exp CARET bool_exp
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
## -------------------------------- ##
|
|
||||||
## Conflicting precedence relations ##
|
|
||||||
## -------------------------------- ##
|
|
||||||
|
|
||||||
AT_SETUP([Conflicting precedence relations])
|
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[input.y]],
|
|
||||||
[[%token TOKEN
|
|
||||||
%precedence A
|
|
||||||
%precedence B
|
|
||||||
%precedence C
|
|
||||||
%precedence D E
|
|
||||||
|
|
||||||
%gprec group {
|
|
||||||
%precedence F
|
|
||||||
%precedence G
|
|
||||||
}
|
|
||||||
|
|
||||||
%precr B = C
|
|
||||||
%precr A > B
|
|
||||||
%precr C > B
|
|
||||||
%precr F > G
|
|
||||||
%precr F > A
|
|
||||||
%%
|
|
||||||
exp:
|
|
||||||
TOKEN
|
|
||||||
| exp A exp
|
|
||||||
| exp B exp
|
|
||||||
| exp C exp
|
|
||||||
| exp D exp
|
|
||||||
| exp E exp
|
|
||||||
| exp F exp
|
|
||||||
| exp G exp
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_BISON_CHECK([[-Wall -o input.c input.y]], 0, [],
|
|
||||||
[[input.y:20.10: warning: contradicting declaration: B = C is in conflict with the previous declaration: B > C [-Wprecedence]
|
|
||||||
input.y:21.10: warning: contradicting declaration: A > B is in conflict with the previous declaration: A < B [-Wprecedence]
|
|
||||||
input.y:22.10: warning: contradicting declaration: C > B is in conflict with the previous declaration: C = B [-Wprecedence]
|
|
||||||
input.y:23.10: warning: contradicting declaration: F > G is in conflict with the previous declaration: F < G [-Wprecedence]
|
|
||||||
input.y: warning: 27 shift/reduce conflicts [-Wconflicts-sr]
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
## ------------------------------ ##
|
|
||||||
## Duplicate precedence relations ##
|
|
||||||
## ------------------------------ ##
|
|
||||||
|
|
||||||
AT_SETUP([Duplicate precedence relations])
|
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[input.y]],
|
|
||||||
[[%token TOKEN
|
|
||||||
%precedence A
|
|
||||||
%precedence B
|
|
||||||
%precedence C
|
|
||||||
%precedence D E
|
|
||||||
|
|
||||||
%gprec group {
|
|
||||||
%precedence F
|
|
||||||
%precedence G
|
|
||||||
}
|
|
||||||
|
|
||||||
%precr D = E
|
|
||||||
%precr B > A
|
|
||||||
%precr C > B
|
|
||||||
%precr G > F
|
|
||||||
%precr F > A
|
|
||||||
%precr C > group
|
|
||||||
%precr C > F
|
|
||||||
%%
|
|
||||||
exp:
|
|
||||||
TOKEN
|
|
||||||
| exp A exp
|
|
||||||
| exp B exp
|
|
||||||
| exp C exp
|
|
||||||
| exp D exp
|
|
||||||
| exp E exp
|
|
||||||
| exp F exp
|
|
||||||
| exp G exp
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_BISON_CHECK([[-Wall -o input.c input.y]], 0, [],
|
|
||||||
[[input.y:20.10: warning: duplicate declaration of the precedence relationship D = E [-Wprecedence]
|
|
||||||
input.y:20.10: warning: duplicate declaration of the precedence relationship E = D [-Wprecedence]
|
|
||||||
input.y:21.10: warning: duplicate declaration of the precedence relationship B > A [-Wprecedence]
|
|
||||||
input.y:22.10: warning: duplicate declaration of the precedence relationship C > B [-Wprecedence]
|
|
||||||
input.y:23.10: warning: duplicate declaration of the precedence relationship G > F [-Wprecedence]
|
|
||||||
input.y:26.10: warning: duplicate declaration of the precedence relationship C > F [-Wprecedence]
|
|
||||||
input.y: warning: 23 shift/reduce conflicts [-Wconflicts-sr]
|
|
||||||
]])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Token declaration order. ##
|
## Token declaration order. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
|
|||||||
+7
-7
@@ -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);
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-4
@@ -484,7 +484,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
|
|
||||||
NAME [reduce using rule 152 (opt_variable)]
|
NAME [reduce using rule 152 (opt_variable)]
|
||||||
'$' [reduce using rule 152 (opt_variable)]
|
'$' [reduce using rule 152 (opt_variable)]
|
||||||
@@ -5385,7 +5385,7 @@
|
@@ -5379,7 +5379,7 @@
|
||||||
156 | . '$' non_post_simp_exp
|
156 | . '$' non_post_simp_exp
|
||||||
|
|
||||||
NAME shift, and go to state 9
|
NAME shift, and go to state 9
|
||||||
@@ -493,7 +493,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
|
|
||||||
NAME [reduce using rule 152 (opt_variable)]
|
NAME [reduce using rule 152 (opt_variable)]
|
||||||
'$' [reduce using rule 152 (opt_variable)]
|
'$' [reduce using rule 152 (opt_variable)]
|
||||||
@@ -5405,7 +5405,7 @@
|
@@ -5399,7 +5399,7 @@
|
||||||
156 | . '$' non_post_simp_exp
|
156 | . '$' non_post_simp_exp
|
||||||
|
|
||||||
NAME shift, and go to state 9
|
NAME shift, and go to state 9
|
||||||
@@ -502,7 +502,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
|
|
||||||
NAME [reduce using rule 152 (opt_variable)]
|
NAME [reduce using rule 152 (opt_variable)]
|
||||||
'$' [reduce using rule 152 (opt_variable)]
|
'$' [reduce using rule 152 (opt_variable)]
|
||||||
@@ -6220,7 +6220,7 @@
|
@@ -6214,7 +6214,7 @@
|
||||||
156 | . '$' non_post_simp_exp
|
156 | . '$' non_post_simp_exp
|
||||||
|
|
||||||
NAME shift, and go to state 9
|
NAME shift, and go to state 9
|
||||||
@@ -511,7 +511,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
|
|
||||||
NAME [reduce using rule 152 (opt_variable)]
|
NAME [reduce using rule 152 (opt_variable)]
|
||||||
'$' [reduce using rule 152 (opt_variable)]
|
'$' [reduce using rule 152 (opt_variable)]
|
||||||
@@ -11117,3 +11117,274 @@
|
@@ -11099,3 +11099,274 @@
|
||||||
45 statement: LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement .
|
45 statement: LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement .
|
||||||
|
|
||||||
$default reduce using rule 45 (statement)
|
$default reduce using rule 45 (statement)
|
||||||
|
|||||||
+32
-2
@@ -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
|
||||||
|
|||||||
+6
-2
@@ -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)
|
||||||
|
|||||||
+30
-23
@@ -64,13 +64,14 @@ AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
|||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
|
[[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
|
||||||
input.y:3.1: error: invalid character: '?'
|
input.y:3.1: error: invalid character: '?'
|
||||||
input.y:4.14: error: syntax error, unexpected }
|
input.y:4.14: error: invalid character: '}'
|
||||||
input.y:5.1: error: invalid character: '%'
|
input.y:5.1: error: invalid character: '%'
|
||||||
input.y:5.2: error: invalid character: '&'
|
input.y:5.2: error: invalid character: '&'
|
||||||
input.y:6.1-17: error: invalid directive: '%a-does-not-exist'
|
input.y:6.1-17: error: invalid directive: '%a-does-not-exist'
|
||||||
input.y:7.1: error: invalid character: '%'
|
input.y:7.1: error: invalid character: '%'
|
||||||
input.y:7.2: error: invalid character: '-'
|
input.y:7.2: error: invalid character: '-'
|
||||||
input.y:8.1-9.0: error: missing '%}' at end of file
|
input.y:8.1-9.0: error: missing '%}' at end of file
|
||||||
|
input.y:8.1-9.0: error: syntax error, unexpected %{...%}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -671,25 +672,25 @@ exp: foo;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
AT_BISON_CHECK([-fcaret input.y], [1], [],
|
||||||
[[input.y:8.7-11: error: %type redeclaration for "foo"
|
[[input.y:8.7-11: error: %type redeclaration for foo
|
||||||
%type <baz> "foo"
|
%type <baz> "foo"
|
||||||
^^^^^
|
^^^^^
|
||||||
input.y:3.7-11: previous declaration
|
input.y:3.7-11: previous declaration
|
||||||
%type <bar> foo
|
%type <bar> foo
|
||||||
^^^^^
|
^^^^^
|
||||||
input.y:9.10-14: error: %printer redeclaration for "foo"
|
input.y:10.13-17: error: %destructor redeclaration for foo
|
||||||
%printer {baz} "foo"
|
|
||||||
^^^^^
|
|
||||||
input.y:4.10-14: previous declaration
|
|
||||||
%printer {bar} foo
|
|
||||||
^^^^^
|
|
||||||
input.y:10.13-17: error: %destructor redeclaration for "foo"
|
|
||||||
%destructor {baz} "foo"
|
%destructor {baz} "foo"
|
||||||
^^^^^
|
^^^^^
|
||||||
input.y:5.13-17: previous declaration
|
input.y:5.13-17: previous declaration
|
||||||
%destructor {bar} foo
|
%destructor {bar} foo
|
||||||
^^^^^
|
^^^^^
|
||||||
input.y:11.1-5: error: %left redeclaration for "foo"
|
input.y:9.10-14: error: %printer redeclaration for foo
|
||||||
|
%printer {baz} "foo"
|
||||||
|
^^^^^
|
||||||
|
input.y:4.10-14: previous declaration
|
||||||
|
%printer {bar} foo
|
||||||
|
^^^^^
|
||||||
|
input.y:11.1-5: error: %left redeclaration for foo
|
||||||
%left "foo"
|
%left "foo"
|
||||||
^^^^^
|
^^^^^
|
||||||
input.y:6.1-5: previous declaration
|
input.y:6.1-5: previous declaration
|
||||||
@@ -955,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.
|
||||||
@@ -1767,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]],
|
||||||
[[%%
|
[[%%
|
||||||
@@ -1797,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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -725,18 +725,23 @@ AT_CLEANUP
|
|||||||
|
|
||||||
AT_SETUP([Java constructor init and init_throws])
|
AT_SETUP([Java constructor init and init_throws])
|
||||||
|
|
||||||
|
m4_pushdef([AT_Witness],
|
||||||
|
[super("Test Thread"); if (true) throw new InterruptedException();])
|
||||||
|
|
||||||
AT_CHECK_JAVA_MINIMAL([[
|
AT_CHECK_JAVA_MINIMAL([[
|
||||||
%define extends {Thread}
|
%define extends {Thread}
|
||||||
%code init { super("Test Thread"); if (true) throw new InterruptedException(); }
|
%code init { ]AT_Witness[ }
|
||||||
%define init_throws {InterruptedException}
|
%define init_throws {InterruptedException}
|
||||||
%lex-param {int lex_param}]])
|
%lex-param {int lex_param}]])
|
||||||
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
|
AT_CHECK([[grep ']AT_Witness[' YYParser.java]], 0, [ignore])
|
||||||
|
|
||||||
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
||||||
%define extends {Thread}
|
%define extends {Thread}
|
||||||
%code init { super("Test Thread"); if (true) throw new InterruptedException(); }
|
%code init { ]AT_Witness[ }
|
||||||
%define init_throws {InterruptedException}]], [], [[return EOF;]])
|
%define init_throws {InterruptedException}]], [], [[return EOF;]])
|
||||||
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
|
AT_CHECK([[grep ']AT_Witness[' YYParser.java]], 0, [ignore])
|
||||||
|
|
||||||
|
m4_popdef([AT_Witness])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|||||||
+47
-1
@@ -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. ##
|
||||||
## ---------------------------- ##
|
## ---------------------------- ##
|
||||||
|
|||||||
+4
-1
@@ -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
|
||||||
|
|||||||
+5
-5
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -405,13 +405,14 @@ default: 'a' }
|
|||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:2.1: error: invalid character: '?'
|
[[input.y:2.1: error: invalid character: '?'
|
||||||
input.y:3.14: error: syntax error, unexpected }
|
input.y:3.14: error: invalid character: '}'
|
||||||
input.y:4.1: error: invalid character: '%'
|
input.y:4.1: error: invalid character: '%'
|
||||||
input.y:4.2: error: invalid character: '&'
|
input.y:4.2: error: invalid character: '&'
|
||||||
input.y:5.1-17: error: invalid directive: '%a-does-not-exist'
|
input.y:5.1-17: error: invalid directive: '%a-does-not-exist'
|
||||||
input.y:6.1: error: invalid character: '%'
|
input.y:6.1: error: invalid character: '%'
|
||||||
input.y:6.2: error: invalid character: '-'
|
input.y:6.2: error: invalid character: '-'
|
||||||
input.y:7.1-8.0: error: missing '%}' at end of file
|
input.y:7.1-8.0: error: missing '%}' at end of file
|
||||||
|
input.y:7.1-8.0: error: syntax error, unexpected %{...%}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -769,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