1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Replace inaccurate error messages

When Bison reports "memory exhausted", it means the parser stack
depth reached the limit `YYMAXDEPTH` which is defaulted to 10_000,
but not memory allocation failed.
This commit is contained in:
Nobuyoshi Nakada 2021-10-05 13:42:17 +09:00
parent 0553494ad7
commit 126122bb6c
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -105,6 +105,9 @@ struct lex_context {
(Current).end_pos = YYRHSLOC(Rhs, 0).end_pos; \
} \
while (0)
#define YY_(Msgid) \
(((Msgid)[0] == 'm') && (strcmp((Msgid), "memory exhausted") == 0) ? \
"nesting too deep" : (Msgid))
#define RUBY_SET_YYLLOC_FROM_STRTERM_HEREDOC(Current) \
rb_parser_set_location_from_strterm_heredoc(p, &p->lex.strterm->u.heredoc, &(Current))