Project

General

Profile

Actions

Feature #4513

closed

allow whitespace following EOL continuation backslash

Added by Rich_Morin (Rich Morin) over 11 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:<unknown>]

Description

In a few programming languages, the displayed or printed program can hide
critical syntactic and/or semantic information. For example, in make(1)
and Python, the difference between initial tabs and spaces can cause bugs
that are not visually apparent.

Ruby has a minor instance of this problem, in that spaces or tabs
between a backslash and the EOL will prevent the line from being continued:

 >> a \
 ?> = 2
 => 2
 >> b \ 
 SyntaxError: compile error
 (irb):3: syntax error, unexpected $undefined, expecting $end
 	from (irb):3

Could Ruby open up its syntax to allow any number of intervening spaces or tabs before the EOL?


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #14597: Ripper Issue - introduced between 62674 & 62681ClosedActions

Updated by nahi (Hiroshi Nakamura) over 10 years ago

  • Description updated (diff)
  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

Regardless it's acceptable or not, we want to check nobu's local patches first. Don't you have that?

Updated by mame (Yusuke Endoh) about 10 years ago

  • Target version set to 2.6

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Priority changed from Normal to 3

It is easy to change, but I doubt if it is useful.

Actions #4

Updated by naruse (Yui NARUSE) almost 5 years ago

  • Target version deleted (2.6)

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Description updated (diff)

Warning for a backslash followed by spaces is:

Old:

$ ruby2.5 -e ' \ '
-e:1: syntax error, unexpected $undefined

Now:

$ ruby -e ' \ '
-e:1: syntax error, unexpected backslash

Does this help you?

Actions #6

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Assigned to Feedback
Actions #7

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Related to Bug #14597: Ripper Issue - introduced between 62674 & 62681 added

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Feedback to Closed

Now:

$ ruby -e ' \ '
-e:1: syntax error, unexpected escaped space

Close this for now.

Actions #9

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0