C++: support variadic emplace

Suggested by Askar Safin.
http://lists.gnu.org/archive/html/bug-bison/2018-12/msg00006.html

* data/variant.hh: Implement.
* tests/types.at: Check.
* doc/bison.texi: Document.
This commit is contained in:
Akim Demaille
2018-12-10 17:41:24 +01:00
parent d657da9fb4
commit 81dbd0d82e
4 changed files with 42 additions and 28 deletions

16
NEWS
View File

@@ -100,6 +100,22 @@ GNU Bison NEWS
until it sees the '='. So we notate the two possible reductions to
indicate that each conflicts in one rule.
*** C++: Variadic emplace
If your application requires C++11, you may now use a variadic emplace for
semantic values:
%define api.value.type variant
%token <std::pair<int, int>> PAIR
in your scanner:
int yylex (parser::semantic_type *lvalp)
{
lvalp->emplace <std::pair<int, int>> (1, 2);
return parser::token::PAIR;
}
*** More POSIX Yacc compatibility warnings
More Bison specific directives are now reported with -y or -Wyacc. This