Commit Graph

6736 Commits

Author SHA1 Message Date
Akim Demaille
ece99a890c tests: make AT_PARSE_PARAMS usable at the end of arguments
When not empty, AT_PARSE_PARAMS was guaranteed to end with a comma.
Remove the trailing comma, so that we can use AT_PARSE_PARAMS at the
end of the arguments, not only at the beginning.

* tests/local.at: here.
Unfortunately, m4_append relies on the macro not being defined whereas
we would have preferred it to check for emptiness.  So use
m4_define/m4_undefine instead of m4_pushdef/m4_popdef.
2020-01-15 08:55:51 +01:00
Akim Demaille
169c2530e4 tests: fix AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS pairs
* tests/glr-regression.at, tests/java.at, tests/javapush.at:
Close properly what is opened.
Do not nest.
2020-01-15 08:54:52 +01:00
Akim Demaille
c894a6e2ce d, java: use traces more alike that of C
Same order, same places, same content.

* data/skeletons/lalr1.d, data/skeletons/lalr1.java: here.
2020-01-15 06:23:46 +01:00
Akim Demaille
187c2ac344 c++: report the stack at the same places as in C
Let's have C be the reference, and match it elsewhere.  Maybe C is too
verbose and some adjustments are needed, but then that would be done
in another batch of patches.

* data/skeletons/lalr1.cc: Print the stack once we popped after
YYERROR, and before emptying the stack at the end of parsing.
2020-01-15 06:22:42 +01:00
Akim Demaille
f06c0d2c05 c++: display the stack in the same order as in C
Currently the C and C++ parse traces differ in the order in which the
stack is displayed: bottom up in C, top down in C++.  Let's stick to
the C order.

* data/skeletons/stack.hh (stack::iterator, stack::const_iterator)
(begin, end): Be forward, not backward.
2020-01-15 06:22:31 +01:00
Akim Demaille
975be86ccc style: avoid redundancy in the tests
* tests/local.at (m4_rpatsubst): New.
Use it to handle %parse-params.
* tests/calc.at: Use %parse-params with several arguments.
2020-01-15 06:22:19 +01:00
Akim Demaille
1c0adb410d yacc.c: comment changes
In particular, import Adrian Vogelsgesang's comments about LAC from
lalr1.cc.

* data/skeletons/yacc.c: here.
2020-01-11 18:01:39 +01:00
Akim Demaille
32b529f038 yacc.c: style: double-quote the argument of b4_percent_define_get
* data/skeletons/yacc.c: Here, for consistency.
2020-01-11 17:35:24 +01:00
Akim Demaille
46cce832fd yacc.c: introduce yysymbol_name
Provide the users with a public API to get the name of the tokens.  A
thin wrapper around yytname.

* data/skeletons/yacc.c (yysymbol_name): New.
Use it.
2020-01-11 16:14:06 +01:00
Akim Demaille
98a1045bea CI: check on PPC64le, ARM64 and s390x
I was hoping it would help us catch warnings when char is
unsigned (see 78bb152a63), but it does
not seem to help.  It's a pity that the compiler is the same all over
the place, I would have preferred testing others.

* .travis.yml: here.
2020-01-11 16:11:45 +01:00
Akim Demaille
8426663631 todo: update 2020-01-11 08:59:51 +01:00
Akim Demaille
a0675d707f Merge branch 'maint' into HEAD
* maint:
  gnulib: update
  lalr1.cc: avoid static_cast
  glr.c: add missing cast
  regen
  package: bump copyrights to 2020
  gitignore: update
2020-01-11 07:38:39 +01:00
Akim Demaille
9cf0a97aa9 gnulib: update 2020-01-11 06:03:51 +01:00
Akim Demaille
3dec8a4caf lalr1.cc: avoid static_cast
Reported by donmac703.
Fixes https://github.com/akimd/bison/issues/20.

* data/skeletons/lalr1.cc: here.
2020-01-10 19:31:00 +01:00
Akim Demaille
2cb52c5a91 glr.c: add missing cast
Reported by psjo.
Fixes https://github.com/akimd/bison/issues/19.

