rubinius-melbourne 2.0.1.0 → 2.1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -9
- data/Gemfile +0 -4
- data/Rakefile +26 -19
- data/ext/rubinius/melbourne/extconf.rb +4 -3
- data/ext/rubinius/melbourne/grammar.cpp +2 -2
- data/ext/rubinius/melbourne/grammar.y +2 -2
- data/ext/rubinius/melbourne/melbourne.cpp +4 -5
- data/lib/rubinius/melbourne/version.rb +2 -2
- data/lib/rubinius/melbourne.rb +1 -21
- data/rubinius-melbourne.gemspec +6 -3
- data/spec/alias_spec.rb +13 -18
- data/spec/and_spec.rb +6 -12
- data/spec/array_spec.rb +28 -54
- data/spec/attrasgn_spec.rb +60 -85
- data/spec/back_ref_spec.rb +6 -8
- data/spec/call_spec.rb +137 -225
- data/spec/case_spec.rb +94 -112
- data/spec/cdecl_spec.rb +16 -28
- data/spec/class_spec.rb +28 -40
- data/spec/colon2_spec.rb +2 -4
- data/spec/colon3_spec.rb +2 -4
- data/spec/const_spec.rb +2 -4
- data/spec/custom/runner/relates.rb +4 -0
- data/spec/cvar_spec.rb +6 -12
- data/spec/cvasgn_spec.rb +20 -15
- data/spec/defined_spec.rb +57 -55
- data/spec/defn_spec.rb +218 -280
- data/spec/defs_spec.rb +30 -38
- data/spec/dot2_spec.rb +2 -4
- data/spec/dot3_spec.rb +2 -4
- data/spec/dregx_spec.rb +20 -34
- data/spec/dstr_spec.rb +87 -111
- data/spec/dsym_spec.rb +5 -7
- data/spec/dxstr_spec.rb +2 -4
- data/spec/ensure_spec.rb +32 -40
- data/spec/false_spec.rb +2 -4
- data/spec/flip2_spec.rb +22 -26
- data/spec/flip3_spec.rb +15 -17
- data/spec/for_spec.rb +25 -23
- data/spec/gasgn_spec.rb +4 -8
- data/spec/gvar_spec.rb +8 -16
- data/spec/hash_spec.rb +14 -18
- data/spec/iasgn_spec.rb +8 -14
- data/spec/if_spec.rb +50 -80
- data/spec/iter_spec.rb +328 -402
- data/spec/lasgn_spec.rb +143 -200
- data/spec/lit_spec.rb +20 -40
- data/spec/masgn_spec.rb +278 -309
- data/spec/match2_spec.rb +6 -10
- data/spec/match3_spec.rb +9 -13
- data/spec/match_spec.rb +2 -4
- data/spec/module_spec.rb +12 -16
- data/spec/nil_spec.rb +2 -4
- data/spec/not_spec.rb +6 -8
- data/spec/nth_ref_spec.rb +2 -4
- data/spec/op_asgn_spec.rb +118 -158
- data/spec/or_spec.rb +18 -24
- data/spec/postexe_spec.rb +2 -4
- data/spec/regex_spec.rb +11 -19
- data/spec/rescue_spec.rb +135 -143
- data/spec/return_spec.rb +19 -36
- data/spec/sclass_spec.rb +26 -25
- data/spec/spec_helper.rb +9 -0
- data/spec/str_spec.rb +25 -43
- data/spec/super_spec.rb +31 -49
- data/spec/true_spec.rb +2 -4
- data/spec/undef_spec.rb +38 -53
- data/spec/until_spec.rb +13 -105
- data/spec/valias_spec.rb +2 -4
- data/spec/while_spec.rb +35 -117
- data/spec/xstr_spec.rb +2 -4
- data/spec/yield_spec.rb +22 -42
- data/spec/zsuper_spec.rb +8 -16
- metadata +64 -22
- data/spec/cvdecl_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab46989de9cf438aa41258bcf6c0eabdb44fc2fe
|
4
|
+
data.tar.gz: d4eee71dff3c1745ff2c8d7524182d2b9408b39a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f4d8503d000603f8c0760372e22d76b81ae95de93178f3b83a51cd782d14099c7b7a1144299c4c8c043fece64d4d56f5051889a30c075a8dda596628dcecc09
|
7
|
+
data.tar.gz: 4171fddd5c644bcbcfad31906fda6c97e78f736dac199c53da8e938e83e1eb78f6379fa9599b5e7ab057500c0145966cec13d291b7baf9465eff6628eb9caedf
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
language: ruby
|
2
2
|
env:
|
3
3
|
- MELBOURNE_SPEC_VERSION=1 RUBYLIB=lib:.
|
4
|
-
|
5
|
-
script: bundle exec mspec spec
|
4
|
+
before_install: gem install rubinius-toolset
|
6
5
|
rvm:
|
7
|
-
- 2.
|
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
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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 =>
|
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::
|
3
|
+
# Fake out Rubinius::ToolSets for bootstrapping
|
4
4
|
module Rubinius
|
5
|
-
module
|
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::
|
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,
|
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
|
-
|
44
|
-
|
45
|
-
|
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",
|
data/lib/rubinius/melbourne.rb
CHANGED
@@ -1,27 +1,7 @@
|
|
1
1
|
require "rubinius/melbourne/melbourne"
|
2
2
|
require "rubinius/melbourne/version"
|
3
3
|
|
4
|
-
|
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
|
data/rubinius-melbourne.gemspec
CHANGED
@@ -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::
|
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-
|
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
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
class X
|
4
4
|
alias :y :x
|
5
5
|
end
|
6
6
|
ruby
|
7
7
|
|
8
|
-
|
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
|
-
|
11
|
+
parse <<-ruby do
|
14
12
|
class X
|
15
13
|
alias y x
|
16
14
|
end
|
17
15
|
ruby
|
18
16
|
|
19
|
-
|
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
|
-
|
20
|
+
parse <<-ruby do
|
25
21
|
class X
|
26
22
|
alias :"y\#{1}" :"x\#{2}"
|
27
23
|
end
|
28
24
|
ruby
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
3
|
-
|
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
|
-
|
9
|
-
|
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
|
-
|
15
|
-
|
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
|
-
|
3
|
-
|
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
|
-
|
9
|
-
|
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
|
-
|
15
|
-
|
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
|
-
|
21
|
-
|
22
|
-
[:
|
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
|
-
|
28
|
-
|
29
|
-
[:
|
30
|
-
|
31
|
-
|
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
|
-
|
37
|
-
|
38
|
-
[:array, [:splat, [:array, [:lit, 1]]]]
|
39
|
-
end
|
26
|
+
parse "[*[1]]" do
|
27
|
+
[:splat, [:array, [:lit, 1]]]
|
40
28
|
end
|
41
29
|
|
42
|
-
|
43
|
-
|
44
|
-
[:array, [:splat, [:lit, 1]]]
|
45
|
-
end
|
30
|
+
parse "[*1]" do
|
31
|
+
[:splat, [:lit, 1]]
|
46
32
|
end
|
47
33
|
|
48
|
-
|
49
|
-
|
50
|
-
[:array, [:array, [:splat, [:lit, 1]]]]
|
51
|
-
end
|
34
|
+
parse "[[*1]]" do
|
35
|
+
[:array, [:splat, [:lit, 1]]]
|
52
36
|
end
|
53
37
|
|
54
|
-
|
55
|
-
|
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
|
-
|
61
|
-
|
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
|
-
|
46
|
+
parse <<-ruby do
|
69
47
|
x = [2]
|
70
48
|
[1, *x]
|
71
49
|
ruby
|
72
50
|
|
73
|
-
|
74
|
-
|
75
|
-
|
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
|
data/spec/attrasgn_spec.rb
CHANGED
@@ -1,112 +1,87 @@
|
|
1
1
|
describe "An Attrasgn node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
y = 0
|
4
4
|
42.method = y
|
5
5
|
ruby
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
-
|
78
|
+
parse <<-ruby do
|
98
79
|
a = []
|
99
80
|
a [42] = 24
|
100
81
|
ruby
|
101
82
|
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|