[前][次][番号順一覧][スレッド一覧]

ruby-changes:58790

From: Nobuyoshi <ko1@a...>
Date: Thu, 14 Nov 2019 16:45:33 +0900 (JST)
Subject: [ruby-changes:58790] 4d615a0c8f (master): `#@1` is no longer an embedded variable

https://git.ruby-lang.org/ruby.git/commit/?id=4d615a0c8f

From 4d615a0c8f4759ce4f6b96b643ef957837bdf20e Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 14 Nov 2019 16:37:25 +0900
Subject: `#@1` is no longer an embedded variable


diff --git a/parse.y b/parse.y
index 57b97a9..099d55e 100644
--- a/parse.y
+++ b/parse.y
@@ -7013,9 +7013,6 @@ parser_peek_variable_name(struct parser_params *p) https://github.com/ruby/ruby/blob/trunk/parse.y#L7013
 	    if (++ptr >= p->lex.pend) return 0;
 	    c = *ptr;
 	}
-	else if (ISDIGIT(c)) {
-	    return tSTRING_DVAR;
-	}
 	break;
       case '{':
 	p->lex.pcur = ptr;
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index d2f8479..ffe2ea1 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -269,7 +269,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ripper/test_scanner_events.rb#L269
                  scan('embvar', '"#@ivar"')
     assert_equal ['#'],
                  scan('embvar', '"#@@cvar"')
-    assert_equal ['#'],
+    assert_equal [],
                  scan('embvar', '"#@1"')
     assert_equal [],
                  scan('embvar', '"#lvar"')
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 2622ec5..cb379eb 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -358,6 +358,7 @@ class TestParse < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L358
     assert_equal("foo 1 bar", "foo #@@foo bar")
     "1" =~ /(.)/
     assert_equal("foo 1 bar", "foo #$1 bar")
+    assert_equal('foo #@1 bar', eval('"foo #@1 bar"'))
   end
 
   def test_dstr_disallowed_variable
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]