Ruby: node.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

node.h
1#ifndef RUBY_NODE_H
2#define RUBY_NODE_H 1
3/**********************************************************************
4
5 node.h -
6
7 $Author$
8 created at: Fri May 28 15:14:02 JST 1993
9
10 Copyright (C) 1993-2007 Yukihiro Matsumoto
11
12**********************************************************************/
13
14#include "internal/compilers.h"
15
16#if defined(__cplusplus)
17extern "C" {
18#if 0
19} /* satisfy cc-mode */
20#endif
21#endif
22
23enum node_type {
24 NODE_SCOPE,
25 NODE_BLOCK,
26 NODE_IF,
27 NODE_UNLESS,
28 NODE_CASE,
29 NODE_CASE2,
30 NODE_CASE3,
31 NODE_WHEN,
32 NODE_IN,
33 NODE_WHILE,
34 NODE_UNTIL,
35 NODE_ITER,
36 NODE_FOR,
37 NODE_FOR_MASGN,
38 NODE_BREAK,
39 NODE_NEXT,
40 NODE_REDO,
41 NODE_RETRY,
42 NODE_BEGIN,
43 NODE_RESCUE,
44 NODE_RESBODY,
45 NODE_ENSURE,
46 NODE_AND,
47 NODE_OR,
48 NODE_MASGN,
49 NODE_LASGN,
50 NODE_DASGN,
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_FNDPTN,
128 NODE_ERROR,
129 NODE_LAST
130};
131
132 typedef struct rb_code_position_struct {
133 int lineno;
134 int column;
135} rb_code_position_t;
136
137 typedef struct rb_code_location_struct {
138 rb_code_position_t beg_pos;
139 rb_code_position_t end_pos;
140} rb_code_location_t;
141
142static inline rb_code_location_t
143code_loc_gen(const rb_code_location_t *loc1, const rb_code_location_t *loc2)
144{
145 rb_code_location_t loc;
146 loc.beg_pos = loc1->beg_pos;
147 loc.end_pos = loc2->end_pos;
148 return loc;
149}
150
151 typedef struct rb_ast_id_table {
152 int size;
153 ID ids[FLEX_ARY_LEN];
154} rb_ast_id_table_t;
155
156 typedef struct RNode {
157 VALUE flags;
158 union {
159 struct RNode *node;
160 ID id;
161 VALUE value;
162 rb_ast_id_table_t *tbl;
163 } u1;
164 union {
165 struct RNode *node;
166 ID id;
167 long argc;
168 VALUE value;
169 } u2;
170 union {
171 struct RNode *node;
172 ID id;
173 long state;
174 struct rb_args_info *args;
175 struct rb_ary_pattern_info *apinfo;
176 struct rb_fnd_pattern_info *fpinfo;
177 VALUE value;
178 } u3;
179 rb_code_location_t nd_loc;
180 int node_id;
181} NODE;
182
183#define RNODE(obj) ((struct RNode *)(obj))
184
185/* FL : 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: FINALIZE, 8: UNUSED, 9: UNUSED, 10: EXIVAR, 11: FREEZE */
186/* NODE_FL: 0..4: T_TYPES, 5: KEEP_WB, 6: PROMOTED, 7: NODE_FL_NEWLINE,
187 * 8..14: nd_type,
188 * 15..: nd_line
189 */
190#define NODE_FL_NEWLINE (((VALUE)1)<<7)
191
192#define NODE_TYPESHIFT 8
193#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
194
195#define nd_type(n) ((int) (((n)->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
196#define nd_set_type(n,t) \
197 rb_node_set_type(n, t)
198#define nd_init_type(n,t) \
199 (n)->flags=(((n)->flags&~NODE_TYPEMASK)|((((unsigned long)(t))<<NODE_TYPESHIFT)&NODE_TYPEMASK))
200
201#define NODE_LSHIFT (NODE_TYPESHIFT+7)
202#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
203#define nd_line(n) (int)(((SIGNED_VALUE)(n)->flags)>>NODE_LSHIFT)
204#define nd_set_line(n,l) \
205 (n)->flags=(((n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))
206
207#define nd_first_column(n) ((int)((n)->nd_loc.beg_pos.column))
208#define nd_set_first_column(n, v) ((n)->nd_loc.beg_pos.column = (v))
209#define nd_first_lineno(n) ((int)((n)->nd_loc.beg_pos.lineno))
210#define nd_set_first_lineno(n, v) ((n)->nd_loc.beg_pos.lineno = (v))
211#define nd_first_loc(n) ((n)->nd_loc.beg_pos)
212#define nd_set_first_loc(n, v) (nd_first_loc(n) = (v))
213
214#define nd_last_column(n) ((int)((n)->nd_loc.end_pos.column))
215#define nd_set_last_column(n, v) ((n)->nd_loc.end_pos.column = (v))
216#define nd_last_lineno(n) ((int)((n)->nd_loc.end_pos.lineno))
217#define nd_set_last_lineno(n, v) ((n)->nd_loc.end_pos.lineno = (v))
218#define nd_last_loc(n) ((n)->nd_loc.end_pos)
219#define nd_set_last_loc(n, v) (nd_last_loc(n) = (v))
220#define nd_node_id(n) ((n)->node_id)
221#define nd_set_node_id(n,id) ((n)->node_id = (id))
222
223#define nd_head u1.node
224#define nd_alen u2.argc
225#define nd_next u3.node
226
227#define nd_cond u1.node
228#define nd_body u2.node
229#define nd_else u3.node
230
231#define nd_resq u2.node
232#define nd_ensr u3.node
233
234#define nd_1st u1.node
235#define nd_2nd u2.node
236
237#define nd_stts u1.node
238
239#define nd_entry u3.id
240#define nd_vid u1.id
241
242#define nd_var u1.node
243#define nd_iter u3.node
244
245#define nd_value u2.node
246#define nd_aid u3.id
247
248#define nd_lit u1.value
249
250#define nd_recv u1.node
251#define nd_mid u2.id
252#define nd_args u3.node
253#define nd_ainfo u3.args
254
255#define nd_defn u3.node
256
257#define nd_cpath u1.node
258#define nd_super u3.node
259
260#define nd_beg u1.node
261#define nd_end u2.node
262#define nd_state u3.state
263
264#define nd_nth u2.argc
265
266#define nd_alias u1.id
267#define nd_orig u2.id
268#define nd_undef u2.node
269
270#define nd_brace u2.argc
271
272#define nd_pconst u1.node
273#define nd_pkwargs u2.node
274#define nd_pkwrestarg u3.node
275
276#define nd_apinfo u3.apinfo
277
278#define nd_fpinfo u3.fpinfo
279
280// for NODE_SCOPE
281#define nd_tbl u1.tbl
282
283// for NODE_ARGS_AUX
284#define nd_pid u1.id
285#define nd_plen u2.argc
286#define nd_cflag u2.id
287
288// for ripper
289#define nd_cval u3.value
290#define nd_rval u2.value
291#define nd_tag u1.id
292
293#define NEW_NODE(t,a0,a1,a2,loc) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2),loc)
294#define NEW_NODE_WITH_LOCALS(t,a1,a2,loc) node_newnode_with_locals(p, (t),(VALUE)(a1),(VALUE)(a2),loc)
295
296#define NEW_DEFN(i,a,d,loc) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d,loc),loc)
297#define NEW_DEFS(r,i,a,d,loc) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d,loc),loc)
298#define NEW_SCOPE(a,b,loc) NEW_NODE_WITH_LOCALS(NODE_SCOPE,b,a,loc)
299#define NEW_BLOCK(a,loc) NEW_NODE(NODE_BLOCK,a,0,0,loc)
300#define NEW_IF(c,t,e,loc) NEW_NODE(NODE_IF,c,t,e,loc)
301#define NEW_UNLESS(c,t,e,loc) NEW_NODE(NODE_UNLESS,c,t,e,loc)
302#define NEW_CASE(h,b,loc) NEW_NODE(NODE_CASE,h,b,0,loc)
303#define NEW_CASE2(b,loc) NEW_NODE(NODE_CASE2,0,b,0,loc)
304#define NEW_CASE3(h,b,loc) NEW_NODE(NODE_CASE3,h,b,0,loc)
305#define NEW_WHEN(c,t,e,loc) NEW_NODE(NODE_WHEN,c,t,e,loc)
306#define NEW_IN(c,t,e,loc) NEW_NODE(NODE_IN,c,t,e,loc)
307#define NEW_WHILE(c,b,n,loc) NEW_NODE(NODE_WHILE,c,b,n,loc)
308#define NEW_UNTIL(c,b,n,loc) NEW_NODE(NODE_UNTIL,c,b,n,loc)
309#define NEW_FOR(i,b,loc) NEW_NODE(NODE_FOR,0,b,i,loc)
310#define NEW_FOR_MASGN(v,loc) NEW_NODE(NODE_FOR_MASGN,v,0,0,loc)
311#define NEW_ITER(a,b,loc) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b,loc),0,loc)
312#define NEW_LAMBDA(a,b,loc) NEW_NODE(NODE_LAMBDA,0,NEW_SCOPE(a,b,loc),0,loc)
313#define NEW_BREAK(s,loc) NEW_NODE(NODE_BREAK,s,0,0,loc)
314#define NEW_NEXT(s,loc) NEW_NODE(NODE_NEXT,s,0,0,loc)
315#define NEW_REDO(loc) NEW_NODE(NODE_REDO,0,0,0,loc)
316#define NEW_RETRY(loc) NEW_NODE(NODE_RETRY,0,0,0,loc)
317#define NEW_BEGIN(b,loc) NEW_NODE(NODE_BEGIN,0,b,0,loc)
318#define NEW_RESCUE(b,res,e,loc) NEW_NODE(NODE_RESCUE,b,res,e,loc)
319#define NEW_RESBODY(a,ex,n,loc) NEW_NODE(NODE_RESBODY,n,ex,a,loc)
320#define NEW_ENSURE(b,en,loc) NEW_NODE(NODE_ENSURE,b,0,en,loc)
321#define NEW_RETURN(s,loc) NEW_NODE(NODE_RETURN,s,0,0,loc)
322#define NEW_YIELD(a,loc) NEW_NODE(NODE_YIELD,a,0,0,loc)
323#define NEW_LIST(a,loc) NEW_NODE(NODE_LIST,a,1,0,loc)
324#define NEW_ZLIST(loc) NEW_NODE(NODE_ZLIST,0,0,0,loc)
325#define NEW_HASH(a,loc) NEW_NODE(NODE_HASH,a,0,0,loc)
326#define NEW_MASGN(l,r,loc) NEW_NODE(NODE_MASGN,l,0,r,loc)
327#define NEW_GASGN(v,val,loc) NEW_NODE(NODE_GASGN,v,val,v,loc)
328#define NEW_LASGN(v,val,loc) NEW_NODE(NODE_LASGN,v,val,0,loc)
329#define NEW_DASGN(v,val,loc) NEW_NODE(NODE_DASGN,v,val,0,loc)
330#define NEW_IASGN(v,val,loc) NEW_NODE(NODE_IASGN,v,val,0,loc)
331#define NEW_CDECL(v,val,path,loc) NEW_NODE(NODE_CDECL,v,val,path,loc)
332#define NEW_CVASGN(v,val,loc) NEW_NODE(NODE_CVASGN,v,val,0,loc)
333#define NEW_OP_ASGN1(p,id,a,loc) NEW_NODE(NODE_OP_ASGN1,p,id,a,loc)
334#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)
335#define NEW_OP_ASGN22(i,o,t,loc) NEW_NODE(NODE_OP_ASGN2,i,o,t,loc)
336#define NEW_OP_ASGN_OR(i,val,loc) NEW_NODE(NODE_OP_ASGN_OR,i,val,0,loc)
337#define NEW_OP_ASGN_AND(i,val,loc) NEW_NODE(NODE_OP_ASGN_AND,i,val,0,loc)
338#define NEW_OP_CDECL(v,op,val,loc) NEW_NODE(NODE_OP_CDECL,v,val,op,loc)
339#define NEW_GVAR(v,loc) NEW_NODE(NODE_GVAR,v,0,v,loc)
340#define NEW_LVAR(v,loc) NEW_NODE(NODE_LVAR,v,0,0,loc)
341#define NEW_DVAR(v,loc) NEW_NODE(NODE_DVAR,v,0,0,loc)
342#define NEW_IVAR(v,loc) NEW_NODE(NODE_IVAR,v,0,0,loc)
343#define NEW_CONST(v,loc) NEW_NODE(NODE_CONST,v,0,0,loc)
344#define NEW_CVAR(v,loc) NEW_NODE(NODE_CVAR,v,0,0,loc)
345#define NEW_NTH_REF(n,loc) NEW_NODE(NODE_NTH_REF,0,n,0,loc)
346#define NEW_BACK_REF(n,loc) NEW_NODE(NODE_BACK_REF,0,n,0,loc)
347#define NEW_MATCH(c,loc) NEW_NODE(NODE_MATCH,c,0,0,loc)
348#define NEW_MATCH2(n1,n2,loc) NEW_NODE(NODE_MATCH2,n1,n2,0,loc)
349#define NEW_MATCH3(r,n2,loc) NEW_NODE(NODE_MATCH3,r,n2,0,loc)
350#define NEW_LIT(l,loc) NEW_NODE(NODE_LIT,l,0,0,loc)
351#define NEW_STR(s,loc) NEW_NODE(NODE_STR,s,0,0,loc)
352#define NEW_DSTR(s,loc) NEW_NODE(NODE_DSTR,s,1,0,loc)
353#define NEW_XSTR(s,loc) NEW_NODE(NODE_XSTR,s,0,0,loc)
354#define NEW_DXSTR(s,loc) NEW_NODE(NODE_DXSTR,s,0,0,loc)
355#define NEW_DSYM(s,loc) NEW_NODE(NODE_DSYM,s,0,0,loc)
356#define NEW_EVSTR(n,loc) NEW_NODE(NODE_EVSTR,0,(n),0,loc)
357#define NEW_CALL(r,m,a,loc) NEW_NODE(NODE_CALL,r,m,a,loc)
358#define NEW_OPCALL(r,m,a,loc) NEW_NODE(NODE_OPCALL,r,m,a,loc)
359#define NEW_FCALL(m,a,loc) NEW_NODE(NODE_FCALL,0,m,a,loc)
360#define NEW_VCALL(m,loc) NEW_NODE(NODE_VCALL,0,m,0,loc)
361#define NEW_SUPER(a,loc) NEW_NODE(NODE_SUPER,0,0,a,loc)
362#define NEW_ZSUPER(loc) NEW_NODE(NODE_ZSUPER,0,0,0,loc)
363#define NEW_ARGS_AUX(r,b,loc) NEW_NODE(NODE_ARGS_AUX,r,b,0,loc)
364#define NEW_OPT_ARG(i,v,loc) NEW_NODE(NODE_OPT_ARG,i,v,0,loc)
365#define NEW_KW_ARG(i,v,loc) NEW_NODE(NODE_KW_ARG,i,v,0,loc)
366#define NEW_POSTARG(i,v,loc) NEW_NODE(NODE_POSTARG,i,v,0,loc)
367#define NEW_ARGSCAT(a,b,loc) NEW_NODE(NODE_ARGSCAT,a,b,0,loc)
368#define NEW_ARGSPUSH(a,b,loc) NEW_NODE(NODE_ARGSPUSH,a,b,0,loc)
369#define NEW_SPLAT(a,loc) NEW_NODE(NODE_SPLAT,a,0,0,loc)
370#define NEW_BLOCK_PASS(b,loc) NEW_NODE(NODE_BLOCK_PASS,0,b,0,loc)
371#define NEW_ALIAS(n,o,loc) NEW_NODE(NODE_ALIAS,n,o,0,loc)
372#define NEW_VALIAS(n,o,loc) NEW_NODE(NODE_VALIAS,n,o,0,loc)
373#define NEW_UNDEF(i,loc) NEW_NODE(NODE_UNDEF,0,i,0,loc)
374#define NEW_CLASS(n,b,s,loc) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b,loc),(s),loc)
375#define NEW_SCLASS(r,b,loc) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b,loc),0,loc)
376#define NEW_MODULE(n,b,loc) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b,loc),0,loc)
377#define NEW_COLON2(c,i,loc) NEW_NODE(NODE_COLON2,c,i,0,loc)
378#define NEW_COLON3(i,loc) NEW_NODE(NODE_COLON3,0,i,0,loc)
379#define NEW_DOT2(b,e,loc) NEW_NODE(NODE_DOT2,b,e,0,loc)
380#define NEW_DOT3(b,e,loc) NEW_NODE(NODE_DOT3,b,e,0,loc)
381#define NEW_SELF(loc) NEW_NODE(NODE_SELF,0,0,1,loc)
382#define NEW_NIL(loc) NEW_NODE(NODE_NIL,0,0,0,loc)
383#define NEW_TRUE(loc) NEW_NODE(NODE_TRUE,0,0,0,loc)
384#define NEW_FALSE(loc) NEW_NODE(NODE_FALSE,0,0,0,loc)
385#define NEW_ERRINFO(loc) NEW_NODE(NODE_ERRINFO,0,0,0,loc)
386#define NEW_DEFINED(e,loc) NEW_NODE(NODE_DEFINED,e,0,0,loc)
387#define NEW_POSTEXE(b,loc) NEW_NODE(NODE_POSTEXE,0,b,0,loc)
388#define NEW_ATTRASGN(r,m,a,loc) NEW_NODE(NODE_ATTRASGN,r,m,a,loc)
389#define NEW_ERROR(loc) NEW_NODE(NODE_ERROR,0,0,0,loc)
390
391#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
392#define NODE_REQUIRED_KEYWORD_P(node) ((node)->nd_value == NODE_SPECIAL_REQUIRED_KEYWORD)
393#define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
394#define NODE_NAMED_REST_P(node) ((node) != NODE_SPECIAL_NO_NAME_REST)
395#define NODE_SPECIAL_EXCESSIVE_COMMA ((ID)1)
396#define NODE_SPECIAL_NO_REST_KEYWORD ((NODE *)-1)
397
398 VALUE rb_node_case_when_optimizable_literal(const NODE *const node);
399
400RUBY_SYMBOL_EXPORT_BEGIN
401
402typedef struct node_buffer_struct node_buffer_t;
403/* T_IMEMO/ast */
404 typedef struct rb_ast_body_struct {
405 const NODE *root;
406 VALUE compile_option;
407 VALUE script_lines;
408 // script_lines is either:
409 // - a Fixnum that represents the line count of the original source, or
410 // - an Array that contains the lines of the original source
411} rb_ast_body_t;
412 typedef struct rb_ast_struct {
413 VALUE flags;
414 node_buffer_t *node_buffer;
415 rb_ast_body_t body;
416} rb_ast_t;
417 rb_ast_t *rb_ast_new(void);
418void rb_ast_mark(rb_ast_t*);
419void rb_ast_update_references(rb_ast_t*);
420void rb_ast_dispose(rb_ast_t*);
421void rb_ast_free(rb_ast_t*);
422size_t rb_ast_memsize(const rb_ast_t*);
423void rb_ast_add_mark_object(rb_ast_t*, VALUE);
424void rb_ast_set_tokens(rb_ast_t*, VALUE);
425 VALUE rb_ast_tokens(rb_ast_t *ast);
426 NODE *rb_ast_newnode(rb_ast_t*, enum node_type type);
427void rb_ast_delete_node(rb_ast_t*, NODE *n);
428 rb_ast_id_table_t *rb_ast_new_local_table(rb_ast_t*, int);
429 rb_ast_id_table_t *rb_ast_resize_latest_local_table(rb_ast_t*, int);
430
431 VALUE rb_parser_new(void);
432 VALUE rb_parser_end_seen_p(VALUE);
433 VALUE rb_parser_encoding(VALUE);
434 VALUE rb_parser_set_yydebug(VALUE, VALUE);
435 VALUE rb_parser_dump_tree(const NODE *node, int comment);
436void rb_parser_set_options(VALUE, int, int, int, int);
437
438 rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
439 rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
440 rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
441 rb_ast_t *rb_parser_compile_generic(VALUE vparser, VALUE (*lex_gets)(VALUE, int), VALUE fname, VALUE input, int line);
442
443void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2);
444const char *ruby_node_name(int node);
445
446const struct kwtable *rb_reserved_word(const char *, unsigned int);
447
448 struct rb_args_info {
449 NODE *pre_init;
450 NODE *post_init;
451
452 int pre_args_num; /* count of mandatory pre-arguments */
453 int post_args_num; /* count of mandatory post-arguments */
454
455 ID first_post_arg;
456
457 ID rest_arg;
458 ID block_arg;
459
460 NODE *kw_args;
461 NODE *kw_rest_arg;
462
463 NODE *opt_args;
464 unsigned int no_kwarg: 1;
465 unsigned int ruby2_keywords: 1;
466 unsigned int forwarding: 1;
467
468 VALUE imemo;
469};
470
471 struct rb_ary_pattern_info {
472 NODE *pre_args;
473 NODE *rest_arg;
474 NODE *post_args;
475};
476
477 struct rb_fnd_pattern_info {
478 NODE *pre_rest_arg;
479 NODE *args;
480 NODE *post_rest_arg;
481};
482
483struct parser_params;
484void *rb_parser_malloc(struct parser_params *, size_t);
485void *rb_parser_realloc(struct parser_params *, void *, size_t);
486void *rb_parser_calloc(struct parser_params *, size_t, size_t);
487void rb_parser_free(struct parser_params *, void *);
488PRINTF_ARGS(void rb_parser_printf(struct parser_params *parser, const char *fmt, ...), 2, 3);
489void rb_ast_node_type_change(NODE *n, enum node_type type);
490
491RUBY_SYMBOL_EXPORT_END
492
493static inline VALUE
494rb_node_set_type(NODE *n, enum node_type t)
495{
496#if RUBY_DEBUG
497 rb_ast_node_type_change(n, t);
498#endif
499 return nd_init_type(n, t);
500}
501
502static inline bool
503nd_type_p(const NODE *n, enum node_type t)
504{
505 return (enum node_type)nd_type(n) == t;
506}
507#if defined(__cplusplus)
508#if 0
509{ /* satisfy cc-mode */
510#endif
511} /* extern "C" { */
512#endif
513
514#endif /* RUBY_NODE_H */
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition cxxanyargs.hpp:56
RNode
Definition node.h:156
kwtable
Definition lex.c:34
node_buffer_struct
Definition node.c:1159
parser_params
Definition parse.c:335
rb_args_info
Definition node.h:448
rb_ary_pattern_info
Definition node.h:471
rb_ast_body_struct
Definition node.h:404
rb_ast_id_table
Definition node.h:151
rb_ast_struct
Definition node.h:412
rb_code_location_struct
Definition node.h:137
rb_code_position_struct
Definition node.h:132
rb_fnd_pattern_info
Definition node.h:477
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40