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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-25 01:07:35 +00:00
parent 8d1dacb229
commit e5600caf2c
2 changed files with 2 additions and 1 deletions

View File

@ -6207,7 +6207,6 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
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");

View File

@ -131,6 +131,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)