rubinius-melbourne 2.0.1.0 → 2.1.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +2 -9
  4. data/Gemfile +0 -4
  5. data/Rakefile +26 -19
  6. data/ext/rubinius/melbourne/extconf.rb +4 -3
  7. data/ext/rubinius/melbourne/grammar.cpp +2 -2
  8. data/ext/rubinius/melbourne/grammar.y +2 -2
  9. data/ext/rubinius/melbourne/melbourne.cpp +4 -5
  10. data/lib/rubinius/melbourne/version.rb +2 -2
  11. data/lib/rubinius/melbourne.rb +1 -21
  12. data/rubinius-melbourne.gemspec +6 -3
  13. data/spec/alias_spec.rb +13 -18
  14. data/spec/and_spec.rb +6 -12
  15. data/spec/array_spec.rb +28 -54
  16. data/spec/attrasgn_spec.rb +60 -85
  17. data/spec/back_ref_spec.rb +6 -8
  18. data/spec/call_spec.rb +137 -225
  19. data/spec/case_spec.rb +94 -112
  20. data/spec/cdecl_spec.rb +16 -28
  21. data/spec/class_spec.rb +28 -40
  22. data/spec/colon2_spec.rb +2 -4
  23. data/spec/colon3_spec.rb +2 -4
  24. data/spec/const_spec.rb +2 -4
  25. data/spec/custom/runner/relates.rb +4 -0
  26. data/spec/cvar_spec.rb +6 -12
  27. data/spec/cvasgn_spec.rb +20 -15
  28. data/spec/defined_spec.rb +57 -55
  29. data/spec/defn_spec.rb +218 -280
  30. data/spec/defs_spec.rb +30 -38
  31. data/spec/dot2_spec.rb +2 -4
  32. data/spec/dot3_spec.rb +2 -4
  33. data/spec/dregx_spec.rb +20 -34
  34. data/spec/dstr_spec.rb +87 -111
  35. data/spec/dsym_spec.rb +5 -7
  36. data/spec/dxstr_spec.rb +2 -4
  37. data/spec/ensure_spec.rb +32 -40
  38. data/spec/false_spec.rb +2 -4
  39. data/spec/flip2_spec.rb +22 -26
  40. data/spec/flip3_spec.rb +15 -17
  41. data/spec/for_spec.rb +25 -23
  42. data/spec/gasgn_spec.rb +4 -8
  43. data/spec/gvar_spec.rb +8 -16
  44. data/spec/hash_spec.rb +14 -18
  45. data/spec/iasgn_spec.rb +8 -14
  46. data/spec/if_spec.rb +50 -80
  47. data/spec/iter_spec.rb +328 -402
  48. data/spec/lasgn_spec.rb +143 -200
  49. data/spec/lit_spec.rb +20 -40
  50. data/spec/masgn_spec.rb +278 -309
  51. data/spec/match2_spec.rb +6 -10
  52. data/spec/match3_spec.rb +9 -13
  53. data/spec/match_spec.rb +2 -4
  54. data/spec/module_spec.rb +12 -16
  55. data/spec/nil_spec.rb +2 -4
  56. data/spec/not_spec.rb +6 -8
  57. data/spec/nth_ref_spec.rb +2 -4
  58. data/spec/op_asgn_spec.rb +118 -158
  59. data/spec/or_spec.rb +18 -24
  60. data/spec/postexe_spec.rb +2 -4
  61. data/spec/regex_spec.rb +11 -19
  62. data/spec/rescue_spec.rb +135 -143
  63. data/spec/return_spec.rb +19 -36
  64. data/spec/sclass_spec.rb +26 -25
  65. data/spec/spec_helper.rb +9 -0
  66. data/spec/str_spec.rb +25 -43
  67. data/spec/super_spec.rb +31 -49
  68. data/spec/true_spec.rb +2 -4
  69. data/spec/undef_spec.rb +38 -53
  70. data/spec/until_spec.rb +13 -105
  71. data/spec/valias_spec.rb +2 -4
  72. data/spec/while_spec.rb +35 -117
  73. data/spec/xstr_spec.rb +2 -4
  74. data/spec/yield_spec.rb +22 -42
  75. data/spec/zsuper_spec.rb +8 -16
  76. metadata +64 -22
  77. data/spec/cvdecl_spec.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b66e13de74897f9ce250c9cc03854b5480e213ba
