This changes the traces from
Reading a token:
Now at end of input.
to
Reading a token:
Next token is token $end (7FFEE56E6474)
which is ok. Actually it is even better, as it gives the location
when locations are enabled, and is clearer when rules explicitly use
the EOF token.
* data/skeletons/lalr1.d (yytranslate_): Handle eof here, as is done
in lalr1.cc.
---
data/skeletons/lalr1.d | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d
index fd19e852..672c8a14 100644
--- a/data/skeletons/lalr1.d
+++ b/data/skeletons/lalr1.d
@@ -500,17 +500,9 @@ m4_popdef([b4_at_dollar])])dnl
}
/* Convert token to internal form. */
- if (yychar <= YYTokenType.EOF)
- {
- yychar = yytoken = YYTokenType.EOF;]b4_parse_trace_if([[
- yycdebug ("Now at end of input.\n");]])[
- }
- else
- {
- yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
- yy_symbol_print ("Next token is",
- yytoken, yylval]b4_locations_if([, yylloc])[);]])[
- }
+ yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
+ yy_symbol_print ("Next token is",
+ yytoken, yylval]b4_locations_if([, yylloc])[);]])[
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
@@ -833,7 +825,9 @@ m4_popdef([b4_at_dollar])])dnl
]b4_translate[
@};
- if (0 <= t && t <= yyuser_token_number_max_)
+ if (t <= 0)
+ return YYTokenType.EOF;
+ else if (t <= yyuser_token_number_max_)
return translate_table[t];
else
return yyundef_token_;]])[
--
2.23.0