summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* package: bump copyrights to 2020Akim Demaille2020-01-05206-213/+268
| | | | Run 'make update-copyright'.
* gitignore: updateAkim Demaille2020-01-051-0/+1
|
* doc: YYERROR_VERBOSE is no longer supportedAkim Demaille2020-01-042-9/+11
| | | | | * doc/bison.texi (Table of Symbols): Remove last reference to it. * NEWS: Be clear about that.
* glr.c: no longer support YYERROR_VERBOSEAkim Demaille2020-01-041-21/+11
| | | | | * data/skeletons/glr.c: Rather, dispatch directly on parse.error's value.
* yacc.c: no longer support YYERROR_VERBOSEAkim Demaille2020-01-042-32/+21
| | | | | | | | | | 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.
* yacc.c: avoid negationsAkim Demaille2020-01-031-6/+6
| | | | * data/skeletons/yacc.c (yyerrlab): here.
* glr.c: clarify yyreportSyntaxErrorAkim Demaille2019-12-311-17/+12
| | | | | | | See the previous commit. * data/skeletons/glr.c (yyreportSyntaxError): First compute the arguments of the error message, _then_ th error message size.
* yacc: restructure and fix yysyntax_errorAkim Demaille2019-12-312-24/+30
| | | | | | | | | | | | | | | | | | | | | 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.
* tests: also check -Wchar-subscriptsAkim Demaille2019-12-311-1/+2
| | | | | | | | | | | | | 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 139d0655947c87f90af08718618feaaca0e558d7. Problem reported by Andy Fiddaman in: https://lists.gnu.org/r/bug-bison/2019-12/msg00021.html * configure.ac (warn_common): Add -Wchar-subscripts.
* CI: do not specify the languageAkim Demaille2019-12-301-30/+54
| | | | | When we give travis the langugage, it overrides our envvars. Instead of the MATRIX_EVAL trick, just stop specifying the language.
* CI: remove ICC support, we can no longer use itAkim Demaille2019-12-301-29/+0
| | | | https://github.com/nemequ/icc-travis/issues/15
* doc: clean up the description of YYDEBUGAkim Demaille2019-12-291-25/+25
| | | | | | * doc/bison.texi: Make it clearer that %define parse.trace is the preferred options. Fix a typo about api.prefix.
* glr.cc: avoid compiler warningsAkim Demaille2019-12-291-1/+2
| | | | | | | | | 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.
* warnings: pacify ‘gcc -Wchar-subscripts’ in yacc.cPaul Eggert2019-12-181-5/+5
| | | | | | | | 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.
* doc: formatting changesAkim Demaille2019-12-141-29/+28
| | | | * doc/bison.texi: No output changes.
* tests: don't fail if seq is no availableAkim Demaille2019-12-141-0/+2
| | | | | | | | 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.
* maint: post-release administriviaAkim Demaille2019-12-112-1/+4
| | | | | | * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
* version 3.5v3.5Akim Demaille2019-12-111-1/+1
| | | | * NEWS: Record release date.
* news: prepare for 3.5Akim Demaille2019-12-101-82/+71
|
* glr.cc: disable warnings from Clang on macOSAkim Demaille2019-12-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | $ 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.
* api.token.raw: fix it in C++Akim Demaille2019-12-081-1/+1
| | | | | | | | | 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.
* c++: fix comments for %code blocksAkim Demaille2019-12-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* parser: pretend we are Bison 3.5Akim Demaille2019-12-083-19/+20
| | | | * src/parse-gram.y: Accept we're Bison 3.5.
* c++: fix spelloAkim Demaille2019-12-081-1/+1
| | | | * data/skeletons/lalr1.cc: here.
* todo: updateAkim Demaille2019-12-081-79/+62
| | | | | * TODO: Schedule some features for 3.6. Remove obsolete stuff.
* maint: post-release administriviaAkim Demaille2019-12-082-1/+4
| | | | | | * NEWS: Add header line for next release. * .prev-version: Record previous version. * cfg.mk (old_NEWS_hash): Auto-update.
* version 3.4.92v3.4.92Akim Demaille2019-12-081-1/+1
| | | | * NEWS: Record release date.
* news: fixesAkim Demaille2019-12-081-10/+12
| | | | | | | Reported by Paul Eggert. https://lists.gnu.org/archive/html/bison-patches/2019-12/msg00014.html * NEWS: here.
* doc: minor changesAkim Demaille2019-12-071-2/+2
| | | | * README-hacking.md: here.
* gnulib: updateAkim Demaille2019-12-071-0/+0
|
* doc: clearly deprecate YYPRINTAkim Demaille2019-12-073-22/+24
| | | | | * doc/bison.texi (Prologue): Stop using YYPRINT as an example. (The YYPRINT Macro): Clearly show this macro is deprecated.
* doc: formatting changesAkim Demaille2019-12-071-45/+42
| | | | | * doc/bison.texi: here. No change in content.
* news: updateAkim Demaille2019-12-072-1/+30
|
* d: obey parse.errorAkim Demaille2019-12-072-77/+67
| | | | | * data/skeletons/lalr1.d (yysyntax_error): Let the dispatch be bison-time, not runtime.
* c++: also prefer YY_ASSERT to YYASSERTAkim Demaille2019-12-071-20/+20
| | | | | | Like the other skeletons. * data/skeletons/variant.hh: here.
* glr.c: obey the parse.assert %define variableAkim Demaille2019-12-075-34/+58
| | | | | | | * data/skeletons/glr.c (YYASSERT): Rename as... (YY_ASSERT): this, for consistency with yacc.c, and also to emphasize the fact that this is not for the end user (YY_ prefix). * tests/glr-regression.at: Define parse.assert.
* c++: beware of short ranges for state numbersAkim Demaille2019-12-071-1/+2
| | | | | | | | | | | | | | | | | Now that we use small integral types, possibly unsigned (e.g., unsigned char), to store state numbers, using -1 to denote an empty state (i.e., a state that stores no semantical value) is very dangerous: it will be confused with state 255, which might be non-empty. Rather than allocating a larger range of state numbers to keep the empty-state apart, let's use the number of a state known to store no value. The initial state, numbered 0, seems to fit perfectly the job. Reported by Frank Heckenbach. https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html * data/skeletons/lalr1.cc (empty_state): Be 0.
* api.token.raw: check it against api.token.constructorAkim Demaille2019-12-071-10/+49
| | | | * tests/scanner.at: here.
* regenAkim Demaille2019-12-062-18/+41
|
* warnings: enable -Wuseless-cast, and eliminate warningsAkim Demaille2019-12-067-100/+153
| | | | | | | | | | | | | | Prompted by Frank Heckenbach. https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html. * configure.ac (warn_cxx): Add -Wuseless-cast. * data/skeletons/c.m4 (b4_attribute_define): Define YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END. * data/skeletons/glr.c (YY_FPRINTF): New, replaces YYFPRINTF, wrapped with YY_IGNORE_USELESS_CAST_BEGIN and YY_IGNORE_USELESS_CAST_END. (YY_DPRINTF): Likewise. * tests/actions.at: Remove useless cast. * tests/headers.at: Adjust.
* diagnostics: style changesAkim Demaille2019-12-024-10/+14
| | | | | | * src/complain.h, src/complain.c: Comment changes. * src/scan-skel.l: Reduce scopes. * data/skeletons/bison.m4: Factor diagnostic functions.
* glr.c: style changesAkim Demaille2019-12-022-26/+27
| | | | | * data/skeletons/glr.c (yysplitStack): Reduce scopes. * tests/atlocal.in: Formatting changes.
* c++: get rid of symbol_type::token ()Akim Demaille2019-12-012-22/+2
| | | | | | | | | It is not used. And its implementation was wrong when api.token.raw was defined, as it was still mapping to the external token numbers, instead of the internal ones. Besides it was provided only when api.token.constructor is defined, yet always declared. * data/skeletons/c++.m4 (by_type::token): Remove, useless.
* c++: remove useless cast about user_token_number_max_Akim Demaille2019-12-012-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Frank Heckenbach. https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html The cast is needed when yytranslate_'s argument type is token_type, i.e., when api.token.constructor is defined. 373. types.at:138: testing lalr1.cc api.value.type=variant api.token.constructor ... ======== Testing with C++ standard flags: '' ../../tests/types.at:138: bison --color=no -fno-caret -o test.cc test.y ../../tests/types.at:138: $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS -o test test.cc $LIBS stderr: test.cc:966:16: error: result of comparison of constant 257 with expression of type 'yy::parser::token_type' (aka 'yy::parser::token::yytokentype') is always true [-Werror,-Wtautological-constant-out-of-range-compare] else if (t <= user_token_number_max_) ~ ^ ~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. It is because it is expected that when api.token.constructor is defined, only symbol constructors will be used, that yytranslate_ then takes a token_type. But it is wrong: we still allow literal characters in this case, as demonstrated by test 373 for instance. %define api.value.type variant %define api.token.constructor %token <std::pair<int, int>> '1' '2'; [...] static yy::parser::symbol_type yylex () { static char const input[] = "12"; int res = input[toknum++]; typedef yy::parser::symbol_type symbol; if (res) return symbol (res, std::make_pair (res - '0', res - '0' + 1)); else return symbol (res); } So let yytranslate_ always take an int, which makes the cast truly useless. * data/skeletons/c++.m4, data/skeletons/lalr1.cc (yytranslate_): here.
* c++: clean a few issues wrt special tokensAkim Demaille2019-12-012-7/+10
| | | | | | | | | | | | | | The C++ implementation of LAC did not skip the $undefined token, probably because it was not exposed. Expose it, and use clearer names. * data/skeletons/c++.m4: Don't define undef_token_ in yytranslate_, but... * data/skeletons/lalr1.cc (yy_undef_token_): here. Use a more precise type to define yy_undef_token_ and yy_error_token_. Unfortunately we move from a compile-time value defined via an enum to a static const member. Eventually we should make it constexpr. Make LAC implementation more alike yacc.c's one.
* d, java: improve yytranslate and neighborsAkim Demaille2019-12-012-22/+26
| | | | | | | | | | | * data/skeletons/lalr1.d, data/skeletons/lalr1.java: Don't expose yyuser_token_number_max_ and yyundef_token_. Do as in C++: scope them into yytranslate_, and only when api.token.raw is not defined. (yyterror_): Rename as... (yy_error_token_): this. * data/skeletons/lalr1.d (token_number_type): New. Use it. Can't be done in the Java backend, as Java does not have type aliases.
* d, java: get rid of a useless tableAkim Demaille2019-12-013-11/+5
| | | | | | | * data/skeletons/lalr1.d, data/skeletons/lalr1.java (yytoken_number_): Remove, useless. Was used in ancient C skeletons to support YYPRINT, long obsoleted by %printer.
* c++, d, java: remove yyerrcodeAkim Demaille2019-11-303-3/+0
| | | | | | | | | It is not used at all. We will remove it also from yacc.c, but later (see TODO). * data/skeletons/lalr1.cc, data/skeletons/lalr1.d, * data/skeletons/lalr1.java (yyerrcode_): Remove.
* c++: improve typingAkim Demaille2019-11-301-1/+1
| | | | | * data/skeletons/lalr1.cc (yysyntax_error_): symbol_type::type_get returns a symbol_number_type (which is indeed an int).
* c++: remove useless cast about yyeof_Akim Demaille2019-11-301-1/+1
| | | | | | | | | | | | | | | Reported by Frank Heckenbach. https://lists.gnu.org/archive/html/bug-bison/2019-11/msg00016.html * data/skeletons/c++.m4 (b4_yytranslate_define): Don't use yyeof_ as if it had two different types. It is used once against the input argument, which is the value returned by yylex, which is an "external token number", typically an int. It is also used as output type, an "internal symbol number". It turns out that in both cases we mean "0", but let's keep yyeof_ only for the case "internal symbol number", i.e., _after_ conversion by yytranslate. This frees us from one cast.