debase-ruby_core_source 0.10.5 → 0.10.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/lib/debase/ruby_core_source.rb +1 -1
  4. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/addr2line.h +21 -0
  5. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/list/list.h +788 -0
  9. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ccan/str/str.h +16 -0
  10. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/constant.h +51 -0
  11. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/debug_counter.h +283 -0
  12. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/dln.h +51 -0
  13. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/encindex.h +69 -0
  14. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/eval_intern.h +333 -0
  15. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/gc.h +116 -0
  16. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/hrtime.h +168 -0
  17. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/id.h +252 -0
  18. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/id_table.h +31 -0
  19. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/insns.inc +249 -0
  20. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/insns_info.inc +9374 -0
  21. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/internal.h +2470 -0
  22. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/iseq.h +304 -0
  23. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/known_errors.inc +791 -0
  24. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/method.h +229 -0
  25. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/mjit.h +148 -0
  26. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/mjit_compile.inc +4226 -0
  27. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/node.h +449 -0
  28. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/node_name.inc +200 -0
  29. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/opt_sc.inc +109 -0
  30. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/optinsn.inc +128 -0
  31. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/optunifs.inc +43 -0
  32. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/parse.h +207 -0
  33. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/probes_helper.h +42 -0
  34. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/regenc.h +254 -0
  35. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/regint.h +938 -0
  36. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/regparse.h +370 -0
  37. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/revision.h +1 -0
  38. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ruby_assert.h +60 -0
  39. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/ruby_atomic.h +244 -0
  40. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/siphash.h +48 -0
  41. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/symbol.h +112 -0
  42. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/thread_pthread.h +75 -0
  43. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/thread_win32.h +36 -0
  44. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/timev.h +53 -0
  45. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/transcode_data.h +139 -0
  46. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/transient_heap.h +60 -0
  47. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/version.h +73 -0
  48. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm.inc +4504 -0
  49. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_call_iseq_optimized.inc +213 -0
  50. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_core.h +1910 -0
  51. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_debug.h +37 -0
  52. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_exec.h +202 -0
  53. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_insnhelper.h +316 -0
  54. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vm_opts.h +70 -0
  55. data/lib/debase/ruby_core_source/ruby-2.6.5-p114/vmtc.inc +243 -0
  56. data/lib/debase/ruby_core_source/version.rb +1 -1
  57. metadata +55 -3
