diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-21 10:32:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-21 10:32:15 +0000 |
commit | 491f523ab18cae6e14a2929de14d51803c362a7c (patch) | |
tree | a0cf6c77e21be576bb2d972022bc6ceb9667cddd /parse.y | |
parent | bc7e5fcb32d84a8537390f1352f811c154782dc4 (diff) |
parse.y: unindent continued line
* parse.y (tokadd_string): stop at continued line in dedented here
documents, to dedent for each lines before removing escaped
newlines. [ruby-core:86236] [Bug #14621]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -5642,7 +5642,14 @@ tokadd_string(struct parser_params *p, switch (c) { case '\n': if (func & STR_FUNC_QWORDS) break; - if (func & STR_FUNC_EXPAND) continue; + if (func & STR_FUNC_EXPAND) { + if (!(func & STR_FUNC_INDENT) || (p->heredoc_indent < 0)) + continue; + if (c == term) { + c = '\\'; + goto terminate; + } + } tokadd(p, '\\'); break; @@ -5723,6 +5730,7 @@ tokadd_string(struct parser_params *p, } tokadd(p, c); } + terminate: if (enc) *encp = enc; return c; } |