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

ruby-changes:46010

From: nobu <ko1@a...>
Date: Sat, 25 Mar 2017 10:07:45 +0900 (JST)
Subject: [ruby-changes:46010] nobu:r58080 (trunk): keep line number after unterminated string literal

nobu	2017-03-25 10:07:35 +0900 (Sat, 25 Mar 2017)

  New Revision: 58080

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

  Log:
    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.

  Modified files:
    trunk/parse.y
    trunk/test/ripper/test_scanner_events.rb
Index: parse.y
===================================================================
--- parse.y	(revision 58079)
+++ parse.y	(revision 58080)
@@ -6207,7 +6207,6 @@ parser_parse_string(struct parser_params https://github.com/ruby/ruby/blob/trunk/parse.y#L6207
     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)
 		compile_error(PARSER_ARG "unterminated regexp meets end of file");
Index: test/ripper/test_scanner_events.rb
===================================================================
--- test/ripper/test_scanner_events.rb	(revision 58079)
+++ test/ripper/test_scanner_events.rb	(revision 58080)
@@ -131,6 +131,8 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/test/ripper/test_scanner_events.rb#L131
     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)

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

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