aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-21 00:47:00 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-21 00:47:00 +0000
commitc0ffccf722b0c749dc37b34b425981f13375010c (patch)
tree5e657c471165bf9e88b70dfb6102e5e3cbe6810c
parentd9119202441f5ba45fcda9771cf57a2e70b2bcb5 (diff)
downloadruby-c0ffccf722b0c749dc37b34b425981f13375010c.tar.gz
parse.y: Fix the locations of NODE in percent strings
* parse.y (parser_yylex): token_flush before calling parse_string. Without token_flush the first locations of NODE in percent strings are set to the location of %. e.g. The locations of NODE_STR is fixed: ``` %w[a b] ``` * Before ``` NODE_STR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 4) ("a") NODE_STR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6) ("b") ``` * After ``` NODE_STR (line: 1, first_lineno: 1, first_column: 3, last_lineno: 1, last_column: 4) ("a") NODE_STR (line: 1, first_lineno: 1, first_column: 5, last_lineno: 1, last_column: 6) ("b") ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--parse.y1
1 files changed, 1 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 8ea297f076..4a12b19dad 100644
--- a/parse.y
+++ b/parse.y
@@ -8248,6 +8248,7 @@ parser_yylex(struct parser_params *parser)
return here_document(&lex_strterm->u.heredoc);
}
else {
+ token_flush(parser);
return parse_string(&lex_strterm->u.literal);
}
}