Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::Translation::Parser::Compiler#visit_regular_expression_node
visit_regular_expression_node(node)
lib/prism/translation/parser/compiler.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/translation/parser/compiler.rb, line 1513
def visit_regular_expression_node(node)
content = node.content
parts =
if content.include?("\n")
offset = node.content_loc.start_offset
content.lines.map do |line|
builder.string_internal([line, srange_offsets(offset, offset += line.bytesize)])
end
else
[builder.string_internal(token(node.content_loc))]
end
builder.regexp_compose(
token(node.opening_loc),
parts,
[node.closing[0], srange_offsets(node.closing_loc.start_offset, node.closing_loc.start_offset + 1)],
builder.regexp_options([node.closing[1..], srange_offsets(node.closing_loc.start_offset + 1, node.closing_loc.end_offset)])
)
end
/foo/ ^^^^^