Ruby: prism/node.c Source File

Ruby 4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721)

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