summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-19 10:48:08 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-19 10:48:08 +0000
commit9b7fe0a25012d615f1cae8da1f5c444f61ffb7c7 (patch)
treee46613a0689272c609dd1e41ebe1ca9e5b7faa50
parent9eb4344a16ec37eb5660099c1aad12f9a8dc914d (diff)
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)); git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/ripper/depend6
-rw-r--r--ext/ripper/tools/dsl.rb46
-rwxr-xr-xext/ripper/tools/generate.rb9
-rwxr-xr-xext/ripper/tools/preproc.rb4
-rw-r--r--parse.y1176
5 files changed, 501 insertions, 740 deletions
diff --git a/ext/ripper/depend b/ext/ripper/depend
index 141319fc06..ed07a32e99 100644
--- a/ext/ripper/depend
+++ b/ext/ripper/depend
@@ -18,7 +18,7 @@ ripper.o: ripper.c
all: check
static: check
-ripper.y: $(srcdir)/tools/preproc.rb $(top_srcdir)/parse.y {$(VPATH)}id.h
+ripper.y: $(srcdir)/tools/preproc.rb $(srcdir)/tools/dsl.rb $(top_srcdir)/parse.y {$(VPATH)}id.h
$(ECHO) extracting $@ from $(top_srcdir)/parse.y
$(Q) $(RUBY) $(top_srcdir)/tool/id2token.rb --path-separator=.$(PATH_SEPARATOR)./ \
--vpath=$(VPATH)$(PATH_SEPARATOR)$(top_srcdir) id.h $(top_srcdir)/parse.y > ripper.tmp.y
@@ -32,11 +32,11 @@ check: .eventids2-check
$(Q) $(RUBY) $(GEN) --mode=check --ids1src=$(SRC1) --ids2src=$(SRC2)
@exit > $@
-eventids1.c: $(srcdir)/tools/generate.rb $(SRC1)
+eventids1.c: $(GEN) $(srcdir)/tools/dsl.rb $(SRC1)
$(ECHO) generating $@ from $(SRC1)
$(Q) $(RUBY) $(GEN) --mode=eventids1 --ids1src=$(SRC1) --output=$@
-eventids2table.c: $(srcdir)/tools/generate.rb $(SRC2)
+eventids2table.c: $(GEN) $(srcdir)/tools/dsl.rb $(SRC2)
$(ECHO) generating $@ from $(SRC2)
$(Q) $(RUBY) $(GEN) --mode=eventids2table --ids2src=$(SRC2) --output=$@
diff --git a/ext/ripper/tools/dsl.rb b/ext/ripper/tools/dsl.rb
new file mode 100644
index 0000000000..e321019d7e
--- /dev/null
+++ b/ext/ripper/tools/dsl.rb
@@ -0,0 +1,46 @@
+# Simple DSL implementation for Ripper code generation
+#
+# input: /*% ripper: stmts_add(stmts_new, void_stmt) %*/
+# output: $$ = dispatch2(stmts_add, dispatch0(stmts_new), dispatch0(void_stmt))
+
+class DSL
+ def initialize(code, options)
+ @events = {}
+ @error = options.include?("error")
+ @brace = options.include?("brace")
+
+ # create $1 == "$1", $2 == "$2", ...
+ re, s = "", ""
+ 1.upto(9) do |n|
+ re << "(..)"
+ s << "$#{ n }"
+ end
+ /#{ re }/ =~ s
+
+ @code = eval(code)
+ end
+
+ attr_reader :events
+
+ undef lambda
+ undef hash
+ undef class
+
+ def generate
+ s = "$$"
+ s = "\t\t\t#{ s } = #@code;"
+ s << "ripper_error(p);" if @error
+ s = "{#{ s }}" if @brace
+ s
+ end
+
+ def method_missing(*args)
+ if args.first =~ /\A_/
+ "#{ $' }(#{ args.drop(1).join(", ") })"
+ else
+ @events[args.first.to_s] = args.size - 1
+ "dispatch#{ args.size - 1 }(#{ args.join(", ") })"
+ end
+ end
+end
+
diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb
index cf24f1398d..883e6ef2df 100755
--- a/ext/ripper/tools/generate.rb
+++ b/ext/ripper/tools/generate.rb
@@ -135,6 +135,8 @@ def check_arity(h)
abort if invalid
end
+require_relative "dsl"
+
def read_ids1_with_locations(path)
h = {}
File.open(path) {|f|
@@ -144,6 +146,13 @@ def read_ids1_with_locations(path)
line.scan(/\bdispatch(\d)\((\w+)/) do |arity, event|
(h[event] ||= []).push [f.lineno, arity.to_i]
end
+ if line =~ %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/>
+ gen = DSL.new($2, ($1 || "").split(","))
+ gen.generate
+ gen.events.each do |event, arity|
+ (h[event] ||= []).push [f.lineno, arity.to_i]
+ end
+ end
end
}
h
diff --git a/ext/ripper/tools/preproc.rb b/ext/ripper/tools/preproc.rb
index 8b68579164..560a82e54f 100755
--- a/ext/ripper/tools/preproc.rb
+++ b/ext/ripper/tools/preproc.rb
@@ -72,9 +72,13 @@ def prelude(f, out)
end
end
+require_relative "dsl"
+
def grammar(f, out)
while line = f.gets
case line
+ when %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/>
+ out << DSL.new($2, ($1 || "").split(",")).generate << $/
when %r</\*%%%\*/>
out << '#if 0' << $/
when %r</\*%c%\*/>
diff --git a/parse.y b/parse.y
index 87e9e7b592..26193c680e 100644
--- a/parse.y
+++ b/parse.y
@@ -664,31 +664,17 @@ static void ripper_error(struct parser_params *p);
#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 : {
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
{
/*%%%*/
$$ = 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 '}'
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
$$ = 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
{
/*%%%*/
$$ = 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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
{
/*%%%*/
$$ = 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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
/*%%%*/
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_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
{
/*%%%*/
$$ = node_assign(p, $1, $3, &@$);
- /*%
- $$ = dispatch2(massign, $1, $3);
- %*/
+ /*% %*/
+ /*% ripper: massign($1, $3) %*/
}
| expr
;
@@ -1296,8 +1255,7 @@ command_asgn : lhs '=' command_rhs
{
/*%%%*/
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_ASGN
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
/*%%%*/
$$ = NEW_FCALL($1, 0, &@$);
nd_set_line($$, p->tokline);
- /*%
- %*/
+ /*% %*/
}
;
@@ -1400,8 +1356,7 @@ command : fcall command_args %prec tLOWEST
$$ = 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 %prec tLOWEST
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 %prec tLOWEST
/*%%%*/
$$ = 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
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(mlhs_paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_paren($2) %*/
}
;
@@ -1490,9 +1438,8 @@ mlhs_inner : mlhs_basic
{
/*%%%*/
$$ = NEW_MASGN(NEW_LIST($2, &@$), 0, &@$);
- /*%
- $$ = dispatch1(mlhs_paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_paren($2) %*/
}
;
@@ -1500,85 +1447,71 @@ mlhs_basic : mlhs_head
{
/*%%%*/
$$ = 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
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(mlhs_paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_paren($2) %*/
}
;
@@ -1597,17 +1529,15 @@ mlhs_head : mlhs_item ','
{
/*%%%*/
$$ = 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
{
/*%%%*/
$$ = 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
{
/*%%%*/
$$ = 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
{
/*%%%*/
$$ = 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
{
/*%%%*/
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
{
/*%%%*/
$$ = 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
{
/*%%%*/
$$ = NEW_LIT(ID2SYM($1), &@$);
- /*%
- $$ = dispatch1(symbol_literal, $1);
- %*/
+ /*% %*/
+ /*% ripper: symbol_literal($1) %*/
}
| dsym
;
@@ -1811,18 +1725,16 @@ undef_list : fitem
{
/*%%%*/
$$ = 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 +1816,7 @@ arg : lhs '=' arg_rhs
{
/*%%%*/
YYLTYPE loc = code_loc_gen(&@1, &@3);
- /*%
- %*/
+ /*% %*/
$$ = const_path_field($1, $3, &loc);
$$ = new_const_op_assign(p, $$, $4, $5, &@$);
}
@@ -1925,9 +1836,8 @@ arg : lhs '=' arg_rhs
value_expr($1);
value_expr($3);
$$ = NEW_DOT2($1, $3, &@$);
- /*%
- $$ = dispatch2(dot2, $1, $3);
- %*/
+ /*% %*/
+ /*% ripper: dot2($1, $3) %*/
}
| arg tDOT3 arg
{
@@ -1935,9 +1845,8 @@ arg : lhs '=' arg_rhs
value_expr($1);
value_expr($3);
$$ = NEW_DOT3($1, $3, &@$);
- /*%
- $$ = dispatch2(dot3, $1, $3);
- %*/
+ /*% %*/
+ /*% ripper: dot3($1, $3) %*/
}
| arg '+' arg
{
@@ -2047,9 +1956,8 @@ arg : lhs '=' arg_rhs
value_expr($1);
$$ = new_if(p, $1, $3, $6, &@$);
fixpos($$, $1);
- /*%
- $$ = dispatch3(ifop, $1, $3, $6);
- %*/
+ /*% %*/
+ /*% ripper: ifop($1, $3, $6) %*/
}
| primary
{
@@ -2090,17 +1998,15 @@ aref_args : none
{
/*%%%*/
$$ = $3 ? arg_append(p, $1, new_hash(p, $3, &@3), &@$) : $1;
- /*%
- $$ = arg_add_assocs($1, $3);
- %*/
+ /*% %*/
+ /*% ripper: args_add($1, bare_assoc_hash($3)) %*/
}
| assocs trailer
{
/*%%%*/
$$ = $1 ? NEW_LIST(new_hash(p, $1, &@1), &@$) : 0;
- /*%
- $$ = arg_add_assocs(arg_new(), $1);
- %*/
+ /*% %*/
+ /*% ripper: args_add(args_new, bare_assoc_hash($1)) %*/
}
;
@@ -2115,9 +2021,8 @@ arg_rhs : arg %prec tOP_ASGN
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) %*/
}
;
@@ -2125,9 +2030,8 @@ paren_args : '(' opt_call_args rparen
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(arg_paren, escape_Qundef($2));
- %*/
+ /*% %*/
+ /*% ripper: arg_paren(_escape_Qundef($2)) %*/
}
;
@@ -2145,17 +2049,15 @@ opt_call_args : none
{
/*%%%*/
$$ = $3 ? arg_append(p, $1, new_hash(p, $3, &@3), &@$) : $1;
- /*%
- $$ = arg_add_assocs($1, $3);
- %*/
+ /*% %*/
+ /*% ripper: args_add($1, bare_assoc_hash($3)) %*/
}
| assocs ','
{
/*%%%*/
$$ = $1 ? NEW_LIST(new_hash(p, $1, &@1), &@1) : 0;
- /*%
- $$ = arg_add_assocs(arg_new(), $1);
- %*/
+ /*% %*/
+ /*% ripper: args_add(args_new, bare_assoc_hash($1)) %*/
}
;
@@ -2164,44 +2066,34 @@ call_args : command
/*%%%*/
value_expr($1);
$$ = NEW_LIST($1, &@$);
- /*%
- $$ = arg_add(arg_new(), $1);
- %*/
+ /*% %*/
+ /*% ripper: args_add(args_new, $1) %*/
}
| args opt_block_arg
{
/*%%%*/
$$ = arg_blk_pass($1, $2);
- /*%
- $$ = arg_add_optblock($1, $2);
- %*/
+ /*% %*/
+ /*% ripper: _arg_add_optblock($1, $2) %*/
}
| assocs opt_block_arg
{
/*%%%*/
$$ = $1 ? NEW_LIST(new_hash(p, $1, &@1), &@1) : 0;
$$ = arg_blk_pass($$, $2);
- /*%
- $$ = arg_add_assocs(arg_new(), $1);
- $$ = arg_add_optblock($$, $2);
- %*/
+ /*% %*/
+ /*% ripper: _arg_add_optblock(args_add(args_new, bare_assoc_hash($1)), $2) %*/
}
| args ',' assocs opt_block_arg
{
/*%%%*/
$$ = $3 ? arg_append(p, $1, new_hash(p, $3, &@3), &@$) : $1;
$$ = arg_blk_pass($$, $4);
- /*%
- $$ = arg_add_optblock(arg_add_assocs($1, $3), $4);
- %*/
+ /*% %*/
+ /*% ripper: _arg_add_optblock(args_add($1, bare_assoc_hash($3)), $4) %*/
}
| block_arg
- /*%c%*/
- /*%c
- {
- $$ = arg_add_block(arg_new(), $1);
- }
- %*/
+ /*% ripper[brace]: args_add_block(args_new, $1) %*/
;
command_args : {
@@ -2234,9 +2126,8 @@ block_arg : tAMPER arg_value
{
/*%%%*/
$$ = NEW_BLOCK_PASS($2, &@$);
- /*%
- $$ = $2;
- %*/
+ /*% %*/
+ /*% ripper: $2 %*/
}
;
@@ -2254,33 +2145,29 @@ args : arg_value
{
/*%%%*/
$$ = NEW_LIST($1, &@$);
- /*%
- $$ = arg_add(arg_new(), $1);
- %*/
+ /*% %*/
+ /*% ripper: args_add(args_new, $1) %*/
}
| tSTAR arg_value
{
/*%%%*/
$$ = NEW_SPLAT($2, &@$);
- /*%
- $$ = arg_add_star(arg_new(), $2);
- %*/
+ /*% %*/
+ /*% ripper: args_add_star(args_new, $2) %*/
}
| args ',' arg_value
{
/*%%%*/
$$ = last_arg_append(p, $1, $3, &@$);
- /*%
- $$ = arg_add($1, $3);
- %*/
+ /*% %*/
+ /*% ripper: args_add($1, $3) %*/
}
| args ',' tSTAR arg_value
{
/*%%%*/
$$ = rest_arg_append(p, $1, $4, &@$);
- /*%
- $$ = arg_add_star($1, $4);
- %*/
+ /*% %*/
+ /*% ripper: args_add_star($1, $4) %*/
}
;
@@ -2292,25 +2179,22 @@ mrhs : args ',' arg_value
{
/*%%%*/
$$ = last_arg_append(p, $1, $3, &@$);
- /*%
- $$ = mrhs_add(args2mrhs($1), $3);
- %*/
+ /*% %*/
+ /*% ripper: mrhs_add(mrhs_new_from_args($1), $3) %*/
}
| args ',' tSTAR arg_value
{
/*%%%*/
$$ = rest_arg_append(p, $1, $4, &@$);
- /*%
- $$ = mrhs_add_star(args2mrhs($1), $4);
- %*/
+ /*% %*/
+ /*% ripper: mrhs_add_star(mrhs_new_from_args($1), $4) %*/
}
| tSTAR arg_value
{
/*%%%*/
$$ = NEW_SPLAT($2, &@$);
- /*%
- $$ = mrhs_add_star(mrhs_new(), $2);
- %*/
+ /*% %*/
+ /*% ripper: mrhs_add_star(mrhs_new, $2) %*/
}
;
@@ -2328,9 +2212,8 @@ primary : literal
{
/*%%%*/
$$ = NEW_FCALL($1, 0, &@$);
- /*%
- $$ = method_arg(dispatch1(fcall, $1), arg_new());
- %*/
+ /*% %*/
+ /*% ripper: method_add_arg(fcall($1), args_new) %*/
}
| k_begin
{
@@ -2345,17 +2228,15 @@ primary : literal
set_line_body($3, @1.end_pos.lineno);
$$ = NEW_BEGIN($3, &@$);
nd_set_line($$, @1.end_pos.lineno);
- /*%
- $$ = dispatch1(begin, $3);
- %*/
+ /*% %*/
+ /*% ripper: send(:begin, $3) %*/
}
| tLPAREN_ARG {SET_LEX_STATE(EXPR_ENDARG);} rparen
{
/*%%%*/
$$ = NEW_BEGIN(0, &@$);
- /*%
- $$ = dispatch1(paren, 0);
- %*/
+ /*% %*/
+ /*% ripper: paren(0) %*/
}
| tLPAREN_ARG
{
@@ -2367,82 +2248,72 @@ primary : literal
CMDARG_SET($<val>1);
/*%%%*/
$$ = $3;
- /*%
- $$ = dispatch1(paren, $3);
- %*/
+ /*% %*/
+ /*% ripper: paren($3) %*/
}
| tLPAREN compstmt ')'
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: paren($2) %*/
}
| primary_value tCOLON2 tCONSTANT
{
/*%%%*/
$$ = NEW_COLON2($1, $3, &@$);
- /*%
- $$ = dispatch2(const_path_ref, $1, $3);
- %*/
+ /*% %*/
+ /*% ripper: const_path_ref($1, $3) %*/
}
| tCOLON3 tCONSTANT
{
/*%%%*/
$$ = NEW_COLON3($2, &@$);
- /*%
- $$ = dispatch1(top_const_ref, $2);
- %*/
+ /*% %*/
+ /*% ripper: top_const_ref($2) %*/
}
| tLBRACK aref_args ']'
{
/*%%%*/
$$ = make_array($2, &@$);
- /*%
- $$ = dispatch1(array, escape_Qundef($2));
- %*/
+ /*% %*/
+ /*% ripper: array(_escape_Qundef($2)) %*/
}
| tLBRACE assoc_list '}'
{
/*%%%*/
$$ = new_hash(p, $2, &@$);
$$->nd_alen = TRUE;
- /*%
- $$ = dispatch1(hash, escape_Qundef($2));
- %*/
+ /*% %*/
+ /*% ripper: hash(_escape_Qundef($2)) %*/
}
| k_return
{
/*%%%*/
$$ = NEW_RETURN(0, &@$);
- /*%
- $$ = dispatch0(return0);
- %*/
+ /*% %*/
+ /*% ripper: return0 %*/
}
| keyword_yield '(' call_args rparen
{
/*%%%*/
$$ = new_yield(p, $3, &@$);
- /*%
- $$ = dispatch1(yield, dispatch1(paren, $3));
- %*/
+ /*% %*/
+ /*% ripper: send(:yield, paren($3)) %*/
}
| keyword_yield '(' rparen
{
/*%%%*/
$$ = NEW_YIELD(0, &@$);
- /*%
- $$ = dispatch1(yield, dispatch1(paren, arg_new()));
- %*/
+ /*% %*/
+ /*% ripper: send(:yield, paren(args_new)) %*/
}
| keyword_yield
{
/*%%%*/
$$ = NEW_YIELD(0, &@$);
- /*%
- $$ = dispatch0(yield0);
- %*/
+ /*% %*/
+ /*% ripper: yield0 %*/
}
| keyword_defined opt_nl '(' {p->in_defined = 1;} expr rparen
{
@@ -2461,10 +2332,8 @@ primary : literal
{
/*%%%*/
$$ = method_add_block(p, $1, $2, &@$);
- /*%
- $$ = method_arg(dispatch1(fcall, $1), arg_new());
- $$ = method_add_block(p, $$, $2, &@$);
- %*/
+ /*% %*/
+ /*% ripper: method_add_block(method_add_arg(fcall($1), args_new), $2) %*/
}
| method_call
| method_call brace_block
@@ -2472,9 +2341,8 @@ primary : literal
/*%%%*/
block_dup_check(p, $1->nd_args, $2);
$$ = method_add_block(p, $1, $2, &@$);
- /*%
- $$ = method_add_block(p, $1, $2, &@$);
- %*/
+ /*% %*/
+ /*% ripper: method_add_block($1, $2) %*/
}
| tLAMBDA
{
@@ -2492,9 +2360,8 @@ primary : literal
/*%%%*/
$$ = new_if(p, $2, $4, $5, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch3(if, $2, $4, escape_Qundef($5));
- %*/
+ /*% %*/
+ /*% ripper: send(:if, $2, $4, _escape_Qundef($5)) %*/
}
| k_unless expr_value then
compstmt
@@ -2504,9 +2371,8 @@ primary : literal
/*%%%*/
$$ = new_unless(p, $2, $4, $5, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch3(unless, $2, $4, escape_Qundef($5));
- %*/
+ /*% %*/
+ /*% ripper: send(:unless, $2, $4, _escape_Qundef($5)) %*/
}
| k_while expr_value_do
compstmt
@@ -2515,9 +2381,8 @@ primary : literal
/*%%%*/
$$ = NEW_WHILE(cond(p, $2, &@2), $3, 1, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch2(while, $2, $3);
- %*/
+ /*% %*/
+ /*% ripper: send(:while, $2, $3) %*/
}
| k_until expr_value_do
compstmt
@@ -2526,9 +2391,8 @@ primary : literal
/*%%%*/
$$ = NEW_UNTIL(cond(p, $2, &@2), $3, 1, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch2(until, $2, $3);
- %*/
+ /*% %*/
+ /*% ripper: send(:until, $2, $3) %*/
}
| k_case expr_value opt_terms
case_body
@@ -2537,17 +2401,15 @@ primary : literal
/*%%%*/
$$ = NEW_CASE($2, $4, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch2(case, $2, $4);
- %*/
+ /*% %*/
+ /*% ripper: send(:case, $2, $4) %*/
}
| k_case opt_terms case_body k_end
{
/*%%%*/
$$ = NEW_CASE2($3, &@$);
- /*%
- $$ = dispatch2(case, Qnil, $3);
- %*/
+ /*% %*/
+ /*% ripper: send(:case, "Qnil", $3) %*/
}
| k_for for_var keyword_in expr_value_do
compstmt
@@ -2590,9 +2452,8 @@ primary : literal
scope = NEW_NODE(NODE_SCOPE, tbl, $5, args, &@$);
$$ = NEW_FOR($4, scope, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch3(for, $2, $4, $5);
- %*/
+ /*% %*/
+ /*% ripper: send(:for, $2, $4, $5) %*/
}
| k_class cpath superclass
{
@@ -2612,9 +2473,8 @@ primary : literal
nd_set_line($$->nd_body, @6.end_pos.lineno);
set_line_body($5, @3.end_pos.lineno);
nd_set_line($$, @3.end_pos.lineno);
- /*%
- $$ = dispatch3(class, $2, $3, $5);
- %*/
+ /*% %*/
+ /*% ripper: send(:class, $2, $3, $5) %*/
local_pop(p);
p->in_class = $<num>1 & 1;
}
@@ -2634,9 +2494,8 @@ primary : literal
nd_set_line($$->nd_body, @7.end_pos.lineno);
set_line_body($6, nd_line($3));
fixpos($$, $3);
- /*%
- $$ = dispatch2(sclass, $3, $6);
- %*/
+ /*% %*/
+ /*% ripper: sclass($3, $6) %*/
local_pop(p);
p->in_def = $<num>4 & 1;
p->in_class = ($<num>4 >> 1) & 1;
@@ -2659,9 +2518,8 @@ primary : literal
nd_set_line($$->nd_body, @5.end_pos.lineno);
set_line_body($4, @2.end_pos.lineno);
nd_set_line($$, @2.end_pos.lineno);
- /*%
- $$ = dispatch2(module, $2, $4);
- %*/
+ /*% %*/
+ /*% ripper: send(:module, $2, $4) %*/
local_pop(p);
p->in_class = $<num>1 & 1;
}
@@ -2685,9 +2543,8 @@ primary : literal
$$ = NEW_DEFN($2, $5, body, &@$);
nd_set_line($$->nd_defn, @7.end_pos.lineno);
set_line_body(body, @1.beg_pos.lineno);
- /*%
- $$ = dispatch3(def, $2, $5, $6);
- %*/
+ /*% %*/
+ /*% ripper: send(:def, $2, $5, $6) %*/
local_pop(p);
p->in_def = $<num>4 & 1;
p->cur_arg = $<id>3;
@@ -2711,9 +2568,8 @@ primary : literal
$$ = NEW_DEFS($2, $5, $7, body, &@$);
nd_set_line($$->nd_defn, @9.end_pos.lineno);
set_line_body(body, @1.beg_pos.lineno);
- /*%
- $$ = dispatch5(defs, $2, $<val>3, $5, $7, $8);
- %*/
+ /*% %*/
+ /*% ripper: defs($2, "$<val>3", $5, $7, $8) %*/
local_pop(p);
p->in_def = $<num>4 & 1;
p->cur_arg = $<id>6;
@@ -2722,33 +2578,29 @@ primary : literal
{
/*%%%*/
$$ = NEW_BREAK(0, &@$);
- /*%
- $$ = dispatch1(break, arg_new());
- %*/
+ /*% %*/
+ /*% ripper: send(:break, args_new) %*/
}
| keyword_next
{
/*%%%*/
$$ = NEW_NEXT(0, &@$);
- /*%
- $$ = dispatch1(next, arg_new());
- %*/
+ /*% %*/
+ /*% ripper: send(:next, args_new) %*/
}
| keyword_redo
{
/*%%%*/
$$ = NEW_REDO(&@$);
- /*%
- $$ = dispatch0(redo);
- %*/
+ /*% %*/
+ /*% ripper: send(:redo) %*/
}
| keyword_retry
{
/*%%%*/
$$ = NEW_RETRY(&@$);
- /*%
- $$ = dispatch0(retry);
- %*/
+ /*% %*/
+ /*% ripper: send(:retry) %*/
}
;
@@ -2833,23 +2685,14 @@ k_return : keyword_return
;
then : term
- /*%c%*/
- /*%c
- { $$ = Qnil; }
- %*/
+ /*% ripper[brace]: "Qnil" %*/
| keyword_then
| term keyword_then
- /*%c%*/
- /*%c
- { $$ = $2; }
- %*/
+ /*% ripper[brace]: $2 %*/
;
do : term
- /*%c%*/
- /*%c
- { $$ = Qnil; }
- %*/
+ /*% ripper[brace]: "Qnil" %*/
| keyword_do_cond
;
@@ -2861,9 +2704,8 @@ if_tail : opt_else
/*%%%*/
$$ = new_if(p, $2, $4, $5, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch3(elsif, $2, $4, escape_Qundef($5));
- %*/
+ /*% %*/
+ /*% ripper: send(:elsif, $2, $4, _escape_Qundef($5)) %*/
}
;
@@ -2872,9 +2714,8 @@ opt_else : none
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(else, $2);
- %*/
+ /*% %*/
+ /*% ripper: send(:else, $2) %*/
}
;
@@ -2886,16 +2727,14 @@ f_marg : f_norm_arg
{
$$ = assignable(p, $1, 0, &@$);
/*%%%*/
- /*%
- %*/
+ /*% %*/
}
| tLPAREN f_margs rparen
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(mlhs_paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_paren($2) %*/
}
;
@@ -2903,17 +2742,15 @@ f_marg_list : f_marg
{
/*%%%*/
$$ = NEW_LIST($1, &@$);
- /*%
- $$ = mlhs_add(mlhs_new(), $1);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add(mlhs_new, $1) %*/
}
| f_marg_list ',' f_marg
{
/*%%%*/
$$ = list_append(p, $1, $3);
- /*%
- $$ = mlhs_add($1, $3);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add($1, $3) %*/
}
;
@@ -2921,81 +2758,68 @@ f_margs : f_marg_list
{
/*%%%*/
$$ = NEW_MASGN($1, 0, &@$);
- /*%
- $$ = $1;
- %*/
+ /*% %*/
+ /*% ripper: $1 %*/
}
| f_marg_list ',' tSTAR f_norm_arg
{
$$ = assignable(p, $4, 0, &@$);
/*%%%*/
$$ = NEW_MASGN($1, $$, &@$);
- /*%
- $$ = mlhs_add_star($1, $$);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_star($1, "$$") %*/
}
| f_marg_list ',' tSTAR f_norm_arg ',' f_marg_list
{
$$ = assignable(p, $4, 0, &@$);
/*%%%*/
$$ = NEW_MASGN($1, NEW_POSTARG($$, $6, &@$), &@$);
- /*%
- $$ = mlhs_add_star($1, $$);
- $$ = mlhs_add_post($$, $6);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_post(mlhs_add_star($1, "$$"), $6) %*/
}
| f_marg_list ',' tSTAR
{
/*%%%*/
$$ = NEW_MASGN($1, NODE_SPECIAL_NO_NAME_REST, &@$);
- /*%
- $$ = mlhs_add_star($1, Qnil);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_star($1, "Qnil") %*/
}
| f_marg_list ',' tSTAR ',' f_marg_list
{
/*%%%*/
$$ = NEW_MASGN($1, NEW_POSTARG(NODE_SPECIAL_NO_NAME_REST, $5, &@$), &@$);
- /*%
- $$ = mlhs_add_star($1, Qnil);
- $$ = mlhs_add_post($$, $5);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_post(mlhs_add_star($1, "Qnil"), $5) %*/
}
| tSTAR f_norm_arg
{
$$ = assignable(p, $2, 0, &@$);
/*%%%*/
$$ = NEW_MASGN(0, $$, &@$);
- /*%
- $$ = mlhs_add_star(mlhs_new(), $$);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_star(mlhs_new, "$$") %*/
}
| tSTAR f_norm_arg ',' f_marg_list
{
$$ = assignable(p, $2, 0, &@$);
/*%%%*/
$$ = NEW_MASGN(0, NEW_POSTARG($$, $4, &@$), &@$);
- /*%
- $$ = mlhs_add_star(mlhs_new(), $$);
- $$ = mlhs_add_post($$, $4);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_post(mlhs_add_star(mlhs_new, "$$"), $4) %*/
}
| tSTAR
{
/*%%%*/
$$ = NEW_MASGN(0, NODE_SPECIAL_NO_NAME_REST, &@$);
- /*%
- $$ = mlhs_add_star(mlhs_new(), Qnil);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_add_star(mlhs_new, "Qnil") %*/
}
| tSTAR ',' f_marg_list
{
/*%%%*/
$$ = 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) %*/
}
;
@@ -3051,10 +2875,7 @@ block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail
| f_arg ','
{
$$ = new_args(p, $1, Qnone, 1, Qnone, new_args_tail(p, Qnone, Qnone, Qnone, &@1), &@$);
- /*%%%*/
- /*%
- $$ = dispatch1(excessed_comma, $$);
- %*/
+ /*% ripper: excessed_comma("$$") %*/
}
| f_arg ',' f_rest_arg ',' f_arg opt_block_args_tail
{
@@ -3106,28 +2927,23 @@ block_param_def : '|' opt_bv_decl '|'
p->cur_arg = 0;
/*%%%*/
$$ = 0;
- /*%
- $$ = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil),
- escape_Qundef($2));
- %*/
+ /*% %*/
+ /*% ripper: block_var("params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil)", _escape_Qundef($2)) %*/
}
| tOROP
{
/*%%%*/
$$ = 0;
- /*%
- $$ = blockvar_new(params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil),
- Qnil);
- %*/
+ /*% %*/
+ /*% ripper: block_var("params_new(Qnil,Qnil,Qnil,Qnil,Qnil,Qnil,Qnil)", "Qnil") %*/
}
| '|' block_param opt_bv_decl '|'
{
p->cur_arg = 0;
/*%%%*/
$$ = $2;
- /*%
- $$ = blockvar_new(escape_Qundef($2), escape_Qundef($3));
- %*/
+ /*% %*/
+ /*% ripper: block_var(_escape_Qundef($2), _escape_Qundef($3)) %*/
}
;
@@ -3140,35 +2956,21 @@ opt_bv_decl : opt_nl
{
/*%%%*/
$$ = 0;
- /*%
- $$ = $3;
- %*/
+ /*% %*/
+ /*% ripper: $3 %*/
}
;
bv_decls : bvar
- /*%c%*/
- /*%c
- {
- $$ = rb_ary_new3(1, get_value($1));
- }
- %*/
+ /*% ripper[brace]: _rb_ary_new3(1, _get_value($1)) %*/
| bv_decls ',' bvar
- /*%c%*/
- /*%c
- {
- rb_ary_push($1, get_value($3));
- }
- %*/
+ /*% ripper[brace]: _rb_ary_push($1, _get_value($3)) %*/
;
bvar : tIDENTIFIER
{
new_bv(p, get_id($1));
- /*%%%*/
- /*%
- $$ = get_value($1);
- %*/
+ /*% ripper: _get_value($1) %*/
}
| f_bad_arg
{
@@ -3197,9 +2999,8 @@ lambda : {
$$ = NEW_LAMBDA($3, $5, &@$);
nd_set_line($$->nd_body, @5.end_pos.lineno);
nd_set_line($$, @3.end_pos.lineno);
- /*%
- $$ = dispatch2(lambda, $3, $5);
- %*/
+ /*% %*/
+ /*% ripper: send(:lambda, $3, $5) %*/
dyna_pop(p, $<vars>1);
}
;
@@ -3208,9 +3009,8 @@ f_larglist : '(' f_args opt_bv_decl ')'
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: paren($2) %*/
}
| f_args
{
@@ -3250,9 +3050,8 @@ block_call : command do_block
}
$$ = method_add_block(p, $1, $2, &@$);
fixpos($$, $1);
- /*%
- $$ = method_add_block(p, $1, $2, &@$);
- %*/
+ /*% %*/
+ /*% ripper: method_add_block($1, $2) %*/
}
| block_call call_op2 operation2 opt_paren_args
{
@@ -3274,9 +3073,8 @@ method_call : fcall paren_args
$$ = $1;
$$->nd_args = $2;
nd_set_last_loc($1, @2.end_pos);
- /*%
- $$ = method_arg(dispatch1(fcall, $1), $2);
- %*/
+ /*% %*/
+ /*% ripper: method_add_arg(fcall($1), $2) %*/
}
| primary_value call_op operation2 opt_paren_args
{
@@ -3306,17 +3104,15 @@ method_call : fcall paren_args
{
/*%%%*/
$$ = NEW_SUPER($2, &@$);
- /*%
- $$ = dispatch1(super, $2);
- %*/
+ /*% %*/
+ /*% ripper: send(:super, $2) %*/
}
| keyword_super
{
/*%%%*/
$$ = NEW_ZSUPER(&@$);
- /*%
- $$ = dispatch0(zsuper);
- %*/
+ /*% %*/
+ /*% ripper: zsuper %*/
}
| primary_value '[' opt_call_args rbracket
{
@@ -3326,9 +3122,8 @@ method_call : fcall paren_args
else
$$ = NEW_CALL($1, tAREF, $3, &@$);
fixpos($$, $1);
- /*%
- $$ = dispatch2(aref, $1, escape_Qundef($3));
- %*/
+ /*% %*/
+ /*% ripper: aref($1, _escape_Qundef($3)) %*/
}
;
@@ -3377,9 +3172,8 @@ case_body : keyword_when args then
/*%%%*/
$$ = NEW_WHEN($2, $4, $5, &@$);
fixpos($$, $2);
- /*%
- $$ = dispatch3(when, $2, $4, escape_Qundef($5));
- %*/
+ /*% %*/
+ /*% ripper: send(:when, $2, $4, _escape_Qundef($5)) %*/
}
;
@@ -3398,13 +3192,8 @@ opt_rescue : keyword_rescue exc_list exc_var then
}
$$ = NEW_RESBODY($2, $5, $6, &@$);
fixpos($$, $2?$2:$5);
- /*%
- $$ = dispatch4(rescue,
- escape_Qundef($2),
- escape_Qundef($3),
- escape_Qundef($5),
- escape_Qundef($6));
- %*/
+ /*% %*/
+ /*% ripper: send(:rescue, _escape_Qundef($2), _escape_Qundef($3), _escape_Qundef($5), _escape_Qundef($6)) %*/
}
| none
;
@@ -3413,17 +3202,15 @@ exc_list : arg_value
{
/*%%%*/
$$ = NEW_LIST($1, &@$);
- /*%
- $$ = rb_ary_new3(1, get_value($1));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_new3(1, _get_value($1)) %*/
}
| mrhs
{
/*%%%*/
if (!($$ = splat_array($1))) $$ = $1;
- /*%
- $$ = $1;
- %*/
+ /*% %*/
+ /*% ripper: $1 %*/
}
| none
;
@@ -3439,9 +3226,8 @@ opt_ensure : keyword_ensure compstmt
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(ensure, $2);
- %*/
+ /*% %*/
+ /*% ripper: send(:ensure, $2) %*/
}
| none
;
@@ -3451,9 +3237,8 @@ literal : numeric
{
/*%%%*/
$$ = NEW_LIT(ID2SYM($1), &@$);
- /*%
- $$ = dispatch1(symbol_literal, $1);
- %*/
+ /*% %*/
+ /*% ripper: symbol_literal($1) %*/
}
| dsym
;
@@ -3469,9 +3254,8 @@ strings : string
node = evstr2dstr(p, node);
}
$$ = node;
- /*%
- $$ = $1;
- %*/
+ /*% %*/
+ /*% ripper: $1 %*/
}
;
@@ -3481,9 +3265,8 @@ string : tCHAR
{
/*%%%*/
$$ = literal_concat(p, $1, $2, &@$);
- /*%
- $$ = dispatch2(string_concat, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: string_concat($1, $2) %*/
}
;
@@ -3492,8 +3275,7 @@ string1 : tSTRING_BEG string_contents tSTRING_END
$$ = new_string1(heredoc_dedent(p, $2));
/*%%%*/
if ($$) nd_set_loc($$, &@$);
- /*%
- %*/
+ /*% %*/
}
;
@@ -3513,9 +3295,8 @@ words : tWORDS_BEG ' ' word_list tSTRING_END
{
/*%%%*/
$$ = make_array($3, &@$);
- /*%
- $$ = dispatch1(array, $3);
- %*/
+ /*% %*/
+ /*% ripper: array($3) %*/
}
;
@@ -3523,35 +3304,26 @@ word_list : /* none */
{
/*%%%*/
$$ = 0;
- /*%
- $$ = dispatch0(words_new);
- %*/
+ /*% %*/
+ /*% ripper: words_new %*/
}
| word_list word ' '
{
/*%%%*/
$$ = list_append(p, $1, evstr2dstr(p, $2));
- /*%
- $$ = dispatch2(words_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: words_add($1, $2) %*/
}
;
word : string_content
- /*%c%*/
- /*%c
- {
- $$ = dispatch0(word_new);
- $$ = dispatch2(word_add, $$, $1);
- }
- %*/
+ /*% ripper[brace]: word_add(word_new, $1) %*/
| word string_content
{
/*%%%*/
$$ = literal_concat(p, $1, $2, &@$);
- /*%
- $$ = dispatch2(word_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: word_add($1, $2) %*/
}
;
@@ -3559,9 +3331,8 @@ symbols : tSYMBOLS_BEG ' ' symbol_list tSTRING_END
{
/*%%%*/
$$ = make_array($3, &@$);
- /*%
- $$ = dispatch1(array, $3);
- %*/
+ /*% %*/
+ /*% ripper: array($3) %*/
}
;
@@ -3569,17 +3340,15 @@ symbol_list : /* none */
{
/*%%%*/
$$ = 0;
- /*%
- $$ = dispatch0(symbols_new);
- %*/
+ /*% %*/
+ /*% ripper: symbols_new %*/
}
| symbol_list word ' '
{
/*%%%*/
$$ = symbol_append(p, $1, evstr2dstr(p, $2));
- /*%
- $$ = dispatch2(symbols_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: symbols_add($1, $2) %*/
}
;
@@ -3587,9 +3356,8 @@ qwords : tQWORDS_BEG ' ' qword_list tSTRING_END
{
/*%%%*/
$$ = make_array($3, &@$);
- /*%
- $$ = dispatch1(array, $3);
- %*/
+ /*% %*/
+ /*% ripper: array($3) %*/
}
;
@@ -3597,9 +3365,8 @@ qsymbols : tQSYMBOLS_BEG ' ' qsym_list tSTRING_END
{
/*%%%*/
$$ = make_array($3, &@$);
- /*%
- $$ = dispatch1(array, $3);
- %*/
+ /*% %*/
+ /*% ripper: array($3) %*/
}
;
@@ -3607,17 +3374,15 @@ qword_list : /* none */
{
/*%%%*/
$$ = 0;
- /*%
- $$ = dispatch0(qwords_new);
- %*/
+ /*% %*/
+ /*% ripper: qwords_new %*/
}
| qword_list tSTRING_CONTENT ' '
{
/*%%%*/
$$ = list_append(p, $1, $2);
- /*%
- $$ = dispatch2(qwords_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: qwords_add($1, $2) %*/
}
;
@@ -3625,17 +3390,15 @@ qsym_list : /* none */
{
/*%%%*/
$$ = 0;
- /*%
- $$ = dispatch0(qsymbols_new);
- %*/
+ /*% %*/
+ /*% ripper: qsymbols_new %*/
}
| qsym_list tSTRING_CONTENT ' '
{
/*%%%*/
$$ = symbol_append(p, $1, $2);
- /*%
- $$ = dispatch2(qsymbols_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: qsymbols_add($1, $2) %*/
}
;
@@ -3643,17 +3406,15 @@ string_contents : /* none */
{
/*%%%*/
$$ = 0;
- /*%
- $$ = dispatch0(string_content);
- %*/
+ /*% %*/
+ /*% ripper: string_content %*/
}
| string_contents string_content
{
/*%%%*/
$$ = literal_concat(p, $1, $2, &@$);
- /*%
- $$ = dispatch2(string_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: string_add($1, $2) %*/
}
;
@@ -3661,17 +3422,15 @@ xstring_contents: /* none */
{
/*%%%*/
$$ = 0;
- /*%
- $$ = dispatch0(xstring_new);
- %*/
+ /*% %*/
+ /*% ripper: xstring_new %*/
}
| xstring_contents string_content
{
/*%%%*/
$$ = literal_concat(p, $1, $2, &@$);
- /*%
- $$ = dispatch2(xstring_add, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: xstring_add($1, $2) %*/
}
;
@@ -3679,8 +3438,11 @@ regexp_contents: /* none */
{
/*%%%*/
$$ = 0;
+ /*% %*/
+ /*% ripper: regexp_new %*/
+ /*%%%*/
/*%
- $$ = ripper_new_yylval(p, 0, dispatch0(regexp_new), 0);
+ $$ = ripper_new_yylval(p, 0, $$, 0);
%*/
}
| regexp_contents string_content
@@ -3738,9 +3500,8 @@ string_content : tSTRING_CONTENT
/*%%%*/
$$ = NEW_EVSTR($3, &@$);
nd_set_line($$, @3.end_pos.lineno);
- /*%
- $$ = dispatch1(string_dvar, $3);
- %*/
+ /*% %*/
+ /*% ripper: string_dvar($3) %*/
}
| tSTRING_DBEG
{
@@ -3778,9 +3539,8 @@ string_content : tSTRING_CONTENT
/*%%%*/
if ($7) $7->flags &= ~NODE_FL_NEWLINE;
$$ = new_evstr(p, $7, &@$);
- /*%
- $$ = dispatch1(string_embexpr, $7);
- %*/
+ /*% %*/
+ /*% ripper: string_embexpr($7) %*/
}
;
@@ -3788,25 +3548,22 @@ string_dvar : tGVAR
{
/*%%%*/
$$ = NEW_GVAR($1, &@$);
- /*%
- $$ = dispatch1(var_ref, $1);
- %*/
+ /*% %*/
+ /*% ripper: var_ref($1) %*/
}
| tIVAR
{
/*%%%*/
$$ = NEW_IVAR($1, &@$);
- /*%
- $$ = dispatch1(var_ref, $1);
- %*/
+ /*% %*/
+ /*% ripper: var_ref($1) %*/
}
| tCVAR
{
/*%%%*/
$$ = NEW_CVAR($1, &@$);
- /*%
- $$ = dispatch1(var_ref, $1);
- %*/
+ /*% %*/
+ /*% ripper: var_ref($1) %*/
}
| backref
;
@@ -3816,9 +3573,8 @@ symbol : tSYMBEG sym
SET_LEX_STATE(EXPR_END|EXPR_ENDARG);
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(symbol, $2);
- %*/
+ /*% %*/
+ /*% ripper: symbol($2) %*/
}
;
@@ -3833,9 +3589,8 @@ dsym : tSYMBEG xstring_contents tSTRING_END
SET_LEX_STATE(EXPR_END|EXPR_ENDARG);
/*%%%*/
$$ = dsym_node(p, $2, &@$);
- /*%
- $$ = dispatch1(dyna_symbol, $2);
- %*/
+ /*% %*/
+ /*% ripper: dyna_symbol($2) %*/
}
;
@@ -3845,9 +3600,8 @@ numeric : simple_numeric
/*%%%*/
$$ = $2;
add_mark_object(p, $$->nd_lit = negate_lit(p, $$->nd_lit));
- /*%
- $$ = dispatch2(unary, ID2VAL(idUMinus), $2);
- %*/
+ /*% %*/
+ /*% ripper: unary("ID2VAL(idUMinus)", $2) %*/
}
;
@@ -3890,9 +3644,8 @@ var_ref : user_variable
{
/*%%%*/
if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);
- /*%
- $$ = dispatch1(var_ref, $1);
- %*/
+ /*% %*/
+ /*% ripper: var_ref($1) %*/
}
;
@@ -3923,9 +3676,8 @@ superclass : '<'
{
/*%%%*/
$$ = 0;
- /*%
- $$ = Qnil;
- %*/
+ /*% %*/
+ /*% ripper: "Qnil" %*/
}
;
@@ -3933,9 +3685,8 @@ f_arglist : '(' f_args rparen
{
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: paren($2) %*/
SET_LEX_STATE(EXPR_BEG);
p->command_start = TRUE;
}
@@ -4049,40 +3800,32 @@ f_bad_arg : tCONSTANT
/*%%%*/
yyerror1(&@1, "formal argument cannot be a constant");
$$ = 0;
- /*%
- $$ = dispatch1(param_error, $1);
- ripper_error(p);
- %*/
+ /*% %*/
+ /*% ripper[error]: param_error($1) %*/
}
| tIVAR
{
/*%%%*/
yyerror1(&@1, "formal argument cannot be an instance variable");
$$ = 0;
- /*%
- $$ = dispatch1(param_error, $1);
- ripper_error(p);
- %*/
+ /*% %*/
+ /*% ripper[error]: param_error($1) %*/
}
| tGVAR
{
/*%%%*/
yyerror1(&@1, "formal argument cannot be a global variable");
$$ = 0;
- /*%
- $$ = dispatch1(param_error, $1);
- ripper_error(p);
- %*/
+ /*% %*/
+ /*% ripper[error]: param_error($1) %*/
}
| tCVAR
{
/*%%%*/
yyerror1(&@1, "formal argument cannot be a class variable");
$$ = 0;
- /*%
- $$ = dispatch1(param_error, $1);
- ripper_error(p);
- %*/
+ /*% %*/
+ /*% ripper[error]: param_error($1) %*/
}
;
@@ -4108,9 +3851,8 @@ f_arg_item : f_arg_asgn
p->cur_arg = 0;
/*%%%*/
$$ = NEW_ARGS_AUX($1, 1, &NULL_LOC);
- /*%
- $$ = get_value($1);
- %*/
+ /*% %*/
+ /*% ripper: _get_value($1) %*/
}
| tLPAREN f_margs rparen
{
@@ -4119,8 +3861,7 @@ f_arg_item : f_arg_asgn
YYLTYPE loc;
loc.beg_pos = @2.beg_pos;
loc.end_pos = @2.beg_pos;
- /*%
- %*/
+ /*% %*/
arg_var(p, tid);
/*%%%*/
if (dyna_in_block(p)) {
@@ -4131,19 +3872,13 @@ f_arg_item : f_arg_asgn
}
$$ = NEW_ARGS_AUX(tid, 1, &NULL_LOC);
$$->nd_next = $2;
- /*%
- $$ = dispatch1(mlhs_paren, $2);
- %*/
+ /*% %*/
+ /*% ripper: mlhs_paren($2) %*/
}
;
f_arg : f_arg_item
- /*%c%*/
- /*%c
- {
- $$ = rb_ary_new3(1, get_value($1));
- }
- c%*/
+ /*% ripper[brace]: _rb_ary_new3(1, _get_value($1)) %*/
| f_arg ',' f_arg_item
{
/*%%%*/
@@ -4151,9 +3886,8 @@ f_arg : f_arg_item
$$->nd_plen++;
$$->nd_next = block_append(p, $$->nd_next, $3->nd_next);
rb_discard_node(p, $3);
- /*%
- $$ = rb_ary_push($1, get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_push($1, _get_value($3)) %*/
}
;
@@ -4173,9 +3907,8 @@ f_kw : f_label arg_value
$$ = assignable(p, $1, $2, &@$);
/*%%%*/
$$ = new_kw_arg(p, $$, &@$);
- /*%
- $$ = rb_assoc_new(get_value($$), get_value($2));
- %*/
+ /*% %*/
+ /*% ripper: _rb_assoc_new(_get_value("$$"), _get_value($2)) %*/
}
| f_label
{
@@ -4183,9 +3916,8 @@ f_kw : f_label arg_value
$$ = assignable(p, $1, REQUIRED_KEYWORD, &@$);
/*%%%*/
$$ = new_kw_arg(p, $$, &@$);
- /*%
- $$ = rb_assoc_new(get_value($$), 0);
- %*/
+ /*% %*/
+ /*% ripper: _rb_assoc_new(_get_value("$$"), 0) %*/
}
;
@@ -4194,18 +3926,16 @@ f_block_kw : f_label primary_value
$$ = assignable(p, $1, $2, &@$);
/*%%%*/
$$ = new_kw_arg(p, $$, &@$);
- /*%
- $$ = rb_assoc_new(get_value($$), get_value($2));
- %*/
+ /*% %*/
+ /*% ripper: _rb_assoc_new(_get_value("$$"), _get_value($2)) %*/
}
| f_label
{
$$ = assignable(p, $1, REQUIRED_KEYWORD, &@$);
/*%%%*/
$$ = new_kw_arg(p, $$, &@$);
- /*%
- $$ = rb_assoc_new(get_value($$), 0);
- %*/
+ /*% %*/
+ /*% ripper: _rb_assoc_new(_get_value("$$"), 0) %*/
}
;
@@ -4213,17 +3943,15 @@ f_block_kwarg : f_block_kw
{
/*%%%*/
$$ = $1;
- /*%
- $$ = rb_ary_new3(1, get_value($1));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_new3(1, _get_value($1)) %*/
}
| f_block_kwarg ',' f_block_kw
{
/*%%%*/
$$ = kwd_append($1, $3);
- /*%
- $$ = rb_ary_push($1, get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_push($1, _get_value($3)) %*/
}
;
@@ -4232,17 +3960,15 @@ f_kwarg : f_kw
{
/*%%%*/
$$ = $1;
- /*%
- $$ = rb_ary_new3(1, get_value($1));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_new3(1, _get_value($1)) %*/
}
| f_kwarg ',' f_kw
{
/*%%%*/
$$ = kwd_append($1, $3);
- /*%
- $$ = rb_ary_push($1, get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_push($1, _get_value($3)) %*/
}
;
@@ -4255,18 +3981,16 @@ f_kwrest : kwrest_mark tIDENTIFIER
shadowing_lvar(p, get_id($2));
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(kwrest_param, $2);
- %*/
+ /*% %*/
+ /*% ripper: kwrest_param($2) %*/
}
| kwrest_mark
{
/*%%%*/
$$ = internal_id(p);
arg_var(p, $$);
- /*%
- $$ = dispatch1(kwrest_param, Qnil);
- %*/
+ /*% %*/
+ /*% ripper: kwrest_param("Qnil") %*/
}
;
@@ -4276,9 +4000,8 @@ f_opt : f_arg_asgn '=' arg_value
$$ = assignable(p, $1, $3, &@$);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$, &@$);
- /*%
- $$ = rb_assoc_new(get_value($$), get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_assoc_new(_get_value("$$"), _get_value($3)) %*/
}
;
@@ -4288,9 +4011,8 @@ f_block_opt : f_arg_asgn '=' primary_value
$$ = assignable(p, $1, $3, &@$);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$, &@$);
- /*%
- $$ = rb_assoc_new(get_value($$), get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_assoc_new(_get_value("$$"), _get_value($3)) %*/
}
;
@@ -4298,17 +4020,15 @@ f_block_optarg : f_block_opt
{
/*%%%*/
$$ = $1;
- /*%
- $$ = rb_ary_new3(1, get_value($1));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_new3(1, _get_value($1)) %*/
}
| f_block_optarg ',' f_block_opt
{
/*%%%*/
$$ = opt_arg_append($1, $3);
- /*%
- $$ = rb_ary_push($1, get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_push($1, _get_value($3)) %*/
}
;
@@ -4316,17 +4036,15 @@ f_optarg : f_opt
{
/*%%%*/
$$ = $1;
- /*%
- $$ = rb_ary_new3(1, get_value($1));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_new3(1, _get_value($1)) %*/
}
| f_optarg ',' f_opt
{
/*%%%*/
$$ = opt_arg_append($1, $3);
- /*%
- $$ = rb_ary_push($1, get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_push($1, _get_value($3)) %*/
}
;
@@ -4339,18 +4057,16 @@ f_rest_arg : restarg_mark tIDENTIFIER
arg_var(p, shadowing_lvar(p, get_id($2)));
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(rest_param, $2);
- %*/
+ /*% %*/
+ /*% ripper: rest_param($2) %*/
}
| restarg_mark
{
/*%%%*/
$$ = internal_id(p);
arg_var(p, $$);
- /*%
- $$ = dispatch1(rest_param, Qnil);
- %*/
+ /*% %*/
+ /*% ripper: rest_param("Qnil") %*/
}
;
@@ -4363,9 +4079,8 @@ f_block_arg : blkarg_mark tIDENTIFIER
arg_var(p, shadowing_lvar(p, get_id($2)));
/*%%%*/
$$ = $2;
- /*%
- $$ = dispatch1(blockarg, $2);
- %*/
+ /*% %*/
+ /*% ripper: blockarg($2) %*/
}
;
@@ -4377,9 +4092,8 @@ opt_f_block_arg : ',' f_block_arg
{
/*%%%*/
$$ = 0;
- /*%
- $$ = Qundef;
- %*/
+ /*% %*/
+ /*% ripper: "Qundef" %*/
}
;
@@ -4407,9 +4121,8 @@ singleton : var_ref
break;
}
$$ = $3;
- /*%
- $$ = dispatch1(paren, $3);
- %*/
+ /*% %*/
+ /*% ripper: paren($3) %*/
}
;
@@ -4418,19 +4131,13 @@ assoc_list : none
{
/*%%%*/
$$ = $1;
- /*%
- $$ = dispatch1(assoclist_from_args, $1);
- %*/
+ /*% %*/
+ /*% ripper: assoclist_from_args($1) %*/
}
;
assocs : assoc
- /*%c%*/
- /*%c
- {
- $$ = rb_ary_new3(1, get_value($1));
- }
- %*/
+ /*% ripper[brace]: _rb_ary_new3(1, _get_value($1)) %*/
| assocs ',' assoc
{
/*%%%*/
@@ -4449,9 +4156,8 @@ assocs : assoc
assocs = list_concat(assocs, tail);
}
$$ = assocs;
- /*%
- $$ = rb_ary_push($1, get_value($3));
- %*/
+ /*% %*/
+ /*% ripper: _rb_ary_push($1, _get_value($3)) %*/
}
;
@@ -4463,26 +4169,23 @@ assoc : arg_value tASSOC arg_value
add_mark_object(p, $1->nd_lit = rb_fstring($1->nd_lit));
}
$$ = list_append(p, NEW_LIST($1, &@$), $3);
- /*%
- $$ = dispatch2(assoc_new, $1, $3);
- %*/
+ /*% %*/
+ /*% ripper: assoc_new($1, $3) %*/
}
| tLABEL arg_value
{
/*%%%*/
$$ = list_append(p, NEW_LIST(NEW_LIT(ID2SYM($1), &@1), &@$), $2);
- /*%
- $$ = dispatch2(assoc_new, $1, $2);
- %*/
+ /*% %*/
+ /*% ripper: assoc_new($1, $2) %*/
}
| tSTRING_BEG string_contents tLABEL_END arg_value
{
/*%%%*/
YYLTYPE loc = code_loc_gen(&@1, &@3);
$$ = list_append(p, NEW_LIST(dsym_node(p, $2, &loc), &loc), $4);
- /*%
- $$ = dispatch2(assoc_new, dispatch1(dyna_symbol, $2), $4);
- %*/
+ /*% %*/
+ /*% ripper: assoc_new(dyna_symbol($2), $4) %*/
}
| tDSTAR arg_value
{
@@ -4492,9 +4195,8 @@ assoc : arg_value tASSOC arg_value
$$ = 0;
else
$$ = list_append(p, NEW_LIST(0, &@$), $2);
- /*%
- $$ = dispatch1(assoc_splat, $2);
- %*/
+ /*% %*/
+ /*% ripper: assoc_splat($2) %*/
}
;