diff options
author | Kevin Newton <[email protected]> | 2025-02-13 13:58:49 -0500 |
---|---|---|
committer | git <[email protected]> | 2025-02-13 19:12:10 +0000 |
commit | b21e1aed2ed5b22b50efc658289a403eeed581df () | |
tree | e9b6b606b96082b9f5924cd3b0c1aba8dd8be7f3 /prism | |
parent | 2b92172894e755362a7a0b74ef3b6a5543a89017 (diff) |
[ruby/prism] Fix infinite loop in error recovery
When recovering from a depth error that occurs at the end of the file, we need to break out of parsing statements. Fixes [Bug #21114] https://.com/ruby/prism/commit/a32e268787
-rw-r--r-- | prism/prism.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -13948,6 +13948,15 @@ parse_statements(pm_parser_t *parser, pm_context_t context, uint16_t depth) { if (PM_NODE_TYPE_P(node, PM_MISSING_NODE)) { parser_lex(parser); while (accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON)); if (context_terminator(context, &parser->current)) break; } else if (!accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_EOF)) { |