Project

General

Profile

Bug #14621

Extra whitespace in squiggly heredoc with escaped newline

Added by printercu (Max Melentiev) over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
[ruby-core:86236]

Description

puts <<~TXT.inspect
  1 \
  2
TXT

Expected:

"1 2\n"

Got:

"1   2\n"
#1

Updated by printercu (Max Melentiev) over 2 years ago

  • ruby -v set to ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]

Updated by printercu (Max Melentiev) over 2 years ago

Tested in ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux] - same result.

#3

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED
  • Description updated (diff)
#4

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r62872.


parse.y: unindent continued line

  • parse.y (tokadd_string): stop at continued line in dedented here documents, to dedent for each lines before removing escaped newlines. [ruby-core:86236] [Bug #14621]

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

r62872 has a bug.

<<-TEXT
\
TEXT

should raise a syntax error, "can't find string "TEXT" anywhere before EOF".
I'll fix it.

#6

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Closed to Open
#7

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r62873.


parse.y: terminator at continued line

  • parse.y (here_document): a continuing line is not the terminator. [ruby-core:86283] [Bug #14621]

Updated by nagachika (Tomoyuki Chikanaga) over 1 year ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED to 2.3: REQUIRED, 2.4: REQUIRED, 2.5: DONE

ruby_2_5 r67050 merged revision(s) 62872,62873.

Updated by usa (Usaku NAKAMURA) over 1 year ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: DONE to 2.3: REQUIRED, 2.4: DONE, 2.5: DONE

ruby_2_4 r67147 merged revision(s) 62872,62873.

Also available in: Atom PDF