node-marshal 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,361 +1,361 @@
1
- /*
2
- * Simpilfied and modified node.h file from Ruby 2.3.0 source code
3
- * Copyright (C) 1993-2007 Yukihiro Matsumoto
4
- * Copyright (C) 2015 Alexey Voskov
5
- */
6
-
7
- #ifndef RUBY_NODE_H
8
- #define RUBY_NODE_H 1
9
-
10
- #if defined(__cplusplus)
11
- extern "C" {
12
- #if 0
13
- } /* satisfy cc-mode */
14
- #endif
15
- #endif
16
-
17
-
18
- enum node_type {
19
- NODE_SCOPE,
20
- #define NODE_SCOPE NODE_SCOPE
21
- NODE_BLOCK,
22
- #define NODE_BLOCK NODE_BLOCK
23
- NODE_IF,
24
- #define NODE_IF NODE_IF
25
- NODE_CASE,
26
- #define NODE_CASE NODE_CASE
27
- NODE_WHEN,
28
- #define NODE_WHEN NODE_WHEN
29
- NODE_OPT_N,
30
- #define NODE_OPT_N NODE_OPT_N
31
- NODE_WHILE,
32
- #define NODE_WHILE NODE_WHILE
33
- NODE_UNTIL,
34
- #define NODE_UNTIL NODE_UNTIL
35
- NODE_ITER,
36
- #define NODE_ITER NODE_ITER
37
- NODE_FOR,
38
- #define NODE_FOR NODE_FOR
39
- NODE_BREAK,
40
- #define NODE_BREAK NODE_BREAK
41
- NODE_NEXT,
42
- #define NODE_NEXT NODE_NEXT
43
- NODE_REDO,
44
- #define NODE_REDO NODE_REDO
45
- NODE_RETRY,
46
- #define NODE_RETRY NODE_RETRY
47
- NODE_BEGIN,
48
- #define NODE_BEGIN NODE_BEGIN
49
- NODE_RESCUE,
50
- #define NODE_RESCUE NODE_RESCUE
51
- NODE_RESBODY,
52
- #define NODE_RESBODY NODE_RESBODY
53
- NODE_ENSURE,
54
- #define NODE_ENSURE NODE_ENSURE
55
- NODE_AND,
56
- #define NODE_AND NODE_AND
57
- NODE_OR,
58
- #define NODE_OR NODE_OR
59
- NODE_MASGN,
60
- #define NODE_MASGN NODE_MASGN
61
- NODE_LASGN,
62
- #define NODE_LASGN NODE_LASGN
63
- NODE_DASGN,
64
- #define NODE_DASGN NODE_DASGN
65
- NODE_DASGN_CURR,
66
- #define NODE_DASGN_CURR NODE_DASGN_CURR
67
- NODE_GASGN,
68
- #define NODE_GASGN NODE_GASGN
69
- NODE_IASGN,
70
- #define NODE_IASGN NODE_IASGN
71
- NODE_IASGN2,
72
- #define NODE_IASGN2 NODE_IASGN2
73
- NODE_CDECL,
74
- #define NODE_CDECL NODE_CDECL
75
- NODE_CVASGN,
76
- #define NODE_CVASGN NODE_CVASGN
77
- NODE_CVDECL,
78
- #define NODE_CVDECL NODE_CVDECL
79
- NODE_OP_ASGN1,
80
- #define NODE_OP_ASGN1 NODE_OP_ASGN1
81
- NODE_OP_ASGN2,
82
- #define NODE_OP_ASGN2 NODE_OP_ASGN2
83
- NODE_OP_ASGN_AND,
84
- #define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
85
- NODE_OP_ASGN_OR,
86
- #define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
87
- NODE_OP_CDECL,
88
- #define NODE_OP_CDECL NODE_OP_CDECL
89
- NODE_CALL,
90
- #define NODE_CALL NODE_CALL
91
- NODE_FCALL,
92
- #define NODE_FCALL NODE_FCALL
93
- NODE_VCALL,
94
- #define NODE_VCALL NODE_VCALL
95
- NODE_QCALL,
96
- #define NODE_QCALL NODE_QCALL
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_KW_ARG,
158
- #define NODE_KW_ARG NODE_KW_ARG
159
- NODE_POSTARG,
160
- #define NODE_POSTARG NODE_POSTARG
161
- NODE_ARGSCAT,
162
- #define NODE_ARGSCAT NODE_ARGSCAT
163
- NODE_ARGSPUSH,
164
- #define NODE_ARGSPUSH NODE_ARGSPUSH
165
- NODE_SPLAT,
166
- #define NODE_SPLAT NODE_SPLAT
167
- NODE_TO_ARY,
168
- #define NODE_TO_ARY NODE_TO_ARY
169
- NODE_BLOCK_ARG,
170
- #define NODE_BLOCK_ARG NODE_BLOCK_ARG
171
- NODE_BLOCK_PASS,
172
- #define NODE_BLOCK_PASS NODE_BLOCK_PASS
173
- NODE_DEFN,
174
- #define NODE_DEFN NODE_DEFN
175
- NODE_DEFS,
176
- #define NODE_DEFS NODE_DEFS
177
- NODE_ALIAS,
178
- #define NODE_ALIAS NODE_ALIAS
179
- NODE_VALIAS,
180
- #define NODE_VALIAS NODE_VALIAS
181
- NODE_UNDEF,
182
- #define NODE_UNDEF NODE_UNDEF
183
- NODE_CLASS,
184
- #define NODE_CLASS NODE_CLASS
185
- NODE_MODULE,
186
- #define NODE_MODULE NODE_MODULE
187
- NODE_SCLASS,
188
- #define NODE_SCLASS NODE_SCLASS
189
- NODE_COLON2,
190
- #define NODE_COLON2 NODE_COLON2
191
- NODE_COLON3,
192
- #define NODE_COLON3 NODE_COLON3
193
- NODE_DOT2,
194
- #define NODE_DOT2 NODE_DOT2
195
- NODE_DOT3,
196
- #define NODE_DOT3 NODE_DOT3
197
- NODE_FLIP2,
198
- #define NODE_FLIP2 NODE_FLIP2
199
- NODE_FLIP3,
200
- #define NODE_FLIP3 NODE_FLIP3
201
- NODE_SELF,
202
- #define NODE_SELF NODE_SELF
203
- NODE_NIL,
204
- #define NODE_NIL NODE_NIL
205
- NODE_TRUE,
206
- #define NODE_TRUE NODE_TRUE
207
- NODE_FALSE,
208
- #define NODE_FALSE NODE_FALSE
209
- NODE_ERRINFO,
210
- #define NODE_ERRINFO NODE_ERRINFO
211
- NODE_DEFINED,
212
- #define NODE_DEFINED NODE_DEFINED
213
- NODE_POSTEXE,
214
- #define NODE_POSTEXE NODE_POSTEXE
215
- NODE_ALLOCA,
216
- #define NODE_ALLOCA NODE_ALLOCA
217
- NODE_BMETHOD,
218
- #define NODE_BMETHOD NODE_BMETHOD
219
- NODE_DSYM,
220
- #define NODE_DSYM NODE_DSYM
221
- NODE_ATTRASGN,
222
- #define NODE_ATTRASGN NODE_ATTRASGN
223
- NODE_PRELUDE,
224
- #define NODE_PRELUDE NODE_PRELUDE
225
- NODE_LAMBDA,
226
- #define NODE_LAMBDA NODE_LAMBDA
227
- NODE_LAST
228
- #define NODE_LAST NODE_LAST
229
- };
230
-
231
- typedef struct RNode {
232
- VALUE flags;
233
- VALUE nd_reserved; /* ex nd_file */
234
- union {
235
- struct RNode *node;
236
- ID id;
237
- VALUE value;
238
- VALUE (*cfunc)(ANYARGS);
239
- ID *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_global_entry *entry;
252
- struct rb_args_info *args;
253
- long cnt;
254
- VALUE value;
255
- } u3;
256
- } NODE;
257
-
258
- #define RNODE(obj) (R_CAST(RNode)(obj))
259
-
260
- /* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTERD, 10: EXIVAR, 11: FREEZE */
261
- /* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE|NODE_FL_CREF_PUSHED_BY_EVAL,
262
- * 8..14: nd_type,
263
- * 15..: nd_line or
264
- * 15: NODE_FL_CREF_PUSHED_BY_EVAL
265
- * 16: NODE_FL_CREF_OMOD_SHARED
266
- */
267
- #define NODE_FL_NEWLINE (((VALUE)1)<<7)
268
-
269
- #define NODE_TYPESHIFT 8
270
- #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
271
-
272
- #define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
273
- #define nd_set_type(n,t) \
274
- RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
275
-
276
- #define NODE_LSHIFT (NODE_TYPESHIFT+7)
277
- #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
278
- #define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
279
- #define nd_set_line(n,l) \
280
- RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
281
-
282
- #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
283
-
284
-
285
- RUBY_SYMBOL_EXPORT_BEGIN
286
-
287
- /* ===== Some version-specific Ruby internals ===== */
288
- struct rb_global_entry {
289
- struct rb_global_variable *var;
290
- ID id;
291
- };
292
- VALUE rb_iseqw_new(const void *iseq);
293
- extern char *ruby_node_name(int type);
294
- extern void *rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, void *parent);
295
- extern VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
296
- #define WITH_RB_ISEQW_NEW 1
297
- #define WITH_CUSTOM_RB_GLOBAL_ENTRY 1
298
- /* ================================================ */
299
-
300
-
301
- VALUE rb_parser_new(void);
302
- VALUE rb_parser_end_seen_p(VALUE);
303
- VALUE rb_parser_encoding(VALUE);
304
- VALUE rb_parser_get_yydebug(VALUE);
305
- VALUE rb_parser_set_yydebug(VALUE, VALUE);
306
- VALUE rb_parser_dump_tree(NODE *node, int comment);
307
- NODE *rb_parser_append_print(VALUE, NODE *);
308
- NODE *rb_parser_while_loop(VALUE, NODE *, int, int);
309
-
310
- NODE *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
311
- NODE *rb_parser_compile_string(VALUE, const char*, VALUE, int);
312
- NODE *rb_parser_compile_file(VALUE, const char*, VALUE, int);
313
- NODE *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
314
- NODE *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
315
-
316
- NODE *rb_compile_cstr(const char*, const char*, int, int);
317
- NODE *rb_compile_string(const char*, VALUE, int);
318
- NODE *rb_compile_file(const char*, VALUE, int);
319
-
320
- NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
321
- NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
322
- void rb_gc_free_node(VALUE obj);
323
- size_t rb_node_memsize(VALUE obj);
324
- VALUE rb_gc_mark_node(NODE *obj);
325
-
326
- const struct kwtable *rb_reserved_word(const char *, unsigned int);
327
-
328
- struct rb_args_info {
329
- NODE *pre_init;
330
- NODE *post_init;
331
-
332
- int pre_args_num; /* count of mandatory pre-arguments */
333
- int post_args_num; /* count of mandatory post-arguments */
334
-
335
- ID first_post_arg;
336
-
337
- ID rest_arg;
338
- ID block_arg;
339
-
340
- NODE *kw_args;
341
- NODE *kw_rest_arg;
342
-
343
- NODE *opt_args;
344
- };
345
-
346
- struct parser_params;
347
- void *rb_parser_malloc(struct parser_params *, size_t);
348
- void *rb_parser_realloc(struct parser_params *, void *, size_t);
349
- void *rb_parser_calloc(struct parser_params *, size_t, size_t);
350
- void rb_parser_free(struct parser_params *, void *);
351
-
352
- RUBY_SYMBOL_EXPORT_END
353
-
354
- #if defined(__cplusplus)
355
- #if 0
356
- { /* satisfy cc-mode */
357
- #endif
358
- } /* extern "C" { */
359
- #endif
360
-
361
- #endif /* RUBY_NODE_H */
1
+ /*
2
+ * Simpilfied and modified node.h file from Ruby 2.3.0 source code
3
+ * Copyright (C) 1993-2007 Yukihiro Matsumoto
4
+ * Copyright (C) 2015 Alexey Voskov
5
+ */
6
+
7
+ #ifndef RUBY_NODE_H
8
+ #define RUBY_NODE_H 1
9
+
10
+ #if defined(__cplusplus)
11
+ extern "C" {
12
+ #if 0
13
+ } /* satisfy cc-mode */
14
+ #endif
15
+ #endif
16
+
17
+
18
+ enum node_type {
19
+ NODE_SCOPE,
20
+ #define NODE_SCOPE NODE_SCOPE
21
+ NODE_BLOCK,
22
+ #define NODE_BLOCK NODE_BLOCK
23
+ NODE_IF,
24
+ #define NODE_IF NODE_IF
25
+ NODE_CASE,
26
+ #define NODE_CASE NODE_CASE
27
+ NODE_WHEN,
28
+ #define NODE_WHEN NODE_WHEN
29
+ NODE_OPT_N,
30
+ #define NODE_OPT_N NODE_OPT_N
31
+ NODE_WHILE,
32
+ #define NODE_WHILE NODE_WHILE
33
+ NODE_UNTIL,
34
+ #define NODE_UNTIL NODE_UNTIL
35
+ NODE_ITER,
36
+ #define NODE_ITER NODE_ITER
37
+ NODE_FOR,
38
+ #define NODE_FOR NODE_FOR
39
+ NODE_BREAK,
40
+ #define NODE_BREAK NODE_BREAK
41
+ NODE_NEXT,
42
+ #define NODE_NEXT NODE_NEXT
43
+ NODE_REDO,
44
+ #define NODE_REDO NODE_REDO
45
+ NODE_RETRY,
46
+ #define NODE_RETRY NODE_RETRY
47
+ NODE_BEGIN,
48
+ #define NODE_BEGIN NODE_BEGIN
49
+ NODE_RESCUE,
50
+ #define NODE_RESCUE NODE_RESCUE
51
+ NODE_RESBODY,
52
+ #define NODE_RESBODY NODE_RESBODY
53
+ NODE_ENSURE,
54
+ #define NODE_ENSURE NODE_ENSURE
55
+ NODE_AND,
56
+ #define NODE_AND NODE_AND
57
+ NODE_OR,
58
+ #define NODE_OR NODE_OR
59
+ NODE_MASGN,
60
+ #define NODE_MASGN NODE_MASGN
61
+ NODE_LASGN,
62
+ #define NODE_LASGN NODE_LASGN
63
+ NODE_DASGN,
64
+ #define NODE_DASGN NODE_DASGN
65
+ NODE_DASGN_CURR,
66
+ #define NODE_DASGN_CURR NODE_DASGN_CURR
67
+ NODE_GASGN,
68
+ #define NODE_GASGN NODE_GASGN
69
+ NODE_IASGN,
70
+ #define NODE_IASGN NODE_IASGN
71
+ NODE_IASGN2,
72
+ #define NODE_IASGN2 NODE_IASGN2
73
+ NODE_CDECL,
74
+ #define NODE_CDECL NODE_CDECL
75
+ NODE_CVASGN,
76
+ #define NODE_CVASGN NODE_CVASGN
77
+ NODE_CVDECL,
78
+ #define NODE_CVDECL NODE_CVDECL
79
+ NODE_OP_ASGN1,
80
+ #define NODE_OP_ASGN1 NODE_OP_ASGN1
81
+ NODE_OP_ASGN2,
82
+ #define NODE_OP_ASGN2 NODE_OP_ASGN2
83
+ NODE_OP_ASGN_AND,
84
+ #define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
85
+ NODE_OP_ASGN_OR,
86
+ #define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
87
+ NODE_OP_CDECL,
88
+ #define NODE_OP_CDECL NODE_OP_CDECL
89
+ NODE_CALL,
90
+ #define NODE_CALL NODE_CALL
91
+ NODE_FCALL,
92
+ #define NODE_FCALL NODE_FCALL
93
+ NODE_VCALL,
94
+ #define NODE_VCALL NODE_VCALL
95
+ NODE_QCALL,
96
+ #define NODE_QCALL NODE_QCALL
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_KW_ARG,
158
+ #define NODE_KW_ARG NODE_KW_ARG
159
+ NODE_POSTARG,
160
+ #define NODE_POSTARG NODE_POSTARG
161
+ NODE_ARGSCAT,
162
+ #define NODE_ARGSCAT NODE_ARGSCAT
163
+ NODE_ARGSPUSH,
164
+ #define NODE_ARGSPUSH NODE_ARGSPUSH
165
+ NODE_SPLAT,
166
+ #define NODE_SPLAT NODE_SPLAT
167
+ NODE_TO_ARY,
168
+ #define NODE_TO_ARY NODE_TO_ARY
169
+ NODE_BLOCK_ARG,
170
+ #define NODE_BLOCK_ARG NODE_BLOCK_ARG
171
+ NODE_BLOCK_PASS,
172
+ #define NODE_BLOCK_PASS NODE_BLOCK_PASS
173
+ NODE_DEFN,
174
+ #define NODE_DEFN NODE_DEFN
175
+ NODE_DEFS,
176
+ #define NODE_DEFS NODE_DEFS
177
+ NODE_ALIAS,
178
+ #define NODE_ALIAS NODE_ALIAS
179
+ NODE_VALIAS,
180
+ #define NODE_VALIAS NODE_VALIAS
181
+ NODE_UNDEF,
182
+ #define NODE_UNDEF NODE_UNDEF
183
+ NODE_CLASS,
184
+ #define NODE_CLASS NODE_CLASS
185
+ NODE_MODULE,
186
+ #define NODE_MODULE NODE_MODULE
187
+ NODE_SCLASS,
188
+ #define NODE_SCLASS NODE_SCLASS
189
+ NODE_COLON2,
190
+ #define NODE_COLON2 NODE_COLON2
191
+ NODE_COLON3,
192
+ #define NODE_COLON3 NODE_COLON3
193
+ NODE_DOT2,
194
+ #define NODE_DOT2 NODE_DOT2
195
+ NODE_DOT3,
196
+ #define NODE_DOT3 NODE_DOT3
197
+ NODE_FLIP2,
198
+ #define NODE_FLIP2 NODE_FLIP2
199
+ NODE_FLIP3,
200
+ #define NODE_FLIP3 NODE_FLIP3
201
+ NODE_SELF,
202
+ #define NODE_SELF NODE_SELF
203
+ NODE_NIL,
204
+ #define NODE_NIL NODE_NIL
205
+ NODE_TRUE,
206
+ #define NODE_TRUE NODE_TRUE
207
+ NODE_FALSE,
208
+ #define NODE_FALSE NODE_FALSE
209
+ NODE_ERRINFO,
210
+ #define NODE_ERRINFO NODE_ERRINFO
211
+ NODE_DEFINED,
212
+ #define NODE_DEFINED NODE_DEFINED
213
+ NODE_POSTEXE,
214
+ #define NODE_POSTEXE NODE_POSTEXE
215
+ NODE_ALLOCA,
216
+ #define NODE_ALLOCA NODE_ALLOCA
217
+ NODE_BMETHOD,
218
+ #define NODE_BMETHOD NODE_BMETHOD
219
+ NODE_DSYM,
220
+ #define NODE_DSYM NODE_DSYM
221
+ NODE_ATTRASGN,
222
+ #define NODE_ATTRASGN NODE_ATTRASGN
223
+ NODE_PRELUDE,
224
+ #define NODE_PRELUDE NODE_PRELUDE
225
+ NODE_LAMBDA,
226
+ #define NODE_LAMBDA NODE_LAMBDA
227
+ NODE_LAST
228
+ #define NODE_LAST NODE_LAST
229
+ };
230
+
231
+ typedef struct RNode {
232
+ VALUE flags;
233
+ VALUE nd_reserved; /* ex nd_file */
234
+ union {
235
+ struct RNode *node;
236
+ ID id;
237
+ VALUE value;
238
+ VALUE (*cfunc)(ANYARGS);
239
+ ID *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_global_entry *entry;
252
+ struct rb_args_info *args;
253
+ long cnt;
254
+ VALUE value;
255
+ } u3;
256
+ } NODE;
257
+
258
+ #define RNODE(obj) (R_CAST(RNode)(obj))
259
+
260
+ /* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: TAINT, 9: UNTRUSTERD, 10: EXIVAR, 11: FREEZE */
261
+ /* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE|NODE_FL_CREF_PUSHED_BY_EVAL,
262
+ * 8..14: nd_type,
263
+ * 15..: nd_line or
264
+ * 15: NODE_FL_CREF_PUSHED_BY_EVAL
265
+ * 16: NODE_FL_CREF_OMOD_SHARED
266
+ */
267
+ #define NODE_FL_NEWLINE (((VALUE)1)<<7)
268
+
269
+ #define NODE_TYPESHIFT 8
270
+ #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
271
+
272
+ #define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
273
+ #define nd_set_type(n,t) \
274
+ RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
275
+
276
+ #define NODE_LSHIFT (NODE_TYPESHIFT+7)
277
+ #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
278
+ #define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
279
+ #define nd_set_line(n,l) \
280
+ RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
281
+
282
+ #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
283
+
284
+
285
+ RUBY_SYMBOL_EXPORT_BEGIN
286
+
287
+ /* ===== Some version-specific Ruby internals ===== */
288
+ struct rb_global_entry {
289
+ struct rb_global_variable *var;
290
+ ID id;
291
+ };
292
+ VALUE rb_iseqw_new(const void *iseq);
293
+ extern char *ruby_node_name(int type);
294
+ extern void *rb_iseq_new_top(NODE *node, VALUE name, VALUE path, VALUE absolute_path, void *parent);
295
+ extern VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
296
+ #define WITH_RB_ISEQW_NEW 1
297
+ #define WITH_CUSTOM_RB_GLOBAL_ENTRY 1
298
+ /* ================================================ */
299
+
300
+
301
+ VALUE rb_parser_new(void);
302
+ VALUE rb_parser_end_seen_p(VALUE);
303
+ VALUE rb_parser_encoding(VALUE);
304
+ VALUE rb_parser_get_yydebug(VALUE);
305
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
306
+ VALUE rb_parser_dump_tree(NODE *node, int comment);
307
+ NODE *rb_parser_append_print(VALUE, NODE *);
308
+ NODE *rb_parser_while_loop(VALUE, NODE *, int, int);
309
+
310
+ NODE *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
311
+ NODE *rb_parser_compile_string(VALUE, const char*, VALUE, int);
312
+ NODE *rb_parser_compile_file(VALUE, const char*, VALUE, int);
313
+ NODE *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
314
+ NODE *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
315
+
316
+ NODE *rb_compile_cstr(const char*, const char*, int, int);
317
+ NODE *rb_compile_string(const char*, VALUE, int);
318
+ NODE *rb_compile_file(const char*, VALUE, int);
319
+
320
+ NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
321
+ NODE *rb_node_newnode_longlife(enum node_type,VALUE,VALUE,VALUE);
322
+ void rb_gc_free_node(VALUE obj);
323
+ size_t rb_node_memsize(VALUE obj);
324
+ VALUE rb_gc_mark_node(NODE *obj);
325
+
326
+ const struct kwtable *rb_reserved_word(const char *, unsigned int);
327
+
328
+ struct rb_args_info {
329
+ NODE *pre_init;
330
+ NODE *post_init;
331
+
332
+ int pre_args_num; /* count of mandatory pre-arguments */
333
+ int post_args_num; /* count of mandatory post-arguments */
334
+
335
+ ID first_post_arg;
336
+
337
+ ID rest_arg;
338
+ ID block_arg;
339
+
340
+ NODE *kw_args;
341
+ NODE *kw_rest_arg;
342
+
343
+ NODE *opt_args;
344
+ };
345
+
346
+ struct parser_params;
347
+ void *rb_parser_malloc(struct parser_params *, size_t);
348
+ void *rb_parser_realloc(struct parser_params *, void *, size_t);
349
+ void *rb_parser_calloc(struct parser_params *, size_t, size_t);
350
+ void rb_parser_free(struct parser_params *, void *);
351
+
352
+ RUBY_SYMBOL_EXPORT_END
353
+
354
+ #if defined(__cplusplus)
355
+ #if 0
356
+ { /* satisfy cc-mode */
357
+ #endif
358
+ } /* extern "C" { */
359
+ #endif
360
+
361
+ #endif /* RUBY_NODE_H */