From 813b8d0a5394a1eb5998246cac3cd7fc18b9a011 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 17 Nov 2017 12:16:31 +0000 Subject: [PATCH] parse.y: RUBY_SET_YYLLOC to rb_parser_set_location git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/parse.y b/parse.y index 879f744476..2dbb2865f0 100644 --- a/parse.y +++ b/parse.y @@ -63,14 +63,7 @@ while (0) #define RUBY_SET_YYLLOC(Current) \ - do \ - { \ - (Current).first_loc.lineno = ruby_sourceline; \ - (Current).first_loc.column = (int)(parser->tokp - lex_pbeg); \ - (Current).last_loc.lineno = ruby_sourceline; \ - (Current).last_loc.column = (int)(lex_p - lex_pbeg); \ - } \ - while (0) + rb_parser_set_location(parser, &(Current)) #undef malloc #undef realloc @@ -690,6 +683,7 @@ enum lex_state_e rb_parser_trace_lex_state(struct parser_params *, enum lex_stat VALUE rb_parser_lex_state_name(enum lex_state_e state); void rb_parser_show_bitstack(struct parser_params *, stack_type, const char *, int); PRINTF_ARGS(void rb_parser_fatal(struct parser_params *parser, const char *fmt, ...), 2, 3); +void rb_parser_set_location(struct parser_params *parser, YYLTYPE *yylloc); RUBY_SYMBOL_EXPORT_END static ID formal_argument_gen(struct parser_params*, ID); @@ -9828,6 +9822,15 @@ rb_parser_fatal(struct parser_params *parser, const char *fmt, ...) parser->debug_output = rb_stderr; yydebug = TRUE; } + +void +rb_parser_set_location(struct parser_params *parser, YYLTYPE *yylloc) +{ + 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); +} #endif /* !RIPPER */ #ifndef RIPPER