mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
%nterm: do not accept character literals
Reported by Rici Lake. http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00000.html * src/complain.h: Formatting change. * src/parse-gram.y (id): Reject character literals used in a context for non-terminals. * tests/input.at (Invalid %nterm uses): Check that.
This commit is contained in:
@@ -553,6 +553,9 @@ symbol_def:
|
||||
symbol_defs.1:
|
||||
symbol_def
|
||||
| symbol_defs.1 symbol_def
|
||||
/* FIXME: cannot do that, results in infinite loop in LAC.
|
||||
| error { yyerrok; }
|
||||
*/
|
||||
;
|
||||
|
||||
|
||||
@@ -669,6 +672,12 @@ id:
|
||||
{ $$ = symbol_from_uniqstr ($1, @1); }
|
||||
| CHAR
|
||||
{
|
||||
if (current_class == nterm_sym)
|
||||
{
|
||||
gram_error (&@1,
|
||||
_("character literals cannot be non-terminals"));
|
||||
YYERROR;
|
||||
}
|
||||
$$ = symbol_get (char_name ($1), @1);
|
||||
symbol_class_set ($$, token_sym, @1, false);
|
||||
symbol_user_token_number_set ($$, $1, @1);
|
||||
|
||||
Reference in New Issue
Block a user