1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2017-11-17 12:16:31 +00:00
parent 3465fdd44e
commit 813b8d0a53

19
parse.y
View file

@ -63,14 +63,7 @@
while (0) while (0)
#define RUBY_SET_YYLLOC(Current) \ #define RUBY_SET_YYLLOC(Current) \
do \ rb_parser_set_location(parser, &(Current))
{ \
(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)
#undef malloc #undef malloc
#undef realloc #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); VALUE rb_parser_lex_state_name(enum lex_state_e state);
void rb_parser_show_bitstack(struct parser_params *, stack_type, const char *, int); 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); 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 RUBY_SYMBOL_EXPORT_END
static ID formal_argument_gen(struct parser_params*, ID); 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; parser->debug_output = rb_stderr;
yydebug = TRUE; 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 */ #endif /* !RIPPER */
#ifndef RIPPER #ifndef RIPPER