Project

General

Profile

Actions

Bug #18963

closed

Ripper.tokenize(code).join != code when heredoc and multiline string is on the same line

Added by tompng (tomoya ishida) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-darwin20]
[ruby-core:109476]

Description

Expect Ripper.tokenize(code).join to match the original code but it doesn't.

code = %[
<<A + "hello
A
world"
]
eval code # => "ruby\nhello\nworld"
code == Ripper.tokenize(code).join # => false
eval Ripper.tokenize(code).join # => Syntax Error

Other codes that does not match.
"<<A;/a\nA\nb/" "<<A;:'a\nA\nb'" "<<A;%[a\nA\nb]"

IRB fails coloring those codes.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20521: Memory leak in Ripper parsingClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0