Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

node.h
Go to the documentation of this file.
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 NODE_BLOCK,
25 NODE_IF,
26 NODE_UNLESS,
27 NODE_CASE,
28 NODE_CASE2,
29 NODE_CASE3,
30 NODE_WHEN,
31 NODE_IN,
32 NODE_WHILE,
33 NODE_UNTIL,
34 NODE_ITER,
35 NODE_FOR,
36 NODE_FOR_MASGN,
37 NODE_BREAK,
38 NODE_NEXT,
39 NODE_REDO,
40 NODE_RETRY,
41 NODE_BEGIN,
42 NODE_RESCUE,
43 NODE_RESBODY,
44 NODE_ENSURE,
45 NODE_AND,
46 NODE_OR,
47 NODE_MASGN,
48 NODE_LASGN,
49 NODE_DASGN,
50 NODE_DASGN_CURR,
51 NODE_GASGN,
52 NODE_IASGN,
53 NODE_CDECL,
54 NODE_CVASGN,
55 NODE_OP_ASGN1,
56 NODE_OP_ASGN2,
57 NODE_OP_ASGN_AND,
58 NODE_OP_ASGN_OR,
59 NODE_OP_CDECL,
60 NODE_CALL,
61 NODE_OPCALL,
62 NODE_FCALL,
63 NODE_VCALL,
64 NODE_QCALL,
65 NODE_SUPER,
66 NODE_ZSUPER,
67 NODE_LIST,
68 NODE_ZLIST,
69 NODE_VALUES,
70 NODE_HASH,
71 NODE_RETURN,
72 NODE_YIELD,
73 NODE_LVAR,
74 NODE_DVAR,
75 NODE_GVAR,
76 NODE_IVAR,
77 NODE_CONST,
78 NODE_CVAR,
79 NODE_NTH_REF,
80 NODE_BACK_REF,
81 NODE_MATCH,
82 NODE_MATCH2,
83 NODE_MATCH3,
84 NODE_LIT,
85 NODE_STR,
86 NODE_DSTR,
87 NODE_XSTR,
88 NODE_DXSTR,
89 NODE_EVSTR,
90 NODE_DREGX,
91 NODE_ONCE,
92 NODE_ARGS,
93 NODE_ARGS_AUX,
94 NODE_OPT_ARG,
95 NODE_KW_ARG,
96 NODE_POSTARG,
97 NODE_ARGSCAT,
98 NODE_ARGSPUSH,
99 NODE_SPLAT,
100 NODE_BLOCK_PASS,
101 NODE_DEFN,
102 NODE_DEFS,
103 NODE_ALIAS,
104 NODE_VALIAS,
105 NODE_UNDEF,
106 NODE_CLASS,
107 NODE_MODULE,
108 NODE_SCLASS,
109 NODE_COLON2,
110 NODE_COLON3,
111 NODE_DOT2,
112 NODE_DOT3,
113 NODE_FLIP2,
114 NODE_FLIP3,
115 NODE_SELF,
116 NODE_NIL,
117 NODE_TRUE,
118 NODE_FALSE,
119 NODE_ERRINFO,
120 NODE_DEFINED,
121 NODE_POSTEXE,
122 NODE_DSYM,
123 NODE_ATTRASGN,
124 NODE_LAMBDA,
125 NODE_ARYPTN,
126 NODE_HSHPTN,
127 NODE_LAST
128 };
129
130 typedef struct rb_code_position_struct {
131 int lineno;
132 int column;
133 } rb_code_position_t;
134
135 typedef struct rb_code_location_struct {
136 rb_code_position_t beg_pos;
137 rb_code_position_t end_pos;
138 } rb_code_location_t;
139
140 static inline rb_code_location_t
141 code_loc_gen(rb_code_location_t *loc1, rb_code_location_t *loc2)
142 {
143 rb_code_location_t loc;
144 loc.beg_pos = loc1->beg_pos;
145 loc.end_pos = loc2->end_pos;
146 return loc;
147 }
148
149 typedef struct RNode {
150 VALUE flags;
151 union {
152 struct RNode *node;
153 ID id;
154 VALUE value;
155 ID *tbl;
156 } u1;
157 union {
158 struct RNode *node;
159 ID id;
160 long argc;
161 VALUE value;
162 } u2;
163 union {
164 struct RNode *node;
165 ID id;
166 long state;
167 struct rb_global_entry *entry;
168 struct rb_args_info *args;
169 struct rb_ary_pattern_info *apinfo;
170 VALUE value;
171 } u3;
172 rb_code_location_t nd_loc;
173 int node_id;
174 } NODE;
175
176 #define RNODE(obj) (R_CAST(RNode)(obj))
177
178 /* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: UNUSED, 9: UNUSED, 10: EXIVAR, 11: FREEZE */
179 /* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE,
180 * 8..14: nd_type,
181 * 15..: nd_line
182 */
183 #define NODE_FL_NEWLINE (((VALUE)1)<<7)
184
185 #define NODE_TYPESHIFT 8
186 #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
187
188 #define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
189 #define nd_set_type(n,t) \
190 (n)->flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
191
192 #define NODE_LSHIFT (NODE_TYPESHIFT+7)
193 #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
194 #define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT)
195 #define nd_set_line(n,l) \
196 (n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
197
198 #define nd_first_column(n) ((int)((n)->nd_loc.beg_pos.column))
199 #define nd_set_first_column(n, v) ((n)->nd_loc.beg_pos.column = (v))
200 #define nd_first_lineno(n) ((int)((n)->nd_loc.beg_pos.lineno))
201 #define nd_set_first_lineno(n, v) ((n)->nd_loc.beg_pos.lineno = (v))
202 #define nd_first_loc(n) ((n)->nd_loc.beg_pos)
203 #define nd_set_first_loc(n, v) (nd_first_loc(n) = (v))
204
205 #define nd_last_column(n) ((int)((n)->nd_loc.end_pos.column))
206 #define nd_set_last_column(n, v) ((n)->nd_loc.end_pos.column = (v))
207 #define nd_last_lineno(n) ((int)((n)->nd_loc.end_pos.lineno))
208 #define nd_set_last_lineno(n, v) ((n)->nd_loc.end_pos.lineno = (v))
209 #define nd_last_loc(n) ((n)->nd_loc.end_pos)
210 #define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
211 #define nd_node_id(n) ((n)->node_id)
212 #define nd_set_node_id(n,id) ((n)->node_id = (id))
213
214 #define nd_head u1.node
215 #define nd_alen u2.argc
216 #define nd_next u3.node
217
218 #define nd_cond u1.node
219 #define nd_body u2.node
220 #define nd_else u3.node
221
222 #define nd_resq u2.node
223 #define nd_ensr u3.node
224
225 #define nd_1st u1.node
226 #define nd_2nd u2.node
227
228 #define nd_stts u1.node
229
230 #define nd_entry u3.entry
231 #define nd_vid u1.id
232 #define nd_cflag u2.id
233 #define nd_cval u3.value
234
235 #define nd_oid u1.id
236 #define nd_tbl u1.tbl
237
238 #define nd_var u1.node
239 #define nd_iter u3.node
240
241 #define nd_value u2.node
242 #define nd_aid u3.id
243
244 #define nd_lit u1.value
245
246 #define nd_rest u1.id
247 #define nd_opt u1.node
248 #define nd_pid u1.id
249 #define nd_plen u2.argc
250
251 #define nd_recv u1.node
252 #define nd_mid u2.id
253 #define nd_args u3.node
254 #define nd_ainfo u3.args
255
256 #define nd_defn u3.node
257
258 #define nd_cpath u1.node
259 #define nd_super u3.node
260
261 #define nd_beg u1.node
262 #define nd_end u2.node
263 #define nd_state u3.state
264 #define nd_rval u2.value
265
266 #define nd_nth u2.argc
267
268 #define nd_tag u1.id
269
270 #define nd_alias u1.id
271 #define nd_orig u2.id
272 #define nd_undef u2.node
273
274 #define nd_brace u2.argc
275
276 #define nd_pconst u1.node
277 #define nd_pkwargs u2.node
278 #define nd_pkwrestarg u3.node
279
280 #define nd_apinfo u3.apinfo
281
282 #define NEW_NODE(t,a0,a1,a2,loc) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2),loc)
283 #define NEW_NODE_WITH_LOCALS(t,a1,a2,loc) node_newnode_with_locals(p, (t),(VALUE)(a1),(VALUE)(a2),loc)
284
285 #define NEW_DEFN(i,a,d,loc) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d,loc),loc)
286 #define NEW_DEFS(r,i,a,d,loc) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d,loc),loc)
287 #define NEW_SCOPE(a,b,loc) NEW_NODE_WITH_LOCALS(NODE_SCOPE,b,a,loc)
288 #define NEW_BLOCK(a,loc) NEW_NODE(NODE_BLOCK,a,0,0,loc)
289 #define NEW_IF(c,t,e,loc) NEW_NODE(NODE_IF,c,t,e,loc)
290 #define NEW_UNLESS(c,t,e,loc) NEW_NODE(NODE_UNLESS,c,t,e,loc)
291 #define NEW_CASE(h,b,loc) NEW_NODE(NODE_CASE,h,b,0,loc)
292 #define NEW_CASE2(b,loc) NEW_NODE(NODE_CASE2,0,b,0,loc)
293 #define NEW_CASE3(h,b,loc) NEW_NODE(NODE_CASE3,h,b,0,loc)
294 #define NEW_WHEN(c,t,e,loc) NEW_NODE(NODE_WHEN,c,t,e,loc)
295 #define NEW_IN(c,t,e,loc) NEW_NODE(NODE_IN,c,t,e,loc)
296 #define NEW_WHILE(c,b,n,loc) NEW_NODE(NODE_WHILE,c,b,n,loc)
297 #define NEW_UNTIL(c,b,n,loc) NEW_NODE(NODE_UNTIL,c,b,n,loc)
298 #define NEW_FOR(i,b,loc) NEW_NODE(NODE_FOR,0,b,i,loc)
299 #define NEW_FOR_MASGN(v,loc) NEW_NODE(NODE_FOR_MASGN,v,0,0,loc)
300 #define NEW_ITER(a,b,loc) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b,loc),0,loc)
301 #define NEW_LAMBDA(a,b,loc) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b,loc),0,loc)
302 #define NEW_BREAK(s,loc) NEW_NODE(NODE_BREAK,s,0,0,loc)
303 #define NEW_NEXT(s,loc) NEW_NODE(NODE_NEXT,s,0,0,loc)
304 #define NEW_REDO(loc) NEW_NODE(NODE_REDO,0,0,0,loc)
305 #define NEW_RETRY(loc) NEW_NODE(NODE_RETRY,0,0,0,loc)
306 #define NEW_BEGIN(b,loc) NEW_NODE(NODE_BEGIN,0,b,0,loc)
307 #define NEW_RESCUE(b,res,e,loc) NEW_NODE(NODE_RESCUE,b,res,e,loc)
308 #define NEW_RESBODY(a,ex,n,loc) NEW_NODE(NODE_RESBODY,n,ex,a,loc)
309 #define NEW_ENSURE(b,en,loc) NEW_NODE(NODE_ENSURE,b,0,en,loc)
310 #define NEW_RETURN(s,loc) NEW_NODE(NODE_RETURN,s,0,0,loc)
311 #define NEW_YIELD(a,loc) NEW_NODE(NODE_YIELD,a,0,0,loc)
312 #define NEW_LIST(a,loc) NEW_NODE(NODE_LIST,a,1,0,loc)
313 #define NEW_ZLIST(loc) NEW_NODE(NODE_ZLIST,0,0,0,loc)
314 #define NEW_HASH(a,loc) NEW_NODE(NODE_HASH,a,0,0,loc)
315 #define NEW_MASGN(l,r,loc) NEW_NODE(NODE_MASGN,l,0,r,loc)
316 #define NEW_GASGN(v,val,loc) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v),loc)
317 #define NEW_LASGN(v,val,loc) NEW_NODE(NODE_LASGN,v,val,0,loc)
318 #define NEW_DASGN(v,val,loc) NEW_NODE(NODE_DASGN,v,val,0,loc)
319 #define NEW_DASGN_CURR(v,val,loc) NEW_NODE(NODE_DASGN_CURR,v,val,0,loc)
320 #define NEW_IASGN(v,val,loc) NEW_NODE(NODE_IASGN,v,val,0,loc)
321 #define NEW_CDECL(v,val,path,loc) NEW_NODE(NODE_CDECL,v,val,path,loc)
322 #define NEW_CVASGN(v,val,loc) NEW_NODE(NODE_CVASGN,v,val,0,loc)
323 #define NEW_OP_ASGN1(p,id,a,loc) NEW_NODE(NODE_OP_ASGN1,p,id,a,loc)
324 #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)
325 #define NEW_OP_ASGN22(i,o,t,loc) NEW_NODE(NODE_OP_ASGN2,i,o,t,loc)
326 #define NEW_OP_ASGN_OR(i,val,loc) NEW_NODE(NODE_OP_ASGN_OR,i,val,0,loc)
327 #define NEW_OP_ASGN_AND(i,val,loc) NEW_NODE(NODE_OP_ASGN_AND,i,val,0,loc)
328 #define NEW_OP_CDECL(v,op,val,loc) NEW_NODE(NODE_OP_CDECL,v,val,op,loc)
329 #define NEW_GVAR(v,loc) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v),loc)
330 #define NEW_LVAR(v,loc) NEW_NODE(NODE_LVAR,v,0,0,loc)
331 #define NEW_DVAR(v,loc) NEW_NODE(NODE_DVAR,v,0,0,loc)
332 #define NEW_IVAR(v,loc) NEW_NODE(NODE_IVAR,v,0,0,loc)
333 #define NEW_CONST(v,loc) NEW_NODE(NODE_CONST,v,0,0,loc)
334 #define NEW_CVAR(v,loc) NEW_NODE(NODE_CVAR,v,0,0,loc)
335 #define NEW_NTH_REF(n,loc) NEW_NODE(NODE_NTH_REF,0,n,0,loc)
336 #define NEW_BACK_REF(n,loc) NEW_NODE(NODE_BACK_REF,0,n,0,loc)
337 #define NEW_MATCH(c,loc) NEW_NODE(NODE_MATCH,c,0,0,loc)
338 #define NEW_MATCH2(n1,n2,loc) NEW_NODE(NODE_MATCH2,n1,n2,0,loc)
339 #define NEW_MATCH3(r,n2,loc) NEW_NODE(NODE_MATCH3,r,n2,0,loc)
340 #define NEW_LIT(l,loc) NEW_NODE(NODE_LIT,l,0,0,loc)
341 #define NEW_STR(s,loc) NEW_NODE(NODE_STR,s,0,0,loc)
342 #define NEW_DSTR(s,loc) NEW_NODE(NODE_DSTR,s,1,0,loc)
343 #define NEW_XSTR(s,loc) NEW_NODE(NODE_XSTR,s,0,0,loc)
344 #define NEW_DXSTR(s,loc) NEW_NODE(NODE_DXSTR,s,0,0,loc)
345 #define NEW_DSYM(s,loc) NEW_NODE(NODE_DSYM,s,0,0,loc)
346 #define NEW_EVSTR(n,loc) NEW_NODE(NODE_EVSTR,0,(n),0,loc)
347 #define NEW_CALL(r,m,a,loc) NEW_NODE(NODE_CALL,r,m,a,loc)
348 #define NEW_OPCALL(r,m,a,loc) NEW_NODE(NODE_OPCALL,r,m,a,loc)
349 #define NEW_FCALL(m,a,loc) NEW_NODE(NODE_FCALL,0,m,a,loc)
350 #define NEW_VCALL(m,loc) NEW_NODE(NODE_VCALL,0,m,0,loc)
351 #define NEW_SUPER(a,loc) NEW_NODE(NODE_SUPER,0,0,a,loc)
352 #define NEW_ZSUPER(loc) NEW_NODE(NODE_ZSUPER,0,0,0,loc)
353 #define NEW_ARGS_AUX(r,b,loc) NEW_NODE(NODE_ARGS_AUX,r,b,0,loc)
354 #define NEW_OPT_ARG(i,v,loc) NEW_NODE(NODE_OPT_ARG,i,v,0,loc)
355 #define NEW_KW_ARG(i,v,loc) NEW_NODE(NODE_KW_ARG,i,v,0,loc)
356 #define NEW_POSTARG(i,v,loc) NEW_NODE(NODE_POSTARG,i,v,0,loc)
357 #define NEW_ARGSCAT(a,b,loc) NEW_NODE(NODE_ARGSCAT,a,b,0,loc)
358 #define NEW_ARGSPUSH(a,b,loc) NEW_NODE(NODE_ARGSPUSH,a,b,0,loc)
359 #define NEW_SPLAT(a,loc) NEW_NODE(NODE_SPLAT,a,0,0,loc)
360 #define NEW_BLOCK_PASS(b,loc) NEW_NODE(NODE_BLOCK_PASS,0,b,0,loc)
361 #define NEW_ALIAS(n,o,loc) NEW_NODE(NODE_ALIAS,n,o,0,loc)
362 #define NEW_VALIAS(n,o,loc) NEW_NODE(NODE_VALIAS,n,o,0,loc)
363 #define NEW_UNDEF(i,loc) NEW_NODE(NODE_UNDEF,0,i,0,loc)
364 #define NEW_CLASS(n,b,s,loc) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b,loc),(s),loc)
365 #define NEW_SCLASS(r,b,loc) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b,loc),0,loc)
366 #define NEW_MODULE(n,b,loc) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b,loc),0,loc)
367 #define NEW_COLON2(c,i,loc) NEW_NODE(NODE_COLON2,c,i,0,loc)
368 #define NEW_COLON3(i,loc) NEW_NODE(NODE_COLON3,0,i,0,loc)
369 #define NEW_DOT2(b,e,loc) NEW_NODE(NODE_DOT2,b,e,0,loc)
370 #define NEW_DOT3(b,e,loc) NEW_NODE(NODE_DOT3,b,e,0,loc)
371 #define NEW_SELF(loc) NEW_NODE(NODE_SELF,0,0,1,loc)
372 #define NEW_NIL(loc) NEW_NODE(NODE_NIL,0,0,0,loc)
373 #define NEW_TRUE(loc) NEW_NODE(NODE_TRUE,0,0,0,loc)
374 #define NEW_FALSE(loc) NEW_NODE(NODE_FALSE,0,0,0,loc)
375 #define NEW_ERRINFO(loc) NEW_NODE(NODE_ERRINFO,0,0,0,loc)
376 #define NEW_DEFINED(e,loc) NEW_NODE(NODE_DEFINED,e,0,0,loc)
377 #define NEW_PREEXE(b,loc) NEW_SCOPE(b,loc)
378 #define NEW_POSTEXE(b,loc) NEW_NODE(NODE_POSTEXE,0,b,0,loc)
379 #define NEW_ATTRASGN(r,m,a,loc) NEW_NODE(NODE_ATTRASGN,r,m,a,loc)
380
381 #define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
382 #define NODE_REQUIRED_KEYWORD_P(node) ((node)->nd_value == NODE_SPECIAL_REQUIRED_KEYWORD)
383 #define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
384 #define NODE_NAMED_REST_P(node) ((node) != NODE_SPECIAL_NO_NAME_REST)
385 #define NODE_SPECIAL_EXCESSIVE_COMMA ((ID)1)
386 #define NODE_SPECIAL_NO_REST_KEYWORD ((NODE *)-1)
387
388 VALUE rb_node_case_when_optimizable_literal(const NODE *const node);
389
390 RUBY_SYMBOL_EXPORT_BEGIN
391
392 typedef struct node_buffer_struct node_buffer_t;
393 /* T_IMEMO/ast */
394 typedef struct rb_ast_body_struct {
395 const NODE *root;
396 VALUE compile_option;
397 int line_count;
398 } rb_ast_body_t;
399 typedef struct rb_ast_struct {
400 VALUE flags;
401 node_buffer_t *node_buffer;
402 rb_ast_body_t body;
403 } rb_ast_t;
404 rb_ast_t *rb_ast_new(void);
405 void rb_ast_mark(rb_ast_t*);
406 void rb_ast_update_references(rb_ast_t*);
407 void rb_ast_dispose(rb_ast_t*);
408 void rb_ast_free(rb_ast_t*);
409 size_t rb_ast_memsize(const rb_ast_t*);
410 void rb_ast_add_mark_object(rb_ast_t*, VALUE);
411 NODE *rb_ast_newnode(rb_ast_t*, enum node_type type);
412 void rb_ast_delete_node(rb_ast_t*, NODE *n);
413
414 VALUE rb_parser_new(void);
415 VALUE rb_parser_end_seen_p(VALUE);
416 VALUE rb_parser_encoding(VALUE);
417 VALUE rb_parser_set_yydebug(VALUE, VALUE);
418 VALUE rb_parser_dump_tree(const NODE *node, int comment);
419 void rb_parser_set_options(VALUE, int, int, int, int);
420
421 rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
422 rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
423 rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
424 rb_ast_t *rb_parser_compile_generic(VALUE vparser, VALUE (*lex_gets)(VALUE, int), VALUE fname, VALUE input, int line);
425
426 void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2);
427 const char *ruby_node_name(int node);
428
429 const struct kwtable *rb_reserved_word(const char *, unsigned int);
430
431 struct rb_args_info {
432 NODE *pre_init;
433 NODE *post_init;
434
435 int pre_args_num; /* count of mandatory pre-arguments */
436 int post_args_num; /* count of mandatory post-arguments */
437
438 ID first_post_arg;
439
440 ID rest_arg;
441 ID block_arg;
442
443 NODE *kw_args;
444 NODE *kw_rest_arg;
445
446 NODE *opt_args;
447 unsigned int no_kwarg: 1;
448 unsigned int ruby2_keywords: 1;
449
450 VALUE imemo;
451 };
452
453 struct rb_ary_pattern_info {
454 NODE *pre_args;
455 NODE *rest_arg;
456 NODE *post_args;
457 VALUE imemo;
458 };
459
460 struct parser_params;
461 void *rb_parser_malloc(struct parser_params *, size_t);
462 void *rb_parser_realloc(struct parser_params *, void *, size_t);
463 void *rb_parser_calloc(struct parser_params *, size_t, size_t);
464 void rb_parser_free(struct parser_params *, void *);
465 PRINTF_ARGS(void rb_parser_printf(struct parser_params *parser, const char *fmt, ...), 2, 3);
466
467 RUBY_SYMBOL_EXPORT_END
468
469 #if defined(__cplusplus)
470 #if 0
471 { /* satisfy cc-mode */
472 #endif
473 } /* extern "C" { */
474 #endif
475
476 #endif /* RUBY_NODE_H */
rb_parser_printf
void rb_parser_printf(struct parser_params *p, const char *fmt,...)
Definition: ripper.c:19435
NODE_NEXT
@ NODE_NEXT
Definition: node.h:47
kwtable
Definition: lex.c:34
NODE_COLON3
@ NODE_COLON3
Definition: node.h:119
NODE_NIL
@ NODE_NIL
Definition: node.h:125
ID
unsigned long ID
Definition: ruby.h:103
rb_ast_newnode
NODE * rb_ast_newnode(rb_ast_t *, enum node_type type)
Definition: node.c:1189
RUBY_SYMBOL_EXPORT_END
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
RNode::value
VALUE value
Definition: node.h:154
rb_parser_compile_string_path
rb_ast_t * rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line)
Definition: ripper.c:12897
NODE_ATTRASGN
@ NODE_ATTRASGN
Definition: node.h:132
NODE_DSYM
@ NODE_DSYM
Definition: node.h:131
NODE_HSHPTN
@ NODE_HSHPTN
Definition: node.h:135
NODE_RESCUE
@ NODE_RESCUE
Definition: node.h:51
rb_ast_struct::body
rb_ast_body_t body
Definition: node.h:402
NODE_OP_ASGN1
@ NODE_OP_ASGN1
Definition: node.h:64
rb_ary_pattern_info::pre_args
NODE * pre_args
Definition: node.h:454
NODE_TRUE
@ NODE_TRUE
Definition: node.h:126
rb_parser_free
void rb_parser_free(struct parser_params *, void *)
Definition: ripper.c:19418
NODE_MATCH3
@ NODE_MATCH3
Definition: node.h:92
NODE_NTH_REF
@ NODE_NTH_REF
Definition: node.h:88
NODE_ZLIST
@ NODE_ZLIST
Definition: node.h:77
NODE_DREGX
@ NODE_DREGX
Definition: node.h:99
NODE_OR
@ NODE_OR
Definition: node.h:55
NODE_ARYPTN
@ NODE_ARYPTN
Definition: node.h:134
NODE_OP_ASGN_OR
@ NODE_OP_ASGN_OR
Definition: node.h:67
RNode::node
struct RNode * node
Definition: node.h:152
NODE_HASH
@ NODE_HASH
Definition: node.h:79
rb_ast_delete_node
void rb_ast_delete_node(rb_ast_t *, NODE *n)
Definition: node.c:1211
NODE_CONST
@ NODE_CONST
Definition: node.h:86
rb_ast_add_mark_object
void rb_ast_add_mark_object(rb_ast_t *, VALUE)
Definition: node.c:1395
NODE_LASGN
@ NODE_LASGN
Definition: node.h:57
rb_parser_encoding
VALUE rb_parser_encoding(VALUE)
Definition: ripper.c:19297
NODE_FLIP2
@ NODE_FLIP2
Definition: node.h:122
NODE_ARGSPUSH
@ NODE_ARGSPUSH
Definition: node.h:107
NODE_FOR
@ NODE_FOR
Definition: node.h:44
VALUE
unsigned long VALUE
Definition: ruby.h:102
NODE_CASE
@ NODE_CASE
Definition: node.h:36
rb_ast_body_struct
Definition: node.h:394
NODE_OP_ASGN2
@ NODE_OP_ASGN2
Definition: node.h:65
NODE_ARGSCAT
@ NODE_ARGSCAT
Definition: node.h:106
rb_reserved_word
const struct kwtable * rb_reserved_word(const char *, unsigned int)
Definition: ripper.c:19218
rb_ast_mark
void rb_ast_mark(rb_ast_t *)
Definition: node.c:1342
rb_args_info::pre_args_num
int pre_args_num
Definition: node.h:435
NODE_DOT2
@ NODE_DOT2
Definition: node.h:120
NODE_EVSTR
@ NODE_EVSTR
Definition: node.h:98
rb_code_position_struct
Definition: node.h:130
rb_args_info::kw_rest_arg
NODE * kw_rest_arg
Definition: node.h:444
NODE_UNTIL
@ NODE_UNTIL
Definition: node.h:42
rb_args_info::post_init
NODE * post_init
Definition: node.h:433
rb_ast_free
void rb_ast_free(rb_ast_t *)
Definition: node.c:1354
RNode::apinfo
struct rb_ary_pattern_info * apinfo
Definition: node.h:169
NODE_CVASGN
@ NODE_CVASGN
Definition: node.h:63
NODE_AND
@ NODE_AND
Definition: node.h:54
rb_code_position_struct::lineno
int lineno
Definition: node.h:131
NODE_LIT
@ NODE_LIT
Definition: node.h:93
RNode::tbl
ID * tbl
Definition: node.h:155
NODE_MASGN
@ NODE_MASGN
Definition: node.h:56
NODE_DXSTR
@ NODE_DXSTR
Definition: node.h:97
NODE_OPCALL
@ NODE_OPCALL
Definition: node.h:70
RNode::flags
VALUE flags
Definition: node.h:150
NODE_OP_ASGN_AND
@ NODE_OP_ASGN_AND
Definition: node.h:66
rb_ast_update_references
void rb_ast_update_references(rb_ast_t *)
Definition: node.c:1332
NODE_DASGN
@ NODE_DASGN
Definition: node.h:58
NODE_BLOCK
@ NODE_BLOCK
Definition: node.h:33
NODE_ERRINFO
@ NODE_ERRINFO
Definition: node.h:128
rb_args_info::first_post_arg
ID first_post_arg
Definition: node.h:438
rb_parser_set_yydebug
VALUE rb_parser_set_yydebug(VALUE, VALUE)
Definition: ripper.c:19329
RNode::u2
union RNode::@123 u2
rb_ast_memsize
size_t rb_ast_memsize(const rb_ast_t *)
Definition: node.c:1375
NODE_KW_ARG
@ NODE_KW_ARG
Definition: node.h:104
NODE_DSTR
@ NODE_DSTR
Definition: node.h:95
rb_parser_end_seen_p
VALUE rb_parser_end_seen_p(VALUE)
Definition: ripper.c:19282
NODE_SPLAT
@ NODE_SPLAT
Definition: node.h:108
NODE_ITER
@ NODE_ITER
Definition: node.h:43
NODE_CDECL
@ NODE_CDECL
Definition: node.h:62
rb_args_info::kw_args
NODE * kw_args
Definition: node.h:443
rb_ast_struct::node_buffer
node_buffer_t * node_buffer
Definition: node.h:401
NODE_CVAR
@ NODE_CVAR
Definition: node.h:87
rb_args_info::pre_init
NODE * pre_init
Definition: node.h:432
NODE_IN
@ NODE_IN
Definition: node.h:40
rb_ast_body_struct::compile_option
VALUE compile_option
Definition: node.h:396
NODE_ZSUPER
@ NODE_ZSUPER
Definition: node.h:75
NODE_LAMBDA
@ NODE_LAMBDA
Definition: node.h:133
NODE_SUPER
@ NODE_SUPER
Definition: node.h:74
NODE_VCALL
@ NODE_VCALL
Definition: node.h:72
NODE_VALIAS
@ NODE_VALIAS
Definition: node.h:113
NODE_DEFS
@ NODE_DEFS
Definition: node.h:111
NODE_UNLESS
@ NODE_UNLESS
Definition: node.h:35
rb_ast_struct
Definition: node.h:399
NODE_DEFN
@ NODE_DEFN
Definition: node.h:110
rb_args_info::opt_args
NODE * opt_args
Definition: node.h:446
rb_args_info
Definition: node.h:431
rb_ary_pattern_info::post_args
NODE * post_args
Definition: node.h:456
rb_parser_compile_generic
rb_ast_t * rb_parser_compile_generic(VALUE vparser, VALUE(*lex_gets)(VALUE, int), VALUE fname, VALUE input, int line)
Definition: ripper.c:12932
rb_ary_pattern_info::rest_arg
NODE * rest_arg
Definition: node.h:455
rb_args_info::imemo
VALUE imemo
Definition: node.h:450
rb_args_info::ruby2_keywords
unsigned int ruby2_keywords
Definition: node.h:448
NODE_CLASS
@ NODE_CLASS
Definition: node.h:115
NODE_IF
@ NODE_IF
Definition: node.h:34
NODE_ENSURE
@ NODE_ENSURE
Definition: node.h:53
NODE_MATCH2
@ NODE_MATCH2
Definition: node.h:91
rb_code_position_struct::column
int column
Definition: node.h:132
NODE_CASE3
@ NODE_CASE3
Definition: node.h:38
RNode::state
long state
Definition: node.h:166
rb_ast_dispose
void rb_ast_dispose(rb_ast_t *)
Definition: node.c:1389
rb_parser_realloc
void * rb_parser_realloc(struct parser_params *, void *, size_t)
Definition: ripper.c:19398
NODE_DASGN_CURR
@ NODE_DASGN_CURR
Definition: node.h:59
NODE_COLON2
@ NODE_COLON2
Definition: node.h:118
NODE_DOT3
@ NODE_DOT3
Definition: node.h:121
node_type
node_type
Definition: node.h:22
rb_parser_dump_tree
VALUE rb_parser_dump_tree(const NODE *node, int comment)
Definition: node.c:1076
ruby_node_name
const char * ruby_node_name(int node)
Definition: iseq.c:2534
NODE_BREAK
@ NODE_BREAK
Definition: node.h:46
input
unsigned int input
Definition: nkf.c:4325
RNode::args
struct rb_args_info * args
Definition: node.h:168
NODE_GVAR
@ NODE_GVAR
Definition: node.h:84
rb_parser_compile_file_path
rb_ast_t * rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line)
Definition: ripper.c:12912
NODE_XSTR
@ NODE_XSTR
Definition: node.h:96
rb_parser_compile_string
rb_ast_t * rb_parser_compile_string(VALUE, const char *, VALUE, int)
Definition: ripper.c:12891
rb_code_location_t
struct rb_code_location_struct rb_code_location_t
rb_ast_body_struct::line_count
int line_count
Definition: node.h:397
NODE_ARGS
@ NODE_ARGS
Definition: node.h:101
NODE_DVAR
@ NODE_DVAR
Definition: node.h:83
PRINTF_ARGS
PRINTF_ARGS(void rb_parser_printf(struct parser_params *parser, const char *fmt,...), 2, 3)
rb_ast_struct::flags
VALUE flags
Definition: node.h:400
NODE_ALIAS
@ NODE_ALIAS
Definition: node.h:112
rb_args_info::post_args_num
int post_args_num
Definition: node.h:436
NODE_OP_CDECL
@ NODE_OP_CDECL
Definition: node.h:68
NODE_POSTARG
@ NODE_POSTARG
Definition: node.h:105
NODE_SELF
@ NODE_SELF
Definition: node.h:124
rb_args_info::no_kwarg
unsigned int no_kwarg
Definition: node.h:447
NODE_LVAR
@ NODE_LVAR
Definition: node.h:82
NODE_STR
@ NODE_STR
Definition: node.h:94
rb_node_init
void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2)
Definition: node.c:1095
src
__inline__ const void *__restrict src
Definition: rb_mjit_min_header-2.7.0.h:2836
fmt
const VALUE int int int int int int VALUE char * fmt
Definition: rb_mjit_min_header-2.7.0.h:6462
rb_parser_new
VALUE rb_parser_new(void)
Definition: ripper.c:19224
NODE_IVAR
@ NODE_IVAR
Definition: node.h:85
rb_node_case_when_optimizable_literal
VALUE rb_node_case_when_optimizable_literal(const NODE *const node)
Definition: compile.c:4288
n
const char size_t n
Definition: rb_mjit_min_header-2.7.0.h:5456
NODE_BEGIN
@ NODE_BEGIN
Definition: node.h:50
NODE_POSTEXE
@ NODE_POSTEXE
Definition: node.h:130
NODE_RESBODY
@ NODE_RESBODY
Definition: node.h:52
NODE_RETURN
@ NODE_RETURN
Definition: node.h:80
NODE_FALSE
@ NODE_FALSE
Definition: node.h:127
RNode::argc
long argc
Definition: node.h:160
NODE_ONCE
@ NODE_ONCE
Definition: node.h:100
RNode::nd_loc
rb_code_location_t nd_loc
Definition: node.h:172
rb_ast_new
rb_ast_t * rb_ast_new(void)
Definition: node.c:1219
rb_parser_set_options
void rb_parser_set_options(VALUE, int, int, int, int)
Definition: ripper.c:19036
NODE_IASGN
@ NODE_IASGN
Definition: node.h:61
RUBY_SYMBOL_EXPORT_BEGIN
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
NODE_ARGS_AUX
@ NODE_ARGS_AUX
Definition: node.h:102
NODE_WHEN
@ NODE_WHEN
Definition: node.h:39
NODE_BLOCK_PASS
@ NODE_BLOCK_PASS
Definition: node.h:109
NODE_MATCH
@ NODE_MATCH
Definition: node.h:90
NODE_OPT_ARG
@ NODE_OPT_ARG
Definition: node.h:103
NODE_CALL
@ NODE_CALL
Definition: node.h:69
rb_parser_calloc
void * rb_parser_calloc(struct parser_params *, size_t, size_t)
Definition: ripper.c:19388
NODE_CASE2
@ NODE_CASE2
Definition: node.h:37
rb_code_location_struct::beg_pos
rb_code_position_t beg_pos
Definition: node.h:136
RNode::u1
union RNode::@122 u1
NODE
struct RNode NODE
rb_code_position_t
struct rb_code_position_struct rb_code_position_t
rb_ary_pattern_info::imemo
VALUE imemo
Definition: node.h:457
NODE_FCALL
@ NODE_FCALL
Definition: node.h:71
RNode::node_id
int node_id
Definition: node.h:173
rb_ast_t
struct rb_ast_struct rb_ast_t
NODE_YIELD
@ NODE_YIELD
Definition: node.h:81
RNode::u3
union RNode::@124 u3
node_buffer_struct
Definition: node.c:1120
rb_ast_body_t
struct rb_ast_body_struct rb_ast_body_t
NODE_UNDEF
@ NODE_UNDEF
Definition: node.h:114
NODE_BACK_REF
@ NODE_BACK_REF
Definition: node.h:89
NODE_DEFINED
@ NODE_DEFINED
Definition: node.h:129
parser_params
Definition: ripper.c:270
rb_parser_malloc
void * rb_parser_malloc(struct parser_params *, size_t)
Definition: ripper.c:19378
rb_args_info::block_arg
ID block_arg
Definition: node.h:441
NODE_LAST
@ NODE_LAST
Definition: node.h:136
NODE_VALUES
@ NODE_VALUES
Definition: node.h:78
NODE_FLIP3
@ NODE_FLIP3
Definition: node.h:123
rb_code_location_struct::end_pos
rb_code_position_t end_pos
Definition: node.h:137
rb_code_location_struct
Definition: node.h:135
rb_ast_body_struct::root
const NODE * root
Definition: node.h:395
NODE_REDO
@ NODE_REDO
Definition: node.h:48
node_buffer_t
typedefRUBY_SYMBOL_EXPORT_BEGIN struct node_buffer_struct node_buffer_t
Definition: node.h:392
rb_ary_pattern_info
Definition: node.h:453
RNode::entry
struct rb_global_entry * entry
Definition: node.h:167
NODE_MODULE
@ NODE_MODULE
Definition: node.h:116
RNode::id
ID id
Definition: node.h:153
rb_args_info::rest_arg
ID rest_arg
Definition: node.h:440
NODE_QCALL
@ NODE_QCALL
Definition: node.h:73
NODE_SCOPE
@ NODE_SCOPE
Definition: node.h:32
NODE_RETRY
@ NODE_RETRY
Definition: node.h:49
NODE_LIST
@ NODE_LIST
Definition: node.h:76
NODE_FOR_MASGN
@ NODE_FOR_MASGN
Definition: node.h:45
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:39
RNode
Definition: node.h:149
rb_global_entry
Definition: internal.h:1350
NODE_WHILE
@ NODE_WHILE
Definition: node.h:41
NODE_SCLASS
@ NODE_SCLASS
Definition: node.h:117
NODE_GASGN
@ NODE_GASGN
Definition: node.h:60