debase-ruby_core_source 3.2.0 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +10 -0
  4. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/addr2line.h +20 -0
  5. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/builtin.h +117 -0
  6. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/build_assert/build_assert.h +40 -0
  7. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/check_type/check_type.h +63 -0
  8. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/container_of/container_of.h +142 -0
  9. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/list/list.h +789 -0
  10. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ccan/str/str.h +17 -0
  11. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/constant.h +53 -0
  12. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/darray.h +246 -0
  13. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/debug_counter.h +423 -0
  14. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/dln.h +31 -0
  15. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/encindex.h +70 -0
  16. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/eval_intern.h +341 -0
  17. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/hrtime.h +227 -0
  18. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/id.h +343 -0
  19. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/id_table.h +39 -0
  20. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/insns.inc +249 -0
  21. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/insns_info.inc +9133 -0
  22. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/array.h +144 -0
  23. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/basic_operators.h +63 -0
  24. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/bignum.h +244 -0
  25. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/bits.h +568 -0
  26. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/class.h +226 -0
  27. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/cmdlineopt.h +63 -0
  28. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/compar.h +29 -0
  29. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/compile.h +34 -0
  30. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/compilers.h +107 -0
  31. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/cont.h +32 -0
  33. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/dir.h +16 -0
  34. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/enc.h +19 -0
  35. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/encoding.h +32 -0
  36. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/enum.h +18 -0
  37. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/enumerator.h +21 -0
  38. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/error.h +213 -0
  39. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/eval.h +32 -0
  40. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/file.h +38 -0
  41. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/fixnum.h +184 -0
  42. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/gc.h +361 -0
  43. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/hash.h +190 -0
  44. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/imemo.h +241 -0
  45. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/inits.h +50 -0
  46. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/io.h +137 -0
  47. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/load.h +18 -0
  48. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/loadpath.h +16 -0
  49. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/math.h +23 -0
  50. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/missing.h +18 -0
  51. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/numeric.h +273 -0
  52. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/object.h +59 -0
  53. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/parse.h +133 -0
  54. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/proc.h +30 -0
  55. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/process.h +124 -0
  56. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/ractor.h +6 -0
  57. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/random.h +16 -0
  58. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/range.h +40 -0
  59. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/rational.h +71 -0
  60. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/re.h +28 -0
  61. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/ruby_parser.h +69 -0
  62. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/sanitizers.h +186 -0
  63. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/serial.h +23 -0
  64. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/signal.h +25 -0
  65. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/static_assert.h +16 -0
  66. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/string.h +160 -0
  67. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/struct.h +127 -0
  68. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/symbol.h +42 -0
  69. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/thread.h +74 -0
  70. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/time.h +34 -0
  71. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/transcode.h +20 -0
  72. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/util.h +27 -0
  73. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/variable.h +71 -0
  74. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/vm.h +129 -0
  75. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal/warnings.h +16 -0
  76. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/internal.h +112 -0
  77. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/iseq.h +334 -0
  78. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/known_errors.inc +791 -0
  79. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/method.h +254 -0
  80. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/node.h +125 -0
  81. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/node_name.inc +210 -0
  82. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/optinsn.inc +128 -0
  83. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/optunifs.inc +43 -0
  84. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parse.h +232 -0
  85. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_bits.h +564 -0
  86. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_node.h +133 -0
  87. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_st.h +162 -0
  88. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/parser_value.h +106 -0
  89. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/probes_helper.h +42 -0
  90. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ractor_core.h +387 -0
  91. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/regenc.h +254 -0
  92. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/regint.h +996 -0
  93. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/regparse.h +370 -0
  94. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/revision.h +5 -0
  95. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rjit.h +103 -0
  96. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rjit_c.h +165 -0
  97. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ruby_assert.h +14 -0
  98. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/ruby_atomic.h +23 -0
  99. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/rubyparser.h +628 -0
  100. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/shape.h +232 -0
  101. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/siphash.h +48 -0
  102. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/symbol.h +119 -0
  103. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_none.h +20 -0
  104. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_pthread.h +126 -0
  105. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/thread_win32.h +58 -0
  106. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/timev.h +58 -0
  107. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/transcode_data.h +138 -0
  108. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/variable.h +30 -0
  109. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/version.h +65 -0
  110. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm.inc +5396 -0
  111. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_call_iseq_optimized.inc +244 -0
  112. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_callinfo.h +608 -0
  113. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_core.h +2089 -0
  114. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_debug.h +122 -0
  115. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_exec.h +199 -0
  116. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_insnhelper.h +271 -0
  117. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_opts.h +67 -0
  118. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vm_sync.h +137 -0
  119. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/vmtc.inc +243 -0
  120. data/lib/debase/ruby_core_source/ruby-3.3.0-preview2/yjit.h +70 -0
  121. data/lib/debase/ruby_core_source/version.rb +1 -1
  122. metadata +120 -3
