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

ruby-changes:50681

From: nagachika <ko1@a...>
Date: Tue, 20 Mar 2018 01:59:52 +0900 (JST)
Subject: [ruby-changes:50681] nagachika:r62847 (ruby_2_4): merge revision(s) 61346: [Backport #14206]

nagachika	2018-03-20 01:59:47 +0900 (Tue, 20 Mar 2018)

  New Revision: 62847

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62847

  Log:
    merge revision(s) 61346: [Backport #14206]
    
    parse.y: end of script at newline
    
    * parse.y (parser_yylex): deal with end of script chars just after
      ignored newline as other places.  [ruby-core:84349] [Bug #14206]

  Modified directories:
    branches/ruby_2_4/
  Modified files:
    branches/ruby_2_4/parse.y
    branches/ruby_2_4/test/ruby/test_parse.rb
    branches/ruby_2_4/version.h
Index: ruby_2_4/parse.y
===================================================================
--- ruby_2_4/parse.y	(revision 62846)
+++ ruby_2_4/parse.y	(revision 62847)
@@ -8108,8 +8108,8 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/ruby_2_4/parse.y#L8108
 	    }
 	    goto retry;
 	}
-	while ((c = nextc())) {
-	    switch (c) {
+	while (1) {
+	    switch (c = nextc()) {
 	      case ' ': case '\t': case '\f': case '\r':
 	      case '\13': /* '\v' */
 		space_seen = 1;
Index: ruby_2_4/version.h
===================================================================
--- ruby_2_4/version.h	(revision 62846)
+++ ruby_2_4/version.h	(revision 62847)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1
 #define RUBY_VERSION "2.4.4"
 #define RUBY_RELEASE_DATE "2018-03-20"
-#define RUBY_PATCHLEVEL 266
+#define RUBY_PATCHLEVEL 267
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_4/test/ruby/test_parse.rb
===================================================================
--- ruby_2_4/test/ruby/test_parse.rb	(revision 62846)
+++ ruby_2_4/test/ruby/test_parse.rb	(revision 62847)
@@ -993,6 +993,12 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_parse.rb#L993
     assert_equal(line, obj.location.lineno, bug)
   end
 
+  def test_eof_in_def
+    assert_raise(SyntaxError) { eval("def m\n\0""end") }
+    assert_raise(SyntaxError) { eval("def m\n\C-d""end") }
+    assert_raise(SyntaxError) { eval("def m\n\C-z""end") }
+  end
+
 =begin
   def test_past_scope_variable
     assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
Index: ruby_2_4
===================================================================
--- ruby_2_4	(revision 62846)
+++ ruby_2_4	(revision 62847)

Property changes on: ruby_2_4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r61346

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

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