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 1 year ago. Updated over 1 year 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.

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|ace2eee544378eb03ea95b95c89434508325e8c8.


[Bug #18963] Separate string contents by here document terminator

Actions

Also available in: Atom PDF

Like0
Like0