* data/skeletons/glr.c (yyprocessOneStack): Here.
2020-01-10 19:30:54 +01:00
Akim Demaille
04f3bfc596 regen 2020-01-10 19:21:35 +01:00
Akim Demaille
c67daa9a97 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-10 19:16:23 +01:00
Akim Demaille
2ca8e86f83 gitignore: update 2020-01-10 19:16:16 +01:00
Akim Demaille
e419eda5e2 regen 2020-01-10 18:38:02 +01:00
Akim Demaille
2116af766a yacc.c: simplify use of YYDPRINTF
* data/skeletons/yacc.c (YYDPRINTF): Expand to no-op (instead of
nothing) when disabled.
Simplify callers.
2020-01-09 09:02:55 +01:00
Akim Demaille
8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00
Akim Demaille
c442b5de9d gitignore: update 2020-01-05 09:40:46 +01:00
Akim Demaille
da4587fcd7 doc: YYERROR_VERBOSE is no longer supported
* doc/bison.texi (Table of Symbols): Remove last reference to it.
* NEWS: Be clear about that.
2020-01-04 09:14:19 +01:00
Akim Demaille
86a3ec0f8d glr.c: no longer support YYERROR_VERBOSE
* data/skeletons/glr.c: Rather, dispatch directly on parse.error's
value.
2020-01-04 09:14:19 +01:00
Akim Demaille
7122d747cf yacc.c: no longer support YYERROR_VERBOSE
Supporting YYERROR_VERBOSE via cpp is a nuisance: m4 is in charge of
handling alternatives.  When adding more options for %define
parse.error, supporting both CPP and M4 is too complex.  Anyway,
YYERROR_VERBOSE was deprecated long ago.

* data/skeletons/yacc.c: Use m4 only to handle verbose/simple error
messages.
2020-01-04 09:12:43 +01:00
Akim Demaille
69fe4b9eb6 yacc.c: avoid negations
* data/skeletons/yacc.c (yyerrlab): here.
2020-01-03 09:07:40 +01:00
Akim Demaille
385fb345bf glr.c: clarify yyreportSyntaxError
See the previous commit.

* data/skeletons/glr.c (yyreportSyntaxError): First compute the
arguments of the error message, _then_ th error message size.
2019-12-31 12:00:04 +01:00
Akim Demaille
f983d00e77 yacc: restructure and fix yysyntax_error
I would like to offer new ways to build the error message.  As a first
step, let's simplify yysyntax_error whose first loop does two things
at the same time: (i) collect the tokens to be reported in the error
message, and (ii) accumulate their sizes and possibly return
"overflow".  Let's pull (ii) in a second step.

Then test 525 (regression.at:1193: parse.error=verbose overflow)
failed.  This test checks that we correctly report "memory overflow"
when the error message is too large.  However the test is mistaken: it
is triggered in a place where there are five (large) expected tokens,
so anyway we would not display them, so there is no (memory) overflow
here!  Transform this test to (i) check that indeed there is no
overflow, and (ii) create syntax_error3 which does check the intended
behavior, but with four expected tokens.

* data/skeletons/yacc.c (yysyntax_error): First compute the list of
arguments, then compute yysize.
* tests/regression.at (parse.error=verbose overflow): Enhance and fix.
2019-12-31 12:00:04 +01:00
Akim Demaille
78bb152a63 tests: also check -Wchar-subscripts
GCC's -Wchar-subscripts may report issues on platforms where char is
unsigned.  Unfortunately the current CI does not reproduce the
problem.  But that would allow contributors to report issues if the
warning appears somewhere.

See 139d065594.
Problem reported by Andy Fiddaman in:
https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html

* configure.ac (warn_common): Add -Wchar-subscripts.
2019-12-31 12:00:02 +01:00
Akim Demaille
4d6ff4c5e5 CI: do not specify the language
When we give travis the langugage, it overrides our envvars.  Instead
of the MATRIX_EVAL trick, just stop specifying the language.
2019-12-30 15:28:15 +01:00
Akim Demaille
9bb5087ad1 CI: remove ICC support, we can no longer use it
https://github.com/nemequ/icc-travis/issues/15
2019-12-30 08:56:46 +01:00
Akim Demaille
d29e40a047 doc: clean up the description of YYDEBUG
* doc/bison.texi: Make it clearer that %define parse.trace is the
preferred options.
Fix a typo about api.prefix.
2019-12-29 11:13:00 +01:00
Akim Demaille
b10366f296 glr.cc: avoid compiler warnings
381. types.at:366: testing glr.cc api.value.type={double} ...
    test.cc:207:57: error: "__clang_major__" is not defined, evaluates to 0 [-Werror=undef]
      207 | #if defined __APPLE__ && YY_CPLUSPLUS < 201103L && 4 <= __clang_major__
          |                                                         ^~~~~~~~~~~~~~~

