rubex 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CONTRIBUTING.md +73 -9
- data/HISTORY.md +19 -0
- data/README.md +53 -8
- data/REFERENCE.md +112 -44
- data/benchmarks/no_gil/no_gil.rb +24 -0
- data/benchmarks/no_gil/no_gil.rubex +22 -0
- data/bin/rubex +1 -1
- data/examples/c_struct_interface/c_struct_interface.rubex +1 -0
- data/lib/rubex.rb +1 -0
- data/lib/rubex/ast.rb +11 -7
- data/lib/rubex/ast/expression.rb +1 -1
- data/lib/rubex/ast/expression/actual_arg_list.rb +7 -0
- data/lib/rubex/ast/expression/analysed_element_ref/c_var_element_ref.rb +5 -2
- data/lib/rubex/ast/expression/analysed_element_ref/ruby_object_element_ref.rb +26 -9
- data/lib/rubex/ast/expression/binary/binary_boolean.rb +1 -1
- data/lib/rubex/ast/expression/binary/binary_expo.rb +34 -0
- data/lib/rubex/ast/expression/binary/colon2.rb +34 -0
- data/lib/rubex/ast/expression/binary/empty_classes.rb +0 -3
- data/lib/rubex/ast/expression/command_call.rb +24 -0
- data/lib/rubex/ast/{statement → expression/command_call}/print.rb +4 -5
- data/lib/rubex/ast/{statement → expression/command_call}/raise.rb +29 -24
- data/lib/rubex/ast/expression/command_call/require.rb +27 -0
- data/lib/rubex/ast/expression/command_call/yield.rb +36 -0
- data/lib/rubex/ast/expression/element_ref.rb +10 -5
- data/lib/rubex/ast/expression/instance_var.rb +33 -0
- data/lib/rubex/ast/expression/method_call.rb +4 -2
- data/lib/rubex/ast/expression/method_call/c_function_call.rb +4 -3
- data/lib/rubex/ast/expression/method_call/ruby_method_call.rb +7 -5
- data/lib/rubex/ast/expression/name.rb +10 -1
- data/lib/rubex/ast/expression/ruby_object_element_ref/ruby_array_element_ref.rb +5 -2
- data/lib/rubex/ast/expression/ruby_object_element_ref/ruby_hash_element_ref.rb +10 -2
- data/lib/rubex/ast/expression/to_ruby_object.rb +1 -0
- data/lib/rubex/ast/expression/unary.rb +7 -3
- data/lib/rubex/ast/expression/unary_base/ampersand.rb +5 -0
- data/lib/rubex/ast/node.rb +213 -185
- data/lib/rubex/ast/node/file_node.rb +25 -0
- data/lib/rubex/ast/node/main_node.rb +56 -0
- data/lib/rubex/ast/statement/begin_block/begin.rb +4 -3
- data/lib/rubex/ast/statement/c_array_decl.rb +1 -1
- data/lib/rubex/ast/statement/c_ptr_decl.rb +2 -0
- data/lib/rubex/ast/statement/no_gil_block.rb +70 -0
- data/lib/rubex/ast/statement/return.rb +1 -0
- data/lib/rubex/ast/top_statement.rb +1 -1
- data/lib/rubex/ast/top_statement/klass.rb +4 -0
- data/lib/rubex/ast/top_statement/klass/attached_klass.rb +88 -10
- data/lib/rubex/ast/top_statement/method_def.rb +2 -3
- data/lib/rubex/ast/top_statement/method_def/c_function_def.rb +10 -4
- data/lib/rubex/cli.rb +11 -6
- data/lib/rubex/code_supervisor.rb +49 -0
- data/lib/rubex/code_writer.rb +22 -1
- data/lib/rubex/compiler.rb +109 -30
- data/lib/rubex/compiler_config.rb +14 -1
- data/lib/rubex/constants.rb +3 -0
- data/lib/rubex/data_type.rb +2 -3
- data/lib/rubex/data_type/ruby_object/ruby_symbol.rb +0 -1
- data/lib/rubex/error.rb +4 -0
- data/lib/rubex/helpers/writers.rb +33 -4
- data/lib/rubex/lexer.rex +9 -1
- data/lib/rubex/lexer.rex.rb +15 -2
- data/lib/rubex/parser.racc +125 -49
- data/lib/rubex/parser.racc.rb +1526 -1376
- data/lib/rubex/rake_task.rb +42 -6
- data/lib/rubex/symbol_table/entry.rb +6 -0
- data/lib/rubex/symbol_table/scope.rb +28 -3
- data/lib/rubex/version.rb +1 -1
- data/rubex.gemspec +1 -0
- data/spec/basic_ruby_method_spec.rb +2 -2
- data/spec/blocks_spec.rb +2 -2
- data/spec/box_op_multi_args_spec.rb +34 -0
- data/spec/c_function_ptrs_spec.rb +2 -2
- data/spec/c_functions_spec.rb +2 -0
- data/spec/c_struct_interface_spec.rb +8 -3
- data/spec/default_args_spec.rb +2 -2
- data/spec/external_c_struct_spec.rb +33 -0
- data/spec/fixtures/api/consumer.rubex +0 -0
- data/spec/fixtures/api/implementation.rubex +0 -0
- data/spec/fixtures/api/implementation.rubexd +0 -0
- data/spec/fixtures/box_op_multi_args/box_op_multi_args.rubex +3 -0
- data/spec/fixtures/c_functions/c_functions.rubex +13 -0
- data/spec/fixtures/c_struct_interface/c_struct_interface.rubex +28 -0
- data/spec/fixtures/class_methods/class_methods.rubex +1 -1
- data/spec/fixtures/error_handling/error_handling.rubex +2 -2
- data/spec/fixtures/external_c_struct/external_c_struct.rubex +16 -0
- data/spec/fixtures/if_else/if_else.rubex +1 -1
- data/spec/fixtures/init_ruby_objects_with_literal_syntax/init_ruby_objects_with_literal_syntax.rubex +1 -1
- data/spec/fixtures/instance_variables/instance_variables.rubex +25 -0
- data/spec/fixtures/loops/loops.rubex +2 -2
- data/spec/fixtures/module/module.rubex +28 -0
- data/spec/fixtures/multi_file_programs/Rakefile +8 -0
- data/spec/fixtures/multi_file_programs/a.rubex +5 -0
- data/spec/fixtures/multi_file_programs/b.rubex +5 -0
- data/spec/fixtures/multi_file_programs/multi_file_programs.rubex +14 -0
- data/spec/fixtures/no_gil/no_gil.rubex +24 -0
- data/spec/fixtures/no_gil_attach_class/no_gil_attach_class.rubex +23 -0
- data/spec/fixtures/no_gil_compile_check/no_gil_compile_check.rubex +4 -0
- data/spec/fixtures/outside_stmts/outside_stmts.rubex +6 -0
- data/spec/fixtures/pow/pow.rubex +4 -0
- data/spec/fixtures/rake_task/single_file/test.rubex +3 -0
- data/spec/fixtures/recursion/recursion.rubex +1 -1
- data/spec/fixtures/ruby_constant_scoping/ruby_constant_scoping.rubex +7 -0
- data/spec/fixtures/ruby_operators/ruby_operators.rubex +1 -1
- data/spec/fixtures/ruby_raise/ruby_raise.rubex +2 -2
- data/spec/fixtures/ruby_types/ruby_types.rubex +4 -4
- data/spec/fixtures/statement_expression/statement_expression.rubex +2 -2
- data/spec/fixtures/static_array/static_array.rubex +3 -3
- data/spec/fixtures/string_literals/string_literals.rubex +12 -2
- data/spec/fixtures/struct/struct.rubex +1 -1
- data/spec/fixtures/var_declarations/var_declarations.rubex +1 -1
- data/spec/implicit_lib_include_spec.rb +2 -2
- data/spec/init_ruby_objects_with_literal_syntax_spec.rb +2 -2
- data/spec/instance_variables_spec.rb +33 -0
- data/spec/loops_spec.rb +2 -2
- data/spec/module_spec.rb +39 -0
- data/spec/multi_file_programs_spec.rb +41 -0
- data/spec/no_gil_attach_class_spec.rb +33 -0
- data/spec/no_gil_compile_check_spec.rb +25 -0
- data/spec/no_gil_spec.rb +36 -0
- data/spec/outside_stmts_spec.rb +34 -0
- data/spec/pow_spec.rb +33 -0
- data/spec/rake_task_spec.rb +142 -0
- data/spec/recursion_spec.rb +4 -4
- data/spec/ruby_constant_scoping_spec.rb +42 -0
- data/spec/ruby_raise_spec.rb +2 -2
- data/spec/ruby_symbols_spec.rb +2 -2
- data/spec/ruby_types_spec.rb +2 -2
- data/spec/spec_helper.rb +17 -3
- data/spec/string_literals_spec.rb +1 -0
- metadata +90 -6
- data/lib/rubex/ast/statement/yield.rb +0 -41
data/spec/ruby_raise_spec.rb
CHANGED
@@ -14,13 +14,13 @@ describe Rubex do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
context ".compile"
|
17
|
+
context ".compile" do
|
18
18
|
it "compiles to valid C file" do
|
19
19
|
t,c,e = Rubex::Compiler.compile(@path + '.rubex', test: true)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
context "Black box testing"
|
23
|
+
context "Black box testing" do
|
24
24
|
it "compiles and checks for valid output" do
|
25
25
|
setup_and_teardown_compiled_files(test_case) do |dir|
|
26
26
|
require_relative "#{dir}/#{test_case}.#{os_extension}"
|
data/spec/ruby_symbols_spec.rb
CHANGED
@@ -14,13 +14,13 @@ describe Rubex do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
context ".compile"
|
17
|
+
context ".compile" do
|
18
18
|
it "compiles to valid C file" do
|
19
19
|
t,c,e = Rubex::Compiler.compile(@path + '.rubex', test: true)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
context "Black box testing"
|
23
|
+
context "Black box testing" do
|
24
24
|
it "compiles and checks for valid output" do
|
25
25
|
setup_and_teardown_compiled_files(test_case) do |dir|
|
26
26
|
require_relative "#{dir}/#{test_case}.#{os_extension}"
|
data/spec/ruby_types_spec.rb
CHANGED
@@ -14,13 +14,13 @@ describe Rubex do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
context ".compile"
|
17
|
+
context ".compile" do
|
18
18
|
it "compiles to valid C file" do
|
19
19
|
t,c,e = Rubex::Compiler.compile(@path + '.rubex', test: true)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
context "Black Box testing"
|
23
|
+
context "Black Box testing" do
|
24
24
|
it "compiles and checks for valid output" do
|
25
25
|
setup_and_teardown_compiled_files(test_case) do |dir|
|
26
26
|
require_relative "#{dir}/#{test_case}.#{os_extension}"
|
data/spec/spec_helper.rb
CHANGED
@@ -33,7 +33,7 @@ def generate_shared_object test_case, example=nil
|
|
33
33
|
path = path_str test_case, example
|
34
34
|
dir = dir_str test_case, example
|
35
35
|
|
36
|
-
Rubex::Compiler.compile(path + '.rubex',
|
36
|
+
Rubex::Compiler.compile(path + '.rubex', target_dir: dir)
|
37
37
|
Dir.chdir(dir) do
|
38
38
|
`ruby extconf.rb`
|
39
39
|
`make`
|
@@ -44,7 +44,9 @@ def delete_generated_files test_case, example=nil
|
|
44
44
|
dir = dir_str test_case, example
|
45
45
|
test_case = example if example
|
46
46
|
Dir.chdir(dir) do
|
47
|
-
FileUtils.rm(
|
47
|
+
FileUtils.rm(
|
48
|
+
Dir.glob("*.{c,h,so,o,bundle,dll}") + ["Makefile", "extconf.rb"],
|
49
|
+
force: true)
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
@@ -58,11 +60,23 @@ def setup_and_teardown_compiled_files test_case, example=nil, &block
|
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
63
|
+
def setup_and_teardown_multiple_compiled_files test_case, source_dir, t_dir, files, &block
|
64
|
+
Rubex::Compiler.compile(test_case, source_dir: source_dir, files: files,
|
65
|
+
target_dir: t_dir, make: true)
|
66
|
+
begin
|
67
|
+
block.call(t_dir)
|
68
|
+
ensure
|
69
|
+
Dir.chdir(t_dir) do
|
70
|
+
FileUtils.rm(
|
71
|
+
Dir.glob("#{t_dir}/*.{c,h,so,o,bundle,dll}") + ["Makefile", "extconf.rb"], force: true)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
61
76
|
def expect_compiled_code code, path
|
62
77
|
expect(code.to_s).to eq(File.read(path))
|
63
78
|
end
|
64
79
|
|
65
|
-
|
66
80
|
def detect_os
|
67
81
|
@os ||= (
|
68
82
|
host_os = RbConfig::CONFIG['host_os']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sameer Deshmukh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: numo-narray
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
description: |
|
182
196
|
A Ruby-like language for writing Ruby C extensions.
|
183
197
|
|
@@ -199,6 +213,8 @@ files:
|
|
199
213
|
- REFERENCE.md
|
200
214
|
- Rakefile
|
201
215
|
- TUTORIAL.md
|
216
|
+
- benchmarks/no_gil/no_gil.rb
|
217
|
+
- benchmarks/no_gil/no_gil.rubex
|
202
218
|
- bin/rubex
|
203
219
|
- docs/_config.yml
|
204
220
|
- docs/index.html
|
@@ -233,16 +249,23 @@ files:
|
|
233
249
|
- lib/rubex/ast/expression/binary.rb
|
234
250
|
- lib/rubex/ast/expression/binary/binary_boolean.rb
|
235
251
|
- lib/rubex/ast/expression/binary/binary_boolean_special_op.rb
|
252
|
+
- lib/rubex/ast/expression/binary/binary_expo.rb
|
253
|
+
- lib/rubex/ast/expression/binary/colon2.rb
|
236
254
|
- lib/rubex/ast/expression/binary/empty_classes.rb
|
237
255
|
- lib/rubex/ast/expression/block_given.rb
|
238
256
|
- lib/rubex/ast/expression/coerce_object.rb
|
239
257
|
- lib/rubex/ast/expression/command_call.rb
|
258
|
+
- lib/rubex/ast/expression/command_call/print.rb
|
259
|
+
- lib/rubex/ast/expression/command_call/raise.rb
|
260
|
+
- lib/rubex/ast/expression/command_call/require.rb
|
240
261
|
- lib/rubex/ast/expression/command_call/struct_or_union_member_call.rb
|
262
|
+
- lib/rubex/ast/expression/command_call/yield.rb
|
241
263
|
- lib/rubex/ast/expression/element_ref.rb
|
242
264
|
- lib/rubex/ast/expression/empty.rb
|
243
265
|
- lib/rubex/ast/expression/from_ruby_object.rb
|
244
266
|
- lib/rubex/ast/expression/func_ptr_arg_declaration.rb
|
245
267
|
- lib/rubex/ast/expression/func_ptr_internal_arg_declaration.rb
|
268
|
+
- lib/rubex/ast/expression/instance_var.rb
|
246
269
|
- lib/rubex/ast/expression/literal.rb
|
247
270
|
- lib/rubex/ast/expression/literal/array_lit.rb
|
248
271
|
- lib/rubex/ast/expression/literal/c_null.rb
|
@@ -275,6 +298,8 @@ files:
|
|
275
298
|
- lib/rubex/ast/expression/unary_base/unary_not.rb
|
276
299
|
- lib/rubex/ast/expression/unary_base/unary_sub.rb
|
277
300
|
- lib/rubex/ast/node.rb
|
301
|
+
- lib/rubex/ast/node/file_node.rb
|
302
|
+
- lib/rubex/ast/node/main_node.rb
|
278
303
|
- lib/rubex/ast/statement.rb
|
279
304
|
- lib/rubex/ast/statement/alias.rb
|
280
305
|
- lib/rubex/ast/statement/argument_list.rb
|
@@ -298,12 +323,10 @@ files:
|
|
298
323
|
- lib/rubex/ast/statement/if_block/else.rb
|
299
324
|
- lib/rubex/ast/statement/if_block/elsif.rb
|
300
325
|
- lib/rubex/ast/statement/if_block/helper.rb
|
301
|
-
- lib/rubex/ast/statement/
|
302
|
-
- lib/rubex/ast/statement/raise.rb
|
326
|
+
- lib/rubex/ast/statement/no_gil_block.rb
|
303
327
|
- lib/rubex/ast/statement/return.rb
|
304
328
|
- lib/rubex/ast/statement/var_decl.rb
|
305
329
|
- lib/rubex/ast/statement/while.rb
|
306
|
-
- lib/rubex/ast/statement/yield.rb
|
307
330
|
- lib/rubex/ast/top_statement.rb
|
308
331
|
- lib/rubex/ast/top_statement/c_bindings.rb
|
309
332
|
- lib/rubex/ast/top_statement/klass.rb
|
@@ -312,6 +335,7 @@ files:
|
|
312
335
|
- lib/rubex/ast/top_statement/method_def/c_function_def.rb
|
313
336
|
- lib/rubex/ast/top_statement/method_def/ruby_method_def.rb
|
314
337
|
- lib/rubex/cli.rb
|
338
|
+
- lib/rubex/code_supervisor.rb
|
315
339
|
- lib/rubex/code_writer.rb
|
316
340
|
- lib/rubex/compiler.rb
|
317
341
|
- lib/rubex/compiler_config.rb
|
@@ -378,6 +402,7 @@ files:
|
|
378
402
|
- spec/binding_ptr_args_spec.rb
|
379
403
|
- spec/bitwise_operators_spec.rb
|
380
404
|
- spec/blocks_spec.rb
|
405
|
+
- spec/box_op_multi_args_spec.rb
|
381
406
|
- spec/c_bindings_spec.rb
|
382
407
|
- spec/c_constants_spec.rb
|
383
408
|
- spec/c_function_ptrs_spec.rb
|
@@ -392,10 +417,15 @@ files:
|
|
392
417
|
- spec/error_handling_spec.rb
|
393
418
|
- spec/examples_spec.rb
|
394
419
|
- spec/expressions_spec.rb
|
420
|
+
- spec/external_c_struct_spec.rb
|
421
|
+
- spec/fixtures/api/consumer.rubex
|
422
|
+
- spec/fixtures/api/implementation.rubex
|
423
|
+
- spec/fixtures/api/implementation.rubexd
|
395
424
|
- spec/fixtures/basic_ruby_method/basic_ruby_method.rubex
|
396
425
|
- spec/fixtures/binding_ptr_args/binding_ptr_args.rubex
|
397
426
|
- spec/fixtures/bitwise_operators/bitwise_operators.rubex
|
398
427
|
- spec/fixtures/blocks/blocks.rubex
|
428
|
+
- spec/fixtures/box_op_multi_args/box_op_multi_args.rubex
|
399
429
|
- spec/fixtures/c_bindings/c_bindings.rubex
|
400
430
|
- spec/fixtures/c_constants/c_constants.rubex
|
401
431
|
- spec/fixtures/c_function_ptrs/c_function_ptrs.rubex
|
@@ -412,12 +442,26 @@ files:
|
|
412
442
|
- spec/fixtures/examples/rcsv.csv
|
413
443
|
- spec/fixtures/examples/rcsv.rubex
|
414
444
|
- spec/fixtures/expressions/expressions.rubex
|
445
|
+
- spec/fixtures/external_c_struct/external_c_struct.rubex
|
415
446
|
- spec/fixtures/if_else/if_else.rubex
|
416
447
|
- spec/fixtures/implicit_lib_include/implicit_lib_include.rubex
|
417
448
|
- spec/fixtures/init_ruby_objects_with_literal_syntax/init_ruby_objects_with_literal_syntax.rubex
|
449
|
+
- spec/fixtures/instance_variables/instance_variables.rubex
|
418
450
|
- spec/fixtures/loops/loops.rubex
|
451
|
+
- spec/fixtures/module/module.rubex
|
452
|
+
- spec/fixtures/multi_file_programs/Rakefile
|
453
|
+
- spec/fixtures/multi_file_programs/a.rubex
|
454
|
+
- spec/fixtures/multi_file_programs/b.rubex
|
455
|
+
- spec/fixtures/multi_file_programs/multi_file_programs.rubex
|
456
|
+
- spec/fixtures/no_gil/no_gil.rubex
|
457
|
+
- spec/fixtures/no_gil_attach_class/no_gil_attach_class.rubex
|
458
|
+
- spec/fixtures/no_gil_compile_check/no_gil_compile_check.rubex
|
459
|
+
- spec/fixtures/outside_stmts/outside_stmts.rubex
|
460
|
+
- spec/fixtures/pow/pow.rubex
|
461
|
+
- spec/fixtures/rake_task/single_file/test.rubex
|
419
462
|
- spec/fixtures/recursion/recursion.rubex
|
420
463
|
- spec/fixtures/ruby_constant_method_calls/ruby_constant_method_calls.rubex
|
464
|
+
- spec/fixtures/ruby_constant_scoping/ruby_constant_scoping.rubex
|
421
465
|
- spec/fixtures/ruby_operators/ruby_operators.rubex
|
422
466
|
- spec/fixtures/ruby_raise/ruby_raise.rubex
|
423
467
|
- spec/fixtures/ruby_strings/ruby_strings.rubex
|
@@ -434,9 +478,19 @@ files:
|
|
434
478
|
- spec/if_else_spec.rb
|
435
479
|
- spec/implicit_lib_include_spec.rb
|
436
480
|
- spec/init_ruby_objects_with_literal_syntax_spec.rb
|
481
|
+
- spec/instance_variables_spec.rb
|
437
482
|
- spec/loops_spec.rb
|
483
|
+
- spec/module_spec.rb
|
484
|
+
- spec/multi_file_programs_spec.rb
|
485
|
+
- spec/no_gil_attach_class_spec.rb
|
486
|
+
- spec/no_gil_compile_check_spec.rb
|
487
|
+
- spec/no_gil_spec.rb
|
488
|
+
- spec/outside_stmts_spec.rb
|
489
|
+
- spec/pow_spec.rb
|
490
|
+
- spec/rake_task_spec.rb
|
438
491
|
- spec/recursion_spec.rb
|
439
492
|
- spec/ruby_constant_method_calls_spec.rb
|
493
|
+
- spec/ruby_constant_scoping_spec.rb
|
440
494
|
- spec/ruby_operators_spec.rb
|
441
495
|
- spec/ruby_raise_spec.rb
|
442
496
|
- spec/ruby_strings_spec.rb
|
@@ -470,7 +524,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
470
524
|
version: '0'
|
471
525
|
requirements: []
|
472
526
|
rubyforge_project:
|
473
|
-
rubygems_version: 2.
|
527
|
+
rubygems_version: 2.6.14
|
474
528
|
signing_key:
|
475
529
|
specification_version: 4
|
476
530
|
summary: A Ruby-like language for writing Ruby C extensions. Rubex keeps you happy
|
@@ -480,6 +534,7 @@ test_files:
|
|
480
534
|
- spec/binding_ptr_args_spec.rb
|
481
535
|
- spec/bitwise_operators_spec.rb
|
482
536
|
- spec/blocks_spec.rb
|
537
|
+
- spec/box_op_multi_args_spec.rb
|
483
538
|
- spec/c_bindings_spec.rb
|
484
539
|
- spec/c_constants_spec.rb
|
485
540
|
- spec/c_function_ptrs_spec.rb
|
@@ -494,10 +549,15 @@ test_files:
|
|
494
549
|
- spec/error_handling_spec.rb
|
495
550
|
- spec/examples_spec.rb
|
496
551
|
- spec/expressions_spec.rb
|
552
|
+
- spec/external_c_struct_spec.rb
|
553
|
+
- spec/fixtures/api/consumer.rubex
|
554
|
+
- spec/fixtures/api/implementation.rubex
|
555
|
+
- spec/fixtures/api/implementation.rubexd
|
497
556
|
- spec/fixtures/basic_ruby_method/basic_ruby_method.rubex
|
498
557
|
- spec/fixtures/binding_ptr_args/binding_ptr_args.rubex
|
499
558
|
- spec/fixtures/bitwise_operators/bitwise_operators.rubex
|
500
559
|
- spec/fixtures/blocks/blocks.rubex
|
560
|
+
- spec/fixtures/box_op_multi_args/box_op_multi_args.rubex
|
501
561
|
- spec/fixtures/c_bindings/c_bindings.rubex
|
502
562
|
- spec/fixtures/c_constants/c_constants.rubex
|
503
563
|
- spec/fixtures/c_function_ptrs/c_function_ptrs.rubex
|
@@ -514,12 +574,26 @@ test_files:
|
|
514
574
|
- spec/fixtures/examples/rcsv.csv
|
515
575
|
- spec/fixtures/examples/rcsv.rubex
|
516
576
|
- spec/fixtures/expressions/expressions.rubex
|
577
|
+
- spec/fixtures/external_c_struct/external_c_struct.rubex
|
517
578
|
- spec/fixtures/if_else/if_else.rubex
|
518
579
|
- spec/fixtures/implicit_lib_include/implicit_lib_include.rubex
|
519
580
|
- spec/fixtures/init_ruby_objects_with_literal_syntax/init_ruby_objects_with_literal_syntax.rubex
|
581
|
+
- spec/fixtures/instance_variables/instance_variables.rubex
|
520
582
|
- spec/fixtures/loops/loops.rubex
|
583
|
+
- spec/fixtures/module/module.rubex
|
584
|
+
- spec/fixtures/multi_file_programs/Rakefile
|
585
|
+
- spec/fixtures/multi_file_programs/a.rubex
|
586
|
+
- spec/fixtures/multi_file_programs/b.rubex
|
587
|
+
- spec/fixtures/multi_file_programs/multi_file_programs.rubex
|
588
|
+
- spec/fixtures/no_gil/no_gil.rubex
|
589
|
+
- spec/fixtures/no_gil_attach_class/no_gil_attach_class.rubex
|
590
|
+
- spec/fixtures/no_gil_compile_check/no_gil_compile_check.rubex
|
591
|
+
- spec/fixtures/outside_stmts/outside_stmts.rubex
|
592
|
+
- spec/fixtures/pow/pow.rubex
|
593
|
+
- spec/fixtures/rake_task/single_file/test.rubex
|
521
594
|
- spec/fixtures/recursion/recursion.rubex
|
522
595
|
- spec/fixtures/ruby_constant_method_calls/ruby_constant_method_calls.rubex
|
596
|
+
- spec/fixtures/ruby_constant_scoping/ruby_constant_scoping.rubex
|
523
597
|
- spec/fixtures/ruby_operators/ruby_operators.rubex
|
524
598
|
- spec/fixtures/ruby_raise/ruby_raise.rubex
|
525
599
|
- spec/fixtures/ruby_strings/ruby_strings.rubex
|
@@ -536,9 +610,19 @@ test_files:
|
|
536
610
|
- spec/if_else_spec.rb
|
537
611
|
- spec/implicit_lib_include_spec.rb
|
538
612
|
- spec/init_ruby_objects_with_literal_syntax_spec.rb
|
613
|
+
- spec/instance_variables_spec.rb
|
539
614
|
- spec/loops_spec.rb
|
615
|
+
- spec/module_spec.rb
|
616
|
+
- spec/multi_file_programs_spec.rb
|
617
|
+
- spec/no_gil_attach_class_spec.rb
|
618
|
+
- spec/no_gil_compile_check_spec.rb
|
619
|
+
- spec/no_gil_spec.rb
|
620
|
+
- spec/outside_stmts_spec.rb
|
621
|
+
- spec/pow_spec.rb
|
622
|
+
- spec/rake_task_spec.rb
|
540
623
|
- spec/recursion_spec.rb
|
541
624
|
- spec/ruby_constant_method_calls_spec.rb
|
625
|
+
- spec/ruby_constant_scoping_spec.rb
|
542
626
|
- spec/ruby_operators_spec.rb
|
543
627
|
- spec/ruby_raise_spec.rb
|
544
628
|
- spec/ruby_strings_spec.rb
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Rubex
|
2
|
-
module AST
|
3
|
-
module Statement
|
4
|
-
class Yield < Base
|
5
|
-
def initialize(args)
|
6
|
-
@args = args
|
7
|
-
end
|
8
|
-
|
9
|
-
def analyse_statement(local_scope)
|
10
|
-
@args = @args.map do |arg|
|
11
|
-
arg.analyse_types local_scope
|
12
|
-
arg.allocate_temps local_scope
|
13
|
-
arg.to_ruby_object
|
14
|
-
end
|
15
|
-
@args.each do |arg|
|
16
|
-
arg.release_temps local_scope
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def generate_code(code, local_scope)
|
21
|
-
@args.each do |a|
|
22
|
-
a.generate_evaluation_code code, local_scope
|
23
|
-
end
|
24
|
-
|
25
|
-
if !@args.empty?
|
26
|
-
code << "rb_yield_values(#{@args.size}, "
|
27
|
-
code << (@args.map { |a| a.c_code(local_scope) }.join(',')).to_s
|
28
|
-
code << ');'
|
29
|
-
else
|
30
|
-
code << 'rb_yield(Qnil);'
|
31
|
-
end
|
32
|
-
code.nl
|
33
|
-
|
34
|
-
@args.each do |a|
|
35
|
-
a.generate_disposal_code code
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|