[ruby/prism] Simplify unterminated string
https://github.com/ruby/prism/commit/ef512ca914
This commit is contained in:
parent
c8b60c8ac2
commit
c5a4409f20
@ -13594,10 +13594,10 @@ parse_strings(pm_parser_t *parser, pm_node_t *current) {
|
||||
pm_string_t unescaped = parser->current_string;
|
||||
parser_lex(parser);
|
||||
|
||||
if (match1(parser, PM_TOKEN_STRING_END)) {
|
||||
if (match2(parser, PM_TOKEN_STRING_END, PM_TOKEN_EOF)) {
|
||||
node = (pm_node_t *) pm_string_node_create_unescaped(parser, &opening, &content, &parser->current, &unescaped);
|
||||
node->flags |= parse_unescaped_encoding(parser);
|
||||
parser_lex(parser);
|
||||
expect1(parser, PM_TOKEN_STRING_END, PM_ERR_STRING_LITERAL_TERM);
|
||||
} else if (accept1(parser, PM_TOKEN_LABEL_END)) {
|
||||
node = (pm_node_t *) pm_symbol_node_create_unescaped(parser, &opening, &content, &parser->previous, &unescaped);
|
||||
} else {
|
||||
|
@ -149,9 +149,9 @@ module Prism
|
||||
def test_unterminated_interpolated_string
|
||||
expr = expression('"hello')
|
||||
assert_errors expr, '"hello', [
|
||||
["expected a closing delimiter for the interpolated string", 0..1]
|
||||
["expected a closing delimiter for the string literal", 6..6]
|
||||
]
|
||||
assert_equal expr.parts[0].unescaped, "hello"
|
||||
assert_equal expr.unescaped, "hello"
|
||||
assert_equal expr.closing, ""
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user