ruby-changes:48753
From: yui-knk <ko1@a...>
Date: Tue, 21 Nov 2017 09:47:06 +0900 (JST)
Subject: [ruby-changes:48753] yui-knk:r60869 (trunk): parse.y: Fix the locations of NODE in percent strings
yui-knk 2017-11-21 09:47:00 +0900 (Tue, 21 Nov 2017) New Revision: 60869 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60869 Log: 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") ``` Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 60868) +++ parse.y (revision 60869) @@ -8248,6 +8248,7 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8248 return here_document(&lex_strterm->u.heredoc); } else { + token_flush(parser); return parse_string(&lex_strterm->u.literal); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/