* data/skeletons/glr.cc: Check __clang_major__ before using it.
2019-12-29 11:13:00 +01:00
Paul Eggert
139d065594 warnings: pacify ‘gcc -Wchar-subscripts’ in yacc.c
Problem reported by Andy Fiddaman in:
https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html
* data/skeletons/yacc.c (yy_reduce_print, yy_lac, yysyntax_error)
(yyreturn): If I might be a char, write a[+I] instead of a[I],
so that ‘gcc -Wchar-subscripts’ does not complain.
2019-12-18 13:35:28 -08:00
Akim Demaille
0d73c39bb7 doc: formatting changes
* doc/bison.texi: No output changes.
2019-12-14 17:19:53 +01:00
Akim Demaille
7f01adced9 tests: don't fail if seq is no available
As is the case on Solaris.
Reported by Dennis Clarke.
https://lists.gnu.org/archive/html/bug-bison/2019-12/msg00011.html

* examples/c/reccalc/reccalc.test: Skip if there is no seq.
2019-12-14 17:19:53 +01:00
Akim Demaille
3bad20352c maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-12-11 07:57:45 +01:00
Akim Demaille
cb3bf6493d version 3.5
* NEWS: Record release date.
v3.5
2019-12-11 07:41:51 +01:00
Akim Demaille
57503e2165 news: prepare for 3.5 2019-12-10 07:06:04 +01:00
Akim Demaille
b3abe014f2 glr.cc: disable warnings from Clang on macOS
$ cat test.cc
    #include <stddef.h>
    #include <stdint.h>

    ptrdiff_t half_max_capacity = PTRDIFF_MAX;
    $ clang++-mp-9.0 -pedantic -std=c++98 /tmp/test.cc -c
    /tmp/test.cc:4:31: warning: 'long long' is a C++11 extension [-Wc++11-long-long]
    ptrdiff_t half_max_capacity = PTRDIFF_MAX;
                                  ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:149:23:
            note: expanded from macro 'PTRDIFF_MAX'
    #define PTRDIFF_MAX       INT64_MAX
                              ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:75:26:
            note: expanded from macro 'INT64_MAX'
    #define INT64_MAX        9223372036854775807LL
                             ^
    1 warning generated.

* data/skeletons/glr.cc: here.
2019-12-08 16:34:53 +01:00
Akim Demaille
80f3220fea api.token.raw: fix it in C++
Another breakage revealed by vcsn.

* data/skeletons/c++.m4 (yytranslate_): Do not hard code "yy" and
"parser", both can be changed by the user.
Actually, since we are in the parser itself, there's really no need to
qualify the type.
2019-12-08 16:07:50 +01:00
Akim Demaille
fc2040a750 c++: fix comments for %code blocks
In a project of mine, vcsn, this commit fixes the following comments.

    --- /tmp/parse.hh	2019-12-08 15:51:24.792934703 +0100
    +++ lib/vcsn/rat/parse.hh	2019-12-08 16:00:59.137107503 +0100
    @@ -43,7 +43,7 @@

     #ifndef YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
     # define YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
    -// //                    "%code requires" blocks.
    +// "%code requires" blocks.
     #line 20 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy"

       #include <iostream>
    @@ -1851,7 +1851,7 @@

    -// //                    "%code provides" blocks.
    +// "%code provides" blocks.
     #line 60 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy"

       #define YY_DECL_(Class) \

* data/skeletons/bison.m4 (b4_percent_code_get): Pass an expanded
string to b4_comment.
2019-12-08 16:03:36 +01:00
Akim Demaille
d55f240991 parser: pretend we are Bison 3.5
* src/parse-gram.y: Accept we're Bison 3.5.
2019-12-08 16:03:36 +01:00
Akim Demaille
4f961a706d c++: fix spello
* data/skeletons/lalr1.cc: here.
2019-12-08 15:42:41 +01:00
Akim Demaille
ac203e6c3c todo: update
* TODO: Schedule some features for 3.6.
Remove obsolete stuff.
2019-12-08 10:12:02 +01:00
Akim Demaille
9141f0b79f maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
2019-12-08 09:29:24 +01:00
Akim Demaille
d57eab87e8 version 3.4.92
* NEWS: Record release date.
v3.4.92
2019-12-08 09:12:30 +01:00
Akim Demaille
bb901beb68 news: fixes
Reported by Paul Eggert.
https://lists.gnu.org/archive/html/bison-patches/2019-12/msg00014.html

* NEWS: here.
2019-12-08 09:12:07 +01:00
Akim Demaille
fa00c56c17 doc: minor changes
* README-hacking.md: here.
2019-12-07 18:23:08 +01:00
Akim Demaille
5359c479bc gnulib: update 2019-12-07 15:29:43 +01:00