diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-05 13:42:17 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-05 15:00:02 +0900 |
commit | 126122bb6c83cca5eac6c71e3e75e3f647397d94 (patch) | |
tree | b82a83eea2d05536494195c66f7e52bb5d4a41e8 /parse.y | |
parent | 0553494ad7ccbc75ac954c2cb0e7ea50443bad0c (diff) |
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.
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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)) |