mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
reader: reject rules on YYEOF
We crashed when rules were given on YYEOF. Reported by Han Zheng. Fixes https://github.com/akimd/bison/issues/92. * src/reader.c (check_and_convert_grammar): Make sure YYEOF is not an nterm. * tests/input.at (Rule for YYEOF): New.
This commit is contained in:
@@ -954,6 +954,10 @@ check_and_convert_grammar (void)
|
||||
if (!eoftoken)
|
||||
{
|
||||
eoftoken = symbol_get ("YYEOF", empty_loc);
|
||||
if (eoftoken->content->class == nterm_sym)
|
||||
complain (&eoftoken->location, complaint,
|
||||
_("rule given for %s, which is a token"),
|
||||
eoftoken->tag);
|
||||
eoftoken->content->class = token_sym;
|
||||
eoftoken->content->number = 0;
|
||||
/* Value specified by POSIX. */
|
||||
|
||||
Reference in New Issue
Block a user