From 3465fdd44e1358c89c3c15ddf743b92df9aac4f8 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 17 Nov 2017 12:16:30 +0000 Subject: [PATCH] parse.y: RUBY_SET_YYLLOC * parse.y (RUBY_SET_YYLLOC): extract setting locations from the source line. * parse.y (yylex): use RUBY_SET_YYLLOC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/parse.y b/parse.y index b354552bcf..879f744476 100644 --- a/parse.y +++ b/parse.y @@ -59,6 +59,11 @@ (Current).last_loc = YYRHSLOC(Rhs, N).last_loc; \ } \ else \ + RUBY_SET_YYLLOC(Current); \ + while (0) + +#define RUBY_SET_YYLLOC(Current) \ + do \ { \ (Current).first_loc.lineno = ruby_sourceline; \ (Current).first_loc.column = (int)(parser->tokp - lex_pbeg); \ @@ -8893,10 +8898,7 @@ yylex(YYSTYPE *lval, YYLTYPE *yylloc, struct parser_params *parser) else if (t != 0) dispatch_scan_event(t); - yylloc->first_loc.lineno = ruby_sourceline; - yylloc->first_loc.column = (int)(parser->tokp - lex_pbeg); - yylloc->last_loc.lineno = ruby_sourceline; - yylloc->last_loc.column = (int)(lex_p - lex_pbeg); + RUBY_SET_YYLLOC(*yylloc); return t; }