rubinius-melbourne 2.3.1.0 → 3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rubinius/code/melbourne/.spec_ruby_version +1 -0
- data/ext/rubinius/code/melbourne/Makefile +51 -0
- data/ext/rubinius/code/melbourne/bstrlib.o +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/encoding_compat.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/encoding_compat.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/extconf.rb +2 -2
- data/ext/rubinius/{melbourne → code/melbourne}/grammar.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/grammar.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/grammar.y +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/lex.c.blt +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/melbourne.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/melbourne.hpp +0 -0
- data/ext/rubinius/code/melbourne/namespace.h +3 -0
- data/ext/rubinius/{melbourne → code/melbourne}/node.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/node_types.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/node_types.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/node_types.rb +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/parser_state.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/symbols.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/symbols.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/var_table.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/var_table.hpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/visitor.cpp +0 -0
- data/ext/rubinius/{melbourne → code/melbourne}/visitor.hpp +0 -0
- data/lib/rubinius/code/melbourne/melbourne.bundle +0 -0
- data/lib/rubinius/{melbourne → code/melbourne}/version.rb +1 -1
- data/lib/rubinius/{melbourne.rb → code/melbourne.rb} +2 -2
- metadata +42 -233
- data/.gitignore +0 -24
- data/.travis.yml +0 -7
- data/Gemfile +0 -4
- data/LICENSE +0 -25
- data/README.md +0 -29
- data/Rakefile +0 -46
- data/rubinius-melbourne.gemspec +0 -29
- data/spec/alias_spec.rb +0 -35
- data/spec/and_spec.rb +0 -13
- data/spec/array_spec.rb +0 -75
- data/spec/attrasgn_spec.rb +0 -91
- data/spec/back_ref_spec.rb +0 -9
- data/spec/call_spec.rb +0 -210
- data/spec/case_spec.rb +0 -216
- data/spec/cdecl_spec.rb +0 -51
- data/spec/class_spec.rb +0 -71
- data/spec/colon2_spec.rb +0 -5
- data/spec/colon3_spec.rb +0 -5
- data/spec/const_spec.rb +0 -5
- data/spec/custom/matchers/parse_as.rb +0 -28
- data/spec/custom/runner/relates.rb +0 -87
- data/spec/cvar_spec.rb +0 -23
- data/spec/cvasgn_spec.rb +0 -35
- data/spec/default.mspec +0 -4
- data/spec/defined_spec.rb +0 -119
- data/spec/defn_spec.rb +0 -783
- data/spec/defs_spec.rb +0 -96
- data/spec/dot2_spec.rb +0 -5
- data/spec/dot3_spec.rb +0 -5
- data/spec/dregx_spec.rb +0 -38
- data/spec/dstr_spec.rb +0 -144
- data/spec/dsym_spec.rb +0 -8
- data/spec/dxstr_spec.rb +0 -9
- data/spec/ensure_spec.rb +0 -113
- data/spec/false_spec.rb +0 -5
- data/spec/flip2_spec.rb +0 -75
- data/spec/flip3_spec.rb +0 -25
- data/spec/for_spec.rb +0 -63
- data/spec/gasgn_spec.rb +0 -9
- data/spec/gvar_spec.rb +0 -17
- data/spec/hash_spec.rb +0 -74
- data/spec/iasgn_spec.rb +0 -19
- data/spec/if_spec.rb +0 -101
- data/spec/iter_spec.rb +0 -666
- data/spec/lambda_spec.rb +0 -107
- data/spec/lasgn_spec.rb +0 -320
- data/spec/lit_spec.rb +0 -57
- data/spec/masgn_spec.rb +0 -171
- data/spec/match2_spec.rb +0 -15
- data/spec/match3_spec.rb +0 -20
- data/spec/match_spec.rb +0 -5
- data/spec/module_spec.rb +0 -43
- data/spec/nil_spec.rb +0 -5
- data/spec/not_spec.rb +0 -15
- data/spec/nth_ref_spec.rb +0 -5
- data/spec/op_asgn_spec.rb +0 -206
- data/spec/or_spec.rb +0 -29
- data/spec/postexe_spec.rb +0 -5
- data/spec/regex_spec.rb +0 -20
- data/spec/rescue_spec.rb +0 -357
- data/spec/return_spec.rb +0 -40
- data/spec/sclass_spec.rb +0 -56
- data/spec/spec_helper.rb +0 -8
- data/spec/str_spec.rb +0 -79
- data/spec/super_spec.rb +0 -75
- data/spec/true_spec.rb +0 -5
- data/spec/undef_spec.rb +0 -83
- data/spec/until_spec.rb +0 -48
- data/spec/valias_spec.rb +0 -5
- data/spec/while_spec.rb +0 -113
- data/spec/xstr_spec.rb +0 -5
- data/spec/yield_spec.rb +0 -45
- data/spec/zsuper_spec.rb +0 -37
data/.gitignore
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
*.o
|
2
|
-
*.bundle
|
3
|
-
*.so
|
4
|
-
*.gem
|
5
|
-
*.rbc
|
6
|
-
.bundle
|
7
|
-
.config
|
8
|
-
.yardoc
|
9
|
-
Gemfile.lock
|
10
|
-
InstalledFiles
|
11
|
-
_yardoc
|
12
|
-
coverage
|
13
|
-
doc/
|
14
|
-
lib/bundler/man
|
15
|
-
pkg
|
16
|
-
rdoc
|
17
|
-
spec/reports
|
18
|
-
test/tmp
|
19
|
-
test/version_tmp
|
20
|
-
tmp
|
21
|
-
.rbx
|
22
|
-
Makefile
|
23
|
-
namespace.h
|
24
|
-
.spec_ruby_version
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Copyright (c) 2013, Brian Shirai
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
6
|
-
|
7
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
8
|
-
list of conditions and the following disclaimer.
|
9
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
-
this list of conditions and the following disclaimer in the documentation
|
11
|
-
and/or other materials provided with the distribution.
|
12
|
-
3. Neither the name of the library nor the names of its contributors may be
|
13
|
-
used to endorse or promote products derived from this software without
|
14
|
-
specific prior written permission.
|
15
|
-
|
16
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
-
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT,
|
20
|
-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
21
|
-
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
22
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
23
|
-
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
24
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
25
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Rubinius::Melbourne
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'rubinius-melbourne'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install rubinius-melbourne
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require "bundler/gem_tasks"
|
3
|
-
|
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
|
-
desc "Generate the parser"
|
15
|
-
task :generate do
|
16
|
-
extension_dir { sh "bison -o grammar.cpp grammar.y" }
|
17
|
-
end
|
18
|
-
|
19
|
-
namespace :spec do
|
20
|
-
desc "Clean the parser extension"
|
21
|
-
task :clean do
|
22
|
-
extension_dir do
|
23
|
-
unless File.exist? spec_ruby_version and
|
24
|
-
File.read(spec_ruby_version) == RUBY_DESCRIPTION
|
25
|
-
sh "make distclean" if File.exist? "Makefile"
|
26
|
-
File.open(spec_ruby_version, "w") { |f| f.write RUBY_DESCRIPTION }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "Build the parser extension"
|
32
|
-
task :build => :generate do
|
33
|
-
extension_dir do
|
34
|
-
ruby "-v extconf.rb"
|
35
|
-
ruby "-e 'system %[make && make install]'"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
desc "Run the specs"
|
41
|
-
task :spec => %w[spec:clean spec:build] do
|
42
|
-
ENV['RUBYLIB'] ||= "#{File.join(__dir__, 'lib')}:#{__dir__}"
|
43
|
-
sh "mspec -r spec/spec_helper spec"
|
44
|
-
end
|
45
|
-
|
46
|
-
task :default => :spec
|
data/rubinius-melbourne.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require './lib/rubinius/melbourne/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.authors = ["Brian Shirai"]
|
6
|
-
spec.email = ["brixen@gmail.com"]
|
7
|
-
spec.description = %q{Ruby parser extracted from MRI.}
|
8
|
-
spec.summary = %q{Rubinius Ruby Parser.}
|
9
|
-
spec.homepage = "https://github.com/rubinius/rubinius-melbourne"
|
10
|
-
spec.license = "BSD"
|
11
|
-
|
12
|
-
spec.files = `git ls-files`.split($\)
|
13
|
-
spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
-
spec.extensions = ["ext/rubinius/melbourne/extconf.rb"]
|
15
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
-
spec.name = "rubinius-melbourne"
|
17
|
-
spec.require_paths = ["lib"]
|
18
|
-
spec.version = CodeTools::Melbourne::VERSION
|
19
|
-
|
20
|
-
spec.required_ruby_version = ">= 1.9.2"
|
21
|
-
|
22
|
-
spec.add_development_dependency "rubinius-processor", "~> 2.0"
|
23
|
-
spec.add_development_dependency "rubinius-compiler", "~> 2.0"
|
24
|
-
spec.add_development_dependency "rubinius-ast", "~> 2.0"
|
25
|
-
spec.add_development_dependency "rubinius-bridge", "~> 1.0"
|
26
|
-
spec.add_development_dependency "redcard", "~> 1.0"
|
27
|
-
spec.add_development_dependency "mspec", "~> 1.5"
|
28
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
-
end
|
data/spec/alias_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
describe "An Alias node" do
|
2
|
-
parse <<-ruby do
|
3
|
-
class X
|
4
|
-
alias :y :x
|
5
|
-
end
|
6
|
-
ruby
|
7
|
-
|
8
|
-
[:class, :X, nil, [:scope, [:block, [:alias, [:lit, :y], [:lit, :x]]]]]
|
9
|
-
end
|
10
|
-
|
11
|
-
parse <<-ruby do
|
12
|
-
class X
|
13
|
-
alias y x
|
14
|
-
end
|
15
|
-
ruby
|
16
|
-
|
17
|
-
[:class, :X, nil, [:scope, [:block, [:alias, [:lit, :y], [:lit, :x]]]]]
|
18
|
-
end
|
19
|
-
|
20
|
-
parse <<-ruby do
|
21
|
-
class X
|
22
|
-
alias :"y\#{1}" :"x\#{2}"
|
23
|
-
end
|
24
|
-
ruby
|
25
|
-
|
26
|
-
[:class,
|
27
|
-
:X,
|
28
|
-
nil,
|
29
|
-
[:scope,
|
30
|
-
[:block,
|
31
|
-
[:alias,
|
32
|
-
[:dsym, "y", [:evstr, [:lit, 1]]],
|
33
|
-
[:dsym, "x", [:evstr, [:lit, 2]]]]]]]
|
34
|
-
end
|
35
|
-
end
|
data/spec/and_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
describe "An And node" do
|
2
|
-
parse "(a and b)" do
|
3
|
-
[:and, [:call, nil, :a, [:arglist]], [:call, nil, :b, [:arglist]]]
|
4
|
-
end
|
5
|
-
|
6
|
-
parse "() and a" do
|
7
|
-
[:and, [:nil], [:call, nil, :a, [:arglist]]]
|
8
|
-
end
|
9
|
-
|
10
|
-
parse "a and ()" do
|
11
|
-
[:and, [:call, nil, :a, [:arglist]], [:nil]]
|
12
|
-
end
|
13
|
-
end
|
data/spec/array_spec.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
describe "An Array node" do
|
2
|
-
parse '[1, :b, "c"]' do
|
3
|
-
[:array, [:lit, 1], [:lit, :b], [:str, "c"]]
|
4
|
-
end
|
5
|
-
|
6
|
-
parse "%w[a b c]" do
|
7
|
-
[:array, [:str, "a"], [:str, "b"], [:str, "c"]]
|
8
|
-
end
|
9
|
-
|
10
|
-
parse '%w[a #{@b} c]' do
|
11
|
-
[:array, [:str, "a"], [:str, "\#{@b}"], [:str, "c"]]
|
12
|
-
end
|
13
|
-
|
14
|
-
parse "%W[a b c]" do
|
15
|
-
[:array,
|
16
|
-
[:str, "a"], [:str, "b"], [:str, "c"]]
|
17
|
-
end
|
18
|
-
|
19
|
-
parse '%W[a #{@b} c]' do
|
20
|
-
[:array,
|
21
|
-
[:str, "a"],
|
22
|
-
[:dstr, "", [:evstr, [:ivar, :@b]]],
|
23
|
-
[:str, "c"]]
|
24
|
-
end
|
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
|
-
|
46
|
-
parse "[*[1]]" do
|
47
|
-
[:splat, [:array, [:lit, 1]]]
|
48
|
-
end
|
49
|
-
|
50
|
-
parse "[*1]" do
|
51
|
-
[:splat, [:lit, 1]]
|
52
|
-
end
|
53
|
-
|
54
|
-
parse "[[*1]]" do
|
55
|
-
[:array, [:splat, [:lit, 1]]]
|
56
|
-
end
|
57
|
-
|
58
|
-
parse "[1, *2]" do
|
59
|
-
[:argscat, [:array, [:lit, 1]], [:lit, 2]]
|
60
|
-
end
|
61
|
-
|
62
|
-
parse "[1, *c()]" do
|
63
|
-
[:argscat, [:array, [:lit, 1]], [:call, nil, :c, [:arglist]]]
|
64
|
-
end
|
65
|
-
|
66
|
-
parse <<-ruby do
|
67
|
-
x = [2]
|
68
|
-
[1, *x]
|
69
|
-
ruby
|
70
|
-
|
71
|
-
[:block,
|
72
|
-
[:lasgn, :x, [:array, [:lit, 2]]],
|
73
|
-
[:argscat, [:array, [:lit, 1]], [:lvar, :x]]]
|
74
|
-
end
|
75
|
-
end
|
data/spec/attrasgn_spec.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
describe "An Attrasgn node" do
|
2
|
-
parse <<-ruby do
|
3
|
-
y = 0
|
4
|
-
42.method = y
|
5
|
-
ruby
|
6
|
-
|
7
|
-
[:block,
|
8
|
-
[:lasgn, :y, [:lit, 0]],
|
9
|
-
[:attrasgn, [:lit, 42], :method=, [:arglist, [:lvar, :y]]]]
|
10
|
-
end
|
11
|
-
|
12
|
-
parse "a.m = *[1]" do
|
13
|
-
[:attrasgn,
|
14
|
-
[:call, nil, :a, [:arglist]],
|
15
|
-
:m=,
|
16
|
-
[:arglist, [:splat, [:array, [:lit, 1]]]]]
|
17
|
-
end
|
18
|
-
|
19
|
-
parse "a[*b] = c" do
|
20
|
-
[:attrasgn,
|
21
|
-
[:call, nil, :a, [:arglist]],
|
22
|
-
:[]=,
|
23
|
-
[:arglist,
|
24
|
-
[:argspush,
|
25
|
-
[:splat, [:call, nil, :b, [:arglist]]],
|
26
|
-
[:call, nil, :c, [:arglist]]]]]
|
27
|
-
end
|
28
|
-
|
29
|
-
parse "a[b, *c] = d" do
|
30
|
-
[:attrasgn,
|
31
|
-
[:call, nil, :a, [:arglist]],
|
32
|
-
:[]=,
|
33
|
-
[:arglist,
|
34
|
-
[:argspush,
|
35
|
-
[:argscat,
|
36
|
-
[:array, [:call, nil, :b, [:arglist]]],
|
37
|
-
[:call, nil, :c, [:arglist]]],
|
38
|
-
[:call, nil, :d, [:arglist]]]]]
|
39
|
-
end
|
40
|
-
|
41
|
-
parse "a[b, *c] = *d" do
|
42
|
-
[:attrasgn,
|
43
|
-
[:call, nil, :a, [:arglist]],
|
44
|
-
:[]=,
|
45
|
-
[:arglist,
|
46
|
-
[:argspush,
|
47
|
-
[:argscat,
|
48
|
-
[:array, [:call, nil, :b, [:arglist]]],
|
49
|
-
[:call, nil, :c, [:arglist]]],
|
50
|
-
[:splat, [:call, nil, :d, [:arglist]]]]]]
|
51
|
-
end
|
52
|
-
|
53
|
-
parse "a[b, *c] = d, e" do
|
54
|
-
[:attrasgn,
|
55
|
-
[:call, nil, :a, [:arglist]],
|
56
|
-
:[]=,
|
57
|
-
[:arglist,
|
58
|
-
[:argspush,
|
59
|
-
[:argscat,
|
60
|
-
[:array, [:call, nil, :b, [:arglist]]],
|
61
|
-
[:call, nil, :c, [:arglist]]],
|
62
|
-
[:array, [:call, nil, :d, [:arglist]], [:call, nil, :e, [:arglist]]]]]]
|
63
|
-
end
|
64
|
-
|
65
|
-
parse "a[42] = 24" do
|
66
|
-
[:attrasgn,
|
67
|
-
[:call, nil, :a, [:arglist]],
|
68
|
-
:[]=,
|
69
|
-
[:arglist, [:lit, 42], [:lit, 24]]]
|
70
|
-
end
|
71
|
-
|
72
|
-
parse "self[index, 0] = other_string" do
|
73
|
-
[:attrasgn,
|
74
|
-
nil,
|
75
|
-
:[]=,
|
76
|
-
[:arglist,
|
77
|
-
[:call, nil, :index, [:arglist]],
|
78
|
-
[:lit, 0],
|
79
|
-
[:call, nil, :other_string, [:arglist]]]]
|
80
|
-
end
|
81
|
-
|
82
|
-
parse <<-ruby do
|
83
|
-
a = []
|
84
|
-
a [42] = 24
|
85
|
-
ruby
|
86
|
-
|
87
|
-
[:block,
|
88
|
-
[:lasgn, :a, [:array]],
|
89
|
-
[:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lit, 42], [:lit, 24]]]]
|
90
|
-
end
|
91
|
-
end
|
data/spec/back_ref_spec.rb
DELETED
data/spec/call_spec.rb
DELETED
@@ -1,210 +0,0 @@
|
|
1
|
-
describe "A Call node" do
|
2
|
-
parse "self.method" do
|
3
|
-
[:call, [:self], :method, [:arglist]]
|
4
|
-
end
|
5
|
-
|
6
|
-
parse "1.m(2)" do
|
7
|
-
[:call, [:lit, 1], :m, [:arglist, [:lit, 2]]]
|
8
|
-
end
|
9
|
-
|
10
|
-
parse "h(1, 2, *a)" do
|
11
|
-
[:call, nil, :h,
|
12
|
-
[:arglist,
|
13
|
-
[:lit, 1],
|
14
|
-
[:lit, 2],
|
15
|
-
[:splat, [:call, nil, :a, [:arglist]]]]]
|
16
|
-
end
|
17
|
-
|
18
|
-
parse <<-ruby do
|
19
|
-
begin
|
20
|
-
(1 + 1)
|
21
|
-
end
|
22
|
-
ruby
|
23
|
-
|
24
|
-
[:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]
|
25
|
-
end
|
26
|
-
|
27
|
-
parse "blah(*a)" do
|
28
|
-
[:call, nil, :blah,
|
29
|
-
[:arglist, [:splat, [:call, nil, :a, [:arglist]]]]]
|
30
|
-
end
|
31
|
-
|
32
|
-
parse "a.b(&c)" do
|
33
|
-
[:call,
|
34
|
-
[:call, nil, :a, [:arglist]],
|
35
|
-
:b,
|
36
|
-
[:arglist, [:block_pass, [:call, nil, :c, [:arglist]]]]]
|
37
|
-
end
|
38
|
-
|
39
|
-
parse "a.b(4, &c)" do
|
40
|
-
[:call,
|
41
|
-
[:call, nil, :a, [:arglist]],
|
42
|
-
:b,
|
43
|
-
[:arglist, [:lit, 4], [:block_pass, [:call, nil, :c, [:arglist]]]]]
|
44
|
-
end
|
45
|
-
|
46
|
-
parse "a.b(1, 2, 3, &c)" do
|
47
|
-
[:call,
|
48
|
-
[:call, nil, :a, [:arglist]],
|
49
|
-
:b,
|
50
|
-
[:arglist,
|
51
|
-
[:lit, 1],
|
52
|
-
[:lit, 2],
|
53
|
-
[:lit, 3],
|
54
|
-
[:block_pass, [:call, nil, :c, [:arglist]]]]]
|
55
|
-
end
|
56
|
-
|
57
|
-
parse "a(&b)" do
|
58
|
-
[:call,
|
59
|
-
nil,
|
60
|
-
:a,
|
61
|
-
[:arglist, [:block_pass, [:call, nil, :b, [:arglist]]]]]
|
62
|
-
end
|
63
|
-
|
64
|
-
parse "a(4, &b)" do
|
65
|
-
[:call,
|
66
|
-
nil,
|
67
|
-
:a,
|
68
|
-
[:arglist, [:lit, 4], [:block_pass, [:call, nil, :b, [:arglist]]]]]
|
69
|
-
end
|
70
|
-
|
71
|
-
parse "a(1, 2, 3, &b)" do
|
72
|
-
[:call,
|
73
|
-
nil,
|
74
|
-
:a,
|
75
|
-
[:arglist,
|
76
|
-
[:lit, 1],
|
77
|
-
[:lit, 2],
|
78
|
-
[:lit, 3],
|
79
|
-
[:block_pass, [:call, nil, :b, [:arglist]]]]]
|
80
|
-
end
|
81
|
-
|
82
|
-
parse "define_attr_method(:x, :sequence_name, &Proc.new { |*args| nil })" do
|
83
|
-
[:call,
|
84
|
-
nil,
|
85
|
-
:define_attr_method,
|
86
|
-
[:arglist,
|
87
|
-
[:lit, :x],
|
88
|
-
[:lit, :sequence_name],
|
89
|
-
[:block_pass,
|
90
|
-
[:call,
|
91
|
-
[:const, :Proc],
|
92
|
-
:new,
|
93
|
-
[:arglist, [:iter, [:args, :"*args"], [:nil]]]]]]]
|
94
|
-
end
|
95
|
-
|
96
|
-
parse "r.read_body(dest, &block)" do
|
97
|
-
[:call,
|
98
|
-
[:call, nil, :r, [:arglist]],
|
99
|
-
:read_body,
|
100
|
-
[:arglist,
|
101
|
-
[:call, nil, :dest, [:arglist]],
|
102
|
-
[:block_pass, [:call, nil, :block, [:arglist]]]]]
|
103
|
-
end
|
104
|
-
|
105
|
-
parse "o.m(:a => 1, :b => 2)" do
|
106
|
-
[:call,
|
107
|
-
[:call, nil, :o, [:arglist]],
|
108
|
-
:m,
|
109
|
-
[:arglist, [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
|
110
|
-
end
|
111
|
-
|
112
|
-
parse "o.m(42, :a => 1, :b => 2)" do
|
113
|
-
[:call,
|
114
|
-
[:call, nil, :o, [:arglist]],
|
115
|
-
:m,
|
116
|
-
[:arglist,
|
117
|
-
[:lit, 42],
|
118
|
-
[:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
|
119
|
-
end
|
120
|
-
|
121
|
-
parse "o.puts(42)" do
|
122
|
-
[:call, [:call, nil, :o, [:arglist]], :puts, [:arglist, [:lit, 42]]]
|
123
|
-
end
|
124
|
-
|
125
|
-
parse "1.b(c)" do
|
126
|
-
[:call, [:lit, 1], :b, [:arglist, [:call, nil, :c, [:arglist]]]]
|
127
|
-
end
|
128
|
-
|
129
|
-
parse "(v = (1 + 1)).zero?" do
|
130
|
-
[:call,
|
131
|
-
[:lasgn, :v, [:call, [:lit, 1], :+, [:arglist, [:lit, 1]]]],
|
132
|
-
:zero?,
|
133
|
-
[:arglist]]
|
134
|
-
end
|
135
|
-
|
136
|
-
parse "-2**31" do
|
137
|
-
[:call,
|
138
|
-
[:call, [:lit, 2], :**, [:arglist, [:lit, 31]]],
|
139
|
-
:-@,
|
140
|
-
[:arglist]]
|
141
|
-
end
|
142
|
-
|
143
|
-
parse "a[]" do
|
144
|
-
[:call, [:call, nil, :a, [:arglist]], :[], [:arglist]]
|
145
|
-
end
|
146
|
-
|
147
|
-
parse "m(:a => 1, :b => 2)" do
|
148
|
-
[:call,
|
149
|
-
nil,
|
150
|
-
:m,
|
151
|
-
[:arglist, [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
|
152
|
-
end
|
153
|
-
|
154
|
-
parse "m(42, :a => 1, :b => 2)" do
|
155
|
-
[:call,
|
156
|
-
nil,
|
157
|
-
:m,
|
158
|
-
[:arglist, [:lit, 42], [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]]]
|
159
|
-
end
|
160
|
-
|
161
|
-
parse "m(42)" do
|
162
|
-
[:call, nil, :m, [:arglist, [:lit, 42]]]
|
163
|
-
end
|
164
|
-
|
165
|
-
parse "a(:b) { :c }" do
|
166
|
-
[:call, nil, :a, [:arglist, [:lit, :b], [:iter, [:args], [:lit, :c]]]]
|
167
|
-
end
|
168
|
-
|
169
|
-
parse "a [42]" do
|
170
|
-
[:call, nil, :a, [:arglist, [:array, [:lit, 42]]]]
|
171
|
-
end
|
172
|
-
|
173
|
-
parse "42 if block_given?" do
|
174
|
-
[:if, [:call, nil, :block_given?, [:arglist]], [:lit, 42], nil]
|
175
|
-
end
|
176
|
-
|
177
|
-
parse "method" do
|
178
|
-
[:call, nil, :method, [:arglist]]
|
179
|
-
end
|
180
|
-
|
181
|
-
parse <<-ruby do
|
182
|
-
a << begin
|
183
|
-
b
|
184
|
-
rescue
|
185
|
-
c
|
186
|
-
end
|
187
|
-
ruby
|
188
|
-
|
189
|
-
[:call,
|
190
|
-
[:call, nil, :a, [:arglist]],
|
191
|
-
:<<,
|
192
|
-
[:arglist,
|
193
|
-
[:rescue,
|
194
|
-
[:call, nil, :b, [:arglist]],
|
195
|
-
[:resbody,
|
196
|
-
[:array, [:const, :StandardError]],
|
197
|
-
[:call, nil, :c, [:arglist]]]]]]
|
198
|
-
end
|
199
|
-
|
200
|
-
parse "meth([*[1]])" do
|
201
|
-
[:call,
|
202
|
-
nil,
|
203
|
-
:meth,
|
204
|
-
[:arglist, [:splat, [:array, [:lit, 1]]]]]
|
205
|
-
end
|
206
|
-
|
207
|
-
parse "meth(*[1])" do
|
208
|
-
[:call, nil, :meth, [:arglist, [:splat, [:array, [:lit, 1]]]]]
|
209
|
-
end
|
210
|
-
end
|