ruby-changes:49834
From: mame <ko1@a...>
Date: Fri, 19 Jan 2018 19:48:13 +0900 (JST)
Subject: [ruby-changes:49834] mame:r61952 (trunk): ext/ripper: Introduce a simple DSL for ripper.y code generation
mame 2018-01-19 19:48:08 +0900 (Fri, 19 Jan 2018) New Revision: 61952 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61952 Log: ext/ripper: Introduce a simple DSL for ripper.y code generation Currently, parse.y actions are hard to read and write because the code has double meaning (for core parser and for ripper). I think that, if it is easy to write ripper's code shortly and simply, the double meaning trick is not needed. For the sake, this change adds a simple DSL for ripper's code. For example, in parse.y, we can write: /*% ripper: stmts_add(stmts_new, void_stmt) %*/ instead of: $$ = dispatch2(stmts_add, dispatch0(stmts_new), dispatch0(void_stmt)); Added files: trunk/ext/ripper/tools/dsl.rb Modified files: trunk/ext/ripper/depend trunk/ext/ripper/tools/generate.rb trunk/ext/ripper/tools/preproc.rb trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61951) +++ parse.y (revision 61952) @@ -664,31 +664,17 @@ static void ripper_error(struct parser_p https://github.com/ruby/ruby/blob/trunk/parse.y#L664 #define TOKEN2VAL(t) ID2VAL(TOKEN2ID(t)) #define KWD2EID(t, v) ripper_new_yylval(p, keyword_##t, get_value(v), 0) -#define arg_new() dispatch0(args_new) -#define arg_add(l,a) dispatch2(args_add, (l), (a)) -#define arg_add_star(l,a) dispatch2(args_add_star, (l), (a)) -#define arg_add_block(l,b) dispatch2(args_add_block, (l), (b)) #define arg_add_optblock(l,b) ((b)==Qundef? (l) : dispatch2(args_add_block, (l), (b))) -#define bare_assoc(v) dispatch1(bare_assoc_hash, (v)) -#define arg_add_assocs(l,b) arg_add((l), bare_assoc(b)) #define args2mrhs(a) dispatch1(mrhs_new_from_args, (a)) #define mrhs_new() dispatch0(mrhs_new) #define mrhs_add(l,a) dispatch2(mrhs_add, (l), (a)) #define mrhs_add_star(l,a) dispatch2(mrhs_add_star, (l), (a)) -#define mlhs_new() dispatch0(mlhs_new) -#define mlhs_add(l,a) dispatch2(mlhs_add, (l), (a)) -#define mlhs_add_star(l,a) dispatch2(mlhs_add_star, (l), (a)) -#define mlhs_add_post(l,a) dispatch2(mlhs_add_post, (l), (a)) - #define params_new(pars, opts, rest, pars2, kws, kwrest, blk) \ dispatch7(params, (pars), (opts), (rest), (pars2), (kws), (kwrest), (blk)) -#define blockvar_new(params,block_local_vars) dispatch2(block_var, (params), (block_local_vars)) - #define method_optarg(m,a) ((a)==Qundef ? (m) : dispatch2(method_add_arg,(m),(a))) -#define method_arg(m,a) dispatch2(method_add_arg,(m),(a)) #define method_add_block(p,m,b,loc) dispatch2(method_add_block, (m), (b)) #define escape_Qundef(x) ((x)==Qundef ? Qnil : (x)) @@ -983,9 +969,11 @@ program : { https://github.com/ruby/ruby/blob/trunk/parse.y#L969 void_expr(p, node); } p->eval_tree = NEW_SCOPE(0, block_append(p, p->eval_tree, $2), &@$); + /*% %*/ + /*% ripper: program($2) %*/ + /*%%%*/ /*% - $$ = $2; - p->result = dispatch1(program, $$); + p->result = $$; %*/ local_pop(p); } @@ -1001,26 +989,22 @@ top_stmts : none https://github.com/ruby/ruby/blob/trunk/parse.y#L989 { /*%%%*/ $$ = NEW_BEGIN(0, &@$); - /*% - $$ = dispatch2(stmts_add, dispatch0(stmts_new), - dispatch0(void_stmt)); - %*/ + /*% %*/ + /*% ripper: stmts_add(stmts_new, void_stmt) %*/ } | top_stmt { /*%%%*/ $$ = newline_node($1); - /*% - $$ = dispatch2(stmts_add, dispatch0(stmts_new), $1); - %*/ + /*% %*/ + /*% ripper: stmts_add(stmts_new, $1) %*/ } | top_stmts terms top_stmt { /*%%%*/ $$ = block_append(p, $1, newline_node($3)); - /*% - $$ = dispatch2(stmts_add, $1, $3); - %*/ + /*% %*/ + /*% ripper: stmts_add($1, $3) %*/ } | error top_stmt { @@ -1041,9 +1025,8 @@ begin_block : '{' top_compstmt '}' https://github.com/ruby/ruby/blob/trunk/parse.y#L1025 p->eval_tree_begin = block_append(p, p->eval_tree_begin, NEW_BEGIN($2, &@$)); $$ = NEW_BEGIN(0, &@$); - /*% - $$ = dispatch1(BEGIN, $2); - %*/ + /*% %*/ + /*% ripper: send(:BEGIN, $2) %*/ } ; @@ -1065,13 +1048,8 @@ bodystmt : compstmt https://github.com/ruby/ruby/blob/trunk/parse.y#L1048 $$ = NEW_ENSURE($$, $4, &@$); } fixpos($$, $1); - /*% - $$ = dispatch4(bodystmt, - escape_Qundef($1), - escape_Qundef($2), - escape_Qundef($3), - escape_Qundef($4)); - %*/ + /*% %*/ + /*% ripper: bodystmt(_escape_Qundef($1), _escape_Qundef($2), _escape_Qundef($3), _escape_Qundef($4)) %*/ } ; @@ -1085,26 +1063,22 @@ stmts : none https://github.com/ruby/ruby/blob/trunk/parse.y#L1063 { /*%%%*/ $$ = NEW_BEGIN(0, &@$); - /*% - $$ = dispatch2(stmts_add, dispatch0(stmts_new), - dispatch0(void_stmt)); - %*/ + /*% %*/ + /*% ripper: stmts_add(stmts_new, void_stmt) %*/ } | stmt_or_begin { /*%%%*/ $$ = newline_node($1); - /*% - $$ = dispatch2(stmts_add, dispatch0(stmts_new), $1); - %*/ + /*% %*/ + /*% ripper: stmts_add(stmts_new, $1) %*/ } | stmts terms stmt_or_begin { /*%%%*/ $$ = block_append(p, $1, newline_node($3)); - /*% - $$ = dispatch2(stmts_add, $1, $3); - %*/ + /*% %*/ + /*% ripper: stmts_add($1, $3) %*/ } | error stmt { @@ -1129,17 +1103,15 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1103 { /*%%%*/ $$ = NEW_ALIAS($2, $4, &@$); - /*% - $$ = dispatch2(alias, $2, $4); - %*/ + /*% %*/ + /*% ripper: send(:alias, $2, $4) %*/ } | keyword_alias tGVAR tGVAR { /*%%%*/ $$ = NEW_VALIAS($2, $3, &@$); - /*% - $$ = dispatch2(var_alias, $2, $3); - %*/ + /*% %*/ + /*% ripper: var_alias($2, $3) %*/ } | keyword_alias tGVAR tBACK_REF { @@ -1148,46 +1120,39 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1120 buf[0] = '$'; buf[1] = (char)$3->nd_nth; $$ = NEW_VALIAS($2, rb_intern2(buf, 2), &@$); - /*% - $$ = dispatch2(var_alias, $2, $3); - %*/ + /*% %*/ + /*% ripper: var_alias($2, $3) %*/ } | keyword_alias tGVAR tNTH_REF { /*%%%*/ yyerror1(&@3, "can't make alias for the number variables"); $$ = NEW_BEGIN(0, &@$); - /*% - $$ = dispatch2(var_alias, $2, $3); - $$ = dispatch1(alias_error, $$); - ripper_error(p); - %*/ + /*% %*/ + /*% ripper[error]: alias_error(var_alias($2, $3)) %*/ } | keyword_undef undef_list { /*%%%*/ $$ = $2; - /*% - $$ = dispatch1(undef, $2); - %*/ + /*% %*/ + /*% ripper: send(:undef, $2) %*/ } | stmt modifier_if expr_value { /*%%%*/ $$ = new_if(p, $3, remove_begin($1), 0, &@$); fixpos($$, $3); - /*% - $$ = dispatch2(if_mod, $3, $1); - %*/ + /*% %*/ + /*% ripper: if_mod($3, $1) %*/ } | stmt modifier_unless expr_value { /*%%%*/ $$ = new_unless(p, $3, remove_begin($1), 0, &@$); fixpos($$, $3); - /*% - $$ = dispatch2(unless_mod, $3, $1); - %*/ + /*% %*/ + /*% ripper: unless_mod($3, $1) %*/ } | stmt modifier_while expr_value { @@ -1198,9 +1163,8 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1163 else { $$ = NEW_WHILE(cond(p, $3, &@3), $1, 1, &@$); } - /*% - $$ = dispatch2(while_mod, $3, $1); - %*/ + /*% %*/ + /*% ripper: while_mod($3, $1) %*/ } | stmt modifier_until expr_value { @@ -1211,9 +1175,8 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1175 else { $$ = NEW_UNTIL(cond(p, $3, &@3), $1, 1, &@$); } - /*% - $$ = dispatch2(until_mod, $3, $1); - %*/ + /*% %*/ + /*% ripper: until_mod($3, $1) %*/ } | stmt modifier_rescue stmt { @@ -1222,9 +1185,8 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1185 YYLTYPE loc = code_loc_gen(&@2, &@3); resq = NEW_RESBODY(0, remove_begin($3), 0, &loc); $$ = NEW_RESCUE(remove_begin($1), resq, 0, &@$); - /*% - $$ = dispatch2(rescue_mod, $1, $3); - %*/ + /*% %*/ + /*% ripper: rescue_mod($1, $3) %*/ } | keyword_END '{' compstmt '}' { @@ -1237,9 +1199,8 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1199 NODE_SCOPE, 0 /* tbl */, $3 /* body */, 0 /* args */, &@$); $$ = NEW_POSTEXE(scope, &@$); } - /*% - $$ = dispatch1(END, $3); - %*/ + /*% %*/ + /*% ripper: send(:END, $3) %*/ } | command_asgn | mlhs '=' command_call @@ -1247,9 +1208,8 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1208 /*%%%*/ value_expr($3); $$ = node_assign(p, $1, $3, &@$); - /*% - $$ = dispatch2(massign, $1, $3); - %*/ + /*% %*/ + /*% ripper: massign($1, $3) %*/ } | lhs '=' mrhs { @@ -1260,9 +1220,8 @@ stmt : keyword_alias fitem {SET_LEX_STA https://github.com/ruby/ruby/blob/trunk/parse.y#L1220 { /*%%%*/ $$ = node_assign(p, $1, $3, &@$); - /*% - $$ = dispatch2(massign, $1, $3); - %*/ + /*% %*/ + /*% ripper: massign($1, $3) %*/ } | expr ; @@ -1296,8 +1255,7 @@ command_asgn : lhs '=' command_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1255 { /*%%%*/ YYLTYPE loc = code_loc_gen(&@1, &@3); - /*% - %*/ + /*% %*/ $$ = const_path_field($1, $3, &loc); $$ = new_const_op_assign(p, $$, $4, $5, &@$); } @@ -1324,9 +1282,8 @@ command_rhs : command_call %prec tOP_A https://github.com/ruby/ruby/blob/trunk/parse.y#L1282 YYLTYPE loc = code_loc_gen(&@2, &@3); value_expr($1); $$ = NEW_RESCUE($1, NEW_RESBODY(0, remove_begin($3), 0, &loc), 0, &@$); - /*% - $$ = dispatch2(rescue_mod, $1, $3); - %*/ + /*% %*/ + /*% ripper: rescue_mod($1, $3) %*/ } | command_asgn ; @@ -1390,8 +1347,7 @@ fcall : operation https://github.com/ruby/ruby/blob/trunk/parse.y#L1347 /*%%%*/ $$ = NEW_FCALL($1, 0, &@$); nd_set_line($$, p->tokline); - /*% - %*/ + /*% %*/ } ; @@ -1400,8 +1356,7 @@ command : fcall command_args %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1356 $$ = new_command(p, $1, $2); /*%%%*/ nd_set_last_loc($1, nd_last_loc($2)); - /*% - %*/ + /*% %*/ } | fcall command_args cmd_brace_block { @@ -1411,8 +1366,7 @@ command : fcall command_args %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1366 fixpos($$, $1); /*%%%*/ nd_set_last_loc($1, nd_last_loc($2)); - /*% - %*/ + /*% %*/ } | primary_value call_op operation2 command_args %prec tLOWEST { @@ -1435,42 +1389,37 @@ command : fcall command_args %pre https://github.com/ruby/ruby/blob/trunk/parse.y#L1389 /*%%%*/ $$ = NEW_SUPER($2, &@$); fixpos($$, $2); - /*% - $$ = dispatch1(super, $2); - %*/ + /*% %*/ + /*% ripper: send(:super, $2) %*/ } | keyword_yield command_args { /*%%%*/ $$ = new_yield(p, $2, &@$); fixpos($$, $2); - /*% - $$ = dispatch1(yield, $2); - %*/ + /*% %*/ + /*% ripper: send(:yield, $2) %*/ } | k_return call_args { /*%%%*/ $$ = NEW_RETURN(ret_args(p, $2), &@$); - /*% - $$ = dispatch1(return, $2); - %*/ + /*% %*/ + /*% ripper: send(:return, $2) %*/ } | keyword_break call_args { /*%%%*/ $$ = NEW_BREAK(ret_args(p, $2), &@$); - /*% - $$ = dispatch1(break, $2); - %*/ + /*% %*/ + /*% ripper: send(:break, $2) %*/ } | keyword_next call_args { /*%%%*/ $$ = NEW_NEXT(ret_args(p, $2), &@$); - /*% - $$ = dispatch1(next, $2); - %*/ + /*% %*/ + /*% ripper: send(:next, $2) %*/ } ; @@ -1479,9 +1428,8 @@ mlhs : mlhs_basic https://github.com/ruby/ruby/blob/trunk/parse.y#L1428 { /*%%%*/ $$ = $2; - /*% - $$ = dispatch1(mlhs_paren, $2); - %*/ + /*% %*/ + /*% ripper: mlhs_paren($2) %*/ } ; @@ -1490,9 +1438,8 @@ mlhs_inner : mlhs_basic https://github.com/ruby/ruby/blob/trunk/parse.y#L1438 { /*%%%*/ $$ = NEW_MASGN(NEW_LIST($2, &@$), 0, &@$); - /*% - $$ = dispatch1(mlhs_paren, $2); - %*/ + /*% %*/ + /*% ripper: mlhs_paren($2) %*/ } ; @@ -1500,85 +1447,71 @@ mlhs_basic : mlhs_head https://github.com/ruby/ruby/blob/trunk/parse.y#L1447 { /*%%%*/ $$ = NEW_MASGN($1, 0, &@$); - /*% - $$ = $1; - %*/ + /*% %*/ + /*% ripper: $1 %*/ } | mlhs_head mlhs_item { /*%%%*/ $$ = NEW_MASGN(list_append(p, $1,$2), 0, &@$); - /*% - $$ = mlhs_add($1, $2); - %*/ + /*% %*/ + /*% ripper: mlhs_add($1, $2) %*/ } | mlhs_head tSTAR mlhs_node { /*%%%*/ $$ = NEW_MASGN($1, $3, &@$); - /*% - $$ = mlhs_add_star($1, $3); - %*/ + /*% %*/ + /*% ripper: mlhs_add_star($1, $3) %*/ } | mlhs_head tSTAR mlhs_node ',' mlhs_post { /*%%%*/ $$ = NEW_MASGN($1, NEW_POSTARG($3,$5,&@$), &@$); - /*% - $1 = mlhs_add_star($1, $3); - $$ = mlhs_add_post($1, $5); - %*/ + /*% %*/ + /*% ripper: mlhs_add_post(mlhs_add_star($1, $3), $5) %*/ } | mlhs_head tSTAR { /*%%%*/ $$ = NEW_MASGN($1, NODE_SPECIAL_NO_NAME_REST, &@$); - /*% - $$ = mlhs_add_star($1, Qnil); - %*/ + /*% %*/ + /*% ripper: mlhs_add_star($1, "Qnil") %*/ } | mlhs_head tSTAR ',' mlhs_post { /*%%%*/ $$ = NEW_MASGN($1, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $4, &@$), &@$); - /*% - $1 = mlhs_add_star($1, Qnil); - $$ = mlhs_add_post($1, $4); - %*/ + /*% %*/ + /*% ripper: mlhs_add_post(mlhs_add_star($1, "Qnil"), $4) %*/ } | tSTAR mlhs_node { /*%%%*/ $$ = NEW_MASGN(0, $2, &@$); - /*% - $$ = mlhs_add_star(mlhs_new(), $2); - %*/ + /*% %*/ + /*% ripper: mlhs_add_star(mlhs_new, $2) %*/ } | tSTAR mlhs_node ',' mlhs_post { /*%%%*/ $$ = NEW_MASGN(0, NEW_POSTARG($2,$4,&@$), &@$); - /*% - $2 = mlhs_add_star(mlhs_new(), $2); - $$ = mlhs_add_post($2, $4); - %*/ + /*% %*/ + /*% ripper: mlhs_add_post(mlhs_add_star(mlhs_new, $2), $4) %*/ } | tSTAR { /*%%%*/ $$ = NEW_MASGN(0, NODE_SPECIAL_NO_NAME_REST, &@$); - /*% - $$ = mlhs_add_star(mlhs_new(), Qnil); - %*/ + /*% %*/ + /*% ripper: mlhs_add_star(mlhs_new, "Qnil") %*/ } | tSTAR ',' mlhs_post { /*%%%*/ $$ = NEW_MASGN(0, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $3, &@$), &@$); - /*% - $$ = mlhs_add_star(mlhs_new(), Qnil); - $$ = mlhs_add_post($$, $3); - %*/ + /*% %*/ + /*% ripper: mlhs_add_post(mlhs_add_star(mlhs_new, "Qnil"), $3) %*/ } ; @@ -1587,9 +1520,8 @@ mlhs_item : mlhs_node https://github.com/ruby/ruby/blob/trunk/parse.y#L1520 { /*%%%*/ $$ = $2; - /*% - $$ = dispatch1(mlhs_paren, $2); - %*/ + /*% %*/ + /*% ripper: mlhs_paren($2) %*/ } ; @@ -1597,17 +1529,15 @@ mlhs_head : mlhs_item ',' https://github.com/ruby/ruby/blob/trunk/parse.y#L1529 { /*%%%*/ $$ = NEW_LIST($1, &@1); - /*% - $$ = mlhs_add(mlhs_new(), $1); - %*/ + /*% %*/ + /*% ripper: mlhs_add(mlhs_new, $1) %*/ } | mlhs_head mlhs_item ',' { /*%%%*/ $$ = list_append(p, $1, $2); - /*% - $$ = mlhs_add($1, $2); - %*/ + /*% %*/ + /*% ripper: mlhs_add($1, $2) %*/ } ; @@ -1615,17 +1545,15 @@ mlhs_post : mlhs_item https://github.com/ruby/ruby/blob/trunk/parse.y#L1545 { /*%%%*/ $$ = NEW_LIST($1, &@$); - /*% - $$ = mlhs_add(mlhs_new(), $1); - %*/ + /*% %*/ + /*% ripper: mlhs_add(mlhs_new, $1) %*/ } | mlhs_post ',' mlhs_item { /*%%%*/ $$ = list_append(p, $1, $3); - /*% - $$ = mlhs_add($1, $3); - %*/ + /*% %*/ + /*% ripper: mlhs_add($1, $3) %*/ } ; @@ -1641,33 +1569,29 @@ mlhs_node : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1569 { /*%%%*/ $$ = aryset(p, $1, $3, &@$); - /*% - $$ = dispatch2(aref_field, $1, escape_Qundef($3)); - %*/ + /*% %*/ + /*% ripper: aref_field($1, _escape_Qundef($3)) %*/ } | primary_value call_op tIDENTIFIER { /*%%%*/ $$ = attrset(p, $1, $2, $3, &@$); - /*% - $$ = dispatch3(field, $1, $2, $3); - %*/ + /*% %*/ + /*% ripper: field($1, $2, $3) %*/ } | primary_value tCOLON2 tIDENTIFIER { /*%%%*/ $$ = attrset(p, $1, idCOLON2, $3, &@$); - /*% - $$ = dispatch2(const_path_field, $1, $3); - %*/ + /*% %*/ + /*% ripper: const_path_field($1, $3) %*/ } | primary_value call_op tCONSTANT { /*%%%*/ $$ = attrset(p, $1, $2, $3, &@$); - /*% - $$ = dispatch3(field, $1, $2, $3); - %*/ + /*% %*/ + /*% ripper: field($1, $2, $3) %*/ } | primary_value tCOLON2 tCONSTANT { @@ -1696,33 +1620,29 @@ lhs : user_variable https://github.com/ruby/ruby/blob/trunk/parse.y#L1620 { /*%%%*/ $$ = aryset(p, $1, $3, &@$); - /*% - $$ = dispatch2(aref_field, $1, escape_Qundef($3)); - %*/ + /*% %*/ + /*% ripper: aref_field($1, _escape_Qundef($3)) %*/ } | primary_value call_op tIDENTIFIER { /*%%%*/ $$ = attrset(p, $1, $2, $3, &@$); - /*% - $$ = dispatch3(field, $1, $2, $3); - %*/ + /*% %*/ + /*% ripper: field($1, $2, $3) %*/ } | primary_value tCOLON2 tIDENTIFIER { /*%%%*/ $$ = attrset(p, $1, idCOLON2, $3, &@$); - /*% - $$ = dispatch3(field, $1, ID2VAL(idCOLON2), $3); - %*/ + /*% %*/ + /*% ripper: field($1, "ID2VAL(idCOLON2)", $3) %*/ } | primary_value call_op tCONSTANT { /*%%%*/ $$ = attrset(p, $1, $2, $3, &@$); - /*% - $$ = dispatch3(field, $1, $2, $3); - %*/ + /*% %*/ + /*% ripper: field($1, $2, $3) %*/ } | primary_value tCOLON2 tCONSTANT { @@ -1743,10 +1663,8 @@ cname : tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/parse.y#L1663 { /*%%%*/ yyerror1(&@1, "class/module name must be CONSTANT"); - /*% - $$ = dispatch1(class_name_error, $1); - ripper_error(p); - %*/ + /*% %*/ + /*% ripper[error]: class_name_error($1) %*/ } | tCONSTANT ; @@ -1755,25 +1673,22 @@ cpath : tCOLON3 cname https://github.com/ruby/ruby/blob/trunk/parse.y#L1673 { /*%%%*/ $$ = NEW_COLON3($2, &@$); - /*% - $$ = dispatch1(top_const_ref, $2); - %*/ + /*% %*/ + /*% ripper: top_const_ref($2) %*/ } | cname { /*%%%*/ $$ = NEW_COLON2(0, $$, &@$); - /*% - $$ = dispatch1(const_ref, $1); - %*/ + /*% %*/ + /*% ripper: const_ref($1) %*/ } | primary_value tCOLON2 cname { /*%%%*/ $$ = NEW_COLON2($1, $3, &@$); - /*% - $$ = dispatch2(const_path_ref, $1, $3); - %*/ + /*% %*/ + /*% ripper: const_path_ref($1, $3) %*/ } ; @@ -1800,9 +1715,8 @@ fitem : fsym https://github.com/ruby/ruby/blob/trunk/parse.y#L1715 { /*%%%*/ $$ = NEW_LIT(ID2SYM($1), &@$); - /*% - $$ = dispatch1(symbol_literal, $1); - %*/ + /*% %*/ + /*% ripper: symbol_literal($1) %*/ } | dsym ; @@ -1811,18 +1725,16 @@ undef_list : fitem https://github.com/ruby/ruby/blob/trunk/parse.y#L1725 { /*%%%*/ $$ = NEW_UNDEF($1, &@$); - /*% - $$ = rb_ary_new3(1, get_value($1)); - %*/ + /*% %*/ + /*% ripper: _rb_ary_new3(1, _get_value($1)) %*/ } | undef_list ',' {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem { /*%%%*/ NODE *undef = NEW_UNDEF($4, &@$); $$ = block_append(p, $1, undef); - /*% - rb_ary_push($1, get_value($4)); - %*/ + /*% %*/ + /*% ripper: _rb_ary_push($1, _get_value($4)) %*/ } ; @@ -1904,8 +1 (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/