4
- data.tar.gz: a3a1a4673bd4180440e30721f24e47349ec6a272
3
+ metadata.gz: ab46989de9cf438aa41258bcf6c0eabdb44fc2fe
4
+ data.tar.gz: d4eee71dff3c1745ff2c8d7524182d2b9408b39a
5
5
  SHA512:
6
- metadata.gz: 75897ae8e978ad3a8f18e4294fda365b0056b7408761db2d14fce91427ce06136dd20a9664af38104a0e2abbfbcdf5d74a94b1a202d1e26ab8b704b8e19dcb01
7
- data.tar.gz: 5ddd5b9db0e47cab21cd29fb5aead3fa646ec370660668829baf10056b862aec7ee41eaa879ad1a4977a52a64ec2026d40a855d75e88fb93d0f79db88e25337a
6
+ metadata.gz: 8f4d8503d000603f8c0760372e22d76b81ae95de93178f3b83a51cd782d14099c7b7a1144299c4c8c043fece64d4d56f5051889a30c075a8dda596628dcecc09
7
+ data.tar.gz: 4171fddd5c644bcbcfad31906fda6c97e78f736dac199c53da8e938e83e1eb78f6379fa9599b5e7ab057500c0145966cec13d291b7baf9465eff6628eb9caedf
data/.gitignore CHANGED
@@ -21,3 +21,4 @@ tmp
21
21
  .rbx
22
22
  Makefile
23
23
  namespace.h
24
+ .spec_ruby_version
data/.travis.yml CHANGED
@@ -1,14 +1,7 @@
1
1
  language: ruby
2
2
  env:
3
3
  - MELBOURNE_SPEC_VERSION=1 RUBYLIB=lib:.
4
- - MELBOURNE_SPEC_VERSION=1 RUBYLIB=.
5
- script: bundle exec mspec spec
4
+ before_install: gem install rubinius-toolset
6
5
  rvm:
7
- - 2.0.0
6
+ - 2.1.0
8
7
  - 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,7 +2,3 @@ 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,33 +1,40 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
- require "redcard"
4
3
 
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]'"
4
+ def extension_dir
5
+ Dir.chdir "ext/rubinius/melbourne" do
6
+ yield
7
+ end
8
+ end
9
+
10
+ def spec_ruby_version
11
+ ".spec_ruby_version"
12
+ end
13
+
14
+ namespace :spec do
15
+ desc "Clean the parser extension"
16
+ task :clean do
17
+ extension_dir do
18
+ unless File.exist? spec_ruby_version and
19
+ File.read(spec_ruby_version) == RUBY_DESCRIPTION
20
+ sh "make distclean"
21
+ File.open(spec_ruby_version, "w") { |f| f.write RUBY_DESCRIPTION }
12
22
  end
13
23
  end
24
+ end
14
25
 
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
26
+ desc "Build the parser extension"
27
+ task :build do
28
+ extension_dir do
29
+ ruby "-v extconf.rb"
30
+ ruby "-e 'system %[make && make install]'"
20
31
  end
21
32
  end
22
-
23
- dependencies = %w[spec:build spec:toolset]
24
- else
25
- dependencies = []
26
33
  end
27
34
 
28
35
  desc "Run the specs"
29
- task :spec => dependencies do
30
- sh "mspec spec"
36
+ task :spec => %w[spec:clean spec:build] do
37
+ sh "mspec -r spec/spec_helper spec"
31
38
  end
32
39
 
33
40
  task :default => :spec
@@ -1,10 +1,11 @@
1
1
  require 'rbconfig'
2
2
 
3
- # Fake out Rubinius::ToolSet for bootstrapping
3
+ # Fake out Rubinius::ToolSets for bootstrapping
4
4
  module Rubinius
