ruby2c 1.0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,88 @@
1
+
2
+ begin require 'rubygems'; rescue LoadError; end
3
+ require 'sexp'
4
+ require 'type'
5
+
6
+ $TESTING = false unless defined? $TESTING
7
+
8
+ class TypedSexp < Sexp
9
+
10
+ def ==(obj)
11
+ case obj
12
+ when TypedSexp
13
+ super && sexp_type == obj.sexp_type
14
+ else
15
+ false
16
+ end
17
+ end
18
+
19
+ def _set_sexp_type(o)
20
+ @sexp_type = o
21
+ end
22
+
23
+ def initialize(*args)
24
+ # TODO: should probably be Type.unknown
25
+ @sexp_type = Type === args.last ? args.pop : nil
26
+ super(*args)
27
+ end
28
+
29
+ def inspect
30
+ sexp_str = self.map {|x|x.inspect}.join(', ')
31
+ sexp_type_str = (sexp_str.empty? ? "" : ", ") + "#{array_type? ? sexp_types.inspect : sexp_type}" unless sexp_type.nil?
32
+ return "t(#{sexp_str}#{sexp_type_str})"
33
+ end
34
+
35
+ def pretty_print(q)
36
+ q.group(1, 't(', ')') do
37
+ q.seplist(self) {|v| q.pp v }
38
+ unless @sexp_type.nil? then
39
+ q.text ", " unless self.empty?
40
+ q.pp @sexp_type
41
+ end
42
+ end
43
+ end
44
+
45
+ def sexp_type
46
+ unless array_type? then
47
+ @sexp_type
48
+ else
49
+ types = self.sexp_types.flatten.uniq
50
+
51
+ if types.size > 1 then
52
+ Type.hetero
53
+ else
54
+ Type.homo
55
+ end
56
+ end
57
+ end
58
+
59
+ def sexp_type=(o)
60
+ raise "You shouldn't call this on an #{first}" if array_type?
61
+ raise "You shouldn't call this a second time, ever" unless
62
+ @sexp_type.nil? or @sexp_type == Type.unknown
63
+ _set_sexp_type(o)
64
+ end
65
+
66
+ def sexp_types
67
+ raise "You shouldn't call this if not an #{@@array_types.join(' or ')}, was #{first} (#{self.inspect})" unless array_type?
68
+ self.grep(Sexp).map { |x| x.sexp_type }
69
+ end
70
+
71
+ def to_a
72
+ result = super
73
+ if defined?(@sexp_type) and not @sexp_type.nil? then
74
+ result += [ @sexp_type ]
75
+ end
76
+ result
77
+ end
78
+
79
+ def to_s
80
+ inspect
81
+ end
82
+
83
+ end
84
+
85
+ def t(*args) # stupid shortcut to make indentation much cleaner
86
+ TypedSexp.new(*args)
87
+ end
88
+
@@ -0,0 +1,1196 @@
1
+ require 'sexp_processor' # for deep_clone FIX
2
+ require 'typed_sexp'
3
+ require 'pt_testcase'
4
+ require 'unique'
5
+
6
+ # TODO: str -> char * in ansi c
7
+ # TODO: add tests that mix types up to fuck up RubyC type checker
8
+
9
+ class R2CTestCase < ParseTreeTestCase
10
+
11
+ def self.add_skipped_tests *names
12
+ names.each do |name|
13
+ add_tests(name,
14
+ "Rewriter" => :same,
15
+ "TypeChecker" => :skip,
16
+ "CRewriter" => :skip,
17
+ "RubyToAnsiC" => :skip,
18
+ "RubyToRubyC" => :skip)
19
+ end
20
+ end
21
+
22
+ testcase_order.push(*%w(Ruby ParseTree Rewriter TypeChecker
23
+ CRewriter RubyToAnsiC RubyToRubyC))
24
+
25
+ # NOTE: all skipped tests are at the end of the file
26
+
27
+ add_tests("and",
28
+ "Rewriter" => :same,
29
+ "TypeChecker" => t(:and,
30
+ t(:call, nil, :a, t(:arglist), Type.bool),
31
+ t(:call, nil, :b, t(:arglist), Type.bool),
32
+ Type.bool),
33
+ "CRewriter" => :same,
34
+ "RubyToAnsiC" => "a() && b()",
35
+ "RubyToRubyC" => 'rb_funcall(self, rb_intern("a"), 0) && rb_funcall(self, rb_intern("b"), 0)')
36
+
37
+ add_tests("array",
38
+ "Rewriter" => :same,
39
+ "TypeChecker" => t(:array,
40
+ t(:lit, 1, Type.long),
41
+ t(:lit, :b, Type.symbol),
42
+ t(:str, "c", Type.str),
43
+ Type.hetero),
44
+ "CRewriter" => :same,
45
+ "RubyToAnsiC" => "1, \"b\", \"c\"",
46
+ "RubyToRubyC" => "LONG2NUM(1), ID2SYM(rb_intern(\"b\")), rb_str_new2(\"c\")")
47
+
48
+ add_tests("array_pct_W",
49
+ "Rewriter" => :same,
50
+ "TypeChecker" => t(:array,
51
+ t(:str, "a", Type.str),
52
+ t(:str, "b", Type.str),
53
+ t(:str, "c", Type.str)),
54
+ "CRewriter" => :same,
55
+ "RubyToAnsiC" => "\"a\", \"b\", \"c\"",
56
+ "RubyToRubyC" => "rb_str_new2(\"a\"), rb_str_new2(\"b\"), rb_str_new2(\"c\")")
57
+
58
+ add_tests("array_pct_w",
59
+ "Rewriter" => :same,
60
+ "TypeChecker" => t(:array,
61
+ t(:str, "a", Type.str),
62
+ t(:str, "b", Type.str),
63
+ t(:str, "c", Type.str)),
64
+ "CRewriter" => :same,
65
+ "RubyToAnsiC" => "\"a\", \"b\", \"c\"",
66
+ "RubyToRubyC" => "rb_str_new2(\"a\"), rb_str_new2(\"b\"), rb_str_new2(\"c\")")
67
+
68
+ add_tests("attrasgn_index_equals",
69
+ "Rewriter" => :same,
70
+ "TypeChecker" => t(:attrasgn,
71
+ t(:call, nil, :a, t(:arglist), Type.unknown),
72
+ :[]=,
73
+ t(:arglist,
74
+ t(:lit, 42, Type.long),
75
+ t(:lit, 24, Type.long))),
76
+ "CRewriter" => :same,
77
+ "RubyToAnsiC" => :skip,
78
+ "RubyToRubyC" => :skip) # TODO: rubyc should be ok with this
79
+
80
+ add_tests("attrasgn_index_equals_space",
81
+ "Rewriter" => :same,
82
+ "TypeChecker" => t(:block,
83
+ t(:lasgn, :a, t(:array), Type.unknown_list),
84
+ t(:attrasgn,
85
+ t(:lvar, :a, Type.unknown_list),
86
+ :[]=,
87
+ t(:arglist,
88
+ t(:lit, 42, Type.long),
89
+ t(:lit, 24, Type.long))), Type.unknown),
90
+ "CRewriter" => :same,
91
+ "RubyToAnsiC" => :skip,
92
+ "RubyToRubyC" => :skip) # TODO: rubyc should be ok with this
93
+
94
+ add_tests("attrset",
95
+ "Rewriter" => s(:defn, :writer=,
96
+ s(:args, :arg),
97
+ s(:scope,
98
+ s(:block,
99
+ s(:return,
100
+ s(:iasgn, :@writer, s(:lvar, :arg)))))),
101
+ "TypeChecker" => t(:defn, :writer=,
102
+ t(:args, t(:arg, Type.unknown)),
103
+ t(:scope,
104
+ t(:block,
105
+ t(:return,
106
+ t(:iasgn, :@writer,
107
+ t(:lvar, :arg, Type.unknown),
108
+ Type.unknown),
109
+ Type.void), Type.unknown), Type.void),
110
+ Type.function(Type.unknown,
111
+ [Type.unknown], Type.unknown)),
112
+ "CRewriter" => :same,
113
+ "RubyToAnsiC" => "void *\nwriter=(void * arg) {\nreturn self->writer = arg;\n}",
114
+ "RubyToRubyC" => "static VALUE\nrrc_c_writer_equals(VALUE self, VALUE arg) {\nreturn self->writer = arg;\n}")
115
+
116
+ add_tests("bools", # NOTE: not in pttc
117
+ "Rewriter" => :skip,
118
+ # TODO: why does return false have type void?
119
+ "TypeChecker" => t(:defn, :bools,
120
+ t(:args, t(:arg1, Type.value)),
121
+ t(:scope,
122
+ t(:block,
123
+ t(:if,
124
+ t(:call,
125
+ t(:lvar, :arg1, Type.value),
126
+ :nil?,
127
+ nil,
128
+ Type.bool),
129
+ t(:return,
130
+ t(:false, Type.bool),
131
+ Type.void),
132
+ t(:return,
133
+ t(:true, Type.bool),
134
+ Type.void),
135
+ Type.void),
136
+ Type.unknown),
137
+ Type.void),
138
+ Type.function(Type.unknown,
139
+ [Type.value], Type.bool)),
140
+ "CRewriter" => :same,
141
+ "RubyToAnsiC" => "bool\nbools(void * arg1) {\nif (arg1) {\nreturn 0;\n} else {\nreturn 1;\n}\n}",
142
+ "RubyToRubyC" => "static VALUE\nrrc_c_bools(VALUE self, VALUE arg1) {\nif (NIL_P(arg1)) {\nreturn Qfalse;\n} else {\nreturn Qtrue;\n}\n}")
143
+
144
+ add_tests("case_stmt", # TODO: not in pttc
145
+ "Rewriter" => :skip,
146
+ "TypeChecker" => t(:defn, :case_stmt,
147
+ t(:args),
148
+ t(:scope,
149
+ t(:block,
150
+ t(:lasgn,
151
+ :var,
152
+ t(:lit, 2, Type.long),
153
+ Type.long),
154
+ t(:lasgn,
155
+ :result,
156
+ t(:str, "", Type.str),
157
+ Type.str),
158
+ t(:if,
159
+ t(:call,
160
+ t(:lvar, :var, Type.long),
161
+ :case_equal_long,
162
+ t(:arglist, t(:lit, 1, Type.long)),
163
+ Type.bool),
164
+ t(:block,
165
+ t(:call,
166
+ nil,
167
+ :puts,
168
+ t(:arglist,
169
+ t(:str, "something", Type.str)),
170
+ Type.void),
171
+ t(:lasgn,
172
+ :result,
173
+ t(:str, "red", Type.str),
174
+ Type.str),
175
+ Type.str),
176
+ t(:if,
177
+ t(:or,
178
+ t(:call,
179
+ t(:lvar, :var, Type.long),
180
+ :case_equal_long,
181
+ t(:arglist, t(:lit, 2, Type.long)),
182
+ Type.bool),
183
+ t(:call,
184
+ t(:lvar, :var, Type.long),
185
+ :case_equal_long,
186
+ t(:arglist, t(:lit, 3, Type.long)),
187
+ Type.bool),
188
+ Type.bool),
189
+ t(:lasgn,
190
+ :result,
191
+ t(:str, "yellow", Type.str),
192
+ Type.str),
193
+ t(:if,
194
+ t(:call,
195
+ t(:lvar, :var, Type.long),
196
+ :case_equal_long,
197
+ t(:arglist, t(:lit, 4, Type.long)),
198
+ Type.bool),
199
+ nil,
200
+ t(:lasgn,
201
+ :result,
202
+ t(:str, "green", Type.str),
203
+ Type.str),
204
+ Type.str),
205
+ Type.str),
206
+ Type.str),
207
+ t(:if,
208
+ t(:call,
209
+ t(:lvar, :result, Type.str),
210
+ :case_equal_str,
211
+ t(:arglist, t(:str, "red", Type.str)),
212
+ Type.bool),
213
+ t(:lasgn, :var, t(:lit, 1, Type.long), Type.long),
214
+ t(:if,
215
+ t(:call,
216
+ t(:lvar, :result, Type.str),
217
+ :case_equal_str,
218
+ t(:arglist, t(:str, "yellow", Type.str)),
219
+ Type.bool),
220
+ t(:lasgn, :var, t(:lit, 2, Type.long), Type.long),
221
+ t(:if,
222
+ t(:call,
223
+ t(:lvar, :result, Type.str),
224
+ :case_equal_str,
225
+ t(:arglist,
226
+ t(:str, "green", Type.str)),
227
+ Type.bool),
228
+ t(:lasgn,
229
+ :var,
230
+ t(:lit, 3, Type.long),
231
+ Type.long),
232
+ nil,
233
+ Type.long),
234
+ Type.long),
235
+ Type.long),
236
+ t(:return,
237
+ t(:lvar, :result, Type.str),
238
+ Type.void),
239
+ Type.unknown),
240
+ Type.void),
241
+ Type.function(Type.unknown, [], Type.str)),
242
+ "CRewriter" => :same,
243
+ # HACK: I don't like the semis after the if blocks, but it is a compromise right now
244
+ "RubyToAnsiC" => "str\ncase_stmt() {\nstr result;\nlong var;\nvar = 2;\nresult = \"\";\nif (case_equal_long(var, 1)) {\nputs(\"something\");\nresult = \"red\";\n} else {\nif (case_equal_long(var, 2) || case_equal_long(var, 3)) {\nresult = \"yellow\";\n} else {\nif (case_equal_long(var, 4)) {\n;\n} else {\nresult = \"green\";\n}\n}\n};\nif (case_equal_str(result, \"red\")) {\nvar = 1;\n} else {\nif (case_equal_str(result, \"yellow\")) {\nvar = 2;\n} else {\nif (case_equal_str(result, \"green\")) {\nvar = 3;\n}\n}\n};\nreturn result;\n}",
245
+ "RubyToRubyC" => "static VALUE\nrrc_c_case_stmt(VALUE self) {\nVALUE result;\nVALUE var;\nvar = LONG2NUM(2);\nresult = rb_str_new2(\"\");\nif (rb_funcall(var, rb_intern(\"===\"), 1, LONG2NUM(1))) {\nrb_funcall(self, rb_intern(\"puts\"), 1, rb_str_new2(\"something\"));\nresult = rb_str_new2(\"red\");\n} else {\nif (rb_funcall(var, rb_intern(\"===\"), 1, LONG2NUM(2)) || rb_funcall(var, rb_intern(\"===\"), 1, LONG2NUM(3))) {\nresult = rb_str_new2(\"yellow\");\n} else {\nif (rb_funcall(var, rb_intern(\"===\"), 1, LONG2NUM(4))) {\n;\n} else {\nresult = rb_str_new2(\"green\");\n}\n}\n};\nif (rb_funcall(result, rb_intern(\"===\"), 1, rb_str_new2(\"red\"))) {\nvar = LONG2NUM(1);\n} else {\nif (rb_funcall(result, rb_intern(\"===\"), 1, rb_str_new2(\"yellow\"))) {\nvar = LONG2NUM(2);\n} else {\nif (rb_funcall(result, rb_intern(\"===\"), 1, rb_str_new2(\"green\"))) {\nvar = LONG2NUM(3);\n}\n}\n};\nreturn result;\n}")
246
+
247
+ add_tests("defn_args_none",
248
+ "Rewriter" => :same,
249
+ "TypeChecker" => t(:defn, :empty,
250
+ t(:args),
251
+ t(:scope,
252
+ t(:block,
253
+ t(:nil, Type.value),
254
+ Type.unknown),
255
+ Type.void),
256
+ Type.function(Type.unknown, [], Type.void)),
257
+ "CRewriter" => :same,
258
+ "RubyToAnsiC" => "void\nempty() {\nNULL;\n}",
259
+ "RubyToRubyC" => "static VALUE\nrrc_c_empty(VALUE self) {\nQnil;\n}")
260
+
261
+ add_tests("defn_is_something", # TODO: not in pttc
262
+ "Rewriter" => :skip,
263
+ "TypeChecker" => t(:defn, :something?,
264
+ t(:args),
265
+ t(:scope,
266
+ t(:block,
267
+ t(:nil, Type.value),
268
+ Type.unknown),
269
+ Type.void),
270
+ Type.function(Type.unknown, [], Type.void)),
271
+ "CRewriter" => :same,
272
+ "RubyToAnsiC" => "void\nis_something() {\nNULL;\n}",
273
+ "RubyToRubyC" => "static VALUE\nrrc_c_is_something(VALUE self) {\nQnil;\n}")
274
+
275
+ add_tests("defn_or",
276
+ "Rewriter" => :same,
277
+ "TypeChecker" => t(:defn, :|,
278
+ t(:args, t(:o, Type.unknown)),
279
+ t(:scope,
280
+ t(:block,
281
+ t(:nil, Type.value),
282
+ Type.unknown),
283
+ Type.void),
284
+ Type.function(Type.unknown, [Type.unknown],
285
+ Type.void)),
286
+ "CRewriter" => :same,
287
+ "RubyToAnsiC" => "void\nor(void * o) {\nNULL;\n}",
288
+ "RubyToRubyC" => "static VALUE\nrrc_c_or(VALUE self, VALUE o) {\nQnil;\n}")
289
+
290
+ add_tests("defn_zarray",
291
+ "Rewriter" => :same,
292
+ "TypeChecker" => t(:defn,
293
+ :zarray,
294
+ t(:args),
295
+ t(:scope,
296
+ t(:block,
297
+ t(:lasgn, :a, t(:array), Type.unknown_list),
298
+ t(:return,
299
+ t(:lvar,
300
+ :a, Type.unknown_list), Type.void),
301
+ Type.unknown), Type.void),
302
+ Type.function(Type.unknown, [], Type.unknown_list)),
303
+ "CRewriter" => :same,
304
+ "RubyToAnsiC" => "void *\nzarray() {\nvoid * a;\na = (void *) malloc(sizeof(void *) * 0);\nreturn a;\n}",
305
+ "RubyToRubyC" => "static VALUE\nrrc_c_zarray(VALUE self) {\nVALUE a;\na = rb_ary_new2(0);\nreturn a;\n}")
306
+
307
+ add_tests("ensure",
308
+ "Rewriter" => :skip,
309
+ "TypeChecker" => t(:defn, :bbegin,
310
+ t(:args),
311
+ t(:scope,
312
+ t(:block,
313
+ t(:begin,
314
+ t(:ensure,
315
+ t(:rescue,
316
+ t(:call,
317
+ t(:lit, 1, Type.long),
318
+ :+,
319
+ t(:arglist, t(:lit, 1, Type.long)), Type.long),
320
+ t(:resbody,
321
+ t(:array, t(:const, :SyntaxError, Type.fucked)),
322
+ t(:block,
323
+ t(:lasgn, :e1, t(:gvar, :$!, Type.unknown),
324
+ Type.unknown),
325
+ t(:lit, 2, Type.long), Type.unknown),
326
+ t(:resbody,
327
+ t(:array, t(:const, :Exception, Type.fucked)),
328
+ t(:block,
329
+ t(:lasgn, :e2, t(:gvar, :$!, Type.unknown),
330
+ Type.unknown),
331
+ t(:lit, 3, Type.long), Type.unknown),
332
+ Type.unknown), Type.long),
333
+ t(:lit, 4, Type.long), Type.long),
334
+ t(:lit, 5, Type.long))), Type.unknown),
335
+ Type.void),
336
+ Type.function(Type.unknown, [], Type.void)),
337
+ "CRewriter" => :same,
338
+ "RubyToAnsiC" => :unsupported,
339
+ "RubyToRubyC" => :unsupported)
340
+
341
+ add_tests("global",
342
+ "Rewriter" => :same,
343
+ "TypeChecker" => :skip,
344
+ # TODO: test s(:gvar, :$stderr) != t(:gvar, $stderr, Type.file)
345
+ "TypeChecker" => t(:gvar, :$stderr, Type.file),
346
+ "CRewriter" => :same,
347
+ "RubyToAnsiC" => "stderr",
348
+ "RubyToRubyC" => "rb_gv_get(\"$stderr\")")
349
+
350
+ add_tests("interpolated", # TODO: not in pttc
351
+ "Rewriter" => :skip,
352
+ "TypeChecker" => t(:dstr,
353
+ "var is ",
354
+ t(:lvar, :argl, Type.long),
355
+ t(:str, ". So there.", Type.str),
356
+ Type.str),
357
+ "CRewriter" => :same,
358
+ "RubyToAnsiC" => :unsupported,
359
+ "RubyToRubyC" => "rb_funcall(rb_mKernel, rb_intern(\"sprintf\"), 4, rb_str_new2(\"%s%s%s\"), rb_str_new2(\"var is \"), argl, rb_str_new2(\". So there.\"))")
360
+
361
+ add_tests("iter", # TODO: not in pttc
362
+ "Rewriter" => :skip,
363
+ "TypeChecker" => t(:iter,
364
+ t(:call, nil, :loop, nil, Type.unknown),
365
+ t(:dasgn_curr, :temp_1, Type.unknown),
366
+ nil,
367
+ Type.unknown),
368
+ "CRewriter" => :skip, # HACK don't do rb_iterate stuff for loop
369
+ # "CRewriter" => [:defx,
370
+ # t(:iter,
371
+ # t(:call, nil, :loop, nil, Type.unknown),
372
+ # t(:args,
373
+ # t(:array, t(:dasgn_curr, :temp_1, Type.unknown), Type.void),
374
+ # t(:array, Type.void), Type.void),
375
+ # t(:call, nil, :temp_1, nil)),
376
+ # [t(:defx,
377
+ # :temp_2,
378
+ # t(:args, :temp_2, :temp_3),
379
+ # t(:scope, t(:block, nil)), Type.void)]],
380
+ "RubyToAnsiC" => "",
381
+ "RubyToRubyC" => "")
382
+
383
+ add_tests("iter_downto",
384
+ "Rewriter" => :same,
385
+ "TypeChecker" => t(:iter,
386
+ t(:call,
387
+ t(:lit, 3, Type.long),
388
+ :downto,
389
+ t(:arglist, t(:lit, 1, Type.long)),
390
+ Type.unknown),
391
+ t(:lasgn, :n, nil, Type.long),
392
+ t(:call, nil, :puts,
393
+ t(:arglist,
394
+ t(:call,
395
+ t(:lvar, :n, Type.long),
396
+ :to_s,
397
+ t(:arglist),
398
+ Type.str)),
399
+ Type.void),
400
+ Type.void),
401
+ "CRewriter" => :skip,
402
+ "RubyToAnsiC" => "n = 1;\nwhile (n <= 3) {\nputs(to_s(n));\nn = n + 1;\n}",
403
+ "RubyToRubyC" => "n = LONG2NUM(1);\nwhile (rb_funcall(n, rb_intern(\"<=\"), 1, LONG2NUM(3))) {\nrb_funcall(self, rb_intern(\"puts\"), 1, rb_funcall(n, rb_intern(\"to_s\"), 0));\nn = rb_funcall(n, rb_intern(\"+\"), 1, LONG2NUM(1));\n}")
404
+
405
+ add_tests("iter_each_lvar",
406
+ "Rewriter" => :same,
407
+ "TypeChecker" => t(:block,
408
+ t(:lasgn, :array,
409
+ t(:array,
410
+ t(:lit, 1, Type.long),
411
+ t(:lit, 2, Type.long),
412
+ t(:lit, 3, Type.long)),
413
+ Type.long_list),
414
+ t(:iter,
415
+ t(:call,
416
+ t(:lvar, :array, Type.long_list),
417
+ :each,
418
+ t(:arglist), Type.unknown),
419
+ t(:lasgn, :x, nil, Type.long),
420
+ t(:call, nil, :puts,
421
+ t(:arglist,
422
+ t(:call,
423
+ t(:lvar, :x, Type.long),
424
+ :to_s,
425
+ t(:arglist),
426
+ Type.str)),
427
+ Type.void),
428
+ Type.void),
429
+ Type.unknown),
430
+ "CRewriter" => [:defx,
431
+ t(:block,
432
+ t(:lasgn, :array,
433
+ t(:array,
434
+ t(:lit, 1, Type.long),
435
+ t(:lit, 2, Type.long),
436
+ t(:lit, 3, Type.long)),
437
+ Type.long_list),
438
+ t(:iter,
439
+ t(:call,
440
+ t(:lvar, :array, Type.long_list),
441
+ :each,
442
+ t(:arglist), Type.unknown),
443
+ t(:args,
444
+ t(:array, t(:lvar, :x, Type.value), Type.void),
445
+ t(:array, t(:lvar, :static_temp_4, Type.value), Type.void),
446
+ Type.void),
447
+ :temp_1),
448
+ Type.unknown),
449
+ [t(:static, "static VALUE static_temp_4;", Type.fucked),
450
+ t(:defx,
451
+ :temp_1,
452
+ t(:args,
453
+ t(:temp_2, Type.value),
454
+ t(:temp_3, Type.value)),
455
+ t(:scope,
456
+ t(:block,
457
+ t(:lasgn, :x,
458
+ t(:lvar, :static_temp_4, Type.value),
459
+ Type.value),
460
+ t(:masgn,
461
+ t(:array),
462
+ t(:to_ary,
463
+ t(:lvar, :temp_2, Type.value))),
464
+ t(:call,
465
+ nil,
466
+ :puts,
467
+ t(:arglist,
468
+ t(:call,
469
+ t(:lvar, :x, Type.long),
470
+ :to_s,
471
+ t(:arglist),
472
+ Type.str)),
473
+ Type.void),
474
+ t(:lasgn,
475
+ :static_temp_4,
476
+ t(:lvar, :x, Type.value),
477
+ Type.value),
478
+ t(:return, t(:nil, Type.value)))),
479
+ Type.void)]],
480
+ "RubyToAnsiC" => :skip, # because eric sucks soooo much
481
+ # 'unsigned long index_x;
482
+ # for (index_x = 0; arrays[index_x] != NULL; ++index_x) {
483
+ # str x = arrays[index_x];
484
+ # puts(x);
485
+ # }',
486
+ "RubyToRubyC" => :skip # indeed, there is an masgn when defx created
487
+ # [:defx,
488
+ # "array = rb_ary_new2(3);
489
+ # rb_ary_store(array, 0, LONG2NUM(1));
490
+ # rb_ary_store(array, 1, LONG2NUM(2));
491
+ # rb_ary_store(array, 2, LONG2NUM(3));
492
+ # static_temp_4 = x;
493
+ # rb_iterate(rb_each, array, temp_1, Qnil);
494
+ # x = static_temp_4;
495
+ # ",
496
+ # ["static VALUE static_temp_4;",
497
+ # "static VALUE
498
+ # rrc_c_temp_1(VALUE temp_2, VALUE temp_3) {
499
+ # VALUE arrays;
500
+ # VALUE x;
501
+ # arrays = static_temp_4;
502
+ # x = temp_2;
503
+ # rb_funcall(self, rb_intern(\"puts\"), 1, x);
504
+ # static_temp_4 = arrays;
505
+ # return Qnil;
506
+ # }"]]
507
+ )
508
+
509
+ add_tests("iter_each_nested",
510
+ "Rewriter" => :same,
511
+ "TypeChecker" => t(:block,
512
+ t(:lasgn, :array1,
513
+ t(:array,
514
+ t(:lit, 1, Type.long),
515
+ t(:lit, 2, Type.long),
516
+ t(:lit, 3, Type.long)), Type.long_list),
517
+ t(:lasgn, :array2,
518
+ t(:array,
519
+ t(:lit, 4, Type.long),
520
+ t(:lit, 5, Type.long),
521
+ t(:lit, 6, Type.long),
522
+ t(:lit, 7, Type.long)), Type.long_list),
523
+ t(:iter,
524
+ t(:call,
525
+ t(:lvar, :array1, Type.long_list),
526
+ :each,
527
+ t(:arglist), Type.unknown),
528
+ t(:lasgn, :x, nil, Type.long),
529
+ t(:iter,
530
+ t(:call,
531
+ t(:lvar, :array2, Type.long_list),
532
+ :each,
533
+ t(:arglist), Type.unknown),
534
+ t(:lasgn, :y, nil, Type.long),
535
+ t(:block,
536
+ t(:call, nil, :puts,
537
+ t(:arglist,
538
+ t(:call,
539
+ t(:lvar, :x, Type.long),
540
+ :to_s,
541
+ t(:arglist), Type.str)),
542
+ Type.void),
543
+ t(:call, nil, :puts,
544
+ t(:arglist,
545
+ t(:call,
546
+ t(:lvar, :y, Type.long),
547
+ :to_s,
548
+ t(:arglist), Type.str)),
549
+ Type.void),
550
+ Type.unknown),
551
+ Type.void),
552
+ Type.void),
553
+ Type.unknown),
554
+ "CRewriter" => :skip,
555
+ "RubyToAnsiC" => 'while (argl >= 1) {
556
+ puts("hello");
557
+ argl = argl - 1;
558
+ }',
559
+ "RubyToRubyC" => 'while (rb_funcall(argl, rb_intern(">="), 1, LONG2NUM(1))) {
560
+ rb_funcall(self, rb_intern("puts"), 1, rb_str_new2("hello"));
561
+ argl = rb_funcall(argl, rb_intern("-"), 1, LONG2NUM(1));
562
+ }')
563
+
564
+ add_tests("iter_while",
565
+ "Rewriter" => :same,
566
+ "TypeChecker" => t(:block,
567
+ t(:lasgn, :argl,
568
+ t(:lit, 10, Type.long), Type.long),
569
+ t(:while,
570
+ t(:call,
571
+ t(:lvar, :argl, Type.long),
572
+ :>=,
573
+ t(:arglist, t(:lit, 1, Type.long)), Type.bool),
574
+ t(:block,
575
+ t(:call, nil, :puts,
576
+ t(:arglist,
577
+ t(:str, 'hello', Type.str)),
578
+ Type.void),
579
+ t(:lasgn, :argl,
580
+ t(:call,
581
+ t(:lvar, :argl, Type.long),
582
+ :-,
583
+ t(:arglist, t(:lit, 1, Type.long)),
584
+ Type.long),
585
+ Type.long),
586
+ Type.unknown), true),
587
+ Type.unknown),
588
+ "CRewriter" => :same,
589
+ "RubyToAnsiC" => "argl = 10;\nwhile (argl >= 1) {\nputs(\"hello\");\nargl = argl - 1;\n}\n",
590
+ "RubyToRubyC" => "argl = LONG2NUM(10);\nwhile (rb_funcall(argl, rb_intern(\">=\"), 1, LONG2NUM(1))) {\nrb_funcall(self, rb_intern(\"puts\"), 1, rb_str_new2(\"hello\"));\nargl = rb_funcall(argl, rb_intern(\"-\"), 1, LONG2NUM(1));\n}\n")
591
+
592
+ add_tests("ivar",
593
+ "Rewriter" => s(:defn, :reader,
594
+ s(:args),
595
+ s(:scope, s(:block,
596
+ s(:return, s(:ivar, :@reader))))),
597
+ "TypeChecker" => :skip,
598
+ "CRewriter" => :skip,
599
+ "RubyToAnsiC" => :skip,
600
+ "RubyToRubyC" => :skip)
601
+
602
+ # TODO: this might still be too much
603
+ add_tests("lasgn_array",
604
+ "Rewriter" => :same,
605
+ "TypeChecker" => t(:lasgn,
606
+ :var,
607
+ t(:array,
608
+ t(:str, "foo", Type.str),
609
+ t(:str, "bar", Type.str)),
610
+ Type.str_list),
611
+ "CRewriter" => :same,
612
+ "RubyToRubyC" => 'var = rb_ary_new2(2);
613
+ rb_ary_store(var, 0, rb_str_new2("foo"));
614
+ rb_ary_store(var, 1, rb_str_new2("bar"))',
615
+ "RubyToAnsiC" => 'var = (str) malloc(sizeof(str) * 2);
616
+ var[0] = "foo";
617
+ var[1] = "bar"')
618
+
619
+ add_tests("lasgn_call",
620
+ "Rewriter" => :same,
621
+ "TypeChecker" => t(:lasgn, :c,
622
+ t(:call,
623
+ t(:lit, 2, Type.long),
624
+ :+,
625
+ t(:arglist,
626
+ t(:lit, 3, Type.long)),
627
+ Type.long),
628
+ Type.long),
629
+ "CRewriter" => :same,
630
+ "RubyToAnsiC" => "c = 2 + 3", # FIX: probably not "c =
631
+ "RubyToRubyC" => 'c = rb_funcall(LONG2NUM(2), rb_intern("+"), 1, LONG2NUM(3))')
632
+
633
+ add_tests("lit_bool_false",
634
+ "Rewriter" => :same,
635
+ "TypeChecker" => t(:false, Type.bool),
636
+ "CRewriter" => :same,
637
+ "RubyToAnsiC" => "0",
638
+ "RubyToRubyC" => "Qfalse")
639
+
640
+ add_tests("lit_bool_true",
641
+ "Rewriter" => :same,
642
+ "TypeChecker" => t(:true, Type.bool),
643
+ "CRewriter" => :same,
644
+ "RubyToAnsiC" => "1",
645
+ "RubyToRubyC" => "Qtrue")
646
+
647
+ add_tests("lit_float",
648
+ "Rewriter" => :same,
649
+ "TypeChecker" => t(:lit, 1.1, Type.float),
650
+ "CRewriter" => :same,
651
+ "RubyToAnsiC" => "1.1",
652
+ "RubyToRubyC" => "rb_float_new(1.1)")
653
+
654
+ add_tests("lit_long",
655
+ "Rewriter" => :same,
656
+ "TypeChecker" => t(:lit, 1, Type.long),
657
+ "CRewriter" => :same,
658
+ "RubyToAnsiC" => "1",
659
+ "RubyToRubyC" => "LONG2NUM(1)")
660
+
661
+ add_tests("lit_long_negative",
662
+ "Rewriter" => :same,
663
+ "TypeChecker" => t(:lit, -1, Type.long),
664
+ "CRewriter" => :same,
665
+ "RubyToAnsiC" => "-1",
666
+ "RubyToRubyC" => "LONG2NUM(-1)")
667
+
668
+ add_tests("lit_range2",
669
+ "Rewriter" => :same,
670
+ "TypeChecker" => t(:lit, 1..10, Type.range),
671
+ "CRewriter" => :same,
672
+ "RubyToAnsiC" => :skip,
673
+ "RubyToRubyC" => :skip)
674
+
675
+ add_tests("lit_range3",
676
+ "Rewriter" => :same,
677
+ "TypeChecker" => t(:lit, 1...10, Type.range),
678
+ "CRewriter" => :same,
679
+ "RubyToAnsiC" => :skip,
680
+ "RubyToRubyC" => :skip)
681
+
682
+ add_tests("lit_regexp",
683
+ "Rewriter" => :same,
684
+ "TypeChecker" => t(:lit, /x/, Type.regexp),
685
+ "CRewriter" => :same,
686
+ "RubyToAnsiC" => :skip,
687
+ "RubyToRubyC" => :skip)
688
+
689
+ add_tests("lit_regexp_i_wwtt",
690
+ "Rewriter" => :same,
691
+ "TypeChecker" => t(:call,
692
+ t(:call, nil, :str, t(:arglist), Type.unknown),
693
+ :split,
694
+ t(:arglist, t(:lit, //i, Type.regexp)),
695
+ Type.unknown),
696
+ "CRewriter" => :same,
697
+ "RubyToAnsiC" => :skip,
698
+ "RubyToRubyC" => :skip)
699
+
700
+ add_tests("lit_regexp_n",
701
+ "Rewriter" => :same,
702
+ "TypeChecker" => t(:lit, /x/n, Type.regexp),
703
+ "CRewriter" => :same,
704
+ "RubyToAnsiC" => :skip,
705
+ "RubyToRubyC" => :skip)
706
+
707
+ add_tests("lit_regexp_once",
708
+ "Rewriter" => :same,
709
+ "TypeChecker" => t(:lit, /x/, Type.regexp), # HACK - once?
710
+ "CRewriter" => :same,
711
+ "RubyToAnsiC" => :skip,
712
+ "RubyToRubyC" => :skip)
713
+
714
+ add_tests("lit_str", # TODO: not in pttc
715
+ "ParseTree" => s(:str, "x"),
716
+ "Rewriter" => :same,
717
+ "TypeChecker" => t(:str, "x", Type.str),
718
+ "CRewriter" => :same,
719
+ "RubyToAnsiC" => '"x"',
720
+ "RubyToRubyC" => 'rb_str_new2("x")')
721
+
722
+ add_tests("lit_sym",
723
+ "Rewriter" => :same,
724
+ "TypeChecker" => t(:lit, :x, Type.symbol),
725
+ "CRewriter" => :same,
726
+ "RubyToAnsiC" => '"x"', # HACK WRONG! (or... is it?
727
+ "RubyToRubyC" => 'ID2SYM(rb_intern("x"))')
728
+
729
+ add_tests("lit_sym_splat",
730
+ "Rewriter" => :same,
731
+ "TypeChecker" => t(:lit, :"*args", Type.symbol),
732
+ "CRewriter" => :same,
733
+ "RubyToAnsiC" => '"*args"',
734
+ "RubyToRubyC" => 'ID2SYM(rb_intern("*args"))')
735
+
736
+ add_tests("multi_args", # TODO: not in pttc
737
+ "Ruby" => "def multi_args(arg1, arg2)
738
+ arg3 = arg1 * arg2 * 7
739
+ puts arg3.to_s
740
+ return \"foo\"
741
+ end",
742
+ "ParseTree" => s(:defn, :multi_args,
743
+ s(:args, :arg1, :arg2),
744
+ s(:scope,
745
+ s(:block,
746
+ s(:lasgn,
747
+ :arg3,
748
+ s(:call,
749
+ s(:call,
750
+ s(:lvar, :arg1),
751
+ :*,
752
+ s(:arglist, s(:lvar, :arg2))),
753
+ :*,
754
+ s(:arglist, s(:lit, 7)))),
755
+ s(:call,
756
+ nil,
757
+ :puts,
758
+ s(:arglist, s(:call, s(:lvar, :arg3),
759
+ :to_s, s(:arglist)))),
760
+ s(:return, s(:str, "foo"))))),
761
+ "Rewriter" => :same,
762
+ "TypeChecker" => t(:defn, :multi_args,
763
+ t(:args,
764
+ t(:arg1, Type.long),
765
+ t(:arg2, Type.long)),
766
+ t(:scope,
767
+ t(:block,
768
+ t(:lasgn,
769
+ :arg3,
770
+ t(:call,
771
+ t(:call,
772
+ t(:lvar, :arg1, Type.long),
773
+ :*,
774
+ t(:arglist, t(:lvar, :arg2, Type.long)),
775
+ Type.long),
776
+ :*,
777
+ t(:arglist, t(:lit, 7, Type.long)),
778
+ Type.long),
779
+ Type.long),
780
+ t(:call,
781
+ nil,
782
+ :puts,
783
+ t(:arglist,
784
+ t(:call,
785
+ t(:lvar, :arg3, Type.long),
786
+ :to_s,
787
+ t(:arglist),
788
+ Type.str)),
789
+ Type.void),
790
+ t(:return, t(:str, "foo", Type.str),
791
+ Type.void),
792
+ Type.unknown),
793
+ Type.void),
794
+ Type.function(Type.unknown,
795
+ [Type.long, Type.long], Type.str)),
796
+ "CRewriter" => :same,
797
+ "RubyToRubyC" => "static VALUE
798
+ rrc_c_multi_args(VALUE self, VALUE arg1, VALUE arg2) {
799
+ VALUE arg3;
800
+ arg3 = rb_funcall(rb_funcall(arg1, rb_intern(\"*\"), 1, arg2), rb_intern(\"*\"), 1, LONG2NUM(7));
801
+ rb_funcall(self, rb_intern(\"puts\"), 1, rb_funcall(arg3, rb_intern(\"to_s\"), 0));
802
+ return rb_str_new2(\"foo\");
803
+ }",
804
+ "RubyToAnsiC" => "str
805
+ multi_args(long arg1, long arg2) {
806
+ long arg3;
807
+ arg3 = arg1 * arg2 * 7;
808
+ puts(to_s(arg3));
809
+ return \"foo\";
810
+ }")
811
+
812
+ add_tests("not",
813
+ "Rewriter" => :same,
814
+ "TypeChecker" => t(:not, t(:true, Type.bool), Type.bool),
815
+ "CRewriter" => :same,
816
+ "RubyToAnsiC" => "!(1)",
817
+ "RubyToRubyC" => "!(Qtrue)")
818
+
819
+ add_tests("or",
820
+ "Rewriter" => :same,
821
+ "TypeChecker" => t(:or,
822
+ t(:call, nil, :a, t(:arglist), Type.bool),
823
+ t(:call, nil, :b, t(:arglist), Type.bool),
824
+ Type.bool),
825
+ "CRewriter" => :same,
826
+ "RubyToAnsiC" => 'a() || b()',
827
+ "RubyToRubyC" => 'rb_funcall(self, rb_intern("a"), 0) || rb_funcall(self, rb_intern("b"), 0)')
828
+
829
+ add_tests("vcall",
830
+ "Rewriter" => :same,
831
+ "TypeChecker" => t(:call, nil, :method, t(:arglist), Type.unknown),
832
+ "CRewriter" => :same,
833
+ "RubyToAnsiC" => "method()",
834
+ "RubyToRubyC" => "rb_funcall(self, rb_intern(\"method\"), 0)")
835
+
836
+ add_tests("whiles", # TODO: not in pttc
837
+ "Ruby" => "def whiles
838
+ while false do
839
+ puts \"false\"
840
+ end
841
+ begin
842
+ puts \"true\"
843
+ end while false
844
+ end",
845
+ "ParseTree" => s(:defn,
846
+ :whiles,
847
+ s(:args),
848
+ s(:scope,
849
+ s(:block,
850
+ s(:while, s(:false),
851
+ s(:call, nil, :puts,
852
+ s(:arglist, s(:str, "false"))),
853
+ true),
854
+ s(:while, s(:false),
855
+ s(:call, nil, :puts,
856
+ s(:arglist, s(:str, "true"))),
857
+ false)))),
858
+ "Rewriter" => :same,
859
+ "TypeChecker" => t(:defn,
860
+ :whiles,
861
+ t(:args),
862
+ t(:scope,
863
+ t(:block,
864
+ t(:while,
865
+ t(:false, Type.bool),
866
+ t(:call,
867
+ nil,
868
+ :puts,
869
+ t(:arglist, t(:str, "false", Type.str)), Type.void),
870
+ true),
871
+ t(:while,
872
+ t(:false, Type.bool),
873
+ t(:call,
874
+ nil,
875
+ :puts,
876
+ t(:arglist, t(:str, "true", Type.str)), Type.void),
877
+ false),
878
+ Type.unknown),
879
+ Type.void),
880
+ Type.function(Type.unknown, [], Type.void)),
881
+ "CRewriter" => :same,
882
+ "RubyToAnsiC" => "void\nwhiles() {\nwhile (0) {\nputs(\"false\");\n};\n{\nputs(\"true\");\n} while (0);\n}",
883
+ "RubyToRubyC" => "static VALUE\nrrc_c_whiles(VALUE self) {\nwhile (Qfalse) {\nrb_funcall(self, rb_intern(\"puts\"), 1, rb_str_new2(\"false\"));\n};\n{\nrb_funcall(self, rb_intern(\"puts\"), 1, rb_str_new2(\"true\"));\n} while (Qfalse);\n}")
884
+
885
+ add_tests("zarray",
886
+ "Rewriter" => :same,
887
+ "TypeChecker" => t(:lasgn, :a, t(:array), Type.unknown_list),
888
+ "CRewriter" => :same,
889
+ # TODO: need to verify that our variable decl will be correct
890
+ "RubyToAnsiC" => "a = (void *) malloc(sizeof(void *) * 0)",
891
+ "RubyToRubyC" => "a = rb_ary_new2(0)")
892
+
893
+
894
+ add_skipped_tests("alias",
895
+ "alias_ugh",
896
+ "argscat_inside",
897
+ "argscat_svalue",
898
+ "argspush",
899
+ "array_pct_W_dstr",
900
+ "array_pct_w_dstr",
901
+ "attrasgn",
902
+ "back_ref",
903
+ "begin",
904
+ "begin_def",
905
+ "begin_rescue_ensure",
906
+ "begin_rescue_ensure_all_empty",
907
+ "begin_rescue_twice",
908
+ "begin_rescue_twice_mri_verbose_flag",
909
+ "block_attrasgn",
910
+ "block_lasgn",
911
+ "block_mystery_block",
912
+ "block_pass_args_and_splat",
913
+ "block_pass_call_0",
914
+ "block_pass_call_1",
915
+ "block_pass_call_n",
916
+ "block_pass_fcall_0",
917
+ "block_pass_fcall_1",
918
+ "block_pass_fcall_n",
919
+ "block_pass_omgwtf",
920
+ "block_pass_splat",
921
+ "block_pass_thingy",
922
+ "block_stmt_after",
923
+ "block_stmt_after_mri_verbose_flag",
924
+ "block_stmt_before",
925
+ "block_stmt_before_mri_verbose_flag",
926
+ "block_stmt_both",
927
+ "block_stmt_both_mri_verbose_flag",
928
+ "bmethod",
929
+ "bmethod_noargs",
930
+ "bmethod_splat",
931
+ "break",
932
+ "break_arg",
933
+ "call",
934
+ "call_arglist",
935
+ "call_arglist_hash",
936
+ "call_arglist_norm_hash",
937
+ "call_arglist_norm_hash_splat",
938
+ "call_arglist_space",
939
+ "call_command",
940
+ "call_expr",
941
+ "call_index",
942
+ "call_index_no_args",
943
+ "call_index_space",
944
+ "call_unary_neg",
945
+ "case",
946
+ "case_nested",
947
+ "case_nested_inner_no_expr",
948
+ "case_no_expr",
949
+ "case_splat",
950
+ "cdecl",
951
+ "class_plain",
952
+ "class_scoped",
953
+ "class_scoped3",
954
+ "class_super_array",
955
+ "class_super_expr",
956
+ "class_super_object",
957
+ "colon2",
958
+ "colon3",
959
+ "const",
960
+ "constX",
961
+ "constY",
962
+ "constZ",
963
+ "cvar",
964
+ "cvasgn",
965
+ "cvasgn_cls_method",
966
+ "cvdecl",
967
+ "dasgn_0",
968
+ "dasgn_1",
969
+ "dasgn_2",
970
+ "dasgn_curr",
971
+ "dasgn_icky",
972
+ "dasgn_mixed",
973
+ "defined",
974
+ "defn_args_block",
975
+ "defn_args_mand",
976
+ "defn_args_mand_block",
977
+ "defn_args_mand_opt",
978
+ "defn_args_mand_opt_block",
979
+ "defn_args_mand_opt_splat",
980
+ "defn_args_mand_opt_splat_block",
981
+ "defn_args_mand_opt_splat_no_name",
982
+ "defn_args_mand_splat",
983
+ "defn_args_mand_splat_block",
984
+ "defn_args_mand_splat_no_name",
985
+ "defn_args_opt",
986
+ "defn_args_opt_block",
987
+ "defn_args_opt_splat",
988
+ "defn_args_opt_splat_block",
989
+ "defn_args_opt_splat_no_name",
990
+ "defn_args_splat",
991
+ "defn_args_splat_no_name",
992
+ "defn_rescue",
993
+ "defn_rescue_mri_verbose_flag",
994
+ "defn_something_eh",
995
+ "defn_splat_no_name",
996
+ "defs",
997
+ "defs_empty",
998
+ "defs_empty_args",
999
+ "defs_expr_wtf",
1000
+ "dmethod",
1001
+ "dot2",
1002
+ "dot3",
1003
+ "dregx",
1004
+ "dregx_interp",
1005
+ "dregx_interp_empty",
1006
+ "dregx_n",
1007
+ "dregx_once",
1008
+ "dregx_once_n_interp",
1009
+ "dstr",
1010
+ "dstr_2",
1011
+ "dstr_3",
1012
+ "dstr_concat",
1013
+ "dstr_gross",
1014
+ "dstr_heredoc_expand",
1015
+ "dstr_heredoc_windoze_sucks",
1016
+ "dstr_heredoc_yet_again",
1017
+ "dstr_nest",
1018
+ "dstr_str_lit_start",
1019
+ "dstr_the_revenge",
1020
+ "dsym",
1021
+ "dxstr",
1022
+ "false",
1023
+ "fbody",
1024
+ "fcall_arglist",
1025
+ "fcall_arglist_hash",
1026
+ "fcall_arglist_norm_hash",
1027
+ "fcall_arglist_norm_hash_splat",
1028
+ "fcall_block",
1029
+ "fcall_index_space",
1030
+ "fcall_keyword",
1031
+ "flip2",
1032
+ "flip2_method",
1033
+ "flip3",
1034
+ "for",
1035
+ "for_no_body",
1036
+ "gasgn",
1037
+ "gvar",
1038
+ "gvar_underscore",
1039
+ "gvar_underscore_blah",
1040
+ "hash",
1041
+ "hash_rescue",
1042
+ "iasgn",
1043
+ "if_block_condition",
1044
+ "if_lasgn_short",
1045
+ "if_nested",
1046
+ "if_post",
1047
+ "if_post_not",
1048
+ "if_pre",
1049
+ "if_pre_not",
1050
+ "iter_call_arglist_space",
1051
+ "iter_dasgn_curr_dasgn_madness",
1052
+ "iter_loop_empty",
1053
+ "iter_masgn_2",
1054
+ "iter_masgn_args_splat",
1055
+ "iter_masgn_args_splat_no_name",
1056
+ "iter_masgn_splat",
1057
+ "iter_masgn_splat_no_name",
1058
+ "iter_shadowed_var",
1059
+ "iter_upto",
1060
+ "lvar_def_boundary",
1061
+ "masgn",
1062
+ "masgn_argscat",
1063
+ "masgn_attrasgn",
1064
+ "masgn_attrasgn_array_rhs",
1065
+ "masgn_attrasgn_idx",
1066
+ "masgn_cdecl",
1067
+ "masgn_iasgn",
1068
+ "masgn_masgn",
1069
+ "masgn_splat_lhs",
1070
+ "masgn_splat_no_name_to_ary",
1071
+ "masgn_splat_no_name_trailing",
1072
+ "masgn_splat_rhs_1",
1073
+ "masgn_splat_rhs_n",
1074
+ "masgn_splat_to_ary",
1075
+ "masgn_splat_to_ary2",
1076
+ "match",
1077
+ "match2",
1078
+ "match3",
1079
+ "module",
1080
+ "module_scoped",
1081
+ "module_scoped3",
1082
+ "next",
1083
+ "next_arg",
1084
+ "nth_ref",
1085
+ "op_asgn1",
1086
+ "op_asgn1_ivar",
1087
+ "op_asgn2",
1088
+ "op_asgn2_self",
1089
+ "op_asgn_and",
1090
+ "op_asgn_and_ivar2",
1091
+ "op_asgn_or",
1092
+ "op_asgn_or_block",
1093
+ "op_asgn_or_ivar",
1094
+ "op_asgn_or_ivar2",
1095
+ "or_big",
1096
+ "or_big2",
1097
+ "parse_floats_as_args",
1098
+ "postexe",
1099
+ "proc_args_0",
1100
+ "proc_args_1",
1101
+ "proc_args_2",
1102
+ "proc_args_no",
1103
+ "redo",
1104
+ "rescue",
1105
+ "rescue_block_body",
1106
+ "rescue_block_body_3",
1107
+ "rescue_block_body_ivar",
1108
+ "rescue_block_nada",
1109
+ "rescue_exceptions",
1110
+ "rescue_iasgn_var_empty",
1111
+ "rescue_lasgn",
1112
+ "rescue_lasgn_var",
1113
+ "rescue_lasgn_var_empty",
1114
+ "retry",
1115
+ "return_0",
1116
+ "return_1",
1117
+ "return_1_splatted",
1118
+ "return_n",
1119
+ "sclass",
1120
+ "sclass_trailing_class",
1121
+ "splat",
1122
+ "splat_array",
1123
+ "splat_break",
1124
+ "splat_break_array",
1125
+ "splat_fcall",
1126
+ "splat_fcall_array",
1127
+ "splat_lasgn",
1128
+ "splat_lasgn_array",
1129
+ "splat_lit_1",
1130
+ "splat_lit_n",
1131
+ "splat_next",
1132
+ "splat_next_array",
1133
+ "splat_return",
1134
+ "splat_return_array",
1135
+ "splat_super",
1136
+ "splat_super_array",
1137
+ "splat_yield",
1138
+ "splat_yield_array",
1139
+ "str",
1140
+ "str_concat_newline",
1141
+ "str_concat_space",
1142
+ "str_heredoc",
1143
+ "str_heredoc_call",
1144
+ "str_heredoc_double",
1145
+ "str_heredoc_empty",
1146
+ "str_heredoc_indent",
1147
+ "str_interp_file",
1148
+ "structure_extra_block_for_dvar_scoping",
1149
+ "structure_remove_begin_1",
1150
+ "structure_remove_begin_2",
1151
+ "structure_unused_literal_wwtt",
1152
+ "super_0",
1153
+ "super_1",
1154
+ "super_1_array",
1155
+ "super_block_pass",
1156
+ "super_block_splat",
1157
+ "super_n",
1158
+ "svalue",
1159
+ "to_ary",
1160
+ "true",
1161
+ "undef",
1162
+ "undef_2",
1163
+ "undef_3",
1164
+ "undef_block_1",
1165
+ "undef_block_2",
1166
+ "undef_block_3",
1167
+ "undef_block_3_post",
1168
+ "undef_block_wtf",
1169
+ "unless_post",
1170
+ "unless_post_not",
1171
+ "unless_pre",
1172
+ "unless_pre_not",
1173
+ "until_post",
1174
+ "until_post_not",
1175
+ "until_pre",
1176
+ "until_pre_mod",
1177
+ "until_pre_not",
1178
+ "until_pre_not_mod",
1179
+ "valias",
1180
+ "while_post",
1181
+ "while_post2",
1182
+ "while_post_not",
1183
+ "while_pre",
1184
+ "while_pre_mod",
1185
+ "while_pre_nil",
1186
+ "while_pre_not",
1187
+ "while_pre_not_mod",
1188
+ "xstr",
1189
+ "yield_0",
1190
+ "yield_1",
1191
+ "yield_array_0",
1192
+ "yield_array_1",
1193
+ "yield_array_n",
1194
+ "yield_n",
1195
+ "zsuper")
1196
+ end