mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) fa05697e48
: [Backport #18166]
Use `%printer` directive for Bison 3.8 --- parse.y | 74 ++++++++++++++++++++++++++--------------------------------------- 1 file changed, 29 insertions(+), 45 deletions(-)
This commit is contained in:
parent
976569d945
commit
efa1ba15fd
2 changed files with 32 additions and 5 deletions
31
parse.y
31
parse.y
|
@ -89,7 +89,6 @@ struct lex_context {
|
|||
#define YYCALLOC(nelem, size) rb_parser_calloc(p, (nelem), (size))
|
||||
#define YYFREE(ptr) rb_parser_free(p, (ptr))
|
||||
#define YYFPRINTF rb_parser_printf
|
||||
#define YYPRINT(out, tok, val) parser_token_value_print(p, (tok), &(val))
|
||||
#define YY_LOCATION_PRINT(File, loc) \
|
||||
rb_parser_printf(p, "%d.%d-%d.%d", \
|
||||
(loc).beg_pos.lineno, (loc).beg_pos.column,\
|
||||
|
@ -654,7 +653,6 @@ RUBY_SYMBOL_EXPORT_END
|
|||
|
||||
static void error_duplicate_pattern_variable(struct parser_params *p, ID id, const YYLTYPE *loc);
|
||||
static void error_duplicate_pattern_key(struct parser_params *p, ID id, const YYLTYPE *loc);
|
||||
static void parser_token_value_print(struct parser_params *p, enum yytokentype type, const YYSTYPE *valp);
|
||||
#ifndef RIPPER
|
||||
static ID formal_argument(struct parser_params*, ID);
|
||||
#else
|
||||
|
@ -1084,6 +1082,35 @@ static int looking_at_eol_p(struct parser_params *p);
|
|||
%expect 0
|
||||
%define api.pure
|
||||
%define parse.error verbose
|
||||
%printer {
|
||||
#ifndef RIPPER
|
||||
rb_parser_printf(p, "%"PRIsVALUE, rb_id2str($$));
|
||||
#else
|
||||
rb_parser_printf(p, "%"PRIsVALUE, RNODE($$)->nd_rval);
|
||||
#endif
|
||||
} tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL tOP_ASGN
|
||||
%printer {
|
||||
#ifndef RIPPER
|
||||
rb_parser_printf(p, "%+"PRIsVALUE, $$->nd_lit);
|
||||
#else
|
||||
rb_parser_printf(p, "%+"PRIsVALUE, get_value($$));
|
||||
#endif
|
||||
} tINTEGER tFLOAT tRATIONAL tIMAGINARY tSTRING_CONTENT tCHAR
|
||||
%printer {
|
||||
#ifndef RIPPER
|
||||
rb_parser_printf(p, "$%ld", $$->nd_nth);
|
||||
#else
|
||||
rb_parser_printf(p, "%"PRIsVALUE, $$);
|
||||
#endif
|
||||
} tNTH_REF
|
||||
%printer {
|
||||
#ifndef RIPPER
|
||||
rb_parser_printf(p, "$%c", (int)$$->nd_nth);
|
||||
#else
|
||||
rb_parser_printf(p, "%"PRIsVALUE, $$);
|
||||
#endif
|
||||
} tBACK_REF
|
||||
|
||||
%lex-param {struct parser_params *p}
|
||||
%parse-param {struct parser_params *p}
|
||||
%initial-action
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 3
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 137
|
||||
#define RUBY_PATCHLEVEL 138
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2021
|
||||
#define RUBY_RELEASE_MONTH 9
|
||||
#define RUBY_RELEASE_DAY 26
|
||||
#define RUBY_RELEASE_MONTH 10
|
||||
#define RUBY_RELEASE_DAY 2
|
||||
|
||||
#include "ruby/version.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue