Ruby 3.5.0dev (2025-02-22 revision 412997300569c1853c09813e4924b6df3d7e8669)
node.c
1/*----------------------------------------------------------------------------*/
2/* This file is generated by the templates/template.rb script and should not */
3/* be modified manually. See */
4/* templates/src/node.c.erb */
5/* if you are looking to modify the */
6/* template */
7/*----------------------------------------------------------------------------*/
8
9#line 2 "prism/templates/src/node.c.erb"
10#include "prism/node.h"
11
18static bool
19pm_node_list_grow(pm_node_list_t *list, size_t size) {
20 size_t requested_size = list->size + size;
21
22 // If the requested size caused overflow, return false.
23 if (requested_size < list->size) return false;
24
25 // If the requested size is within the existing capacity, return true.
26 if (requested_size < list->capacity) return true;
27
28 // Otherwise, reallocate the list to be twice as large as it was before.
29 size_t next_capacity = list->capacity == 0 ? 4 : list->capacity * 2;
30
31 // If multiplying by 2 caused overflow, return false.
32 if (next_capacity < list->capacity) return false;
33
34 // If we didn't get enough by doubling, keep doubling until we do.
35 while (requested_size > next_capacity) {
36 size_t double_capacity = next_capacity * 2;
37
38 // Ensure we didn't overflow by multiplying by 2.
39 if (double_capacity < next_capacity) return false;
40 next_capacity = double_capacity;
41 }
42
43 pm_node_t **nodes = (pm_node_t **) xrealloc(list->nodes, sizeof(pm_node_t *) * next_capacity);
44 if (nodes == NULL) return false;
45
46 list->nodes = nodes;
47 list->capacity = next_capacity;
48 return true;
49}
50
54void
55pm_node_list_append(pm_node_list_t *list, pm_node_t *node) {
56 if (pm_node_list_grow(list, 1)) {
57 list->nodes[list->size++] = node;
58 }
59}
60
64void
65pm_node_list_prepend(pm_node_list_t *list, pm_node_t *node) {
66 if (pm_node_list_grow(list, 1)) {
67 memmove(list->nodes + 1, list->nodes, list->size * sizeof(pm_node_t *));
68 list->nodes[0] = node;
69 list->size++;
70 }
71}
72
76void
77pm_node_list_concat(pm_node_list_t *list, pm_node_list_t *other) {
78 if (other->size > 0 && pm_node_list_grow(list, other->size)) {
79 memcpy(list->nodes + list->size, other->nodes, other->size * sizeof(pm_node_t *));
80 list->size += other->size;
81 }
82}
83
87void
88pm_node_list_free(pm_node_list_t *list) {
89 if (list->capacity > 0) {
90 xfree(list->nodes);
91 *list = (pm_node_list_t) { 0 };
92 }
93}
94
96pm_node_destroy(pm_parser_t *parser, pm_node_t *node);
97
101static void
102pm_node_list_destroy(pm_parser_t *parser, pm_node_list_t *list) {
103 pm_node_t *node;
104 PM_NODE_LIST_FOREACH(list, index, node) pm_node_destroy(parser, node);
105 pm_node_list_free(list);
106}
107
114pm_node_destroy(pm_parser_t *parser, pm_node_t *node) {
115 switch (PM_NODE_TYPE(node)) {
116#line 110 "prism/templates/src/node.c.erb"
119 pm_node_destroy(parser, (pm_node_t *)cast->new_name);
120 pm_node_destroy(parser, (pm_node_t *)cast->old_name);
121 break;
122 }
123#line 110 "prism/templates/src/node.c.erb"
126 pm_node_destroy(parser, (pm_node_t *)cast->new_name);
127 pm_node_destroy(parser, (pm_node_t *)cast->old_name);
128 break;
129 }
130#line 110 "prism/templates/src/node.c.erb"
133 pm_node_destroy(parser, (pm_node_t *)cast->left);
134 pm_node_destroy(parser, (pm_node_t *)cast->right);
135 break;
136 }
137#line 110 "prism/templates/src/node.c.erb"
138 case PM_AND_NODE: {
139 pm_and_node_t *cast = (pm_and_node_t *) node;
140 pm_node_destroy(parser, (pm_node_t *)cast->left);
141 pm_node_destroy(parser, (pm_node_t *)cast->right);
142 break;
143 }
144#line 110 "prism/templates/src/node.c.erb"
145 case PM_ARGUMENTS_NODE: {
147 pm_node_list_destroy(parser, &cast->arguments);
148 break;
149 }
150#line 110 "prism/templates/src/node.c.erb"
151 case PM_ARRAY_NODE: {
152 pm_array_node_t *cast = (pm_array_node_t *) node;
153 pm_node_list_destroy(parser, &cast->elements);
154 break;
155 }
156#line 110 "prism/templates/src/node.c.erb"
159 if (cast->constant != NULL) {
160 pm_node_destroy(parser, (pm_node_t *)cast->constant);
161 }
162 pm_node_list_destroy(parser, &cast->requireds);
163 if (cast->rest != NULL) {
164 pm_node_destroy(parser, (pm_node_t *)cast->rest);
165 }
166 pm_node_list_destroy(parser, &cast->posts);
167 break;
168 }
169#line 110 "prism/templates/src/node.c.erb"
170 case PM_ASSOC_NODE: {
171 pm_assoc_node_t *cast = (pm_assoc_node_t *) node;
172 pm_node_destroy(parser, (pm_node_t *)cast->key);
173 pm_node_destroy(parser, (pm_node_t *)cast->value);
174 break;
175 }
176#line 110 "prism/templates/src/node.c.erb"
177 case PM_ASSOC_SPLAT_NODE: {
179 if (cast->value != NULL) {
180 pm_node_destroy(parser, (pm_node_t *)cast->value);
181 }
182 break;
183 }
184#line 110 "prism/templates/src/node.c.erb"
186 break;
187 }
188#line 110 "prism/templates/src/node.c.erb"
189 case PM_BEGIN_NODE: {
190 pm_begin_node_t *cast = (pm_begin_node_t *) node;
191 if (cast->statements != NULL) {
192 pm_node_destroy(parser, (pm_node_t *)cast->statements);
193 }
194 if (cast->rescue_clause != NULL) {
195 pm_node_destroy(parser, (pm_node_t *)cast->rescue_clause);
196 }
197 if (cast->else_clause != NULL) {
198 pm_node_destroy(parser, (pm_node_t *)cast->else_clause);
199 }
200 if (cast->ensure_clause != NULL) {
201 pm_node_destroy(parser, (pm_node_t *)cast->ensure_clause);
202 }
203 break;
204 }
205#line 110 "prism/templates/src/node.c.erb"
208 if (cast->expression != NULL) {
209 pm_node_destroy(parser, (pm_node_t *)cast->expression);
210 }
211 break;
212 }
213#line 110 "prism/templates/src/node.c.erb"
215 break;
216 }
217#line 110 "prism/templates/src/node.c.erb"
218 case PM_BLOCK_NODE: {
219 pm_block_node_t *cast = (pm_block_node_t *) node;
220 pm_constant_id_list_free(&cast->locals);
221 if (cast->parameters != NULL) {
222 pm_node_destroy(parser, (pm_node_t *)cast->parameters);
223 }
224 if (cast->body != NULL) {
225 pm_node_destroy(parser, (pm_node_t *)cast->body);
226 }
227 break;
228 }
229#line 110 "prism/templates/src/node.c.erb"
231 break;
232 }
233#line 110 "prism/templates/src/node.c.erb"
236 if (cast->parameters != NULL) {
237 pm_node_destroy(parser, (pm_node_t *)cast->parameters);
238 }
239 pm_node_list_destroy(parser, &cast->locals);
240 break;
241 }
242#line 110 "prism/templates/src/node.c.erb"
243 case PM_BREAK_NODE: {
244 pm_break_node_t *cast = (pm_break_node_t *) node;
245 if (cast->arguments != NULL) {
246 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
247 }
248 break;
249 }
250#line 110 "prism/templates/src/node.c.erb"
253 if (cast->receiver != NULL) {
254 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
255 }
256 pm_node_destroy(parser, (pm_node_t *)cast->value);
257 break;
258 }
259#line 110 "prism/templates/src/node.c.erb"
260 case PM_CALL_NODE: {
261 pm_call_node_t *cast = (pm_call_node_t *) node;
262 if (cast->receiver != NULL) {
263 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
264 }
265 if (cast->arguments != NULL) {
266 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
267 }
268 if (cast->block != NULL) {
269 pm_node_destroy(parser, (pm_node_t *)cast->block);
270 }
271 break;
272 }
273#line 110 "prism/templates/src/node.c.erb"
276 if (cast->receiver != NULL) {
277 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
278 }
279 pm_node_destroy(parser, (pm_node_t *)cast->value);
280 break;
281 }
282#line 110 "prism/templates/src/node.c.erb"
285 if (cast->receiver != NULL) {
286 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
287 }
288 pm_node_destroy(parser, (pm_node_t *)cast->value);
289 break;
290 }
291#line 110 "prism/templates/src/node.c.erb"
292 case PM_CALL_TARGET_NODE: {
294 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
295 break;
296 }
297#line 110 "prism/templates/src/node.c.erb"
300 pm_node_destroy(parser, (pm_node_t *)cast->value);
301 pm_node_destroy(parser, (pm_node_t *)cast->target);
302 break;
303 }
304#line 110 "prism/templates/src/node.c.erb"
305 case PM_CASE_MATCH_NODE: {
307 if (cast->predicate != NULL) {
308 pm_node_destroy(parser, (pm_node_t *)cast->predicate);
309 }
310 pm_node_list_destroy(parser, &cast->conditions);
311 if (cast->else_clause != NULL) {
312 pm_node_destroy(parser, (pm_node_t *)cast->else_clause);
313 }
314 break;
315 }
316#line 110 "prism/templates/src/node.c.erb"
317 case PM_CASE_NODE: {
318 pm_case_node_t *cast = (pm_case_node_t *) node;
319 if (cast->predicate != NULL) {
320 pm_node_destroy(parser, (pm_node_t *)cast->predicate);
321 }
322 pm_node_list_destroy(parser, &cast->conditions);
323 if (cast->else_clause != NULL) {
324 pm_node_destroy(parser, (pm_node_t *)cast->else_clause);
325 }
326 break;
327 }
328#line 110 "prism/templates/src/node.c.erb"
329 case PM_CLASS_NODE: {
330 pm_class_node_t *cast = (pm_class_node_t *) node;
331 pm_constant_id_list_free(&cast->locals);
332 pm_node_destroy(parser, (pm_node_t *)cast->constant_path);
333 if (cast->superclass != NULL) {
334 pm_node_destroy(parser, (pm_node_t *)cast->superclass);
335 }
336 if (cast->body != NULL) {
337 pm_node_destroy(parser, (pm_node_t *)cast->body);
338 }
339 break;
340 }
341#line 110 "prism/templates/src/node.c.erb"
344 pm_node_destroy(parser, (pm_node_t *)cast->value);
345 break;
346 }
347#line 110 "prism/templates/src/node.c.erb"
350 pm_node_destroy(parser, (pm_node_t *)cast->value);
351 break;
352 }
353#line 110 "prism/templates/src/node.c.erb"
356 pm_node_destroy(parser, (pm_node_t *)cast->value);
357 break;
358 }
359#line 110 "prism/templates/src/node.c.erb"
361 break;
362 }
363#line 110 "prism/templates/src/node.c.erb"
365 break;
366 }
367#line 110 "prism/templates/src/node.c.erb"
370 pm_node_destroy(parser, (pm_node_t *)cast->value);
371 break;
372 }
373#line 110 "prism/templates/src/node.c.erb"
376 pm_node_destroy(parser, (pm_node_t *)cast->value);
377 break;
378 }
379#line 110 "prism/templates/src/node.c.erb"
382 pm_node_destroy(parser, (pm_node_t *)cast->value);
383 break;
384 }
385#line 110 "prism/templates/src/node.c.erb"
388 pm_node_destroy(parser, (pm_node_t *)cast->value);
389 break;
390 }
391#line 110 "prism/templates/src/node.c.erb"
394 pm_node_destroy(parser, (pm_node_t *)cast->target);
395 pm_node_destroy(parser, (pm_node_t *)cast->value);
396 break;
397 }
398#line 110 "prism/templates/src/node.c.erb"
401 if (cast->parent != NULL) {
402 pm_node_destroy(parser, (pm_node_t *)cast->parent);
403 }
404 break;
405 }
406#line 110 "prism/templates/src/node.c.erb"
409 pm_node_destroy(parser, (pm_node_t *)cast->target);
410 pm_node_destroy(parser, (pm_node_t *)cast->value);
411 break;
412 }
413#line 110 "prism/templates/src/node.c.erb"
416 pm_node_destroy(parser, (pm_node_t *)cast->target);
417 pm_node_destroy(parser, (pm_node_t *)cast->value);
418 break;
419 }
420#line 110 "prism/templates/src/node.c.erb"
423 if (cast->parent != NULL) {
424 pm_node_destroy(parser, (pm_node_t *)cast->parent);
425 }
426 break;
427 }
428#line 110 "prism/templates/src/node.c.erb"
431 pm_node_destroy(parser, (pm_node_t *)cast->target);
432 pm_node_destroy(parser, (pm_node_t *)cast->value);
433 break;
434 }
435#line 110 "prism/templates/src/node.c.erb"
437 break;
438 }
439#line 110 "prism/templates/src/node.c.erb"
441 break;
442 }
443#line 110 "prism/templates/src/node.c.erb"
446 pm_node_destroy(parser, (pm_node_t *)cast->value);
447 break;
448 }
449#line 110 "prism/templates/src/node.c.erb"
450 case PM_DEF_NODE: {
451 pm_def_node_t *cast = (pm_def_node_t *) node;
452 if (cast->receiver != NULL) {
453 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
454 }
455 if (cast->parameters != NULL) {
456 pm_node_destroy(parser, (pm_node_t *)cast->parameters);
457 }
458 if (cast->body != NULL) {
459 pm_node_destroy(parser, (pm_node_t *)cast->body);
460 }
461 pm_constant_id_list_free(&cast->locals);
462 break;
463 }
464#line 110 "prism/templates/src/node.c.erb"
465 case PM_DEFINED_NODE: {
466 pm_defined_node_t *cast = (pm_defined_node_t *) node;
467 pm_node_destroy(parser, (pm_node_t *)cast->value);
468 break;
469 }
470#line 110 "prism/templates/src/node.c.erb"
471 case PM_ELSE_NODE: {
472 pm_else_node_t *cast = (pm_else_node_t *) node;
473 if (cast->statements != NULL) {
474 pm_node_destroy(parser, (pm_node_t *)cast->statements);
475 }
476 break;
477 }
478#line 110 "prism/templates/src/node.c.erb"
481 if (cast->statements != NULL) {
482 pm_node_destroy(parser, (pm_node_t *)cast->statements);
483 }
484 break;
485 }
486#line 110 "prism/templates/src/node.c.erb"
489 pm_node_destroy(parser, (pm_node_t *)cast->variable);
490 break;
491 }
492#line 110 "prism/templates/src/node.c.erb"
493 case PM_ENSURE_NODE: {
494 pm_ensure_node_t *cast = (pm_ensure_node_t *) node;
495 if (cast->statements != NULL) {
496 pm_node_destroy(parser, (pm_node_t *)cast->statements);
497 }
498 break;
499 }
500#line 110 "prism/templates/src/node.c.erb"
501 case PM_FALSE_NODE: {
502 break;
503 }
504#line 110 "prism/templates/src/node.c.erb"
507 if (cast->constant != NULL) {
508 pm_node_destroy(parser, (pm_node_t *)cast->constant);
509 }
510 pm_node_destroy(parser, (pm_node_t *)cast->left);
511 pm_node_list_destroy(parser, &cast->requireds);
512 pm_node_destroy(parser, (pm_node_t *)cast->right);
513 break;
514 }
515#line 110 "prism/templates/src/node.c.erb"
516 case PM_FLIP_FLOP_NODE: {
518 if (cast->left != NULL) {
519 pm_node_destroy(parser, (pm_node_t *)cast->left);
520 }
521 if (cast->right != NULL) {
522 pm_node_destroy(parser, (pm_node_t *)cast->right);
523 }
524 break;
525 }
526#line 110 "prism/templates/src/node.c.erb"
527 case PM_FLOAT_NODE: {
528 break;
529 }
530#line 110 "prism/templates/src/node.c.erb"
531 case PM_FOR_NODE: {
532 pm_for_node_t *cast = (pm_for_node_t *) node;
533 pm_node_destroy(parser, (pm_node_t *)cast->index);
534 pm_node_destroy(parser, (pm_node_t *)cast->collection);
535 if (cast->statements != NULL) {
536 pm_node_destroy(parser, (pm_node_t *)cast->statements);
537 }
538 break;
539 }
540#line 110 "prism/templates/src/node.c.erb"
542 break;
543 }
544#line 110 "prism/templates/src/node.c.erb"
546 break;
547 }
548#line 110 "prism/templates/src/node.c.erb"
551 if (cast->block != NULL) {
552 pm_node_destroy(parser, (pm_node_t *)cast->block);
553 }
554 break;
555 }
556#line 110 "prism/templates/src/node.c.erb"
559 pm_node_destroy(parser, (pm_node_t *)cast->value);
560 break;
561 }
562#line 110 "prism/templates/src/node.c.erb"
565 pm_node_destroy(parser, (pm_node_t *)cast->value);
566 break;
567 }
568#line 110 "prism/templates/src/node.c.erb"
571 pm_node_destroy(parser, (pm_node_t *)cast->value);
572 break;
573 }
574#line 110 "prism/templates/src/node.c.erb"
576 break;
577 }
578#line 110 "prism/templates/src/node.c.erb"
580 break;
581 }
582#line 110 "prism/templates/src/node.c.erb"
585 pm_node_destroy(parser, (pm_node_t *)cast->value);
586 break;
587 }
588#line 110 "prism/templates/src/node.c.erb"
589 case PM_HASH_NODE: {
590 pm_hash_node_t *cast = (pm_hash_node_t *) node;
591 pm_node_list_destroy(parser, &cast->elements);
592 break;
593 }
594#line 110 "prism/templates/src/node.c.erb"
597 if (cast->constant != NULL) {
598 pm_node_destroy(parser, (pm_node_t *)cast->constant);
599 }
600 pm_node_list_destroy(parser, &cast->elements);
601 if (cast->rest != NULL) {
602 pm_node_destroy(parser, (pm_node_t *)cast->rest);
603 }
604 break;
605 }
606#line 110 "prism/templates/src/node.c.erb"
607 case PM_IF_NODE: {
608 pm_if_node_t *cast = (pm_if_node_t *) node;
609 pm_node_destroy(parser, (pm_node_t *)cast->predicate);
610 if (cast->statements != NULL) {
611 pm_node_destroy(parser, (pm_node_t *)cast->statements);
612 }
613 if (cast->subsequent != NULL) {
614 pm_node_destroy(parser, (pm_node_t *)cast->subsequent);
615 }
616 break;
617 }
618#line 110 "prism/templates/src/node.c.erb"
619 case PM_IMAGINARY_NODE: {
621 pm_node_destroy(parser, (pm_node_t *)cast->numeric);
622 break;
623 }
624#line 110 "prism/templates/src/node.c.erb"
625 case PM_IMPLICIT_NODE: {
626 pm_implicit_node_t *cast = (pm_implicit_node_t *) node;
627 pm_node_destroy(parser, (pm_node_t *)cast->value);
628 break;
629 }
630#line 110 "prism/templates/src/node.c.erb"
632 break;
633 }
634#line 110 "prism/templates/src/node.c.erb"
635 case PM_IN_NODE: {
636 pm_in_node_t *cast = (pm_in_node_t *) node;
637 pm_node_destroy(parser, (pm_node_t *)cast->pattern);
638 if (cast->statements != NULL) {
639 pm_node_destroy(parser, (pm_node_t *)cast->statements);
640 }
641 break;
642 }
643#line 110 "prism/templates/src/node.c.erb"
646 if (cast->receiver != NULL) {
647 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
648 }
649 if (cast->arguments != NULL) {
650 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
651 }
652 if (cast->block != NULL) {
653 pm_node_destroy(parser, (pm_node_t *)cast->block);
654 }
655 pm_node_destroy(parser, (pm_node_t *)cast->value);
656 break;
657 }
658#line 110 "prism/templates/src/node.c.erb"
661 if (cast->receiver != NULL) {
662 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
663 }
664 if (cast->arguments != NULL) {
665 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
666 }
667 if (cast->block != NULL) {
668 pm_node_destroy(parser, (pm_node_t *)cast->block);
669 }
670 pm_node_destroy(parser, (pm_node_t *)cast->value);
671 break;
672 }
673#line 110 "prism/templates/src/node.c.erb"
676 if (cast->receiver != NULL) {
677 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
678 }
679 if (cast->arguments != NULL) {
680 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
681 }
682 if (cast->block != NULL) {
683 pm_node_destroy(parser, (pm_node_t *)cast->block);
684 }
685 pm_node_destroy(parser, (pm_node_t *)cast->value);
686 break;
687 }
688#line 110 "prism/templates/src/node.c.erb"
691 pm_node_destroy(parser, (pm_node_t *)cast->receiver);
692 if (cast->arguments != NULL) {
693 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
694 }
695 if (cast->block != NULL) {
696 pm_node_destroy(parser, (pm_node_t *)cast->block);
697 }
698 break;
699 }
700#line 110 "prism/templates/src/node.c.erb"
703 pm_node_destroy(parser, (pm_node_t *)cast->value);
704 break;
705 }
706#line 110 "prism/templates/src/node.c.erb"
709 pm_node_destroy(parser, (pm_node_t *)cast->value);
710 break;
711 }
712#line 110 "prism/templates/src/node.c.erb"
715 pm_node_destroy(parser, (pm_node_t *)cast->value);
716 break;
717 }
718#line 110 "prism/templates/src/node.c.erb"
720 break;
721 }
722#line 110 "prism/templates/src/node.c.erb"
724 break;
725 }
726#line 110 "prism/templates/src/node.c.erb"
729 pm_node_destroy(parser, (pm_node_t *)cast->value);
730 break;
731 }
732#line 110 "prism/templates/src/node.c.erb"
733 case PM_INTEGER_NODE: {
734 pm_integer_node_t *cast = (pm_integer_node_t *) node;
735 pm_integer_free(&cast->value);
736 break;
737 }
738#line 110 "prism/templates/src/node.c.erb"
741 pm_node_list_destroy(parser, &cast->parts);
742 break;
743 }
744#line 110 "prism/templates/src/node.c.erb"
747 pm_node_list_destroy(parser, &cast->parts);
748 break;
749 }
750#line 110 "prism/templates/src/node.c.erb"
753 pm_node_list_destroy(parser, &cast->parts);
754 break;
755 }
756#line 110 "prism/templates/src/node.c.erb"
759 pm_node_list_destroy(parser, &cast->parts);
760 break;
761 }
762#line 110 "prism/templates/src/node.c.erb"
765 pm_node_list_destroy(parser, &cast->parts);
766 break;
767 }
768#line 110 "prism/templates/src/node.c.erb"
770 break;
771 }
772#line 110 "prism/templates/src/node.c.erb"
774 break;
775 }
776#line 110 "prism/templates/src/node.c.erb"
779 pm_node_list_destroy(parser, &cast->elements);
780 break;
781 }
782#line 110 "prism/templates/src/node.c.erb"
784 break;
785 }
786#line 110 "prism/templates/src/node.c.erb"
787 case PM_LAMBDA_NODE: {
788 pm_lambda_node_t *cast = (pm_lambda_node_t *) node;
789 pm_constant_id_list_free(&cast->locals);
790 if (cast->parameters != NULL) {
791 pm_node_destroy(parser, (pm_node_t *)cast->parameters);
792 }
793 if (cast->body != NULL) {
794 pm_node_destroy(parser, (pm_node_t *)cast->body);
795 }
796 break;
797 }
798#line 110 "prism/templates/src/node.c.erb"
801 pm_node_destroy(parser, (pm_node_t *)cast->value);
802 break;
803 }
804#line 110 "prism/templates/src/node.c.erb"
807 pm_node_destroy(parser, (pm_node_t *)cast->value);
808 break;
809 }
810#line 110 "prism/templates/src/node.c.erb"
813 pm_node_destroy(parser, (pm_node_t *)cast->value);
814 break;
815 }
816#line 110 "prism/templates/src/node.c.erb"
818 break;
819 }
820#line 110 "prism/templates/src/node.c.erb"
822 break;
823 }
824#line 110 "prism/templates/src/node.c.erb"
827 pm_node_destroy(parser, (pm_node_t *)cast->value);
828 break;
829 }
830#line 110 "prism/templates/src/node.c.erb"
833 pm_string_free(&cast->unescaped);
834 break;
835 }
836#line 110 "prism/templates/src/node.c.erb"
839 pm_node_destroy(parser, (pm_node_t *)cast->value);
840 pm_node_destroy(parser, (pm_node_t *)cast->pattern);
841 break;
842 }
843#line 110 "prism/templates/src/node.c.erb"
846 pm_node_destroy(parser, (pm_node_t *)cast->value);
847 pm_node_destroy(parser, (pm_node_t *)cast->pattern);
848 break;
849 }
850#line 110 "prism/templates/src/node.c.erb"
851 case PM_MATCH_WRITE_NODE: {
853 pm_node_destroy(parser, (pm_node_t *)cast->call);
854 pm_node_list_destroy(parser, &cast->targets);
855 break;
856 }
857#line 110 "prism/templates/src/node.c.erb"
858 case PM_MISSING_NODE: {
859 break;
860 }
861#line 110 "prism/templates/src/node.c.erb"
862 case PM_MODULE_NODE: {
863 pm_module_node_t *cast = (pm_module_node_t *) node;
864 pm_constant_id_list_free(&cast->locals);
865 pm_node_destroy(parser, (pm_node_t *)cast->constant_path);
866 if (cast->body != NULL) {
867 pm_node_destroy(parser, (pm_node_t *)cast->body);
868 }
869 break;
870 }
871#line 110 "prism/templates/src/node.c.erb"
874 pm_node_list_destroy(parser, &cast->lefts);
875 if (cast->rest != NULL) {
876 pm_node_destroy(parser, (pm_node_t *)cast->rest);
877 }
878 pm_node_list_destroy(parser, &cast->rights);
879 break;
880 }
881#line 110 "prism/templates/src/node.c.erb"
882 case PM_MULTI_WRITE_NODE: {
884 pm_node_list_destroy(parser, &cast->lefts);
885 if (cast->rest != NULL) {
886 pm_node_destroy(parser, (pm_node_t *)cast->rest);
887 }
888 pm_node_list_destroy(parser, &cast->rights);
889 pm_node_destroy(parser, (pm_node_t *)cast->value);
890 break;
891 }
892#line 110 "prism/templates/src/node.c.erb"
893 case PM_NEXT_NODE: {
894 pm_next_node_t *cast = (pm_next_node_t *) node;
895 if (cast->arguments != NULL) {
896 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
897 }
898 break;
899 }
900#line 110 "prism/templates/src/node.c.erb"
901 case PM_NIL_NODE: {
902 break;
903 }
904#line 110 "prism/templates/src/node.c.erb"
906 break;
907 }
908#line 110 "prism/templates/src/node.c.erb"
910 break;
911 }
912#line 110 "prism/templates/src/node.c.erb"
914 break;
915 }
916#line 110 "prism/templates/src/node.c.erb"
919 pm_node_destroy(parser, (pm_node_t *)cast->value);
920 break;
921 }
922#line 110 "prism/templates/src/node.c.erb"
925 pm_node_destroy(parser, (pm_node_t *)cast->value);
926 break;
927 }
928#line 110 "prism/templates/src/node.c.erb"
929 case PM_OR_NODE: {
930 pm_or_node_t *cast = (pm_or_node_t *) node;
931 pm_node_destroy(parser, (pm_node_t *)cast->left);
932 pm_node_destroy(parser, (pm_node_t *)cast->right);
933 break;
934 }
935#line 110 "prism/templates/src/node.c.erb"
936 case PM_PARAMETERS_NODE: {
938 pm_node_list_destroy(parser, &cast->requireds);
939 pm_node_list_destroy(parser, &cast->optionals);
940 if (cast->rest != NULL) {
941 pm_node_destroy(parser, (pm_node_t *)cast->rest);
942 }
943 pm_node_list_destroy(parser, &cast->posts);
944 pm_node_list_destroy(parser, &cast->keywords);
945 if (cast->keyword_rest != NULL) {
946 pm_node_destroy(parser, (pm_node_t *)cast->keyword_rest);
947 }
948 if (cast->block != NULL) {
949 pm_node_destroy(parser, (pm_node_t *)cast->block);
950 }
951 break;
952 }
953#line 110 "prism/templates/src/node.c.erb"
954 case PM_PARENTHESES_NODE: {
956 if (cast->body != NULL) {
957 pm_node_destroy(parser, (pm_node_t *)cast->body);
958 }
959 break;
960 }
961#line 110 "prism/templates/src/node.c.erb"
964 pm_node_destroy(parser, (pm_node_t *)cast->expression);
965 break;
966 }
967#line 110 "prism/templates/src/node.c.erb"
970 pm_node_destroy(parser, (pm_node_t *)cast->variable);
971 break;
972 }
973#line 110 "prism/templates/src/node.c.erb"
976 if (cast->statements != NULL) {
977 pm_node_destroy(parser, (pm_node_t *)cast->statements);
978 }
979 break;
980 }
981#line 110 "prism/templates/src/node.c.erb"
984 if (cast->statements != NULL) {
985 pm_node_destroy(parser, (pm_node_t *)cast->statements);
986 }
987 break;
988 }
989#line 110 "prism/templates/src/node.c.erb"
990 case PM_PROGRAM_NODE: {
991 pm_program_node_t *cast = (pm_program_node_t *) node;
992 pm_constant_id_list_free(&cast->locals);
993 pm_node_destroy(parser, (pm_node_t *)cast->statements);
994 break;
995 }
996#line 110 "prism/templates/src/node.c.erb"
997 case PM_RANGE_NODE: {
998 pm_range_node_t *cast = (pm_range_node_t *) node;
999 if (cast->left != NULL) {
1000 pm_node_destroy(parser, (pm_node_t *)cast->left);
1001 }
1002 if (cast->right != NULL) {
1003 pm_node_destroy(parser, (pm_node_t *)cast->right);
1004 }
1005 break;
1006 }
1007#line 110 "prism/templates/src/node.c.erb"
1008 case PM_RATIONAL_NODE: {
1009 pm_rational_node_t *cast = (pm_rational_node_t *) node;
1010 pm_integer_free(&cast->numerator);
1011 pm_integer_free(&cast->denominator);
1012 break;
1013 }
1014#line 110 "prism/templates/src/node.c.erb"
1015 case PM_REDO_NODE: {
1016 break;
1017 }
1018#line 110 "prism/templates/src/node.c.erb"
1021 pm_string_free(&cast->unescaped);
1022 break;
1023 }
1024#line 110 "prism/templates/src/node.c.erb"
1026 break;
1027 }
1028#line 110 "prism/templates/src/node.c.erb"
1030 break;
1031 }
1032#line 110 "prism/templates/src/node.c.erb"
1035 pm_node_destroy(parser, (pm_node_t *)cast->expression);
1036 pm_node_destroy(parser, (pm_node_t *)cast->rescue_expression);
1037 break;
1038 }
1039#line 110 "prism/templates/src/node.c.erb"
1040 case PM_RESCUE_NODE: {
1041 pm_rescue_node_t *cast = (pm_rescue_node_t *) node;
1042 pm_node_list_destroy(parser, &cast->exceptions);
1043 if (cast->reference != NULL) {
1044 pm_node_destroy(parser, (pm_node_t *)cast->reference);
1045 }
1046 if (cast->statements != NULL) {
1047 pm_node_destroy(parser, (pm_node_t *)cast->statements);
1048 }
1049 if (cast->subsequent != NULL) {
1050 pm_node_destroy(parser, (pm_node_t *)cast->subsequent);
1051 }
1052 break;
1053 }
1054#line 110 "prism/templates/src/node.c.erb"
1056 break;
1057 }
1058#line 110 "prism/templates/src/node.c.erb"
1059 case PM_RETRY_NODE: {
1060 break;
1061 }
1062#line 110 "prism/templates/src/node.c.erb"
1063 case PM_RETURN_NODE: {
1064 pm_return_node_t *cast = (pm_return_node_t *) node;
1065 if (cast->arguments != NULL) {
1066 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
1067 }
1068 break;
1069 }
1070#line 110 "prism/templates/src/node.c.erb"
1071 case PM_SELF_NODE: {
1072 break;
1073 }
1074#line 110 "prism/templates/src/node.c.erb"
1077 pm_node_destroy(parser, (pm_node_t *)cast->write);
1078 break;
1079 }
1080#line 110 "prism/templates/src/node.c.erb"
1083 pm_constant_id_list_free(&cast->locals);
1084 pm_node_destroy(parser, (pm_node_t *)cast->expression);
1085 if (cast->body != NULL) {
1086 pm_node_destroy(parser, (pm_node_t *)cast->body);
1087 }
1088 break;
1089 }
1090#line 110 "prism/templates/src/node.c.erb"
1092 break;
1093 }
1094#line 110 "prism/templates/src/node.c.erb"
1095 case PM_SOURCE_FILE_NODE: {
1097 pm_string_free(&cast->filepath);
1098 break;
1099 }
1100#line 110 "prism/templates/src/node.c.erb"
1101 case PM_SOURCE_LINE_NODE: {
1102 break;
1103 }
1104#line 110 "prism/templates/src/node.c.erb"
1105 case PM_SPLAT_NODE: {
1106 pm_splat_node_t *cast = (pm_splat_node_t *) node;
1107 if (cast->expression != NULL) {
1108 pm_node_destroy(parser, (pm_node_t *)cast->expression);
1109 }
1110 break;
1111 }
1112#line 110 "prism/templates/src/node.c.erb"
1113 case PM_STATEMENTS_NODE: {
1115 pm_node_list_destroy(parser, &cast->body);
1116 break;
1117 }
1118#line 110 "prism/templates/src/node.c.erb"
1119 case PM_STRING_NODE: {
1120 pm_string_node_t *cast = (pm_string_node_t *) node;
1121 pm_string_free(&cast->unescaped);
1122 break;
1123 }
1124#line 110 "prism/templates/src/node.c.erb"
1125 case PM_SUPER_NODE: {
1126 pm_super_node_t *cast = (pm_super_node_t *) node;
1127 if (cast->arguments != NULL) {
1128 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
1129 }
1130 if (cast->block != NULL) {
1131 pm_node_destroy(parser, (pm_node_t *)cast->block);
1132 }
1133 break;
1134 }
1135#line 110 "prism/templates/src/node.c.erb"
1136 case PM_SYMBOL_NODE: {
1137 pm_symbol_node_t *cast = (pm_symbol_node_t *) node;
1138 pm_string_free(&cast->unescaped);
1139 break;
1140 }
1141#line 110 "prism/templates/src/node.c.erb"
1142 case PM_TRUE_NODE: {
1143 break;
1144 }
1145#line 110 "prism/templates/src/node.c.erb"
1146 case PM_UNDEF_NODE: {
1147 pm_undef_node_t *cast = (pm_undef_node_t *) node;
1148 pm_node_list_destroy(parser, &cast->names);
1149 break;
1150 }
1151#line 110 "prism/templates/src/node.c.erb"
1152 case PM_UNLESS_NODE: {
1153 pm_unless_node_t *cast = (pm_unless_node_t *) node;
1154 pm_node_destroy(parser, (pm_node_t *)cast->predicate);
1155 if (cast->statements != NULL) {
1156 pm_node_destroy(parser, (pm_node_t *)cast->statements);
1157 }
1158 if (cast->else_clause != NULL) {
1159 pm_node_destroy(parser, (pm_node_t *)cast->else_clause);
1160 }
1161 break;
1162 }
1163#line 110 "prism/templates/src/node.c.erb"
1164 case PM_UNTIL_NODE: {
1165 pm_until_node_t *cast = (pm_until_node_t *) node;
1166 pm_node_destroy(parser, (pm_node_t *)cast->predicate);
1167 if (cast->statements != NULL) {
1168 pm_node_destroy(parser, (pm_node_t *)cast->statements);
1169 }
1170 break;
1171 }
1172#line 110 "prism/templates/src/node.c.erb"
1173 case PM_WHEN_NODE: {
1174 pm_when_node_t *cast = (pm_when_node_t *) node;
1175 pm_node_list_destroy(parser, &cast->conditions);
1176 if (cast->statements != NULL) {
1177 pm_node_destroy(parser, (pm_node_t *)cast->statements);
1178 }
1179 break;
1180 }
1181#line 110 "prism/templates/src/node.c.erb"
1182 case PM_WHILE_NODE: {
1183 pm_while_node_t *cast = (pm_while_node_t *) node;
1184 pm_node_destroy(parser, (pm_node_t *)cast->predicate);
1185 if (cast->statements != NULL) {
1186 pm_node_destroy(parser, (pm_node_t *)cast->statements);
1187 }
1188 break;
1189 }
1190#line 110 "prism/templates/src/node.c.erb"
1191 case PM_X_STRING_NODE: {
1192 pm_x_string_node_t *cast = (pm_x_string_node_t *) node;
1193 pm_string_free(&cast->unescaped);
1194 break;
1195 }
1196#line 110 "prism/templates/src/node.c.erb"
1197 case PM_YIELD_NODE: {
1198 pm_yield_node_t *cast = (pm_yield_node_t *) node;
1199 if (cast->arguments != NULL) {
1200 pm_node_destroy(parser, (pm_node_t *)cast->arguments);
1201 }
1202 break;
1203 }
1204#line 139 "prism/templates/src/node.c.erb"
1205 default:
1206 assert(false && "unreachable");
1207 break;
1208 }
1209 xfree(node);
1210}
1211
1215PRISM_EXPORTED_FUNCTION const char *
1216pm_node_type_to_str(pm_node_type_t node_type)
1217{
1218 switch (node_type) {
1220 return "PM_ALIAS_GLOBAL_VARIABLE_NODE";
1222 return "PM_ALIAS_METHOD_NODE";
1224 return "PM_ALTERNATION_PATTERN_NODE";
1225 case PM_AND_NODE:
1226 return "PM_AND_NODE";
1227 case PM_ARGUMENTS_NODE:
1228 return "PM_ARGUMENTS_NODE";
1229 case PM_ARRAY_NODE:
1230 return "PM_ARRAY_NODE";
1232 return "PM_ARRAY_PATTERN_NODE";
1233 case PM_ASSOC_NODE:
1234 return "PM_ASSOC_NODE";
1236 return "PM_ASSOC_SPLAT_NODE";
1238 return "PM_BACK_REFERENCE_READ_NODE";
1239 case PM_BEGIN_NODE:
1240 return "PM_BEGIN_NODE";
1242 return "PM_BLOCK_ARGUMENT_NODE";
1244 return "PM_BLOCK_LOCAL_VARIABLE_NODE";
1245 case PM_BLOCK_NODE:
1246 return "PM_BLOCK_NODE";
1248 return "PM_BLOCK_PARAMETER_NODE";
1250 return "PM_BLOCK_PARAMETERS_NODE";
1251 case PM_BREAK_NODE:
1252 return "PM_BREAK_NODE";
1254 return "PM_CALL_AND_WRITE_NODE";
1255 case PM_CALL_NODE:
1256 return "PM_CALL_NODE";
1258 return "PM_CALL_OPERATOR_WRITE_NODE";
1260 return "PM_CALL_OR_WRITE_NODE";
1262 return "PM_CALL_TARGET_NODE";
1264 return "PM_CAPTURE_PATTERN_NODE";
1265 case PM_CASE_MATCH_NODE:
1266 return "PM_CASE_MATCH_NODE";
1267 case PM_CASE_NODE:
1268 return "PM_CASE_NODE";
1269 case PM_CLASS_NODE:
1270 return "PM_CLASS_NODE";
1272 return "PM_CLASS_VARIABLE_AND_WRITE_NODE";
1274 return "PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE";
1276 return "PM_CLASS_VARIABLE_OR_WRITE_NODE";
1278 return "PM_CLASS_VARIABLE_READ_NODE";
1280 return "PM_CLASS_VARIABLE_TARGET_NODE";
1282 return "PM_CLASS_VARIABLE_WRITE_NODE";
1284 return "PM_CONSTANT_AND_WRITE_NODE";
1286 return "PM_CONSTANT_OPERATOR_WRITE_NODE";
1288 return "PM_CONSTANT_OR_WRITE_NODE";
1290 return "PM_CONSTANT_PATH_AND_WRITE_NODE";
1292 return "PM_CONSTANT_PATH_NODE";
1294 return "PM_CONSTANT_PATH_OPERATOR_WRITE_NODE";
1296 return "PM_CONSTANT_PATH_OR_WRITE_NODE";
1298 return "PM_CONSTANT_PATH_TARGET_NODE";
1300 return "PM_CONSTANT_PATH_WRITE_NODE";
1302 return "PM_CONSTANT_READ_NODE";
1304 return "PM_CONSTANT_TARGET_NODE";
1306 return "PM_CONSTANT_WRITE_NODE";
1307 case PM_DEF_NODE:
1308 return "PM_DEF_NODE";
1309 case PM_DEFINED_NODE:
1310 return "PM_DEFINED_NODE";
1311 case PM_ELSE_NODE:
1312 return "PM_ELSE_NODE";
1314 return "PM_EMBEDDED_STATEMENTS_NODE";
1316 return "PM_EMBEDDED_VARIABLE_NODE";
1317 case PM_ENSURE_NODE:
1318 return "PM_ENSURE_NODE";
1319 case PM_FALSE_NODE:
1320 return "PM_FALSE_NODE";
1322 return "PM_FIND_PATTERN_NODE";
1323 case PM_FLIP_FLOP_NODE:
1324 return "PM_FLIP_FLOP_NODE";
1325 case PM_FLOAT_NODE:
1326 return "PM_FLOAT_NODE";
1327 case PM_FOR_NODE:
1328 return "PM_FOR_NODE";
1330 return "PM_FORWARDING_ARGUMENTS_NODE";
1332 return "PM_FORWARDING_PARAMETER_NODE";
1334 return "PM_FORWARDING_SUPER_NODE";
1336 return "PM_GLOBAL_VARIABLE_AND_WRITE_NODE";
1338 return "PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE";
1340 return "PM_GLOBAL_VARIABLE_OR_WRITE_NODE";
1342 return "PM_GLOBAL_VARIABLE_READ_NODE";
1344 return "PM_GLOBAL_VARIABLE_TARGET_NODE";
1346 return "PM_GLOBAL_VARIABLE_WRITE_NODE";
1347 case PM_HASH_NODE:
1348 return "PM_HASH_NODE";
1350 return "PM_HASH_PATTERN_NODE";
1351 case PM_IF_NODE:
1352 return "PM_IF_NODE";
1353 case PM_IMAGINARY_NODE:
1354 return "PM_IMAGINARY_NODE";
1355 case PM_IMPLICIT_NODE:
1356 return "PM_IMPLICIT_NODE";
1358 return "PM_IMPLICIT_REST_NODE";
1359 case PM_IN_NODE:
1360 return "PM_IN_NODE";
1362 return "PM_INDEX_AND_WRITE_NODE";
1364 return "PM_INDEX_OPERATOR_WRITE_NODE";
1366 return "PM_INDEX_OR_WRITE_NODE";
1368 return "PM_INDEX_TARGET_NODE";
1370 return "PM_INSTANCE_VARIABLE_AND_WRITE_NODE";
1372 return "PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE";
1374 return "PM_INSTANCE_VARIABLE_OR_WRITE_NODE";
1376 return "PM_INSTANCE_VARIABLE_READ_NODE";
1378 return "PM_INSTANCE_VARIABLE_TARGET_NODE";
1380 return "PM_INSTANCE_VARIABLE_WRITE_NODE";
1381 case PM_INTEGER_NODE:
1382 return "PM_INTEGER_NODE";
1384 return "PM_INTERPOLATED_MATCH_LAST_LINE_NODE";
1386 return "PM_INTERPOLATED_REGULAR_EXPRESSION_NODE";
1388 return "PM_INTERPOLATED_STRING_NODE";
1390 return "PM_INTERPOLATED_SYMBOL_NODE";
1392 return "PM_INTERPOLATED_X_STRING_NODE";
1394 return "PM_IT_LOCAL_VARIABLE_READ_NODE";
1396 return "PM_IT_PARAMETERS_NODE";
1398 return "PM_KEYWORD_HASH_NODE";
1400 return "PM_KEYWORD_REST_PARAMETER_NODE";
1401 case PM_LAMBDA_NODE:
1402 return "PM_LAMBDA_NODE";
1404 return "PM_LOCAL_VARIABLE_AND_WRITE_NODE";
1406 return "PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE";
1408 return "PM_LOCAL_VARIABLE_OR_WRITE_NODE";
1410 return "PM_LOCAL_VARIABLE_READ_NODE";
1412 return "PM_LOCAL_VARIABLE_TARGET_NODE";
1414 return "PM_LOCAL_VARIABLE_WRITE_NODE";
1416 return "PM_MATCH_LAST_LINE_NODE";
1418 return "PM_MATCH_PREDICATE_NODE";
1420 return "PM_MATCH_REQUIRED_NODE";
1422 return "PM_MATCH_WRITE_NODE";
1423 case PM_MISSING_NODE:
1424 return "PM_MISSING_NODE";
1425 case PM_MODULE_NODE:
1426 return "PM_MODULE_NODE";
1428 return "PM_MULTI_TARGET_NODE";
1430 return "PM_MULTI_WRITE_NODE";
1431 case PM_NEXT_NODE:
1432 return "PM_NEXT_NODE";
1433 case PM_NIL_NODE:
1434 return "PM_NIL_NODE";
1436 return "PM_NO_KEYWORDS_PARAMETER_NODE";
1438 return "PM_NUMBERED_PARAMETERS_NODE";
1440 return "PM_NUMBERED_REFERENCE_READ_NODE";
1442 return "PM_OPTIONAL_KEYWORD_PARAMETER_NODE";
1444 return "PM_OPTIONAL_PARAMETER_NODE";
1445 case PM_OR_NODE:
1446 return "PM_OR_NODE";
1447 case PM_PARAMETERS_NODE:
1448 return "PM_PARAMETERS_NODE";
1450 return "PM_PARENTHESES_NODE";
1452 return "PM_PINNED_EXPRESSION_NODE";
1454 return "PM_PINNED_VARIABLE_NODE";
1456 return "PM_POST_EXECUTION_NODE";
1458 return "PM_PRE_EXECUTION_NODE";
1459 case PM_PROGRAM_NODE:
1460 return "PM_PROGRAM_NODE";
1461 case PM_RANGE_NODE:
1462 return "PM_RANGE_NODE";
1463 case PM_RATIONAL_NODE:
1464 return "PM_RATIONAL_NODE";
1465 case PM_REDO_NODE:
1466 return "PM_REDO_NODE";
1468 return "PM_REGULAR_EXPRESSION_NODE";
1470 return "PM_REQUIRED_KEYWORD_PARAMETER_NODE";
1472 return "PM_REQUIRED_PARAMETER_NODE";
1474 return "PM_RESCUE_MODIFIER_NODE";
1475 case PM_RESCUE_NODE:
1476 return "PM_RESCUE_NODE";
1478 return "PM_REST_PARAMETER_NODE";
1479 case PM_RETRY_NODE:
1480 return "PM_RETRY_NODE";
1481 case PM_RETURN_NODE:
1482 return "PM_RETURN_NODE";
1483 case PM_SELF_NODE:
1484 return "PM_SELF_NODE";
1486 return "PM_SHAREABLE_CONSTANT_NODE";
1488 return "PM_SINGLETON_CLASS_NODE";
1490 return "PM_SOURCE_ENCODING_NODE";
1492 return "PM_SOURCE_FILE_NODE";
1494 return "PM_SOURCE_LINE_NODE";
1495 case PM_SPLAT_NODE:
1496 return "PM_SPLAT_NODE";
1497 case PM_STATEMENTS_NODE:
1498 return "PM_STATEMENTS_NODE";
1499 case PM_STRING_NODE:
1500 return "PM_STRING_NODE";
1501 case PM_SUPER_NODE:
1502 return "PM_SUPER_NODE";
1503 case PM_SYMBOL_NODE:
1504 return "PM_SYMBOL_NODE";
1505 case PM_TRUE_NODE:
1506 return "PM_TRUE_NODE";
1507 case PM_UNDEF_NODE:
1508 return "PM_UNDEF_NODE";
1509 case PM_UNLESS_NODE:
1510 return "PM_UNLESS_NODE";
1511 case PM_UNTIL_NODE:
1512 return "PM_UNTIL_NODE";
1513 case PM_WHEN_NODE:
1514 return "PM_WHEN_NODE";
1515 case PM_WHILE_NODE:
1516 return "PM_WHILE_NODE";
1517 case PM_X_STRING_NODE:
1518 return "PM_X_STRING_NODE";
1519 case PM_YIELD_NODE:
1520 return "PM_YIELD_NODE";
1521 }
1522 return "";
1523}
1524
1534pm_visit_node(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data) {
1535 if (visitor(node, data)) pm_visit_child_nodes(node, visitor, data);
1536}
1537
1544pm_visit_child_nodes(const pm_node_t *node, bool (*visitor)(const pm_node_t *node, void *data), void *data) {
1545 switch (PM_NODE_TYPE(node)) {
1548
1549 // Visit the new_name field
1550 pm_visit_node((const pm_node_t *) cast->new_name, visitor, data);
1551
1552 // Visit the old_name field
1553 pm_visit_node((const pm_node_t *) cast->old_name, visitor, data);
1554
1555 break;
1556 }
1557 case PM_ALIAS_METHOD_NODE: {
1558 const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node;
1559
1560 // Visit the new_name field
1561 pm_visit_node((const pm_node_t *) cast->new_name, visitor, data);
1562
1563 // Visit the old_name field
1564 pm_visit_node((const pm_node_t *) cast->old_name, visitor, data);
1565
1566 break;
1567 }
1570
1571 // Visit the left field
1572 pm_visit_node((const pm_node_t *) cast->left, visitor, data);
1573
1574 // Visit the right field
1575 pm_visit_node((const pm_node_t *) cast->right, visitor, data);
1576
1577 break;
1578 }
1579 case PM_AND_NODE: {
1580 const pm_and_node_t *cast = (const pm_and_node_t *) node;
1581
1582 // Visit the left field
1583 pm_visit_node((const pm_node_t *) cast->left, visitor, data);
1584
1585 // Visit the right field
1586 pm_visit_node((const pm_node_t *) cast->right, visitor, data);
1587
1588 break;
1589 }
1590 case PM_ARGUMENTS_NODE: {
1591 const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node;
1592
1593 // Visit the arguments field
1594 const pm_node_list_t *arguments = &cast->arguments;
1595 for (size_t index = 0; index < arguments->size; index++) {
1596 pm_visit_node(arguments->nodes[index], visitor, data);
1597 }
1598
1599 break;
1600 }
1601 case PM_ARRAY_NODE: {
1602 const pm_array_node_t *cast = (const pm_array_node_t *) node;
1603
1604 // Visit the elements field
1605 const pm_node_list_t *elements = &cast->elements;
1606 for (size_t index = 0; index < elements->size; index++) {
1607 pm_visit_node(elements->nodes[index], visitor, data);
1608 }
1609
1610 break;
1611 }
1612 case PM_ARRAY_PATTERN_NODE: {
1613 const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node;
1614
1615 // Visit the constant field
1616 if (cast->constant != NULL) {
1617 pm_visit_node((const pm_node_t *) cast->constant, visitor, data);
1618 }
1619
1620 // Visit the requireds field
1621 const pm_node_list_t *requireds = &cast->requireds;
1622 for (size_t index = 0; index < requireds->size; index++) {
1623 pm_visit_node(requireds->nodes[index], visitor, data);
1624 }
1625
1626 // Visit the rest field
1627 if (cast->rest != NULL) {
1628 pm_visit_node((const pm_node_t *) cast->rest, visitor, data);
1629 }
1630
1631 // Visit the posts field
1632 const pm_node_list_t *posts = &cast->posts;
1633 for (size_t index = 0; index < posts->size; index++) {
1634 pm_visit_node(posts->nodes[index], visitor, data);
1635 }
1636
1637 break;
1638 }
1639 case PM_ASSOC_NODE: {
1640 const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node;
1641
1642 // Visit the key field
1643 pm_visit_node((const pm_node_t *) cast->key, visitor, data);
1644
1645 // Visit the value field
1646 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1647
1648 break;
1649 }
1650 case PM_ASSOC_SPLAT_NODE: {
1651 const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node;
1652
1653 // Visit the value field
1654 if (cast->value != NULL) {
1655 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1656 }
1657
1658 break;
1659 }
1661 break;
1662 case PM_BEGIN_NODE: {
1663 const pm_begin_node_t *cast = (const pm_begin_node_t *) node;
1664
1665 // Visit the statements field
1666 if (cast->statements != NULL) {
1667 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
1668 }
1669
1670 // Visit the rescue_clause field
1671 if (cast->rescue_clause != NULL) {
1672 pm_visit_node((const pm_node_t *) cast->rescue_clause, visitor, data);
1673 }
1674
1675 // Visit the else_clause field
1676 if (cast->else_clause != NULL) {
1677 pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data);
1678 }
1679
1680 // Visit the ensure_clause field
1681 if (cast->ensure_clause != NULL) {
1682 pm_visit_node((const pm_node_t *) cast->ensure_clause, visitor, data);
1683 }
1684
1685 break;
1686 }
1688 const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node;
1689
1690 // Visit the expression field
1691 if (cast->expression != NULL) {
1692 pm_visit_node((const pm_node_t *) cast->expression, visitor, data);
1693 }
1694
1695 break;
1696 }
1698 break;
1699 case PM_BLOCK_NODE: {
1700 const pm_block_node_t *cast = (const pm_block_node_t *) node;
1701
1702 // Visit the parameters field
1703 if (cast->parameters != NULL) {
1704 pm_visit_node((const pm_node_t *) cast->parameters, visitor, data);
1705 }
1706
1707 // Visit the body field
1708 if (cast->body != NULL) {
1709 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
1710 }
1711
1712 break;
1713 }
1715 break;
1717 const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node;
1718
1719 // Visit the parameters field
1720 if (cast->parameters != NULL) {
1721 pm_visit_node((const pm_node_t *) cast->parameters, visitor, data);
1722 }
1723
1724 // Visit the locals field
1725 const pm_node_list_t *locals = &cast->locals;
1726 for (size_t index = 0; index < locals->size; index++) {
1727 pm_visit_node(locals->nodes[index], visitor, data);
1728 }
1729
1730 break;
1731 }
1732 case PM_BREAK_NODE: {
1733 const pm_break_node_t *cast = (const pm_break_node_t *) node;
1734
1735 // Visit the arguments field
1736 if (cast->arguments != NULL) {
1737 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
1738 }
1739
1740 break;
1741 }
1743 const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node;
1744
1745 // Visit the receiver field
1746 if (cast->receiver != NULL) {
1747 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
1748 }
1749
1750 // Visit the value field
1751 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1752
1753 break;
1754 }
1755 case PM_CALL_NODE: {
1756 const pm_call_node_t *cast = (const pm_call_node_t *) node;
1757
1758 // Visit the receiver field
1759 if (cast->receiver != NULL) {
1760 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
1761 }
1762
1763 // Visit the arguments field
1764 if (cast->arguments != NULL) {
1765 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
1766 }
1767
1768 // Visit the block field
1769 if (cast->block != NULL) {
1770 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
1771 }
1772
1773 break;
1774 }
1777
1778 // Visit the receiver field
1779 if (cast->receiver != NULL) {
1780 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
1781 }
1782
1783 // Visit the value field
1784 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1785
1786 break;
1787 }
1788 case PM_CALL_OR_WRITE_NODE: {
1789 const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node;
1790
1791 // Visit the receiver field
1792 if (cast->receiver != NULL) {
1793 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
1794 }
1795
1796 // Visit the value field
1797 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1798
1799 break;
1800 }
1801 case PM_CALL_TARGET_NODE: {
1802 const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node;
1803
1804 // Visit the receiver field
1805 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
1806
1807 break;
1808 }
1810 const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node;
1811
1812 // Visit the value field
1813 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1814
1815 // Visit the target field
1816 pm_visit_node((const pm_node_t *) cast->target, visitor, data);
1817
1818 break;
1819 }
1820 case PM_CASE_MATCH_NODE: {
1821 const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node;
1822
1823 // Visit the predicate field
1824 if (cast->predicate != NULL) {
1825 pm_visit_node((const pm_node_t *) cast->predicate, visitor, data);
1826 }
1827
1828 // Visit the conditions field
1829 const pm_node_list_t *conditions = &cast->conditions;
1830 for (size_t index = 0; index < conditions->size; index++) {
1831 pm_visit_node(conditions->nodes[index], visitor, data);
1832 }
1833
1834 // Visit the else_clause field
1835 if (cast->else_clause != NULL) {
1836 pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data);
1837 }
1838
1839 break;
1840 }
1841 case PM_CASE_NODE: {
1842 const pm_case_node_t *cast = (const pm_case_node_t *) node;
1843
1844 // Visit the predicate field
1845 if (cast->predicate != NULL) {
1846 pm_visit_node((const pm_node_t *) cast->predicate, visitor, data);
1847 }
1848
1849 // Visit the conditions field
1850 const pm_node_list_t *conditions = &cast->conditions;
1851 for (size_t index = 0; index < conditions->size; index++) {
1852 pm_visit_node(conditions->nodes[index], visitor, data);
1853 }
1854
1855 // Visit the else_clause field
1856 if (cast->else_clause != NULL) {
1857 pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data);
1858 }
1859
1860 break;
1861 }
1862 case PM_CLASS_NODE: {
1863 const pm_class_node_t *cast = (const pm_class_node_t *) node;
1864
1865 // Visit the constant_path field
1866 pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data);
1867
1868 // Visit the superclass field
1869 if (cast->superclass != NULL) {
1870 pm_visit_node((const pm_node_t *) cast->superclass, visitor, data);
1871 }
1872
1873 // Visit the body field
1874 if (cast->body != NULL) {
1875 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
1876 }
1877
1878 break;
1879 }
1882
1883 // Visit the value field
1884 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1885
1886 break;
1887 }
1890
1891 // Visit the value field
1892 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1893
1894 break;
1895 }
1898
1899 // Visit the value field
1900 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1901
1902 break;
1903 }
1905 break;
1907 break;
1910
1911 // Visit the value field
1912 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1913
1914 break;
1915 }
1918
1919 // Visit the value field
1920 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1921
1922 break;
1923 }
1926
1927 // Visit the value field
1928 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1929
1930 break;
1931 }
1933 const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node;
1934
1935 // Visit the value field
1936 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1937
1938 break;
1939 }
1942
1943 // Visit the target field
1944 pm_visit_node((const pm_node_t *) cast->target, visitor, data);
1945
1946 // Visit the value field
1947 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1948
1949 break;
1950 }
1951 case PM_CONSTANT_PATH_NODE: {
1952 const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node;
1953
1954 // Visit the parent field
1955 if (cast->parent != NULL) {
1956 pm_visit_node((const pm_node_t *) cast->parent, visitor, data);
1957 }
1958
1959 break;
1960 }
1963
1964 // Visit the target field
1965 pm_visit_node((const pm_node_t *) cast->target, visitor, data);
1966
1967 // Visit the value field
1968 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1969
1970 break;
1971 }
1974
1975 // Visit the target field
1976 pm_visit_node((const pm_node_t *) cast->target, visitor, data);
1977
1978 // Visit the value field
1979 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
1980
1981 break;
1982 }
1985
1986 // Visit the parent field
1987 if (cast->parent != NULL) {
1988 pm_visit_node((const pm_node_t *) cast->parent, visitor, data);
1989 }
1990
1991 break;
1992 }
1995
1996 // Visit the target field
1997 pm_visit_node((const pm_node_t *) cast->target, visitor, data);
1998
1999 // Visit the value field
2000 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2001
2002 break;
2003 }
2005 break;
2007 break;
2009 const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node;
2010
2011 // Visit the value field
2012 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2013
2014 break;
2015 }
2016 case PM_DEF_NODE: {
2017 const pm_def_node_t *cast = (const pm_def_node_t *) node;
2018
2019 // Visit the receiver field
2020 if (cast->receiver != NULL) {
2021 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
2022 }
2023
2024 // Visit the parameters field
2025 if (cast->parameters != NULL) {
2026 pm_visit_node((const pm_node_t *) cast->parameters, visitor, data);
2027 }
2028
2029 // Visit the body field
2030 if (cast->body != NULL) {
2031 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
2032 }
2033
2034 break;
2035 }
2036 case PM_DEFINED_NODE: {
2037 const pm_defined_node_t *cast = (const pm_defined_node_t *) node;
2038
2039 // Visit the value field
2040 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2041
2042 break;
2043 }
2044 case PM_ELSE_NODE: {
2045 const pm_else_node_t *cast = (const pm_else_node_t *) node;
2046
2047 // Visit the statements field
2048 if (cast->statements != NULL) {
2049 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2050 }
2051
2052 break;
2053 }
2056
2057 // Visit the statements field
2058 if (cast->statements != NULL) {
2059 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2060 }
2061
2062 break;
2063 }
2065 const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node;
2066
2067 // Visit the variable field
2068 pm_visit_node((const pm_node_t *) cast->variable, visitor, data);
2069
2070 break;
2071 }
2072 case PM_ENSURE_NODE: {
2073 const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
2074
2075 // Visit the statements field
2076 if (cast->statements != NULL) {
2077 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2078 }
2079
2080 break;
2081 }
2082 case PM_FALSE_NODE:
2083 break;
2084 case PM_FIND_PATTERN_NODE: {
2085 const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node;
2086
2087 // Visit the constant field
2088 if (cast->constant != NULL) {
2089 pm_visit_node((const pm_node_t *) cast->constant, visitor, data);
2090 }
2091
2092 // Visit the left field
2093 pm_visit_node((const pm_node_t *) cast->left, visitor, data);
2094
2095 // Visit the requireds field
2096 const pm_node_list_t *requireds = &cast->requireds;
2097 for (size_t index = 0; index < requireds->size; index++) {
2098 pm_visit_node(requireds->nodes[index], visitor, data);
2099 }
2100
2101 // Visit the right field
2102 pm_visit_node((const pm_node_t *) cast->right, visitor, data);
2103
2104 break;
2105 }
2106 case PM_FLIP_FLOP_NODE: {
2107 const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node;
2108
2109 // Visit the left field
2110 if (cast->left != NULL) {
2111 pm_visit_node((const pm_node_t *) cast->left, visitor, data);
2112 }
2113
2114 // Visit the right field
2115 if (cast->right != NULL) {
2116 pm_visit_node((const pm_node_t *) cast->right, visitor, data);
2117 }
2118
2119 break;
2120 }
2121 case PM_FLOAT_NODE:
2122 break;
2123 case PM_FOR_NODE: {
2124 const pm_for_node_t *cast = (const pm_for_node_t *) node;
2125
2126 // Visit the index field
2127 pm_visit_node((const pm_node_t *) cast->index, visitor, data);
2128
2129 // Visit the collection field
2130 pm_visit_node((const pm_node_t *) cast->collection, visitor, data);
2131
2132 // Visit the statements field
2133 if (cast->statements != NULL) {
2134 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2135 }
2136
2137 break;
2138 }
2140 break;
2142 break;
2144 const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node;
2145
2146 // Visit the block field
2147 if (cast->block != NULL) {
2148 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2149 }
2150
2151 break;
2152 }
2155
2156 // Visit the value field
2157 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2158
2159 break;
2160 }
2163
2164 // Visit the value field
2165 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2166
2167 break;
2168 }
2171
2172 // Visit the value field
2173 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2174
2175 break;
2176 }
2178 break;
2180 break;
2183
2184 // Visit the value field
2185 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2186
2187 break;
2188 }
2189 case PM_HASH_NODE: {
2190 const pm_hash_node_t *cast = (const pm_hash_node_t *) node;
2191
2192 // Visit the elements field
2193 const pm_node_list_t *elements = &cast->elements;
2194 for (size_t index = 0; index < elements->size; index++) {
2195 pm_visit_node(elements->nodes[index], visitor, data);
2196 }
2197
2198 break;
2199 }
2200 case PM_HASH_PATTERN_NODE: {
2201 const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node;
2202
2203 // Visit the constant field
2204 if (cast->constant != NULL) {
2205 pm_visit_node((const pm_node_t *) cast->constant, visitor, data);
2206 }
2207
2208 // Visit the elements field
2209 const pm_node_list_t *elements = &cast->elements;
2210 for (size_t index = 0; index < elements->size; index++) {
2211 pm_visit_node(elements->nodes[index], visitor, data);
2212 }
2213
2214 // Visit the rest field
2215 if (cast->rest != NULL) {
2216 pm_visit_node((const pm_node_t *) cast->rest, visitor, data);
2217 }
2218
2219 break;
2220 }
2221 case PM_IF_NODE: {
2222 const pm_if_node_t *cast = (const pm_if_node_t *) node;
2223
2224 // Visit the predicate field
2225 pm_visit_node((const pm_node_t *) cast->predicate, visitor, data);
2226
2227 // Visit the statements field
2228 if (cast->statements != NULL) {
2229 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2230 }
2231
2232 // Visit the subsequent field
2233 if (cast->subsequent != NULL) {
2234 pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data);
2235 }
2236
2237 break;
2238 }
2239 case PM_IMAGINARY_NODE: {
2240 const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node;
2241
2242 // Visit the numeric field
2243 pm_visit_node((const pm_node_t *) cast->numeric, visitor, data);
2244
2245 break;
2246 }
2247 case PM_IMPLICIT_NODE: {
2248 const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node;
2249
2250 // Visit the value field
2251 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2252
2253 break;
2254 }
2256 break;
2257 case PM_IN_NODE: {
2258 const pm_in_node_t *cast = (const pm_in_node_t *) node;
2259
2260 // Visit the pattern field
2261 pm_visit_node((const pm_node_t *) cast->pattern, visitor, data);
2262
2263 // Visit the statements field
2264 if (cast->statements != NULL) {
2265 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2266 }
2267
2268 break;
2269 }
2271 const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node;
2272
2273 // Visit the receiver field
2274 if (cast->receiver != NULL) {
2275 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
2276 }
2277
2278 // Visit the arguments field
2279 if (cast->arguments != NULL) {
2280 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2281 }
2282
2283 // Visit the block field
2284 if (cast->block != NULL) {
2285 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2286 }
2287
2288 // Visit the value field
2289 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2290
2291 break;
2292 }
2295
2296 // Visit the receiver field
2297 if (cast->receiver != NULL) {
2298 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
2299 }
2300
2301 // Visit the arguments field
2302 if (cast->arguments != NULL) {
2303 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2304 }
2305
2306 // Visit the block field
2307 if (cast->block != NULL) {
2308 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2309 }
2310
2311 // Visit the value field
2312 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2313
2314 break;
2315 }
2317 const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node;
2318
2319 // Visit the receiver field
2320 if (cast->receiver != NULL) {
2321 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
2322 }
2323
2324 // Visit the arguments field
2325 if (cast->arguments != NULL) {
2326 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2327 }
2328
2329 // Visit the block field
2330 if (cast->block != NULL) {
2331 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2332 }
2333
2334 // Visit the value field
2335 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2336
2337 break;
2338 }
2339 case PM_INDEX_TARGET_NODE: {
2340 const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node;
2341
2342 // Visit the receiver field
2343 pm_visit_node((const pm_node_t *) cast->receiver, visitor, data);
2344
2345 // Visit the arguments field
2346 if (cast->arguments != NULL) {
2347 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2348 }
2349
2350 // Visit the block field
2351 if (cast->block != NULL) {
2352 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2353 }
2354
2355 break;
2356 }
2359
2360 // Visit the value field
2361 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2362
2363 break;
2364 }
2367
2368 // Visit the value field
2369 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2370
2371 break;
2372 }
2375
2376 // Visit the value field
2377 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2378
2379 break;
2380 }
2382 break;
2384 break;
2387
2388 // Visit the value field
2389 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2390
2391 break;
2392 }
2393 case PM_INTEGER_NODE:
2394 break;
2397
2398 // Visit the parts field
2399 const pm_node_list_t *parts = &cast->parts;
2400 for (size_t index = 0; index < parts->size; index++) {
2401 pm_visit_node(parts->nodes[index], visitor, data);
2402 }
2403
2404 break;
2405 }
2408
2409 // Visit the parts field
2410 const pm_node_list_t *parts = &cast->parts;
2411 for (size_t index = 0; index < parts->size; index++) {
2412 pm_visit_node(parts->nodes[index], visitor, data);
2413 }
2414
2415 break;
2416 }
2419
2420 // Visit the parts field
2421 const pm_node_list_t *parts = &cast->parts;
2422 for (size_t index = 0; index < parts->size; index++) {
2423 pm_visit_node(parts->nodes[index], visitor, data);
2424 }
2425
2426 break;
2427 }
2430
2431 // Visit the parts field
2432 const pm_node_list_t *parts = &cast->parts;
2433 for (size_t index = 0; index < parts->size; index++) {
2434 pm_visit_node(parts->nodes[index], visitor, data);
2435 }
2436
2437 break;
2438 }
2441
2442 // Visit the parts field
2443 const pm_node_list_t *parts = &cast->parts;
2444 for (size_t index = 0; index < parts->size; index++) {
2445 pm_visit_node(parts->nodes[index], visitor, data);
2446 }
2447
2448 break;
2449 }
2451 break;
2453 break;
2454 case PM_KEYWORD_HASH_NODE: {
2455 const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node;
2456
2457 // Visit the elements field
2458 const pm_node_list_t *elements = &cast->elements;
2459 for (size_t index = 0; index < elements->size; index++) {
2460 pm_visit_node(elements->nodes[index], visitor, data);
2461 }
2462
2463 break;
2464 }
2466 break;
2467 case PM_LAMBDA_NODE: {
2468 const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node;
2469
2470 // Visit the parameters field
2471 if (cast->parameters != NULL) {
2472 pm_visit_node((const pm_node_t *) cast->parameters, visitor, data);
2473 }
2474
2475 // Visit the body field
2476 if (cast->body != NULL) {
2477 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
2478 }
2479
2480 break;
2481 }
2484
2485 // Visit the value field
2486 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2487
2488 break;
2489 }
2492
2493 // Visit the value field
2494 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2495
2496 break;
2497 }
2500
2501 // Visit the value field
2502 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2503
2504 break;
2505 }
2507 break;
2509 break;
2512
2513 // Visit the value field
2514 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2515
2516 break;
2517 }
2519 break;
2521 const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node;
2522
2523 // Visit the value field
2524 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2525
2526 // Visit the pattern field
2527 pm_visit_node((const pm_node_t *) cast->pattern, visitor, data);
2528
2529 break;
2530 }
2532 const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node;
2533
2534 // Visit the value field
2535 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2536
2537 // Visit the pattern field
2538 pm_visit_node((const pm_node_t *) cast->pattern, visitor, data);
2539
2540 break;
2541 }
2542 case PM_MATCH_WRITE_NODE: {
2543 const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node;
2544
2545 // Visit the call field
2546 pm_visit_node((const pm_node_t *) cast->call, visitor, data);
2547
2548 // Visit the targets field
2549 const pm_node_list_t *targets = &cast->targets;
2550 for (size_t index = 0; index < targets->size; index++) {
2551 pm_visit_node(targets->nodes[index], visitor, data);
2552 }
2553
2554 break;
2555 }
2556 case PM_MISSING_NODE:
2557 break;
2558 case PM_MODULE_NODE: {
2559 const pm_module_node_t *cast = (const pm_module_node_t *) node;
2560
2561 // Visit the constant_path field
2562 pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data);
2563
2564 // Visit the body field
2565 if (cast->body != NULL) {
2566 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
2567 }
2568
2569 break;
2570 }
2571 case PM_MULTI_TARGET_NODE: {
2572 const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node;
2573
2574 // Visit the lefts field
2575 const pm_node_list_t *lefts = &cast->lefts;
2576 for (size_t index = 0; index < lefts->size; index++) {
2577 pm_visit_node(lefts->nodes[index], visitor, data);
2578 }
2579
2580 // Visit the rest field
2581 if (cast->rest != NULL) {
2582 pm_visit_node((const pm_node_t *) cast->rest, visitor, data);
2583 }
2584
2585 // Visit the rights field
2586 const pm_node_list_t *rights = &cast->rights;
2587 for (size_t index = 0; index < rights->size; index++) {
2588 pm_visit_node(rights->nodes[index], visitor, data);
2589 }
2590
2591 break;
2592 }
2593 case PM_MULTI_WRITE_NODE: {
2594 const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node;
2595
2596 // Visit the lefts field
2597 const pm_node_list_t *lefts = &cast->lefts;
2598 for (size_t index = 0; index < lefts->size; index++) {
2599 pm_visit_node(lefts->nodes[index], visitor, data);
2600 }
2601
2602 // Visit the rest field
2603 if (cast->rest != NULL) {
2604 pm_visit_node((const pm_node_t *) cast->rest, visitor, data);
2605 }
2606
2607 // Visit the rights field
2608 const pm_node_list_t *rights = &cast->rights;
2609 for (size_t index = 0; index < rights->size; index++) {
2610 pm_visit_node(rights->nodes[index], visitor, data);
2611 }
2612
2613 // Visit the value field
2614 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2615
2616 break;
2617 }
2618 case PM_NEXT_NODE: {
2619 const pm_next_node_t *cast = (const pm_next_node_t *) node;
2620
2621 // Visit the arguments field
2622 if (cast->arguments != NULL) {
2623 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2624 }
2625
2626 break;
2627 }
2628 case PM_NIL_NODE:
2629 break;
2631 break;
2633 break;
2635 break;
2638
2639 // Visit the value field
2640 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2641
2642 break;
2643 }
2646
2647 // Visit the value field
2648 pm_visit_node((const pm_node_t *) cast->value, visitor, data);
2649
2650 break;
2651 }
2652 case PM_OR_NODE: {
2653 const pm_or_node_t *cast = (const pm_or_node_t *) node;
2654
2655 // Visit the left field
2656 pm_visit_node((const pm_node_t *) cast->left, visitor, data);
2657
2658 // Visit the right field
2659 pm_visit_node((const pm_node_t *) cast->right, visitor, data);
2660
2661 break;
2662 }
2663 case PM_PARAMETERS_NODE: {
2664 const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node;
2665
2666 // Visit the requireds field
2667 const pm_node_list_t *requireds = &cast->requireds;
2668 for (size_t index = 0; index < requireds->size; index++) {
2669 pm_visit_node(requireds->nodes[index], visitor, data);
2670 }
2671
2672 // Visit the optionals field
2673 const pm_node_list_t *optionals = &cast->optionals;
2674 for (size_t index = 0; index < optionals->size; index++) {
2675 pm_visit_node(optionals->nodes[index], visitor, data);
2676 }
2677
2678 // Visit the rest field
2679 if (cast->rest != NULL) {
2680 pm_visit_node((const pm_node_t *) cast->rest, visitor, data);
2681 }
2682
2683 // Visit the posts field
2684 const pm_node_list_t *posts = &cast->posts;
2685 for (size_t index = 0; index < posts->size; index++) {
2686 pm_visit_node(posts->nodes[index], visitor, data);
2687 }
2688
2689 // Visit the keywords field
2690 const pm_node_list_t *keywords = &cast->keywords;
2691 for (size_t index = 0; index < keywords->size; index++) {
2692 pm_visit_node(keywords->nodes[index], visitor, data);
2693 }
2694
2695 // Visit the keyword_rest field
2696 if (cast->keyword_rest != NULL) {
2697 pm_visit_node((const pm_node_t *) cast->keyword_rest, visitor, data);
2698 }
2699
2700 // Visit the block field
2701 if (cast->block != NULL) {
2702 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2703 }
2704
2705 break;
2706 }
2707 case PM_PARENTHESES_NODE: {
2708 const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node;
2709
2710 // Visit the body field
2711 if (cast->body != NULL) {
2712 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
2713 }
2714
2715 break;
2716 }
2718 const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node;
2719
2720 // Visit the expression field
2721 pm_visit_node((const pm_node_t *) cast->expression, visitor, data);
2722
2723 break;
2724 }
2726 const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node;
2727
2728 // Visit the variable field
2729 pm_visit_node((const pm_node_t *) cast->variable, visitor, data);
2730
2731 break;
2732 }
2734 const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node;
2735
2736 // Visit the statements field
2737 if (cast->statements != NULL) {
2738 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2739 }
2740
2741 break;
2742 }
2743 case PM_PRE_EXECUTION_NODE: {
2744 const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node;
2745
2746 // Visit the statements field
2747 if (cast->statements != NULL) {
2748 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2749 }
2750
2751 break;
2752 }
2753 case PM_PROGRAM_NODE: {
2754 const pm_program_node_t *cast = (const pm_program_node_t *) node;
2755
2756 // Visit the statements field
2757 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2758
2759 break;
2760 }
2761 case PM_RANGE_NODE: {
2762 const pm_range_node_t *cast = (const pm_range_node_t *) node;
2763
2764 // Visit the left field
2765 if (cast->left != NULL) {
2766 pm_visit_node((const pm_node_t *) cast->left, visitor, data);
2767 }
2768
2769 // Visit the right field
2770 if (cast->right != NULL) {
2771 pm_visit_node((const pm_node_t *) cast->right, visitor, data);
2772 }
2773
2774 break;
2775 }
2776 case PM_RATIONAL_NODE:
2777 break;
2778 case PM_REDO_NODE:
2779 break;
2781 break;
2783 break;
2785 break;
2787 const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node;
2788
2789 // Visit the expression field
2790 pm_visit_node((const pm_node_t *) cast->expression, visitor, data);
2791
2792 // Visit the rescue_expression field
2793 pm_visit_node((const pm_node_t *) cast->rescue_expression, visitor, data);
2794
2795 break;
2796 }
2797 case PM_RESCUE_NODE: {
2798 const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node;
2799
2800 // Visit the exceptions field
2801 const pm_node_list_t *exceptions = &cast->exceptions;
2802 for (size_t index = 0; index < exceptions->size; index++) {
2803 pm_visit_node(exceptions->nodes[index], visitor, data);
2804 }
2805
2806 // Visit the reference field
2807 if (cast->reference != NULL) {
2808 pm_visit_node((const pm_node_t *) cast->reference, visitor, data);
2809 }
2810
2811 // Visit the statements field
2812 if (cast->statements != NULL) {
2813 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2814 }
2815
2816 // Visit the subsequent field
2817 if (cast->subsequent != NULL) {
2818 pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data);
2819 }
2820
2821 break;
2822 }
2824 break;
2825 case PM_RETRY_NODE:
2826 break;
2827 case PM_RETURN_NODE: {
2828 const pm_return_node_t *cast = (const pm_return_node_t *) node;
2829
2830 // Visit the arguments field
2831 if (cast->arguments != NULL) {
2832 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2833 }
2834
2835 break;
2836 }
2837 case PM_SELF_NODE:
2838 break;
2841
2842 // Visit the write field
2843 pm_visit_node((const pm_node_t *) cast->write, visitor, data);
2844
2845 break;
2846 }
2848 const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node;
2849
2850 // Visit the expression field
2851 pm_visit_node((const pm_node_t *) cast->expression, visitor, data);
2852
2853 // Visit the body field
2854 if (cast->body != NULL) {
2855 pm_visit_node((const pm_node_t *) cast->body, visitor, data);
2856 }
2857
2858 break;
2859 }
2861 break;
2863 break;
2865 break;
2866 case PM_SPLAT_NODE: {
2867 const pm_splat_node_t *cast = (const pm_splat_node_t *) node;
2868
2869 // Visit the expression field
2870 if (cast->expression != NULL) {
2871 pm_visit_node((const pm_node_t *) cast->expression, visitor, data);
2872 }
2873
2874 break;
2875 }
2876 case PM_STATEMENTS_NODE: {
2877 const pm_statements_node_t *cast = (const pm_statements_node_t *) node;
2878
2879 // Visit the body field
2880 const pm_node_list_t *body = &cast->body;
2881 for (size_t index = 0; index < body->size; index++) {
2882 pm_visit_node(body->nodes[index], visitor, data);
2883 }
2884
2885 break;
2886 }
2887 case PM_STRING_NODE:
2888 break;
2889 case PM_SUPER_NODE: {
2890 const pm_super_node_t *cast = (const pm_super_node_t *) node;
2891
2892 // Visit the arguments field
2893 if (cast->arguments != NULL) {
2894 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2895 }
2896
2897 // Visit the block field
2898 if (cast->block != NULL) {
2899 pm_visit_node((const pm_node_t *) cast->block, visitor, data);
2900 }
2901
2902 break;
2903 }
2904 case PM_SYMBOL_NODE:
2905 break;
2906 case PM_TRUE_NODE:
2907 break;
2908 case PM_UNDEF_NODE: {
2909 const pm_undef_node_t *cast = (const pm_undef_node_t *) node;
2910
2911 // Visit the names field
2912 const pm_node_list_t *names = &cast->names;
2913 for (size_t index = 0; index < names->size; index++) {
2914 pm_visit_node(names->nodes[index], visitor, data);
2915 }
2916
2917 break;
2918 }
2919 case PM_UNLESS_NODE: {
2920 const pm_unless_node_t *cast = (const pm_unless_node_t *) node;
2921
2922 // Visit the predicate field
2923 pm_visit_node((const pm_node_t *) cast->predicate, visitor, data);
2924
2925 // Visit the statements field
2926 if (cast->statements != NULL) {
2927 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2928 }
2929
2930 // Visit the else_clause field
2931 if (cast->else_clause != NULL) {
2932 pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data);
2933 }
2934
2935 break;
2936 }
2937 case PM_UNTIL_NODE: {
2938 const pm_until_node_t *cast = (const pm_until_node_t *) node;
2939
2940 // Visit the predicate field
2941 pm_visit_node((const pm_node_t *) cast->predicate, visitor, data);
2942
2943 // Visit the statements field
2944 if (cast->statements != NULL) {
2945 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2946 }
2947
2948 break;
2949 }
2950 case PM_WHEN_NODE: {
2951 const pm_when_node_t *cast = (const pm_when_node_t *) node;
2952
2953 // Visit the conditions field
2954 const pm_node_list_t *conditions = &cast->conditions;
2955 for (size_t index = 0; index < conditions->size; index++) {
2956 pm_visit_node(conditions->nodes[index], visitor, data);
2957 }
2958
2959 // Visit the statements field
2960 if (cast->statements != NULL) {
2961 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2962 }
2963
2964 break;
2965 }
2966 case PM_WHILE_NODE: {
2967 const pm_while_node_t *cast = (const pm_while_node_t *) node;
2968
2969 // Visit the predicate field
2970 pm_visit_node((const pm_node_t *) cast->predicate, visitor, data);
2971
2972 // Visit the statements field
2973 if (cast->statements != NULL) {
2974 pm_visit_node((const pm_node_t *) cast->statements, visitor, data);
2975 }
2976
2977 break;
2978 }
2979 case PM_X_STRING_NODE:
2980 break;
2981 case PM_YIELD_NODE: {
2982 const pm_yield_node_t *cast = (const pm_yield_node_t *) node;
2983
2984 // Visit the arguments field
2985 if (cast->arguments != NULL) {
2986 pm_visit_node((const pm_node_t *) cast->arguments, visitor, data);
2987 }
2988
2989 break;
2990 }
2991 case PM_SCOPE_NODE:
2992 break;
2993 }
2994}
2995
2996// We optionally support dumping to JSON. For systems that don't want or need
2997// this functionality, it can be turned off with the PRISM_EXCLUDE_JSON define.
2998#ifndef PRISM_EXCLUDE_JSON
2999
3000static void
3001pm_dump_json_constant(pm_buffer_t *buffer, const pm_parser_t *parser, pm_constant_id_t constant_id) {
3002 const pm_constant_t *constant = pm_constant_pool_id_to_constant(&parser->constant_pool, constant_id);
3003 pm_buffer_append_byte(buffer, '"');
3004 pm_buffer_append_source(buffer, constant->start, constant->length, PM_BUFFER_ESCAPING_JSON);
3005 pm_buffer_append_byte(buffer, '"');
3006}
3007
3008static void
3009pm_dump_json_location(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_location_t *location) {
3010 uint32_t start = (uint32_t) (location->start - parser->start);
3011 uint32_t end = (uint32_t) (location->end - parser->start);
3012 pm_buffer_append_format(buffer, "{\"start\":%" PRIu32 ",\"end\":%" PRIu32 "}", start, end);
3013}
3014
3019pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *node) {
3020 switch (PM_NODE_TYPE(node)) {
3022 pm_buffer_append_string(buffer, "{\"type\":\"AliasGlobalVariableNode\",\"location\":", 45);
3023
3025 pm_dump_json_location(buffer, parser, &cast->base.location);
3026
3027 // Dump the new_name field
3028 pm_buffer_append_byte(buffer, ',');
3029 pm_buffer_append_string(buffer, "\"new_name\":", 11);
3030 pm_dump_json(buffer, parser, (const pm_node_t *) cast->new_name);
3031
3032 // Dump the old_name field
3033 pm_buffer_append_byte(buffer, ',');
3034 pm_buffer_append_string(buffer, "\"old_name\":", 11);
3035 pm_dump_json(buffer, parser, (const pm_node_t *) cast->old_name);
3036
3037 // Dump the keyword_loc field
3038 pm_buffer_append_byte(buffer, ',');
3039 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
3040 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
3041
3042 pm_buffer_append_byte(buffer, '}');
3043 break;
3044 }
3045 case PM_ALIAS_METHOD_NODE: {
3046 pm_buffer_append_string(buffer, "{\"type\":\"AliasMethodNode\",\"location\":", 37);
3047
3048 const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node;
3049 pm_dump_json_location(buffer, parser, &cast->base.location);
3050
3051 // Dump the new_name field
3052 pm_buffer_append_byte(buffer, ',');
3053 pm_buffer_append_string(buffer, "\"new_name\":", 11);
3054 pm_dump_json(buffer, parser, (const pm_node_t *) cast->new_name);
3055
3056 // Dump the old_name field
3057 pm_buffer_append_byte(buffer, ',');
3058 pm_buffer_append_string(buffer, "\"old_name\":", 11);
3059 pm_dump_json(buffer, parser, (const pm_node_t *) cast->old_name);
3060
3061 // Dump the keyword_loc field
3062 pm_buffer_append_byte(buffer, ',');
3063 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
3064 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
3065
3066 pm_buffer_append_byte(buffer, '}');
3067 break;
3068 }
3070 pm_buffer_append_string(buffer, "{\"type\":\"AlternationPatternNode\",\"location\":", 44);
3071
3073 pm_dump_json_location(buffer, parser, &cast->base.location);
3074
3075 // Dump the left field
3076 pm_buffer_append_byte(buffer, ',');
3077 pm_buffer_append_string(buffer, "\"left\":", 7);
3078 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
3079
3080 // Dump the right field
3081 pm_buffer_append_byte(buffer, ',');
3082 pm_buffer_append_string(buffer, "\"right\":", 8);
3083 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
3084
3085 // Dump the operator_loc field
3086 pm_buffer_append_byte(buffer, ',');
3087 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3088 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3089
3090 pm_buffer_append_byte(buffer, '}');
3091 break;
3092 }
3093 case PM_AND_NODE: {
3094 pm_buffer_append_string(buffer, "{\"type\":\"AndNode\",\"location\":", 29);
3095
3096 const pm_and_node_t *cast = (const pm_and_node_t *) node;
3097 pm_dump_json_location(buffer, parser, &cast->base.location);
3098
3099 // Dump the left field
3100 pm_buffer_append_byte(buffer, ',');
3101 pm_buffer_append_string(buffer, "\"left\":", 7);
3102 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
3103
3104 // Dump the right field
3105 pm_buffer_append_byte(buffer, ',');
3106 pm_buffer_append_string(buffer, "\"right\":", 8);
3107 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
3108
3109 // Dump the operator_loc field
3110 pm_buffer_append_byte(buffer, ',');
3111 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3112 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3113
3114 pm_buffer_append_byte(buffer, '}');
3115 break;
3116 }
3117 case PM_ARGUMENTS_NODE: {
3118 pm_buffer_append_string(buffer, "{\"type\":\"ArgumentsNode\",\"location\":", 35);
3119
3120 const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node;
3121 pm_dump_json_location(buffer, parser, &cast->base.location);
3122
3123 // Dump the ArgumentsNodeFlags field
3124 pm_buffer_append_byte(buffer, ',');
3125 pm_buffer_append_string(buffer, "\"ArgumentsNodeFlags\":", 21);
3126 size_t flags = 0;
3127 pm_buffer_append_byte(buffer, '[');
3129 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3130 pm_buffer_append_string(buffer, "\"CONTAINS_FORWARDING\"", 21);
3131 flags++;
3132 }
3134 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3135 pm_buffer_append_string(buffer, "\"CONTAINS_KEYWORDS\"", 19);
3136 flags++;
3137 }
3139 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3140 pm_buffer_append_string(buffer, "\"CONTAINS_KEYWORD_SPLAT\"", 24);
3141 flags++;
3142 }
3144 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3145 pm_buffer_append_string(buffer, "\"CONTAINS_SPLAT\"", 16);
3146 flags++;
3147 }
3149 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3150 pm_buffer_append_string(buffer, "\"CONTAINS_MULTIPLE_SPLATS\"", 26);
3151 flags++;
3152 }
3153 pm_buffer_append_byte(buffer, ']');
3154
3155 // Dump the arguments field
3156 pm_buffer_append_byte(buffer, ',');
3157 pm_buffer_append_string(buffer, "\"arguments\":", 12);
3158 const pm_node_list_t *arguments = &cast->arguments;
3159 pm_buffer_append_byte(buffer, '[');
3160
3161 for (size_t index = 0; index < arguments->size; index++) {
3162 if (index != 0) pm_buffer_append_byte(buffer, ',');
3163 pm_dump_json(buffer, parser, arguments->nodes[index]);
3164 }
3165 pm_buffer_append_byte(buffer, ']');
3166
3167 pm_buffer_append_byte(buffer, '}');
3168 break;
3169 }
3170 case PM_ARRAY_NODE: {
3171 pm_buffer_append_string(buffer, "{\"type\":\"ArrayNode\",\"location\":", 31);
3172
3173 const pm_array_node_t *cast = (const pm_array_node_t *) node;
3174 pm_dump_json_location(buffer, parser, &cast->base.location);
3175
3176 // Dump the ArrayNodeFlags field
3177 pm_buffer_append_byte(buffer, ',');
3178 pm_buffer_append_string(buffer, "\"ArrayNodeFlags\":", 17);
3179 size_t flags = 0;
3180 pm_buffer_append_byte(buffer, '[');
3182 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3183 pm_buffer_append_string(buffer, "\"CONTAINS_SPLAT\"", 16);
3184 flags++;
3185 }
3186 pm_buffer_append_byte(buffer, ']');
3187
3188 // Dump the elements field
3189 pm_buffer_append_byte(buffer, ',');
3190 pm_buffer_append_string(buffer, "\"elements\":", 11);
3191 const pm_node_list_t *elements = &cast->elements;
3192 pm_buffer_append_byte(buffer, '[');
3193
3194 for (size_t index = 0; index < elements->size; index++) {
3195 if (index != 0) pm_buffer_append_byte(buffer, ',');
3196 pm_dump_json(buffer, parser, elements->nodes[index]);
3197 }
3198 pm_buffer_append_byte(buffer, ']');
3199
3200 // Dump the opening_loc field
3201 pm_buffer_append_byte(buffer, ',');
3202 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3203 if (cast->opening_loc.start != NULL) {
3204 pm_dump_json_location(buffer, parser, &cast->opening_loc);
3205 } else {
3206 pm_buffer_append_string(buffer, "null", 4);
3207 }
3208
3209 // Dump the closing_loc field
3210 pm_buffer_append_byte(buffer, ',');
3211 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3212 if (cast->closing_loc.start != NULL) {
3213 pm_dump_json_location(buffer, parser, &cast->closing_loc);
3214 } else {
3215 pm_buffer_append_string(buffer, "null", 4);
3216 }
3217
3218 pm_buffer_append_byte(buffer, '}');
3219 break;
3220 }
3221 case PM_ARRAY_PATTERN_NODE: {
3222 pm_buffer_append_string(buffer, "{\"type\":\"ArrayPatternNode\",\"location\":", 38);
3223
3224 const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node;
3225 pm_dump_json_location(buffer, parser, &cast->base.location);
3226
3227 // Dump the constant field
3228 pm_buffer_append_byte(buffer, ',');
3229 pm_buffer_append_string(buffer, "\"constant\":", 11);
3230 if (cast->constant != NULL) {
3231 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
3232 } else {
3233 pm_buffer_append_string(buffer, "null", 4);
3234 }
3235
3236 // Dump the requireds field
3237 pm_buffer_append_byte(buffer, ',');
3238 pm_buffer_append_string(buffer, "\"requireds\":", 12);
3239 const pm_node_list_t *requireds = &cast->requireds;
3240 pm_buffer_append_byte(buffer, '[');
3241
3242 for (size_t index = 0; index < requireds->size; index++) {
3243 if (index != 0) pm_buffer_append_byte(buffer, ',');
3244 pm_dump_json(buffer, parser, requireds->nodes[index]);
3245 }
3246 pm_buffer_append_byte(buffer, ']');
3247
3248 // Dump the rest field
3249 pm_buffer_append_byte(buffer, ',');
3250 pm_buffer_append_string(buffer, "\"rest\":", 7);
3251 if (cast->rest != NULL) {
3252 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
3253 } else {
3254 pm_buffer_append_string(buffer, "null", 4);
3255 }
3256
3257 // Dump the posts field
3258 pm_buffer_append_byte(buffer, ',');
3259 pm_buffer_append_string(buffer, "\"posts\":", 8);
3260 const pm_node_list_t *posts = &cast->posts;
3261 pm_buffer_append_byte(buffer, '[');
3262
3263 for (size_t index = 0; index < posts->size; index++) {
3264 if (index != 0) pm_buffer_append_byte(buffer, ',');
3265 pm_dump_json(buffer, parser, posts->nodes[index]);
3266 }
3267 pm_buffer_append_byte(buffer, ']');
3268
3269 // Dump the opening_loc field
3270 pm_buffer_append_byte(buffer, ',');
3271 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3272 if (cast->opening_loc.start != NULL) {
3273 pm_dump_json_location(buffer, parser, &cast->opening_loc);
3274 } else {
3275 pm_buffer_append_string(buffer, "null", 4);
3276 }
3277
3278 // Dump the closing_loc field
3279 pm_buffer_append_byte(buffer, ',');
3280 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3281 if (cast->closing_loc.start != NULL) {
3282 pm_dump_json_location(buffer, parser, &cast->closing_loc);
3283 } else {
3284 pm_buffer_append_string(buffer, "null", 4);
3285 }
3286
3287 pm_buffer_append_byte(buffer, '}');
3288 break;
3289 }
3290 case PM_ASSOC_NODE: {
3291 pm_buffer_append_string(buffer, "{\"type\":\"AssocNode\",\"location\":", 31);
3292
3293 const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node;
3294 pm_dump_json_location(buffer, parser, &cast->base.location);
3295
3296 // Dump the key field
3297 pm_buffer_append_byte(buffer, ',');
3298 pm_buffer_append_string(buffer, "\"key\":", 6);
3299 pm_dump_json(buffer, parser, (const pm_node_t *) cast->key);
3300
3301 // Dump the value field
3302 pm_buffer_append_byte(buffer, ',');
3303 pm_buffer_append_string(buffer, "\"value\":", 8);
3304 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3305
3306 // Dump the operator_loc field
3307 pm_buffer_append_byte(buffer, ',');
3308 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3309 if (cast->operator_loc.start != NULL) {
3310 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3311 } else {
3312 pm_buffer_append_string(buffer, "null", 4);
3313 }
3314
3315 pm_buffer_append_byte(buffer, '}');
3316 break;
3317 }
3318 case PM_ASSOC_SPLAT_NODE: {
3319 pm_buffer_append_string(buffer, "{\"type\":\"AssocSplatNode\",\"location\":", 36);
3320
3321 const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node;
3322 pm_dump_json_location(buffer, parser, &cast->base.location);
3323
3324 // Dump the value field
3325 pm_buffer_append_byte(buffer, ',');
3326 pm_buffer_append_string(buffer, "\"value\":", 8);
3327 if (cast->value != NULL) {
3328 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3329 } else {
3330 pm_buffer_append_string(buffer, "null", 4);
3331 }
3332
3333 // Dump the operator_loc field
3334 pm_buffer_append_byte(buffer, ',');
3335 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3336 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3337
3338 pm_buffer_append_byte(buffer, '}');
3339 break;
3340 }
3342 pm_buffer_append_string(buffer, "{\"type\":\"BackReferenceReadNode\",\"location\":", 43);
3343
3345 pm_dump_json_location(buffer, parser, &cast->base.location);
3346
3347 // Dump the name field
3348 pm_buffer_append_byte(buffer, ',');
3349 pm_buffer_append_string(buffer, "\"name\":", 7);
3350 pm_dump_json_constant(buffer, parser, cast->name);
3351
3352 pm_buffer_append_byte(buffer, '}');
3353 break;
3354 }
3355 case PM_BEGIN_NODE: {
3356 pm_buffer_append_string(buffer, "{\"type\":\"BeginNode\",\"location\":", 31);
3357
3358 const pm_begin_node_t *cast = (const pm_begin_node_t *) node;
3359 pm_dump_json_location(buffer, parser, &cast->base.location);
3360
3361 // Dump the begin_keyword_loc field
3362 pm_buffer_append_byte(buffer, ',');
3363 pm_buffer_append_string(buffer, "\"begin_keyword_loc\":", 20);
3364 if (cast->begin_keyword_loc.start != NULL) {
3365 pm_dump_json_location(buffer, parser, &cast->begin_keyword_loc);
3366 } else {
3367 pm_buffer_append_string(buffer, "null", 4);
3368 }
3369
3370 // Dump the statements field
3371 pm_buffer_append_byte(buffer, ',');
3372 pm_buffer_append_string(buffer, "\"statements\":", 13);
3373 if (cast->statements != NULL) {
3374 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
3375 } else {
3376 pm_buffer_append_string(buffer, "null", 4);
3377 }
3378
3379 // Dump the rescue_clause field
3380 pm_buffer_append_byte(buffer, ',');
3381 pm_buffer_append_string(buffer, "\"rescue_clause\":", 16);
3382 if (cast->rescue_clause != NULL) {
3383 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_clause);
3384 } else {
3385 pm_buffer_append_string(buffer, "null", 4);
3386 }
3387
3388 // Dump the else_clause field
3389 pm_buffer_append_byte(buffer, ',');
3390 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
3391 if (cast->else_clause != NULL) {
3392 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
3393 } else {
3394 pm_buffer_append_string(buffer, "null", 4);
3395 }
3396
3397 // Dump the ensure_clause field
3398 pm_buffer_append_byte(buffer, ',');
3399 pm_buffer_append_string(buffer, "\"ensure_clause\":", 16);
3400 if (cast->ensure_clause != NULL) {
3401 pm_dump_json(buffer, parser, (const pm_node_t *) cast->ensure_clause);
3402 } else {
3403 pm_buffer_append_string(buffer, "null", 4);
3404 }
3405
3406 // Dump the end_keyword_loc field
3407 pm_buffer_append_byte(buffer, ',');
3408 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
3409 if (cast->end_keyword_loc.start != NULL) {
3410 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
3411 } else {
3412 pm_buffer_append_string(buffer, "null", 4);
3413 }
3414
3415 pm_buffer_append_byte(buffer, '}');
3416 break;
3417 }
3419 pm_buffer_append_string(buffer, "{\"type\":\"BlockArgumentNode\",\"location\":", 39);
3420
3421 const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node;
3422 pm_dump_json_location(buffer, parser, &cast->base.location);
3423
3424 // Dump the expression field
3425 pm_buffer_append_byte(buffer, ',');
3426 pm_buffer_append_string(buffer, "\"expression\":", 13);
3427 if (cast->expression != NULL) {
3428 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
3429 } else {
3430 pm_buffer_append_string(buffer, "null", 4);
3431 }
3432
3433 // Dump the operator_loc field
3434 pm_buffer_append_byte(buffer, ',');
3435 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3436 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3437
3438 pm_buffer_append_byte(buffer, '}');
3439 break;
3440 }
3442 pm_buffer_append_string(buffer, "{\"type\":\"BlockLocalVariableNode\",\"location\":", 44);
3443
3445 pm_dump_json_location(buffer, parser, &cast->base.location);
3446
3447 // Dump the ParameterFlags field
3448 pm_buffer_append_byte(buffer, ',');
3449 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
3450 size_t flags = 0;
3451 pm_buffer_append_byte(buffer, '[');
3453 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3454 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
3455 flags++;
3456 }
3457 pm_buffer_append_byte(buffer, ']');
3458
3459 // Dump the name field
3460 pm_buffer_append_byte(buffer, ',');
3461 pm_buffer_append_string(buffer, "\"name\":", 7);
3462 pm_dump_json_constant(buffer, parser, cast->name);
3463
3464 pm_buffer_append_byte(buffer, '}');
3465 break;
3466 }
3467 case PM_BLOCK_NODE: {
3468 pm_buffer_append_string(buffer, "{\"type\":\"BlockNode\",\"location\":", 31);
3469
3470 const pm_block_node_t *cast = (const pm_block_node_t *) node;
3471 pm_dump_json_location(buffer, parser, &cast->base.location);
3472
3473 // Dump the locals field
3474 pm_buffer_append_byte(buffer, ',');
3475 pm_buffer_append_string(buffer, "\"locals\":", 9);
3476 const pm_constant_id_list_t *locals = &cast->locals;
3477 pm_buffer_append_byte(buffer, '[');
3478
3479 for (size_t index = 0; index < locals->size; index++) {
3480 if (index != 0) pm_buffer_append_byte(buffer, ',');
3481 pm_dump_json_constant(buffer, parser, locals->ids[index]);
3482 }
3483 pm_buffer_append_byte(buffer, ']');
3484
3485 // Dump the parameters field
3486 pm_buffer_append_byte(buffer, ',');
3487 pm_buffer_append_string(buffer, "\"parameters\":", 13);
3488 if (cast->parameters != NULL) {
3489 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
3490 } else {
3491 pm_buffer_append_string(buffer, "null", 4);
3492 }
3493
3494 // Dump the body field
3495 pm_buffer_append_byte(buffer, ',');
3496 pm_buffer_append_string(buffer, "\"body\":", 7);
3497 if (cast->body != NULL) {
3498 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
3499 } else {
3500 pm_buffer_append_string(buffer, "null", 4);
3501 }
3502
3503 // Dump the opening_loc field
3504 pm_buffer_append_byte(buffer, ',');
3505 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3506 pm_dump_json_location(buffer, parser, &cast->opening_loc);
3507
3508 // Dump the closing_loc field
3509 pm_buffer_append_byte(buffer, ',');
3510 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3511 pm_dump_json_location(buffer, parser, &cast->closing_loc);
3512
3513 pm_buffer_append_byte(buffer, '}');
3514 break;
3515 }
3517 pm_buffer_append_string(buffer, "{\"type\":\"BlockParameterNode\",\"location\":", 40);
3518
3519 const pm_block_parameter_node_t *cast = (const pm_block_parameter_node_t *) node;
3520 pm_dump_json_location(buffer, parser, &cast->base.location);
3521
3522 // Dump the ParameterFlags field
3523 pm_buffer_append_byte(buffer, ',');
3524 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
3525 size_t flags = 0;
3526 pm_buffer_append_byte(buffer, '[');
3528 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3529 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
3530 flags++;
3531 }
3532 pm_buffer_append_byte(buffer, ']');
3533
3534 // Dump the name field
3535 pm_buffer_append_byte(buffer, ',');
3536 pm_buffer_append_string(buffer, "\"name\":", 7);
3537 if (cast->name != PM_CONSTANT_ID_UNSET) {
3538 pm_dump_json_constant(buffer, parser, cast->name);
3539 } else {
3540 pm_buffer_append_string(buffer, "null", 4);
3541 }
3542
3543 // Dump the name_loc field
3544 pm_buffer_append_byte(buffer, ',');
3545 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3546 if (cast->name_loc.start != NULL) {
3547 pm_dump_json_location(buffer, parser, &cast->name_loc);
3548 } else {
3549 pm_buffer_append_string(buffer, "null", 4);
3550 }
3551
3552 // Dump the operator_loc field
3553 pm_buffer_append_byte(buffer, ',');
3554 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3555 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3556
3557 pm_buffer_append_byte(buffer, '}');
3558 break;
3559 }
3561 pm_buffer_append_string(buffer, "{\"type\":\"BlockParametersNode\",\"location\":", 41);
3562
3563 const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node;
3564 pm_dump_json_location(buffer, parser, &cast->base.location);
3565
3566 // Dump the parameters field
3567 pm_buffer_append_byte(buffer, ',');
3568 pm_buffer_append_string(buffer, "\"parameters\":", 13);
3569 if (cast->parameters != NULL) {
3570 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
3571 } else {
3572 pm_buffer_append_string(buffer, "null", 4);
3573 }
3574
3575 // Dump the locals field
3576 pm_buffer_append_byte(buffer, ',');
3577 pm_buffer_append_string(buffer, "\"locals\":", 9);
3578 const pm_node_list_t *locals = &cast->locals;
3579 pm_buffer_append_byte(buffer, '[');
3580
3581 for (size_t index = 0; index < locals->size; index++) {
3582 if (index != 0) pm_buffer_append_byte(buffer, ',');
3583 pm_dump_json(buffer, parser, locals->nodes[index]);
3584 }
3585 pm_buffer_append_byte(buffer, ']');
3586
3587 // Dump the opening_loc field
3588 pm_buffer_append_byte(buffer, ',');
3589 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3590 if (cast->opening_loc.start != NULL) {
3591 pm_dump_json_location(buffer, parser, &cast->opening_loc);
3592 } else {
3593 pm_buffer_append_string(buffer, "null", 4);
3594 }
3595
3596 // Dump the closing_loc field
3597 pm_buffer_append_byte(buffer, ',');
3598 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3599 if (cast->closing_loc.start != NULL) {
3600 pm_dump_json_location(buffer, parser, &cast->closing_loc);
3601 } else {
3602 pm_buffer_append_string(buffer, "null", 4);
3603 }
3604
3605 pm_buffer_append_byte(buffer, '}');
3606 break;
3607 }
3608 case PM_BREAK_NODE: {
3609 pm_buffer_append_string(buffer, "{\"type\":\"BreakNode\",\"location\":", 31);
3610
3611 const pm_break_node_t *cast = (const pm_break_node_t *) node;
3612 pm_dump_json_location(buffer, parser, &cast->base.location);
3613
3614 // Dump the arguments field
3615 pm_buffer_append_byte(buffer, ',');
3616 pm_buffer_append_string(buffer, "\"arguments\":", 12);
3617 if (cast->arguments != NULL) {
3618 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
3619 } else {
3620 pm_buffer_append_string(buffer, "null", 4);
3621 }
3622
3623 // Dump the keyword_loc field
3624 pm_buffer_append_byte(buffer, ',');
3625 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
3626 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
3627
3628 pm_buffer_append_byte(buffer, '}');
3629 break;
3630 }
3632 pm_buffer_append_string(buffer, "{\"type\":\"CallAndWriteNode\",\"location\":", 38);
3633
3634 const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node;
3635 pm_dump_json_location(buffer, parser, &cast->base.location);
3636
3637 // Dump the CallNodeFlags field
3638 pm_buffer_append_byte(buffer, ',');
3639 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3640 size_t flags = 0;
3641 pm_buffer_append_byte(buffer, '[');
3643 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3644 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
3645 flags++;
3646 }
3648 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3649 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
3650 flags++;
3651 }
3653 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3654 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
3655 flags++;
3656 }
3658 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3659 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
3660 flags++;
3661 }
3662 pm_buffer_append_byte(buffer, ']');
3663
3664 // Dump the receiver field
3665 pm_buffer_append_byte(buffer, ',');
3666 pm_buffer_append_string(buffer, "\"receiver\":", 11);
3667 if (cast->receiver != NULL) {
3668 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
3669 } else {
3670 pm_buffer_append_string(buffer, "null", 4);
3671 }
3672
3673 // Dump the call_operator_loc field
3674 pm_buffer_append_byte(buffer, ',');
3675 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
3676 if (cast->call_operator_loc.start != NULL) {
3677 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
3678 } else {
3679 pm_buffer_append_string(buffer, "null", 4);
3680 }
3681
3682 // Dump the message_loc field
3683 pm_buffer_append_byte(buffer, ',');
3684 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
3685 if (cast->message_loc.start != NULL) {
3686 pm_dump_json_location(buffer, parser, &cast->message_loc);
3687 } else {
3688 pm_buffer_append_string(buffer, "null", 4);
3689 }
3690
3691 // Dump the read_name field
3692 pm_buffer_append_byte(buffer, ',');
3693 pm_buffer_append_string(buffer, "\"read_name\":", 12);
3694 pm_dump_json_constant(buffer, parser, cast->read_name);
3695
3696 // Dump the write_name field
3697 pm_buffer_append_byte(buffer, ',');
3698 pm_buffer_append_string(buffer, "\"write_name\":", 13);
3699 pm_dump_json_constant(buffer, parser, cast->write_name);
3700
3701 // Dump the operator_loc field
3702 pm_buffer_append_byte(buffer, ',');
3703 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3704 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3705
3706 // Dump the value field
3707 pm_buffer_append_byte(buffer, ',');
3708 pm_buffer_append_string(buffer, "\"value\":", 8);
3709 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3710
3711 pm_buffer_append_byte(buffer, '}');
3712 break;
3713 }
3714 case PM_CALL_NODE: {
3715 pm_buffer_append_string(buffer, "{\"type\":\"CallNode\",\"location\":", 30);
3716
3717 const pm_call_node_t *cast = (const pm_call_node_t *) node;
3718 pm_dump_json_location(buffer, parser, &cast->base.location);
3719
3720 // Dump the CallNodeFlags field
3721 pm_buffer_append_byte(buffer, ',');
3722 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3723 size_t flags = 0;
3724 pm_buffer_append_byte(buffer, '[');
3726 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3727 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
3728 flags++;
3729 }
3731 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3732 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
3733 flags++;
3734 }
3736 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3737 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
3738 flags++;
3739 }
3741 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3742 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
3743 flags++;
3744 }
3745 pm_buffer_append_byte(buffer, ']');
3746
3747 // Dump the receiver field
3748 pm_buffer_append_byte(buffer, ',');
3749 pm_buffer_append_string(buffer, "\"receiver\":", 11);
3750 if (cast->receiver != NULL) {
3751 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
3752 } else {
3753 pm_buffer_append_string(buffer, "null", 4);
3754 }
3755
3756 // Dump the call_operator_loc field
3757 pm_buffer_append_byte(buffer, ',');
3758 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
3759 if (cast->call_operator_loc.start != NULL) {
3760 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
3761 } else {
3762 pm_buffer_append_string(buffer, "null", 4);
3763 }
3764
3765 // Dump the name field
3766 pm_buffer_append_byte(buffer, ',');
3767 pm_buffer_append_string(buffer, "\"name\":", 7);
3768 pm_dump_json_constant(buffer, parser, cast->name);
3769
3770 // Dump the message_loc field
3771 pm_buffer_append_byte(buffer, ',');
3772 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
3773 if (cast->message_loc.start != NULL) {
3774 pm_dump_json_location(buffer, parser, &cast->message_loc);
3775 } else {
3776 pm_buffer_append_string(buffer, "null", 4);
3777 }
3778
3779 // Dump the opening_loc field
3780 pm_buffer_append_byte(buffer, ',');
3781 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3782 if (cast->opening_loc.start != NULL) {
3783 pm_dump_json_location(buffer, parser, &cast->opening_loc);
3784 } else {
3785 pm_buffer_append_string(buffer, "null", 4);
3786 }
3787
3788 // Dump the arguments field
3789 pm_buffer_append_byte(buffer, ',');
3790 pm_buffer_append_string(buffer, "\"arguments\":", 12);
3791 if (cast->arguments != NULL) {
3792 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
3793 } else {
3794 pm_buffer_append_string(buffer, "null", 4);
3795 }
3796
3797 // Dump the closing_loc field
3798 pm_buffer_append_byte(buffer, ',');
3799 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3800 if (cast->closing_loc.start != NULL) {
3801 pm_dump_json_location(buffer, parser, &cast->closing_loc);
3802 } else {
3803 pm_buffer_append_string(buffer, "null", 4);
3804 }
3805
3806 // Dump the block field
3807 pm_buffer_append_byte(buffer, ',');
3808 pm_buffer_append_string(buffer, "\"block\":", 8);
3809 if (cast->block != NULL) {
3810 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
3811 } else {
3812 pm_buffer_append_string(buffer, "null", 4);
3813 }
3814
3815 pm_buffer_append_byte(buffer, '}');
3816 break;
3817 }
3819 pm_buffer_append_string(buffer, "{\"type\":\"CallOperatorWriteNode\",\"location\":", 43);
3820
3822 pm_dump_json_location(buffer, parser, &cast->base.location);
3823
3824 // Dump the CallNodeFlags field
3825 pm_buffer_append_byte(buffer, ',');
3826 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3827 size_t flags = 0;
3828 pm_buffer_append_byte(buffer, '[');
3830 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3831 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
3832 flags++;
3833 }
3835 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3836 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
3837 flags++;
3838 }
3840 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3841 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
3842 flags++;
3843 }
3845 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3846 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
3847 flags++;
3848 }
3849 pm_buffer_append_byte(buffer, ']');
3850
3851 // Dump the receiver field
3852 pm_buffer_append_byte(buffer, ',');
3853 pm_buffer_append_string(buffer, "\"receiver\":", 11);
3854 if (cast->receiver != NULL) {
3855 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
3856 } else {
3857 pm_buffer_append_string(buffer, "null", 4);
3858 }
3859
3860 // Dump the call_operator_loc field
3861 pm_buffer_append_byte(buffer, ',');
3862 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
3863 if (cast->call_operator_loc.start != NULL) {
3864 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
3865 } else {
3866 pm_buffer_append_string(buffer, "null", 4);
3867 }
3868
3869 // Dump the message_loc field
3870 pm_buffer_append_byte(buffer, ',');
3871 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
3872 if (cast->message_loc.start != NULL) {
3873 pm_dump_json_location(buffer, parser, &cast->message_loc);
3874 } else {
3875 pm_buffer_append_string(buffer, "null", 4);
3876 }
3877
3878 // Dump the read_name field
3879 pm_buffer_append_byte(buffer, ',');
3880 pm_buffer_append_string(buffer, "\"read_name\":", 12);
3881 pm_dump_json_constant(buffer, parser, cast->read_name);
3882
3883 // Dump the write_name field
3884 pm_buffer_append_byte(buffer, ',');
3885 pm_buffer_append_string(buffer, "\"write_name\":", 13);
3886 pm_dump_json_constant(buffer, parser, cast->write_name);
3887
3888 // Dump the binary_operator field
3889 pm_buffer_append_byte(buffer, ',');
3890 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
3891 pm_dump_json_constant(buffer, parser, cast->binary_operator);
3892
3893 // Dump the binary_operator_loc field
3894 pm_buffer_append_byte(buffer, ',');
3895 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
3896 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
3897
3898 // Dump the value field
3899 pm_buffer_append_byte(buffer, ',');
3900 pm_buffer_append_string(buffer, "\"value\":", 8);
3901 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3902
3903 pm_buffer_append_byte(buffer, '}');
3904 break;
3905 }
3906 case PM_CALL_OR_WRITE_NODE: {
3907 pm_buffer_append_string(buffer, "{\"type\":\"CallOrWriteNode\",\"location\":", 37);
3908
3909 const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node;
3910 pm_dump_json_location(buffer, parser, &cast->base.location);
3911
3912 // Dump the CallNodeFlags field
3913 pm_buffer_append_byte(buffer, ',');
3914 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3915 size_t flags = 0;
3916 pm_buffer_append_byte(buffer, '[');
3918 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3919 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
3920 flags++;
3921 }
3923 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3924 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
3925 flags++;
3926 }
3928 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3929 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
3930 flags++;
3931 }
3933 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3934 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
3935 flags++;
3936 }
3937 pm_buffer_append_byte(buffer, ']');
3938
3939 // Dump the receiver field
3940 pm_buffer_append_byte(buffer, ',');
3941 pm_buffer_append_string(buffer, "\"receiver\":", 11);
3942 if (cast->receiver != NULL) {
3943 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
3944 } else {
3945 pm_buffer_append_string(buffer, "null", 4);
3946 }
3947
3948 // Dump the call_operator_loc field
3949 pm_buffer_append_byte(buffer, ',');
3950 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
3951 if (cast->call_operator_loc.start != NULL) {
3952 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
3953 } else {
3954 pm_buffer_append_string(buffer, "null", 4);
3955 }
3956
3957 // Dump the message_loc field
3958 pm_buffer_append_byte(buffer, ',');
3959 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
3960 if (cast->message_loc.start != NULL) {
3961 pm_dump_json_location(buffer, parser, &cast->message_loc);
3962 } else {
3963 pm_buffer_append_string(buffer, "null", 4);
3964 }
3965
3966 // Dump the read_name field
3967 pm_buffer_append_byte(buffer, ',');
3968 pm_buffer_append_string(buffer, "\"read_name\":", 12);
3969 pm_dump_json_constant(buffer, parser, cast->read_name);
3970
3971 // Dump the write_name field
3972 pm_buffer_append_byte(buffer, ',');
3973 pm_buffer_append_string(buffer, "\"write_name\":", 13);
3974 pm_dump_json_constant(buffer, parser, cast->write_name);
3975
3976 // Dump the operator_loc field
3977 pm_buffer_append_byte(buffer, ',');
3978 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3979 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3980
3981 // Dump the value field
3982 pm_buffer_append_byte(buffer, ',');
3983 pm_buffer_append_string(buffer, "\"value\":", 8);
3984 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3985
3986 pm_buffer_append_byte(buffer, '}');
3987 break;
3988 }
3989 case PM_CALL_TARGET_NODE: {
3990 pm_buffer_append_string(buffer, "{\"type\":\"CallTargetNode\",\"location\":", 36);
3991
3992 const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node;
3993 pm_dump_json_location(buffer, parser, &cast->base.location);
3994
3995 // Dump the CallNodeFlags field
3996 pm_buffer_append_byte(buffer, ',');
3997 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3998 size_t flags = 0;
3999 pm_buffer_append_byte(buffer, '[');
4001 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4002 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
4003 flags++;
4004 }
4006 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4007 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
4008 flags++;
4009 }
4011 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4012 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
4013 flags++;
4014 }
4016 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4017 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
4018 flags++;
4019 }
4020 pm_buffer_append_byte(buffer, ']');
4021
4022 // Dump the receiver field
4023 pm_buffer_append_byte(buffer, ',');
4024 pm_buffer_append_string(buffer, "\"receiver\":", 11);
4025 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
4026
4027 // Dump the call_operator_loc field
4028 pm_buffer_append_byte(buffer, ',');
4029 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
4030 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
4031
4032 // Dump the name field
4033 pm_buffer_append_byte(buffer, ',');
4034 pm_buffer_append_string(buffer, "\"name\":", 7);
4035 pm_dump_json_constant(buffer, parser, cast->name);
4036
4037 // Dump the message_loc field
4038 pm_buffer_append_byte(buffer, ',');
4039 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
4040 pm_dump_json_location(buffer, parser, &cast->message_loc);
4041
4042 pm_buffer_append_byte(buffer, '}');
4043 break;
4044 }
4046 pm_buffer_append_string(buffer, "{\"type\":\"CapturePatternNode\",\"location\":", 40);
4047
4048 const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node;
4049 pm_dump_json_location(buffer, parser, &cast->base.location);
4050
4051 // Dump the value field
4052 pm_buffer_append_byte(buffer, ',');
4053 pm_buffer_append_string(buffer, "\"value\":", 8);
4054 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4055
4056 // Dump the target field
4057 pm_buffer_append_byte(buffer, ',');
4058 pm_buffer_append_string(buffer, "\"target\":", 9);
4059 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4060
4061 // Dump the operator_loc field
4062 pm_buffer_append_byte(buffer, ',');
4063 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4064 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4065
4066 pm_buffer_append_byte(buffer, '}');
4067 break;
4068 }
4069 case PM_CASE_MATCH_NODE: {
4070 pm_buffer_append_string(buffer, "{\"type\":\"CaseMatchNode\",\"location\":", 35);
4071
4072 const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node;
4073 pm_dump_json_location(buffer, parser, &cast->base.location);
4074
4075 // Dump the predicate field
4076 pm_buffer_append_byte(buffer, ',');
4077 pm_buffer_append_string(buffer, "\"predicate\":", 12);
4078 if (cast->predicate != NULL) {
4079 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
4080 } else {
4081 pm_buffer_append_string(buffer, "null", 4);
4082 }
4083
4084 // Dump the conditions field
4085 pm_buffer_append_byte(buffer, ',');
4086 pm_buffer_append_string(buffer, "\"conditions\":", 13);
4087 const pm_node_list_t *conditions = &cast->conditions;
4088 pm_buffer_append_byte(buffer, '[');
4089
4090 for (size_t index = 0; index < conditions->size; index++) {
4091 if (index != 0) pm_buffer_append_byte(buffer, ',');
4092 pm_dump_json(buffer, parser, conditions->nodes[index]);
4093 }
4094 pm_buffer_append_byte(buffer, ']');
4095
4096 // Dump the else_clause field
4097 pm_buffer_append_byte(buffer, ',');
4098 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
4099 if (cast->else_clause != NULL) {
4100 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
4101 } else {
4102 pm_buffer_append_string(buffer, "null", 4);
4103 }
4104
4105 // Dump the case_keyword_loc field
4106 pm_buffer_append_byte(buffer, ',');
4107 pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19);
4108 pm_dump_json_location(buffer, parser, &cast->case_keyword_loc);
4109
4110 // Dump the end_keyword_loc field
4111 pm_buffer_append_byte(buffer, ',');
4112 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4113 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4114
4115 pm_buffer_append_byte(buffer, '}');
4116 break;
4117 }
4118 case PM_CASE_NODE: {
4119 pm_buffer_append_string(buffer, "{\"type\":\"CaseNode\",\"location\":", 30);
4120
4121 const pm_case_node_t *cast = (const pm_case_node_t *) node;
4122 pm_dump_json_location(buffer, parser, &cast->base.location);
4123
4124 // Dump the predicate field
4125 pm_buffer_append_byte(buffer, ',');
4126 pm_buffer_append_string(buffer, "\"predicate\":", 12);
4127 if (cast->predicate != NULL) {
4128 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
4129 } else {
4130 pm_buffer_append_string(buffer, "null", 4);
4131 }
4132
4133 // Dump the conditions field
4134 pm_buffer_append_byte(buffer, ',');
4135 pm_buffer_append_string(buffer, "\"conditions\":", 13);
4136 const pm_node_list_t *conditions = &cast->conditions;
4137 pm_buffer_append_byte(buffer, '[');
4138
4139 for (size_t index = 0; index < conditions->size; index++) {
4140 if (index != 0) pm_buffer_append_byte(buffer, ',');
4141 pm_dump_json(buffer, parser, conditions->nodes[index]);
4142 }
4143 pm_buffer_append_byte(buffer, ']');
4144
4145 // Dump the else_clause field
4146 pm_buffer_append_byte(buffer, ',');
4147 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
4148 if (cast->else_clause != NULL) {
4149 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
4150 } else {
4151 pm_buffer_append_string(buffer, "null", 4);
4152 }
4153
4154 // Dump the case_keyword_loc field
4155 pm_buffer_append_byte(buffer, ',');
4156 pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19);
4157 pm_dump_json_location(buffer, parser, &cast->case_keyword_loc);
4158
4159 // Dump the end_keyword_loc field
4160 pm_buffer_append_byte(buffer, ',');
4161 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4162 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4163
4164 pm_buffer_append_byte(buffer, '}');
4165 break;
4166 }
4167 case PM_CLASS_NODE: {
4168 pm_buffer_append_string(buffer, "{\"type\":\"ClassNode\",\"location\":", 31);
4169
4170 const pm_class_node_t *cast = (const pm_class_node_t *) node;
4171 pm_dump_json_location(buffer, parser, &cast->base.location);
4172
4173 // Dump the locals field
4174 pm_buffer_append_byte(buffer, ',');
4175 pm_buffer_append_string(buffer, "\"locals\":", 9);
4176 const pm_constant_id_list_t *locals = &cast->locals;
4177 pm_buffer_append_byte(buffer, '[');
4178
4179 for (size_t index = 0; index < locals->size; index++) {
4180 if (index != 0) pm_buffer_append_byte(buffer, ',');
4181 pm_dump_json_constant(buffer, parser, locals->ids[index]);
4182 }
4183 pm_buffer_append_byte(buffer, ']');
4184
4185 // Dump the class_keyword_loc field
4186 pm_buffer_append_byte(buffer, ',');
4187 pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20);
4188 pm_dump_json_location(buffer, parser, &cast->class_keyword_loc);
4189
4190 // Dump the constant_path field
4191 pm_buffer_append_byte(buffer, ',');
4192 pm_buffer_append_string(buffer, "\"constant_path\":", 16);
4193 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path);
4194
4195 // Dump the inheritance_operator_loc field
4196 pm_buffer_append_byte(buffer, ',');
4197 pm_buffer_append_string(buffer, "\"inheritance_operator_loc\":", 27);
4198 if (cast->inheritance_operator_loc.start != NULL) {
4199 pm_dump_json_location(buffer, parser, &cast->inheritance_operator_loc);
4200 } else {
4201 pm_buffer_append_string(buffer, "null", 4);
4202 }
4203
4204 // Dump the superclass field
4205 pm_buffer_append_byte(buffer, ',');
4206 pm_buffer_append_string(buffer, "\"superclass\":", 13);
4207 if (cast->superclass != NULL) {
4208 pm_dump_json(buffer, parser, (const pm_node_t *) cast->superclass);
4209 } else {
4210 pm_buffer_append_string(buffer, "null", 4);
4211 }
4212
4213 // Dump the body field
4214 pm_buffer_append_byte(buffer, ',');
4215 pm_buffer_append_string(buffer, "\"body\":", 7);
4216 if (cast->body != NULL) {
4217 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
4218 } else {
4219 pm_buffer_append_string(buffer, "null", 4);
4220 }
4221
4222 // Dump the end_keyword_loc field
4223 pm_buffer_append_byte(buffer, ',');
4224 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4225 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4226
4227 // Dump the name field
4228 pm_buffer_append_byte(buffer, ',');
4229 pm_buffer_append_string(buffer, "\"name\":", 7);
4230 pm_dump_json_constant(buffer, parser, cast->name);
4231
4232 pm_buffer_append_byte(buffer, '}');
4233 break;
4234 }
4236 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableAndWriteNode\",\"location\":", 47);
4237
4239 pm_dump_json_location(buffer, parser, &cast->base.location);
4240
4241 // Dump the name field
4242 pm_buffer_append_byte(buffer, ',');
4243 pm_buffer_append_string(buffer, "\"name\":", 7);
4244 pm_dump_json_constant(buffer, parser, cast->name);
4245
4246 // Dump the name_loc field
4247 pm_buffer_append_byte(buffer, ',');
4248 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4249 pm_dump_json_location(buffer, parser, &cast->name_loc);
4250
4251 // Dump the operator_loc field
4252 pm_buffer_append_byte(buffer, ',');
4253 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4254 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4255
4256 // Dump the value field
4257 pm_buffer_append_byte(buffer, ',');
4258 pm_buffer_append_string(buffer, "\"value\":", 8);
4259 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4260
4261 pm_buffer_append_byte(buffer, '}');
4262 break;
4263 }
4265 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOperatorWriteNode\",\"location\":", 52);
4266
4268 pm_dump_json_location(buffer, parser, &cast->base.location);
4269
4270 // Dump the name field
4271 pm_buffer_append_byte(buffer, ',');
4272 pm_buffer_append_string(buffer, "\"name\":", 7);
4273 pm_dump_json_constant(buffer, parser, cast->name);
4274
4275 // Dump the name_loc field
4276 pm_buffer_append_byte(buffer, ',');
4277 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4278 pm_dump_json_location(buffer, parser, &cast->name_loc);
4279
4280 // Dump the binary_operator_loc field
4281 pm_buffer_append_byte(buffer, ',');
4282 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
4283 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
4284
4285 // Dump the value field
4286 pm_buffer_append_byte(buffer, ',');
4287 pm_buffer_append_string(buffer, "\"value\":", 8);
4288 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4289
4290 // Dump the binary_operator field
4291 pm_buffer_append_byte(buffer, ',');
4292 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
4293 pm_dump_json_constant(buffer, parser, cast->binary_operator);
4294
4295 pm_buffer_append_byte(buffer, '}');
4296 break;
4297 }
4299 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOrWriteNode\",\"location\":", 46);
4300
4302 pm_dump_json_location(buffer, parser, &cast->base.location);
4303
4304 // Dump the name field
4305 pm_buffer_append_byte(buffer, ',');
4306 pm_buffer_append_string(buffer, "\"name\":", 7);
4307 pm_dump_json_constant(buffer, parser, cast->name);
4308
4309 // Dump the name_loc field
4310 pm_buffer_append_byte(buffer, ',');
4311 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4312 pm_dump_json_location(buffer, parser, &cast->name_loc);
4313
4314 // Dump the operator_loc field
4315 pm_buffer_append_byte(buffer, ',');
4316 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4317 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4318
4319 // Dump the value field
4320 pm_buffer_append_byte(buffer, ',');
4321 pm_buffer_append_string(buffer, "\"value\":", 8);
4322 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4323
4324 pm_buffer_append_byte(buffer, '}');
4325 break;
4326 }
4328 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableReadNode\",\"location\":", 43);
4329
4331 pm_dump_json_location(buffer, parser, &cast->base.location);
4332
4333 // Dump the name field
4334 pm_buffer_append_byte(buffer, ',');
4335 pm_buffer_append_string(buffer, "\"name\":", 7);
4336 pm_dump_json_constant(buffer, parser, cast->name);
4337
4338 pm_buffer_append_byte(buffer, '}');
4339 break;
4340 }
4342 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableTargetNode\",\"location\":", 45);
4343
4345 pm_dump_json_location(buffer, parser, &cast->base.location);
4346
4347 // Dump the name field
4348 pm_buffer_append_byte(buffer, ',');
4349 pm_buffer_append_string(buffer, "\"name\":", 7);
4350 pm_dump_json_constant(buffer, parser, cast->name);
4351
4352 pm_buffer_append_byte(buffer, '}');
4353 break;
4354 }
4356 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableWriteNode\",\"location\":", 44);
4357
4359 pm_dump_json_location(buffer, parser, &cast->base.location);
4360
4361 // Dump the name field
4362 pm_buffer_append_byte(buffer, ',');
4363 pm_buffer_append_string(buffer, "\"name\":", 7);
4364 pm_dump_json_constant(buffer, parser, cast->name);
4365
4366 // Dump the name_loc field
4367 pm_buffer_append_byte(buffer, ',');
4368 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4369 pm_dump_json_location(buffer, parser, &cast->name_loc);
4370
4371 // Dump the value field
4372 pm_buffer_append_byte(buffer, ',');
4373 pm_buffer_append_string(buffer, "\"value\":", 8);
4374 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4375
4376 // Dump the operator_loc field
4377 pm_buffer_append_byte(buffer, ',');
4378 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4379 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4380
4381 pm_buffer_append_byte(buffer, '}');
4382 break;
4383 }
4385 pm_buffer_append_string(buffer, "{\"type\":\"ConstantAndWriteNode\",\"location\":", 42);
4386
4388 pm_dump_json_location(buffer, parser, &cast->base.location);
4389
4390 // Dump the name field
4391 pm_buffer_append_byte(buffer, ',');
4392 pm_buffer_append_string(buffer, "\"name\":", 7);
4393 pm_dump_json_constant(buffer, parser, cast->name);
4394
4395 // Dump the name_loc field
4396 pm_buffer_append_byte(buffer, ',');
4397 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4398 pm_dump_json_location(buffer, parser, &cast->name_loc);
4399
4400 // Dump the operator_loc field
4401 pm_buffer_append_byte(buffer, ',');
4402 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4403 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4404
4405 // Dump the value field
4406 pm_buffer_append_byte(buffer, ',');
4407 pm_buffer_append_string(buffer, "\"value\":", 8);
4408 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4409
4410 pm_buffer_append_byte(buffer, '}');
4411 break;
4412 }
4414 pm_buffer_append_string(buffer, "{\"type\":\"ConstantOperatorWriteNode\",\"location\":", 47);
4415
4417 pm_dump_json_location(buffer, parser, &cast->base.location);
4418
4419 // Dump the name field
4420 pm_buffer_append_byte(buffer, ',');
4421 pm_buffer_append_string(buffer, "\"name\":", 7);
4422 pm_dump_json_constant(buffer, parser, cast->name);
4423
4424 // Dump the name_loc field
4425 pm_buffer_append_byte(buffer, ',');
4426 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4427 pm_dump_json_location(buffer, parser, &cast->name_loc);
4428
4429 // Dump the binary_operator_loc field
4430 pm_buffer_append_byte(buffer, ',');
4431 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
4432 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
4433
4434 // Dump the value field
4435 pm_buffer_append_byte(buffer, ',');
4436 pm_buffer_append_string(buffer, "\"value\":", 8);
4437 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4438
4439 // Dump the binary_operator field
4440 pm_buffer_append_byte(buffer, ',');
4441 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
4442 pm_dump_json_constant(buffer, parser, cast->binary_operator);
4443
4444 pm_buffer_append_byte(buffer, '}');
4445 break;
4446 }
4448 pm_buffer_append_string(buffer, "{\"type\":\"ConstantOrWriteNode\",\"location\":", 41);
4449
4450 const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node;
4451 pm_dump_json_location(buffer, parser, &cast->base.location);
4452
4453 // Dump the name field
4454 pm_buffer_append_byte(buffer, ',');
4455 pm_buffer_append_string(buffer, "\"name\":", 7);
4456 pm_dump_json_constant(buffer, parser, cast->name);
4457
4458 // Dump the name_loc field
4459 pm_buffer_append_byte(buffer, ',');
4460 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4461 pm_dump_json_location(buffer, parser, &cast->name_loc);
4462
4463 // Dump the operator_loc field
4464 pm_buffer_append_byte(buffer, ',');
4465 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4466 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4467
4468 // Dump the value field
4469 pm_buffer_append_byte(buffer, ',');
4470 pm_buffer_append_string(buffer, "\"value\":", 8);
4471 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4472
4473 pm_buffer_append_byte(buffer, '}');
4474 break;
4475 }
4477 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathAndWriteNode\",\"location\":", 46);
4478
4480 pm_dump_json_location(buffer, parser, &cast->base.location);
4481
4482 // Dump the target field
4483 pm_buffer_append_byte(buffer, ',');
4484 pm_buffer_append_string(buffer, "\"target\":", 9);
4485 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4486
4487 // Dump the operator_loc field
4488 pm_buffer_append_byte(buffer, ',');
4489 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4490 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4491
4492 // Dump the value field
4493 pm_buffer_append_byte(buffer, ',');
4494 pm_buffer_append_string(buffer, "\"value\":", 8);
4495 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4496
4497 pm_buffer_append_byte(buffer, '}');
4498 break;
4499 }
4500 case PM_CONSTANT_PATH_NODE: {
4501 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathNode\",\"location\":", 38);
4502
4503 const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node;
4504 pm_dump_json_location(buffer, parser, &cast->base.location);
4505
4506 // Dump the parent field
4507 pm_buffer_append_byte(buffer, ',');
4508 pm_buffer_append_string(buffer, "\"parent\":", 9);
4509 if (cast->parent != NULL) {
4510 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent);
4511 } else {
4512 pm_buffer_append_string(buffer, "null", 4);
4513 }
4514
4515 // Dump the name field
4516 pm_buffer_append_byte(buffer, ',');
4517 pm_buffer_append_string(buffer, "\"name\":", 7);
4518 if (cast->name != PM_CONSTANT_ID_UNSET) {
4519 pm_dump_json_constant(buffer, parser, cast->name);
4520 } else {
4521 pm_buffer_append_string(buffer, "null", 4);
4522 }
4523
4524 // Dump the delimiter_loc field
4525 pm_buffer_append_byte(buffer, ',');
4526 pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16);
4527 pm_dump_json_location(buffer, parser, &cast->delimiter_loc);
4528
4529 // Dump the name_loc field
4530 pm_buffer_append_byte(buffer, ',');
4531 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4532 pm_dump_json_location(buffer, parser, &cast->name_loc);
4533
4534 pm_buffer_append_byte(buffer, '}');
4535 break;
4536 }
4538 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOperatorWriteNode\",\"location\":", 51);
4539
4541 pm_dump_json_location(buffer, parser, &cast->base.location);
4542
4543 // Dump the target field
4544 pm_buffer_append_byte(buffer, ',');
4545 pm_buffer_append_string(buffer, "\"target\":", 9);
4546 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4547
4548 // Dump the binary_operator_loc field
4549 pm_buffer_append_byte(buffer, ',');
4550 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
4551 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
4552
4553 // Dump the value field
4554 pm_buffer_append_byte(buffer, ',');
4555 pm_buffer_append_string(buffer, "\"value\":", 8);
4556 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4557
4558 // Dump the binary_operator field
4559 pm_buffer_append_byte(buffer, ',');
4560 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
4561 pm_dump_json_constant(buffer, parser, cast->binary_operator);
4562
4563 pm_buffer_append_byte(buffer, '}');
4564 break;
4565 }
4567 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOrWriteNode\",\"location\":", 45);
4568
4570 pm_dump_json_location(buffer, parser, &cast->base.location);
4571
4572 // Dump the target field
4573 pm_buffer_append_byte(buffer, ',');
4574 pm_buffer_append_string(buffer, "\"target\":", 9);
4575 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4576
4577 // Dump the operator_loc field
4578 pm_buffer_append_byte(buffer, ',');
4579 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4580 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4581
4582 // Dump the value field
4583 pm_buffer_append_byte(buffer, ',');
4584 pm_buffer_append_string(buffer, "\"value\":", 8);
4585 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4586
4587 pm_buffer_append_byte(buffer, '}');
4588 break;
4589 }
4591 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathTargetNode\",\"location\":", 44);
4592
4594 pm_dump_json_location(buffer, parser, &cast->base.location);
4595
4596 // Dump the parent field
4597 pm_buffer_append_byte(buffer, ',');
4598 pm_buffer_append_string(buffer, "\"parent\":", 9);
4599 if (cast->parent != NULL) {
4600 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent);
4601 } else {
4602 pm_buffer_append_string(buffer, "null", 4);
4603 }
4604
4605 // Dump the name field
4606 pm_buffer_append_byte(buffer, ',');
4607 pm_buffer_append_string(buffer, "\"name\":", 7);
4608 if (cast->name != PM_CONSTANT_ID_UNSET) {
4609 pm_dump_json_constant(buffer, parser, cast->name);
4610 } else {
4611 pm_buffer_append_string(buffer, "null", 4);
4612 }
4613
4614 // Dump the delimiter_loc field
4615 pm_buffer_append_byte(buffer, ',');
4616 pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16);
4617 pm_dump_json_location(buffer, parser, &cast->delimiter_loc);
4618
4619 // Dump the name_loc field
4620 pm_buffer_append_byte(buffer, ',');
4621 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4622 pm_dump_json_location(buffer, parser, &cast->name_loc);
4623
4624 pm_buffer_append_byte(buffer, '}');
4625 break;
4626 }
4628 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathWriteNode\",\"location\":", 43);
4629
4631 pm_dump_json_location(buffer, parser, &cast->base.location);
4632
4633 // Dump the target field
4634 pm_buffer_append_byte(buffer, ',');
4635 pm_buffer_append_string(buffer, "\"target\":", 9);
4636 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4637
4638 // Dump the operator_loc field
4639 pm_buffer_append_byte(buffer, ',');
4640 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4641 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4642
4643 // Dump the value field
4644 pm_buffer_append_byte(buffer, ',');
4645 pm_buffer_append_string(buffer, "\"value\":", 8);
4646 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4647
4648 pm_buffer_append_byte(buffer, '}');
4649 break;
4650 }
4651 case PM_CONSTANT_READ_NODE: {
4652 pm_buffer_append_string(buffer, "{\"type\":\"ConstantReadNode\",\"location\":", 38);
4653
4654 const pm_constant_read_node_t *cast = (const pm_constant_read_node_t *) node;
4655 pm_dump_json_location(buffer, parser, &cast->base.location);
4656
4657 // Dump the name field
4658 pm_buffer_append_byte(buffer, ',');
4659 pm_buffer_append_string(buffer, "\"name\":", 7);
4660 pm_dump_json_constant(buffer, parser, cast->name);
4661
4662 pm_buffer_append_byte(buffer, '}');
4663 break;
4664 }
4666 pm_buffer_append_string(buffer, "{\"type\":\"ConstantTargetNode\",\"location\":", 40);
4667
4668 const pm_constant_target_node_t *cast = (const pm_constant_target_node_t *) node;
4669 pm_dump_json_location(buffer, parser, &cast->base.location);
4670
4671 // Dump the name field
4672 pm_buffer_append_byte(buffer, ',');
4673 pm_buffer_append_string(buffer, "\"name\":", 7);
4674 pm_dump_json_constant(buffer, parser, cast->name);
4675
4676 pm_buffer_append_byte(buffer, '}');
4677 break;
4678 }
4680 pm_buffer_append_string(buffer, "{\"type\":\"ConstantWriteNode\",\"location\":", 39);
4681
4682 const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node;
4683 pm_dump_json_location(buffer, parser, &cast->base.location);
4684
4685 // Dump the name field
4686 pm_buffer_append_byte(buffer, ',');
4687 pm_buffer_append_string(buffer, "\"name\":", 7);
4688 pm_dump_json_constant(buffer, parser, cast->name);
4689
4690 // Dump the name_loc field
4691 pm_buffer_append_byte(buffer, ',');
4692 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4693 pm_dump_json_location(buffer, parser, &cast->name_loc);
4694
4695 // Dump the value field
4696 pm_buffer_append_byte(buffer, ',');
4697 pm_buffer_append_string(buffer, "\"value\":", 8);
4698 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4699
4700 // Dump the operator_loc field
4701 pm_buffer_append_byte(buffer, ',');
4702 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4703 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4704
4705 pm_buffer_append_byte(buffer, '}');
4706 break;
4707 }
4708 case PM_DEF_NODE: {
4709 pm_buffer_append_string(buffer, "{\"type\":\"DefNode\",\"location\":", 29);
4710
4711 const pm_def_node_t *cast = (const pm_def_node_t *) node;
4712 pm_dump_json_location(buffer, parser, &cast->base.location);
4713
4714 // Dump the name field
4715 pm_buffer_append_byte(buffer, ',');
4716 pm_buffer_append_string(buffer, "\"name\":", 7);
4717 pm_dump_json_constant(buffer, parser, cast->name);
4718
4719 // Dump the name_loc field
4720 pm_buffer_append_byte(buffer, ',');
4721 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4722 pm_dump_json_location(buffer, parser, &cast->name_loc);
4723
4724 // Dump the receiver field
4725 pm_buffer_append_byte(buffer, ',');
4726 pm_buffer_append_string(buffer, "\"receiver\":", 11);
4727 if (cast->receiver != NULL) {
4728 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
4729 } else {
4730 pm_buffer_append_string(buffer, "null", 4);
4731 }
4732
4733 // Dump the parameters field
4734 pm_buffer_append_byte(buffer, ',');
4735 pm_buffer_append_string(buffer, "\"parameters\":", 13);
4736 if (cast->parameters != NULL) {
4737 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
4738 } else {
4739 pm_buffer_append_string(buffer, "null", 4);
4740 }
4741
4742 // Dump the body field
4743 pm_buffer_append_byte(buffer, ',');
4744 pm_buffer_append_string(buffer, "\"body\":", 7);
4745 if (cast->body != NULL) {
4746 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
4747 } else {
4748 pm_buffer_append_string(buffer, "null", 4);
4749 }
4750
4751 // Dump the locals field
4752 pm_buffer_append_byte(buffer, ',');
4753 pm_buffer_append_string(buffer, "\"locals\":", 9);
4754 const pm_constant_id_list_t *locals = &cast->locals;
4755 pm_buffer_append_byte(buffer, '[');
4756
4757 for (size_t index = 0; index < locals->size; index++) {
4758 if (index != 0) pm_buffer_append_byte(buffer, ',');
4759 pm_dump_json_constant(buffer, parser, locals->ids[index]);
4760 }
4761 pm_buffer_append_byte(buffer, ']');
4762
4763 // Dump the def_keyword_loc field
4764 pm_buffer_append_byte(buffer, ',');
4765 pm_buffer_append_string(buffer, "\"def_keyword_loc\":", 18);
4766 pm_dump_json_location(buffer, parser, &cast->def_keyword_loc);
4767
4768 // Dump the operator_loc field
4769 pm_buffer_append_byte(buffer, ',');
4770 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4771 if (cast->operator_loc.start != NULL) {
4772 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4773 } else {
4774 pm_buffer_append_string(buffer, "null", 4);
4775 }
4776
4777 // Dump the lparen_loc field
4778 pm_buffer_append_byte(buffer, ',');
4779 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4780 if (cast->lparen_loc.start != NULL) {
4781 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
4782 } else {
4783 pm_buffer_append_string(buffer, "null", 4);
4784 }
4785
4786 // Dump the rparen_loc field
4787 pm_buffer_append_byte(buffer, ',');
4788 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4789 if (cast->rparen_loc.start != NULL) {
4790 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
4791 } else {
4792 pm_buffer_append_string(buffer, "null", 4);
4793 }
4794
4795 // Dump the equal_loc field
4796 pm_buffer_append_byte(buffer, ',');
4797 pm_buffer_append_string(buffer, "\"equal_loc\":", 12);
4798 if (cast->equal_loc.start != NULL) {
4799 pm_dump_json_location(buffer, parser, &cast->equal_loc);
4800 } else {
4801 pm_buffer_append_string(buffer, "null", 4);
4802 }
4803
4804 // Dump the end_keyword_loc field
4805 pm_buffer_append_byte(buffer, ',');
4806 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4807 if (cast->end_keyword_loc.start != NULL) {
4808 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4809 } else {
4810 pm_buffer_append_string(buffer, "null", 4);
4811 }
4812
4813 pm_buffer_append_byte(buffer, '}');
4814 break;
4815 }
4816 case PM_DEFINED_NODE: {
4817 pm_buffer_append_string(buffer, "{\"type\":\"DefinedNode\",\"location\":", 33);
4818
4819 const pm_defined_node_t *cast = (const pm_defined_node_t *) node;
4820 pm_dump_json_location(buffer, parser, &cast->base.location);
4821
4822 // Dump the lparen_loc field
4823 pm_buffer_append_byte(buffer, ',');
4824 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4825 if (cast->lparen_loc.start != NULL) {
4826 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
4827 } else {
4828 pm_buffer_append_string(buffer, "null", 4);
4829 }
4830
4831 // Dump the value field
4832 pm_buffer_append_byte(buffer, ',');
4833 pm_buffer_append_string(buffer, "\"value\":", 8);
4834 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4835
4836 // Dump the rparen_loc field
4837 pm_buffer_append_byte(buffer, ',');
4838 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4839 if (cast->rparen_loc.start != NULL) {
4840 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
4841 } else {
4842 pm_buffer_append_string(buffer, "null", 4);
4843 }
4844
4845 // Dump the keyword_loc field
4846 pm_buffer_append_byte(buffer, ',');
4847 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4848 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
4849
4850 pm_buffer_append_byte(buffer, '}');
4851 break;
4852 }
4853 case PM_ELSE_NODE: {
4854 pm_buffer_append_string(buffer, "{\"type\":\"ElseNode\",\"location\":", 30);
4855
4856 const pm_else_node_t *cast = (const pm_else_node_t *) node;
4857 pm_dump_json_location(buffer, parser, &cast->base.location);
4858
4859 // Dump the else_keyword_loc field
4860 pm_buffer_append_byte(buffer, ',');
4861 pm_buffer_append_string(buffer, "\"else_keyword_loc\":", 19);
4862 pm_dump_json_location(buffer, parser, &cast->else_keyword_loc);
4863
4864 // Dump the statements field
4865 pm_buffer_append_byte(buffer, ',');
4866 pm_buffer_append_string(buffer, "\"statements\":", 13);
4867 if (cast->statements != NULL) {
4868 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4869 } else {
4870 pm_buffer_append_string(buffer, "null", 4);
4871 }
4872
4873 // Dump the end_keyword_loc field
4874 pm_buffer_append_byte(buffer, ',');
4875 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4876 if (cast->end_keyword_loc.start != NULL) {
4877 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4878 } else {
4879 pm_buffer_append_string(buffer, "null", 4);
4880 }
4881
4882 pm_buffer_append_byte(buffer, '}');
4883 break;
4884 }
4886 pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedStatementsNode\",\"location\":", 44);
4887
4889 pm_dump_json_location(buffer, parser, &cast->base.location);
4890
4891 // Dump the opening_loc field
4892 pm_buffer_append_byte(buffer, ',');
4893 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
4894 pm_dump_json_location(buffer, parser, &cast->opening_loc);
4895
4896 // Dump the statements field
4897 pm_buffer_append_byte(buffer, ',');
4898 pm_buffer_append_string(buffer, "\"statements\":", 13);
4899 if (cast->statements != NULL) {
4900 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4901 } else {
4902 pm_buffer_append_string(buffer, "null", 4);
4903 }
4904
4905 // Dump the closing_loc field
4906 pm_buffer_append_byte(buffer, ',');
4907 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
4908 pm_dump_json_location(buffer, parser, &cast->closing_loc);
4909
4910 pm_buffer_append_byte(buffer, '}');
4911 break;
4912 }
4914 pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedVariableNode\",\"location\":", 42);
4915
4916 const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node;
4917 pm_dump_json_location(buffer, parser, &cast->base.location);
4918
4919 // Dump the operator_loc field
4920 pm_buffer_append_byte(buffer, ',');
4921 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4922 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4923
4924 // Dump the variable field
4925 pm_buffer_append_byte(buffer, ',');
4926 pm_buffer_append_string(buffer, "\"variable\":", 11);
4927 pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable);
4928
4929 pm_buffer_append_byte(buffer, '}');
4930 break;
4931 }
4932 case PM_ENSURE_NODE: {
4933 pm_buffer_append_string(buffer, "{\"type\":\"EnsureNode\",\"location\":", 32);
4934
4935 const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
4936 pm_dump_json_location(buffer, parser, &cast->base.location);
4937
4938 // Dump the ensure_keyword_loc field
4939 pm_buffer_append_byte(buffer, ',');
4940 pm_buffer_append_string(buffer, "\"ensure_keyword_loc\":", 21);
4941 pm_dump_json_location(buffer, parser, &cast->ensure_keyword_loc);
4942
4943 // Dump the statements field
4944 pm_buffer_append_byte(buffer, ',');
4945 pm_buffer_append_string(buffer, "\"statements\":", 13);
4946 if (cast->statements != NULL) {
4947 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4948 } else {
4949 pm_buffer_append_string(buffer, "null", 4);
4950 }
4951
4952 // Dump the end_keyword_loc field
4953 pm_buffer_append_byte(buffer, ',');
4954 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4955 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4956
4957 pm_buffer_append_byte(buffer, '}');
4958 break;
4959 }
4960 case PM_FALSE_NODE: {
4961 pm_buffer_append_string(buffer, "{\"type\":\"FalseNode\",\"location\":", 31);
4962
4963 const pm_false_node_t *cast = (const pm_false_node_t *) node;
4964 pm_dump_json_location(buffer, parser, &cast->base.location);
4965
4966 pm_buffer_append_byte(buffer, '}');
4967 break;
4968 }
4969 case PM_FIND_PATTERN_NODE: {
4970 pm_buffer_append_string(buffer, "{\"type\":\"FindPatternNode\",\"location\":", 37);
4971
4972 const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node;
4973 pm_dump_json_location(buffer, parser, &cast->base.location);
4974
4975 // Dump the constant field
4976 pm_buffer_append_byte(buffer, ',');
4977 pm_buffer_append_string(buffer, "\"constant\":", 11);
4978 if (cast->constant != NULL) {
4979 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
4980 } else {
4981 pm_buffer_append_string(buffer, "null", 4);
4982 }
4983
4984 // Dump the left field
4985 pm_buffer_append_byte(buffer, ',');
4986 pm_buffer_append_string(buffer, "\"left\":", 7);
4987 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
4988
4989 // Dump the requireds field
4990 pm_buffer_append_byte(buffer, ',');
4991 pm_buffer_append_string(buffer, "\"requireds\":", 12);
4992 const pm_node_list_t *requireds = &cast->requireds;
4993 pm_buffer_append_byte(buffer, '[');
4994
4995 for (size_t index = 0; index < requireds->size; index++) {
4996 if (index != 0) pm_buffer_append_byte(buffer, ',');
4997 pm_dump_json(buffer, parser, requireds->nodes[index]);
4998 }
4999 pm_buffer_append_byte(buffer, ']');
5000
5001 // Dump the right field
5002 pm_buffer_append_byte(buffer, ',');
5003 pm_buffer_append_string(buffer, "\"right\":", 8);
5004 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
5005
5006 // Dump the opening_loc field
5007 pm_buffer_append_byte(buffer, ',');
5008 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5009 if (cast->opening_loc.start != NULL) {
5010 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5011 } else {
5012 pm_buffer_append_string(buffer, "null", 4);
5013 }
5014
5015 // Dump the closing_loc field
5016 pm_buffer_append_byte(buffer, ',');
5017 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5018 if (cast->closing_loc.start != NULL) {
5019 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5020 } else {
5021 pm_buffer_append_string(buffer, "null", 4);
5022 }
5023
5024 pm_buffer_append_byte(buffer, '}');
5025 break;
5026 }
5027 case PM_FLIP_FLOP_NODE: {
5028 pm_buffer_append_string(buffer, "{\"type\":\"FlipFlopNode\",\"location\":", 34);
5029
5030 const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node;
5031 pm_dump_json_location(buffer, parser, &cast->base.location);
5032
5033 // Dump the RangeFlags field
5034 pm_buffer_append_byte(buffer, ',');
5035 pm_buffer_append_string(buffer, "\"RangeFlags\":", 13);
5036 size_t flags = 0;
5037 pm_buffer_append_byte(buffer, '[');
5039 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5040 pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13);
5041 flags++;
5042 }
5043 pm_buffer_append_byte(buffer, ']');
5044
5045 // Dump the left field
5046 pm_buffer_append_byte(buffer, ',');
5047 pm_buffer_append_string(buffer, "\"left\":", 7);
5048 if (cast->left != NULL) {
5049 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
5050 } else {
5051 pm_buffer_append_string(buffer, "null", 4);
5052 }
5053
5054 // Dump the right field
5055 pm_buffer_append_byte(buffer, ',');
5056 pm_buffer_append_string(buffer, "\"right\":", 8);
5057 if (cast->right != NULL) {
5058 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
5059 } else {
5060 pm_buffer_append_string(buffer, "null", 4);
5061 }
5062
5063 // Dump the operator_loc field
5064 pm_buffer_append_byte(buffer, ',');
5065 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5066 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5067
5068 pm_buffer_append_byte(buffer, '}');
5069 break;
5070 }
5071 case PM_FLOAT_NODE: {
5072 pm_buffer_append_string(buffer, "{\"type\":\"FloatNode\",\"location\":", 31);
5073
5074 const pm_float_node_t *cast = (const pm_float_node_t *) node;
5075 pm_dump_json_location(buffer, parser, &cast->base.location);
5076
5077 // Dump the value field
5078 pm_buffer_append_byte(buffer, ',');
5079 pm_buffer_append_string(buffer, "\"value\":", 8);
5080 pm_buffer_append_format(buffer, "%f", cast->value);
5081
5082 pm_buffer_append_byte(buffer, '}');
5083 break;
5084 }
5085 case PM_FOR_NODE: {
5086 pm_buffer_append_string(buffer, "{\"type\":\"ForNode\",\"location\":", 29);
5087
5088 const pm_for_node_t *cast = (const pm_for_node_t *) node;
5089 pm_dump_json_location(buffer, parser, &cast->base.location);
5090
5091 // Dump the index field
5092 pm_buffer_append_byte(buffer, ',');
5093 pm_buffer_append_string(buffer, "\"index\":", 8);
5094 pm_dump_json(buffer, parser, (const pm_node_t *) cast->index);
5095
5096 // Dump the collection field
5097 pm_buffer_append_byte(buffer, ',');
5098 pm_buffer_append_string(buffer, "\"collection\":", 13);
5099 pm_dump_json(buffer, parser, (const pm_node_t *) cast->collection);
5100
5101 // Dump the statements field
5102 pm_buffer_append_byte(buffer, ',');
5103 pm_buffer_append_string(buffer, "\"statements\":", 13);
5104 if (cast->statements != NULL) {
5105 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5106 } else {
5107 pm_buffer_append_string(buffer, "null", 4);
5108 }
5109
5110 // Dump the for_keyword_loc field
5111 pm_buffer_append_byte(buffer, ',');
5112 pm_buffer_append_string(buffer, "\"for_keyword_loc\":", 18);
5113 pm_dump_json_location(buffer, parser, &cast->for_keyword_loc);
5114
5115 // Dump the in_keyword_loc field
5116 pm_buffer_append_byte(buffer, ',');
5117 pm_buffer_append_string(buffer, "\"in_keyword_loc\":", 17);
5118 pm_dump_json_location(buffer, parser, &cast->in_keyword_loc);
5119
5120 // Dump the do_keyword_loc field
5121 pm_buffer_append_byte(buffer, ',');
5122 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
5123 if (cast->do_keyword_loc.start != NULL) {
5124 pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
5125 } else {
5126 pm_buffer_append_string(buffer, "null", 4);
5127 }
5128
5129 // Dump the end_keyword_loc field
5130 pm_buffer_append_byte(buffer, ',');
5131 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5132 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
5133
5134 pm_buffer_append_byte(buffer, '}');
5135 break;
5136 }
5138 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingArgumentsNode\",\"location\":", 45);
5139
5141 pm_dump_json_location(buffer, parser, &cast->base.location);
5142
5143 pm_buffer_append_byte(buffer, '}');
5144 break;
5145 }
5147 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingParameterNode\",\"location\":", 45);
5148
5150 pm_dump_json_location(buffer, parser, &cast->base.location);
5151
5152 pm_buffer_append_byte(buffer, '}');
5153 break;
5154 }
5156 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingSuperNode\",\"location\":", 41);
5157
5158 const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node;
5159 pm_dump_json_location(buffer, parser, &cast->base.location);
5160
5161 // Dump the block field
5162 pm_buffer_append_byte(buffer, ',');
5163 pm_buffer_append_string(buffer, "\"block\":", 8);
5164 if (cast->block != NULL) {
5165 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5166 } else {
5167 pm_buffer_append_string(buffer, "null", 4);
5168 }
5169
5170 pm_buffer_append_byte(buffer, '}');
5171 break;
5172 }
5174 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableAndWriteNode\",\"location\":", 48);
5175
5177 pm_dump_json_location(buffer, parser, &cast->base.location);
5178
5179 // Dump the name field
5180 pm_buffer_append_byte(buffer, ',');
5181 pm_buffer_append_string(buffer, "\"name\":", 7);
5182 pm_dump_json_constant(buffer, parser, cast->name);
5183
5184 // Dump the name_loc field
5185 pm_buffer_append_byte(buffer, ',');
5186 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5187 pm_dump_json_location(buffer, parser, &cast->name_loc);
5188
5189 // Dump the operator_loc field
5190 pm_buffer_append_byte(buffer, ',');
5191 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5192 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5193
5194 // Dump the value field
5195 pm_buffer_append_byte(buffer, ',');
5196 pm_buffer_append_string(buffer, "\"value\":", 8);
5197 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5198
5199 pm_buffer_append_byte(buffer, '}');
5200 break;
5201 }
5203 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOperatorWriteNode\",\"location\":", 53);
5204
5206 pm_dump_json_location(buffer, parser, &cast->base.location);
5207
5208 // Dump the name field
5209 pm_buffer_append_byte(buffer, ',');
5210 pm_buffer_append_string(buffer, "\"name\":", 7);
5211 pm_dump_json_constant(buffer, parser, cast->name);
5212
5213 // Dump the name_loc field
5214 pm_buffer_append_byte(buffer, ',');
5215 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5216 pm_dump_json_location(buffer, parser, &cast->name_loc);
5217
5218 // Dump the binary_operator_loc field
5219 pm_buffer_append_byte(buffer, ',');
5220 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
5221 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
5222
5223 // Dump the value field
5224 pm_buffer_append_byte(buffer, ',');
5225 pm_buffer_append_string(buffer, "\"value\":", 8);
5226 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5227
5228 // Dump the binary_operator field
5229 pm_buffer_append_byte(buffer, ',');
5230 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
5231 pm_dump_json_constant(buffer, parser, cast->binary_operator);
5232
5233 pm_buffer_append_byte(buffer, '}');
5234 break;
5235 }
5237 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOrWriteNode\",\"location\":", 47);
5238
5240 pm_dump_json_location(buffer, parser, &cast->base.location);
5241
5242 // Dump the name field
5243 pm_buffer_append_byte(buffer, ',');
5244 pm_buffer_append_string(buffer, "\"name\":", 7);
5245 pm_dump_json_constant(buffer, parser, cast->name);
5246
5247 // Dump the name_loc field
5248 pm_buffer_append_byte(buffer, ',');
5249 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5250 pm_dump_json_location(buffer, parser, &cast->name_loc);
5251
5252 // Dump the operator_loc field
5253 pm_buffer_append_byte(buffer, ',');
5254 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5255 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5256
5257 // Dump the value field
5258 pm_buffer_append_byte(buffer, ',');
5259 pm_buffer_append_string(buffer, "\"value\":", 8);
5260 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5261
5262 pm_buffer_append_byte(buffer, '}');
5263 break;
5264 }
5266 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableReadNode\",\"location\":", 44);
5267
5269 pm_dump_json_location(buffer, parser, &cast->base.location);
5270
5271 // Dump the name field
5272 pm_buffer_append_byte(buffer, ',');
5273 pm_buffer_append_string(buffer, "\"name\":", 7);
5274 pm_dump_json_constant(buffer, parser, cast->name);
5275
5276 pm_buffer_append_byte(buffer, '}');
5277 break;
5278 }
5280 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableTargetNode\",\"location\":", 46);
5281
5283 pm_dump_json_location(buffer, parser, &cast->base.location);
5284
5285 // Dump the name field
5286 pm_buffer_append_byte(buffer, ',');
5287 pm_buffer_append_string(buffer, "\"name\":", 7);
5288 pm_dump_json_constant(buffer, parser, cast->name);
5289
5290 pm_buffer_append_byte(buffer, '}');
5291 break;
5292 }
5294 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableWriteNode\",\"location\":", 45);
5295
5297 pm_dump_json_location(buffer, parser, &cast->base.location);
5298
5299 // Dump the name field
5300 pm_buffer_append_byte(buffer, ',');
5301 pm_buffer_append_string(buffer, "\"name\":", 7);
5302 pm_dump_json_constant(buffer, parser, cast->name);
5303
5304 // Dump the name_loc field
5305 pm_buffer_append_byte(buffer, ',');
5306 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5307 pm_dump_json_location(buffer, parser, &cast->name_loc);
5308
5309 // Dump the value field
5310 pm_buffer_append_byte(buffer, ',');
5311 pm_buffer_append_string(buffer, "\"value\":", 8);
5312 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5313
5314 // Dump the operator_loc field
5315 pm_buffer_append_byte(buffer, ',');
5316 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5317 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5318
5319 pm_buffer_append_byte(buffer, '}');
5320 break;
5321 }
5322 case PM_HASH_NODE: {
5323 pm_buffer_append_string(buffer, "{\"type\":\"HashNode\",\"location\":", 30);
5324
5325 const pm_hash_node_t *cast = (const pm_hash_node_t *) node;
5326 pm_dump_json_location(buffer, parser, &cast->base.location);
5327
5328 // Dump the opening_loc field
5329 pm_buffer_append_byte(buffer, ',');
5330 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5331 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5332
5333 // Dump the elements field
5334 pm_buffer_append_byte(buffer, ',');
5335 pm_buffer_append_string(buffer, "\"elements\":", 11);
5336 const pm_node_list_t *elements = &cast->elements;
5337 pm_buffer_append_byte(buffer, '[');
5338
5339 for (size_t index = 0; index < elements->size; index++) {
5340 if (index != 0) pm_buffer_append_byte(buffer, ',');
5341 pm_dump_json(buffer, parser, elements->nodes[index]);
5342 }
5343 pm_buffer_append_byte(buffer, ']');
5344
5345 // Dump the closing_loc field
5346 pm_buffer_append_byte(buffer, ',');
5347 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5348 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5349
5350 pm_buffer_append_byte(buffer, '}');
5351 break;
5352 }
5353 case PM_HASH_PATTERN_NODE: {
5354 pm_buffer_append_string(buffer, "{\"type\":\"HashPatternNode\",\"location\":", 37);
5355
5356 const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node;
5357 pm_dump_json_location(buffer, parser, &cast->base.location);
5358
5359 // Dump the constant field
5360 pm_buffer_append_byte(buffer, ',');
5361 pm_buffer_append_string(buffer, "\"constant\":", 11);
5362 if (cast->constant != NULL) {
5363 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
5364 } else {
5365 pm_buffer_append_string(buffer, "null", 4);
5366 }
5367
5368 // Dump the elements field
5369 pm_buffer_append_byte(buffer, ',');
5370 pm_buffer_append_string(buffer, "\"elements\":", 11);
5371 const pm_node_list_t *elements = &cast->elements;
5372 pm_buffer_append_byte(buffer, '[');
5373
5374 for (size_t index = 0; index < elements->size; index++) {
5375 if (index != 0) pm_buffer_append_byte(buffer, ',');
5376 pm_dump_json(buffer, parser, elements->nodes[index]);
5377 }
5378 pm_buffer_append_byte(buffer, ']');
5379
5380 // Dump the rest field
5381 pm_buffer_append_byte(buffer, ',');
5382 pm_buffer_append_string(buffer, "\"rest\":", 7);
5383 if (cast->rest != NULL) {
5384 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
5385 } else {
5386 pm_buffer_append_string(buffer, "null", 4);
5387 }
5388
5389 // Dump the opening_loc field
5390 pm_buffer_append_byte(buffer, ',');
5391 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5392 if (cast->opening_loc.start != NULL) {
5393 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5394 } else {
5395 pm_buffer_append_string(buffer, "null", 4);
5396 }
5397
5398 // Dump the closing_loc field
5399 pm_buffer_append_byte(buffer, ',');
5400 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5401 if (cast->closing_loc.start != NULL) {
5402 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5403 } else {
5404 pm_buffer_append_string(buffer, "null", 4);
5405 }
5406
5407 pm_buffer_append_byte(buffer, '}');
5408 break;
5409 }
5410 case PM_IF_NODE: {
5411 pm_buffer_append_string(buffer, "{\"type\":\"IfNode\",\"location\":", 28);
5412
5413 const pm_if_node_t *cast = (const pm_if_node_t *) node;
5414 pm_dump_json_location(buffer, parser, &cast->base.location);
5415
5416 // Dump the if_keyword_loc field
5417 pm_buffer_append_byte(buffer, ',');
5418 pm_buffer_append_string(buffer, "\"if_keyword_loc\":", 17);
5419 if (cast->if_keyword_loc.start != NULL) {
5420 pm_dump_json_location(buffer, parser, &cast->if_keyword_loc);
5421 } else {
5422 pm_buffer_append_string(buffer, "null", 4);
5423 }
5424
5425 // Dump the predicate field
5426 pm_buffer_append_byte(buffer, ',');
5427 pm_buffer_append_string(buffer, "\"predicate\":", 12);
5428 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
5429
5430 // Dump the then_keyword_loc field
5431 pm_buffer_append_byte(buffer, ',');
5432 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
5433 if (cast->then_keyword_loc.start != NULL) {
5434 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
5435 } else {
5436 pm_buffer_append_string(buffer, "null", 4);
5437 }
5438
5439 // Dump the statements field
5440 pm_buffer_append_byte(buffer, ',');
5441 pm_buffer_append_string(buffer, "\"statements\":", 13);
5442 if (cast->statements != NULL) {
5443 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5444 } else {
5445 pm_buffer_append_string(buffer, "null", 4);
5446 }
5447
5448 // Dump the subsequent field
5449 pm_buffer_append_byte(buffer, ',');
5450 pm_buffer_append_string(buffer, "\"subsequent\":", 13);
5451 if (cast->subsequent != NULL) {
5452 pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent);
5453 } else {
5454 pm_buffer_append_string(buffer, "null", 4);
5455 }
5456
5457 // Dump the end_keyword_loc field
5458 pm_buffer_append_byte(buffer, ',');
5459 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5460 if (cast->end_keyword_loc.start != NULL) {
5461 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
5462 } else {
5463 pm_buffer_append_string(buffer, "null", 4);
5464 }
5465
5466 pm_buffer_append_byte(buffer, '}');
5467 break;
5468 }
5469 case PM_IMAGINARY_NODE: {
5470 pm_buffer_append_string(buffer, "{\"type\":\"ImaginaryNode\",\"location\":", 35);
5471
5472 const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node;
5473 pm_dump_json_location(buffer, parser, &cast->base.location);
5474
5475 // Dump the numeric field
5476 pm_buffer_append_byte(buffer, ',');
5477 pm_buffer_append_string(buffer, "\"numeric\":", 10);
5478 pm_dump_json(buffer, parser, (const pm_node_t *) cast->numeric);
5479
5480 pm_buffer_append_byte(buffer, '}');
5481 break;
5482 }
5483 case PM_IMPLICIT_NODE: {
5484 pm_buffer_append_string(buffer, "{\"type\":\"ImplicitNode\",\"location\":", 34);
5485
5486 const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node;
5487 pm_dump_json_location(buffer, parser, &cast->base.location);
5488
5489 // Dump the value field
5490 pm_buffer_append_byte(buffer, ',');
5491 pm_buffer_append_string(buffer, "\"value\":", 8);
5492 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5493
5494 pm_buffer_append_byte(buffer, '}');
5495 break;
5496 }
5497 case PM_IMPLICIT_REST_NODE: {
5498 pm_buffer_append_string(buffer, "{\"type\":\"ImplicitRestNode\",\"location\":", 38);
5499
5500 const pm_implicit_rest_node_t *cast = (const pm_implicit_rest_node_t *) node;
5501 pm_dump_json_location(buffer, parser, &cast->base.location);
5502
5503 pm_buffer_append_byte(buffer, '}');
5504 break;
5505 }
5506 case PM_IN_NODE: {
5507 pm_buffer_append_string(buffer, "{\"type\":\"InNode\",\"location\":", 28);
5508
5509 const pm_in_node_t *cast = (const pm_in_node_t *) node;
5510 pm_dump_json_location(buffer, parser, &cast->base.location);
5511
5512 // Dump the pattern field
5513 pm_buffer_append_byte(buffer, ',');
5514 pm_buffer_append_string(buffer, "\"pattern\":", 10);
5515 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
5516
5517 // Dump the statements field
5518 pm_buffer_append_byte(buffer, ',');
5519 pm_buffer_append_string(buffer, "\"statements\":", 13);
5520 if (cast->statements != NULL) {
5521 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5522 } else {
5523 pm_buffer_append_string(buffer, "null", 4);
5524 }
5525
5526 // Dump the in_loc field
5527 pm_buffer_append_byte(buffer, ',');
5528 pm_buffer_append_string(buffer, "\"in_loc\":", 9);
5529 pm_dump_json_location(buffer, parser, &cast->in_loc);
5530
5531 // Dump the then_loc field
5532 pm_buffer_append_byte(buffer, ',');
5533 pm_buffer_append_string(buffer, "\"then_loc\":", 11);
5534 if (cast->then_loc.start != NULL) {
5535 pm_dump_json_location(buffer, parser, &cast->then_loc);
5536 } else {
5537 pm_buffer_append_string(buffer, "null", 4);
5538 }
5539
5540 pm_buffer_append_byte(buffer, '}');
5541 break;
5542 }
5544 pm_buffer_append_string(buffer, "{\"type\":\"IndexAndWriteNode\",\"location\":", 39);
5545
5546 const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node;
5547 pm_dump_json_location(buffer, parser, &cast->base.location);
5548
5549 // Dump the CallNodeFlags field
5550 pm_buffer_append_byte(buffer, ',');
5551 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5552 size_t flags = 0;
5553 pm_buffer_append_byte(buffer, '[');
5555 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5556 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5557 flags++;
5558 }
5560 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5561 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5562 flags++;
5563 }
5565 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5566 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5567 flags++;
5568 }
5570 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5571 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5572 flags++;
5573 }
5574 pm_buffer_append_byte(buffer, ']');
5575
5576 // Dump the receiver field
5577 pm_buffer_append_byte(buffer, ',');
5578 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5579 if (cast->receiver != NULL) {
5580 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5581 } else {
5582 pm_buffer_append_string(buffer, "null", 4);
5583 }
5584
5585 // Dump the call_operator_loc field
5586 pm_buffer_append_byte(buffer, ',');
5587 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
5588 if (cast->call_operator_loc.start != NULL) {
5589 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
5590 } else {
5591 pm_buffer_append_string(buffer, "null", 4);
5592 }
5593
5594 // Dump the opening_loc field
5595 pm_buffer_append_byte(buffer, ',');
5596 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5597 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5598
5599 // Dump the arguments field
5600 pm_buffer_append_byte(buffer, ',');
5601 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5602 if (cast->arguments != NULL) {
5603 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5604 } else {
5605 pm_buffer_append_string(buffer, "null", 4);
5606 }
5607
5608 // Dump the closing_loc field
5609 pm_buffer_append_byte(buffer, ',');
5610 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5611 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5612
5613 // Dump the block field
5614 pm_buffer_append_byte(buffer, ',');
5615 pm_buffer_append_string(buffer, "\"block\":", 8);
5616 if (cast->block != NULL) {
5617 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5618 } else {
5619 pm_buffer_append_string(buffer, "null", 4);
5620 }
5621
5622 // Dump the operator_loc field
5623 pm_buffer_append_byte(buffer, ',');
5624 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5625 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5626
5627 // Dump the value field
5628 pm_buffer_append_byte(buffer, ',');
5629 pm_buffer_append_string(buffer, "\"value\":", 8);
5630 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5631
5632 pm_buffer_append_byte(buffer, '}');
5633 break;
5634 }
5636 pm_buffer_append_string(buffer, "{\"type\":\"IndexOperatorWriteNode\",\"location\":", 44);
5637
5639 pm_dump_json_location(buffer, parser, &cast->base.location);
5640
5641 // Dump the CallNodeFlags field
5642 pm_buffer_append_byte(buffer, ',');
5643 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5644 size_t flags = 0;
5645 pm_buffer_append_byte(buffer, '[');
5647 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5648 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5649 flags++;
5650 }
5652 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5653 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5654 flags++;
5655 }
5657 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5658 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5659 flags++;
5660 }
5662 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5663 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5664 flags++;
5665 }
5666 pm_buffer_append_byte(buffer, ']');
5667
5668 // Dump the receiver field
5669 pm_buffer_append_byte(buffer, ',');
5670 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5671 if (cast->receiver != NULL) {
5672 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5673 } else {
5674 pm_buffer_append_string(buffer, "null", 4);
5675 }
5676
5677 // Dump the call_operator_loc field
5678 pm_buffer_append_byte(buffer, ',');
5679 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
5680 if (cast->call_operator_loc.start != NULL) {
5681 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
5682 } else {
5683 pm_buffer_append_string(buffer, "null", 4);
5684 }
5685
5686 // Dump the opening_loc field
5687 pm_buffer_append_byte(buffer, ',');
5688 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5689 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5690
5691 // Dump the arguments field
5692 pm_buffer_append_byte(buffer, ',');
5693 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5694 if (cast->arguments != NULL) {
5695 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5696 } else {
5697 pm_buffer_append_string(buffer, "null", 4);
5698 }
5699
5700 // Dump the closing_loc field
5701 pm_buffer_append_byte(buffer, ',');
5702 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5703 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5704
5705 // Dump the block field
5706 pm_buffer_append_byte(buffer, ',');
5707 pm_buffer_append_string(buffer, "\"block\":", 8);
5708 if (cast->block != NULL) {
5709 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5710 } else {
5711 pm_buffer_append_string(buffer, "null", 4);
5712 }
5713
5714 // Dump the binary_operator field
5715 pm_buffer_append_byte(buffer, ',');
5716 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
5717 pm_dump_json_constant(buffer, parser, cast->binary_operator);
5718
5719 // Dump the binary_operator_loc field
5720 pm_buffer_append_byte(buffer, ',');
5721 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
5722 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
5723
5724 // Dump the value field
5725 pm_buffer_append_byte(buffer, ',');
5726 pm_buffer_append_string(buffer, "\"value\":", 8);
5727 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5728
5729 pm_buffer_append_byte(buffer, '}');
5730 break;
5731 }
5733 pm_buffer_append_string(buffer, "{\"type\":\"IndexOrWriteNode\",\"location\":", 38);
5734
5735 const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node;
5736 pm_dump_json_location(buffer, parser, &cast->base.location);
5737
5738 // Dump the CallNodeFlags field
5739 pm_buffer_append_byte(buffer, ',');
5740 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5741 size_t flags = 0;
5742 pm_buffer_append_byte(buffer, '[');
5744 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5745 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5746 flags++;
5747 }
5749 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5750 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5751 flags++;
5752 }
5754 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5755 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5756 flags++;
5757 }
5759 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5760 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5761 flags++;
5762 }
5763 pm_buffer_append_byte(buffer, ']');
5764
5765 // Dump the receiver field
5766 pm_buffer_append_byte(buffer, ',');
5767 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5768 if (cast->receiver != NULL) {
5769 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5770 } else {
5771 pm_buffer_append_string(buffer, "null", 4);
5772 }
5773
5774 // Dump the call_operator_loc field
5775 pm_buffer_append_byte(buffer, ',');
5776 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
5777 if (cast->call_operator_loc.start != NULL) {
5778 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
5779 } else {
5780 pm_buffer_append_string(buffer, "null", 4);
5781 }
5782
5783 // Dump the opening_loc field
5784 pm_buffer_append_byte(buffer, ',');
5785 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5786 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5787
5788 // Dump the arguments field
5789 pm_buffer_append_byte(buffer, ',');
5790 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5791 if (cast->arguments != NULL) {
5792 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5793 } else {
5794 pm_buffer_append_string(buffer, "null", 4);
5795 }
5796
5797 // Dump the closing_loc field
5798 pm_buffer_append_byte(buffer, ',');
5799 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5800 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5801
5802 // Dump the block field
5803 pm_buffer_append_byte(buffer, ',');
5804 pm_buffer_append_string(buffer, "\"block\":", 8);
5805 if (cast->block != NULL) {
5806 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5807 } else {
5808 pm_buffer_append_string(buffer, "null", 4);
5809 }
5810
5811 // Dump the operator_loc field
5812 pm_buffer_append_byte(buffer, ',');
5813 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5814 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5815
5816 // Dump the value field
5817 pm_buffer_append_byte(buffer, ',');
5818 pm_buffer_append_string(buffer, "\"value\":", 8);
5819 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5820
5821 pm_buffer_append_byte(buffer, '}');
5822 break;
5823 }
5824 case PM_INDEX_TARGET_NODE: {
5825 pm_buffer_append_string(buffer, "{\"type\":\"IndexTargetNode\",\"location\":", 37);
5826
5827 const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node;
5828 pm_dump_json_location(buffer, parser, &cast->base.location);
5829
5830 // Dump the CallNodeFlags field
5831 pm_buffer_append_byte(buffer, ',');
5832 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5833 size_t flags = 0;
5834 pm_buffer_append_byte(buffer, '[');
5836 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5837 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5838 flags++;
5839 }
5841 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5842 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5843 flags++;
5844 }
5846 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5847 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5848 flags++;
5849 }
5851 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5852 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5853 flags++;
5854 }
5855 pm_buffer_append_byte(buffer, ']');
5856
5857 // Dump the receiver field
5858 pm_buffer_append_byte(buffer, ',');
5859 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5860 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5861
5862 // Dump the opening_loc field
5863 pm_buffer_append_byte(buffer, ',');
5864 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5865 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5866
5867 // Dump the arguments field
5868 pm_buffer_append_byte(buffer, ',');
5869 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5870 if (cast->arguments != NULL) {
5871 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5872 } else {
5873 pm_buffer_append_string(buffer, "null", 4);
5874 }
5875
5876 // Dump the closing_loc field
5877 pm_buffer_append_byte(buffer, ',');
5878 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5879 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5880
5881 // Dump the block field
5882 pm_buffer_append_byte(buffer, ',');
5883 pm_buffer_append_string(buffer, "\"block\":", 8);
5884 if (cast->block != NULL) {
5885 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5886 } else {
5887 pm_buffer_append_string(buffer, "null", 4);
5888 }
5889
5890 pm_buffer_append_byte(buffer, '}');
5891 break;
5892 }
5894 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableAndWriteNode\",\"location\":", 50);
5895
5897 pm_dump_json_location(buffer, parser, &cast->base.location);
5898
5899 // Dump the name field
5900 pm_buffer_append_byte(buffer, ',');
5901 pm_buffer_append_string(buffer, "\"name\":", 7);
5902 pm_dump_json_constant(buffer, parser, cast->name);
5903
5904 // Dump the name_loc field
5905 pm_buffer_append_byte(buffer, ',');
5906 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5907 pm_dump_json_location(buffer, parser, &cast->name_loc);
5908
5909 // Dump the operator_loc field
5910 pm_buffer_append_byte(buffer, ',');
5911 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5912 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5913
5914 // Dump the value field
5915 pm_buffer_append_byte(buffer, ',');
5916 pm_buffer_append_string(buffer, "\"value\":", 8);
5917 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5918
5919 pm_buffer_append_byte(buffer, '}');
5920 break;
5921 }
5923 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOperatorWriteNode\",\"location\":", 55);
5924
5926 pm_dump_json_location(buffer, parser, &cast->base.location);
5927
5928 // Dump the name field
5929 pm_buffer_append_byte(buffer, ',');
5930 pm_buffer_append_string(buffer, "\"name\":", 7);
5931 pm_dump_json_constant(buffer, parser, cast->name);
5932
5933 // Dump the name_loc field
5934 pm_buffer_append_byte(buffer, ',');
5935 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5936 pm_dump_json_location(buffer, parser, &cast->name_loc);
5937
5938 // Dump the binary_operator_loc field
5939 pm_buffer_append_byte(buffer, ',');
5940 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
5941 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
5942
5943 // Dump the value field
5944 pm_buffer_append_byte(buffer, ',');
5945 pm_buffer_append_string(buffer, "\"value\":", 8);
5946 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5947
5948 // Dump the binary_operator field
5949 pm_buffer_append_byte(buffer, ',');
5950 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
5951 pm_dump_json_constant(buffer, parser, cast->binary_operator);
5952
5953 pm_buffer_append_byte(buffer, '}');
5954 break;
5955 }
5957 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOrWriteNode\",\"location\":", 49);
5958
5960 pm_dump_json_location(buffer, parser, &cast->base.location);
5961
5962 // Dump the name field
5963 pm_buffer_append_byte(buffer, ',');
5964 pm_buffer_append_string(buffer, "\"name\":", 7);
5965 pm_dump_json_constant(buffer, parser, cast->name);
5966
5967 // Dump the name_loc field
5968 pm_buffer_append_byte(buffer, ',');
5969 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5970 pm_dump_json_location(buffer, parser, &cast->name_loc);
5971
5972 // Dump the operator_loc field
5973 pm_buffer_append_byte(buffer, ',');
5974 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5975 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5976
5977 // Dump the value field
5978 pm_buffer_append_byte(buffer, ',');
5979 pm_buffer_append_string(buffer, "\"value\":", 8);
5980 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5981
5982 pm_buffer_append_byte(buffer, '}');
5983 break;
5984 }
5986 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableReadNode\",\"location\":", 46);
5987
5989 pm_dump_json_location(buffer, parser, &cast->base.location);
5990
5991 // Dump the name field
5992 pm_buffer_append_byte(buffer, ',');
5993 pm_buffer_append_string(buffer, "\"name\":", 7);
5994 pm_dump_json_constant(buffer, parser, cast->name);
5995
5996 pm_buffer_append_byte(buffer, '}');
5997 break;
5998 }
6000 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableTargetNode\",\"location\":", 48);
6001
6003 pm_dump_json_location(buffer, parser, &cast->base.location);
6004
6005 // Dump the name field
6006 pm_buffer_append_byte(buffer, ',');
6007 pm_buffer_append_string(buffer, "\"name\":", 7);
6008 pm_dump_json_constant(buffer, parser, cast->name);
6009
6010 pm_buffer_append_byte(buffer, '}');
6011 break;
6012 }
6014 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableWriteNode\",\"location\":", 47);
6015
6017 pm_dump_json_location(buffer, parser, &cast->base.location);
6018
6019 // Dump the name field
6020 pm_buffer_append_byte(buffer, ',');
6021 pm_buffer_append_string(buffer, "\"name\":", 7);
6022 pm_dump_json_constant(buffer, parser, cast->name);
6023
6024 // Dump the name_loc field
6025 pm_buffer_append_byte(buffer, ',');
6026 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6027 pm_dump_json_location(buffer, parser, &cast->name_loc);
6028
6029 // Dump the value field
6030 pm_buffer_append_byte(buffer, ',');
6031 pm_buffer_append_string(buffer, "\"value\":", 8);
6032 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6033
6034 // Dump the operator_loc field
6035 pm_buffer_append_byte(buffer, ',');
6036 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6037 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6038
6039 pm_buffer_append_byte(buffer, '}');
6040 break;
6041 }
6042 case PM_INTEGER_NODE: {
6043 pm_buffer_append_string(buffer, "{\"type\":\"IntegerNode\",\"location\":", 33);
6044
6045 const pm_integer_node_t *cast = (const pm_integer_node_t *) node;
6046 pm_dump_json_location(buffer, parser, &cast->base.location);
6047
6048 // Dump the IntegerBaseFlags field
6049 pm_buffer_append_byte(buffer, ',');
6050 pm_buffer_append_string(buffer, "\"IntegerBaseFlags\":", 19);
6051 size_t flags = 0;
6052 pm_buffer_append_byte(buffer, '[');
6054 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6055 pm_buffer_append_string(buffer, "\"BINARY\"", 8);
6056 flags++;
6057 }
6059 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6060 pm_buffer_append_string(buffer, "\"DECIMAL\"", 9);
6061 flags++;
6062 }
6064 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6065 pm_buffer_append_string(buffer, "\"OCTAL\"", 7);
6066 flags++;
6067 }
6069 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6070 pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13);
6071 flags++;
6072 }
6073 pm_buffer_append_byte(buffer, ']');
6074
6075 // Dump the value field
6076 pm_buffer_append_byte(buffer, ',');
6077 pm_buffer_append_string(buffer, "\"value\":", 8);
6078 pm_integer_string(buffer, &cast->value);
6079
6080 pm_buffer_append_byte(buffer, '}');
6081 break;
6082 }
6084 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedMatchLastLineNode\",\"location\":", 51);
6085
6087 pm_dump_json_location(buffer, parser, &cast->base.location);
6088
6089 // Dump the RegularExpressionFlags field
6090 pm_buffer_append_byte(buffer, ',');
6091 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
6092 size_t flags = 0;
6093 pm_buffer_append_byte(buffer, '[');
6095 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6096 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
6097 flags++;
6098 }
6100 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6101 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
6102 flags++;
6103 }
6105 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6106 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
6107 flags++;
6108 }
6110 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6111 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
6112 flags++;
6113 }
6115 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6116 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
6117 flags++;
6118 }
6120 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6121 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
6122 flags++;
6123 }
6125 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6126 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
6127 flags++;
6128 }
6130 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6131 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
6132 flags++;
6133 }
6135 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6136 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
6137 flags++;
6138 }
6140 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6141 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
6142 flags++;
6143 }
6145 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6146 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
6147 flags++;
6148 }
6149 pm_buffer_append_byte(buffer, ']');
6150
6151 // Dump the opening_loc field
6152 pm_buffer_append_byte(buffer, ',');
6153 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6154 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6155
6156 // Dump the parts field
6157 pm_buffer_append_byte(buffer, ',');
6158 pm_buffer_append_string(buffer, "\"parts\":", 8);
6159 const pm_node_list_t *parts = &cast->parts;
6160 pm_buffer_append_byte(buffer, '[');
6161
6162 for (size_t index = 0; index < parts->size; index++) {
6163 if (index != 0) pm_buffer_append_byte(buffer, ',');
6164 pm_dump_json(buffer, parser, parts->nodes[index]);
6165 }
6166 pm_buffer_append_byte(buffer, ']');
6167
6168 // Dump the closing_loc field
6169 pm_buffer_append_byte(buffer, ',');
6170 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6171 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6172
6173 pm_buffer_append_byte(buffer, '}');
6174 break;
6175 }
6177 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedRegularExpressionNode\",\"location\":", 55);
6178
6180 pm_dump_json_location(buffer, parser, &cast->base.location);
6181
6182 // Dump the RegularExpressionFlags field
6183 pm_buffer_append_byte(buffer, ',');
6184 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
6185 size_t flags = 0;
6186 pm_buffer_append_byte(buffer, '[');
6188 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6189 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
6190 flags++;
6191 }
6193 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6194 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
6195 flags++;
6196 }
6198 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6199 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
6200 flags++;
6201 }
6203 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6204 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
6205 flags++;
6206 }
6208 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6209 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
6210 flags++;
6211 }
6213 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6214 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
6215 flags++;
6216 }
6218 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6219 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
6220 flags++;
6221 }
6223 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6224 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
6225 flags++;
6226 }
6228 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6229 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
6230 flags++;
6231 }
6233 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6234 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
6235 flags++;
6236 }
6238 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6239 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
6240 flags++;
6241 }
6242 pm_buffer_append_byte(buffer, ']');
6243
6244 // Dump the opening_loc field
6245 pm_buffer_append_byte(buffer, ',');
6246 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6247 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6248
6249 // Dump the parts field
6250 pm_buffer_append_byte(buffer, ',');
6251 pm_buffer_append_string(buffer, "\"parts\":", 8);
6252 const pm_node_list_t *parts = &cast->parts;
6253 pm_buffer_append_byte(buffer, '[');
6254
6255 for (size_t index = 0; index < parts->size; index++) {
6256 if (index != 0) pm_buffer_append_byte(buffer, ',');
6257 pm_dump_json(buffer, parser, parts->nodes[index]);
6258 }
6259 pm_buffer_append_byte(buffer, ']');
6260
6261 // Dump the closing_loc field
6262 pm_buffer_append_byte(buffer, ',');
6263 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6264 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6265
6266 pm_buffer_append_byte(buffer, '}');
6267 break;
6268 }
6270 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedStringNode\",\"location\":", 44);
6271
6273 pm_dump_json_location(buffer, parser, &cast->base.location);
6274
6275 // Dump the InterpolatedStringNodeFlags field
6276 pm_buffer_append_byte(buffer, ',');
6277 pm_buffer_append_string(buffer, "\"InterpolatedStringNodeFlags\":", 30);
6278 size_t flags = 0;
6279 pm_buffer_append_byte(buffer, '[');
6281 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6282 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
6283 flags++;
6284 }
6286 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6287 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
6288 flags++;
6289 }
6290 pm_buffer_append_byte(buffer, ']');
6291
6292 // Dump the opening_loc field
6293 pm_buffer_append_byte(buffer, ',');
6294 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6295 if (cast->opening_loc.start != NULL) {
6296 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6297 } else {
6298 pm_buffer_append_string(buffer, "null", 4);
6299 }
6300
6301 // Dump the parts field
6302 pm_buffer_append_byte(buffer, ',');
6303 pm_buffer_append_string(buffer, "\"parts\":", 8);
6304 const pm_node_list_t *parts = &cast->parts;
6305 pm_buffer_append_byte(buffer, '[');
6306
6307 for (size_t index = 0; index < parts->size; index++) {
6308 if (index != 0) pm_buffer_append_byte(buffer, ',');
6309 pm_dump_json(buffer, parser, parts->nodes[index]);
6310 }
6311 pm_buffer_append_byte(buffer, ']');
6312
6313 // Dump the closing_loc field
6314 pm_buffer_append_byte(buffer, ',');
6315 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6316 if (cast->closing_loc.start != NULL) {
6317 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6318 } else {
6319 pm_buffer_append_string(buffer, "null", 4);
6320 }
6321
6322 pm_buffer_append_byte(buffer, '}');
6323 break;
6324 }
6326 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedSymbolNode\",\"location\":", 44);
6327
6329 pm_dump_json_location(buffer, parser, &cast->base.location);
6330
6331 // Dump the opening_loc field
6332 pm_buffer_append_byte(buffer, ',');
6333 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6334 if (cast->opening_loc.start != NULL) {
6335 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6336 } else {
6337 pm_buffer_append_string(buffer, "null", 4);
6338 }
6339
6340 // Dump the parts field
6341 pm_buffer_append_byte(buffer, ',');
6342 pm_buffer_append_string(buffer, "\"parts\":", 8);
6343 const pm_node_list_t *parts = &cast->parts;
6344 pm_buffer_append_byte(buffer, '[');
6345
6346 for (size_t index = 0; index < parts->size; index++) {
6347 if (index != 0) pm_buffer_append_byte(buffer, ',');
6348 pm_dump_json(buffer, parser, parts->nodes[index]);
6349 }
6350 pm_buffer_append_byte(buffer, ']');
6351
6352 // Dump the closing_loc field
6353 pm_buffer_append_byte(buffer, ',');
6354 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6355 if (cast->closing_loc.start != NULL) {
6356 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6357 } else {
6358 pm_buffer_append_string(buffer, "null", 4);
6359 }
6360
6361 pm_buffer_append_byte(buffer, '}');
6362 break;
6363 }
6365 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedXStringNode\",\"location\":", 45);
6366
6368 pm_dump_json_location(buffer, parser, &cast->base.location);
6369
6370 // Dump the opening_loc field
6371 pm_buffer_append_byte(buffer, ',');
6372 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6373 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6374
6375 // Dump the parts field
6376 pm_buffer_append_byte(buffer, ',');
6377 pm_buffer_append_string(buffer, "\"parts\":", 8);
6378 const pm_node_list_t *parts = &cast->parts;
6379 pm_buffer_append_byte(buffer, '[');
6380
6381 for (size_t index = 0; index < parts->size; index++) {
6382 if (index != 0) pm_buffer_append_byte(buffer, ',');
6383 pm_dump_json(buffer, parser, parts->nodes[index]);
6384 }
6385 pm_buffer_append_byte(buffer, ']');
6386
6387 // Dump the closing_loc field
6388 pm_buffer_append_byte(buffer, ',');
6389 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6390 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6391
6392 pm_buffer_append_byte(buffer, '}');
6393 break;
6394 }
6396 pm_buffer_append_string(buffer, "{\"type\":\"ItLocalVariableReadNode\",\"location\":", 45);
6397
6399 pm_dump_json_location(buffer, parser, &cast->base.location);
6400
6401 pm_buffer_append_byte(buffer, '}');
6402 break;
6403 }
6404 case PM_IT_PARAMETERS_NODE: {
6405 pm_buffer_append_string(buffer, "{\"type\":\"ItParametersNode\",\"location\":", 38);
6406
6407 const pm_it_parameters_node_t *cast = (const pm_it_parameters_node_t *) node;
6408 pm_dump_json_location(buffer, parser, &cast->base.location);
6409
6410 pm_buffer_append_byte(buffer, '}');
6411 break;
6412 }
6413 case PM_KEYWORD_HASH_NODE: {
6414 pm_buffer_append_string(buffer, "{\"type\":\"KeywordHashNode\",\"location\":", 37);
6415
6416 const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node;
6417 pm_dump_json_location(buffer, parser, &cast->base.location);
6418
6419 // Dump the KeywordHashNodeFlags field
6420 pm_buffer_append_byte(buffer, ',');
6421 pm_buffer_append_string(buffer, "\"KeywordHashNodeFlags\":", 23);
6422 size_t flags = 0;
6423 pm_buffer_append_byte(buffer, '[');
6425 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6426 pm_buffer_append_string(buffer, "\"SYMBOL_KEYS\"", 13);
6427 flags++;
6428 }
6429 pm_buffer_append_byte(buffer, ']');
6430
6431 // Dump the elements field
6432 pm_buffer_append_byte(buffer, ',');
6433 pm_buffer_append_string(buffer, "\"elements\":", 11);
6434 const pm_node_list_t *elements = &cast->elements;
6435 pm_buffer_append_byte(buffer, '[');
6436
6437 for (size_t index = 0; index < elements->size; index++) {
6438 if (index != 0) pm_buffer_append_byte(buffer, ',');
6439 pm_dump_json(buffer, parser, elements->nodes[index]);
6440 }
6441 pm_buffer_append_byte(buffer, ']');
6442
6443 pm_buffer_append_byte(buffer, '}');
6444 break;
6445 }
6447 pm_buffer_append_string(buffer, "{\"type\":\"KeywordRestParameterNode\",\"location\":", 46);
6448
6450 pm_dump_json_location(buffer, parser, &cast->base.location);
6451
6452 // Dump the ParameterFlags field
6453 pm_buffer_append_byte(buffer, ',');
6454 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
6455 size_t flags = 0;
6456 pm_buffer_append_byte(buffer, '[');
6458 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6459 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
6460 flags++;
6461 }
6462 pm_buffer_append_byte(buffer, ']');
6463
6464 // Dump the name field
6465 pm_buffer_append_byte(buffer, ',');
6466 pm_buffer_append_string(buffer, "\"name\":", 7);
6467 if (cast->name != PM_CONSTANT_ID_UNSET) {
6468 pm_dump_json_constant(buffer, parser, cast->name);
6469 } else {
6470 pm_buffer_append_string(buffer, "null", 4);
6471 }
6472
6473 // Dump the name_loc field
6474 pm_buffer_append_byte(buffer, ',');
6475 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6476 if (cast->name_loc.start != NULL) {
6477 pm_dump_json_location(buffer, parser, &cast->name_loc);
6478 } else {
6479 pm_buffer_append_string(buffer, "null", 4);
6480 }
6481
6482 // Dump the operator_loc field
6483 pm_buffer_append_byte(buffer, ',');
6484 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6485 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6486
6487 pm_buffer_append_byte(buffer, '}');
6488 break;
6489 }
6490 case PM_LAMBDA_NODE: {
6491 pm_buffer_append_string(buffer, "{\"type\":\"LambdaNode\",\"location\":", 32);
6492
6493 const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node;
6494 pm_dump_json_location(buffer, parser, &cast->base.location);
6495
6496 // Dump the locals field
6497 pm_buffer_append_byte(buffer, ',');
6498 pm_buffer_append_string(buffer, "\"locals\":", 9);
6499 const pm_constant_id_list_t *locals = &cast->locals;
6500 pm_buffer_append_byte(buffer, '[');
6501
6502 for (size_t index = 0; index < locals->size; index++) {
6503 if (index != 0) pm_buffer_append_byte(buffer, ',');
6504 pm_dump_json_constant(buffer, parser, locals->ids[index]);
6505 }
6506 pm_buffer_append_byte(buffer, ']');
6507
6508 // Dump the operator_loc field
6509 pm_buffer_append_byte(buffer, ',');
6510 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6511 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6512
6513 // Dump the opening_loc field
6514 pm_buffer_append_byte(buffer, ',');
6515 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6516 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6517
6518 // Dump the closing_loc field
6519 pm_buffer_append_byte(buffer, ',');
6520 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6521 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6522
6523 // Dump the parameters field
6524 pm_buffer_append_byte(buffer, ',');
6525 pm_buffer_append_string(buffer, "\"parameters\":", 13);
6526 if (cast->parameters != NULL) {
6527 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
6528 } else {
6529 pm_buffer_append_string(buffer, "null", 4);
6530 }
6531
6532 // Dump the body field
6533 pm_buffer_append_byte(buffer, ',');
6534 pm_buffer_append_string(buffer, "\"body\":", 7);
6535 if (cast->body != NULL) {
6536 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
6537 } else {
6538 pm_buffer_append_string(buffer, "null", 4);
6539 }
6540
6541 pm_buffer_append_byte(buffer, '}');
6542 break;
6543 }
6545 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableAndWriteNode\",\"location\":", 47);
6546
6548 pm_dump_json_location(buffer, parser, &cast->base.location);
6549
6550 // Dump the name_loc field
6551 pm_buffer_append_byte(buffer, ',');
6552 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6553 pm_dump_json_location(buffer, parser, &cast->name_loc);
6554
6555 // Dump the operator_loc field
6556 pm_buffer_append_byte(buffer, ',');
6557 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6558 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6559
6560 // Dump the value field
6561 pm_buffer_append_byte(buffer, ',');
6562 pm_buffer_append_string(buffer, "\"value\":", 8);
6563 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6564
6565 // Dump the name field
6566 pm_buffer_append_byte(buffer, ',');
6567 pm_buffer_append_string(buffer, "\"name\":", 7);
6568 pm_dump_json_constant(buffer, parser, cast->name);
6569
6570 // Dump the depth field
6571 pm_buffer_append_byte(buffer, ',');
6572 pm_buffer_append_string(buffer, "\"depth\":", 8);
6573 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6574
6575 pm_buffer_append_byte(buffer, '}');
6576 break;
6577 }
6579 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOperatorWriteNode\",\"location\":", 52);
6580
6582 pm_dump_json_location(buffer, parser, &cast->base.location);
6583
6584 // Dump the name_loc field
6585 pm_buffer_append_byte(buffer, ',');
6586 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6587 pm_dump_json_location(buffer, parser, &cast->name_loc);
6588
6589 // Dump the binary_operator_loc field
6590 pm_buffer_append_byte(buffer, ',');
6591 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
6592 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
6593
6594 // Dump the value field
6595 pm_buffer_append_byte(buffer, ',');
6596 pm_buffer_append_string(buffer, "\"value\":", 8);
6597 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6598
6599 // Dump the name field
6600 pm_buffer_append_byte(buffer, ',');
6601 pm_buffer_append_string(buffer, "\"name\":", 7);
6602 pm_dump_json_constant(buffer, parser, cast->name);
6603
6604 // Dump the binary_operator field
6605 pm_buffer_append_byte(buffer, ',');
6606 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
6607 pm_dump_json_constant(buffer, parser, cast->binary_operator);
6608
6609 // Dump the depth field
6610 pm_buffer_append_byte(buffer, ',');
6611 pm_buffer_append_string(buffer, "\"depth\":", 8);
6612 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6613
6614 pm_buffer_append_byte(buffer, '}');
6615 break;
6616 }
6618 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOrWriteNode\",\"location\":", 46);
6619
6621 pm_dump_json_location(buffer, parser, &cast->base.location);
6622
6623 // Dump the name_loc field
6624 pm_buffer_append_byte(buffer, ',');
6625 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6626 pm_dump_json_location(buffer, parser, &cast->name_loc);
6627
6628 // Dump the operator_loc field
6629 pm_buffer_append_byte(buffer, ',');
6630 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6631 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6632
6633 // Dump the value field
6634 pm_buffer_append_byte(buffer, ',');
6635 pm_buffer_append_string(buffer, "\"value\":", 8);
6636 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6637
6638 // Dump the name field
6639 pm_buffer_append_byte(buffer, ',');
6640 pm_buffer_append_string(buffer, "\"name\":", 7);
6641 pm_dump_json_constant(buffer, parser, cast->name);
6642
6643 // Dump the depth field
6644 pm_buffer_append_byte(buffer, ',');
6645 pm_buffer_append_string(buffer, "\"depth\":", 8);
6646 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6647
6648 pm_buffer_append_byte(buffer, '}');
6649 break;
6650 }
6652 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableReadNode\",\"location\":", 43);
6653
6655 pm_dump_json_location(buffer, parser, &cast->base.location);
6656
6657 // Dump the name field
6658 pm_buffer_append_byte(buffer, ',');
6659 pm_buffer_append_string(buffer, "\"name\":", 7);
6660 pm_dump_json_constant(buffer, parser, cast->name);
6661
6662 // Dump the depth field
6663 pm_buffer_append_byte(buffer, ',');
6664 pm_buffer_append_string(buffer, "\"depth\":", 8);
6665 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6666
6667 pm_buffer_append_byte(buffer, '}');
6668 break;
6669 }
6671 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableTargetNode\",\"location\":", 45);
6672
6674 pm_dump_json_location(buffer, parser, &cast->base.location);
6675
6676 // Dump the name field
6677 pm_buffer_append_byte(buffer, ',');
6678 pm_buffer_append_string(buffer, "\"name\":", 7);
6679 pm_dump_json_constant(buffer, parser, cast->name);
6680
6681 // Dump the depth field
6682 pm_buffer_append_byte(buffer, ',');
6683 pm_buffer_append_string(buffer, "\"depth\":", 8);
6684 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6685
6686 pm_buffer_append_byte(buffer, '}');
6687 break;
6688 }
6690 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableWriteNode\",\"location\":", 44);
6691
6693 pm_dump_json_location(buffer, parser, &cast->base.location);
6694
6695 // Dump the name field
6696 pm_buffer_append_byte(buffer, ',');
6697 pm_buffer_append_string(buffer, "\"name\":", 7);
6698 pm_dump_json_constant(buffer, parser, cast->name);
6699
6700 // Dump the depth field
6701 pm_buffer_append_byte(buffer, ',');
6702 pm_buffer_append_string(buffer, "\"depth\":", 8);
6703 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6704
6705 // Dump the name_loc field
6706 pm_buffer_append_byte(buffer, ',');
6707 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6708 pm_dump_json_location(buffer, parser, &cast->name_loc);
6709
6710 // Dump the value field
6711 pm_buffer_append_byte(buffer, ',');
6712 pm_buffer_append_string(buffer, "\"value\":", 8);
6713 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6714
6715 // Dump the operator_loc field
6716 pm_buffer_append_byte(buffer, ',');
6717 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6718 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6719
6720 pm_buffer_append_byte(buffer, '}');
6721 break;
6722 }
6724 pm_buffer_append_string(buffer, "{\"type\":\"MatchLastLineNode\",\"location\":", 39);
6725
6726 const pm_match_last_line_node_t *cast = (const pm_match_last_line_node_t *) node;
6727 pm_dump_json_location(buffer, parser, &cast->base.location);
6728
6729 // Dump the RegularExpressionFlags field
6730 pm_buffer_append_byte(buffer, ',');
6731 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
6732 size_t flags = 0;
6733 pm_buffer_append_byte(buffer, '[');
6735 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6736 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
6737 flags++;
6738 }
6740 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6741 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
6742 flags++;
6743 }
6745 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6746 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
6747 flags++;
6748 }
6750 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6751 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
6752 flags++;
6753 }
6755 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6756 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
6757 flags++;
6758 }
6760 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6761 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
6762 flags++;
6763 }
6765 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6766 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
6767 flags++;
6768 }
6770 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6771 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
6772 flags++;
6773 }
6775 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6776 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
6777 flags++;
6778 }
6780 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6781 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
6782 flags++;
6783 }
6785 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6786 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
6787 flags++;
6788 }
6789 pm_buffer_append_byte(buffer, ']');
6790
6791 // Dump the opening_loc field
6792 pm_buffer_append_byte(buffer, ',');
6793 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6794 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6795
6796 // Dump the content_loc field
6797 pm_buffer_append_byte(buffer, ',');
6798 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
6799 pm_dump_json_location(buffer, parser, &cast->content_loc);
6800
6801 // Dump the closing_loc field
6802 pm_buffer_append_byte(buffer, ',');
6803 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6804 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6805
6806 // Dump the unescaped field
6807 pm_buffer_append_byte(buffer, ',');
6808 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
6809 const pm_string_t *unescaped = &cast->unescaped;
6810 pm_buffer_append_byte(buffer, '"');
6811 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
6812 pm_buffer_append_byte(buffer, '"');
6813
6814 pm_buffer_append_byte(buffer, '}');
6815 break;
6816 }
6818 pm_buffer_append_string(buffer, "{\"type\":\"MatchPredicateNode\",\"location\":", 40);
6819
6820 const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node;
6821 pm_dump_json_location(buffer, parser, &cast->base.location);
6822
6823 // Dump the value field
6824 pm_buffer_append_byte(buffer, ',');
6825 pm_buffer_append_string(buffer, "\"value\":", 8);
6826 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6827
6828 // Dump the pattern field
6829 pm_buffer_append_byte(buffer, ',');
6830 pm_buffer_append_string(buffer, "\"pattern\":", 10);
6831 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
6832
6833 // Dump the operator_loc field
6834 pm_buffer_append_byte(buffer, ',');
6835 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6836 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6837
6838 pm_buffer_append_byte(buffer, '}');
6839 break;
6840 }
6842 pm_buffer_append_string(buffer, "{\"type\":\"MatchRequiredNode\",\"location\":", 39);
6843
6844 const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node;
6845 pm_dump_json_location(buffer, parser, &cast->base.location);
6846
6847 // Dump the value field
6848 pm_buffer_append_byte(buffer, ',');
6849 pm_buffer_append_string(buffer, "\"value\":", 8);
6850 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6851
6852 // Dump the pattern field
6853 pm_buffer_append_byte(buffer, ',');
6854 pm_buffer_append_string(buffer, "\"pattern\":", 10);
6855 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
6856
6857 // Dump the operator_loc field
6858 pm_buffer_append_byte(buffer, ',');
6859 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6860 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6861
6862 pm_buffer_append_byte(buffer, '}');
6863 break;
6864 }
6865 case PM_MATCH_WRITE_NODE: {
6866 pm_buffer_append_string(buffer, "{\"type\":\"MatchWriteNode\",\"location\":", 36);
6867
6868 const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node;
6869 pm_dump_json_location(buffer, parser, &cast->base.location);
6870
6871 // Dump the call field
6872 pm_buffer_append_byte(buffer, ',');
6873 pm_buffer_append_string(buffer, "\"call\":", 7);
6874 pm_dump_json(buffer, parser, (const pm_node_t *) cast->call);
6875
6876 // Dump the targets field
6877 pm_buffer_append_byte(buffer, ',');
6878 pm_buffer_append_string(buffer, "\"targets\":", 10);
6879 const pm_node_list_t *targets = &cast->targets;
6880 pm_buffer_append_byte(buffer, '[');
6881
6882 for (size_t index = 0; index < targets->size; index++) {
6883 if (index != 0) pm_buffer_append_byte(buffer, ',');
6884 pm_dump_json(buffer, parser, targets->nodes[index]);
6885 }
6886 pm_buffer_append_byte(buffer, ']');
6887
6888 pm_buffer_append_byte(buffer, '}');
6889 break;
6890 }
6891 case PM_MISSING_NODE: {
6892 pm_buffer_append_string(buffer, "{\"type\":\"MissingNode\",\"location\":", 33);
6893
6894 const pm_missing_node_t *cast = (const pm_missing_node_t *) node;
6895 pm_dump_json_location(buffer, parser, &cast->base.location);
6896
6897 pm_buffer_append_byte(buffer, '}');
6898 break;
6899 }
6900 case PM_MODULE_NODE: {
6901 pm_buffer_append_string(buffer, "{\"type\":\"ModuleNode\",\"location\":", 32);
6902
6903 const pm_module_node_t *cast = (const pm_module_node_t *) node;
6904 pm_dump_json_location(buffer, parser, &cast->base.location);
6905
6906 // Dump the locals field
6907 pm_buffer_append_byte(buffer, ',');
6908 pm_buffer_append_string(buffer, "\"locals\":", 9);
6909 const pm_constant_id_list_t *locals = &cast->locals;
6910 pm_buffer_append_byte(buffer, '[');
6911
6912 for (size_t index = 0; index < locals->size; index++) {
6913 if (index != 0) pm_buffer_append_byte(buffer, ',');
6914 pm_dump_json_constant(buffer, parser, locals->ids[index]);
6915 }
6916 pm_buffer_append_byte(buffer, ']');
6917
6918 // Dump the module_keyword_loc field
6919 pm_buffer_append_byte(buffer, ',');
6920 pm_buffer_append_string(buffer, "\"module_keyword_loc\":", 21);
6921 pm_dump_json_location(buffer, parser, &cast->module_keyword_loc);
6922
6923 // Dump the constant_path field
6924 pm_buffer_append_byte(buffer, ',');
6925 pm_buffer_append_string(buffer, "\"constant_path\":", 16);
6926 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path);
6927
6928 // Dump the body field
6929 pm_buffer_append_byte(buffer, ',');
6930 pm_buffer_append_string(buffer, "\"body\":", 7);
6931 if (cast->body != NULL) {
6932 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
6933 } else {
6934 pm_buffer_append_string(buffer, "null", 4);
6935 }
6936
6937 // Dump the end_keyword_loc field
6938 pm_buffer_append_byte(buffer, ',');
6939 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
6940 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
6941
6942 // Dump the name field
6943 pm_buffer_append_byte(buffer, ',');
6944 pm_buffer_append_string(buffer, "\"name\":", 7);
6945 pm_dump_json_constant(buffer, parser, cast->name);
6946
6947 pm_buffer_append_byte(buffer, '}');
6948 break;
6949 }
6950 case PM_MULTI_TARGET_NODE: {
6951 pm_buffer_append_string(buffer, "{\"type\":\"MultiTargetNode\",\"location\":", 37);
6952
6953 const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node;
6954 pm_dump_json_location(buffer, parser, &cast->base.location);
6955
6956 // Dump the lefts field
6957 pm_buffer_append_byte(buffer, ',');
6958 pm_buffer_append_string(buffer, "\"lefts\":", 8);
6959 const pm_node_list_t *lefts = &cast->lefts;
6960 pm_buffer_append_byte(buffer, '[');
6961
6962 for (size_t index = 0; index < lefts->size; index++) {
6963 if (index != 0) pm_buffer_append_byte(buffer, ',');
6964 pm_dump_json(buffer, parser, lefts->nodes[index]);
6965 }
6966 pm_buffer_append_byte(buffer, ']');
6967
6968 // Dump the rest field
6969 pm_buffer_append_byte(buffer, ',');
6970 pm_buffer_append_string(buffer, "\"rest\":", 7);
6971 if (cast->rest != NULL) {
6972 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
6973 } else {
6974 pm_buffer_append_string(buffer, "null", 4);
6975 }
6976
6977 // Dump the rights field
6978 pm_buffer_append_byte(buffer, ',');
6979 pm_buffer_append_string(buffer, "\"rights\":", 9);
6980 const pm_node_list_t *rights = &cast->rights;
6981 pm_buffer_append_byte(buffer, '[');
6982
6983 for (size_t index = 0; index < rights->size; index++) {
6984 if (index != 0) pm_buffer_append_byte(buffer, ',');
6985 pm_dump_json(buffer, parser, rights->nodes[index]);
6986 }
6987 pm_buffer_append_byte(buffer, ']');
6988
6989 // Dump the lparen_loc field
6990 pm_buffer_append_byte(buffer, ',');
6991 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
6992 if (cast->lparen_loc.start != NULL) {
6993 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
6994 } else {
6995 pm_buffer_append_string(buffer, "null", 4);
6996 }
6997
6998 // Dump the rparen_loc field
6999 pm_buffer_append_byte(buffer, ',');
7000 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
7001 if (cast->rparen_loc.start != NULL) {
7002 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
7003 } else {
7004 pm_buffer_append_string(buffer, "null", 4);
7005 }
7006
7007 pm_buffer_append_byte(buffer, '}');
7008 break;
7009 }
7010 case PM_MULTI_WRITE_NODE: {
7011 pm_buffer_append_string(buffer, "{\"type\":\"MultiWriteNode\",\"location\":", 36);
7012
7013 const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node;
7014 pm_dump_json_location(buffer, parser, &cast->base.location);
7015
7016 // Dump the lefts field
7017 pm_buffer_append_byte(buffer, ',');
7018 pm_buffer_append_string(buffer, "\"lefts\":", 8);
7019 const pm_node_list_t *lefts = &cast->lefts;
7020 pm_buffer_append_byte(buffer, '[');
7021
7022 for (size_t index = 0; index < lefts->size; index++) {
7023 if (index != 0) pm_buffer_append_byte(buffer, ',');
7024 pm_dump_json(buffer, parser, lefts->nodes[index]);
7025 }
7026 pm_buffer_append_byte(buffer, ']');
7027
7028 // Dump the rest field
7029 pm_buffer_append_byte(buffer, ',');
7030 pm_buffer_append_string(buffer, "\"rest\":", 7);
7031 if (cast->rest != NULL) {
7032 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
7033 } else {
7034 pm_buffer_append_string(buffer, "null", 4);
7035 }
7036
7037 // Dump the rights field
7038 pm_buffer_append_byte(buffer, ',');
7039 pm_buffer_append_string(buffer, "\"rights\":", 9);
7040 const pm_node_list_t *rights = &cast->rights;
7041 pm_buffer_append_byte(buffer, '[');
7042
7043 for (size_t index = 0; index < rights->size; index++) {
7044 if (index != 0) pm_buffer_append_byte(buffer, ',');
7045 pm_dump_json(buffer, parser, rights->nodes[index]);
7046 }
7047 pm_buffer_append_byte(buffer, ']');
7048
7049 // Dump the lparen_loc field
7050 pm_buffer_append_byte(buffer, ',');
7051 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
7052 if (cast->lparen_loc.start != NULL) {
7053 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
7054 } else {
7055 pm_buffer_append_string(buffer, "null", 4);
7056 }
7057
7058 // Dump the rparen_loc field
7059 pm_buffer_append_byte(buffer, ',');
7060 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
7061 if (cast->rparen_loc.start != NULL) {
7062 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
7063 } else {
7064 pm_buffer_append_string(buffer, "null", 4);
7065 }
7066
7067 // Dump the operator_loc field
7068 pm_buffer_append_byte(buffer, ',');
7069 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7070 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7071
7072 // Dump the value field
7073 pm_buffer_append_byte(buffer, ',');
7074 pm_buffer_append_string(buffer, "\"value\":", 8);
7075 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
7076
7077 pm_buffer_append_byte(buffer, '}');
7078 break;
7079 }
7080 case PM_NEXT_NODE: {
7081 pm_buffer_append_string(buffer, "{\"type\":\"NextNode\",\"location\":", 30);
7082
7083 const pm_next_node_t *cast = (const pm_next_node_t *) node;
7084 pm_dump_json_location(buffer, parser, &cast->base.location);
7085
7086 // Dump the arguments field
7087 pm_buffer_append_byte(buffer, ',');
7088 pm_buffer_append_string(buffer, "\"arguments\":", 12);
7089 if (cast->arguments != NULL) {
7090 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
7091 } else {
7092 pm_buffer_append_string(buffer, "null", 4);
7093 }
7094
7095 // Dump the keyword_loc field
7096 pm_buffer_append_byte(buffer, ',');
7097 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7098 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7099
7100 pm_buffer_append_byte(buffer, '}');
7101 break;
7102 }
7103 case PM_NIL_NODE: {
7104 pm_buffer_append_string(buffer, "{\"type\":\"NilNode\",\"location\":", 29);
7105
7106 const pm_nil_node_t *cast = (const pm_nil_node_t *) node;
7107 pm_dump_json_location(buffer, parser, &cast->base.location);
7108
7109 pm_buffer_append_byte(buffer, '}');
7110 break;
7111 }
7113 pm_buffer_append_string(buffer, "{\"type\":\"NoKeywordsParameterNode\",\"location\":", 45);
7114
7116 pm_dump_json_location(buffer, parser, &cast->base.location);
7117
7118 // Dump the operator_loc field
7119 pm_buffer_append_byte(buffer, ',');
7120 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7121 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7122
7123 // Dump the keyword_loc field
7124 pm_buffer_append_byte(buffer, ',');
7125 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7126 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7127
7128 pm_buffer_append_byte(buffer, '}');
7129 break;
7130 }
7132 pm_buffer_append_string(buffer, "{\"type\":\"NumberedParametersNode\",\"location\":", 44);
7133
7135 pm_dump_json_location(buffer, parser, &cast->base.location);
7136
7137 // Dump the maximum field
7138 pm_buffer_append_byte(buffer, ',');
7139 pm_buffer_append_string(buffer, "\"maximum\":", 10);
7140 pm_buffer_append_format(buffer, "%" PRIu8, cast->maximum);
7141
7142 pm_buffer_append_byte(buffer, '}');
7143 break;
7144 }
7146 pm_buffer_append_string(buffer, "{\"type\":\"NumberedReferenceReadNode\",\"location\":", 47);
7147
7149 pm_dump_json_location(buffer, parser, &cast->base.location);
7150
7151 // Dump the number field
7152 pm_buffer_append_byte(buffer, ',');
7153 pm_buffer_append_string(buffer, "\"number\":", 9);
7154 pm_buffer_append_format(buffer, "%" PRIu32, cast->number);
7155
7156 pm_buffer_append_byte(buffer, '}');
7157 break;
7158 }
7160 pm_buffer_append_string(buffer, "{\"type\":\"OptionalKeywordParameterNode\",\"location\":", 50);
7161
7163 pm_dump_json_location(buffer, parser, &cast->base.location);
7164
7165 // Dump the ParameterFlags field
7166 pm_buffer_append_byte(buffer, ',');
7167 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7168 size_t flags = 0;
7169 pm_buffer_append_byte(buffer, '[');
7171 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7172 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7173 flags++;
7174 }
7175 pm_buffer_append_byte(buffer, ']');
7176
7177 // Dump the name field
7178 pm_buffer_append_byte(buffer, ',');
7179 pm_buffer_append_string(buffer, "\"name\":", 7);
7180 pm_dump_json_constant(buffer, parser, cast->name);
7181
7182 // Dump the name_loc field
7183 pm_buffer_append_byte(buffer, ',');
7184 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7185 pm_dump_json_location(buffer, parser, &cast->name_loc);
7186
7187 // Dump the value field
7188 pm_buffer_append_byte(buffer, ',');
7189 pm_buffer_append_string(buffer, "\"value\":", 8);
7190 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
7191
7192 pm_buffer_append_byte(buffer, '}');
7193 break;
7194 }
7196 pm_buffer_append_string(buffer, "{\"type\":\"OptionalParameterNode\",\"location\":", 43);
7197
7199 pm_dump_json_location(buffer, parser, &cast->base.location);
7200
7201 // Dump the ParameterFlags field
7202 pm_buffer_append_byte(buffer, ',');
7203 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7204 size_t flags = 0;
7205 pm_buffer_append_byte(buffer, '[');
7207 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7208 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7209 flags++;
7210 }
7211 pm_buffer_append_byte(buffer, ']');
7212
7213 // Dump the name field
7214 pm_buffer_append_byte(buffer, ',');
7215 pm_buffer_append_string(buffer, "\"name\":", 7);
7216 pm_dump_json_constant(buffer, parser, cast->name);
7217
7218 // Dump the name_loc field
7219 pm_buffer_append_byte(buffer, ',');
7220 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7221 pm_dump_json_location(buffer, parser, &cast->name_loc);
7222
7223 // Dump the operator_loc field
7224 pm_buffer_append_byte(buffer, ',');
7225 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7226 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7227
7228 // Dump the value field
7229 pm_buffer_append_byte(buffer, ',');
7230 pm_buffer_append_string(buffer, "\"value\":", 8);
7231 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
7232
7233 pm_buffer_append_byte(buffer, '}');
7234 break;
7235 }
7236 case PM_OR_NODE: {
7237 pm_buffer_append_string(buffer, "{\"type\":\"OrNode\",\"location\":", 28);
7238
7239 const pm_or_node_t *cast = (const pm_or_node_t *) node;
7240 pm_dump_json_location(buffer, parser, &cast->base.location);
7241
7242 // Dump the left field
7243 pm_buffer_append_byte(buffer, ',');
7244 pm_buffer_append_string(buffer, "\"left\":", 7);
7245 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
7246
7247 // Dump the right field
7248 pm_buffer_append_byte(buffer, ',');
7249 pm_buffer_append_string(buffer, "\"right\":", 8);
7250 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
7251
7252 // Dump the operator_loc field
7253 pm_buffer_append_byte(buffer, ',');
7254 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7255 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7256
7257 pm_buffer_append_byte(buffer, '}');
7258 break;
7259 }
7260 case PM_PARAMETERS_NODE: {
7261 pm_buffer_append_string(buffer, "{\"type\":\"ParametersNode\",\"location\":", 36);
7262
7263 const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node;
7264 pm_dump_json_location(buffer, parser, &cast->base.location);
7265
7266 // Dump the requireds field
7267 pm_buffer_append_byte(buffer, ',');
7268 pm_buffer_append_string(buffer, "\"requireds\":", 12);
7269 const pm_node_list_t *requireds = &cast->requireds;
7270 pm_buffer_append_byte(buffer, '[');
7271
7272 for (size_t index = 0; index < requireds->size; index++) {
7273 if (index != 0) pm_buffer_append_byte(buffer, ',');
7274 pm_dump_json(buffer, parser, requireds->nodes[index]);
7275 }
7276 pm_buffer_append_byte(buffer, ']');
7277
7278 // Dump the optionals field
7279 pm_buffer_append_byte(buffer, ',');
7280 pm_buffer_append_string(buffer, "\"optionals\":", 12);
7281 const pm_node_list_t *optionals = &cast->optionals;
7282 pm_buffer_append_byte(buffer, '[');
7283
7284 for (size_t index = 0; index < optionals->size; index++) {
7285 if (index != 0) pm_buffer_append_byte(buffer, ',');
7286 pm_dump_json(buffer, parser, optionals->nodes[index]);
7287 }
7288 pm_buffer_append_byte(buffer, ']');
7289
7290 // Dump the rest field
7291 pm_buffer_append_byte(buffer, ',');
7292 pm_buffer_append_string(buffer, "\"rest\":", 7);
7293 if (cast->rest != NULL) {
7294 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
7295 } else {
7296 pm_buffer_append_string(buffer, "null", 4);
7297 }
7298
7299 // Dump the posts field
7300 pm_buffer_append_byte(buffer, ',');
7301 pm_buffer_append_string(buffer, "\"posts\":", 8);
7302 const pm_node_list_t *posts = &cast->posts;
7303 pm_buffer_append_byte(buffer, '[');
7304
7305 for (size_t index = 0; index < posts->size; index++) {
7306 if (index != 0) pm_buffer_append_byte(buffer, ',');
7307 pm_dump_json(buffer, parser, posts->nodes[index]);
7308 }
7309 pm_buffer_append_byte(buffer, ']');
7310
7311 // Dump the keywords field
7312 pm_buffer_append_byte(buffer, ',');
7313 pm_buffer_append_string(buffer, "\"keywords\":", 11);
7314 const pm_node_list_t *keywords = &cast->keywords;
7315 pm_buffer_append_byte(buffer, '[');
7316
7317 for (size_t index = 0; index < keywords->size; index++) {
7318 if (index != 0) pm_buffer_append_byte(buffer, ',');
7319 pm_dump_json(buffer, parser, keywords->nodes[index]);
7320 }
7321 pm_buffer_append_byte(buffer, ']');
7322
7323 // Dump the keyword_rest field
7324 pm_buffer_append_byte(buffer, ',');
7325 pm_buffer_append_string(buffer, "\"keyword_rest\":", 15);
7326 if (cast->keyword_rest != NULL) {
7327 pm_dump_json(buffer, parser, (const pm_node_t *) cast->keyword_rest);
7328 } else {
7329 pm_buffer_append_string(buffer, "null", 4);
7330 }
7331
7332 // Dump the block field
7333 pm_buffer_append_byte(buffer, ',');
7334 pm_buffer_append_string(buffer, "\"block\":", 8);
7335 if (cast->block != NULL) {
7336 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
7337 } else {
7338 pm_buffer_append_string(buffer, "null", 4);
7339 }
7340
7341 pm_buffer_append_byte(buffer, '}');
7342 break;
7343 }
7344 case PM_PARENTHESES_NODE: {
7345 pm_buffer_append_string(buffer, "{\"type\":\"ParenthesesNode\",\"location\":", 37);
7346
7347 const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node;
7348 pm_dump_json_location(buffer, parser, &cast->base.location);
7349
7350 // Dump the body field
7351 pm_buffer_append_byte(buffer, ',');
7352 pm_buffer_append_string(buffer, "\"body\":", 7);
7353 if (cast->body != NULL) {
7354 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
7355 } else {
7356 pm_buffer_append_string(buffer, "null", 4);
7357 }
7358
7359 // Dump the opening_loc field
7360 pm_buffer_append_byte(buffer, ',');
7361 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7362 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7363
7364 // Dump the closing_loc field
7365 pm_buffer_append_byte(buffer, ',');
7366 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7367 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7368
7369 pm_buffer_append_byte(buffer, '}');
7370 break;
7371 }
7373 pm_buffer_append_string(buffer, "{\"type\":\"PinnedExpressionNode\",\"location\":", 42);
7374
7375 const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node;
7376 pm_dump_json_location(buffer, parser, &cast->base.location);
7377
7378 // Dump the expression field
7379 pm_buffer_append_byte(buffer, ',');
7380 pm_buffer_append_string(buffer, "\"expression\":", 13);
7381 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
7382
7383 // Dump the operator_loc field
7384 pm_buffer_append_byte(buffer, ',');
7385 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7386 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7387
7388 // Dump the lparen_loc field
7389 pm_buffer_append_byte(buffer, ',');
7390 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
7391 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
7392
7393 // Dump the rparen_loc field
7394 pm_buffer_append_byte(buffer, ',');
7395 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
7396 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
7397
7398 pm_buffer_append_byte(buffer, '}');
7399 break;
7400 }
7402 pm_buffer_append_string(buffer, "{\"type\":\"PinnedVariableNode\",\"location\":", 40);
7403
7404 const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node;
7405 pm_dump_json_location(buffer, parser, &cast->base.location);
7406
7407 // Dump the variable field
7408 pm_buffer_append_byte(buffer, ',');
7409 pm_buffer_append_string(buffer, "\"variable\":", 11);
7410 pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable);
7411
7412 // Dump the operator_loc field
7413 pm_buffer_append_byte(buffer, ',');
7414 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7415 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7416
7417 pm_buffer_append_byte(buffer, '}');
7418 break;
7419 }
7421 pm_buffer_append_string(buffer, "{\"type\":\"PostExecutionNode\",\"location\":", 39);
7422
7423 const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node;
7424 pm_dump_json_location(buffer, parser, &cast->base.location);
7425
7426 // Dump the statements field
7427 pm_buffer_append_byte(buffer, ',');
7428 pm_buffer_append_string(buffer, "\"statements\":", 13);
7429 if (cast->statements != NULL) {
7430 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7431 } else {
7432 pm_buffer_append_string(buffer, "null", 4);
7433 }
7434
7435 // Dump the keyword_loc field
7436 pm_buffer_append_byte(buffer, ',');
7437 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7438 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7439
7440 // Dump the opening_loc field
7441 pm_buffer_append_byte(buffer, ',');
7442 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7443 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7444
7445 // Dump the closing_loc field
7446 pm_buffer_append_byte(buffer, ',');
7447 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7448 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7449
7450 pm_buffer_append_byte(buffer, '}');
7451 break;
7452 }
7453 case PM_PRE_EXECUTION_NODE: {
7454 pm_buffer_append_string(buffer, "{\"type\":\"PreExecutionNode\",\"location\":", 38);
7455
7456 const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node;
7457 pm_dump_json_location(buffer, parser, &cast->base.location);
7458
7459 // Dump the statements field
7460 pm_buffer_append_byte(buffer, ',');
7461 pm_buffer_append_string(buffer, "\"statements\":", 13);
7462 if (cast->statements != NULL) {
7463 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7464 } else {
7465 pm_buffer_append_string(buffer, "null", 4);
7466 }
7467
7468 // Dump the keyword_loc field
7469 pm_buffer_append_byte(buffer, ',');
7470 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7471 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7472
7473 // Dump the opening_loc field
7474 pm_buffer_append_byte(buffer, ',');
7475 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7476 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7477
7478 // Dump the closing_loc field
7479 pm_buffer_append_byte(buffer, ',');
7480 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7481 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7482
7483 pm_buffer_append_byte(buffer, '}');
7484 break;
7485 }
7486 case PM_PROGRAM_NODE: {
7487 pm_buffer_append_string(buffer, "{\"type\":\"ProgramNode\",\"location\":", 33);
7488
7489 const pm_program_node_t *cast = (const pm_program_node_t *) node;
7490 pm_dump_json_location(buffer, parser, &cast->base.location);
7491
7492 // Dump the locals field
7493 pm_buffer_append_byte(buffer, ',');
7494 pm_buffer_append_string(buffer, "\"locals\":", 9);
7495 const pm_constant_id_list_t *locals = &cast->locals;
7496 pm_buffer_append_byte(buffer, '[');
7497
7498 for (size_t index = 0; index < locals->size; index++) {
7499 if (index != 0) pm_buffer_append_byte(buffer, ',');
7500 pm_dump_json_constant(buffer, parser, locals->ids[index]);
7501 }
7502 pm_buffer_append_byte(buffer, ']');
7503
7504 // Dump the statements field
7505 pm_buffer_append_byte(buffer, ',');
7506 pm_buffer_append_string(buffer, "\"statements\":", 13);
7507 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7508
7509 pm_buffer_append_byte(buffer, '}');
7510 break;
7511 }
7512 case PM_RANGE_NODE: {
7513 pm_buffer_append_string(buffer, "{\"type\":\"RangeNode\",\"location\":", 31);
7514
7515 const pm_range_node_t *cast = (const pm_range_node_t *) node;
7516 pm_dump_json_location(buffer, parser, &cast->base.location);
7517
7518 // Dump the RangeFlags field
7519 pm_buffer_append_byte(buffer, ',');
7520 pm_buffer_append_string(buffer, "\"RangeFlags\":", 13);
7521 size_t flags = 0;
7522 pm_buffer_append_byte(buffer, '[');
7524 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7525 pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13);
7526 flags++;
7527 }
7528 pm_buffer_append_byte(buffer, ']');
7529
7530 // Dump the left field
7531 pm_buffer_append_byte(buffer, ',');
7532 pm_buffer_append_string(buffer, "\"left\":", 7);
7533 if (cast->left != NULL) {
7534 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
7535 } else {
7536 pm_buffer_append_string(buffer, "null", 4);
7537 }
7538
7539 // Dump the right field
7540 pm_buffer_append_byte(buffer, ',');
7541 pm_buffer_append_string(buffer, "\"right\":", 8);
7542 if (cast->right != NULL) {
7543 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
7544 } else {
7545 pm_buffer_append_string(buffer, "null", 4);
7546 }
7547
7548 // Dump the operator_loc field
7549 pm_buffer_append_byte(buffer, ',');
7550 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7551 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7552
7553 pm_buffer_append_byte(buffer, '}');
7554 break;
7555 }
7556 case PM_RATIONAL_NODE: {
7557 pm_buffer_append_string(buffer, "{\"type\":\"RationalNode\",\"location\":", 34);
7558
7559 const pm_rational_node_t *cast = (const pm_rational_node_t *) node;
7560 pm_dump_json_location(buffer, parser, &cast->base.location);
7561
7562 // Dump the IntegerBaseFlags field
7563 pm_buffer_append_byte(buffer, ',');
7564 pm_buffer_append_string(buffer, "\"IntegerBaseFlags\":", 19);
7565 size_t flags = 0;
7566 pm_buffer_append_byte(buffer, '[');
7568 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7569 pm_buffer_append_string(buffer, "\"BINARY\"", 8);
7570 flags++;
7571 }
7573 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7574 pm_buffer_append_string(buffer, "\"DECIMAL\"", 9);
7575 flags++;
7576 }
7578 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7579 pm_buffer_append_string(buffer, "\"OCTAL\"", 7);
7580 flags++;
7581 }
7583 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7584 pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13);
7585 flags++;
7586 }
7587 pm_buffer_append_byte(buffer, ']');
7588
7589 // Dump the numerator field
7590 pm_buffer_append_byte(buffer, ',');
7591 pm_buffer_append_string(buffer, "\"numerator\":", 12);
7592 pm_integer_string(buffer, &cast->numerator);
7593
7594 // Dump the denominator field
7595 pm_buffer_append_byte(buffer, ',');
7596 pm_buffer_append_string(buffer, "\"denominator\":", 14);
7597 pm_integer_string(buffer, &cast->denominator);
7598
7599 pm_buffer_append_byte(buffer, '}');
7600 break;
7601 }
7602 case PM_REDO_NODE: {
7603 pm_buffer_append_string(buffer, "{\"type\":\"RedoNode\",\"location\":", 30);
7604
7605 const pm_redo_node_t *cast = (const pm_redo_node_t *) node;
7606 pm_dump_json_location(buffer, parser, &cast->base.location);
7607
7608 pm_buffer_append_byte(buffer, '}');
7609 break;
7610 }
7612 pm_buffer_append_string(buffer, "{\"type\":\"RegularExpressionNode\",\"location\":", 43);
7613
7615 pm_dump_json_location(buffer, parser, &cast->base.location);
7616
7617 // Dump the RegularExpressionFlags field
7618 pm_buffer_append_byte(buffer, ',');
7619 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
7620 size_t flags = 0;
7621 pm_buffer_append_byte(buffer, '[');
7623 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7624 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
7625 flags++;
7626 }
7628 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7629 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
7630 flags++;
7631 }
7633 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7634 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
7635 flags++;
7636 }
7638 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7639 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
7640 flags++;
7641 }
7643 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7644 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
7645 flags++;
7646 }
7648 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7649 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
7650 flags++;
7651 }
7653 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7654 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
7655 flags++;
7656 }
7658 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7659 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
7660 flags++;
7661 }
7663 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7664 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
7665 flags++;
7666 }
7668 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7669 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
7670 flags++;
7671 }
7673 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7674 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
7675 flags++;
7676 }
7677 pm_buffer_append_byte(buffer, ']');
7678
7679 // Dump the opening_loc field
7680 pm_buffer_append_byte(buffer, ',');
7681 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7682 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7683
7684 // Dump the content_loc field
7685 pm_buffer_append_byte(buffer, ',');
7686 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
7687 pm_dump_json_location(buffer, parser, &cast->content_loc);
7688
7689 // Dump the closing_loc field
7690 pm_buffer_append_byte(buffer, ',');
7691 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7692 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7693
7694 // Dump the unescaped field
7695 pm_buffer_append_byte(buffer, ',');
7696 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
7697 const pm_string_t *unescaped = &cast->unescaped;
7698 pm_buffer_append_byte(buffer, '"');
7699 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
7700 pm_buffer_append_byte(buffer, '"');
7701
7702 pm_buffer_append_byte(buffer, '}');
7703 break;
7704 }
7706 pm_buffer_append_string(buffer, "{\"type\":\"RequiredKeywordParameterNode\",\"location\":", 50);
7707
7709 pm_dump_json_location(buffer, parser, &cast->base.location);
7710
7711 // Dump the ParameterFlags field
7712 pm_buffer_append_byte(buffer, ',');
7713 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7714 size_t flags = 0;
7715 pm_buffer_append_byte(buffer, '[');
7717 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7718 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7719 flags++;
7720 }
7721 pm_buffer_append_byte(buffer, ']');
7722
7723 // Dump the name field
7724 pm_buffer_append_byte(buffer, ',');
7725 pm_buffer_append_string(buffer, "\"name\":", 7);
7726 pm_dump_json_constant(buffer, parser, cast->name);
7727
7728 // Dump the name_loc field
7729 pm_buffer_append_byte(buffer, ',');
7730 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7731 pm_dump_json_location(buffer, parser, &cast->name_loc);
7732
7733 pm_buffer_append_byte(buffer, '}');
7734 break;
7735 }
7737 pm_buffer_append_string(buffer, "{\"type\":\"RequiredParameterNode\",\"location\":", 43);
7738
7740 pm_dump_json_location(buffer, parser, &cast->base.location);
7741
7742 // Dump the ParameterFlags field
7743 pm_buffer_append_byte(buffer, ',');
7744 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7745 size_t flags = 0;
7746 pm_buffer_append_byte(buffer, '[');
7748 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7749 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7750 flags++;
7751 }
7752 pm_buffer_append_byte(buffer, ']');
7753
7754 // Dump the name field
7755 pm_buffer_append_byte(buffer, ',');
7756 pm_buffer_append_string(buffer, "\"name\":", 7);
7757 pm_dump_json_constant(buffer, parser, cast->name);
7758
7759 pm_buffer_append_byte(buffer, '}');
7760 break;
7761 }
7763 pm_buffer_append_string(buffer, "{\"type\":\"RescueModifierNode\",\"location\":", 40);
7764
7765 const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node;
7766 pm_dump_json_location(buffer, parser, &cast->base.location);
7767
7768 // Dump the expression field
7769 pm_buffer_append_byte(buffer, ',');
7770 pm_buffer_append_string(buffer, "\"expression\":", 13);
7771 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
7772
7773 // Dump the keyword_loc field
7774 pm_buffer_append_byte(buffer, ',');
7775 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7776 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7777
7778 // Dump the rescue_expression field
7779 pm_buffer_append_byte(buffer, ',');
7780 pm_buffer_append_string(buffer, "\"rescue_expression\":", 20);
7781 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_expression);
7782
7783 pm_buffer_append_byte(buffer, '}');
7784 break;
7785 }
7786 case PM_RESCUE_NODE: {
7787 pm_buffer_append_string(buffer, "{\"type\":\"RescueNode\",\"location\":", 32);
7788
7789 const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node;
7790 pm_dump_json_location(buffer, parser, &cast->base.location);
7791
7792 // Dump the keyword_loc field
7793 pm_buffer_append_byte(buffer, ',');
7794 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7795 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7796
7797 // Dump the exceptions field
7798 pm_buffer_append_byte(buffer, ',');
7799 pm_buffer_append_string(buffer, "\"exceptions\":", 13);
7800 const pm_node_list_t *exceptions = &cast->exceptions;
7801 pm_buffer_append_byte(buffer, '[');
7802
7803 for (size_t index = 0; index < exceptions->size; index++) {
7804 if (index != 0) pm_buffer_append_byte(buffer, ',');
7805 pm_dump_json(buffer, parser, exceptions->nodes[index]);
7806 }
7807 pm_buffer_append_byte(buffer, ']');
7808
7809 // Dump the operator_loc field
7810 pm_buffer_append_byte(buffer, ',');
7811 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7812 if (cast->operator_loc.start != NULL) {
7813 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7814 } else {
7815 pm_buffer_append_string(buffer, "null", 4);
7816 }
7817
7818 // Dump the reference field
7819 pm_buffer_append_byte(buffer, ',');
7820 pm_buffer_append_string(buffer, "\"reference\":", 12);
7821 if (cast->reference != NULL) {
7822 pm_dump_json(buffer, parser, (const pm_node_t *) cast->reference);
7823 } else {
7824 pm_buffer_append_string(buffer, "null", 4);
7825 }
7826
7827 // Dump the statements field
7828 pm_buffer_append_byte(buffer, ',');
7829 pm_buffer_append_string(buffer, "\"statements\":", 13);
7830 if (cast->statements != NULL) {
7831 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7832 } else {
7833 pm_buffer_append_string(buffer, "null", 4);
7834 }
7835
7836 // Dump the subsequent field
7837 pm_buffer_append_byte(buffer, ',');
7838 pm_buffer_append_string(buffer, "\"subsequent\":", 13);
7839 if (cast->subsequent != NULL) {
7840 pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent);
7841 } else {
7842 pm_buffer_append_string(buffer, "null", 4);
7843 }
7844
7845 pm_buffer_append_byte(buffer, '}');
7846 break;
7847 }
7849 pm_buffer_append_string(buffer, "{\"type\":\"RestParameterNode\",\"location\":", 39);
7850
7851 const pm_rest_parameter_node_t *cast = (const pm_rest_parameter_node_t *) node;
7852 pm_dump_json_location(buffer, parser, &cast->base.location);
7853
7854 // Dump the ParameterFlags field
7855 pm_buffer_append_byte(buffer, ',');
7856 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7857 size_t flags = 0;
7858 pm_buffer_append_byte(buffer, '[');
7860 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7861 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7862 flags++;
7863 }
7864 pm_buffer_append_byte(buffer, ']');
7865
7866 // Dump the name field
7867 pm_buffer_append_byte(buffer, ',');
7868 pm_buffer_append_string(buffer, "\"name\":", 7);
7869 if (cast->name != PM_CONSTANT_ID_UNSET) {
7870 pm_dump_json_constant(buffer, parser, cast->name);
7871 } else {
7872 pm_buffer_append_string(buffer, "null", 4);
7873 }
7874
7875 // Dump the name_loc field
7876 pm_buffer_append_byte(buffer, ',');
7877 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7878 if (cast->name_loc.start != NULL) {
7879 pm_dump_json_location(buffer, parser, &cast->name_loc);
7880 } else {
7881 pm_buffer_append_string(buffer, "null", 4);
7882 }
7883
7884 // Dump the operator_loc field
7885 pm_buffer_append_byte(buffer, ',');
7886 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7887 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7888
7889 pm_buffer_append_byte(buffer, '}');
7890 break;
7891 }
7892 case PM_RETRY_NODE: {
7893 pm_buffer_append_string(buffer, "{\"type\":\"RetryNode\",\"location\":", 31);
7894
7895 const pm_retry_node_t *cast = (const pm_retry_node_t *) node;
7896 pm_dump_json_location(buffer, parser, &cast->base.location);
7897
7898 pm_buffer_append_byte(buffer, '}');
7899 break;
7900 }
7901 case PM_RETURN_NODE: {
7902 pm_buffer_append_string(buffer, "{\"type\":\"ReturnNode\",\"location\":", 32);
7903
7904 const pm_return_node_t *cast = (const pm_return_node_t *) node;
7905 pm_dump_json_location(buffer, parser, &cast->base.location);
7906
7907 // Dump the keyword_loc field
7908 pm_buffer_append_byte(buffer, ',');
7909 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7910 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7911
7912 // Dump the arguments field
7913 pm_buffer_append_byte(buffer, ',');
7914 pm_buffer_append_string(buffer, "\"arguments\":", 12);
7915 if (cast->arguments != NULL) {
7916 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
7917 } else {
7918 pm_buffer_append_string(buffer, "null", 4);
7919 }
7920
7921 pm_buffer_append_byte(buffer, '}');
7922 break;
7923 }
7924 case PM_SELF_NODE: {
7925 pm_buffer_append_string(buffer, "{\"type\":\"SelfNode\",\"location\":", 30);
7926
7927 const pm_self_node_t *cast = (const pm_self_node_t *) node;
7928 pm_dump_json_location(buffer, parser, &cast->base.location);
7929
7930 pm_buffer_append_byte(buffer, '}');
7931 break;
7932 }
7934 pm_buffer_append_string(buffer, "{\"type\":\"ShareableConstantNode\",\"location\":", 43);
7935
7937 pm_dump_json_location(buffer, parser, &cast->base.location);
7938
7939 // Dump the ShareableConstantNodeFlags field
7940 pm_buffer_append_byte(buffer, ',');
7941 pm_buffer_append_string(buffer, "\"ShareableConstantNodeFlags\":", 29);
7942 size_t flags = 0;
7943 pm_buffer_append_byte(buffer, '[');
7945 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7946 pm_buffer_append_string(buffer, "\"LITERAL\"", 9);
7947 flags++;
7948 }
7950 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7951 pm_buffer_append_string(buffer, "\"EXPERIMENTAL_EVERYTHING\"", 25);
7952 flags++;
7953 }
7955 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7956 pm_buffer_append_string(buffer, "\"EXPERIMENTAL_COPY\"", 19);
7957 flags++;
7958 }
7959 pm_buffer_append_byte(buffer, ']');
7960
7961 // Dump the write field
7962 pm_buffer_append_byte(buffer, ',');
7963 pm_buffer_append_string(buffer, "\"write\":", 8);
7964 pm_dump_json(buffer, parser, (const pm_node_t *) cast->write);
7965
7966 pm_buffer_append_byte(buffer, '}');
7967 break;
7968 }
7970 pm_buffer_append_string(buffer, "{\"type\":\"SingletonClassNode\",\"location\":", 40);
7971
7972 const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node;
7973 pm_dump_json_location(buffer, parser, &cast->base.location);
7974
7975 // Dump the locals field
7976 pm_buffer_append_byte(buffer, ',');
7977 pm_buffer_append_string(buffer, "\"locals\":", 9);
7978 const pm_constant_id_list_t *locals = &cast->locals;
7979 pm_buffer_append_byte(buffer, '[');
7980
7981 for (size_t index = 0; index < locals->size; index++) {
7982 if (index != 0) pm_buffer_append_byte(buffer, ',');
7983 pm_dump_json_constant(buffer, parser, locals->ids[index]);
7984 }
7985 pm_buffer_append_byte(buffer, ']');
7986
7987 // Dump the class_keyword_loc field
7988 pm_buffer_append_byte(buffer, ',');
7989 pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20);
7990 pm_dump_json_location(buffer, parser, &cast->class_keyword_loc);
7991
7992 // Dump the operator_loc field
7993 pm_buffer_append_byte(buffer, ',');
7994 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7995 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7996
7997 // Dump the expression field
7998 pm_buffer_append_byte(buffer, ',');
7999 pm_buffer_append_string(buffer, "\"expression\":", 13);
8000 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
8001
8002 // Dump the body field
8003 pm_buffer_append_byte(buffer, ',');
8004 pm_buffer_append_string(buffer, "\"body\":", 7);
8005 if (cast->body != NULL) {
8006 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
8007 } else {
8008 pm_buffer_append_string(buffer, "null", 4);
8009 }
8010
8011 // Dump the end_keyword_loc field
8012 pm_buffer_append_byte(buffer, ',');
8013 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
8014 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
8015
8016 pm_buffer_append_byte(buffer, '}');
8017 break;
8018 }
8020 pm_buffer_append_string(buffer, "{\"type\":\"SourceEncodingNode\",\"location\":", 40);
8021
8022 const pm_source_encoding_node_t *cast = (const pm_source_encoding_node_t *) node;
8023 pm_dump_json_location(buffer, parser, &cast->base.location);
8024
8025 pm_buffer_append_byte(buffer, '}');
8026 break;
8027 }
8028 case PM_SOURCE_FILE_NODE: {
8029 pm_buffer_append_string(buffer, "{\"type\":\"SourceFileNode\",\"location\":", 36);
8030
8031 const pm_source_file_node_t *cast = (const pm_source_file_node_t *) node;
8032 pm_dump_json_location(buffer, parser, &cast->base.location);
8033
8034 // Dump the StringFlags field
8035 pm_buffer_append_byte(buffer, ',');
8036 pm_buffer_append_string(buffer, "\"StringFlags\":", 14);
8037 size_t flags = 0;
8038 pm_buffer_append_byte(buffer, '[');
8040 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8041 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8042 flags++;
8043 }
8045 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8046 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8047 flags++;
8048 }
8050 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8051 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
8052 flags++;
8053 }
8055 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8056 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
8057 flags++;
8058 }
8059 pm_buffer_append_byte(buffer, ']');
8060
8061 // Dump the filepath field
8062 pm_buffer_append_byte(buffer, ',');
8063 pm_buffer_append_string(buffer, "\"filepath\":", 11);
8064 const pm_string_t *filepath = &cast->filepath;
8065 pm_buffer_append_byte(buffer, '"');
8066 pm_buffer_append_source(buffer, pm_string_source(filepath), pm_string_length(filepath), PM_BUFFER_ESCAPING_JSON);
8067 pm_buffer_append_byte(buffer, '"');
8068
8069 pm_buffer_append_byte(buffer, '}');
8070 break;
8071 }
8072 case PM_SOURCE_LINE_NODE: {
8073 pm_buffer_append_string(buffer, "{\"type\":\"SourceLineNode\",\"location\":", 36);
8074
8075 const pm_source_line_node_t *cast = (const pm_source_line_node_t *) node;
8076 pm_dump_json_location(buffer, parser, &cast->base.location);
8077
8078 pm_buffer_append_byte(buffer, '}');
8079 break;
8080 }
8081 case PM_SPLAT_NODE: {
8082 pm_buffer_append_string(buffer, "{\"type\":\"SplatNode\",\"location\":", 31);
8083
8084 const pm_splat_node_t *cast = (const pm_splat_node_t *) node;
8085 pm_dump_json_location(buffer, parser, &cast->base.location);
8086
8087 // Dump the operator_loc field
8088 pm_buffer_append_byte(buffer, ',');
8089 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
8090 pm_dump_json_location(buffer, parser, &cast->operator_loc);
8091
8092 // Dump the expression field
8093 pm_buffer_append_byte(buffer, ',');
8094 pm_buffer_append_string(buffer, "\"expression\":", 13);
8095 if (cast->expression != NULL) {
8096 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
8097 } else {
8098 pm_buffer_append_string(buffer, "null", 4);
8099 }
8100
8101 pm_buffer_append_byte(buffer, '}');
8102 break;
8103 }
8104 case PM_STATEMENTS_NODE: {
8105 pm_buffer_append_string(buffer, "{\"type\":\"StatementsNode\",\"location\":", 36);
8106
8107 const pm_statements_node_t *cast = (const pm_statements_node_t *) node;
8108 pm_dump_json_location(buffer, parser, &cast->base.location);
8109
8110 // Dump the body field
8111 pm_buffer_append_byte(buffer, ',');
8112 pm_buffer_append_string(buffer, "\"body\":", 7);
8113 const pm_node_list_t *body = &cast->body;
8114 pm_buffer_append_byte(buffer, '[');
8115
8116 for (size_t index = 0; index < body->size; index++) {
8117 if (index != 0) pm_buffer_append_byte(buffer, ',');
8118 pm_dump_json(buffer, parser, body->nodes[index]);
8119 }
8120 pm_buffer_append_byte(buffer, ']');
8121
8122 pm_buffer_append_byte(buffer, '}');
8123 break;
8124 }
8125 case PM_STRING_NODE: {
8126 pm_buffer_append_string(buffer, "{\"type\":\"StringNode\",\"location\":", 32);
8127
8128 const pm_string_node_t *cast = (const pm_string_node_t *) node;
8129 pm_dump_json_location(buffer, parser, &cast->base.location);
8130
8131 // Dump the StringFlags field
8132 pm_buffer_append_byte(buffer, ',');
8133 pm_buffer_append_string(buffer, "\"StringFlags\":", 14);
8134 size_t flags = 0;
8135 pm_buffer_append_byte(buffer, '[');
8137 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8138 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8139 flags++;
8140 }
8142 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8143 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8144 flags++;
8145 }
8147 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8148 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
8149 flags++;
8150 }
8152 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8153 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
8154 flags++;
8155 }
8156 pm_buffer_append_byte(buffer, ']');
8157
8158 // Dump the opening_loc field
8159 pm_buffer_append_byte(buffer, ',');
8160 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
8161 if (cast->opening_loc.start != NULL) {
8162 pm_dump_json_location(buffer, parser, &cast->opening_loc);
8163 } else {
8164 pm_buffer_append_string(buffer, "null", 4);
8165 }
8166
8167 // Dump the content_loc field
8168 pm_buffer_append_byte(buffer, ',');
8169 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
8170 pm_dump_json_location(buffer, parser, &cast->content_loc);
8171
8172 // Dump the closing_loc field
8173 pm_buffer_append_byte(buffer, ',');
8174 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8175 if (cast->closing_loc.start != NULL) {
8176 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8177 } else {
8178 pm_buffer_append_string(buffer, "null", 4);
8179 }
8180
8181 // Dump the unescaped field
8182 pm_buffer_append_byte(buffer, ',');
8183 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
8184 const pm_string_t *unescaped = &cast->unescaped;
8185 pm_buffer_append_byte(buffer, '"');
8186 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
8187 pm_buffer_append_byte(buffer, '"');
8188
8189 pm_buffer_append_byte(buffer, '}');
8190 break;
8191 }
8192 case PM_SUPER_NODE: {
8193 pm_buffer_append_string(buffer, "{\"type\":\"SuperNode\",\"location\":", 31);
8194
8195 const pm_super_node_t *cast = (const pm_super_node_t *) node;
8196 pm_dump_json_location(buffer, parser, &cast->base.location);
8197
8198 // Dump the keyword_loc field
8199 pm_buffer_append_byte(buffer, ',');
8200 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8201 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8202
8203 // Dump the lparen_loc field
8204 pm_buffer_append_byte(buffer, ',');
8205 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
8206 if (cast->lparen_loc.start != NULL) {
8207 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
8208 } else {
8209 pm_buffer_append_string(buffer, "null", 4);
8210 }
8211
8212 // Dump the arguments field
8213 pm_buffer_append_byte(buffer, ',');
8214 pm_buffer_append_string(buffer, "\"arguments\":", 12);
8215 if (cast->arguments != NULL) {
8216 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
8217 } else {
8218 pm_buffer_append_string(buffer, "null", 4);
8219 }
8220
8221 // Dump the rparen_loc field
8222 pm_buffer_append_byte(buffer, ',');
8223 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
8224 if (cast->rparen_loc.start != NULL) {
8225 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
8226 } else {
8227 pm_buffer_append_string(buffer, "null", 4);
8228 }
8229
8230 // Dump the block field
8231 pm_buffer_append_byte(buffer, ',');
8232 pm_buffer_append_string(buffer, "\"block\":", 8);
8233 if (cast->block != NULL) {
8234 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
8235 } else {
8236 pm_buffer_append_string(buffer, "null", 4);
8237 }
8238
8239 pm_buffer_append_byte(buffer, '}');
8240 break;
8241 }
8242 case PM_SYMBOL_NODE: {
8243 pm_buffer_append_string(buffer, "{\"type\":\"SymbolNode\",\"location\":", 32);
8244
8245 const pm_symbol_node_t *cast = (const pm_symbol_node_t *) node;
8246 pm_dump_json_location(buffer, parser, &cast->base.location);
8247
8248 // Dump the SymbolFlags field
8249 pm_buffer_append_byte(buffer, ',');
8250 pm_buffer_append_string(buffer, "\"SymbolFlags\":", 14);
8251 size_t flags = 0;
8252 pm_buffer_append_byte(buffer, '[');
8254 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8255 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8256 flags++;
8257 }
8259 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8260 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8261 flags++;
8262 }
8264 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8265 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
8266 flags++;
8267 }
8268 pm_buffer_append_byte(buffer, ']');
8269
8270 // Dump the opening_loc field
8271 pm_buffer_append_byte(buffer, ',');
8272 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
8273 if (cast->opening_loc.start != NULL) {
8274 pm_dump_json_location(buffer, parser, &cast->opening_loc);
8275 } else {
8276 pm_buffer_append_string(buffer, "null", 4);
8277 }
8278
8279 // Dump the value_loc field
8280 pm_buffer_append_byte(buffer, ',');
8281 pm_buffer_append_string(buffer, "\"value_loc\":", 12);
8282 if (cast->value_loc.start != NULL) {
8283 pm_dump_json_location(buffer, parser, &cast->value_loc);
8284 } else {
8285 pm_buffer_append_string(buffer, "null", 4);
8286 }
8287
8288 // Dump the closing_loc field
8289 pm_buffer_append_byte(buffer, ',');
8290 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8291 if (cast->closing_loc.start != NULL) {
8292 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8293 } else {
8294 pm_buffer_append_string(buffer, "null", 4);
8295 }
8296
8297 // Dump the unescaped field
8298 pm_buffer_append_byte(buffer, ',');
8299 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
8300 const pm_string_t *unescaped = &cast->unescaped;
8301 pm_buffer_append_byte(buffer, '"');
8302 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
8303 pm_buffer_append_byte(buffer, '"');
8304
8305 pm_buffer_append_byte(buffer, '}');
8306 break;
8307 }
8308 case PM_TRUE_NODE: {
8309 pm_buffer_append_string(buffer, "{\"type\":\"TrueNode\",\"location\":", 30);
8310
8311 const pm_true_node_t *cast = (const pm_true_node_t *) node;
8312 pm_dump_json_location(buffer, parser, &cast->base.location);
8313
8314 pm_buffer_append_byte(buffer, '}');
8315 break;
8316 }
8317 case PM_UNDEF_NODE: {
8318 pm_buffer_append_string(buffer, "{\"type\":\"UndefNode\",\"location\":", 31);
8319
8320 const pm_undef_node_t *cast = (const pm_undef_node_t *) node;
8321 pm_dump_json_location(buffer, parser, &cast->base.location);
8322
8323 // Dump the names field
8324 pm_buffer_append_byte(buffer, ',');
8325 pm_buffer_append_string(buffer, "\"names\":", 8);
8326 const pm_node_list_t *names = &cast->names;
8327 pm_buffer_append_byte(buffer, '[');
8328
8329 for (size_t index = 0; index < names->size; index++) {
8330 if (index != 0) pm_buffer_append_byte(buffer, ',');
8331 pm_dump_json(buffer, parser, names->nodes[index]);
8332 }
8333 pm_buffer_append_byte(buffer, ']');
8334
8335 // Dump the keyword_loc field
8336 pm_buffer_append_byte(buffer, ',');
8337 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8338 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8339
8340 pm_buffer_append_byte(buffer, '}');
8341 break;
8342 }
8343 case PM_UNLESS_NODE: {
8344 pm_buffer_append_string(buffer, "{\"type\":\"UnlessNode\",\"location\":", 32);
8345
8346 const pm_unless_node_t *cast = (const pm_unless_node_t *) node;
8347 pm_dump_json_location(buffer, parser, &cast->base.location);
8348
8349 // Dump the keyword_loc field
8350 pm_buffer_append_byte(buffer, ',');
8351 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8352 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8353
8354 // Dump the predicate field
8355 pm_buffer_append_byte(buffer, ',');
8356 pm_buffer_append_string(buffer, "\"predicate\":", 12);
8357 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
8358
8359 // Dump the then_keyword_loc field
8360 pm_buffer_append_byte(buffer, ',');
8361 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
8362 if (cast->then_keyword_loc.start != NULL) {
8363 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
8364 } else {
8365 pm_buffer_append_string(buffer, "null", 4);
8366 }
8367
8368 // Dump the statements field
8369 pm_buffer_append_byte(buffer, ',');
8370 pm_buffer_append_string(buffer, "\"statements\":", 13);
8371 if (cast->statements != NULL) {
8372 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8373 } else {
8374 pm_buffer_append_string(buffer, "null", 4);
8375 }
8376
8377 // Dump the else_clause field
8378 pm_buffer_append_byte(buffer, ',');
8379 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
8380 if (cast->else_clause != NULL) {
8381 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
8382 } else {
8383 pm_buffer_append_string(buffer, "null", 4);
8384 }
8385
8386 // Dump the end_keyword_loc field
8387 pm_buffer_append_byte(buffer, ',');
8388 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
8389 if (cast->end_keyword_loc.start != NULL) {
8390 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
8391 } else {
8392 pm_buffer_append_string(buffer, "null", 4);
8393 }
8394
8395 pm_buffer_append_byte(buffer, '}');
8396 break;
8397 }
8398 case PM_UNTIL_NODE: {
8399 pm_buffer_append_string(buffer, "{\"type\":\"UntilNode\",\"location\":", 31);
8400
8401 const pm_until_node_t *cast = (const pm_until_node_t *) node;
8402 pm_dump_json_location(buffer, parser, &cast->base.location);
8403
8404 // Dump the LoopFlags field
8405 pm_buffer_append_byte(buffer, ',');
8406 pm_buffer_append_string(buffer, "\"LoopFlags\":", 12);
8407 size_t flags = 0;
8408 pm_buffer_append_byte(buffer, '[');
8410 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8411 pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16);
8412 flags++;
8413 }
8414 pm_buffer_append_byte(buffer, ']');
8415
8416 // Dump the keyword_loc field
8417 pm_buffer_append_byte(buffer, ',');
8418 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8419 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8420
8421 // Dump the do_keyword_loc field
8422 pm_buffer_append_byte(buffer, ',');
8423 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
8424 if (cast->do_keyword_loc.start != NULL) {
8425 pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
8426 } else {
8427 pm_buffer_append_string(buffer, "null", 4);
8428 }
8429
8430 // Dump the closing_loc field
8431 pm_buffer_append_byte(buffer, ',');
8432 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8433 if (cast->closing_loc.start != NULL) {
8434 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8435 } else {
8436 pm_buffer_append_string(buffer, "null", 4);
8437 }
8438
8439 // Dump the predicate field
8440 pm_buffer_append_byte(buffer, ',');
8441 pm_buffer_append_string(buffer, "\"predicate\":", 12);
8442 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
8443
8444 // Dump the statements field
8445 pm_buffer_append_byte(buffer, ',');
8446 pm_buffer_append_string(buffer, "\"statements\":", 13);
8447 if (cast->statements != NULL) {
8448 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8449 } else {
8450 pm_buffer_append_string(buffer, "null", 4);
8451 }
8452
8453 pm_buffer_append_byte(buffer, '}');
8454 break;
8455 }
8456 case PM_WHEN_NODE: {
8457 pm_buffer_append_string(buffer, "{\"type\":\"WhenNode\",\"location\":", 30);
8458
8459 const pm_when_node_t *cast = (const pm_when_node_t *) node;
8460 pm_dump_json_location(buffer, parser, &cast->base.location);
8461
8462 // Dump the keyword_loc field
8463 pm_buffer_append_byte(buffer, ',');
8464 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8465 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8466
8467 // Dump the conditions field
8468 pm_buffer_append_byte(buffer, ',');
8469 pm_buffer_append_string(buffer, "\"conditions\":", 13);
8470 const pm_node_list_t *conditions = &cast->conditions;
8471 pm_buffer_append_byte(buffer, '[');
8472
8473 for (size_t index = 0; index < conditions->size; index++) {
8474 if (index != 0) pm_buffer_append_byte(buffer, ',');
8475 pm_dump_json(buffer, parser, conditions->nodes[index]);
8476 }
8477 pm_buffer_append_byte(buffer, ']');
8478
8479 // Dump the then_keyword_loc field
8480 pm_buffer_append_byte(buffer, ',');
8481 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
8482 if (cast->then_keyword_loc.start != NULL) {
8483 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
8484 } else {
8485 pm_buffer_append_string(buffer, "null", 4);
8486 }
8487
8488 // Dump the statements field
8489 pm_buffer_append_byte(buffer, ',');
8490 pm_buffer_append_string(buffer, "\"statements\":", 13);
8491 if (cast->statements != NULL) {
8492 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8493 } else {
8494 pm_buffer_append_string(buffer, "null", 4);
8495 }
8496
8497 pm_buffer_append_byte(buffer, '}');
8498 break;
8499 }
8500 case PM_WHILE_NODE: {
8501 pm_buffer_append_string(buffer, "{\"type\":\"WhileNode\",\"location\":", 31);
8502
8503 const pm_while_node_t *cast = (const pm_while_node_t *) node;
8504 pm_dump_json_location(buffer, parser, &cast->base.location);
8505
8506 // Dump the LoopFlags field
8507 pm_buffer_append_byte(buffer, ',');
8508 pm_buffer_append_string(buffer, "\"LoopFlags\":", 12);
8509 size_t flags = 0;
8510 pm_buffer_append_byte(buffer, '[');
8512 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8513 pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16);
8514 flags++;
8515 }
8516 pm_buffer_append_byte(buffer, ']');
8517
8518 // Dump the keyword_loc field
8519 pm_buffer_append_byte(buffer, ',');
8520 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8521 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8522
8523 // Dump the do_keyword_loc field
8524 pm_buffer_append_byte(buffer, ',');
8525 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
8526 if (cast->do_keyword_loc.start != NULL) {
8527 pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
8528 } else {
8529 pm_buffer_append_string(buffer, "null", 4);
8530 }
8531
8532 // Dump the closing_loc field
8533 pm_buffer_append_byte(buffer, ',');
8534 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8535 if (cast->closing_loc.start != NULL) {
8536 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8537 } else {
8538 pm_buffer_append_string(buffer, "null", 4);
8539 }
8540
8541 // Dump the predicate field
8542 pm_buffer_append_byte(buffer, ',');
8543 pm_buffer_append_string(buffer, "\"predicate\":", 12);
8544 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
8545
8546 // Dump the statements field
8547 pm_buffer_append_byte(buffer, ',');
8548 pm_buffer_append_string(buffer, "\"statements\":", 13);
8549 if (cast->statements != NULL) {
8550 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8551 } else {
8552 pm_buffer_append_string(buffer, "null", 4);
8553 }
8554
8555 pm_buffer_append_byte(buffer, '}');
8556 break;
8557 }
8558 case PM_X_STRING_NODE: {
8559 pm_buffer_append_string(buffer, "{\"type\":\"XStringNode\",\"location\":", 33);
8560
8561 const pm_x_string_node_t *cast = (const pm_x_string_node_t *) node;
8562 pm_dump_json_location(buffer, parser, &cast->base.location);
8563
8564 // Dump the EncodingFlags field
8565 pm_buffer_append_byte(buffer, ',');
8566 pm_buffer_append_string(buffer, "\"EncodingFlags\":", 16);
8567 size_t flags = 0;
8568 pm_buffer_append_byte(buffer, '[');
8570 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8571 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8572 flags++;
8573 }
8575 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8576 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8577 flags++;
8578 }
8579 pm_buffer_append_byte(buffer, ']');
8580
8581 // Dump the opening_loc field
8582 pm_buffer_append_byte(buffer, ',');
8583 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
8584 pm_dump_json_location(buffer, parser, &cast->opening_loc);
8585
8586 // Dump the content_loc field
8587 pm_buffer_append_byte(buffer, ',');
8588 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
8589 pm_dump_json_location(buffer, parser, &cast->content_loc);
8590
8591 // Dump the closing_loc field
8592 pm_buffer_append_byte(buffer, ',');
8593 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8594 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8595
8596 // Dump the unescaped field
8597 pm_buffer_append_byte(buffer, ',');
8598 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
8599 const pm_string_t *unescaped = &cast->unescaped;
8600 pm_buffer_append_byte(buffer, '"');
8601 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
8602 pm_buffer_append_byte(buffer, '"');
8603
8604 pm_buffer_append_byte(buffer, '}');
8605 break;
8606 }
8607 case PM_YIELD_NODE: {
8608 pm_buffer_append_string(buffer, "{\"type\":\"YieldNode\",\"location\":", 31);
8609
8610 const pm_yield_node_t *cast = (const pm_yield_node_t *) node;
8611 pm_dump_json_location(buffer, parser, &cast->base.location);
8612
8613 // Dump the keyword_loc field
8614 pm_buffer_append_byte(buffer, ',');
8615 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8616 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8617
8618 // Dump the lparen_loc field
8619 pm_buffer_append_byte(buffer, ',');
8620 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
8621 if (cast->lparen_loc.start != NULL) {
8622 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
8623 } else {
8624 pm_buffer_append_string(buffer, "null", 4);
8625 }
8626
8627 // Dump the arguments field
8628 pm_buffer_append_byte(buffer, ',');
8629 pm_buffer_append_string(buffer, "\"arguments\":", 12);
8630 if (cast->arguments != NULL) {
8631 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
8632 } else {
8633 pm_buffer_append_string(buffer, "null", 4);
8634 }
8635
8636 // Dump the rparen_loc field
8637 pm_buffer_append_byte(buffer, ',');
8638 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
8639 if (cast->rparen_loc.start != NULL) {
8640 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
8641 } else {
8642 pm_buffer_append_string(buffer, "null", 4);
8643 }
8644
8645 pm_buffer_append_byte(buffer, '}');
8646 break;
8647 }
8648 case PM_SCOPE_NODE:
8649 break;
8650 }
8651}
8652
8653#endif
@ PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE
mutable by virtue of a frozen_string_literal: false comment or --disable-frozen-string-literal; only ...
Definition ast.h:7822
@ PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN
frozen by virtue of a frozen_string_literal: true comment or --enable-frozen-string-literal; only for...
Definition ast.h:7819
@ PM_RANGE_FLAGS_EXCLUDE_END
... operator
Definition ast.h:7854
@ PM_DEFINED_NODE
DefinedNode.
Definition ast.h:709
@ PM_PRE_EXECUTION_NODE
PreExecutionNode.
Definition ast.h:931
@ PM_RETRY_NODE
RetryNode.
Definition ast.h:964
@ PM_REDO_NODE
RedoNode.
Definition ast.h:943
@ PM_CONSTANT_PATH_WRITE_NODE
ConstantPathWriteNode.
Definition ast.h:694
@ PM_INDEX_AND_WRITE_NODE
IndexAndWriteNode.
Definition ast.h:787
@ PM_SOURCE_LINE_NODE
SourceLineNode.
Definition ast.h:985
@ PM_UNLESS_NODE
UnlessNode.
Definition ast.h:1009
@ PM_EMBEDDED_VARIABLE_NODE
EmbeddedVariableNode.
Definition ast.h:718
@ PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE
GlobalVariableOperatorWriteNode.
Definition ast.h:751
@ PM_CALL_NODE
CallNode.
Definition ast.h:628
@ PM_NIL_NODE
NilNode.
Definition ast.h:895
@ PM_GLOBAL_VARIABLE_READ_NODE
GlobalVariableReadNode.
Definition ast.h:757
@ PM_RATIONAL_NODE
RationalNode.
Definition ast.h:940
@ PM_YIELD_NODE
YieldNode.
Definition ast.h:1024
@ PM_LOCAL_VARIABLE_AND_WRITE_NODE
LocalVariableAndWriteNode.
Definition ast.h:850
@ PM_CONSTANT_AND_WRITE_NODE
ConstantAndWriteNode.
Definition ast.h:670
@ PM_CLASS_NODE
ClassNode.
Definition ast.h:649
@ PM_FIND_PATTERN_NODE
FindPatternNode.
Definition ast.h:727
@ PM_CALL_OPERATOR_WRITE_NODE
CallOperatorWriteNode.
Definition ast.h:631
@ PM_MATCH_WRITE_NODE
MatchWriteNode.
Definition ast.h:877
@ PM_ARRAY_NODE
ArrayNode.
Definition ast.h:589
@ PM_CONSTANT_PATH_TARGET_NODE
ConstantPathTargetNode.
Definition ast.h:691
@ PM_PROGRAM_NODE
ProgramNode.
Definition ast.h:934
@ PM_OR_NODE
OrNode.
Definition ast.h:913
@ PM_MULTI_WRITE_NODE
MultiWriteNode.
Definition ast.h:889
@ PM_IF_NODE
IfNode.
Definition ast.h:772
@ PM_IMPLICIT_NODE
ImplicitNode.
Definition ast.h:778
@ PM_ARGUMENTS_NODE
ArgumentsNode.
Definition ast.h:586
@ PM_FORWARDING_SUPER_NODE
ForwardingSuperNode.
Definition ast.h:745
@ PM_WHILE_NODE
WhileNode.
Definition ast.h:1018
@ PM_INTERPOLATED_STRING_NODE
InterpolatedStringNode.
Definition ast.h:826
@ PM_FALSE_NODE
FalseNode.
Definition ast.h:724
@ PM_FORWARDING_PARAMETER_NODE
ForwardingParameterNode.
Definition ast.h:742
@ PM_BLOCK_LOCAL_VARIABLE_NODE
BlockLocalVariableNode.
Definition ast.h:610
@ PM_HASH_NODE
HashNode.
Definition ast.h:766
@ PM_UNTIL_NODE
UntilNode.
Definition ast.h:1012
@ PM_MATCH_PREDICATE_NODE
MatchPredicateNode.
Definition ast.h:871
@ PM_X_STRING_NODE
XStringNode.
Definition ast.h:1021
@ PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE
LocalVariableOperatorWriteNode.
Definition ast.h:853
@ PM_LOCAL_VARIABLE_OR_WRITE_NODE
LocalVariableOrWriteNode.
Definition ast.h:856
@ PM_INSTANCE_VARIABLE_AND_WRITE_NODE
InstanceVariableAndWriteNode.
Definition ast.h:799
@ PM_GLOBAL_VARIABLE_TARGET_NODE
GlobalVariableTargetNode.
Definition ast.h:760
@ PM_AND_NODE
AndNode.
Definition ast.h:583
@ PM_CONSTANT_TARGET_NODE
ConstantTargetNode.
Definition ast.h:700
@ PM_IT_LOCAL_VARIABLE_READ_NODE
ItLocalVariableReadNode.
Definition ast.h:835
@ PM_CONSTANT_PATH_AND_WRITE_NODE
ConstantPathAndWriteNode.
Definition ast.h:679
@ PM_IN_NODE
InNode.
Definition ast.h:784
@ PM_BLOCK_PARAMETER_NODE
BlockParameterNode.
Definition ast.h:616
@ PM_CAPTURE_PATTERN_NODE
CapturePatternNode.
Definition ast.h:640
@ PM_SOURCE_FILE_NODE
SourceFileNode.
Definition ast.h:982
@ PM_NO_KEYWORDS_PARAMETER_NODE
NoKeywordsParameterNode.
Definition ast.h:898
@ PM_CONSTANT_PATH_OPERATOR_WRITE_NODE
ConstantPathOperatorWriteNode.
Definition ast.h:685
@ PM_MULTI_TARGET_NODE
MultiTargetNode.
Definition ast.h:886
@ PM_SPLAT_NODE
SplatNode.
Definition ast.h:988
@ PM_LAMBDA_NODE
LambdaNode.
Definition ast.h:847
@ PM_CLASS_VARIABLE_READ_NODE
ClassVariableReadNode.
Definition ast.h:661
@ PM_REQUIRED_KEYWORD_PARAMETER_NODE
RequiredKeywordParameterNode.
Definition ast.h:949
@ PM_CALL_TARGET_NODE
CallTargetNode.
Definition ast.h:637
@ PM_ELSE_NODE
ElseNode.
Definition ast.h:712
@ PM_INTERPOLATED_MATCH_LAST_LINE_NODE
InterpolatedMatchLastLineNode.
Definition ast.h:820
@ PM_WHEN_NODE
WhenNode.
Definition ast.h:1015
@ PM_NUMBERED_PARAMETERS_NODE
NumberedParametersNode.
Definition ast.h:901
@ PM_SYMBOL_NODE
SymbolNode.
Definition ast.h:1000
@ PM_RESCUE_MODIFIER_NODE
RescueModifierNode.
Definition ast.h:955
@ PM_ALIAS_METHOD_NODE
AliasMethodNode.
Definition ast.h:577
@ PM_MATCH_REQUIRED_NODE
MatchRequiredNode.
Definition ast.h:874
@ PM_FORWARDING_ARGUMENTS_NODE
ForwardingArgumentsNode.
Definition ast.h:739
@ PM_BACK_REFERENCE_READ_NODE
BackReferenceReadNode.
Definition ast.h:601
@ PM_SCOPE_NODE
A special kind of node used for compilation.
Definition ast.h:1027
@ PM_BLOCK_ARGUMENT_NODE
BlockArgumentNode.
Definition ast.h:607
@ PM_MISSING_NODE
MissingNode.
Definition ast.h:880
@ PM_SELF_NODE
SelfNode.
Definition ast.h:970
@ PM_IMPLICIT_REST_NODE
ImplicitRestNode.
Definition ast.h:781
@ PM_TRUE_NODE
TrueNode.
Definition ast.h:1003
@ PM_ASSOC_SPLAT_NODE
AssocSplatNode.
Definition ast.h:598
@ PM_CLASS_VARIABLE_AND_WRITE_NODE
ClassVariableAndWriteNode.
Definition ast.h:652
@ PM_RANGE_NODE
RangeNode.
Definition ast.h:937
@ PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE
InstanceVariableOperatorWriteNode.
Definition ast.h:802
@ PM_LOCAL_VARIABLE_READ_NODE
LocalVariableReadNode.
Definition ast.h:859
@ PM_SHAREABLE_CONSTANT_NODE
ShareableConstantNode.
Definition ast.h:973
@ PM_NEXT_NODE
NextNode.
Definition ast.h:892
@ PM_INSTANCE_VARIABLE_OR_WRITE_NODE
InstanceVariableOrWriteNode.
Definition ast.h:805
@ PM_REGULAR_EXPRESSION_NODE
RegularExpressionNode.
Definition ast.h:946
@ PM_CLASS_VARIABLE_OR_WRITE_NODE
ClassVariableOrWriteNode.
Definition ast.h:658
@ PM_BLOCK_PARAMETERS_NODE
BlockParametersNode.
Definition ast.h:619
@ PM_CONSTANT_WRITE_NODE
ConstantWriteNode.
Definition ast.h:703
@ PM_HASH_PATTERN_NODE
HashPatternNode.
Definition ast.h:769
@ PM_INDEX_OPERATOR_WRITE_NODE
IndexOperatorWriteNode.
Definition ast.h:790
@ PM_UNDEF_NODE
UndefNode.
Definition ast.h:1006
@ PM_ALTERNATION_PATTERN_NODE
AlternationPatternNode.
Definition ast.h:580
@ PM_ENSURE_NODE
EnsureNode.
Definition ast.h:721
@ PM_LOCAL_VARIABLE_WRITE_NODE
LocalVariableWriteNode.
Definition ast.h:865
@ PM_SINGLETON_CLASS_NODE
SingletonClassNode.
Definition ast.h:976
@ PM_KEYWORD_HASH_NODE
KeywordHashNode.
Definition ast.h:841
@ PM_PARENTHESES_NODE
ParenthesesNode.
Definition ast.h:919
@ PM_FOR_NODE
ForNode.
Definition ast.h:736
@ PM_CLASS_VARIABLE_WRITE_NODE
ClassVariableWriteNode.
Definition ast.h:667
@ PM_POST_EXECUTION_NODE
PostExecutionNode.
Definition ast.h:928
@ PM_CONSTANT_OPERATOR_WRITE_NODE
ConstantOperatorWriteNode.
Definition ast.h:673
@ PM_RETURN_NODE
ReturnNode.
Definition ast.h:967
@ PM_MODULE_NODE
ModuleNode.
Definition ast.h:883
@ PM_ARRAY_PATTERN_NODE
ArrayPatternNode.
Definition ast.h:592
@ PM_SUPER_NODE
SuperNode.
Definition ast.h:997
@ PM_MATCH_LAST_LINE_NODE
MatchLastLineNode.
Definition ast.h:868
@ PM_CONSTANT_PATH_NODE
ConstantPathNode.
Definition ast.h:682
@ PM_INTERPOLATED_SYMBOL_NODE
InterpolatedSymbolNode.
Definition ast.h:829
@ PM_CALL_AND_WRITE_NODE
CallAndWriteNode.
Definition ast.h:625
@ PM_OPTIONAL_KEYWORD_PARAMETER_NODE
OptionalKeywordParameterNode.
Definition ast.h:907
@ PM_CLASS_VARIABLE_TARGET_NODE
ClassVariableTargetNode.
Definition ast.h:664
@ PM_CASE_MATCH_NODE
CaseMatchNode.
Definition ast.h:643
@ PM_BREAK_NODE
BreakNode.
Definition ast.h:622
@ PM_CALL_OR_WRITE_NODE
CallOrWriteNode.
Definition ast.h:634
@ PM_IMAGINARY_NODE
ImaginaryNode.
Definition ast.h:775
@ PM_DEF_NODE
DefNode.
Definition ast.h:706
@ PM_CONSTANT_READ_NODE
ConstantReadNode.
Definition ast.h:697
@ PM_GLOBAL_VARIABLE_WRITE_NODE
GlobalVariableWriteNode.
Definition ast.h:763
@ PM_SOURCE_ENCODING_NODE
SourceEncodingNode.
Definition ast.h:979
@ PM_BEGIN_NODE
BeginNode.
Definition ast.h:604
@ PM_INTERPOLATED_X_STRING_NODE
InterpolatedXStringNode.
Definition ast.h:832
@ PM_INSTANCE_VARIABLE_READ_NODE
InstanceVariableReadNode.
Definition ast.h:808
@ PM_FLIP_FLOP_NODE
FlipFlopNode.
Definition ast.h:730
@ PM_PINNED_VARIABLE_NODE
PinnedVariableNode.
Definition ast.h:925
@ PM_REQUIRED_PARAMETER_NODE
RequiredParameterNode.
Definition ast.h:952
@ PM_INSTANCE_VARIABLE_WRITE_NODE
InstanceVariableWriteNode.
Definition ast.h:814
@ PM_INSTANCE_VARIABLE_TARGET_NODE
InstanceVariableTargetNode.
Definition ast.h:811
@ PM_GLOBAL_VARIABLE_AND_WRITE_NODE
GlobalVariableAndWriteNode.
Definition ast.h:748
@ PM_CASE_NODE
CaseNode.
Definition ast.h:646
@ PM_RESCUE_NODE
RescueNode.
Definition ast.h:958
@ PM_FLOAT_NODE
FloatNode.
Definition ast.h:733
@ PM_ASSOC_NODE
AssocNode.
Definition ast.h:595
@ PM_IT_PARAMETERS_NODE
ItParametersNode.
Definition ast.h:838
@ PM_INTEGER_NODE
IntegerNode.
Definition ast.h:817
@ PM_LOCAL_VARIABLE_TARGET_NODE
LocalVariableTargetNode.
Definition ast.h:862
@ PM_STRING_NODE
StringNode.
Definition ast.h:994
@ PM_INDEX_OR_WRITE_NODE
IndexOrWriteNode.
Definition ast.h:793
@ PM_ALIAS_GLOBAL_VARIABLE_NODE
AliasGlobalVariableNode.
Definition ast.h:574
@ PM_PARAMETERS_NODE
ParametersNode.
Definition ast.h:916
@ PM_NUMBERED_REFERENCE_READ_NODE
NumberedReferenceReadNode.
Definition ast.h:904
@ PM_CONSTANT_PATH_OR_WRITE_NODE
ConstantPathOrWriteNode.
Definition ast.h:688
@ PM_GLOBAL_VARIABLE_OR_WRITE_NODE
GlobalVariableOrWriteNode.
Definition ast.h:754
@ PM_CONSTANT_OR_WRITE_NODE
ConstantOrWriteNode.
Definition ast.h:676
@ PM_STATEMENTS_NODE
StatementsNode.
Definition ast.h:991
@ PM_OPTIONAL_PARAMETER_NODE
OptionalParameterNode.
Definition ast.h:910
@ PM_PINNED_EXPRESSION_NODE
PinnedExpressionNode.
Definition ast.h:922
@ PM_BLOCK_NODE
BlockNode.
Definition ast.h:613
@ PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE
ClassVariableOperatorWriteNode.
Definition ast.h:655
@ PM_REST_PARAMETER_NODE
RestParameterNode.
Definition ast.h:961
@ PM_EMBEDDED_STATEMENTS_NODE
EmbeddedStatementsNode.
Definition ast.h:715
@ PM_INTERPOLATED_REGULAR_EXPRESSION_NODE
InterpolatedRegularExpressionNode.
Definition ast.h:823
@ PM_INDEX_TARGET_NODE
IndexTargetNode.
Definition ast.h:796
@ PM_KEYWORD_REST_PARAMETER_NODE
KeywordRestParameterNode.
Definition ast.h:844
@ PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING
internal bytes forced the encoding to UTF-8
Definition ast.h:7931
@ PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING
internal bytes forced the encoding to US-ASCII
Definition ast.h:7937
@ PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING
internal bytes forced the encoding to binary
Definition ast.h:7934
@ PM_STRING_FLAGS_FROZEN
frozen by virtue of a frozen_string_literal: true comment or --enable-frozen-string-literal
Definition ast.h:7920
@ PM_STRING_FLAGS_FORCED_BINARY_ENCODING
internal bytes forced the encoding to binary
Definition ast.h:7917
@ PM_STRING_FLAGS_MUTABLE
mutable by virtue of a frozen_string_literal: false comment or --disable-frozen-string-literal
Definition ast.h:7923
@ PM_STRING_FLAGS_FORCED_UTF8_ENCODING
internal bytes forced the encoding to UTF-8
Definition ast.h:7914
@ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT
if the arguments contain a splat
Definition ast.h:7755
@ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING
if the arguments contain forwarding
Definition ast.h:7746
@ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS
if the arguments contain keywords
Definition ast.h:7749
@ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT
if the arguments contain a keyword splat
Definition ast.h:7752
@ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS
if the arguments contain multiple splats
Definition ast.h:7758
#define PM_NODE_FLAG_P(node, flag)
Return true if the given flag is set on the given node.
Definition ast.h:1063
#define PM_NODE_TYPE(node)
Cast the type to an enum to allow the compiler to provide exhaustiveness checking.
Definition ast.h:1053
@ PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT
if array contains splat nodes
Definition ast.h:7766
@ PM_INTEGER_BASE_FLAGS_HEXADECIMAL
0x prefix
Definition ast.h:7811
@ PM_INTEGER_BASE_FLAGS_OCTAL
0o or 0 prefix
Definition ast.h:7808
@ PM_INTEGER_BASE_FLAGS_DECIMAL
0d or no prefix
Definition ast.h:7805
@ PM_INTEGER_BASE_FLAGS_BINARY
0b prefix
Definition ast.h:7802
@ PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY
a call that ignores method visibility
Definition ast.h:7783
@ PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
&.
Definition ast.h:7774
@ PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE
a call that is an attribute write, so the value being written should be returned
Definition ast.h:7780
@ PM_CALL_NODE_FLAGS_VARIABLE_CALL
a call that could have been a local variable
Definition ast.h:7777
@ PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING
constant writes that should be modified with shareable constant value experimental everything
Definition ast.h:7903
@ PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL
constant writes that should be modified with shareable constant value literal
Definition ast.h:7900
@ PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY
constant writes that should be modified with shareable constant value experimental copy
Definition ast.h:7906
uint16_t pm_node_type_t
This is the type of node embedded in the node struct.
Definition ast.h:1034
@ PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS
a keyword hash which only has AssocNode elements all with symbol keys, which means the elements can b...
Definition ast.h:7830
struct pm_node_list pm_node_list_t
A list of nodes in the source, most often used for lists of children.
@ PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING
internal bytes forced the encoding to binary
Definition ast.h:7889
@ PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING
internal bytes forced the encoding to US-ASCII
Definition ast.h:7892
@ PM_REGULAR_EXPRESSION_FLAGS_EUC_JP
e - forces the EUC-JP encoding
Definition ast.h:7874
@ PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
i - ignores the case of characters when matching
Definition ast.h:7862
@ PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING
internal bytes forced the encoding to UTF-8
Definition ast.h:7886
@ PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
n - forces the ASCII-8BIT encoding
Definition ast.h:7877
@ PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE
m - allows $ to match the end of lines within strings
Definition ast.h:7868
@ PM_REGULAR_EXPRESSION_FLAGS_EXTENDED
x - ignores whitespace and allows comments in regular expressions
Definition ast.h:7865
@ PM_REGULAR_EXPRESSION_FLAGS_ONCE
o - only interpolates values into the regular expression once
Definition ast.h:7871
@ PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
s - forces the Windows-31J encoding
Definition ast.h:7880
@ PM_REGULAR_EXPRESSION_FLAGS_UTF_8
u - forces the UTF-8 encoding
Definition ast.h:7883
@ PM_PARAMETER_FLAGS_REPEATED_PARAMETER
a parameter name that has been repeated in the method signature
Definition ast.h:7846
@ PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING
internal bytes forced the encoding to binary
Definition ast.h:7794
@ PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING
internal bytes forced the encoding to UTF-8
Definition ast.h:7791
@ PM_LOOP_FLAGS_BEGIN_MODIFIER
a loop after a begin statement, so the body is executed first before the condition
Definition ast.h:7838
#define xfree
Old name of ruby_xfree.
Definition xmalloc.h:58
#define xrealloc
Old name of ruby_xrealloc.
Definition xmalloc.h:56
#define PM_CONSTANT_ID_UNSET
When we allocate constants into the pool, we reserve 0 to mean that the slot is not yet filled.
uint32_t pm_constant_id_t
A constant id is a unique identifier for a constant in the constant pool.
#define PRISM_EXPORTED_FUNCTION
By default, we compile with -fvisibility=hidden.
Definition defines.h:53
Functions related to nodes in the AST.
#define PM_NODE_LIST_FOREACH(list, index, node)
Loop through each node in the node list, writing each node to the given pm_node_t pointer.
Definition node.h:17
AliasGlobalVariableNode.
Definition ast.h:1107
struct pm_node * old_name
AliasGlobalVariableNode::old_name.
Definition ast.h:1130
pm_node_t base
The embedded base node.
Definition ast.h:1109
struct pm_node * new_name
AliasGlobalVariableNode::new_name.
Definition ast.h:1120
pm_location_t keyword_loc
AliasGlobalVariableNode::keyword_loc.
Definition ast.h:1140
AliasMethodNode.
Definition ast.h:1155
struct pm_node * old_name
AliasMethodNode::old_name.
Definition ast.h:1190
struct pm_node * new_name
AliasMethodNode::new_name.
Definition ast.h:1174
pm_node_t base
The embedded base node.
Definition ast.h:1157
pm_location_t keyword_loc
AliasMethodNode::keyword_loc.
Definition ast.h:1200
AlternationPatternNode.
Definition ast.h:1215
pm_location_t operator_loc
AlternationPatternNode::operator_loc.
Definition ast.h:1248
struct pm_node * left
AlternationPatternNode::left.
Definition ast.h:1228
struct pm_node * right
AlternationPatternNode::right.
Definition ast.h:1238
pm_node_t base
The embedded base node.
Definition ast.h:1217
AndNode.
Definition ast.h:1263
struct pm_node * left
AndNode::left.
Definition ast.h:1279
struct pm_node * right
AndNode::right.
Definition ast.h:1292
pm_location_t operator_loc
AndNode::operator_loc.
Definition ast.h:1302
pm_node_t base
The embedded base node.
Definition ast.h:1265
ArgumentsNode.
Definition ast.h:1324
pm_node_t base
The embedded base node.
Definition ast.h:1326
struct pm_node_list arguments
ArgumentsNode::arguments.
Definition ast.h:1337
ArrayNode.
Definition ast.h:1355
pm_node_t base
The embedded base node.
Definition ast.h:1357
pm_location_t closing_loc
ArrayNode::closing_loc.
Definition ast.h:1389
struct pm_node_list elements
ArrayNode::elements.
Definition ast.h:1365
pm_location_t opening_loc
ArrayNode::opening_loc.
Definition ast.h:1377
ArrayPatternNode.
Definition ast.h:1416
struct pm_node_list requireds
ArrayPatternNode::requireds.
Definition ast.h:1434
struct pm_node * rest
ArrayPatternNode::rest.
Definition ast.h:1444
struct pm_node * constant
ArrayPatternNode::constant.
Definition ast.h:1424
pm_location_t opening_loc
ArrayPatternNode::opening_loc.
Definition ast.h:1464
pm_node_t base
The embedded base node.
Definition ast.h:1418
pm_location_t closing_loc
ArrayPatternNode::closing_loc.
Definition ast.h:1474
struct pm_node_list posts
ArrayPatternNode::posts.
Definition ast.h:1454
AssocNode.
Definition ast.h:1489
pm_node_t base
The embedded base node.
Definition ast.h:1491
struct pm_node * value
AssocNode::value.
Definition ast.h:1521
struct pm_node * key
AssocNode::key.
Definition ast.h:1508
pm_location_t operator_loc
AssocNode::operator_loc.
Definition ast.h:1531
AssocSplatNode.
Definition ast.h:1546
struct pm_node * value
AssocSplatNode::value.
Definition ast.h:1559
pm_node_t base
The embedded base node.
Definition ast.h:1548
pm_location_t operator_loc
AssocSplatNode::operator_loc.
Definition ast.h:1569
BackReferenceReadNode.
Definition ast.h:1584
pm_constant_id_t name
BackReferenceReadNode::name.
Definition ast.h:1598
pm_node_t base
The embedded base node.
Definition ast.h:1586
BeginNode.
Definition ast.h:1615
struct pm_ensure_node * ensure_clause
BeginNode::ensure_clause.
Definition ast.h:1668
struct pm_rescue_node * rescue_clause
BeginNode::rescue_clause.
Definition ast.h:1648
struct pm_statements_node * statements
BeginNode::statements.
Definition ast.h:1638
pm_node_t base
The embedded base node.
Definition ast.h:1617
pm_location_t end_keyword_loc
BeginNode::end_keyword_loc.
Definition ast.h:1678
pm_location_t begin_keyword_loc
BeginNode::begin_keyword_loc.
Definition ast.h:1628
struct pm_else_node * else_clause
BeginNode::else_clause.
Definition ast.h:1658
BlockArgumentNode.
Definition ast.h:1693
pm_node_t base
The embedded base node.
Definition ast.h:1695
struct pm_node * expression
BlockArgumentNode::expression.
Definition ast.h:1706
pm_location_t operator_loc
BlockArgumentNode::operator_loc.
Definition ast.h:1716
BlockLocalVariableNode.
Definition ast.h:1734
pm_node_t base
The embedded base node.
Definition ast.h:1736
pm_constant_id_t name
BlockLocalVariableNode::name.
Definition ast.h:1747
BlockNode.
Definition ast.h:1762
pm_node_t base
The embedded base node.
Definition ast.h:1764
pm_location_t closing_loc
BlockNode::closing_loc.
Definition ast.h:1819
struct pm_node * parameters
BlockNode::parameters.
Definition ast.h:1789
pm_location_t opening_loc
BlockNode::opening_loc.
Definition ast.h:1809
struct pm_node * body
BlockNode::body.
Definition ast.h:1799
pm_constant_id_list_t locals
BlockNode::locals.
Definition ast.h:1775
BlockParameterNode.
Definition ast.h:1838
pm_location_t operator_loc
BlockParameterNode::operator_loc.
Definition ast.h:1873
pm_location_t name_loc
BlockParameterNode::name_loc.
Definition ast.h:1862
pm_constant_id_t name
BlockParameterNode::name.
Definition ast.h:1852
pm_node_t base
The embedded base node.
Definition ast.h:1840
BlockParametersNode.
Definition ast.h:1892
struct pm_parameters_node * parameters
BlockParametersNode::parameters.
Definition ast.h:1909
pm_node_t base
The embedded base node.
Definition ast.h:1894
struct pm_node_list locals
BlockParametersNode::locals.
Definition ast.h:1923
pm_location_t closing_loc
BlockParametersNode::closing_loc.
Definition ast.h:1951
pm_location_t opening_loc
BlockParametersNode::opening_loc.
Definition ast.h:1937
BreakNode.
Definition ast.h:1966
struct pm_arguments_node * arguments
BreakNode::arguments.
Definition ast.h:1979
pm_location_t keyword_loc
BreakNode::keyword_loc.
Definition ast.h:1989
pm_node_t base
The embedded base node.
Definition ast.h:1968
A pm_buffer_t is a simple memory buffer that stores data in a contiguous block of memory.
Definition pm_buffer.h:22
CallAndWriteNode.
Definition ast.h:2010
pm_location_t operator_loc
CallAndWriteNode::operator_loc.
Definition ast.h:2073
struct pm_node * value
CallAndWriteNode::value.
Definition ast.h:2083
pm_node_t base
The embedded base node.
Definition ast.h:2012
pm_location_t call_operator_loc
CallAndWriteNode::call_operator_loc.
Definition ast.h:2033
pm_location_t message_loc
CallAndWriteNode::message_loc.
Definition ast.h:2043
pm_constant_id_t read_name
CallAndWriteNode::read_name.
Definition ast.h:2053
pm_constant_id_t write_name
CallAndWriteNode::write_name.
Definition ast.h:2063
struct pm_node * receiver
CallAndWriteNode::receiver.
Definition ast.h:2023
CallNode.
Definition ast.h:2119
pm_location_t opening_loc
CallNode::opening_loc.
Definition ast.h:2180
pm_location_t closing_loc
CallNode::closing_loc.
Definition ast.h:2200
struct pm_node * receiver
CallNode::receiver.
Definition ast.h:2138
pm_constant_id_t name
CallNode::name.
Definition ast.h:2161
pm_node_t base
The embedded base node.
Definition ast.h:2121
pm_location_t call_operator_loc
CallNode::call_operator_loc.
Definition ast.h:2151
pm_location_t message_loc
CallNode::message_loc.
Definition ast.h:2171
struct pm_arguments_node * arguments
CallNode::arguments.
Definition ast.h:2190
struct pm_node * block
CallNode::block.
Definition ast.h:2210
CallOperatorWriteNode.
Definition ast.h:2231
pm_constant_id_t read_name
CallOperatorWriteNode::read_name.
Definition ast.h:2274
pm_constant_id_t binary_operator
CallOperatorWriteNode::binary_operator.
Definition ast.h:2294
pm_location_t binary_operator_loc
CallOperatorWriteNode::binary_operator_loc.
Definition ast.h:2304
struct pm_node * receiver
CallOperatorWriteNode::receiver.
Definition ast.h:2244
pm_node_t base
The embedded base node.
Definition ast.h:2233
pm_constant_id_t write_name
CallOperatorWriteNode::write_name.
Definition ast.h:2284
pm_location_t message_loc
CallOperatorWriteNode::message_loc.
Definition ast.h:2264
struct pm_node * value
CallOperatorWriteNode::value.
Definition ast.h:2314
pm_location_t call_operator_loc
CallOperatorWriteNode::call_operator_loc.
Definition ast.h:2254
CallOrWriteNode.
Definition ast.h:2335
pm_location_t operator_loc
CallOrWriteNode::operator_loc.
Definition ast.h:2398
pm_location_t call_operator_loc
CallOrWriteNode::call_operator_loc.
Definition ast.h:2358
pm_node_t base
The embedded base node.
Definition ast.h:2337
struct pm_node * receiver
CallOrWriteNode::receiver.
Definition ast.h:2348
struct pm_node * value
CallOrWriteNode::value.
Definition ast.h:2408
pm_constant_id_t write_name
CallOrWriteNode::write_name.
Definition ast.h:2388
pm_constant_id_t read_name
CallOrWriteNode::read_name.
Definition ast.h:2378
pm_location_t message_loc
CallOrWriteNode::message_loc.
Definition ast.h:2368
CallTargetNode.
Definition ast.h:2437
pm_node_t base
The embedded base node.
Definition ast.h:2439
pm_constant_id_t name
CallTargetNode::name.
Definition ast.h:2470
struct pm_node * receiver
CallTargetNode::receiver.
Definition ast.h:2450
pm_location_t call_operator_loc
CallTargetNode::call_operator_loc.
Definition ast.h:2460
pm_location_t message_loc
CallTargetNode::message_loc.
Definition ast.h:2480
CapturePatternNode.
Definition ast.h:2495
struct pm_local_variable_target_node * target
CapturePatternNode::target.
Definition ast.h:2518
pm_location_t operator_loc
CapturePatternNode::operator_loc.
Definition ast.h:2528
struct pm_node * value
CapturePatternNode::value.
Definition ast.h:2508
pm_node_t base
The embedded base node.
Definition ast.h:2497
CaseMatchNode.
Definition ast.h:2545
pm_location_t end_keyword_loc
CaseMatchNode::end_keyword_loc.
Definition ast.h:2598
struct pm_node_list conditions
CaseMatchNode::conditions.
Definition ast.h:2568
pm_node_t base
The embedded base node.
Definition ast.h:2547
pm_location_t case_keyword_loc
CaseMatchNode::case_keyword_loc.
Definition ast.h:2588
struct pm_else_node * else_clause
CaseMatchNode::else_clause.
Definition ast.h:2578
struct pm_node * predicate
CaseMatchNode::predicate.
Definition ast.h:2558
CaseNode.
Definition ast.h:2615
struct pm_node * predicate
CaseNode::predicate.
Definition ast.h:2628
struct pm_else_node * else_clause
CaseNode::else_clause.
Definition ast.h:2648
struct pm_node_list conditions
CaseNode::conditions.
Definition ast.h:2638
pm_node_t base
The embedded base node.
Definition ast.h:2617
pm_location_t case_keyword_loc
CaseNode::case_keyword_loc.
Definition ast.h:2658
pm_location_t end_keyword_loc
CaseNode::end_keyword_loc.
Definition ast.h:2668
ClassNode.
Definition ast.h:2683
pm_location_t class_keyword_loc
ClassNode::class_keyword_loc.
Definition ast.h:2696
pm_location_t end_keyword_loc
ClassNode::end_keyword_loc.
Definition ast.h:2721
struct pm_node * constant_path
ClassNode::constant_path.
Definition ast.h:2701
pm_constant_id_list_t locals
ClassNode::locals.
Definition ast.h:2691
pm_location_t inheritance_operator_loc
ClassNode::inheritance_operator_loc.
Definition ast.h:2706
pm_constant_id_t name
ClassNode::name.
Definition ast.h:2726
pm_node_t base
The embedded base node.
Definition ast.h:2685
struct pm_node * body
ClassNode::body.
Definition ast.h:2716
struct pm_node * superclass
ClassNode::superclass.
Definition ast.h:2711
ClassVariableAndWriteNode.
Definition ast.h:2741
struct pm_node * value
ClassVariableAndWriteNode::value.
Definition ast.h:2784
pm_constant_id_t name
ClassVariableAndWriteNode::name.
Definition ast.h:2754
pm_location_t operator_loc
ClassVariableAndWriteNode::operator_loc.
Definition ast.h:2774
pm_node_t base
The embedded base node.
Definition ast.h:2743
pm_location_t name_loc
ClassVariableAndWriteNode::name_loc.
Definition ast.h:2764
ClassVariableOperatorWriteNode.
Definition ast.h:2799
pm_node_t base
The embedded base node.
Definition ast.h:2801
pm_constant_id_t name
ClassVariableOperatorWriteNode::name.
Definition ast.h:2807
pm_location_t name_loc
ClassVariableOperatorWriteNode::name_loc.
Definition ast.h:2812
pm_constant_id_t binary_operator
ClassVariableOperatorWriteNode::binary_operator.
Definition ast.h:2827
struct pm_node * value
ClassVariableOperatorWriteNode::value.
Definition ast.h:2822
pm_location_t binary_operator_loc
ClassVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:2817
ClassVariableOrWriteNode.
Definition ast.h:2842
pm_node_t base
The embedded base node.
Definition ast.h:2844
pm_location_t name_loc
ClassVariableOrWriteNode::name_loc.
Definition ast.h:2855
pm_location_t operator_loc
ClassVariableOrWriteNode::operator_loc.
Definition ast.h:2860
pm_constant_id_t name
ClassVariableOrWriteNode::name.
Definition ast.h:2850
struct pm_node * value
ClassVariableOrWriteNode::value.
Definition ast.h:2865
ClassVariableReadNode.
Definition ast.h:2880
pm_node_t base
The embedded base node.
Definition ast.h:2882
pm_constant_id_t name
ClassVariableReadNode::name.
Definition ast.h:2894
ClassVariableTargetNode.
Definition ast.h:2909
pm_node_t base
The embedded base node.
Definition ast.h:2911
pm_constant_id_t name
ClassVariableTargetNode::name.
Definition ast.h:2917
ClassVariableWriteNode.
Definition ast.h:2932
pm_location_t name_loc
ClassVariableWriteNode::name_loc.
Definition ast.h:2956
pm_node_t base
The embedded base node.
Definition ast.h:2934
struct pm_node * value
ClassVariableWriteNode::value.
Definition ast.h:2969
pm_location_t operator_loc
ClassVariableWriteNode::operator_loc.
Definition ast.h:2979
pm_constant_id_t name
ClassVariableWriteNode::name.
Definition ast.h:2946
ConstantAndWriteNode.
Definition ast.h:2994
pm_location_t operator_loc
ConstantAndWriteNode::operator_loc.
Definition ast.h:3012
pm_location_t name_loc
ConstantAndWriteNode::name_loc.
Definition ast.h:3007
pm_constant_id_t name
ConstantAndWriteNode::name.
Definition ast.h:3002
struct pm_node * value
ConstantAndWriteNode::value.
Definition ast.h:3017
pm_node_t base
The embedded base node.
Definition ast.h:2996
A list of constant IDs.
size_t size
The number of constant ids in the list.
pm_constant_id_t * ids
The constant ids in the list.
ConstantOperatorWriteNode.
Definition ast.h:3032
pm_constant_id_t name
ConstantOperatorWriteNode::name.
Definition ast.h:3040
pm_location_t name_loc
ConstantOperatorWriteNode::name_loc.
Definition ast.h:3045
pm_constant_id_t binary_operator
ConstantOperatorWriteNode::binary_operator.
Definition ast.h:3060
pm_location_t binary_operator_loc
ConstantOperatorWriteNode::binary_operator_loc.
Definition ast.h:3050
struct pm_node * value
ConstantOperatorWriteNode::value.
Definition ast.h:3055
pm_node_t base
The embedded base node.
Definition ast.h:3034
ConstantOrWriteNode.
Definition ast.h:3075
pm_location_t operator_loc
ConstantOrWriteNode::operator_loc.
Definition ast.h:3093
pm_location_t name_loc
ConstantOrWriteNode::name_loc.
Definition ast.h:3088
pm_constant_id_t name
ConstantOrWriteNode::name.
Definition ast.h:3083
pm_node_t base
The embedded base node.
Definition ast.h:3077
struct pm_node * value
ConstantOrWriteNode::value.
Definition ast.h:3098
ConstantPathAndWriteNode.
Definition ast.h:3113
pm_node_t base
The embedded base node.
Definition ast.h:3115
struct pm_constant_path_node * target
ConstantPathAndWriteNode::target.
Definition ast.h:3121
pm_location_t operator_loc
ConstantPathAndWriteNode::operator_loc.
Definition ast.h:3126
struct pm_node * value
ConstantPathAndWriteNode::value.
Definition ast.h:3131
ConstantPathNode.
Definition ast.h:3146
pm_location_t delimiter_loc
ConstantPathNode::delimiter_loc.
Definition ast.h:3185
pm_node_t base
The embedded base node.
Definition ast.h:3148
pm_location_t name_loc
ConstantPathNode::name_loc.
Definition ast.h:3198
pm_constant_id_t name
ConstantPathNode::name.
Definition ast.h:3172
struct pm_node * parent
ConstantPathNode::parent.
Definition ast.h:3165
ConstantPathOperatorWriteNode.
Definition ast.h:3213
struct pm_constant_path_node * target
ConstantPathOperatorWriteNode::target.
Definition ast.h:3221
struct pm_node * value
ConstantPathOperatorWriteNode::value.
Definition ast.h:3231
pm_constant_id_t binary_operator
ConstantPathOperatorWriteNode::binary_operator.
Definition ast.h:3236
pm_node_t base
The embedded base node.
Definition ast.h:3215
pm_location_t binary_operator_loc
ConstantPathOperatorWriteNode::binary_operator_loc.
Definition ast.h:3226
ConstantPathOrWriteNode.
Definition ast.h:3251
pm_location_t operator_loc
ConstantPathOrWriteNode::operator_loc.
Definition ast.h:3264
pm_node_t base
The embedded base node.
Definition ast.h:3253
struct pm_node * value
ConstantPathOrWriteNode::value.
Definition ast.h:3269
struct pm_constant_path_node * target
ConstantPathOrWriteNode::target.
Definition ast.h:3259
ConstantPathTargetNode.
Definition ast.h:3284
pm_node_t base
The embedded base node.
Definition ast.h:3286
struct pm_node * parent
ConstantPathTargetNode::parent.
Definition ast.h:3292
pm_location_t delimiter_loc
ConstantPathTargetNode::delimiter_loc.
Definition ast.h:3302
pm_constant_id_t name
ConstantPathTargetNode::name.
Definition ast.h:3297
pm_location_t name_loc
ConstantPathTargetNode::name_loc.
Definition ast.h:3307
ConstantPathWriteNode.
Definition ast.h:3328
struct pm_constant_path_node * target
ConstantPathWriteNode::target.
Definition ast.h:3344
pm_location_t operator_loc
ConstantPathWriteNode::operator_loc.
Definition ast.h:3354
pm_node_t base
The embedded base node.
Definition ast.h:3330
struct pm_node * value
ConstantPathWriteNode::value.
Definition ast.h:3364
ConstantReadNode.
Definition ast.h:3379
pm_node_t base
The embedded base node.
Definition ast.h:3381
pm_constant_id_t name
ConstantReadNode::name.
Definition ast.h:3393
A constant in the pool which effectively stores a string.
size_t length
The length of the string.
const uint8_t * start
A pointer to the start of the string.
ConstantTargetNode.
Definition ast.h:3408
pm_node_t base
The embedded base node.
Definition ast.h:3410
pm_constant_id_t name
ConstantTargetNode::name.
Definition ast.h:3416
ConstantWriteNode.
Definition ast.h:3431
pm_node_t base
The embedded base node.
Definition ast.h:3433
struct pm_node * value
ConstantWriteNode::value.
Definition ast.h:3468
pm_constant_id_t name
ConstantWriteNode::name.
Definition ast.h:3445
pm_location_t name_loc
ConstantWriteNode::name_loc.
Definition ast.h:3455
pm_location_t operator_loc
ConstantWriteNode::operator_loc.
Definition ast.h:3478
DefNode.
Definition ast.h:3494
struct pm_parameters_node * parameters
DefNode::parameters.
Definition ast.h:3517
pm_location_t end_keyword_loc
DefNode::end_keyword_loc.
Definition ast.h:3557
pm_constant_id_t name
DefNode::name.
Definition ast.h:3502
pm_location_t name_loc
DefNode::name_loc.
Definition ast.h:3507
pm_location_t rparen_loc
DefNode::rparen_loc.
Definition ast.h:3547
struct pm_node * body
DefNode::body.
Definition ast.h:3522
pm_location_t equal_loc
DefNode::equal_loc.
Definition ast.h:3552
pm_location_t def_keyword_loc
DefNode::def_keyword_loc.
Definition ast.h:3532
struct pm_node * receiver
DefNode::receiver.
Definition ast.h:3512
pm_node_t base
The embedded base node.
Definition ast.h:3496
pm_location_t lparen_loc
DefNode::lparen_loc.
Definition ast.h:3542
pm_location_t operator_loc
DefNode::operator_loc.
Definition ast.h:3537
pm_constant_id_list_t locals
DefNode::locals.
Definition ast.h:3527
DefinedNode.
Definition ast.h:3572
pm_location_t lparen_loc
DefinedNode::lparen_loc.
Definition ast.h:3580
pm_node_t base
The embedded base node.
Definition ast.h:3574
pm_location_t rparen_loc
DefinedNode::rparen_loc.
Definition ast.h:3590
pm_location_t keyword_loc
DefinedNode::keyword_loc.
Definition ast.h:3595
struct pm_node * value
DefinedNode::value.
Definition ast.h:3585
ElseNode.
Definition ast.h:3610
struct pm_statements_node * statements
ElseNode::statements.
Definition ast.h:3623
pm_location_t else_keyword_loc
ElseNode::else_keyword_loc.
Definition ast.h:3618
pm_node_t base
The embedded base node.
Definition ast.h:3612
pm_location_t end_keyword_loc
ElseNode::end_keyword_loc.
Definition ast.h:3628
EmbeddedStatementsNode.
Definition ast.h:3643
pm_location_t closing_loc
EmbeddedStatementsNode::closing_loc.
Definition ast.h:3661
struct pm_statements_node * statements
EmbeddedStatementsNode::statements.
Definition ast.h:3656
pm_node_t base
The embedded base node.
Definition ast.h:3645
pm_location_t opening_loc
EmbeddedStatementsNode::opening_loc.
Definition ast.h:3651
EmbeddedVariableNode.
Definition ast.h:3676
struct pm_node * variable
EmbeddedVariableNode::variable.
Definition ast.h:3689
pm_location_t operator_loc
EmbeddedVariableNode::operator_loc.
Definition ast.h:3684
pm_node_t base
The embedded base node.
Definition ast.h:3678
EnsureNode.
Definition ast.h:3708
struct pm_statements_node * statements
EnsureNode::statements.
Definition ast.h:3721
pm_node_t base
The embedded base node.
Definition ast.h:3710
pm_location_t ensure_keyword_loc
EnsureNode::ensure_keyword_loc.
Definition ast.h:3716
pm_location_t end_keyword_loc
EnsureNode::end_keyword_loc.
Definition ast.h:3726
FalseNode.
Definition ast.h:3741
pm_node_t base
The embedded base node.
Definition ast.h:3743
FindPatternNode.
Definition ast.h:3765
struct pm_node * constant
FindPatternNode::constant.
Definition ast.h:3773
struct pm_node * right
FindPatternNode::right.
Definition ast.h:3788
pm_location_t opening_loc
FindPatternNode::opening_loc.
Definition ast.h:3793
pm_node_t base
The embedded base node.
Definition ast.h:3767
struct pm_node_list requireds
FindPatternNode::requireds.
Definition ast.h:3783
struct pm_splat_node * left
FindPatternNode::left.
Definition ast.h:3778
pm_location_t closing_loc
FindPatternNode::closing_loc.
Definition ast.h:3798
FlipFlopNode.
Definition ast.h:3816
pm_node_t base
The embedded base node.
Definition ast.h:3818
pm_location_t operator_loc
FlipFlopNode::operator_loc.
Definition ast.h:3834
struct pm_node * left
FlipFlopNode::left.
Definition ast.h:3824
struct pm_node * right
FlipFlopNode::right.
Definition ast.h:3829
FloatNode.
Definition ast.h:3849
double value
FloatNode::value.
Definition ast.h:3859
pm_node_t base
The embedded base node.
Definition ast.h:3851
ForNode.
Definition ast.h:3874
struct pm_statements_node * statements
ForNode::statements.
Definition ast.h:3909
struct pm_node * index
ForNode::index.
Definition ast.h:3887
struct pm_node * collection
ForNode::collection.
Definition ast.h:3897
pm_node_t base
The embedded base node.
Definition ast.h:3876
pm_location_t end_keyword_loc
ForNode::end_keyword_loc.
Definition ast.h:3949
pm_location_t for_keyword_loc
ForNode::for_keyword_loc.
Definition ast.h:3919
pm_location_t do_keyword_loc
ForNode::do_keyword_loc.
Definition ast.h:3939
pm_location_t in_keyword_loc
ForNode::in_keyword_loc.
Definition ast.h:3929
ForwardingArgumentsNode.
Definition ast.h:3966
pm_node_t base
The embedded base node.
Definition ast.h:3968
ForwardingParameterNode.
Definition ast.h:3985
pm_node_t base
The embedded base node.
Definition ast.h:3987
ForwardingSuperNode.
Definition ast.h:4003
pm_node_t base
The embedded base node.
Definition ast.h:4005
struct pm_block_node * block
ForwardingSuperNode::block.
Definition ast.h:4011
GlobalVariableAndWriteNode.
Definition ast.h:4026
pm_location_t operator_loc
GlobalVariableAndWriteNode::operator_loc.
Definition ast.h:4044
pm_node_t base
The embedded base node.
Definition ast.h:4028
pm_location_t name_loc
GlobalVariableAndWriteNode::name_loc.
Definition ast.h:4039
struct pm_node * value
GlobalVariableAndWriteNode::value.
Definition ast.h:4049
pm_constant_id_t name
GlobalVariableAndWriteNode::name.
Definition ast.h:4034
GlobalVariableOperatorWriteNode.
Definition ast.h:4064
pm_constant_id_t name
GlobalVariableOperatorWriteNode::name.
Definition ast.h:4072
pm_constant_id_t binary_operator
GlobalVariableOperatorWriteNode::binary_operator.
Definition ast.h:4092
struct pm_node * value
GlobalVariableOperatorWriteNode::value.
Definition ast.h:4087
pm_location_t name_loc
GlobalVariableOperatorWriteNode::name_loc.
Definition ast.h:4077
pm_node_t base
The embedded base node.
Definition ast.h:4066
pm_location_t binary_operator_loc
GlobalVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:4082
GlobalVariableOrWriteNode.
Definition ast.h:4107
pm_constant_id_t name
GlobalVariableOrWriteNode::name.
Definition ast.h:4115
pm_location_t name_loc
GlobalVariableOrWriteNode::name_loc.
Definition ast.h:4120
pm_node_t base
The embedded base node.
Definition ast.h:4109
pm_location_t operator_loc
GlobalVariableOrWriteNode::operator_loc.
Definition ast.h:4125
struct pm_node * value
GlobalVariableOrWriteNode::value.
Definition ast.h:4130
GlobalVariableReadNode.
Definition ast.h:4145
pm_node_t base
The embedded base node.
Definition ast.h:4147
pm_constant_id_t name
GlobalVariableReadNode::name.
Definition ast.h:4159
GlobalVariableTargetNode.
Definition ast.h:4174
pm_constant_id_t name
GlobalVariableTargetNode::name.
Definition ast.h:4182
pm_node_t base
The embedded base node.
Definition ast.h:4176
GlobalVariableWriteNode.
Definition ast.h:4197
struct pm_node * value
GlobalVariableWriteNode::value.
Definition ast.h:4234
pm_location_t name_loc
GlobalVariableWriteNode::name_loc.
Definition ast.h:4221
pm_location_t operator_loc
GlobalVariableWriteNode::operator_loc.
Definition ast.h:4244
pm_constant_id_t name
GlobalVariableWriteNode::name.
Definition ast.h:4211
pm_node_t base
The embedded base node.
Definition ast.h:4199
HashNode.
Definition ast.h:4259
struct pm_node_list elements
HashNode::elements.
Definition ast.h:4285
pm_node_t base
The embedded base node.
Definition ast.h:4261
pm_location_t closing_loc
HashNode::closing_loc.
Definition ast.h:4295
pm_location_t opening_loc
HashNode::opening_loc.
Definition ast.h:4272
HashPatternNode.
Definition ast.h:4313
struct pm_node_list elements
HashPatternNode::elements.
Definition ast.h:4326
pm_location_t opening_loc
HashPatternNode::opening_loc.
Definition ast.h:4336
pm_node_t base
The embedded base node.
Definition ast.h:4315
struct pm_node * rest
HashPatternNode::rest.
Definition ast.h:4331
pm_location_t closing_loc
HashPatternNode::closing_loc.
Definition ast.h:4341
struct pm_node * constant
HashPatternNode::constant.
Definition ast.h:4321
IfNode.
Definition ast.h:4362
struct pm_node * predicate
IfNode::predicate.
Definition ast.h:4395
pm_location_t end_keyword_loc
IfNode::end_keyword_loc.
Definition ast.h:4453
pm_location_t if_keyword_loc
IfNode::if_keyword_loc.
Definition ast.h:4377
struct pm_statements_node * statements
IfNode::statements.
Definition ast.h:4422
pm_node_t base
The embedded base node.
Definition ast.h:4364
struct pm_node * subsequent
IfNode::subsequent.
Definition ast.h:4441
pm_location_t then_keyword_loc
IfNode::then_keyword_loc.
Definition ast.h:4408
ImaginaryNode.
Definition ast.h:4468
struct pm_node * numeric
ImaginaryNode::numeric.
Definition ast.h:4476
pm_node_t base
The embedded base node.
Definition ast.h:4470
ImplicitNode.
Definition ast.h:4497
struct pm_node * value
ImplicitNode::value.
Definition ast.h:4505
pm_node_t base
The embedded base node.
Definition ast.h:4499
ImplicitRestNode.
Definition ast.h:4529
pm_node_t base
The embedded base node.
Definition ast.h:4531
InNode.
Definition ast.h:4547
struct pm_statements_node * statements
InNode::statements.
Definition ast.h:4560
struct pm_node * pattern
InNode::pattern.
Definition ast.h:4555
pm_node_t base
The embedded base node.
Definition ast.h:4549
pm_location_t then_loc
InNode::then_loc.
Definition ast.h:4570
pm_location_t in_loc
InNode::in_loc.
Definition ast.h:4565
IndexAndWriteNode.
Definition ast.h:4591
struct pm_arguments_node * arguments
IndexAndWriteNode::arguments.
Definition ast.h:4614
struct pm_node * receiver
IndexAndWriteNode::receiver.
Definition ast.h:4599
pm_node_t base
The embedded base node.
Definition ast.h:4593
struct pm_block_argument_node * block
IndexAndWriteNode::block.
Definition ast.h:4624
struct pm_node * value
IndexAndWriteNode::value.
Definition ast.h:4634
pm_location_t operator_loc
IndexAndWriteNode::operator_loc.
Definition ast.h:4629
pm_location_t closing_loc
IndexAndWriteNode::closing_loc.
Definition ast.h:4619
pm_location_t opening_loc
IndexAndWriteNode::opening_loc.
Definition ast.h:4609
pm_location_t call_operator_loc
IndexAndWriteNode::call_operator_loc.
Definition ast.h:4604
IndexOperatorWriteNode.
Definition ast.h:4655
pm_node_t base
The embedded base node.
Definition ast.h:4657
struct pm_block_argument_node * block
IndexOperatorWriteNode::block.
Definition ast.h:4688
pm_location_t binary_operator_loc
IndexOperatorWriteNode::binary_operator_loc.
Definition ast.h:4698
struct pm_node * value
IndexOperatorWriteNode::value.
Definition ast.h:4703
pm_location_t opening_loc
IndexOperatorWriteNode::opening_loc.
Definition ast.h:4673
pm_location_t call_operator_loc
IndexOperatorWriteNode::call_operator_loc.
Definition ast.h:4668
pm_location_t closing_loc
IndexOperatorWriteNode::closing_loc.
Definition ast.h:4683
struct pm_arguments_node * arguments
IndexOperatorWriteNode::arguments.
Definition ast.h:4678
pm_constant_id_t binary_operator
IndexOperatorWriteNode::binary_operator.
Definition ast.h:4693
struct pm_node * receiver
IndexOperatorWriteNode::receiver.
Definition ast.h:4663
IndexOrWriteNode.
Definition ast.h:4724
pm_location_t closing_loc
IndexOrWriteNode::closing_loc.
Definition ast.h:4752
pm_location_t call_operator_loc
IndexOrWriteNode::call_operator_loc.
Definition ast.h:4737
pm_node_t base
The embedded base node.
Definition ast.h:4726
struct pm_block_argument_node * block
IndexOrWriteNode::block.
Definition ast.h:4757
pm_location_t operator_loc
IndexOrWriteNode::operator_loc.
Definition ast.h:4762
struct pm_node * receiver
IndexOrWriteNode::receiver.
Definition ast.h:4732
pm_location_t opening_loc
IndexOrWriteNode::opening_loc.
Definition ast.h:4742
struct pm_node * value
IndexOrWriteNode::value.
Definition ast.h:4767
struct pm_arguments_node * arguments
IndexOrWriteNode::arguments.
Definition ast.h:4747
IndexTargetNode.
Definition ast.h:4796
pm_node_t base
The embedded base node.
Definition ast.h:4798
struct pm_node * receiver
IndexTargetNode::receiver.
Definition ast.h:4804
pm_location_t closing_loc
IndexTargetNode::closing_loc.
Definition ast.h:4819
struct pm_arguments_node * arguments
IndexTargetNode::arguments.
Definition ast.h:4814
pm_location_t opening_loc
IndexTargetNode::opening_loc.
Definition ast.h:4809
struct pm_block_argument_node * block
IndexTargetNode::block.
Definition ast.h:4824
InstanceVariableAndWriteNode.
Definition ast.h:4839
pm_location_t operator_loc
InstanceVariableAndWriteNode::operator_loc.
Definition ast.h:4857
pm_location_t name_loc
InstanceVariableAndWriteNode::name_loc.
Definition ast.h:4852
struct pm_node * value
InstanceVariableAndWriteNode::value.
Definition ast.h:4862
pm_node_t base
The embedded base node.
Definition ast.h:4841
pm_constant_id_t name
InstanceVariableAndWriteNode::name.
Definition ast.h:4847
InstanceVariableOperatorWriteNode.
Definition ast.h:4877
struct pm_node * value
InstanceVariableOperatorWriteNode::value.
Definition ast.h:4900
pm_constant_id_t binary_operator
InstanceVariableOperatorWriteNode::binary_operator.
Definition ast.h:4905
pm_location_t binary_operator_loc
InstanceVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:4895
pm_constant_id_t name
InstanceVariableOperatorWriteNode::name.
Definition ast.h:4885
pm_node_t base
The embedded base node.
Definition ast.h:4879
pm_location_t name_loc
InstanceVariableOperatorWriteNode::name_loc.
Definition ast.h:4890
InstanceVariableOrWriteNode.
Definition ast.h:4920
pm_location_t operator_loc
InstanceVariableOrWriteNode::operator_loc.
Definition ast.h:4938
struct pm_node * value
InstanceVariableOrWriteNode::value.
Definition ast.h:4943
pm_node_t base
The embedded base node.
Definition ast.h:4922
pm_location_t name_loc
InstanceVariableOrWriteNode::name_loc.
Definition ast.h:4933
pm_constant_id_t name
InstanceVariableOrWriteNode::name.
Definition ast.h:4928
InstanceVariableReadNode.
Definition ast.h:4958
pm_constant_id_t name
InstanceVariableReadNode::name.
Definition ast.h:4972
pm_node_t base
The embedded base node.
Definition ast.h:4960
InstanceVariableTargetNode.
Definition ast.h:4987
pm_constant_id_t name
InstanceVariableTargetNode::name.
Definition ast.h:4995
pm_node_t base
The embedded base node.
Definition ast.h:4989
InstanceVariableWriteNode.
Definition ast.h:5010
pm_location_t operator_loc
InstanceVariableWriteNode::operator_loc.
Definition ast.h:5057
pm_constant_id_t name
InstanceVariableWriteNode::name.
Definition ast.h:5024
pm_node_t base
The embedded base node.
Definition ast.h:5012
struct pm_node * value
InstanceVariableWriteNode::value.
Definition ast.h:5047
pm_location_t name_loc
InstanceVariableWriteNode::name_loc.
Definition ast.h:5034
IntegerNode.
Definition ast.h:5078
pm_integer_t value
IntegerNode::value.
Definition ast.h:5088
pm_node_t base
The embedded base node.
Definition ast.h:5080
InterpolatedMatchLastLineNode.
Definition ast.h:5116
pm_node_t base
The embedded base node.
Definition ast.h:5118
pm_location_t closing_loc
InterpolatedMatchLastLineNode::closing_loc.
Definition ast.h:5134
struct pm_node_list parts
InterpolatedMatchLastLineNode::parts.
Definition ast.h:5129
pm_location_t opening_loc
InterpolatedMatchLastLineNode::opening_loc.
Definition ast.h:5124
InterpolatedRegularExpressionNode.
Definition ast.h:5162
pm_location_t opening_loc
InterpolatedRegularExpressionNode::opening_loc.
Definition ast.h:5170
struct pm_node_list parts
InterpolatedRegularExpressionNode::parts.
Definition ast.h:5175
pm_node_t base
The embedded base node.
Definition ast.h:5164
pm_location_t closing_loc
InterpolatedRegularExpressionNode::closing_loc.
Definition ast.h:5180
InterpolatedStringNode.
Definition ast.h:5199
pm_node_t base
The embedded base node.
Definition ast.h:5201
pm_location_t closing_loc
InterpolatedStringNode::closing_loc.
Definition ast.h:5217
pm_location_t opening_loc
InterpolatedStringNode::opening_loc.
Definition ast.h:5207
struct pm_node_list parts
InterpolatedStringNode::parts.
Definition ast.h:5212
InterpolatedSymbolNode.
Definition ast.h:5232
struct pm_node_list parts
InterpolatedSymbolNode::parts.
Definition ast.h:5245
pm_location_t closing_loc
InterpolatedSymbolNode::closing_loc.
Definition ast.h:5250
pm_location_t opening_loc
InterpolatedSymbolNode::opening_loc.
Definition ast.h:5240
pm_node_t base
The embedded base node.
Definition ast.h:5234
InterpolatedXStringNode.
Definition ast.h:5265
pm_location_t opening_loc
InterpolatedXStringNode::opening_loc.
Definition ast.h:5273
pm_location_t closing_loc
InterpolatedXStringNode::closing_loc.
Definition ast.h:5283
pm_node_t base
The embedded base node.
Definition ast.h:5267
struct pm_node_list parts
InterpolatedXStringNode::parts.
Definition ast.h:5278
ItLocalVariableReadNode.
Definition ast.h:5298
pm_node_t base
The embedded base node.
Definition ast.h:5300
ItParametersNode.
Definition ast.h:5316
pm_node_t base
The embedded base node.
Definition ast.h:5318
KeywordHashNode.
Definition ast.h:5337
pm_node_t base
The embedded base node.
Definition ast.h:5339
struct pm_node_list elements
KeywordHashNode::elements.
Definition ast.h:5345
KeywordRestParameterNode.
Definition ast.h:5364
pm_node_t base
The embedded base node.
Definition ast.h:5366
pm_constant_id_t name
KeywordRestParameterNode::name.
Definition ast.h:5372
pm_location_t operator_loc
KeywordRestParameterNode::operator_loc.
Definition ast.h:5382
pm_location_t name_loc
KeywordRestParameterNode::name_loc.
Definition ast.h:5377
LambdaNode.
Definition ast.h:5397
pm_location_t closing_loc
LambdaNode::closing_loc.
Definition ast.h:5420
pm_node_t base
The embedded base node.
Definition ast.h:5399
struct pm_node * body
LambdaNode::body.
Definition ast.h:5430
pm_location_t opening_loc
LambdaNode::opening_loc.
Definition ast.h:5415
struct pm_node * parameters
LambdaNode::parameters.
Definition ast.h:5425
pm_location_t operator_loc
LambdaNode::operator_loc.
Definition ast.h:5410
pm_constant_id_list_t locals
LambdaNode::locals.
Definition ast.h:5405
LocalVariableAndWriteNode.
Definition ast.h:5445
pm_constant_id_t name
LocalVariableAndWriteNode::name.
Definition ast.h:5468
pm_node_t base
The embedded base node.
Definition ast.h:5447
uint32_t depth
LocalVariableAndWriteNode::depth.
Definition ast.h:5473
pm_location_t operator_loc
LocalVariableAndWriteNode::operator_loc.
Definition ast.h:5458
struct pm_node * value
LocalVariableAndWriteNode::value.
Definition ast.h:5463
pm_location_t name_loc
LocalVariableAndWriteNode::name_loc.
Definition ast.h:5453
LocalVariableOperatorWriteNode.
Definition ast.h:5488
uint32_t depth
LocalVariableOperatorWriteNode::depth.
Definition ast.h:5521
pm_constant_id_t binary_operator
LocalVariableOperatorWriteNode::binary_operator.
Definition ast.h:5516
pm_node_t base
The embedded base node.
Definition ast.h:5490
struct pm_node * value
LocalVariableOperatorWriteNode::value.
Definition ast.h:5506
pm_location_t name_loc
LocalVariableOperatorWriteNode::name_loc.
Definition ast.h:5496
pm_location_t binary_operator_loc
LocalVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:5501
pm_constant_id_t name
LocalVariableOperatorWriteNode::name.
Definition ast.h:5511
LocalVariableOrWriteNode.
Definition ast.h:5536
uint32_t depth
LocalVariableOrWriteNode::depth.
Definition ast.h:5564
pm_location_t operator_loc
LocalVariableOrWriteNode::operator_loc.
Definition ast.h:5549
struct pm_node * value
LocalVariableOrWriteNode::value.
Definition ast.h:5554
pm_node_t base
The embedded base node.
Definition ast.h:5538
pm_constant_id_t name
LocalVariableOrWriteNode::name.
Definition ast.h:5559
pm_location_t name_loc
LocalVariableOrWriteNode::name_loc.
Definition ast.h:5544
LocalVariableReadNode.
Definition ast.h:5579
uint32_t depth
LocalVariableReadNode::depth.
Definition ast.h:5610
pm_constant_id_t name
LocalVariableReadNode::name.
Definition ast.h:5597
pm_node_t base
The embedded base node.
Definition ast.h:5581
LocalVariableTargetNode.
Definition ast.h:5625
uint32_t depth
LocalVariableTargetNode::depth.
Definition ast.h:5638
pm_constant_id_t name
LocalVariableTargetNode::name.
Definition ast.h:5633
pm_node_t base
The embedded base node.
Definition ast.h:5627
LocalVariableWriteNode.
Definition ast.h:5653
pm_location_t operator_loc
LocalVariableWriteNode::operator_loc.
Definition ast.h:5717
pm_location_t name_loc
LocalVariableWriteNode::name_loc.
Definition ast.h:5690
pm_node_t base
The embedded base node.
Definition ast.h:5655
struct pm_node * value
LocalVariableWriteNode::value.
Definition ast.h:5707
uint32_t depth
LocalVariableWriteNode::depth.
Definition ast.h:5680
pm_constant_id_t name
LocalVariableWriteNode::name.
Definition ast.h:5667
This represents a range of bytes in the source string to which a node or token corresponds.
Definition ast.h:545
const uint8_t * start
A pointer to the start location of the range in the source.
Definition ast.h:547
const uint8_t * end
A pointer to the end location of the range in the source.
Definition ast.h:550
MatchLastLineNode.
Definition ast.h:5745
pm_location_t content_loc
MatchLastLineNode::content_loc.
Definition ast.h:5758
pm_location_t opening_loc
MatchLastLineNode::opening_loc.
Definition ast.h:5753
pm_location_t closing_loc
MatchLastLineNode::closing_loc.
Definition ast.h:5763
pm_string_t unescaped
MatchLastLineNode::unescaped.
Definition ast.h:5768
pm_node_t base
The embedded base node.
Definition ast.h:5747
MatchPredicateNode.
Definition ast.h:5783
pm_location_t operator_loc
MatchPredicateNode::operator_loc.
Definition ast.h:5801
struct pm_node * pattern
MatchPredicateNode::pattern.
Definition ast.h:5796
struct pm_node * value
MatchPredicateNode::value.
Definition ast.h:5791
pm_node_t base
The embedded base node.
Definition ast.h:5785
MatchRequiredNode.
Definition ast.h:5816
pm_node_t base
The embedded base node.
Definition ast.h:5818
pm_location_t operator_loc
MatchRequiredNode::operator_loc.
Definition ast.h:5834
struct pm_node * value
MatchRequiredNode::value.
Definition ast.h:5824
struct pm_node * pattern
MatchRequiredNode::pattern.
Definition ast.h:5829
MatchWriteNode.
Definition ast.h:5849
pm_node_t base
The embedded base node.
Definition ast.h:5851
struct pm_node_list targets
MatchWriteNode::targets.
Definition ast.h:5862
struct pm_call_node * call
MatchWriteNode::call.
Definition ast.h:5857
MissingNode.
Definition ast.h:5874
pm_node_t base
The embedded base node.
Definition ast.h:5876
ModuleNode.
Definition ast.h:5892
pm_location_t end_keyword_loc
ModuleNode::end_keyword_loc.
Definition ast.h:5920
struct pm_node * constant_path
ModuleNode::constant_path.
Definition ast.h:5910
struct pm_node * body
ModuleNode::body.
Definition ast.h:5915
pm_constant_id_list_t locals
ModuleNode::locals.
Definition ast.h:5900
pm_node_t base
The embedded base node.
Definition ast.h:5894
pm_location_t module_keyword_loc
ModuleNode::module_keyword_loc.
Definition ast.h:5905
pm_constant_id_t name
ModuleNode::name.
Definition ast.h:5925
MultiTargetNode.
Definition ast.h:5945
pm_node_t base
The embedded base node.
Definition ast.h:5947
pm_location_t lparen_loc
MultiTargetNode::lparen_loc.
Definition ast.h:6003
struct pm_node_list lefts
MultiTargetNode::lefts.
Definition ast.h:5963
struct pm_node * rest
MultiTargetNode::rest.
Definition ast.h:5983
pm_location_t rparen_loc
MultiTargetNode::rparen_loc.
Definition ast.h:6013
struct pm_node_list rights
MultiTargetNode::rights.
Definition ast.h:5993
MultiWriteNode.
Definition ast.h:6028
pm_location_t rparen_loc
MultiWriteNode::rparen_loc.
Definition ast.h:6096
struct pm_node * value
MultiWriteNode::value.
Definition ast.h:6116
struct pm_node * rest
MultiWriteNode::rest.
Definition ast.h:6066
struct pm_node_list rights
MultiWriteNode::rights.
Definition ast.h:6076
pm_location_t operator_loc
MultiWriteNode::operator_loc.
Definition ast.h:6106
pm_location_t lparen_loc
MultiWriteNode::lparen_loc.
Definition ast.h:6086
struct pm_node_list lefts
MultiWriteNode::lefts.
Definition ast.h:6046
pm_node_t base
The embedded base node.
Definition ast.h:6030
NextNode.
Definition ast.h:6131
struct pm_arguments_node * arguments
NextNode::arguments.
Definition ast.h:6139
pm_node_t base
The embedded base node.
Definition ast.h:6133
pm_location_t keyword_loc
NextNode::keyword_loc.
Definition ast.h:6144
NilNode.
Definition ast.h:6159
pm_node_t base
The embedded base node.
Definition ast.h:6161
NoKeywordsParameterNode.
Definition ast.h:6178
pm_location_t keyword_loc
NoKeywordsParameterNode::keyword_loc.
Definition ast.h:6191
pm_location_t operator_loc
NoKeywordsParameterNode::operator_loc.
Definition ast.h:6186
pm_node_t base
The embedded base node.
Definition ast.h:6180
A list of nodes in the source, most often used for lists of children.
Definition ast.h:558
size_t size
The number of nodes in the list.
Definition ast.h:560
struct pm_node ** nodes
The nodes in the list.
Definition ast.h:566
size_t capacity
The capacity of the list that has been allocated.
Definition ast.h:563
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1069
pm_location_t location
This is the location of the node in the source.
Definition ast.h:1092
NumberedParametersNode.
Definition ast.h:6206
pm_node_t base
The embedded base node.
Definition ast.h:6208
uint8_t maximum
NumberedParametersNode::maximum.
Definition ast.h:6214
NumberedReferenceReadNode.
Definition ast.h:6229
pm_node_t base
The embedded base node.
Definition ast.h:6231
uint32_t number
NumberedReferenceReadNode::number.
Definition ast.h:6245
OptionalKeywordParameterNode.
Definition ast.h:6264
pm_node_t base
The embedded base node.
Definition ast.h:6266
pm_constant_id_t name
OptionalKeywordParameterNode::name.
Definition ast.h:6272
struct pm_node * value
OptionalKeywordParameterNode::value.
Definition ast.h:6282
pm_location_t name_loc
OptionalKeywordParameterNode::name_loc.
Definition ast.h:6277
OptionalParameterNode.
Definition ast.h:6301
pm_location_t name_loc
OptionalParameterNode::name_loc.
Definition ast.h:6314
struct pm_node * value
OptionalParameterNode::value.
Definition ast.h:6324
pm_constant_id_t name
OptionalParameterNode::name.
Definition ast.h:6309
pm_node_t base
The embedded base node.
Definition ast.h:6303
pm_location_t operator_loc
OptionalParameterNode::operator_loc.
Definition ast.h:6319
OrNode.
Definition ast.h:6339
struct pm_node * left
OrNode::left.
Definition ast.h:6355
struct pm_node * right
OrNode::right.
Definition ast.h:6368
pm_node_t base
The embedded base node.
Definition ast.h:6341
pm_location_t operator_loc
OrNode::operator_loc.
Definition ast.h:6378
ParametersNode.
Definition ast.h:6394
struct pm_node * rest
ParametersNode::rest.
Definition ast.h:6412
struct pm_node_list requireds
ParametersNode::requireds.
Definition ast.h:6402
struct pm_block_parameter_node * block
ParametersNode::block.
Definition ast.h:6432
struct pm_node_list optionals
ParametersNode::optionals.
Definition ast.h:6407
struct pm_node_list posts
ParametersNode::posts.
Definition ast.h:6417
pm_node_t base
The embedded base node.
Definition ast.h:6396
struct pm_node * keyword_rest
ParametersNode::keyword_rest.
Definition ast.h:6427
struct pm_node_list keywords
ParametersNode::keywords.
Definition ast.h:6422
ParenthesesNode.
Definition ast.h:6447
struct pm_node * body
ParenthesesNode::body.
Definition ast.h:6455
pm_location_t closing_loc
ParenthesesNode::closing_loc.
Definition ast.h:6465
pm_node_t base
The embedded base node.
Definition ast.h:6449
pm_location_t opening_loc
ParenthesesNode::opening_loc.
Definition ast.h:6460
This struct represents the overall parser.
Definition parser.h:640
pm_constant_pool_t constant_pool
This constant pool keeps all of the constants defined throughout the file so that we can reference th...
Definition parser.h:786
const uint8_t * start
The pointer to the start of the source.
Definition parser.h:691
PinnedExpressionNode.
Definition ast.h:6480
pm_node_t base
The embedded base node.
Definition ast.h:6482
pm_location_t rparen_loc
PinnedExpressionNode::rparen_loc.
Definition ast.h:6503
struct pm_node * expression
PinnedExpressionNode::expression.
Definition ast.h:6488
pm_location_t lparen_loc
PinnedExpressionNode::lparen_loc.
Definition ast.h:6498
pm_location_t operator_loc
PinnedExpressionNode::operator_loc.
Definition ast.h:6493
PinnedVariableNode.
Definition ast.h:6518
struct pm_node * variable
PinnedVariableNode::variable.
Definition ast.h:6526
pm_node_t base
The embedded base node.
Definition ast.h:6520
pm_location_t operator_loc
PinnedVariableNode::operator_loc.
Definition ast.h:6531
PostExecutionNode.
Definition ast.h:6546
pm_location_t closing_loc
PostExecutionNode::closing_loc.
Definition ast.h:6569
struct pm_statements_node * statements
PostExecutionNode::statements.
Definition ast.h:6554
pm_node_t base
The embedded base node.
Definition ast.h:6548
pm_location_t opening_loc
PostExecutionNode::opening_loc.
Definition ast.h:6564
pm_location_t keyword_loc
PostExecutionNode::keyword_loc.
Definition ast.h:6559
PreExecutionNode.
Definition ast.h:6584
struct pm_statements_node * statements
PreExecutionNode::statements.
Definition ast.h:6592
pm_location_t closing_loc
PreExecutionNode::closing_loc.
Definition ast.h:6607
pm_location_t opening_loc
PreExecutionNode::opening_loc.
Definition ast.h:6602
pm_node_t base
The embedded base node.
Definition ast.h:6586
pm_location_t keyword_loc
PreExecutionNode::keyword_loc.
Definition ast.h:6597
ProgramNode.
Definition ast.h:6619
struct pm_statements_node * statements
ProgramNode::statements.
Definition ast.h:6632
pm_node_t base
The embedded base node.
Definition ast.h:6621
pm_constant_id_list_t locals
ProgramNode::locals.
Definition ast.h:6627
RangeNode.
Definition ast.h:6653
struct pm_node * right
RangeNode::right.
Definition ast.h:6683
pm_location_t operator_loc
RangeNode::operator_loc.
Definition ast.h:6690
pm_node_t base
The embedded base node.
Definition ast.h:6655
struct pm_node * left
RangeNode::left.
Definition ast.h:6669
RationalNode.
Definition ast.h:6711
pm_node_t base
The embedded base node.
Definition ast.h:6713
pm_integer_t denominator
RationalNode::denominator.
Definition ast.h:6732
pm_integer_t numerator
RationalNode::numerator.
Definition ast.h:6723
RedoNode.
Definition ast.h:6747
pm_node_t base
The embedded base node.
Definition ast.h:6749
RegularExpressionNode.
Definition ast.h:6778
pm_location_t closing_loc
RegularExpressionNode::closing_loc.
Definition ast.h:6796
pm_node_t base
The embedded base node.
Definition ast.h:6780
pm_string_t unescaped
RegularExpressionNode::unescaped.
Definition ast.h:6801
pm_location_t opening_loc
RegularExpressionNode::opening_loc.
Definition ast.h:6786
pm_location_t content_loc
RegularExpressionNode::content_loc.
Definition ast.h:6791
RequiredKeywordParameterNode.
Definition ast.h:6820
pm_location_t name_loc
RequiredKeywordParameterNode::name_loc.
Definition ast.h:6833
pm_node_t base
The embedded base node.
Definition ast.h:6822
pm_constant_id_t name
RequiredKeywordParameterNode::name.
Definition ast.h:6828
RequiredParameterNode.
Definition ast.h:6852
pm_constant_id_t name
RequiredParameterNode::name.
Definition ast.h:6860
pm_node_t base
The embedded base node.
Definition ast.h:6854
RescueModifierNode.
Definition ast.h:6875
pm_node_t base
The embedded base node.
Definition ast.h:6877
struct pm_node * rescue_expression
RescueModifierNode::rescue_expression.
Definition ast.h:6893
pm_location_t keyword_loc
RescueModifierNode::keyword_loc.
Definition ast.h:6888
struct pm_node * expression
RescueModifierNode::expression.
Definition ast.h:6883
RescueNode.
Definition ast.h:6913
pm_location_t keyword_loc
RescueNode::keyword_loc.
Definition ast.h:6921
struct pm_rescue_node * subsequent
RescueNode::subsequent.
Definition ast.h:6946
pm_location_t operator_loc
RescueNode::operator_loc.
Definition ast.h:6931
struct pm_node * reference
RescueNode::reference.
Definition ast.h:6936
struct pm_node_list exceptions
RescueNode::exceptions.
Definition ast.h:6926
struct pm_statements_node * statements
RescueNode::statements.
Definition ast.h:6941
pm_node_t base
The embedded base node.
Definition ast.h:6915
RestParameterNode.
Definition ast.h:6965
pm_constant_id_t name
RestParameterNode::name.
Definition ast.h:6973
pm_location_t name_loc
RestParameterNode::name_loc.
Definition ast.h:6978
pm_node_t base
The embedded base node.
Definition ast.h:6967
pm_location_t operator_loc
RestParameterNode::operator_loc.
Definition ast.h:6983
RetryNode.
Definition ast.h:6998
pm_node_t base
The embedded base node.
Definition ast.h:7000
ReturnNode.
Definition ast.h:7016
pm_location_t keyword_loc
ReturnNode::keyword_loc.
Definition ast.h:7024
pm_node_t base
The embedded base node.
Definition ast.h:7018
struct pm_arguments_node * arguments
ReturnNode::arguments.
Definition ast.h:7029
SelfNode.
Definition ast.h:7044
pm_node_t base
The embedded base node.
Definition ast.h:7046
ShareableConstantNode.
Definition ast.h:7068
struct pm_node * write
ShareableConstantNode::write.
Definition ast.h:7078
pm_node_t base
The embedded base node.
Definition ast.h:7070
SingletonClassNode.
Definition ast.h:7093
pm_node_t base
The embedded base node.
Definition ast.h:7095
pm_constant_id_list_t locals
SingletonClassNode::locals.
Definition ast.h:7101
pm_location_t operator_loc
SingletonClassNode::operator_loc.
Definition ast.h:7111
struct pm_node * expression
SingletonClassNode::expression.
Definition ast.h:7116
pm_location_t end_keyword_loc
SingletonClassNode::end_keyword_loc.
Definition ast.h:7126
pm_location_t class_keyword_loc
SingletonClassNode::class_keyword_loc.
Definition ast.h:7106
struct pm_node * body
SingletonClassNode::body.
Definition ast.h:7121
SourceEncodingNode.
Definition ast.h:7141
pm_node_t base
The embedded base node.
Definition ast.h:7143
SourceFileNode.
Definition ast.h:7165
pm_string_t filepath
SourceFileNode::filepath.
Definition ast.h:7175
pm_node_t base
The embedded base node.
Definition ast.h:7167
SourceLineNode.
Definition ast.h:7190
pm_node_t base
The embedded base node.
Definition ast.h:7192
SplatNode.
Definition ast.h:7208
struct pm_node * expression
SplatNode::expression.
Definition ast.h:7221
pm_node_t base
The embedded base node.
Definition ast.h:7210
pm_location_t operator_loc
SplatNode::operator_loc.
Definition ast.h:7216
StatementsNode.
Definition ast.h:7236
struct pm_node_list body
StatementsNode::body.
Definition ast.h:7244
pm_node_t base
The embedded base node.
Definition ast.h:7238
StringNode.
Definition ast.h:7271
pm_node_t base
The embedded base node.
Definition ast.h:7273
pm_string_t unescaped
StringNode::unescaped.
Definition ast.h:7294
pm_location_t content_loc
StringNode::content_loc.
Definition ast.h:7284
pm_location_t closing_loc
StringNode::closing_loc.
Definition ast.h:7289
pm_location_t opening_loc
StringNode::opening_loc.
Definition ast.h:7279
A generic string type that can have various ownership semantics.
Definition pm_string.h:33
SuperNode.
Definition ast.h:7312
struct pm_arguments_node * arguments
SuperNode::arguments.
Definition ast.h:7330
pm_location_t lparen_loc
SuperNode::lparen_loc.
Definition ast.h:7325
pm_node_t base
The embedded base node.
Definition ast.h:7314
pm_location_t keyword_loc
SuperNode::keyword_loc.
Definition ast.h:7320
pm_location_t rparen_loc
SuperNode::rparen_loc.
Definition ast.h:7335
struct pm_node * block
SuperNode::block.
Definition ast.h:7340
SymbolNode.
Definition ast.h:7363
pm_location_t opening_loc
SymbolNode::opening_loc.
Definition ast.h:7371
pm_location_t value_loc
SymbolNode::value_loc.
Definition ast.h:7376
pm_location_t closing_loc
SymbolNode::closing_loc.
Definition ast.h:7381
pm_string_t unescaped
SymbolNode::unescaped.
Definition ast.h:7386
pm_node_t base
The embedded base node.
Definition ast.h:7365
TrueNode.
Definition ast.h:7401
pm_node_t base
The embedded base node.
Definition ast.h:7403
UndefNode.
Definition ast.h:7419
pm_node_t base
The embedded base node.
Definition ast.h:7421
pm_location_t keyword_loc
UndefNode::keyword_loc.
Definition ast.h:7432
struct pm_node_list names
UndefNode::names.
Definition ast.h:7427
UnlessNode.
Definition ast.h:7450
pm_location_t keyword_loc
UnlessNode::keyword_loc.
Definition ast.h:7466
pm_location_t then_keyword_loc
UnlessNode::then_keyword_loc.
Definition ast.h:7489
pm_location_t end_keyword_loc
UnlessNode::end_keyword_loc.
Definition ast.h:7520
pm_node_t base
The embedded base node.
Definition ast.h:7452
struct pm_statements_node * statements
UnlessNode::statements.
Definition ast.h:7500
struct pm_node * predicate
UnlessNode::predicate.
Definition ast.h:7479
struct pm_else_node * else_clause
UnlessNode::else_clause.
Definition ast.h:7510
UntilNode.
Definition ast.h:7541
struct pm_statements_node * statements
UntilNode::statements.
Definition ast.h:7569
pm_location_t closing_loc
UntilNode::closing_loc.
Definition ast.h:7559
struct pm_node * predicate
UntilNode::predicate.
Definition ast.h:7564
pm_location_t keyword_loc
UntilNode::keyword_loc.
Definition ast.h:7549
pm_node_t base
The embedded base node.
Definition ast.h:7543
pm_location_t do_keyword_loc
UntilNode::do_keyword_loc.
Definition ast.h:7554
WhenNode.
Definition ast.h:7586
struct pm_statements_node * statements
WhenNode::statements.
Definition ast.h:7609
pm_node_t base
The embedded base node.
Definition ast.h:7588
pm_location_t then_keyword_loc
WhenNode::then_keyword_loc.
Definition ast.h:7604
pm_location_t keyword_loc
WhenNode::keyword_loc.
Definition ast.h:7594
struct pm_node_list conditions
WhenNode::conditions.
Definition ast.h:7599
WhileNode.
Definition ast.h:7630
pm_location_t closing_loc
WhileNode::closing_loc.
Definition ast.h:7648
pm_location_t keyword_loc
WhileNode::keyword_loc.
Definition ast.h:7638
struct pm_statements_node * statements
WhileNode::statements.
Definition ast.h:7658
pm_node_t base
The embedded base node.
Definition ast.h:7632
pm_location_t do_keyword_loc
WhileNode::do_keyword_loc.
Definition ast.h:7643
struct pm_node * predicate
WhileNode::predicate.
Definition ast.h:7653
XStringNode.
Definition ast.h:7677
pm_location_t closing_loc
XStringNode::closing_loc.
Definition ast.h:7695
pm_location_t opening_loc
XStringNode::opening_loc.
Definition ast.h:7685
pm_location_t content_loc
XStringNode::content_loc.
Definition ast.h:7690
pm_string_t unescaped
XStringNode::unescaped.
Definition ast.h:7700
pm_node_t base
The embedded base node.
Definition ast.h:7679
YieldNode.
Definition ast.h:7715
pm_location_t keyword_loc
YieldNode::keyword_loc.
Definition ast.h:7723
pm_location_t lparen_loc
YieldNode::lparen_loc.
Definition ast.h:7728
pm_node_t base
The embedded base node.
Definition ast.h:7717
pm_location_t rparen_loc
YieldNode::rparen_loc.
Definition ast.h:7738
struct pm_arguments_node * arguments
YieldNode::arguments.
Definition ast.h:7733