diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-30 13:59:21 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-30 13:59:21 +0000 |
| commit | c884cbd810d4a8b331e17aede4760a2368261177 (patch) | |
| tree | 1c60bbace6f17de7944313b1a6f96b1646d90651 /parse.y | |
| parent | 410c048a3a44627aa152e721593526c970e9478b (diff) | |
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
Diffstat (limited to 'parse.y')
| -rw-r--r-- | parse.y | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -6502,16 +6502,14 @@ parser_parse_string(struct parser_params *parser, NODE *quote) pushback(c); if (tokadd_string(func, term, paren, "e->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; } } |
