diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2020-05-03 08:17:05 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2020-05-03 09:20:08 +0200 |
commit | ccaa8e29f92170a92ef2d38128d122aec59e6dbe (patch) | |
tree | ebc87c93f5ad32a5bd8d1ac8cdced36daf0a988b /.gitignore | |
parent | 76c3bccf405a2940bd891d95bcf92b182de6e5fa (diff) | |
download | bison-ccaa8e29f92170a92ef2d38128d122aec59e6dbe.tar.gz |
c++: provide backward compatibility on by_type
To write unit tests for their scanners, some users depended on
symbol_type::token():
Lexer lex("12345");
symbol_type t = lex.nextToken();
assert(t.token() == token::INTLIT);
assert(t.value.as<int>() == 12345);
But symbol_type::token() was removed in Bison 3.5 because it relied on
a conversion table. So users had to find other patterns, such as
assert(t.type_get() == by_type(token::INTLIT).type_get());
which relies on several private implementation details.
As part of transitioning from "token type" to "token kind", and making
this a public and documented interface, "by_type" was renamed
"by_kind" and "type_get()" was renamed as "kind()". The latter had
backward compatibility mechanisms, not the former.
In Bison 3.6 none of this should be used, but rather
assert(t.kind() == symbol_kind::S_INTLIT);
Reported by Pramod Kumbhar.
https://lists.gnu.org/r/bug-bison/2020-05/msg00012.html
* data/skeletons/c++.m4 (by_type): Make it an alias to by_kind.
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions