binding_of_caller 0.8.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +108 -0
  3. data/.gitignore +12 -7
  4. data/Gemfile +6 -1
  5. data/README.md +14 -5
  6. data/Rakefile +4 -132
  7. data/binding_of_caller.gemspec +33 -37
  8. data/lib/binding_of_caller/{mri2.rb → mri.rb} +2 -2
  9. data/lib/binding_of_caller/version.rb +1 -1
  10. data/lib/binding_of_caller.rb +7 -8
  11. metadata +25 -103
  12. data/.travis.yml +0 -35
  13. data/HISTORY +0 -35
  14. data/examples/benchmark.rb +0 -63
  15. data/examples/example.rb +0 -41
  16. data/ext/binding_of_caller/binding_of_caller.c +0 -225
  17. data/ext/binding_of_caller/extconf.rb +0 -28
  18. data/ext/binding_of_caller/ruby_headers/192/debug.h +0 -36
  19. data/ext/binding_of_caller/ruby_headers/192/dln.h +0 -41
  20. data/ext/binding_of_caller/ruby_headers/192/eval_intern.h +0 -232
  21. data/ext/binding_of_caller/ruby_headers/192/id.h +0 -173
  22. data/ext/binding_of_caller/ruby_headers/192/iseq.h +0 -104
  23. data/ext/binding_of_caller/ruby_headers/192/method.h +0 -103
  24. data/ext/binding_of_caller/ruby_headers/192/node.h +0 -483
  25. data/ext/binding_of_caller/ruby_headers/192/regenc.h +0 -211
  26. data/ext/binding_of_caller/ruby_headers/192/regint.h +0 -841
  27. data/ext/binding_of_caller/ruby_headers/192/regparse.h +0 -354
  28. data/ext/binding_of_caller/ruby_headers/192/rubys_gc.h +0 -77
  29. data/ext/binding_of_caller/ruby_headers/192/thread_pthread.h +0 -27
  30. data/ext/binding_of_caller/ruby_headers/192/thread_win32.h +0 -33
  31. data/ext/binding_of_caller/ruby_headers/192/timev.h +0 -21
  32. data/ext/binding_of_caller/ruby_headers/192/transcode_data.h +0 -109
  33. data/ext/binding_of_caller/ruby_headers/192/version.h +0 -55
  34. data/ext/binding_of_caller/ruby_headers/192/vm_core.h +0 -703
  35. data/ext/binding_of_caller/ruby_headers/192/vm_exec.h +0 -184
  36. data/ext/binding_of_caller/ruby_headers/192/vm_insnhelper.h +0 -208
  37. data/ext/binding_of_caller/ruby_headers/192/vm_opts.h +0 -51
  38. data/ext/binding_of_caller/ruby_headers/193/addr2line.h +0 -21
  39. data/ext/binding_of_caller/ruby_headers/193/atomic.h +0 -56
  40. data/ext/binding_of_caller/ruby_headers/193/constant.h +0 -34
  41. data/ext/binding_of_caller/ruby_headers/193/debug.h +0 -41
  42. data/ext/binding_of_caller/ruby_headers/193/dln.h +0 -50
  43. data/ext/binding_of_caller/ruby_headers/193/encdb.h +0 -167
  44. data/ext/binding_of_caller/ruby_headers/193/eval_intern.h +0 -234
  45. data/ext/binding_of_caller/ruby_headers/193/id.h +0 -175
  46. data/ext/binding_of_caller/ruby_headers/193/internal.h +0 -227
  47. data/ext/binding_of_caller/ruby_headers/193/iseq.h +0 -125
  48. data/ext/binding_of_caller/ruby_headers/193/method.h +0 -105
  49. data/ext/binding_of_caller/ruby_headers/193/node.h +0 -503
  50. data/ext/binding_of_caller/ruby_headers/193/parse.h +0 -186
  51. data/ext/binding_of_caller/ruby_headers/193/regenc.h +0 -219
  52. data/ext/binding_of_caller/ruby_headers/193/regint.h +0 -851
  53. data/ext/binding_of_caller/ruby_headers/193/regparse.h +0 -362
  54. data/ext/binding_of_caller/ruby_headers/193/revision.h +0 -1
  55. data/ext/binding_of_caller/ruby_headers/193/rubys_gc.h +0 -98
  56. data/ext/binding_of_caller/ruby_headers/193/thread_pthread.h +0 -51
  57. data/ext/binding_of_caller/ruby_headers/193/thread_win32.h +0 -40
  58. data/ext/binding_of_caller/ruby_headers/193/timev.h +0 -21
  59. data/ext/binding_of_caller/ruby_headers/193/transcode_data.h +0 -117
  60. data/ext/binding_of_caller/ruby_headers/193/transdb.h +0 -189
  61. data/ext/binding_of_caller/ruby_headers/193/version.h +0 -52
  62. data/ext/binding_of_caller/ruby_headers/193/vm_core.h +0 -755
  63. data/ext/binding_of_caller/ruby_headers/193/vm_exec.h +0 -184
  64. data/ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h +0 -220
  65. data/ext/binding_of_caller/ruby_headers/193/vm_opts.h +0 -51
  66. data/test/test_binding_of_caller.rb +0 -161
@@ -1,483 +0,0 @@
1
- /**********************************************************************
2
-
3
- node.h -
4
-
5
- $Author$
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
- #define NODE_SCOPE NODE_SCOPE
25
- NODE_BLOCK,
26
- #define NODE_BLOCK NODE_BLOCK
27
- NODE_IF,
28
- #define NODE_IF NODE_IF
29
- NODE_CASE,
30
- #define NODE_CASE NODE_CASE
31
- NODE_WHEN,
32
- #define NODE_WHEN NODE_WHEN
33
- NODE_OPT_N,
34
- #define NODE_OPT_N NODE_OPT_N
35
- NODE_WHILE,
36
- #define NODE_WHILE NODE_WHILE
37
- NODE_UNTIL,
38
- #define NODE_UNTIL NODE_UNTIL
39
- NODE_ITER,
40
- #define NODE_ITER NODE_ITER
41
- NODE_FOR,
42
- #define NODE_FOR NODE_FOR
43
- NODE_BREAK,
44
- #define NODE_BREAK NODE_BREAK
45
- NODE_NEXT,
46
- #define NODE_NEXT NODE_NEXT
47
- NODE_REDO,
48
- #define NODE_REDO NODE_REDO
49
- NODE_RETRY,
50
- #define NODE_RETRY NODE_RETRY
51
- NODE_BEGIN,
52
- #define NODE_BEGIN NODE_BEGIN
53
- NODE_RESCUE,
54
- #define NODE_RESCUE NODE_RESCUE
55
- NODE_RESBODY,
56
- #define NODE_RESBODY NODE_RESBODY
57
- NODE_ENSURE,
58
- #define NODE_ENSURE NODE_ENSURE
59
- NODE_AND,
60
- #define NODE_AND NODE_AND
61
- NODE_OR,
62
- #define NODE_OR NODE_OR
63
- NODE_MASGN,
64
- #define NODE_MASGN NODE_MASGN
65
- NODE_LASGN,
66
- #define NODE_LASGN NODE_LASGN
67
- NODE_DASGN,
68
- #define NODE_DASGN NODE_DASGN
69
- NODE_DASGN_CURR,
70
- #define NODE_DASGN_CURR NODE_DASGN_CURR
71
- NODE_GASGN,
72
- #define NODE_GASGN NODE_GASGN
73
- NODE_IASGN,
74
- #define NODE_IASGN NODE_IASGN
75
- NODE_IASGN2,
76
- #define NODE_IASGN2 NODE_IASGN2
77
- NODE_CDECL,
78
- #define NODE_CDECL NODE_CDECL
79
- NODE_CVASGN,
80
- #define NODE_CVASGN NODE_CVASGN
81
- NODE_CVDECL,
82
- #define NODE_CVDECL NODE_CVDECL
83
- NODE_OP_ASGN1,
84
- #define NODE_OP_ASGN1 NODE_OP_ASGN1
85
- NODE_OP_ASGN2,
86
- #define NODE_OP_ASGN2 NODE_OP_ASGN2
87
- NODE_OP_ASGN_AND,
88
- #define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
89
- NODE_OP_ASGN_OR,
90
- #define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
91
- NODE_CALL,
92
- #define NODE_CALL NODE_CALL
93
- NODE_FCALL,
94
- #define NODE_FCALL NODE_FCALL
95
- NODE_VCALL,
96
- #define NODE_VCALL NODE_VCALL
97
- NODE_SUPER,
98
- #define NODE_SUPER NODE_SUPER
99
- NODE_ZSUPER,
100
- #define NODE_ZSUPER NODE_ZSUPER
101
- NODE_ARRAY,
102
- #define NODE_ARRAY NODE_ARRAY
103
- NODE_ZARRAY,
104
- #define NODE_ZARRAY NODE_ZARRAY
105
- NODE_VALUES,
106
- #define NODE_VALUES NODE_VALUES
107
- NODE_HASH,
108
- #define NODE_HASH NODE_HASH
109
- NODE_RETURN,
110
- #define NODE_RETURN NODE_RETURN
111
- NODE_YIELD,
112
- #define NODE_YIELD NODE_YIELD
113
- NODE_LVAR,
114
- #define NODE_LVAR NODE_LVAR
115
- NODE_DVAR,
116
- #define NODE_DVAR NODE_DVAR
117
- NODE_GVAR,
118
- #define NODE_GVAR NODE_GVAR
119
- NODE_IVAR,
120
- #define NODE_IVAR NODE_IVAR
121
- NODE_CONST,
122
- #define NODE_CONST NODE_CONST
123
- NODE_CVAR,
124
- #define NODE_CVAR NODE_CVAR
125
- NODE_NTH_REF,
126
- #define NODE_NTH_REF NODE_NTH_REF
127
- NODE_BACK_REF,
128
- #define NODE_BACK_REF NODE_BACK_REF
129
- NODE_MATCH,
130
- #define NODE_MATCH NODE_MATCH
131
- NODE_MATCH2,
132
- #define NODE_MATCH2 NODE_MATCH2
133
- NODE_MATCH3,
134
- #define NODE_MATCH3 NODE_MATCH3
135
- NODE_LIT,
136
- #define NODE_LIT NODE_LIT
137
- NODE_STR,
138
- #define NODE_STR NODE_STR
139
- NODE_DSTR,
140
- #define NODE_DSTR NODE_DSTR
141
- NODE_XSTR,
142
- #define NODE_XSTR NODE_XSTR
143
- NODE_DXSTR,
144
- #define NODE_DXSTR NODE_DXSTR
145
- NODE_EVSTR,
146
- #define NODE_EVSTR NODE_EVSTR
147
- NODE_DREGX,
148
- #define NODE_DREGX NODE_DREGX
149
- NODE_DREGX_ONCE,
150
- #define NODE_DREGX_ONCE NODE_DREGX_ONCE
151
- NODE_ARGS,
152
- #define NODE_ARGS NODE_ARGS
153
- NODE_ARGS_AUX,
154
- #define NODE_ARGS_AUX NODE_ARGS_AUX
155
- NODE_OPT_ARG,
156
- #define NODE_OPT_ARG NODE_OPT_ARG
157
- NODE_POSTARG,
158
- #define NODE_POSTARG NODE_POSTARG
159
- NODE_ARGSCAT,
160
- #define NODE_ARGSCAT NODE_ARGSCAT
161
- NODE_ARGSPUSH,
162
- #define NODE_ARGSPUSH NODE_ARGSPUSH
163
- NODE_SPLAT,
164
- #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
- NODE_BLOCK_PASS,
170
- #define NODE_BLOCK_PASS NODE_BLOCK_PASS
171
- NODE_DEFN,
172
- #define NODE_DEFN NODE_DEFN
173
- NODE_DEFS,
174
- #define NODE_DEFS NODE_DEFS
175
- NODE_ALIAS,
176
- #define NODE_ALIAS NODE_ALIAS
177
- NODE_VALIAS,
178
- #define NODE_VALIAS NODE_VALIAS
179
- NODE_UNDEF,
180
- #define NODE_UNDEF NODE_UNDEF
181
- NODE_CLASS,
182
- #define NODE_CLASS NODE_CLASS
183
- NODE_MODULE,
184
- #define NODE_MODULE NODE_MODULE
185
- NODE_SCLASS,
186
- #define NODE_SCLASS NODE_SCLASS
187
- NODE_COLON2,
188
- #define NODE_COLON2 NODE_COLON2
189
- NODE_COLON3,
190
- #define NODE_COLON3 NODE_COLON3
191
- NODE_DOT2,
192
- #define NODE_DOT2 NODE_DOT2
193
- NODE_DOT3,
194
- #define NODE_DOT3 NODE_DOT3
195
- NODE_FLIP2,
196
- #define NODE_FLIP2 NODE_FLIP2
197
- NODE_FLIP3,
198
- #define NODE_FLIP3 NODE_FLIP3
199
- NODE_SELF,
200
- #define NODE_SELF NODE_SELF
201
- NODE_NIL,
202
- #define NODE_NIL NODE_NIL
203
- NODE_TRUE,
204
- #define NODE_TRUE NODE_TRUE
205
- NODE_FALSE,
206
- #define NODE_FALSE NODE_FALSE
207
- NODE_ERRINFO,
208
- #define NODE_ERRINFO NODE_ERRINFO
209
- NODE_DEFINED,
210
- #define NODE_DEFINED NODE_DEFINED
211
- NODE_POSTEXE,
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
- NODE_DSYM,
222
- #define NODE_DSYM NODE_DSYM
223
- NODE_ATTRASGN,
224
- #define NODE_ATTRASGN NODE_ATTRASGN
225
- NODE_PRELUDE,
226
- #define NODE_PRELUDE NODE_PRELUDE
227
- NODE_LAMBDA,
228
- #define NODE_LAMBDA NODE_LAMBDA
229
- NODE_OPTBLOCK,
230
- #define NODE_OPTBLOCK NODE_OPTBLOCK
231
- NODE_LAST
232
- #define NODE_LAST NODE_LAST
233
- };
234
-
235
- typedef struct RNode {
236
- unsigned long flags;
237
- char *nd_file;
238
- union {
239
- struct RNode *node;
240
- ID id;
241
- VALUE value;
242
- VALUE (*cfunc)(ANYARGS);
243
- ID *tbl;
244
- } u1;
245
- union {
246
- struct RNode *node;
247
- ID id;
248
- long argc;
249
- VALUE value;
250
- } u2;
251
- union {
252
- struct RNode *node;
253
- ID id;
254
- long state;
255
- struct rb_global_entry *entry;
256
- long cnt;
257
- VALUE value;
258
- } u3;
259
- } NODE;
260
-
261
- #define RNODE(obj) (R_CAST(RNode)(obj))
262
-
263
- /* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_FL_NEWLINE */
264
- #define NODE_FL_NEWLINE (((VALUE)1)<<7)
265
- #define NODE_FL_CREF_PUSHED_BY_EVAL NODE_FL_NEWLINE
266
-
267
- #define NODE_TYPESHIFT 8
268
- #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
269
-
270
- #define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
271
- #define nd_set_type(n,t) \
272
- RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
273
-
274
- #define NODE_LSHIFT (NODE_TYPESHIFT+7)
275
- #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
276
- #define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
277
- #define nd_set_line(n,l) \
278
- RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
279
-
280
- #define nd_head u1.node
281
- #define nd_alen u2.argc
282
- #define nd_next u3.node
283
-
284
- #define nd_cond u1.node
285
- #define nd_body u2.node
286
- #define nd_else u3.node
287
-
288
- #define nd_orig u3.value
289
-
290
- #define nd_resq u2.node
291
- #define nd_ensr u3.node
292
-
293
- #define nd_1st u1.node
294
- #define nd_2nd u2.node
295
-
296
- #define nd_stts u1.node
297
-
298
- #define nd_entry u3.entry
299
- #define nd_vid u1.id
300
- #define nd_cflag u2.id
301
- #define nd_cval u3.value
302
-
303
- #define nd_oid u1.id
304
- #define nd_cnt u3.cnt
305
- #define nd_tbl u1.tbl
306
-
307
- #define nd_var u1.node
308
- #define nd_iter u3.node
309
-
310
- #define nd_value u2.node
311
- #define nd_aid u3.id
312
-
313
- #define nd_lit u1.value
314
-
315
- #define nd_frml u2.argc
316
- #define nd_rest u1.id
317
- #define nd_opt u1.node
318
- #define nd_pid u1.id
319
- #define nd_plen u2.argc
320
-
321
- #define nd_recv u1.node
322
- #define nd_mid u2.id
323
- #define nd_args u3.node
324
-
325
- #define nd_noex u3.id
326
- #define nd_defn u3.node
327
-
328
- #define nd_cfnc u1.cfunc
329
- #define nd_argc u2.argc
330
-
331
- #define nd_cpath u1.node
332
- #define nd_super u3.node
333
-
334
- #define nd_modl u1.id
335
- #define nd_clss u1.value
336
-
337
- #define nd_beg u1.node
338
- #define nd_end u2.node
339
- #define nd_state u3.state
340
- #define nd_rval u2.value
341
-
342
- #define nd_nth u2.argc
343
-
344
- #define nd_tag u1.id
345
- #define nd_tval u2.value
346
-
347
- #define nd_visi u2.argc
348
-
349
- #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
350
-
351
- #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
352
- #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
- #define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
355
- #define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
356
- #define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
357
- #define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
358
- #define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
359
- #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
- #define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
362
- #define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
363
- #define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
364
- #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,0,0)
366
- #define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
367
- #define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
368
- #define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
369
- #define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
370
- #define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
371
- #define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
372
- #define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
373
- #define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
374
- #define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
375
- #define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
376
- #define NEW_LIST(a) NEW_ARRAY(a)
377
- #define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
378
- #define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
379
- #define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
380
- #define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
381
- #define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
382
- #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
383
- #define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
384
- #define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
385
- #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
- #define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
388
- #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
- #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,rb_id_attrset(i))
393
- #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
394
- #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
395
- #define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
396
- #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
397
- #define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
398
- #define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
399
- #define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
400
- #define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
401
- #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
402
- #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
403
- #define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
404
- #define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
405
- #define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
406
- #define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
407
- #define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
408
- #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
409
- #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
410
- #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
411
- #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
412
- #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
413
- #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
414
- #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
415
- #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
416
- #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
417
- #define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
418
- #define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
419
- #define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
420
- #define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
421
- #define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
422
- #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
423
- #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
424
- #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
- #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
428
- #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
429
- #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
430
- #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
431
- #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
432
- #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
433
- #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
434
- #define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
435
- #define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
436
- #define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
437
- #define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
438
- #define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
439
- #define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
440
- #define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
441
- #define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
442
- #define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
443
- #define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
444
- #define NEW_PREEXE(b) NEW_SCOPE(b)
445
- #define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
446
- #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
447
- #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,0)
449
- #define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
450
-
451
- VALUE rb_parser_new(void);
452
- VALUE rb_parser_end_seen_p(VALUE);
453
- VALUE rb_parser_encoding(VALUE);
454
-
455
- NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int);
456
- NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int);
457
- NODE *rb_parser_compile_file(volatile VALUE, const char*, VALUE, int);
458
-
459
- NODE *rb_compile_cstr(const char*, const char*, int, int);
460
- NODE *rb_compile_string(const char*, VALUE, int);
461
- NODE *rb_compile_file(const char*, VALUE, int);
462
-
463
- NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
464
- NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
465
-
466
- struct rb_global_entry {
467
- struct rb_global_variable *var;
468
- ID id;
469
- };
470
-
471
- struct rb_global_entry *rb_global_entry(ID);
472
- VALUE rb_gvar_get(struct rb_global_entry *);
473
- VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
474
- VALUE rb_gvar_defined(struct rb_global_entry *);
475
-
476
- #if defined(__cplusplus)
477
- #if 0
478
- { /* satisfy cc-mode */
479
- #endif
480
- } /* extern "C" { */
481
- #endif
482
-
483
- #endif /* RUBY_NODE_H */
@@ -1,211 +0,0 @@
1
- #ifndef ONIGURUMA_REGENC_H
2
- #define ONIGURUMA_REGENC_H
3
- /**********************************************************************
4
- regenc.h - Oniguruma (regular expression library)
5
- **********************************************************************/
6
- /*-
7
- * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8
- * All rights reserved.
9
- *
10
- * Redistribution and use in source and binary forms, with or without
11
- * modification, are permitted provided that the following conditions
12
- * are met:
13
- * 1. Redistributions of source code must retain the above copyright
14
- * notice, this list of conditions and the following disclaimer.
15
- * 2. Redistributions in binary form must reproduce the above copyright
16
- * notice, this list of conditions and the following disclaimer in the
17
- * documentation and/or other materials provided with the distribution.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
- * SUCH DAMAGE.
30
- */
31
- #ifndef REGINT_H
32
- #ifndef RUBY_EXTERN
33
- #include "ruby/config.h"
34
- #include "ruby/defines.h"
35
- #endif
36
- #ifdef ONIG_ESCAPE_UCHAR_COLLISION
37
- #undef ONIG_ESCAPE_UCHAR_COLLISION
38
- #endif
39
- #endif
40
- #include "ruby/oniguruma.h"
41
-
42
- typedef struct {
43
- OnigCodePoint from;
44
- OnigCodePoint to;
45
- } OnigPairCaseFoldCodes;
46
-
47
-
48
- #ifndef NULL
49
- #define NULL ((void* )0)
50
- #endif
51
-
52
- #ifndef TRUE
53
- #define TRUE 1
54
- #endif
55
-
56
- #ifndef FALSE
57
- #define FALSE 0
58
- #endif
59
-
60
- #ifndef ARG_UNUSED
61
- #if defined(__GNUC__)
62
- # define ARG_UNUSED __attribute__ ((unused))
63
- #else
64
- # define ARG_UNUSED
65
- #endif
66
- #endif
67
-
68
- #define ONIG_IS_NULL(p) (((void*)(p)) == (void*)0)
69
- #define ONIG_IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
70
- #define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL
71
- #define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val)
72
-
73
- #define enclen(enc,p,e) ((enc->max_enc_len == enc->min_enc_len) ? enc->min_enc_len : ONIGENC_MBC_ENC_LEN(enc,p,e))
74
-
75
- /* character types bit flag */
76
- #define BIT_CTYPE_NEWLINE (1<< ONIGENC_CTYPE_NEWLINE)
77
- #define BIT_CTYPE_ALPHA (1<< ONIGENC_CTYPE_ALPHA)
78
- #define BIT_CTYPE_BLANK (1<< ONIGENC_CTYPE_BLANK)
79
- #define BIT_CTYPE_CNTRL (1<< ONIGENC_CTYPE_CNTRL)
80
- #define BIT_CTYPE_DIGIT (1<< ONIGENC_CTYPE_DIGIT)
81
- #define BIT_CTYPE_GRAPH (1<< ONIGENC_CTYPE_GRAPH)
82
- #define BIT_CTYPE_LOWER (1<< ONIGENC_CTYPE_LOWER)
83
- #define BIT_CTYPE_PRINT (1<< ONIGENC_CTYPE_PRINT)
84
- #define BIT_CTYPE_PUNCT (1<< ONIGENC_CTYPE_PUNCT)
85
- #define BIT_CTYPE_SPACE (1<< ONIGENC_CTYPE_SPACE)
86
- #define BIT_CTYPE_UPPER (1<< ONIGENC_CTYPE_UPPER)
87
- #define BIT_CTYPE_XDIGIT (1<< ONIGENC_CTYPE_XDIGIT)
88
- #define BIT_CTYPE_WORD (1<< ONIGENC_CTYPE_WORD)
89
- #define BIT_CTYPE_ALNUM (1<< ONIGENC_CTYPE_ALNUM)
90
- #define BIT_CTYPE_ASCII (1<< ONIGENC_CTYPE_ASCII)
91
-
92
- #define CTYPE_TO_BIT(ctype) (1<<(ctype))
93
- #define CTYPE_IS_WORD_GRAPH_PRINT(ctype) \
94
- ((ctype) == ONIGENC_CTYPE_WORD || (ctype) == ONIGENC_CTYPE_GRAPH ||\
95
- (ctype) == ONIGENC_CTYPE_PRINT)
96
-
97
-
98
- typedef struct {
99
- const UChar *name;
100
- int ctype;
101
- short int len;
102
- } PosixBracketEntryType;
103
-
104
- #define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
105
-
106
- /* #define USE_CRNL_AS_LINE_TERMINATOR */
107
- #define USE_UNICODE_PROPERTIES
108
- /* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
109
- /* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTF#18 */
110
-
111
-
112
- #define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
113
-
114
- /* for encoding system implementation (internal) */
115
- ONIG_EXTERN int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc));
116
- ONIG_EXTERN int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc));
117
- ONIG_EXTERN int onigenc_apply_all_case_fold_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
118
- ONIG_EXTERN int onigenc_get_case_fold_codes_by_str_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
119
- ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], OnigEncoding enc));
120
- ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end, OnigEncoding enc));
121
-
122
-
123
- /* methods for single byte encoding */
124
- ONIG_EXTERN int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower, OnigEncoding enc));
125
- ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p, const UChar* e, OnigEncoding enc));
126
- ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end, OnigEncoding enc));
127
- ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
128
- ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf, OnigEncoding enc));
129
- ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, const OnigUChar* end, OnigEncoding enc));
130
- ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
131
- ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
132
- ONIG_EXTERN int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
133
-
134
- /* methods for multi byte encoding */
135
- ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
136
- ONIG_EXTERN int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));
137
- ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
138
- ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
139
- ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
140
- ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
141
- ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
142
- ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
143
- ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
144
- ONIG_EXTERN int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
145
-
146
-
147
- /* in enc/unicode.c */
148
- ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
149
- ONIG_EXTERN int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[], OnigEncoding enc));
150
- ONIG_EXTERN int onigenc_unicode_ctype_code_range P_((int ctype, const OnigCodePoint* ranges[]));
151
- ONIG_EXTERN int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
152
- ONIG_EXTERN int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));
153
- ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc));
154
-
155
-
156
- #define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
157
- #define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
158
-
159
- #define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
160
- OnigEncISO_8859_1_ToLowerCaseTable[c]
161
- #define ONIGENC_ISO_8859_1_TO_UPPER_CASE(c) \
162
- OnigEncISO_8859_1_ToUpperCaseTable[c]
163
-
164
- ONIG_EXTERN const UChar OnigEncISO_8859_1_ToLowerCaseTable[];
165
- ONIG_EXTERN const UChar OnigEncISO_8859_1_ToUpperCaseTable[];
166
-
167
- ONIG_EXTERN int
168
- onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
169
- ONIG_EXTERN UChar*
170
- onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n));
171
-
172
- /* defined in regexec.c, but used in enc/xxx.c */
173
- extern int onig_is_in_code_range P_((const UChar* p, OnigCodePoint code));
174
-
175
- ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding;
176
- ONIG_EXTERN const UChar OnigEncAsciiToLowerCaseTable[];
177
- ONIG_EXTERN const UChar OnigEncAsciiToUpperCaseTable[];
178
- ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
179
-
180
- #define ONIGENC_IS_ASCII_CODE(code) ((code) < 0x80)
181
- #define ONIGENC_ASCII_CODE_TO_LOWER_CASE(c) OnigEncAsciiToLowerCaseTable[c]
182
- #define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c]
183
- #define ONIGENC_IS_ASCII_CODE_CTYPE(code,ctype) \
184
- ((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
185
- #define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \
186
- (ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
187
- ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
188
-
189
- #ifdef ONIG_ENC_REGISTER
190
- extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
191
- #define OnigEncodingName(n) encoding_##n
192
- #define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n)
193
- #define OnigEncodingDefine(f,n) \
194
- OnigEncodingDeclare(n); \
195
- void Init_##f(void) { \
196
- ONIG_ENC_REGISTER(OnigEncodingName(n).name, \
197
- &OnigEncodingName(n)); \
198
- } \
199
- OnigEncodingDeclare(n)
200
- #else
201
- #define OnigEncodingName(n) OnigEncoding##n
202
- #define OnigEncodingDeclare(n) OnigEncodingType OnigEncodingName(n)
203
- #define OnigEncodingDefine(f,n) OnigEncodingDeclare(n)
204
- #endif
205
-
206
- /* macros for define replica encoding and encoding alias */
207
- #define ENC_REPLICATE(name, orig)
208
- #define ENC_ALIAS(name, orig)
209
- #define ENC_DUMMY(name)
210
-
211
- #endif /* ONIGURUMA_REGENC_H */