diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-03-05 21:34:03 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-03-06 16:42:51 +0000 |
| commit | debb5e01f1d387661e6e98642d5092d4c0450c53 (patch) | |
| tree | 8cecfa614347d846ff72a963644b22a61e9c825b | |
| parent | 782f49db5b5f48f9d37c9c562442907aef410e2e (diff) | |
[ruby/prism] Implement character literals for ripper translation
https://github.com/ruby/prism/commit/3c28994a24
| -rw-r--r-- | lib/prism/translation/ripper.rb | 5 | ||||
| -rw-r--r-- | test/prism/ripper_test.rb | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index 55e56d51cd..822d8cdd74 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -2301,7 +2301,10 @@ module Prism # "foo" # ^^^^^ def visit_string_node(node) - if node.content.empty? + if node.opening == "?" + bounds(node.location) + on_CHAR("?#{node.content}") + elsif node.content.empty? bounds(node.location) on_string_literal(on_string_content) else diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb index 3d747242a1..569063168f 100644 --- a/test/prism/ripper_test.rb +++ b/test/prism/ripper_test.rb @@ -50,7 +50,6 @@ module Prism seattlerb/block_return.txt seattlerb/bug190.txt seattlerb/bug191.txt - seattlerb/bug_comma.txt seattlerb/bug_hash_args_trailing_comma.txt seattlerb/bug_hash_interp_array.txt seattlerb/call_args_assoc_quoted.txt @@ -131,8 +130,6 @@ module Prism seattlerb/parse_pattern_076.txt seattlerb/quoted_symbol_hash_arg.txt seattlerb/quoted_symbol_keys.txt - seattlerb/read_escape_unicode_curlies.txt - seattlerb/read_escape_unicode_h4.txt seattlerb/regexp_esc_C_slash.txt seattlerb/regexp_escape_extended.txt seattlerb/rescue_do_end_ensure_result.txt @@ -201,7 +198,6 @@ module Prism whitequark/bug_do_block_in_hash_brace.txt whitequark/case_cond_else.txt whitequark/case_expr_else.txt - whitequark/character.txt whitequark/class_definition_in_while_cond.txt whitequark/dedenting_heredoc.txt whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt |
