Project

General

Profile

Actions

Bug #20579

closed

`Ripper.tokenize("1\n ")` does not include trailing spaces

Added by tompng (tomoya ishida) 5 months ago. Updated 5 months ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-06-13T09:49:46Z master 8b843b0dc7) [x86_64-linux]
[ruby-core:118315]

Description

# trailing :on_sp, :on_ignored_nl are included in the result
Ripper.tokenize("1\n\t \t\n\t \t")
# => ["1", "\n", "\t \t", "\n", "\t \t"]

# trailing :on_sp disappears
Ripper.tokenize("1\n\t \t")
# => ["1", "\n"]

Found with Ripper.tokenize(random_string).join != random_string while investigating https://bugs.ruby-lang.org/issues/20578

Actions #1

Updated by nobu (Nobuyoshi Nakada) 5 months ago

  • Status changed from Open to Closed

Applied in changeset git|a1f72a563b74a44198b34add3aa9fdcef54c2405.


[Bug #20579] ripper: Dispatch spaces at END-OF-INPUT without newline

Actions

Also available in: Atom PDF

Like0
Like0