@@ -0,0 +1,449 @@
1
+ /**********************************************************************
2
+
3
+ node.h -
4
+
5
+ $Author: nobu $
6
+ created at: Fri May 28 15:14:02 JST 1993
7
+
8
+ Copyright (C) 1993-2007 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_NODE_H
13
+ #define RUBY_NODE_H 1
14
+
15
+ #if defined(__cplusplus)
16
+ extern "C" {
17
+ #if 0
18
+ } /* satisfy cc-mode */
19
+ #endif
20
+ #endif
21
+
22
+ enum node_type {
23
+ NODE_SCOPE,
24
+ NODE_BLOCK,
25
+ NODE_IF,
26
+ NODE_UNLESS,
27
+ NODE_CASE,
28
+ NODE_CASE2,
29
+ NODE_WHEN,
30
+ NODE_WHILE,
31
+ NODE_UNTIL,
32
+ NODE_ITER,
33
+ NODE_FOR,
34
+ NODE_FOR_MASGN,
35
+ NODE_BREAK,
36
+ NODE_NEXT,
37
+ NODE_REDO,
38
+ NODE_RETRY,
39
+ NODE_BEGIN,
40
+ NODE_RESCUE,
41
+ NODE_RESBODY,
42
+ NODE_ENSURE,
43
+ NODE_AND,
44
+ NODE_OR,
45
+ NODE_MASGN,
46
+ NODE_LASGN,
47
+ NODE_DASGN,
48
+ NODE_DASGN_CURR,
49
+ NODE_GASGN,
50
+ NODE_IASGN,
51
+ NODE_CDECL,
52
+ NODE_CVASGN,
53
+ NODE_OP_ASGN1,
54
+ NODE_OP_ASGN2,
55
+ NODE_OP_ASGN_AND,
56
+ NODE_OP_ASGN_OR,
57
+ NODE_OP_CDECL,
58
+ NODE_CALL,
59
+ NODE_OPCALL,
60
+ NODE_FCALL,
61
+ NODE_VCALL,
62
+ NODE_QCALL,
63
+ NODE_SUPER,
64
+ NODE_ZSUPER,
65
+ NODE_ARRAY,
66
+ NODE_ZARRAY,
67
+ NODE_VALUES,
68
+ NODE_HASH,
69
+ NODE_RETURN,
70
+ NODE_YIELD,
71
+ NODE_LVAR,
72
+ NODE_DVAR,
73
+ NODE_GVAR,
74
+ NODE_IVAR,
75
+ NODE_CONST,
76
+ NODE_CVAR,
77
+ NODE_NTH_REF,
78
+ NODE_BACK_REF,
79
+ NODE_MATCH,
80
+ NODE_MATCH2,
81
+ NODE_MATCH3,
82
+ NODE_LIT,
83
+ NODE_STR,
84
+ NODE_DSTR,
85
+ NODE_XSTR,
86
+ NODE_DXSTR,
87
+ NODE_EVSTR,
88
+ NODE_DREGX,
89
+ NODE_ONCE,
90
+ NODE_ARGS,
91
+ NODE_ARGS_AUX,
92
+ NODE_OPT_ARG,
93
+ NODE_KW_ARG,
94
+ NODE_POSTARG,
95
+ NODE_ARGSCAT,
96
+ NODE_ARGSPUSH,
97
+ NODE_SPLAT,
98
+ NODE_BLOCK_PASS,
99
+ NODE_DEFN,
100
+ NODE_DEFS,
101
+ NODE_ALIAS,
102
+ NODE_VALIAS,
103
+ NODE_UNDEF,
104
+ NODE_CLASS,
105
+ NODE_MODULE,
106
+ NODE_SCLASS,
107
+ NODE_COLON2,
108
+ NODE_COLON3,
109
+ NODE_DOT2,
110
+ NODE_DOT3,
111
+ NODE_FLIP2,
112
+ NODE_FLIP3,
113
+ NODE_SELF,
114
+ NODE_NIL,
115
+ NODE_TRUE,
116
+ NODE_FALSE,
117
+ NODE_ERRINFO,
118
+ NODE_DEFINED,
119
+ NODE_POSTEXE,
120
+ NODE_DSYM,
121
+ NODE_ATTRASGN,
122
+ NODE_LAMBDA,
123
+ NODE_LAST
124
+ };
125
+
126
+ typedef struct rb_code_position_struct {
127
+ int lineno;
128
+ int column;
129
+ } rb_code_position_t;
130
+
131
+ typedef struct rb_code_location_struct {
132
+ rb_code_position_t beg_pos;
133
+ rb_code_position_t end_pos;
134
+ } rb_code_location_t;
135
+
136
+ static inline rb_code_location_t code_loc_gen(rb_code_location_t *loc1, rb_code_location_t *loc2)
137
+ {
138
+ rb_code_location_t loc;
139
+ loc.beg_pos = loc1->beg_pos;
140
+ loc.end_pos = loc2->end_pos;
141
+ return loc;
142
+ }
143
+
144
+ typedef struct RNode {
145
+ VALUE flags;
146
+ union {
147
+ struct RNode *node;
148
+ ID id;
149
+ VALUE value;
150
+ ID *tbl;
151
+ } u1;
152
+ union {
153
+ struct RNode *node;
154
+ ID id;
155
+ long argc;
156
+ VALUE value;
157
+ } u2;
158
+ union {
159
+ struct RNode *node;
160
+ ID id;
161
+ long state;
162
+ struct rb_global_entry *entry;
163
+ struct rb_args_info *args;
164
+ VALUE value;
165
+ } u3;
166
+ rb_code_location_t nd_loc;
167
+ int node_id;
168
+ } NODE;
169
+
170
+ #define RNODE(obj) (R_CAST(RNode)(obj))
171
+
172
+ /* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTED, 10: EXIVAR, 11: FREEZE */
173
+ /* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE,
174
+ * 8..14: nd_type,
175
+ * 15..: nd_line
176
+ */
177
+ #define NODE_FL_NEWLINE (((VALUE)1)<<7)
178
+
179
+ #define NODE_TYPESHIFT 8
180
+ #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
181
+
182
+ #define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
183
+ #define nd_set_type(n,t) \
184
+ (n)->flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
185
+
186
+ #define NODE_LSHIFT (NODE_TYPESHIFT+7)
187
+ #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
188
+ #define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT)
189
+ #define nd_set_line(n,l) \
190
+ (n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
191
+
192
+ #define nd_first_column(n) ((int)((n)->nd_loc.beg_pos.column))
193
+ #define nd_set_first_column(n, v) ((n)->nd_loc.beg_pos.column = (v))
194
+ #define nd_first_lineno(n) ((int)((n)->nd_loc.beg_pos.lineno))
195
+ #define nd_set_first_lineno(n, v) ((n)->nd_loc.beg_pos.lineno = (v))
196
+ #define nd_first_loc(n) ((n)->nd_loc.beg_pos)
197
+ #define nd_set_first_loc(n, v) (nd_first_loc(n) = (v))
198
+
199
+ #define nd_last_column(n) ((int)((n)->nd_loc.end_pos.column))
200
+ #define nd_set_last_column(n, v) ((n)->nd_loc.end_pos.column = (v))
201
+ #define nd_last_lineno(n) ((int)((n)->nd_loc.end_pos.lineno))
202
+ #define nd_set_last_lineno(n, v) ((n)->nd_loc.end_pos.lineno = (v))
203
+ #define nd_last_loc(n) ((n)->nd_loc.end_pos)
204
+ #define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
205
+ #define nd_node_id(n) ((n)->node_id)
206
+ #define nd_set_node_id(n,id) ((n)->node_id = (id))
207
+
208
+ #define nd_head u1.node
209
+ #define nd_alen u2.argc
210
+ #define nd_next u3.node
211
+
212
+ #define nd_cond u1.node
213
+ #define nd_body u2.node
214
+ #define nd_else u3.node
215
+
216
+ #define nd_resq u2.node
217
+ #define nd_ensr u3.node
218
+
219
+ #define nd_1st u1.node
220
+ #define nd_2nd u2.node
221
+
222
+ #define nd_stts u1.node
223
+
224
+ #define nd_entry u3.entry
225
+ #define nd_vid u1.id
226
+ #define nd_cflag u2.id
227
+ #define nd_cval u3.value
228
+
229
+ #define nd_oid u1.id
230
+ #define nd_tbl u1.tbl
231
+
232
+ #define nd_var u1.node
233
+ #define nd_iter u3.node
234
+
235
+ #define nd_value u2.node
236
+ #define nd_aid u3.id
237
+
238
+ #define nd_lit u1.value
239
+
240
+ #define nd_rest u1.id
241
+ #define nd_opt u1.node
242
+ #define nd_pid u1.id
243
+ #define nd_plen u2.argc
244
+
245
+ #define nd_recv u1.node
246
+ #define nd_mid u2.id
247
+ #define nd_args u3.node
248
+ #define nd_ainfo u3.args
249
+
250
+ #define nd_defn u3.node
251
+
252
+ #define nd_cpath u1.node
253
+ #define nd_super u3.node
254
+
255
+ #define nd_beg u1.node
256
+ #define nd_end u2.node
257
+ #define nd_state u3.state
258
+ #define nd_rval u2.value
259
+
260
+ #define nd_nth u2.argc
261
+
262
+ #define nd_tag u1.id
263
+
264
+ #define nd_alias u1.id
265
+ #define nd_orig u2.id
266
+ #define nd_undef u2.node
267
+
268
+ #define NEW_NODE(t,a0,a1,a2,loc) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2),loc)
269
+
270
+ #define NEW_DEFN(i,a,d,loc) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d,loc),loc)
271
+ #define NEW_DEFS(r,i,a,d,loc) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d,loc),loc)
272
+ #define NEW_SCOPE(a,b,loc) NEW_NODE(NODE_SCOPE,local_tbl(p),b,a,loc)
273
+ #define NEW_BLOCK(a,loc) NEW_NODE(NODE_BLOCK,a,0,0,loc)
274
+ #define NEW_IF(c,t,e,loc) NEW_NODE(NODE_IF,c,t,e,loc)
275
+ #define NEW_UNLESS(c,t,e,loc) NEW_NODE(NODE_UNLESS,c,t,e,loc)
276
+ #define NEW_CASE(h,b,loc) NEW_NODE(NODE_CASE,h,b,0,loc)
277
+ #define NEW_CASE2(b,loc) NEW_NODE(NODE_CASE2,0,b,0,loc)
278
+ #define NEW_WHEN(c,t,e,loc) NEW_NODE(NODE_WHEN,c,t,e,loc)
279
+ #define NEW_WHILE(c,b,n,loc) NEW_NODE(NODE_WHILE,c,b,n,loc)
280
+ #define NEW_UNTIL(c,b,n,loc) NEW_NODE(NODE_UNTIL,c,b,n,loc)
281
+ #define NEW_FOR(i,b,loc) NEW_NODE(NODE_FOR,0,b,i,loc)
282
+ #define NEW_FOR_MASGN(v,loc) NEW_NODE(NODE_FOR_MASGN,v,0,0,loc)
283
+ #define NEW_ITER(a,b,loc) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b,loc),0,loc)
284
+ #define NEW_LAMBDA(a,b,loc) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b,loc),0,loc)
285
+ #define NEW_BREAK(s,loc) NEW_NODE(NODE_BREAK,s,0,0,loc)
286
+ #define NEW_NEXT(s,loc) NEW_NODE(NODE_NEXT,s,0,0,loc)
287
+ #define NEW_REDO(loc) NEW_NODE(NODE_REDO,0,0,0,loc)
288
+ #define NEW_RETRY(loc) NEW_NODE(NODE_RETRY,0,0,0,loc)
289
+ #define NEW_BEGIN(b,loc) NEW_NODE(NODE_BEGIN,0,b,0,loc)
290
+ #define NEW_RESCUE(b,res,e,loc) NEW_NODE(NODE_RESCUE,b,res,e,loc)
291
+ #define NEW_RESBODY(a,ex,n,loc) NEW_NODE(NODE_RESBODY,n,ex,a,loc)
292
+ #define NEW_ENSURE(b,en,loc) NEW_NODE(NODE_ENSURE,b,0,en,loc)
293
+ #define NEW_RETURN(s,loc) NEW_NODE(NODE_RETURN,s,0,0,loc)
294
+ #define NEW_YIELD(a,loc) NEW_NODE(NODE_YIELD,a,0,0,loc)
295
+ #define NEW_LIST(a,loc) NEW_ARRAY(a,loc)
296
+ #define NEW_ARRAY(a,loc) NEW_NODE(NODE_ARRAY,a,1,0,loc)
297
+ #define NEW_ZARRAY(loc) NEW_NODE(NODE_ZARRAY,0,0,0,loc)
298
+ #define NEW_HASH(a,loc) NEW_NODE(NODE_HASH,a,0,0,loc)
299
+ #define NEW_MASGN(l,r,loc) NEW_NODE(NODE_MASGN,l,0,r,loc)
300
+ #define NEW_GASGN(v,val,loc) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v),loc)
301
+ #define NEW_LASGN(v,val,loc) NEW_NODE(NODE_LASGN,v,val,0,loc)
302
+ #define NEW_DASGN(v,val,loc) NEW_NODE(NODE_DASGN,v,val,0,loc)
303
+ #define NEW_DASGN_CURR(v,val,loc) NEW_NODE(NODE_DASGN_CURR,v,val,0,loc)
304
+ #define NEW_IASGN(v,val,loc) NEW_NODE(NODE_IASGN,v,val,0,loc)
305
+ #define NEW_CDECL(v,val,path,loc) NEW_NODE(NODE_CDECL,v,val,path,loc)
306
+ #define NEW_CVASGN(v,val,loc) NEW_NODE(NODE_CVASGN,v,val,0,loc)
307
+ #define NEW_OP_ASGN1(p,id,a,loc) NEW_NODE(NODE_OP_ASGN1,p,id,a,loc)
308
+ #define NEW_OP_ASGN2(r,t,i,o,val,loc) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o,t,loc),loc)
309
+ #define NEW_OP_ASGN22(i,o,t,loc) NEW_NODE(NODE_OP_ASGN2,i,o,t,loc)
310
+ #define NEW_OP_ASGN_OR(i,val,loc) NEW_NODE(NODE_OP_ASGN_OR,i,val,0,loc)
311
+ #define NEW_OP_ASGN_AND(i,val,loc) NEW_NODE(NODE_OP_ASGN_AND,i,val,0,loc)
312
+ #define NEW_OP_CDECL(v,op,val,loc) NEW_NODE(NODE_OP_CDECL,v,val,op,loc)
313
+ #define NEW_GVAR(v,loc) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v),loc)
314
+ #define NEW_LVAR(v,loc) NEW_NODE(NODE_LVAR,v,0,0,loc)
315
+ #define NEW_DVAR(v,loc) NEW_NODE(NODE_DVAR,v,0,0,loc)
316
+ #define NEW_IVAR(v,loc) NEW_NODE(NODE_IVAR,v,0,0,loc)
317
+ #define NEW_CONST(v,loc) NEW_NODE(NODE_CONST,v,0,0,loc)
318
+ #define NEW_CVAR(v,loc) NEW_NODE(NODE_CVAR,v,0,0,loc)
319
+ #define NEW_NTH_REF(n,loc) NEW_NODE(NODE_NTH_REF,0,n,0,loc)
320
+ #define NEW_BACK_REF(n,loc) NEW_NODE(NODE_BACK_REF,0,n,0,loc)
321
+ #define NEW_MATCH(c,loc) NEW_NODE(NODE_MATCH,c,0,0,loc)
322
+ #define NEW_MATCH2(n1,n2,loc) NEW_NODE(NODE_MATCH2,n1,n2,0,loc)
323
+ #define NEW_MATCH3(r,n2,loc) NEW_NODE(NODE_MATCH3,r,n2,0,loc)
324
+ #define NEW_LIT(l,loc) NEW_NODE(NODE_LIT,l,0,0,loc)
325
+ #define NEW_STR(s,loc) NEW_NODE(NODE_STR,s,0,0,loc)
326
+ #define NEW_DSTR(s,loc) NEW_NODE(NODE_DSTR,s,1,0,loc)
327
+ #define NEW_XSTR(s,loc) NEW_NODE(NODE_XSTR,s,0,0,loc)
328
+ #define NEW_DXSTR(s,loc) NEW_NODE(NODE_DXSTR,s,0,0,loc)
329
+ #define NEW_DSYM(s,loc) NEW_NODE(NODE_DSYM,s,0,0,loc)
330
+ #define NEW_EVSTR(n,loc) NEW_NODE(NODE_EVSTR,0,(n),0,loc)
331
+ #define NEW_CALL(r,m,a,loc) NEW_NODE(NODE_CALL,r,m,a,loc)
332
+ #define NEW_OPCALL(r,m,a,loc) NEW_NODE(NODE_OPCALL,r,m,a,loc)
333
+ #define NEW_FCALL(m,a,loc) NEW_NODE(NODE_FCALL,0,m,a,loc)
334
+ #define NEW_VCALL(m,loc) NEW_NODE(NODE_VCALL,0,m,0,loc)
335
+ #define NEW_SUPER(a,loc) NEW_NODE(NODE_SUPER,0,0,a,loc)
336
+ #define NEW_ZSUPER(loc) NEW_NODE(NODE_ZSUPER,0,0,0,loc)
337
+ #define NEW_ARGS_AUX(r,b,loc) NEW_NODE(NODE_ARGS_AUX,r,b,0,loc)
338
+ #define NEW_OPT_ARG(i,v,loc) NEW_NODE(NODE_OPT_ARG,i,v,0,loc)
339
+ #define NEW_KW_ARG(i,v,loc) NEW_NODE(NODE_KW_ARG,i,v,0,loc)
340
+ #define NEW_POSTARG(i,v,loc) NEW_NODE(NODE_POSTARG,i,v,0,loc)
341
+ #define NEW_ARGSCAT(a,b,loc) NEW_NODE(NODE_ARGSCAT,a,b,0,loc)
342
+ #define NEW_ARGSPUSH(a,b,loc) NEW_NODE(NODE_ARGSPUSH,a,b,0,loc)
343
+ #define NEW_SPLAT(a,loc) NEW_NODE(NODE_SPLAT,a,0,0,loc)
344
+ #define NEW_BLOCK_PASS(b,loc) NEW_NODE(NODE_BLOCK_PASS,0,b,0,loc)
345
+ #define NEW_ALIAS(n,o,loc) NEW_NODE(NODE_ALIAS,n,o,0,loc)
346
+ #define NEW_VALIAS(n,o,loc) NEW_NODE(NODE_VALIAS,n,o,0,loc)
347
+ #define NEW_UNDEF(i,loc) NEW_NODE(NODE_UNDEF,0,i,0,loc)
348
+ #define NEW_CLASS(n,b,s,loc) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b,loc),(s),loc)
349
+ #define NEW_SCLASS(r,b,loc) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b,loc),0,loc)
350
+ #define NEW_MODULE(n,b,loc) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b,loc),0,loc)
351
+ #define NEW_COLON2(c,i,loc) NEW_NODE(NODE_COLON2,c,i,0,loc)
352
+ #define NEW_COLON3(i,loc) NEW_NODE(NODE_COLON3,0,i,0,loc)
353
+ #define NEW_DOT2(b,e,loc) NEW_NODE(NODE_DOT2,b,e,0,loc)
354
+ #define NEW_DOT3(b,e,loc) NEW_NODE(NODE_DOT3,b,e,0,loc)
355
+ #define NEW_SELF(loc) NEW_NODE(NODE_SELF,0,0,0,loc)
356
+ #define NEW_NIL(loc) NEW_NODE(NODE_NIL,0,0,0,loc)
357
+ #define NEW_TRUE(loc) NEW_NODE(NODE_TRUE,0,0,0,loc)
358
+ #define NEW_FALSE(loc) NEW_NODE(NODE_FALSE,0,0,0,loc)
359
+ #define NEW_ERRINFO(loc) NEW_NODE(NODE_ERRINFO,0,0,0,loc)
360
+ #define NEW_DEFINED(e,loc) NEW_NODE(NODE_DEFINED,e,0,0,loc)
361
+ #define NEW_PREEXE(b,loc) NEW_SCOPE(b,loc)
362
+ #define NEW_POSTEXE(b,loc) NEW_NODE(NODE_POSTEXE,0,b,0,loc)
363
+ #define NEW_ATTRASGN(r,m,a,loc) NEW_NODE(NODE_ATTRASGN,r,m,a,loc)
364
+
365
+ #define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
366
+ #define NODE_REQUIRED_KEYWORD_P(node) ((node)->nd_value == NODE_SPECIAL_REQUIRED_KEYWORD)
367
+ #define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
368
+ #define NODE_NAMED_REST_P(node) ((node) != NODE_SPECIAL_NO_NAME_REST)
369
+
370
+ RUBY_SYMBOL_EXPORT_BEGIN
371
+
372
+ typedef struct node_buffer_struct node_buffer_t;
373
+ /* T_IMEMO/ast */
374
+ typedef struct rb_ast_body_struct {
375
+ const NODE *root;
376
+ VALUE compile_option;
377
+ int line_count;
378
+ } rb_ast_body_t;
379
+ typedef struct rb_ast_struct {
380
+ VALUE flags;
381
+ node_buffer_t *node_buffer;
382
+ rb_ast_body_t body;
383
+ } rb_ast_t;
384
+ rb_ast_t *rb_ast_new(void);
385
+ void rb_ast_mark(rb_ast_t*);
386
+ void rb_ast_dispose(rb_ast_t*);
387
+ void rb_ast_free(rb_ast_t*);
388
+ void rb_ast_add_mark_object(rb_ast_t*, VALUE);
389
+ NODE *rb_ast_newnode(rb_ast_t*);
390
+ void rb_ast_delete_node(rb_ast_t*, NODE *n);
391
+
392
+ VALUE rb_parser_new(void);
393
+ VALUE rb_parser_end_seen_p(VALUE);
394
+ VALUE rb_parser_encoding(VALUE);
395
+ VALUE rb_parser_get_yydebug(VALUE);
396
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
397
+ VALUE rb_parser_dump_tree(const NODE *node, int comment);
398
+ void rb_parser_set_options(VALUE, int, int, int, int);
399
+
400
+ rb_ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
401
+ rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
402
+ rb_ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int);
403
+ rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
404
+ rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
405
+ rb_ast_t *rb_parser_compile_generic(VALUE vparser, VALUE (*lex_gets)(VALUE, int), VALUE fname, VALUE input, int line);
406
+
407
+ rb_ast_t *rb_compile_cstr(const char*, const char*, int, int);
408
+ rb_ast_t *rb_compile_string(const char*, VALUE, int);
409
+ rb_ast_t *rb_compile_file(const char*, VALUE, int);
410
+
411
+ void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2);
412
+
413
+ const struct kwtable *rb_reserved_word(const char *, unsigned int);
414
+
415
+ struct rb_args_info {
416
+ NODE *pre_init;
417
+ NODE *post_init;
418
+
419
+ int pre_args_num; /* count of mandatory pre-arguments */
420
+ int post_args_num; /* count of mandatory post-arguments */
421
+
422
+ ID first_post_arg;
423
+
424
+ ID rest_arg;
425
+ ID block_arg;
426
+
427
+ NODE *kw_args;
428
+ NODE *kw_rest_arg;
429
+
430
+ NODE *opt_args;
431
+ };
432
+
433
+ struct parser_params;
434
+ void *rb_parser_malloc(struct parser_params *, size_t);
435
+ void *rb_parser_realloc(struct parser_params *, void *, size_t);
436
+ void *rb_parser_calloc(struct parser_params *, size_t, size_t);
437
+ void rb_parser_free(struct parser_params *, void *);
438
+ PRINTF_ARGS(void rb_parser_printf(struct parser_params *parser, const char *fmt, ...), 2, 3);
439
+
440
+ RUBY_SYMBOL_EXPORT_END
441
+
442
+ #if defined(__cplusplus)
443
+ #if 0
444
+ { /* satisfy cc-mode */
445
+ #endif
446
+ } /* extern "C" { */
447
+ #endif
448
+
449
+ #endif /* RUBY_NODE_H */
@@ -0,0 +1,200 @@
1
+ case NODE_SCOPE:
2
+ return "NODE_SCOPE";
3
+ case NODE_BLOCK:
4
+ return "NODE_BLOCK";
5
+ case NODE_IF:
6
+ return "NODE_IF";
7
+ case NODE_UNLESS:
8
+ return "NODE_UNLESS";
9
+ case NODE_CASE:
10
+ return "NODE_CASE";
11
+ case NODE_CASE2:
12
+ return "NODE_CASE2";
13
+ case NODE_WHEN:
14
+ return "NODE_WHEN";
15
+ case NODE_WHILE:
16
+ return "NODE_WHILE";
17
+ case NODE_UNTIL:
18
+ return "NODE_UNTIL";
19
+ case NODE_ITER:
20
+ return "NODE_ITER";
21
+ case NODE_FOR:
22
+ return "NODE_FOR";
23
+ case NODE_FOR_MASGN:
24
+ return "NODE_FOR_MASGN";
25
+ case NODE_BREAK:
26
+ return "NODE_BREAK";
27
+ case NODE_NEXT:
28
+ return "NODE_NEXT";
29
+ case NODE_REDO:
30
+ return "NODE_REDO";
31
+ case NODE_RETRY:
32
+ return "NODE_RETRY";
33
+ case NODE_BEGIN:
34
+ return "NODE_BEGIN";
35
+ case NODE_RESCUE:
36
+ return "NODE_RESCUE";
37
+ case NODE_RESBODY:
38
+ return "NODE_RESBODY";
39
+ case NODE_ENSURE:
40
+ return "NODE_ENSURE";
41
+ case NODE_AND:
42
+ return "NODE_AND";
43
+ case NODE_OR:
44
+ return "NODE_OR";
45
+ case NODE_MASGN:
46
+ return "NODE_MASGN";
47
+ case NODE_LASGN:
48
+ return "NODE_LASGN";
49
+ case NODE_DASGN:
50
+ return "NODE_DASGN";
51
+ case NODE_DASGN_CURR:
52
+ return "NODE_DASGN_CURR";
53
+ case NODE_GASGN:
54
+ return "NODE_GASGN";
55
+ case NODE_IASGN:
56
+ return "NODE_IASGN";
57
+ case NODE_CDECL:
58
+ return "NODE_CDECL";
59
+ case NODE_CVASGN:
60
+ return "NODE_CVASGN";
61
+ case NODE_OP_ASGN1:
62
+ return "NODE_OP_ASGN1";
63
+ case NODE_OP_ASGN2:
64
+ return "NODE_OP_ASGN2";
65
+ case NODE_OP_ASGN_AND:
66
+ return "NODE_OP_ASGN_AND";
67
+ case NODE_OP_ASGN_OR:
68
+ return "NODE_OP_ASGN_OR";
69
+ case NODE_OP_CDECL:
70
+ return "NODE_OP_CDECL";
71
+ case NODE_CALL:
72
+ return "NODE_CALL";
73
+ case NODE_OPCALL:
74
+ return "NODE_OPCALL";
75
+ case NODE_FCALL:
76
+ return "NODE_FCALL";
77
+ case NODE_VCALL:
78
+ return "NODE_VCALL";
79
+ case NODE_QCALL:
80
+ return "NODE_QCALL";
81
+ case NODE_SUPER:
82
+ return "NODE_SUPER";
83
+ case NODE_ZSUPER:
84
+ return "NODE_ZSUPER";
85
+ case NODE_ARRAY:
86
+ return "NODE_ARRAY";
87
+ case NODE_ZARRAY:
88
+ return "NODE_ZARRAY";
89
+ case NODE_VALUES:
90
+ return "NODE_VALUES";
91
+ case NODE_HASH:
92
+ return "NODE_HASH";
93
+ case NODE_RETURN:
94
+ return "NODE_RETURN";
95
+ case NODE_YIELD:
96
+ return "NODE_YIELD";
97
+ case NODE_LVAR:
98
+ return "NODE_LVAR";
99
+ case NODE_DVAR:
100
+ return "NODE_DVAR";
101
+ case NODE_GVAR:
102
+ return "NODE_GVAR";
103
+ case NODE_IVAR:
104
+ return "NODE_IVAR";
105
+ case NODE_CONST:
106
+ return "NODE_CONST";
107
+ case NODE_CVAR:
108
+ return "NODE_CVAR";
109
+ case NODE_NTH_REF:
110
+ return "NODE_NTH_REF";
111
+ case NODE_BACK_REF:
112
+ return "NODE_BACK_REF";
113
+ case NODE_MATCH:
114
+ return "NODE_MATCH";
115
+ case NODE_MATCH2:
116
+ return "NODE_MATCH2";
117
+ case NODE_MATCH3:
118
+ return "NODE_MATCH3";
119
+ case NODE_LIT:
120
+ return "NODE_LIT";
121
+ case NODE_STR:
122
+ return "NODE_STR";
123
+ case NODE_DSTR:
124
+ return "NODE_DSTR";
125
+ case NODE_XSTR:
126
+ return "NODE_XSTR";
127
+ case NODE_DXSTR:
128
+ return "NODE_DXSTR";
129
+ case NODE_EVSTR:
130
+ return "NODE_EVSTR";
131
+ case NODE_DREGX:
132
+ return "NODE_DREGX";
133
+ case NODE_ONCE:
134
+ return "NODE_ONCE";
135
+ case NODE_ARGS:
136
+ return "NODE_ARGS";
137
+ case NODE_ARGS_AUX:
138
+ return "NODE_ARGS_AUX";
139
+ case NODE_OPT_ARG:
140
+ return "NODE_OPT_ARG";
141
+ case NODE_KW_ARG:
142
+ return "NODE_KW_ARG";
143
+ case NODE_POSTARG:
144
+ return "NODE_POSTARG";
145
+ case NODE_ARGSCAT:
146
+ return "NODE_ARGSCAT";
147
+ case NODE_ARGSPUSH:
148
+ return "NODE_ARGSPUSH";
149
+ case NODE_SPLAT:
150
+ return "NODE_SPLAT";
151
+ case NODE_BLOCK_PASS:
152
+ return "NODE_BLOCK_PASS";
153
+ case NODE_DEFN:
154
+ return "NODE_DEFN";
155
+ case NODE_DEFS:
156
+ return "NODE_DEFS";
157
+ case NODE_ALIAS:
158
+ return "NODE_ALIAS";
159
+ case NODE_VALIAS:
160
+ return "NODE_VALIAS";
161
+ case NODE_UNDEF:
162
+ return "NODE_UNDEF";
163
+ case NODE_CLASS:
164
+ return "NODE_CLASS";
165
+ case NODE_MODULE:
166
+ return "NODE_MODULE";
167
+ case NODE_SCLASS:
168
+ return "NODE_SCLASS";
169
+ case NODE_COLON2:
170
+ return "NODE_COLON2";
171
+ case NODE_COLON3:
172
+ return "NODE_COLON3";
173
+ case NODE_DOT2:
174
+ return "NODE_DOT2";
175
+ case NODE_DOT3:
176
+ return "NODE_DOT3";
177
+ case NODE_FLIP2:
178
+ return "NODE_FLIP2";
179
+ case NODE_FLIP3:
180
+ return "NODE_FLIP3";
181
+ case NODE_SELF:
182
+ return "NODE_SELF";
183
+ case NODE_NIL:
184
+ return "NODE_NIL";
185
+ case NODE_TRUE:
186
+ return "NODE_TRUE";
187
+ case NODE_FALSE:
188
+ return "NODE_FALSE";
189
+ case NODE_ERRINFO:
190
+ return "NODE_ERRINFO";
191
+ case NODE_DEFINED:
192
+ return "NODE_DEFINED";
193
+ case NODE_POSTEXE:
194
+ return "NODE_POSTEXE";
195
+ case NODE_DSYM:
196
+ return "NODE_DSYM";
197
+ case NODE_ATTRASGN:
198
+ return "NODE_ATTRASGN";
199
+ case NODE_LAMBDA:
200
+ return "NODE_LAMBDA";