From c884cbd810d4a8b331e17aede4760a2368261177 Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 30 Apr 2017 13:59:21 +0000 Subject: 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ripper/test_scanner_events.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 1b7b56ebfe..8c950041a2 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -109,6 +109,9 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase [[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::Unit::TestCase 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) -- cgit v1.2.3