diff options
author | TSUYUSATO Kitsune <make.just.on@gmail.com> | 2023-12-11 12:44:33 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-11 13:36:37 +0000 |
commit | 48cb70fee95dcdcf5f9eef2ef40c3adfecc214fa (patch) | |
tree | 3b983fdf0c2800ad5d567bb22814b91752c77888 /prism | |
parent | a860e3605c53e708d3cb06e2080ff73b58de4b22 (diff) |
[ruby/prism] Fix parsing unterminated empty string `"`
Fix https://github.com/ruby/prism/pull/2034
https://github.com/ruby/prism/commit/8280e577fa
Diffstat (limited to 'prism')
-rw-r--r-- | prism/prism.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/prism/prism.c b/prism/prism.c index 9ca542ba30..1b5d82b4bb 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -13520,7 +13520,8 @@ parse_strings(pm_parser_t *parser, pm_node_t *current) { pm_token_t opening = parser->current; parser_lex(parser); - if (accept1(parser, PM_TOKEN_STRING_END)) { + if (match2(parser, PM_TOKEN_STRING_END, PM_TOKEN_EOF)) { + expect1(parser, PM_TOKEN_STRING_END, PM_ERR_STRING_LITERAL_TERM); // If we get here, then we have an end immediately after a // start. In that case we'll create an empty content token and // return an uninterpolated string. |