c++: minor changes

* data/lalr1.cc: Fix oldish comment.
* data/stack.hh: Prefer typename for type names.
Use size() instead of duplicating it.
* examples/variant-11.yy, examples/variant.yy (yylex): Use int,
as this is the type of the semantic value.
This commit is contained in:
Akim Demaille
2018-10-22 08:18:54 +02:00
parent 73917e9e6f
commit 4b0efdeb28
6 changed files with 19 additions and 12 deletions

View File

@@ -124,10 +124,10 @@ namespace yy
parser::symbol_type
yylex ()
{
static auto count = 0u;
const auto stage = count;
static int count = 0;
const int stage = count;
++count;
auto loc = parser::location_type{nullptr, stage + 1, stage + 1};
auto loc = parser::location_type{nullptr, unsigned (stage + 1), unsigned (stage + 1)};
if (stage == 0)
return parser::make_TEXT (make_string_uptr ("I have numbers for you."), std::move (loc));
else if (stage < max)

View File

@@ -114,9 +114,10 @@ namespace yy
parser::symbol_type
yylex ()
{
static int stage = -1;
++stage;
parser::location_type loc (nullptr, stage + 1, stage + 1);
static int count = 0;
const int stage = count;
++count;
parser::location_type loc (nullptr, unsigned (stage + 1), unsigned (stage + 1));
switch (stage)
{
case 0: