summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-03-05 07:43:24 -0500
committergit <svn-admin@ruby-lang.org>2024-03-06 16:42:41 +0000
commitd815d68cbb420243d0f2e3fc866350761154dd82 (patch)
treee0603f5606449a4c5d065b4ed2784013c8439eaa /lib
parentbfa2a08444f073b2a0a5d759f463a04fb8a3c1f2 (diff)
[ruby/prism] Implement regular expressions for ripper translation
https://github.com/ruby/prism/commit/788cf7c528
Diffstat (limited to 'lib')
-rw-r--r--lib/prism/translation/ripper.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index c839b90456..fe44fae836 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -1329,7 +1329,7 @@ module Prism
# /(?<foo>foo)/ =~ bar
# ^^^^^^^^^^^^^^^^^^^^
def visit_match_write_node(node)
- raise NoMethodError, __method__
+ visit(node.call)
end
# A node that is missing from the syntax tree. This is only used in the
@@ -1568,7 +1568,13 @@ module Prism
# /foo/
# ^^^^^
def visit_regular_expression_node(node)
- raise NoMethodError, __method__
+ bounds(node.content_loc)
+ content = on_tstring_content(node.unescaped)
+
+ bounds(node.closing_loc)
+ closing = on_regexp_end(node.closing)
+
+ on_regexp_literal(on_regexp_add(on_regexp_new, content), closing)
end
# def foo(bar:); end