Project

General

Profile

Actions

Bug #19882

closed

:$0x should be rejected

Added by mame (Yusuke Endoh) 8 months ago. Updated 8 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:114761]

Description

irb(main):001> :$0x
=> :"$0x"

Since $0x is not a valid global variable name, I think it should be rejected unless quotation marks are used.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19549: Inconsistency in backref parsingClosedActions

Updated by kddnewton (Kevin Newton) 8 months ago

I think it is rejected at the moment:

-e:1: identifier $0x is not valid to get
-e: compile error (SyntaxError)

Updated by mame (Yusuke Endoh) 8 months ago

Don't overlook the colon!

Actions #3

Updated by nobu (Nobuyoshi Nakada) 8 months ago

  • Related to Bug #19549: Inconsistency in backref parsing added

Updated by nobu (Nobuyoshi Nakada) 8 months ago

It's subtly intentional.

The former seemed better to me.

$ ruby -e '$01234'
-e:1: identifier $01234 is not valid to get
-e: compile error (SyntaxError)
$ ./ruby -e 'p :$01234'
-e:1: syntax error, unexpected integer literal, expecting end-of-input
$01234
  ^~~~
-e: compile error (SyntaxError)

"Then the symbol should not be quoted"?, maybe.

Actions #6

Updated by nobu (Nobuyoshi Nakada) 8 months ago

  • Status changed from Open to Closed

Applied in changeset git|89802078f9f406be411032814e1960e62dbc7ce2.


[Bug #19882] Reject tokens invalid as symbols

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0