Skip to content

Commit

Permalink
[Bug #20988] [prism] Fix escaped octal character literals
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 29, 2024
1 parent 689bb19 commit a33c944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions prism/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -9728,6 +9728,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, pm_buffer_t *regular_expre
}
}

value = escape_byte(value, flags);
escape_write_byte(parser, buffer, regular_expression_buffer, flags, value);
return;
}
Expand Down
2 changes: 2 additions & 0 deletions test/ruby/test_literal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def test_string
assert_raise(SyntaxError) {eval('"\C-\\' "\u3042" '"')}
assert_raise(SyntaxError) {eval('"\M-' "\u3042" '"')}
assert_raise(SyntaxError) {eval('"\M-\\' "\u3042" '"')}

assert_equal "\x09 \xC9 \x89", eval('"\C-\111 \M-\111 \M-\C-\111"')
ensure
$VERBOSE = verbose_bak
end
Expand Down

0 comments on commit a33c944

Please sign in to comment.