diff --git a/data/skeletons/c++.m4 b/data/skeletons/c++.m4 index c78ebed6..6e825ff3 100644 --- a/data/skeletons/c++.m4 +++ b/data/skeletons/c++.m4 @@ -529,8 +529,7 @@ m4_define([b4_token_constructor_define], []) # sometimes in the cc file. m4_define([b4_yytranslate_define], [ b4_inline([$1])b4_parser_class[::token_number_type - ]b4_parser_class[::yytranslate_ (]b4_token_ctor_if([token_type], - [int])[ t) + ]b4_parser_class[::yytranslate_ (int t) { ]b4_api_token_raw_if( [[ return static_cast (t);]], @@ -546,7 +545,7 @@ m4_define([b4_yytranslate_define], if (t <= 0) return yyeof_; - else if (static_cast (t) <= user_token_number_max_) + else if (t <= user_token_number_max_) return translate_table[t]; else return yy_undef_token_;]])[ diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index 5c8a67df..8a2bee04 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -268,7 +268,9 @@ m4_define([b4_shared_declarations], static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_; /// Convert a scanner token number \a t to a symbol number. - static token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t); + /// In theory \a t should be a token_type, but character literals + /// are valid, yet not member of the token_type enum. + static token_number_type yytranslate_ (int t); // Tables. ]b4_parser_tables_declare[]b4_error_verbose_if([