Project

General

Profile

Actions

Bug #20938

closed

Percent String literal delimiter impacts string contents with parse.y

Added by eightbitraptor (Matt V-H) 10 days ago. Updated 8 days ago.

Status:
Closed
Assignee:
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-11-28T09:19:02Z master 31a3e87777) +PRISM +GC [arm64-darwin24]
[ruby-core:120144]

Description

The following code defines 2 programs that declare string literals using % and a single byte delimiter. I'd expect these programs to have the same output no matter which delimiter is used.

With Prism, both programs output the same value (the string content: 1_\n), but using parse.y the output values differ depending on the delimiter.

Are the outputs supposed to be the same or different?

program1 = "%\n1_\r\n\n" # => parse.y: 1_, prism: "1_\n"
program2 = "%'1_\r\n'"   # => "1_\n"

p eval(program1)
p eval(program2)

[Github Issue]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0