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

ruby-changes:72371

From: Nobuyoshi <ko1@a...>
Date: Thu, 30 Jun 2022 16:32:02 +0900 (JST)
Subject: [ruby-changes:72371] 982cda9a3e (master): [Bug #18877] Let `lex_ctxt` not to eat escaped whitespace

https://git.ruby-lang.org/ruby.git/commit/?id=982cda9a3e

From 982cda9a3e908c7ab49632c46f4b1e3c0219f9f2 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 26 Jun 2022 18:39:59 +0900
Subject: [Bug #18877] Let `lex_ctxt` not to eat escaped whitespace

---
 parse.y                 | 6 +-----
 test/ruby/test_parse.rb | 4 ++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/parse.y b/parse.y
index f746a0c272..5fae5dc218 100644
--- a/parse.y
+++ b/parse.y
@@ -2673,11 +2673,7 @@ rel_expr	: arg relop arg   %prec '>' https://github.com/ruby/ruby/blob/trunk/parse.y#L2673
 		    }
 		;
 
-lex_ctxt	: tSP
-		    {
-			$$ = p->ctxt;
-		    }
-		| none
+lex_ctxt	: none
 		    {
 			$$ = p->ctxt;
 		    }
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 1d756441f8..8b7c8f0e5b 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1366,6 +1366,10 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1366
     assert_valid_syntax('class while true; break Object end::Kernel; end')
   end
 
+  def test_escaped_space
+    assert_syntax_error('x = \ 42', /escaped space/)
+  end
+
 =begin
   def test_past_scope_variable
     assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
-- 
cgit v1.2.1


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

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