5
- module ToolSet
5
+ module ToolSets
6
6
  def self.current
7
7
  @current ||= Module.new
8
+ @current.const_set :ToolSet, @current
8
9
  end
9
10
  end
10
11
  end
@@ -13,7 +14,7 @@ require File.expand_path("../../../../lib/rubinius/melbourne/version", __FILE__)
13
14
 
14
15
  path = File.expand_path "../namespace.h", __FILE__
15
16
  File.open path, "wb" do |f|
16
- version = Rubinius::ToolSet.current::TS::Melbourne::VERSION
17
+ version = Rubinius::ToolSets.current::ToolSet::Melbourne::VERSION
17
18
 
18
19
  if ENV["MELBOURNE_SPEC_VERSION"]
19
20
  # Alter the version to not match any possible loaded version
@@ -11518,8 +11518,6 @@ static const struct {
11518
11518
  } op_tbl[] = {
11519
11519
  {tDOT2, ".."},
11520
11520
  {tDOT3, "..."},
11521
- {'+', "+(binary)"},
11522
- {'-', "-(binary)"},
11523
11521
  {tPOW, "**"},
11524
11522
  {tUPLUS, "+@"},
11525
11523
  {tUMINUS, "-@"},
@@ -11542,6 +11540,8 @@ static const struct {
11542
11540
  {'%', "%"},
11543
11541
  {'&', "&"},
11544
11542
  {'*', "*"},
11543
+ {'+', "+"},
11544
+ {'-', "-"},
11545
11545
  {'/', "/"},
11546
11546
  {'<', "<"},
11547
11547
  {'>', ">"},
@@ -6124,8 +6124,6 @@ static const struct {
6124
6124
  } op_tbl[] = {
6125
6125
  {tDOT2, ".."},
6126
6126
  {tDOT3, "..."},
6127
- {'+', "+(binary)"},
6128
- {'-', "-(binary)"},
6129
6127
  {tPOW, "**"},
6130
6128
  {tUPLUS, "+@"},
6131
6129
  {tUMINUS, "-@"},
@@ -6148,6 +6146,8 @@ static const struct {
6148
6146
  {'%', "%"},
6149
6147
  {'&', "&"},
6150
6148
  {'*', "*"},
6149
+ {'+', "+"},
6150
+ {'-', "-"},
6151
6151
  {'/', "/"},
6152
6152
  {'<', "<"},
6153
6153
  {'>', ">"},
@@ -32,7 +32,7 @@ VALUE MELBOURNE_FILE_TO_AST(VALUE self, VALUE fname, VALUE start) {
32
32
  }
33
33
 
34
34
  void Init_melbourne(void) {
35
- VALUE rb_cMelbourne, rb_mToolSet, rb_mTScurrent, rb_mTS;
35
+ VALUE rb_cMelbourne, rb_mToolSets, rb_mToolSet;
36
36
 
37
37
  MELBOURNE::init_symbols();
38
38
 
@@ -40,10 +40,9 @@ void Init_melbourne(void) {
40
40
  VALUE rb_mRubinius = rb_const_get(rb_cObject, rb_intern("Rubinius"));
41
41
  #endif
42
42
 
43
- rb_mToolSet = rb_const_get(rb_mRubinius, rb_intern("ToolSet"));
44
- rb_mTScurrent = rb_funcall(rb_mToolSet, rb_intern("current"), 0);
45
- rb_mTS = rb_define_module_under(rb_mTScurrent, "TS");
46
- rb_cMelbourne = rb_define_class_under(rb_mTS, "Melbourne", rb_cObject);
43
+ rb_mToolSets = rb_const_get(rb_mRubinius, rb_intern("ToolSets"));
44
+ rb_mToolSet = rb_funcall(rb_mToolSets, rb_intern("current"), 0);
45
+ rb_cMelbourne = rb_define_class_under(rb_mToolSet, "Melbourne", rb_cObject);
47
46
  rb_define_method(rb_cMelbourne, "string_to_ast",
48
47
  RUBY_METHOD_FUNC(MELBOURNE_STRING_TO_AST), 3);
49
48
  rb_define_method(rb_cMelbourne, "file_to_ast",
@@ -1,5 +1,5 @@
1
- module Rubinius::ToolSet.current::TS
1
+ module Rubinius::ToolSets.current::ToolSet
2
2
  class Melbourne
3
- VERSION = "2.0.1.0"
3
+ VERSION = "2.1.0.0"
4
4
  end
5
5
  end
@@ -1,27 +1,7 @@
1
1
  require "rubinius/melbourne/melbourne"
2
2
  require "rubinius/melbourne/version"
3
3
 
4
- class String
5
- def to_ast(name="(eval)", line=1)
6
- Rubinius::ToolSet.get(:runtime)::Melbourne.parse_string self, name, line
7
- end
8
-
9
- def to_sexp(name="(eval)", line=1)
10
- to_ast(name, line).to_sexp
11
- end
12
- end
13
-
14
- class File
15
- def self.to_ast(name, line=1)
16
- Rubinius::ToolSet.get(:runtime)::Melbourne.parse_file name, line
17
- end
18
-
19
- def self.to_sexp(name, line=1)
20
- to_ast(name, line).to_sexp
21
- end
22
- end
23
-
24
- module Rubinius::ToolSet.current::TS
4
+ module Rubinius::ToolSets.current::ToolSet
25
5
  class Melbourne
26
6
  attr_accessor :transforms
27
7
  attr_accessor :magic_handler
@@ -16,11 +16,14 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.name = "rubinius-melbourne"
18
18
  spec.require_paths = ["lib"]
19
- spec.version = Rubinius::ToolSet.current::TS::Melbourne::VERSION
19
+ spec.version = Rubinius::ToolSets.current::ToolSet::Melbourne::VERSION
20
20
 
21
- spec.add_runtime_dependency "rubinius-toolset"
21
+ spec.add_runtime_dependency "rubinius-toolset", "~> 2.2"
22
22
 
23
- spec.add_development_dependency "rubinius-toolset", "~> 2.0"
23
+ spec.add_development_dependency "rubinius-processor", "~> 2.0"
24
+ spec.add_development_dependency "rubinius-compiler", "~> 2.0"
25
+ spec.add_development_dependency "rubinius-ast", "~> 2.0"
26
+ spec.add_development_dependency "rubinius-bridge", "~> 1.0"
24
27
  spec.add_development_dependency "redcard", "~> 1.0"
25
28
  spec.add_development_dependency "mspec", "~> 1.5"
26
29
  spec.add_development_dependency "rake", "~> 10.0"
data/spec/alias_spec.rb CHANGED
@@ -1,40 +1,35 @@
1
1
  describe "An Alias node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  class X
4
4
  alias :y :x
5
5
  end
6
6
  ruby
7
7
 
8
- parse do
9
- [:class, :X, nil, [:scope, [:alias, [:lit, :y], [:lit, :x]]]]
10
- end
8
+ [:class, :X, nil, [:scope, [:block, [:alias, [:lit, :y], [:lit, :x]]]]]
11
9
  end
12
10
 
13
- relates <<-ruby do
11
+ parse <<-ruby do
14
12
  class X
15
13
  alias y x
16
14
  end
17
15
  ruby
18
16
 
19
- parse do
20
- [:class, :X, nil, [:scope, [:alias, [:lit, :y], [:lit, :x]]]]
21
- end
17
+ [:class, :X, nil, [:scope, [:block, [:alias, [:lit, :y], [:lit, :x]]]]]
22
18
  end
23
19
 
24
- relates <<-ruby do
20
+ parse <<-ruby do
25
21
  class X
26
22
  alias :"y\#{1}" :"x\#{2}"
27
23
  end
28
24
  ruby
29
25
 
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
26
+ [:class,
27
+ :X,
28
+ nil,
29
+ [:scope,
30
+ [:block,
31
+ [:alias,
32
+ [:dsym, "y", [:evstr, [:lit, 1]]],
33
+ [:dsym, "x", [:evstr, [:lit, 2]]]]]]]
39
34
  end
40
35
  end
data/spec/and_spec.rb CHANGED
@@ -1,19 +1,13 @@
1
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
2
+ parse "(a and b)" do
3
+ [:and, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]]
6
4
  end
7
5
 
8
- relates "() and a" do
9
- parse do
10
- [:and, [:nil], [:call, nil, :a, [:arglist]]]
11
- end
6
+ parse "() and a" do
7
+ [:and, [:nil], [:call, nil, :a, [:arglist]]]
12
8
  end
13
9
 
14
- relates "a and ()" do
15
- parse do
16
- [:and, [:call, nil, :a, [:arglist]], [:nil]]
17
- end
10
+ parse "a and ()" do
11
+ [:and, [:call, nil, :a, [:arglist]], [:nil]]
18
12
  end
19
13
  end
data/spec/array_spec.rb CHANGED
@@ -1,81 +1,55 @@
1
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
2
+ parse '[1, :b, "c"]' do
3
+ [:array, [:lit, 1], [:lit, :b], [:str, "c"]]
6
4
  end
7
5
 
8
- relates "%w[a b c]" do
9
- parse do
10
- [:array, [:str, "a"], [:str, "b"], [:str, "c"]]
11
- end
6
+ parse "%w[a b c]" do
7
+ [:array, [:str, "a"], [:str, "b"], [:str, "c"]]
12
8
  end
13
9
 
14
- relates '%w[a #{@b} c]' do
15
- parse do
16
- [:array, [:str, "a"], [:str, "\#{@b}"], [:str, "c"]]
17
- end
10
+ parse '%w[a #{@b} c]' do
11
+ [:array, [:str, "a"], [:str, "\#{@b}"], [:str, "c"]]
18
12
  end
19
13
 
20
- relates "%W[a b c]" do
21
- parse do
22
- [:array,
23
- [:str, "a"], [:str, "b"], [:str, "c"]]
24
- end
14
+ parse "%W[a b c]" do
15
+ [:array,
16
+ [:str, "a"], [:str, "b"], [:str, "c"]]
25
17
  end
26
18
 
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
19
+ parse '%W[a #{@b} c]' do
20
+ [:array,
21
+ [:str, "a"],
22
+ [:dstr, "", [:evstr, [:ivar, :@b]]],
23
+ [:str, "c"]]
34
24
  end
35
25
 
36
- relates "[*[1]]" do
37
- parse do
38
- [:array, [:splat, [:array, [:lit, 1]]]]
39
- end
26
+ parse "[*[1]]" do
27
+ [:splat, [:array, [:lit, 1]]]
40
28
  end
41
29
 
42
- relates "[*1]" do
43
- parse do
44
- [:array, [:splat, [:lit, 1]]]
45
- end
30
+ parse "[*1]" do
31
+ [:splat, [:lit, 1]]
46
32
  end
47
33
 
48
- relates "[[*1]]" do
49
- parse do
50
- [:array, [:array, [:splat, [:lit, 1]]]]
51
- end
34
+ parse "[[*1]]" do
35
+ [:array, [:splat, [:lit, 1]]]
52
36
  end
53
37
 
54
- relates "[1, *2]" do
55
- parse do
56
- [:array, [:lit, 1], [:splat, [:lit, 2]]]
57
- end
38
+ parse "[1, *2]" do
39
+ [:argscat, [:array, [:lit, 1]], [:lit, 2]]
58
40
  end
59
41
 
60
- relates "[1, *c()]" do
61
- parse do
62
- [:array, [:lit, 1], [:splat, [:call, nil, :c, [:arglist]]]]
63
- end
64
-
65
- # TODO
42
+ parse "[1, *c()]" do
43
+ [:argscat, [:array, [:lit, 1]], [:call, nil, :c, [:arglist]]]
66
44
  end
67
45
 
68
- relates <<-ruby do
46
+ parse <<-ruby do
69
47
  x = [2]
70
48
  [1, *x]
71
49
  ruby
72
50
 
73
- parse do
74
- [:block,
75
- [:lasgn, :x, [:array, [:lit, 2]]],
76
- [:array, [:lit, 1], [:splat, [:lvar, :x]]]]
77
- end
78
-
79
- # TODO
51
+ [:block,
52
+ [:lasgn, :x, [:array, [:lit, 2]]],
53
+ [:argscat, [:array, [:lit, 1]], [:lvar, :x]]]
80
54
  end
81
55
  end
@@ -1,112 +1,87 @@
1
1
  describe "An Attrasgn node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  y = 0
4
4
  42.method = y
5
5
  ruby
6
6
 
7
- parse do
8
- [:block,
9
- [:lasgn, :y, [:lit, 0]],
10
- [:attrasgn, [:lit, 42], :method=, [:arglist, [:lvar, :y]]]]
11
- end
7
+ [:block,
8
+ [:lasgn, :y, [:lit, 0]],
9
+ [:attrasgn, [:lit, 42], :method=, [:arglist, [:lvar, :y]]]]
12
10
  end
13
11
 
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
12
+ parse "a.m = *[1]" do
13
+ [:attrasgn,
14
+ [:call, nil, :a, [:arglist]],
15
+ :m=,
16
+ [:arglist, [:splat, [:array, [:lit, 1]]]]]
23
17
  end
24
18
 
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
19
+ parse "a[*b] = c" do
20
+ [:attrasgn,
21
+ [:call, nil, :a, [:arglist]],
22
+ :[]=,
23
+ [:arglist,
24
+ [:splat, [:call, nil, :b, [:arglist]]],
25
+ [:call, nil, :c, [:arglist]]]]
34
26
  end
35
27
 
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
28
+ parse "a[b, *c] = d" do
29
+ [:attrasgn,
30
+ [:call, nil, :a, [:arglist]],
31
+ :[]=,
32
+ [:arglist,
33
+ [:argscat,
34
+ [:array, [:call, nil, :b, [:arglist]]],
35
+ [:call, nil, :c, [:arglist]]],
36
+ [:call, nil, :d, [:arglist]]]]
47
37
  end
48
38
 
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
39
+ parse "a[b, *c] = *d" do
40
+ [:attrasgn,
41
+ [:call, nil, :a, [:arglist]],
42
+ :[]=,
43
+ [:arglist,
44
+ [:argscat,
45
+ [:array, [:call, nil, :b, [:arglist]]],
46
+ [:call, nil, :c, [:arglist]]],
47
+ [:splat, [:call, nil, :d, [:arglist]]]]]
60
48
  end
61
49
 
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
50
+ parse "a[b, *c] = d, e" do
51
+ [:attrasgn,
52
+ [:call, nil, :a, [:arglist]],
53
+ :[]=,
54
+ [:arglist,
55
+ [:argscat,
56
+ [:array, [:call, nil, :b, [:arglist]]],
57
+ [:call, nil, :c, [:arglist]]],
58
+ [:array, [:call, nil, :d, [:arglist]], [:call, nil, :e, [:arglist]]]]]
74
59
  end
75
60
 
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
61
+ parse "a[42] = 24" do
62
+ [:attrasgn,
63
+ [:call, nil, :a, [:arglist]],
64
+ :[]=,
65
+ [:arglist, [:lit, 42], [:lit, 24]]]
83
66
  end
84
67
 
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
68
+ parse "self[index, 0] = other_string" do
69
+ [:attrasgn,
70
+ nil,
71
+ :[]=,
72
+ [:arglist,
73
+ [:call, nil, :index, [:arglist]],
74
+ [:lit, 0],
75
+ [:call, nil, :other_string, [:arglist]]]]
95
76
  end
96
77
 
97
- relates <<-ruby do
78
+ parse <<-ruby do
98
79
  a = []
99
80
  a [42] = 24
100
81
  ruby
101
82
 
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
83
+ [:block,
84
+ [:lasgn, :a, [:array]],
85
+ [:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lit, 42], [:lit, 24]]]]
111
86
  end
112
87
  end