9#line 2 "prism/templates/src/node.c.erb"
10#include "prism/internal/node.h"
12#include "prism/internal/arena.h"
13#include "prism/internal/oom.h"
23 uint32_t requested_size = list->size + size;
26 if (requested_size < list->size) PRISM_OOM();
29 if (requested_size <= list->capacity)
return;
32 uint32_t next_capacity = list->capacity == 0 ? 4 : list->capacity * 2;
35 while (requested_size > next_capacity) {
36 if (next_capacity == 0) PRISM_OOM();
41 pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, next_capacity);
45 memcpy(nodes, list->nodes, list->size *
sizeof(pm_node_t *));
49 list->capacity = next_capacity;
58 pm_scratch_node_list_grow(arena, list, 1);
59 list->nodes[list->size++] = node;
67 if (other->size > 0) {
68 pm_scratch_node_list_grow(arena, list, other->size);
69 memcpy(list->nodes + list->size, other->nodes, other->size *
sizeof(pm_node_t *));
70 list->size += other->size;
80pm_node_list_append(
pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
81 if (list->
size == 0) {
82 *list = pm_node_list_single(arena, node);
86 list->
nodes = PM_ARENA_REALLOC(arena, list->
nodes,
sizeof(pm_node_t *) * (list->
size + 1),
sizeof(pm_node_t *) * list->
size, pm_node_t *);
96static pm_node_chunk_t *
98 pm_node_chunk_t *batch = (pm_node_chunk_t *) pm_arena_alloc_aligned(chunks->arena, PM_NODE_CHUNK_BATCH * PM_NODE_CHUNK_SIZE, PM_NODE_CHUNK_SIZE);
100 chunks->next = batch + 1;
101 chunks->end = batch + PM_NODE_CHUNK_BATCH;
111 pm_node_chunk_t *chunk = chunks->free;
114 chunks->free = chunk->prev;
118 if (chunks->next != chunks->end)
return chunks->next++;
119 return pm_node_chunks_carve(chunks);
128pm_node_list_open_append_slow(
pm_node_chunks_t *chunks, pm_node_list_t *list, pm_node_t *node) {
129 pm_node_chunk_t *chunk = pm_node_chunk_acquire(chunks);
130 chunk->prev = list->
nodes == NULL ? NULL : PM_NODE_CHUNK_OF(list->
nodes - 1);
131 chunk->slots[0] = node;
133 list->
nodes = &chunk->slots[1];
144 if (list->
size == 0)
return;
146 pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, list->
size);
147 pm_node_chunk_t *last = PM_NODE_CHUNK_OF(list->
nodes - 1);
148 pm_node_chunk_t *chunk = last;
150 size_t count = (size_t) (list->
nodes - chunk->slots);
151 size_t offset = list->
size;
155 memcpy(nodes + offset, chunk->slots, count *
sizeof(pm_node_t *));
157 if (chunk->prev == NULL)
break;
159 count = PM_NODE_CHUNK_SLOTS;
162 chunk->prev = chunks->free;
172pm_node_list_single(
pm_arena_t *arena, pm_node_t *node) {
173 pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, 1);
175 return (pm_node_list_t) { .size = 1, .nodes = nodes };
183pm_node_list_prepend_finalized(
pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
184 pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, list->
size + 1);
187 if (list->
size > 0) {
188 memcpy(nodes + 1, list->
nodes,
sizeof(pm_node_t *) * list->
size);
199pm_node_type(pm_node_type_t node_type)
202 case PM_ALIAS_GLOBAL_VARIABLE_NODE:
203 return "PM_ALIAS_GLOBAL_VARIABLE_NODE";
204 case PM_ALIAS_METHOD_NODE:
205 return "PM_ALIAS_METHOD_NODE";
206 case PM_ALTERNATION_PATTERN_NODE:
207 return "PM_ALTERNATION_PATTERN_NODE";
209 return "PM_AND_NODE";
210 case PM_ARGUMENTS_NODE:
211 return "PM_ARGUMENTS_NODE";
213 return "PM_ARRAY_NODE";
214 case PM_ARRAY_PATTERN_NODE:
215 return "PM_ARRAY_PATTERN_NODE";
217 return "PM_ASSOC_NODE";
218 case PM_ASSOC_SPLAT_NODE:
219 return "PM_ASSOC_SPLAT_NODE";
220 case PM_BACK_REFERENCE_READ_NODE:
221 return "PM_BACK_REFERENCE_READ_NODE";
223 return "PM_BEGIN_NODE";
224 case PM_BLOCK_ARGUMENT_NODE:
225 return "PM_BLOCK_ARGUMENT_NODE";
226 case PM_BLOCK_LOCAL_VARIABLE_NODE:
227 return "PM_BLOCK_LOCAL_VARIABLE_NODE";
229 return "PM_BLOCK_NODE";
230 case PM_BLOCK_PARAMETER_NODE:
231 return "PM_BLOCK_PARAMETER_NODE";
232 case PM_BLOCK_PARAMETERS_NODE:
233 return "PM_BLOCK_PARAMETERS_NODE";
235 return "PM_BREAK_NODE";
236 case PM_CALL_AND_WRITE_NODE:
237 return "PM_CALL_AND_WRITE_NODE";
239 return "PM_CALL_NODE";
240 case PM_CALL_OPERATOR_WRITE_NODE:
241 return "PM_CALL_OPERATOR_WRITE_NODE";
242 case PM_CALL_OR_WRITE_NODE:
243 return "PM_CALL_OR_WRITE_NODE";
244 case PM_CALL_TARGET_NODE:
245 return "PM_CALL_TARGET_NODE";
246 case PM_CAPTURE_PATTERN_NODE:
247 return "PM_CAPTURE_PATTERN_NODE";
248 case PM_CASE_MATCH_NODE:
249 return "PM_CASE_MATCH_NODE";
251 return "PM_CASE_NODE";
253 return "PM_CLASS_NODE";
254 case PM_CLASS_VARIABLE_AND_WRITE_NODE:
255 return "PM_CLASS_VARIABLE_AND_WRITE_NODE";
256 case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE:
257 return "PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE";
258 case PM_CLASS_VARIABLE_OR_WRITE_NODE:
259 return "PM_CLASS_VARIABLE_OR_WRITE_NODE";
260 case PM_CLASS_VARIABLE_READ_NODE:
261 return "PM_CLASS_VARIABLE_READ_NODE";
262 case PM_CLASS_VARIABLE_TARGET_NODE:
263 return "PM_CLASS_VARIABLE_TARGET_NODE";
264 case PM_CLASS_VARIABLE_WRITE_NODE:
265 return "PM_CLASS_VARIABLE_WRITE_NODE";
266 case PM_CONSTANT_AND_WRITE_NODE:
267 return "PM_CONSTANT_AND_WRITE_NODE";
268 case PM_CONSTANT_OPERATOR_WRITE_NODE:
269 return "PM_CONSTANT_OPERATOR_WRITE_NODE";
270 case PM_CONSTANT_OR_WRITE_NODE:
271 return "PM_CONSTANT_OR_WRITE_NODE";
272 case PM_CONSTANT_PATH_AND_WRITE_NODE:
273 return "PM_CONSTANT_PATH_AND_WRITE_NODE";
274 case PM_CONSTANT_PATH_NODE:
275 return "PM_CONSTANT_PATH_NODE";
276 case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE:
277 return "PM_CONSTANT_PATH_OPERATOR_WRITE_NODE";
278 case PM_CONSTANT_PATH_OR_WRITE_NODE:
279 return "PM_CONSTANT_PATH_OR_WRITE_NODE";
280 case PM_CONSTANT_PATH_TARGET_NODE:
281 return "PM_CONSTANT_PATH_TARGET_NODE";
282 case PM_CONSTANT_PATH_WRITE_NODE:
283 return "PM_CONSTANT_PATH_WRITE_NODE";
284 case PM_CONSTANT_READ_NODE:
285 return "PM_CONSTANT_READ_NODE";
286 case PM_CONSTANT_TARGET_NODE:
287 return "PM_CONSTANT_TARGET_NODE";
288 case PM_CONSTANT_WRITE_NODE:
289 return "PM_CONSTANT_WRITE_NODE";
291 return "PM_DEF_NODE";
292 case PM_DEFINED_NODE:
293 return "PM_DEFINED_NODE";
295 return "PM_ELSE_NODE";
296 case PM_EMBEDDED_STATEMENTS_NODE:
297 return "PM_EMBEDDED_STATEMENTS_NODE";
298 case PM_EMBEDDED_VARIABLE_NODE:
299 return "PM_EMBEDDED_VARIABLE_NODE";
301 return "PM_ENSURE_NODE";
302 case PM_ERROR_RECOVERY_NODE:
303 return "PM_ERROR_RECOVERY_NODE";
305 return "PM_FALSE_NODE";
306 case PM_FIND_PATTERN_NODE:
307 return "PM_FIND_PATTERN_NODE";
308 case PM_FLIP_FLOP_NODE:
309 return "PM_FLIP_FLOP_NODE";
311 return "PM_FLOAT_NODE";
313 return "PM_FOR_NODE";
314 case PM_FORWARDING_ARGUMENTS_NODE:
315 return "PM_FORWARDING_ARGUMENTS_NODE";
316 case PM_FORWARDING_PARAMETER_NODE:
317 return "PM_FORWARDING_PARAMETER_NODE";
318 case PM_FORWARDING_SUPER_NODE:
319 return "PM_FORWARDING_SUPER_NODE";
320 case PM_GLOBAL_VARIABLE_AND_WRITE_NODE:
321 return "PM_GLOBAL_VARIABLE_AND_WRITE_NODE";
322 case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE:
323 return "PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE";
324 case PM_GLOBAL_VARIABLE_OR_WRITE_NODE:
325 return "PM_GLOBAL_VARIABLE_OR_WRITE_NODE";
326 case PM_GLOBAL_VARIABLE_READ_NODE:
327 return "PM_GLOBAL_VARIABLE_READ_NODE";
328 case PM_GLOBAL_VARIABLE_TARGET_NODE:
329 return "PM_GLOBAL_VARIABLE_TARGET_NODE";
330 case PM_GLOBAL_VARIABLE_WRITE_NODE:
331 return "PM_GLOBAL_VARIABLE_WRITE_NODE";
333 return "PM_HASH_NODE";
334 case PM_HASH_PATTERN_NODE:
335 return "PM_HASH_PATTERN_NODE";
338 case PM_IMAGINARY_NODE:
339 return "PM_IMAGINARY_NODE";
340 case PM_IMPLICIT_NODE:
341 return "PM_IMPLICIT_NODE";
342 case PM_IMPLICIT_REST_NODE:
343 return "PM_IMPLICIT_REST_NODE";
346 case PM_INDEX_AND_WRITE_NODE:
347 return "PM_INDEX_AND_WRITE_NODE";
348 case PM_INDEX_OPERATOR_WRITE_NODE:
349 return "PM_INDEX_OPERATOR_WRITE_NODE";
350 case PM_INDEX_OR_WRITE_NODE:
351 return "PM_INDEX_OR_WRITE_NODE";
352 case PM_INDEX_TARGET_NODE:
353 return "PM_INDEX_TARGET_NODE";
354 case PM_INSTANCE_VARIABLE_AND_WRITE_NODE:
355 return "PM_INSTANCE_VARIABLE_AND_WRITE_NODE";
356 case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE:
357 return "PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE";
358 case PM_INSTANCE_VARIABLE_OR_WRITE_NODE:
359 return "PM_INSTANCE_VARIABLE_OR_WRITE_NODE";
360 case PM_INSTANCE_VARIABLE_READ_NODE:
361 return "PM_INSTANCE_VARIABLE_READ_NODE";
362 case PM_INSTANCE_VARIABLE_TARGET_NODE:
363 return "PM_INSTANCE_VARIABLE_TARGET_NODE";
364 case PM_INSTANCE_VARIABLE_WRITE_NODE:
365 return "PM_INSTANCE_VARIABLE_WRITE_NODE";
366 case PM_INTEGER_NODE:
367 return "PM_INTEGER_NODE";
368 case PM_INTERPOLATED_MATCH_LAST_LINE_NODE:
369 return "PM_INTERPOLATED_MATCH_LAST_LINE_NODE";
370 case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
371 return "PM_INTERPOLATED_REGULAR_EXPRESSION_NODE";
372 case PM_INTERPOLATED_STRING_NODE:
373 return "PM_INTERPOLATED_STRING_NODE";
374 case PM_INTERPOLATED_SYMBOL_NODE:
375 return "PM_INTERPOLATED_SYMBOL_NODE";
376 case PM_INTERPOLATED_X_STRING_NODE:
377 return "PM_INTERPOLATED_X_STRING_NODE";
378 case PM_IT_LOCAL_VARIABLE_READ_NODE:
379 return "PM_IT_LOCAL_VARIABLE_READ_NODE";
380 case PM_IT_PARAMETERS_NODE:
381 return "PM_IT_PARAMETERS_NODE";
382 case PM_KEYWORD_HASH_NODE:
383 return "PM_KEYWORD_HASH_NODE";
384 case PM_KEYWORD_REST_PARAMETER_NODE:
385 return "PM_KEYWORD_REST_PARAMETER_NODE";
387 return "PM_LAMBDA_NODE";
388 case PM_LOCAL_VARIABLE_AND_WRITE_NODE:
389 return "PM_LOCAL_VARIABLE_AND_WRITE_NODE";
390 case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE:
391 return "PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE";
392 case PM_LOCAL_VARIABLE_OR_WRITE_NODE:
393 return "PM_LOCAL_VARIABLE_OR_WRITE_NODE";
394 case PM_LOCAL_VARIABLE_READ_NODE:
395 return "PM_LOCAL_VARIABLE_READ_NODE";
396 case PM_LOCAL_VARIABLE_TARGET_NODE:
397 return "PM_LOCAL_VARIABLE_TARGET_NODE";
398 case PM_LOCAL_VARIABLE_WRITE_NODE:
399 return "PM_LOCAL_VARIABLE_WRITE_NODE";
400 case PM_MATCH_LAST_LINE_NODE:
401 return "PM_MATCH_LAST_LINE_NODE";
402 case PM_MATCH_PREDICATE_NODE:
403 return "PM_MATCH_PREDICATE_NODE";
404 case PM_MATCH_REQUIRED_NODE:
405 return "PM_MATCH_REQUIRED_NODE";
406 case PM_MATCH_WRITE_NODE:
407 return "PM_MATCH_WRITE_NODE";
409 return "PM_MODULE_NODE";
410 case PM_MULTI_TARGET_NODE:
411 return "PM_MULTI_TARGET_NODE";
412 case PM_MULTI_WRITE_NODE:
413 return "PM_MULTI_WRITE_NODE";
415 return "PM_NEXT_NODE";
417 return "PM_NIL_NODE";
418 case PM_NO_BLOCK_PARAMETER_NODE:
419 return "PM_NO_BLOCK_PARAMETER_NODE";
420 case PM_NO_KEYWORDS_PARAMETER_NODE:
421 return "PM_NO_KEYWORDS_PARAMETER_NODE";
422 case PM_NUMBERED_PARAMETERS_NODE:
423 return "PM_NUMBERED_PARAMETERS_NODE";
424 case PM_NUMBERED_REFERENCE_READ_NODE:
425 return "PM_NUMBERED_REFERENCE_READ_NODE";
426 case PM_OPTIONAL_KEYWORD_PARAMETER_NODE:
427 return "PM_OPTIONAL_KEYWORD_PARAMETER_NODE";
428 case PM_OPTIONAL_PARAMETER_NODE:
429 return "PM_OPTIONAL_PARAMETER_NODE";
432 case PM_PARAMETERS_NODE:
433 return "PM_PARAMETERS_NODE";
434 case PM_PARENTHESES_NODE:
435 return "PM_PARENTHESES_NODE";
436 case PM_PINNED_EXPRESSION_NODE:
437 return "PM_PINNED_EXPRESSION_NODE";
438 case PM_PINNED_VARIABLE_NODE:
439 return "PM_PINNED_VARIABLE_NODE";
440 case PM_POST_EXECUTION_NODE:
441 return "PM_POST_EXECUTION_NODE";
442 case PM_PRE_EXECUTION_NODE:
443 return "PM_PRE_EXECUTION_NODE";
444 case PM_PROGRAM_NODE:
445 return "PM_PROGRAM_NODE";
447 return "PM_RANGE_NODE";
448 case PM_RATIONAL_NODE:
449 return "PM_RATIONAL_NODE";
451 return "PM_REDO_NODE";
452 case PM_REGULAR_EXPRESSION_NODE:
453 return "PM_REGULAR_EXPRESSION_NODE";
454 case PM_REQUIRED_KEYWORD_PARAMETER_NODE:
455 return "PM_REQUIRED_KEYWORD_PARAMETER_NODE";
456 case PM_REQUIRED_PARAMETER_NODE:
457 return "PM_REQUIRED_PARAMETER_NODE";
458 case PM_RESCUE_MODIFIER_NODE:
459 return "PM_RESCUE_MODIFIER_NODE";
461 return "PM_RESCUE_NODE";
462 case PM_REST_PARAMETER_NODE:
463 return "PM_REST_PARAMETER_NODE";
465 return "PM_RETRY_NODE";
467 return "PM_RETURN_NODE";
469 return "PM_SELF_NODE";
470 case PM_SHAREABLE_CONSTANT_NODE:
471 return "PM_SHAREABLE_CONSTANT_NODE";
472 case PM_SINGLETON_CLASS_NODE:
473 return "PM_SINGLETON_CLASS_NODE";
474 case PM_SOURCE_ENCODING_NODE:
475 return "PM_SOURCE_ENCODING_NODE";
476 case PM_SOURCE_FILE_NODE:
477 return "PM_SOURCE_FILE_NODE";
478 case PM_SOURCE_LINE_NODE:
479 return "PM_SOURCE_LINE_NODE";
481 return "PM_SPLAT_NODE";
482 case PM_STATEMENTS_NODE:
483 return "PM_STATEMENTS_NODE";
485 return "PM_STRING_NODE";
487 return "PM_SUPER_NODE";
489 return "PM_SYMBOL_NODE";
491 return "PM_TRUE_NODE";
493 return "PM_UNDEF_NODE";
495 return "PM_UNLESS_NODE";
497 return "PM_UNTIL_NODE";
499 return "PM_WHEN_NODE";
501 return "PM_WHILE_NODE";
502 case PM_X_STRING_NODE:
503 return "PM_X_STRING_NODE";
505 return "PM_YIELD_NODE";
520 if (result ==
PM_VISIT_DESCEND)
return pm_visit_child_nodes(node, visitor, data);
532 switch (PM_NODE_TYPE(node)) {
533 case PM_ALIAS_GLOBAL_VARIABLE_NODE: {
534 const pm_alias_global_variable_node_t *cast = (
const pm_alias_global_variable_node_t *) node;
537 if (!pm_visit_node((
const pm_node_t *) cast->new_name, visitor, data))
return false;
540 if (!pm_visit_node((
const pm_node_t *) cast->old_name, visitor, data))
return false;
544 case PM_ALIAS_METHOD_NODE: {
545 const pm_alias_method_node_t *cast = (
const pm_alias_method_node_t *) node;
548 if (!pm_visit_node((
const pm_node_t *) cast->new_name, visitor, data))
return false;
551 if (!pm_visit_node((
const pm_node_t *) cast->old_name, visitor, data))
return false;
555 case PM_ALTERNATION_PATTERN_NODE: {
556 const pm_alternation_pattern_node_t *cast = (
const pm_alternation_pattern_node_t *) node;
559 if (!pm_visit_node((
const pm_node_t *) cast->left, visitor, data))
return false;
562 if (!pm_visit_node((
const pm_node_t *) cast->right, visitor, data))
return false;
567 const pm_and_node_t *cast = (
const pm_and_node_t *) node;
570 if (!pm_visit_node((
const pm_node_t *) cast->left, visitor, data))
return false;
573 if (!pm_visit_node((
const pm_node_t *) cast->right, visitor, data))
return false;
577 case PM_ARGUMENTS_NODE: {
578 const pm_arguments_node_t *cast = (
const pm_arguments_node_t *) node;
581 const pm_node_list_t *arguments = &cast->arguments;
582 for (
size_t index = 0; index < arguments->
size; index++) {
583 if (!pm_visit_node(arguments->
nodes[index], visitor, data))
return false;
588 case PM_ARRAY_NODE: {
589 const pm_array_node_t *cast = (
const pm_array_node_t *) node;
592 const pm_node_list_t *elements = &cast->elements;
593 for (
size_t index = 0; index < elements->
size; index++) {
594 if (!pm_visit_node(elements->
nodes[index], visitor, data))
return false;
599 case PM_ARRAY_PATTERN_NODE: {
600 const pm_array_pattern_node_t *cast = (
const pm_array_pattern_node_t *) node;
603 if (cast->constant != NULL && !pm_visit_node((
const pm_node_t *) cast->constant, visitor, data))
return false;
606 const pm_node_list_t *requireds = &cast->requireds;
607 for (
size_t index = 0; index < requireds->
size; index++) {
608 if (!pm_visit_node(requireds->
nodes[index], visitor, data))
return false;
612 if (cast->rest != NULL && !pm_visit_node((
const pm_node_t *) cast->rest, visitor, data))
return false;
615 const pm_node_list_t *posts = &cast->posts;
616 for (
size_t index = 0; index < posts->
size; index++) {
617 if (!pm_visit_node(posts->
nodes[index], visitor, data))
return false;
622 case PM_ASSOC_NODE: {
623 const pm_assoc_node_t *cast = (
const pm_assoc_node_t *) node;
626 if (!pm_visit_node((
const pm_node_t *) cast->key, visitor, data))
return false;
629 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
633 case PM_ASSOC_SPLAT_NODE: {
634 const pm_assoc_splat_node_t *cast = (
const pm_assoc_splat_node_t *) node;
637 if (cast->value != NULL && !pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
641 case PM_BACK_REFERENCE_READ_NODE:
643 case PM_BEGIN_NODE: {
644 const pm_begin_node_t *cast = (
const pm_begin_node_t *) node;
647 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
650 if (cast->rescue_clause != NULL && !pm_visit_node((
const pm_node_t *) cast->rescue_clause, visitor, data))
return false;
653 if (cast->else_clause != NULL && !pm_visit_node((
const pm_node_t *) cast->else_clause, visitor, data))
return false;
656 if (cast->ensure_clause != NULL && !pm_visit_node((
const pm_node_t *) cast->ensure_clause, visitor, data))
return false;
660 case PM_BLOCK_ARGUMENT_NODE: {
661 const pm_block_argument_node_t *cast = (
const pm_block_argument_node_t *) node;
664 if (cast->expression != NULL && !pm_visit_node((
const pm_node_t *) cast->expression, visitor, data))
return false;
668 case PM_BLOCK_LOCAL_VARIABLE_NODE:
670 case PM_BLOCK_NODE: {
671 const pm_block_node_t *cast = (
const pm_block_node_t *) node;
674 if (cast->parameters != NULL && !pm_visit_node((
const pm_node_t *) cast->parameters, visitor, data))
return false;
677 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
681 case PM_BLOCK_PARAMETER_NODE:
683 case PM_BLOCK_PARAMETERS_NODE: {
684 const pm_block_parameters_node_t *cast = (
const pm_block_parameters_node_t *) node;
687 if (cast->parameters != NULL && !pm_visit_node((
const pm_node_t *) cast->parameters, visitor, data))
return false;
690 const pm_node_list_t *locals = &cast->locals;
691 for (
size_t index = 0; index < locals->
size; index++) {
692 if (!pm_visit_node(locals->
nodes[index], visitor, data))
return false;
697 case PM_BREAK_NODE: {
698 const pm_break_node_t *cast = (
const pm_break_node_t *) node;
701 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
705 case PM_CALL_AND_WRITE_NODE: {
706 const pm_call_and_write_node_t *cast = (
const pm_call_and_write_node_t *) node;
709 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
712 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
717 const pm_call_node_t *cast = (
const pm_call_node_t *) node;
720 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
723 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
726 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
730 case PM_CALL_OPERATOR_WRITE_NODE: {
731 const pm_call_operator_write_node_t *cast = (
const pm_call_operator_write_node_t *) node;
734 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
737 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
741 case PM_CALL_OR_WRITE_NODE: {
742 const pm_call_or_write_node_t *cast = (
const pm_call_or_write_node_t *) node;
745 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
748 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
752 case PM_CALL_TARGET_NODE: {
753 const pm_call_target_node_t *cast = (
const pm_call_target_node_t *) node;
756 if (!pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
760 case PM_CAPTURE_PATTERN_NODE: {
761 const pm_capture_pattern_node_t *cast = (
const pm_capture_pattern_node_t *) node;
764 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
767 if (!pm_visit_node((
const pm_node_t *) cast->target, visitor, data))
return false;
771 case PM_CASE_MATCH_NODE: {
772 const pm_case_match_node_t *cast = (
const pm_case_match_node_t *) node;
775 if (cast->predicate != NULL && !pm_visit_node((
const pm_node_t *) cast->predicate, visitor, data))
return false;
778 const pm_node_list_t *conditions = &cast->conditions;
779 for (
size_t index = 0; index < conditions->
size; index++) {
780 if (!pm_visit_node(conditions->
nodes[index], visitor, data))
return false;
784 if (cast->else_clause != NULL && !pm_visit_node((
const pm_node_t *) cast->else_clause, visitor, data))
return false;
789 const pm_case_node_t *cast = (
const pm_case_node_t *) node;
792 if (cast->predicate != NULL && !pm_visit_node((
const pm_node_t *) cast->predicate, visitor, data))
return false;
795 const pm_node_list_t *conditions = &cast->conditions;
796 for (
size_t index = 0; index < conditions->
size; index++) {
797 if (!pm_visit_node(conditions->
nodes[index], visitor, data))
return false;
801 if (cast->else_clause != NULL && !pm_visit_node((
const pm_node_t *) cast->else_clause, visitor, data))
return false;
805 case PM_CLASS_NODE: {
806 const pm_class_node_t *cast = (
const pm_class_node_t *) node;
809 if (!pm_visit_node((
const pm_node_t *) cast->constant_path, visitor, data))
return false;
812 if (cast->superclass != NULL && !pm_visit_node((
const pm_node_t *) cast->superclass, visitor, data))
return false;
815 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
819 case PM_CLASS_VARIABLE_AND_WRITE_NODE: {
820 const pm_class_variable_and_write_node_t *cast = (
const pm_class_variable_and_write_node_t *) node;
823 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
827 case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
828 const pm_class_variable_operator_write_node_t *cast = (
const pm_class_variable_operator_write_node_t *) node;
831 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
835 case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
836 const pm_class_variable_or_write_node_t *cast = (
const pm_class_variable_or_write_node_t *) node;
839 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
843 case PM_CLASS_VARIABLE_READ_NODE:
845 case PM_CLASS_VARIABLE_TARGET_NODE:
847 case PM_CLASS_VARIABLE_WRITE_NODE: {
848 const pm_class_variable_write_node_t *cast = (
const pm_class_variable_write_node_t *) node;
851 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
855 case PM_CONSTANT_AND_WRITE_NODE: {
856 const pm_constant_and_write_node_t *cast = (
const pm_constant_and_write_node_t *) node;
859 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
863 case PM_CONSTANT_OPERATOR_WRITE_NODE: {
864 const pm_constant_operator_write_node_t *cast = (
const pm_constant_operator_write_node_t *) node;
867 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
871 case PM_CONSTANT_OR_WRITE_NODE: {
872 const pm_constant_or_write_node_t *cast = (
const pm_constant_or_write_node_t *) node;
875 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
879 case PM_CONSTANT_PATH_AND_WRITE_NODE: {
880 const pm_constant_path_and_write_node_t *cast = (
const pm_constant_path_and_write_node_t *) node;
883 if (!pm_visit_node((
const pm_node_t *) cast->target, visitor, data))
return false;
886 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
890 case PM_CONSTANT_PATH_NODE: {
891 const pm_constant_path_node_t *cast = (
const pm_constant_path_node_t *) node;
894 if (cast->parent != NULL && !pm_visit_node((
const pm_node_t *) cast->parent, visitor, data))
return false;
898 case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
899 const pm_constant_path_operator_write_node_t *cast = (
const pm_constant_path_operator_write_node_t *) node;
902 if (!pm_visit_node((
const pm_node_t *) cast->target, visitor, data))
return false;
905 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
909 case PM_CONSTANT_PATH_OR_WRITE_NODE: {
910 const pm_constant_path_or_write_node_t *cast = (
const pm_constant_path_or_write_node_t *) node;
913 if (!pm_visit_node((
const pm_node_t *) cast->target, visitor, data))
return false;
916 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
920 case PM_CONSTANT_PATH_TARGET_NODE: {
921 const pm_constant_path_target_node_t *cast = (
const pm_constant_path_target_node_t *) node;
924 if (cast->parent != NULL && !pm_visit_node((
const pm_node_t *) cast->parent, visitor, data))
return false;
928 case PM_CONSTANT_PATH_WRITE_NODE: {
929 const pm_constant_path_write_node_t *cast = (
const pm_constant_path_write_node_t *) node;
932 if (!pm_visit_node((
const pm_node_t *) cast->target, visitor, data))
return false;
935 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
939 case PM_CONSTANT_READ_NODE:
941 case PM_CONSTANT_TARGET_NODE:
943 case PM_CONSTANT_WRITE_NODE: {
944 const pm_constant_write_node_t *cast = (
const pm_constant_write_node_t *) node;
947 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
952 const pm_def_node_t *cast = (
const pm_def_node_t *) node;
955 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
958 if (cast->parameters != NULL && !pm_visit_node((
const pm_node_t *) cast->parameters, visitor, data))
return false;
961 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
965 case PM_DEFINED_NODE: {
966 const pm_defined_node_t *cast = (
const pm_defined_node_t *) node;
969 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
974 const pm_else_node_t *cast = (
const pm_else_node_t *) node;
977 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
981 case PM_EMBEDDED_STATEMENTS_NODE: {
982 const pm_embedded_statements_node_t *cast = (
const pm_embedded_statements_node_t *) node;
985 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
989 case PM_EMBEDDED_VARIABLE_NODE: {
990 const pm_embedded_variable_node_t *cast = (
const pm_embedded_variable_node_t *) node;
993 if (!pm_visit_node((
const pm_node_t *) cast->variable, visitor, data))
return false;
997 case PM_ENSURE_NODE: {
998 const pm_ensure_node_t *cast = (
const pm_ensure_node_t *) node;
1001 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1005 case PM_ERROR_RECOVERY_NODE: {
1006 const pm_error_recovery_node_t *cast = (
const pm_error_recovery_node_t *) node;
1009 if (cast->unexpected != NULL && !pm_visit_node((
const pm_node_t *) cast->unexpected, visitor, data))
return false;
1015 case PM_FIND_PATTERN_NODE: {
1016 const pm_find_pattern_node_t *cast = (
const pm_find_pattern_node_t *) node;
1019 if (cast->constant != NULL && !pm_visit_node((
const pm_node_t *) cast->constant, visitor, data))
return false;
1022 if (!pm_visit_node((
const pm_node_t *) cast->left, visitor, data))
return false;
1025 const pm_node_list_t *requireds = &cast->requireds;
1026 for (
size_t index = 0; index < requireds->
size; index++) {
1027 if (!pm_visit_node(requireds->
nodes[index], visitor, data))
return false;
1031 if (!pm_visit_node((
const pm_node_t *) cast->right, visitor, data))
return false;
1035 case PM_FLIP_FLOP_NODE: {
1036 const pm_flip_flop_node_t *cast = (
const pm_flip_flop_node_t *) node;
1039 if (cast->left != NULL && !pm_visit_node((
const pm_node_t *) cast->left, visitor, data))
return false;
1042 if (cast->right != NULL && !pm_visit_node((
const pm_node_t *) cast->right, visitor, data))
return false;
1049 const pm_for_node_t *cast = (
const pm_for_node_t *) node;
1052 if (!pm_visit_node((
const pm_node_t *) cast->index, visitor, data))
return false;
1055 if (!pm_visit_node((
const pm_node_t *) cast->collection, visitor, data))
return false;
1058 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1062 case PM_FORWARDING_ARGUMENTS_NODE:
1064 case PM_FORWARDING_PARAMETER_NODE:
1066 case PM_FORWARDING_SUPER_NODE: {
1067 const pm_forwarding_super_node_t *cast = (
const pm_forwarding_super_node_t *) node;
1070 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1074 case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: {
1075 const pm_global_variable_and_write_node_t *cast = (
const pm_global_variable_and_write_node_t *) node;
1078 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1082 case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
1083 const pm_global_variable_operator_write_node_t *cast = (
const pm_global_variable_operator_write_node_t *) node;
1086 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1090 case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
1091 const pm_global_variable_or_write_node_t *cast = (
const pm_global_variable_or_write_node_t *) node;
1094 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1098 case PM_GLOBAL_VARIABLE_READ_NODE:
1100 case PM_GLOBAL_VARIABLE_TARGET_NODE:
1102 case PM_GLOBAL_VARIABLE_WRITE_NODE: {
1103 const pm_global_variable_write_node_t *cast = (
const pm_global_variable_write_node_t *) node;
1106 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1110 case PM_HASH_NODE: {
1111 const pm_hash_node_t *cast = (
const pm_hash_node_t *) node;
1114 const pm_node_list_t *elements = &cast->elements;
1115 for (
size_t index = 0; index < elements->
size; index++) {
1116 if (!pm_visit_node(elements->
nodes[index], visitor, data))
return false;
1121 case PM_HASH_PATTERN_NODE: {
1122 const pm_hash_pattern_node_t *cast = (
const pm_hash_pattern_node_t *) node;
1125 if (cast->constant != NULL && !pm_visit_node((
const pm_node_t *) cast->constant, visitor, data))
return false;
1128 const pm_node_list_t *elements = &cast->elements;
1129 for (
size_t index = 0; index < elements->
size; index++) {
1130 if (!pm_visit_node(elements->
nodes[index], visitor, data))
return false;
1134 if (cast->rest != NULL && !pm_visit_node((
const pm_node_t *) cast->rest, visitor, data))
return false;
1139 const pm_if_node_t *cast = (
const pm_if_node_t *) node;
1142 if (!pm_visit_node((
const pm_node_t *) cast->predicate, visitor, data))
return false;
1145 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1148 if (cast->subsequent != NULL && !pm_visit_node((
const pm_node_t *) cast->subsequent, visitor, data))
return false;
1152 case PM_IMAGINARY_NODE: {
1153 const pm_imaginary_node_t *cast = (
const pm_imaginary_node_t *) node;
1156 if (!pm_visit_node((
const pm_node_t *) cast->numeric, visitor, data))
return false;
1160 case PM_IMPLICIT_NODE: {
1161 const pm_implicit_node_t *cast = (
const pm_implicit_node_t *) node;
1164 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1168 case PM_IMPLICIT_REST_NODE:
1171 const pm_in_node_t *cast = (
const pm_in_node_t *) node;
1174 if (!pm_visit_node((
const pm_node_t *) cast->pattern, visitor, data))
return false;
1177 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1181 case PM_INDEX_AND_WRITE_NODE: {
1182 const pm_index_and_write_node_t *cast = (
const pm_index_and_write_node_t *) node;
1185 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
1188 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1191 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1194 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1198 case PM_INDEX_OPERATOR_WRITE_NODE: {
1199 const pm_index_operator_write_node_t *cast = (
const pm_index_operator_write_node_t *) node;
1202 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
1205 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1208 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1211 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1215 case PM_INDEX_OR_WRITE_NODE: {
1216 const pm_index_or_write_node_t *cast = (
const pm_index_or_write_node_t *) node;
1219 if (cast->receiver != NULL && !pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
1222 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1225 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1228 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1232 case PM_INDEX_TARGET_NODE: {
1233 const pm_index_target_node_t *cast = (
const pm_index_target_node_t *) node;
1236 if (!pm_visit_node((
const pm_node_t *) cast->receiver, visitor, data))
return false;
1239 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1242 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1246 case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
1247 const pm_instance_variable_and_write_node_t *cast = (
const pm_instance_variable_and_write_node_t *) node;
1250 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1254 case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
1255 const pm_instance_variable_operator_write_node_t *cast = (
const pm_instance_variable_operator_write_node_t *) node;
1258 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1262 case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
1263 const pm_instance_variable_or_write_node_t *cast = (
const pm_instance_variable_or_write_node_t *) node;
1266 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1270 case PM_INSTANCE_VARIABLE_READ_NODE:
1272 case PM_INSTANCE_VARIABLE_TARGET_NODE:
1274 case PM_INSTANCE_VARIABLE_WRITE_NODE: {
1275 const pm_instance_variable_write_node_t *cast = (
const pm_instance_variable_write_node_t *) node;
1278 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1282 case PM_INTEGER_NODE:
1284 case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
1285 const pm_interpolated_match_last_line_node_t *cast = (
const pm_interpolated_match_last_line_node_t *) node;
1288 const pm_node_list_t *parts = &cast->parts;
1289 for (
size_t index = 0; index < parts->
size; index++) {
1290 if (!pm_visit_node(parts->
nodes[index], visitor, data))
return false;
1295 case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
1296 const pm_interpolated_regular_expression_node_t *cast = (
const pm_interpolated_regular_expression_node_t *) node;
1299 const pm_node_list_t *parts = &cast->parts;
1300 for (
size_t index = 0; index < parts->
size; index++) {
1301 if (!pm_visit_node(parts->
nodes[index], visitor, data))
return false;
1306 case PM_INTERPOLATED_STRING_NODE: {
1307 const pm_interpolated_string_node_t *cast = (
const pm_interpolated_string_node_t *) node;
1310 const pm_node_list_t *parts = &cast->parts;
1311 for (
size_t index = 0; index < parts->
size; index++) {
1312 if (!pm_visit_node(parts->
nodes[index], visitor, data))
return false;
1317 case PM_INTERPOLATED_SYMBOL_NODE: {
1318 const pm_interpolated_symbol_node_t *cast = (
const pm_interpolated_symbol_node_t *) node;
1321 const pm_node_list_t *parts = &cast->parts;
1322 for (
size_t index = 0; index < parts->
size; index++) {
1323 if (!pm_visit_node(parts->
nodes[index], visitor, data))
return false;
1328 case PM_INTERPOLATED_X_STRING_NODE: {
1329 const pm_interpolated_x_string_node_t *cast = (
const pm_interpolated_x_string_node_t *) node;
1332 const pm_node_list_t *parts = &cast->parts;
1333 for (
size_t index = 0; index < parts->
size; index++) {
1334 if (!pm_visit_node(parts->
nodes[index], visitor, data))
return false;
1339 case PM_IT_LOCAL_VARIABLE_READ_NODE:
1341 case PM_IT_PARAMETERS_NODE:
1343 case PM_KEYWORD_HASH_NODE: {
1344 const pm_keyword_hash_node_t *cast = (
const pm_keyword_hash_node_t *) node;
1347 const pm_node_list_t *elements = &cast->elements;
1348 for (
size_t index = 0; index < elements->
size; index++) {
1349 if (!pm_visit_node(elements->
nodes[index], visitor, data))
return false;
1354 case PM_KEYWORD_REST_PARAMETER_NODE:
1356 case PM_LAMBDA_NODE: {
1357 const pm_lambda_node_t *cast = (
const pm_lambda_node_t *) node;
1360 if (cast->parameters != NULL && !pm_visit_node((
const pm_node_t *) cast->parameters, visitor, data))
return false;
1363 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
1367 case PM_LOCAL_VARIABLE_AND_WRITE_NODE: {
1368 const pm_local_variable_and_write_node_t *cast = (
const pm_local_variable_and_write_node_t *) node;
1371 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1375 case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
1376 const pm_local_variable_operator_write_node_t *cast = (
const pm_local_variable_operator_write_node_t *) node;
1379 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1383 case PM_LOCAL_VARIABLE_OR_WRITE_NODE: {
1384 const pm_local_variable_or_write_node_t *cast = (
const pm_local_variable_or_write_node_t *) node;
1387 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1391 case PM_LOCAL_VARIABLE_READ_NODE:
1393 case PM_LOCAL_VARIABLE_TARGET_NODE:
1395 case PM_LOCAL_VARIABLE_WRITE_NODE: {
1396 const pm_local_variable_write_node_t *cast = (
const pm_local_variable_write_node_t *) node;
1399 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1403 case PM_MATCH_LAST_LINE_NODE:
1405 case PM_MATCH_PREDICATE_NODE: {
1406 const pm_match_predicate_node_t *cast = (
const pm_match_predicate_node_t *) node;
1409 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1412 if (!pm_visit_node((
const pm_node_t *) cast->pattern, visitor, data))
return false;
1416 case PM_MATCH_REQUIRED_NODE: {
1417 const pm_match_required_node_t *cast = (
const pm_match_required_node_t *) node;
1420 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1423 if (!pm_visit_node((
const pm_node_t *) cast->pattern, visitor, data))
return false;
1427 case PM_MATCH_WRITE_NODE: {
1428 const pm_match_write_node_t *cast = (
const pm_match_write_node_t *) node;
1431 if (!pm_visit_node((
const pm_node_t *) cast->call, visitor, data))
return false;
1434 const pm_node_list_t *targets = &cast->targets;
1435 for (
size_t index = 0; index < targets->
size; index++) {
1436 if (!pm_visit_node(targets->
nodes[index], visitor, data))
return false;
1441 case PM_MODULE_NODE: {
1442 const pm_module_node_t *cast = (
const pm_module_node_t *) node;
1445 if (!pm_visit_node((
const pm_node_t *) cast->constant_path, visitor, data))
return false;
1448 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
1452 case PM_MULTI_TARGET_NODE: {
1453 const pm_multi_target_node_t *cast = (
const pm_multi_target_node_t *) node;
1456 const pm_node_list_t *lefts = &cast->lefts;
1457 for (
size_t index = 0; index < lefts->
size; index++) {
1458 if (!pm_visit_node(lefts->
nodes[index], visitor, data))
return false;
1462 if (cast->rest != NULL && !pm_visit_node((
const pm_node_t *) cast->rest, visitor, data))
return false;
1465 const pm_node_list_t *rights = &cast->rights;
1466 for (
size_t index = 0; index < rights->
size; index++) {
1467 if (!pm_visit_node(rights->
nodes[index], visitor, data))
return false;
1472 case PM_MULTI_WRITE_NODE: {
1473 const pm_multi_write_node_t *cast = (
const pm_multi_write_node_t *) node;
1476 const pm_node_list_t *lefts = &cast->lefts;
1477 for (
size_t index = 0; index < lefts->
size; index++) {
1478 if (!pm_visit_node(lefts->
nodes[index], visitor, data))
return false;
1482 if (cast->rest != NULL && !pm_visit_node((
const pm_node_t *) cast->rest, visitor, data))
return false;
1485 const pm_node_list_t *rights = &cast->rights;
1486 for (
size_t index = 0; index < rights->
size; index++) {
1487 if (!pm_visit_node(rights->
nodes[index], visitor, data))
return false;
1491 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1495 case PM_NEXT_NODE: {
1496 const pm_next_node_t *cast = (
const pm_next_node_t *) node;
1499 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1505 case PM_NO_BLOCK_PARAMETER_NODE:
1507 case PM_NO_KEYWORDS_PARAMETER_NODE:
1509 case PM_NUMBERED_PARAMETERS_NODE:
1511 case PM_NUMBERED_REFERENCE_READ_NODE:
1513 case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
1514 const pm_optional_keyword_parameter_node_t *cast = (
const pm_optional_keyword_parameter_node_t *) node;
1517 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1521 case PM_OPTIONAL_PARAMETER_NODE: {
1522 const pm_optional_parameter_node_t *cast = (
const pm_optional_parameter_node_t *) node;
1525 if (!pm_visit_node((
const pm_node_t *) cast->value, visitor, data))
return false;
1530 const pm_or_node_t *cast = (
const pm_or_node_t *) node;
1533 if (!pm_visit_node((
const pm_node_t *) cast->left, visitor, data))
return false;
1536 if (!pm_visit_node((
const pm_node_t *) cast->right, visitor, data))
return false;
1540 case PM_PARAMETERS_NODE: {
1541 const pm_parameters_node_t *cast = (
const pm_parameters_node_t *) node;
1544 const pm_node_list_t *requireds = &cast->requireds;
1545 for (
size_t index = 0; index < requireds->
size; index++) {
1546 if (!pm_visit_node(requireds->
nodes[index], visitor, data))
return false;
1550 const pm_node_list_t *optionals = &cast->optionals;
1551 for (
size_t index = 0; index < optionals->
size; index++) {
1552 if (!pm_visit_node(optionals->
nodes[index], visitor, data))
return false;
1556 if (cast->rest != NULL && !pm_visit_node((
const pm_node_t *) cast->rest, visitor, data))
return false;
1559 const pm_node_list_t *posts = &cast->posts;
1560 for (
size_t index = 0; index < posts->
size; index++) {
1561 if (!pm_visit_node(posts->
nodes[index], visitor, data))
return false;
1565 const pm_node_list_t *keywords = &cast->keywords;
1566 for (
size_t index = 0; index < keywords->
size; index++) {
1567 if (!pm_visit_node(keywords->
nodes[index], visitor, data))
return false;
1571 if (cast->keyword_rest != NULL && !pm_visit_node((
const pm_node_t *) cast->keyword_rest, visitor, data))
return false;
1574 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1578 case PM_PARENTHESES_NODE: {
1579 const pm_parentheses_node_t *cast = (
const pm_parentheses_node_t *) node;
1582 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
1586 case PM_PINNED_EXPRESSION_NODE: {
1587 const pm_pinned_expression_node_t *cast = (
const pm_pinned_expression_node_t *) node;
1590 if (!pm_visit_node((
const pm_node_t *) cast->expression, visitor, data))
return false;
1594 case PM_PINNED_VARIABLE_NODE: {
1595 const pm_pinned_variable_node_t *cast = (
const pm_pinned_variable_node_t *) node;
1598 if (!pm_visit_node((
const pm_node_t *) cast->variable, visitor, data))
return false;
1602 case PM_POST_EXECUTION_NODE: {
1603 const pm_post_execution_node_t *cast = (
const pm_post_execution_node_t *) node;
1606 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1610 case PM_PRE_EXECUTION_NODE: {
1611 const pm_pre_execution_node_t *cast = (
const pm_pre_execution_node_t *) node;
1614 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1618 case PM_PROGRAM_NODE: {
1619 const pm_program_node_t *cast = (
const pm_program_node_t *) node;
1622 if (!pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1626 case PM_RANGE_NODE: {
1627 const pm_range_node_t *cast = (
const pm_range_node_t *) node;
1630 if (cast->left != NULL && !pm_visit_node((
const pm_node_t *) cast->left, visitor, data))
return false;
1633 if (cast->right != NULL && !pm_visit_node((
const pm_node_t *) cast->right, visitor, data))
return false;
1637 case PM_RATIONAL_NODE:
1641 case PM_REGULAR_EXPRESSION_NODE:
1643 case PM_REQUIRED_KEYWORD_PARAMETER_NODE:
1645 case PM_REQUIRED_PARAMETER_NODE:
1647 case PM_RESCUE_MODIFIER_NODE: {
1648 const pm_rescue_modifier_node_t *cast = (
const pm_rescue_modifier_node_t *) node;
1651 if (!pm_visit_node((
const pm_node_t *) cast->expression, visitor, data))
return false;
1654 if (!pm_visit_node((
const pm_node_t *) cast->rescue_expression, visitor, data))
return false;
1658 case PM_RESCUE_NODE: {
1659 const pm_rescue_node_t *cast = (
const pm_rescue_node_t *) node;
1662 const pm_node_list_t *exceptions = &cast->exceptions;
1663 for (
size_t index = 0; index < exceptions->
size; index++) {
1664 if (!pm_visit_node(exceptions->
nodes[index], visitor, data))
return false;
1668 if (cast->reference != NULL && !pm_visit_node((
const pm_node_t *) cast->reference, visitor, data))
return false;
1671 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1674 if (cast->subsequent != NULL && !pm_visit_node((
const pm_node_t *) cast->subsequent, visitor, data))
return false;
1678 case PM_REST_PARAMETER_NODE:
1682 case PM_RETURN_NODE: {
1683 const pm_return_node_t *cast = (
const pm_return_node_t *) node;
1686 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1692 case PM_SHAREABLE_CONSTANT_NODE: {
1693 const pm_shareable_constant_node_t *cast = (
const pm_shareable_constant_node_t *) node;
1696 if (!pm_visit_node((
const pm_node_t *) cast->write, visitor, data))
return false;
1700 case PM_SINGLETON_CLASS_NODE: {
1701 const pm_singleton_class_node_t *cast = (
const pm_singleton_class_node_t *) node;
1704 if (!pm_visit_node((
const pm_node_t *) cast->expression, visitor, data))
return false;
1707 if (cast->body != NULL && !pm_visit_node((
const pm_node_t *) cast->body, visitor, data))
return false;
1711 case PM_SOURCE_ENCODING_NODE:
1713 case PM_SOURCE_FILE_NODE:
1715 case PM_SOURCE_LINE_NODE:
1717 case PM_SPLAT_NODE: {
1718 const pm_splat_node_t *cast = (
const pm_splat_node_t *) node;
1721 if (cast->expression != NULL && !pm_visit_node((
const pm_node_t *) cast->expression, visitor, data))
return false;
1725 case PM_STATEMENTS_NODE: {
1726 const pm_statements_node_t *cast = (
const pm_statements_node_t *) node;
1729 const pm_node_list_t *body = &cast->body;
1730 for (
size_t index = 0; index < body->
size; index++) {
1731 if (!pm_visit_node(body->
nodes[index], visitor, data))
return false;
1736 case PM_STRING_NODE:
1738 case PM_SUPER_NODE: {
1739 const pm_super_node_t *cast = (
const pm_super_node_t *) node;
1742 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1745 if (cast->block != NULL && !pm_visit_node((
const pm_node_t *) cast->block, visitor, data))
return false;
1749 case PM_SYMBOL_NODE:
1753 case PM_UNDEF_NODE: {
1754 const pm_undef_node_t *cast = (
const pm_undef_node_t *) node;
1757 const pm_node_list_t *names = &cast->names;
1758 for (
size_t index = 0; index < names->
size; index++) {
1759 if (!pm_visit_node(names->
nodes[index], visitor, data))
return false;
1764 case PM_UNLESS_NODE: {
1765 const pm_unless_node_t *cast = (
const pm_unless_node_t *) node;
1768 if (!pm_visit_node((
const pm_node_t *) cast->predicate, visitor, data))
return false;
1771 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1774 if (cast->else_clause != NULL && !pm_visit_node((
const pm_node_t *) cast->else_clause, visitor, data))
return false;
1778 case PM_UNTIL_NODE: {
1779 const pm_until_node_t *cast = (
const pm_until_node_t *) node;
1782 if (!pm_visit_node((
const pm_node_t *) cast->predicate, visitor, data))
return false;
1785 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1789 case PM_WHEN_NODE: {
1790 const pm_when_node_t *cast = (
const pm_when_node_t *) node;
1793 const pm_node_list_t *conditions = &cast->conditions;
1794 for (
size_t index = 0; index < conditions->
size; index++) {
1795 if (!pm_visit_node(conditions->
nodes[index], visitor, data))
return false;
1799 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1803 case PM_WHILE_NODE: {
1804 const pm_while_node_t *cast = (
const pm_while_node_t *) node;
1807 if (!pm_visit_node((
const pm_node_t *) cast->predicate, visitor, data))
return false;
1810 if (cast->statements != NULL && !pm_visit_node((
const pm_node_t *) cast->statements, visitor, data))
return false;
1814 case PM_X_STRING_NODE:
1816 case PM_YIELD_NODE: {
1817 const pm_yield_node_t *cast = (
const pm_yield_node_t *) node;
1820 if (cast->arguments != NULL && !pm_visit_node((
const pm_node_t *) cast->arguments, visitor, data))
return false;
1834pm_alias_global_variable_node_t *
1836 pm_alias_global_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_alias_global_variable_node_t);
1838 *node = (pm_alias_global_variable_node_t) {
1839 .base = { .type = PM_ALIAS_GLOBAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
1840 .new_name = new_name,
1841 .old_name = old_name,
1842 .keyword_loc = keyword_loc
1851pm_alias_method_node_t *
1853 pm_alias_method_node_t *node = PM_ARENA_ALLOC(arena, pm_alias_method_node_t);
1855 *node = (pm_alias_method_node_t) {
1856 .base = { .type = PM_ALIAS_METHOD_NODE, .flags = flags, .node_id = node_id, .location = location },
1857 .new_name = new_name,
1858 .old_name = old_name,
1859 .keyword_loc = keyword_loc
1868pm_alternation_pattern_node_t *
1870 pm_alternation_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_alternation_pattern_node_t);
1872 *node = (pm_alternation_pattern_node_t) {
1873 .base = { .type = PM_ALTERNATION_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
1876 .operator_loc = operator_loc
1887 pm_and_node_t *node = PM_ARENA_ALLOC(arena, pm_and_node_t);
1889 *node = (pm_and_node_t) {
1890 .base = { .type = PM_AND_NODE, .flags = flags, .node_id = node_id, .location = location },
1893 .operator_loc = operator_loc
1902pm_arguments_node_t *
1903pm_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) {
1904 pm_arguments_node_t *node = PM_ARENA_ALLOC(arena, pm_arguments_node_t);
1906 *node = (pm_arguments_node_t) {
1907 .base = { .type = PM_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
1908 .arguments = arguments
1919 pm_array_node_t *node = PM_ARENA_ALLOC(arena, pm_array_node_t);
1921 *node = (pm_array_node_t) {
1922 .base = { .type = PM_ARRAY_NODE, .flags = flags, .node_id = node_id, .location = location },
1923 .elements = elements,
1924 .opening_loc = opening_loc,
1925 .closing_loc = closing_loc
1934pm_array_pattern_node_t *
1936 pm_array_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_array_pattern_node_t);
1938 *node = (pm_array_pattern_node_t) {
1939 .base = { .type = PM_ARRAY_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
1941 .requireds = requireds,
1944 .opening_loc = opening_loc,
1945 .closing_loc = closing_loc
1956 pm_assoc_node_t *node = PM_ARENA_ALLOC(arena, pm_assoc_node_t);
1958 *node = (pm_assoc_node_t) {
1959 .base = { .type = PM_ASSOC_NODE, .flags = flags, .node_id = node_id, .location = location },
1962 .operator_loc = operator_loc
1971pm_assoc_splat_node_t *
1973 pm_assoc_splat_node_t *node = PM_ARENA_ALLOC(arena, pm_assoc_splat_node_t);
1975 *node = (pm_assoc_splat_node_t) {
1976 .base = { .type = PM_ASSOC_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location },
1978 .operator_loc = operator_loc
1987pm_back_reference_read_node_t *
1989 pm_back_reference_read_node_t *node = PM_ARENA_ALLOC(arena, pm_back_reference_read_node_t);
1991 *node = (pm_back_reference_read_node_t) {
1992 .base = { .type = PM_BACK_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2004 pm_begin_node_t *node = PM_ARENA_ALLOC(arena, pm_begin_node_t);
2006 *node = (pm_begin_node_t) {
2007 .base = { .type = PM_BEGIN_NODE, .flags = flags, .node_id = node_id, .location = location },
2008 .begin_keyword_loc = begin_keyword_loc,
2009 .statements = statements,
2010 .rescue_clause = rescue_clause,
2011 .else_clause = else_clause,
2012 .ensure_clause = ensure_clause,
2022pm_block_argument_node_t *
2024 pm_block_argument_node_t *node = PM_ARENA_ALLOC(arena, pm_block_argument_node_t);
2026 *node = (pm_block_argument_node_t) {
2027 .base = { .type = PM_BLOCK_ARGUMENT_NODE, .flags = flags, .node_id = node_id, .location = location },
2028 .expression = expression,
2029 .operator_loc = operator_loc
2038pm_block_local_variable_node_t *
2040 pm_block_local_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_block_local_variable_node_t);
2042 *node = (pm_block_local_variable_node_t) {
2043 .base = { .type = PM_BLOCK_LOCAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
2055 pm_block_node_t *node = PM_ARENA_ALLOC(arena, pm_block_node_t);
2057 *node = (pm_block_node_t) {
2058 .base = { .type = PM_BLOCK_NODE, .flags = flags, .node_id = node_id, .location = location },
2060 .parameters = parameters,
2062 .opening_loc = opening_loc,
2063 .closing_loc = closing_loc
2072pm_block_parameter_node_t *
2074 pm_block_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_block_parameter_node_t);
2076 *node = (pm_block_parameter_node_t) {
2077 .base = { .type = PM_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
2079 .name_loc = name_loc,
2080 .operator_loc = operator_loc
2089pm_block_parameters_node_t *
2091 pm_block_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_block_parameters_node_t);
2093 *node = (pm_block_parameters_node_t) {
2094 .base = { .type = PM_BLOCK_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
2095 .parameters = parameters,
2097 .opening_loc = opening_loc,
2098 .closing_loc = closing_loc
2109 pm_break_node_t *node = PM_ARENA_ALLOC(arena, pm_break_node_t);
2111 *node = (pm_break_node_t) {
2112 .base = { .type = PM_BREAK_NODE, .flags = flags, .node_id = node_id, .location = location },
2113 .arguments = arguments,
2114 .keyword_loc = keyword_loc
2123pm_call_and_write_node_t *
2124pm_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) {
2125 pm_call_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_call_and_write_node_t);
2127 *node = (pm_call_and_write_node_t) {
2128 .base = { .type = PM_CALL_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2129 .receiver = receiver,
2130 .call_operator_loc = call_operator_loc,
2131 .message_loc = message_loc,
2132 .read_name = read_name,
2133 .write_name = write_name,
2134 .operator_loc = operator_loc,
2145pm_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) {
2146 pm_call_node_t *node = PM_ARENA_ALLOC(arena, pm_call_node_t);
2148 *node = (pm_call_node_t) {
2149 .base = { .type = PM_CALL_NODE, .flags = flags, .node_id = node_id, .location = location },
2150 .receiver = receiver,
2151 .call_operator_loc = call_operator_loc,
2153 .message_loc = message_loc,
2154 .opening_loc = opening_loc,
2155 .arguments = arguments,
2156 .closing_loc = closing_loc,
2157 .equal_loc = equal_loc,
2167pm_call_operator_write_node_t *
2168pm_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) {
2169 pm_call_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_call_operator_write_node_t);
2171 *node = (pm_call_operator_write_node_t) {
2172 .base = { .type = PM_CALL_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2173 .receiver = receiver,
2174 .call_operator_loc = call_operator_loc,
2175 .message_loc = message_loc,
2176 .read_name = read_name,
2177 .write_name = write_name,
2178 .binary_operator = binary_operator,
2179 .binary_operator_loc = binary_operator_loc,
2189pm_call_or_write_node_t *
2190pm_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) {
2191 pm_call_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_call_or_write_node_t);
2193 *node = (pm_call_or_write_node_t) {
2194 .base = { .type = PM_CALL_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2195 .receiver = receiver,
2196 .call_operator_loc = call_operator_loc,
2197 .message_loc = message_loc,
2198 .read_name = read_name,
2199 .write_name = write_name,
2200 .operator_loc = operator_loc,
2210pm_call_target_node_t *
2212 pm_call_target_node_t *node = PM_ARENA_ALLOC(arena, pm_call_target_node_t);
2214 *node = (pm_call_target_node_t) {
2215 .base = { .type = PM_CALL_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2216 .receiver = receiver,
2217 .call_operator_loc = call_operator_loc,
2219 .message_loc = message_loc
2228pm_capture_pattern_node_t *
2230 pm_capture_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_capture_pattern_node_t);
2232 *node = (pm_capture_pattern_node_t) {
2233 .base = { .type = PM_CAPTURE_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2236 .operator_loc = operator_loc
2245pm_case_match_node_t *
2247 pm_case_match_node_t *node = PM_ARENA_ALLOC(arena, pm_case_match_node_t);
2249 *node = (pm_case_match_node_t) {
2250 .base = { .type = PM_CASE_MATCH_NODE, .flags = flags, .node_id = node_id, .location = location },
2251 .predicate = predicate,
2252 .conditions = conditions,
2253 .else_clause = else_clause,
2254 .case_keyword_loc = case_keyword_loc,
2255 .end_keyword_loc = end_keyword_loc
2266 pm_case_node_t *node = PM_ARENA_ALLOC(arena, pm_case_node_t);
2268 *node = (pm_case_node_t) {
2269 .base = { .type = PM_CASE_NODE, .flags = flags, .node_id = node_id, .location = location },
2270 .predicate = predicate,
2271 .conditions = conditions,
2272 .else_clause = else_clause,
2273 .case_keyword_loc = case_keyword_loc,
2274 .end_keyword_loc = end_keyword_loc
2284pm_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) {
2285 pm_class_node_t *node = PM_ARENA_ALLOC(arena, pm_class_node_t);
2287 *node = (pm_class_node_t) {
2288 .base = { .type = PM_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location },
2290 .class_keyword_loc = class_keyword_loc,
2291 .constant_path = constant_path,
2292 .inheritance_operator_loc = inheritance_operator_loc,
2293 .superclass = superclass,
2295 .end_keyword_loc = end_keyword_loc,
2305pm_class_variable_and_write_node_t *
2307 pm_class_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_and_write_node_t);
2309 *node = (pm_class_variable_and_write_node_t) {
2310 .base = { .type = PM_CLASS_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2312 .name_loc = name_loc,
2313 .operator_loc = operator_loc,
2323pm_class_variable_operator_write_node_t *
2325 pm_class_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_operator_write_node_t);
2327 *node = (pm_class_variable_operator_write_node_t) {
2328 .base = { .type = PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2330 .name_loc = name_loc,
2331 .binary_operator_loc = binary_operator_loc,
2333 .binary_operator = binary_operator
2342pm_class_variable_or_write_node_t *
2344 pm_class_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_or_write_node_t);
2346 *node = (pm_class_variable_or_write_node_t) {
2347 .base = { .type = PM_CLASS_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2349 .name_loc = name_loc,
2350 .operator_loc = operator_loc,
2360pm_class_variable_read_node_t *
2362 pm_class_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_read_node_t);
2364 *node = (pm_class_variable_read_node_t) {
2365 .base = { .type = PM_CLASS_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2375pm_class_variable_target_node_t *
2377 pm_class_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_target_node_t);
2379 *node = (pm_class_variable_target_node_t) {
2380 .base = { .type = PM_CLASS_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2390pm_class_variable_write_node_t *
2392 pm_class_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_write_node_t);
2394 *node = (pm_class_variable_write_node_t) {
2395 .base = { .type = PM_CLASS_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2397 .name_loc = name_loc,
2399 .operator_loc = operator_loc
2408pm_constant_and_write_node_t *
2410 pm_constant_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_and_write_node_t);
2412 *node = (pm_constant_and_write_node_t) {
2413 .base = { .type = PM_CONSTANT_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2415 .name_loc = name_loc,
2416 .operator_loc = operator_loc,
2426pm_constant_operator_write_node_t *
2428 pm_constant_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_operator_write_node_t);
2430 *node = (pm_constant_operator_write_node_t) {
2431 .base = { .type = PM_CONSTANT_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2433 .name_loc = name_loc,
2434 .binary_operator_loc = binary_operator_loc,
2436 .binary_operator = binary_operator
2445pm_constant_or_write_node_t *
2447 pm_constant_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_or_write_node_t);
2449 *node = (pm_constant_or_write_node_t) {
2450 .base = { .type = PM_CONSTANT_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2452 .name_loc = name_loc,
2453 .operator_loc = operator_loc,
2463pm_constant_path_and_write_node_t *
2465 pm_constant_path_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_and_write_node_t);
2467 *node = (pm_constant_path_and_write_node_t) {
2468 .base = { .type = PM_CONSTANT_PATH_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2470 .operator_loc = operator_loc,
2480pm_constant_path_node_t *
2482 pm_constant_path_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_node_t);
2484 *node = (pm_constant_path_node_t) {
2485 .base = { .type = PM_CONSTANT_PATH_NODE, .flags = flags, .node_id = node_id, .location = location },
2488 .delimiter_loc = delimiter_loc,
2489 .name_loc = name_loc
2498pm_constant_path_operator_write_node_t *
2500 pm_constant_path_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_operator_write_node_t);
2502 *node = (pm_constant_path_operator_write_node_t) {
2503 .base = { .type = PM_CONSTANT_PATH_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2505 .binary_operator_loc = binary_operator_loc,
2507 .binary_operator = binary_operator
2516pm_constant_path_or_write_node_t *
2518 pm_constant_path_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_or_write_node_t);
2520 *node = (pm_constant_path_or_write_node_t) {
2521 .base = { .type = PM_CONSTANT_PATH_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2523 .operator_loc = operator_loc,
2533pm_constant_path_target_node_t *
2535 pm_constant_path_target_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_target_node_t);
2537 *node = (pm_constant_path_target_node_t) {
2538 .base = { .type = PM_CONSTANT_PATH_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2541 .delimiter_loc = delimiter_loc,
2542 .name_loc = name_loc
2551pm_constant_path_write_node_t *
2553 pm_constant_path_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_write_node_t);
2555 *node = (pm_constant_path_write_node_t) {
2556 .base = { .type = PM_CONSTANT_PATH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2558 .operator_loc = operator_loc,
2568pm_constant_read_node_t *
2570 pm_constant_read_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_read_node_t);
2572 *node = (pm_constant_read_node_t) {
2573 .base = { .type = PM_CONSTANT_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2583pm_constant_target_node_t *
2585 pm_constant_target_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_target_node_t);
2587 *node = (pm_constant_target_node_t) {
2588 .base = { .type = PM_CONSTANT_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2598pm_constant_write_node_t *
2600 pm_constant_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_write_node_t);
2602 *node = (pm_constant_write_node_t) {
2603 .base = { .type = PM_CONSTANT_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2605 .name_loc = name_loc,
2607 .operator_loc = operator_loc
2617pm_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) {
2618 pm_def_node_t *node = PM_ARENA_ALLOC(arena, pm_def_node_t);
2620 *node = (pm_def_node_t) {
2621 .base = { .type = PM_DEF_NODE, .flags = flags, .node_id = node_id, .location = location },
2623 .name_loc = name_loc,
2624 .receiver = receiver,
2625 .parameters = parameters,
2628 .def_keyword_loc = def_keyword_loc,
2629 .operator_loc = operator_loc,
2630 .lparen_loc = lparen_loc,
2631 .rparen_loc = rparen_loc,
2632 .equal_loc = equal_loc,
2633 .end_keyword_loc = end_keyword_loc
2644 pm_defined_node_t *node = PM_ARENA_ALLOC(arena, pm_defined_node_t);
2646 *node = (pm_defined_node_t) {
2647 .base = { .type = PM_DEFINED_NODE, .flags = flags, .node_id = node_id, .location = location },
2648 .lparen_loc = lparen_loc,
2650 .rparen_loc = rparen_loc,
2651 .keyword_loc = keyword_loc
2662 pm_else_node_t *node = PM_ARENA_ALLOC(arena, pm_else_node_t);
2664 *node = (pm_else_node_t) {
2665 .base = { .type = PM_ELSE_NODE, .flags = flags, .node_id = node_id, .location = location },
2666 .else_keyword_loc = else_keyword_loc,
2667 .statements = statements,
2668 .end_keyword_loc = end_keyword_loc
2677pm_embedded_statements_node_t *
2679 pm_embedded_statements_node_t *node = PM_ARENA_ALLOC(arena, pm_embedded_statements_node_t);
2681 *node = (pm_embedded_statements_node_t) {
2682 .base = { .type = PM_EMBEDDED_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
2683 .opening_loc = opening_loc,
2684 .statements = statements,
2685 .closing_loc = closing_loc
2694pm_embedded_variable_node_t *
2696 pm_embedded_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_embedded_variable_node_t);
2698 *node = (pm_embedded_variable_node_t) {
2699 .base = { .type = PM_EMBEDDED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
2700 .operator_loc = operator_loc,
2701 .variable = variable
2712 pm_ensure_node_t *node = PM_ARENA_ALLOC(arena, pm_ensure_node_t);
2714 *node = (pm_ensure_node_t) {
2715 .base = { .type = PM_ENSURE_NODE, .flags = flags, .node_id = node_id, .location = location },
2716 .ensure_keyword_loc = ensure_keyword_loc,
2717 .statements = statements,
2718 .end_keyword_loc = end_keyword_loc
2727pm_error_recovery_node_t *
2729 pm_error_recovery_node_t *node = PM_ARENA_ALLOC(arena, pm_error_recovery_node_t);
2731 *node = (pm_error_recovery_node_t) {
2732 .base = { .type = PM_ERROR_RECOVERY_NODE, .flags = flags, .node_id = node_id, .location = location },
2733 .unexpected = unexpected
2744 pm_false_node_t *node = PM_ARENA_ALLOC(arena, pm_false_node_t);
2746 *node = (pm_false_node_t) {
2747 .base = { .type = PM_FALSE_NODE, .flags = flags, .node_id = node_id, .location = location }
2756pm_find_pattern_node_t *
2758 pm_find_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_find_pattern_node_t);
2760 *node = (pm_find_pattern_node_t) {
2761 .base = { .type = PM_FIND_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2764 .requireds = requireds,
2766 .opening_loc = opening_loc,
2767 .closing_loc = closing_loc
2776pm_flip_flop_node_t *
2778 pm_flip_flop_node_t *node = PM_ARENA_ALLOC(arena, pm_flip_flop_node_t);
2780 *node = (pm_flip_flop_node_t) {
2781 .base = { .type = PM_FLIP_FLOP_NODE, .flags = flags, .node_id = node_id, .location = location },
2784 .operator_loc = operator_loc
2794pm_float_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location,
double value) {
2795 pm_float_node_t *node = PM_ARENA_ALLOC(arena, pm_float_node_t);
2797 *node = (pm_float_node_t) {
2798 .base = { .type = PM_FLOAT_NODE, .flags = flags, .node_id = node_id, .location = location },
2809pm_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) {
2810 pm_for_node_t *node = PM_ARENA_ALLOC(arena, pm_for_node_t);
2812 *node = (pm_for_node_t) {
2813 .base = { .type = PM_FOR_NODE, .flags = flags, .node_id = node_id, .location = location },
2815 .collection = collection,
2816 .statements = statements,
2817 .for_keyword_loc = for_keyword_loc,
2818 .in_keyword_loc = in_keyword_loc,
2819 .do_keyword_loc = do_keyword_loc,
2820 .end_keyword_loc = end_keyword_loc
2829pm_forwarding_arguments_node_t *
2830pm_forwarding_arguments_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location) {
2831 pm_forwarding_arguments_node_t *node = PM_ARENA_ALLOC(arena, pm_forwarding_arguments_node_t);
2833 *node = (pm_forwarding_arguments_node_t) {
2834 .base = { .type = PM_FORWARDING_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location }
2843pm_forwarding_parameter_node_t *
2844pm_forwarding_parameter_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location) {
2845 pm_forwarding_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_forwarding_parameter_node_t);
2847 *node = (pm_forwarding_parameter_node_t) {
2848 .base = { .type = PM_FORWARDING_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }
2857pm_forwarding_super_node_t *
2859 pm_forwarding_super_node_t *node = PM_ARENA_ALLOC(arena, pm_forwarding_super_node_t);
2861 *node = (pm_forwarding_super_node_t) {
2862 .base = { .type = PM_FORWARDING_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location },
2863 .keyword_loc = keyword_loc,
2873pm_global_variable_and_write_node_t *
2875 pm_global_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_and_write_node_t);
2877 *node = (pm_global_variable_and_write_node_t) {
2878 .base = { .type = PM_GLOBAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2880 .name_loc = name_loc,
2881 .operator_loc = operator_loc,
2891pm_global_variable_operator_write_node_t *
2893 pm_global_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_operator_write_node_t);
2895 *node = (pm_global_variable_operator_write_node_t) {
2896 .base = { .type = PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2898 .name_loc = name_loc,
2899 .binary_operator_loc = binary_operator_loc,
2901 .binary_operator = binary_operator
2910pm_global_variable_or_write_node_t *
2912 pm_global_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_or_write_node_t);
2914 *node = (pm_global_variable_or_write_node_t) {
2915 .base = { .type = PM_GLOBAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2917 .name_loc = name_loc,
2918 .operator_loc = operator_loc,
2928pm_global_variable_read_node_t *
2930 pm_global_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_read_node_t);
2932 *node = (pm_global_variable_read_node_t) {
2933 .base = { .type = PM_GLOBAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2943pm_global_variable_target_node_t *
2945 pm_global_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_target_node_t);
2947 *node = (pm_global_variable_target_node_t) {
2948 .base = { .type = PM_GLOBAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2958pm_global_variable_write_node_t *
2960 pm_global_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_write_node_t);
2962 *node = (pm_global_variable_write_node_t) {
2963 .base = { .type = PM_GLOBAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2965 .name_loc = name_loc,
2967 .operator_loc = operator_loc
2978 pm_hash_node_t *node = PM_ARENA_ALLOC(arena, pm_hash_node_t);
2980 *node = (pm_hash_node_t) {
2981 .base = { .type = PM_HASH_NODE, .flags = flags, .node_id = node_id, .location = location },
2982 .opening_loc = opening_loc,
2983 .elements = elements,
2984 .closing_loc = closing_loc
2993pm_hash_pattern_node_t *
2995 pm_hash_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_hash_pattern_node_t);
2997 *node = (pm_hash_pattern_node_t) {
2998 .base = { .type = PM_HASH_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
3000 .elements = elements,
3002 .opening_loc = opening_loc,
3003 .closing_loc = closing_loc
3014 pm_if_node_t *node = PM_ARENA_ALLOC(arena, pm_if_node_t);
3016 *node = (pm_if_node_t) {
3017 .base = { .type = PM_IF_NODE, .flags = flags, .node_id = node_id, .location = location },
3018 .if_keyword_loc = if_keyword_loc,
3019 .predicate = predicate,
3020 .then_keyword_loc = then_keyword_loc,
3021 .statements = statements,
3022 .subsequent = subsequent,
3023 .end_keyword_loc = end_keyword_loc
3032pm_imaginary_node_t *
3034 pm_imaginary_node_t *node = PM_ARENA_ALLOC(arena, pm_imaginary_node_t);
3036 *node = (pm_imaginary_node_t) {
3037 .base = { .type = PM_IMAGINARY_NODE, .flags = flags, .node_id = node_id, .location = location },
3049 pm_implicit_node_t *node = PM_ARENA_ALLOC(arena, pm_implicit_node_t);
3051 *node = (pm_implicit_node_t) {
3052 .base = { .type = PM_IMPLICIT_NODE, .flags = flags, .node_id = node_id, .location = location },
3062pm_implicit_rest_node_t *
3063pm_implicit_rest_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location) {
3064 pm_implicit_rest_node_t *node = PM_ARENA_ALLOC(arena, pm_implicit_rest_node_t);
3066 *node = (pm_implicit_rest_node_t) {
3067 .base = { .type = PM_IMPLICIT_REST_NODE, .flags = flags, .node_id = node_id, .location = location }
3078 pm_in_node_t *node = PM_ARENA_ALLOC(arena, pm_in_node_t);
3080 *node = (pm_in_node_t) {
3081 .base = { .type = PM_IN_NODE, .flags = flags, .node_id = node_id, .location = location },
3083 .statements = statements,
3084 .in_keyword_loc = in_keyword_loc,
3085 .then_keyword_loc = then_keyword_loc
3094pm_index_and_write_node_t *
3095pm_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) {
3096 pm_index_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_index_and_write_node_t);
3098 *node = (pm_index_and_write_node_t) {
3099 .base = { .type = PM_INDEX_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3100 .receiver = receiver,
3101 .call_operator_loc = call_operator_loc,
3102 .opening_loc = opening_loc,
3103 .arguments = arguments,
3104 .closing_loc = closing_loc,
3116pm_index_operator_write_node_t *
3117pm_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) {
3118 pm_index_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_index_operator_write_node_t);
3120 *node = (pm_index_operator_write_node_t) {
3121 .base = { .type = PM_INDEX_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3122 .receiver = receiver,
3123 .call_operator_loc = call_operator_loc,
3124 .opening_loc = opening_loc,
3125 .arguments = arguments,
3126 .closing_loc = closing_loc,
3128 .binary_operator = binary_operator,
3129 .binary_operator_loc = binary_operator_loc,
3139pm_index_or_write_node_t *
3140pm_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) {
3141 pm_index_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_index_or_write_node_t);
3143 *node = (pm_index_or_write_node_t) {
3144 .base = { .type = PM_INDEX_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3145 .receiver = receiver,
3146 .call_operator_loc = call_operator_loc,
3147 .opening_loc = opening_loc,
3148 .arguments = arguments,
3149 .closing_loc = closing_loc,
3161pm_index_target_node_t *
3163 pm_index_target_node_t *node = PM_ARENA_ALLOC(arena, pm_index_target_node_t);
3165 *node = (pm_index_target_node_t) {
3166 .base = { .type = PM_INDEX_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3167 .receiver = receiver,
3168 .opening_loc = opening_loc,
3169 .arguments = arguments,
3170 .closing_loc = closing_loc,
3180pm_instance_variable_and_write_node_t *
3182 pm_instance_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_and_write_node_t);
3184 *node = (pm_instance_variable_and_write_node_t) {
3185 .base = { .type = PM_INSTANCE_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3187 .name_loc = name_loc,
3188 .operator_loc = operator_loc,
3198pm_instance_variable_operator_write_node_t *
3200 pm_instance_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_operator_write_node_t);
3202 *node = (pm_instance_variable_operator_write_node_t) {
3203 .base = { .type = PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3205 .name_loc = name_loc,
3206 .binary_operator_loc = binary_operator_loc,
3208 .binary_operator = binary_operator
3217pm_instance_variable_or_write_node_t *
3219 pm_instance_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_or_write_node_t);
3221 *node = (pm_instance_variable_or_write_node_t) {
3222 .base = { .type = PM_INSTANCE_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3224 .name_loc = name_loc,
3225 .operator_loc = operator_loc,
3235pm_instance_variable_read_node_t *
3237 pm_instance_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_read_node_t);
3239 *node = (pm_instance_variable_read_node_t) {
3240 .base = { .type = PM_INSTANCE_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3250pm_instance_variable_target_node_t *
3252 pm_instance_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_target_node_t);
3254 *node = (pm_instance_variable_target_node_t) {
3255 .base = { .type = PM_INSTANCE_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3265pm_instance_variable_write_node_t *
3267 pm_instance_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_write_node_t);
3269 *node = (pm_instance_variable_write_node_t) {
3270 .base = { .type = PM_INSTANCE_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3272 .name_loc = name_loc,
3274 .operator_loc = operator_loc
3285 pm_integer_node_t *node = PM_ARENA_ALLOC(arena, pm_integer_node_t);
3287 *node = (pm_integer_node_t) {
3288 .base = { .type = PM_INTEGER_NODE, .flags = flags, .node_id = node_id, .location = location },
3298pm_interpolated_match_last_line_node_t *
3300 pm_interpolated_match_last_line_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_match_last_line_node_t);
3302 *node = (pm_interpolated_match_last_line_node_t) {
3303 .base = { .type = PM_INTERPOLATED_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location },
3304 .opening_loc = opening_loc,
3306 .closing_loc = closing_loc
3315pm_interpolated_regular_expression_node_t *
3317 pm_interpolated_regular_expression_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_regular_expression_node_t);
3319 *node = (pm_interpolated_regular_expression_node_t) {
3320 .base = { .type = PM_INTERPOLATED_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3321 .opening_loc = opening_loc,
3323 .closing_loc = closing_loc
3332pm_interpolated_string_node_t *
3334 pm_interpolated_string_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_string_node_t);
3336 *node = (pm_interpolated_string_node_t) {
3337 .base = { .type = PM_INTERPOLATED_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
3338 .opening_loc = opening_loc,
3340 .closing_loc = closing_loc
3349pm_interpolated_symbol_node_t *
3351 pm_interpolated_symbol_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_symbol_node_t);
3353 *node = (pm_interpolated_symbol_node_t) {
3354 .base = { .type = PM_INTERPOLATED_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location },
3355 .opening_loc = opening_loc,
3357 .closing_loc = closing_loc
3366pm_interpolated_x_string_node_t *
3368 pm_interpolated_x_string_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_x_string_node_t);
3370 *node = (pm_interpolated_x_string_node_t) {
3371 .base = { .type = PM_INTERPOLATED_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
3372 .opening_loc = opening_loc,
3374 .closing_loc = closing_loc
3383pm_it_local_variable_read_node_t *
3384pm_it_local_variable_read_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location) {
3385 pm_it_local_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_it_local_variable_read_node_t);
3387 *node = (pm_it_local_variable_read_node_t) {
3388 .base = { .type = PM_IT_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }
3397pm_it_parameters_node_t *
3398pm_it_parameters_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location) {
3399 pm_it_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_it_parameters_node_t);
3401 *node = (pm_it_parameters_node_t) {
3402 .base = { .type = PM_IT_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location }
3411pm_keyword_hash_node_t *
3412pm_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) {
3413 pm_keyword_hash_node_t *node = PM_ARENA_ALLOC(arena, pm_keyword_hash_node_t);
3415 *node = (pm_keyword_hash_node_t) {
3416 .base = { .type = PM_KEYWORD_HASH_NODE, .flags = flags, .node_id = node_id, .location = location },
3417 .elements = elements
3426pm_keyword_rest_parameter_node_t *
3428 pm_keyword_rest_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_keyword_rest_parameter_node_t);
3430 *node = (pm_keyword_rest_parameter_node_t) {
3431 .base = { .type = PM_KEYWORD_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3433 .name_loc = name_loc,
3434 .operator_loc = operator_loc
3445 pm_lambda_node_t *node = PM_ARENA_ALLOC(arena, pm_lambda_node_t);
3447 *node = (pm_lambda_node_t) {
3448 .base = { .type = PM_LAMBDA_NODE, .flags = flags, .node_id = node_id, .location = location },
3450 .operator_loc = operator_loc,
3451 .opening_loc = opening_loc,
3452 .closing_loc = closing_loc,
3453 .parameters = parameters,
3463pm_local_variable_and_write_node_t *
3465 pm_local_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_and_write_node_t);
3467 *node = (pm_local_variable_and_write_node_t) {
3468 .base = { .type = PM_LOCAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3469 .name_loc = name_loc,
3470 .operator_loc = operator_loc,
3482pm_local_variable_operator_write_node_t *
3484 pm_local_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_operator_write_node_t);
3486 *node = (pm_local_variable_operator_write_node_t) {
3487 .base = { .type = PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3488 .name_loc = name_loc,
3489 .binary_operator_loc = binary_operator_loc,
3492 .binary_operator = binary_operator,
3502pm_local_variable_or_write_node_t *
3504 pm_local_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_or_write_node_t);
3506 *node = (pm_local_variable_or_write_node_t) {
3507 .base = { .type = PM_LOCAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3508 .name_loc = name_loc,
3509 .operator_loc = operator_loc,
3521pm_local_variable_read_node_t *
3523 pm_local_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_read_node_t);
3525 *node = (pm_local_variable_read_node_t) {
3526 .base = { .type = PM_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3537pm_local_variable_target_node_t *
3539 pm_local_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_target_node_t);
3541 *node = (pm_local_variable_target_node_t) {
3542 .base = { .type = PM_LOCAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3553pm_local_variable_write_node_t *
3555 pm_local_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_write_node_t);
3557 *node = (pm_local_variable_write_node_t) {
3558 .base = { .type = PM_LOCAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3561 .name_loc = name_loc,
3563 .operator_loc = operator_loc
3572pm_match_last_line_node_t *
3574 pm_match_last_line_node_t *node = PM_ARENA_ALLOC(arena, pm_match_last_line_node_t);
3576 *node = (pm_match_last_line_node_t) {
3577 .base = { .type = PM_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location },
3578 .opening_loc = opening_loc,
3579 .content_loc = content_loc,
3580 .closing_loc = closing_loc,
3581 .unescaped = unescaped
3590pm_match_predicate_node_t *
3592 pm_match_predicate_node_t *node = PM_ARENA_ALLOC(arena, pm_match_predicate_node_t);
3594 *node = (pm_match_predicate_node_t) {
3595 .base = { .type = PM_MATCH_PREDICATE_NODE, .flags = flags, .node_id = node_id, .location = location },
3598 .keyword_loc = keyword_loc
3607pm_match_required_node_t *
3609 pm_match_required_node_t *node = PM_ARENA_ALLOC(arena, pm_match_required_node_t);
3611 *node = (pm_match_required_node_t) {
3612 .base = { .type = PM_MATCH_REQUIRED_NODE, .flags = flags, .node_id = node_id, .location = location },
3615 .operator_loc = operator_loc
3624pm_match_write_node_t *
3626 pm_match_write_node_t *node = PM_ARENA_ALLOC(arena, pm_match_write_node_t);
3628 *node = (pm_match_write_node_t) {
3629 .base = { .type = PM_MATCH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3642 pm_module_node_t *node = PM_ARENA_ALLOC(arena, pm_module_node_t);
3644 *node = (pm_module_node_t) {
3645 .base = { .type = PM_MODULE_NODE, .flags = flags, .node_id = node_id, .location = location },
3647 .module_keyword_loc = module_keyword_loc,
3648 .constant_path = constant_path,
3650 .end_keyword_loc = end_keyword_loc,
3660pm_multi_target_node_t *
3662 pm_multi_target_node_t *node = PM_ARENA_ALLOC(arena, pm_multi_target_node_t);
3664 *node = (pm_multi_target_node_t) {
3665 .base = { .type = PM_MULTI_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3669 .lparen_loc = lparen_loc,
3670 .rparen_loc = rparen_loc
3679pm_multi_write_node_t *
3680pm_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) {
3681 pm_multi_write_node_t *node = PM_ARENA_ALLOC(arena, pm_multi_write_node_t);
3683 *node = (pm_multi_write_node_t) {
3684 .base = { .type = PM_MULTI_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3688 .lparen_loc = lparen_loc,
3689 .rparen_loc = rparen_loc,
3690 .operator_loc = operator_loc,
3702 pm_next_node_t *node = PM_ARENA_ALLOC(arena, pm_next_node_t);
3704 *node = (pm_next_node_t) {
3705 .base = { .type = PM_NEXT_NODE, .flags = flags, .node_id = node_id, .location = location },
3706 .arguments = arguments,
3707 .keyword_loc = keyword_loc
3718 pm_nil_node_t *node = PM_ARENA_ALLOC(arena, pm_nil_node_t);
3720 *node = (pm_nil_node_t) {
3721 .base = { .type = PM_NIL_NODE, .flags = flags, .node_id = node_id, .location = location }
3730pm_no_block_parameter_node_t *
3732 pm_no_block_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_no_block_parameter_node_t);
3734 *node = (pm_no_block_parameter_node_t) {
3735 .base = { .type = PM_NO_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3736 .operator_loc = operator_loc,
3737 .keyword_loc = keyword_loc
3746pm_no_keywords_parameter_node_t *
3748 pm_no_keywords_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_no_keywords_parameter_node_t);
3750 *node = (pm_no_keywords_parameter_node_t) {
3751 .base = { .type = PM_NO_KEYWORDS_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3752 .operator_loc = operator_loc,
3753 .keyword_loc = keyword_loc
3762pm_numbered_parameters_node_t *
3763pm_numbered_parameters_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location, uint8_t maximum) {
3764 pm_numbered_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_numbered_parameters_node_t);
3766 *node = (pm_numbered_parameters_node_t) {
3767 .base = { .type = PM_NUMBERED_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
3777pm_numbered_reference_read_node_t *
3778pm_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) {
3779 pm_numbered_reference_read_node_t *node = PM_ARENA_ALLOC(arena, pm_numbered_reference_read_node_t);
3781 *node = (pm_numbered_reference_read_node_t) {
3782 .base = { .type = PM_NUMBERED_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3792pm_optional_keyword_parameter_node_t *
3794 pm_optional_keyword_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_optional_keyword_parameter_node_t);
3796 *node = (pm_optional_keyword_parameter_node_t) {
3797 .base = { .type = PM_OPTIONAL_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3799 .name_loc = name_loc,
3809pm_optional_parameter_node_t *
3811 pm_optional_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_optional_parameter_node_t);
3813 *node = (pm_optional_parameter_node_t) {
3814 .base = { .type = PM_OPTIONAL_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3816 .name_loc = name_loc,
3817 .operator_loc = operator_loc,
3829 pm_or_node_t *node = PM_ARENA_ALLOC(arena, pm_or_node_t);
3831 *node = (pm_or_node_t) {
3832 .base = { .type = PM_OR_NODE, .flags = flags, .node_id = node_id, .location = location },
3835 .operator_loc = operator_loc
3844pm_parameters_node_t *
3845pm_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) {
3846 pm_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_parameters_node_t);
3848 *node = (pm_parameters_node_t) {
3849 .base = { .type = PM_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
3850 .requireds = requireds,
3851 .optionals = optionals,
3854 .keywords = keywords,
3855 .keyword_rest = keyword_rest,
3865pm_parentheses_node_t *
3867 pm_parentheses_node_t *node = PM_ARENA_ALLOC(arena, pm_parentheses_node_t);
3869 *node = (pm_parentheses_node_t) {
3870 .base = { .type = PM_PARENTHESES_NODE, .flags = flags, .node_id = node_id, .location = location },
3872 .opening_loc = opening_loc,
3873 .closing_loc = closing_loc
3882pm_pinned_expression_node_t *
3884 pm_pinned_expression_node_t *node = PM_ARENA_ALLOC(arena, pm_pinned_expression_node_t);
3886 *node = (pm_pinned_expression_node_t) {
3887 .base = { .type = PM_PINNED_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3888 .expression = expression,
3889 .operator_loc = operator_loc,
3890 .lparen_loc = lparen_loc,
3891 .rparen_loc = rparen_loc
3900pm_pinned_variable_node_t *
3902 pm_pinned_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_pinned_variable_node_t);
3904 *node = (pm_pinned_variable_node_t) {
3905 .base = { .type = PM_PINNED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
3906 .variable = variable,
3907 .operator_loc = operator_loc
3916pm_post_execution_node_t *
3918 pm_post_execution_node_t *node = PM_ARENA_ALLOC(arena, pm_post_execution_node_t);
3920 *node = (pm_post_execution_node_t) {
3921 .base = { .type = PM_POST_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location },
3922 .statements = statements,
3923 .keyword_loc = keyword_loc,
3924 .opening_loc = opening_loc,
3925 .closing_loc = closing_loc
3934pm_pre_execution_node_t *
3936 pm_pre_execution_node_t *node = PM_ARENA_ALLOC(arena, pm_pre_execution_node_t);
3938 *node = (pm_pre_execution_node_t) {
3939 .base = { .type = PM_PRE_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location },
3940 .statements = statements,
3941 .keyword_loc = keyword_loc,
3942 .opening_loc = opening_loc,
3943 .closing_loc = closing_loc
3954 pm_program_node_t *node = PM_ARENA_ALLOC(arena, pm_program_node_t);
3956 *node = (pm_program_node_t) {
3957 .base = { .type = PM_PROGRAM_NODE, .flags = flags, .node_id = node_id, .location = location },
3959 .statements = statements
3970 pm_range_node_t *node = PM_ARENA_ALLOC(arena, pm_range_node_t);
3972 *node = (pm_range_node_t) {
3973 .base = { .type = PM_RANGE_NODE, .flags = flags, .node_id = node_id, .location = location },
3976 .operator_loc = operator_loc
3987 pm_rational_node_t *node = PM_ARENA_ALLOC(arena, pm_rational_node_t);
3989 *node = (pm_rational_node_t) {
3990 .base = { .type = PM_RATIONAL_NODE, .flags = flags, .node_id = node_id, .location = location },
3991 .numerator = numerator,
3992 .denominator = denominator
4003 pm_redo_node_t *node = PM_ARENA_ALLOC(arena, pm_redo_node_t);
4005 *node = (pm_redo_node_t) {
4006 .base = { .type = PM_REDO_NODE, .flags = flags, .node_id = node_id, .location = location }
4015pm_regular_expression_node_t *
4017 pm_regular_expression_node_t *node = PM_ARENA_ALLOC(arena, pm_regular_expression_node_t);
4019 *node = (pm_regular_expression_node_t) {
4020 .base = { .type = PM_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
4021 .opening_loc = opening_loc,
4022 .content_loc = content_loc,
4023 .closing_loc = closing_loc,
4024 .unescaped = unescaped
4033pm_required_keyword_parameter_node_t *
4035 pm_required_keyword_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_required_keyword_parameter_node_t);
4037 *node = (pm_required_keyword_parameter_node_t) {
4038 .base = { .type = PM_REQUIRED_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4040 .name_loc = name_loc
4049pm_required_parameter_node_t *
4051 pm_required_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_required_parameter_node_t);
4053 *node = (pm_required_parameter_node_t) {
4054 .base = { .type = PM_REQUIRED_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4064pm_rescue_modifier_node_t *
4066 pm_rescue_modifier_node_t *node = PM_ARENA_ALLOC(arena, pm_rescue_modifier_node_t);
4068 *node = (pm_rescue_modifier_node_t) {
4069 .base = { .type = PM_RESCUE_MODIFIER_NODE, .flags = flags, .node_id = node_id, .location = location },
4070 .expression = expression,
4071 .keyword_loc = keyword_loc,
4072 .rescue_expression = rescue_expression
4082pm_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) {
4083 pm_rescue_node_t *node = PM_ARENA_ALLOC(arena, pm_rescue_node_t);
4085 *node = (pm_rescue_node_t) {
4086 .base = { .type = PM_RESCUE_NODE, .flags = flags, .node_id = node_id, .location = location },
4087 .keyword_loc = keyword_loc,
4088 .exceptions = exceptions,
4089 .operator_loc = operator_loc,
4090 .reference = reference,
4091 .then_keyword_loc = then_keyword_loc,
4092 .statements = statements,
4093 .subsequent = subsequent
4102pm_rest_parameter_node_t *
4104 pm_rest_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_rest_parameter_node_t);
4106 *node = (pm_rest_parameter_node_t) {
4107 .base = { .type = PM_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4109 .name_loc = name_loc,
4110 .operator_loc = operator_loc
4121 pm_retry_node_t *node = PM_ARENA_ALLOC(arena, pm_retry_node_t);
4123 *node = (pm_retry_node_t) {
4124 .base = { .type = PM_RETRY_NODE, .flags = flags, .node_id = node_id, .location = location }
4135 pm_return_node_t *node = PM_ARENA_ALLOC(arena, pm_return_node_t);
4137 *node = (pm_return_node_t) {
4138 .base = { .type = PM_RETURN_NODE, .flags = flags, .node_id = node_id, .location = location },
4139 .keyword_loc = keyword_loc,
4140 .arguments = arguments
4151 pm_self_node_t *node = PM_ARENA_ALLOC(arena, pm_self_node_t);
4153 *node = (pm_self_node_t) {
4154 .base = { .type = PM_SELF_NODE, .flags = flags, .node_id = node_id, .location = location }
4163pm_shareable_constant_node_t *
4165 pm_shareable_constant_node_t *node = PM_ARENA_ALLOC(arena, pm_shareable_constant_node_t);
4167 *node = (pm_shareable_constant_node_t) {
4168 .base = { .type = PM_SHAREABLE_CONSTANT_NODE, .flags = flags, .node_id = node_id, .location = location },
4178pm_singleton_class_node_t *
4180 pm_singleton_class_node_t *node = PM_ARENA_ALLOC(arena, pm_singleton_class_node_t);
4182 *node = (pm_singleton_class_node_t) {
4183 .base = { .type = PM_SINGLETON_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location },
4185 .class_keyword_loc = class_keyword_loc,
4186 .operator_loc = operator_loc,
4187 .expression = expression,
4189 .end_keyword_loc = end_keyword_loc
4198pm_source_encoding_node_t *
4199pm_source_encoding_node_new(
pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags,
pm_location_t location) {
4200 pm_source_encoding_node_t *node = PM_ARENA_ALLOC(arena, pm_source_encoding_node_t);
4202 *node = (pm_source_encoding_node_t) {
4203 .base = { .type = PM_SOURCE_ENCODING_NODE, .flags = flags, .node_id = node_id, .location = location }
4212pm_source_file_node_t *
4214 pm_source_file_node_t *node = PM_ARENA_ALLOC(arena, pm_source_file_node_t);
4216 *node = (pm_source_file_node_t) {
4217 .base = { .type = PM_SOURCE_FILE_NODE, .flags = flags, .node_id = node_id, .location = location },
4218 .filepath = filepath
4227pm_source_line_node_t *
4229 pm_source_line_node_t *node = PM_ARENA_ALLOC(arena, pm_source_line_node_t);
4231 *node = (pm_source_line_node_t) {
4232 .base = { .type = PM_SOURCE_LINE_NODE, .flags = flags, .node_id = node_id, .location = location }
4243 pm_splat_node_t *node = PM_ARENA_ALLOC(arena, pm_splat_node_t);
4245 *node = (pm_splat_node_t) {
4246 .base = { .type = PM_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location },
4247 .operator_loc = operator_loc,
4248 .expression = expression
4257pm_statements_node_t *
4258pm_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) {
4259 pm_statements_node_t *node = PM_ARENA_ALLOC(arena, pm_statements_node_t);
4261 *node = (pm_statements_node_t) {
4262 .base = { .type = PM_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
4274 pm_string_node_t *node = PM_ARENA_ALLOC(arena, pm_string_node_t);
4276 *node = (pm_string_node_t) {
4277 .base = { .type = PM_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
4278 .opening_loc = opening_loc,
4279 .content_loc = content_loc,
4280 .closing_loc = closing_loc,
4281 .unescaped = unescaped
4292 pm_super_node_t *node = PM_ARENA_ALLOC(arena, pm_super_node_t);
4294 *node = (pm_super_node_t) {
4295 .base = { .type = PM_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location },
4296 .keyword_loc = keyword_loc,
4297 .lparen_loc = lparen_loc,
4298 .arguments = arguments,
4299 .rparen_loc = rparen_loc,
4311 pm_symbol_node_t *node = PM_ARENA_ALLOC(arena, pm_symbol_node_t);
4313 *node = (pm_symbol_node_t) {
4314 .base = { .type = PM_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location },
4315 .opening_loc = opening_loc,
4316 .content_loc = content_loc,
4317 .closing_loc = closing_loc,
4318 .unescaped = unescaped
4329 pm_true_node_t *node = PM_ARENA_ALLOC(arena, pm_true_node_t);
4331 *node = (pm_true_node_t) {
4332 .base = { .type = PM_TRUE_NODE, .flags = flags, .node_id = node_id, .location = location }
4343 pm_undef_node_t *node = PM_ARENA_ALLOC(arena, pm_undef_node_t);
4345 *node = (pm_undef_node_t) {
4346 .base = { .type = PM_UNDEF_NODE, .flags = flags, .node_id = node_id, .location = location },
4348 .keyword_loc = keyword_loc
4359 pm_unless_node_t *node = PM_ARENA_ALLOC(arena, pm_unless_node_t);
4361 *node = (pm_unless_node_t) {
4362 .base = { .type = PM_UNLESS_NODE, .flags = flags, .node_id = node_id, .location = location },
4363 .unless_keyword_loc = unless_keyword_loc,
4364 .predicate = predicate,
4365 .then_keyword_loc = then_keyword_loc,
4366 .statements = statements,
4367 .else_clause = else_clause,
4379 pm_until_node_t *node = PM_ARENA_ALLOC(arena, pm_until_node_t);
4381 *node = (pm_until_node_t) {
4382 .base = { .type = PM_UNTIL_NODE, .flags = flags, .node_id = node_id, .location = location },
4383 .until_keyword_loc = until_keyword_loc,
4384 .do_keyword_loc = do_keyword_loc,
4385 .end_keyword_loc = end_keyword_loc,
4386 .predicate = predicate,
4387 .statements = statements
4398 pm_when_node_t *node = PM_ARENA_ALLOC(arena, pm_when_node_t);
4400 *node = (pm_when_node_t) {
4401 .base = { .type = PM_WHEN_NODE, .flags = flags, .node_id = node_id, .location = location },
4402 .when_keyword_loc = when_keyword_loc,
4403 .conditions = conditions,
4404 .then_keyword_loc = then_keyword_loc,
4405 .statements = statements
4416 pm_while_node_t *node = PM_ARENA_ALLOC(arena, pm_while_node_t);
4418 *node = (pm_while_node_t) {
4419 .base = { .type = PM_WHILE_NODE, .flags = flags, .node_id = node_id, .location = location },
4420 .while_keyword_loc = while_keyword_loc,
4421 .do_keyword_loc = do_keyword_loc,
4422 .end_keyword_loc = end_keyword_loc,
4423 .predicate = predicate,
4424 .statements = statements
4435 pm_x_string_node_t *node = PM_ARENA_ALLOC(arena, pm_x_string_node_t);
4437 *node = (pm_x_string_node_t) {
4438 .base = { .type = PM_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
4439 .opening_loc = opening_loc,
4440 .content_loc = content_loc,
4441 .closing_loc = closing_loc,
4442 .unescaped = unescaped
4453 pm_yield_node_t *node = PM_ARENA_ALLOC(arena, pm_yield_node_t);
4455 *node = (pm_yield_node_t) {
4456 .base = { .type = PM_YIELD_NODE, .flags = flags, .node_id = node_id, .location = location },
4457 .keyword_loc = keyword_loc,
4458 .lparen_loc = lparen_loc,
4459 .arguments = arguments,
4460 .rparen_loc = rparen_loc
uint32_t pm_constant_id_t
A constant id is a unique identifier for a constant in the constant pool.
#define PRISM_INLINE
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
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.
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.
pm_visit_result_t
The value returned by a visitor callback, which determines where the walk goes next.
@ PM_VISIT_STOP
End the walk without visiting any more nodes.
@ PM_VISIT_DESCEND
Continue the walk by visiting this node's children.
pm_location_t operator_loc
BlockArgumentNode::operator_loc.
pm_location_t end_keyword_loc
ElseNode::end_keyword_loc.
pm_location_t end_keyword_loc
EnsureNode::end_keyword_loc.
A structure represents an arbitrary-sized integer.
This struct represents a slice in the source code, defined by an offset and a length.
uint32_t size
The number of nodes in the list.
struct pm_node ** nodes
The nodes in the list.
This is the base structure that represents a node in the syntax tree.
A view of a sequence of bytes.