diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-12-29 10:32:33 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-12-29 10:32:33 +0900 |
| commit | a33c944ba8a0580322ee77b3066755f8e2c1c9b1 (patch) | |
| tree | c5e9661d46a6255bae13bad9e219cd33980e536a | |
| parent | 689bb193cc7a1b49cb241d14b84208dfff83c8ea (diff) | |
[Bug #20988] [prism] Fix escaped octal character literals
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12487
| -rw-r--r-- | prism/prism.c | 1 | ||||
| -rw-r--r-- | test/ruby/test_literal.rb | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/prism/prism.c b/prism/prism.c index bb69f139ae..dfafd610f8 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -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; } diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb index 941a4456d0..dbff3c4734 100644 --- a/test/ruby/test_literal.rb +++ b/test/ruby/test_literal.rb @@ -101,6 +101,8 @@ class TestRubyLiteral < Test::Unit::TestCase 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 |
