rubinius-melbourne 2.1.0.0 → 2.2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/ext/rubinius/melbourne/extconf.rb +4 -13
- data/ext/rubinius/melbourne/grammar.cpp +4788 -4044
- data/ext/rubinius/melbourne/grammar.y +919 -485
- data/ext/rubinius/melbourne/melbourne.cpp +3 -8
- data/ext/rubinius/melbourne/node.hpp +25 -1
- data/ext/rubinius/melbourne/node_types.cpp +74 -66
- data/ext/rubinius/melbourne/node_types.hpp +5 -1
- data/ext/rubinius/melbourne/node_types.rb +5 -0
- data/ext/rubinius/melbourne/parser_state.hpp +40 -15
- data/ext/rubinius/melbourne/symbols.cpp +6 -0
- data/ext/rubinius/melbourne/symbols.hpp +3 -0
- data/ext/rubinius/melbourne/visitor.cpp +75 -52
- data/lib/rubinius/melbourne/version.rb +2 -2
- data/lib/rubinius/melbourne.rb +2 -2
- data/rubinius-melbourne.gemspec +1 -4
- data/spec/array_spec.rb +20 -0
- data/spec/custom/matchers/parse_as.rb +2 -1
- data/spec/defn_spec.rb +556 -265
- data/spec/defs_spec.rb +63 -40
- data/spec/dstr_spec.rb +1 -2
- data/spec/ensure_spec.rb +12 -8
- data/spec/flip2_spec.rb +38 -2
- data/spec/hash_spec.rb +47 -0
- data/spec/iter_spec.rb +371 -244
- data/spec/lambda_spec.rb +107 -0
- data/spec/lit_spec.rb +16 -0
- data/spec/masgn_spec.rb +97 -301
- data/spec/rescue_spec.rb +12 -6
- data/spec/spec_helper.rb +6 -7
- data/spec/while_spec.rb +9 -6
- metadata +4 -16
@@ -56,8 +56,10 @@ namespace MELBOURNE {
|
|
56
56
|
extern ID rb_sHash;
|
57
57
|
extern ID rb_sIAsgn;
|
58
58
|
extern ID rb_sIf;
|
59
|
+
extern ID rb_sImaginary;
|
59
60
|
extern ID rb_sIter;
|
60
61
|
extern ID rb_sIVar;
|
62
|
+
extern ID rb_sKwArg;
|
61
63
|
extern ID rb_sLAsgn;
|
62
64
|
extern ID rb_sLambda;
|
63
65
|
extern ID rb_sLit;
|
@@ -82,6 +84,7 @@ namespace MELBOURNE {
|
|
82
84
|
extern ID rb_sPostExe;
|
83
85
|
extern ID rb_sPostArg;
|
84
86
|
extern ID rb_sPreExe;
|
87
|
+
extern ID rb_sRational;
|
85
88
|
extern ID rb_sRedo;
|
86
89
|
extern ID rb_sRegex;
|
87
90
|
extern ID rb_sResbody;
|
@@ -577,13 +577,14 @@ namespace MELBOURNE {
|
|
577
577
|
|
578
578
|
node = node->nd_head;
|
579
579
|
while (node) {
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
580
|
+
if(node->nd_head) {
|
581
|
+
rb_ary_push(array, process_parse_tree(parser_state, ptp, node->nd_head, locals));
|
582
|
+
if (!(node = node->nd_next)) break;
|
583
|
+
rb_ary_push(array, process_parse_tree(parser_state, ptp, node->nd_head, locals));
|
584
|
+
} else {
|
585
|
+
// Marker for Hash splat.
|
586
|
+
rb_ary_push(array, Qnil);
|
585
587
|
}
|
586
|
-
rb_ary_push(array, process_parse_tree(parser_state, ptp, node->nd_head, locals));
|
587
588
|
node = node->nd_next;
|
588
589
|
}
|
589
590
|
tree = rb_funcall(ptp, rb_sHash, 2, line, array);
|
@@ -693,61 +694,55 @@ namespace MELBOURNE {
|
|
693
694
|
tree = rb_funcall(ptp, rb_sOptArg, 2, line, args);
|
694
695
|
break;
|
695
696
|
}
|
697
|
+
case NODE_KW_ARG: {
|
698
|
+
VALUE args = rb_ary_new();
|
699
|
+
|
700
|
+
do {
|
701
|
+
rb_ary_push(args, process_parse_tree(parser_state, ptp, node->nd_body, locals));
|
702
|
+
node = node->nd_next;
|
703
|
+
} while(node);
|
704
|
+
|
705
|
+
tree = rb_funcall(ptp, rb_sKwArg, 2, line, args);
|
706
|
+
break;
|
707
|
+
}
|
696
708
|
case NODE_ARGS: {
|
697
709
|
VALUE args = Qnil;
|
698
710
|
VALUE opts = Qnil;
|
699
711
|
VALUE splat = Qnil;
|
700
712
|
VALUE post = Qnil;
|
713
|
+
VALUE kwargs = Qnil;
|
714
|
+
VALUE kwrest = Qnil;
|
701
715
|
VALUE block = Qnil;
|
702
716
|
|
703
717
|
int total_args = 0;
|
704
718
|
ID* args_ary = 0;
|
705
719
|
|
706
|
-
|
707
|
-
NODE* post_args = aux->nd_next;
|
720
|
+
struct rb_args_info *ainfo = node->nd_ainfo;
|
708
721
|
NODE* masgn = 0;
|
709
722
|
NODE* next = 0;
|
710
723
|
|
711
|
-
if(
|
712
|
-
if(post_args->nd_next->nd_head) {
|
713
|
-
if (nd_type(post_args->nd_next->nd_head) == NODE_BLOCK) {
|
714
|
-
masgn = post_args->nd_next->nd_head->nd_head;
|
715
|
-
next = post_args->nd_next->nd_head->nd_next;
|
716
|
-
} else {
|
717
|
-
masgn = post_args->nd_next->nd_head;
|
718
|
-
next = masgn->nd_next;
|
719
|
-
// -1 comes from: mlhs_head tSTAR
|
720
|
-
if(masgn->nd_cnt == -1) next = 0;
|
721
|
-
}
|
722
|
-
} else {
|
723
|
-
masgn = post_args->nd_next->nd_2nd;
|
724
|
-
if(masgn) {
|
725
|
-
next = masgn->nd_next;
|
726
|
-
if (nd_type(masgn) == NODE_BLOCK) {
|
727
|
-
masgn = masgn->nd_head;
|
728
|
-
}
|
729
|
-
}
|
730
|
-
}
|
731
|
-
}
|
732
|
-
|
733
|
-
if(node->nd_argc > 0) {
|
724
|
+
if(ainfo->pre_args_num > 0) {
|
734
725
|
total_args = (int)locals[0];
|
735
726
|
args_ary = locals + 1;
|
736
727
|
|
728
|
+
masgn = ainfo->pre_init;
|
729
|
+
if(masgn && nd_type(masgn) == NODE_BLOCK) {
|
730
|
+
next = masgn->nd_next;
|
731
|
+
masgn = masgn->nd_head;
|
732
|
+
}
|
733
|
+
|
737
734
|
args = rb_ary_new();
|
738
|
-
for(int i = 0; i <
|
735
|
+
for(int i = 0; i < ainfo->pre_args_num && i < total_args; i++) {
|
739
736
|
VALUE arg = Qnil;
|
740
737
|
|
741
738
|
if(!INTERNAL_ID_P(args_ary[i])) {
|
742
739
|
arg = ID2SYM(args_ary[i]);
|
743
740
|
} else if(masgn) {
|
744
741
|
arg = process_parse_tree(parser_state, ptp, masgn, locals);
|
745
|
-
|
742
|
+
|
743
|
+
if(next) {
|
746
744
|
masgn = next->nd_head;
|
747
745
|
next = next->nd_next;
|
748
|
-
} else {
|
749
|
-
masgn = next;
|
750
|
-
if(masgn) next = masgn->nd_next;
|
751
746
|
}
|
752
747
|
}
|
753
748
|
|
@@ -755,53 +750,73 @@ namespace MELBOURNE {
|
|
755
750
|
}
|
756
751
|
}
|
757
752
|
|
758
|
-
if(
|
759
|
-
opts = process_parse_tree(parser_state, ptp,
|
753
|
+
if(ainfo->opt_args) {
|
754
|
+
opts = process_parse_tree(parser_state, ptp, ainfo->opt_args, locals);
|
755
|
+
}
|
756
|
+
|
757
|
+
if(ainfo->kw_args) {
|
758
|
+
kwargs = process_parse_tree(parser_state, ptp, ainfo->kw_args, locals);
|
760
759
|
}
|
761
760
|
|
762
|
-
if(
|
763
|
-
|
764
|
-
|
765
|
-
if(
|
761
|
+
if(ainfo->rest_arg) {
|
762
|
+
if(INTERNAL_ID_P(ainfo->rest_arg)) {
|
763
|
+
splat = Qtrue;
|
764
|
+
} else if(ainfo->rest_arg == 1) {
|
766
765
|
// m { |a,| ... }
|
767
766
|
splat = Qfalse;
|
768
767
|
} else {
|
769
|
-
splat = ID2SYM(
|
768
|
+
splat = ID2SYM(ainfo->rest_arg);
|
769
|
+
}
|
770
|
+
}
|
771
|
+
|
772
|
+
if(ainfo->kw_rest_arg) {
|
773
|
+
if(INTERNAL_ID_P(ainfo->kw_rest_arg->nd_vid)) {
|
774
|
+
kwrest = Qtrue;
|
775
|
+
} else {
|
776
|
+
kwrest = ID2SYM(ainfo->kw_rest_arg->nd_vid);
|
770
777
|
}
|
771
778
|
}
|
772
|
-
if(aux->nd_mid) block = ID2SYM(aux->nd_mid);
|
773
779
|
|
774
|
-
if(
|
780
|
+
if(ainfo->block_arg) block = ID2SYM(ainfo->block_arg);
|
781
|
+
|
782
|
+
if(ainfo->post_args_num > 0) {
|
775
783
|
total_args = (int)locals[0];
|
776
784
|
args_ary = locals + 1;
|
777
785
|
|
786
|
+
masgn = ainfo->post_init;
|
787
|
+
if(masgn && nd_type(masgn) == NODE_BLOCK) {
|
788
|
+
next = masgn->nd_next;
|
789
|
+
masgn = masgn->nd_head;
|
790
|
+
} else {
|
791
|
+
next = 0;
|
792
|
+
}
|
793
|
+
|
778
794
|
int start;
|
779
795
|
for(start = 0; start < total_args; start++) {
|
780
|
-
if(args_ary[start] ==
|
796
|
+
if(args_ary[start] == ainfo->first_post_arg)
|
781
797
|
break;
|
782
798
|
}
|
783
799
|
|
784
800
|
post = rb_ary_new();
|
785
|
-
for(int i = 0; i <
|
801
|
+
for(int i = 0; i < ainfo->post_args_num && start + i < total_args; i++) {
|
786
802
|
VALUE arg = Qnil;
|
787
803
|
|
788
804
|
if(!INTERNAL_ID_P(args_ary[start + i])) {
|
789
805
|
arg = ID2SYM(args_ary[start + i]);
|
790
806
|
} else if(masgn) {
|
791
807
|
arg = process_parse_tree(parser_state, ptp, masgn, locals);
|
792
|
-
|
808
|
+
|
809
|
+
if(next) {
|
793
810
|
masgn = next->nd_head;
|
794
811
|
next = next->nd_next;
|
795
|
-
} else {
|
796
|
-
masgn = next;
|
797
|
-
if(masgn) next = masgn->nd_next;
|
798
812
|
}
|
799
813
|
}
|
800
814
|
rb_ary_push(post, arg);
|
801
815
|
}
|
802
816
|
}
|
803
817
|
|
804
|
-
tree = rb_funcall(ptp, rb_sArgs,
|
818
|
+
tree = rb_funcall(ptp, rb_sArgs, 8, line, args, opts, splat,
|
819
|
+
post, kwargs, kwrest, block);
|
805
820
|
break;
|
806
821
|
}
|
807
822
|
case NODE_LVAR:
|
@@ -863,6 +878,14 @@ namespace MELBOURNE {
|
|
863
878
|
tree = rb_funcall(ptp, rb_sFloat, 2, line, node->nd_lit);
|
864
879
|
break;
|
865
880
|
|
881
|
+
case NODE_IMAGINARY:
|
882
|
+
tree = rb_funcall(ptp, rb_sImaginary, 2, line, node->nd_lit);
|
883
|
+
break;
|
884
|
+
|
885
|
+
case NODE_RATIONAL:
|
886
|
+
tree = rb_funcall(ptp, rb_sRational, 2, line, node->nd_lit);
|
887
|
+
break;
|
888
|
+
|
866
889
|
case NODE_NTH_REF: /* u2 u3 ($1) - u3 is local_cnt('~') ignorable? */
|
867
890
|
tree = rb_funcall(ptp, rb_sNthRef, 2, line, INT2FIX(node->nd_nth));
|
868
891
|
break;
|
data/lib/rubinius/melbourne.rb
CHANGED
data/rubinius-melbourne.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require 'rubinius/toolset'
|
3
2
|
require './lib/rubinius/melbourne/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |spec|
|
@@ -16,9 +15,7 @@ Gem::Specification.new do |spec|
|
|
16
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
16
|
spec.name = "rubinius-melbourne"
|
18
17
|
spec.require_paths = ["lib"]
|
19
|
-
spec.version =
|
20
|
-
|
21
|
-
spec.add_runtime_dependency "rubinius-toolset", "~> 2.2"
|
18
|
+
spec.version = CodeTools::Melbourne::VERSION
|
22
19
|
|
23
20
|
spec.add_development_dependency "rubinius-processor", "~> 2.0"
|
24
21
|
spec.add_development_dependency "rubinius-compiler", "~> 2.0"
|
data/spec/array_spec.rb
CHANGED
@@ -23,6 +23,26 @@ describe "An Array node" do
|
|
23
23
|
[:str, "c"]]
|
24
24
|
end
|
25
25
|
|
26
|
+
parse "%i[a b c]" do
|
27
|
+
[:array, [:lit, :a], [:lit, :b], [:lit, :c]]
|
28
|
+
end
|
29
|
+
|
30
|
+
parse '%i[a #{@b} c]' do
|
31
|
+
[:array, [:lit, :a], [:lit, :"\#{@b}"], [:lit, :c]]
|
32
|
+
end
|
33
|
+
|
34
|
+
parse "%I[a b c]" do
|
35
|
+
[:array,
|
36
|
+
[:dsym, "a"], [:dsym, "b"], [:dsym, "c"]]
|
37
|
+
end
|
38
|
+
|
39
|
+
parse '%I[a #{@b} c]' do
|
40
|
+
[:array,
|
41
|
+
[:dsym, "a"],
|
42
|
+
[:dsym, "", [:evstr, [:ivar, :@b]]],
|
43
|
+
[:dsym, "c"]]
|
44
|
+
end
|
45
|
+
|
26
46
|
parse "[*[1]]" do
|
27
47
|
[:splat, [:array, [:lit, 1]]]
|
28
48
|
end
|
data/spec/defn_spec.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
describe "A Defn node" do
|
2
2
|
parse <<-ruby do
|
3
3
|
def m
|
4
|
-
begin
|
5
|
-
end
|
6
4
|
end
|
7
5
|
ruby
|
8
6
|
|
@@ -10,483 +8,776 @@ describe "A Defn node" do
|
|
10
8
|
end
|
11
9
|
|
12
10
|
parse <<-ruby do
|
13
|
-
def m
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
def m() end
|
12
|
+
ruby
|
13
|
+
|
14
|
+
[:defn, :m, [:args], [:scope, [:block, [:nil]]]]
|
15
|
+
end
|
16
|
+
|
17
|
+
parse <<-ruby do
|
18
|
+
def m(a) end
|
19
|
+
ruby
|
20
|
+
|
21
|
+
[:defn, :m, [:args, :a], [:scope, [:block, [:nil]]]]
|
22
|
+
end
|
23
|
+
|
24
|
+
parse <<-ruby do
|
25
|
+
def m((a)) end
|
18
26
|
ruby
|
19
27
|
|
20
28
|
[:defn,
|
21
29
|
:m,
|
22
|
-
[:args],
|
23
|
-
[:scope, [:block, [:
|
30
|
+
[:args, [:masgn, [:array, [:lasgn, :a]], [:lvar, :"_:1"]]],
|
31
|
+
[:scope, [:block, [:nil]]]]
|
24
32
|
end
|
25
33
|
|
26
34
|
parse <<-ruby do
|
27
|
-
def
|
28
|
-
other(42, *args, &block)
|
29
|
-
end
|
35
|
+
def m((*a, b)) end
|
30
36
|
ruby
|
31
37
|
|
32
38
|
[:defn,
|
33
|
-
:
|
34
|
-
[:args,
|
35
|
-
|
36
|
-
|
37
|
-
[:call,
|
38
|
-
nil,
|
39
|
-
:other,
|
40
|
-
[:arglist,
|
41
|
-
[:lit, 42],
|
42
|
-
[:splat, [:lvar, :args]],
|
43
|
-
[:block_pass, [:lvar, :block]]]]]]]
|
39
|
+
:m,
|
40
|
+
[:args,
|
41
|
+
[:masgn, [:array, [:splat, [:lasgn, :a]]], [:lasgn, :b], [:lvar, :"_:1"]]],
|
42
|
+
[:scope, [:block, [:nil]]]]
|
44
43
|
end
|
45
44
|
|
46
45
|
parse <<-ruby do
|
47
|
-
def
|
48
|
-
other(*args, &block)
|
49
|
-
end
|
46
|
+
def m(a=1) end
|
50
47
|
ruby
|
51
48
|
|
52
49
|
[:defn,
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
[:block,
|
57
|
-
[:call,
|
58
|
-
nil,
|
59
|
-
:other,
|
60
|
-
[:arglist,
|
61
|
-
[:splat, [:lvar, :args]],
|
62
|
-
[:block_pass, [:lvar, :block]]]]]]]
|
50
|
+
:m,
|
51
|
+
[:args, :a, [:block, [:lasgn, :a, [:lit, 1]]]],
|
52
|
+
[:scope, [:block, [:nil]]]]
|
63
53
|
end
|
64
54
|
|
65
55
|
parse <<-ruby do
|
66
|
-
def
|
67
|
-
|
68
|
-
b
|
69
|
-
rescue
|
70
|
-
c
|
71
|
-
end
|
56
|
+
def m(*) end
|
57
|
+
ruby
|
72
58
|
|
73
|
-
|
74
|
-
|
59
|
+
[:defn, :m, [:args, :*], [:scope, [:block, [:nil]]]]
|
60
|
+
end
|
61
|
+
|
62
|
+
parse <<-ruby do
|
63
|
+
def m(*a) end
|
64
|
+
ruby
|
65
|
+
|
66
|
+
[:defn, :m, [:args, :"*a"], [:scope, [:block, [:nil]]]]
|
67
|
+
end
|
68
|
+
|
69
|
+
parse <<-ruby do
|
70
|
+
def m(a:) end
|
71
|
+
ruby
|
72
|
+
|
73
|
+
[:defn, :m, [:args, :a, [:block, [:a]]], [:scope, [:block, [:nil]]]]
|
74
|
+
end
|
75
|
+
|
76
|
+
parse <<-ruby do
|
77
|
+
def m(a: 1) end
|
75
78
|
ruby
|
76
79
|
|
77
80
|
[:defn,
|
78
|
-
:
|
79
|
-
[:args],
|
80
|
-
[:scope,
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
parse <<-ruby do
|
91
|
-
def
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
81
|
+
:m,
|
82
|
+
[:args, :a, [:block, [:a], [[:lasgn, :a, [:lit, 1]]]]],
|
83
|
+
[:scope, [:block, [:nil]]]]
|
84
|
+
end
|
85
|
+
|
86
|
+
parse <<-ruby do
|
87
|
+
def m(**) end
|
88
|
+
ruby
|
89
|
+
|
90
|
+
[:defn, :m, [:args, :**, [:block, [:**]]], [:scope, [:block, [:nil]]]]
|
91
|
+
end
|
92
|
+
|
93
|
+
parse <<-ruby do
|
94
|
+
def m(**k) end
|
95
|
+
ruby
|
96
|
+
|
97
|
+
[:defn, :m, [:args, :"**k", [:block, [:"**k"]]], [:scope, [:block, [:nil]]]]
|
98
|
+
end
|
99
|
+
|
100
|
+
parse <<-ruby do
|
101
|
+
def m(&b) end
|
102
|
+
ruby
|
103
|
+
|
104
|
+
[:defn, :m, [:args, :"&b"], [:scope, [:block, [:nil]]]]
|
105
|
+
end
|
106
|
+
|
107
|
+
parse <<-ruby do
|
108
|
+
def m(a, b) end
|
109
|
+
ruby
|
110
|
+
|
111
|
+
[:defn, :m, [:args, :a, :b], [:scope, [:block, [:nil]]]]
|
112
|
+
end
|
113
|
+
|
114
|
+
parse <<-ruby do
|
115
|
+
def m(a, (b, c)) end
|
99
116
|
ruby
|
100
117
|
|
101
118
|
[:defn,
|
102
|
-
:
|
103
|
-
[:args],
|
104
|
-
[:scope,
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
[:resbody,
|
110
|
-
[:array, [:const, :StandardError]],
|
111
|
-
[:call, nil, :c, [:arglist]]]]]]]
|
112
|
-
end
|
113
|
-
|
114
|
-
parse <<-ruby do
|
115
|
-
def f
|
116
|
-
a
|
117
|
-
begin
|
118
|
-
b
|
119
|
-
rescue
|
120
|
-
c
|
121
|
-
end
|
122
|
-
d
|
123
|
-
end
|
119
|
+
:m,
|
120
|
+
[:args, :a, [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]], [:lvar, :"_:1"]]],
|
121
|
+
[:scope, [:block, [:nil]]]]
|
122
|
+
end
|
123
|
+
|
124
|
+
parse <<-ruby do
|
125
|
+
def m((a), (b)) end
|
124
126
|
ruby
|
125
127
|
|
126
128
|
[:defn,
|
127
|
-
:
|
128
|
-
[:args
|
129
|
-
|
130
|
-
[:
|
131
|
-
|
132
|
-
[:rescue,
|
133
|
-
[:call, nil, :b, [:arglist]],
|
134
|
-
[:resbody,
|
135
|
-
[:array, [:const, :StandardError]],
|
136
|
-
[:call, nil, :c, [:arglist]]]],
|
137
|
-
[:call, nil, :d, [:arglist]]]]]
|
129
|
+
:m,
|
130
|
+
[:args,
|
131
|
+
[:masgn, [:array, [:lasgn, :a]], [:lvar, :"_:1"]],
|
132
|
+
[:masgn, [:array, [:lasgn, :b]], [:lvar, :"_:2"]]],
|
133
|
+
[:scope, [:block, [:nil]]]]
|
138
134
|
end
|
139
135
|
|
140
136
|
parse <<-ruby do
|
141
|
-
def
|
142
|
-
end
|
137
|
+
def m((*), (*)) end
|
143
138
|
ruby
|
144
139
|
|
145
|
-
[:defn,
|
140
|
+
[:defn,
|
141
|
+
:m,
|
142
|
+
[:args,
|
143
|
+
[:masgn, [:array, [:splat]], [:lvar, :"_:1"]],
|
144
|
+
[:masgn, [:array, [:splat]], [:lvar, :"_:2"]]],
|
145
|
+
[:scope, [:block, [:nil]]]]
|
146
146
|
end
|
147
147
|
|
148
148
|
parse <<-ruby do
|
149
|
-
def
|
150
|
-
end
|
149
|
+
def m((*a), (*c)) end
|
151
150
|
ruby
|
152
151
|
|
153
152
|
[:defn,
|
154
|
-
:
|
155
|
-
[:args,
|
153
|
+
:m,
|
154
|
+
[:args,
|
155
|
+
[:masgn, [:array, [:splat, [:lasgn, :a]]], [:lvar, :"_:1"]],
|
156
|
+
[:masgn, [:array, [:splat, [:lasgn, :c]]], [:lvar, :"_:2"]]],
|
156
157
|
[:scope, [:block, [:nil]]]]
|
157
158
|
end
|
158
159
|
|
159
160
|
parse <<-ruby do
|
160
|
-
def
|
161
|
-
end
|
161
|
+
def m((a, b), (c, d)) end
|
162
162
|
ruby
|
163
163
|
|
164
164
|
[:defn,
|
165
|
-
:
|
166
|
-
[:args,
|
165
|
+
:m,
|
166
|
+
[:args,
|
167
|
+
[:masgn, [:array, [:lasgn, :a], [:lasgn, :b]], [:lvar, :"_:1"]],
|
168
|
+
[:masgn, [:array, [:lasgn, :c], [:lasgn, :d]], [:lvar, :"_:2"]]],
|
167
169
|
[:scope, [:block, [:nil]]]]
|
168
170
|
end
|
169
171
|
|
170
172
|
parse <<-ruby do
|
171
|
-
def
|
172
|
-
end
|
173
|
+
def m((a, *b), (*c, d)) end
|
173
174
|
ruby
|
174
175
|
|
175
|
-
[:defn,
|
176
|
+
[:defn,
|
177
|
+
:m,
|
178
|
+
[:args,
|
179
|
+
[:masgn, [:array, [:lasgn, :a], [:splat, [:lasgn, :b]]], [:lvar, :"_:1"]],
|
180
|
+
[:masgn, [:array, [:splat, [:lasgn, :c]]], [:lasgn, :d], [:lvar, :"_:2"]]],
|
181
|
+
[:scope, [:block, [:nil]]]]
|
176
182
|
end
|
177
183
|
|
178
184
|
parse <<-ruby do
|
179
|
-
def
|
180
|
-
end
|
185
|
+
def m((a, b, *c, d), (*e, f, g), (*h)) end
|
181
186
|
ruby
|
182
187
|
|
183
188
|
[:defn,
|
184
|
-
:
|
185
|
-
[:args,
|
189
|
+
:m,
|
190
|
+
[:args,
|
191
|
+
[:masgn,
|
192
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
193
|
+
[:lasgn, :d],
|
194
|
+
[:lvar, :"_:1"]],
|
195
|
+
[:masgn,
|
196
|
+
[:array, [:splat, [:lasgn, :e]]],
|
197
|
+
[:lasgn, :f],
|
198
|
+
[:lasgn, :g],
|
199
|
+
[:lvar, :"_:2"]],
|
200
|
+
[:masgn, [:array, [:splat, [:lasgn, :h]]], [:lvar, :"_:3"]]],
|
186
201
|
[:scope, [:block, [:nil]]]]
|
187
202
|
end
|
188
203
|
|
189
204
|
parse <<-ruby do
|
190
|
-
def
|
191
|
-
end
|
205
|
+
def m(a, (b, (c, *d), *e)) end
|
192
206
|
ruby
|
193
207
|
|
194
208
|
[:defn,
|
195
|
-
:
|
209
|
+
:m,
|
196
210
|
[:args,
|
197
|
-
:
|
198
|
-
:
|
199
|
-
|
200
|
-
|
201
|
-
|
211
|
+
:a,
|
212
|
+
[:masgn,
|
213
|
+
[:array,
|
214
|
+
[:lasgn, :b],
|
215
|
+
[:masgn, [:array, [:lasgn, :c], [:splat, [:lasgn, :d]]]],
|
216
|
+
[:splat, [:lasgn, :e]]],
|
217
|
+
[:lvar, :"_:1"]]],
|
202
218
|
[:scope, [:block, [:nil]]]]
|
203
219
|
end
|
204
220
|
|
205
221
|
parse <<-ruby do
|
206
|
-
def
|
207
|
-
end
|
222
|
+
def m(a, (b, (c, *d, (e, (*f)), g), (h, (i, j)))) end
|
208
223
|
ruby
|
209
224
|
|
210
225
|
[:defn,
|
211
|
-
:
|
212
|
-
[:args,
|
226
|
+
:m,
|
227
|
+
[:args,
|
228
|
+
:a,
|
229
|
+
[:masgn,
|
230
|
+
[:array,
|
231
|
+
[:lasgn, :b],
|
232
|
+
[:masgn,
|
233
|
+
[:array, [:lasgn, :c], [:splat, [:lasgn, :d]]],
|
234
|
+
[:masgn,
|
235
|
+
[:array, [:lasgn, :e], [:masgn, [:array, [:splat, [:lasgn, :f]]]]]],
|
236
|
+
[:lasgn, :g]],
|
237
|
+
[:masgn,
|
238
|
+
[:array, [:lasgn, :h], [:masgn, [:array, [:lasgn, :i], [:lasgn, :j]]]]]],
|
239
|
+
[:lvar, :"_:1"]]],
|
213
240
|
[:scope, [:block, [:nil]]]]
|
214
241
|
end
|
215
242
|
|
216
243
|
parse <<-ruby do
|
217
|
-
def
|
218
|
-
end
|
244
|
+
def m(a, b=1) end
|
219
245
|
ruby
|
220
246
|
|
221
247
|
[:defn,
|
222
|
-
:
|
223
|
-
[:args, :
|
248
|
+
:m,
|
249
|
+
[:args, :a, :b, [:block, [:lasgn, :b, [:lit, 1]]]],
|
224
250
|
[:scope, [:block, [:nil]]]]
|
225
251
|
end
|
226
252
|
|
227
253
|
parse <<-ruby do
|
228
|
-
def
|
229
|
-
end
|
254
|
+
def m(a, *) end
|
230
255
|
ruby
|
231
256
|
|
232
|
-
[:defn, :
|
257
|
+
[:defn, :m, [:args, :a, :*], [:scope, [:block, [:nil]]]]
|
233
258
|
end
|
234
259
|
|
235
260
|
parse <<-ruby do
|
236
|
-
def
|
237
|
-
end
|
261
|
+
def m(a, *b) end
|
238
262
|
ruby
|
239
263
|
|
240
|
-
[:defn, :
|
264
|
+
[:defn, :m, [:args, :a, :"*b"], [:scope, [:block, [:nil]]]]
|
241
265
|
end
|
242
266
|
|
243
267
|
parse <<-ruby do
|
244
|
-
def
|
245
|
-
end
|
268
|
+
def m(a, b:) end
|
246
269
|
ruby
|
247
270
|
|
248
|
-
[:defn, :
|
271
|
+
[:defn, :m, [:args, :a, :b, [:block, [:b]]], [:scope, [:block, [:nil]]]]
|
249
272
|
end
|
250
273
|
|
251
274
|
parse <<-ruby do
|
252
|
-
def
|
253
|
-
p(a, args)
|
254
|
-
end
|
275
|
+
def m(a, b: 1) end
|
255
276
|
ruby
|
256
277
|
|
257
278
|
[:defn,
|
258
|
-
:
|
259
|
-
[:args, :a, :
|
260
|
-
[:scope, [:block, [:
|
279
|
+
:m,
|
280
|
+
[:args, :a, :b, [:block, [:b], [[:lasgn, :b, [:lit, 1]]]]],
|
281
|
+
[:scope, [:block, [:nil]]]]
|
261
282
|
end
|
262
283
|
|
263
284
|
parse <<-ruby do
|
264
|
-
def
|
265
|
-
end
|
285
|
+
def m(a, **) end
|
266
286
|
ruby
|
267
287
|
|
268
|
-
[:defn, :
|
288
|
+
[:defn, :m, [:args, :a, :**, [:block, [:**]]], [:scope, [:block, [:nil]]]]
|
269
289
|
end
|
270
290
|
|
271
291
|
parse <<-ruby do
|
272
|
-
def
|
273
|
-
end
|
292
|
+
def m(a, **k) end
|
274
293
|
ruby
|
275
294
|
|
276
295
|
[:defn,
|
277
|
-
:
|
278
|
-
[:args, :
|
296
|
+
:m,
|
297
|
+
[:args, :a, :"**k", [:block, [:"**k"]]],
|
279
298
|
[:scope, [:block, [:nil]]]]
|
280
299
|
end
|
281
300
|
|
282
301
|
parse <<-ruby do
|
283
|
-
def
|
284
|
-
|
302
|
+
def m(a, &b) end
|
303
|
+
ruby
|
304
|
+
|
305
|
+
[:defn, :m, [:args, :a, :"&b"], [:scope, [:block, [:nil]]]]
|
306
|
+
end
|
307
|
+
|
308
|
+
parse <<-ruby do
|
309
|
+
def m(a=1, b) end
|
310
|
+
ruby
|
311
|
+
|
312
|
+
[:defn,
|
313
|
+
:m,
|
314
|
+
[:args, :a, :b, [:block, [:lasgn, :a, [:lit, 1]]]],
|
315
|
+
[:scope, [:block, [:nil]]]]
|
316
|
+
end
|
317
|
+
|
318
|
+
parse <<-ruby do
|
319
|
+
def m(a=1, *) end
|
320
|
+
ruby
|
321
|
+
|
322
|
+
[:defn,
|
323
|
+
:m,
|
324
|
+
[:args, :a, :*, [:block, [:lasgn, :a, [:lit, 1]]]],
|
325
|
+
[:scope, [:block, [:nil]]]]
|
326
|
+
end
|
327
|
+
|
328
|
+
parse <<-ruby do
|
329
|
+
def m(a=1, *b) end
|
330
|
+
ruby
|
331
|
+
|
332
|
+
[:defn,
|
333
|
+
:m,
|
334
|
+
[:args, :a, :"*b", [:block, [:lasgn, :a, [:lit, 1]]]],
|
335
|
+
[:scope, [:block, [:nil]]]]
|
336
|
+
end
|
337
|
+
|
338
|
+
parse <<-ruby do
|
339
|
+
def m(a=1, (b, c)) end
|
340
|
+
ruby
|
341
|
+
|
342
|
+
[:defn,
|
343
|
+
:m,
|
344
|
+
[:args,
|
345
|
+
:a,
|
346
|
+
[:masgn, [:array, [:lasgn, :b], [:lasgn, :c]], [:lvar, :"_:1"]],
|
347
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
348
|
+
[:scope, [:block, [:nil]]]]
|
349
|
+
end
|
350
|
+
|
351
|
+
parse <<-ruby do
|
352
|
+
def m(a=1, (b, (c, *d))) end
|
353
|
+
ruby
|
354
|
+
|
355
|
+
[:defn,
|
356
|
+
:m,
|
357
|
+
[:args,
|
358
|
+
:a,
|
359
|
+
[:masgn,
|
360
|
+
[:array,
|
361
|
+
[:lasgn, :b],
|
362
|
+
[:masgn, [:array, [:lasgn, :c], [:splat, [:lasgn, :d]]]]],
|
363
|
+
[:lvar, :"_:1"]],
|
364
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
365
|
+
[:scope, [:block, [:nil]]]]
|
366
|
+
end
|
367
|
+
|
368
|
+
parse <<-ruby do
|
369
|
+
def m(a=1, (b, (c, *d), *e)) end
|
370
|
+
ruby
|
371
|
+
|
372
|
+
[:defn,
|
373
|
+
:m,
|
374
|
+
[:args,
|
375
|
+
:a,
|
376
|
+
[:masgn,
|
377
|
+
[:array,
|
378
|
+
[:lasgn, :b],
|
379
|
+
[:masgn, [:array, [:lasgn, :c], [:splat, [:lasgn, :d]]]],
|
380
|
+
[:splat, [:lasgn, :e]]],
|
381
|
+
[:lvar, :"_:1"]],
|
382
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
383
|
+
[:scope, [:block, [:nil]]]]
|
384
|
+
end
|
385
|
+
|
386
|
+
parse <<-ruby do
|
387
|
+
def m(a=1, (b), (c)) end
|
388
|
+
ruby
|
389
|
+
|
390
|
+
[:defn,
|
391
|
+
:m,
|
392
|
+
[:args,
|
393
|
+
:a,
|
394
|
+
[:masgn, [:array, [:lasgn, :b]], [:lvar, :"_:1"]],
|
395
|
+
[:masgn, [:array, [:lasgn, :c]], [:lvar, :"_:2"]],
|
396
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
397
|
+
[:scope, [:block, [:nil]]]]
|
398
|
+
end
|
399
|
+
|
400
|
+
parse <<-ruby do
|
401
|
+
def m(a=1, (*b), (*c)) end
|
402
|
+
ruby
|
403
|
+
|
404
|
+
[:defn,
|
405
|
+
:m,
|
406
|
+
[:args,
|
407
|
+
:a,
|
408
|
+
[:masgn, [:array, [:splat, [:lasgn, :b]]], [:lvar, :"_:1"]],
|
409
|
+
[:masgn, [:array, [:splat, [:lasgn, :c]]], [:lvar, :"_:2"]],
|
410
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
411
|
+
[:scope, [:block, [:nil]]]]
|
412
|
+
end
|
413
|
+
|
414
|
+
parse <<-ruby do
|
415
|
+
def m(a=1, (b, c), (d, e)) end
|
416
|
+
ruby
|
417
|
+
|
418
|
+
[:defn,
|
419
|
+
:m,
|
420
|
+
[:args,
|
421
|
+
:a,
|
422
|
+
[:masgn, [:array, [:lasgn, :b], [:lasgn, :c]], [:lvar, :"_:1"]],
|
423
|
+
[:masgn, [:array, [:lasgn, :d], [:lasgn, :e]], [:lvar, :"_:2"]],
|
424
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
425
|
+
[:scope, [:block, [:nil]]]]
|
426
|
+
end
|
427
|
+
|
428
|
+
parse <<-ruby do
|
429
|
+
def m(a=1, (b, *c), (*d, e)) end
|
285
430
|
ruby
|
286
431
|
|
287
432
|
[:defn,
|
288
|
-
:
|
433
|
+
:m,
|
434
|
+
[:args,
|
435
|
+
:a,
|
436
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]], [:lvar, :"_:1"]],
|
437
|
+
[:masgn, [:array, [:splat, [:lasgn, :d]]], [:lasgn, :e], [:lvar, :"_:2"]],
|
438
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
439
|
+
[:scope, [:block, [:nil]]]]
|
440
|
+
end
|
441
|
+
|
442
|
+
parse <<-ruby do
|
443
|
+
def m(a=1, (b, *c), (d, (*e, f))) end
|
444
|
+
ruby
|
445
|
+
|
446
|
+
[:defn,
|
447
|
+
:m,
|
448
|
+
[:args,
|
449
|
+
:a,
|
450
|
+
[:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]]], [:lvar, :"_:1"]],
|
451
|
+
[:masgn,
|
452
|
+
[:array,
|
453
|
+
[:lasgn, :d],
|
454
|
+
[:masgn, [:array, [:splat, [:lasgn, :e]]], [:lasgn, :f]]],
|
455
|
+
[:lvar, :"_:2"]],
|
456
|
+
[:block, [:lasgn, :a, [:lit, 1]]]],
|
457
|
+
[:scope, [:block, [:nil]]]]
|
458
|
+
end
|
459
|
+
|
460
|
+
parse <<-ruby do
|
461
|
+
def m(a=1, b:) end
|
462
|
+
ruby
|
463
|
+
|
464
|
+
[:defn,
|
465
|
+
:m,
|
466
|
+
[:args, :a, :b, [:block, [:lasgn, :a, [:lit, 1]]], [:block, [:b]]],
|
467
|
+
[:scope, [:block, [:nil]]]]
|
468
|
+
end
|
469
|
+
|
470
|
+
parse <<-ruby do
|
471
|
+
def m(a=1, b: 2) end
|
472
|
+
ruby
|
473
|
+
|
474
|
+
[:defn,
|
475
|
+
:m,
|
289
476
|
[:args,
|
290
477
|
:a,
|
291
478
|
:b,
|
292
|
-
:
|
293
|
-
[:block,
|
294
|
-
[:lasgn, :a, [:lit, 42]],
|
295
|
-
[:lasgn, :b, [:str, "1"]],
|
296
|
-
[:lasgn,
|
297
|
-
:c,
|
298
|
-
[:call, nil, :lambda, [:arglist, [:iter, [:args, :n], [:lvar, :n]]]]]]],
|
479
|
+
[:block, [:lasgn, :a, [:lit, 1]]],
|
480
|
+
[:block, [:b], [[:lasgn, :b, [:lit, 2]]]]],
|
299
481
|
[:scope, [:block, [:nil]]]]
|
300
482
|
end
|
301
483
|
|
302
484
|
parse <<-ruby do
|
303
|
-
def
|
304
|
-
end
|
485
|
+
def m(a=1, **) end
|
305
486
|
ruby
|
306
487
|
|
307
488
|
[:defn,
|
308
|
-
:
|
309
|
-
[:args, :
|
489
|
+
:m,
|
490
|
+
[:args, :a, :**, [:block, [:lasgn, :a, [:lit, 1]]], [:block, [:**]]],
|
310
491
|
[:scope, [:block, [:nil]]]]
|
311
492
|
end
|
312
493
|
|
313
494
|
parse <<-ruby do
|
314
|
-
def
|
315
|
-
end
|
495
|
+
def m(a=1, **k) end
|
316
496
|
ruby
|
317
497
|
|
318
498
|
[:defn,
|
319
|
-
:
|
320
|
-
[:args, :
|
499
|
+
:m,
|
500
|
+
[:args, :a, :"**k", [:block, [:lasgn, :a, [:lit, 1]]], [:block, [:"**k"]]],
|
321
501
|
[:scope, [:block, [:nil]]]]
|
322
502
|
end
|
323
503
|
|
324
504
|
parse <<-ruby do
|
325
|
-
def
|
326
|
-
end
|
505
|
+
def m(a=1, &b) end
|
327
506
|
ruby
|
328
507
|
|
329
508
|
[:defn,
|
330
|
-
:
|
331
|
-
[:args, :b,
|
509
|
+
:m,
|
510
|
+
[:args, :a, :"&b", [:block, [:lasgn, :a, [:lit, 1]]]],
|
332
511
|
[:scope, [:block, [:nil]]]]
|
333
512
|
end
|
334
513
|
|
335
514
|
parse <<-ruby do
|
336
|
-
def
|
337
|
-
|
515
|
+
def m(*, a) end
|
516
|
+
ruby
|
517
|
+
|
518
|
+
[:defn, :m, [:args, :*, :a], [:scope, [:block, [:nil]]]]
|
519
|
+
end
|
520
|
+
|
521
|
+
parse <<-ruby do
|
522
|
+
def m(*a, b) end
|
523
|
+
ruby
|
524
|
+
|
525
|
+
[:defn, :m, [:args, :"*a", :b], [:scope, [:block, [:nil]]]]
|
526
|
+
end
|
527
|
+
|
528
|
+
parse <<-ruby do
|
529
|
+
def m(*, a:) end
|
530
|
+
ruby
|
531
|
+
|
532
|
+
[:defn, :m, [:args, :*, :a, [:block, [:a]]], [:scope, [:block, [:nil]]]]
|
533
|
+
end
|
534
|
+
|
535
|
+
parse <<-ruby do
|
536
|
+
def m(*a, b:) end
|
537
|
+
ruby
|
538
|
+
|
539
|
+
[:defn, :m, [:args, :"*a", :b, [:block, [:b]]], [:scope, [:block, [:nil]]]]
|
540
|
+
end
|
541
|
+
|
542
|
+
parse <<-ruby do
|
543
|
+
def m(*, a: 1) end
|
338
544
|
ruby
|
339
545
|
|
340
546
|
[:defn,
|
341
|
-
:
|
342
|
-
[:args, :
|
547
|
+
:m,
|
548
|
+
[:args, :*, :a, [:block, [:a], [[:lasgn, :a, [:lit, 1]]]]],
|
343
549
|
[:scope, [:block, [:nil]]]]
|
344
550
|
end
|
345
551
|
|
346
552
|
parse <<-ruby do
|
347
|
-
def
|
348
|
-
end
|
553
|
+
def m(*a, b: 1) end
|
349
554
|
ruby
|
350
555
|
|
351
|
-
[:defn,
|
556
|
+
[:defn,
|
557
|
+
:m,
|
558
|
+
[:args, :"*a", :b, [:block, [:b], [[:lasgn, :b, [:lit, 1]]]]],
|
559
|
+
[:scope, [:block, [:nil]]]]
|
352
560
|
end
|
353
561
|
|
354
562
|
parse <<-ruby do
|
355
|
-
def
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
563
|
+
def m(*, **) end
|
564
|
+
ruby
|
565
|
+
|
566
|
+
[:defn, :m, [:args, :*, :**, [:block, [:**]]], [:scope, [:block, [:nil]]]]
|
567
|
+
end
|
568
|
+
|
569
|
+
parse <<-ruby do
|
570
|
+
def m(*a, **) end
|
571
|
+
ruby
|
572
|
+
|
573
|
+
[:defn, :m, [:args, :"*a", :**, [:block, [:**]]], [:scope, [:block, [:nil]]]]
|
574
|
+
end
|
575
|
+
|
576
|
+
parse <<-ruby do
|
577
|
+
def m(*, **k) end
|
360
578
|
ruby
|
361
579
|
|
362
580
|
[:defn,
|
363
|
-
:
|
364
|
-
[:args, :
|
365
|
-
[:scope,
|
366
|
-
[:block,
|
367
|
-
[:rescue,
|
368
|
-
[:call,
|
369
|
-
[:call, [:self], :uuid, [:arglist]],
|
370
|
-
:==,
|
371
|
-
[:arglist, [:call, [:lvar, :resource], :uuid, [:arglist]]]],
|
372
|
-
[:resbody, [:array, [:const, :StandardError]], [:false]]]]]]
|
581
|
+
:m,
|
582
|
+
[:args, :*, :"**k", [:block, [:"**k"]]],
|
583
|
+
[:scope, [:block, [:nil]]]]
|
373
584
|
end
|
374
585
|
|
375
586
|
parse <<-ruby do
|
376
|
-
def
|
377
|
-
end
|
587
|
+
def m(*a, **k) end
|
378
588
|
ruby
|
379
589
|
|
380
|
-
[:defn,
|
590
|
+
[:defn,
|
591
|
+
:m,
|
592
|
+
[:args, :"*a", :"**k", [:block, [:"**k"]]],
|
593
|
+
[:scope, [:block, [:nil]]]]
|
381
594
|
end
|
382
595
|
|
383
596
|
parse <<-ruby do
|
384
|
-
def
|
385
|
-
end
|
597
|
+
def m(*, &b) end
|
386
598
|
ruby
|
387
599
|
|
388
|
-
[:defn, :
|
600
|
+
[:defn, :m, [:args, :*, :"&b"], [:scope, [:block, [:nil]]]]
|
389
601
|
end
|
390
602
|
|
391
603
|
parse <<-ruby do
|
392
|
-
def
|
393
|
-
end
|
604
|
+
def m(*a, &b) end
|
394
605
|
ruby
|
395
606
|
|
396
|
-
[:defn, :
|
607
|
+
[:defn, :m, [:args, :"*a", :"&b"], [:scope, [:block, [:nil]]]]
|
397
608
|
end
|
398
609
|
|
399
610
|
parse <<-ruby do
|
400
|
-
def
|
401
|
-
|
402
|
-
|
611
|
+
def m(a:, b:) end
|
612
|
+
ruby
|
613
|
+
|
614
|
+
[:defn, :m, [:args, :a, :b, [:block, [:a, :b]]], [:scope, [:block, [:nil]]]]
|
615
|
+
end
|
616
|
+
|
617
|
+
parse <<-ruby do
|
618
|
+
def m(a:, b: 1) end
|
403
619
|
ruby
|
404
620
|
|
405
621
|
[:defn,
|
406
|
-
:
|
407
|
-
[:args, :a,
|
408
|
-
[:scope, [:block, [:
|
622
|
+
:m,
|
623
|
+
[:args, :a, :b, [:block, [:a, :b], [[:lasgn, :b, [:lit, 1]]]]],
|
624
|
+
[:scope, [:block, [:nil]]]]
|
409
625
|
end
|
410
626
|
|
411
627
|
parse <<-ruby do
|
412
|
-
def
|
413
|
-
|
414
|
-
|
415
|
-
|
628
|
+
def m(a:, **) end
|
629
|
+
ruby
|
630
|
+
|
631
|
+
[:defn, :m, [:args, :a, :**, [:block, [:a, :**]]], [:scope, [:block, [:nil]]]]
|
632
|
+
end
|
633
|
+
|
634
|
+
parse <<-ruby do
|
635
|
+
def m(a:, **k) end
|
416
636
|
ruby
|
417
637
|
|
418
638
|
[:defn,
|
419
|
-
:
|
420
|
-
[:args],
|
421
|
-
[:scope, [:block, [:
|
639
|
+
:m,
|
640
|
+
[:args, :a, :"**k", [:block, [:a, :"**k"]]],
|
641
|
+
[:scope, [:block, [:nil]]]]
|
422
642
|
end
|
423
643
|
|
424
644
|
parse <<-ruby do
|
425
|
-
b
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
end
|
434
|
-
end
|
645
|
+
def m(a:, &b) end
|
646
|
+
ruby
|
647
|
+
|
648
|
+
[:defn, :m, [:args, :a, :"&b", [:block, [:a]]], [:scope, [:block, [:nil]]]]
|
649
|
+
end
|
650
|
+
|
651
|
+
parse <<-ruby do
|
652
|
+
def m(a: 1, b:) end
|
435
653
|
ruby
|
436
654
|
|
437
|
-
[:
|
438
|
-
|
439
|
-
[:
|
655
|
+
[:defn,
|
656
|
+
:m,
|
657
|
+
[:args, :a, :b, [:block, [:a, :b], [[:lasgn, :a, [:lit, 1]]]]],
|
658
|
+
[:scope, [:block, [:nil]]]]
|
659
|
+
end
|
660
|
+
|
661
|
+
parse <<-ruby do
|
662
|
+
def m(a: def m(a: 1) a end, b:) end
|
663
|
+
ruby
|
664
|
+
|
665
|
+
[:defn,
|
666
|
+
:m,
|
667
|
+
[:args,
|
440
668
|
:a,
|
441
|
-
|
442
|
-
[:
|
443
|
-
[:
|
444
|
-
|
445
|
-
|
446
|
-
:
|
447
|
-
|
448
|
-
[:
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
end
|
456
|
-
|
457
|
-
parse <<-ruby do
|
458
|
-
def x(a=0.0,b=0.0)
|
459
|
-
a+b
|
460
|
-
end
|
669
|
+
:b,
|
670
|
+
[:block,
|
671
|
+
[:a, :b],
|
672
|
+
[[:lasgn,
|
673
|
+
:a,
|
674
|
+
[:defn,
|
675
|
+
:m,
|
676
|
+
[:args, :a, [:block, [:a], [[:lasgn, :a, [:lit, 1]]]]],
|
677
|
+
[:scope, [:block, [:lvar, :a]]]]]]]],
|
678
|
+
[:scope, [:block, [:nil]]]]
|
679
|
+
end
|
680
|
+
|
681
|
+
parse <<-ruby do
|
682
|
+
def m(a: 1, b: 2) end
|
461
683
|
ruby
|
462
684
|
|
463
685
|
[:defn,
|
464
|
-
:
|
686
|
+
:m,
|
465
687
|
[:args,
|
466
688
|
:a,
|
467
689
|
:b,
|
468
|
-
[:block, [:lasgn, :a, [:lit,
|
469
|
-
[:scope, [:block, [:
|
690
|
+
[:block, [:a, :b], [[:lasgn, :a, [:lit, 1]], [:lasgn, :b, [:lit, 2]]]]],
|
691
|
+
[:scope, [:block, [:nil]]]]
|
470
692
|
end
|
471
693
|
|
472
694
|
parse <<-ruby do
|
473
|
-
def
|
474
|
-
a(*b)
|
475
|
-
end
|
695
|
+
def m(a: 1, **) end
|
476
696
|
ruby
|
477
697
|
|
478
698
|
[:defn,
|
479
|
-
:
|
480
|
-
[:args, :
|
481
|
-
[:scope, [:block, [:
|
699
|
+
:m,
|
700
|
+
[:args, :a, :**, [:block, [:a, :**], [[:lasgn, :a, [:lit, 1]]]]],
|
701
|
+
[:scope, [:block, [:nil]]]]
|
482
702
|
end
|
483
703
|
|
484
704
|
parse <<-ruby do
|
485
|
-
def
|
486
|
-
|
705
|
+
def m(a: 1, **k) end
|
706
|
+
ruby
|
707
|
+
|
708
|
+
[:defn,
|
709
|
+
:m,
|
710
|
+
[:args, :a, :"**k", [:block, [:a, :"**k"], [[:lasgn, :a, [:lit, 1]]]]],
|
711
|
+
[:scope, [:block, [:nil]]]]
|
712
|
+
end
|
713
|
+
|
714
|
+
parse <<-ruby do
|
715
|
+
def m(a: 1, &b) end
|
716
|
+
ruby
|
717
|
+
|
718
|
+
[:defn,
|
719
|
+
:m,
|
720
|
+
[:args, :a, :"&b", [:block, [:a], [[:lasgn, :a, [:lit, 1]]]]],
|
721
|
+
[:scope, [:block, [:nil]]]]
|
722
|
+
end
|
723
|
+
|
724
|
+
parse <<-ruby do
|
725
|
+
def m(**, &b) end
|
726
|
+
ruby
|
727
|
+
|
728
|
+
[:defn, :m, [:args, :**, :"&b", [:block, [:**]]], [:scope, [:block, [:nil]]]]
|
729
|
+
end
|
730
|
+
|
731
|
+
parse <<-ruby do
|
732
|
+
def m(**k, &b) end
|
733
|
+
ruby
|
734
|
+
|
735
|
+
[:defn,
|
736
|
+
:m,
|
737
|
+
[:args, :"**k", :"&b", [:block, [:"**k"]]],
|
738
|
+
[:scope, [:block, [:nil]]]]
|
739
|
+
end
|
740
|
+
|
741
|
+
parse <<-ruby do
|
742
|
+
def m(a, b=1, *c, d, e:, f: 2, g:, **k, &l) end
|
743
|
+
ruby
|
744
|
+
|
745
|
+
[:defn,
|
746
|
+
:m,
|
747
|
+
[:args,
|
748
|
+
:a,
|
749
|
+
:b,
|
750
|
+
:"*c",
|
751
|
+
:d,
|
752
|
+
:e,
|
753
|
+
:f,
|
754
|
+
:g,
|
755
|
+
:"**k",
|
756
|
+
:"&l",
|
757
|
+
[:block, [:lasgn, :b, [:lit, 1]]],
|
758
|
+
[:block, [:e, :f, :g, :"**k"], [[:lasgn, :f, [:lit, 2]]]]],
|
759
|
+
[:scope, [:block, [:nil]]]]
|
760
|
+
end
|
761
|
+
|
762
|
+
parse <<-ruby do
|
763
|
+
def m a, b=1, *c, d, e:, f: 2, g:, **k, &l
|
487
764
|
end
|
488
765
|
ruby
|
489
766
|
|
490
|
-
[:defn,
|
767
|
+
[:defn,
|
768
|
+
:m,
|
769
|
+
[:args,
|
770
|
+
:a,
|
771
|
+
:b,
|
772
|
+
:"*c",
|
773
|
+
:d,
|
774
|
+
:e,
|
775
|
+
:f,
|
776
|
+
:g,
|
777
|
+
:"**k",
|
778
|
+
:"&l",
|
779
|
+
[:block, [:lasgn, :b, [:lit, 1]]],
|
780
|
+
[:block, [:e, :f, :g, :"**k"], [[:lasgn, :f, [:lit, 2]]]]],
|
781
|
+
[:scope, [:block, [:nil]]]]
|
491
782
|
end
|
492
783
|
end
|