summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-17 12:16:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-17 12:16:30 +0000
commit3465fdd44e1358c89c3c15ddf743b92df9aac4f8 (patch)
treeb8de14bcb5aab08b92be169fcfba7f9a5db6dbd6
parent8d7d8d0c7fd0b1e43ae00442b0c738e7cb5d3b70 (diff)
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
-rw-r--r--parse.y10
1 files 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;
}