mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
b4_semantic_type_declare.
* data/c++.m4 (b4_semantic_type_declare): New. Factors and generalizes what was in glr.cc and lalr1.cc. * data/variant.hh (b4_semantic_type_declare): Redefine it for variants. * data/lalr1.cc, data/glr.cc: Use it.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
2009-03-02 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
b4_semantic_type_declare.
|
||||||
|
* data/c++.m4 (b4_semantic_type_declare): New.
|
||||||
|
Factors and generalizes what was in glr.cc and lalr1.cc.
|
||||||
|
* data/variant.hh (b4_semantic_type_declare): Redefine it for
|
||||||
|
variants.
|
||||||
|
* data/lalr1.cc, data/glr.cc: Use it.
|
||||||
|
|
||||||
2009-02-26 Akim Demaille <demaille@gostai.com>
|
2009-02-26 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
Upgrade gnulib.
|
Upgrade gnulib.
|
||||||
|
|||||||
14
data/c++.m4
14
data/c++.m4
@@ -97,6 +97,20 @@ m4_map_sep([ b4_token_enum], [,
|
|||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
|
# b4_semantic_type_declare
|
||||||
|
# ------------------------
|
||||||
|
# Declare semantic_type.
|
||||||
|
m4_define([b4_semantic_type_declare],
|
||||||
|
[ /// Symbol semantic values.
|
||||||
|
m4_ifdef([b4_stype],
|
||||||
|
[ union semantic_type
|
||||||
|
{b4_user_stype
|
||||||
|
};],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[ typedef int semantic_type;]],
|
||||||
|
[[ typedef YYSTYPE semantic_type;]])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
m4_define([b4_variant_if],
|
m4_define([b4_variant_if],
|
||||||
|
|||||||
10
data/glr.cc
10
data/glr.cc
@@ -266,16 +266,8 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Symbol semantic values.
|
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
]m4_ifdef([b4_stype],
|
]b4_semantic_type_declare[
|
||||||
[ union semantic_type
|
|
||||||
{
|
|
||||||
b4_user_stype
|
|
||||||
};],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[ typedef int semantic_type;]],
|
|
||||||
[[ typedef YYSTYPE semantic_type;]])])[
|
|
||||||
#else
|
#else
|
||||||
typedef YYSTYPE semantic_type;
|
typedef YYSTYPE semantic_type;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -389,21 +389,7 @@ do { \
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef YYSTYPE
|
#ifndef YYSTYPE
|
||||||
]b4_variant_if(
|
]b4_semantic_type_declare[
|
||||||
[ /// An auxiliary type to compute the largest semantic type.
|
|
||||||
union union_type
|
|
||||||
{]b4_type_foreach([b4_char_sizeof])[};
|
|
||||||
|
|
||||||
/// Symbol semantic values.
|
|
||||||
typedef variant<sizeof(union_type)> semantic_type;],
|
|
||||||
[ /// Symbol semantic values.
|
|
||||||
m4_ifdef([b4_stype],
|
|
||||||
[ union semantic_type
|
|
||||||
{b4_user_stype
|
|
||||||
};],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[ typedef int semantic_type;]],
|
|
||||||
[[ typedef YYSTYPE semantic_type;]])])])[
|
|
||||||
#else
|
#else
|
||||||
typedef YYSTYPE semantic_type;
|
typedef YYSTYPE semantic_type;
|
||||||
#endif]b4_locations_if([
|
#endif]b4_locations_if([
|
||||||
|
|||||||
@@ -189,6 +189,18 @@ m4_define([b4_variant_definition],
|
|||||||
## -------------------------- ##
|
## -------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_semantic_type_declare
|
||||||
|
# ------------------------
|
||||||
|
# Declare semantic_type.
|
||||||
|
m4_define([b4_semantic_type_declare],
|
||||||
|
[ /// An auxiliary type to compute the largest semantic type.
|
||||||
|
union union_type
|
||||||
|
{]b4_type_foreach([b4_char_sizeof])[};
|
||||||
|
|
||||||
|
/// Symbol semantic values.
|
||||||
|
typedef variant<sizeof(union_type)> semantic_type;])
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
# How the semantic value is extracted when using variants.
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [TYPE])
|
# b4_symbol_value(VAL, [TYPE])
|
||||||
|
|||||||
Reference in New Issue
Block a user