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

ruby-changes:46404

From: usa <ko1@a...>
Date: Sun, 30 Apr 2017 22:59:27 +0900 (JST)
Subject: [ruby-changes:46404] usa:r58518 (ruby_2_3): merge revision(s) 58080, 58138: [Backport #13363]

usa	2017-04-30 22:59:21 +0900 (Sun, 30 Apr 2017)

  New Revision: 58518

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

  Log:
    merge revision(s) 58080,58138: [Backport #13363]
    
    keep line number after unterminated string literal
    
    * parse.y (parser_parse_string): keep line number even after an
      unterminated string literal.  it does not matter in the parser,
      ripper needs this value after this error.
    parse.y: unterminated content token
    
    * parse.y (parser_parse_string): defer the end token to next
      reading, to yield tSTRING_CONTENT with the unterminated content.
      [Bug #13363]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/parse.y
    branches/ruby_2_3/test/ripper/test_scanner_events.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/parse.y
===================================================================
--- ruby_2_3/parse.y	(revision 58517)
+++ ruby_2_3/parse.y	(revision 58518)
@@ -6502,16 +6502,14 @@ parser_parse_string(struct parser_params https://github.com/ruby/ruby/blob/trunk/ruby_2_3/parse.y#L6502
     pushback(c);
     if (tokadd_string(func, term, paren, &quote->nd_nest,
 		      &enc) == -1) {
-	ruby_sourceline = nd_line(quote);
-	if (func & STR_FUNC_REGEXP) {
-	    if (parser->eofp)
+	if (parser->eofp) {
+	    if (func & STR_FUNC_REGEXP) {
 		compile_error(PARSER_ARG "unterminated regexp meets end of file");
-	    return tREGEXP_END;
-	}
-	else {
-	    if (parser->eofp)
+	    }
+	    else {
 		compile_error(PARSER_ARG "unterminated string meets end of file");
-	    return tSTRING_END;
+	    }
+	    quote->u2.id = -1;
 	}
     }
 
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 58517)
+++ ruby_2_3/ChangeLog	(revision 58518)
@@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sun Apr 30 22:55:41 2017  Nobuyoshi Nakada  <nobu@r...>
+
+	keep line number after unterminated string literal
+
+	* parse.y (parser_parse_string): keep line number even after an
+	  unterminated string literal.  it does not matter in the parser,
+	  ripper needs this value after this error.
+
+	parse.y: unterminated content token
+
+	* parse.y (parser_parse_string): defer the end token to next
+	  reading, to yield tSTRING_CONTENT with the unterminated content.
+	  [Bug #13363]
+
 Sun Apr 30 22:52:38 2017  Marcus Stollsteimer  <sto.mar@w...>
 
 	* io.c: [DOC] expand docs for IO#puts
Index: ruby_2_3/test/ripper/test_scanner_events.rb
===================================================================
--- ruby_2_3/test/ripper/test_scanner_events.rb	(revision 58517)
+++ ruby_2_3/test/ripper/test_scanner_events.rb	(revision 58518)
@@ -109,6 +109,9 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ripper/test_scanner_events.rb#L109
                    [[3, 0], :on_heredoc_end, "EOS"]
                  ],
                  Ripper.lex("<<~EOS\n  heredoc\nEOS")
+    assert_equal [[[1, 0], :on_tstring_beg, "'"],
+                  [[1, 1], :on_tstring_content, "foo"]],
+                 Ripper.lex("'foo")
   end
 
   def test_location
@@ -131,6 +134,8 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ripper/test_scanner_events.rb#L134
     assert_location %Q["a\nb\r\nc"]
     assert_location "print(<<""EOS)\nheredoc\nEOS\n"
     assert_location "print(<<-\"EOS\")\nheredoc\n     EOS\n"
+    assert_location "'foo'"
+    assert_location "'foo"
   end
 
   def assert_location(src)
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 58517)
+++ ruby_2_3/version.h	(revision 58518)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.5"
 #define RUBY_RELEASE_DATE "2017-04-30"
-#define RUBY_PATCHLEVEL 307
+#define RUBY_PATCHLEVEL 308
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 58517)
+++ ruby_2_3	(revision 58518)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r58080,58138

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

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