mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
c++: clean a few issues wrt special tokens
The C++ implementation of LAC did not skip the $undefined token, probably because it was not exposed. Expose it, and use clearer names. * data/skeletons/c++.m4: Don't define undef_token_ in yytranslate_, but... * data/skeletons/lalr1.cc (yy_undef_token_): here. Use a more precise type to define yy_undef_token_ and yy_error_token_. Unfortunately we move from a compile-time value defined via an enum to a static const member. Eventually we should make it constexpr. Make LAC implementation more alike yacc.c's one.
This commit is contained in:
@@ -543,14 +543,13 @@ m4_define([b4_yytranslate_define],
|
||||
]b4_translate[
|
||||
};
|
||||
const int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
if (t <= 0)
|
||||
return yyeof_;
|
||||
else if (static_cast<int> (t) <= user_token_number_max_)
|
||||
return translate_table[t];
|
||||
else
|
||||
return undef_token_;]])[
|
||||
return yy_undef_token_;]])[
|
||||
}
|
||||
]])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user