debase-ruby_core_source 0.10.15 → 0.10.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/debase-ruby_core_source.gemspec +1 -1
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/addr2line.h +1 -1
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/list/list.h +773 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/str/str.h +16 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/constant.h +51 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/debug_counter.h +109 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/dln.h +10 -9
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/encindex.h +69 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/eval_intern.h +334 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/gc.h +27 -10
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id.h +250 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id_table.h +31 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns.inc +217 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns_info.inc +1570 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/internal.h +2036 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/iseq.h +308 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/known_errors.inc +16 -1
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/method.h +218 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node.h +115 -79
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node_name.inc +12 -22
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/opt_sc.inc +1601 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/optinsn.inc +103 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/optunifs.inc +28 -83
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/parse.h +74 -60
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/probes_helper.h +43 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/regenc.h +254 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regint.h +299 -211
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regparse.h +45 -37
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/revision.h +1 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ruby_assert.h +54 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/ruby_atomic.h +84 -26
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/siphash.h +1 -1
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/symbol.h +108 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_pthread.h +14 -11
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_win32.h +2 -6
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/timev.h +42 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/transcode_data.h +34 -12
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/version.h +73 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm.inc +3667 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_call_iseq_optimized.inc +213 -0
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_core.h +1768 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550/debug.h → ruby-2.5.4-p155/vm_debug.h} +4 -8
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_exec.h +38 -30
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_insnhelper.h +255 -0
- data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_opts.h +14 -9
- data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vmtc.inc +214 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +52 -42
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/constant.h +0 -34
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/encdb.h +0 -167
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/eval_intern.h +0 -234
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/id.h +0 -177
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns.inc +0 -179
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns_info.inc +0 -695
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/internal.h +0 -242
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/iseq.h +0 -126
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/method.h +0 -105
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/opt_sc.inc +0 -670
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/optinsn.inc +0 -30
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/regenc.h +0 -219
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/revision.h +0 -1
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/timev.h +0 -21
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/transdb.h +0 -189
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/version.h +0 -52
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm.inc +0 -3054
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_core.h +0 -763
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_insnhelper.h +0 -220
- data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vmtc.inc +0 -97
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
node.h -
|
4
4
|
|
5
|
-
$Author:
|
5
|
+
$Author: mame $
|
6
6
|
created at: Fri May 28 15:14:02 JST 1993
|
7
7
|
|
8
8
|
Copyright (C) 1993-2007 Yukihiro Matsumoto
|
@@ -26,12 +26,14 @@ enum node_type {
|
|
26
26
|
#define NODE_BLOCK NODE_BLOCK
|
27
27
|
NODE_IF,
|
28
28
|
#define NODE_IF NODE_IF
|
29
|
+
NODE_UNLESS,
|
30
|
+
#define NODE_UNLESS NODE_UNLESS
|
29
31
|
NODE_CASE,
|
30
32
|
#define NODE_CASE NODE_CASE
|
33
|
+
NODE_CASE2,
|
34
|
+
#define NODE_CASE2 NODE_CASE2
|
31
35
|
NODE_WHEN,
|
32
36
|
#define NODE_WHEN NODE_WHEN
|
33
|
-
NODE_OPT_N,
|
34
|
-
#define NODE_OPT_N NODE_OPT_N
|
35
37
|
NODE_WHILE,
|
36
38
|
#define NODE_WHILE NODE_WHILE
|
37
39
|
NODE_UNTIL,
|
@@ -72,14 +74,10 @@ enum node_type {
|
|
72
74
|
#define NODE_GASGN NODE_GASGN
|
73
75
|
NODE_IASGN,
|
74
76
|
#define NODE_IASGN NODE_IASGN
|
75
|
-
NODE_IASGN2,
|
76
|
-
#define NODE_IASGN2 NODE_IASGN2
|
77
77
|
NODE_CDECL,
|
78
78
|
#define NODE_CDECL NODE_CDECL
|
79
79
|
NODE_CVASGN,
|
80
80
|
#define NODE_CVASGN NODE_CVASGN
|
81
|
-
NODE_CVDECL,
|
82
|
-
#define NODE_CVDECL NODE_CVDECL
|
83
81
|
NODE_OP_ASGN1,
|
84
82
|
#define NODE_OP_ASGN1 NODE_OP_ASGN1
|
85
83
|
NODE_OP_ASGN2,
|
@@ -88,12 +86,18 @@ enum node_type {
|
|
88
86
|
#define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
|
89
87
|
NODE_OP_ASGN_OR,
|
90
88
|
#define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
|
89
|
+
NODE_OP_CDECL,
|
90
|
+
#define NODE_OP_CDECL NODE_OP_CDECL
|
91
91
|
NODE_CALL,
|
92
92
|
#define NODE_CALL NODE_CALL
|
93
|
+
NODE_OPCALL,
|
94
|
+
#define NODE_OPCALL NODE_OPCALL
|
93
95
|
NODE_FCALL,
|
94
96
|
#define NODE_FCALL NODE_FCALL
|
95
97
|
NODE_VCALL,
|
96
98
|
#define NODE_VCALL NODE_VCALL
|
99
|
+
NODE_QCALL,
|
100
|
+
#define NODE_QCALL NODE_QCALL
|
97
101
|
NODE_SUPER,
|
98
102
|
#define NODE_SUPER NODE_SUPER
|
99
103
|
NODE_ZSUPER,
|
@@ -146,14 +150,14 @@ enum node_type {
|
|
146
150
|
#define NODE_EVSTR NODE_EVSTR
|
147
151
|
NODE_DREGX,
|
148
152
|
#define NODE_DREGX NODE_DREGX
|
149
|
-
NODE_DREGX_ONCE,
|
150
|
-
#define NODE_DREGX_ONCE NODE_DREGX_ONCE
|
151
153
|
NODE_ARGS,
|
152
154
|
#define NODE_ARGS NODE_ARGS
|
153
155
|
NODE_ARGS_AUX,
|
154
156
|
#define NODE_ARGS_AUX NODE_ARGS_AUX
|
155
157
|
NODE_OPT_ARG,
|
156
158
|
#define NODE_OPT_ARG NODE_OPT_ARG
|
159
|
+
NODE_KW_ARG,
|
160
|
+
#define NODE_KW_ARG NODE_KW_ARG
|
157
161
|
NODE_POSTARG,
|
158
162
|
#define NODE_POSTARG NODE_POSTARG
|
159
163
|
NODE_ARGSCAT,
|
@@ -162,10 +166,6 @@ enum node_type {
|
|
162
166
|
#define NODE_ARGSPUSH NODE_ARGSPUSH
|
163
167
|
NODE_SPLAT,
|
164
168
|
#define NODE_SPLAT NODE_SPLAT
|
165
|
-
NODE_TO_ARY,
|
166
|
-
#define NODE_TO_ARY NODE_TO_ARY
|
167
|
-
NODE_BLOCK_ARG,
|
168
|
-
#define NODE_BLOCK_ARG NODE_BLOCK_ARG
|
169
169
|
NODE_BLOCK_PASS,
|
170
170
|
#define NODE_BLOCK_PASS NODE_BLOCK_PASS
|
171
171
|
NODE_DEFN,
|
@@ -210,14 +210,6 @@ enum node_type {
|
|
210
210
|
#define NODE_DEFINED NODE_DEFINED
|
211
211
|
NODE_POSTEXE,
|
212
212
|
#define NODE_POSTEXE NODE_POSTEXE
|
213
|
-
NODE_ALLOCA,
|
214
|
-
#define NODE_ALLOCA NODE_ALLOCA
|
215
|
-
NODE_BMETHOD,
|
216
|
-
#define NODE_BMETHOD NODE_BMETHOD
|
217
|
-
NODE_MEMO,
|
218
|
-
#define NODE_MEMO NODE_MEMO
|
219
|
-
NODE_IFUNC,
|
220
|
-
#define NODE_IFUNC NODE_IFUNC
|
221
213
|
NODE_DSYM,
|
222
214
|
#define NODE_DSYM NODE_DSYM
|
223
215
|
NODE_ATTRASGN,
|
@@ -226,15 +218,22 @@ enum node_type {
|
|
226
218
|
#define NODE_PRELUDE NODE_PRELUDE
|
227
219
|
NODE_LAMBDA,
|
228
220
|
#define NODE_LAMBDA NODE_LAMBDA
|
229
|
-
NODE_OPTBLOCK,
|
230
|
-
#define NODE_OPTBLOCK NODE_OPTBLOCK
|
231
221
|
NODE_LAST
|
232
222
|
#define NODE_LAST NODE_LAST
|
233
223
|
};
|
234
224
|
|
225
|
+
typedef struct rb_code_location_struct {
|
226
|
+
int lineno;
|
227
|
+
int column;
|
228
|
+
} rb_code_location_t;
|
229
|
+
|
230
|
+
typedef struct rb_code_range_struct {
|
231
|
+
rb_code_location_t first_loc;
|
232
|
+
rb_code_location_t last_loc;
|
233
|
+
} rb_code_range_t;
|
234
|
+
|
235
235
|
typedef struct RNode {
|
236
236
|
VALUE flags;
|
237
|
-
VALUE nd_reserved; /* ex nd_file */
|
238
237
|
union {
|
239
238
|
struct RNode *node;
|
240
239
|
ID id;
|
@@ -253,29 +252,46 @@ typedef struct RNode {
|
|
253
252
|
ID id;
|
254
253
|
long state;
|
255
254
|
struct rb_global_entry *entry;
|
255
|
+
struct rb_args_info *args;
|
256
256
|
long cnt;
|
257
257
|
VALUE value;
|
258
258
|
} u3;
|
259
|
+
rb_code_range_t nd_loc;
|
259
260
|
} NODE;
|
260
261
|
|
261
262
|
#define RNODE(obj) (R_CAST(RNode)(obj))
|
262
263
|
|
263
|
-
/* 0..4:T_TYPES, 5:
|
264
|
-
|
265
|
-
|
264
|
+
/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTED, 10: EXIVAR, 11: FREEZE */
|
265
|
+
/* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE,
|
266
|
+
* 8..14: nd_type,
|
267
|
+
* 15..: nd_line
|
268
|
+
*/
|
269
|
+
#define NODE_FL_NEWLINE (((VALUE)1)<<7)
|
266
270
|
|
267
271
|
#define NODE_TYPESHIFT 8
|
268
272
|
#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
|
269
273
|
|
270
|
-
#define nd_type(n) ((int) (((
|
274
|
+
#define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
|
271
275
|
#define nd_set_type(n,t) \
|
272
|
-
|
276
|
+
(n)->flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
|
273
277
|
|
274
278
|
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
|
275
279
|
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
|
276
|
-
#define nd_line(n) (int)(
|
280
|
+
#define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT)
|
277
281
|
#define nd_set_line(n,l) \
|
278
|
-
|
282
|
+
(n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
|
283
|
+
|
284
|
+
#define nd_first_column(n) ((int)((n)->nd_loc.first_loc.column))
|
285
|
+
#define nd_set_first_column(n, v) ((n)->nd_loc.first_loc.column = (v))
|
286
|
+
#define nd_first_lineno(n) ((int)((n)->nd_loc.first_loc.lineno))
|
287
|
+
#define nd_set_first_lineno(n, v) ((n)->nd_loc.first_loc.lineno = (v))
|
288
|
+
|
289
|
+
#define nd_last_column(n) ((int)((n)->nd_loc.last_loc.column))
|
290
|
+
#define nd_set_last_column(n, v) ((n)->nd_loc.last_loc.column = (v))
|
291
|
+
#define nd_last_lineno(n) ((int)((n)->nd_loc.last_loc.lineno))
|
292
|
+
#define nd_set_last_lineno(n, v) ((n)->nd_loc.last_loc.lineno = (v))
|
293
|
+
#define nd_last_loc(n) ((n)->nd_loc.last_loc)
|
294
|
+
#define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
|
279
295
|
|
280
296
|
#define nd_head u1.node
|
281
297
|
#define nd_alen u2.argc
|
@@ -285,8 +301,6 @@ typedef struct RNode {
|
|
285
301
|
#define nd_body u2.node
|
286
302
|
#define nd_else u3.node
|
287
303
|
|
288
|
-
#define nd_orig u3.value
|
289
|
-
|
290
304
|
#define nd_resq u2.node
|
291
305
|
#define nd_ensr u3.node
|
292
306
|
|
@@ -321,6 +335,7 @@ typedef struct RNode {
|
|
321
335
|
#define nd_recv u1.node
|
322
336
|
#define nd_mid u2.id
|
323
337
|
#define nd_args u3.node
|
338
|
+
#define nd_ainfo u3.args
|
324
339
|
|
325
340
|
#define nd_noex u3.id
|
326
341
|
#define nd_defn u3.node
|
@@ -331,9 +346,6 @@ typedef struct RNode {
|
|
331
346
|
#define nd_cpath u1.node
|
332
347
|
#define nd_super u3.node
|
333
348
|
|
334
|
-
#define nd_modl u1.id
|
335
|
-
#define nd_clss u1.value
|
336
|
-
|
337
349
|
#define nd_beg u1.node
|
338
350
|
#define nd_end u2.node
|
339
351
|
#define nd_state u3.state
|
@@ -342,27 +354,29 @@ typedef struct RNode {
|
|
342
354
|
#define nd_nth u2.argc
|
343
355
|
|
344
356
|
#define nd_tag u1.id
|
345
|
-
#define nd_tval u2.value
|
346
357
|
|
347
|
-
#define
|
358
|
+
#define nd_alias u1.id
|
359
|
+
#define nd_orig u2.id
|
360
|
+
#define nd_undef u2.node
|
361
|
+
|
362
|
+
#define nd_compile_option u3.value
|
348
363
|
|
349
364
|
#define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
|
350
365
|
|
351
366
|
#define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
|
352
367
|
#define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
|
353
|
-
#define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
|
354
368
|
#define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
|
355
369
|
#define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
|
356
370
|
#define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
|
357
|
-
#define NEW_UNLESS(c,t,e)
|
371
|
+
#define NEW_UNLESS(c,t,e) NEW_NODE(NODE_UNLESS,c,t,e)
|
358
372
|
#define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
|
373
|
+
#define NEW_CASE2(b) NEW_NODE(NODE_CASE2,0,b,0)
|
359
374
|
#define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
|
360
|
-
#define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
|
361
375
|
#define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
|
362
376
|
#define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
|
363
377
|
#define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
|
364
378
|
#define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
|
365
|
-
#define NEW_LAMBDA(a) NEW_NODE(NODE_LAMBDA,a,
|
379
|
+
#define NEW_LAMBDA(a,b) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b),0)
|
366
380
|
#define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
|
367
381
|
#define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
|
368
382
|
#define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
|
@@ -372,7 +386,7 @@ typedef struct RNode {
|
|
372
386
|
#define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
|
373
387
|
#define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
|
374
388
|
#define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
|
375
|
-
#define NEW_YIELD(a
|
389
|
+
#define NEW_YIELD(a) NEW_NODE(NODE_YIELD,a,0,0)
|
376
390
|
#define NEW_LIST(a) NEW_ARRAY(a)
|
377
391
|
#define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
|
378
392
|
#define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
|
@@ -383,15 +397,14 @@ typedef struct RNode {
|
|
383
397
|
#define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
|
384
398
|
#define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
|
385
399
|
#define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
|
386
|
-
#define NEW_IASGN2(v,val) NEW_NODE(NODE_IASGN2,v,val,0)
|
387
400
|
#define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
|
388
401
|
#define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
|
389
|
-
#define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
|
390
402
|
#define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
|
391
|
-
#define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
|
392
|
-
#define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,
|
403
|
+
#define NEW_OP_ASGN2(r,t,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o,t))
|
404
|
+
#define NEW_OP_ASGN22(i,o,t) NEW_NODE(NODE_OP_ASGN2,i,o,t)
|
393
405
|
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
|
394
406
|
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
|
407
|
+
#define NEW_OP_CDECL(v,op,val) NEW_NODE(NODE_OP_CDECL,v,val,op)
|
395
408
|
#define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
|
396
409
|
#define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
|
397
410
|
#define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
|
@@ -411,19 +424,18 @@ typedef struct RNode {
|
|
411
424
|
#define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
|
412
425
|
#define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
|
413
426
|
#define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
|
427
|
+
#define NEW_OPCALL(r,m,a) NEW_NODE(NODE_OPCALL,r,m,a)
|
414
428
|
#define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
|
415
429
|
#define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
|
416
430
|
#define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
|
417
431
|
#define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
|
418
|
-
#define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
|
419
432
|
#define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
|
420
433
|
#define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
|
434
|
+
#define NEW_KW_ARG(i,v) NEW_NODE(NODE_KW_ARG,i,v,0)
|
421
435
|
#define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
|
422
436
|
#define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
|
423
437
|
#define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
|
424
438
|
#define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
|
425
|
-
#define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
|
426
|
-
#define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
|
427
439
|
#define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
|
428
440
|
#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
|
429
441
|
#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
|
@@ -443,15 +455,31 @@ typedef struct RNode {
|
|
443
455
|
#define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
|
444
456
|
#define NEW_PREEXE(b) NEW_SCOPE(b)
|
445
457
|
#define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
|
446
|
-
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
|
447
458
|
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
|
448
|
-
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,
|
449
|
-
#define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
|
450
|
-
#define NEW_MEMO(a,b,c) NEW_NODE(NODE_MEMO,a,b,c)
|
459
|
+
#define NEW_PRELUDE(p,b,o) NEW_NODE(NODE_PRELUDE,p,b,o)
|
451
460
|
|
452
|
-
#
|
453
|
-
#
|
454
|
-
|
461
|
+
#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
|
462
|
+
#define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
|
463
|
+
|
464
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
465
|
+
|
466
|
+
typedef struct node_buffer_struct node_buffer_t;
|
467
|
+
/* T_IMEMO/ast */
|
468
|
+
typedef struct rb_ast_struct {
|
469
|
+
VALUE flags;
|
470
|
+
VALUE reserved1;
|
471
|
+
NODE *root;
|
472
|
+
node_buffer_t *node_buffer;
|
473
|
+
VALUE mark_ary;
|
474
|
+
} rb_ast_t;
|
475
|
+
rb_ast_t *rb_ast_new();
|
476
|
+
void rb_ast_mark(rb_ast_t*);
|
477
|
+
void rb_ast_dispose(rb_ast_t*);
|
478
|
+
void rb_ast_free(rb_ast_t*);
|
479
|
+
void rb_ast_add_mark_object(rb_ast_t*, VALUE);
|
480
|
+
void rb_ast_delete_mark_object(rb_ast_t*, VALUE);
|
481
|
+
NODE *rb_ast_newnode(rb_ast_t*);
|
482
|
+
void rb_ast_delete_node(rb_ast_t*, NODE *n);
|
455
483
|
|
456
484
|
VALUE rb_parser_new(void);
|
457
485
|
VALUE rb_parser_end_seen_p(VALUE);
|
@@ -459,40 +487,48 @@ VALUE rb_parser_encoding(VALUE);
|
|
459
487
|
VALUE rb_parser_get_yydebug(VALUE);
|
460
488
|
VALUE rb_parser_set_yydebug(VALUE, VALUE);
|
461
489
|
VALUE rb_parser_dump_tree(NODE *node, int comment);
|
462
|
-
|
463
|
-
NODE *rb_parser_while_loop(VALUE, NODE *, int, int);
|
490
|
+
void rb_parser_set_options(VALUE, int, int, int, int);
|
464
491
|
|
465
|
-
|
466
|
-
|
467
|
-
|
492
|
+
rb_ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
|
493
|
+
rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
|
494
|
+
rb_ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int);
|
495
|
+
rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
|
496
|
+
rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
|
468
497
|
|
469
|
-
|
470
|
-
|
471
|
-
|
498
|
+
rb_ast_t *rb_compile_cstr(const char*, const char*, int, int);
|
499
|
+
rb_ast_t *rb_compile_string(const char*, VALUE, int);
|
500
|
+
rb_ast_t *rb_compile_file(const char*, VALUE, int);
|
472
501
|
|
473
|
-
NODE *
|
474
|
-
NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
|
502
|
+
void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2);
|
475
503
|
|
476
|
-
struct rb_global_entry {
|
477
|
-
struct rb_global_variable *var;
|
478
|
-
ID id;
|
479
|
-
};
|
480
|
-
|
481
|
-
struct rb_global_entry *rb_global_entry(ID);
|
482
|
-
VALUE rb_gvar_get(struct rb_global_entry *);
|
483
|
-
VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
|
484
|
-
VALUE rb_gvar_defined(struct rb_global_entry *);
|
485
504
|
const struct kwtable *rb_reserved_word(const char *, unsigned int);
|
486
505
|
|
506
|
+
struct rb_args_info {
|
507
|
+
NODE *pre_init;
|
508
|
+
NODE *post_init;
|
509
|
+
|
510
|
+
int pre_args_num; /* count of mandatory pre-arguments */
|
511
|
+
int post_args_num; /* count of mandatory post-arguments */
|
512
|
+
|
513
|
+
ID first_post_arg;
|
514
|
+
|
515
|
+
ID rest_arg;
|
516
|
+
ID block_arg;
|
517
|
+
|
518
|
+
NODE *kw_args;
|
519
|
+
NODE *kw_rest_arg;
|
520
|
+
|
521
|
+
NODE *opt_args;
|
522
|
+
};
|
523
|
+
|
487
524
|
struct parser_params;
|
488
525
|
void *rb_parser_malloc(struct parser_params *, size_t);
|
489
526
|
void *rb_parser_realloc(struct parser_params *, void *, size_t);
|
490
527
|
void *rb_parser_calloc(struct parser_params *, size_t, size_t);
|
491
528
|
void rb_parser_free(struct parser_params *, void *);
|
529
|
+
void rb_parser_printf(struct parser_params *parser, const char *fmt, ...);
|
492
530
|
|
493
|
-
|
494
|
-
#pragma GCC visibility pop
|
495
|
-
#endif
|
531
|
+
RUBY_SYMBOL_EXPORT_END
|
496
532
|
|
497
533
|
#if defined(__cplusplus)
|
498
534
|
#if 0
|
@@ -4,12 +4,14 @@
|
|
4
4
|
return "NODE_BLOCK";
|
5
5
|
case NODE_IF:
|
6
6
|
return "NODE_IF";
|
7
|
+
case NODE_UNLESS:
|
8
|
+
return "NODE_UNLESS";
|
7
9
|
case NODE_CASE:
|
8
10
|
return "NODE_CASE";
|
11
|
+
case NODE_CASE2:
|
12
|
+
return "NODE_CASE2";
|
9
13
|
case NODE_WHEN:
|
10
14
|
return "NODE_WHEN";
|
11
|
-
case NODE_OPT_N:
|
12
|
-
return "NODE_OPT_N";
|
13
15
|
case NODE_WHILE:
|
14
16
|
return "NODE_WHILE";
|
15
17
|
case NODE_UNTIL:
|
@@ -50,14 +52,10 @@
|
|
50
52
|
return "NODE_GASGN";
|
51
53
|
case NODE_IASGN:
|
52
54
|
return "NODE_IASGN";
|
53
|
-
case NODE_IASGN2:
|
54
|
-
return "NODE_IASGN2";
|
55
55
|
case NODE_CDECL:
|
56
56
|
return "NODE_CDECL";
|
57
57
|
case NODE_CVASGN:
|
58
58
|
return "NODE_CVASGN";
|
59
|
-
case NODE_CVDECL:
|
60
|
-
return "NODE_CVDECL";
|
61
59
|
case NODE_OP_ASGN1:
|
62
60
|
return "NODE_OP_ASGN1";
|
63
61
|
case NODE_OP_ASGN2:
|
@@ -66,12 +64,18 @@
|
|
66
64
|
return "NODE_OP_ASGN_AND";
|
67
65
|
case NODE_OP_ASGN_OR:
|
68
66
|
return "NODE_OP_ASGN_OR";
|
67
|
+
case NODE_OP_CDECL:
|
68
|
+
return "NODE_OP_CDECL";
|
69
69
|
case NODE_CALL:
|
70
70
|
return "NODE_CALL";
|
71
|
+
case NODE_OPCALL:
|
72
|
+
return "NODE_OPCALL";
|
71
73
|
case NODE_FCALL:
|
72
74
|
return "NODE_FCALL";
|
73
75
|
case NODE_VCALL:
|
74
76
|
return "NODE_VCALL";
|
77
|
+
case NODE_QCALL:
|
78
|
+
return "NODE_QCALL";
|
75
79
|
case NODE_SUPER:
|
76
80
|
return "NODE_SUPER";
|
77
81
|
case NODE_ZSUPER:
|
@@ -124,14 +128,14 @@
|
|
124
128
|
return "NODE_EVSTR";
|
125
129
|
case NODE_DREGX:
|
126
130
|
return "NODE_DREGX";
|
127
|
-
case NODE_DREGX_ONCE:
|
128
|
-
return "NODE_DREGX_ONCE";
|
129
131
|
case NODE_ARGS:
|
130
132
|
return "NODE_ARGS";
|
131
133
|
case NODE_ARGS_AUX:
|
132
134
|
return "NODE_ARGS_AUX";
|
133
135
|
case NODE_OPT_ARG:
|
134
136
|
return "NODE_OPT_ARG";
|
137
|
+
case NODE_KW_ARG:
|
138
|
+
return "NODE_KW_ARG";
|
135
139
|
case NODE_POSTARG:
|
136
140
|
return "NODE_POSTARG";
|
137
141
|
case NODE_ARGSCAT:
|
@@ -140,10 +144,6 @@
|
|
140
144
|
return "NODE_ARGSPUSH";
|
141
145
|
case NODE_SPLAT:
|
142
146
|
return "NODE_SPLAT";
|
143
|
-
case NODE_TO_ARY:
|
144
|
-
return "NODE_TO_ARY";
|
145
|
-
case NODE_BLOCK_ARG:
|
146
|
-
return "NODE_BLOCK_ARG";
|
147
147
|
case NODE_BLOCK_PASS:
|
148
148
|
return "NODE_BLOCK_PASS";
|
149
149
|
case NODE_DEFN:
|
@@ -188,14 +188,6 @@
|
|
188
188
|
return "NODE_DEFINED";
|
189
189
|
case NODE_POSTEXE:
|
190
190
|
return "NODE_POSTEXE";
|
191
|
-
case NODE_ALLOCA:
|
192
|
-
return "NODE_ALLOCA";
|
193
|
-
case NODE_BMETHOD:
|
194
|
-
return "NODE_BMETHOD";
|
195
|
-
case NODE_MEMO:
|
196
|
-
return "NODE_MEMO";
|
197
|
-
case NODE_IFUNC:
|
198
|
-
return "NODE_IFUNC";
|
199
191
|
case NODE_DSYM:
|
200
192
|
return "NODE_DSYM";
|
201
193
|
case NODE_ATTRASGN:
|
@@ -204,5 +196,3 @@
|
|
204
196
|
return "NODE_PRELUDE";
|
205
197
|
case NODE_LAMBDA:
|
206
198
|
return "NODE_LAMBDA";
|
207
|
-
case NODE_OPTBLOCK:
|
208
|
-
return "NODE_OPTBLOCK";
|