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:
parent
0553494ad7
commit
126122bb6c
1 changed files with 3 additions and 0 deletions
3
parse.y
3
parse.y
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue