rubinius-melbourne 2.0.0.19 → 2.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +14 -0
  4. data/Gemfile +4 -0
  5. data/Rakefile +31 -0
  6. data/ext/rubinius/melbourne/extconf.rb +9 -2
  7. data/lib/rubinius/melbourne.rb +1 -1
  8. data/lib/rubinius/melbourne/version.rb +1 -1
  9. data/rubinius-melbourne.gemspec +5 -3
  10. data/spec/alias_spec.rb +40 -0
  11. data/spec/and_spec.rb +19 -0
  12. data/spec/array_spec.rb +81 -0
  13. data/spec/attrasgn_spec.rb +112 -0
  14. data/spec/back_ref_spec.rb +11 -0
  15. data/spec/call_spec.rb +298 -0
  16. data/spec/case_spec.rb +234 -0
  17. data/spec/cdecl_spec.rb +45 -0
  18. data/spec/class_spec.rb +83 -0
  19. data/spec/colon2_spec.rb +7 -0
  20. data/spec/colon3_spec.rb +7 -0
  21. data/spec/const_spec.rb +7 -0
  22. data/spec/custom/matchers/parse_as.rb +27 -0
  23. data/spec/custom/runner/relates.rb +83 -0
  24. data/spec/cvar_spec.rb +29 -0
  25. data/spec/cvasgn_spec.rb +30 -0
  26. data/spec/cvdecl_spec.rb +12 -0
  27. data/spec/default.mspec +4 -0
  28. data/spec/defined_spec.rb +117 -0
  29. data/spec/defn_spec.rb +554 -0
  30. data/spec/defs_spec.rb +81 -0
  31. data/spec/dot2_spec.rb +7 -0
  32. data/spec/dot3_spec.rb +7 -0
  33. data/spec/dregx_spec.rb +52 -0
  34. data/spec/dstr_spec.rb +169 -0
  35. data/spec/dsym_spec.rb +10 -0
  36. data/spec/dxstr_spec.rb +11 -0
  37. data/spec/ensure_spec.rb +117 -0
  38. data/spec/false_spec.rb +7 -0
  39. data/spec/flip2_spec.rb +43 -0
  40. data/spec/flip3_spec.rb +27 -0
  41. data/spec/for_spec.rb +61 -0
  42. data/spec/gasgn_spec.rb +13 -0
  43. data/spec/gvar_spec.rb +25 -0
  44. data/spec/hash_spec.rb +31 -0
  45. data/spec/iasgn_spec.rb +25 -0
  46. data/spec/if_spec.rb +131 -0
  47. data/spec/iter_spec.rb +613 -0
  48. data/spec/lasgn_spec.rb +377 -0
  49. data/spec/lit_spec.rb +61 -0
  50. data/spec/masgn_spec.rb +406 -0
  51. data/spec/match2_spec.rb +19 -0
  52. data/spec/match3_spec.rb +24 -0
  53. data/spec/match_spec.rb +7 -0
  54. data/spec/module_spec.rb +47 -0
  55. data/spec/nil_spec.rb +7 -0
  56. data/spec/not_spec.rb +17 -0
  57. data/spec/nth_ref_spec.rb +7 -0
  58. data/spec/op_asgn_spec.rb +246 -0
  59. data/spec/or_spec.rb +35 -0
  60. data/spec/postexe_spec.rb +7 -0
  61. data/spec/regex_spec.rb +28 -0
  62. data/spec/rescue_spec.rb +359 -0
  63. data/spec/return_spec.rb +57 -0
  64. data/spec/sclass_spec.rb +55 -0
  65. data/spec/str_spec.rb +97 -0
  66. data/spec/super_spec.rb +93 -0
  67. data/spec/true_spec.rb +7 -0
  68. data/spec/undef_spec.rb +98 -0
  69. data/spec/until_spec.rb +140 -0
  70. data/spec/valias_spec.rb +7 -0
  71. data/spec/while_spec.rb +192 -0
  72. data/spec/xstr_spec.rb +7 -0
  73. data/spec/yield_spec.rb +65 -0
  74. data/spec/zsuper_spec.rb +45 -0
  75. metadata +171 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2707b9089a094027e673782a2482aa761cfd2c40
4
- data.tar.gz: 2e3242f6ef0e6105da433a42919f4c3888a92a6c
3
+ metadata.gz: b66e13de74897f9ce250c9cc03854b5480e213ba
4
+ data.tar.gz: a3a1a4673bd4180440e30721f24e47349ec6a272
5
5
  SHA512:
6
- metadata.gz: be76d146a72a79ddabd411636c4824d93e91e21f72a9171163bde48e34c7827fa895e815645a9e7f341ab4ad801ef3670d7fa55bbcb1e5ed1777307d9dd7f8eb
7
- data.tar.gz: ca634acf9f7bfcebb04f5a28c44e9879cc6f2225a50c1a337afb9ffd605e053041d3b43945436dcf04facc8dc48dc6e00cb1b309c0aaf1acf95efce77a1ebf84
6
+ metadata.gz: 75897ae8e978ad3a8f18e4294fda365b0056b7408761db2d14fce91427ce06136dd20a9664af38104a0e2abbfbcdf5d74a94b1a202d1e26ab8b704b8e19dcb01
7
+ data.tar.gz: 5ddd5b9db0e47cab21cd29fb5aead3fa646ec370660668829baf10056b862aec7ee41eaa879ad1a4977a52a64ec2026d40a855d75e88fb93d0f79db88e25337a
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ test/version_tmp
20
20
  tmp
21
21
  .rbx
22
22
  Makefile
23
+ namespace.h
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ env:
3
+ - MELBOURNE_SPEC_VERSION=1 RUBYLIB=lib:.
4
+ - MELBOURNE_SPEC_VERSION=1 RUBYLIB=.
5
+ script: bundle exec mspec spec
6
+ rvm:
7
+ - 2.0.0
8
+ - rbx-2
9
+ matrix:
10
+ exclude:
11
+ - rvm: ruby-head
12
+ env: MELBOURNE_SPEC_VERSION=1 RUBYLIB=lib:.
13
+ - rvm: rbx-2
14
+ env: MELBOURNE_SPEC_VERSION=1 RUBYLIB=.
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rubinius-melbourne.gemspec
4
4
  gemspec
5
+
6
+ platforms :rbx do
7
+ gem 'rubysl', '~> 2.0'
8
+ end
data/Rakefile CHANGED
@@ -1,2 +1,33 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
+ require "redcard"
4
+
5
+ if RedCard.check :rubinius
6
+ namespace :spec do
7
+ desc "Build the parser extension"
8
+ task :build do
9
+ Dir.chdir "ext/rubinius/melbourne" do
10
+ ruby "-v extconf.rb"
11
+ ruby "-e 'system %[make && make install]'"
12
+ end
13
+ end
14
+
15
+ desc "Load the perser into the Spec ToolSet"
16
+ task :toolset do
17
+ Rubinius::ToolSet.start
18
+ require "rubinius/melbourne"
19
+ Rubinius::ToolSet.finish :spec
20
+ end
21
+ end
22
+
23
+ dependencies = %w[spec:build spec:toolset]
24
+ else
25
+ dependencies = []
26
+ end
27
+
28
+ desc "Run the specs"
29
+ task :spec => dependencies do
30
+ sh "mspec spec"
31
+ end
32
+
33
+ task :default => :spec
@@ -14,13 +14,20 @@ require File.expand_path("../../../../lib/rubinius/melbourne/version", __FILE__)
14
14
  path = File.expand_path "../namespace.h", __FILE__
15
15
  File.open path, "wb" do |f|
16
16
  version = Rubinius::ToolSet.current::TS::Melbourne::VERSION
17
+
18
+ if ENV["MELBOURNE_SPEC_VERSION"]
19
+ # Alter the version to not match any possible loaded version
20
+ version = version.split(".").map { |x| x + 1 }.join(".")
21
+ end
22
+
17
23
  melbourne = "melbourne_#{version.gsub(/\./, "_")}"
24
+
18
25
  f.puts "#define MELBOURNE #{melbourne}"
19
26
  f.puts "#define MELBOURNE_FILE_TO_AST #{melbourne}_file_to_ast"
20
27
  f.puts "#define MELBOURNE_STRING_TO_AST #{melbourne}_string_to_ast"
21
28
  end
22
29
 
23
- unless File.exists? "Makefile" and
30
+ unless File.exist? "Makefile" and
24
31
  File.mtime("Makefile") > File.mtime(__FILE__)
25
32
  cxx = ENV["CXX"] || RbConfig::CONFIG["CXX"] || "g++"
26
33
  cxxflags = "#{ENV["CXXFLAGS"] || ENV["CPPFLAGS"] ||
@@ -37,7 +44,7 @@ unless File.exists? "Makefile" and
37
44
  archincdirs = []
38
45
  incdirs.each do |x|
39
46
  dir = "#{x}/#{RbConfig::CONFIG["arch"]}"
40
- archincdirs << dir if File.exists? dir
47
+ archincdirs << dir if File.exist? dir
41
48
  end
42
49
  incdirs.concat archincdirs
43
50
 
@@ -74,7 +74,7 @@ module Rubinius::ToolSet.current::TS
74
74
  end
75
75
 
76
76
  def parse_file
77
- unless @name and File.exists? @name
77
+ unless @name and File.exist? @name
78
78
  raise Errno::ENOENT, @name.inspect
79
79
  end
80
80
 
@@ -1,5 +1,5 @@
1
1
  module Rubinius::ToolSet.current::TS
2
2
  class Melbourne
3
- VERSION = "2.0.0.19"
3
+ VERSION = "2.0.1.0"
4
4
  end
5
5
  end
@@ -18,8 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
  spec.version = Rubinius::ToolSet.current::TS::Melbourne::VERSION
20
20
 
21
- spec.add_runtime_dependency "rubinius-toolset"
21
+ spec.add_runtime_dependency "rubinius-toolset"
22
22
 
23
- spec.add_development_dependency "mspec", "~> 1.5"
24
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rubinius-toolset", "~> 2.0"
24
+ spec.add_development_dependency "redcard", "~> 1.0"
25
+ spec.add_development_dependency "mspec", "~> 1.5"
26
+ spec.add_development_dependency "rake", "~> 10.0"
25
27
  end
@@ -0,0 +1,40 @@
1
+ describe "An Alias node" do
2
+ relates <<-ruby do
3
+ class X
4
+ alias :y :x
5
+ end
6
+ ruby
7
+
8
+ parse do
9
+ [:class, :X, nil, [:scope, [:alias, [:lit, :y], [:lit, :x]]]]
10
+ end
11
+ end
12
+
13
+ relates <<-ruby do
14
+ class X
15
+ alias y x
16
+ end
17
+ ruby
18
+
19
+ parse do
20
+ [:class, :X, nil, [:scope, [:alias, [:lit, :y], [:lit, :x]]]]
21
+ end
22
+ end
23
+
24
+ relates <<-ruby do
25
+ class X
26
+ alias :"y\#{1}" :"x\#{2}"
27
+ end
28
+ ruby
29
+
30
+ parse do
31
+ [:class,
32
+ :X,
33
+ nil,
34
+ [:scope,
35
+ [:alias,
36
+ [:dsym, "y", [:evstr, [:lit, 1]]],
37
+ [:dsym, "x", [:evstr, [:lit, 2]]]]]]
38
+ end
39
+ end
40
+ end
data/spec/and_spec.rb ADDED
@@ -0,0 +1,19 @@
1
+ describe "An And node" do
2
+ relates "(a and b)" do
3
+ parse do
4
+ [:and, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]]
5
+ end
6
+ end
7
+
8
+ relates "() and a" do
9
+ parse do
10
+ [:and, [:nil], [:call, nil, :a, [:arglist]]]
11
+ end
12
+ end
13
+
14
+ relates "a and ()" do
15
+ parse do
16
+ [:and, [:call, nil, :a, [:arglist]], [:nil]]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,81 @@
1
+ describe "An Array node" do
2
+ relates '[1, :b, "c"]' do
3
+ parse do
4
+ [:array, [:lit, 1], [:lit, :b], [:str, "c"]]
5
+ end
6
+ end
7
+
8
+ relates "%w[a b c]" do
9
+ parse do
10
+ [:array, [:str, "a"], [:str, "b"], [:str, "c"]]
11
+ end
12
+ end
13
+
14
+ relates '%w[a #{@b} c]' do
15
+ parse do
16
+ [:array, [:str, "a"], [:str, "\#{@b}"], [:str, "c"]]
17
+ end
18
+ end
19
+
20
+ relates "%W[a b c]" do
21
+ parse do
22
+ [:array,
23
+ [:str, "a"], [:str, "b"], [:str, "c"]]
24
+ end
25
+ end
26
+
27
+ relates '%W[a #{@b} c]' do
28
+ parse do
29
+ [:array,
30
+ [:str, "a"],
31
+ [:dstr, "", [:evstr, [:ivar, :@b]]],
32
+ [:str, "c"]]
33
+ end
34
+ end
35
+
36
+ relates "[*[1]]" do
37
+ parse do
38
+ [:array, [:splat, [:array, [:lit, 1]]]]
39
+ end
40
+ end
41
+
42
+ relates "[*1]" do
43
+ parse do
44
+ [:array, [:splat, [:lit, 1]]]
45
+ end
46
+ end
47
+
48
+ relates "[[*1]]" do
49
+ parse do
50
+ [:array, [:array, [:splat, [:lit, 1]]]]
51
+ end
52
+ end
53
+
54
+ relates "[1, *2]" do
55
+ parse do
56
+ [:array, [:lit, 1], [:splat, [:lit, 2]]]
57
+ end
58
+ end
59
+
60
+ relates "[1, *c()]" do
61
+ parse do
62
+ [:array, [:lit, 1], [:splat, [:call, nil, :c, [:arglist]]]]
63
+ end
64
+
65
+ # TODO
66
+ end
67
+
68
+ relates <<-ruby do
69
+ x = [2]
70
+ [1, *x]
71
+ ruby
72
+
73
+ parse do
74
+ [:block,
75
+ [:lasgn, :x, [:array, [:lit, 2]]],
76
+ [:array, [:lit, 1], [:splat, [:lvar, :x]]]]
77
+ end
78
+
79
+ # TODO
80
+ end
81
+ end
@@ -0,0 +1,112 @@
1
+ describe "An Attrasgn node" do
2
+ relates <<-ruby do
3
+ y = 0
4
+ 42.method = y
5
+ ruby
6
+
7
+ parse do
8
+ [:block,
9
+ [:lasgn, :y, [:lit, 0]],
10
+ [:attrasgn, [:lit, 42], :method=, [:arglist, [:lvar, :y]]]]
11
+ end
12
+ end
13
+
14
+ relates "a.m = *[1]" do
15
+ parse do
16
+ [:attrasgn,
17
+ [:call, nil, :a, [:arglist]],
18
+ :m=,
19
+ [:arglist, [:svalue, [:splat, [:array, [:lit, 1]]]]]]
20
+ end
21
+
22
+ # attrasgn_splat
23
+ end
24
+
25
+ relates "a[*b] = c" do
26
+ parse do
27
+ [:attrasgn,
28
+ [:call, nil, :a, [:arglist]],
29
+ :[]=,
30
+ [:arglist,
31
+ [:splat, [:call, nil, :b, [:arglist]]],
32
+ [:call, nil, :c, [:arglist]]]]
33
+ end
34
+ end
35
+
36
+ relates "a[b, *c] = d" do
37
+ parse do
38
+ [:attrasgn,
39
+ [:call, nil, :a, [:arglist]],
40
+ :[]=,
41
+ [:arglist,
42
+ [:array,
43
+ [:call, nil, :b, [:arglist]],
44
+ [:splat, [:call, nil, :c, [:arglist]]]],
45
+ [:call, nil, :d, [:arglist]]]]
46
+ end
47
+ end
48
+
49
+ relates "a[b, *c] = *d" do
50
+ parse do
51
+ [:attrasgn,
52
+ [:call, nil, :a, [:arglist]],
53
+ :[]=,
54
+ [:arglist,
55
+ [:array,
56
+ [:call, nil, :b, [:arglist]],
57
+ [:splat, [:call, nil, :c, [:arglist]]]],
58
+ [:svalue, [:splat, [:call, nil, :d, [:arglist]]]]]]
59
+ end
60
+ end
61
+
62
+ relates "a[b, *c] = d, e" do
63
+ parse do
64
+ [:attrasgn,
65
+ [:call, nil, :a, [:arglist]],
66
+ :[]=,
67
+ [:arglist,
68
+ [:array,
69
+ [:call, nil, :b, [:arglist]],
70
+ [:splat, [:call, nil, :c, [:arglist]]]],
71
+ [:svalue,
72
+ [:array, [:call, nil, :d, [:arglist]], [:call, nil, :e, [:arglist]]]]]]
73
+ end
74
+ end
75
+
76
+ relates "a[42] = 24" do
77
+ parse do
78
+ [:attrasgn,
79
+ [:call, nil, :a, [:arglist]],
80
+ :[]=,
81
+ [:arglist, [:lit, 42], [:lit, 24]]]
82
+ end
83
+ end
84
+
85
+ relates "self[index, 0] = other_string" do
86
+ parse do
87
+ [:attrasgn,
88
+ [:self],
89
+ :[]=,
90
+ [:arglist,
91
+ [:call, nil, :index, [:arglist]],
92
+ [:lit, 0],
93
+ [:call, nil, :other_string, [:arglist]]]]
94
+ end
95
+ end
96
+
97
+ relates <<-ruby do
98
+ a = []
99
+ a [42] = 24
100
+ ruby
101
+
102
+ parse do
103
+ [:block,
104
+ [:lasgn, :a, [:array]],
105
+ [:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lit, 42], [:lit, 24]]]]
106
+ end
107
+ end
108
+
109
+ relates "m { |a.b| }" do
110
+ # TODO
111
+ end
112
+ end
@@ -0,0 +1,11 @@
1
+ describe "An Back_ref node" do
2
+ relates "[$&, $`, $', $+]" do
3
+ parse do
4
+ [:array,
5
+ [:back_ref, :&],
6
+ [:back_ref, :`],
7
+ [:back_ref, :"'"],
8
+ [:back_ref, :+]]
9
+ end
10
+ end
11
+ end
data/spec/call_spec.rb ADDED
@@ -0,0 +1,298 @@
1
+ describe "A Call node" do
2
+ relates "self.method" do
3
+ parse do
4
+ [:call, [:self], :method, [:arglist]]
5
+ end
6
+ end
7
+
8
+ relates "1.m(2)" do
9
+ parse do
10
+ [:call, [:lit, 1], :m, [:arglist, [:lit, 2]]]
11
+ end
12
+ end
13
+
14
+ relates "h(1, 2, *a)" do
15
+ parse do
16
+ [:call, nil, :h,
17
+ [:arglist,
18
+ [:lit, 1],
19
+ [:lit, 2],
20
+ [:splat, [:call, nil, :a, [:arglist]]]]]
21
+ end
22
+ end
23
+
24
+ relates <<-ruby do
25
+ begin
26
+ (1 + 1)
27
+ end
28
+ ruby
29
+
30
+ parse do
31
+ [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]
32
+ end
33
+ end
34
+
35
+ relates "blah(*a)" do
36
+ parse do
37
+ [:call, nil, :blah,
38
+ [:arglist, [:splat, [:call, nil, :a, [:arglist]]]]]
39
+ end
40
+ end
41
+
42
+ relates "a.b(&c)" do
43
+ parse do
44
+ [:call,
45
+ [:call, nil, :a, [:arglist]],
46
+ :b,
47
+ [:arglist, [:block_pass, [:call, nil, :c, [:arglist]]]]]
48
+ end
49
+ end
50
+
51
+ relates "a.b(4, &c)" do
52
+ parse do
53
+ [:call,
54
+ [:call, nil, :a, [:arglist]],
55
+ :b,
56
+ [:arglist, [:lit, 4], [:block_pass, [:call, nil, :c, [:arglist]]]]]
57
+ end
58
+ end
59
+
60
+ relates "a.b(1, 2, 3, &c)" do
61
+ parse do
62
+ [:call,
63
+ [:call, nil, :a, [:arglist]],
64
+ :b,
65
+ [:arglist,
66
+ [:lit, 1],
67
+ [:lit, 2],
68
+ [:lit, 3],
69
+ [:block_pass, [:call, nil, :c, [:arglist]]]]]
70
+ end
71
+ end
72
+
73
+ relates "a(&b)" do
74
+ parse do
75
+ [:call,
76
+ nil,
77
+ :a,
78
+ [:arglist, [:block_pass, [:call, nil, :b, [:arglist]]]]]
79
+ end
80
+ end
81
+
82
+ relates "a(4, &b)" do
83
+ parse do
84
+ [:call,
85
+ nil,
86
+ :a,
87
+ [:arglist, [:lit, 4], [:block_pass, [:call, nil, :b, [:arglist]]]]]
88
+ end
89
+ end
90
+
91
+ relates "a(1, 2, 3, &b)" do
92
+ parse do
93
+ [:call,
94
+ nil,
95
+ :a,
96
+ [:arglist,
97
+ [:lit, 1],
98
+ [:lit, 2],
99
+ [:lit, 3],
100
+ [:block_pass, [:call, nil, :b, [:arglist]]]]]
101
+ end
102
+ end
103
+
104
+ relates "define_attr_method(:x, :sequence_name, &Proc.new { |*args| nil })" do
105
+ parse do
106
+ [:call,
107
+ nil,
108
+ :define_attr_method,
109
+ [:arglist,
110
+ [:lit, :x],
111
+ [:lit, :sequence_name],
112
+ [:block_pass,
113
+ [:iter,
114
+ [:call, [:const, :Proc], :new, [:arglist]],
115
+ [:masgn, [:array, [:splat, [:lasgn, :args]]]],
116
+ [:nil]]]]]
117
+ end
118
+ end
119
+
120
+ relates "r.read_body(dest, &block)" do
121
+ parse do
122
+ [:call,
123
+ [:call, nil, :r, [:arglist]],
124
+ :read_body,
125
+ [:arglist,
126
+ [:call, nil, :dest, [:arglist]],
127
+ [:block_pass, [:call, nil, :block, [:arglist]]]]]
128
+ end
129
+ end
130
+
131
+ relates "o.m(:a => 1, :b => 2)" do
132
+ parse do
133
+ [:call,
134
+ [:call, nil, :o, [:arglist]],
135
+ :m,
136
+ [:arglist, [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
137
+ end
138
+ end
139
+
140
+ relates "o.m(42, :a => 1, :b => 2)" do
141
+ parse do
142
+ [:call,
143
+ [:call, nil, :o, [:arglist]],
144
+ :m,
145
+ [:arglist,
146
+ [:lit, 42],
147
+ [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
148
+ end
149
+ end
150
+
151
+ relates "o.m(42, :a => 1, :b => 2, *c)" do
152
+ parse do
153
+ [:call,
154
+ [:call, nil, :o, [:arglist]],
155
+ :m,
156
+ [:arglist,
157
+ [:lit, 42],
158
+ [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]],
159
+ [:splat, [:call, nil, :c, [:arglist]]]]]
160
+ end
161
+ end
162
+
163
+ relates "a (1,2,3)" do
164
+ parse do
165
+ [:call, nil, :a, [:arglist, [:lit, 1], [:lit, 2], [:lit, 3]]]
166
+ end
167
+ end
168
+
169
+ relates "o.puts(42)" do
170
+ parse do
171
+ [:call, [:call, nil, :o, [:arglist]], :puts, [:arglist, [:lit, 42]]]
172
+ end
173
+ end
174
+
175
+ relates "1.b(c)" do
176
+ parse do
177
+ [:call, [:lit, 1], :b, [:arglist, [:call, nil, :c, [:arglist]]]]
178
+ end
179
+ end
180
+
181
+ relates "(v = (1 + 1)).zero?" do
182
+ parse do
183
+ [:call,
184
+ [:lasgn, :v, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]],
185
+ :zero?,
186
+ [:arglist]]
187
+ end
188
+ end
189
+
190
+ relates "-2**31" do
191
+ parse do
192
+ [:call,
193
+ [:call, [:lit, 2], :**, [:arglist, [:lit, 31]]],
194
+ :-@,
195
+ [:arglist]]
196
+ end
197
+ end
198
+
199
+ relates "a[]" do
200
+ parse do
201
+ [:call, [:call, nil, :a, [:arglist]], :[], [:arglist]]
202
+ end
203
+ end
204
+
205
+ relates "m(:a => 1, :b => 2)" do
206
+ parse do
207
+ [:call,
208
+ nil,
209
+ :m,
210
+ [:arglist, [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
211
+ end
212
+ end
213
+
214
+ relates "m(42, :a => 1, :b => 2)" do
215
+ parse do
216
+ [:call,
217
+ nil,
218
+ :m,
219
+ [:arglist, [:lit, 42], [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
220
+ end
221
+ end
222
+
223
+ relates "m(42, :a => 1, :b => 2, *c)" do
224
+ parse do
225
+ [:call,
226
+ nil,
227
+ :m,
228
+ [:arglist,
229
+ [:lit, 42],
230
+ [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]],
231
+ [:splat, [:call, nil, :c, [:arglist]]]]]
232
+ end
233
+ end
234
+
235
+ relates "m(42)" do
236
+ parse do
237
+ [:call, nil, :m, [:arglist, [:lit, 42]]]
238
+ end
239
+ end
240
+
241
+ relates "a(:b) { :c }" do
242
+ parse do
243
+ [:iter, [:call, nil, :a, [:arglist, [:lit, :b]]], nil, [:lit, :c]]
244
+ end
245
+ end
246
+
247
+ relates "a [42]" do
248
+ parse do
249
+ [:call, nil, :a, [:arglist, [:array, [:lit, 42]]]]
250
+ end
251
+ end
252
+
253
+ relates "42 if block_given?" do
254
+ parse do
255
+ [:if, [:call, nil, :block_given?, [:arglist]], [:lit, 42], nil]
256
+ end
257
+ end
258
+
259
+ relates "method" do
260
+ parse do
261
+ [:call, nil, :method, [:arglist]]
262
+ end
263
+ end
264
+
265
+ relates <<-ruby do
266
+ a << begin
267
+ b
268
+ rescue
269
+ c
270
+ end
271
+ ruby
272
+
273
+ parse do
274
+ [:call,
275
+ [:call, nil, :a, [:arglist]],
276
+ :<<,
277
+ [:arglist,
278
+ [:rescue,
279
+ [:call, nil, :b, [:arglist]],
280
+ [:resbody, [:array], [:call, nil, :c, [:arglist]]]]]]
281
+ end
282
+ end
283
+
284
+ relates "meth([*[1]])" do
285
+ parse do
286
+ [:call,
287
+ nil,
288
+ :meth,
289
+ [:arglist, [:array, [:splat, [:array, [:lit, 1]]]]]]
290
+ end
291
+ end
292
+
293
+ relates "meth(*[1])" do
294
+ parse do
295
+ [:call, nil, :meth, [:arglist, [:splat, [:array, [:lit, 1]]]]]
296
+ end
297
+ end
298
+ end