c++: rename semantic_type as value_type

We always refer to the triplet "kind, value, location".  All of them
are nouns, and we support api.value.type and api.location.type.  On
this regard, "semantic_type" was a poor choice.  Make it "value_type".

The test suite was not updated to use value_type, on purpose, to
enforce backward compatibility.

* data/skeletons/c++.m4, data/skeletons/glr.cc, data/skeletons/glr2.cc,
* data/skeletons/variant.hh, doc/bison.texi: Define value_type rather
than semantic_type.
Add a backward compatibility typedef.
* examples/c++/glr/c++-types.yy: Migrate.
This commit is contained in:
Akim Demaille
2020-12-26 08:21:50 +01:00
parent 59653c8efd
commit 2157ced3dd
7 changed files with 63 additions and 56 deletions

View File

@@ -46,11 +46,11 @@
# define nullptr 0
#endif
static yy::parser::semantic_type
stmtMerge (const yy::parser::semantic_type& x0, const yy::parser::semantic_type& x1);
static yy::parser::value_type
stmtMerge (const yy::parser::value_type& x0, const yy::parser::value_type& x1);
static int
yylex (yy::parser::semantic_type* val, yy::parser::location_type* loc);
yylex (yy::parser::value_type* val, yy::parser::location_type* loc);
}
%expect-rr 1
@@ -103,7 +103,7 @@ yy::parser::error (const location_type& l, const std::string& m)
}
static int
yylex (yy::parser::semantic_type* lvalp, yy::parser::location_type* llocp)
yylex (yy::parser::value_type* lvalp, yy::parser::location_type* llocp)
{
static int lineNum = 1;
static int colNum = 0;
@@ -162,8 +162,8 @@ yylex (yy::parser::semantic_type* lvalp, yy::parser::location_type* llocp)
}
}
static yy::parser::semantic_type
stmtMerge (const yy::parser::semantic_type& x0, const yy::parser::semantic_type& x1)
static yy::parser::value_type
stmtMerge (const yy::parser::value_type& x0, const yy::parser::value_type& x1)
{
return Nterm ("<OR>", x0, x1);
}