mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 19:55:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b23ca37ed2 | ||
|
|
bb5e4b659b | ||
|
|
bc8ec1d7bf | ||
|
|
665c5d688c | ||
|
|
53d379b905 | ||
|
|
aa85bfe3a7 | ||
|
|
5ec9c99662 | ||
|
|
36cae8e752 | ||
|
|
7498ede3ab | ||
|
|
27104acdbe | ||
|
|
7b3368a155 | ||
|
|
ec08b369ec | ||
|
|
05b70f47e8 | ||
|
|
626d2f2dca | ||
|
|
5c797b1627 | ||
|
|
ac692b572a | ||
|
|
2f208ee43a | ||
|
|
013a695add | ||
|
|
54ed577da0 | ||
|
|
4a690d3d19 | ||
|
|
cd1a9f076c | ||
|
|
7a0f681cb8 | ||
|
|
eb0f3e79e0 | ||
|
|
25b7421c40 | ||
|
|
e86adac52d | ||
|
|
5879c8dc5a | ||
|
|
d5d148630a | ||
|
|
b443932991 | ||
|
|
f5a646c390 | ||
|
|
f038f0b12f | ||
|
|
b6b397b7f0 | ||
|
|
2c8fb4d126 | ||
|
|
169fe80c7f | ||
|
|
b7e0d3131d | ||
|
|
a634aad9e6 | ||
|
|
ad326ada91 | ||
|
|
a049509d04 | ||
|
|
7c5e508b39 | ||
|
|
55bf52860e | ||
|
|
8575bd06ae | ||
|
|
7c63cc1f6b | ||
|
|
4a41a8ec51 | ||
|
|
ba469451d8 | ||
|
|
8580b268c3 | ||
|
|
41aaa8374c | ||
|
|
79e79be298 | ||
|
|
ffe2e4aaec | ||
|
|
dad14ec3e4 | ||
|
|
a7ff1c75be | ||
|
|
8c3a7687e4 | ||
|
|
72c488aa62 | ||
|
|
a88f8117b0 | ||
|
|
3551d51dd9 | ||
|
|
38b17c36da | ||
|
|
f9db426de6 | ||
|
|
c927c955c8 |
+1
-1
@@ -1 +1 @@
|
|||||||
3.2.2
|
3.2.91
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.90 (2019-01-12) [beta]
|
* Noteworthy changes in release 3.3 (2019-01-26) [stable]
|
||||||
|
|
||||||
|
A new mailing list was created, Bison Announce. It is low traffic, and is
|
||||||
|
only about announcing new releases and important messages (e.g., polls about
|
||||||
|
major decisions to make).
|
||||||
|
|
||||||
|
https://lists.gnu.org/mailman/listinfo/bison-announce
|
||||||
|
|
||||||
** Backward incompatible changes
|
** Backward incompatible changes
|
||||||
|
|
||||||
@@ -9,6 +15,11 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Deprecated features
|
** Deprecated features
|
||||||
|
|
||||||
|
A new feature, --update (see below) helps adjusting existing grammars to
|
||||||
|
deprecations.
|
||||||
|
|
||||||
|
*** Deprecated directives
|
||||||
|
|
||||||
The %error-verbose directive is deprecated in favor of '%define
|
The %error-verbose directive is deprecated in favor of '%define
|
||||||
parse.error verbose' since Bison 3.0, but no warning was issued.
|
parse.error verbose' since Bison 3.0, but no warning was issued.
|
||||||
|
|
||||||
@@ -16,9 +27,19 @@ GNU Bison NEWS
|
|||||||
api.prefix {xx}' since Bison 3.0, but no warning was issued. These
|
api.prefix {xx}' since Bison 3.0, but no warning was issued. These
|
||||||
directives are slightly different, you might need to adjust your code.
|
directives are slightly different, you might need to adjust your code.
|
||||||
%name-prefix renames only symbols with external linkage, while api.prefix
|
%name-prefix renames only symbols with external linkage, while api.prefix
|
||||||
also renames types and macros, including @code{YYDEBUG},
|
also renames types and macros, including YYDEBUG, YYTOKENTYPE,
|
||||||
@code{YYTOKENTYPE}, @code{yytokentype}, @code{YYSTYPE}, @code{YYLTYPE},
|
yytokentype, YYSTYPE, YYLTYPE, etc.
|
||||||
etc.
|
|
||||||
|
Users of Flex that move from '%name-prefix "xx"' to '%define api.prefix
|
||||||
|
{xx}' will typically have to update YY_DECL from
|
||||||
|
|
||||||
|
#define YY_DECL int xxlex (YYSTYPE *yylval, YYLTYPE *yylloc)
|
||||||
|
|
||||||
|
to
|
||||||
|
|
||||||
|
#define YY_DECL int xxlex (XXSTYPE *yylval, XXLTYPE *yylloc)
|
||||||
|
|
||||||
|
*** Deprecated %define variable names
|
||||||
|
|
||||||
The following variables, mostly related to parsers in Java, have been
|
The following variables, mostly related to parsers in Java, have been
|
||||||
renamed for consistency. Backward compatibility is ensured, but upgrading
|
renamed for consistency. Backward compatibility is ensured, but upgrading
|
||||||
@@ -35,14 +56,66 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** New features
|
** New features
|
||||||
|
|
||||||
|
*** Generation of fix-its for IDEs/Editors
|
||||||
|
|
||||||
|
When given the new option -ffixit (aka -fdiagnostics-parseable-fixits),
|
||||||
|
bison now generates machine readable editing instructions to fix some
|
||||||
|
issues. Currently, this is mostly limited to updating deprecated
|
||||||
|
directives and removing duplicates. For instance:
|
||||||
|
|
||||||
|
$ cat foo.y
|
||||||
|
%error-verbose
|
||||||
|
%define parser_class_name "Parser"
|
||||||
|
%define api.parser.class "Parser"
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
|
||||||
|
See the "fix-it:" lines below:
|
||||||
|
|
||||||
|
$ bison -ffixit foo.y
|
||||||
|
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
||||||
|
%error-verbose
|
||||||
|
^~~~~~~~~~~~~~
|
||||||
|
fix-it:"foo.y":{1:1-1:15}:"%define parse.error verbose"
|
||||||
|
foo.y:2.1-34: warning: deprecated directive, use '%define api.parser.class {Parser}' [-Wdeprecated]
|
||||||
|
%define parser_class_name "Parser"
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
fix-it:"foo.y":{2:1-2:35}:"%define api.parser.class {Parser}"
|
||||||
|
foo.y:3.1-33: error: %define variable 'api.parser.class' redefined
|
||||||
|
%define api.parser.class "Parser"
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
foo.y:2.1-34: previous definition
|
||||||
|
%define parser_class_name "Parser"
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
fix-it:"foo.y":{3:1-3:34}:""
|
||||||
|
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||||
|
|
||||||
|
This uses the same output format as GCC and Clang.
|
||||||
|
|
||||||
|
*** Updating grammar files
|
||||||
|
|
||||||
|
Fixes can be applied on the fly. The previous example ends with the
|
||||||
|
suggestion to re-run bison with the option -u/--update, which results in a
|
||||||
|
cleaner grammar file.
|
||||||
|
|
||||||
|
$ bison --update foo.y
|
||||||
|
[...]
|
||||||
|
bison: file 'foo.y' was updated (backup: 'foo.y~')
|
||||||
|
|
||||||
|
$ cat foo.y
|
||||||
|
%define parse.error verbose
|
||||||
|
%define api.parser.class {Parser}
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
|
||||||
*** Bison is now relocatable
|
*** Bison is now relocatable
|
||||||
|
|
||||||
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
|
If you pass '--enable-relocatable' to 'configure', Bison is relocatable.
|
||||||
|
|
||||||
A relocatable program can be moved or copied to a different location on
|
A relocatable program can be moved or copied to a different location on
|
||||||
the file system. It can also be used through mount points for network
|
the file system. It can also be used through mount points for network
|
||||||
sharing. It is possible to make symlinks to the installed and moved
|
sharing. It is possible to make symbolic links to the installed and moved
|
||||||
programs, and invoke them through the symlink.
|
programs, and invoke them through the symbolic link.
|
||||||
|
|
||||||
*** %expect and %expect-rr modifiers on individual rules
|
*** %expect and %expect-rr modifiers on individual rules
|
||||||
|
|
||||||
@@ -121,7 +194,7 @@ GNU Bison NEWS
|
|||||||
*** C++: Actual token constructors
|
*** C++: Actual token constructors
|
||||||
|
|
||||||
When variants and token constructors are enabled, in addition to the
|
When variants and token constructors are enabled, in addition to the
|
||||||
type-safe named token constructors (make_ID, amke_INT, etc.), we now
|
type-safe named token constructors (make_ID, make_INT, etc.), we now
|
||||||
generate genuine constructors for symbol_type.
|
generate genuine constructors for symbol_type.
|
||||||
|
|
||||||
For instance with these declarations
|
For instance with these declarations
|
||||||
@@ -238,7 +311,7 @@ GNU Bison NEWS
|
|||||||
where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
|
where TAG denotes a type tag such as ‘<ival>’, ID denotes an identifier
|
||||||
such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
|
such as ‘NUM’, NUMBER a decimal or hexadecimal integer such as ‘300’ or
|
||||||
‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
|
‘0x12d’, CHAR a character literal such as ‘'+'’, and STRING a string
|
||||||
literal such as ‘"number"’. The postfix quantifiers are ‘?’ (zero or
|
literal such as ‘"number"’. The post-fix quantifiers are ‘?’ (zero or
|
||||||
one), ‘*’ (zero or more) and ‘+’ (one or more).
|
one), ‘*’ (zero or more) and ‘+’ (one or more).
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
|
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
|
||||||
@@ -3395,10 +3468,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
||||||
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
||||||
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir
|
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir
|
||||||
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG
|
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
|
||||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW
|
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
||||||
|
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
||||||
|
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
||||||
|
LocalWords: noexcept constexpr ispell american
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
|
ispell-dictionary: "american"
|
||||||
mode: outline
|
mode: outline
|
||||||
fill-column: 76
|
fill-column: 76
|
||||||
End:
|
End:
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
* Bison 3.4
|
* Bison 3.4
|
||||||
** injection rules
|
** injection rules
|
||||||
|
** glr.cc
|
||||||
|
move glr.c into the yy namespace
|
||||||
** improve syntax errors (UTF-8, internationalization)
|
** improve syntax errors (UTF-8, internationalization)
|
||||||
Bison depends on the current locale. For instance:
|
Bison depends on the current locale. For instance:
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
argmatch assert
|
argmatch array-list assert
|
||||||
bitsetv
|
bitsetv
|
||||||
calloc-posix close closeout config-h c-strcase
|
calloc-posix close closeout config-h c-strcase
|
||||||
configmake
|
configmake
|
||||||
@@ -26,7 +26,9 @@ gnulib_modules='
|
|||||||
getopt-gnu
|
getopt-gnu
|
||||||
gettext git-version-gen gitlog-to-changelog
|
gettext git-version-gen gitlog-to-changelog
|
||||||
gpl-3.0 hash inttypes isnan javacomp-script
|
gpl-3.0 hash inttypes isnan javacomp-script
|
||||||
javaexec-script ldexpl malloc-gnu
|
javaexec-script
|
||||||
|
ldexpl
|
||||||
|
malloc-gnu
|
||||||
mbswidth
|
mbswidth
|
||||||
non-recursive-gnulib-prefix-hack
|
non-recursive-gnulib-prefix-hack
|
||||||
obstack
|
obstack
|
||||||
@@ -36,6 +38,7 @@ gnulib_modules='
|
|||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
relocatable-prog relocatable-script
|
relocatable-prog relocatable-script
|
||||||
|
rename
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strverscmp
|
||||||
timevar
|
timevar
|
||||||
unistd unistd-safer unlink unlocked-io
|
unistd unistd-safer unlink unlocked-io
|
||||||
@@ -44,6 +47,7 @@ gnulib_modules='
|
|||||||
xalloc
|
xalloc
|
||||||
xalloc-die
|
xalloc-die
|
||||||
xconcat-filename
|
xconcat-filename
|
||||||
|
xlist
|
||||||
xmemdup0
|
xmemdup0
|
||||||
xstrndup
|
xstrndup
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,11 @@ while (<STDIN>)
|
|||||||
# are strings and have the same syntax as on the command line.
|
# are strings and have the same syntax as on the command line.
|
||||||
if ($dir_arg eq 'name[=value]')
|
if ($dir_arg eq 'name[=value]')
|
||||||
{
|
{
|
||||||
$dir_arg = '@var{name} ["@var{value}"]';
|
# -D/-F do not add quotes to the argument.
|
||||||
|
$dir_arg =
|
||||||
|
$dir eq "%define"
|
||||||
|
? '@var{name} [@var{value}]'
|
||||||
|
: '@var{name} ["@var{value}"]';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ exclude = \
|
|||||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
|
cast_of_argument_to_free=^src/muscle-tab.c$$ \
|
||||||
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
preprocessor_indentation=^data/|^lib/|^src/parse-gram.[ch]$$ \
|
||||||
program_name=^lib/main.c$$ \
|
program_name=^lib/main.c$$ \
|
||||||
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
prohibit_always-defined_macros=^data/skeletons/yacc.c$$ \
|
||||||
|
|||||||
+5
-3
@@ -96,9 +96,11 @@ AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes])
|
|||||||
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
|
||||||
-fparse-all-comments -Wdocumentation
|
-fparse-all-comments -Wdocumentation
|
||||||
-Wformat -Wnull-dereference -Wpointer-arith -Wwrite-strings'
|
-Wformat -Wimplicit-fallthrough -Wnull-dereference
|
||||||
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
-Wpointer-arith -Wshadow
|
||||||
warn_cxx='-Wnoexcept'
|
-Wwrite-strings'
|
||||||
|
warn_c='-Wbad-function-cast -Wstrict-prototypes'
|
||||||
|
warn_cxx='-Wextra-semi -Wnoexcept -Wundefined-func-template -Wweak-vtables'
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
#
|
#
|
||||||
# -fno-color-diagnostics: Clang's use of colors in the error
|
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||||
|
|||||||
@@ -480,7 +480,9 @@ m4_popdef([b4_actions_])dnl
|
|||||||
|
|
||||||
# _b4_symbol_case(SYMBOL-NUM)
|
# _b4_symbol_case(SYMBOL-NUM)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
# Issue a "case NUM" for SYMBOL-NUM. Ends with its EOL to make it
|
||||||
|
# easier to use with m4_map, but then, use []dnl to suppress the last
|
||||||
|
# one.
|
||||||
m4_define([_b4_symbol_case],
|
m4_define([_b4_symbol_case],
|
||||||
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
|
||||||
])
|
])
|
||||||
|
|||||||
+39
-40
@@ -77,11 +77,13 @@ m4_define([b4_cxx_portability],
|
|||||||
// Support noexcept when possible.
|
// Support noexcept when possible.
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
# define YY_NOEXCEPT noexcept
|
# define YY_NOEXCEPT noexcept
|
||||||
|
# define YY_NOTHROW
|
||||||
#else
|
#else
|
||||||
# define YY_NOEXCEPT
|
# define YY_NOEXCEPT
|
||||||
#endif[]dnl
|
# define YY_NOTHROW throw ()
|
||||||
|
#endif
|
||||||
|
|
||||||
// Support noexcept when possible.
|
// Support constexpr when possible.
|
||||||
#if 201703 <= YY_CPLUSPLUS
|
#if 201703 <= YY_CPLUSPLUS
|
||||||
# define YY_CONSTEXPR constexpr
|
# define YY_CONSTEXPR constexpr
|
||||||
#else
|
#else
|
||||||
@@ -217,7 +219,14 @@ m4_define([b4_public_types_declare],
|
|||||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
||||||
: std::runtime_error (m)]b4_locations_if([
|
: std::runtime_error (m)]b4_locations_if([
|
||||||
, location (l)])[
|
, location (l)])[
|
||||||
{}]b4_locations_if([
|
{}
|
||||||
|
|
||||||
|
syntax_error (const syntax_error& s)
|
||||||
|
: std::runtime_error (s.what ())]b4_locations_if([
|
||||||
|
, location (s.location)])[
|
||||||
|
{}
|
||||||
|
|
||||||
|
~syntax_error () YY_NOEXCEPT YY_NOTHROW;]b4_locations_if([
|
||||||
|
|
||||||
location_type location;])[
|
location_type location;])[
|
||||||
};
|
};
|
||||||
@@ -260,7 +269,10 @@ m4_define([b4_symbol_type_define],
|
|||||||
typedef Base super_type;
|
typedef Base super_type;
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
basic_symbol ();
|
basic_symbol ()
|
||||||
|
: value ()]b4_locations_if([
|
||||||
|
, location ()])[
|
||||||
|
{}
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
/// Move constructor.
|
/// Move constructor.
|
||||||
@@ -282,10 +294,29 @@ m4_define([b4_symbol_type_define],
|
|||||||
YY_RVREF (location_type) l])[);
|
YY_RVREF (location_type) l])[);
|
||||||
]])[
|
]])[
|
||||||
/// Destroy the symbol.
|
/// Destroy the symbol.
|
||||||
~basic_symbol ();
|
~basic_symbol ()
|
||||||
|
{
|
||||||
|
clear ();
|
||||||
|
}
|
||||||
|
|
||||||
/// Destroy contents, and record that is empty.
|
/// Destroy contents, and record that is empty.
|
||||||
void clear ();
|
void clear ()
|
||||||
|
{]b4_variant_if([[
|
||||||
|
// User destructor.
|
||||||
|
symbol_number_type yytype = this->type_get ();
|
||||||
|
basic_symbol<Base>& yysym = *this;
|
||||||
|
(void) yysym;
|
||||||
|
switch (yytype)
|
||||||
|
{
|
||||||
|
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
||||||
|
[ default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type destructor.
|
||||||
|
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
||||||
|
Base::clear ();
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether empty.
|
/// Whether empty.
|
||||||
bool empty () const YY_NOEXCEPT;
|
bool empty () const YY_NOEXCEPT;
|
||||||
@@ -352,7 +383,7 @@ m4_define([b4_symbol_type_define],
|
|||||||
typedef basic_symbol<by_type> super_type;
|
typedef basic_symbol<by_type> super_type;
|
||||||
|
|
||||||
/// Empty symbol.
|
/// Empty symbol.
|
||||||
symbol_type () {};
|
symbol_type () {}
|
||||||
|
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
/// Constructor for valueless symbols, and symbols from each type.
|
||||||
]b4_type_foreach([_b4_token_constructor_define])dnl
|
]b4_type_foreach([_b4_token_constructor_define])dnl
|
||||||
@@ -365,12 +396,6 @@ m4_define([b4_symbol_type_define],
|
|||||||
# Provide the implementation needed by the public types.
|
# Provide the implementation needed by the public types.
|
||||||
m4_define([b4_public_types_define],
|
m4_define([b4_public_types_define],
|
||||||
[[ // basic_symbol.
|
[[ // basic_symbol.
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol ()
|
|
||||||
: value ()]b4_locations_if([
|
|
||||||
, location ()])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
|
]b4_parser_class[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
|
||||||
@@ -416,32 +441,6 @@ m4_define([b4_public_types_define],
|
|||||||
(void) v;
|
(void) v;
|
||||||
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
]b4_symbol_variant([this->type_get ()], [value], [YY_MOVE_OR_COPY], [YY_MOVE (v)])])[}]])[
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::~basic_symbol ()
|
|
||||||
{
|
|
||||||
clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base>
|
|
||||||
void
|
|
||||||
]b4_parser_class[::basic_symbol<Base>::clear ()
|
|
||||||
{]b4_variant_if([[
|
|
||||||
// User destructor.
|
|
||||||
symbol_number_type yytype = this->type_get ();
|
|
||||||
basic_symbol<Base>& yysym = *this;
|
|
||||||
(void) yysym;
|
|
||||||
switch (yytype)
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type destructor.
|
|
||||||
]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
|
|
||||||
Base::clear ();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
bool
|
bool
|
||||||
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
]b4_parser_class[::basic_symbol<Base>::empty () const YY_NOEXCEPT
|
||||||
@@ -517,7 +516,7 @@ m4_define([b4_public_types_define],
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_tolen_constructor_define
|
# b4_token_constructor_define
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
# Define symbol constructors for all the value types.
|
# Define symbol constructors for all the value types.
|
||||||
# Use at class-level. Redefined in variant.hh.
|
# Use at class-level. Redefined in variant.hh.
|
||||||
|
|||||||
@@ -590,7 +590,10 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
/* Fall through. */
|
else
|
||||||
|
goto append;
|
||||||
|
|
||||||
|
append:
|
||||||
default:
|
default:
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = *yyp;
|
yyres[yyn] = *yyp;
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
]b4_parser_class::~b4_parser_class[ ()
|
]b4_parser_class::~b4_parser_class[ ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
||||||
|
{}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class[::operator() ()
|
]b4_parser_class[::operator() ()
|
||||||
{
|
{
|
||||||
@@ -246,9 +249,12 @@ b4_percent_code_get([[requires]])[
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
]m4_ifdef([b4_location_file],
|
]b4_cxx_portability[
|
||||||
|
]m4_ifdef([b4_location_include],
|
||||||
[[# include ]b4_location_include])[
|
[[# include ]b4_location_include])[
|
||||||
|
]b4_variant_if([b4_variant_includes])[
|
||||||
|
|
||||||
|
]b4_attribute_define[
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
// Whether we are compiled with exception support.
|
||||||
@@ -263,6 +269,7 @@ b4_percent_code_get([[requires]])[
|
|||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
]b4_bison_locations_if([m4_ifndef([b4_location_file],
|
||||||
[b4_location_define])])[
|
[b4_location_define])])[
|
||||||
|
|
||||||
|
|||||||
+11
-4
@@ -110,7 +110,7 @@ b4_dollar_pushdef([yysym.value],
|
|||||||
[$1],
|
[$1],
|
||||||
[],
|
[],
|
||||||
[yysym.location])dnl
|
[yysym.location])dnl
|
||||||
_b4_symbol_case([$1])
|
_b4_symbol_case([$1])[]dnl
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
b4_syncline([b4_symbol([$1], [$2_line])], [b4_symbol([$1], [$2_file])])
|
||||||
b4_symbol([$1], [$2])
|
b4_symbol([$1], [$2])
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
@@ -532,7 +532,10 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
// Fall through.
|
else
|
||||||
|
goto append;
|
||||||
|
|
||||||
|
append:
|
||||||
default:
|
default:
|
||||||
yyr += *yyp;
|
yyr += *yyp;
|
||||||
break;
|
break;
|
||||||
@@ -559,6 +562,8 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
]b4_parser_class::~b4_parser_class[ ()
|
]b4_parser_class::~b4_parser_class[ ()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
]b4_parser_class[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
|
||||||
|
{}
|
||||||
|
|
||||||
/*---------------.
|
/*---------------.
|
||||||
| Symbol types. |
|
| Symbol types. |
|
||||||
@@ -659,10 +664,12 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
std::ostream& yyoutput = yyo;
|
std::ostream& yyoutput = yyo;
|
||||||
YYUSE (yyoutput);
|
YYUSE (yyoutput);
|
||||||
symbol_number_type yytype = yysym.type_get ();
|
symbol_number_type yytype = yysym.type_get ();
|
||||||
|
#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 100 + __GNUC_MINOR__ <= 408
|
||||||
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
// Avoid a (spurious) G++ 4.8 warning about "array subscript is
|
||||||
// below array bounds".
|
// below array bounds".
|
||||||
if (yysym.empty ())
|
if (yysym.empty ())
|
||||||
std::abort ();
|
std::abort ();
|
||||||
|
#endif
|
||||||
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
yyo << (yytype < yyntokens_ ? "token" : "nterm")
|
||||||
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
<< ' ' << yytname_[yytype] << " ("]b4_locations_if([
|
||||||
<< yysym.location << ": "])[;
|
<< yysym.location << ": "])[;
|
||||||
@@ -896,8 +903,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
[
|
[
|
||||||
// Default location.
|
// Default location.
|
||||||
{
|
{
|
||||||
slice<stack_symbol_type, stack_type> slice (yystack_, yylen);
|
stack_type::slice range (yystack_, yylen);
|
||||||
YYLLOC_DEFAULT (yylhs.location, slice, yylen);
|
YYLLOC_DEFAULT (yylhs.location, range, yylen);
|
||||||
yyerror_range[1].location = yylhs.location;
|
yyerror_range[1].location = yylhs.location;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
|
|||||||
+20
-21
@@ -122,33 +122,32 @@ m4_define([b4_stack_define],
|
|||||||
return seq_.rend ();
|
return seq_.rend ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Present a slice of the top of a stack.
|
||||||
|
class slice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
slice (const stack& stack, int range)
|
||||||
|
: stack_ (stack)
|
||||||
|
, range_ (range)
|
||||||
|
{}
|
||||||
|
|
||||||
|
const T&
|
||||||
|
operator[] (int i) const
|
||||||
|
{
|
||||||
|
return stack_[range_ - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const stack& stack_;
|
||||||
|
int range_;
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
stack (const stack&);
|
stack (const stack&);
|
||||||
stack& operator= (const stack&);
|
stack& operator= (const stack&);
|
||||||
/// The wrapped container.
|
/// The wrapped container.
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Present a slice of the top of a stack.
|
|
||||||
template <typename T, typename S = stack<T> >
|
|
||||||
class slice
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
slice (const S& stack, int range)
|
|
||||||
: stack_ (stack)
|
|
||||||
, range_ (range)
|
|
||||||
{}
|
|
||||||
|
|
||||||
const T&
|
|
||||||
operator[] (int i) const
|
|
||||||
{
|
|
||||||
return stack_[range_ - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const S& stack_;
|
|
||||||
int range_;
|
|
||||||
};
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
m4_ifdef([b4_stack_file],
|
m4_ifdef([b4_stack_file],
|
||||||
|
|||||||
@@ -1066,7 +1066,10 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
/* Fall through. */
|
else
|
||||||
|
goto append;
|
||||||
|
|
||||||
|
append:
|
||||||
default:
|
default:
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = *yyp;
|
yyres[yyn] = *yyp;
|
||||||
|
|||||||
+134
-20
@@ -4278,16 +4278,16 @@ final action does not use @code{$3}). Bison reports these errors when the
|
|||||||
Bison}):
|
Bison}):
|
||||||
|
|
||||||
@example
|
@example
|
||||||
$ bison -Wmidrule-value mid.y
|
$ @kbd{bison -Wmidrule-value mid.y}
|
||||||
@group
|
@group
|
||||||
mid.y:2.6-13: warning: unset value: $$
|
mid.y:2.6-13: warning: unset value: $$
|
||||||
exp: @{ a(); @} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
exp: @{ a(); @} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
mid.y:2.19-31: warning: unused value: $3
|
mid.y:2.19-31: warning: unused value: $3
|
||||||
exp: @{ a(); @} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
exp: @{ a(); @} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @};
|
||||||
^^^^^^^^^^^^^
|
^~~~~~~~~~~~~
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@@ -6650,6 +6650,28 @@ For example, if you use @samp{%define api.prefix @{c@}}, the names become
|
|||||||
@code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
|
@code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
|
||||||
on.
|
on.
|
||||||
|
|
||||||
|
Users of Flex must update the signature of the generated @code{yylex}
|
||||||
|
function. Since the Flex scanner usually includes the generated header of
|
||||||
|
the parser (to get the definitions of the tokens, etc.), the most convenient
|
||||||
|
way is to insert the declaration of @code{yylex} in the @code{provides}
|
||||||
|
section:
|
||||||
|
|
||||||
|
@example
|
||||||
|
%define api.prefix @{c@}
|
||||||
|
// Emitted in the header file, after the definition of YYSTYPE.
|
||||||
|
%code provides
|
||||||
|
@{
|
||||||
|
// Tell Flex the expected prototype of yylex.
|
||||||
|
#define YY_DECL \
|
||||||
|
int clex (CSTYPE *yylval, CLTYPE *yylloc)
|
||||||
|
|
||||||
|
// Declare the scanner.
|
||||||
|
YY_DECL;
|
||||||
|
@}
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@sp 1
|
||||||
|
|
||||||
The @code{%define} variable @code{api.prefix} works in two different ways.
|
The @code{%define} variable @code{api.prefix} works in two different ways.
|
||||||
In the implementation file, it works by adding macro definitions to the
|
In the implementation file, it works by adding macro definitions to the
|
||||||
beginning of the parser implementation file, defining @code{yyparse} as
|
beginning of the parser implementation file, defining @code{yyparse} as
|
||||||
@@ -9309,7 +9331,7 @@ calc.y: warning: 1 nonterminal useless in grammar [-Wother]
|
|||||||
calc.y: warning: 1 rule useless in grammar [-Wother]
|
calc.y: warning: 1 rule useless in grammar [-Wother]
|
||||||
calc.y:19.1-7: warning: nonterminal useless in grammar: useless [-Wother]
|
calc.y:19.1-7: warning: nonterminal useless in grammar: useless [-Wother]
|
||||||
useless: STR;
|
useless: STR;
|
||||||
^^^^^^^
|
^~~~~~~
|
||||||
calc.y: warning: 7 shift/reduce conflicts [-Wconflicts-sr]
|
calc.y: warning: 7 shift/reduce conflicts [-Wconflicts-sr]
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@@ -9842,12 +9864,12 @@ Used to output an xhtml enhancement of the @samp{.output} file.
|
|||||||
|
|
||||||
Sample usage (requires @command{xsltproc}):
|
Sample usage (requires @command{xsltproc}):
|
||||||
@example
|
@example
|
||||||
$ bison -x gr.y
|
$ @kbd{bison -x gr.y}
|
||||||
@group
|
@group
|
||||||
$ bison --print-datadir
|
$ @kbd{bison --print-datadir}
|
||||||
/usr/local/share/bison
|
/usr/local/share/bison
|
||||||
@end group
|
@end group
|
||||||
$ xsltproc /usr/local/share/bison/xslt/xml2xhtml.xsl gr.xml >gr.html
|
$ @kbd{xsltproc /usr/local/share/bison/xslt/xml2xhtml.xsl gr.xml >gr.html}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@c ================================================= Tracing
|
@c ================================================= Tracing
|
||||||
@@ -10247,6 +10269,43 @@ Print the name of the directory containing locale-dependent data.
|
|||||||
@item --print-datadir
|
@item --print-datadir
|
||||||
Print the name of the directory containing skeletons and XSLT.
|
Print the name of the directory containing skeletons and XSLT.
|
||||||
|
|
||||||
|
@item -u
|
||||||
|
@item --update
|
||||||
|
Update the grammar file (remove duplicates, update deprecated directives,
|
||||||
|
etc.) and exit (i.e., do not generate any of the output files). Leaves a
|
||||||
|
backup of the original file with a @code{~} appended. For instance:
|
||||||
|
|
||||||
|
@example
|
||||||
|
@group
|
||||||
|
$ @kbd{cat foo.y}
|
||||||
|
%error-verbose
|
||||||
|
%define parse.error verbose
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
@end group
|
||||||
|
@group
|
||||||
|
$ @kbd{bison -u foo.y}
|
||||||
|
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
||||||
|
%error-verbose
|
||||||
|
^~~~~~~~~~~~~~
|
||||||
|
foo.y:2.1-27: error: %define variable 'parse.error' redefined
|
||||||
|
%define parse.error verbose
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
foo.y:1.1-14: previous definition
|
||||||
|
%error-verbose
|
||||||
|
^~~~~~~~~~~~~~
|
||||||
|
bison: file 'foo.y' was updated (backup: 'foo.y~')
|
||||||
|
@end group
|
||||||
|
@group
|
||||||
|
$ @kbd{cat foo.y}
|
||||||
|
%define parse.error verbose
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
@end group
|
||||||
|
@end example
|
||||||
|
|
||||||
|
See the documentation of @option{--feature=fixit} below for more details.
|
||||||
|
|
||||||
@item -y
|
@item -y
|
||||||
@itemx --yacc
|
@itemx --yacc
|
||||||
Act more like the traditional Yacc command. This can cause different
|
Act more like the traditional Yacc command. This can cause different
|
||||||
@@ -10353,17 +10412,17 @@ Bison reports:
|
|||||||
@group
|
@group
|
||||||
warning: useless precedence and associativity for "="
|
warning: useless precedence and associativity for "="
|
||||||
%nonassoc "="
|
%nonassoc "="
|
||||||
^^^
|
^~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
warning: useless associativity for "*", use %precedence
|
warning: useless associativity for "*", use %precedence
|
||||||
%left "*"
|
%left "*"
|
||||||
^^^
|
^~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
warning: useless precedence for "("
|
warning: useless precedence for "("
|
||||||
%precedence "("
|
%precedence "("
|
||||||
^^^
|
^~~
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@@ -10412,8 +10471,8 @@ the following commands are @emph{not} equivalent, as the first will not treat
|
|||||||
S/R conflicts as errors.
|
S/R conflicts as errors.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
$ bison -Werror=yacc,conflicts-sr input.y
|
$ @kbd{bison -Werror=yacc,conflicts-sr input.y}
|
||||||
$ bison -Werror=yacc,error=conflicts-sr input.y
|
$ @kbd{bison -Werror=yacc,error=conflicts-sr input.y}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item -Wno-error
|
@item -Wno-error
|
||||||
@@ -10449,27 +10508,27 @@ When invoked with @option{-fcaret} (or nothing), Bison will report:
|
|||||||
@group
|
@group
|
||||||
in.y:3.20-23: error: ambiguous reference: '$exp'
|
in.y:3.20-23: error: ambiguous reference: '$exp'
|
||||||
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||||
^^^^
|
^~~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
in.y:3.1-3: refers to: $exp at $$
|
in.y:3.1-3: refers to: $exp at $$
|
||||||
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||||
^^^
|
^~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
in.y:3.6-8: refers to: $exp at $1
|
in.y:3.6-8: refers to: $exp at $1
|
||||||
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||||
^^^
|
^~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
in.y:3.14-16: refers to: $exp at $3
|
in.y:3.14-16: refers to: $exp at $3
|
||||||
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||||
^^^
|
^~~
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
in.y:3.32-33: error: $2 of 'exp' has no declared type
|
in.y:3.32-33: error: $2 of 'exp' has no declared type
|
||||||
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
exp: exp '+' exp @{ $exp = $1 + $2; @};
|
||||||
^^
|
^~
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@@ -10487,6 +10546,61 @@ in.y:3.32-33: error: $2 of ‘exp’ has no declared type
|
|||||||
|
|
||||||
This option is activated by default.
|
This option is activated by default.
|
||||||
|
|
||||||
|
@item fixit
|
||||||
|
@itemx diagnostics-parseable-fixits
|
||||||
|
Show machine-readable fixes, in a manner similar to GCC's and Clang's
|
||||||
|
@option{-fdiagnostics-parseable-fixits}.
|
||||||
|
|
||||||
|
Fix-its are generated for duplicate directives:
|
||||||
|
|
||||||
|
@example
|
||||||
|
@group
|
||||||
|
$ @kbd{cat foo.y}
|
||||||
|
%define api.prefix @{foo@}
|
||||||
|
%define api.prefix @{bar@}
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
@end group
|
||||||
|
|
||||||
|
@group
|
||||||
|
$ @kbd{bison -ffixit foo.y}
|
||||||
|
foo.y:2.1-24: error: %define variable 'api.prefix' redefined
|
||||||
|
%define api.prefix @{bar@}
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
foo.y:1.1-24: previous definition
|
||||||
|
%define api.prefix @{foo@}
|
||||||
|
^~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
fix-it:"foo.y":@{2:1-2:25@}:""
|
||||||
|
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||||
|
@end group
|
||||||
|
@end example
|
||||||
|
|
||||||
|
They are also generated to update deprecated directives, unless
|
||||||
|
@option{-Wno-deprecated} was given:
|
||||||
|
|
||||||
|
@example
|
||||||
|
@group
|
||||||
|
$ @kbd{cat /tmp/foo.yy}
|
||||||
|
%error-verbose
|
||||||
|
%name-prefix "foo"
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
@end group
|
||||||
|
@group
|
||||||
|
$ @kbd{bison foo.y}
|
||||||
|
foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
|
||||||
|
%error-verbose
|
||||||
|
^~~~~~~~~~~~~~
|
||||||
|
foo.y:2.1-18: warning: deprecated directive, use '%define api.prefix @{foo@}' [-Wdeprecated]
|
||||||
|
%name-prefix "foo"
|
||||||
|
^~~~~~~~~~~~~~~~~~
|
||||||
|
foo.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||||
|
@end group
|
||||||
|
@end example
|
||||||
|
|
||||||
|
The fix-its are applied by @command{bison} itself when given the option
|
||||||
|
@option{-u}/@option{--update}. See its documentation above.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@@ -10926,10 +11040,10 @@ int main ()
|
|||||||
Compile, and run!
|
Compile, and run!
|
||||||
|
|
||||||
@example
|
@example
|
||||||
$ bison simple.yy -o simple.cc
|
$ @kbd{bison simple.yy -o simple.cc}
|
||||||
$ g++ -std=c++14 simple.cc -o simple
|
$ @kbd{g++ -std=c++14 simple.cc -o simple}
|
||||||
@group
|
@group
|
||||||
$ ./simple
|
$ @kbd{./simple}
|
||||||
@{I have three numbers for you., 1, 2, 3, And that's all!@}
|
@{I have three numbers for you., 1, 2, 3, And that's all!@}
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: 315eb5ffc1...34881aff40
+45
-36
@@ -8,6 +8,10 @@
|
|||||||
/alignof.h
|
/alignof.h
|
||||||
/alloca.h
|
/alloca.h
|
||||||
/alloca.in.h
|
/alloca.in.h
|
||||||
|
/allocator.c
|
||||||
|
/allocator.h
|
||||||
|
/areadlink.c
|
||||||
|
/areadlink.h
|
||||||
/arg-nonnull.h
|
/arg-nonnull.h
|
||||||
/argmatch.c
|
/argmatch.c
|
||||||
/argmatch.h
|
/argmatch.h
|
||||||
@@ -18,6 +22,11 @@
|
|||||||
/binary-io.h
|
/binary-io.h
|
||||||
/bitrotate.c
|
/bitrotate.c
|
||||||
/bitrotate.h
|
/bitrotate.h
|
||||||
|
/bitset.c
|
||||||
|
/bitset.h
|
||||||
|
/bitset/
|
||||||
|
/bitsetv.c
|
||||||
|
/bitsetv.h
|
||||||
/c++defs.h
|
/c++defs.h
|
||||||
/c-ctype.c
|
/c-ctype.c
|
||||||
/c-ctype.h
|
/c-ctype.h
|
||||||
@@ -26,6 +35,9 @@
|
|||||||
/c-strcaseeq.h
|
/c-strcaseeq.h
|
||||||
/c-strncasecmp.c
|
/c-strncasecmp.c
|
||||||
/calloc.c
|
/calloc.c
|
||||||
|
/canonicalize-lgpl.c
|
||||||
|
/careadlinkat.c
|
||||||
|
/careadlinkat.h
|
||||||
/charset.alias
|
/charset.alias
|
||||||
/cloexec.c
|
/cloexec.c
|
||||||
/cloexec.h
|
/cloexec.h
|
||||||
@@ -78,6 +90,8 @@
|
|||||||
/fseterr.h
|
/fseterr.h
|
||||||
/fstat.c
|
/fstat.c
|
||||||
/getdtablesize.c
|
/getdtablesize.c
|
||||||
|
/gethrxtime.c
|
||||||
|
/gethrxtime.h
|
||||||
/getopt-cdefs.in.h
|
/getopt-cdefs.in.h
|
||||||
/getopt-core.h
|
/getopt-core.h
|
||||||
/getopt-ext.h
|
/getopt-ext.h
|
||||||
@@ -90,7 +104,16 @@
|
|||||||
/getopt_int.h
|
/getopt_int.h
|
||||||
/getprogname.c
|
/getprogname.c
|
||||||
/getprogname.h
|
/getprogname.h
|
||||||
|
/getrusage.c
|
||||||
/gettext.h
|
/gettext.h
|
||||||
|
/gettime.c
|
||||||
|
/gettimeofday.c
|
||||||
|
/gl_array_list.c
|
||||||
|
/gl_array_list.h
|
||||||
|
/gl_list.c
|
||||||
|
/gl_list.h
|
||||||
|
/gl_xlist.c
|
||||||
|
/gl_xlist.h
|
||||||
/gnulib.mk
|
/gnulib.mk
|
||||||
/hard-locale.c
|
/hard-locale.c
|
||||||
/hard-locale.h
|
/hard-locale.h
|
||||||
@@ -112,6 +135,8 @@
|
|||||||
/limits.in.h
|
/limits.in.h
|
||||||
/localcharset.c
|
/localcharset.c
|
||||||
/localcharset.h
|
/localcharset.h
|
||||||
|
/localtime-buffer.c
|
||||||
|
/localtime-buffer.h
|
||||||
/lstat.c
|
/lstat.c
|
||||||
/malloc.c
|
/malloc.c
|
||||||
/malloca.c
|
/malloca.c
|
||||||
@@ -150,17 +175,23 @@
|
|||||||
/printf.c
|
/printf.c
|
||||||
/progname.c
|
/progname.c
|
||||||
/progname.h
|
/progname.h
|
||||||
|
/progreloc.c
|
||||||
/quote.h
|
/quote.h
|
||||||
/quotearg.c
|
/quotearg.c
|
||||||
/quotearg.h
|
/quotearg.h
|
||||||
/raise.c
|
/raise.c
|
||||||
/rawmemchr.c
|
/rawmemchr.c
|
||||||
/rawmemchr.valgrind
|
/rawmemchr.valgrind
|
||||||
|
/readlink.c
|
||||||
/realloc.c
|
/realloc.c
|
||||||
/ref-add.sed
|
/ref-add.sed
|
||||||
/ref-del.sed
|
/ref-del.sed
|
||||||
|
/relocatable.c
|
||||||
|
/relocatable.h
|
||||||
|
/relocwrapper.c
|
||||||
/sched.h
|
/sched.h
|
||||||
/sched.in.h
|
/sched.in.h
|
||||||
|
/setenv.c
|
||||||
/sig-handler.c
|
/sig-handler.c
|
||||||
/sig-handler.h
|
/sig-handler.h
|
||||||
/sigaction.c
|
/sigaction.c
|
||||||
@@ -190,6 +221,8 @@
|
|||||||
/spawnp.c
|
/spawnp.c
|
||||||
/sprintf.c
|
/sprintf.c
|
||||||
/stamp-h1
|
/stamp-h1
|
||||||
|
/stat-time.c
|
||||||
|
/stat-time.h
|
||||||
/stat-w32.c
|
/stat-w32.c
|
||||||
/stat-w32.h
|
/stat-w32.h
|
||||||
/stat.c
|
/stat.c
|
||||||
@@ -223,13 +256,20 @@
|
|||||||
/strverscmp.c
|
/strverscmp.c
|
||||||
/sys
|
/sys
|
||||||
/sys_ioctl.in.h
|
/sys_ioctl.in.h
|
||||||
|
/sys_resource.in.h
|
||||||
/sys_socket.in.h
|
/sys_socket.in.h
|
||||||
/sys_stat.in.h
|
/sys_stat.in.h
|
||||||
|
/sys_time.in.h
|
||||||
|
/sys_times.in.h
|
||||||
/sys_types.in.h
|
/sys_types.in.h
|
||||||
/sys_wait.in.h
|
/sys_wait.in.h
|
||||||
/sysexits.in.h
|
/sysexits.in.h
|
||||||
/time.h
|
/time.h
|
||||||
/time.in.h
|
/time.in.h
|
||||||
|
/timespec.c
|
||||||
|
/timespec.h
|
||||||
|
/timevar.c
|
||||||
|
/timevar.h
|
||||||
/unistd--.h
|
/unistd--.h
|
||||||
/unistd-safer.h
|
/unistd-safer.h
|
||||||
/unistd.c
|
/unistd.c
|
||||||
@@ -267,45 +307,14 @@
|
|||||||
/xmalloc.c
|
/xmalloc.c
|
||||||
/xmemdup0.c
|
/xmemdup0.c
|
||||||
/xmemdup0.h
|
/xmemdup0.h
|
||||||
|
/xreadlink.c
|
||||||
|
/xreadlink.h
|
||||||
/xsize.c
|
/xsize.c
|
||||||
/xsize.h
|
/xsize.h
|
||||||
/xstrndup.c
|
/xstrndup.c
|
||||||
/xstrndup.h
|
/xstrndup.h
|
||||||
/stat-time.c
|
|
||||||
/stat-time.h
|
|
||||||
/timevar.c
|
|
||||||
/timevar.h
|
|
||||||
/sys_time.in.h
|
|
||||||
/sys_times.in.h
|
|
||||||
/gethrxtime.c
|
|
||||||
/gethrxtime.h
|
|
||||||
/getrusage.c
|
|
||||||
/gettime.c
|
|
||||||
/gettimeofday.c
|
|
||||||
/localtime-buffer.c
|
|
||||||
/localtime-buffer.h
|
|
||||||
/sys_resource.in.h
|
|
||||||
/timespec.c
|
|
||||||
/timespec.h
|
|
||||||
/xtime.c
|
/xtime.c
|
||||||
/xtime.h
|
/xtime.h
|
||||||
/bitset.c
|
/rename.c
|
||||||
/bitset.h
|
/rmdir.c
|
||||||
/bitset/
|
/same-inode.h
|
||||||
/bitsetv.c
|
|
||||||
/bitsetv.h
|
|
||||||
/allocator.c
|
|
||||||
/allocator.h
|
|
||||||
/areadlink.c
|
|
||||||
/areadlink.h
|
|
||||||
/canonicalize-lgpl.c
|
|
||||||
/careadlinkat.c
|
|
||||||
/careadlinkat.h
|
|
||||||
/progreloc.c
|
|
||||||
/readlink.c
|
|
||||||
/relocatable.c
|
|
||||||
/relocatable.h
|
|
||||||
/relocwrapper.c
|
|
||||||
/setenv.c
|
|
||||||
/xreadlink.c
|
|
||||||
/xreadlink.h
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
src/complain.c
|
src/complain.c
|
||||||
src/conflicts.c
|
src/conflicts.c
|
||||||
src/files.c
|
src/files.c
|
||||||
|
src/fixits.c
|
||||||
src/getargs.c
|
src/getargs.c
|
||||||
src/gram.c
|
src/gram.c
|
||||||
src/graphviz.c
|
src/graphviz.c
|
||||||
|
|||||||
+25
-3
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "complain.h"
|
#include "complain.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
#include "fixits.h"
|
||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
|
|
||||||
@@ -278,15 +279,18 @@ error_message (const location *loc, warnings flags, const char *prefix,
|
|||||||
*indent_ptr = pos;
|
*indent_ptr = pos;
|
||||||
else if (*indent_ptr > pos)
|
else if (*indent_ptr > pos)
|
||||||
fprintf (stderr, "%*s", *indent_ptr - pos, "");
|
fprintf (stderr, "%*s", *indent_ptr - pos, "");
|
||||||
indent_ptr = 0;
|
indent_ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
fprintf (stderr, "%s: ", prefix);
|
fprintf (stderr, "%s: ", prefix);
|
||||||
|
|
||||||
vfprintf (stderr, message, args);
|
vfprintf (stderr, message, args);
|
||||||
if (! (flags & silent))
|
/* Print the type of warning, only if this is not a sub message
|
||||||
|
(in which case the prefix is null). */
|
||||||
|
if (! (flags & silent) && prefix)
|
||||||
warnings_print_categories (flags, stderr);
|
warnings_print_categories (flags, stderr);
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t l = strlen (message);
|
size_t l = strlen (message);
|
||||||
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
||||||
@@ -393,6 +397,9 @@ deprecated_directive (location const *loc, char const *old, char const *upd)
|
|||||||
complain (loc, Wdeprecated,
|
complain (loc, Wdeprecated,
|
||||||
_("deprecated directive: %s, use %s"),
|
_("deprecated directive: %s, use %s"),
|
||||||
quote (old), quote_n (1, upd));
|
quote (old), quote_n (1, upd));
|
||||||
|
/* Register updates only if -Wdeprecated is enabled. */
|
||||||
|
if (warnings_flag[warning_deprecated] != severity_disabled)
|
||||||
|
fixits_register (loc, upd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -400,7 +407,22 @@ duplicate_directive (char const *directive,
|
|||||||
location first, location second)
|
location first, location second)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
complain (&second, complaint, _("only one %s allowed per rule"), directive);
|
if (feature_flag & feature_caret)
|
||||||
|
complain_indent (&second, Wother, &i, _("duplicate directive"));
|
||||||
|
else
|
||||||
|
complain_indent (&second, Wother, &i, _("duplicate directive: %s"), quote (directive));
|
||||||
|
i += SUB_INDENT;
|
||||||
|
complain_indent (&first, Wother, &i, _("previous declaration"));
|
||||||
|
fixits_register (&second, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
duplicate_rule_directive (char const *directive,
|
||||||
|
location first, location second)
|
||||||
|
{
|
||||||
|
unsigned i = 0;
|
||||||
|
complain_indent (&second, complaint, &i, _("only one %s allowed per rule"), directive);
|
||||||
i += SUB_INDENT;
|
i += SUB_INDENT;
|
||||||
complain_indent (&first, complaint, &i, _("previous declaration"));
|
complain_indent (&first, complaint, &i, _("previous declaration"));
|
||||||
|
fixits_register (&second, "");
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -126,10 +126,14 @@ void bison_directive (location const *loc, char const *directive);
|
|||||||
void deprecated_directive (location const *loc,
|
void deprecated_directive (location const *loc,
|
||||||
char const *obsolete, char const *updated);
|
char const *obsolete, char const *updated);
|
||||||
|
|
||||||
/** Report a repeated directive for a rule. */
|
/** Report a repeated directive. */
|
||||||
void duplicate_directive (char const *directive,
|
void duplicate_directive (char const *directive,
|
||||||
location first, location second);
|
location first, location second);
|
||||||
|
|
||||||
|
/** Report a repeated directive for a rule. */
|
||||||
|
void duplicate_rule_directive (char const *directive,
|
||||||
|
location first, location second);
|
||||||
|
|
||||||
/** Warnings treated as errors shouldn't stop the execution as regular
|
/** Warnings treated as errors shouldn't stop the execution as regular
|
||||||
errors should (because due to their nature, it is safe to go
|
errors should (because due to their nature, it is safe to go
|
||||||
on). Thus, there are three possible execution statuses. */
|
on). Thus, there are three possible execution statuses. */
|
||||||
|
|||||||
+24
-31
@@ -43,7 +43,9 @@
|
|||||||
|
|
||||||
char const *spec_outfile = NULL; /* for -o. */
|
char const *spec_outfile = NULL; /* for -o. */
|
||||||
char const *spec_file_prefix = NULL; /* for -b. */
|
char const *spec_file_prefix = NULL; /* for -b. */
|
||||||
|
location spec_file_prefix_loc = EMPTY_LOCATION_INIT;
|
||||||
char const *spec_name_prefix = NULL; /* for -p. */
|
char const *spec_name_prefix = NULL; /* for -p. */
|
||||||
|
location spec_name_prefix_loc = EMPTY_LOCATION_INIT;
|
||||||
char *spec_verbose_file = NULL; /* for --verbose. */
|
char *spec_verbose_file = NULL; /* for --verbose. */
|
||||||
char *spec_graph_file = NULL; /* for -g. */
|
char *spec_graph_file = NULL; /* for -g. */
|
||||||
char *spec_xml_file = NULL; /* for -x. */
|
char *spec_xml_file = NULL; /* for -x. */
|
||||||
@@ -115,14 +117,12 @@ concat2 (char const *str1, char const *str2)
|
|||||||
FILE *
|
FILE *
|
||||||
xfopen (const char *name, const char *mode)
|
xfopen (const char *name, const char *mode)
|
||||||
{
|
{
|
||||||
FILE *ptr;
|
FILE *res = fopen_safer (name, mode);
|
||||||
|
if (!res)
|
||||||
ptr = fopen_safer (name, mode);
|
|
||||||
if (!ptr)
|
|
||||||
error (EXIT_FAILURE, get_errno (),
|
error (EXIT_FAILURE, get_errno (),
|
||||||
_("%s: cannot open"), quotearg_colon (name));
|
_("%s: cannot open"), quotearg_colon (name));
|
||||||
|
|
||||||
return ptr;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------.
|
/*-------------------------------------------------------------.
|
||||||
@@ -243,19 +243,18 @@ file_name_split (const char *file_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compute ALL_BUT_EXT and ALL_BUT_TAB_EXT from SPEC_OUTFILE or
|
||||||
|
GRAMMAR_FILE.
|
||||||
|
|
||||||
|
The precise -o name will be used for FTABLE. For other output
|
||||||
|
files, remove the ".c" or ".tab.c" suffix. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compute_file_name_parts (void)
|
compute_file_name_parts (void)
|
||||||
{
|
{
|
||||||
const char *base, *tab, *ext;
|
|
||||||
|
|
||||||
/* Compute ALL_BUT_EXT and ALL_BUT_TAB_EXT from SPEC_OUTFILE
|
|
||||||
or GRAMMAR_FILE.
|
|
||||||
|
|
||||||
The precise -o name will be used for FTABLE. For other output
|
|
||||||
files, remove the ".c" or ".tab.c" suffix. */
|
|
||||||
if (spec_outfile)
|
if (spec_outfile)
|
||||||
{
|
{
|
||||||
|
const char *base, *tab, *ext;
|
||||||
file_name_split (spec_outfile, &base, &tab, &ext);
|
file_name_split (spec_outfile, &base, &tab, &ext);
|
||||||
dir_prefix = xstrndup (spec_outfile, base - spec_outfile);
|
dir_prefix = xstrndup (spec_outfile, base - spec_outfile);
|
||||||
|
|
||||||
@@ -275,6 +274,7 @@ compute_file_name_parts (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const char *base, *tab, *ext;
|
||||||
file_name_split (grammar_file, &base, &tab, &ext);
|
file_name_split (grammar_file, &base, &tab, &ext);
|
||||||
|
|
||||||
if (spec_file_prefix)
|
if (spec_file_prefix)
|
||||||
@@ -285,7 +285,7 @@ compute_file_name_parts (void)
|
|||||||
last_component (spec_file_prefix) - spec_file_prefix);
|
last_component (spec_file_prefix) - spec_file_prefix);
|
||||||
all_but_tab_ext = xstrdup (spec_file_prefix);
|
all_but_tab_ext = xstrdup (spec_file_prefix);
|
||||||
}
|
}
|
||||||
else if (yacc_flag)
|
else if (! location_empty (yacc_loc))
|
||||||
{
|
{
|
||||||
/* If --yacc, then the output is 'y.tab.c'. */
|
/* If --yacc, then the output is 'y.tab.c'. */
|
||||||
dir_prefix = xstrdup ("");
|
dir_prefix = xstrdup ("");
|
||||||
@@ -306,7 +306,7 @@ compute_file_name_parts (void)
|
|||||||
all_but_ext = xstrdup (all_but_tab_ext);
|
all_but_ext = xstrdup (all_but_tab_ext);
|
||||||
|
|
||||||
/* Compute the extensions from the grammar file name. */
|
/* Compute the extensions from the grammar file name. */
|
||||||
if (ext && !yacc_flag)
|
if (ext && location_empty (yacc_loc))
|
||||||
compute_exts_from_gf (ext);
|
compute_exts_from_gf (ext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -374,16 +374,13 @@ output_file_name_check (char **file_name, bool source)
|
|||||||
conflict = true;
|
conflict = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
for (int i = 0; i < generated_files_size; i++)
|
||||||
int i;
|
if (STREQ (generated_files[i].name, *file_name))
|
||||||
for (i = 0; i < generated_files_size; i++)
|
{
|
||||||
if (STREQ (generated_files[i].name, *file_name))
|
complain (NULL, Wother, _("conflicting outputs to file %s"),
|
||||||
{
|
quote (generated_files[i].name));
|
||||||
complain (NULL, Wother, _("conflicting outputs to file %s"),
|
conflict = true;
|
||||||
quote (generated_files[i].name));
|
}
|
||||||
conflict = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (conflict)
|
if (conflict)
|
||||||
{
|
{
|
||||||
free (*file_name);
|
free (*file_name);
|
||||||
@@ -401,8 +398,7 @@ output_file_name_check (char **file_name, bool source)
|
|||||||
void
|
void
|
||||||
unlink_generated_sources (void)
|
unlink_generated_sources (void)
|
||||||
{
|
{
|
||||||
int i;
|
for (int i = 0; i < generated_files_size; i++)
|
||||||
for (i = 0; i < generated_files_size; i++)
|
|
||||||
if (generated_files[i].is_source)
|
if (generated_files[i].is_source)
|
||||||
/* Ignore errors. The file might not even exist. */
|
/* Ignore errors. The file might not even exist. */
|
||||||
unlink (generated_files[i].name);
|
unlink (generated_files[i].name);
|
||||||
@@ -418,10 +414,7 @@ output_file_names_free (void)
|
|||||||
free (spec_defines_file);
|
free (spec_defines_file);
|
||||||
free (parser_file_name);
|
free (parser_file_name);
|
||||||
free (dir_prefix);
|
free (dir_prefix);
|
||||||
{
|
for (int i = 0; i < generated_files_size; i++)
|
||||||
int i;
|
free (generated_files[i].name);
|
||||||
for (i = 0; i < generated_files_size; i++)
|
|
||||||
free (generated_files[i].name);
|
|
||||||
}
|
|
||||||
free (generated_files);
|
free (generated_files);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -21,6 +21,7 @@
|
|||||||
#ifndef FILES_H_
|
#ifndef FILES_H_
|
||||||
# define FILES_H_
|
# define FILES_H_
|
||||||
|
|
||||||
|
# include "location.h"
|
||||||
# include "uniqstr.h"
|
# include "uniqstr.h"
|
||||||
|
|
||||||
/* File name specified with -o for the output file, or 0 if no -o. */
|
/* File name specified with -o for the output file, or 0 if no -o. */
|
||||||
@@ -31,9 +32,11 @@ extern char *parser_file_name;
|
|||||||
|
|
||||||
/* Symbol prefix specified with -p, or 0 if no -p. */
|
/* Symbol prefix specified with -p, or 0 if no -p. */
|
||||||
extern const char *spec_name_prefix;
|
extern const char *spec_name_prefix;
|
||||||
|
extern location spec_name_prefix_loc;
|
||||||
|
|
||||||
/* File name prefix specified with -b, or 0 if no -b. */
|
/* File name prefix specified with -b, or 0 if no -b. */
|
||||||
extern char const *spec_file_prefix;
|
extern char const *spec_file_prefix;
|
||||||
|
extern location spec_file_prefix_loc;
|
||||||
|
|
||||||
/* --verbose. */
|
/* --verbose. */
|
||||||
extern char *spec_verbose_file;
|
extern char *spec_verbose_file;
|
||||||
@@ -55,7 +58,7 @@ extern char *dir_prefix;
|
|||||||
and therefore GCC warns about a name clash. */
|
and therefore GCC warns about a name clash. */
|
||||||
extern uniqstr grammar_file;
|
extern uniqstr grammar_file;
|
||||||
|
|
||||||
/* The current file name. Might change with %include, or with #line. */
|
/* The current file name. Might change with #line. */
|
||||||
extern uniqstr current_file;
|
extern uniqstr current_file;
|
||||||
|
|
||||||
/* The computed base for output file names. */
|
/* The computed base for output file names. */
|
||||||
|
|||||||
+212
@@ -0,0 +1,212 @@
|
|||||||
|
/* Support for fixing grammar files.
|
||||||
|
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include "fixits.h"
|
||||||
|
|
||||||
|
#include "system.h"
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
#include "get-errno.h"
|
||||||
|
#include "getargs.h"
|
||||||
|
#include "gl_array_list.h"
|
||||||
|
#include "gl_xlist.h"
|
||||||
|
#include "progname.h"
|
||||||
|
#include "quote.h"
|
||||||
|
#include "quotearg.h"
|
||||||
|
#include "vasnprintf.h"
|
||||||
|
|
||||||
|
#include "files.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
location location;
|
||||||
|
char *fix;
|
||||||
|
} fixit;
|
||||||
|
|
||||||
|
gl_list_t fixits = NULL;
|
||||||
|
|
||||||
|
static fixit *
|
||||||
|
fixit_new (location const *loc, char const* fix)
|
||||||
|
{
|
||||||
|
fixit *res = xmalloc (sizeof *res);
|
||||||
|
res->location = *loc;
|
||||||
|
res->fix = xstrdup (fix);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
fixit_free (fixit *f)
|
||||||
|
{
|
||||||
|
free (f->fix);
|
||||||
|
free (f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* GCC and Clang follow the same pattern.
|
||||||
|
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
|
||||||
|
http://clang.llvm.org/docs/UsersManual.html#cmdoption-fdiagnostics-parseable-fixits */
|
||||||
|
static void
|
||||||
|
fixit_print (fixit const *f, FILE *out)
|
||||||
|
{
|
||||||
|
fprintf (out, "fix-it:%s:{%d:%d-%d:%d}:%s\n",
|
||||||
|
quotearg_n_style (1, c_quoting_style, f->location.start.file),
|
||||||
|
f->location.start.line, f->location.start.column,
|
||||||
|
f->location.end.line, f->location.end.column,
|
||||||
|
quotearg_n_style (2, c_quoting_style, f->fix));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
fixits_register (location const *loc, char const* fix)
|
||||||
|
{
|
||||||
|
if (!fixits)
|
||||||
|
fixits = gl_list_create_empty (GL_ARRAY_LIST,
|
||||||
|
/* equals */ NULL,
|
||||||
|
/* hashcode */ NULL,
|
||||||
|
(gl_listelement_dispose_fn) fixit_free,
|
||||||
|
true);
|
||||||
|
fixit *f = fixit_new (loc, fix);
|
||||||
|
gl_list_add_last (fixits, f);
|
||||||
|
if (feature_flag & feature_fixit_parsable)
|
||||||
|
fixit_print (f, stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
fixits_empty (void)
|
||||||
|
{
|
||||||
|
return !fixits;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
fixits_run (void)
|
||||||
|
{
|
||||||
|
if (!fixits)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* This is not unlike what is done in location_caret. */
|
||||||
|
uniqstr input = ((fixit *) gl_list_get_at (fixits, 0))->location.start.file;
|
||||||
|
/* Backup the file. */
|
||||||
|
char buf[256];
|
||||||
|
size_t len = sizeof (buf);
|
||||||
|
char *backup = asnprintf (buf, &len, "%s~", input);
|
||||||
|
if (!backup)
|
||||||
|
xalloc_die ();
|
||||||
|
if (rename (input, backup))
|
||||||
|
error (EXIT_FAILURE, get_errno (),
|
||||||
|
_("%s: cannot backup"), quotearg_colon (input));
|
||||||
|
FILE *in = xfopen (backup, "r");
|
||||||
|
FILE *out = xfopen (input, "w");
|
||||||
|
size_t line = 1;
|
||||||
|
size_t offset = 1;
|
||||||
|
fixit const *f = NULL;
|
||||||
|
gl_list_iterator_t iter = gl_list_iterator (fixits);
|
||||||
|
while (gl_list_iterator_next (&iter, (const void**) &f, NULL))
|
||||||
|
{
|
||||||
|
/* Look for the correct line. */
|
||||||
|
while (line < f->location.start.line)
|
||||||
|
{
|
||||||
|
int c = getc (in);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
if (c == '\n')
|
||||||
|
{
|
||||||
|
++line;
|
||||||
|
offset = 1;
|
||||||
|
}
|
||||||
|
putc (c, out);
|
||||||
|
}
|
||||||
|
/* Look for the right offset. */
|
||||||
|
while (offset < f->location.start.column)
|
||||||
|
{
|
||||||
|
int c = getc (in);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
++offset;
|
||||||
|
putc (c, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Paste the fix instead. */
|
||||||
|
fputs (f->fix, out);
|
||||||
|
|
||||||
|
/* Skip the bad input. */
|
||||||
|
while (line < f->location.end.line)
|
||||||
|
{
|
||||||
|
int c = getc (in);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
if (c == '\n')
|
||||||
|
{
|
||||||
|
++line;
|
||||||
|
offset = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (offset < f->location.end.column)
|
||||||
|
{
|
||||||
|
int c = getc (in);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
++offset;
|
||||||
|
}
|
||||||
|
/* If erasing the content of a full line, also remove the
|
||||||
|
end-of-line. */
|
||||||
|
if (f->fix[0] == 0 && f->location.start.column == 1)
|
||||||
|
{
|
||||||
|
int c = getc (in);
|
||||||
|
if (c == EOF)
|
||||||
|
break;
|
||||||
|
else if (c == '\n')
|
||||||
|
{
|
||||||
|
++line;
|
||||||
|
offset = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ungetc (c, in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Paste the rest of the file. */
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
while ((c = getc (in)) != EOF)
|
||||||
|
putc (c, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_list_iterator_free (&iter);
|
||||||
|
xfclose (out);
|
||||||
|
xfclose (in);
|
||||||
|
fprintf (stderr, "%s: file %s was updated (backup: %s)\n",
|
||||||
|
program_name, quote_n (0, input), quote_n (1, backup));
|
||||||
|
if (backup != buf)
|
||||||
|
free (backup);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free the registered fixits. */
|
||||||
|
void fixits_free (void)
|
||||||
|
{
|
||||||
|
if (fixits)
|
||||||
|
{
|
||||||
|
gl_list_free (fixits);
|
||||||
|
fixits = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/* Support for fixing grammar files.
|
||||||
|
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifndef FIXITS_H_
|
||||||
|
# define FIXITS_H_ 1
|
||||||
|
|
||||||
|
# include "location.h"
|
||||||
|
|
||||||
|
/* Declare a fix to apply. */
|
||||||
|
void fixits_register (location const *loc, char const* update);
|
||||||
|
|
||||||
|
/* Apply the fixits: update the source file. */
|
||||||
|
void fixits_run (void);
|
||||||
|
|
||||||
|
/* Whether there are no fixits. */
|
||||||
|
bool fixits_empty (void);
|
||||||
|
|
||||||
|
/* Free the registered fixits. */
|
||||||
|
void fixits_free (void);
|
||||||
|
|
||||||
|
#endif /* !FIXITS_H_ */
|
||||||
+19
-7
@@ -36,12 +36,13 @@
|
|||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "uniqstr.h"
|
#include "uniqstr.h"
|
||||||
|
|
||||||
bool defines_flag;
|
bool defines_flag = false;
|
||||||
bool graph_flag;
|
bool graph_flag = false;
|
||||||
bool xml_flag;
|
bool xml_flag = false;
|
||||||
bool no_lines_flag;
|
bool no_lines_flag = false;
|
||||||
bool token_table_flag;
|
bool token_table_flag = false;
|
||||||
bool yacc_flag; /* for -y */
|
location yacc_loc = EMPTY_LOCATION_INIT;
|
||||||
|
bool update_flag = false; /* for -u */
|
||||||
|
|
||||||
bool nondeterministic_parser = false;
|
bool nondeterministic_parser = false;
|
||||||
bool glr_parser = false;
|
bool glr_parser = false;
|
||||||
@@ -228,6 +229,7 @@ static const char * const feature_args[] =
|
|||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"caret", "diagnostics-show-caret",
|
"caret", "diagnostics-show-caret",
|
||||||
|
"fixit", "diagnostics-parseable-fixits",
|
||||||
"all",
|
"all",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
@@ -236,6 +238,7 @@ static const int feature_types[] =
|
|||||||
{
|
{
|
||||||
feature_none,
|
feature_none,
|
||||||
feature_caret, feature_caret,
|
feature_caret, feature_caret,
|
||||||
|
feature_fixit_parsable, feature_fixit_parsable,
|
||||||
feature_all
|
feature_all
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -281,7 +284,10 @@ Operation modes:\n\
|
|||||||
-h, --help display this help and exit\n\
|
-h, --help display this help and exit\n\
|
||||||
-V, --version output version information and exit\n\
|
-V, --version output version information and exit\n\
|
||||||
--print-localedir output directory containing locale-dependent data\n\
|
--print-localedir output directory containing locale-dependent data\n\
|
||||||
|
and exit\n\
|
||||||
--print-datadir output directory containing skeletons and XSLT\n\
|
--print-datadir output directory containing skeletons and XSLT\n\
|
||||||
|
and exit\n\
|
||||||
|
-u, --update apply fixes to the source grammar file and exit\n\
|
||||||
-y, --yacc emulate POSIX Yacc\n\
|
-y, --yacc emulate POSIX Yacc\n\
|
||||||
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
|
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
|
||||||
-f, --feature[=FEATURE] activate miscellaneous features\n\
|
-f, --feature[=FEATURE] activate miscellaneous features\n\
|
||||||
@@ -476,6 +482,7 @@ static char const short_options[] =
|
|||||||
"p:"
|
"p:"
|
||||||
"r:"
|
"r:"
|
||||||
"t"
|
"t"
|
||||||
|
"u" /* --update */
|
||||||
"v"
|
"v"
|
||||||
"x::"
|
"x::"
|
||||||
"y"
|
"y"
|
||||||
@@ -497,6 +504,7 @@ static struct option const long_options[] =
|
|||||||
{ "version", no_argument, 0, 'V' },
|
{ "version", no_argument, 0, 'V' },
|
||||||
{ "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION },
|
{ "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION },
|
||||||
{ "print-datadir", no_argument, 0, PRINT_DATADIR_OPTION },
|
{ "print-datadir", no_argument, 0, PRINT_DATADIR_OPTION },
|
||||||
|
{ "update", no_argument, 0, 'u' },
|
||||||
{ "warnings", optional_argument, 0, 'W' },
|
{ "warnings", optional_argument, 0, 'W' },
|
||||||
|
|
||||||
/* Parser. */
|
/* Parser. */
|
||||||
@@ -682,6 +690,10 @@ getargs (int argc, char *argv[])
|
|||||||
MUSCLE_PERCENT_DEFINE_D);
|
MUSCLE_PERCENT_DEFINE_D);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
update_flag = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
report_flag |= report_states;
|
report_flag |= report_states;
|
||||||
break;
|
break;
|
||||||
@@ -697,7 +709,7 @@ getargs (int argc, char *argv[])
|
|||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
warning_argmatch ("error=yacc", 0, 6);
|
warning_argmatch ("error=yacc", 0, 6);
|
||||||
yacc_flag = true;
|
yacc_loc = command_line_location ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOCATIONS_OPTION:
|
case LOCATIONS_OPTION:
|
||||||
|
|||||||
+6
-5
@@ -39,8 +39,8 @@ extern bool graph_flag; /* for -g */
|
|||||||
extern bool xml_flag; /* for -x */
|
extern bool xml_flag; /* for -x */
|
||||||
extern bool no_lines_flag; /* for -l */
|
extern bool no_lines_flag; /* for -l */
|
||||||
extern bool token_table_flag; /* for -k */
|
extern bool token_table_flag; /* for -k */
|
||||||
extern bool yacc_flag; /* for -y */
|
extern location yacc_loc; /* for -y */
|
||||||
|
extern bool update_flag; /* for -u */
|
||||||
|
|
||||||
/* GLR_PARSER is true if the input file says to use the GLR
|
/* GLR_PARSER is true if the input file says to use the GLR
|
||||||
(Generalized LR) parser, and to output some additional information
|
(Generalized LR) parser, and to output some additional information
|
||||||
@@ -114,9 +114,10 @@ extern int trace_flag;
|
|||||||
|
|
||||||
enum feature
|
enum feature
|
||||||
{
|
{
|
||||||
feature_none = 0, /**< No additional feature. */
|
feature_none = 0, /**< No additional feature. */
|
||||||
feature_caret = 1 << 0, /**< Enhance the output of errors with carets. */
|
feature_caret = 1 << 0, /**< Output errors with carets. */
|
||||||
feature_all = ~0 /**< All above features. */
|
feature_fixit_parsable = 1 << 1, /**< Issue instructions to fix the sources. */
|
||||||
|
feature_all = ~0 /**< All above features. */
|
||||||
};
|
};
|
||||||
/** What additional features to use. */
|
/** What additional features to use. */
|
||||||
extern int feature_flag;
|
extern int feature_flag;
|
||||||
|
|||||||
+1
-1
@@ -329,7 +329,7 @@ state_lookahead_tokens_count (state *s, bool default_reduction_only_for_accept)
|
|||||||
&& default_reduction_only_for_accept))
|
&& default_reduction_only_for_accept))
|
||||||
n_lookahead_tokens += rp->num;
|
n_lookahead_tokens += rp->num;
|
||||||
else
|
else
|
||||||
s->consistent = 1;
|
s->consistent = true;
|
||||||
|
|
||||||
return n_lookahead_tokens;
|
return n_lookahead_tokens;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ src_bison_SOURCES = \
|
|||||||
src/derives.h \
|
src/derives.h \
|
||||||
src/files.c \
|
src/files.c \
|
||||||
src/files.h \
|
src/files.h \
|
||||||
|
src/fixits.c \
|
||||||
|
src/fixits.h \
|
||||||
src/flex-scanner.h \
|
src/flex-scanner.h \
|
||||||
src/getargs.c \
|
src/getargs.c \
|
||||||
src/getargs.h \
|
src/getargs.h \
|
||||||
|
|||||||
+8
-1
@@ -209,13 +209,20 @@ location_caret (location loc, FILE *out)
|
|||||||
/* Print the carets (at least one), with the same indent as above.*/
|
/* Print the carets (at least one), with the same indent as above.*/
|
||||||
fprintf (out, " %*s", loc.start.column - 1, "");
|
fprintf (out, " %*s", loc.start.column - 1, "");
|
||||||
for (i = loc.start.column; i == loc.start.column || i < len; ++i)
|
for (i = loc.start.column; i == loc.start.column || i < len; ++i)
|
||||||
putc ('^', out);
|
putc (i == loc.start.column ? '^' : '~', out);
|
||||||
}
|
}
|
||||||
putc ('\n', out);
|
putc ('\n', out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
location_empty (location loc)
|
||||||
|
{
|
||||||
|
return !loc.start.file && !loc.start.line && !loc.start.column
|
||||||
|
&& !loc.end.file && !loc.end.line && !loc.end.column;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
boundary_set_from_string (boundary *bound, char *loc_str)
|
boundary_set_from_string (boundary *bound, char *loc_str)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ location_cmp (location a, location b)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Whether this is the empty location. */
|
||||||
|
bool location_empty (location loc);
|
||||||
|
|
||||||
/* LOC_STR must be formatted as 'file:line.column', it will be modified. */
|
/* LOC_STR must be formatted as 'file:line.column', it will be modified. */
|
||||||
void boundary_set_from_string (boundary *bound, char *loc_str);
|
void boundary_set_from_string (boundary *bound, char *loc_str);
|
||||||
|
|
||||||
|
|||||||
+45
-26
@@ -35,6 +35,7 @@
|
|||||||
#include "conflicts.h"
|
#include "conflicts.h"
|
||||||
#include "derives.h"
|
#include "derives.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
#include "fixits.h"
|
||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
#include "gram.h"
|
#include "gram.h"
|
||||||
#include "lalr.h"
|
#include "lalr.h"
|
||||||
@@ -154,31 +155,34 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
print_precedence_warnings ();
|
print_precedence_warnings ();
|
||||||
|
|
||||||
/* Output file names. */
|
if (!update_flag)
|
||||||
compute_output_file_names ();
|
|
||||||
|
|
||||||
/* Output the detailed report on the grammar. */
|
|
||||||
if (report_flag)
|
|
||||||
{
|
{
|
||||||
timevar_push (tv_report);
|
/* Output file names. */
|
||||||
print_results ();
|
compute_output_file_names ();
|
||||||
timevar_pop (tv_report);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Output the graph. */
|
/* Output the detailed report on the grammar. */
|
||||||
if (graph_flag)
|
if (report_flag)
|
||||||
{
|
{
|
||||||
timevar_push (tv_graph);
|
timevar_push (tv_report);
|
||||||
print_graph ();
|
print_results ();
|
||||||
timevar_pop (tv_graph);
|
timevar_pop (tv_report);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output xml. */
|
/* Output the graph. */
|
||||||
if (xml_flag)
|
if (graph_flag)
|
||||||
{
|
{
|
||||||
timevar_push (tv_xml);
|
timevar_push (tv_graph);
|
||||||
print_xml ();
|
print_graph ();
|
||||||
timevar_pop (tv_xml);
|
timevar_pop (tv_graph);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output xml. */
|
||||||
|
if (xml_flag)
|
||||||
|
{
|
||||||
|
timevar_push (tv_xml);
|
||||||
|
print_xml ();
|
||||||
|
timevar_pop (tv_xml);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop if there were errors, to avoid trashing previous output
|
/* Stop if there were errors, to avoid trashing previous output
|
||||||
@@ -192,9 +196,12 @@ main (int argc, char *argv[])
|
|||||||
timevar_pop (tv_free);
|
timevar_pop (tv_free);
|
||||||
|
|
||||||
/* Output the tables and the parser to ftable. In file output. */
|
/* Output the tables and the parser to ftable. In file output. */
|
||||||
timevar_push (tv_parser);
|
if (!update_flag)
|
||||||
output ();
|
{
|
||||||
timevar_pop (tv_parser);
|
timevar_push (tv_parser);
|
||||||
|
output ();
|
||||||
|
timevar_pop (tv_parser);
|
||||||
|
}
|
||||||
|
|
||||||
timevar_push (tv_free);
|
timevar_push (tv_free);
|
||||||
nullable_free ();
|
nullable_free ();
|
||||||
@@ -210,7 +217,6 @@ main (int argc, char *argv[])
|
|||||||
contains things such as user actions, prologue, epilogue etc. */
|
contains things such as user actions, prologue, epilogue etc. */
|
||||||
gram_scanner_free ();
|
gram_scanner_free ();
|
||||||
muscle_free ();
|
muscle_free ();
|
||||||
uniqstrs_free ();
|
|
||||||
code_scanner_free ();
|
code_scanner_free ();
|
||||||
skel_scanner_free ();
|
skel_scanner_free ();
|
||||||
quotearg_free ();
|
quotearg_free ();
|
||||||
@@ -227,5 +233,18 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
cleanup_caret ();
|
cleanup_caret ();
|
||||||
|
|
||||||
|
/* Fix input file now, even if there are errors: that's less
|
||||||
|
warnings in the following runs. */
|
||||||
|
if (!fixits_empty ())
|
||||||
|
{
|
||||||
|
if (update_flag)
|
||||||
|
fixits_run ();
|
||||||
|
else
|
||||||
|
complain (NULL, Wother,
|
||||||
|
_("fix-its can be applied. Rerun with option '--update'."));
|
||||||
|
fixits_free ();
|
||||||
|
}
|
||||||
|
uniqstrs_free ();
|
||||||
|
|
||||||
return complaint_status ? EXIT_FAILURE : EXIT_SUCCESS;
|
return complaint_status ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
+66
-40
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "complain.h"
|
#include "complain.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
#include "fixits.h"
|
||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
#include "muscle-tab.h"
|
#include "muscle-tab.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
@@ -429,12 +430,14 @@ define_directive (char const *assignment,
|
|||||||
/** If the \a variable name is obsolete, return the name to use,
|
/** If the \a variable name is obsolete, return the name to use,
|
||||||
* otherwise \a variable. If the \a value is obsolete, update it too.
|
* otherwise \a variable. If the \a value is obsolete, update it too.
|
||||||
*
|
*
|
||||||
* Allocates the returned value. */
|
* Allocates the returned value if needed, otherwise the returned
|
||||||
|
* value is exactly \a variable. */
|
||||||
static
|
static
|
||||||
char *
|
char const *
|
||||||
muscle_percent_variable_update (char const *variable, location variable_loc,
|
muscle_percent_variable_update (char const *variable,
|
||||||
muscle_kind kind,
|
muscle_kind kind,
|
||||||
char const **value)
|
char const **value,
|
||||||
|
char **old, char **upd)
|
||||||
{
|
{
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -444,8 +447,15 @@ muscle_percent_variable_update (char const *variable, location variable_loc,
|
|||||||
} conversion_type;
|
} conversion_type;
|
||||||
const conversion_type conversion[] =
|
const conversion_type conversion[] =
|
||||||
{
|
{
|
||||||
|
{ "%error-verbose", "parse.error=verbose", muscle_keyword },
|
||||||
|
{ "%error_verbose", "parse.error=verbose", muscle_keyword },
|
||||||
|
{ "abstract", "api.parser.abstract", muscle_keyword },
|
||||||
|
{ "annotations", "api.parser.annotations", muscle_code },
|
||||||
{ "api.push_pull", "api.push-pull", muscle_keyword },
|
{ "api.push_pull", "api.push-pull", muscle_keyword },
|
||||||
{ "api.tokens.prefix", "api.token.prefix", muscle_code },
|
{ "api.tokens.prefix", "api.token.prefix", muscle_code },
|
||||||
|
{ "extends", "api.parser.extends", muscle_keyword },
|
||||||
|
{ "final", "api.parser.final", muscle_keyword },
|
||||||
|
{ "implements", "api.parser.implements", muscle_keyword },
|
||||||
{ "lex_symbol", "api.token.constructor", -1 },
|
{ "lex_symbol", "api.token.constructor", -1 },
|
||||||
{ "location_type", "api.location.type", muscle_code },
|
{ "location_type", "api.location.type", muscle_code },
|
||||||
{ "lr.default-reductions", "lr.default-reduction", muscle_keyword },
|
{ "lr.default-reductions", "lr.default-reduction", muscle_keyword },
|
||||||
@@ -453,16 +463,11 @@ muscle_percent_variable_update (char const *variable, location variable_loc,
|
|||||||
{ "lr.keep_unreachable_states", "lr.keep-unreachable-state", muscle_keyword },
|
{ "lr.keep_unreachable_states", "lr.keep-unreachable-state", muscle_keyword },
|
||||||
{ "namespace", "api.namespace", muscle_code },
|
{ "namespace", "api.namespace", muscle_code },
|
||||||
{ "parser_class_name", "api.parser.class", muscle_code },
|
{ "parser_class_name", "api.parser.class", muscle_code },
|
||||||
|
{ "public", "api.parser.public", muscle_keyword },
|
||||||
|
{ "strictfp", "api.parser.strictfp", muscle_keyword },
|
||||||
{ "stype", "api.value.type", -1 },
|
{ "stype", "api.value.type", -1 },
|
||||||
{ "variant=", "api.value.type=variant", -1 },
|
{ "variant=", "api.value.type=variant", -1 },
|
||||||
{ "variant=true", "api.value.type=variant", -1 },
|
{ "variant=true", "api.value.type=variant", -1 },
|
||||||
{ "abstract", "api.parser.abstract", muscle_keyword },
|
|
||||||
{ "annotations", "api.parser.annotations", muscle_code },
|
|
||||||
{ "extends", "api.parser.extends", muscle_keyword },
|
|
||||||
{ "final", "api.parser.final", muscle_keyword },
|
|
||||||
{ "implements", "api.parser.implements", muscle_keyword },
|
|
||||||
{ "public", "api.parser.public", muscle_keyword },
|
|
||||||
{ "strictfp", "api.parser.strictfp", muscle_keyword },
|
|
||||||
{ NULL, NULL, -1, }
|
{ NULL, NULL, -1, }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -474,22 +479,25 @@ muscle_percent_variable_update (char const *variable, location variable_loc,
|
|||||||
&& STREQ (eq + 1, *value))
|
&& STREQ (eq + 1, *value))
|
||||||
: STREQ (c->obsolete, variable))
|
: STREQ (c->obsolete, variable))
|
||||||
{
|
{
|
||||||
char *old = define_directive (c->obsolete, kind, *value);
|
/* Generate the deprecation warning. */
|
||||||
char *upd = define_directive (c->updated, c->kind, *value);
|
*old = c->obsolete[0] == '%'
|
||||||
deprecated_directive (&variable_loc, old, upd);
|
? xstrdup (c->obsolete)
|
||||||
free (old);
|
: define_directive (c->obsolete, kind, *value);
|
||||||
free (upd);
|
*upd = define_directive (c->updated, c->kind, *value);
|
||||||
char *res = xstrdup (c->updated);
|
/* Update the variable and its value. */
|
||||||
char *eq2 = strchr (res, '=');
|
{
|
||||||
if (eq2)
|
char *res = xstrdup (c->updated);
|
||||||
{
|
char *eq2 = strchr (res, '=');
|
||||||
*eq2 = '\0';
|
if (eq2)
|
||||||
*value = eq2 + 1;
|
{
|
||||||
}
|
*eq2 = '\0';
|
||||||
return res;
|
*value = eq2 + 1;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return xstrdup (variable);
|
return variable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -499,8 +507,11 @@ muscle_percent_define_insert (char const *var, location variable_loc,
|
|||||||
muscle_percent_define_how how)
|
muscle_percent_define_how how)
|
||||||
{
|
{
|
||||||
/* Backward compatibility. */
|
/* Backward compatibility. */
|
||||||
char *variable
|
char *old = NULL;
|
||||||
= muscle_percent_variable_update (var, variable_loc, kind, &value);
|
char *upd = NULL;
|
||||||
|
char const *variable
|
||||||
|
= muscle_percent_variable_update (var, kind,
|
||||||
|
&value, &old, &upd);
|
||||||
uniqstr name = muscle_name (variable, NULL);
|
uniqstr name = muscle_name (variable, NULL);
|
||||||
uniqstr loc_name = muscle_name (variable, "loc");
|
uniqstr loc_name = muscle_name (variable, "loc");
|
||||||
uniqstr syncline_name = muscle_name (variable, "syncline");
|
uniqstr syncline_name = muscle_name (variable, "syncline");
|
||||||
@@ -508,21 +519,33 @@ muscle_percent_define_insert (char const *var, location variable_loc,
|
|||||||
uniqstr kind_name = muscle_name (variable, "kind");
|
uniqstr kind_name = muscle_name (variable, "kind");
|
||||||
|
|
||||||
/* Command-line options are processed before the grammar file. */
|
/* Command-line options are processed before the grammar file. */
|
||||||
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
|
bool warned = false;
|
||||||
&& muscle_find_const (name))
|
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE)
|
||||||
{
|
{
|
||||||
muscle_percent_define_how how_old = atoi (muscle_find_const (how_name));
|
char const *current_value = muscle_find_const (name);
|
||||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
if (current_value)
|
||||||
goto end;
|
{
|
||||||
unsigned i = 0;
|
muscle_percent_define_how how_old
|
||||||
complain_indent (&variable_loc, complaint, &i,
|
= atoi (muscle_find_const (how_name));
|
||||||
_("%%define variable %s redefined"),
|
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||||
quote (variable));
|
goto end;
|
||||||
i += SUB_INDENT;
|
unsigned i = 0;
|
||||||
location loc = muscle_percent_define_get_loc (variable);
|
/* If assigning the same value, make it a warning. */
|
||||||
complain_indent (&loc, complaint, &i, _("previous definition"));
|
warnings warn = STREQ (value, current_value) ? Wother : complaint;
|
||||||
|
complain_indent (&variable_loc, warn, &i,
|
||||||
|
_("%%define variable %s redefined"),
|
||||||
|
quote (variable));
|
||||||
|
i += SUB_INDENT;
|
||||||
|
location loc = muscle_percent_define_get_loc (variable);
|
||||||
|
complain_indent (&loc, warn, &i, _("previous definition"));
|
||||||
|
fixits_register (&variable_loc, "");
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!warned && old && upd)
|
||||||
|
deprecated_directive (&variable_loc, old, upd);
|
||||||
|
|
||||||
MUSCLE_INSERT_STRING (name, value);
|
MUSCLE_INSERT_STRING (name, value);
|
||||||
muscle_insert (loc_name, "");
|
muscle_insert (loc_name, "");
|
||||||
muscle_location_grow (loc_name, variable_loc);
|
muscle_location_grow (loc_name, variable_loc);
|
||||||
@@ -533,7 +556,10 @@ muscle_percent_define_insert (char const *var, location variable_loc,
|
|||||||
MUSCLE_INSERT_INT (how_name, how);
|
MUSCLE_INSERT_INT (how_name, how);
|
||||||
MUSCLE_INSERT_STRING (kind_name, muscle_kind_string (kind));
|
MUSCLE_INSERT_STRING (kind_name, muscle_kind_string (kind));
|
||||||
end:
|
end:
|
||||||
free (variable);
|
free (old);
|
||||||
|
free (upd);
|
||||||
|
if (variable != var)
|
||||||
|
free ((char *) variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is used for backward compatibility, e.g., "%define api.pure"
|
/* This is used for backward compatibility, e.g., "%define api.pure"
|
||||||
|
|||||||
+1
-1
@@ -665,7 +665,7 @@ prepare (void)
|
|||||||
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
||||||
MUSCLE_INSERT_BOOL ("token_table_flag", token_table_flag);
|
MUSCLE_INSERT_BOOL ("token_table_flag", token_table_flag);
|
||||||
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
|
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
|
||||||
MUSCLE_INSERT_BOOL ("yacc_flag", yacc_flag);
|
MUSCLE_INSERT_BOOL ("yacc_flag", !location_empty (yacc_loc));
|
||||||
|
|
||||||
/* File names. */
|
/* File names. */
|
||||||
if (spec_name_prefix)
|
if (spec_name_prefix)
|
||||||
|
|||||||
+861
-716
File diff suppressed because it is too large
Load Diff
+61
-51
@@ -1,8 +1,9 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.2.1.108-19b4e. */
|
/* A Bison parser, made by GNU Bison 3.2.90.23-0bbcb-dirty. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
|
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||||
|
Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -51,11 +52,11 @@
|
|||||||
extern int gram_debug;
|
extern int gram_debug;
|
||||||
#endif
|
#endif
|
||||||
/* "%code requires" blocks. */
|
/* "%code requires" blocks. */
|
||||||
#line 21 "src/parse-gram.y" /* yacc.c:1917 */
|
#line 21 "src/parse-gram.y" /* yacc.c:1921 */
|
||||||
|
|
||||||
#include "symlist.h"
|
#include "symlist.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#line 218 "src/parse-gram.y" /* yacc.c:1917 */
|
#line 239 "src/parse-gram.y" /* yacc.c:1921 */
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,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 660 "src/parse-gram.y" /* yacc.c:1917 */
|
#line 682 "src/parse-gram.y" /* yacc.c:1921 */
|
||||||
|
|
||||||
#include "muscle-tab.h"
|
#include "muscle-tab.h"
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -73,7 +74,7 @@ extern int gram_debug;
|
|||||||
muscle_kind kind;
|
muscle_kind kind;
|
||||||
} value_type;
|
} value_type;
|
||||||
|
|
||||||
#line 77 "src/parse-gram.h" /* yacc.c:1917 */
|
#line 78 "src/parse-gram.h" /* yacc.c:1921 */
|
||||||
|
|
||||||
/* Token type. */
|
/* Token type. */
|
||||||
#ifndef GRAM_TOKENTYPE
|
#ifndef GRAM_TOKENTYPE
|
||||||
@@ -98,43 +99,44 @@ extern int gram_debug;
|
|||||||
PERCENT_DEFAULT_PREC = 272,
|
PERCENT_DEFAULT_PREC = 272,
|
||||||
PERCENT_DEFINE = 273,
|
PERCENT_DEFINE = 273,
|
||||||
PERCENT_DEFINES = 274,
|
PERCENT_DEFINES = 274,
|
||||||
PERCENT_EXPECT = 275,
|
PERCENT_ERROR_VERBOSE = 275,
|
||||||
PERCENT_EXPECT_RR = 276,
|
PERCENT_EXPECT = 276,
|
||||||
PERCENT_FLAG = 277,
|
PERCENT_EXPECT_RR = 277,
|
||||||
PERCENT_FILE_PREFIX = 278,
|
PERCENT_FLAG = 278,
|
||||||
PERCENT_GLR_PARSER = 279,
|
PERCENT_FILE_PREFIX = 279,
|
||||||
PERCENT_INITIAL_ACTION = 280,
|
PERCENT_GLR_PARSER = 280,
|
||||||
PERCENT_LANGUAGE = 281,
|
PERCENT_INITIAL_ACTION = 281,
|
||||||
PERCENT_NAME_PREFIX = 282,
|
PERCENT_LANGUAGE = 282,
|
||||||
PERCENT_NO_DEFAULT_PREC = 283,
|
PERCENT_NAME_PREFIX = 283,
|
||||||
PERCENT_NO_LINES = 284,
|
PERCENT_NO_DEFAULT_PREC = 284,
|
||||||
PERCENT_NONDETERMINISTIC_PARSER = 285,
|
PERCENT_NO_LINES = 285,
|
||||||
PERCENT_OUTPUT = 286,
|
PERCENT_NONDETERMINISTIC_PARSER = 286,
|
||||||
PERCENT_REQUIRE = 287,
|
PERCENT_OUTPUT = 287,
|
||||||
PERCENT_SKELETON = 288,
|
PERCENT_REQUIRE = 288,
|
||||||
PERCENT_START = 289,
|
PERCENT_SKELETON = 289,
|
||||||
PERCENT_TOKEN_TABLE = 290,
|
PERCENT_START = 290,
|
||||||
PERCENT_VERBOSE = 291,
|
PERCENT_TOKEN_TABLE = 291,
|
||||||
PERCENT_YACC = 292,
|
PERCENT_VERBOSE = 292,
|
||||||
BRACED_CODE = 293,
|
PERCENT_YACC = 293,
|
||||||
BRACED_PREDICATE = 294,
|
BRACED_CODE = 294,
|
||||||
BRACKETED_ID = 295,
|
BRACED_PREDICATE = 295,
|
||||||
CHAR = 296,
|
BRACKETED_ID = 296,
|
||||||
EPILOGUE = 297,
|
CHAR = 297,
|
||||||
EQUAL = 298,
|
EPILOGUE = 298,
|
||||||
ID = 299,
|
EQUAL = 299,
|
||||||
ID_COLON = 300,
|
ID = 300,
|
||||||
PERCENT_PERCENT = 301,
|
ID_COLON = 301,
|
||||||
PIPE = 302,
|
PERCENT_PERCENT = 302,
|
||||||
PROLOGUE = 303,
|
PIPE = 303,
|
||||||
SEMICOLON = 304,
|
PROLOGUE = 304,
|
||||||
TAG = 305,
|
SEMICOLON = 305,
|
||||||
TAG_ANY = 306,
|
TAG = 306,
|
||||||
TAG_NONE = 307,
|
TAG_ANY = 307,
|
||||||
INT = 308,
|
TAG_NONE = 308,
|
||||||
PERCENT_PARAM = 309,
|
INT = 309,
|
||||||
PERCENT_UNION = 310,
|
PERCENT_PARAM = 310,
|
||||||
PERCENT_EMPTY = 311
|
PERCENT_UNION = 311,
|
||||||
|
PERCENT_EMPTY = 312
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -161,9 +163,9 @@ union GRAM_STYPE
|
|||||||
/* "integer" */
|
/* "integer" */
|
||||||
int INT;
|
int INT;
|
||||||
/* int.opt */
|
/* int.opt */
|
||||||
int yytype_78;
|
int yytype_79;
|
||||||
/* named_ref.opt */
|
/* named_ref.opt */
|
||||||
named_ref* yytype_90;
|
named_ref* yytype_91;
|
||||||
/* "%param" */
|
/* "%param" */
|
||||||
param_type PERCENT_PARAM;
|
param_type PERCENT_PARAM;
|
||||||
/* token_decl */
|
/* token_decl */
|
||||||
@@ -179,7 +181,7 @@ union GRAM_STYPE
|
|||||||
/* string_as_id */
|
/* string_as_id */
|
||||||
symbol* string_as_id;
|
symbol* string_as_id;
|
||||||
/* string_as_id.opt */
|
/* string_as_id.opt */
|
||||||
symbol* yytype_97;
|
symbol* yytype_98;
|
||||||
/* generic_symlist */
|
/* generic_symlist */
|
||||||
symbol_list* generic_symlist;
|
symbol_list* generic_symlist;
|
||||||
/* generic_symlist_item */
|
/* generic_symlist_item */
|
||||||
@@ -189,17 +191,25 @@ union GRAM_STYPE
|
|||||||
/* token_decls */
|
/* token_decls */
|
||||||
symbol_list* token_decls;
|
symbol_list* token_decls;
|
||||||
/* token_decl.1 */
|
/* token_decl.1 */
|
||||||
symbol_list* yytype_76;
|
symbol_list* yytype_77;
|
||||||
/* token_decls_for_prec */
|
/* token_decls_for_prec */
|
||||||
symbol_list* token_decls_for_prec;
|
symbol_list* token_decls_for_prec;
|
||||||
/* token_decl_for_prec.1 */
|
/* token_decl_for_prec.1 */
|
||||||
symbol_list* yytype_80;
|
symbol_list* yytype_81;
|
||||||
/* symbol_decls */
|
/* symbol_decls */
|
||||||
symbol_list* symbol_decls;
|
symbol_list* symbol_decls;
|
||||||
/* symbol_decl.1 */
|
/* symbol_decl.1 */
|
||||||
symbol_list* yytype_83;
|
symbol_list* yytype_84;
|
||||||
|
/* "%error-verbose" */
|
||||||
|
uniqstr PERCENT_ERROR_VERBOSE;
|
||||||
/* "%<flag>" */
|
/* "%<flag>" */
|
||||||
uniqstr PERCENT_FLAG;
|
uniqstr PERCENT_FLAG;
|
||||||
|
/* "%file-prefix" */
|
||||||
|
uniqstr PERCENT_FILE_PREFIX;
|
||||||
|
/* "%name-prefix" */
|
||||||
|
uniqstr PERCENT_NAME_PREFIX;
|
||||||
|
/* "%yacc" */
|
||||||
|
uniqstr PERCENT_YACC;
|
||||||
/* "[identifier]" */
|
/* "[identifier]" */
|
||||||
uniqstr BRACKETED_ID;
|
uniqstr BRACKETED_ID;
|
||||||
/* "identifier" */
|
/* "identifier" */
|
||||||
@@ -209,7 +219,7 @@ union GRAM_STYPE
|
|||||||
/* "<tag>" */
|
/* "<tag>" */
|
||||||
uniqstr TAG;
|
uniqstr TAG;
|
||||||
/* tag.opt */
|
/* tag.opt */
|
||||||
uniqstr yytype_70;
|
uniqstr yytype_71;
|
||||||
/* tag */
|
/* tag */
|
||||||
uniqstr tag;
|
uniqstr tag;
|
||||||
/* variable */
|
/* variable */
|
||||||
@@ -218,7 +228,7 @@ union GRAM_STYPE
|
|||||||
unsigned char CHAR;
|
unsigned char CHAR;
|
||||||
/* value */
|
/* value */
|
||||||
value_type value;
|
value_type value;
|
||||||
#line 222 "src/parse-gram.h" /* yacc.c:1917 */
|
#line 232 "src/parse-gram.h" /* yacc.c:1921 */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef union GRAM_STYPE GRAM_STYPE;
|
typedef union GRAM_STYPE GRAM_STYPE;
|
||||||
|
|||||||
+120
-12
@@ -43,8 +43,9 @@
|
|||||||
#include "named-ref.h"
|
#include "named-ref.h"
|
||||||
#include "quotearg.h"
|
#include "quotearg.h"
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "scan-gram.h"
|
|
||||||
#include "scan-code.h"
|
#include "scan-code.h"
|
||||||
|
#include "scan-gram.h"
|
||||||
|
#include "vasnprintf.h"
|
||||||
#include "xmemdup0.h"
|
#include "xmemdup0.h"
|
||||||
|
|
||||||
static int current_prec = 0;
|
static int current_prec = 0;
|
||||||
@@ -81,11 +82,26 @@
|
|||||||
string from the scanner (should be CODE). */
|
string from the scanner (should be CODE). */
|
||||||
static char const *translate_code_braceless (char *code, location loc);
|
static char const *translate_code_braceless (char *code, location loc);
|
||||||
|
|
||||||
|
/* Handle a %error-verbose directive. */
|
||||||
|
static void handle_error_verbose (location const *loc, char const *directive);
|
||||||
|
|
||||||
|
/* Handle a %file-prefix directive. */
|
||||||
|
static void handle_file_prefix (location const *loc,
|
||||||
|
location const *dir_loc,
|
||||||
|
char const *directive, char const *value);
|
||||||
|
|
||||||
|
/* Handle a %name-prefix directive. */
|
||||||
|
static void handle_name_prefix (location const *loc,
|
||||||
|
char const *directive, char const *value);
|
||||||
|
|
||||||
/* Handle a %require directive. */
|
/* Handle a %require directive. */
|
||||||
static void do_require (location const *loc, char const *version);
|
static void handle_require (location const *loc, char const *version);
|
||||||
|
|
||||||
/* Handle a %skeleton directive. */
|
/* Handle a %skeleton directive. */
|
||||||
static void do_skeleton (location const *loc, char const *skel);
|
static void handle_skeleton (location const *loc, char const *skel);
|
||||||
|
|
||||||
|
/* Handle a %yacc directive. */
|
||||||
|
static void handle_yacc (location const *loc, char const *directive);
|
||||||
|
|
||||||
static void gram_error (location const *, char const *);
|
static void gram_error (location const *, char const *);
|
||||||
|
|
||||||
@@ -146,6 +162,7 @@
|
|||||||
PERCENT_DEFAULT_PREC "%default-prec"
|
PERCENT_DEFAULT_PREC "%default-prec"
|
||||||
PERCENT_DEFINE "%define"
|
PERCENT_DEFINE "%define"
|
||||||
PERCENT_DEFINES "%defines"
|
PERCENT_DEFINES "%defines"
|
||||||
|
PERCENT_ERROR_VERBOSE "%error-verbose"
|
||||||
PERCENT_EXPECT "%expect"
|
PERCENT_EXPECT "%expect"
|
||||||
PERCENT_EXPECT_RR "%expect-rr"
|
PERCENT_EXPECT_RR "%expect-rr"
|
||||||
PERCENT_FLAG "%<flag>"
|
PERCENT_FLAG "%<flag>"
|
||||||
@@ -190,7 +207,11 @@
|
|||||||
%printer { fputs (quotearg_style (c_quoting_style, $$), yyo); } STRING
|
%printer { fputs (quotearg_style (c_quoting_style, $$), yyo); } STRING
|
||||||
%printer { fprintf (yyo, "{\n%s\n}", $$); } <char*>
|
%printer { fprintf (yyo, "{\n%s\n}", $$); } <char*>
|
||||||
|
|
||||||
%type <uniqstr> BRACKETED_ID ID ID_COLON PERCENT_FLAG TAG tag tag.opt variable
|
%type <uniqstr>
|
||||||
|
BRACKETED_ID ID ID_COLON
|
||||||
|
PERCENT_ERROR_VERBOSE PERCENT_FILE_PREFIX PERCENT_FLAG PERCENT_NAME_PREFIX
|
||||||
|
PERCENT_YACC
|
||||||
|
TAG tag tag.opt variable
|
||||||
%printer { fputs ($$, yyo); } <uniqstr>
|
%printer { fputs ($$, yyo); } <uniqstr>
|
||||||
%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID
|
%printer { fprintf (yyo, "[%s]", $$); } BRACKETED_ID
|
||||||
%printer { fprintf (yyo, "%s:", $$); } ID_COLON
|
%printer { fprintf (yyo, "%s:", $$); } ID_COLON
|
||||||
@@ -284,7 +305,7 @@ prologue_declaration:
|
|||||||
}
|
}
|
||||||
| "%define" variable value
|
| "%define" variable value
|
||||||
{
|
{
|
||||||
muscle_percent_define_insert ($2, @2, $3.kind, $3.chars,
|
muscle_percent_define_insert ($2, @$, $3.kind, $3.chars,
|
||||||
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
|
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
|
||||||
}
|
}
|
||||||
| "%defines" { defines_flag = true; }
|
| "%defines" { defines_flag = true; }
|
||||||
@@ -293,9 +314,10 @@ prologue_declaration:
|
|||||||
defines_flag = true;
|
defines_flag = true;
|
||||||
spec_defines_file = xstrdup ($2);
|
spec_defines_file = xstrdup ($2);
|
||||||
}
|
}
|
||||||
|
| "%error-verbose" { handle_error_verbose (&@$, $1); }
|
||||||
| "%expect" INT { expected_sr_conflicts = $2; }
|
| "%expect" INT { expected_sr_conflicts = $2; }
|
||||||
| "%expect-rr" INT { expected_rr_conflicts = $2; }
|
| "%expect-rr" INT { expected_rr_conflicts = $2; }
|
||||||
| "%file-prefix" STRING { spec_file_prefix = $2; }
|
| "%file-prefix" STRING { handle_file_prefix (&@$, &@1, $1, $2); }
|
||||||
| "%glr-parser"
|
| "%glr-parser"
|
||||||
{
|
{
|
||||||
nondeterministic_parser = true;
|
nondeterministic_parser = true;
|
||||||
@@ -307,16 +329,16 @@ prologue_declaration:
|
|||||||
code_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
}
|
}
|
||||||
| "%language" STRING { language_argmatch ($2, grammar_prio, @1); }
|
| "%language" STRING { language_argmatch ($2, grammar_prio, @1); }
|
||||||
| "%name-prefix" STRING { spec_name_prefix = $2; }
|
| "%name-prefix" STRING { handle_name_prefix (&@$, $1, $2); }
|
||||||
| "%no-lines" { no_lines_flag = true; }
|
| "%no-lines" { no_lines_flag = true; }
|
||||||
| "%nondeterministic-parser" { nondeterministic_parser = true; }
|
| "%nondeterministic-parser" { nondeterministic_parser = true; }
|
||||||
| "%output" STRING { spec_outfile = $2; }
|
| "%output" STRING { spec_outfile = $2; }
|
||||||
| "%param" { current_param = $1; } params { current_param = param_none; }
|
| "%param" { current_param = $1; } params { current_param = param_none; }
|
||||||
| "%require" STRING { do_require (&@2, $2); }
|
| "%require" STRING { handle_require (&@2, $2); }
|
||||||
| "%skeleton" STRING { do_skeleton (&@2, $2); }
|
| "%skeleton" STRING { handle_skeleton (&@2, $2); }
|
||||||
| "%token-table" { token_table_flag = true; }
|
| "%token-table" { token_table_flag = true; }
|
||||||
| "%verbose" { report_flag |= report_states; }
|
| "%verbose" { report_flag |= report_states; }
|
||||||
| "%yacc" { yacc_flag = true; }
|
| "%yacc" { handle_yacc (&@$, $1); }
|
||||||
| error ";" { current_class = unknown_sym; yyerrok; }
|
| error ";" { current_class = unknown_sym; yyerrok; }
|
||||||
| /*FIXME: Err? What is this horror doing here? */ ";"
|
| /*FIXME: Err? What is this horror doing here? */ ";"
|
||||||
;
|
;
|
||||||
@@ -847,7 +869,74 @@ add_param (param_type type, char *decl, location loc)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_require (location const *loc, char const *version)
|
handle_error_verbose (location const *loc, char const *directive)
|
||||||
|
{
|
||||||
|
bison_directive (loc, directive);
|
||||||
|
muscle_percent_define_insert (directive, *loc, muscle_keyword, "",
|
||||||
|
MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_file_prefix (location const *loc,
|
||||||
|
location const *dir_loc,
|
||||||
|
char const *directive, char const *value)
|
||||||
|
{
|
||||||
|
bison_directive (loc, directive);
|
||||||
|
bool warned = false;
|
||||||
|
|
||||||
|
if (location_empty (spec_file_prefix_loc))
|
||||||
|
{
|
||||||
|
spec_file_prefix_loc = *loc;
|
||||||
|
spec_file_prefix = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
duplicate_directive (directive, spec_file_prefix_loc, *loc);
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!warned
|
||||||
|
&& STRNEQ (directive, "%file-prefix"))
|
||||||
|
deprecated_directive (dir_loc, directive, "%file-prefix");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_name_prefix (location const *loc,
|
||||||
|
char const *directive, char const *value)
|
||||||
|
{
|
||||||
|
bison_directive (loc, directive);
|
||||||
|
|
||||||
|
char buf1[1024];
|
||||||
|
size_t len1 = sizeof (buf1);
|
||||||
|
char *old = asnprintf (buf1, &len1, "%s\"%s\"", directive, value);
|
||||||
|
if (!old)
|
||||||
|
xalloc_die ();
|
||||||
|
|
||||||
|
if (location_empty (spec_name_prefix_loc))
|
||||||
|
{
|
||||||
|
spec_name_prefix = value;
|
||||||
|
spec_name_prefix_loc = *loc;
|
||||||
|
|
||||||
|
char buf2[1024];
|
||||||
|
size_t len2 = sizeof (buf2);
|
||||||
|
char *new = asnprintf (buf2, &len2, "%%define api.prefix {%s}", value);
|
||||||
|
if (!new)
|
||||||
|
xalloc_die ();
|
||||||
|
deprecated_directive (loc, old, new);
|
||||||
|
if (new != buf2)
|
||||||
|
free (new);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
duplicate_directive (old, spec_file_prefix_loc, *loc);
|
||||||
|
|
||||||
|
if (old != buf1)
|
||||||
|
free (old);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_require (location const *loc, char const *version)
|
||||||
{
|
{
|
||||||
/* Changes of behavior are only on minor version changes, so "3.0.5"
|
/* Changes of behavior are only on minor version changes, so "3.0.5"
|
||||||
is the same as "3.0". */
|
is the same as "3.0". */
|
||||||
@@ -885,7 +974,7 @@ do_require (location const *loc, char const *version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_skeleton (location const *loc, char const *skel)
|
handle_skeleton (location const *loc, char const *skel)
|
||||||
{
|
{
|
||||||
char const *skeleton_user = skel;
|
char const *skeleton_user = skel;
|
||||||
if (strchr (skeleton_user, '/'))
|
if (strchr (skeleton_user, '/'))
|
||||||
@@ -909,6 +998,25 @@ do_skeleton (location const *loc, char const *skel)
|
|||||||
skeleton_arg (skeleton_user, grammar_prio, *loc);
|
skeleton_arg (skeleton_user, grammar_prio, *loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_yacc (location const *loc, char const *directive)
|
||||||
|
{
|
||||||
|
bison_directive (loc, directive);
|
||||||
|
bool warned = false;
|
||||||
|
|
||||||
|
if (location_empty (yacc_loc))
|
||||||
|
yacc_loc = *loc;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
duplicate_directive (directive, yacc_loc, *loc);
|
||||||
|
warned = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!warned
|
||||||
|
&& STRNEQ (directive, "%fixed-output-files")
|
||||||
|
&& STRNEQ (directive, "%yacc"))
|
||||||
|
deprecated_directive (loc, directive, "%fixed-output-files");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gram_error (location const *loc, char const *msg)
|
gram_error (location const *loc, char const *msg)
|
||||||
|
|||||||
+8
-8
@@ -467,8 +467,8 @@ grammar_current_rule_prec_set (symbol *precsym, location loc)
|
|||||||
not defined separately as a token. */
|
not defined separately as a token. */
|
||||||
symbol_class_set (precsym, token_sym, loc, false);
|
symbol_class_set (precsym, token_sym, loc, false);
|
||||||
if (current_rule->ruleprec)
|
if (current_rule->ruleprec)
|
||||||
duplicate_directive ("%prec",
|
duplicate_rule_directive ("%prec",
|
||||||
current_rule->ruleprec->location, loc);
|
current_rule->ruleprec->location, loc);
|
||||||
else
|
else
|
||||||
current_rule->ruleprec = precsym;
|
current_rule->ruleprec = precsym;
|
||||||
}
|
}
|
||||||
@@ -483,8 +483,8 @@ grammar_current_rule_empty_set (location loc)
|
|||||||
if (warning_is_unset (Wempty_rule))
|
if (warning_is_unset (Wempty_rule))
|
||||||
warning_argmatch ("empty-rule", 0, 0);
|
warning_argmatch ("empty-rule", 0, 0);
|
||||||
if (current_rule->percent_empty_loc.start.file)
|
if (current_rule->percent_empty_loc.start.file)
|
||||||
duplicate_directive ("%empty",
|
duplicate_rule_directive ("%empty",
|
||||||
current_rule->percent_empty_loc, loc);
|
current_rule->percent_empty_loc, loc);
|
||||||
else
|
else
|
||||||
current_rule->percent_empty_loc = loc;
|
current_rule->percent_empty_loc = loc;
|
||||||
}
|
}
|
||||||
@@ -501,8 +501,8 @@ grammar_current_rule_dprec_set (int dprec, location loc)
|
|||||||
complain (&loc, complaint, _("%s must be followed by positive number"),
|
complain (&loc, complaint, _("%s must be followed by positive number"),
|
||||||
"%dprec");
|
"%dprec");
|
||||||
else if (current_rule->dprec != 0)
|
else if (current_rule->dprec != 0)
|
||||||
duplicate_directive ("%dprec",
|
duplicate_rule_directive ("%dprec",
|
||||||
current_rule->dprec_location, loc);
|
current_rule->dprec_location, loc);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current_rule->dprec = dprec;
|
current_rule->dprec = dprec;
|
||||||
@@ -520,8 +520,8 @@ grammar_current_rule_merge_set (uniqstr name, location loc)
|
|||||||
complain (&loc, Wother, _("%s affects only GLR parsers"),
|
complain (&loc, Wother, _("%s affects only GLR parsers"),
|
||||||
"%merge");
|
"%merge");
|
||||||
if (current_rule->merger != 0)
|
if (current_rule->merger != 0)
|
||||||
duplicate_directive ("%merge",
|
duplicate_rule_directive ("%merge",
|
||||||
current_rule->merger_declaration_location, loc);
|
current_rule->merger_declaration_location, loc);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current_rule->merger = get_merge_function (name);
|
current_rule->merger = get_merge_function (name);
|
||||||
|
|||||||
+13
-16
@@ -76,18 +76,17 @@ static size_t no_cr_read (FILE *, char *, size_t);
|
|||||||
|
|
||||||
#define DEPRECATED(Msg) \
|
#define DEPRECATED(Msg) \
|
||||||
do { \
|
do { \
|
||||||
size_t i; \
|
|
||||||
deprecated_directive (loc, yytext, Msg); \
|
deprecated_directive (loc, yytext, Msg); \
|
||||||
scanner_cursor.column -= mbsnwidth (Msg, strlen (Msg), 0); \
|
scanner_cursor.column -= mbsnwidth (Msg, strlen (Msg), 0); \
|
||||||
for (i = strlen (Msg); i != 0; --i) \
|
for (size_t i = strlen (Msg); i != 0; --i) \
|
||||||
unput (Msg[i - 1]); \
|
unput (Msg[i - 1]); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* A string representing the most recently saved token. */
|
/* A string representing the most recently saved token. */
|
||||||
static char *last_string;
|
static char *last_string = NULL;
|
||||||
|
|
||||||
/* Bracketed identifier. */
|
/* Bracketed identifier. */
|
||||||
static uniqstr bracketed_id_str = 0;
|
static uniqstr bracketed_id_str = NULL;
|
||||||
static location bracketed_id_loc;
|
static location bracketed_id_loc;
|
||||||
static boundary bracketed_id_start;
|
static boundary bracketed_id_start;
|
||||||
static int bracketed_id_context_state = 0;
|
static int bracketed_id_context_state = 0;
|
||||||
@@ -145,7 +144,8 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
|
|
||||||
/* An equal sign, with optional leading whitespaces. This is used in some
|
/* An equal sign, with optional leading whitespaces. This is used in some
|
||||||
deprecated constructs. */
|
deprecated constructs. */
|
||||||
eqopt ([[:space:]]*=)?
|
sp [[:space:]]*
|
||||||
|
eqopt ({sp}=)?
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%{
|
%{
|
||||||
@@ -228,8 +228,8 @@ eqopt ([[:space:]]*=)?
|
|||||||
"%empty" return BISON_DIRECTIVE (EMPTY);
|
"%empty" return BISON_DIRECTIVE (EMPTY);
|
||||||
"%expect" return BISON_DIRECTIVE (EXPECT);
|
"%expect" return BISON_DIRECTIVE (EXPECT);
|
||||||
"%expect-rr" return BISON_DIRECTIVE (EXPECT_RR);
|
"%expect-rr" return BISON_DIRECTIVE (EXPECT_RR);
|
||||||
"%file-prefix" return BISON_DIRECTIVE (FILE_PREFIX);
|
"%file-prefix" RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
|
||||||
"%fixed-output-files" return BISON_DIRECTIVE (YACC);
|
"%fixed-output-files" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
|
||||||
"%initial-action" return BISON_DIRECTIVE (INITIAL_ACTION);
|
"%initial-action" return BISON_DIRECTIVE (INITIAL_ACTION);
|
||||||
"%glr-parser" return BISON_DIRECTIVE (GLR_PARSER);
|
"%glr-parser" return BISON_DIRECTIVE (GLR_PARSER);
|
||||||
"%language" return BISON_DIRECTIVE (LANGUAGE);
|
"%language" return BISON_DIRECTIVE (LANGUAGE);
|
||||||
@@ -259,25 +259,22 @@ eqopt ([[:space:]]*=)?
|
|||||||
"%type" return PERCENT_TYPE;
|
"%type" return PERCENT_TYPE;
|
||||||
"%union" return PERCENT_UNION;
|
"%union" return PERCENT_UNION;
|
||||||
"%verbose" return BISON_DIRECTIVE (VERBOSE);
|
"%verbose" return BISON_DIRECTIVE (VERBOSE);
|
||||||
"%yacc" return BISON_DIRECTIVE (YACC);
|
"%yacc" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
|
||||||
|
|
||||||
/* Deprecated since Bison 3.0 (2013-07-25), but the warning is
|
/* Deprecated since Bison 3.0 (2013-07-25), but the warning is
|
||||||
issued only since Bison 3.3. */
|
issued only since Bison 3.3. */
|
||||||
"%error-verbose" DEPRECATED ("%define parse.error verbose");
|
"%error-verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext));
|
||||||
|
|
||||||
/* Deprecated since Bison 2.6 (2012-07-19), but the warning is
|
/* Deprecated since Bison 2.6 (2012-07-19), but the warning is
|
||||||
issued only since Bison 3.3. */
|
issued only since Bison 3.3. */
|
||||||
"%name"[-_]"prefix"{eqopt} {
|
"%name"[-_]"prefix"{eqopt}{sp} RETURN_VALUE (PERCENT_NAME_PREFIX, uniqstr_new (yytext));
|
||||||
deprecated_directive (loc, yytext, "%define api.prefix");
|
|
||||||
return BISON_DIRECTIVE (NAME_PREFIX);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Deprecated since Bison 2.7.90, 2012. */
|
/* Deprecated since Bison 2.7.90, 2012. */
|
||||||
"%default"[-_]"prec" DEPRECATED ("%default-prec");
|
"%default"[-_]"prec" DEPRECATED ("%default-prec");
|
||||||
"%error"[-_]"verbose" DEPRECATED ("%define parse.error verbose");
|
"%error"[-_]"verbose" RETURN_VALUE (PERCENT_ERROR_VERBOSE, uniqstr_new (yytext));
|
||||||
"%expect"[-_]"rr" DEPRECATED ("%expect-rr");
|
"%expect"[-_]"rr" DEPRECATED ("%expect-rr");
|
||||||
"%file-prefix"{eqopt} DEPRECATED ("%file-prefix");
|
"%file-prefix"{eqopt} RETURN_VALUE (PERCENT_FILE_PREFIX, uniqstr_new (yytext));
|
||||||
"%fixed"[-_]"output"[-_]"files" DEPRECATED ("%fixed-output-files");
|
"%fixed"[-_]"output"[-_]"files" RETURN_VALUE (PERCENT_YACC, uniqstr_new (yytext));
|
||||||
"%no"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec");
|
"%no"[-_]"default"[-_]"prec" DEPRECATED ("%no-default-prec");
|
||||||
"%no"[-_]"lines" DEPRECATED ("%no-lines");
|
"%no"[-_]"lines" DEPRECATED ("%no-lines");
|
||||||
"%output"{eqopt} DEPRECATED ("%output");
|
"%output"{eqopt} DEPRECATED ("%output");
|
||||||
|
|||||||
+1
-1
@@ -143,7 +143,7 @@ state_new (symbol_number accessing_symbol,
|
|||||||
res->reductions = NULL;
|
res->reductions = NULL;
|
||||||
res->errs = NULL;
|
res->errs = NULL;
|
||||||
res->state_list = NULL;
|
res->state_list = NULL;
|
||||||
res->consistent = 0;
|
res->consistent = false;
|
||||||
res->solved_conflicts = NULL;
|
res->solved_conflicts = NULL;
|
||||||
res->solved_conflicts_xml = NULL;
|
res->solved_conflicts_xml = NULL;
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -81,6 +81,8 @@
|
|||||||
#ifndef STATE_H_
|
#ifndef STATE_H_
|
||||||
# define STATE_H_
|
# define STATE_H_
|
||||||
|
|
||||||
|
# include <stdbool.h>
|
||||||
|
|
||||||
# include <bitset.h>
|
# include <bitset.h>
|
||||||
|
|
||||||
# include "gram.h"
|
# include "gram.h"
|
||||||
@@ -208,9 +210,9 @@ struct state
|
|||||||
store in this member a reference to the node containing each state. */
|
store in this member a reference to the node containing each state. */
|
||||||
struct state_list *state_list;
|
struct state_list *state_list;
|
||||||
|
|
||||||
/* If non-zero, then no lookahead sets on reduce actions are needed to
|
/* Whether no lookahead sets on reduce actions are needed to decide
|
||||||
decide what to do in state S. */
|
what to do in state S. */
|
||||||
char consistent;
|
bool consistent;
|
||||||
|
|
||||||
/* If some conflicts were solved thanks to precedence/associativity,
|
/* If some conflicts were solved thanks to precedence/associativity,
|
||||||
a human readable description of the resolution. */
|
a human readable description of the resolution. */
|
||||||
|
|||||||
+50
-21
@@ -130,7 +130,7 @@ b: {} {};
|
|||||||
AT_BISON_CHECK([-fcaret -Wempty-rule 1.y], [0], [],
|
AT_BISON_CHECK([-fcaret -Wempty-rule 1.y], [0], [],
|
||||||
[[1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
[[1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||||
a: /* empty. */ {};
|
a: /* empty. */ {};
|
||||||
^^
|
^~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[2.y]],
|
AT_DATA_GRAMMAR([[2.y]],
|
||||||
@@ -144,10 +144,10 @@ c: /* empty. */ {};
|
|||||||
AT_BISON_CHECK([-fcaret 2.y], [0], [],
|
AT_BISON_CHECK([-fcaret 2.y], [0], [],
|
||||||
[[2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
[[2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||||
a: /* empty. */ {};
|
a: /* empty. */ {};
|
||||||
^^
|
^~
|
||||||
2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule]
|
2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||||
c: /* empty. */ {};
|
c: /* empty. */ {};
|
||||||
^^
|
^~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-fcaret -Wno-empty-rule 2.y], [0])
|
AT_BISON_CHECK([-fcaret -Wno-empty-rule 2.y], [0])
|
||||||
@@ -170,12 +170,39 @@ exp:
|
|||||||
AT_BISON_CHECK([-fcaret one.y], [1], [],
|
AT_BISON_CHECK([-fcaret one.y], [1], [],
|
||||||
[[one.y:11.13-18: error: only one %empty allowed per rule
|
[[one.y:11.13-18: error: only one %empty allowed per rule
|
||||||
%empty {} %empty
|
%empty {} %empty
|
||||||
^^^^^^
|
^~~~~~
|
||||||
one.y:11.3-8: previous declaration
|
one.y:11.3-8: previous declaration
|
||||||
%empty {} %empty
|
%empty {} %empty
|
||||||
^^^^^^
|
^~~~~~
|
||||||
|
one.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([-fcaret -u one.y], [1], [],
|
||||||
|
[[one.y:11.13-18: error: only one %empty allowed per rule
|
||||||
|
%empty {} %empty
|
||||||
|
^~~~~~
|
||||||
|
one.y:11.3-8: previous declaration
|
||||||
|
%empty {} %empty
|
||||||
|
^~~~~~
|
||||||
|
bison: file 'one.y' was updated (backup: 'one.y~')
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CHECK([cat one.y], [],
|
||||||
|
[[%code top {
|
||||||
|
/* Load config.h, and adjust to the compiler.
|
||||||
|
We used to do it here, but each time we add a new line,
|
||||||
|
we have to adjust all the line numbers in error messages.
|
||||||
|
It's simpler to use a constant include to a varying file. */
|
||||||
|
#include <testsuite.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
%%
|
||||||
|
exp:
|
||||||
|
%empty {} @&t@
|
||||||
|
;
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([[two.y]],
|
AT_DATA_GRAMMAR([[two.y]],
|
||||||
[[%%
|
[[%%
|
||||||
exp:
|
exp:
|
||||||
@@ -188,13 +215,13 @@ exp:
|
|||||||
AT_BISON_CHECK([-fcaret two.y], [1], [],
|
AT_BISON_CHECK([-fcaret two.y], [1], [],
|
||||||
[[two.y:11.7-12: error: %empty on non-empty rule
|
[[two.y:11.7-12: error: %empty on non-empty rule
|
||||||
'a' %empty {}
|
'a' %empty {}
|
||||||
^^^^^^
|
^~~~~~
|
||||||
two.y:12.3-8: error: %empty on non-empty rule
|
two.y:12.3-8: error: %empty on non-empty rule
|
||||||
| %empty 'a' {}
|
| %empty 'a' {}
|
||||||
^^^^^^
|
^~~~~~
|
||||||
two.y:13.3-8: error: %empty on non-empty rule
|
two.y:13.3-8: error: %empty on non-empty rule
|
||||||
| %empty {} {}
|
| %empty {} {}
|
||||||
^^^^^^
|
^~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -516,7 +543,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
|
|
||||||
#define YYINITDEPTH 10
|
#define YYINITDEPTH 10
|
||||||
#define YYMAXDEPTH 10
|
#define YYMAXDEPTH 10
|
||||||
#define RANGE(Location) ]AT_LALR1_CC_IF([(Location).begin.line, (Location).end.line],
|
#define RANGE(Location) ]AT_CXX_IF([(Location).begin.line, (Location).end.line],
|
||||||
[(Location).first_line, (Location).last_line])[
|
[(Location).first_line, (Location).last_line])[
|
||||||
|
|
||||||
#define USE(SYM)
|
#define USE(SYM)
|
||||||
@@ -545,8 +572,8 @@ AT_LALR1_CC_IF([typedef yy::location YYLTYPE;])[
|
|||||||
/* FIXME: This %printer isn't actually tested. */
|
/* FIXME: This %printer isn't actually tested. */
|
||||||
%printer
|
%printer
|
||||||
{
|
{
|
||||||
]AT_LALR1_CC_IF([yyo << $$;],
|
]AT_CXX_IF([yyo << $$;],
|
||||||
[fprintf (yyo, "%d", $$)])[;
|
[fprintf (yyo, "%d", $$)])[;
|
||||||
}
|
}
|
||||||
'(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END
|
'(' 'x' 'y' ')' ';' thing line input '!' raise check-spontaneous-errors END
|
||||||
|
|
||||||
@@ -707,9 +734,8 @@ static
|
|||||||
fprintf (stderr, " (%d@%d-%d)\n", c, RANGE (]AT_LOC[));
|
fprintf (stderr, " (%d@%d-%d)\n", c, RANGE (]AT_LOC[));
|
||||||
return source[c];
|
return source[c];
|
||||||
}
|
}
|
||||||
]AT_LALR1_CC_IF(
|
]AT_LALR1_CC_IF([static bool yydebug;])[
|
||||||
[static bool yydebug;
|
]AT_CXX_IF([int
|
||||||
int
|
|
||||||
yyparse ()
|
yyparse ()
|
||||||
{
|
{
|
||||||
yy::parser parser;
|
yy::parser parser;
|
||||||
@@ -972,11 +998,14 @@ AT_CLEANUP
|
|||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([])
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([], [ with union])
|
||||||
|
|
||||||
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
|
||||||
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union])
|
||||||
|
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [ with union])
|
||||||
|
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr.cc"])
|
||||||
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [ with union])
|
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "glr.cc"], [ with union])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1514,16 +1543,16 @@ input.y:32.3-23: warning: unused value: $3 [-Wother]
|
|||||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||||
[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
|
[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
|
||||||
%printer { #error "<*> printer should not be used" } <*>
|
%printer { #error "<*> printer should not be used" } <*>
|
||||||
^^^
|
^~~
|
||||||
input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
|
input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
|
||||||
%printer { #error "<*> printer should not be used" } <*>
|
%printer { #error "<*> printer should not be used" } <*>
|
||||||
^^^
|
^~~
|
||||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||||
{ @$ = 4; } // Only used.
|
{ @$ = 4; } // Only used.
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~
|
||||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||||
{ USE ($$); @$ = 3; } // Only set.
|
{ USE ($$); @$ = 3; } // Only set.
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_COMPILE([input])
|
AT_COMPILE([input])
|
||||||
|
|||||||
+6
-6
@@ -249,13 +249,13 @@ exp:
|
|||||||
AT_BISON_CHECK([[-fcaret input.yy]], [0], [],
|
AT_BISON_CHECK([[-fcaret input.yy]], [0], [],
|
||||||
[[input.yy:16.33-34: warning: multiple occurrences of $2 with api.value.automove [-Wother]
|
[[input.yy:16.33-34: warning: multiple occurrences of $2 with api.value.automove [-Wother]
|
||||||
| "twice" exp { $$ = $2 + $2; }
|
| "twice" exp { $$ = $2 + $2; }
|
||||||
^^
|
^~
|
||||||
input.yy:17.33-36: warning: multiple occurrences of $2 with api.value.automove [-Wother]
|
input.yy:17.33-36: warning: multiple occurrences of $2 with api.value.automove [-Wother]
|
||||||
| "thrice" exp[val] { $$ = $2 + $val + $2; }
|
| "thrice" exp[val] { $$ = $2 + $val + $2; }
|
||||||
^^^^
|
^~~~
|
||||||
input.yy:17.40-41: warning: multiple occurrences of $2 with api.value.automove [-Wother]
|
input.yy:17.40-41: warning: multiple occurrences of $2 with api.value.automove [-Wother]
|
||||||
| "thrice" exp[val] { $$ = $2 + $val + $2; }
|
| "thrice" exp[val] { $$ = $2 + $val + $2; }
|
||||||
^^
|
^~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
@@ -420,8 +420,7 @@ namespace yy
|
|||||||
{
|
{
|
||||||
static
|
static
|
||||||
]AT_YYLEX_PROTOTYPE[
|
]AT_YYLEX_PROTOTYPE[
|
||||||
{]AT_LOCATION_IF([
|
{
|
||||||
typedef parser::location_type location;])[
|
|
||||||
// The 5 is a syntax error whose recovery requires that we discard
|
// The 5 is a syntax error whose recovery requires that we discard
|
||||||
// the lookahead. This tests a regression, see
|
// the lookahead. This tests a regression, see
|
||||||
// <http://savannah.gnu.org/support/?108481>.
|
// <http://savannah.gnu.org/support/?108481>.
|
||||||
@@ -1243,7 +1242,8 @@ yylex (yy::parser::semantic_type *lvalp)
|
|||||||
default:
|
default:
|
||||||
lvalp->]AT_VARIANT_IF([build<Object> (res)],
|
lvalp->]AT_VARIANT_IF([build<Object> (res)],
|
||||||
[obj = new Object (res)])[;
|
[obj = new Object (res)])[;
|
||||||
// Fall through.
|
goto zero;
|
||||||
|
zero:
|
||||||
case 0:
|
case 0:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -246,16 +246,16 @@ f: B
|
|||||||
AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
|
AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
|
||||||
[[input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
|
[[input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
|
||||||
%nonassoc U
|
%nonassoc U
|
||||||
^^^^^^^^^
|
^~~~~~~~~
|
||||||
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
|
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
|
||||||
%right V
|
%right V
|
||||||
^^^^^^
|
^~~~~~
|
||||||
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
|
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
|
||||||
%left W
|
%left W
|
||||||
^^^^^
|
^~~~~
|
||||||
input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
|
input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
|
||||||
%precedence Z
|
%precedence Z
|
||||||
^^^^^^^^^^^
|
^~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1367,7 +1367,7 @@ b: %expect-rr 4
|
|||||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
|
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
|
||||||
[[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 4 expected
|
[[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 4 expected
|
||||||
b: %expect-rr 4
|
b: %expect-rr 4
|
||||||
^^^^^^^^^^^^
|
^~~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -1396,7 +1396,7 @@ b: %expect-rr 2
|
|||||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
|
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
|
||||||
[[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 2 expected
|
[[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 2 expected
|
||||||
b: %expect-rr 2
|
b: %expect-rr 2
|
||||||
^^^^^^^^^^^^
|
^~~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -85,7 +85,8 @@ exp: %empty;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([--defines -o input.c input.y], [], [],
|
AT_BISON_CHECK([--defines -o input.c input.y], [], [],
|
||||||
[[input.y:11.1-12: warning: deprecated directive: '%name-prefix', use '%define api.prefix' [-Wdeprecated]
|
[[input.y:11.1-18: warning: deprecated directive: '%name-prefix "my_"', use '%define api.prefix {my_}' [-Wdeprecated]
|
||||||
|
input.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# YYLTYPE should be defined, and MY_LLOC declared.
|
# YYLTYPE should be defined, and MY_LLOC declared.
|
||||||
@@ -125,7 +126,7 @@ AT_BISON_OPTION_PUSHDEFS([$1])
|
|||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[$1
|
[[$1
|
||||||
%define parse.error verbose
|
%define parse.error verbose
|
||||||
]AT_VARIANT_IF([], [%union {int integer;}])[
|
]AT_VARIANT_IF([%token <int> 'x'], [%union {int integer;}])[
|
||||||
%code {
|
%code {
|
||||||
]AT_PUSH_IF([[
|
]AT_PUSH_IF([[
|
||||||
#if defined __GNUC__ && 7 == __GNUC__
|
#if defined __GNUC__ && 7 == __GNUC__
|
||||||
@@ -329,6 +330,7 @@ AT_CHECK([[$PERL -n -0777 -e '
|
|||||||
|YY_MOVE_OR_COPY
|
|YY_MOVE_OR_COPY
|
||||||
|YY_MOVE_REF
|
|YY_MOVE_REF
|
||||||
|YY_NOEXCEPT
|
|YY_NOEXCEPT
|
||||||
|
|YY_NOTHROW
|
||||||
|YY_NULLPTR
|
|YY_NULLPTR
|
||||||
|YY_RVREF
|
|YY_RVREF
|
||||||
|YY_\w+_INCLUDED
|
|YY_\w+_INCLUDED
|
||||||
|
|||||||
+299
-220
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -707,8 +707,9 @@ if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
|
|||||||
# Build expected stderr up to and including the "warnings being
|
# Build expected stderr up to and including the "warnings being
|
||||||
# treated as errors" message.
|
# treated as errors" message.
|
||||||
]AT_DATA([[experr]], [$4])[
|
]AT_DATA([[experr]], [$4])[
|
||||||
$PERL -pi -e 's{(.*): warning: (.*)\[-W(.*)\]$}
|
$PERL -pi -e 's{(.*): warning:}{$][1: error:};' \
|
||||||
{$][1: error: $][2\@<:@-Werror=$][3@:>@}' experr
|
-e 's{\[-W(.*)\]$}{@<:@-Werror=$][1@:>@}' \
|
||||||
|
experr
|
||||||
]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
|
]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
|
||||||
|
|
||||||
# Now check --warnings=error.
|
# Now check --warnings=error.
|
||||||
|
|||||||
+48
-48
@@ -254,16 +254,16 @@ exp:
|
|||||||
AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
|
AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
|
||||||
[[test.y:52.51-60: error: invalid reference: '$<ival>lo9'
|
[[test.y:52.51-60: error: invalid reference: '$<ival>lo9'
|
||||||
| exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
|
| exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
|
||||||
^^^^^^^^^^
|
^~~~~~~~~~
|
||||||
test.y:52.3-68: symbol not found in production: lo9
|
test.y:52.3-68: symbol not found in production: lo9
|
||||||
| exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
|
| exp[x] '+' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>lo9 + $r; }
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:53.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
|
test.y:53.51-60: warning: misleading reference: '$<ival>exp' [-Wother]
|
||||||
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
||||||
^^^^^^^^^^
|
^~~~~~~~~~
|
||||||
test.y:44.1-3: refers to: $exp at $$
|
test.y:44.1-3: refers to: $exp at $$
|
||||||
exp:
|
exp:
|
||||||
^^^
|
^~~
|
||||||
test.y:53.7: possibly meant: $x, hiding $exp at $1
|
test.y:53.7: possibly meant: $x, hiding $exp at $1
|
||||||
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
| exp[x] '-' { $<ival>$ = $x; } [l] exp[r] { $$ = $<ival>exp - $r; }
|
||||||
^
|
^
|
||||||
@@ -272,19 +272,19 @@ test.y:53.41: possibly meant: $r, hiding $exp at $4
|
|||||||
^
|
^
|
||||||
test.y:54.51-52: error: $l of 'exp' has no declared type
|
test.y:54.51-52: error: $l of 'exp' has no declared type
|
||||||
| exp[x] '*' { $<ival>$ = $x; } [l] exp[r] { $$ = $l * $r; }
|
| exp[x] '*' { $<ival>$ = $x; } [l] exp[r] { $$ = $l * $r; }
|
||||||
^^
|
^~
|
||||||
test.y:57.40-43: error: invalid reference: '$r12'
|
test.y:57.40-43: error: invalid reference: '$r12'
|
||||||
| exp[l] '^' exp[r] { $$ = power ($l, $r12); }
|
| exp[l] '^' exp[r] { $$ = power ($l, $r12); }
|
||||||
^^^^
|
^~~~
|
||||||
test.y:57.3-47: symbol not found in production: r12
|
test.y:57.3-47: symbol not found in production: r12
|
||||||
| exp[l] '^' exp[r] { $$ = power ($l, $r12); }
|
| exp[l] '^' exp[r] { $$ = power ($l, $r12); }
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:58.29-33: error: invalid reference: '$expo'
|
test.y:58.29-33: error: invalid reference: '$expo'
|
||||||
| '(' exp ')' { $$ = $expo; }
|
| '(' exp ')' { $$ = $expo; }
|
||||||
^^^^^
|
^~~~~
|
||||||
test.y:58.3-46: symbol not found in production: expo
|
test.y:58.3-46: symbol not found in production: expo
|
||||||
| '(' exp ')' { $$ = $expo; }
|
| '(' exp ')' { $$ = $expo; }
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -423,121 +423,121 @@ test.y:45.41-46: possibly meant: $[then-a].f at $4
|
|||||||
AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
|
AT_BISON_CHECK([-fcaret -o test.c test.y], 1, [],
|
||||||
[[test.y:24.36-41: error: invalid reference: '$cond1'
|
[[test.y:24.36-41: error: invalid reference: '$cond1'
|
||||||
{ $if_stmt1 = new IfStmt($cond1, $then.f1, $else); };
|
{ $if_stmt1 = new IfStmt($cond1, $then.f1, $else); };
|
||||||
^^^^^^
|
^~~~~~
|
||||||
test.y:23.11-24.62: symbol not found in production: cond1
|
test.y:23.11-24.62: symbol not found in production: cond1
|
||||||
if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI
|
if_stmt1: IF expr[cond] THEN stmt[then] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:26.43-53: error: invalid reference: '$stmt.field'
|
test.y:26.43-53: error: invalid reference: '$stmt.field'
|
||||||
{ $if_stmt2 = new IfStmt($cond, $stmt.field, 0); };
|
{ $if_stmt2 = new IfStmt($cond, $stmt.field, 0); };
|
||||||
^^^^^^^^^^^
|
^~~~~~~~~~~
|
||||||
test.y:25.11-26.60: symbol not found in production: stmt
|
test.y:25.11-26.60: symbol not found in production: stmt
|
||||||
if_stmt2: IF expr[cond] THEN stmt[then] FI
|
if_stmt2: IF expr[cond] THEN stmt[then] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:25.35-38: possibly meant: $then.field, hiding $stmt.field at $4
|
test.y:25.35-38: possibly meant: $then.field, hiding $stmt.field at $4
|
||||||
if_stmt2: IF expr[cond] THEN stmt[then] FI
|
if_stmt2: IF expr[cond] THEN stmt[then] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:28.43-52: error: invalid reference: '$stmt.list'
|
test.y:28.43-52: error: invalid reference: '$stmt.list'
|
||||||
{ $if_stmt3 = new IfStmt($cond, $stmt.list, 0); };
|
{ $if_stmt3 = new IfStmt($cond, $stmt.list, 0); };
|
||||||
^^^^^^^^^^
|
^~~~~~~~~~
|
||||||
test.y:27.11-28.59: symbol not found in production: stmt
|
test.y:27.11-28.59: symbol not found in production: stmt
|
||||||
if_stmt3: IF expr[cond] THEN stmt.list FI
|
if_stmt3: IF expr[cond] THEN stmt.list FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:27.30-38: possibly meant: $[stmt.list] at $4
|
test.y:27.30-38: possibly meant: $[stmt.list] at $4
|
||||||
if_stmt3: IF expr[cond] THEN stmt.list FI
|
if_stmt3: IF expr[cond] THEN stmt.list FI
|
||||||
^^^^^^^^^
|
^~~~~~~~~
|
||||||
test.y:30.43-46: error: ambiguous reference: '$xyz'
|
test.y:30.43-46: error: ambiguous reference: '$xyz'
|
||||||
{ $if_stmt4 = new IfStmt($cond, $xyz, $cond); };
|
{ $if_stmt4 = new IfStmt($cond, $xyz, $cond); };
|
||||||
^^^^
|
^~~~
|
||||||
test.y:29.35-37: refers to: $xyz at $4
|
test.y:29.35-37: refers to: $xyz at $4
|
||||||
if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
|
if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
|
||||||
^^^
|
^~~
|
||||||
test.y:29.50-52: refers to: $xyz at $6
|
test.y:29.50-52: refers to: $xyz at $6
|
||||||
if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
|
if_stmt4: IF expr[cond] THEN stmt[xyz] ELSE stmt[xyz] FI
|
||||||
^^^
|
^~~
|
||||||
test.y:32.43-52: error: invalid reference: '$stmt.list'
|
test.y:32.43-52: error: invalid reference: '$stmt.list'
|
||||||
{ $if_stmt5 = new IfStmt($cond, $stmt.list, $else); };
|
{ $if_stmt5 = new IfStmt($cond, $stmt.list, $else); };
|
||||||
^^^^^^^^^^
|
^~~~~~~~~~
|
||||||
test.y:31.11-32.63: symbol not found in production: stmt
|
test.y:31.11-32.63: symbol not found in production: stmt
|
||||||
if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:31.40-43: possibly meant: $then, hiding $[stmt.list] at $4
|
test.y:31.40-43: possibly meant: $then, hiding $[stmt.list] at $4
|
||||||
if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:31.61-64: possibly meant: $else, hiding $[stmt.list] at $6
|
test.y:31.61-64: possibly meant: $else, hiding $[stmt.list] at $6
|
||||||
if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt5: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:34.43-58: error: invalid reference: '$stmt.list.field'
|
test.y:34.43-58: error: invalid reference: '$stmt.list.field'
|
||||||
{ $if_stmt6 = new IfStmt($cond, $stmt.list.field, $else); };
|
{ $if_stmt6 = new IfStmt($cond, $stmt.list.field, $else); };
|
||||||
^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~
|
||||||
test.y:33.11-34.69: symbol not found in production: stmt
|
test.y:33.11-34.69: symbol not found in production: stmt
|
||||||
if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:33.40-43: possibly meant: $then.field, hiding $[stmt.list].field at $4
|
test.y:33.40-43: possibly meant: $then.field, hiding $[stmt.list].field at $4
|
||||||
if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:33.61-64: possibly meant: $else.field, hiding $[stmt.list].field at $6
|
test.y:33.61-64: possibly meant: $else.field, hiding $[stmt.list].field at $6
|
||||||
if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt6: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:36.43-54: error: invalid reference: '$[stmt.list]'
|
test.y:36.43-54: error: invalid reference: '$[stmt.list]'
|
||||||
{ $if_stmt7 = new IfStmt($cond, $[stmt.list].field, $else); };
|
{ $if_stmt7 = new IfStmt($cond, $[stmt.list].field, $else); };
|
||||||
^^^^^^^^^^^^
|
^~~~~~~~~~~~
|
||||||
test.y:35.11-36.71: symbol not found in production: stmt.list
|
test.y:35.11-36.71: symbol not found in production: stmt.list
|
||||||
if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:35.40-43: possibly meant: $then, hiding $[stmt.list] at $4
|
test.y:35.40-43: possibly meant: $then, hiding $[stmt.list] at $4
|
||||||
if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:35.61-64: possibly meant: $else, hiding $[stmt.list] at $6
|
test.y:35.61-64: possibly meant: $else, hiding $[stmt.list] at $6
|
||||||
if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if_stmt7: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^
|
^~~~
|
||||||
test.y:38.43-49: error: invalid reference: '$then.1'
|
test.y:38.43-49: error: invalid reference: '$then.1'
|
||||||
{ $if_stmt8 = new IfStmt($cond, $then.1, $else); };
|
{ $if_stmt8 = new IfStmt($cond, $then.1, $else); };
|
||||||
^^^^^^^
|
^~~~~~~
|
||||||
test.y:37.11-38.60: symbol not found in production: then
|
test.y:37.11-38.60: symbol not found in production: then
|
||||||
if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:37.40-45: possibly meant: $[then.1] at $4
|
test.y:37.40-45: possibly meant: $[then.1] at $4
|
||||||
if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
if_stmt8: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
||||||
^^^^^^
|
^~~~~~
|
||||||
test.y:40.43-55: error: invalid reference: '$then.1.field'
|
test.y:40.43-55: error: invalid reference: '$then.1.field'
|
||||||
{ $if_stmt9 = new IfStmt($cond, $then.1.field, $else); };
|
{ $if_stmt9 = new IfStmt($cond, $then.1.field, $else); };
|
||||||
^^^^^^^^^^^^^
|
^~~~~~~~~~~~~
|
||||||
test.y:39.11-40.66: symbol not found in production: then
|
test.y:39.11-40.66: symbol not found in production: then
|
||||||
if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:39.40-45: possibly meant: $[then.1].field at $4
|
test.y:39.40-45: possibly meant: $[then.1].field at $4
|
||||||
if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
if_stmt9: IF expr[cond] THEN stmt.list[then.1] ELSE stmt.list[else] FI
|
||||||
^^^^^^
|
^~~~~~
|
||||||
test.y:42.44-50: error: invalid reference: '$stmt.x'
|
test.y:42.44-50: error: invalid reference: '$stmt.x'
|
||||||
{ $if_stmt10 = new IfStmt($cond, $stmt.x, 0); };
|
{ $if_stmt10 = new IfStmt($cond, $stmt.x, 0); };
|
||||||
^^^^^^^
|
^~~~~~~
|
||||||
test.y:41.12-42.57: symbol not found in production: stmt
|
test.y:41.12-42.57: symbol not found in production: stmt
|
||||||
if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
|
if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:41.36-41: possibly meant: $[stmt.x].x, hiding $stmt.x at $4
|
test.y:41.36-41: possibly meant: $[stmt.x].x, hiding $stmt.x at $4
|
||||||
if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
|
if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
|
||||||
^^^^^^
|
^~~~~~
|
||||||
test.y:41.36-41: possibly meant: $[stmt.x] at $4
|
test.y:41.36-41: possibly meant: $[stmt.x] at $4
|
||||||
if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
|
if_stmt10: IF expr[cond] THEN stmt[stmt.x] FI
|
||||||
^^^^^^
|
^~~~~~
|
||||||
test.y:44.13-22: error: invalid reference: '$if-stmt-a'
|
test.y:44.13-22: error: invalid reference: '$if-stmt-a'
|
||||||
{ $if-stmt-a = new IfStmt($cond, $then, $else); };
|
{ $if-stmt-a = new IfStmt($cond, $then, $else); };
|
||||||
^^^^^^^^^^
|
^~~~~~~~~~
|
||||||
test.y:43.12-44.59: symbol not found in production: if
|
test.y:43.12-44.59: symbol not found in production: if
|
||||||
if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:43.1-9: possibly meant: $[if-stmt-a] at $$
|
test.y:43.1-9: possibly meant: $[if-stmt-a] at $$
|
||||||
if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
if-stmt-a: IF expr[cond] THEN stmt.list[then] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^
|
^~~~~~~~~
|
||||||
test.y:46.46-54: error: invalid reference: '$then-a.f'
|
test.y:46.46-54: error: invalid reference: '$then-a.f'
|
||||||
{ $[if-stmt-b] = new IfStmt($cond, $then-a.f, $else); };
|
{ $[if-stmt-b] = new IfStmt($cond, $then-a.f, $else); };
|
||||||
^^^^^^^^^
|
^~~~~~~~~
|
||||||
test.y:45.12-46.65: symbol not found in production: then
|
test.y:45.12-46.65: symbol not found in production: then
|
||||||
if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
|
if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
test.y:45.41-46: possibly meant: $[then-a].f at $4
|
test.y:45.41-46: possibly meant: $[then-a].f at $4
|
||||||
if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
|
if-stmt-b: IF expr[cond] THEN if-stmt-a[then-a] ELSE stmt.list[else] FI
|
||||||
^^^^^^
|
^~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
+1
-1
@@ -154,7 +154,7 @@ start: ;
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([[input.y]], [[1]], [],
|
AT_BISON_CHECK([[input.y]], [[1]], [],
|
||||||
[[input.y:2.9-21: error: %define variable 'api.push-pull' is not used
|
[[input.y:2.1-26: error: %define variable 'api.push-pull' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
+15
-15
@@ -134,31 +134,31 @@ AT_BISON_CHECK([[-fcaret input.y]], 0, [],
|
|||||||
input.y: warning: 9 rules useless in grammar [-Wother]
|
input.y: warning: 9 rules useless in grammar [-Wother]
|
||||||
input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
|
input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
|
||||||
useless1: '1';
|
useless1: '1';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
|
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
|
||||||
useless2: '2';
|
useless2: '2';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
|
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
|
||||||
useless3: '3';
|
useless3: '3';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
|
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
|
||||||
useless4: '4';
|
useless4: '4';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
|
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
|
||||||
useless5: '5';
|
useless5: '5';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
|
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
|
||||||
useless6: '6';
|
useless6: '6';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
|
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
|
||||||
useless7: '7';
|
useless7: '7';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
|
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
|
||||||
useless8: '8';
|
useless8: '8';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
|
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
|
||||||
useless9: '9';
|
useless9: '9';
|
||||||
^^^^^^^^
|
^~~~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -240,13 +240,13 @@ AT_BISON_CHECK([[-fcaret not-reduced.y]], 0, [],
|
|||||||
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
|
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
|
||||||
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
|
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
|
||||||
not_reachable: useful { /* A not reachable action. */ }
|
not_reachable: useful { /* A not reachable action. */ }
|
||||||
^^^^^^^^^^^^^
|
^~~~~~~~~~~~~
|
||||||
not-reduced.y:17.1-14: warning: nonterminal useless in grammar: non_productive [-Wother]
|
not-reduced.y:17.1-14: warning: nonterminal useless in grammar: non_productive [-Wother]
|
||||||
non_productive: non_productive useless_token
|
non_productive: non_productive useless_token
|
||||||
^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~
|
||||||
not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
|
not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
|
||||||
| non_productive { /* A non productive action. */ }
|
| non_productive { /* A non productive action. */ }
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
|
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
|
||||||
@@ -319,13 +319,13 @@ AT_BISON_CHECK([[-fcaret input.y]], 0, [],
|
|||||||
input.y: warning: 3 rules useless in grammar [-Wother]
|
input.y: warning: 3 rules useless in grammar [-Wother]
|
||||||
input.y:6.1-11: warning: nonterminal useless in grammar: underivable [-Wother]
|
input.y:6.1-11: warning: nonterminal useless in grammar: underivable [-Wother]
|
||||||
underivable: indirection;
|
underivable: indirection;
|
||||||
^^^^^^^^^^^
|
^~~~~~~~~~~
|
||||||
input.y:7.1-11: warning: nonterminal useless in grammar: indirection [-Wother]
|
input.y:7.1-11: warning: nonterminal useless in grammar: indirection [-Wother]
|
||||||
indirection: underivable;
|
indirection: underivable;
|
||||||
^^^^^^^^^^^
|
^~~~~~~~~~~
|
||||||
input.y:5.15-25: warning: rule useless in grammar [-Wother]
|
input.y:5.15-25: warning: rule useless in grammar [-Wother]
|
||||||
exp: useful | underivable;
|
exp: useful | underivable;
|
||||||
^^^^^^^^^^^
|
^~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
|
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,
|
||||||
|
|||||||
+2
-2
@@ -454,10 +454,10 @@ input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" used
|
|||||||
AT_BISON_CHECK([-fcaret -o input.c input.y], [[0]], [[]],
|
AT_BISON_CHECK([-fcaret -o input.c input.y], [[0]], [[]],
|
||||||
[[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
|
[[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
|
||||||
%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
|
%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
|
||||||
^^^^^^^
|
^~~~~~~
|
||||||
input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" used more than once as a literal string [-Wother]
|
input.y:22.16-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" used more than once as a literal string [-Wother]
|
||||||
%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
|
%token SPECIAL "\\\'\?\"\a\b\f\n\r\t\v\001\201\x001\x000081??!"
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
]])
|
]])
|
||||||
AT_COMPILE([input])
|
AT_COMPILE([input])
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -32,7 +32,7 @@ exp: %empty;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
||||||
[[input.y:2.9-22: error: '%union' and '%define api.value.type' cannot be used together
|
[[input.y:2.1-38: error: '%union' and '%define api.value.type' cannot be used together
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -51,7 +51,7 @@ exp: %empty;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
||||||
[[input.y:2.9-22: error: '%yacc' and '%define api.value.type "union"' cannot be used together
|
[[input.y:2.1-28: error: '%yacc' and '%define api.value.type "union"' cannot be used together
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
Reference in New Issue
Block a user