@@ -0,0 +1,628 @@
1
+ #ifndef RUBY_RUBYPARSER_H
2
+ #define RUBY_RUBYPARSER_H 1
3
+ /*
4
+ * This is a header file for librubyparser interface
5
+ */
6
+
7
+ #include <stdarg.h> /* for va_list */
8
+
9
+ #ifdef UNIVERSAL_PARSER
10
+
11
+ #define rb_encoding void
12
+ #define OnigCodePoint unsigned int
13
+ #include "parser_st.h"
14
+ #ifndef RUBY_RUBY_H
15
+ #include "parser_value.h"
16
+ #endif
17
+
18
+ #else
19
+
20
+ #include "ruby/encoding.h"
21
+
22
+ #endif
23
+
24
+ /*
25
+ * AST Node
26
+ */
27
+ enum node_type {
28
+ NODE_SCOPE,
29
+ NODE_BLOCK,
30
+ NODE_IF,
31
+ NODE_UNLESS,
32
+ NODE_CASE,
33
+ NODE_CASE2,
34
+ NODE_CASE3,
35
+ NODE_WHEN,
36
+ NODE_IN,
37
+ NODE_WHILE,
38
+ NODE_UNTIL,
39
+ NODE_ITER,
40
+ NODE_FOR,
41
+ NODE_FOR_MASGN,
42
+ NODE_BREAK,
43
+ NODE_NEXT,
44
+ NODE_REDO,
45
+ NODE_RETRY,
46
+ NODE_BEGIN,
47
+ NODE_RESCUE,
48
+ NODE_RESBODY,
49
+ NODE_ENSURE,
50
+ NODE_AND,
51
+ NODE_OR,
52
+ NODE_MASGN,
53
+ NODE_LASGN,
54
+ NODE_DASGN,
55
+ NODE_GASGN,
56
+ NODE_IASGN,
57
+ NODE_CDECL,
58
+ NODE_CVASGN,
59
+ NODE_OP_ASGN1,
60
+ NODE_OP_ASGN2,
61
+ NODE_OP_ASGN_AND,
62
+ NODE_OP_ASGN_OR,
63
+ NODE_OP_CDECL,
64
+ NODE_CALL,
65
+ NODE_OPCALL,
66
+ NODE_FCALL,
67
+ NODE_VCALL,
68
+ NODE_QCALL,
69
+ NODE_SUPER,
70
+ NODE_ZSUPER,
71
+ NODE_LIST,
72
+ NODE_ZLIST,
73
+ NODE_VALUES,
74
+ NODE_HASH,
75
+ NODE_RETURN,
76
+ NODE_YIELD,
77
+ NODE_LVAR,
78
+ NODE_DVAR,
79
+ NODE_GVAR,
80
+ NODE_IVAR,
81
+ NODE_CONST,
82
+ NODE_CVAR,
83
+ NODE_NTH_REF,
84
+ NODE_BACK_REF,
85
+ NODE_MATCH,
86
+ NODE_MATCH2,
87
+ NODE_MATCH3,
88
+ NODE_LIT,
89
+ NODE_STR,
90
+ NODE_DSTR,
91
+ NODE_XSTR,
92
+ NODE_DXSTR,
93
+ NODE_EVSTR,
94
+ NODE_DREGX,
95
+ NODE_ONCE,
96
+ NODE_ARGS,
97
+ NODE_ARGS_AUX,
98
+ NODE_OPT_ARG,
99
+ NODE_KW_ARG,
100
+ NODE_POSTARG,
101
+ NODE_ARGSCAT,
102
+ NODE_ARGSPUSH,
103
+ NODE_SPLAT,
104
+ NODE_BLOCK_PASS,
105
+ NODE_DEFN,
106
+ NODE_DEFS,
107
+ NODE_ALIAS,
108
+ NODE_VALIAS,
109
+ NODE_UNDEF,
110
+ NODE_CLASS,
111
+ NODE_MODULE,
112
+ NODE_SCLASS,
113
+ NODE_COLON2,
114
+ NODE_COLON3,
115
+ NODE_DOT2,
116
+ NODE_DOT3,
117
+ NODE_FLIP2,
118
+ NODE_FLIP3,
119
+ NODE_SELF,
120
+ NODE_NIL,
121
+ NODE_TRUE,
122
+ NODE_FALSE,
123
+ NODE_ERRINFO,
124
+ NODE_DEFINED,
125
+ NODE_POSTEXE,
126
+ NODE_DSYM,
127
+ NODE_ATTRASGN,
128
+ NODE_LAMBDA,
129
+ NODE_ARYPTN,
130
+ NODE_HSHPTN,
131
+ NODE_FNDPTN,
132
+ NODE_ERROR,
133
+ NODE_LAST
134
+ };
135
+
136
+
137
+ #define nd_head u1.node
138
+ #define nd_alen u2.argc
139
+ #define nd_next u3.node
140
+
141
+ #define nd_cond u1.node
142
+ #define nd_body u2.node
143
+ #define nd_else u3.node
144
+
145
+ #define nd_resq u2.node
146
+ #define nd_ensr u3.node
147
+
148
+ #define nd_1st u1.node
149
+ #define nd_2nd u2.node
150
+
151
+ #define nd_stts u1.node
152
+
153
+ #define nd_vid u1.id
154
+
155
+ #define nd_var u1.node
156
+ #define nd_iter u3.node
157
+
158
+ #define nd_value u2.node
159
+ #define nd_aid u3.id
160
+
161
+ #define nd_lit u1.value
162
+
163
+ #define nd_recv u1.node
164
+ #define nd_mid u2.id
165
+ #define nd_args u3.node
166
+ #define nd_ainfo u3.args
167
+
168
+ #define nd_defn u3.node
169
+
170
+ #define nd_cpath u1.node
171
+ #define nd_super u3.node
172
+
173
+ #define nd_beg u1.node
174
+ #define nd_end u2.node
175
+ #define nd_state u3.state
176
+
177
+ #define nd_nth u2.argc
178
+
179
+ #define nd_alias u1.id
180
+ #define nd_orig u2.id
181
+ #define nd_undef u2.node
182
+
183
+ #define nd_brace u2.argc
184
+
185
+ #define nd_pconst u1.node
186
+ #define nd_pkwargs u2.node
187
+ #define nd_pkwrestarg u3.node
188
+
189
+ #define nd_apinfo u3.apinfo
190
+
191
+ #define nd_fpinfo u3.fpinfo
192
+
193
+ // for NODE_SCOPE
194
+ #define nd_tbl u1.tbl
195
+
196
+ // for NODE_ARGS_AUX
197
+ #define nd_pid u1.id
198
+ #define nd_plen u2.argc
199
+ #define nd_cflag u2.id
200
+
201
+ // for ripper
202
+ #define nd_cval u3.value
203
+ #define nd_rval u2.value
204
+ #define nd_tag u1.id
205
+
206
+ #ifndef FLEX_ARY_LEN
207
+ /* From internal/compilers.h */
208
+ /* A macro for defining a flexible array, like: VALUE ary[FLEX_ARY_LEN]; */
209
+ #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
210
+ # define FLEX_ARY_LEN /* VALUE ary[]; */
211
+ #elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
212
+ # define FLEX_ARY_LEN 0 /* VALUE ary[0]; */
213
+ #else
214
+ # define FLEX_ARY_LEN 1 /* VALUE ary[1]; */
215
+ #endif
216
+ #endif
217
+
218
+ typedef struct rb_ast_id_table {
219
+ int size;
220
+ ID ids[FLEX_ARY_LEN];
221
+ } rb_ast_id_table_t;
222
+
223
+ typedef struct rb_code_position_struct {
224
+ int lineno;
225
+ int column;
226
+ } rb_code_position_t;
227
+
228
+ typedef struct rb_code_location_struct {
229
+ rb_code_position_t beg_pos;
230
+ rb_code_position_t end_pos;
231
+ } rb_code_location_t;
232
+
233
+ typedef struct RNode {
234
+ VALUE flags;
235
+ union {
236
+ struct RNode *node;
237
+ ID id;
238
+ VALUE value;
239
+ rb_ast_id_table_t *tbl;
240
+ } u1;
241
+ union {
242
+ struct RNode *node;
243
+ ID id;
244
+ long argc;
245
+ VALUE value;
246
+ } u2;
247
+ union {
248
+ struct RNode *node;
249
+ ID id;
250
+ long state;
251
+ struct rb_args_info *args;
252
+ struct rb_ary_pattern_info *apinfo;
253
+ struct rb_fnd_pattern_info *fpinfo;
254
+ VALUE value;
255
+ } u3;
256
+ rb_code_location_t nd_loc;
257
+ int node_id;
258
+ } NODE;
259
+
260
+ /* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: UNUSED, 9: UNUSED, 10: EXIVAR, 11: FREEZE */
261
+ /* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE,
262
+ * 8..14: nd_type,
263
+ * 15..: nd_line
264
+ */
265
+ #define NODE_FL_NEWLINE (((VALUE)1)<<7)
266
+
267
+ #define NODE_TYPESHIFT 8
268
+ #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
269
+
270
+ #define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
271
+ #define nd_set_type(n,t) \
272
+ rb_node_set_type(n, t)
273
+ #define nd_init_type(n,t) \
274
+ (n)->flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
275
+
276
+ struct rb_args_info {
277
+ NODE *pre_init;
278
+ NODE *post_init;
279
+
280
+ int pre_args_num; /* count of mandatory pre-arguments */
281
+ int post_args_num; /* count of mandatory post-arguments */
282
+
283
+ ID first_post_arg;
284
+
285
+ ID rest_arg;
286
+ ID block_arg;
287
+
288
+ NODE *kw_args;
289
+ NODE *kw_rest_arg;
290
+
291
+ NODE *opt_args;
292
+ unsigned int no_kwarg: 1;
293
+ unsigned int ruby2_keywords: 1;
294
+ unsigned int forwarding: 1;
295
+
296
+ VALUE imemo;
297
+ };
298
+
299
+ struct rb_ary_pattern_info {
300
+ NODE *pre_args;
301
+ NODE *rest_arg;
302
+ NODE *post_args;
303
+ };
304
+
305
+ struct rb_fnd_pattern_info {
306
+ NODE *pre_rest_arg;
307
+ NODE *args;
308
+ NODE *post_rest_arg;
309
+ };
310
+
311
+ typedef struct node_buffer_struct node_buffer_t;
312
+ /* T_IMEMO/ast */
313
+ typedef struct rb_ast_body_struct {
314
+ const NODE *root;
315
+ VALUE script_lines;
316
+ // script_lines is either:
317
+ // - a Fixnum that represents the line count of the original source, or
318
+ // - an Array that contains the lines of the original source
319
+ signed int frozen_string_literal:2; /* -1: not specified, 0: false, 1: true */
320
+ signed int coverage_enabled:2; /* -1: not specified, 0: false, 1: true */
321
+ } rb_ast_body_t;
322
+ typedef struct rb_ast_struct {
323
+ VALUE flags;
324
+ node_buffer_t *node_buffer;
325
+ rb_ast_body_t body;
326
+ } rb_ast_t;
327
+
328
+
329
+
330
+ /*
331
+ * Parser Interface
332
+ */
333
+
334
+
335
+ typedef struct parser_params rb_parser_t;
336
+ #ifndef INTERNAL_IMEMO_H
337
+ typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;
338
+ #endif
339
+
340
+ #ifdef UNIVERSAL_PARSER
341
+ typedef struct rb_parser_config_struct {
342
+ /*
343
+ * Reference counter.
344
+ * This is needed because both parser and ast refer
345
+ * same config pointer.
346
+ * We can remove this, once decuple parser and ast from Ruby GC.
347
+ */
348
+ int counter;
349
+
350
+ /* Memory */
351
+ void *(*malloc)(size_t size);
352
+ void *(*calloc)(size_t number, size_t size);
353
+ void *(*realloc)(void *ptr, size_t newsiz);
354
+ void (*free)(void *ptr);
355
+ void *(*alloc_n)(size_t nelems, size_t elemsiz);
356
+ void *(*alloc)(size_t elemsiz);
357
+ void *(*realloc_n)(void *ptr, size_t newelems, size_t newsiz);
358
+ void *(*zalloc)(size_t elemsiz);
359
+ void *(*rb_memmove)(void *dest, const void *src, size_t t, size_t n);
360
+ void *(*nonempty_memcpy)(void *dest, const void *src, size_t t, size_t n);
361
+ void *(*xmalloc_mul_add)(size_t x, size_t y, size_t z);
362
+
363
+ /* imemo */
364
+ // TODO: Should it return `rb_strterm_t *'?
365
+ VALUE (*new_strterm)(VALUE v1, VALUE v2, VALUE v3, VALUE v0, int heredoc);
366
+ int (*strterm_is_heredoc)(VALUE strterm);
367
+ VALUE (*tmpbuf_auto_free_pointer)(void);
368
+ void *(*tmpbuf_set_ptr)(VALUE v, void *ptr);
369
+ rb_imemo_tmpbuf_t *(*tmpbuf_parser_heap)(void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt);
370
+ rb_ast_t *(*ast_new)(VALUE nb);
371
+
372
+ // VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
373
+ VALUE (*compile_callback)(VALUE (*func)(VALUE), VALUE arg);
374
+ NODE *(*reg_named_capture_assign)(struct parser_params* p, VALUE regexp, const rb_code_location_t *loc);
375
+
376
+ /* Object */
377
+ VALUE (*obj_freeze)(VALUE obj);
378
+ VALUE (*obj_hide)(VALUE obj);
379
+ int (*obj_frozen)(VALUE obj);
380
+ int (*type_p)(VALUE, int);
381
+ void (*obj_freeze_raw)(VALUE obj);
382
+
383
+ int (*fixnum_p)(VALUE);
384
+ int (*symbol_p)(VALUE);
385
+
386
+ /* Variable */
387
+ VALUE (*attr_get)(VALUE obj, ID id);
388
+
389
+ /* Array */
390
+ VALUE (*ary_new)(void);
391
+ VALUE (*ary_push)(VALUE ary, VALUE elem);
392
+ VALUE (*ary_new_from_args)(long n, ...);
393
+ VALUE (*ary_pop)(VALUE ary);
394
+ VALUE (*ary_last)(int argc, const VALUE *argv, VALUE ary);
395
+ VALUE (*ary_unshift)(VALUE ary, VALUE item);
396
+ VALUE (*ary_new2)(long capa); // ary_new_capa
397
+ VALUE (*ary_entry)(VALUE ary, long offset);
398
+ VALUE (*ary_join)(VALUE ary, VALUE sep);
399
+ VALUE (*ary_reverse)(VALUE ary);
400
+ VALUE (*ary_clear)(VALUE ary);
401
+ long (*array_len)(VALUE a);
402
+ VALUE (*array_aref)(VALUE, long);
403
+
404
+ /* Symbol */
405
+ VALUE (*sym_intern_ascii_cstr)(const char *ptr);
406
+ ID (*make_temporary_id)(size_t n);
407
+ int (*is_local_id)(ID);
408
+ int (*is_attrset_id)(ID);
409
+ int (*is_global_name_punct)(const int c);
410
+ int (*id_type)(ID id);
411
+ ID (*id_attrset)(ID);
412
+ ID (*intern)(const char *name);
413
+ ID (*intern2)(const char *name, long len);
414
+ ID (*intern3)(const char *name, long len, rb_encoding *enc);
415
+ ID (*intern_str)(VALUE str);
416
+ int (*is_notop_id)(ID);
417
+ int (*enc_symname_type)(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset);
418
+ VALUE (*str_intern)(VALUE str);
419
+ const char *(*id2name)(ID id);
420
+ VALUE (*id2str)(ID id);
421
+ VALUE (*id2sym)(ID x);
422
+ ID (*sym2id)(VALUE sym);
423
+
424
+ /* String */
425
+ VALUE (*str_catf)(VALUE str, const char *format, ...);
426
+ VALUE (*str_cat_cstr)(VALUE str, const char *ptr);
427
+ VALUE (*str_subseq)(VALUE str, long beg, long len);
428
+ VALUE (*str_dup)(VALUE str);
429
+ VALUE (*str_new_frozen)(VALUE orig);
430
+ VALUE (*str_buf_new)(long capa);
431
+ VALUE (*str_buf_cat)(VALUE, const char*, long);
432
+ void (*str_modify)(VALUE str);
433
+ void (*str_set_len)(VALUE str, long len);
434
+ VALUE (*str_cat)(VALUE str, const char *ptr, long len);
435
+ VALUE (*str_resize)(VALUE str, long len);
436
+ VALUE (*str_new)(const char *ptr, long len);
437
+ VALUE (*str_new_cstr)(const char *ptr);
438
+ VALUE (*fstring)(VALUE);
439
+ int (*is_ascii_string)(VALUE str);
440
+ VALUE (*enc_str_new)(const char *ptr, long len, rb_encoding *enc);
441
+ VALUE (*enc_str_buf_cat)(VALUE str, const char *ptr, long len, rb_encoding *enc);
442
+ VALUE (*str_buf_append)(VALUE str, VALUE str2);
443
+ VALUE (*str_vcatf)(VALUE str, const char *fmt, va_list ap);
444
+ char *(*string_value_cstr)(volatile VALUE *ptr);
445
+ VALUE (*rb_sprintf)(const char *format, ...);
446
+ char *(*rstring_ptr)(VALUE str);
447
+ char *(*rstring_end)(VALUE str);
448
+ long (*rstring_len)(VALUE str);
449
+ VALUE (*filesystem_str_new_cstr)(const char *ptr);
450
+ VALUE (*obj_as_string)(VALUE);
451
+
452
+ /* Hash */
453
+ VALUE (*hash_clear)(VALUE hash);
454
+ VALUE (*hash_new)(void);
455
+ VALUE (*hash_aset)(VALUE hash, VALUE key, VALUE val);
456
+ VALUE (*hash_lookup)(VALUE hash, VALUE key);
457
+ VALUE (*ident_hash_new)(void);
458
+
459
+ /* Fixnum */
460
+ VALUE (*int2fix)(long i);
461
+
462
+ /* Bignum */
463
+ void (*bignum_negate)(VALUE b);
464
+ VALUE (*big_norm)(VALUE x);
465
+ VALUE (*cstr_to_inum)(const char *str, int base, int badcheck);
466
+
467
+ /* Float */
468
+ VALUE (*float_new)(double d);
469
+ double (*float_value)(VALUE v);
470
+
471
+ /* Numeric */
472
+ int (*num2int)(VALUE val);
473
+ VALUE (*int_positive_pow)(long x, unsigned long y);
474
+ VALUE (*int2num)(int v);
475
+ long (*fix2long)(VALUE val);
476
+
477
+ /* Rational */
478
+ VALUE (*rational_new)(VALUE x, VALUE y);
479
+ VALUE (*rational_raw1)(VALUE x);
480
+ void (*rational_set_num)(VALUE r, VALUE n);
481
+ VALUE (*rational_get_num)(VALUE obj);
482
+
483
+ /* Complex */
484
+ VALUE (*complex_raw)(VALUE x, VALUE y);
485
+ void (*rcomplex_set_real)(VALUE cmp, VALUE r);
486
+ void (*rcomplex_set_imag)(VALUE cmp, VALUE i);
487
+ VALUE (*rcomplex_get_real)(VALUE obj);
488
+ VALUE (*rcomplex_get_imag)(VALUE obj);
489
+
490
+ /* IO */
491
+ int (*stderr_tty_p)(void);
492
+ void (*write_error_str)(VALUE mesg);
493
+ VALUE (*default_rs)(void);
494
+ VALUE (*io_write)(VALUE io, VALUE str);
495
+ VALUE (*io_flush)(VALUE io);
496
+ VALUE (*io_puts)(int argc, const VALUE *argv, VALUE out);
497
+ VALUE (*io_gets_internal)(VALUE io);
498
+
499
+ /* IO (Ractor) */
500
+ VALUE (*debug_output_stdout)(void);
501
+ VALUE (*debug_output_stderr)(void);
502
+
503
+ /* Encoding */
504
+ int (*is_usascii_enc)(rb_encoding *enc);
505
+ int (*enc_isalnum)(OnigCodePoint c, rb_encoding *enc);
506
+ int (*enc_precise_mbclen)(const char *p, const char *e, rb_encoding *enc);
507
+ int (*mbclen_charfound_p)(int len);
508
+ const char *(*enc_name)(rb_encoding *enc);
509
+ char *(*enc_prev_char)(const char *s, const char *p, const char *e, rb_encoding *enc);
510
+ rb_encoding* (*enc_get)(VALUE obj);
511
+ int (*enc_asciicompat)(rb_encoding *enc);
512
+ rb_encoding *(*utf8_encoding)(void);
513
+ VALUE (*enc_associate)(VALUE obj, rb_encoding *enc);
514
+ rb_encoding *(*ascii8bit_encoding)(void);
515
+ int (*enc_codelen)(int c, rb_encoding *enc);
516
+ int (*enc_mbcput)(unsigned int c, void *buf, rb_encoding *enc);
517
+ int (*char_to_option_kcode)(int c, int *option, int *kcode);
518
+ int (*ascii8bit_encindex)(void);
519
+ int (*enc_find_index)(const char *name);
520
+ rb_encoding *(*enc_from_index)(int idx);
521
+ VALUE (*enc_associate_index)(VALUE obj, int encindex);
522
+ int (*enc_isspace)(OnigCodePoint c, rb_encoding *enc);
523
+ int enc_coderange_7bit;
524
+ int enc_coderange_unknown;
525
+ rb_encoding *(*enc_compatible)(VALUE str1, VALUE str2);
526
+ VALUE (*enc_from_encoding)(rb_encoding *enc);
527
+ int (*encoding_get)(VALUE obj);
528
+ void (*encoding_set)(VALUE obj, int encindex);
529
+ int (*encoding_is_ascii8bit)(VALUE obj);
530
+ rb_encoding *(*usascii_encoding)(void);
531
+
532
+ /* Ractor */
533
+ VALUE (*ractor_make_shareable)(VALUE obj);
534
+
535
+ /* Compile */
536
+ // int rb_local_defined(ID id, const rb_iseq_t *iseq);
537
+ int (*local_defined)(ID, const void*);
538
+ // int rb_dvar_defined(ID id, const rb_iseq_t *iseq);
539
+ int (*dvar_defined)(ID, const void*);
540
+
541
+ /* Compile (parse.y) */
542
+ int (*literal_cmp)(VALUE val, VALUE lit);
543
+ parser_st_index_t (*literal_hash)(VALUE a);
544
+
545
+ /* Error (Exception) */
546
+ const char *(*builtin_class_name)(VALUE x);
547
+ VALUE (*syntax_error_append)(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
548
+ void (*raise)(VALUE exc, const char *fmt, ...);
549
+ VALUE (*syntax_error_new)(void);
550
+
551
+ /* Eval */
552
+ VALUE (*errinfo)(void);
553
+ void (*set_errinfo)(VALUE err);
554
+ void (*exc_raise)(VALUE mesg);
555
+ VALUE (*make_exception)(int argc, const VALUE *argv);
556
+
557
+ /* GC */
558
+ void (*sized_xfree)(void *x, size_t size);
559
+ void *(*sized_realloc_n)(void *ptr, size_t new_count, size_t element_size, size_t old_count);
560
+ VALUE (*obj_write)(VALUE, VALUE *, VALUE);
561
+ VALUE (*obj_written)(VALUE, VALUE, VALUE);
562
+ void (*gc_register_mark_object)(VALUE object);
563
+ void (*gc_guard)(VALUE);
564
+ void (*gc_mark)(VALUE);
565
+ void (*gc_mark_movable)(VALUE ptr);
566
+ VALUE (*gc_location)(VALUE value);
567
+
568
+ /* Re */
569
+ VALUE (*reg_compile)(VALUE str, int options, const char *sourcefile, int sourceline);
570
+ VALUE (*reg_check_preprocess)(VALUE str);
571
+ int (*memcicmp)(const void *x, const void *y, long len);
572
+
573
+ /* Error */
574
+ void (*compile_warn)(const char *file, int line, const char *fmt, ...);
575
+ void (*compile_warning)(const char *file, int line, const char *fmt, ...);
576
+ void (*bug)(const char *fmt, ...);
577
+ void (*fatal)(const char *fmt, ...);
578
+ VALUE (*verbose)(void);
579
+
580
+ /* VM */
581
+ VALUE (*make_backtrace)(void);
582
+
583
+ /* Util */
584
+ unsigned long (*scan_hex)(const char *start, size_t len, size_t *retlen);
585
+ unsigned long (*scan_oct)(const char *start, size_t len, size_t *retlen);
586
+ unsigned long (*scan_digits)(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
587
+ double (*strtod)(const char *s00, char **se);
588
+
589
+ /* Misc */
590
+ VALUE (*rbool)(VALUE);
591
+ int (*undef_p)(VALUE);
592
+ int (*rtest)(VALUE obj);
593
+ int (*nil_p)(VALUE obj);
594
+ int (*flonum_p)(VALUE obj);
595
+ VALUE qnil;
596
+ VALUE qtrue;
597
+ VALUE qfalse;
598
+ VALUE qundef;
599
+ VALUE eArgError;
600
+ VALUE mRubyVMFrozenCore;
601
+ int (*long2int)(long);
602
+ int (*special_const_p)(VALUE);
603
+ int (*builtin_type)(VALUE);
604
+
605
+ VALUE (*node_case_when_optimizable_literal)(const NODE *const node);
606
+
607
+ /* For Ripper */
608
+ VALUE (*static_id2sym)(ID id);
609
+ long (*str_coderange_scan_restartable)(const char *s, const char *e, rb_encoding *enc, int *cr);
610
+ } rb_parser_config_t;
611
+
612
+ #undef rb_encoding
613
+ #undef OnigCodePoint
614
+ #endif /* UNIVERSAL_PARSER */
615
+
616
+ RUBY_SYMBOL_EXPORT_BEGIN
617
+ void rb_ruby_parser_free(void *ptr);
618
+ rb_ast_t* rb_ruby_parser_compile_string(rb_parser_t *p, const char *f, VALUE s, int line);
619
+
620
+ #ifdef UNIVERSAL_PARSER
621
+ rb_parser_config_t *rb_ruby_parser_config_new(void *(*malloc)(size_t size));
622
+ void rb_ruby_parser_config_free(rb_parser_config_t *config);
623
+ rb_parser_t *rb_ruby_parser_allocate(rb_parser_config_t *config);
624
+ rb_parser_t *rb_ruby_parser_new(rb_parser_config_t *config);
625
+ #endif
626
+ RUBY_SYMBOL_EXPORT_END
627
+
628
+ #endif /* RUBY_RUBYPARSER_H */