Ruby 4.1.0dev (2026-10-29 revision 64ae80dd36092e73448324ac235e3100597c1e51)
node.c
1/*----------------------------------------------------------------------------*/
2/* This file is generated by the templates/template.rb script and should not */
3/* be modified manually. See */
4/* templates/src/node.c.erb */
5/* if you are looking to modify the */
6/* template */
7/*----------------------------------------------------------------------------*/
8
9#line 2 "prism/templates/src/node.c.erb"
10#include "prism/internal/node.h"
11
12#include "prism/internal/arena.h"
13
14#include <stdlib.h>
15
22static void
23pm_node_list_grow(pm_arena_t *arena, pm_node_list_t *list, size_t size) {
24 size_t requested_size = list->size + size;
25
26 // Guard against overflow on the addition.
27 if (requested_size < list->size) abort();
28
29 // If the requested size is within the existing capacity, return.
30 if (requested_size <= list->capacity) return;
31
32 // Otherwise, compute the next capacity by doubling.
33 size_t next_capacity = list->capacity == 0 ? 4 : list->capacity * 2;
34
35 // Guard against overflow on the doubling.
36 while (requested_size > next_capacity) {
37 if (next_capacity == 0) abort();
38 next_capacity *= 2;
39 }
40
41 // Allocate a new array from the arena (old array is abandoned).
42 pm_node_t **nodes = (pm_node_t **) pm_arena_alloc(arena, sizeof(pm_node_t *) * next_capacity, PRISM_ALIGNOF(pm_node_t *));
43
44 // Copy old data into the new array.
45 if (list->size > 0) {
46 memcpy(nodes, list->nodes, list->size * sizeof(pm_node_t *));
47 }
48
49 list->nodes = nodes;
50 list->capacity = next_capacity;
51}
52
57void
58pm_node_list_append_slow(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
59 pm_node_list_grow(arena, list, 1);
60 list->nodes[list->size++] = node;
61}
62
66void
67pm_node_list_append(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
68 pm_node_list_append_inline(arena, list, node);
69}
70
74void
75pm_node_list_prepend(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
76 pm_node_list_grow(arena, list, 1);
77 memmove(list->nodes + 1, list->nodes, list->size * sizeof(pm_node_t *));
78 list->nodes[0] = node;
79 list->size++;
80}
81
85void
86pm_node_list_concat(pm_arena_t *arena, pm_node_list_t *list, pm_node_list_t *other) {
87 if (other->size > 0) {
88 pm_node_list_grow(arena, list, other->size);
89 memcpy(list->nodes + list->size, other->nodes, other->size * sizeof(pm_node_t *));
90 list->size += other->size;
91 }
92}
93
97const char *
98pm_node_type(pm_node_type_t node_type)
99{
100 switch (node_type) {
101 case PM_ALIAS_GLOBAL_VARIABLE_NODE:
102 return "PM_ALIAS_GLOBAL_VARIABLE_NODE";
103 case PM_ALIAS_METHOD_NODE:
104 return "PM_ALIAS_METHOD_NODE";
105 case PM_ALTERNATION_PATTERN_NODE:
106 return "PM_ALTERNATION_PATTERN_NODE";
107 case PM_AND_NODE:
108 return "PM_AND_NODE";
109 case PM_ARGUMENTS_NODE:
110 return "PM_ARGUMENTS_NODE";
111 case PM_ARRAY_NODE:
112 return "PM_ARRAY_NODE";
113 case PM_ARRAY_PATTERN_NODE:
114 return "PM_ARRAY_PATTERN_NODE";
115 case PM_ASSOC_NODE:
116 return "PM_ASSOC_NODE";
117 case PM_ASSOC_SPLAT_NODE:
118 return "PM_ASSOC_SPLAT_NODE";
119 case PM_BACK_REFERENCE_READ_NODE:
120 return "PM_BACK_REFERENCE_READ_NODE";
121 case PM_BEGIN_NODE:
122 return "PM_BEGIN_NODE";
123 case PM_BLOCK_ARGUMENT_NODE:
124 return "PM_BLOCK_ARGUMENT_NODE";
125 case PM_BLOCK_LOCAL_VARIABLE_NODE:
126 return "PM_BLOCK_LOCAL_VARIABLE_NODE";
127 case PM_BLOCK_NODE:
128 return "PM_BLOCK_NODE";
129 case PM_BLOCK_PARAMETER_NODE:
130 return "PM_BLOCK_PARAMETER_NODE";
131 case PM_BLOCK_PARAMETERS_NODE:
132 return "PM_BLOCK_PARAMETERS_NODE";
133 case PM_BREAK_NODE:
134 return "PM_BREAK_NODE";
135 case PM_CALL_AND_WRITE_NODE:
136 return "PM_CALL_AND_WRITE_NODE";
137 case PM_CALL_NODE:
138 return "PM_CALL_NODE";
139 case PM_CALL_OPERATOR_WRITE_NODE:
140 return "PM_CALL_OPERATOR_WRITE_NODE";
141 case PM_CALL_OR_WRITE_NODE:
142 return "PM_CALL_OR_WRITE_NODE";
143 case PM_CALL_TARGET_NODE:
144 return "PM_CALL_TARGET_NODE";
145 case PM_CAPTURE_PATTERN_NODE:
146 return "PM_CAPTURE_PATTERN_NODE";
147 case PM_CASE_MATCH_NODE:
148 return "PM_CASE_MATCH_NODE";
149 case PM_CASE_NODE:
150 return "PM_CASE_NODE";
151 case PM_CLASS_NODE:
152 return "PM_CLASS_NODE";
153 case PM_CLASS_VARIABLE_AND_WRITE_NODE:
154 return "PM_CLASS_VARIABLE_AND_WRITE_NODE";
155 case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE:
156 return "PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE";
157 case PM_CLASS_VARIABLE_OR_WRITE_NODE:
158 return "PM_CLASS_VARIABLE_OR_WRITE_NODE";
159 case PM_CLASS_VARIABLE_READ_NODE:
160 return "PM_CLASS_VARIABLE_READ_NODE";
161 case PM_CLASS_VARIABLE_TARGET_NODE:
162 return "PM_CLASS_VARIABLE_TARGET_NODE";
163 case PM_CLASS_VARIABLE_WRITE_NODE:
164 return "PM_CLASS_VARIABLE_WRITE_NODE";
165 case PM_CONSTANT_AND_WRITE_NODE:
166 return "PM_CONSTANT_AND_WRITE_NODE";
167 case PM_CONSTANT_OPERATOR_WRITE_NODE:
168 return "PM_CONSTANT_OPERATOR_WRITE_NODE";
169 case PM_CONSTANT_OR_WRITE_NODE:
170 return "PM_CONSTANT_OR_WRITE_NODE";
171 case PM_CONSTANT_PATH_AND_WRITE_NODE:
172 return "PM_CONSTANT_PATH_AND_WRITE_NODE";
173 case PM_CONSTANT_PATH_NODE:
174 return "PM_CONSTANT_PATH_NODE";
175 case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE:
176 return "PM_CONSTANT_PATH_OPERATOR_WRITE_NODE";
177 case PM_CONSTANT_PATH_OR_WRITE_NODE:
178 return "PM_CONSTANT_PATH_OR_WRITE_NODE";
179 case PM_CONSTANT_PATH_TARGET_NODE:
180 return "PM_CONSTANT_PATH_TARGET_NODE";
181 case PM_CONSTANT_PATH_WRITE_NODE:
182 return "PM_CONSTANT_PATH_WRITE_NODE";
183 case PM_CONSTANT_READ_NODE:
184 return "PM_CONSTANT_READ_NODE";
185 case PM_CONSTANT_TARGET_NODE:
186 return "PM_CONSTANT_TARGET_NODE";
187 case PM_CONSTANT_WRITE_NODE:
188 return "PM_CONSTANT_WRITE_NODE";
189 case PM_DEF_NODE:
190 return "PM_DEF_NODE";
191 case PM_DEFINED_NODE:
192 return "PM_DEFINED_NODE";
193 case PM_ELSE_NODE:
194 return "PM_ELSE_NODE";
195 case PM_EMBEDDED_STATEMENTS_NODE:
196 return "PM_EMBEDDED_STATEMENTS_NODE";
197 case PM_EMBEDDED_VARIABLE_NODE:
198 return "PM_EMBEDDED_VARIABLE_NODE";
199 case PM_ENSURE_NODE:
200 return "PM_ENSURE_NODE";
201 case PM_ERROR_RECOVERY_NODE:
202 return "PM_ERROR_RECOVERY_NODE";
203 case PM_FALSE_NODE:
204 return "PM_FALSE_NODE";
205 case PM_FIND_PATTERN_NODE:
206 return "PM_FIND_PATTERN_NODE";
207 case PM_FLIP_FLOP_NODE:
208 return "PM_FLIP_FLOP_NODE";
209 case PM_FLOAT_NODE:
210 return "PM_FLOAT_NODE";
211 case PM_FOR_NODE:
212 return "PM_FOR_NODE";
213 case PM_FORWARDING_ARGUMENTS_NODE:
214 return "PM_FORWARDING_ARGUMENTS_NODE";
215 case PM_FORWARDING_PARAMETER_NODE:
216 return "PM_FORWARDING_PARAMETER_NODE";
217 case PM_FORWARDING_SUPER_NODE:
218 return "PM_FORWARDING_SUPER_NODE";
219 case PM_GLOBAL_VARIABLE_AND_WRITE_NODE:
220 return "PM_GLOBAL_VARIABLE_AND_WRITE_NODE";
221 case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE:
222 return "PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE";
223 case PM_GLOBAL_VARIABLE_OR_WRITE_NODE:
224 return "PM_GLOBAL_VARIABLE_OR_WRITE_NODE";
225 case PM_GLOBAL_VARIABLE_READ_NODE:
226 return "PM_GLOBAL_VARIABLE_READ_NODE";
227 case PM_GLOBAL_VARIABLE_TARGET_NODE:
228 return "PM_GLOBAL_VARIABLE_TARGET_NODE";
229 case PM_GLOBAL_VARIABLE_WRITE_NODE:
230 return "PM_GLOBAL_VARIABLE_WRITE_NODE";
231 case PM_HASH_NODE:
232 return "PM_HASH_NODE";
233 case PM_HASH_PATTERN_NODE:
234 return "PM_HASH_PATTERN_NODE";
235 case PM_IF_NODE:
236 return "PM_IF_NODE";
237 case PM_IMAGINARY_NODE:
238 return "PM_IMAGINARY_NODE";
239 case PM_IMPLICIT_NODE:
240 return "PM_IMPLICIT_NODE";
241 case PM_IMPLICIT_REST_NODE:
242 return "PM_IMPLICIT_REST_NODE";
243 case PM_IN_NODE:
244 return "PM_IN_NODE";
245 case PM_INDEX_AND_WRITE_NODE:
246 return "PM_INDEX_AND_WRITE_NODE";
247 case PM_INDEX_OPERATOR_WRITE_NODE:
248 return "PM_INDEX_OPERATOR_WRITE_NODE";
249 case PM_INDEX_OR_WRITE_NODE:
250 return "PM_INDEX_OR_WRITE_NODE";
251 case PM_INDEX_TARGET_NODE:
252 return "PM_INDEX_TARGET_NODE";
253 case PM_INSTANCE_VARIABLE_AND_WRITE_NODE:
254 return "PM_INSTANCE_VARIABLE_AND_WRITE_NODE";
255 case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE:
256 return "PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE";
257 case PM_INSTANCE_VARIABLE_OR_WRITE_NODE:
258 return "PM_INSTANCE_VARIABLE_OR_WRITE_NODE";
259 case PM_INSTANCE_VARIABLE_READ_NODE:
260 return "PM_INSTANCE_VARIABLE_READ_NODE";
261 case PM_INSTANCE_VARIABLE_TARGET_NODE:
262 return "PM_INSTANCE_VARIABLE_TARGET_NODE";
263 case PM_INSTANCE_VARIABLE_WRITE_NODE:
264 return "PM_INSTANCE_VARIABLE_WRITE_NODE";
265 case PM_INTEGER_NODE:
266 return "PM_INTEGER_NODE";
267 case PM_INTERPOLATED_MATCH_LAST_LINE_NODE:
268 return "PM_INTERPOLATED_MATCH_LAST_LINE_NODE";
269 case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
270 return "PM_INTERPOLATED_REGULAR_EXPRESSION_NODE";
271 case PM_INTERPOLATED_STRING_NODE:
272 return "PM_INTERPOLATED_STRING_NODE";
273 case PM_INTERPOLATED_SYMBOL_NODE:
274 return "PM_INTERPOLATED_SYMBOL_NODE";
275 case PM_INTERPOLATED_X_STRING_NODE:
276 return "PM_INTERPOLATED_X_STRING_NODE";
277 case PM_IT_LOCAL_VARIABLE_READ_NODE:
278 return "PM_IT_LOCAL_VARIABLE_READ_NODE";
279 case PM_IT_PARAMETERS_NODE:
280 return "PM_IT_PARAMETERS_NODE";
281 case PM_KEYWORD_HASH_NODE:
282 return "PM_KEYWORD_HASH_NODE";
283 case PM_KEYWORD_REST_PARAMETER_NODE:
284 return "PM_KEYWORD_REST_PARAMETER_NODE";
285 case PM_LAMBDA_NODE:
286 return "PM_LAMBDA_NODE";
287 case PM_LOCAL_VARIABLE_AND_WRITE_NODE:
288 return "PM_LOCAL_VARIABLE_AND_WRITE_NODE";
289 case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE:
290 return "PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE";
291 case PM_LOCAL_VARIABLE_OR_WRITE_NODE:
292 return "PM_LOCAL_VARIABLE_OR_WRITE_NODE";
293 case PM_LOCAL_VARIABLE_READ_NODE:
294 return "PM_LOCAL_VARIABLE_READ_NODE";
295 case PM_LOCAL_VARIABLE_TARGET_NODE:
296 return "PM_LOCAL_VARIABLE_TARGET_NODE";
297 case PM_LOCAL_VARIABLE_WRITE_NODE:
298 return "PM_LOCAL_VARIABLE_WRITE_NODE";
299 case PM_MATCH_LAST_LINE_NODE:
300 return "PM_MATCH_LAST_LINE_NODE";
301 case PM_MATCH_PREDICATE_NODE:
302 return "PM_MATCH_PREDICATE_NODE";
303 case PM_MATCH_REQUIRED_NODE:
304 return "PM_MATCH_REQUIRED_NODE";
305 case PM_MATCH_WRITE_NODE:
306 return "PM_MATCH_WRITE_NODE";
307 case PM_MODULE_NODE:
308 return "PM_MODULE_NODE";
309 case PM_MULTI_TARGET_NODE:
310 return "PM_MULTI_TARGET_NODE";
311 case PM_MULTI_WRITE_NODE:
312 return "PM_MULTI_WRITE_NODE";
313 case PM_NEXT_NODE:
314 return "PM_NEXT_NODE";
315 case PM_NIL_NODE:
316 return "PM_NIL_NODE";
317 case PM_NO_BLOCK_PARAMETER_NODE:
318 return "PM_NO_BLOCK_PARAMETER_NODE";
319 case PM_NO_KEYWORDS_PARAMETER_NODE:
320 return "PM_NO_KEYWORDS_PARAMETER_NODE";
321 case PM_NUMBERED_PARAMETERS_NODE:
322 return "PM_NUMBERED_PARAMETERS_NODE";
323 case PM_NUMBERED_REFERENCE_READ_NODE:
324 return "PM_NUMBERED_REFERENCE_READ_NODE";
325 case PM_OPTIONAL_KEYWORD_PARAMETER_NODE:
326 return "PM_OPTIONAL_KEYWORD_PARAMETER_NODE";
327 case PM_OPTIONAL_PARAMETER_NODE:
328 return "PM_OPTIONAL_PARAMETER_NODE";
329 case PM_OR_NODE:
330 return "PM_OR_NODE";
331 case PM_PARAMETERS_NODE:
332 return "PM_PARAMETERS_NODE";
333 case PM_PARENTHESES_NODE:
334 return "PM_PARENTHESES_NODE";
335 case PM_PINNED_EXPRESSION_NODE:
336 return "PM_PINNED_EXPRESSION_NODE";
337 case PM_PINNED_VARIABLE_NODE:
338 return "PM_PINNED_VARIABLE_NODE";
339 case PM_POST_EXECUTION_NODE:
340 return "PM_POST_EXECUTION_NODE";
341 case PM_PRE_EXECUTION_NODE:
342 return "PM_PRE_EXECUTION_NODE";
343 case PM_PROGRAM_NODE:
344 return "PM_PROGRAM_NODE";
345 case PM_RANGE_NODE:
346 return "PM_RANGE_NODE";
347 case PM_RATIONAL_NODE:
348 return "PM_RATIONAL_NODE";
349 case PM_REDO_NODE:
350 return "PM_REDO_NODE";
351 case PM_REGULAR_EXPRESSION_NODE:
352 return "PM_REGULAR_EXPRESSION_NODE";
353 case PM_REQUIRED_KEYWORD_PARAMETER_NODE:
354 return "PM_REQUIRED_KEYWORD_PARAMETER_NODE";
355 case PM_REQUIRED_PARAMETER_NODE:
356 return "PM_REQUIRED_PARAMETER_NODE";
357 case PM_RESCUE_MODIFIER_NODE:
358 return "PM_RESCUE_MODIFIER_NODE";
359 case PM_RESCUE_NODE:
360 return "PM_RESCUE_NODE";
361 case PM_REST_PARAMETER_NODE:
362 return "PM_REST_PARAMETER_NODE";
363 case PM_RETRY_NODE:
364 return "PM_RETRY_NODE";
365 case PM_RETURN_NODE:
366 return "PM_RETURN_NODE";
367 case PM_SELF_NODE:
368 return "PM_SELF_NODE";
369 case PM_SHAREABLE_CONSTANT_NODE:
370 return "PM_SHAREABLE_CONSTANT_NODE";
371 case PM_SINGLETON_CLASS_NODE:
372 return "PM_SINGLETON_CLASS_NODE";
373 case PM_SOURCE_ENCODING_NODE:
374 return "PM_SOURCE_ENCODING_NODE";
375 case PM_SOURCE_FILE_NODE:
376 return "PM_SOURCE_FILE_NODE";
377 case PM_SOURCE_LINE_NODE:
378 return "PM_SOURCE_LINE_NODE";
379 case PM_SPLAT_NODE:
380 return "PM_SPLAT_NODE";
381 case PM_STATEMENTS_NODE:
382 return "PM_STATEMENTS_NODE";
383 case PM_STRING_NODE:
384 return "PM_STRING_NODE";
385 case PM_SUPER_NODE:
386 return "PM_SUPER_NODE";
387 case PM_SYMBOL_NODE:
388 return "PM_SYMBOL_NODE";
389 case PM_TRUE_NODE:
390 return "PM_TRUE_NODE";
391 case PM_UNDEF_NODE:
392 return "PM_UNDEF_NODE";
393 case PM_UNLESS_NODE:
394 return "PM_UNLESS_NODE";
395 case PM_UNTIL_NODE:
396 return "PM_UNTIL_NODE";
397 case PM_WHEN_NODE:
398 return "PM_WHEN_NODE";
399 case PM_WHILE_NODE:
400 return "PM_WHILE_NODE";
401 case PM_X_STRING_NODE:
402 return "PM_X_STRING_NODE";
403 case PM_YIELD_NODE:
404 return "PM_YIELD_NODE";
405 }
406 return "";
407}
408
416bool
417pm_visit_node(const pm_node_t *node, pm_visit_callback_t visitor, void *data) {
418 pm_visit_result_t result = visitor(node, data);
419 if (result == PM_VISIT_DESCEND) return pm_visit_child_nodes(node, visitor, data);
420 return result != PM_VISIT_STOP;
421}
422
429bool
430pm_visit_child_nodes(const pm_node_t *node, pm_visit_callback_t visitor, void *data) {
431 switch (PM_NODE_TYPE(node)) {
432 case PM_ALIAS_GLOBAL_VARIABLE_NODE: {
434
435 // Visit the new_name field
436 if (!pm_visit_node((const pm_node_t *) cast->new_name, visitor, data)) return false;
437
438 // Visit the old_name field
439 if (!pm_visit_node((const pm_node_t *) cast->old_name, visitor, data)) return false;
440
441 break;
442 }
443 case PM_ALIAS_METHOD_NODE: {
444 const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node;
445
446 // Visit the new_name field
447 if (!pm_visit_node((const pm_node_t *) cast->new_name, visitor, data)) return false;
448
449 // Visit the old_name field
450 if (!pm_visit_node((const pm_node_t *) cast->old_name, visitor, data)) return false;
451
452 break;
453 }
454 case PM_ALTERNATION_PATTERN_NODE: {
456
457 // Visit the left field
458 if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
459
460 // Visit the right field
461 if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
462
463 break;
464 }
465 case PM_AND_NODE: {
466 const pm_and_node_t *cast = (const pm_and_node_t *) node;
467
468 // Visit the left field
469 if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
470
471 // Visit the right field
472 if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
473
474 break;
475 }
476 case PM_ARGUMENTS_NODE: {
477 const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node;
478
479 // Visit the arguments field
480 const pm_node_list_t *arguments = &cast->arguments;
481 for (size_t index = 0; index < arguments->size; index++) {
482 if (!pm_visit_node(arguments->nodes[index], visitor, data)) return false;
483 }
484
485 break;
486 }
487 case PM_ARRAY_NODE: {
488 const pm_array_node_t *cast = (const pm_array_node_t *) node;
489
490 // Visit the elements field
491 const pm_node_list_t *elements = &cast->elements;
492 for (size_t index = 0; index < elements->size; index++) {
493 if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
494 }
495
496 break;
497 }
498 case PM_ARRAY_PATTERN_NODE: {
499 const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node;
500
501 // Visit the constant field
502 if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)) return false;
503
504 // Visit the requireds field
505 const pm_node_list_t *requireds = &cast->requireds;
506 for (size_t index = 0; index < requireds->size; index++) {
507 if (!pm_visit_node(requireds->nodes[index], visitor, data)) return false;
508 }
509
510 // Visit the rest field
511 if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
512
513 // Visit the posts field
514 const pm_node_list_t *posts = &cast->posts;
515 for (size_t index = 0; index < posts->size; index++) {
516 if (!pm_visit_node(posts->nodes[index], visitor, data)) return false;
517 }
518
519 break;
520 }
521 case PM_ASSOC_NODE: {
522 const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node;
523
524 // Visit the key field
525 if (!pm_visit_node((const pm_node_t *) cast->key, visitor, data)) return false;
526
527 // Visit the value field
528 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
529
530 break;
531 }
532 case PM_ASSOC_SPLAT_NODE: {
533 const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node;
534
535 // Visit the value field
536 if (cast->value != NULL && !pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
537
538 break;
539 }
540 case PM_BACK_REFERENCE_READ_NODE:
541 break;
542 case PM_BEGIN_NODE: {
543 const pm_begin_node_t *cast = (const pm_begin_node_t *) node;
544
545 // Visit the statements field
546 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
547
548 // Visit the rescue_clause field
549 if (cast->rescue_clause != NULL && !pm_visit_node((const pm_node_t *) cast->rescue_clause, visitor, data)) return false;
550
551 // Visit the else_clause field
552 if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
553
554 // Visit the ensure_clause field
555 if (cast->ensure_clause != NULL && !pm_visit_node((const pm_node_t *) cast->ensure_clause, visitor, data)) return false;
556
557 break;
558 }
559 case PM_BLOCK_ARGUMENT_NODE: {
560 const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node;
561
562 // Visit the expression field
563 if (cast->expression != NULL && !pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
564
565 break;
566 }
567 case PM_BLOCK_LOCAL_VARIABLE_NODE:
568 break;
569 case PM_BLOCK_NODE: {
570 const pm_block_node_t *cast = (const pm_block_node_t *) node;
571
572 // Visit the parameters field
573 if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
574
575 // Visit the body field
576 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
577
578 break;
579 }
580 case PM_BLOCK_PARAMETER_NODE:
581 break;
582 case PM_BLOCK_PARAMETERS_NODE: {
583 const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node;
584
585 // Visit the parameters field
586 if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
587
588 // Visit the locals field
589 const pm_node_list_t *locals = &cast->locals;
590 for (size_t index = 0; index < locals->size; index++) {
591 if (!pm_visit_node(locals->nodes[index], visitor, data)) return false;
592 }
593
594 break;
595 }
596 case PM_BREAK_NODE: {
597 const pm_break_node_t *cast = (const pm_break_node_t *) node;
598
599 // Visit the arguments field
600 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
601
602 break;
603 }
604 case PM_CALL_AND_WRITE_NODE: {
605 const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node;
606
607 // Visit the receiver field
608 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
609
610 // Visit the value field
611 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
612
613 break;
614 }
615 case PM_CALL_NODE: {
616 const pm_call_node_t *cast = (const pm_call_node_t *) node;
617
618 // Visit the receiver field
619 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
620
621 // Visit the arguments field
622 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
623
624 // Visit the block field
625 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
626
627 break;
628 }
629 case PM_CALL_OPERATOR_WRITE_NODE: {
631
632 // Visit the receiver field
633 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
634
635 // Visit the value field
636 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
637
638 break;
639 }
640 case PM_CALL_OR_WRITE_NODE: {
641 const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node;
642
643 // Visit the receiver field
644 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
645
646 // Visit the value field
647 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
648
649 break;
650 }
651 case PM_CALL_TARGET_NODE: {
652 const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node;
653
654 // Visit the receiver field
655 if (!pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
656
657 break;
658 }
659 case PM_CAPTURE_PATTERN_NODE: {
660 const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node;
661
662 // Visit the value field
663 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
664
665 // Visit the target field
666 if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
667
668 break;
669 }
670 case PM_CASE_MATCH_NODE: {
671 const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node;
672
673 // Visit the predicate field
674 if (cast->predicate != NULL && !pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
675
676 // Visit the conditions field
677 const pm_node_list_t *conditions = &cast->conditions;
678 for (size_t index = 0; index < conditions->size; index++) {
679 if (!pm_visit_node(conditions->nodes[index], visitor, data)) return false;
680 }
681
682 // Visit the else_clause field
683 if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
684
685 break;
686 }
687 case PM_CASE_NODE: {
688 const pm_case_node_t *cast = (const pm_case_node_t *) node;
689
690 // Visit the predicate field
691 if (cast->predicate != NULL && !pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
692
693 // Visit the conditions field
694 const pm_node_list_t *conditions = &cast->conditions;
695 for (size_t index = 0; index < conditions->size; index++) {
696 if (!pm_visit_node(conditions->nodes[index], visitor, data)) return false;
697 }
698
699 // Visit the else_clause field
700 if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
701
702 break;
703 }
704 case PM_CLASS_NODE: {
705 const pm_class_node_t *cast = (const pm_class_node_t *) node;
706
707 // Visit the constant_path field
708 if (!pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data)) return false;
709
710 // Visit the superclass field
711 if (cast->superclass != NULL && !pm_visit_node((const pm_node_t *) cast->superclass, visitor, data)) return false;
712
713 // Visit the body field
714 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
715
716 break;
717 }
718 case PM_CLASS_VARIABLE_AND_WRITE_NODE: {
720
721 // Visit the value field
722 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
723
724 break;
725 }
726 case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
728
729 // Visit the value field
730 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
731
732 break;
733 }
734 case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
736
737 // Visit the value field
738 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
739
740 break;
741 }
742 case PM_CLASS_VARIABLE_READ_NODE:
743 break;
744 case PM_CLASS_VARIABLE_TARGET_NODE:
745 break;
746 case PM_CLASS_VARIABLE_WRITE_NODE: {
748
749 // Visit the value field
750 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
751
752 break;
753 }
754 case PM_CONSTANT_AND_WRITE_NODE: {
756
757 // Visit the value field
758 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
759
760 break;
761 }
762 case PM_CONSTANT_OPERATOR_WRITE_NODE: {
764
765 // Visit the value field
766 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
767
768 break;
769 }
770 case PM_CONSTANT_OR_WRITE_NODE: {
771 const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node;
772
773 // Visit the value field
774 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
775
776 break;
777 }
778 case PM_CONSTANT_PATH_AND_WRITE_NODE: {
780
781 // Visit the target field
782 if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
783
784 // Visit the value field
785 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
786
787 break;
788 }
789 case PM_CONSTANT_PATH_NODE: {
790 const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node;
791
792 // Visit the parent field
793 if (cast->parent != NULL && !pm_visit_node((const pm_node_t *) cast->parent, visitor, data)) return false;
794
795 break;
796 }
797 case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
799
800 // Visit the target field
801 if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
802
803 // Visit the value field
804 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
805
806 break;
807 }
808 case PM_CONSTANT_PATH_OR_WRITE_NODE: {
810
811 // Visit the target field
812 if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
813
814 // Visit the value field
815 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
816
817 break;
818 }
819 case PM_CONSTANT_PATH_TARGET_NODE: {
821
822 // Visit the parent field
823 if (cast->parent != NULL && !pm_visit_node((const pm_node_t *) cast->parent, visitor, data)) return false;
824
825 break;
826 }
827 case PM_CONSTANT_PATH_WRITE_NODE: {
829
830 // Visit the target field
831 if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
832
833 // Visit the value field
834 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
835
836 break;
837 }
838 case PM_CONSTANT_READ_NODE:
839 break;
840 case PM_CONSTANT_TARGET_NODE:
841 break;
842 case PM_CONSTANT_WRITE_NODE: {
843 const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node;
844
845 // Visit the value field
846 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
847
848 break;
849 }
850 case PM_DEF_NODE: {
851 const pm_def_node_t *cast = (const pm_def_node_t *) node;
852
853 // Visit the receiver field
854 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
855
856 // Visit the parameters field
857 if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
858
859 // Visit the body field
860 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
861
862 break;
863 }
864 case PM_DEFINED_NODE: {
865 const pm_defined_node_t *cast = (const pm_defined_node_t *) node;
866
867 // Visit the value field
868 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
869
870 break;
871 }
872 case PM_ELSE_NODE: {
873 const pm_else_node_t *cast = (const pm_else_node_t *) node;
874
875 // Visit the statements field
876 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
877
878 break;
879 }
880 case PM_EMBEDDED_STATEMENTS_NODE: {
882
883 // Visit the statements field
884 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
885
886 break;
887 }
888 case PM_EMBEDDED_VARIABLE_NODE: {
889 const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node;
890
891 // Visit the variable field
892 if (!pm_visit_node((const pm_node_t *) cast->variable, visitor, data)) return false;
893
894 break;
895 }
896 case PM_ENSURE_NODE: {
897 const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
898
899 // Visit the statements field
900 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
901
902 break;
903 }
904 case PM_ERROR_RECOVERY_NODE: {
905 const pm_error_recovery_node_t *cast = (const pm_error_recovery_node_t *) node;
906
907 // Visit the unexpected field
908 if (cast->unexpected != NULL && !pm_visit_node((const pm_node_t *) cast->unexpected, visitor, data)) return false;
909
910 break;
911 }
912 case PM_FALSE_NODE:
913 break;
914 case PM_FIND_PATTERN_NODE: {
915 const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node;
916
917 // Visit the constant field
918 if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)) return false;
919
920 // Visit the left field
921 if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
922
923 // Visit the requireds field
924 const pm_node_list_t *requireds = &cast->requireds;
925 for (size_t index = 0; index < requireds->size; index++) {
926 if (!pm_visit_node(requireds->nodes[index], visitor, data)) return false;
927 }
928
929 // Visit the right field
930 if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
931
932 break;
933 }
934 case PM_FLIP_FLOP_NODE: {
935 const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node;
936
937 // Visit the left field
938 if (cast->left != NULL && !pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
939
940 // Visit the right field
941 if (cast->right != NULL && !pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
942
943 break;
944 }
945 case PM_FLOAT_NODE:
946 break;
947 case PM_FOR_NODE: {
948 const pm_for_node_t *cast = (const pm_for_node_t *) node;
949
950 // Visit the index field
951 if (!pm_visit_node((const pm_node_t *) cast->index, visitor, data)) return false;
952
953 // Visit the collection field
954 if (!pm_visit_node((const pm_node_t *) cast->collection, visitor, data)) return false;
955
956 // Visit the statements field
957 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
958
959 break;
960 }
961 case PM_FORWARDING_ARGUMENTS_NODE:
962 break;
963 case PM_FORWARDING_PARAMETER_NODE:
964 break;
965 case PM_FORWARDING_SUPER_NODE: {
966 const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node;
967
968 // Visit the block field
969 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
970
971 break;
972 }
973 case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: {
975
976 // Visit the value field
977 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
978
979 break;
980 }
981 case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
983
984 // Visit the value field
985 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
986
987 break;
988 }
989 case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
991
992 // Visit the value field
993 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
994
995 break;
996 }
997 case PM_GLOBAL_VARIABLE_READ_NODE:
998 break;
999 case PM_GLOBAL_VARIABLE_TARGET_NODE:
1000 break;
1001 case PM_GLOBAL_VARIABLE_WRITE_NODE: {
1003
1004 // Visit the value field
1005 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1006
1007 break;
1008 }
1009 case PM_HASH_NODE: {
1010 const pm_hash_node_t *cast = (const pm_hash_node_t *) node;
1011
1012 // Visit the elements field
1013 const pm_node_list_t *elements = &cast->elements;
1014 for (size_t index = 0; index < elements->size; index++) {
1015 if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
1016 }
1017
1018 break;
1019 }
1020 case PM_HASH_PATTERN_NODE: {
1021 const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node;
1022
1023 // Visit the constant field
1024 if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)) return false;
1025
1026 // Visit the elements field
1027 const pm_node_list_t *elements = &cast->elements;
1028 for (size_t index = 0; index < elements->size; index++) {
1029 if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
1030 }
1031
1032 // Visit the rest field
1033 if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1034
1035 break;
1036 }
1037 case PM_IF_NODE: {
1038 const pm_if_node_t *cast = (const pm_if_node_t *) node;
1039
1040 // Visit the predicate field
1041 if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1042
1043 // Visit the statements field
1044 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1045
1046 // Visit the subsequent field
1047 if (cast->subsequent != NULL && !pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data)) return false;
1048
1049 break;
1050 }
1051 case PM_IMAGINARY_NODE: {
1052 const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node;
1053
1054 // Visit the numeric field
1055 if (!pm_visit_node((const pm_node_t *) cast->numeric, visitor, data)) return false;
1056
1057 break;
1058 }
1059 case PM_IMPLICIT_NODE: {
1060 const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node;
1061
1062 // Visit the value field
1063 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1064
1065 break;
1066 }
1067 case PM_IMPLICIT_REST_NODE:
1068 break;
1069 case PM_IN_NODE: {
1070 const pm_in_node_t *cast = (const pm_in_node_t *) node;
1071
1072 // Visit the pattern field
1073 if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return false;
1074
1075 // Visit the statements field
1076 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1077
1078 break;
1079 }
1080 case PM_INDEX_AND_WRITE_NODE: {
1081 const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node;
1082
1083 // Visit the receiver field
1084 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1085
1086 // Visit the arguments field
1087 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1088
1089 // Visit the block field
1090 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1091
1092 // Visit the value field
1093 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1094
1095 break;
1096 }
1097 case PM_INDEX_OPERATOR_WRITE_NODE: {
1099
1100 // Visit the receiver field
1101 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1102
1103 // Visit the arguments field
1104 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1105
1106 // Visit the block field
1107 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1108
1109 // Visit the value field
1110 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1111
1112 break;
1113 }
1114 case PM_INDEX_OR_WRITE_NODE: {
1115 const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node;
1116
1117 // Visit the receiver field
1118 if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1119
1120 // Visit the arguments field
1121 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1122
1123 // Visit the block field
1124 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1125
1126 // Visit the value field
1127 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1128
1129 break;
1130 }
1131 case PM_INDEX_TARGET_NODE: {
1132 const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node;
1133
1134 // Visit the receiver field
1135 if (!pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1136
1137 // Visit the arguments field
1138 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1139
1140 // Visit the block field
1141 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1142
1143 break;
1144 }
1145 case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
1147
1148 // Visit the value field
1149 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1150
1151 break;
1152 }
1153 case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
1155
1156 // Visit the value field
1157 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1158
1159 break;
1160 }
1161 case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
1163
1164 // Visit the value field
1165 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1166
1167 break;
1168 }
1169 case PM_INSTANCE_VARIABLE_READ_NODE:
1170 break;
1171 case PM_INSTANCE_VARIABLE_TARGET_NODE:
1172 break;
1173 case PM_INSTANCE_VARIABLE_WRITE_NODE: {
1175
1176 // Visit the value field
1177 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1178
1179 break;
1180 }
1181 case PM_INTEGER_NODE:
1182 break;
1183 case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
1185
1186 // Visit the parts field
1187 const pm_node_list_t *parts = &cast->parts;
1188 for (size_t index = 0; index < parts->size; index++) {
1189 if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1190 }
1191
1192 break;
1193 }
1194 case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
1196
1197 // Visit the parts field
1198 const pm_node_list_t *parts = &cast->parts;
1199 for (size_t index = 0; index < parts->size; index++) {
1200 if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1201 }
1202
1203 break;
1204 }
1205 case PM_INTERPOLATED_STRING_NODE: {
1207
1208 // Visit the parts field
1209 const pm_node_list_t *parts = &cast->parts;
1210 for (size_t index = 0; index < parts->size; index++) {
1211 if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1212 }
1213
1214 break;
1215 }
1216 case PM_INTERPOLATED_SYMBOL_NODE: {
1218
1219 // Visit the parts field
1220 const pm_node_list_t *parts = &cast->parts;
1221 for (size_t index = 0; index < parts->size; index++) {
1222 if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1223 }
1224
1225 break;
1226 }
1227 case PM_INTERPOLATED_X_STRING_NODE: {
1229
1230 // Visit the parts field
1231 const pm_node_list_t *parts = &cast->parts;
1232 for (size_t index = 0; index < parts->size; index++) {
1233 if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1234 }
1235
1236 break;
1237 }
1238 case PM_IT_LOCAL_VARIABLE_READ_NODE:
1239 break;
1240 case PM_IT_PARAMETERS_NODE:
1241 break;
1242 case PM_KEYWORD_HASH_NODE: {
1243 const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node;
1244
1245 // Visit the elements field
1246 const pm_node_list_t *elements = &cast->elements;
1247 for (size_t index = 0; index < elements->size; index++) {
1248 if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
1249 }
1250
1251 break;
1252 }
1253 case PM_KEYWORD_REST_PARAMETER_NODE:
1254 break;
1255 case PM_LAMBDA_NODE: {
1256 const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node;
1257
1258 // Visit the parameters field
1259 if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
1260
1261 // Visit the body field
1262 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1263
1264 break;
1265 }
1266 case PM_LOCAL_VARIABLE_AND_WRITE_NODE: {
1268
1269 // Visit the value field
1270 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1271
1272 break;
1273 }
1274 case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
1276
1277 // Visit the value field
1278 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1279
1280 break;
1281 }
1282 case PM_LOCAL_VARIABLE_OR_WRITE_NODE: {
1284
1285 // Visit the value field
1286 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1287
1288 break;
1289 }
1290 case PM_LOCAL_VARIABLE_READ_NODE:
1291 break;
1292 case PM_LOCAL_VARIABLE_TARGET_NODE:
1293 break;
1294 case PM_LOCAL_VARIABLE_WRITE_NODE: {
1296
1297 // Visit the value field
1298 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1299
1300 break;
1301 }
1302 case PM_MATCH_LAST_LINE_NODE:
1303 break;
1304 case PM_MATCH_PREDICATE_NODE: {
1305 const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node;
1306
1307 // Visit the value field
1308 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1309
1310 // Visit the pattern field
1311 if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return false;
1312
1313 break;
1314 }
1315 case PM_MATCH_REQUIRED_NODE: {
1316 const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node;
1317
1318 // Visit the value field
1319 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1320
1321 // Visit the pattern field
1322 if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return false;
1323
1324 break;
1325 }
1326 case PM_MATCH_WRITE_NODE: {
1327 const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node;
1328
1329 // Visit the call field
1330 if (!pm_visit_node((const pm_node_t *) cast->call, visitor, data)) return false;
1331
1332 // Visit the targets field
1333 const pm_node_list_t *targets = &cast->targets;
1334 for (size_t index = 0; index < targets->size; index++) {
1335 if (!pm_visit_node(targets->nodes[index], visitor, data)) return false;
1336 }
1337
1338 break;
1339 }
1340 case PM_MODULE_NODE: {
1341 const pm_module_node_t *cast = (const pm_module_node_t *) node;
1342
1343 // Visit the constant_path field
1344 if (!pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data)) return false;
1345
1346 // Visit the body field
1347 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1348
1349 break;
1350 }
1351 case PM_MULTI_TARGET_NODE: {
1352 const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node;
1353
1354 // Visit the lefts field
1355 const pm_node_list_t *lefts = &cast->lefts;
1356 for (size_t index = 0; index < lefts->size; index++) {
1357 if (!pm_visit_node(lefts->nodes[index], visitor, data)) return false;
1358 }
1359
1360 // Visit the rest field
1361 if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1362
1363 // Visit the rights field
1364 const pm_node_list_t *rights = &cast->rights;
1365 for (size_t index = 0; index < rights->size; index++) {
1366 if (!pm_visit_node(rights->nodes[index], visitor, data)) return false;
1367 }
1368
1369 break;
1370 }
1371 case PM_MULTI_WRITE_NODE: {
1372 const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node;
1373
1374 // Visit the lefts field
1375 const pm_node_list_t *lefts = &cast->lefts;
1376 for (size_t index = 0; index < lefts->size; index++) {
1377 if (!pm_visit_node(lefts->nodes[index], visitor, data)) return false;
1378 }
1379
1380 // Visit the rest field
1381 if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1382
1383 // Visit the rights field
1384 const pm_node_list_t *rights = &cast->rights;
1385 for (size_t index = 0; index < rights->size; index++) {
1386 if (!pm_visit_node(rights->nodes[index], visitor, data)) return false;
1387 }
1388
1389 // Visit the value field
1390 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1391
1392 break;
1393 }
1394 case PM_NEXT_NODE: {
1395 const pm_next_node_t *cast = (const pm_next_node_t *) node;
1396
1397 // Visit the arguments field
1398 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1399
1400 break;
1401 }
1402 case PM_NIL_NODE:
1403 break;
1404 case PM_NO_BLOCK_PARAMETER_NODE:
1405 break;
1406 case PM_NO_KEYWORDS_PARAMETER_NODE:
1407 break;
1408 case PM_NUMBERED_PARAMETERS_NODE:
1409 break;
1410 case PM_NUMBERED_REFERENCE_READ_NODE:
1411 break;
1412 case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
1414
1415 // Visit the value field
1416 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1417
1418 break;
1419 }
1420 case PM_OPTIONAL_PARAMETER_NODE: {
1422
1423 // Visit the value field
1424 if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1425
1426 break;
1427 }
1428 case PM_OR_NODE: {
1429 const pm_or_node_t *cast = (const pm_or_node_t *) node;
1430
1431 // Visit the left field
1432 if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
1433
1434 // Visit the right field
1435 if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
1436
1437 break;
1438 }
1439 case PM_PARAMETERS_NODE: {
1440 const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node;
1441
1442 // Visit the requireds field
1443 const pm_node_list_t *requireds = &cast->requireds;
1444 for (size_t index = 0; index < requireds->size; index++) {
1445 if (!pm_visit_node(requireds->nodes[index], visitor, data)) return false;
1446 }
1447
1448 // Visit the optionals field
1449 const pm_node_list_t *optionals = &cast->optionals;
1450 for (size_t index = 0; index < optionals->size; index++) {
1451 if (!pm_visit_node(optionals->nodes[index], visitor, data)) return false;
1452 }
1453
1454 // Visit the rest field
1455 if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1456
1457 // Visit the posts field
1458 const pm_node_list_t *posts = &cast->posts;
1459 for (size_t index = 0; index < posts->size; index++) {
1460 if (!pm_visit_node(posts->nodes[index], visitor, data)) return false;
1461 }
1462
1463 // Visit the keywords field
1464 const pm_node_list_t *keywords = &cast->keywords;
1465 for (size_t index = 0; index < keywords->size; index++) {
1466 if (!pm_visit_node(keywords->nodes[index], visitor, data)) return false;
1467 }
1468
1469 // Visit the keyword_rest field
1470 if (cast->keyword_rest != NULL && !pm_visit_node((const pm_node_t *) cast->keyword_rest, visitor, data)) return false;
1471
1472 // Visit the block field
1473 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1474
1475 break;
1476 }
1477 case PM_PARENTHESES_NODE: {
1478 const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node;
1479
1480 // Visit the body field
1481 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1482
1483 break;
1484 }
1485 case PM_PINNED_EXPRESSION_NODE: {
1486 const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node;
1487
1488 // Visit the expression field
1489 if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1490
1491 break;
1492 }
1493 case PM_PINNED_VARIABLE_NODE: {
1494 const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node;
1495
1496 // Visit the variable field
1497 if (!pm_visit_node((const pm_node_t *) cast->variable, visitor, data)) return false;
1498
1499 break;
1500 }
1501 case PM_POST_EXECUTION_NODE: {
1502 const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node;
1503
1504 // Visit the statements field
1505 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1506
1507 break;
1508 }
1509 case PM_PRE_EXECUTION_NODE: {
1510 const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node;
1511
1512 // Visit the statements field
1513 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1514
1515 break;
1516 }
1517 case PM_PROGRAM_NODE: {
1518 const pm_program_node_t *cast = (const pm_program_node_t *) node;
1519
1520 // Visit the statements field
1521 if (!pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1522
1523 break;
1524 }
1525 case PM_RANGE_NODE: {
1526 const pm_range_node_t *cast = (const pm_range_node_t *) node;
1527
1528 // Visit the left field
1529 if (cast->left != NULL && !pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
1530
1531 // Visit the right field
1532 if (cast->right != NULL && !pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
1533
1534 break;
1535 }
1536 case PM_RATIONAL_NODE:
1537 break;
1538 case PM_REDO_NODE:
1539 break;
1540 case PM_REGULAR_EXPRESSION_NODE:
1541 break;
1542 case PM_REQUIRED_KEYWORD_PARAMETER_NODE:
1543 break;
1544 case PM_REQUIRED_PARAMETER_NODE:
1545 break;
1546 case PM_RESCUE_MODIFIER_NODE: {
1547 const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node;
1548
1549 // Visit the expression field
1550 if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1551
1552 // Visit the rescue_expression field
1553 if (!pm_visit_node((const pm_node_t *) cast->rescue_expression, visitor, data)) return false;
1554
1555 break;
1556 }
1557 case PM_RESCUE_NODE: {
1558 const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node;
1559
1560 // Visit the exceptions field
1561 const pm_node_list_t *exceptions = &cast->exceptions;
1562 for (size_t index = 0; index < exceptions->size; index++) {
1563 if (!pm_visit_node(exceptions->nodes[index], visitor, data)) return false;
1564 }
1565
1566 // Visit the reference field
1567 if (cast->reference != NULL && !pm_visit_node((const pm_node_t *) cast->reference, visitor, data)) return false;
1568
1569 // Visit the statements field
1570 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1571
1572 // Visit the subsequent field
1573 if (cast->subsequent != NULL && !pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data)) return false;
1574
1575 break;
1576 }
1577 case PM_REST_PARAMETER_NODE:
1578 break;
1579 case PM_RETRY_NODE:
1580 break;
1581 case PM_RETURN_NODE: {
1582 const pm_return_node_t *cast = (const pm_return_node_t *) node;
1583
1584 // Visit the arguments field
1585 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1586
1587 break;
1588 }
1589 case PM_SELF_NODE:
1590 break;
1591 case PM_SHAREABLE_CONSTANT_NODE: {
1593
1594 // Visit the write field
1595 if (!pm_visit_node((const pm_node_t *) cast->write, visitor, data)) return false;
1596
1597 break;
1598 }
1599 case PM_SINGLETON_CLASS_NODE: {
1600 const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node;
1601
1602 // Visit the expression field
1603 if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1604
1605 // Visit the body field
1606 if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1607
1608 break;
1609 }
1610 case PM_SOURCE_ENCODING_NODE:
1611 break;
1612 case PM_SOURCE_FILE_NODE:
1613 break;
1614 case PM_SOURCE_LINE_NODE:
1615 break;
1616 case PM_SPLAT_NODE: {
1617 const pm_splat_node_t *cast = (const pm_splat_node_t *) node;
1618
1619 // Visit the expression field
1620 if (cast->expression != NULL && !pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1621
1622 break;
1623 }
1624 case PM_STATEMENTS_NODE: {
1625 const pm_statements_node_t *cast = (const pm_statements_node_t *) node;
1626
1627 // Visit the body field
1628 const pm_node_list_t *body = &cast->body;
1629 for (size_t index = 0; index < body->size; index++) {
1630 if (!pm_visit_node(body->nodes[index], visitor, data)) return false;
1631 }
1632
1633 break;
1634 }
1635 case PM_STRING_NODE:
1636 break;
1637 case PM_SUPER_NODE: {
1638 const pm_super_node_t *cast = (const pm_super_node_t *) node;
1639
1640 // Visit the arguments field
1641 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1642
1643 // Visit the block field
1644 if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1645
1646 break;
1647 }
1648 case PM_SYMBOL_NODE:
1649 break;
1650 case PM_TRUE_NODE:
1651 break;
1652 case PM_UNDEF_NODE: {
1653 const pm_undef_node_t *cast = (const pm_undef_node_t *) node;
1654
1655 // Visit the names field
1656 const pm_node_list_t *names = &cast->names;
1657 for (size_t index = 0; index < names->size; index++) {
1658 if (!pm_visit_node(names->nodes[index], visitor, data)) return false;
1659 }
1660
1661 break;
1662 }
1663 case PM_UNLESS_NODE: {
1664 const pm_unless_node_t *cast = (const pm_unless_node_t *) node;
1665
1666 // Visit the predicate field
1667 if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1668
1669 // Visit the statements field
1670 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1671
1672 // Visit the else_clause field
1673 if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
1674
1675 break;
1676 }
1677 case PM_UNTIL_NODE: {
1678 const pm_until_node_t *cast = (const pm_until_node_t *) node;
1679
1680 // Visit the predicate field
1681 if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1682
1683 // Visit the statements field
1684 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1685
1686 break;
1687 }
1688 case PM_WHEN_NODE: {
1689 const pm_when_node_t *cast = (const pm_when_node_t *) node;
1690
1691 // Visit the conditions field
1692 const pm_node_list_t *conditions = &cast->conditions;
1693 for (size_t index = 0; index < conditions->size; index++) {
1694 if (!pm_visit_node(conditions->nodes[index], visitor, data)) return false;
1695 }
1696
1697 // Visit the statements field
1698 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1699
1700 break;
1701 }
1702 case PM_WHILE_NODE: {
1703 const pm_while_node_t *cast = (const pm_while_node_t *) node;
1704
1705 // Visit the predicate field
1706 if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1707
1708 // Visit the statements field
1709 if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1710
1711 break;
1712 }
1713 case PM_X_STRING_NODE:
1714 break;
1715 case PM_YIELD_NODE: {
1716 const pm_yield_node_t *cast = (const pm_yield_node_t *) node;
1717
1718 // Visit the arguments field
1719 if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1720
1721 break;
1722 }
1723 case PM_SCOPE_NODE:
1724 break;
1725 }
1726
1727 return true;
1728}
1729
1734pm_alias_global_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *new_name, struct pm_node *old_name, pm_location_t keyword_loc) {
1736
1738 .base = { .type = PM_ALIAS_GLOBAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
1739 .new_name = new_name,
1740 .old_name = old_name,
1741 .keyword_loc = keyword_loc
1742 };
1743
1744 return node;
1745}
1746
1751pm_alias_method_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *new_name, struct pm_node *old_name, pm_location_t keyword_loc) {
1753
1754 *node = (pm_alias_method_node_t) {
1755 .base = { .type = PM_ALIAS_METHOD_NODE, .flags = flags, .node_id = node_id, .location = location },
1756 .new_name = new_name,
1757 .old_name = old_name,
1758 .keyword_loc = keyword_loc
1759 };
1760
1761 return node;
1762}
1763
1768pm_alternation_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
1770
1772 .base = { .type = PM_ALTERNATION_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
1773 .left = left,
1774 .right = right,
1775 .operator_loc = operator_loc
1776 };
1777
1778 return node;
1779}
1780
1785pm_and_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
1786 pm_and_node_t *node = (pm_and_node_t *) pm_arena_alloc(arena, sizeof(pm_and_node_t), PRISM_ALIGNOF(pm_and_node_t));
1787
1788 *node = (pm_and_node_t) {
1789 .base = { .type = PM_AND_NODE, .flags = flags, .node_id = node_id, .location = location },
1790 .left = left,
1791 .right = right,
1792 .operator_loc = operator_loc
1793 };
1794
1795 return node;
1796}
1797
1802pm_arguments_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t arguments) {
1804
1805 *node = (pm_arguments_node_t) {
1806 .base = { .type = PM_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
1807 .arguments = arguments
1808 };
1809
1810 return node;
1811}
1812
1817pm_array_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t elements, pm_location_t opening_loc, pm_location_t closing_loc) {
1818 pm_array_node_t *node = (pm_array_node_t *) pm_arena_alloc(arena, sizeof(pm_array_node_t), PRISM_ALIGNOF(pm_array_node_t));
1819
1820 *node = (pm_array_node_t) {
1821 .base = { .type = PM_ARRAY_NODE, .flags = flags, .node_id = node_id, .location = location },
1822 .elements = elements,
1823 .opening_loc = opening_loc,
1824 .closing_loc = closing_loc
1825 };
1826
1827 return node;
1828}
1829
1834pm_array_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, pm_node_list_t requireds, struct pm_node *rest, pm_node_list_t posts, pm_location_t opening_loc, pm_location_t closing_loc) {
1836
1837 *node = (pm_array_pattern_node_t) {
1838 .base = { .type = PM_ARRAY_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
1839 .constant = constant,
1840 .requireds = requireds,
1841 .rest = rest,
1842 .posts = posts,
1843 .opening_loc = opening_loc,
1844 .closing_loc = closing_loc
1845 };
1846
1847 return node;
1848}
1849
1854pm_assoc_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *key, struct pm_node *value, pm_location_t operator_loc) {
1855 pm_assoc_node_t *node = (pm_assoc_node_t *) pm_arena_alloc(arena, sizeof(pm_assoc_node_t), PRISM_ALIGNOF(pm_assoc_node_t));
1856
1857 *node = (pm_assoc_node_t) {
1858 .base = { .type = PM_ASSOC_NODE, .flags = flags, .node_id = node_id, .location = location },
1859 .key = key,
1860 .value = value,
1861 .operator_loc = operator_loc
1862 };
1863
1864 return node;
1865}
1866
1871pm_assoc_splat_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, pm_location_t operator_loc) {
1873
1874 *node = (pm_assoc_splat_node_t) {
1875 .base = { .type = PM_ASSOC_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location },
1876 .value = value,
1877 .operator_loc = operator_loc
1878 };
1879
1880 return node;
1881}
1882
1887pm_back_reference_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
1889
1891 .base = { .type = PM_BACK_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
1892 .name = name
1893 };
1894
1895 return node;
1896}
1897
1902pm_begin_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t begin_keyword_loc, struct pm_statements_node *statements, struct pm_rescue_node *rescue_clause, struct pm_else_node *else_clause, struct pm_ensure_node *ensure_clause, pm_location_t end_keyword_loc) {
1903 pm_begin_node_t *node = (pm_begin_node_t *) pm_arena_alloc(arena, sizeof(pm_begin_node_t), PRISM_ALIGNOF(pm_begin_node_t));
1904
1905 *node = (pm_begin_node_t) {
1906 .base = { .type = PM_BEGIN_NODE, .flags = flags, .node_id = node_id, .location = location },
1907 .begin_keyword_loc = begin_keyword_loc,
1908 .statements = statements,
1909 .rescue_clause = rescue_clause,
1910 .else_clause = else_clause,
1911 .ensure_clause = ensure_clause,
1912 .end_keyword_loc = end_keyword_loc
1913 };
1914
1915 return node;
1916}
1917
1922pm_block_argument_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t operator_loc) {
1924
1925 *node = (pm_block_argument_node_t) {
1926 .base = { .type = PM_BLOCK_ARGUMENT_NODE, .flags = flags, .node_id = node_id, .location = location },
1927 .expression = expression,
1928 .operator_loc = operator_loc
1929 };
1930
1931 return node;
1932}
1933
1938pm_block_local_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
1940
1942 .base = { .type = PM_BLOCK_LOCAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
1943 .name = name
1944 };
1945
1946 return node;
1947}
1948
1953pm_block_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, struct pm_node *parameters, struct pm_node *body, pm_location_t opening_loc, pm_location_t closing_loc) {
1954 pm_block_node_t *node = (pm_block_node_t *) pm_arena_alloc(arena, sizeof(pm_block_node_t), PRISM_ALIGNOF(pm_block_node_t));
1955
1956 *node = (pm_block_node_t) {
1957 .base = { .type = PM_BLOCK_NODE, .flags = flags, .node_id = node_id, .location = location },
1958 .locals = locals,
1959 .parameters = parameters,
1960 .body = body,
1961 .opening_loc = opening_loc,
1962 .closing_loc = closing_loc
1963 };
1964
1965 return node;
1966}
1967
1972pm_block_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) {
1974
1975 *node = (pm_block_parameter_node_t) {
1976 .base = { .type = PM_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
1977 .name = name,
1978 .name_loc = name_loc,
1979 .operator_loc = operator_loc
1980 };
1981
1982 return node;
1983}
1984
1989pm_block_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_parameters_node *parameters, pm_node_list_t locals, pm_location_t opening_loc, pm_location_t closing_loc) {
1991
1992 *node = (pm_block_parameters_node_t) {
1993 .base = { .type = PM_BLOCK_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
1994 .parameters = parameters,
1995 .locals = locals,
1996 .opening_loc = opening_loc,
1997 .closing_loc = closing_loc
1998 };
1999
2000 return node;
2001}
2002
2007pm_break_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_arguments_node *arguments, pm_location_t keyword_loc) {
2008 pm_break_node_t *node = (pm_break_node_t *) pm_arena_alloc(arena, sizeof(pm_break_node_t), PRISM_ALIGNOF(pm_break_node_t));
2009
2010 *node = (pm_break_node_t) {
2011 .base = { .type = PM_BREAK_NODE, .flags = flags, .node_id = node_id, .location = location },
2012 .arguments = arguments,
2013 .keyword_loc = keyword_loc
2014 };
2015
2016 return node;
2017}
2018
2023pm_call_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_location_t operator_loc, struct pm_node *value) {
2025
2026 *node = (pm_call_and_write_node_t) {
2027 .base = { .type = PM_CALL_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2028 .receiver = receiver,
2029 .call_operator_loc = call_operator_loc,
2030 .message_loc = message_loc,
2031 .read_name = read_name,
2032 .write_name = write_name,
2033 .operator_loc = operator_loc,
2034 .value = value
2035 };
2036
2037 return node;
2038}
2039
2044pm_call_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_constant_id_t name, pm_location_t message_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, pm_location_t equal_loc, struct pm_node *block) {
2045 pm_call_node_t *node = (pm_call_node_t *) pm_arena_alloc(arena, sizeof(pm_call_node_t), PRISM_ALIGNOF(pm_call_node_t));
2046
2047 *node = (pm_call_node_t) {
2048 .base = { .type = PM_CALL_NODE, .flags = flags, .node_id = node_id, .location = location },
2049 .receiver = receiver,
2050 .call_operator_loc = call_operator_loc,
2051 .name = name,
2052 .message_loc = message_loc,
2053 .opening_loc = opening_loc,
2054 .arguments = arguments,
2055 .closing_loc = closing_loc,
2056 .equal_loc = equal_loc,
2057 .block = block
2058 };
2059
2060 return node;
2061}
2062
2067pm_call_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_constant_id_t binary_operator, pm_location_t binary_operator_loc, struct pm_node *value) {
2069
2071 .base = { .type = PM_CALL_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2072 .receiver = receiver,
2073 .call_operator_loc = call_operator_loc,
2074 .message_loc = message_loc,
2075 .read_name = read_name,
2076 .write_name = write_name,
2077 .binary_operator = binary_operator,
2078 .binary_operator_loc = binary_operator_loc,
2079 .value = value
2080 };
2081
2082 return node;
2083}
2084
2089pm_call_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_location_t operator_loc, struct pm_node *value) {
2091
2092 *node = (pm_call_or_write_node_t) {
2093 .base = { .type = PM_CALL_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2094 .receiver = receiver,
2095 .call_operator_loc = call_operator_loc,
2096 .message_loc = message_loc,
2097 .read_name = read_name,
2098 .write_name = write_name,
2099 .operator_loc = operator_loc,
2100 .value = value
2101 };
2102
2103 return node;
2104}
2105
2110pm_call_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_constant_id_t name, pm_location_t message_loc) {
2112
2113 *node = (pm_call_target_node_t) {
2114 .base = { .type = PM_CALL_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2115 .receiver = receiver,
2116 .call_operator_loc = call_operator_loc,
2117 .name = name,
2118 .message_loc = message_loc
2119 };
2120
2121 return node;
2122}
2123
2128pm_capture_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_local_variable_target_node *target, pm_location_t operator_loc) {
2130
2131 *node = (pm_capture_pattern_node_t) {
2132 .base = { .type = PM_CAPTURE_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2133 .value = value,
2134 .target = target,
2135 .operator_loc = operator_loc
2136 };
2137
2138 return node;
2139}
2140
2145pm_case_match_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *predicate, pm_node_list_t conditions, struct pm_else_node *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc) {
2147
2148 *node = (pm_case_match_node_t) {
2149 .base = { .type = PM_CASE_MATCH_NODE, .flags = flags, .node_id = node_id, .location = location },
2150 .predicate = predicate,
2151 .conditions = conditions,
2152 .else_clause = else_clause,
2153 .case_keyword_loc = case_keyword_loc,
2154 .end_keyword_loc = end_keyword_loc
2155 };
2156
2157 return node;
2158}
2159
2164pm_case_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *predicate, pm_node_list_t conditions, struct pm_else_node *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc) {
2165 pm_case_node_t *node = (pm_case_node_t *) pm_arena_alloc(arena, sizeof(pm_case_node_t), PRISM_ALIGNOF(pm_case_node_t));
2166
2167 *node = (pm_case_node_t) {
2168 .base = { .type = PM_CASE_NODE, .flags = flags, .node_id = node_id, .location = location },
2169 .predicate = predicate,
2170 .conditions = conditions,
2171 .else_clause = else_clause,
2172 .case_keyword_loc = case_keyword_loc,
2173 .end_keyword_loc = end_keyword_loc
2174 };
2175
2176 return node;
2177}
2178
2183pm_class_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t class_keyword_loc, struct pm_node *constant_path, pm_location_t inheritance_operator_loc, struct pm_node *superclass, struct pm_node *body, pm_location_t end_keyword_loc, pm_constant_id_t name) {
2184 pm_class_node_t *node = (pm_class_node_t *) pm_arena_alloc(arena, sizeof(pm_class_node_t), PRISM_ALIGNOF(pm_class_node_t));
2185
2186 *node = (pm_class_node_t) {
2187 .base = { .type = PM_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location },
2188 .locals = locals,
2189 .class_keyword_loc = class_keyword_loc,
2190 .constant_path = constant_path,
2191 .inheritance_operator_loc = inheritance_operator_loc,
2192 .superclass = superclass,
2193 .body = body,
2194 .end_keyword_loc = end_keyword_loc,
2195 .name = name
2196 };
2197
2198 return node;
2199}
2200
2205pm_class_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2207
2209 .base = { .type = PM_CLASS_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2210 .name = name,
2211 .name_loc = name_loc,
2212 .operator_loc = operator_loc,
2213 .value = value
2214 };
2215
2216 return node;
2217}
2218
2223pm_class_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2225
2227 .base = { .type = PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2228 .name = name,
2229 .name_loc = name_loc,
2230 .binary_operator_loc = binary_operator_loc,
2231 .value = value,
2232 .binary_operator = binary_operator
2233 };
2234
2235 return node;
2236}
2237
2242pm_class_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2244
2246 .base = { .type = PM_CLASS_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2247 .name = name,
2248 .name_loc = name_loc,
2249 .operator_loc = operator_loc,
2250 .value = value
2251 };
2252
2253 return node;
2254}
2255
2260pm_class_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2262
2264 .base = { .type = PM_CLASS_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2265 .name = name
2266 };
2267
2268 return node;
2269}
2270
2275pm_class_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2277
2279 .base = { .type = PM_CLASS_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2280 .name = name
2281 };
2282
2283 return node;
2284}
2285
2290pm_class_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
2292
2294 .base = { .type = PM_CLASS_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2295 .name = name,
2296 .name_loc = name_loc,
2297 .value = value,
2298 .operator_loc = operator_loc
2299 };
2300
2301 return node;
2302}
2303
2308pm_constant_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2310
2312 .base = { .type = PM_CONSTANT_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2313 .name = name,
2314 .name_loc = name_loc,
2315 .operator_loc = operator_loc,
2316 .value = value
2317 };
2318
2319 return node;
2320}
2321
2326pm_constant_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2328
2330 .base = { .type = PM_CONSTANT_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2331 .name = name,
2332 .name_loc = name_loc,
2333 .binary_operator_loc = binary_operator_loc,
2334 .value = value,
2335 .binary_operator = binary_operator
2336 };
2337
2338 return node;
2339}
2340
2345pm_constant_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2347
2348 *node = (pm_constant_or_write_node_t) {
2349 .base = { .type = PM_CONSTANT_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2350 .name = name,
2351 .name_loc = name_loc,
2352 .operator_loc = operator_loc,
2353 .value = value
2354 };
2355
2356 return node;
2357}
2358
2363pm_constant_path_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) {
2365
2367 .base = { .type = PM_CONSTANT_PATH_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2368 .target = target,
2369 .operator_loc = operator_loc,
2370 .value = value
2371 };
2372
2373 return node;
2374}
2375
2380pm_constant_path_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *parent, pm_constant_id_t name, pm_location_t delimiter_loc, pm_location_t name_loc) {
2382
2383 *node = (pm_constant_path_node_t) {
2384 .base = { .type = PM_CONSTANT_PATH_NODE, .flags = flags, .node_id = node_id, .location = location },
2385 .parent = parent,
2386 .name = name,
2387 .delimiter_loc = delimiter_loc,
2388 .name_loc = name_loc
2389 };
2390
2391 return node;
2392}
2393
2398pm_constant_path_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2400
2402 .base = { .type = PM_CONSTANT_PATH_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2403 .target = target,
2404 .binary_operator_loc = binary_operator_loc,
2405 .value = value,
2406 .binary_operator = binary_operator
2407 };
2408
2409 return node;
2410}
2411
2416pm_constant_path_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) {
2418
2420 .base = { .type = PM_CONSTANT_PATH_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2421 .target = target,
2422 .operator_loc = operator_loc,
2423 .value = value
2424 };
2425
2426 return node;
2427}
2428
2433pm_constant_path_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *parent, pm_constant_id_t name, pm_location_t delimiter_loc, pm_location_t name_loc) {
2435
2437 .base = { .type = PM_CONSTANT_PATH_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2438 .parent = parent,
2439 .name = name,
2440 .delimiter_loc = delimiter_loc,
2441 .name_loc = name_loc
2442 };
2443
2444 return node;
2445}
2446
2451pm_constant_path_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) {
2453
2455 .base = { .type = PM_CONSTANT_PATH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2456 .target = target,
2457 .operator_loc = operator_loc,
2458 .value = value
2459 };
2460
2461 return node;
2462}
2463
2468pm_constant_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2470
2471 *node = (pm_constant_read_node_t) {
2472 .base = { .type = PM_CONSTANT_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2473 .name = name
2474 };
2475
2476 return node;
2477}
2478
2483pm_constant_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2485
2486 *node = (pm_constant_target_node_t) {
2487 .base = { .type = PM_CONSTANT_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2488 .name = name
2489 };
2490
2491 return node;
2492}
2493
2498pm_constant_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
2500
2501 *node = (pm_constant_write_node_t) {
2502 .base = { .type = PM_CONSTANT_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2503 .name = name,
2504 .name_loc = name_loc,
2505 .value = value,
2506 .operator_loc = operator_loc
2507 };
2508
2509 return node;
2510}
2511
2516pm_def_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *receiver, struct pm_parameters_node *parameters, struct pm_node *body, pm_constant_id_list_t locals, pm_location_t def_keyword_loc, pm_location_t operator_loc, pm_location_t lparen_loc, pm_location_t rparen_loc, pm_location_t equal_loc, pm_location_t end_keyword_loc) {
2517 pm_def_node_t *node = (pm_def_node_t *) pm_arena_alloc(arena, sizeof(pm_def_node_t), PRISM_ALIGNOF(pm_def_node_t));
2518
2519 *node = (pm_def_node_t) {
2520 .base = { .type = PM_DEF_NODE, .flags = flags, .node_id = node_id, .location = location },
2521 .name = name,
2522 .name_loc = name_loc,
2523 .receiver = receiver,
2524 .parameters = parameters,
2525 .body = body,
2526 .locals = locals,
2527 .def_keyword_loc = def_keyword_loc,
2528 .operator_loc = operator_loc,
2529 .lparen_loc = lparen_loc,
2530 .rparen_loc = rparen_loc,
2531 .equal_loc = equal_loc,
2532 .end_keyword_loc = end_keyword_loc
2533 };
2534
2535 return node;
2536}
2537
2542pm_defined_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t lparen_loc, struct pm_node *value, pm_location_t rparen_loc, pm_location_t keyword_loc) {
2543 pm_defined_node_t *node = (pm_defined_node_t *) pm_arena_alloc(arena, sizeof(pm_defined_node_t), PRISM_ALIGNOF(pm_defined_node_t));
2544
2545 *node = (pm_defined_node_t) {
2546 .base = { .type = PM_DEFINED_NODE, .flags = flags, .node_id = node_id, .location = location },
2547 .lparen_loc = lparen_loc,
2548 .value = value,
2549 .rparen_loc = rparen_loc,
2550 .keyword_loc = keyword_loc
2551 };
2552
2553 return node;
2554}
2555
2560pm_else_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t else_keyword_loc, struct pm_statements_node *statements, pm_location_t end_keyword_loc) {
2561 pm_else_node_t *node = (pm_else_node_t *) pm_arena_alloc(arena, sizeof(pm_else_node_t), PRISM_ALIGNOF(pm_else_node_t));
2562
2563 *node = (pm_else_node_t) {
2564 .base = { .type = PM_ELSE_NODE, .flags = flags, .node_id = node_id, .location = location },
2565 .else_keyword_loc = else_keyword_loc,
2566 .statements = statements,
2567 .end_keyword_loc = end_keyword_loc
2568 };
2569
2570 return node;
2571}
2572
2577pm_embedded_statements_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, struct pm_statements_node *statements, pm_location_t closing_loc) {
2579
2581 .base = { .type = PM_EMBEDDED_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
2582 .opening_loc = opening_loc,
2583 .statements = statements,
2584 .closing_loc = closing_loc
2585 };
2586
2587 return node;
2588}
2589
2594pm_embedded_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, struct pm_node *variable) {
2596
2597 *node = (pm_embedded_variable_node_t) {
2598 .base = { .type = PM_EMBEDDED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
2599 .operator_loc = operator_loc,
2600 .variable = variable
2601 };
2602
2603 return node;
2604}
2605
2610pm_ensure_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t ensure_keyword_loc, struct pm_statements_node *statements, pm_location_t end_keyword_loc) {
2611 pm_ensure_node_t *node = (pm_ensure_node_t *) pm_arena_alloc(arena, sizeof(pm_ensure_node_t), PRISM_ALIGNOF(pm_ensure_node_t));
2612
2613 *node = (pm_ensure_node_t) {
2614 .base = { .type = PM_ENSURE_NODE, .flags = flags, .node_id = node_id, .location = location },
2615 .ensure_keyword_loc = ensure_keyword_loc,
2616 .statements = statements,
2617 .end_keyword_loc = end_keyword_loc
2618 };
2619
2620 return node;
2621}
2622
2627pm_error_recovery_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *unexpected) {
2629
2630 *node = (pm_error_recovery_node_t) {
2631 .base = { .type = PM_ERROR_RECOVERY_NODE, .flags = flags, .node_id = node_id, .location = location },
2632 .unexpected = unexpected
2633 };
2634
2635 return node;
2636}
2637
2642pm_false_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2643 pm_false_node_t *node = (pm_false_node_t *) pm_arena_alloc(arena, sizeof(pm_false_node_t), PRISM_ALIGNOF(pm_false_node_t));
2644
2645 *node = (pm_false_node_t) {
2646 .base = { .type = PM_FALSE_NODE, .flags = flags, .node_id = node_id, .location = location }
2647 };
2648
2649 return node;
2650}
2651
2656pm_find_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, struct pm_splat_node *left, pm_node_list_t requireds, struct pm_splat_node *right, pm_location_t opening_loc, pm_location_t closing_loc) {
2658
2659 *node = (pm_find_pattern_node_t) {
2660 .base = { .type = PM_FIND_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2661 .constant = constant,
2662 .left = left,
2663 .requireds = requireds,
2664 .right = right,
2665 .opening_loc = opening_loc,
2666 .closing_loc = closing_loc
2667 };
2668
2669 return node;
2670}
2671
2676pm_flip_flop_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
2678
2679 *node = (pm_flip_flop_node_t) {
2680 .base = { .type = PM_FLIP_FLOP_NODE, .flags = flags, .node_id = node_id, .location = location },
2681 .left = left,
2682 .right = right,
2683 .operator_loc = operator_loc
2684 };
2685
2686 return node;
2687}
2688
2693pm_float_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, double value) {
2694 pm_float_node_t *node = (pm_float_node_t *) pm_arena_alloc(arena, sizeof(pm_float_node_t), PRISM_ALIGNOF(pm_float_node_t));
2695
2696 *node = (pm_float_node_t) {
2697 .base = { .type = PM_FLOAT_NODE, .flags = flags, .node_id = node_id, .location = location },
2698 .value = value
2699 };
2700
2701 return node;
2702}
2703
2708pm_for_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *index, struct pm_node *collection, struct pm_statements_node *statements, pm_location_t for_keyword_loc, pm_location_t in_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc) {
2709 pm_for_node_t *node = (pm_for_node_t *) pm_arena_alloc(arena, sizeof(pm_for_node_t), PRISM_ALIGNOF(pm_for_node_t));
2710
2711 *node = (pm_for_node_t) {
2712 .base = { .type = PM_FOR_NODE, .flags = flags, .node_id = node_id, .location = location },
2713 .index = index,
2714 .collection = collection,
2715 .statements = statements,
2716 .for_keyword_loc = for_keyword_loc,
2717 .in_keyword_loc = in_keyword_loc,
2718 .do_keyword_loc = do_keyword_loc,
2719 .end_keyword_loc = end_keyword_loc
2720 };
2721
2722 return node;
2723}
2724
2729pm_forwarding_arguments_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2731
2733 .base = { .type = PM_FORWARDING_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location }
2734 };
2735
2736 return node;
2737}
2738
2743pm_forwarding_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2745
2747 .base = { .type = PM_FORWARDING_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }
2748 };
2749
2750 return node;
2751}
2752
2757pm_forwarding_super_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, struct pm_block_node *block) {
2759
2760 *node = (pm_forwarding_super_node_t) {
2761 .base = { .type = PM_FORWARDING_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location },
2762 .keyword_loc = keyword_loc,
2763 .block = block
2764 };
2765
2766 return node;
2767}
2768
2773pm_global_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2775
2777 .base = { .type = PM_GLOBAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2778 .name = name,
2779 .name_loc = name_loc,
2780 .operator_loc = operator_loc,
2781 .value = value
2782 };
2783
2784 return node;
2785}
2786
2791pm_global_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2793
2795 .base = { .type = PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2796 .name = name,
2797 .name_loc = name_loc,
2798 .binary_operator_loc = binary_operator_loc,
2799 .value = value,
2800 .binary_operator = binary_operator
2801 };
2802
2803 return node;
2804}
2805
2810pm_global_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2812
2814 .base = { .type = PM_GLOBAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2815 .name = name,
2816 .name_loc = name_loc,
2817 .operator_loc = operator_loc,
2818 .value = value
2819 };
2820
2821 return node;
2822}
2823
2828pm_global_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2830
2832 .base = { .type = PM_GLOBAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2833 .name = name
2834 };
2835
2836 return node;
2837}
2838
2843pm_global_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2845
2847 .base = { .type = PM_GLOBAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2848 .name = name
2849 };
2850
2851 return node;
2852}
2853
2858pm_global_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
2860
2862 .base = { .type = PM_GLOBAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2863 .name = name,
2864 .name_loc = name_loc,
2865 .value = value,
2866 .operator_loc = operator_loc
2867 };
2868
2869 return node;
2870}
2871
2876pm_hash_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t elements, pm_location_t closing_loc) {
2877 pm_hash_node_t *node = (pm_hash_node_t *) pm_arena_alloc(arena, sizeof(pm_hash_node_t), PRISM_ALIGNOF(pm_hash_node_t));
2878
2879 *node = (pm_hash_node_t) {
2880 .base = { .type = PM_HASH_NODE, .flags = flags, .node_id = node_id, .location = location },
2881 .opening_loc = opening_loc,
2882 .elements = elements,
2883 .closing_loc = closing_loc
2884 };
2885
2886 return node;
2887}
2888
2893pm_hash_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, pm_node_list_t elements, struct pm_node *rest, pm_location_t opening_loc, pm_location_t closing_loc) {
2895
2896 *node = (pm_hash_pattern_node_t) {
2897 .base = { .type = PM_HASH_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2898 .constant = constant,
2899 .elements = elements,
2900 .rest = rest,
2901 .opening_loc = opening_loc,
2902 .closing_loc = closing_loc
2903 };
2904
2905 return node;
2906}
2907
2912pm_if_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t if_keyword_loc, struct pm_node *predicate, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_node *subsequent, pm_location_t end_keyword_loc) {
2913 pm_if_node_t *node = (pm_if_node_t *) pm_arena_alloc(arena, sizeof(pm_if_node_t), PRISM_ALIGNOF(pm_if_node_t));
2914
2915 *node = (pm_if_node_t) {
2916 .base = { .type = PM_IF_NODE, .flags = flags, .node_id = node_id, .location = location },
2917 .if_keyword_loc = if_keyword_loc,
2918 .predicate = predicate,
2919 .then_keyword_loc = then_keyword_loc,
2920 .statements = statements,
2921 .subsequent = subsequent,
2922 .end_keyword_loc = end_keyword_loc
2923 };
2924
2925 return node;
2926}
2927
2932pm_imaginary_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *numeric) {
2934
2935 *node = (pm_imaginary_node_t) {
2936 .base = { .type = PM_IMAGINARY_NODE, .flags = flags, .node_id = node_id, .location = location },
2937 .numeric = numeric
2938 };
2939
2940 return node;
2941}
2942
2947pm_implicit_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value) {
2949
2950 *node = (pm_implicit_node_t) {
2951 .base = { .type = PM_IMPLICIT_NODE, .flags = flags, .node_id = node_id, .location = location },
2952 .value = value
2953 };
2954
2955 return node;
2956}
2957
2962pm_implicit_rest_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2964
2965 *node = (pm_implicit_rest_node_t) {
2966 .base = { .type = PM_IMPLICIT_REST_NODE, .flags = flags, .node_id = node_id, .location = location }
2967 };
2968
2969 return node;
2970}
2971
2976pm_in_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *pattern, struct pm_statements_node *statements, pm_location_t in_keyword_loc, pm_location_t then_keyword_loc) {
2977 pm_in_node_t *node = (pm_in_node_t *) pm_arena_alloc(arena, sizeof(pm_in_node_t), PRISM_ALIGNOF(pm_in_node_t));
2978
2979 *node = (pm_in_node_t) {
2980 .base = { .type = PM_IN_NODE, .flags = flags, .node_id = node_id, .location = location },
2981 .pattern = pattern,
2982 .statements = statements,
2983 .in_keyword_loc = in_keyword_loc,
2984 .then_keyword_loc = then_keyword_loc
2985 };
2986
2987 return node;
2988}
2989
2994pm_index_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_location_t operator_loc, struct pm_node *value) {
2996
2997 *node = (pm_index_and_write_node_t) {
2998 .base = { .type = PM_INDEX_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2999 .receiver = receiver,
3000 .call_operator_loc = call_operator_loc,
3001 .opening_loc = opening_loc,
3002 .arguments = arguments,
3003 .closing_loc = closing_loc,
3004 .block = block,
3005 .operator_loc = operator_loc,
3006 .value = value
3007 };
3008
3009 return node;
3010}
3011
3016pm_index_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_constant_id_t binary_operator, pm_location_t binary_operator_loc, struct pm_node *value) {
3018
3020 .base = { .type = PM_INDEX_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3021 .receiver = receiver,
3022 .call_operator_loc = call_operator_loc,
3023 .opening_loc = opening_loc,
3024 .arguments = arguments,
3025 .closing_loc = closing_loc,
3026 .block = block,
3027 .binary_operator = binary_operator,
3028 .binary_operator_loc = binary_operator_loc,
3029 .value = value
3030 };
3031
3032 return node;
3033}
3034
3039pm_index_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_location_t operator_loc, struct pm_node *value) {
3041
3042 *node = (pm_index_or_write_node_t) {
3043 .base = { .type = PM_INDEX_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3044 .receiver = receiver,
3045 .call_operator_loc = call_operator_loc,
3046 .opening_loc = opening_loc,
3047 .arguments = arguments,
3048 .closing_loc = closing_loc,
3049 .block = block,
3050 .operator_loc = operator_loc,
3051 .value = value
3052 };
3053
3054 return node;
3055}
3056
3061pm_index_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block) {
3063
3064 *node = (pm_index_target_node_t) {
3065 .base = { .type = PM_INDEX_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3066 .receiver = receiver,
3067 .opening_loc = opening_loc,
3068 .arguments = arguments,
3069 .closing_loc = closing_loc,
3070 .block = block
3071 };
3072
3073 return node;
3074}
3075
3080pm_instance_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
3082
3084 .base = { .type = PM_INSTANCE_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3085 .name = name,
3086 .name_loc = name_loc,
3087 .operator_loc = operator_loc,
3088 .value = value
3089 };
3090
3091 return node;
3092}
3093
3098pm_instance_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
3100
3102 .base = { .type = PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3103 .name = name,
3104 .name_loc = name_loc,
3105 .binary_operator_loc = binary_operator_loc,
3106 .value = value,
3107 .binary_operator = binary_operator
3108 };
3109
3110 return node;
3111}
3112
3117pm_instance_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
3119
3121 .base = { .type = PM_INSTANCE_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3122 .name = name,
3123 .name_loc = name_loc,
3124 .operator_loc = operator_loc,
3125 .value = value
3126 };
3127
3128 return node;
3129}
3130
3135pm_instance_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
3137
3139 .base = { .type = PM_INSTANCE_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3140 .name = name
3141 };
3142
3143 return node;
3144}
3145
3150pm_instance_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
3152
3154 .base = { .type = PM_INSTANCE_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3155 .name = name
3156 };
3157
3158 return node;
3159}
3160
3165pm_instance_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
3167
3169 .base = { .type = PM_INSTANCE_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3170 .name = name,
3171 .name_loc = name_loc,
3172 .value = value,
3173 .operator_loc = operator_loc
3174 };
3175
3176 return node;
3177}
3178
3183pm_integer_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_integer_t value) {
3184 pm_integer_node_t *node = (pm_integer_node_t *) pm_arena_alloc(arena, sizeof(pm_integer_node_t), PRISM_ALIGNOF(pm_integer_node_t));
3185
3186 *node = (pm_integer_node_t) {
3187 .base = { .type = PM_INTEGER_NODE, .flags = flags, .node_id = node_id, .location = location },
3188 .value = value
3189 };
3190
3191 return node;
3192}
3193
3198pm_interpolated_match_last_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3200
3202 .base = { .type = PM_INTERPOLATED_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location },
3203 .opening_loc = opening_loc,
3204 .parts = parts,
3205 .closing_loc = closing_loc
3206 };
3207
3208 return node;
3209}
3210
3215pm_interpolated_regular_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3217
3219 .base = { .type = PM_INTERPOLATED_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3220 .opening_loc = opening_loc,
3221 .parts = parts,
3222 .closing_loc = closing_loc
3223 };
3224
3225 return node;
3226}
3227
3232pm_interpolated_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3234
3236 .base = { .type = PM_INTERPOLATED_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
3237 .opening_loc = opening_loc,
3238 .parts = parts,
3239 .closing_loc = closing_loc
3240 };
3241
3242 return node;
3243}
3244
3249pm_interpolated_symbol_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3251
3253 .base = { .type = PM_INTERPOLATED_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location },
3254 .opening_loc = opening_loc,
3255 .parts = parts,
3256 .closing_loc = closing_loc
3257 };
3258
3259 return node;
3260}
3261
3266pm_interpolated_x_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3268
3270 .base = { .type = PM_INTERPOLATED_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
3271 .opening_loc = opening_loc,
3272 .parts = parts,
3273 .closing_loc = closing_loc
3274 };
3275
3276 return node;
3277}
3278
3283pm_it_local_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3285
3287 .base = { .type = PM_IT_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }
3288 };
3289
3290 return node;
3291}
3292
3297pm_it_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3299
3300 *node = (pm_it_parameters_node_t) {
3301 .base = { .type = PM_IT_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location }
3302 };
3303
3304 return node;
3305}
3306
3311pm_keyword_hash_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t elements) {
3313
3314 *node = (pm_keyword_hash_node_t) {
3315 .base = { .type = PM_KEYWORD_HASH_NODE, .flags = flags, .node_id = node_id, .location = location },
3316 .elements = elements
3317 };
3318
3319 return node;
3320}
3321
3326pm_keyword_rest_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) {
3328
3330 .base = { .type = PM_KEYWORD_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3331 .name = name,
3332 .name_loc = name_loc,
3333 .operator_loc = operator_loc
3334 };
3335
3336 return node;
3337}
3338
3343pm_lambda_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t operator_loc, pm_location_t opening_loc, pm_location_t closing_loc, struct pm_node *parameters, struct pm_node *body) {
3344 pm_lambda_node_t *node = (pm_lambda_node_t *) pm_arena_alloc(arena, sizeof(pm_lambda_node_t), PRISM_ALIGNOF(pm_lambda_node_t));
3345
3346 *node = (pm_lambda_node_t) {
3347 .base = { .type = PM_LAMBDA_NODE, .flags = flags, .node_id = node_id, .location = location },
3348 .locals = locals,
3349 .operator_loc = operator_loc,
3350 .opening_loc = opening_loc,
3351 .closing_loc = closing_loc,
3352 .parameters = parameters,
3353 .body = body
3354 };
3355
3356 return node;
3357}
3358
3363pm_local_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value, pm_constant_id_t name, uint32_t depth) {
3365
3367 .base = { .type = PM_LOCAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3368 .name_loc = name_loc,
3369 .operator_loc = operator_loc,
3370 .value = value,
3371 .name = name,
3372 .depth = depth
3373 };
3374
3375 return node;
3376}
3377
3382pm_local_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t name, pm_constant_id_t binary_operator, uint32_t depth) {
3384
3386 .base = { .type = PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3387 .name_loc = name_loc,
3388 .binary_operator_loc = binary_operator_loc,
3389 .value = value,
3390 .name = name,
3391 .binary_operator = binary_operator,
3392 .depth = depth
3393 };
3394
3395 return node;
3396}
3397
3402pm_local_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value, pm_constant_id_t name, uint32_t depth) {
3404
3406 .base = { .type = PM_LOCAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3407 .name_loc = name_loc,
3408 .operator_loc = operator_loc,
3409 .value = value,
3410 .name = name,
3411 .depth = depth
3412 };
3413
3414 return node;
3415}
3416
3421pm_local_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth) {
3423
3425 .base = { .type = PM_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3426 .name = name,
3427 .depth = depth
3428 };
3429
3430 return node;
3431}
3432
3437pm_local_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth) {
3439
3441 .base = { .type = PM_LOCAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3442 .name = name,
3443 .depth = depth
3444 };
3445
3446 return node;
3447}
3448
3453pm_local_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
3455
3457 .base = { .type = PM_LOCAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3458 .name = name,
3459 .depth = depth,
3460 .name_loc = name_loc,
3461 .value = value,
3462 .operator_loc = operator_loc
3463 };
3464
3465 return node;
3466}
3467
3472pm_match_last_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
3474
3475 *node = (pm_match_last_line_node_t) {
3476 .base = { .type = PM_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location },
3477 .opening_loc = opening_loc,
3478 .content_loc = content_loc,
3479 .closing_loc = closing_loc,
3480 .unescaped = unescaped
3481 };
3482
3483 return node;
3484}
3485
3490pm_match_predicate_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_node *pattern, pm_location_t keyword_loc) {
3492
3493 *node = (pm_match_predicate_node_t) {
3494 .base = { .type = PM_MATCH_PREDICATE_NODE, .flags = flags, .node_id = node_id, .location = location },
3495 .value = value,
3496 .pattern = pattern,
3497 .keyword_loc = keyword_loc
3498 };
3499
3500 return node;
3501}
3502
3507pm_match_required_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_node *pattern, pm_location_t operator_loc) {
3509
3510 *node = (pm_match_required_node_t) {
3511 .base = { .type = PM_MATCH_REQUIRED_NODE, .flags = flags, .node_id = node_id, .location = location },
3512 .value = value,
3513 .pattern = pattern,
3514 .operator_loc = operator_loc
3515 };
3516
3517 return node;
3518}
3519
3524pm_match_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_call_node *call, pm_node_list_t targets) {
3526
3527 *node = (pm_match_write_node_t) {
3528 .base = { .type = PM_MATCH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3529 .call = call,
3530 .targets = targets
3531 };
3532
3533 return node;
3534}
3535
3540pm_module_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t module_keyword_loc, struct pm_node *constant_path, struct pm_node *body, pm_location_t end_keyword_loc, pm_constant_id_t name) {
3541 pm_module_node_t *node = (pm_module_node_t *) pm_arena_alloc(arena, sizeof(pm_module_node_t), PRISM_ALIGNOF(pm_module_node_t));
3542
3543 *node = (pm_module_node_t) {
3544 .base = { .type = PM_MODULE_NODE, .flags = flags, .node_id = node_id, .location = location },
3545 .locals = locals,
3546 .module_keyword_loc = module_keyword_loc,
3547 .constant_path = constant_path,
3548 .body = body,
3549 .end_keyword_loc = end_keyword_loc,
3550 .name = name
3551 };
3552
3553 return node;
3554}
3555
3560pm_multi_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t lefts, struct pm_node *rest, pm_node_list_t rights, pm_location_t lparen_loc, pm_location_t rparen_loc) {
3562
3563 *node = (pm_multi_target_node_t) {
3564 .base = { .type = PM_MULTI_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3565 .lefts = lefts,
3566 .rest = rest,
3567 .rights = rights,
3568 .lparen_loc = lparen_loc,
3569 .rparen_loc = rparen_loc
3570 };
3571
3572 return node;
3573}
3574
3579pm_multi_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t lefts, struct pm_node *rest, pm_node_list_t rights, pm_location_t lparen_loc, pm_location_t rparen_loc, pm_location_t operator_loc, struct pm_node *value) {
3581
3582 *node = (pm_multi_write_node_t) {
3583 .base = { .type = PM_MULTI_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3584 .lefts = lefts,
3585 .rest = rest,
3586 .rights = rights,
3587 .lparen_loc = lparen_loc,
3588 .rparen_loc = rparen_loc,
3589 .operator_loc = operator_loc,
3590 .value = value
3591 };
3592
3593 return node;
3594}
3595
3600pm_next_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_arguments_node *arguments, pm_location_t keyword_loc) {
3601 pm_next_node_t *node = (pm_next_node_t *) pm_arena_alloc(arena, sizeof(pm_next_node_t), PRISM_ALIGNOF(pm_next_node_t));
3602
3603 *node = (pm_next_node_t) {
3604 .base = { .type = PM_NEXT_NODE, .flags = flags, .node_id = node_id, .location = location },
3605 .arguments = arguments,
3606 .keyword_loc = keyword_loc
3607 };
3608
3609 return node;
3610}
3611
3616pm_nil_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3617 pm_nil_node_t *node = (pm_nil_node_t *) pm_arena_alloc(arena, sizeof(pm_nil_node_t), PRISM_ALIGNOF(pm_nil_node_t));
3618
3619 *node = (pm_nil_node_t) {
3620 .base = { .type = PM_NIL_NODE, .flags = flags, .node_id = node_id, .location = location }
3621 };
3622
3623 return node;
3624}
3625
3630pm_no_block_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, pm_location_t keyword_loc) {
3632
3634 .base = { .type = PM_NO_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3635 .operator_loc = operator_loc,
3636 .keyword_loc = keyword_loc
3637 };
3638
3639 return node;
3640}
3641
3646pm_no_keywords_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, pm_location_t keyword_loc) {
3648
3650 .base = { .type = PM_NO_KEYWORDS_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3651 .operator_loc = operator_loc,
3652 .keyword_loc = keyword_loc
3653 };
3654
3655 return node;
3656}
3657
3662pm_numbered_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, uint8_t maximum) {
3664
3666 .base = { .type = PM_NUMBERED_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
3667 .maximum = maximum
3668 };
3669
3670 return node;
3671}
3672
3677pm_numbered_reference_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, uint32_t number) {
3679
3681 .base = { .type = PM_NUMBERED_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3682 .number = number
3683 };
3684
3685 return node;
3686}
3687
3692pm_optional_keyword_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value) {
3694
3696 .base = { .type = PM_OPTIONAL_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3697 .name = name,
3698 .name_loc = name_loc,
3699 .value = value
3700 };
3701
3702 return node;
3703}
3704
3709pm_optional_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
3711
3713 .base = { .type = PM_OPTIONAL_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3714 .name = name,
3715 .name_loc = name_loc,
3716 .operator_loc = operator_loc,
3717 .value = value
3718 };
3719
3720 return node;
3721}
3722
3727pm_or_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
3728 pm_or_node_t *node = (pm_or_node_t *) pm_arena_alloc(arena, sizeof(pm_or_node_t), PRISM_ALIGNOF(pm_or_node_t));
3729
3730 *node = (pm_or_node_t) {
3731 .base = { .type = PM_OR_NODE, .flags = flags, .node_id = node_id, .location = location },
3732 .left = left,
3733 .right = right,
3734 .operator_loc = operator_loc
3735 };
3736
3737 return node;
3738}
3739
3744pm_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t requireds, pm_node_list_t optionals, struct pm_node *rest, pm_node_list_t posts, pm_node_list_t keywords, struct pm_node *keyword_rest, struct pm_node *block) {
3746
3747 *node = (pm_parameters_node_t) {
3748 .base = { .type = PM_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
3749 .requireds = requireds,
3750 .optionals = optionals,
3751 .rest = rest,
3752 .posts = posts,
3753 .keywords = keywords,
3754 .keyword_rest = keyword_rest,
3755 .block = block
3756 };
3757
3758 return node;
3759}
3760
3765pm_parentheses_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *body, pm_location_t opening_loc, pm_location_t closing_loc) {
3767
3768 *node = (pm_parentheses_node_t) {
3769 .base = { .type = PM_PARENTHESES_NODE, .flags = flags, .node_id = node_id, .location = location },
3770 .body = body,
3771 .opening_loc = opening_loc,
3772 .closing_loc = closing_loc
3773 };
3774
3775 return node;
3776}
3777
3782pm_pinned_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t operator_loc, pm_location_t lparen_loc, pm_location_t rparen_loc) {
3784
3785 *node = (pm_pinned_expression_node_t) {
3786 .base = { .type = PM_PINNED_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3787 .expression = expression,
3788 .operator_loc = operator_loc,
3789 .lparen_loc = lparen_loc,
3790 .rparen_loc = rparen_loc
3791 };
3792
3793 return node;
3794}
3795
3800pm_pinned_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *variable, pm_location_t operator_loc) {
3802
3803 *node = (pm_pinned_variable_node_t) {
3804 .base = { .type = PM_PINNED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
3805 .variable = variable,
3806 .operator_loc = operator_loc
3807 };
3808
3809 return node;
3810}
3811
3816pm_post_execution_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_statements_node *statements, pm_location_t keyword_loc, pm_location_t opening_loc, pm_location_t closing_loc) {
3818
3819 *node = (pm_post_execution_node_t) {
3820 .base = { .type = PM_POST_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location },
3821 .statements = statements,
3822 .keyword_loc = keyword_loc,
3823 .opening_loc = opening_loc,
3824 .closing_loc = closing_loc
3825 };
3826
3827 return node;
3828}
3829
3834pm_pre_execution_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_statements_node *statements, pm_location_t keyword_loc, pm_location_t opening_loc, pm_location_t closing_loc) {
3836
3837 *node = (pm_pre_execution_node_t) {
3838 .base = { .type = PM_PRE_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location },
3839 .statements = statements,
3840 .keyword_loc = keyword_loc,
3841 .opening_loc = opening_loc,
3842 .closing_loc = closing_loc
3843 };
3844
3845 return node;
3846}
3847
3852pm_program_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, struct pm_statements_node *statements) {
3853 pm_program_node_t *node = (pm_program_node_t *) pm_arena_alloc(arena, sizeof(pm_program_node_t), PRISM_ALIGNOF(pm_program_node_t));
3854
3855 *node = (pm_program_node_t) {
3856 .base = { .type = PM_PROGRAM_NODE, .flags = flags, .node_id = node_id, .location = location },
3857 .locals = locals,
3858 .statements = statements
3859 };
3860
3861 return node;
3862}
3863
3868pm_range_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
3869 pm_range_node_t *node = (pm_range_node_t *) pm_arena_alloc(arena, sizeof(pm_range_node_t), PRISM_ALIGNOF(pm_range_node_t));
3870
3871 *node = (pm_range_node_t) {
3872 .base = { .type = PM_RANGE_NODE, .flags = flags, .node_id = node_id, .location = location },
3873 .left = left,
3874 .right = right,
3875 .operator_loc = operator_loc
3876 };
3877
3878 return node;
3879}
3880
3885pm_rational_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_integer_t numerator, pm_integer_t denominator) {
3887
3888 *node = (pm_rational_node_t) {
3889 .base = { .type = PM_RATIONAL_NODE, .flags = flags, .node_id = node_id, .location = location },
3890 .numerator = numerator,
3891 .denominator = denominator
3892 };
3893
3894 return node;
3895}
3896
3901pm_redo_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3902 pm_redo_node_t *node = (pm_redo_node_t *) pm_arena_alloc(arena, sizeof(pm_redo_node_t), PRISM_ALIGNOF(pm_redo_node_t));
3903
3904 *node = (pm_redo_node_t) {
3905 .base = { .type = PM_REDO_NODE, .flags = flags, .node_id = node_id, .location = location }
3906 };
3907
3908 return node;
3909}
3910
3915pm_regular_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
3917
3919 .base = { .type = PM_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3920 .opening_loc = opening_loc,
3921 .content_loc = content_loc,
3922 .closing_loc = closing_loc,
3923 .unescaped = unescaped
3924 };
3925
3926 return node;
3927}
3928
3933pm_required_keyword_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc) {
3935
3937 .base = { .type = PM_REQUIRED_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3938 .name = name,
3939 .name_loc = name_loc
3940 };
3941
3942 return node;
3943}
3944
3949pm_required_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
3951
3953 .base = { .type = PM_REQUIRED_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3954 .name = name
3955 };
3956
3957 return node;
3958}
3959
3964pm_rescue_modifier_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t keyword_loc, struct pm_node *rescue_expression) {
3966
3967 *node = (pm_rescue_modifier_node_t) {
3968 .base = { .type = PM_RESCUE_MODIFIER_NODE, .flags = flags, .node_id = node_id, .location = location },
3969 .expression = expression,
3970 .keyword_loc = keyword_loc,
3971 .rescue_expression = rescue_expression
3972 };
3973
3974 return node;
3975}
3976
3981pm_rescue_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_node_list_t exceptions, pm_location_t operator_loc, struct pm_node *reference, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_rescue_node *subsequent) {
3982 pm_rescue_node_t *node = (pm_rescue_node_t *) pm_arena_alloc(arena, sizeof(pm_rescue_node_t), PRISM_ALIGNOF(pm_rescue_node_t));
3983
3984 *node = (pm_rescue_node_t) {
3985 .base = { .type = PM_RESCUE_NODE, .flags = flags, .node_id = node_id, .location = location },
3986 .keyword_loc = keyword_loc,
3987 .exceptions = exceptions,
3988 .operator_loc = operator_loc,
3989 .reference = reference,
3990 .then_keyword_loc = then_keyword_loc,
3991 .statements = statements,
3992 .subsequent = subsequent
3993 };
3994
3995 return node;
3996}
3997
4002pm_rest_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) {
4004
4005 *node = (pm_rest_parameter_node_t) {
4006 .base = { .type = PM_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4007 .name = name,
4008 .name_loc = name_loc,
4009 .operator_loc = operator_loc
4010 };
4011
4012 return node;
4013}
4014
4019pm_retry_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4020 pm_retry_node_t *node = (pm_retry_node_t *) pm_arena_alloc(arena, sizeof(pm_retry_node_t), PRISM_ALIGNOF(pm_retry_node_t));
4021
4022 *node = (pm_retry_node_t) {
4023 .base = { .type = PM_RETRY_NODE, .flags = flags, .node_id = node_id, .location = location }
4024 };
4025
4026 return node;
4027}
4028
4033pm_return_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, struct pm_arguments_node *arguments) {
4034 pm_return_node_t *node = (pm_return_node_t *) pm_arena_alloc(arena, sizeof(pm_return_node_t), PRISM_ALIGNOF(pm_return_node_t));
4035
4036 *node = (pm_return_node_t) {
4037 .base = { .type = PM_RETURN_NODE, .flags = flags, .node_id = node_id, .location = location },
4038 .keyword_loc = keyword_loc,
4039 .arguments = arguments
4040 };
4041
4042 return node;
4043}
4044
4049pm_self_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4050 pm_self_node_t *node = (pm_self_node_t *) pm_arena_alloc(arena, sizeof(pm_self_node_t), PRISM_ALIGNOF(pm_self_node_t));
4051
4052 *node = (pm_self_node_t) {
4053 .base = { .type = PM_SELF_NODE, .flags = flags, .node_id = node_id, .location = location }
4054 };
4055
4056 return node;
4057}
4058
4063pm_shareable_constant_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *write) {
4065
4067 .base = { .type = PM_SHAREABLE_CONSTANT_NODE, .flags = flags, .node_id = node_id, .location = location },
4068 .write = write
4069 };
4070
4071 return node;
4072}
4073
4078pm_singleton_class_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t class_keyword_loc, pm_location_t operator_loc, struct pm_node *expression, struct pm_node *body, pm_location_t end_keyword_loc) {
4080
4081 *node = (pm_singleton_class_node_t) {
4082 .base = { .type = PM_SINGLETON_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location },
4083 .locals = locals,
4084 .class_keyword_loc = class_keyword_loc,
4085 .operator_loc = operator_loc,
4086 .expression = expression,
4087 .body = body,
4088 .end_keyword_loc = end_keyword_loc
4089 };
4090
4091 return node;
4092}
4093
4098pm_source_encoding_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4100
4101 *node = (pm_source_encoding_node_t) {
4102 .base = { .type = PM_SOURCE_ENCODING_NODE, .flags = flags, .node_id = node_id, .location = location }
4103 };
4104
4105 return node;
4106}
4107
4112pm_source_file_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_string_t filepath) {
4114
4115 *node = (pm_source_file_node_t) {
4116 .base = { .type = PM_SOURCE_FILE_NODE, .flags = flags, .node_id = node_id, .location = location },
4117 .filepath = filepath
4118 };
4119
4120 return node;
4121}
4122
4127pm_source_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4129
4130 *node = (pm_source_line_node_t) {
4131 .base = { .type = PM_SOURCE_LINE_NODE, .flags = flags, .node_id = node_id, .location = location }
4132 };
4133
4134 return node;
4135}
4136
4141pm_splat_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, struct pm_node *expression) {
4142 pm_splat_node_t *node = (pm_splat_node_t *) pm_arena_alloc(arena, sizeof(pm_splat_node_t), PRISM_ALIGNOF(pm_splat_node_t));
4143
4144 *node = (pm_splat_node_t) {
4145 .base = { .type = PM_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location },
4146 .operator_loc = operator_loc,
4147 .expression = expression
4148 };
4149
4150 return node;
4151}
4152
4157pm_statements_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t body) {
4159
4160 *node = (pm_statements_node_t) {
4161 .base = { .type = PM_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
4162 .body = body
4163 };
4164
4165 return node;
4166}
4167
4172pm_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4173 pm_string_node_t *node = (pm_string_node_t *) pm_arena_alloc(arena, sizeof(pm_string_node_t), PRISM_ALIGNOF(pm_string_node_t));
4174
4175 *node = (pm_string_node_t) {
4176 .base = { .type = PM_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
4177 .opening_loc = opening_loc,
4178 .content_loc = content_loc,
4179 .closing_loc = closing_loc,
4180 .unescaped = unescaped
4181 };
4182
4183 return node;
4184}
4185
4190pm_super_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_location_t lparen_loc, struct pm_arguments_node *arguments, pm_location_t rparen_loc, struct pm_node *block) {
4191 pm_super_node_t *node = (pm_super_node_t *) pm_arena_alloc(arena, sizeof(pm_super_node_t), PRISM_ALIGNOF(pm_super_node_t));
4192
4193 *node = (pm_super_node_t) {
4194 .base = { .type = PM_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location },
4195 .keyword_loc = keyword_loc,
4196 .lparen_loc = lparen_loc,
4197 .arguments = arguments,
4198 .rparen_loc = rparen_loc,
4199 .block = block
4200 };
4201
4202 return node;
4203}
4204
4209pm_symbol_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4210 pm_symbol_node_t *node = (pm_symbol_node_t *) pm_arena_alloc(arena, sizeof(pm_symbol_node_t), PRISM_ALIGNOF(pm_symbol_node_t));
4211
4212 *node = (pm_symbol_node_t) {
4213 .base = { .type = PM_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location },
4214 .opening_loc = opening_loc,
4215 .content_loc = content_loc,
4216 .closing_loc = closing_loc,
4217 .unescaped = unescaped
4218 };
4219
4220 return node;
4221}
4222
4227pm_true_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4228 pm_true_node_t *node = (pm_true_node_t *) pm_arena_alloc(arena, sizeof(pm_true_node_t), PRISM_ALIGNOF(pm_true_node_t));
4229
4230 *node = (pm_true_node_t) {
4231 .base = { .type = PM_TRUE_NODE, .flags = flags, .node_id = node_id, .location = location }
4232 };
4233
4234 return node;
4235}
4236
4241pm_undef_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t names, pm_location_t keyword_loc) {
4242 pm_undef_node_t *node = (pm_undef_node_t *) pm_arena_alloc(arena, sizeof(pm_undef_node_t), PRISM_ALIGNOF(pm_undef_node_t));
4243
4244 *node = (pm_undef_node_t) {
4245 .base = { .type = PM_UNDEF_NODE, .flags = flags, .node_id = node_id, .location = location },
4246 .names = names,
4247 .keyword_loc = keyword_loc
4248 };
4249
4250 return node;
4251}
4252
4257pm_unless_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t unless_keyword_loc, struct pm_node *predicate, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_else_node *else_clause, pm_location_t end_keyword_loc) {
4258 pm_unless_node_t *node = (pm_unless_node_t *) pm_arena_alloc(arena, sizeof(pm_unless_node_t), PRISM_ALIGNOF(pm_unless_node_t));
4259
4260 *node = (pm_unless_node_t) {
4261 .base = { .type = PM_UNLESS_NODE, .flags = flags, .node_id = node_id, .location = location },
4262 .unless_keyword_loc = unless_keyword_loc,
4263 .predicate = predicate,
4264 .then_keyword_loc = then_keyword_loc,
4265 .statements = statements,
4266 .else_clause = else_clause,
4267 .end_keyword_loc = end_keyword_loc
4268 };
4269
4270 return node;
4271}
4272
4277pm_until_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t until_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc, struct pm_node *predicate, struct pm_statements_node *statements) {
4278 pm_until_node_t *node = (pm_until_node_t *) pm_arena_alloc(arena, sizeof(pm_until_node_t), PRISM_ALIGNOF(pm_until_node_t));
4279
4280 *node = (pm_until_node_t) {
4281 .base = { .type = PM_UNTIL_NODE, .flags = flags, .node_id = node_id, .location = location },
4282 .until_keyword_loc = until_keyword_loc,
4283 .do_keyword_loc = do_keyword_loc,
4284 .end_keyword_loc = end_keyword_loc,
4285 .predicate = predicate,
4286 .statements = statements
4287 };
4288
4289 return node;
4290}
4291
4296pm_when_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t when_keyword_loc, pm_node_list_t conditions, pm_location_t then_keyword_loc, struct pm_statements_node *statements) {
4297 pm_when_node_t *node = (pm_when_node_t *) pm_arena_alloc(arena, sizeof(pm_when_node_t), PRISM_ALIGNOF(pm_when_node_t));
4298
4299 *node = (pm_when_node_t) {
4300 .base = { .type = PM_WHEN_NODE, .flags = flags, .node_id = node_id, .location = location },
4301 .when_keyword_loc = when_keyword_loc,
4302 .conditions = conditions,
4303 .then_keyword_loc = then_keyword_loc,
4304 .statements = statements
4305 };
4306
4307 return node;
4308}
4309
4314pm_while_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t while_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc, struct pm_node *predicate, struct pm_statements_node *statements) {
4315 pm_while_node_t *node = (pm_while_node_t *) pm_arena_alloc(arena, sizeof(pm_while_node_t), PRISM_ALIGNOF(pm_while_node_t));
4316
4317 *node = (pm_while_node_t) {
4318 .base = { .type = PM_WHILE_NODE, .flags = flags, .node_id = node_id, .location = location },
4319 .while_keyword_loc = while_keyword_loc,
4320 .do_keyword_loc = do_keyword_loc,
4321 .end_keyword_loc = end_keyword_loc,
4322 .predicate = predicate,
4323 .statements = statements
4324 };
4325
4326 return node;
4327}
4328
4333pm_x_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4335
4336 *node = (pm_x_string_node_t) {
4337 .base = { .type = PM_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
4338 .opening_loc = opening_loc,
4339 .content_loc = content_loc,
4340 .closing_loc = closing_loc,
4341 .unescaped = unescaped
4342 };
4343
4344 return node;
4345}
4346
4351pm_yield_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_location_t lparen_loc, struct pm_arguments_node *arguments, pm_location_t rparen_loc) {
4352 pm_yield_node_t *node = (pm_yield_node_t *) pm_arena_alloc(arena, sizeof(pm_yield_node_t), PRISM_ALIGNOF(pm_yield_node_t));
4353
4354 *node = (pm_yield_node_t) {
4355 .base = { .type = PM_YIELD_NODE, .flags = flags, .node_id = node_id, .location = location },
4356 .keyword_loc = keyword_loc,
4357 .lparen_loc = lparen_loc,
4358 .arguments = arguments,
4359 .rparen_loc = rparen_loc
4360 };
4361
4362 return node;
4363}
#define PRISM_ALIGNOF
Get the alignment requirement of a type.
Definition align.h:15
uint32_t pm_constant_id_t
A constant id is a unique identifier for a constant in the constant pool.
std::string_view constant(const pm_parser_t *parser PRISM_LIFETIMEBOUND, pm_constant_id_t constant_id) noexcept
The name of the constant with the given id, which must not be zero.
Definition parser.hpp:64
pm_visit_result_t(* pm_visit_callback_t)(const pm_node_t *node, void *data)
A callback that is called for each node visited by pm_visit_node and pm_visit_child_nodes.
Definition node.h:65
pm_visit_result_t
The value returned by a visitor callback, which determines where the walk goes next.
Definition node.h:49
@ PM_VISIT_STOP
End the walk without visiting any more nodes.
Definition node.h:57
@ PM_VISIT_DESCEND
Continue the walk by visiting this node's children.
Definition node.h:54
AliasGlobalVariableNode.
Definition ast.h:1165
pm_node_t base
The embedded base node.
Definition ast.h:1167
AliasMethodNode.
Definition ast.h:1212
pm_node_t base
The embedded base node.
Definition ast.h:1214
AlternationPatternNode.
Definition ast.h:1271
pm_node_t base
The embedded base node.
Definition ast.h:1273
AndNode.
Definition ast.h:1318
pm_node_t base
The embedded base node.
Definition ast.h:1320
ArgumentsNode.
Definition ast.h:1378
pm_node_t base
The embedded base node.
Definition ast.h:1380
ArrayNode.
Definition ast.h:1408
pm_node_t base
The embedded base node.
Definition ast.h:1410
ArrayPatternNode.
Definition ast.h:1468
pm_node_t base
The embedded base node.
Definition ast.h:1470
AssocNode.
Definition ast.h:1551
pm_node_t base
The embedded base node.
Definition ast.h:1553
AssocSplatNode.
Definition ast.h:1607
pm_node_t base
The embedded base node.
Definition ast.h:1609
BackReferenceReadNode.
Definition ast.h:1644
pm_node_t base
The embedded base node.
Definition ast.h:1646
BeginNode.
Definition ast.h:1674
pm_node_t base
The embedded base node.
Definition ast.h:1676
BlockArgumentNode.
Definition ast.h:1751
pm_node_t base
The embedded base node.
Definition ast.h:1753
pm_location_t operator_loc
BlockArgumentNode::operator_loc.
Definition ast.h:1773
BlockLocalVariableNode.
Definition ast.h:1791
pm_node_t base
The embedded base node.
Definition ast.h:1793
BlockNode.
Definition ast.h:1818
pm_node_t base
The embedded base node.
Definition ast.h:1820
BlockParameterNode.
Definition ast.h:1893
pm_node_t base
The embedded base node.
Definition ast.h:1895
BlockParametersNode.
Definition ast.h:1946
pm_node_t base
The embedded base node.
Definition ast.h:1948
BreakNode.
Definition ast.h:2019
pm_node_t base
The embedded base node.
Definition ast.h:2021
CallAndWriteNode.
Definition ast.h:2062
pm_node_t base
The embedded base node.
Definition ast.h:2064
CallNode.
Definition ast.h:2170
pm_node_t base
The embedded base node.
Definition ast.h:2172
CallOperatorWriteNode.
Definition ast.h:2295
pm_node_t base
The embedded base node.
Definition ast.h:2297
CallOrWriteNode.
Definition ast.h:2398
pm_node_t base
The embedded base node.
Definition ast.h:2400
CallTargetNode.
Definition ast.h:2499
pm_node_t base
The embedded base node.
Definition ast.h:2501
CapturePatternNode.
Definition ast.h:2556
pm_node_t base
The embedded base node.
Definition ast.h:2558
CaseMatchNode.
Definition ast.h:2605
pm_node_t base
The embedded base node.
Definition ast.h:2607
CaseNode.
Definition ast.h:2674
pm_node_t base
The embedded base node.
Definition ast.h:2676
ClassNode.
Definition ast.h:2741
pm_node_t base
The embedded base node.
Definition ast.h:2743
ClassVariableAndWriteNode.
Definition ast.h:2827
pm_node_t base
The embedded base node.
Definition ast.h:2829
ClassVariableOperatorWriteNode.
Definition ast.h:2884
pm_node_t base
The embedded base node.
Definition ast.h:2886
ClassVariableOrWriteNode.
Definition ast.h:2926
pm_node_t base
The embedded base node.
Definition ast.h:2928
ClassVariableReadNode.
Definition ast.h:2963
pm_node_t base
The embedded base node.
Definition ast.h:2965
ClassVariableTargetNode.
Definition ast.h:2991
pm_node_t base
The embedded base node.
Definition ast.h:2993
ClassVariableWriteNode.
Definition ast.h:3013
pm_node_t base
The embedded base node.
Definition ast.h:3015
ConstantAndWriteNode.
Definition ast.h:3074
pm_node_t base
The embedded base node.
Definition ast.h:3076
A list of constant IDs.
ConstantOperatorWriteNode.
Definition ast.h:3111
pm_node_t base
The embedded base node.
Definition ast.h:3113
ConstantOrWriteNode.
Definition ast.h:3153
pm_node_t base
The embedded base node.
Definition ast.h:3155
ConstantPathAndWriteNode.
Definition ast.h:3190
pm_node_t base
The embedded base node.
Definition ast.h:3192
ConstantPathNode.
Definition ast.h:3222
pm_node_t base
The embedded base node.
Definition ast.h:3224
ConstantPathOperatorWriteNode.
Definition ast.h:3288
pm_node_t base
The embedded base node.
Definition ast.h:3290
ConstantPathOrWriteNode.
Definition ast.h:3325
pm_node_t base
The embedded base node.
Definition ast.h:3327
ConstantPathTargetNode.
Definition ast.h:3357
pm_node_t base
The embedded base node.
Definition ast.h:3359
ConstantPathWriteNode.
Definition ast.h:3400
pm_node_t base
The embedded base node.
Definition ast.h:3402
ConstantReadNode.
Definition ast.h:3450
pm_node_t base
The embedded base node.
Definition ast.h:3452
ConstantTargetNode.
Definition ast.h:3478
pm_node_t base
The embedded base node.
Definition ast.h:3480
ConstantWriteNode.
Definition ast.h:3500
pm_node_t base
The embedded base node.
Definition ast.h:3502
DefNode.
Definition ast.h:3562
pm_node_t base
The embedded base node.
Definition ast.h:3564
DefinedNode.
Definition ast.h:3639
pm_node_t base
The embedded base node.
Definition ast.h:3641
ElseNode.
Definition ast.h:3676
pm_node_t base
The embedded base node.
Definition ast.h:3678
pm_location_t end_keyword_loc
ElseNode::end_keyword_loc.
Definition ast.h:3693
EmbeddedStatementsNode.
Definition ast.h:3708
pm_node_t base
The embedded base node.
Definition ast.h:3710
EmbeddedVariableNode.
Definition ast.h:3740
pm_node_t base
The embedded base node.
Definition ast.h:3742
EnsureNode.
Definition ast.h:3771
pm_node_t base
The embedded base node.
Definition ast.h:3773
pm_location_t end_keyword_loc
EnsureNode::end_keyword_loc.
Definition ast.h:3788
ErrorRecoveryNode.
Definition ast.h:3800
pm_node_t base
The embedded base node.
Definition ast.h:3802
FalseNode.
Definition ast.h:3824
pm_node_t base
The embedded base node.
Definition ast.h:3826
FindPatternNode.
Definition ast.h:3850
pm_node_t base
The embedded base node.
Definition ast.h:3852
FlipFlopNode.
Definition ast.h:3945
pm_node_t base
The embedded base node.
Definition ast.h:3947
FloatNode.
Definition ast.h:3977
pm_node_t base
The embedded base node.
Definition ast.h:3979
ForNode.
Definition ast.h:4001
pm_node_t base
The embedded base node.
Definition ast.h:4003
ForwardingArgumentsNode.
Definition ast.h:4092
pm_node_t base
The embedded base node.
Definition ast.h:4094
ForwardingParameterNode.
Definition ast.h:4110
pm_node_t base
The embedded base node.
Definition ast.h:4112
ForwardingSuperNode.
Definition ast.h:4132
pm_node_t base
The embedded base node.
Definition ast.h:4134
GlobalVariableAndWriteNode.
Definition ast.h:4167
pm_node_t base
The embedded base node.
Definition ast.h:4169
GlobalVariableOperatorWriteNode.
Definition ast.h:4204
pm_node_t base
The embedded base node.
Definition ast.h:4206
GlobalVariableOrWriteNode.
Definition ast.h:4246
pm_node_t base
The embedded base node.
Definition ast.h:4248
GlobalVariableReadNode.
Definition ast.h:4283
pm_node_t base
The embedded base node.
Definition ast.h:4285
GlobalVariableTargetNode.
Definition ast.h:4311
pm_node_t base
The embedded base node.
Definition ast.h:4313
GlobalVariableWriteNode.
Definition ast.h:4333
pm_node_t base
The embedded base node.
Definition ast.h:4335
HashNode.
Definition ast.h:4394
pm_node_t base
The embedded base node.
Definition ast.h:4396
HashPatternNode.
Definition ast.h:4453
pm_node_t base
The embedded base node.
Definition ast.h:4455
IfNode.
Definition ast.h:4541
pm_node_t base
The embedded base node.
Definition ast.h:4543
ImaginaryNode.
Definition ast.h:4646
pm_node_t base
The embedded base node.
Definition ast.h:4648
ImplicitNode.
Definition ast.h:4674
pm_node_t base
The embedded base node.
Definition ast.h:4676
ImplicitRestNode.
Definition ast.h:4705
pm_node_t base
The embedded base node.
Definition ast.h:4707
InNode.
Definition ast.h:4722
pm_node_t base
The embedded base node.
Definition ast.h:4724
IndexAndWriteNode.
Definition ast.h:4765
pm_node_t base
The embedded base node.
Definition ast.h:4767
IndexOperatorWriteNode.
Definition ast.h:4828
pm_node_t base
The embedded base node.
Definition ast.h:4830
IndexOrWriteNode.
Definition ast.h:4896
pm_node_t base
The embedded base node.
Definition ast.h:4898
IndexTargetNode.
Definition ast.h:4967
pm_node_t base
The embedded base node.
Definition ast.h:4969
InstanceVariableAndWriteNode.
Definition ast.h:5009
pm_node_t base
The embedded base node.
Definition ast.h:5011
InstanceVariableOperatorWriteNode.
Definition ast.h:5046
pm_node_t base
The embedded base node.
Definition ast.h:5048
InstanceVariableOrWriteNode.
Definition ast.h:5088
pm_node_t base
The embedded base node.
Definition ast.h:5090
InstanceVariableReadNode.
Definition ast.h:5125
pm_node_t base
The embedded base node.
Definition ast.h:5127
InstanceVariableTargetNode.
Definition ast.h:5153
pm_node_t base
The embedded base node.
Definition ast.h:5155
InstanceVariableWriteNode.
Definition ast.h:5175
pm_node_t base
The embedded base node.
Definition ast.h:5177
IntegerNode.
Definition ast.h:5242
pm_node_t base
The embedded base node.
Definition ast.h:5244
A structure represents an arbitrary-sized integer.
Definition integer.h:16
InterpolatedMatchLastLineNode.
Definition ast.h:5279
pm_node_t base
The embedded base node.
Definition ast.h:5281
InterpolatedRegularExpressionNode.
Definition ast.h:5324
pm_node_t base
The embedded base node.
Definition ast.h:5326
InterpolatedStringNode.
Definition ast.h:5360
pm_node_t base
The embedded base node.
Definition ast.h:5362
InterpolatedSymbolNode.
Definition ast.h:5392
pm_node_t base
The embedded base node.
Definition ast.h:5394
InterpolatedXStringNode.
Definition ast.h:5424
pm_node_t base
The embedded base node.
Definition ast.h:5426
ItLocalVariableReadNode.
Definition ast.h:5456
pm_node_t base
The embedded base node.
Definition ast.h:5458
ItParametersNode.
Definition ast.h:5473
pm_node_t base
The embedded base node.
Definition ast.h:5475
KeywordHashNode.
Definition ast.h:5493
pm_node_t base
The embedded base node.
Definition ast.h:5495
KeywordRestParameterNode.
Definition ast.h:5519
pm_node_t base
The embedded base node.
Definition ast.h:5521
LambdaNode.
Definition ast.h:5551
pm_node_t base
The embedded base node.
Definition ast.h:5553
LocalVariableAndWriteNode.
Definition ast.h:5598
pm_node_t base
The embedded base node.
Definition ast.h:5600
LocalVariableOperatorWriteNode.
Definition ast.h:5640
pm_node_t base
The embedded base node.
Definition ast.h:5642
LocalVariableOrWriteNode.
Definition ast.h:5687
pm_node_t base
The embedded base node.
Definition ast.h:5689
LocalVariableReadNode.
Definition ast.h:5729
pm_node_t base
The embedded base node.
Definition ast.h:5731
LocalVariableTargetNode.
Definition ast.h:5777
pm_node_t base
The embedded base node.
Definition ast.h:5779
LocalVariableWriteNode.
Definition ast.h:5804
pm_node_t base
The embedded base node.
Definition ast.h:5806
This struct represents a slice in the source code, defined by an offset and a length.
Definition ast.h:579
MatchLastLineNode.
Definition ast.h:5895
pm_node_t base
The embedded base node.
Definition ast.h:5897
MatchPredicateNode.
Definition ast.h:5932
pm_node_t base
The embedded base node.
Definition ast.h:5934
MatchRequiredNode.
Definition ast.h:5964
pm_node_t base
The embedded base node.
Definition ast.h:5966
MatchWriteNode.
Definition ast.h:6050
pm_node_t base
The embedded base node.
Definition ast.h:6052
ModuleNode.
Definition ast.h:6077
pm_node_t base
The embedded base node.
Definition ast.h:6079
MultiTargetNode.
Definition ast.h:6129
pm_node_t base
The embedded base node.
Definition ast.h:6131
MultiWriteNode.
Definition ast.h:6211
pm_node_t base
The embedded base node.
Definition ast.h:6213
NextNode.
Definition ast.h:6313
pm_node_t base
The embedded base node.
Definition ast.h:6315
NilNode.
Definition ast.h:6340
pm_node_t base
The embedded base node.
Definition ast.h:6342
NoBlockParameterNode.
Definition ast.h:6358
pm_node_t base
The embedded base node.
Definition ast.h:6360
NoKeywordsParameterNode.
Definition ast.h:6386
pm_node_t base
The embedded base node.
Definition ast.h:6388
A list of nodes in the source, most often used for lists of children.
Definition ast.h:592
size_t size
The number of nodes in the list.
Definition ast.h:594
struct pm_node ** nodes
The nodes in the list.
Definition ast.h:600
size_t capacity
The capacity of the list that has been allocated.
Definition ast.h:597
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1090
pm_node_type_t type
This represents the type of the node.
Definition ast.h:1095
NumberedParametersNode.
Definition ast.h:6413
pm_node_t base
The embedded base node.
Definition ast.h:6415
NumberedReferenceReadNode.
Definition ast.h:6435
pm_node_t base
The embedded base node.
Definition ast.h:6437
OptionalKeywordParameterNode.
Definition ast.h:6469
pm_node_t base
The embedded base node.
Definition ast.h:6471
OptionalParameterNode.
Definition ast.h:6505
pm_node_t base
The embedded base node.
Definition ast.h:6507
OrNode.
Definition ast.h:6542
pm_node_t base
The embedded base node.
Definition ast.h:6544
ParametersNode.
Definition ast.h:6596
pm_node_t base
The embedded base node.
Definition ast.h:6598
ParenthesesNode.
Definition ast.h:6651
pm_node_t base
The embedded base node.
Definition ast.h:6653
PinnedExpressionNode.
Definition ast.h:6683
pm_node_t base
The embedded base node.
Definition ast.h:6685
PinnedVariableNode.
Definition ast.h:6740
pm_node_t base
The embedded base node.
Definition ast.h:6742
PostExecutionNode.
Definition ast.h:6777
pm_node_t base
The embedded base node.
Definition ast.h:6779
PreExecutionNode.
Definition ast.h:6814
pm_node_t base
The embedded base node.
Definition ast.h:6816
ProgramNode.
Definition ast.h:6848
pm_node_t base
The embedded base node.
Definition ast.h:6850
RangeNode.
Definition ast.h:6881
pm_node_t base
The embedded base node.
Definition ast.h:6883
RationalNode.
Definition ast.h:6938
pm_node_t base
The embedded base node.
Definition ast.h:6940
RedoNode.
Definition ast.h:6973
pm_node_t base
The embedded base node.
Definition ast.h:6975
RegularExpressionNode.
Definition ast.h:7003
pm_node_t base
The embedded base node.
Definition ast.h:7005
RequiredKeywordParameterNode.
Definition ast.h:7044
pm_node_t base
The embedded base node.
Definition ast.h:7046
RequiredParameterNode.
Definition ast.h:7075
pm_node_t base
The embedded base node.
Definition ast.h:7077
RescueModifierNode.
Definition ast.h:7097
pm_node_t base
The embedded base node.
Definition ast.h:7099
RescueNode.
Definition ast.h:7134
pm_node_t base
The embedded base node.
Definition ast.h:7136
RestParameterNode.
Definition ast.h:7190
pm_node_t base
The embedded base node.
Definition ast.h:7192
RetryNode.
Definition ast.h:7222
pm_node_t base
The embedded base node.
Definition ast.h:7224
ReturnNode.
Definition ast.h:7239
pm_node_t base
The embedded base node.
Definition ast.h:7241
SelfNode.
Definition ast.h:7266
pm_node_t base
The embedded base node.
Definition ast.h:7268
ShareableConstantNode.
Definition ast.h:7289
pm_node_t base
The embedded base node.
Definition ast.h:7291
SingletonClassNode.
Definition ast.h:7313
pm_node_t base
The embedded base node.
Definition ast.h:7315
SourceEncodingNode.
Definition ast.h:7360
pm_node_t base
The embedded base node.
Definition ast.h:7362
SourceFileNode.
Definition ast.h:7383
pm_node_t base
The embedded base node.
Definition ast.h:7385
SourceLineNode.
Definition ast.h:7407
pm_node_t base
The embedded base node.
Definition ast.h:7409
SplatNode.
Definition ast.h:7424
pm_node_t base
The embedded base node.
Definition ast.h:7426
StatementsNode.
Definition ast.h:7451
pm_node_t base
The embedded base node.
Definition ast.h:7453
StringNode.
Definition ast.h:7485
pm_node_t base
The embedded base node.
Definition ast.h:7487
A view of a sequence of bytes.
Definition stringy.h:23
SuperNode.
Definition ast.h:7527
pm_node_t base
The embedded base node.
Definition ast.h:7529
SymbolNode.
Definition ast.h:7579
pm_node_t base
The embedded base node.
Definition ast.h:7581
TrueNode.
Definition ast.h:7616
pm_node_t base
The embedded base node.
Definition ast.h:7618
UndefNode.
Definition ast.h:7633
pm_node_t base
The embedded base node.
Definition ast.h:7635
UnlessNode.
Definition ast.h:7663
pm_node_t base
The embedded base node.
Definition ast.h:7665
UntilNode.
Definition ast.h:7753
pm_node_t base
The embedded base node.
Definition ast.h:7755
WhenNode.
Definition ast.h:7797
pm_node_t base
The embedded base node.
Definition ast.h:7799
WhileNode.
Definition ast.h:7840
pm_node_t base
The embedded base node.
Definition ast.h:7842
XStringNode.
Definition ast.h:7886
pm_node_t base
The embedded base node.
Definition ast.h:7888
YieldNode.
Definition ast.h:7923
pm_node_t base
The embedded base node.
Definition ast.h:7925