diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-11-11 13:29:47 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-11-13 06:17:52 +0100 |
commit | d8cc6b073e2802d871a16dc62418a7eb62ed2216 (patch) | |
tree | 328311ed5f70335bbb707908fc761c3f860f7101 /NEWS | |
parent | 0264b4bca071cfac10a8909f30e0e5aa422b35d6 (diff) | |
download | bison-d8cc6b073e2802d871a16dc62418a7eb62ed2216.tar.gz |
c++: shorten the assertions that check whether tokens are correct
Before:
YY_ASSERT (tok == token::YYEOF || tok == token::YYerror || tok == token::YYUNDEF || tok == 120 || tok == 49 || tok == 50 || tok == 51 || tok == 52 || tok == 53 || tok == 54 || tok == 55 || tok == 56 || tok == 57 || tok == 97 || tok == 98);
After:
YY_ASSERT (tok == token::YYEOF
|| (token::YYerror <= tok && tok <= token::YYUNDEF)
|| tok == 120
|| (49 <= tok && tok <= 57)
|| (97 <= tok && tok <= 98));
Clauses are now also wrapped on several lines. This is nicer to read
and diff, but also avoids pushing Visual C++ to its arbitrary
limits (640K and lines of 16380 bytes ought to be enough for anybody,
otherwise make an C2026 error).
The useless parens are there for the dummy warnings about
precedence (in the future, will we also have to put parens in
`1+2*3`?).
* data/skeletons/variant.hh (_b4_filter_tokens, b4_tok_in, b4_tok_in):
New.
(_b4_token_constructor_define): Use them.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -18,6 +18,10 @@ GNU Bison NEWS The private internal macro YY_ASSERT now obeys the `api.prefix` %define variable. + When there is a very large number of tokens, some assertions could be long + enough to hit arbitrary limits in Visual C++. They have been rewritten to + work around this limitation. + ** Changes The YYBISON macro in generated "regular C parsers" (from the "yacc.c" |