mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-11 19:55:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8adec9c125 | ||
|
|
cafa811a66 | ||
|
|
07a187c5ee | ||
|
|
a81bcbb245 | ||
|
|
96ef81cf07 | ||
|
|
fc54e6b9b3 | ||
|
|
cb3c595f6c | ||
|
|
b741659d85 | ||
|
|
5e28cf53be |
+1
-1
@@ -1 +1 @@
|
|||||||
3.2.1
|
3.2.3
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.2.4 (2018-12-24) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Fix the move constructor of symbol_type.
|
||||||
|
|
||||||
|
Always provide a copy constructor for symbol_type, even in modern C++.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.2.3 (2018-12-18) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Properly support token constructors in C++ with types that include commas
|
||||||
|
(e.g., std::pair<int, int>). A regression introduced in Bison 3.2.
|
||||||
|
|
||||||
* Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
|
* Noteworthy changes in release 3.2.2 (2018-11-21) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ Wayne Green [email protected]
|
|||||||
Wei Song [email protected]
|
Wei Song [email protected]
|
||||||
Wojciech Polak [email protected]
|
Wojciech Polak [email protected]
|
||||||
Wolfgang S. Kechel [email protected]
|
Wolfgang S. Kechel [email protected]
|
||||||
|
Wolfgang Thaller [email protected]
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
xolodho [email protected]
|
xolodho [email protected]
|
||||||
|
|||||||
+42
-12
@@ -244,8 +244,13 @@ m4_define([b4_symbol_type_declare],
|
|||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
basic_symbol ();
|
basic_symbol ();
|
||||||
|
|
||||||
/// Move or copy constructor.
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
basic_symbol (YY_RVREF (basic_symbol) other);
|
/// Move constructor.
|
||||||
|
basic_symbol (basic_symbol&& that);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Copy constructor.
|
||||||
|
basic_symbol (const basic_symbol& that);
|
||||||
|
|
||||||
]b4_variant_if([[
|
]b4_variant_if([[
|
||||||
/// Constructor for valueless symbols, and symbols from each type.
|
/// Constructor for valueless symbols, and symbols from each type.
|
||||||
@@ -280,7 +285,7 @@ m4_define([b4_symbol_type_declare],
|
|||||||
private:
|
private:
|
||||||
#if YY_CPLUSPLUS < 201103L
|
#if YY_CPLUSPLUS < 201103L
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
basic_symbol& operator= (const basic_symbol& other);
|
basic_symbol& operator= (const basic_symbol& that);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -290,8 +295,13 @@ m4_define([b4_symbol_type_declare],
|
|||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
by_type ();
|
by_type ();
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Move constructor.
|
||||||
|
by_type (by_type&& that);
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Copy constructor.
|
/// Copy constructor.
|
||||||
by_type (const by_type& other);
|
by_type (const by_type& that);
|
||||||
|
|
||||||
/// The symbol type as needed by the constructor.
|
/// The symbol type as needed by the constructor.
|
||||||
typedef token_type kind_type;
|
typedef token_type kind_type;
|
||||||
@@ -339,14 +349,26 @@ m4_define([b4_public_types_define],
|
|||||||
, location ()])[
|
, location ()])[
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (YY_RVREF (basic_symbol) other)
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
|
||||||
: Base (YY_MOVE (other))
|
: Base (std::move (that))
|
||||||
, value (]b4_variant_if([], [YY_MOVE (other.value)]))b4_locations_if([
|
, value (]b4_variant_if([], [std::move (that.value)]))b4_locations_if([
|
||||||
, location (YY_MOVE (other.location))])[
|
, location (std::move (that.location))])[
|
||||||
{]b4_variant_if([
|
{]b4_variant_if([
|
||||||
b4_symbol_variant([other.type_get ()], [value], [YY_MOVE_OR_COPY],
|
b4_symbol_variant([this->type_get ()], [value], [move],
|
||||||
[YY_MOVE (other.value)])])[
|
[std::move (that.value)])])[
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template <typename Base>
|
||||||
|
]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& that)
|
||||||
|
: Base (that)
|
||||||
|
, value (]b4_variant_if([], [that.value]))b4_locations_if([
|
||||||
|
, location (that.location)])[
|
||||||
|
{]b4_variant_if([
|
||||||
|
b4_symbol_variant([this->type_get ()], [value], [copy],
|
||||||
|
[that.value])])[
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_variant_if([[
|
]b4_variant_if([[
|
||||||
@@ -423,8 +445,16 @@ m4_define([b4_public_types_define],
|
|||||||
: type (empty_symbol)
|
: type (empty_symbol)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& other)
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
: type (other.type)
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (by_type&& that)
|
||||||
|
: type (that.type)
|
||||||
|
{
|
||||||
|
that.clear ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (const by_type& that)
|
||||||
|
: type (that.type)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
]b4_inline([$1])b4_parser_class_name[::by_type::by_type (token_type t)
|
||||||
|
|||||||
+31
-10
@@ -335,13 +335,21 @@ m4_define([b4_symbol_value_template],
|
|||||||
# these SYMBOL-NUMBERS. Use at class-level.
|
# these SYMBOL-NUMBERS. Use at class-level.
|
||||||
m4_define([_b4_symbol_constructor_declare],
|
m4_define([_b4_symbol_constructor_declare],
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[ static
|
[#if 201103L <= YY_CPLUSPLUS
|
||||||
|
static
|
||||||
symbol_type
|
symbol_type
|
||||||
make_[]_b4_symbol([$1], [id]) (dnl
|
make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
b4_join(b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[YY_COPY (b4_symbol([$1], [type])) v]),
|
[b4_symbol([$1], [type]) v]),
|
||||||
b4_locations_if([YY_COPY (location_type) l])));
|
b4_locations_if([location_type l])));
|
||||||
|
#else
|
||||||
|
static
|
||||||
|
symbol_type
|
||||||
|
make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
|
[const b4_symbol([$1], [type])& v]),
|
||||||
|
b4_locations_if([const location_type& l])));
|
||||||
|
#endif
|
||||||
])])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
@@ -360,18 +368,31 @@ b4_symbol_foreach([_b4_symbol_constructor_declare])])
|
|||||||
# Define symbol constructor for this SYMBOL-NUMBER.
|
# Define symbol constructor for this SYMBOL-NUMBER.
|
||||||
m4_define([_b4_symbol_constructor_define],
|
m4_define([_b4_symbol_constructor_define],
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
||||||
[ inline
|
[# if 201103L <= YY_CPLUSPLUS
|
||||||
|
inline
|
||||||
b4_parser_class_name::symbol_type
|
b4_parser_class_name::symbol_type
|
||||||
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
b4_join(b4_symbol_if([$1], [has_type],
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
[YY_COPY (b4_symbol([$1], [type])) v]),
|
[b4_symbol([$1], [type]) v]),
|
||||||
b4_locations_if([YY_COPY (location_type) l])))
|
b4_locations_if([location_type l])))
|
||||||
{
|
{
|
||||||
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
b4_symbol_if([$1], [has_type], [YY_MOVE (v)]),
|
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||||
b4_locations_if([YY_MOVE (l)])));
|
b4_locations_if([std::move (l)])));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
inline
|
||||||
|
b4_parser_class_name::symbol_type
|
||||||
|
b4_parser_class_name::make_[]_b4_symbol([$1], [id]) (dnl
|
||||||
|
b4_join(b4_symbol_if([$1], [has_type],
|
||||||
|
[const b4_symbol([$1], [type])& v]),
|
||||||
|
b4_locations_if([const location_type& l])))
|
||||||
|
{
|
||||||
|
return symbol_type (b4_join([token::b4_symbol([$1], [id])],
|
||||||
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
|
b4_locations_if([l])));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
])])])
|
])])])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+39
-13
@@ -103,7 +103,7 @@ AT_KEYWORDS([variant])
|
|||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" %debug $1])
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc" %debug $1])
|
||||||
# Store strings and integers in a vector of strings.
|
# Store strings and integers in a vector of strings.
|
||||||
AT_DATA_GRAMMAR([list.y],
|
AT_DATA_GRAMMAR([list.yy],
|
||||||
[[%skeleton "lalr1.cc"
|
[[%skeleton "lalr1.cc"
|
||||||
%define api.value.type variant
|
%define api.value.type variant
|
||||||
%define parse.assert
|
%define parse.assert
|
||||||
@@ -142,24 +142,52 @@ exp: "int" { $$.push_back ($1); }
|
|||||||
]AT_YYERROR_DEFINE[
|
]AT_YYERROR_DEFINE[
|
||||||
]AT_YYLEX_DEFINE[
|
]AT_YYLEX_DEFINE[
|
||||||
|
|
||||||
|
template <typename Exp, typename Eff>
|
||||||
|
void assert_eq (const Exp& exp, const Eff& eff)
|
||||||
|
{
|
||||||
|
if (getenv ("DEBUG"))
|
||||||
|
std::cerr << "Assert: " << exp << " == " << eff << '\n';
|
||||||
|
if (exp != eff)
|
||||||
|
std::cerr << "Assertion failed: " << exp << " != " << eff << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
using yy::parser;
|
using yy::parser;
|
||||||
// symbol_type: construction, accessor.
|
// symbol_type: construction, accessor.
|
||||||
{
|
{
|
||||||
parser::symbol_type s = parser::make_INT(12);
|
parser::symbol_type s = parser::make_INT (12);
|
||||||
std::cerr << s.value.as<int>() << '\n';
|
assert_eq (s.value.as<int> (), 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
// symbol_type: move constructor.
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
{
|
||||||
|
auto s = parser::make_INT (42);
|
||||||
|
auto s2 = std::move (s);
|
||||||
|
assert_eq (s2.value.as<int> (), 42);
|
||||||
|
// Used to crash here, because s was improperly cleared, and
|
||||||
|
// its destructor tried to delete its (moved) value.
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// symbol_type: copy constructor.
|
||||||
|
{
|
||||||
|
parser::symbol_type s = parser::make_INT (51);
|
||||||
|
parser::symbol_type s2 = s;
|
||||||
|
assert_eq (s.value.as<int> (), 51);
|
||||||
|
assert_eq (s2.value.as<int> (), 51);
|
||||||
}
|
}
|
||||||
|
|
||||||
// stack_symbol_type: construction, accessor.
|
// stack_symbol_type: construction, accessor.
|
||||||
{
|
{
|
||||||
#if defined __cplusplus && 201103L <= __cplusplus
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
auto ss = parser::stack_symbol_type(1, parser::make_INT(123));
|
auto ss = parser::stack_symbol_type(1, parser::make_INT(123));
|
||||||
#else
|
#else
|
||||||
parser::symbol_type s = parser::make_INT(123);
|
parser::symbol_type s = parser::make_INT (123);
|
||||||
parser::stack_symbol_type ss(1, s);
|
parser::stack_symbol_type ss(1, s);
|
||||||
#endif
|
#endif
|
||||||
std::cerr << ss.value.as<int>() << '\n';
|
assert_eq (ss.value.as<int> (), 123);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pushing on the stack.
|
// Pushing on the stack.
|
||||||
@@ -170,7 +198,7 @@ int main()
|
|||||||
const int mucho = 1700;
|
const int mucho = 1700;
|
||||||
for (int i = 0; i < mucho; ++i)
|
for (int i = 0; i < mucho; ++i)
|
||||||
{
|
{
|
||||||
#if defined __cplusplus && 201103L <= __cplusplus
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
st.push(parser::stack_symbol_type{1, parser::make_INT (i)});
|
st.push(parser::stack_symbol_type{1, parser::make_INT (i)});
|
||||||
#else
|
#else
|
||||||
parser::symbol_type s = parser::make_INT (i);
|
parser::symbol_type s = parser::make_INT (i);
|
||||||
@@ -180,19 +208,17 @@ int main()
|
|||||||
}
|
}
|
||||||
for (int i = mucho - 1; 0 <= i; --i)
|
for (int i = mucho - 1; 0 <= i; --i)
|
||||||
{
|
{
|
||||||
assert (st[0].value.as<int>() == i);
|
assert_eq (st[0].value.as<int>(), i);
|
||||||
st.pop ();
|
st.pop ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([[-o list.cc list.yy]])
|
||||||
AT_FOR_EACH_CXX([
|
AT_FOR_EACH_CXX([
|
||||||
AT_FULL_COMPILE([list])
|
AT_COMPILE_CXX([list])
|
||||||
AT_PARSER_CHECK([./list], 0, [],
|
AT_PARSER_CHECK([./list])
|
||||||
[12
|
|
||||||
123
|
|
||||||
])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|||||||
+21
-11
@@ -248,16 +248,25 @@ m4_pushdef([AT_YYLTYPE],
|
|||||||
[AT_CXX_IF([AT_NAMESPACE[::parser::location_type]],
|
[AT_CXX_IF([AT_NAMESPACE[::parser::location_type]],
|
||||||
[AT_API_PREFIX[LTYPE]])])
|
[AT_API_PREFIX[LTYPE]])])
|
||||||
|
|
||||||
|
AT_TOKEN_CTOR_IF(
|
||||||
AT_PURE_LEX_IF(
|
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
|
||||||
|
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
|
||||||
|
m4_pushdef([AT_YYLEX_FORMALS], [])
|
||||||
|
m4_pushdef([AT_YYLEX_RETURN], [yy::parser::symbol_type])
|
||||||
|
m4_pushdef([AT_YYLEX_ARGS], [])
|
||||||
|
m4_pushdef([AT_USE_LEX_ARGS], [])
|
||||||
|
m4_pushdef([AT_YYLEX_PRE_FORMALS], [])
|
||||||
|
m4_pushdef([AT_YYLEX_PRE_ARGS], [])],
|
||||||
|
[AT_PURE_LEX_IF(
|
||||||
[m4_pushdef([AT_LOC], [(*llocp)])
|
[m4_pushdef([AT_LOC], [(*llocp)])
|
||||||
m4_pushdef([AT_VAL], [(*lvalp)])
|
m4_pushdef([AT_VAL], [(*lvalp)])
|
||||||
m4_pushdef([AT_YYLEX_FORMALS],
|
m4_pushdef([AT_YYLEX_FORMALS],
|
||||||
[AT_YYSTYPE *lvalp[]AT_LOCATION_IF([, AT_YYLTYPE *llocp])])
|
[AT_YYSTYPE *lvalp[]AT_LOCATION_IF([, AT_YYLTYPE *llocp])])
|
||||||
|
m4_pushdef([AT_YYLEX_RETURN], [int])
|
||||||
m4_pushdef([AT_YYLEX_ARGS],
|
m4_pushdef([AT_YYLEX_ARGS],
|
||||||
[lvalp[]AT_LOCATION_IF([, llocp])])
|
[lvalp[]AT_LOCATION_IF([, llocp])])
|
||||||
m4_pushdef([AT_USE_LEX_ARGS],
|
m4_pushdef([AT_USE_LEX_ARGS],
|
||||||
[(void) lvalp;AT_LOCATION_IF([(void) llocp])])
|
[(void) lvalp;AT_LOCATION_IF([(void) llocp;])])
|
||||||
m4_pushdef([AT_YYLEX_PRE_FORMALS],
|
m4_pushdef([AT_YYLEX_PRE_FORMALS],
|
||||||
[AT_YYLEX_FORMALS, ])
|
[AT_YYLEX_FORMALS, ])
|
||||||
m4_pushdef([AT_YYLEX_PRE_ARGS],
|
m4_pushdef([AT_YYLEX_PRE_ARGS],
|
||||||
@@ -266,11 +275,12 @@ AT_PURE_LEX_IF(
|
|||||||
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
|
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
|
||||||
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
|
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
|
||||||
m4_pushdef([AT_YYLEX_FORMALS], [void])
|
m4_pushdef([AT_YYLEX_FORMALS], [void])
|
||||||
|
m4_pushdef([AT_YYLEX_RETURN], [int])
|
||||||
m4_pushdef([AT_YYLEX_ARGS], [])
|
m4_pushdef([AT_YYLEX_ARGS], [])
|
||||||
m4_pushdef([AT_USE_LEX_ARGS], [])
|
m4_pushdef([AT_USE_LEX_ARGS], [])
|
||||||
m4_pushdef([AT_YYLEX_PRE_FORMALS], [])
|
m4_pushdef([AT_YYLEX_PRE_FORMALS], [])
|
||||||
m4_pushdef([AT_YYLEX_PRE_ARGS], [])
|
m4_pushdef([AT_YYLEX_PRE_ARGS], [])
|
||||||
])
|
])])
|
||||||
|
|
||||||
# Handle the different types of location components.
|
# Handle the different types of location components.
|
||||||
|
|
||||||
@@ -403,7 +413,7 @@ $2])
|
|||||||
# ACTION may compute yylval for instance, using "res" as token type,
|
# ACTION may compute yylval for instance, using "res" as token type,
|
||||||
# and "toknum" as the number of calls to yylex (starting at 0).
|
# and "toknum" as the number of calls to yylex (starting at 0).
|
||||||
m4_define([AT_YYLEX_PROTOTYPE],
|
m4_define([AT_YYLEX_PROTOTYPE],
|
||||||
[int AT_NAME_PREFIX[]lex (]AT_YYLEX_FORMALS[)[]dnl
|
[AT_YYLEX_RETURN AT_NAME_PREFIX[]lex (]AT_YYLEX_FORMALS[)[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
m4_define([AT_YYLEX_DECLARE_EXTERN],
|
m4_define([AT_YYLEX_DECLARE_EXTERN],
|
||||||
@@ -424,15 +434,15 @@ static
|
|||||||
[[static int const input[] = ]$1])[;
|
[[static int const input[] = ]$1])[;
|
||||||
static size_t toknum = 0;
|
static size_t toknum = 0;
|
||||||
int res;
|
int res;
|
||||||
]AT_USE_LEX_ARGS[;
|
]AT_USE_LEX_ARGS[
|
||||||
assert (toknum < sizeof input / sizeof input[0]);
|
assert (toknum < sizeof input / sizeof input[0]);
|
||||||
res = input[toknum++];
|
res = input[toknum++];
|
||||||
]$2[;]AT_LOCATION_IF([[
|
]$2[;]AT_TOKEN_CTOR_IF([], [[
|
||||||
|
]AT_LOCATION_IF([[
|
||||||
]AT_LOC_FIRST_LINE[ = ]AT_LOC_LAST_LINE[ = 1;
|
]AT_LOC_FIRST_LINE[ = ]AT_LOC_LAST_LINE[ = 1;
|
||||||
]AT_LOC_FIRST_COLUMN[ = ]AT_LOC_LAST_COLUMN[ = ]AT_CXX_IF([(unsigned )], [(int)])[toknum;]])[
|
]AT_LOC_FIRST_COLUMN[ = ]AT_LOC_LAST_COLUMN[ = ]AT_CXX_IF([(unsigned )], [(int)])[toknum;]])[
|
||||||
return res;
|
return res;]])[
|
||||||
}]dnl
|
}]])
|
||||||
])
|
|
||||||
|
|
||||||
# AT_YYERROR_FORMALS
|
# AT_YYERROR_FORMALS
|
||||||
# AT_YYERROR_PROTOTYPE
|
# AT_YYERROR_PROTOTYPE
|
||||||
|
|||||||
+22
-1
@@ -288,6 +288,26 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
|
|||||||
AT_VAL.build (std::make_pair<std::string, std::string> ("two", "deux"));],
|
AT_VAL.build (std::make_pair<std::string, std::string> ("two", "deux"));],
|
||||||
[10:11, two:deux])
|
[10:11, two:deux])
|
||||||
|
|
||||||
|
AT_TEST([%skeleton "]b4_skel["
|
||||||
|
%code requires { #include <memory> }
|
||||||
|
%define api.value.type variant
|
||||||
|
%define api.token.constructor],
|
||||||
|
[[%token <std::unique_ptr<int>> ONE;
|
||||||
|
%token <std::pair<int, int>> TWO;
|
||||||
|
%token EOI 0;]],
|
||||||
|
[ONE TWO { std::cout << *$1 << ", "
|
||||||
|
<< $2.first << ", "
|
||||||
|
<< $2.second << '\n'; }],
|
||||||
|
["12"],
|
||||||
|
[[if (res == '1')
|
||||||
|
return yy::parser::make_ONE (std::make_unique<int> (10));
|
||||||
|
else if (res == '2')
|
||||||
|
return yy::parser::make_TWO (std::make_pair<int, int> (21, 22));
|
||||||
|
else
|
||||||
|
return yy::parser::make_EOI ()]],
|
||||||
|
[10, 21, 22],
|
||||||
|
[AT_REQUIRE_CXX_STD(14, [echo "$at_std not supported"; continue])])
|
||||||
|
|
||||||
# Move-only types.
|
# Move-only types.
|
||||||
AT_TEST([%skeleton "]b4_skel["
|
AT_TEST([%skeleton "]b4_skel["
|
||||||
%code requires { #include <memory> }
|
%code requires { #include <memory> }
|
||||||
@@ -303,7 +323,8 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc]],
|
|||||||
]AT_VAL[.emplace <std::unique_ptr<std::string>>
|
]AT_VAL[.emplace <std::unique_ptr<std::string>>
|
||||||
(std::make_unique <std::string> ("two"));]],
|
(std::make_unique <std::string> ("two"));]],
|
||||||
[10, two],
|
[10, two],
|
||||||
[AT_REQUIRE_CXX_STD(14, [echo "$at_std not supported"; continue])])])
|
[AT_REQUIRE_CXX_STD(14, [echo "$at_std not supported"; continue])])
|
||||||
|
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user