Ruby: prism/node.c Source File

Ruby 3.4.6p54 (2025-09-16 revision dbd83256b1cec76c69756ecb8758b9e1079833de)

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 block field
3809 pm_buffer_append_byte(buffer, ',');
3810 pm_buffer_append_string(buffer, "\"block\":", 8);
3811 if (cast->block != NULL) {
3812 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
3813 } else {
3814 pm_buffer_append_string(buffer, "null", 4);
3815 }
3816
3817 pm_buffer_append_byte(buffer, '}');
3818 break;
3819 }
3820 case PM_CALL_OPERATOR_WRITE_NODE: {
3821 pm_buffer_append_string(buffer, "{\"type\":\"CallOperatorWriteNode\",\"location\":", 43);
3822
3823 const pm_call_operator_write_node_t *cast = (const pm_call_operator_write_node_t *) node;
3824 pm_dump_json_location(buffer, parser, &cast->base.location);
3825
3826 // Dump the CallNodeFlags field
3827 pm_buffer_append_byte(buffer, ',');
3828 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3829 size_t flags = 0;
3830 pm_buffer_append_byte(buffer, '[');
3831 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
3832 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3833 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
3834 flags++;
3835 }
3836 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
3837 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3838 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
3839 flags++;
3840 }
3841 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
3842 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3843 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
3844 flags++;
3845 }
3846 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
3847 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3848 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
3849 flags++;
3850 }
3851 pm_buffer_append_byte(buffer, ']');
3852
3853 // Dump the receiver field
3854 pm_buffer_append_byte(buffer, ',');
3855 pm_buffer_append_string(buffer, "\"receiver\":", 11);
3856 if (cast->receiver != NULL) {
3857 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
3858 } else {
3859 pm_buffer_append_string(buffer, "null", 4);
3860 }
3861
3862 // Dump the call_operator_loc field
3863 pm_buffer_append_byte(buffer, ',');
3864 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
3865 if (cast->call_operator_loc.start != NULL) {
3866 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
3867 } else {
3868 pm_buffer_append_string(buffer, "null", 4);
3869 }
3870
3871 // Dump the message_loc field
3872 pm_buffer_append_byte(buffer, ',');
3873 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
3874 if (cast->message_loc.start != NULL) {
3875 pm_dump_json_location(buffer, parser, &cast->message_loc);
3876 } else {
3877 pm_buffer_append_string(buffer, "null", 4);
3878 }
3879
3880 // Dump the read_name field
3881 pm_buffer_append_byte(buffer, ',');
3882 pm_buffer_append_string(buffer, "\"read_name\":", 12);
3883 pm_dump_json_constant(buffer, parser, cast->read_name);
3884
3885 // Dump the write_name field
3886 pm_buffer_append_byte(buffer, ',');
3887 pm_buffer_append_string(buffer, "\"write_name\":", 13);
3888 pm_dump_json_constant(buffer, parser, cast->write_name);
3889
3890 // Dump the binary_operator field
3891 pm_buffer_append_byte(buffer, ',');
3892 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
3893 pm_dump_json_constant(buffer, parser, cast->binary_operator);
3894
3895 // Dump the binary_operator_loc field
3896 pm_buffer_append_byte(buffer, ',');
3897 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
3898 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
3899
3900 // Dump the value field
3901 pm_buffer_append_byte(buffer, ',');
3902 pm_buffer_append_string(buffer, "\"value\":", 8);
3903 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3904
3905 pm_buffer_append_byte(buffer, '}');
3906 break;
3907 }
3908 case PM_CALL_OR_WRITE_NODE: {
3909 pm_buffer_append_string(buffer, "{\"type\":\"CallOrWriteNode\",\"location\":", 37);
3910
3911 const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node;
3912 pm_dump_json_location(buffer, parser, &cast->base.location);
3913
3914 // Dump the CallNodeFlags field
3915 pm_buffer_append_byte(buffer, ',');
3916 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
3917 size_t flags = 0;
3918 pm_buffer_append_byte(buffer, '[');
3919 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
3920 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3921 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
3922 flags++;
3923 }
3924 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
3925 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3926 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
3927 flags++;
3928 }
3929 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
3930 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3931 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
3932 flags++;
3933 }
3934 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
3935 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3936 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
3937 flags++;
3938 }
3939 pm_buffer_append_byte(buffer, ']');
3940
3941 // Dump the receiver field
3942 pm_buffer_append_byte(buffer, ',');
3943 pm_buffer_append_string(buffer, "\"receiver\":", 11);
3944 if (cast->receiver != NULL) {
3945 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
3946 } else {
3947 pm_buffer_append_string(buffer, "null", 4);
3948 }
3949
3950 // Dump the call_operator_loc field
3951 pm_buffer_append_byte(buffer, ',');
3952 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
3953 if (cast->call_operator_loc.start != NULL) {
3954 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
3955 } else {
3956 pm_buffer_append_string(buffer, "null", 4);
3957 }
3958
3959 // Dump the message_loc field
3960 pm_buffer_append_byte(buffer, ',');
3961 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
3962 if (cast->message_loc.start != NULL) {
3963 pm_dump_json_location(buffer, parser, &cast->message_loc);
3964 } else {
3965 pm_buffer_append_string(buffer, "null", 4);
3966 }
3967
3968 // Dump the read_name field
3969 pm_buffer_append_byte(buffer, ',');
3970 pm_buffer_append_string(buffer, "\"read_name\":", 12);
3971 pm_dump_json_constant(buffer, parser, cast->read_name);
3972
3973 // Dump the write_name field
3974 pm_buffer_append_byte(buffer, ',');
3975 pm_buffer_append_string(buffer, "\"write_name\":", 13);
3976 pm_dump_json_constant(buffer, parser, cast->write_name);
3977
3978 // Dump the operator_loc field
3979 pm_buffer_append_byte(buffer, ',');
3980 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3981 pm_dump_json_location(buffer, parser, &cast->operator_loc);
3982
3983 // Dump the value field
3984 pm_buffer_append_byte(buffer, ',');
3985 pm_buffer_append_string(buffer, "\"value\":", 8);
3986 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3987
3988 pm_buffer_append_byte(buffer, '}');
3989 break;
3990 }
3991 case PM_CALL_TARGET_NODE: {
3992 pm_buffer_append_string(buffer, "{\"type\":\"CallTargetNode\",\"location\":", 36);
3993
3994 const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node;
3995 pm_dump_json_location(buffer, parser, &cast->base.location);
3996
3997 // Dump the CallNodeFlags field
3998 pm_buffer_append_byte(buffer, ',');
3999 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
4000 size_t flags = 0;
4001 pm_buffer_append_byte(buffer, '[');
4002 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
4003 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4004 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
4005 flags++;
4006 }
4007 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
4008 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4009 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
4010 flags++;
4011 }
4012 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
4013 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4014 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
4015 flags++;
4016 }
4017 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
4018 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4019 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
4020 flags++;
4021 }
4022 pm_buffer_append_byte(buffer, ']');
4023
4024 // Dump the receiver field
4025 pm_buffer_append_byte(buffer, ',');
4026 pm_buffer_append_string(buffer, "\"receiver\":", 11);
4027 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
4028
4029 // Dump the call_operator_loc field
4030 pm_buffer_append_byte(buffer, ',');
4031 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
4032 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
4033
4034 // Dump the name field
4035 pm_buffer_append_byte(buffer, ',');
4036 pm_buffer_append_string(buffer, "\"name\":", 7);
4037 pm_dump_json_constant(buffer, parser, cast->name);
4038
4039 // Dump the message_loc field
4040 pm_buffer_append_byte(buffer, ',');
4041 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
4042 pm_dump_json_location(buffer, parser, &cast->message_loc);
4043
4044 pm_buffer_append_byte(buffer, '}');
4045 break;
4046 }
4047 case PM_CAPTURE_PATTERN_NODE: {
4048 pm_buffer_append_string(buffer, "{\"type\":\"CapturePatternNode\",\"location\":", 40);
4049
4050 const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node;
4051 pm_dump_json_location(buffer, parser, &cast->base.location);
4052
4053 // Dump the value field
4054 pm_buffer_append_byte(buffer, ',');
4055 pm_buffer_append_string(buffer, "\"value\":", 8);
4056 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4057
4058 // Dump the target field
4059 pm_buffer_append_byte(buffer, ',');
4060 pm_buffer_append_string(buffer, "\"target\":", 9);
4061 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4062
4063 // Dump the operator_loc field
4064 pm_buffer_append_byte(buffer, ',');
4065 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4066 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4067
4068 pm_buffer_append_byte(buffer, '}');
4069 break;
4070 }
4071 case PM_CASE_MATCH_NODE: {
4072 pm_buffer_append_string(buffer, "{\"type\":\"CaseMatchNode\",\"location\":", 35);
4073
4074 const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node;
4075 pm_dump_json_location(buffer, parser, &cast->base.location);
4076
4077 // Dump the predicate field
4078 pm_buffer_append_byte(buffer, ',');
4079 pm_buffer_append_string(buffer, "\"predicate\":", 12);
4080 if (cast->predicate != NULL) {
4081 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
4082 } else {
4083 pm_buffer_append_string(buffer, "null", 4);
4084 }
4085
4086 // Dump the conditions field
4087 pm_buffer_append_byte(buffer, ',');
4088 pm_buffer_append_string(buffer, "\"conditions\":", 13);
4089 const pm_node_list_t *conditions = &cast->conditions;
4090 pm_buffer_append_byte(buffer, '[');
4091
4092 for (size_t index = 0; index < conditions->size; index++) {
4093 if (index != 0) pm_buffer_append_byte(buffer, ',');
4094 pm_dump_json(buffer, parser, conditions->nodes[index]);
4095 }
4096 pm_buffer_append_byte(buffer, ']');
4097
4098 // Dump the else_clause field
4099 pm_buffer_append_byte(buffer, ',');
4100 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
4101 if (cast->else_clause != NULL) {
4102 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
4103 } else {
4104 pm_buffer_append_string(buffer, "null", 4);
4105 }
4106
4107 // Dump the case_keyword_loc field
4108 pm_buffer_append_byte(buffer, ',');
4109 pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19);
4110 pm_dump_json_location(buffer, parser, &cast->case_keyword_loc);
4111
4112 // Dump the end_keyword_loc field
4113 pm_buffer_append_byte(buffer, ',');
4114 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4115 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4116
4117 pm_buffer_append_byte(buffer, '}');
4118 break;
4119 }
4120 case PM_CASE_NODE: {
4121 pm_buffer_append_string(buffer, "{\"type\":\"CaseNode\",\"location\":", 30);
4122
4123 const pm_case_node_t *cast = (const pm_case_node_t *) node;
4124 pm_dump_json_location(buffer, parser, &cast->base.location);
4125
4126 // Dump the predicate field
4127 pm_buffer_append_byte(buffer, ',');
4128 pm_buffer_append_string(buffer, "\"predicate\":", 12);
4129 if (cast->predicate != NULL) {
4130 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
4131 } else {
4132 pm_buffer_append_string(buffer, "null", 4);
4133 }
4134
4135 // Dump the conditions field
4136 pm_buffer_append_byte(buffer, ',');
4137 pm_buffer_append_string(buffer, "\"conditions\":", 13);
4138 const pm_node_list_t *conditions = &cast->conditions;
4139 pm_buffer_append_byte(buffer, '[');
4140
4141 for (size_t index = 0; index < conditions->size; index++) {
4142 if (index != 0) pm_buffer_append_byte(buffer, ',');
4143 pm_dump_json(buffer, parser, conditions->nodes[index]);
4144 }
4145 pm_buffer_append_byte(buffer, ']');
4146
4147 // Dump the else_clause field
4148 pm_buffer_append_byte(buffer, ',');
4149 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
4150 if (cast->else_clause != NULL) {
4151 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
4152 } else {
4153 pm_buffer_append_string(buffer, "null", 4);
4154 }
4155
4156 // Dump the case_keyword_loc field
4157 pm_buffer_append_byte(buffer, ',');
4158 pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19);
4159 pm_dump_json_location(buffer, parser, &cast->case_keyword_loc);
4160
4161 // Dump the end_keyword_loc field
4162 pm_buffer_append_byte(buffer, ',');
4163 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4164 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4165
4166 pm_buffer_append_byte(buffer, '}');
4167 break;
4168 }
4169 case PM_CLASS_NODE: {
4170 pm_buffer_append_string(buffer, "{\"type\":\"ClassNode\",\"location\":", 31);
4171
4172 const pm_class_node_t *cast = (const pm_class_node_t *) node;
4173 pm_dump_json_location(buffer, parser, &cast->base.location);
4174
4175 // Dump the locals field
4176 pm_buffer_append_byte(buffer, ',');
4177 pm_buffer_append_string(buffer, "\"locals\":", 9);
4178 const pm_constant_id_list_t *locals = &cast->locals;
4179 pm_buffer_append_byte(buffer, '[');
4180
4181 for (size_t index = 0; index < locals->size; index++) {
4182 if (index != 0) pm_buffer_append_byte(buffer, ',');
4183 pm_dump_json_constant(buffer, parser, locals->ids[index]);
4184 }
4185 pm_buffer_append_byte(buffer, ']');
4186
4187 // Dump the class_keyword_loc field
4188 pm_buffer_append_byte(buffer, ',');
4189 pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20);
4190 pm_dump_json_location(buffer, parser, &cast->class_keyword_loc);
4191
4192 // Dump the constant_path field
4193 pm_buffer_append_byte(buffer, ',');
4194 pm_buffer_append_string(buffer, "\"constant_path\":", 16);
4195 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path);
4196
4197 // Dump the inheritance_operator_loc field
4198 pm_buffer_append_byte(buffer, ',');
4199 pm_buffer_append_string(buffer, "\"inheritance_operator_loc\":", 27);
4200 if (cast->inheritance_operator_loc.start != NULL) {
4201 pm_dump_json_location(buffer, parser, &cast->inheritance_operator_loc);
4202 } else {
4203 pm_buffer_append_string(buffer, "null", 4);
4204 }
4205
4206 // Dump the superclass field
4207 pm_buffer_append_byte(buffer, ',');
4208 pm_buffer_append_string(buffer, "\"superclass\":", 13);
4209 if (cast->superclass != NULL) {
4210 pm_dump_json(buffer, parser, (const pm_node_t *) cast->superclass);
4211 } else {
4212 pm_buffer_append_string(buffer, "null", 4);
4213 }
4214
4215 // Dump the body field
4216 pm_buffer_append_byte(buffer, ',');
4217 pm_buffer_append_string(buffer, "\"body\":", 7);
4218 if (cast->body != NULL) {
4219 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
4220 } else {
4221 pm_buffer_append_string(buffer, "null", 4);
4222 }
4223
4224 // Dump the end_keyword_loc field
4225 pm_buffer_append_byte(buffer, ',');
4226 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4227 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4228
4229 // Dump the name field
4230 pm_buffer_append_byte(buffer, ',');
4231 pm_buffer_append_string(buffer, "\"name\":", 7);
4232 pm_dump_json_constant(buffer, parser, cast->name);
4233
4234 pm_buffer_append_byte(buffer, '}');
4235 break;
4236 }
4237 case PM_CLASS_VARIABLE_AND_WRITE_NODE: {
4238 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableAndWriteNode\",\"location\":", 47);
4239
4240 const pm_class_variable_and_write_node_t *cast = (const pm_class_variable_and_write_node_t *) node;
4241 pm_dump_json_location(buffer, parser, &cast->base.location);
4242
4243 // Dump the name field
4244 pm_buffer_append_byte(buffer, ',');
4245 pm_buffer_append_string(buffer, "\"name\":", 7);
4246 pm_dump_json_constant(buffer, parser, cast->name);
4247
4248 // Dump the name_loc field
4249 pm_buffer_append_byte(buffer, ',');
4250 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4251 pm_dump_json_location(buffer, parser, &cast->name_loc);
4252
4253 // Dump the operator_loc field
4254 pm_buffer_append_byte(buffer, ',');
4255 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4256 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4257
4258 // Dump the value field
4259 pm_buffer_append_byte(buffer, ',');
4260 pm_buffer_append_string(buffer, "\"value\":", 8);
4261 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4262
4263 pm_buffer_append_byte(buffer, '}');
4264 break;
4265 }
4266 case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
4267 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOperatorWriteNode\",\"location\":", 52);
4268
4269 const pm_class_variable_operator_write_node_t *cast = (const pm_class_variable_operator_write_node_t *) node;
4270 pm_dump_json_location(buffer, parser, &cast->base.location);
4271
4272 // Dump the name field
4273 pm_buffer_append_byte(buffer, ',');
4274 pm_buffer_append_string(buffer, "\"name\":", 7);
4275 pm_dump_json_constant(buffer, parser, cast->name);
4276
4277 // Dump the name_loc field
4278 pm_buffer_append_byte(buffer, ',');
4279 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4280 pm_dump_json_location(buffer, parser, &cast->name_loc);
4281
4282 // Dump the binary_operator_loc field
4283 pm_buffer_append_byte(buffer, ',');
4284 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
4285 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
4286
4287 // Dump the value field
4288 pm_buffer_append_byte(buffer, ',');
4289 pm_buffer_append_string(buffer, "\"value\":", 8);
4290 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4291
4292 // Dump the binary_operator field
4293 pm_buffer_append_byte(buffer, ',');
4294 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
4295 pm_dump_json_constant(buffer, parser, cast->binary_operator);
4296
4297 pm_buffer_append_byte(buffer, '}');
4298 break;
4299 }
4300 case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
4301 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOrWriteNode\",\"location\":", 46);
4302
4303 const pm_class_variable_or_write_node_t *cast = (const pm_class_variable_or_write_node_t *) node;
4304 pm_dump_json_location(buffer, parser, &cast->base.location);
4305
4306 // Dump the name field
4307 pm_buffer_append_byte(buffer, ',');
4308 pm_buffer_append_string(buffer, "\"name\":", 7);
4309 pm_dump_json_constant(buffer, parser, cast->name);
4310
4311 // Dump the name_loc field
4312 pm_buffer_append_byte(buffer, ',');
4313 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4314 pm_dump_json_location(buffer, parser, &cast->name_loc);
4315
4316 // Dump the operator_loc field
4317 pm_buffer_append_byte(buffer, ',');
4318 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4319 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4320
4321 // Dump the value field
4322 pm_buffer_append_byte(buffer, ',');
4323 pm_buffer_append_string(buffer, "\"value\":", 8);
4324 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4325
4326 pm_buffer_append_byte(buffer, '}');
4327 break;
4328 }
4329 case PM_CLASS_VARIABLE_READ_NODE: {
4330 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableReadNode\",\"location\":", 43);
4331
4332 const pm_class_variable_read_node_t *cast = (const pm_class_variable_read_node_t *) node;
4333 pm_dump_json_location(buffer, parser, &cast->base.location);
4334
4335 // Dump the name field
4336 pm_buffer_append_byte(buffer, ',');
4337 pm_buffer_append_string(buffer, "\"name\":", 7);
4338 pm_dump_json_constant(buffer, parser, cast->name);
4339
4340 pm_buffer_append_byte(buffer, '}');
4341 break;
4342 }
4343 case PM_CLASS_VARIABLE_TARGET_NODE: {
4344 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableTargetNode\",\"location\":", 45);
4345
4346 const pm_class_variable_target_node_t *cast = (const pm_class_variable_target_node_t *) node;
4347 pm_dump_json_location(buffer, parser, &cast->base.location);
4348
4349 // Dump the name field
4350 pm_buffer_append_byte(buffer, ',');
4351 pm_buffer_append_string(buffer, "\"name\":", 7);
4352 pm_dump_json_constant(buffer, parser, cast->name);
4353
4354 pm_buffer_append_byte(buffer, '}');
4355 break;
4356 }
4357 case PM_CLASS_VARIABLE_WRITE_NODE: {
4358 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableWriteNode\",\"location\":", 44);
4359
4360 const pm_class_variable_write_node_t *cast = (const pm_class_variable_write_node_t *) node;
4361 pm_dump_json_location(buffer, parser, &cast->base.location);
4362
4363 // Dump the name field
4364 pm_buffer_append_byte(buffer, ',');
4365 pm_buffer_append_string(buffer, "\"name\":", 7);
4366 pm_dump_json_constant(buffer, parser, cast->name);
4367
4368 // Dump the name_loc field
4369 pm_buffer_append_byte(buffer, ',');
4370 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4371 pm_dump_json_location(buffer, parser, &cast->name_loc);
4372
4373 // Dump the value field
4374 pm_buffer_append_byte(buffer, ',');
4375 pm_buffer_append_string(buffer, "\"value\":", 8);
4376 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4377
4378 // Dump the operator_loc field
4379 pm_buffer_append_byte(buffer, ',');
4380 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4381 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4382
4383 pm_buffer_append_byte(buffer, '}');
4384 break;
4385 }
4386 case PM_CONSTANT_AND_WRITE_NODE: {
4387 pm_buffer_append_string(buffer, "{\"type\":\"ConstantAndWriteNode\",\"location\":", 42);
4388
4389 const pm_constant_and_write_node_t *cast = (const pm_constant_and_write_node_t *) node;
4390 pm_dump_json_location(buffer, parser, &cast->base.location);
4391
4392 // Dump the name field
4393 pm_buffer_append_byte(buffer, ',');
4394 pm_buffer_append_string(buffer, "\"name\":", 7);
4395 pm_dump_json_constant(buffer, parser, cast->name);
4396
4397 // Dump the name_loc field
4398 pm_buffer_append_byte(buffer, ',');
4399 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4400 pm_dump_json_location(buffer, parser, &cast->name_loc);
4401
4402 // Dump the operator_loc field
4403 pm_buffer_append_byte(buffer, ',');
4404 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4405 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4406
4407 // Dump the value field
4408 pm_buffer_append_byte(buffer, ',');
4409 pm_buffer_append_string(buffer, "\"value\":", 8);
4410 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4411
4412 pm_buffer_append_byte(buffer, '}');
4413 break;
4414 }
4415 case PM_CONSTANT_OPERATOR_WRITE_NODE: {
4416 pm_buffer_append_string(buffer, "{\"type\":\"ConstantOperatorWriteNode\",\"location\":", 47);
4417
4418 const pm_constant_operator_write_node_t *cast = (const pm_constant_operator_write_node_t *) node;
4419 pm_dump_json_location(buffer, parser, &cast->base.location);
4420
4421 // Dump the name field
4422 pm_buffer_append_byte(buffer, ',');
4423 pm_buffer_append_string(buffer, "\"name\":", 7);
4424 pm_dump_json_constant(buffer, parser, cast->name);
4425
4426 // Dump the name_loc field
4427 pm_buffer_append_byte(buffer, ',');
4428 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4429 pm_dump_json_location(buffer, parser, &cast->name_loc);
4430
4431 // Dump the binary_operator_loc field
4432 pm_buffer_append_byte(buffer, ',');
4433 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
4434 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
4435
4436 // Dump the value field
4437 pm_buffer_append_byte(buffer, ',');
4438 pm_buffer_append_string(buffer, "\"value\":", 8);
4439 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4440
4441 // Dump the binary_operator field
4442 pm_buffer_append_byte(buffer, ',');
4443 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
4444 pm_dump_json_constant(buffer, parser, cast->binary_operator);
4445
4446 pm_buffer_append_byte(buffer, '}');
4447 break;
4448 }
4449 case PM_CONSTANT_OR_WRITE_NODE: {
4450 pm_buffer_append_string(buffer, "{\"type\":\"ConstantOrWriteNode\",\"location\":", 41);
4451
4452 const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node;
4453 pm_dump_json_location(buffer, parser, &cast->base.location);
4454
4455 // Dump the name field
4456 pm_buffer_append_byte(buffer, ',');
4457 pm_buffer_append_string(buffer, "\"name\":", 7);
4458 pm_dump_json_constant(buffer, parser, cast->name);
4459
4460 // Dump the name_loc field
4461 pm_buffer_append_byte(buffer, ',');
4462 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4463 pm_dump_json_location(buffer, parser, &cast->name_loc);
4464
4465 // Dump the operator_loc field
4466 pm_buffer_append_byte(buffer, ',');
4467 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4468 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4469
4470 // Dump the value field
4471 pm_buffer_append_byte(buffer, ',');
4472 pm_buffer_append_string(buffer, "\"value\":", 8);
4473 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4474
4475 pm_buffer_append_byte(buffer, '}');
4476 break;
4477 }
4478 case PM_CONSTANT_PATH_AND_WRITE_NODE: {
4479 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathAndWriteNode\",\"location\":", 46);
4480
4481 const pm_constant_path_and_write_node_t *cast = (const pm_constant_path_and_write_node_t *) node;
4482 pm_dump_json_location(buffer, parser, &cast->base.location);
4483
4484 // Dump the target field
4485 pm_buffer_append_byte(buffer, ',');
4486 pm_buffer_append_string(buffer, "\"target\":", 9);
4487 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4488
4489 // Dump the operator_loc field
4490 pm_buffer_append_byte(buffer, ',');
4491 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4492 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4493
4494 // Dump the value field
4495 pm_buffer_append_byte(buffer, ',');
4496 pm_buffer_append_string(buffer, "\"value\":", 8);
4497 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4498
4499 pm_buffer_append_byte(buffer, '}');
4500 break;
4501 }
4502 case PM_CONSTANT_PATH_NODE: {
4503 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathNode\",\"location\":", 38);
4504
4505 const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node;
4506 pm_dump_json_location(buffer, parser, &cast->base.location);
4507
4508 // Dump the parent field
4509 pm_buffer_append_byte(buffer, ',');
4510 pm_buffer_append_string(buffer, "\"parent\":", 9);
4511 if (cast->parent != NULL) {
4512 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent);
4513 } else {
4514 pm_buffer_append_string(buffer, "null", 4);
4515 }
4516
4517 // Dump the name field
4518 pm_buffer_append_byte(buffer, ',');
4519 pm_buffer_append_string(buffer, "\"name\":", 7);
4520 if (cast->name != PM_CONSTANT_ID_UNSET) {
4521 pm_dump_json_constant(buffer, parser, cast->name);
4522 } else {
4523 pm_buffer_append_string(buffer, "null", 4);
4524 }
4525
4526 // Dump the delimiter_loc field
4527 pm_buffer_append_byte(buffer, ',');
4528 pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16);
4529 pm_dump_json_location(buffer, parser, &cast->delimiter_loc);
4530
4531 // Dump the name_loc field
4532 pm_buffer_append_byte(buffer, ',');
4533 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4534 pm_dump_json_location(buffer, parser, &cast->name_loc);
4535
4536 pm_buffer_append_byte(buffer, '}');
4537 break;
4538 }
4539 case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
4540 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOperatorWriteNode\",\"location\":", 51);
4541
4542 const pm_constant_path_operator_write_node_t *cast = (const pm_constant_path_operator_write_node_t *) node;
4543 pm_dump_json_location(buffer, parser, &cast->base.location);
4544
4545 // Dump the target field
4546 pm_buffer_append_byte(buffer, ',');
4547 pm_buffer_append_string(buffer, "\"target\":", 9);
4548 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4549
4550 // Dump the binary_operator_loc field
4551 pm_buffer_append_byte(buffer, ',');
4552 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
4553 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
4554
4555 // Dump the value field
4556 pm_buffer_append_byte(buffer, ',');
4557 pm_buffer_append_string(buffer, "\"value\":", 8);
4558 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4559
4560 // Dump the binary_operator field
4561 pm_buffer_append_byte(buffer, ',');
4562 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
4563 pm_dump_json_constant(buffer, parser, cast->binary_operator);
4564
4565 pm_buffer_append_byte(buffer, '}');
4566 break;
4567 }
4568 case PM_CONSTANT_PATH_OR_WRITE_NODE: {
4569 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOrWriteNode\",\"location\":", 45);
4570
4571 const pm_constant_path_or_write_node_t *cast = (const pm_constant_path_or_write_node_t *) node;
4572 pm_dump_json_location(buffer, parser, &cast->base.location);
4573
4574 // Dump the target field
4575 pm_buffer_append_byte(buffer, ',');
4576 pm_buffer_append_string(buffer, "\"target\":", 9);
4577 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4578
4579 // Dump the operator_loc field
4580 pm_buffer_append_byte(buffer, ',');
4581 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4582 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4583
4584 // Dump the value field
4585 pm_buffer_append_byte(buffer, ',');
4586 pm_buffer_append_string(buffer, "\"value\":", 8);
4587 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4588
4589 pm_buffer_append_byte(buffer, '}');
4590 break;
4591 }
4592 case PM_CONSTANT_PATH_TARGET_NODE: {
4593 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathTargetNode\",\"location\":", 44);
4594
4595 const pm_constant_path_target_node_t *cast = (const pm_constant_path_target_node_t *) node;
4596 pm_dump_json_location(buffer, parser, &cast->base.location);
4597
4598 // Dump the parent field
4599 pm_buffer_append_byte(buffer, ',');
4600 pm_buffer_append_string(buffer, "\"parent\":", 9);
4601 if (cast->parent != NULL) {
4602 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent);
4603 } else {
4604 pm_buffer_append_string(buffer, "null", 4);
4605 }
4606
4607 // Dump the name field
4608 pm_buffer_append_byte(buffer, ',');
4609 pm_buffer_append_string(buffer, "\"name\":", 7);
4610 if (cast->name != PM_CONSTANT_ID_UNSET) {
4611 pm_dump_json_constant(buffer, parser, cast->name);
4612 } else {
4613 pm_buffer_append_string(buffer, "null", 4);
4614 }
4615
4616 // Dump the delimiter_loc field
4617 pm_buffer_append_byte(buffer, ',');
4618 pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16);
4619 pm_dump_json_location(buffer, parser, &cast->delimiter_loc);
4620
4621 // Dump the name_loc field
4622 pm_buffer_append_byte(buffer, ',');
4623 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4624 pm_dump_json_location(buffer, parser, &cast->name_loc);
4625
4626 pm_buffer_append_byte(buffer, '}');
4627 break;
4628 }
4629 case PM_CONSTANT_PATH_WRITE_NODE: {
4630 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathWriteNode\",\"location\":", 43);
4631
4632 const pm_constant_path_write_node_t *cast = (const pm_constant_path_write_node_t *) node;
4633 pm_dump_json_location(buffer, parser, &cast->base.location);
4634
4635 // Dump the target field
4636 pm_buffer_append_byte(buffer, ',');
4637 pm_buffer_append_string(buffer, "\"target\":", 9);
4638 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
4639
4640 // Dump the operator_loc field
4641 pm_buffer_append_byte(buffer, ',');
4642 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4643 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4644
4645 // Dump the value field
4646 pm_buffer_append_byte(buffer, ',');
4647 pm_buffer_append_string(buffer, "\"value\":", 8);
4648 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4649
4650 pm_buffer_append_byte(buffer, '}');
4651 break;
4652 }
4653 case PM_CONSTANT_READ_NODE: {
4654 pm_buffer_append_string(buffer, "{\"type\":\"ConstantReadNode\",\"location\":", 38);
4655
4656 const pm_constant_read_node_t *cast = (const pm_constant_read_node_t *) node;
4657 pm_dump_json_location(buffer, parser, &cast->base.location);
4658
4659 // Dump the name field
4660 pm_buffer_append_byte(buffer, ',');
4661 pm_buffer_append_string(buffer, "\"name\":", 7);
4662 pm_dump_json_constant(buffer, parser, cast->name);
4663
4664 pm_buffer_append_byte(buffer, '}');
4665 break;
4666 }
4667 case PM_CONSTANT_TARGET_NODE: {
4668 pm_buffer_append_string(buffer, "{\"type\":\"ConstantTargetNode\",\"location\":", 40);
4669
4670 const pm_constant_target_node_t *cast = (const pm_constant_target_node_t *) node;
4671 pm_dump_json_location(buffer, parser, &cast->base.location);
4672
4673 // Dump the name field
4674 pm_buffer_append_byte(buffer, ',');
4675 pm_buffer_append_string(buffer, "\"name\":", 7);
4676 pm_dump_json_constant(buffer, parser, cast->name);
4677
4678 pm_buffer_append_byte(buffer, '}');
4679 break;
4680 }
4681 case PM_CONSTANT_WRITE_NODE: {
4682 pm_buffer_append_string(buffer, "{\"type\":\"ConstantWriteNode\",\"location\":", 39);
4683
4684 const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node;
4685 pm_dump_json_location(buffer, parser, &cast->base.location);
4686
4687 // Dump the name field
4688 pm_buffer_append_byte(buffer, ',');
4689 pm_buffer_append_string(buffer, "\"name\":", 7);
4690 pm_dump_json_constant(buffer, parser, cast->name);
4691
4692 // Dump the name_loc field
4693 pm_buffer_append_byte(buffer, ',');
4694 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4695 pm_dump_json_location(buffer, parser, &cast->name_loc);
4696
4697 // Dump the value field
4698 pm_buffer_append_byte(buffer, ',');
4699 pm_buffer_append_string(buffer, "\"value\":", 8);
4700 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4701
4702 // Dump the operator_loc field
4703 pm_buffer_append_byte(buffer, ',');
4704 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4705 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4706
4707 pm_buffer_append_byte(buffer, '}');
4708 break;
4709 }
4710 case PM_DEF_NODE: {
4711 pm_buffer_append_string(buffer, "{\"type\":\"DefNode\",\"location\":", 29);
4712
4713 const pm_def_node_t *cast = (const pm_def_node_t *) node;
4714 pm_dump_json_location(buffer, parser, &cast->base.location);
4715
4716 // Dump the name field
4717 pm_buffer_append_byte(buffer, ',');
4718 pm_buffer_append_string(buffer, "\"name\":", 7);
4719 pm_dump_json_constant(buffer, parser, cast->name);
4720
4721 // Dump the name_loc field
4722 pm_buffer_append_byte(buffer, ',');
4723 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4724 pm_dump_json_location(buffer, parser, &cast->name_loc);
4725
4726 // Dump the receiver field
4727 pm_buffer_append_byte(buffer, ',');
4728 pm_buffer_append_string(buffer, "\"receiver\":", 11);
4729 if (cast->receiver != NULL) {
4730 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
4731 } else {
4732 pm_buffer_append_string(buffer, "null", 4);
4733 }
4734
4735 // Dump the parameters field
4736 pm_buffer_append_byte(buffer, ',');
4737 pm_buffer_append_string(buffer, "\"parameters\":", 13);
4738 if (cast->parameters != NULL) {
4739 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
4740 } else {
4741 pm_buffer_append_string(buffer, "null", 4);
4742 }
4743
4744 // Dump the body field
4745 pm_buffer_append_byte(buffer, ',');
4746 pm_buffer_append_string(buffer, "\"body\":", 7);
4747 if (cast->body != NULL) {
4748 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
4749 } else {
4750 pm_buffer_append_string(buffer, "null", 4);
4751 }
4752
4753 // Dump the locals field
4754 pm_buffer_append_byte(buffer, ',');
4755 pm_buffer_append_string(buffer, "\"locals\":", 9);
4756 const pm_constant_id_list_t *locals = &cast->locals;
4757 pm_buffer_append_byte(buffer, '[');
4758
4759 for (size_t index = 0; index < locals->size; index++) {
4760 if (index != 0) pm_buffer_append_byte(buffer, ',');
4761 pm_dump_json_constant(buffer, parser, locals->ids[index]);
4762 }
4763 pm_buffer_append_byte(buffer, ']');
4764
4765 // Dump the def_keyword_loc field
4766 pm_buffer_append_byte(buffer, ',');
4767 pm_buffer_append_string(buffer, "\"def_keyword_loc\":", 18);
4768 pm_dump_json_location(buffer, parser, &cast->def_keyword_loc);
4769
4770 // Dump the operator_loc field
4771 pm_buffer_append_byte(buffer, ',');
4772 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4773 if (cast->operator_loc.start != NULL) {
4774 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4775 } else {
4776 pm_buffer_append_string(buffer, "null", 4);
4777 }
4778
4779 // Dump the lparen_loc field
4780 pm_buffer_append_byte(buffer, ',');
4781 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4782 if (cast->lparen_loc.start != NULL) {
4783 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
4784 } else {
4785 pm_buffer_append_string(buffer, "null", 4);
4786 }
4787
4788 // Dump the rparen_loc field
4789 pm_buffer_append_byte(buffer, ',');
4790 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4791 if (cast->rparen_loc.start != NULL) {
4792 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
4793 } else {
4794 pm_buffer_append_string(buffer, "null", 4);
4795 }
4796
4797 // Dump the equal_loc field
4798 pm_buffer_append_byte(buffer, ',');
4799 pm_buffer_append_string(buffer, "\"equal_loc\":", 12);
4800 if (cast->equal_loc.start != NULL) {
4801 pm_dump_json_location(buffer, parser, &cast->equal_loc);
4802 } else {
4803 pm_buffer_append_string(buffer, "null", 4);
4804 }
4805
4806 // Dump the end_keyword_loc field
4807 pm_buffer_append_byte(buffer, ',');
4808 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4809 if (cast->end_keyword_loc.start != NULL) {
4810 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4811 } else {
4812 pm_buffer_append_string(buffer, "null", 4);
4813 }
4814
4815 pm_buffer_append_byte(buffer, '}');
4816 break;
4817 }
4818 case PM_DEFINED_NODE: {
4819 pm_buffer_append_string(buffer, "{\"type\":\"DefinedNode\",\"location\":", 33);
4820
4821 const pm_defined_node_t *cast = (const pm_defined_node_t *) node;
4822 pm_dump_json_location(buffer, parser, &cast->base.location);
4823
4824 // Dump the lparen_loc field
4825 pm_buffer_append_byte(buffer, ',');
4826 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4827 if (cast->lparen_loc.start != NULL) {
4828 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
4829 } else {
4830 pm_buffer_append_string(buffer, "null", 4);
4831 }
4832
4833 // Dump the value field
4834 pm_buffer_append_byte(buffer, ',');
4835 pm_buffer_append_string(buffer, "\"value\":", 8);
4836 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4837
4838 // Dump the rparen_loc field
4839 pm_buffer_append_byte(buffer, ',');
4840 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4841 if (cast->rparen_loc.start != NULL) {
4842 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
4843 } else {
4844 pm_buffer_append_string(buffer, "null", 4);
4845 }
4846
4847 // Dump the keyword_loc field
4848 pm_buffer_append_byte(buffer, ',');
4849 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4850 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
4851
4852 pm_buffer_append_byte(buffer, '}');
4853 break;
4854 }
4855 case PM_ELSE_NODE: {
4856 pm_buffer_append_string(buffer, "{\"type\":\"ElseNode\",\"location\":", 30);
4857
4858 const pm_else_node_t *cast = (const pm_else_node_t *) node;
4859 pm_dump_json_location(buffer, parser, &cast->base.location);
4860
4861 // Dump the else_keyword_loc field
4862 pm_buffer_append_byte(buffer, ',');
4863 pm_buffer_append_string(buffer, "\"else_keyword_loc\":", 19);
4864 pm_dump_json_location(buffer, parser, &cast->else_keyword_loc);
4865
4866 // Dump the statements field
4867 pm_buffer_append_byte(buffer, ',');
4868 pm_buffer_append_string(buffer, "\"statements\":", 13);
4869 if (cast->statements != NULL) {
4870 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4871 } else {
4872 pm_buffer_append_string(buffer, "null", 4);
4873 }
4874
4875 // Dump the end_keyword_loc field
4876 pm_buffer_append_byte(buffer, ',');
4877 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4878 if (cast->end_keyword_loc.start != NULL) {
4879 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4880 } else {
4881 pm_buffer_append_string(buffer, "null", 4);
4882 }
4883
4884 pm_buffer_append_byte(buffer, '}');
4885 break;
4886 }
4887 case PM_EMBEDDED_STATEMENTS_NODE: {
4888 pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedStatementsNode\",\"location\":", 44);
4889
4890 const pm_embedded_statements_node_t *cast = (const pm_embedded_statements_node_t *) node;
4891 pm_dump_json_location(buffer, parser, &cast->base.location);
4892
4893 // Dump the opening_loc field
4894 pm_buffer_append_byte(buffer, ',');
4895 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
4896 pm_dump_json_location(buffer, parser, &cast->opening_loc);
4897
4898 // Dump the statements field
4899 pm_buffer_append_byte(buffer, ',');
4900 pm_buffer_append_string(buffer, "\"statements\":", 13);
4901 if (cast->statements != NULL) {
4902 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4903 } else {
4904 pm_buffer_append_string(buffer, "null", 4);
4905 }
4906
4907 // Dump the closing_loc field
4908 pm_buffer_append_byte(buffer, ',');
4909 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
4910 pm_dump_json_location(buffer, parser, &cast->closing_loc);
4911
4912 pm_buffer_append_byte(buffer, '}');
4913 break;
4914 }
4915 case PM_EMBEDDED_VARIABLE_NODE: {
4916 pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedVariableNode\",\"location\":", 42);
4917
4918 const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node;
4919 pm_dump_json_location(buffer, parser, &cast->base.location);
4920
4921 // Dump the operator_loc field
4922 pm_buffer_append_byte(buffer, ',');
4923 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4924 pm_dump_json_location(buffer, parser, &cast->operator_loc);
4925
4926 // Dump the variable field
4927 pm_buffer_append_byte(buffer, ',');
4928 pm_buffer_append_string(buffer, "\"variable\":", 11);
4929 pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable);
4930
4931 pm_buffer_append_byte(buffer, '}');
4932 break;
4933 }
4934 case PM_ENSURE_NODE: {
4935 pm_buffer_append_string(buffer, "{\"type\":\"EnsureNode\",\"location\":", 32);
4936
4937 const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
4938 pm_dump_json_location(buffer, parser, &cast->base.location);
4939
4940 // Dump the ensure_keyword_loc field
4941 pm_buffer_append_byte(buffer, ',');
4942 pm_buffer_append_string(buffer, "\"ensure_keyword_loc\":", 21);
4943 pm_dump_json_location(buffer, parser, &cast->ensure_keyword_loc);
4944
4945 // Dump the statements field
4946 pm_buffer_append_byte(buffer, ',');
4947 pm_buffer_append_string(buffer, "\"statements\":", 13);
4948 if (cast->statements != NULL) {
4949 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4950 } else {
4951 pm_buffer_append_string(buffer, "null", 4);
4952 }
4953
4954 // Dump the end_keyword_loc field
4955 pm_buffer_append_byte(buffer, ',');
4956 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
4957 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
4958
4959 pm_buffer_append_byte(buffer, '}');
4960 break;
4961 }
4962 case PM_FALSE_NODE: {
4963 pm_buffer_append_string(buffer, "{\"type\":\"FalseNode\",\"location\":", 31);
4964
4965 const pm_false_node_t *cast = (const pm_false_node_t *) node;
4966 pm_dump_json_location(buffer, parser, &cast->base.location);
4967
4968 pm_buffer_append_byte(buffer, '}');
4969 break;
4970 }
4971 case PM_FIND_PATTERN_NODE: {
4972 pm_buffer_append_string(buffer, "{\"type\":\"FindPatternNode\",\"location\":", 37);
4973
4974 const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node;
4975 pm_dump_json_location(buffer, parser, &cast->base.location);
4976
4977 // Dump the constant field
4978 pm_buffer_append_byte(buffer, ',');
4979 pm_buffer_append_string(buffer, "\"constant\":", 11);
4980 if (cast->constant != NULL) {
4981 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
4982 } else {
4983 pm_buffer_append_string(buffer, "null", 4);
4984 }
4985
4986 // Dump the left field
4987 pm_buffer_append_byte(buffer, ',');
4988 pm_buffer_append_string(buffer, "\"left\":", 7);
4989 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
4990
4991 // Dump the requireds field
4992 pm_buffer_append_byte(buffer, ',');
4993 pm_buffer_append_string(buffer, "\"requireds\":", 12);
4994 const pm_node_list_t *requireds = &cast->requireds;
4995 pm_buffer_append_byte(buffer, '[');
4996
4997 for (size_t index = 0; index < requireds->size; index++) {
4998 if (index != 0) pm_buffer_append_byte(buffer, ',');
4999 pm_dump_json(buffer, parser, requireds->nodes[index]);
5000 }
5001 pm_buffer_append_byte(buffer, ']');
5002
5003 // Dump the right field
5004 pm_buffer_append_byte(buffer, ',');
5005 pm_buffer_append_string(buffer, "\"right\":", 8);
5006 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
5007
5008 // Dump the opening_loc field
5009 pm_buffer_append_byte(buffer, ',');
5010 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5011 if (cast->opening_loc.start != NULL) {
5012 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5013 } else {
5014 pm_buffer_append_string(buffer, "null", 4);
5015 }
5016
5017 // Dump the closing_loc field
5018 pm_buffer_append_byte(buffer, ',');
5019 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5020 if (cast->closing_loc.start != NULL) {
5021 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5022 } else {
5023 pm_buffer_append_string(buffer, "null", 4);
5024 }
5025
5026 pm_buffer_append_byte(buffer, '}');
5027 break;
5028 }
5029 case PM_FLIP_FLOP_NODE: {
5030 pm_buffer_append_string(buffer, "{\"type\":\"FlipFlopNode\",\"location\":", 34);
5031
5032 const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node;
5033 pm_dump_json_location(buffer, parser, &cast->base.location);
5034
5035 // Dump the RangeFlags field
5036 pm_buffer_append_byte(buffer, ',');
5037 pm_buffer_append_string(buffer, "\"RangeFlags\":", 13);
5038 size_t flags = 0;
5039 pm_buffer_append_byte(buffer, '[');
5040 if (PM_NODE_FLAG_P(cast, PM_RANGE_FLAGS_EXCLUDE_END)) {
5041 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5042 pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13);
5043 flags++;
5044 }
5045 pm_buffer_append_byte(buffer, ']');
5046
5047 // Dump the left field
5048 pm_buffer_append_byte(buffer, ',');
5049 pm_buffer_append_string(buffer, "\"left\":", 7);
5050 if (cast->left != NULL) {
5051 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
5052 } else {
5053 pm_buffer_append_string(buffer, "null", 4);
5054 }
5055
5056 // Dump the right field
5057 pm_buffer_append_byte(buffer, ',');
5058 pm_buffer_append_string(buffer, "\"right\":", 8);
5059 if (cast->right != NULL) {
5060 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
5061 } else {
5062 pm_buffer_append_string(buffer, "null", 4);
5063 }
5064
5065 // Dump the operator_loc field
5066 pm_buffer_append_byte(buffer, ',');
5067 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5068 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5069
5070 pm_buffer_append_byte(buffer, '}');
5071 break;
5072 }
5073 case PM_FLOAT_NODE: {
5074 pm_buffer_append_string(buffer, "{\"type\":\"FloatNode\",\"location\":", 31);
5075
5076 const pm_float_node_t *cast = (const pm_float_node_t *) node;
5077 pm_dump_json_location(buffer, parser, &cast->base.location);
5078
5079 // Dump the value field
5080 pm_buffer_append_byte(buffer, ',');
5081 pm_buffer_append_string(buffer, "\"value\":", 8);
5082 pm_buffer_append_format(buffer, "%f", cast->value);
5083
5084 pm_buffer_append_byte(buffer, '}');
5085 break;
5086 }
5087 case PM_FOR_NODE: {
5088 pm_buffer_append_string(buffer, "{\"type\":\"ForNode\",\"location\":", 29);
5089
5090 const pm_for_node_t *cast = (const pm_for_node_t *) node;
5091 pm_dump_json_location(buffer, parser, &cast->base.location);
5092
5093 // Dump the index field
5094 pm_buffer_append_byte(buffer, ',');
5095 pm_buffer_append_string(buffer, "\"index\":", 8);
5096 pm_dump_json(buffer, parser, (const pm_node_t *) cast->index);
5097
5098 // Dump the collection field
5099 pm_buffer_append_byte(buffer, ',');
5100 pm_buffer_append_string(buffer, "\"collection\":", 13);
5101 pm_dump_json(buffer, parser, (const pm_node_t *) cast->collection);
5102
5103 // Dump the statements field
5104 pm_buffer_append_byte(buffer, ',');
5105 pm_buffer_append_string(buffer, "\"statements\":", 13);
5106 if (cast->statements != NULL) {
5107 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5108 } else {
5109 pm_buffer_append_string(buffer, "null", 4);
5110 }
5111
5112 // Dump the for_keyword_loc field
5113 pm_buffer_append_byte(buffer, ',');
5114 pm_buffer_append_string(buffer, "\"for_keyword_loc\":", 18);
5115 pm_dump_json_location(buffer, parser, &cast->for_keyword_loc);
5116
5117 // Dump the in_keyword_loc field
5118 pm_buffer_append_byte(buffer, ',');
5119 pm_buffer_append_string(buffer, "\"in_keyword_loc\":", 17);
5120 pm_dump_json_location(buffer, parser, &cast->in_keyword_loc);
5121
5122 // Dump the do_keyword_loc field
5123 pm_buffer_append_byte(buffer, ',');
5124 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
5125 if (cast->do_keyword_loc.start != NULL) {
5126 pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
5127 } else {
5128 pm_buffer_append_string(buffer, "null", 4);
5129 }
5130
5131 // Dump the end_keyword_loc field
5132 pm_buffer_append_byte(buffer, ',');
5133 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5134 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
5135
5136 pm_buffer_append_byte(buffer, '}');
5137 break;
5138 }
5139 case PM_FORWARDING_ARGUMENTS_NODE: {
5140 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingArgumentsNode\",\"location\":", 45);
5141
5142 const pm_forwarding_arguments_node_t *cast = (const pm_forwarding_arguments_node_t *) node;
5143 pm_dump_json_location(buffer, parser, &cast->base.location);
5144
5145 pm_buffer_append_byte(buffer, '}');
5146 break;
5147 }
5148 case PM_FORWARDING_PARAMETER_NODE: {
5149 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingParameterNode\",\"location\":", 45);
5150
5151 const pm_forwarding_parameter_node_t *cast = (const pm_forwarding_parameter_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_SUPER_NODE: {
5158 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingSuperNode\",\"location\":", 41);
5159
5160 const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node;
5161 pm_dump_json_location(buffer, parser, &cast->base.location);
5162
5163 // Dump the block field
5164 pm_buffer_append_byte(buffer, ',');
5165 pm_buffer_append_string(buffer, "\"block\":", 8);
5166 if (cast->block != NULL) {
5167 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5168 } else {
5169 pm_buffer_append_string(buffer, "null", 4);
5170 }
5171
5172 pm_buffer_append_byte(buffer, '}');
5173 break;
5174 }
5175 case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: {
5176 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableAndWriteNode\",\"location\":", 48);
5177
5178 const pm_global_variable_and_write_node_t *cast = (const pm_global_variable_and_write_node_t *) node;
5179 pm_dump_json_location(buffer, parser, &cast->base.location);
5180
5181 // Dump the name field
5182 pm_buffer_append_byte(buffer, ',');
5183 pm_buffer_append_string(buffer, "\"name\":", 7);
5184 pm_dump_json_constant(buffer, parser, cast->name);
5185
5186 // Dump the name_loc field
5187 pm_buffer_append_byte(buffer, ',');
5188 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5189 pm_dump_json_location(buffer, parser, &cast->name_loc);
5190
5191 // Dump the operator_loc field
5192 pm_buffer_append_byte(buffer, ',');
5193 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5194 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5195
5196 // Dump the value field
5197 pm_buffer_append_byte(buffer, ',');
5198 pm_buffer_append_string(buffer, "\"value\":", 8);
5199 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5200
5201 pm_buffer_append_byte(buffer, '}');
5202 break;
5203 }
5204 case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
5205 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOperatorWriteNode\",\"location\":", 53);
5206
5207 const pm_global_variable_operator_write_node_t *cast = (const pm_global_variable_operator_write_node_t *) node;
5208 pm_dump_json_location(buffer, parser, &cast->base.location);
5209
5210 // Dump the name field
5211 pm_buffer_append_byte(buffer, ',');
5212 pm_buffer_append_string(buffer, "\"name\":", 7);
5213 pm_dump_json_constant(buffer, parser, cast->name);
5214
5215 // Dump the name_loc field
5216 pm_buffer_append_byte(buffer, ',');
5217 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5218 pm_dump_json_location(buffer, parser, &cast->name_loc);
5219
5220 // Dump the binary_operator_loc field
5221 pm_buffer_append_byte(buffer, ',');
5222 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
5223 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
5224
5225 // Dump the value field
5226 pm_buffer_append_byte(buffer, ',');
5227 pm_buffer_append_string(buffer, "\"value\":", 8);
5228 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5229
5230 // Dump the binary_operator field
5231 pm_buffer_append_byte(buffer, ',');
5232 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
5233 pm_dump_json_constant(buffer, parser, cast->binary_operator);
5234
5235 pm_buffer_append_byte(buffer, '}');
5236 break;
5237 }
5238 case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
5239 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOrWriteNode\",\"location\":", 47);
5240
5241 const pm_global_variable_or_write_node_t *cast = (const pm_global_variable_or_write_node_t *) node;
5242 pm_dump_json_location(buffer, parser, &cast->base.location);
5243
5244 // Dump the name field
5245 pm_buffer_append_byte(buffer, ',');
5246 pm_buffer_append_string(buffer, "\"name\":", 7);
5247 pm_dump_json_constant(buffer, parser, cast->name);
5248
5249 // Dump the name_loc field
5250 pm_buffer_append_byte(buffer, ',');
5251 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5252 pm_dump_json_location(buffer, parser, &cast->name_loc);
5253
5254 // Dump the operator_loc field
5255 pm_buffer_append_byte(buffer, ',');
5256 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5257 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5258
5259 // Dump the value field
5260 pm_buffer_append_byte(buffer, ',');
5261 pm_buffer_append_string(buffer, "\"value\":", 8);
5262 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5263
5264 pm_buffer_append_byte(buffer, '}');
5265 break;
5266 }
5267 case PM_GLOBAL_VARIABLE_READ_NODE: {
5268 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableReadNode\",\"location\":", 44);
5269
5270 const pm_global_variable_read_node_t *cast = (const pm_global_variable_read_node_t *) node;
5271 pm_dump_json_location(buffer, parser, &cast->base.location);
5272
5273 // Dump the name field
5274 pm_buffer_append_byte(buffer, ',');
5275 pm_buffer_append_string(buffer, "\"name\":", 7);
5276 pm_dump_json_constant(buffer, parser, cast->name);
5277
5278 pm_buffer_append_byte(buffer, '}');
5279 break;
5280 }
5281 case PM_GLOBAL_VARIABLE_TARGET_NODE: {
5282 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableTargetNode\",\"location\":", 46);
5283
5284 const pm_global_variable_target_node_t *cast = (const pm_global_variable_target_node_t *) node;
5285 pm_dump_json_location(buffer, parser, &cast->base.location);
5286
5287 // Dump the name field
5288 pm_buffer_append_byte(buffer, ',');
5289 pm_buffer_append_string(buffer, "\"name\":", 7);
5290 pm_dump_json_constant(buffer, parser, cast->name);
5291
5292 pm_buffer_append_byte(buffer, '}');
5293 break;
5294 }
5295 case PM_GLOBAL_VARIABLE_WRITE_NODE: {
5296 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableWriteNode\",\"location\":", 45);
5297
5298 const pm_global_variable_write_node_t *cast = (const pm_global_variable_write_node_t *) node;
5299 pm_dump_json_location(buffer, parser, &cast->base.location);
5300
5301 // Dump the name field
5302 pm_buffer_append_byte(buffer, ',');
5303 pm_buffer_append_string(buffer, "\"name\":", 7);
5304 pm_dump_json_constant(buffer, parser, cast->name);
5305
5306 // Dump the name_loc field
5307 pm_buffer_append_byte(buffer, ',');
5308 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5309 pm_dump_json_location(buffer, parser, &cast->name_loc);
5310
5311 // Dump the value field
5312 pm_buffer_append_byte(buffer, ',');
5313 pm_buffer_append_string(buffer, "\"value\":", 8);
5314 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5315
5316 // Dump the operator_loc field
5317 pm_buffer_append_byte(buffer, ',');
5318 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5319 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5320
5321 pm_buffer_append_byte(buffer, '}');
5322 break;
5323 }
5324 case PM_HASH_NODE: {
5325 pm_buffer_append_string(buffer, "{\"type\":\"HashNode\",\"location\":", 30);
5326
5327 const pm_hash_node_t *cast = (const pm_hash_node_t *) node;
5328 pm_dump_json_location(buffer, parser, &cast->base.location);
5329
5330 // Dump the opening_loc field
5331 pm_buffer_append_byte(buffer, ',');
5332 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5333 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5334
5335 // Dump the elements field
5336 pm_buffer_append_byte(buffer, ',');
5337 pm_buffer_append_string(buffer, "\"elements\":", 11);
5338 const pm_node_list_t *elements = &cast->elements;
5339 pm_buffer_append_byte(buffer, '[');
5340
5341 for (size_t index = 0; index < elements->size; index++) {
5342 if (index != 0) pm_buffer_append_byte(buffer, ',');
5343 pm_dump_json(buffer, parser, elements->nodes[index]);
5344 }
5345 pm_buffer_append_byte(buffer, ']');
5346
5347 // Dump the closing_loc field
5348 pm_buffer_append_byte(buffer, ',');
5349 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5350 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5351
5352 pm_buffer_append_byte(buffer, '}');
5353 break;
5354 }
5355 case PM_HASH_PATTERN_NODE: {
5356 pm_buffer_append_string(buffer, "{\"type\":\"HashPatternNode\",\"location\":", 37);
5357
5358 const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node;
5359 pm_dump_json_location(buffer, parser, &cast->base.location);
5360
5361 // Dump the constant field
5362 pm_buffer_append_byte(buffer, ',');
5363 pm_buffer_append_string(buffer, "\"constant\":", 11);
5364 if (cast->constant != NULL) {
5365 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
5366 } else {
5367 pm_buffer_append_string(buffer, "null", 4);
5368 }
5369
5370 // Dump the elements field
5371 pm_buffer_append_byte(buffer, ',');
5372 pm_buffer_append_string(buffer, "\"elements\":", 11);
5373 const pm_node_list_t *elements = &cast->elements;
5374 pm_buffer_append_byte(buffer, '[');
5375
5376 for (size_t index = 0; index < elements->size; index++) {
5377 if (index != 0) pm_buffer_append_byte(buffer, ',');
5378 pm_dump_json(buffer, parser, elements->nodes[index]);
5379 }
5380 pm_buffer_append_byte(buffer, ']');
5381
5382 // Dump the rest field
5383 pm_buffer_append_byte(buffer, ',');
5384 pm_buffer_append_string(buffer, "\"rest\":", 7);
5385 if (cast->rest != NULL) {
5386 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
5387 } else {
5388 pm_buffer_append_string(buffer, "null", 4);
5389 }
5390
5391 // Dump the opening_loc field
5392 pm_buffer_append_byte(buffer, ',');
5393 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5394 if (cast->opening_loc.start != NULL) {
5395 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5396 } else {
5397 pm_buffer_append_string(buffer, "null", 4);
5398 }
5399
5400 // Dump the closing_loc field
5401 pm_buffer_append_byte(buffer, ',');
5402 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5403 if (cast->closing_loc.start != NULL) {
5404 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5405 } else {
5406 pm_buffer_append_string(buffer, "null", 4);
5407 }
5408
5409 pm_buffer_append_byte(buffer, '}');
5410 break;
5411 }
5412 case PM_IF_NODE: {
5413 pm_buffer_append_string(buffer, "{\"type\":\"IfNode\",\"location\":", 28);
5414
5415 const pm_if_node_t *cast = (const pm_if_node_t *) node;
5416 pm_dump_json_location(buffer, parser, &cast->base.location);
5417
5418 // Dump the if_keyword_loc field
5419 pm_buffer_append_byte(buffer, ',');
5420 pm_buffer_append_string(buffer, "\"if_keyword_loc\":", 17);
5421 if (cast->if_keyword_loc.start != NULL) {
5422 pm_dump_json_location(buffer, parser, &cast->if_keyword_loc);
5423 } else {
5424 pm_buffer_append_string(buffer, "null", 4);
5425 }
5426
5427 // Dump the predicate field
5428 pm_buffer_append_byte(buffer, ',');
5429 pm_buffer_append_string(buffer, "\"predicate\":", 12);
5430 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
5431
5432 // Dump the then_keyword_loc field
5433 pm_buffer_append_byte(buffer, ',');
5434 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
5435 if (cast->then_keyword_loc.start != NULL) {
5436 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
5437 } else {
5438 pm_buffer_append_string(buffer, "null", 4);
5439 }
5440
5441 // Dump the statements field
5442 pm_buffer_append_byte(buffer, ',');
5443 pm_buffer_append_string(buffer, "\"statements\":", 13);
5444 if (cast->statements != NULL) {
5445 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5446 } else {
5447 pm_buffer_append_string(buffer, "null", 4);
5448 }
5449
5450 // Dump the subsequent field
5451 pm_buffer_append_byte(buffer, ',');
5452 pm_buffer_append_string(buffer, "\"subsequent\":", 13);
5453 if (cast->subsequent != NULL) {
5454 pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent);
5455 } else {
5456 pm_buffer_append_string(buffer, "null", 4);
5457 }
5458
5459 // Dump the end_keyword_loc field
5460 pm_buffer_append_byte(buffer, ',');
5461 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5462 if (cast->end_keyword_loc.start != NULL) {
5463 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
5464 } else {
5465 pm_buffer_append_string(buffer, "null", 4);
5466 }
5467
5468 pm_buffer_append_byte(buffer, '}');
5469 break;
5470 }
5471 case PM_IMAGINARY_NODE: {
5472 pm_buffer_append_string(buffer, "{\"type\":\"ImaginaryNode\",\"location\":", 35);
5473
5474 const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node;
5475 pm_dump_json_location(buffer, parser, &cast->base.location);
5476
5477 // Dump the numeric field
5478 pm_buffer_append_byte(buffer, ',');
5479 pm_buffer_append_string(buffer, "\"numeric\":", 10);
5480 pm_dump_json(buffer, parser, (const pm_node_t *) cast->numeric);
5481
5482 pm_buffer_append_byte(buffer, '}');
5483 break;
5484 }
5485 case PM_IMPLICIT_NODE: {
5486 pm_buffer_append_string(buffer, "{\"type\":\"ImplicitNode\",\"location\":", 34);
5487
5488 const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node;
5489 pm_dump_json_location(buffer, parser, &cast->base.location);
5490
5491 // Dump the value field
5492 pm_buffer_append_byte(buffer, ',');
5493 pm_buffer_append_string(buffer, "\"value\":", 8);
5494 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5495
5496 pm_buffer_append_byte(buffer, '}');
5497 break;
5498 }
5499 case PM_IMPLICIT_REST_NODE: {
5500 pm_buffer_append_string(buffer, "{\"type\":\"ImplicitRestNode\",\"location\":", 38);
5501
5502 const pm_implicit_rest_node_t *cast = (const pm_implicit_rest_node_t *) node;
5503 pm_dump_json_location(buffer, parser, &cast->base.location);
5504
5505 pm_buffer_append_byte(buffer, '}');
5506 break;
5507 }
5508 case PM_IN_NODE: {
5509 pm_buffer_append_string(buffer, "{\"type\":\"InNode\",\"location\":", 28);
5510
5511 const pm_in_node_t *cast = (const pm_in_node_t *) node;
5512 pm_dump_json_location(buffer, parser, &cast->base.location);
5513
5514 // Dump the pattern field
5515 pm_buffer_append_byte(buffer, ',');
5516 pm_buffer_append_string(buffer, "\"pattern\":", 10);
5517 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
5518
5519 // Dump the statements field
5520 pm_buffer_append_byte(buffer, ',');
5521 pm_buffer_append_string(buffer, "\"statements\":", 13);
5522 if (cast->statements != NULL) {
5523 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5524 } else {
5525 pm_buffer_append_string(buffer, "null", 4);
5526 }
5527
5528 // Dump the in_loc field
5529 pm_buffer_append_byte(buffer, ',');
5530 pm_buffer_append_string(buffer, "\"in_loc\":", 9);
5531 pm_dump_json_location(buffer, parser, &cast->in_loc);
5532
5533 // Dump the then_loc field
5534 pm_buffer_append_byte(buffer, ',');
5535 pm_buffer_append_string(buffer, "\"then_loc\":", 11);
5536 if (cast->then_loc.start != NULL) {
5537 pm_dump_json_location(buffer, parser, &cast->then_loc);
5538 } else {
5539 pm_buffer_append_string(buffer, "null", 4);
5540 }
5541
5542 pm_buffer_append_byte(buffer, '}');
5543 break;
5544 }
5545 case PM_INDEX_AND_WRITE_NODE: {
5546 pm_buffer_append_string(buffer, "{\"type\":\"IndexAndWriteNode\",\"location\":", 39);
5547
5548 const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node;
5549 pm_dump_json_location(buffer, parser, &cast->base.location);
5550
5551 // Dump the CallNodeFlags field
5552 pm_buffer_append_byte(buffer, ',');
5553 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5554 size_t flags = 0;
5555 pm_buffer_append_byte(buffer, '[');
5556 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
5557 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5558 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5559 flags++;
5560 }
5561 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
5562 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5563 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5564 flags++;
5565 }
5566 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
5567 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5568 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5569 flags++;
5570 }
5571 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
5572 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5573 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5574 flags++;
5575 }
5576 pm_buffer_append_byte(buffer, ']');
5577
5578 // Dump the receiver field
5579 pm_buffer_append_byte(buffer, ',');
5580 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5581 if (cast->receiver != NULL) {
5582 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5583 } else {
5584 pm_buffer_append_string(buffer, "null", 4);
5585 }
5586
5587 // Dump the call_operator_loc field
5588 pm_buffer_append_byte(buffer, ',');
5589 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
5590 if (cast->call_operator_loc.start != NULL) {
5591 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
5592 } else {
5593 pm_buffer_append_string(buffer, "null", 4);
5594 }
5595
5596 // Dump the opening_loc field
5597 pm_buffer_append_byte(buffer, ',');
5598 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5599 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5600
5601 // Dump the arguments field
5602 pm_buffer_append_byte(buffer, ',');
5603 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5604 if (cast->arguments != NULL) {
5605 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5606 } else {
5607 pm_buffer_append_string(buffer, "null", 4);
5608 }
5609
5610 // Dump the closing_loc field
5611 pm_buffer_append_byte(buffer, ',');
5612 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5613 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5614
5615 // Dump the block field
5616 pm_buffer_append_byte(buffer, ',');
5617 pm_buffer_append_string(buffer, "\"block\":", 8);
5618 if (cast->block != NULL) {
5619 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5620 } else {
5621 pm_buffer_append_string(buffer, "null", 4);
5622 }
5623
5624 // Dump the operator_loc field
5625 pm_buffer_append_byte(buffer, ',');
5626 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5627 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5628
5629 // Dump the value field
5630 pm_buffer_append_byte(buffer, ',');
5631 pm_buffer_append_string(buffer, "\"value\":", 8);
5632 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5633
5634 pm_buffer_append_byte(buffer, '}');
5635 break;
5636 }
5637 case PM_INDEX_OPERATOR_WRITE_NODE: {
5638 pm_buffer_append_string(buffer, "{\"type\":\"IndexOperatorWriteNode\",\"location\":", 44);
5639
5640 const pm_index_operator_write_node_t *cast = (const pm_index_operator_write_node_t *) node;
5641 pm_dump_json_location(buffer, parser, &cast->base.location);
5642
5643 // Dump the CallNodeFlags field
5644 pm_buffer_append_byte(buffer, ',');
5645 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5646 size_t flags = 0;
5647 pm_buffer_append_byte(buffer, '[');
5648 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
5649 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5650 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5651 flags++;
5652 }
5653 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
5654 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5655 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5656 flags++;
5657 }
5658 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
5659 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5660 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5661 flags++;
5662 }
5663 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
5664 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5665 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5666 flags++;
5667 }
5668 pm_buffer_append_byte(buffer, ']');
5669
5670 // Dump the receiver field
5671 pm_buffer_append_byte(buffer, ',');
5672 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5673 if (cast->receiver != NULL) {
5674 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5675 } else {
5676 pm_buffer_append_string(buffer, "null", 4);
5677 }
5678
5679 // Dump the call_operator_loc field
5680 pm_buffer_append_byte(buffer, ',');
5681 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
5682 if (cast->call_operator_loc.start != NULL) {
5683 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
5684 } else {
5685 pm_buffer_append_string(buffer, "null", 4);
5686 }
5687
5688 // Dump the opening_loc field
5689 pm_buffer_append_byte(buffer, ',');
5690 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5691 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5692
5693 // Dump the arguments field
5694 pm_buffer_append_byte(buffer, ',');
5695 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5696 if (cast->arguments != NULL) {
5697 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5698 } else {
5699 pm_buffer_append_string(buffer, "null", 4);
5700 }
5701
5702 // Dump the closing_loc field
5703 pm_buffer_append_byte(buffer, ',');
5704 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5705 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5706
5707 // Dump the block field
5708 pm_buffer_append_byte(buffer, ',');
5709 pm_buffer_append_string(buffer, "\"block\":", 8);
5710 if (cast->block != NULL) {
5711 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5712 } else {
5713 pm_buffer_append_string(buffer, "null", 4);
5714 }
5715
5716 // Dump the binary_operator field
5717 pm_buffer_append_byte(buffer, ',');
5718 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
5719 pm_dump_json_constant(buffer, parser, cast->binary_operator);
5720
5721 // Dump the binary_operator_loc field
5722 pm_buffer_append_byte(buffer, ',');
5723 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
5724 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
5725
5726 // Dump the value field
5727 pm_buffer_append_byte(buffer, ',');
5728 pm_buffer_append_string(buffer, "\"value\":", 8);
5729 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5730
5731 pm_buffer_append_byte(buffer, '}');
5732 break;
5733 }
5734 case PM_INDEX_OR_WRITE_NODE: {
5735 pm_buffer_append_string(buffer, "{\"type\":\"IndexOrWriteNode\",\"location\":", 38);
5736
5737 const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node;
5738 pm_dump_json_location(buffer, parser, &cast->base.location);
5739
5740 // Dump the CallNodeFlags field
5741 pm_buffer_append_byte(buffer, ',');
5742 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5743 size_t flags = 0;
5744 pm_buffer_append_byte(buffer, '[');
5745 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
5746 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5747 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5748 flags++;
5749 }
5750 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
5751 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5752 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5753 flags++;
5754 }
5755 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
5756 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5757 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5758 flags++;
5759 }
5760 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
5761 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5762 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5763 flags++;
5764 }
5765 pm_buffer_append_byte(buffer, ']');
5766
5767 // Dump the receiver field
5768 pm_buffer_append_byte(buffer, ',');
5769 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5770 if (cast->receiver != NULL) {
5771 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5772 } else {
5773 pm_buffer_append_string(buffer, "null", 4);
5774 }
5775
5776 // Dump the call_operator_loc field
5777 pm_buffer_append_byte(buffer, ',');
5778 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
5779 if (cast->call_operator_loc.start != NULL) {
5780 pm_dump_json_location(buffer, parser, &cast->call_operator_loc);
5781 } else {
5782 pm_buffer_append_string(buffer, "null", 4);
5783 }
5784
5785 // Dump the opening_loc field
5786 pm_buffer_append_byte(buffer, ',');
5787 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5788 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5789
5790 // Dump the arguments field
5791 pm_buffer_append_byte(buffer, ',');
5792 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5793 if (cast->arguments != NULL) {
5794 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5795 } else {
5796 pm_buffer_append_string(buffer, "null", 4);
5797 }
5798
5799 // Dump the closing_loc field
5800 pm_buffer_append_byte(buffer, ',');
5801 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5802 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5803
5804 // Dump the block field
5805 pm_buffer_append_byte(buffer, ',');
5806 pm_buffer_append_string(buffer, "\"block\":", 8);
5807 if (cast->block != NULL) {
5808 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5809 } else {
5810 pm_buffer_append_string(buffer, "null", 4);
5811 }
5812
5813 // Dump the operator_loc field
5814 pm_buffer_append_byte(buffer, ',');
5815 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5816 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5817
5818 // Dump the value field
5819 pm_buffer_append_byte(buffer, ',');
5820 pm_buffer_append_string(buffer, "\"value\":", 8);
5821 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5822
5823 pm_buffer_append_byte(buffer, '}');
5824 break;
5825 }
5826 case PM_INDEX_TARGET_NODE: {
5827 pm_buffer_append_string(buffer, "{\"type\":\"IndexTargetNode\",\"location\":", 37);
5828
5829 const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node;
5830 pm_dump_json_location(buffer, parser, &cast->base.location);
5831
5832 // Dump the CallNodeFlags field
5833 pm_buffer_append_byte(buffer, ',');
5834 pm_buffer_append_string(buffer, "\"CallNodeFlags\":", 16);
5835 size_t flags = 0;
5836 pm_buffer_append_byte(buffer, '[');
5837 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
5838 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5839 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
5840 flags++;
5841 }
5842 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
5843 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5844 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
5845 flags++;
5846 }
5847 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
5848 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5849 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
5850 flags++;
5851 }
5852 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
5853 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5854 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
5855 flags++;
5856 }
5857 pm_buffer_append_byte(buffer, ']');
5858
5859 // Dump the receiver field
5860 pm_buffer_append_byte(buffer, ',');
5861 pm_buffer_append_string(buffer, "\"receiver\":", 11);
5862 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
5863
5864 // Dump the opening_loc field
5865 pm_buffer_append_byte(buffer, ',');
5866 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5867 pm_dump_json_location(buffer, parser, &cast->opening_loc);
5868
5869 // Dump the arguments field
5870 pm_buffer_append_byte(buffer, ',');
5871 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5872 if (cast->arguments != NULL) {
5873 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5874 } else {
5875 pm_buffer_append_string(buffer, "null", 4);
5876 }
5877
5878 // Dump the closing_loc field
5879 pm_buffer_append_byte(buffer, ',');
5880 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5881 pm_dump_json_location(buffer, parser, &cast->closing_loc);
5882
5883 // Dump the block field
5884 pm_buffer_append_byte(buffer, ',');
5885 pm_buffer_append_string(buffer, "\"block\":", 8);
5886 if (cast->block != NULL) {
5887 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5888 } else {
5889 pm_buffer_append_string(buffer, "null", 4);
5890 }
5891
5892 pm_buffer_append_byte(buffer, '}');
5893 break;
5894 }
5895 case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
5896 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableAndWriteNode\",\"location\":", 50);
5897
5898 const pm_instance_variable_and_write_node_t *cast = (const pm_instance_variable_and_write_node_t *) node;
5899 pm_dump_json_location(buffer, parser, &cast->base.location);
5900
5901 // Dump the name field
5902 pm_buffer_append_byte(buffer, ',');
5903 pm_buffer_append_string(buffer, "\"name\":", 7);
5904 pm_dump_json_constant(buffer, parser, cast->name);
5905
5906 // Dump the name_loc field
5907 pm_buffer_append_byte(buffer, ',');
5908 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5909 pm_dump_json_location(buffer, parser, &cast->name_loc);
5910
5911 // Dump the operator_loc field
5912 pm_buffer_append_byte(buffer, ',');
5913 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5914 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5915
5916 // Dump the value field
5917 pm_buffer_append_byte(buffer, ',');
5918 pm_buffer_append_string(buffer, "\"value\":", 8);
5919 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5920
5921 pm_buffer_append_byte(buffer, '}');
5922 break;
5923 }
5924 case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
5925 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOperatorWriteNode\",\"location\":", 55);
5926
5927 const pm_instance_variable_operator_write_node_t *cast = (const pm_instance_variable_operator_write_node_t *) node;
5928 pm_dump_json_location(buffer, parser, &cast->base.location);
5929
5930 // Dump the name field
5931 pm_buffer_append_byte(buffer, ',');
5932 pm_buffer_append_string(buffer, "\"name\":", 7);
5933 pm_dump_json_constant(buffer, parser, cast->name);
5934
5935 // Dump the name_loc field
5936 pm_buffer_append_byte(buffer, ',');
5937 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5938 pm_dump_json_location(buffer, parser, &cast->name_loc);
5939
5940 // Dump the binary_operator_loc field
5941 pm_buffer_append_byte(buffer, ',');
5942 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
5943 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
5944
5945 // Dump the value field
5946 pm_buffer_append_byte(buffer, ',');
5947 pm_buffer_append_string(buffer, "\"value\":", 8);
5948 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5949
5950 // Dump the binary_operator field
5951 pm_buffer_append_byte(buffer, ',');
5952 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
5953 pm_dump_json_constant(buffer, parser, cast->binary_operator);
5954
5955 pm_buffer_append_byte(buffer, '}');
5956 break;
5957 }
5958 case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
5959 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOrWriteNode\",\"location\":", 49);
5960
5961 const pm_instance_variable_or_write_node_t *cast = (const pm_instance_variable_or_write_node_t *) node;
5962 pm_dump_json_location(buffer, parser, &cast->base.location);
5963
5964 // Dump the name field
5965 pm_buffer_append_byte(buffer, ',');
5966 pm_buffer_append_string(buffer, "\"name\":", 7);
5967 pm_dump_json_constant(buffer, parser, cast->name);
5968
5969 // Dump the name_loc field
5970 pm_buffer_append_byte(buffer, ',');
5971 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
5972 pm_dump_json_location(buffer, parser, &cast->name_loc);
5973
5974 // Dump the operator_loc field
5975 pm_buffer_append_byte(buffer, ',');
5976 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5977 pm_dump_json_location(buffer, parser, &cast->operator_loc);
5978
5979 // Dump the value field
5980 pm_buffer_append_byte(buffer, ',');
5981 pm_buffer_append_string(buffer, "\"value\":", 8);
5982 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
5983
5984 pm_buffer_append_byte(buffer, '}');
5985 break;
5986 }
5987 case PM_INSTANCE_VARIABLE_READ_NODE: {
5988 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableReadNode\",\"location\":", 46);
5989
5990 const pm_instance_variable_read_node_t *cast = (const pm_instance_variable_read_node_t *) node;
5991 pm_dump_json_location(buffer, parser, &cast->base.location);
5992
5993 // Dump the name field
5994 pm_buffer_append_byte(buffer, ',');
5995 pm_buffer_append_string(buffer, "\"name\":", 7);
5996 pm_dump_json_constant(buffer, parser, cast->name);
5997
5998 pm_buffer_append_byte(buffer, '}');
5999 break;
6000 }
6001 case PM_INSTANCE_VARIABLE_TARGET_NODE: {
6002 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableTargetNode\",\"location\":", 48);
6003
6004 const pm_instance_variable_target_node_t *cast = (const pm_instance_variable_target_node_t *) node;
6005 pm_dump_json_location(buffer, parser, &cast->base.location);
6006
6007 // Dump the name field
6008 pm_buffer_append_byte(buffer, ',');
6009 pm_buffer_append_string(buffer, "\"name\":", 7);
6010 pm_dump_json_constant(buffer, parser, cast->name);
6011
6012 pm_buffer_append_byte(buffer, '}');
6013 break;
6014 }
6015 case PM_INSTANCE_VARIABLE_WRITE_NODE: {
6016 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableWriteNode\",\"location\":", 47);
6017
6018 const pm_instance_variable_write_node_t *cast = (const pm_instance_variable_write_node_t *) node;
6019 pm_dump_json_location(buffer, parser, &cast->base.location);
6020
6021 // Dump the name field
6022 pm_buffer_append_byte(buffer, ',');
6023 pm_buffer_append_string(buffer, "\"name\":", 7);
6024 pm_dump_json_constant(buffer, parser, cast->name);
6025
6026 // Dump the name_loc field
6027 pm_buffer_append_byte(buffer, ',');
6028 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6029 pm_dump_json_location(buffer, parser, &cast->name_loc);
6030
6031 // Dump the value field
6032 pm_buffer_append_byte(buffer, ',');
6033 pm_buffer_append_string(buffer, "\"value\":", 8);
6034 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6035
6036 // Dump the operator_loc field
6037 pm_buffer_append_byte(buffer, ',');
6038 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6039 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6040
6041 pm_buffer_append_byte(buffer, '}');
6042 break;
6043 }
6044 case PM_INTEGER_NODE: {
6045 pm_buffer_append_string(buffer, "{\"type\":\"IntegerNode\",\"location\":", 33);
6046
6047 const pm_integer_node_t *cast = (const pm_integer_node_t *) node;
6048 pm_dump_json_location(buffer, parser, &cast->base.location);
6049
6050 // Dump the IntegerBaseFlags field
6051 pm_buffer_append_byte(buffer, ',');
6052 pm_buffer_append_string(buffer, "\"IntegerBaseFlags\":", 19);
6053 size_t flags = 0;
6054 pm_buffer_append_byte(buffer, '[');
6055 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_BINARY)) {
6056 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6057 pm_buffer_append_string(buffer, "\"BINARY\"", 8);
6058 flags++;
6059 }
6060 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_DECIMAL)) {
6061 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6062 pm_buffer_append_string(buffer, "\"DECIMAL\"", 9);
6063 flags++;
6064 }
6065 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_OCTAL)) {
6066 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6067 pm_buffer_append_string(buffer, "\"OCTAL\"", 7);
6068 flags++;
6069 }
6070 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_HEXADECIMAL)) {
6071 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6072 pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13);
6073 flags++;
6074 }
6075 pm_buffer_append_byte(buffer, ']');
6076
6077 // Dump the value field
6078 pm_buffer_append_byte(buffer, ',');
6079 pm_buffer_append_string(buffer, "\"value\":", 8);
6080 pm_integer_string(buffer, &cast->value);
6081
6082 pm_buffer_append_byte(buffer, '}');
6083 break;
6084 }
6085 case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
6086 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedMatchLastLineNode\",\"location\":", 51);
6087
6088 const pm_interpolated_match_last_line_node_t *cast = (const pm_interpolated_match_last_line_node_t *) node;
6089 pm_dump_json_location(buffer, parser, &cast->base.location);
6090
6091 // Dump the RegularExpressionFlags field
6092 pm_buffer_append_byte(buffer, ',');
6093 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
6094 size_t flags = 0;
6095 pm_buffer_append_byte(buffer, '[');
6096 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
6097 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6098 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
6099 flags++;
6100 }
6101 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
6102 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6103 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
6104 flags++;
6105 }
6106 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
6107 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6108 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
6109 flags++;
6110 }
6111 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
6112 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6113 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
6114 flags++;
6115 }
6116 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
6117 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6118 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
6119 flags++;
6120 }
6121 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
6122 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6123 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
6124 flags++;
6125 }
6126 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
6127 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6128 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
6129 flags++;
6130 }
6131 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
6132 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6133 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
6134 flags++;
6135 }
6136 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
6137 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6138 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
6139 flags++;
6140 }
6141 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
6142 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6143 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
6144 flags++;
6145 }
6146 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
6147 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6148 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
6149 flags++;
6150 }
6151 pm_buffer_append_byte(buffer, ']');
6152
6153 // Dump the opening_loc field
6154 pm_buffer_append_byte(buffer, ',');
6155 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6156 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6157
6158 // Dump the parts field
6159 pm_buffer_append_byte(buffer, ',');
6160 pm_buffer_append_string(buffer, "\"parts\":", 8);
6161 const pm_node_list_t *parts = &cast->parts;
6162 pm_buffer_append_byte(buffer, '[');
6163
6164 for (size_t index = 0; index < parts->size; index++) {
6165 if (index != 0) pm_buffer_append_byte(buffer, ',');
6166 pm_dump_json(buffer, parser, parts->nodes[index]);
6167 }
6168 pm_buffer_append_byte(buffer, ']');
6169
6170 // Dump the closing_loc field
6171 pm_buffer_append_byte(buffer, ',');
6172 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6173 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6174
6175 pm_buffer_append_byte(buffer, '}');
6176 break;
6177 }
6178 case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
6179 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedRegularExpressionNode\",\"location\":", 55);
6180
6181 const pm_interpolated_regular_expression_node_t *cast = (const pm_interpolated_regular_expression_node_t *) node;
6182 pm_dump_json_location(buffer, parser, &cast->base.location);
6183
6184 // Dump the RegularExpressionFlags field
6185 pm_buffer_append_byte(buffer, ',');
6186 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
6187 size_t flags = 0;
6188 pm_buffer_append_byte(buffer, '[');
6189 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
6190 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6191 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
6192 flags++;
6193 }
6194 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
6195 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6196 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
6197 flags++;
6198 }
6199 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
6200 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6201 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
6202 flags++;
6203 }
6204 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
6205 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6206 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
6207 flags++;
6208 }
6209 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
6210 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6211 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
6212 flags++;
6213 }
6214 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
6215 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6216 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
6217 flags++;
6218 }
6219 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
6220 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6221 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
6222 flags++;
6223 }
6224 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
6225 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6226 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
6227 flags++;
6228 }
6229 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
6230 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6231 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
6232 flags++;
6233 }
6234 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
6235 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6236 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
6237 flags++;
6238 }
6239 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
6240 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6241 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
6242 flags++;
6243 }
6244 pm_buffer_append_byte(buffer, ']');
6245
6246 // Dump the opening_loc field
6247 pm_buffer_append_byte(buffer, ',');
6248 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6249 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6250
6251 // Dump the parts field
6252 pm_buffer_append_byte(buffer, ',');
6253 pm_buffer_append_string(buffer, "\"parts\":", 8);
6254 const pm_node_list_t *parts = &cast->parts;
6255 pm_buffer_append_byte(buffer, '[');
6256
6257 for (size_t index = 0; index < parts->size; index++) {
6258 if (index != 0) pm_buffer_append_byte(buffer, ',');
6259 pm_dump_json(buffer, parser, parts->nodes[index]);
6260 }
6261 pm_buffer_append_byte(buffer, ']');
6262
6263 // Dump the closing_loc field
6264 pm_buffer_append_byte(buffer, ',');
6265 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6266 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6267
6268 pm_buffer_append_byte(buffer, '}');
6269 break;
6270 }
6271 case PM_INTERPOLATED_STRING_NODE: {
6272 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedStringNode\",\"location\":", 44);
6273
6274 const pm_interpolated_string_node_t *cast = (const pm_interpolated_string_node_t *) node;
6275 pm_dump_json_location(buffer, parser, &cast->base.location);
6276
6277 // Dump the InterpolatedStringNodeFlags field
6278 pm_buffer_append_byte(buffer, ',');
6279 pm_buffer_append_string(buffer, "\"InterpolatedStringNodeFlags\":", 30);
6280 size_t flags = 0;
6281 pm_buffer_append_byte(buffer, '[');
6282 if (PM_NODE_FLAG_P(cast, PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN)) {
6283 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6284 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
6285 flags++;
6286 }
6287 if (PM_NODE_FLAG_P(cast, PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE)) {
6288 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6289 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
6290 flags++;
6291 }
6292 pm_buffer_append_byte(buffer, ']');
6293
6294 // Dump the opening_loc field
6295 pm_buffer_append_byte(buffer, ',');
6296 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6297 if (cast->opening_loc.start != NULL) {
6298 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6299 } else {
6300 pm_buffer_append_string(buffer, "null", 4);
6301 }
6302
6303 // Dump the parts field
6304 pm_buffer_append_byte(buffer, ',');
6305 pm_buffer_append_string(buffer, "\"parts\":", 8);
6306 const pm_node_list_t *parts = &cast->parts;
6307 pm_buffer_append_byte(buffer, '[');
6308
6309 for (size_t index = 0; index < parts->size; index++) {
6310 if (index != 0) pm_buffer_append_byte(buffer, ',');
6311 pm_dump_json(buffer, parser, parts->nodes[index]);
6312 }
6313 pm_buffer_append_byte(buffer, ']');
6314
6315 // Dump the closing_loc field
6316 pm_buffer_append_byte(buffer, ',');
6317 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6318 if (cast->closing_loc.start != NULL) {
6319 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6320 } else {
6321 pm_buffer_append_string(buffer, "null", 4);
6322 }
6323
6324 pm_buffer_append_byte(buffer, '}');
6325 break;
6326 }
6327 case PM_INTERPOLATED_SYMBOL_NODE: {
6328 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedSymbolNode\",\"location\":", 44);
6329
6330 const pm_interpolated_symbol_node_t *cast = (const pm_interpolated_symbol_node_t *) node;
6331 pm_dump_json_location(buffer, parser, &cast->base.location);
6332
6333 // Dump the opening_loc field
6334 pm_buffer_append_byte(buffer, ',');
6335 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6336 if (cast->opening_loc.start != NULL) {
6337 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6338 } else {
6339 pm_buffer_append_string(buffer, "null", 4);
6340 }
6341
6342 // Dump the parts field
6343 pm_buffer_append_byte(buffer, ',');
6344 pm_buffer_append_string(buffer, "\"parts\":", 8);
6345 const pm_node_list_t *parts = &cast->parts;
6346 pm_buffer_append_byte(buffer, '[');
6347
6348 for (size_t index = 0; index < parts->size; index++) {
6349 if (index != 0) pm_buffer_append_byte(buffer, ',');
6350 pm_dump_json(buffer, parser, parts->nodes[index]);
6351 }
6352 pm_buffer_append_byte(buffer, ']');
6353
6354 // Dump the closing_loc field
6355 pm_buffer_append_byte(buffer, ',');
6356 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6357 if (cast->closing_loc.start != NULL) {
6358 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6359 } else {
6360 pm_buffer_append_string(buffer, "null", 4);
6361 }
6362
6363 pm_buffer_append_byte(buffer, '}');
6364 break;
6365 }
6366 case PM_INTERPOLATED_X_STRING_NODE: {
6367 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedXStringNode\",\"location\":", 45);
6368
6369 const pm_interpolated_x_string_node_t *cast = (const pm_interpolated_x_string_node_t *) node;
6370 pm_dump_json_location(buffer, parser, &cast->base.location);
6371
6372 // Dump the opening_loc field
6373 pm_buffer_append_byte(buffer, ',');
6374 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6375 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6376
6377 // Dump the parts field
6378 pm_buffer_append_byte(buffer, ',');
6379 pm_buffer_append_string(buffer, "\"parts\":", 8);
6380 const pm_node_list_t *parts = &cast->parts;
6381 pm_buffer_append_byte(buffer, '[');
6382
6383 for (size_t index = 0; index < parts->size; index++) {
6384 if (index != 0) pm_buffer_append_byte(buffer, ',');
6385 pm_dump_json(buffer, parser, parts->nodes[index]);
6386 }
6387 pm_buffer_append_byte(buffer, ']');
6388
6389 // Dump the closing_loc field
6390 pm_buffer_append_byte(buffer, ',');
6391 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6392 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6393
6394 pm_buffer_append_byte(buffer, '}');
6395 break;
6396 }
6397 case PM_IT_LOCAL_VARIABLE_READ_NODE: {
6398 pm_buffer_append_string(buffer, "{\"type\":\"ItLocalVariableReadNode\",\"location\":", 45);
6399
6400 const pm_it_local_variable_read_node_t *cast = (const pm_it_local_variable_read_node_t *) node;
6401 pm_dump_json_location(buffer, parser, &cast->base.location);
6402
6403 pm_buffer_append_byte(buffer, '}');
6404 break;
6405 }
6406 case PM_IT_PARAMETERS_NODE: {
6407 pm_buffer_append_string(buffer, "{\"type\":\"ItParametersNode\",\"location\":", 38);
6408
6409 const pm_it_parameters_node_t *cast = (const pm_it_parameters_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_KEYWORD_HASH_NODE: {
6416 pm_buffer_append_string(buffer, "{\"type\":\"KeywordHashNode\",\"location\":", 37);
6417
6418 const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node;
6419 pm_dump_json_location(buffer, parser, &cast->base.location);
6420
6421 // Dump the KeywordHashNodeFlags field
6422 pm_buffer_append_byte(buffer, ',');
6423 pm_buffer_append_string(buffer, "\"KeywordHashNodeFlags\":", 23);
6424 size_t flags = 0;
6425 pm_buffer_append_byte(buffer, '[');
6426 if (PM_NODE_FLAG_P(cast, PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS)) {
6427 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6428 pm_buffer_append_string(buffer, "\"SYMBOL_KEYS\"", 13);
6429 flags++;
6430 }
6431 pm_buffer_append_byte(buffer, ']');
6432
6433 // Dump the elements field
6434 pm_buffer_append_byte(buffer, ',');
6435 pm_buffer_append_string(buffer, "\"elements\":", 11);
6436 const pm_node_list_t *elements = &cast->elements;
6437 pm_buffer_append_byte(buffer, '[');
6438
6439 for (size_t index = 0; index < elements->size; index++) {
6440 if (index != 0) pm_buffer_append_byte(buffer, ',');
6441 pm_dump_json(buffer, parser, elements->nodes[index]);
6442 }
6443 pm_buffer_append_byte(buffer, ']');
6444
6445 pm_buffer_append_byte(buffer, '}');
6446 break;
6447 }
6448 case PM_KEYWORD_REST_PARAMETER_NODE: {
6449 pm_buffer_append_string(buffer, "{\"type\":\"KeywordRestParameterNode\",\"location\":", 46);
6450
6451 const pm_keyword_rest_parameter_node_t *cast = (const pm_keyword_rest_parameter_node_t *) node;
6452 pm_dump_json_location(buffer, parser, &cast->base.location);
6453
6454 // Dump the ParameterFlags field
6455 pm_buffer_append_byte(buffer, ',');
6456 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
6457 size_t flags = 0;
6458 pm_buffer_append_byte(buffer, '[');
6459 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
6460 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6461 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
6462 flags++;
6463 }
6464 pm_buffer_append_byte(buffer, ']');
6465
6466 // Dump the name field
6467 pm_buffer_append_byte(buffer, ',');
6468 pm_buffer_append_string(buffer, "\"name\":", 7);
6469 if (cast->name != PM_CONSTANT_ID_UNSET) {
6470 pm_dump_json_constant(buffer, parser, cast->name);
6471 } else {
6472 pm_buffer_append_string(buffer, "null", 4);
6473 }
6474
6475 // Dump the name_loc field
6476 pm_buffer_append_byte(buffer, ',');
6477 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6478 if (cast->name_loc.start != NULL) {
6479 pm_dump_json_location(buffer, parser, &cast->name_loc);
6480 } else {
6481 pm_buffer_append_string(buffer, "null", 4);
6482 }
6483
6484 // Dump the operator_loc field
6485 pm_buffer_append_byte(buffer, ',');
6486 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6487 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6488
6489 pm_buffer_append_byte(buffer, '}');
6490 break;
6491 }
6492 case PM_LAMBDA_NODE: {
6493 pm_buffer_append_string(buffer, "{\"type\":\"LambdaNode\",\"location\":", 32);
6494
6495 const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node;
6496 pm_dump_json_location(buffer, parser, &cast->base.location);
6497
6498 // Dump the locals field
6499 pm_buffer_append_byte(buffer, ',');
6500 pm_buffer_append_string(buffer, "\"locals\":", 9);
6501 const pm_constant_id_list_t *locals = &cast->locals;
6502 pm_buffer_append_byte(buffer, '[');
6503
6504 for (size_t index = 0; index < locals->size; index++) {
6505 if (index != 0) pm_buffer_append_byte(buffer, ',');
6506 pm_dump_json_constant(buffer, parser, locals->ids[index]);
6507 }
6508 pm_buffer_append_byte(buffer, ']');
6509
6510 // Dump the operator_loc field
6511 pm_buffer_append_byte(buffer, ',');
6512 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6513 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6514
6515 // Dump the opening_loc field
6516 pm_buffer_append_byte(buffer, ',');
6517 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6518 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6519
6520 // Dump the closing_loc field
6521 pm_buffer_append_byte(buffer, ',');
6522 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6523 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6524
6525 // Dump the parameters field
6526 pm_buffer_append_byte(buffer, ',');
6527 pm_buffer_append_string(buffer, "\"parameters\":", 13);
6528 if (cast->parameters != NULL) {
6529 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
6530 } else {
6531 pm_buffer_append_string(buffer, "null", 4);
6532 }
6533
6534 // Dump the body field
6535 pm_buffer_append_byte(buffer, ',');
6536 pm_buffer_append_string(buffer, "\"body\":", 7);
6537 if (cast->body != NULL) {
6538 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
6539 } else {
6540 pm_buffer_append_string(buffer, "null", 4);
6541 }
6542
6543 pm_buffer_append_byte(buffer, '}');
6544 break;
6545 }
6546 case PM_LOCAL_VARIABLE_AND_WRITE_NODE: {
6547 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableAndWriteNode\",\"location\":", 47);
6548
6549 const pm_local_variable_and_write_node_t *cast = (const pm_local_variable_and_write_node_t *) node;
6550 pm_dump_json_location(buffer, parser, &cast->base.location);
6551
6552 // Dump the name_loc field
6553 pm_buffer_append_byte(buffer, ',');
6554 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6555 pm_dump_json_location(buffer, parser, &cast->name_loc);
6556
6557 // Dump the operator_loc field
6558 pm_buffer_append_byte(buffer, ',');
6559 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6560 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6561
6562 // Dump the value field
6563 pm_buffer_append_byte(buffer, ',');
6564 pm_buffer_append_string(buffer, "\"value\":", 8);
6565 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6566
6567 // Dump the name field
6568 pm_buffer_append_byte(buffer, ',');
6569 pm_buffer_append_string(buffer, "\"name\":", 7);
6570 pm_dump_json_constant(buffer, parser, cast->name);
6571
6572 // Dump the depth field
6573 pm_buffer_append_byte(buffer, ',');
6574 pm_buffer_append_string(buffer, "\"depth\":", 8);
6575 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6576
6577 pm_buffer_append_byte(buffer, '}');
6578 break;
6579 }
6580 case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
6581 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOperatorWriteNode\",\"location\":", 52);
6582
6583 const pm_local_variable_operator_write_node_t *cast = (const pm_local_variable_operator_write_node_t *) node;
6584 pm_dump_json_location(buffer, parser, &cast->base.location);
6585
6586 // Dump the name_loc field
6587 pm_buffer_append_byte(buffer, ',');
6588 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6589 pm_dump_json_location(buffer, parser, &cast->name_loc);
6590
6591 // Dump the binary_operator_loc field
6592 pm_buffer_append_byte(buffer, ',');
6593 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
6594 pm_dump_json_location(buffer, parser, &cast->binary_operator_loc);
6595
6596 // Dump the value field
6597 pm_buffer_append_byte(buffer, ',');
6598 pm_buffer_append_string(buffer, "\"value\":", 8);
6599 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6600
6601 // Dump the name field
6602 pm_buffer_append_byte(buffer, ',');
6603 pm_buffer_append_string(buffer, "\"name\":", 7);
6604 pm_dump_json_constant(buffer, parser, cast->name);
6605
6606 // Dump the binary_operator field
6607 pm_buffer_append_byte(buffer, ',');
6608 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
6609 pm_dump_json_constant(buffer, parser, cast->binary_operator);
6610
6611 // Dump the depth field
6612 pm_buffer_append_byte(buffer, ',');
6613 pm_buffer_append_string(buffer, "\"depth\":", 8);
6614 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6615
6616 pm_buffer_append_byte(buffer, '}');
6617 break;
6618 }
6619 case PM_LOCAL_VARIABLE_OR_WRITE_NODE: {
6620 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOrWriteNode\",\"location\":", 46);
6621
6622 const pm_local_variable_or_write_node_t *cast = (const pm_local_variable_or_write_node_t *) node;
6623 pm_dump_json_location(buffer, parser, &cast->base.location);
6624
6625 // Dump the name_loc field
6626 pm_buffer_append_byte(buffer, ',');
6627 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6628 pm_dump_json_location(buffer, parser, &cast->name_loc);
6629
6630 // Dump the operator_loc field
6631 pm_buffer_append_byte(buffer, ',');
6632 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6633 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6634
6635 // Dump the value field
6636 pm_buffer_append_byte(buffer, ',');
6637 pm_buffer_append_string(buffer, "\"value\":", 8);
6638 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6639
6640 // Dump the name field
6641 pm_buffer_append_byte(buffer, ',');
6642 pm_buffer_append_string(buffer, "\"name\":", 7);
6643 pm_dump_json_constant(buffer, parser, cast->name);
6644
6645 // Dump the depth field
6646 pm_buffer_append_byte(buffer, ',');
6647 pm_buffer_append_string(buffer, "\"depth\":", 8);
6648 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6649
6650 pm_buffer_append_byte(buffer, '}');
6651 break;
6652 }
6653 case PM_LOCAL_VARIABLE_READ_NODE: {
6654 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableReadNode\",\"location\":", 43);
6655
6656 const pm_local_variable_read_node_t *cast = (const pm_local_variable_read_node_t *) node;
6657 pm_dump_json_location(buffer, parser, &cast->base.location);
6658
6659 // Dump the name field
6660 pm_buffer_append_byte(buffer, ',');
6661 pm_buffer_append_string(buffer, "\"name\":", 7);
6662 pm_dump_json_constant(buffer, parser, cast->name);
6663
6664 // Dump the depth field
6665 pm_buffer_append_byte(buffer, ',');
6666 pm_buffer_append_string(buffer, "\"depth\":", 8);
6667 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6668
6669 pm_buffer_append_byte(buffer, '}');
6670 break;
6671 }
6672 case PM_LOCAL_VARIABLE_TARGET_NODE: {
6673 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableTargetNode\",\"location\":", 45);
6674
6675 const pm_local_variable_target_node_t *cast = (const pm_local_variable_target_node_t *) node;
6676 pm_dump_json_location(buffer, parser, &cast->base.location);
6677
6678 // Dump the name field
6679 pm_buffer_append_byte(buffer, ',');
6680 pm_buffer_append_string(buffer, "\"name\":", 7);
6681 pm_dump_json_constant(buffer, parser, cast->name);
6682
6683 // Dump the depth field
6684 pm_buffer_append_byte(buffer, ',');
6685 pm_buffer_append_string(buffer, "\"depth\":", 8);
6686 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6687
6688 pm_buffer_append_byte(buffer, '}');
6689 break;
6690 }
6691 case PM_LOCAL_VARIABLE_WRITE_NODE: {
6692 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableWriteNode\",\"location\":", 44);
6693
6694 const pm_local_variable_write_node_t *cast = (const pm_local_variable_write_node_t *) node;
6695 pm_dump_json_location(buffer, parser, &cast->base.location);
6696
6697 // Dump the name field
6698 pm_buffer_append_byte(buffer, ',');
6699 pm_buffer_append_string(buffer, "\"name\":", 7);
6700 pm_dump_json_constant(buffer, parser, cast->name);
6701
6702 // Dump the depth field
6703 pm_buffer_append_byte(buffer, ',');
6704 pm_buffer_append_string(buffer, "\"depth\":", 8);
6705 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
6706
6707 // Dump the name_loc field
6708 pm_buffer_append_byte(buffer, ',');
6709 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
6710 pm_dump_json_location(buffer, parser, &cast->name_loc);
6711
6712 // Dump the value field
6713 pm_buffer_append_byte(buffer, ',');
6714 pm_buffer_append_string(buffer, "\"value\":", 8);
6715 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6716
6717 // Dump the operator_loc field
6718 pm_buffer_append_byte(buffer, ',');
6719 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6720 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6721
6722 pm_buffer_append_byte(buffer, '}');
6723 break;
6724 }
6725 case PM_MATCH_LAST_LINE_NODE: {
6726 pm_buffer_append_string(buffer, "{\"type\":\"MatchLastLineNode\",\"location\":", 39);
6727
6728 const pm_match_last_line_node_t *cast = (const pm_match_last_line_node_t *) node;
6729 pm_dump_json_location(buffer, parser, &cast->base.location);
6730
6731 // Dump the RegularExpressionFlags field
6732 pm_buffer_append_byte(buffer, ',');
6733 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
6734 size_t flags = 0;
6735 pm_buffer_append_byte(buffer, '[');
6736 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
6737 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6738 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
6739 flags++;
6740 }
6741 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
6742 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6743 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
6744 flags++;
6745 }
6746 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
6747 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6748 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
6749 flags++;
6750 }
6751 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
6752 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6753 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
6754 flags++;
6755 }
6756 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
6757 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6758 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
6759 flags++;
6760 }
6761 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
6762 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6763 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
6764 flags++;
6765 }
6766 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
6767 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6768 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
6769 flags++;
6770 }
6771 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
6772 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6773 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
6774 flags++;
6775 }
6776 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
6777 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6778 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
6779 flags++;
6780 }
6781 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
6782 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6783 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
6784 flags++;
6785 }
6786 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
6787 if (flags != 0) pm_buffer_append_byte(buffer, ',');
6788 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
6789 flags++;
6790 }
6791 pm_buffer_append_byte(buffer, ']');
6792
6793 // Dump the opening_loc field
6794 pm_buffer_append_byte(buffer, ',');
6795 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
6796 pm_dump_json_location(buffer, parser, &cast->opening_loc);
6797
6798 // Dump the content_loc field
6799 pm_buffer_append_byte(buffer, ',');
6800 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
6801 pm_dump_json_location(buffer, parser, &cast->content_loc);
6802
6803 // Dump the closing_loc field
6804 pm_buffer_append_byte(buffer, ',');
6805 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
6806 pm_dump_json_location(buffer, parser, &cast->closing_loc);
6807
6808 // Dump the unescaped field
6809 pm_buffer_append_byte(buffer, ',');
6810 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
6811 const pm_string_t *unescaped = &cast->unescaped;
6812 pm_buffer_append_byte(buffer, '"');
6813 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
6814 pm_buffer_append_byte(buffer, '"');
6815
6816 pm_buffer_append_byte(buffer, '}');
6817 break;
6818 }
6819 case PM_MATCH_PREDICATE_NODE: {
6820 pm_buffer_append_string(buffer, "{\"type\":\"MatchPredicateNode\",\"location\":", 40);
6821
6822 const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node;
6823 pm_dump_json_location(buffer, parser, &cast->base.location);
6824
6825 // Dump the value field
6826 pm_buffer_append_byte(buffer, ',');
6827 pm_buffer_append_string(buffer, "\"value\":", 8);
6828 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6829
6830 // Dump the pattern field
6831 pm_buffer_append_byte(buffer, ',');
6832 pm_buffer_append_string(buffer, "\"pattern\":", 10);
6833 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
6834
6835 // Dump the operator_loc field
6836 pm_buffer_append_byte(buffer, ',');
6837 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6838 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6839
6840 pm_buffer_append_byte(buffer, '}');
6841 break;
6842 }
6843 case PM_MATCH_REQUIRED_NODE: {
6844 pm_buffer_append_string(buffer, "{\"type\":\"MatchRequiredNode\",\"location\":", 39);
6845
6846 const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node;
6847 pm_dump_json_location(buffer, parser, &cast->base.location);
6848
6849 // Dump the value field
6850 pm_buffer_append_byte(buffer, ',');
6851 pm_buffer_append_string(buffer, "\"value\":", 8);
6852 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
6853
6854 // Dump the pattern field
6855 pm_buffer_append_byte(buffer, ',');
6856 pm_buffer_append_string(buffer, "\"pattern\":", 10);
6857 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
6858
6859 // Dump the operator_loc field
6860 pm_buffer_append_byte(buffer, ',');
6861 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
6862 pm_dump_json_location(buffer, parser, &cast->operator_loc);
6863
6864 pm_buffer_append_byte(buffer, '}');
6865 break;
6866 }
6867 case PM_MATCH_WRITE_NODE: {
6868 pm_buffer_append_string(buffer, "{\"type\":\"MatchWriteNode\",\"location\":", 36);
6869
6870 const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node;
6871 pm_dump_json_location(buffer, parser, &cast->base.location);
6872
6873 // Dump the call field
6874 pm_buffer_append_byte(buffer, ',');
6875 pm_buffer_append_string(buffer, "\"call\":", 7);
6876 pm_dump_json(buffer, parser, (const pm_node_t *) cast->call);
6877
6878 // Dump the targets field
6879 pm_buffer_append_byte(buffer, ',');
6880 pm_buffer_append_string(buffer, "\"targets\":", 10);
6881 const pm_node_list_t *targets = &cast->targets;
6882 pm_buffer_append_byte(buffer, '[');
6883
6884 for (size_t index = 0; index < targets->size; index++) {
6885 if (index != 0) pm_buffer_append_byte(buffer, ',');
6886 pm_dump_json(buffer, parser, targets->nodes[index]);
6887 }
6888 pm_buffer_append_byte(buffer, ']');
6889
6890 pm_buffer_append_byte(buffer, '}');
6891 break;
6892 }
6893 case PM_MISSING_NODE: {
6894 pm_buffer_append_string(buffer, "{\"type\":\"MissingNode\",\"location\":", 33);
6895
6896 const pm_missing_node_t *cast = (const pm_missing_node_t *) node;
6897 pm_dump_json_location(buffer, parser, &cast->base.location);
6898
6899 pm_buffer_append_byte(buffer, '}');
6900 break;
6901 }
6902 case PM_MODULE_NODE: {
6903 pm_buffer_append_string(buffer, "{\"type\":\"ModuleNode\",\"location\":", 32);
6904
6905 const pm_module_node_t *cast = (const pm_module_node_t *) node;
6906 pm_dump_json_location(buffer, parser, &cast->base.location);
6907
6908 // Dump the locals field
6909 pm_buffer_append_byte(buffer, ',');
6910 pm_buffer_append_string(buffer, "\"locals\":", 9);
6911 const pm_constant_id_list_t *locals = &cast->locals;
6912 pm_buffer_append_byte(buffer, '[');
6913
6914 for (size_t index = 0; index < locals->size; index++) {
6915 if (index != 0) pm_buffer_append_byte(buffer, ',');
6916 pm_dump_json_constant(buffer, parser, locals->ids[index]);
6917 }
6918 pm_buffer_append_byte(buffer, ']');
6919
6920 // Dump the module_keyword_loc field
6921 pm_buffer_append_byte(buffer, ',');
6922 pm_buffer_append_string(buffer, "\"module_keyword_loc\":", 21);
6923 pm_dump_json_location(buffer, parser, &cast->module_keyword_loc);
6924
6925 // Dump the constant_path field
6926 pm_buffer_append_byte(buffer, ',');
6927 pm_buffer_append_string(buffer, "\"constant_path\":", 16);
6928 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path);
6929
6930 // Dump the body field
6931 pm_buffer_append_byte(buffer, ',');
6932 pm_buffer_append_string(buffer, "\"body\":", 7);
6933 if (cast->body != NULL) {
6934 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
6935 } else {
6936 pm_buffer_append_string(buffer, "null", 4);
6937 }
6938
6939 // Dump the end_keyword_loc field
6940 pm_buffer_append_byte(buffer, ',');
6941 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
6942 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
6943
6944 // Dump the name field
6945 pm_buffer_append_byte(buffer, ',');
6946 pm_buffer_append_string(buffer, "\"name\":", 7);
6947 pm_dump_json_constant(buffer, parser, cast->name);
6948
6949 pm_buffer_append_byte(buffer, '}');
6950 break;
6951 }
6952 case PM_MULTI_TARGET_NODE: {
6953 pm_buffer_append_string(buffer, "{\"type\":\"MultiTargetNode\",\"location\":", 37);
6954
6955 const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node;
6956 pm_dump_json_location(buffer, parser, &cast->base.location);
6957
6958 // Dump the lefts field
6959 pm_buffer_append_byte(buffer, ',');
6960 pm_buffer_append_string(buffer, "\"lefts\":", 8);
6961 const pm_node_list_t *lefts = &cast->lefts;
6962 pm_buffer_append_byte(buffer, '[');
6963
6964 for (size_t index = 0; index < lefts->size; index++) {
6965 if (index != 0) pm_buffer_append_byte(buffer, ',');
6966 pm_dump_json(buffer, parser, lefts->nodes[index]);
6967 }
6968 pm_buffer_append_byte(buffer, ']');
6969
6970 // Dump the rest field
6971 pm_buffer_append_byte(buffer, ',');
6972 pm_buffer_append_string(buffer, "\"rest\":", 7);
6973 if (cast->rest != NULL) {
6974 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
6975 } else {
6976 pm_buffer_append_string(buffer, "null", 4);
6977 }
6978
6979 // Dump the rights field
6980 pm_buffer_append_byte(buffer, ',');
6981 pm_buffer_append_string(buffer, "\"rights\":", 9);
6982 const pm_node_list_t *rights = &cast->rights;
6983 pm_buffer_append_byte(buffer, '[');
6984
6985 for (size_t index = 0; index < rights->size; index++) {
6986 if (index != 0) pm_buffer_append_byte(buffer, ',');
6987 pm_dump_json(buffer, parser, rights->nodes[index]);
6988 }
6989 pm_buffer_append_byte(buffer, ']');
6990
6991 // Dump the lparen_loc field
6992 pm_buffer_append_byte(buffer, ',');
6993 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
6994 if (cast->lparen_loc.start != NULL) {
6995 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
6996 } else {
6997 pm_buffer_append_string(buffer, "null", 4);
6998 }
6999
7000 // Dump the rparen_loc field
7001 pm_buffer_append_byte(buffer, ',');
7002 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
7003 if (cast->rparen_loc.start != NULL) {
7004 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
7005 } else {
7006 pm_buffer_append_string(buffer, "null", 4);
7007 }
7008
7009 pm_buffer_append_byte(buffer, '}');
7010 break;
7011 }
7012 case PM_MULTI_WRITE_NODE: {
7013 pm_buffer_append_string(buffer, "{\"type\":\"MultiWriteNode\",\"location\":", 36);
7014
7015 const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node;
7016 pm_dump_json_location(buffer, parser, &cast->base.location);
7017
7018 // Dump the lefts field
7019 pm_buffer_append_byte(buffer, ',');
7020 pm_buffer_append_string(buffer, "\"lefts\":", 8);
7021 const pm_node_list_t *lefts = &cast->lefts;
7022 pm_buffer_append_byte(buffer, '[');
7023
7024 for (size_t index = 0; index < lefts->size; index++) {
7025 if (index != 0) pm_buffer_append_byte(buffer, ',');
7026 pm_dump_json(buffer, parser, lefts->nodes[index]);
7027 }
7028 pm_buffer_append_byte(buffer, ']');
7029
7030 // Dump the rest field
7031 pm_buffer_append_byte(buffer, ',');
7032 pm_buffer_append_string(buffer, "\"rest\":", 7);
7033 if (cast->rest != NULL) {
7034 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
7035 } else {
7036 pm_buffer_append_string(buffer, "null", 4);
7037 }
7038
7039 // Dump the rights field
7040 pm_buffer_append_byte(buffer, ',');
7041 pm_buffer_append_string(buffer, "\"rights\":", 9);
7042 const pm_node_list_t *rights = &cast->rights;
7043 pm_buffer_append_byte(buffer, '[');
7044
7045 for (size_t index = 0; index < rights->size; index++) {
7046 if (index != 0) pm_buffer_append_byte(buffer, ',');
7047 pm_dump_json(buffer, parser, rights->nodes[index]);
7048 }
7049 pm_buffer_append_byte(buffer, ']');
7050
7051 // Dump the lparen_loc field
7052 pm_buffer_append_byte(buffer, ',');
7053 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
7054 if (cast->lparen_loc.start != NULL) {
7055 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
7056 } else {
7057 pm_buffer_append_string(buffer, "null", 4);
7058 }
7059
7060 // Dump the rparen_loc field
7061 pm_buffer_append_byte(buffer, ',');
7062 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
7063 if (cast->rparen_loc.start != NULL) {
7064 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
7065 } else {
7066 pm_buffer_append_string(buffer, "null", 4);
7067 }
7068
7069 // Dump the operator_loc field
7070 pm_buffer_append_byte(buffer, ',');
7071 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7072 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7073
7074 // Dump the value field
7075 pm_buffer_append_byte(buffer, ',');
7076 pm_buffer_append_string(buffer, "\"value\":", 8);
7077 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
7078
7079 pm_buffer_append_byte(buffer, '}');
7080 break;
7081 }
7082 case PM_NEXT_NODE: {
7083 pm_buffer_append_string(buffer, "{\"type\":\"NextNode\",\"location\":", 30);
7084
7085 const pm_next_node_t *cast = (const pm_next_node_t *) node;
7086 pm_dump_json_location(buffer, parser, &cast->base.location);
7087
7088 // Dump the arguments field
7089 pm_buffer_append_byte(buffer, ',');
7090 pm_buffer_append_string(buffer, "\"arguments\":", 12);
7091 if (cast->arguments != NULL) {
7092 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
7093 } else {
7094 pm_buffer_append_string(buffer, "null", 4);
7095 }
7096
7097 // Dump the keyword_loc field
7098 pm_buffer_append_byte(buffer, ',');
7099 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7100 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7101
7102 pm_buffer_append_byte(buffer, '}');
7103 break;
7104 }
7105 case PM_NIL_NODE: {
7106 pm_buffer_append_string(buffer, "{\"type\":\"NilNode\",\"location\":", 29);
7107
7108 const pm_nil_node_t *cast = (const pm_nil_node_t *) node;
7109 pm_dump_json_location(buffer, parser, &cast->base.location);
7110
7111 pm_buffer_append_byte(buffer, '}');
7112 break;
7113 }
7114 case PM_NO_KEYWORDS_PARAMETER_NODE: {
7115 pm_buffer_append_string(buffer, "{\"type\":\"NoKeywordsParameterNode\",\"location\":", 45);
7116
7117 const pm_no_keywords_parameter_node_t *cast = (const pm_no_keywords_parameter_node_t *) node;
7118 pm_dump_json_location(buffer, parser, &cast->base.location);
7119
7120 // Dump the operator_loc field
7121 pm_buffer_append_byte(buffer, ',');
7122 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7123 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7124
7125 // Dump the keyword_loc field
7126 pm_buffer_append_byte(buffer, ',');
7127 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7128 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7129
7130 pm_buffer_append_byte(buffer, '}');
7131 break;
7132 }
7133 case PM_NUMBERED_PARAMETERS_NODE: {
7134 pm_buffer_append_string(buffer, "{\"type\":\"NumberedParametersNode\",\"location\":", 44);
7135
7136 const pm_numbered_parameters_node_t *cast = (const pm_numbered_parameters_node_t *) node;
7137 pm_dump_json_location(buffer, parser, &cast->base.location);
7138
7139 // Dump the maximum field
7140 pm_buffer_append_byte(buffer, ',');
7141 pm_buffer_append_string(buffer, "\"maximum\":", 10);
7142 pm_buffer_append_format(buffer, "%" PRIu8, cast->maximum);
7143
7144 pm_buffer_append_byte(buffer, '}');
7145 break;
7146 }
7147 case PM_NUMBERED_REFERENCE_READ_NODE: {
7148 pm_buffer_append_string(buffer, "{\"type\":\"NumberedReferenceReadNode\",\"location\":", 47);
7149
7150 const pm_numbered_reference_read_node_t *cast = (const pm_numbered_reference_read_node_t *) node;
7151 pm_dump_json_location(buffer, parser, &cast->base.location);
7152
7153 // Dump the number field
7154 pm_buffer_append_byte(buffer, ',');
7155 pm_buffer_append_string(buffer, "\"number\":", 9);
7156 pm_buffer_append_format(buffer, "%" PRIu32, cast->number);
7157
7158 pm_buffer_append_byte(buffer, '}');
7159 break;
7160 }
7161 case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
7162 pm_buffer_append_string(buffer, "{\"type\":\"OptionalKeywordParameterNode\",\"location\":", 50);
7163
7164 const pm_optional_keyword_parameter_node_t *cast = (const pm_optional_keyword_parameter_node_t *) node;
7165 pm_dump_json_location(buffer, parser, &cast->base.location);
7166
7167 // Dump the ParameterFlags field
7168 pm_buffer_append_byte(buffer, ',');
7169 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7170 size_t flags = 0;
7171 pm_buffer_append_byte(buffer, '[');
7172 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
7173 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7174 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7175 flags++;
7176 }
7177 pm_buffer_append_byte(buffer, ']');
7178
7179 // Dump the name field
7180 pm_buffer_append_byte(buffer, ',');
7181 pm_buffer_append_string(buffer, "\"name\":", 7);
7182 pm_dump_json_constant(buffer, parser, cast->name);
7183
7184 // Dump the name_loc field
7185 pm_buffer_append_byte(buffer, ',');
7186 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7187 pm_dump_json_location(buffer, parser, &cast->name_loc);
7188
7189 // Dump the value field
7190 pm_buffer_append_byte(buffer, ',');
7191 pm_buffer_append_string(buffer, "\"value\":", 8);
7192 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
7193
7194 pm_buffer_append_byte(buffer, '}');
7195 break;
7196 }
7197 case PM_OPTIONAL_PARAMETER_NODE: {
7198 pm_buffer_append_string(buffer, "{\"type\":\"OptionalParameterNode\",\"location\":", 43);
7199
7200 const pm_optional_parameter_node_t *cast = (const pm_optional_parameter_node_t *) node;
7201 pm_dump_json_location(buffer, parser, &cast->base.location);
7202
7203 // Dump the ParameterFlags field
7204 pm_buffer_append_byte(buffer, ',');
7205 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7206 size_t flags = 0;
7207 pm_buffer_append_byte(buffer, '[');
7208 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
7209 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7210 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7211 flags++;
7212 }
7213 pm_buffer_append_byte(buffer, ']');
7214
7215 // Dump the name field
7216 pm_buffer_append_byte(buffer, ',');
7217 pm_buffer_append_string(buffer, "\"name\":", 7);
7218 pm_dump_json_constant(buffer, parser, cast->name);
7219
7220 // Dump the name_loc field
7221 pm_buffer_append_byte(buffer, ',');
7222 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7223 pm_dump_json_location(buffer, parser, &cast->name_loc);
7224
7225 // Dump the operator_loc field
7226 pm_buffer_append_byte(buffer, ',');
7227 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7228 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7229
7230 // Dump the value field
7231 pm_buffer_append_byte(buffer, ',');
7232 pm_buffer_append_string(buffer, "\"value\":", 8);
7233 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
7234
7235 pm_buffer_append_byte(buffer, '}');
7236 break;
7237 }
7238 case PM_OR_NODE: {
7239 pm_buffer_append_string(buffer, "{\"type\":\"OrNode\",\"location\":", 28);
7240
7241 const pm_or_node_t *cast = (const pm_or_node_t *) node;
7242 pm_dump_json_location(buffer, parser, &cast->base.location);
7243
7244 // Dump the left field
7245 pm_buffer_append_byte(buffer, ',');
7246 pm_buffer_append_string(buffer, "\"left\":", 7);
7247 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
7248
7249 // Dump the right field
7250 pm_buffer_append_byte(buffer, ',');
7251 pm_buffer_append_string(buffer, "\"right\":", 8);
7252 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
7253
7254 // Dump the operator_loc field
7255 pm_buffer_append_byte(buffer, ',');
7256 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7257 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7258
7259 pm_buffer_append_byte(buffer, '}');
7260 break;
7261 }
7262 case PM_PARAMETERS_NODE: {
7263 pm_buffer_append_string(buffer, "{\"type\":\"ParametersNode\",\"location\":", 36);
7264
7265 const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node;
7266 pm_dump_json_location(buffer, parser, &cast->base.location);
7267
7268 // Dump the requireds field
7269 pm_buffer_append_byte(buffer, ',');
7270 pm_buffer_append_string(buffer, "\"requireds\":", 12);
7271 const pm_node_list_t *requireds = &cast->requireds;
7272 pm_buffer_append_byte(buffer, '[');
7273
7274 for (size_t index = 0; index < requireds->size; index++) {
7275 if (index != 0) pm_buffer_append_byte(buffer, ',');
7276 pm_dump_json(buffer, parser, requireds->nodes[index]);
7277 }
7278 pm_buffer_append_byte(buffer, ']');
7279
7280 // Dump the optionals field
7281 pm_buffer_append_byte(buffer, ',');
7282 pm_buffer_append_string(buffer, "\"optionals\":", 12);
7283 const pm_node_list_t *optionals = &cast->optionals;
7284 pm_buffer_append_byte(buffer, '[');
7285
7286 for (size_t index = 0; index < optionals->size; index++) {
7287 if (index != 0) pm_buffer_append_byte(buffer, ',');
7288 pm_dump_json(buffer, parser, optionals->nodes[index]);
7289 }
7290 pm_buffer_append_byte(buffer, ']');
7291
7292 // Dump the rest field
7293 pm_buffer_append_byte(buffer, ',');
7294 pm_buffer_append_string(buffer, "\"rest\":", 7);
7295 if (cast->rest != NULL) {
7296 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
7297 } else {
7298 pm_buffer_append_string(buffer, "null", 4);
7299 }
7300
7301 // Dump the posts field
7302 pm_buffer_append_byte(buffer, ',');
7303 pm_buffer_append_string(buffer, "\"posts\":", 8);
7304 const pm_node_list_t *posts = &cast->posts;
7305 pm_buffer_append_byte(buffer, '[');
7306
7307 for (size_t index = 0; index < posts->size; index++) {
7308 if (index != 0) pm_buffer_append_byte(buffer, ',');
7309 pm_dump_json(buffer, parser, posts->nodes[index]);
7310 }
7311 pm_buffer_append_byte(buffer, ']');
7312
7313 // Dump the keywords field
7314 pm_buffer_append_byte(buffer, ',');
7315 pm_buffer_append_string(buffer, "\"keywords\":", 11);
7316 const pm_node_list_t *keywords = &cast->keywords;
7317 pm_buffer_append_byte(buffer, '[');
7318
7319 for (size_t index = 0; index < keywords->size; index++) {
7320 if (index != 0) pm_buffer_append_byte(buffer, ',');
7321 pm_dump_json(buffer, parser, keywords->nodes[index]);
7322 }
7323 pm_buffer_append_byte(buffer, ']');
7324
7325 // Dump the keyword_rest field
7326 pm_buffer_append_byte(buffer, ',');
7327 pm_buffer_append_string(buffer, "\"keyword_rest\":", 15);
7328 if (cast->keyword_rest != NULL) {
7329 pm_dump_json(buffer, parser, (const pm_node_t *) cast->keyword_rest);
7330 } else {
7331 pm_buffer_append_string(buffer, "null", 4);
7332 }
7333
7334 // Dump the block field
7335 pm_buffer_append_byte(buffer, ',');
7336 pm_buffer_append_string(buffer, "\"block\":", 8);
7337 if (cast->block != NULL) {
7338 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
7339 } else {
7340 pm_buffer_append_string(buffer, "null", 4);
7341 }
7342
7343 pm_buffer_append_byte(buffer, '}');
7344 break;
7345 }
7346 case PM_PARENTHESES_NODE: {
7347 pm_buffer_append_string(buffer, "{\"type\":\"ParenthesesNode\",\"location\":", 37);
7348
7349 const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node;
7350 pm_dump_json_location(buffer, parser, &cast->base.location);
7351
7352 // Dump the ParenthesesNodeFlags field
7353 pm_buffer_append_byte(buffer, ',');
7354 pm_buffer_append_string(buffer, "\"ParenthesesNodeFlags\":", 23);
7355 size_t flags = 0;
7356 pm_buffer_append_byte(buffer, '[');
7357 if (PM_NODE_FLAG_P(cast, PM_PARENTHESES_NODE_FLAGS_MULTIPLE_STATEMENTS)) {
7358 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7359 pm_buffer_append_string(buffer, "\"MULTIPLE_STATEMENTS\"", 21);
7360 flags++;
7361 }
7362 pm_buffer_append_byte(buffer, ']');
7363
7364 // Dump the body field
7365 pm_buffer_append_byte(buffer, ',');
7366 pm_buffer_append_string(buffer, "\"body\":", 7);
7367 if (cast->body != NULL) {
7368 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
7369 } else {
7370 pm_buffer_append_string(buffer, "null", 4);
7371 }
7372
7373 // Dump the opening_loc field
7374 pm_buffer_append_byte(buffer, ',');
7375 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7376 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7377
7378 // Dump the closing_loc field
7379 pm_buffer_append_byte(buffer, ',');
7380 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7381 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7382
7383 pm_buffer_append_byte(buffer, '}');
7384 break;
7385 }
7386 case PM_PINNED_EXPRESSION_NODE: {
7387 pm_buffer_append_string(buffer, "{\"type\":\"PinnedExpressionNode\",\"location\":", 42);
7388
7389 const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node;
7390 pm_dump_json_location(buffer, parser, &cast->base.location);
7391
7392 // Dump the expression field
7393 pm_buffer_append_byte(buffer, ',');
7394 pm_buffer_append_string(buffer, "\"expression\":", 13);
7395 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
7396
7397 // Dump the operator_loc field
7398 pm_buffer_append_byte(buffer, ',');
7399 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7400 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7401
7402 // Dump the lparen_loc field
7403 pm_buffer_append_byte(buffer, ',');
7404 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
7405 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
7406
7407 // Dump the rparen_loc field
7408 pm_buffer_append_byte(buffer, ',');
7409 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
7410 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
7411
7412 pm_buffer_append_byte(buffer, '}');
7413 break;
7414 }
7415 case PM_PINNED_VARIABLE_NODE: {
7416 pm_buffer_append_string(buffer, "{\"type\":\"PinnedVariableNode\",\"location\":", 40);
7417
7418 const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node;
7419 pm_dump_json_location(buffer, parser, &cast->base.location);
7420
7421 // Dump the variable field
7422 pm_buffer_append_byte(buffer, ',');
7423 pm_buffer_append_string(buffer, "\"variable\":", 11);
7424 pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable);
7425
7426 // Dump the operator_loc field
7427 pm_buffer_append_byte(buffer, ',');
7428 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7429 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7430
7431 pm_buffer_append_byte(buffer, '}');
7432 break;
7433 }
7434 case PM_POST_EXECUTION_NODE: {
7435 pm_buffer_append_string(buffer, "{\"type\":\"PostExecutionNode\",\"location\":", 39);
7436
7437 const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node;
7438 pm_dump_json_location(buffer, parser, &cast->base.location);
7439
7440 // Dump the statements field
7441 pm_buffer_append_byte(buffer, ',');
7442 pm_buffer_append_string(buffer, "\"statements\":", 13);
7443 if (cast->statements != NULL) {
7444 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7445 } else {
7446 pm_buffer_append_string(buffer, "null", 4);
7447 }
7448
7449 // Dump the keyword_loc field
7450 pm_buffer_append_byte(buffer, ',');
7451 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7452 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7453
7454 // Dump the opening_loc field
7455 pm_buffer_append_byte(buffer, ',');
7456 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7457 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7458
7459 // Dump the closing_loc field
7460 pm_buffer_append_byte(buffer, ',');
7461 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7462 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7463
7464 pm_buffer_append_byte(buffer, '}');
7465 break;
7466 }
7467 case PM_PRE_EXECUTION_NODE: {
7468 pm_buffer_append_string(buffer, "{\"type\":\"PreExecutionNode\",\"location\":", 38);
7469
7470 const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node;
7471 pm_dump_json_location(buffer, parser, &cast->base.location);
7472
7473 // Dump the statements field
7474 pm_buffer_append_byte(buffer, ',');
7475 pm_buffer_append_string(buffer, "\"statements\":", 13);
7476 if (cast->statements != NULL) {
7477 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7478 } else {
7479 pm_buffer_append_string(buffer, "null", 4);
7480 }
7481
7482 // Dump the keyword_loc field
7483 pm_buffer_append_byte(buffer, ',');
7484 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7485 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7486
7487 // Dump the opening_loc field
7488 pm_buffer_append_byte(buffer, ',');
7489 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7490 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7491
7492 // Dump the closing_loc field
7493 pm_buffer_append_byte(buffer, ',');
7494 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7495 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7496
7497 pm_buffer_append_byte(buffer, '}');
7498 break;
7499 }
7500 case PM_PROGRAM_NODE: {
7501 pm_buffer_append_string(buffer, "{\"type\":\"ProgramNode\",\"location\":", 33);
7502
7503 const pm_program_node_t *cast = (const pm_program_node_t *) node;
7504 pm_dump_json_location(buffer, parser, &cast->base.location);
7505
7506 // Dump the locals field
7507 pm_buffer_append_byte(buffer, ',');
7508 pm_buffer_append_string(buffer, "\"locals\":", 9);
7509 const pm_constant_id_list_t *locals = &cast->locals;
7510 pm_buffer_append_byte(buffer, '[');
7511
7512 for (size_t index = 0; index < locals->size; index++) {
7513 if (index != 0) pm_buffer_append_byte(buffer, ',');
7514 pm_dump_json_constant(buffer, parser, locals->ids[index]);
7515 }
7516 pm_buffer_append_byte(buffer, ']');
7517
7518 // Dump the statements field
7519 pm_buffer_append_byte(buffer, ',');
7520 pm_buffer_append_string(buffer, "\"statements\":", 13);
7521 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7522
7523 pm_buffer_append_byte(buffer, '}');
7524 break;
7525 }
7526 case PM_RANGE_NODE: {
7527 pm_buffer_append_string(buffer, "{\"type\":\"RangeNode\",\"location\":", 31);
7528
7529 const pm_range_node_t *cast = (const pm_range_node_t *) node;
7530 pm_dump_json_location(buffer, parser, &cast->base.location);
7531
7532 // Dump the RangeFlags field
7533 pm_buffer_append_byte(buffer, ',');
7534 pm_buffer_append_string(buffer, "\"RangeFlags\":", 13);
7535 size_t flags = 0;
7536 pm_buffer_append_byte(buffer, '[');
7537 if (PM_NODE_FLAG_P(cast, PM_RANGE_FLAGS_EXCLUDE_END)) {
7538 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7539 pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13);
7540 flags++;
7541 }
7542 pm_buffer_append_byte(buffer, ']');
7543
7544 // Dump the left field
7545 pm_buffer_append_byte(buffer, ',');
7546 pm_buffer_append_string(buffer, "\"left\":", 7);
7547 if (cast->left != NULL) {
7548 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
7549 } else {
7550 pm_buffer_append_string(buffer, "null", 4);
7551 }
7552
7553 // Dump the right field
7554 pm_buffer_append_byte(buffer, ',');
7555 pm_buffer_append_string(buffer, "\"right\":", 8);
7556 if (cast->right != NULL) {
7557 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
7558 } else {
7559 pm_buffer_append_string(buffer, "null", 4);
7560 }
7561
7562 // Dump the operator_loc field
7563 pm_buffer_append_byte(buffer, ',');
7564 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7565 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7566
7567 pm_buffer_append_byte(buffer, '}');
7568 break;
7569 }
7570 case PM_RATIONAL_NODE: {
7571 pm_buffer_append_string(buffer, "{\"type\":\"RationalNode\",\"location\":", 34);
7572
7573 const pm_rational_node_t *cast = (const pm_rational_node_t *) node;
7574 pm_dump_json_location(buffer, parser, &cast->base.location);
7575
7576 // Dump the IntegerBaseFlags field
7577 pm_buffer_append_byte(buffer, ',');
7578 pm_buffer_append_string(buffer, "\"IntegerBaseFlags\":", 19);
7579 size_t flags = 0;
7580 pm_buffer_append_byte(buffer, '[');
7581 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_BINARY)) {
7582 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7583 pm_buffer_append_string(buffer, "\"BINARY\"", 8);
7584 flags++;
7585 }
7586 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_DECIMAL)) {
7587 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7588 pm_buffer_append_string(buffer, "\"DECIMAL\"", 9);
7589 flags++;
7590 }
7591 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_OCTAL)) {
7592 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7593 pm_buffer_append_string(buffer, "\"OCTAL\"", 7);
7594 flags++;
7595 }
7596 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_HEXADECIMAL)) {
7597 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7598 pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13);
7599 flags++;
7600 }
7601 pm_buffer_append_byte(buffer, ']');
7602
7603 // Dump the numerator field
7604 pm_buffer_append_byte(buffer, ',');
7605 pm_buffer_append_string(buffer, "\"numerator\":", 12);
7606 pm_integer_string(buffer, &cast->numerator);
7607
7608 // Dump the denominator field
7609 pm_buffer_append_byte(buffer, ',');
7610 pm_buffer_append_string(buffer, "\"denominator\":", 14);
7611 pm_integer_string(buffer, &cast->denominator);
7612
7613 pm_buffer_append_byte(buffer, '}');
7614 break;
7615 }
7616 case PM_REDO_NODE: {
7617 pm_buffer_append_string(buffer, "{\"type\":\"RedoNode\",\"location\":", 30);
7618
7619 const pm_redo_node_t *cast = (const pm_redo_node_t *) node;
7620 pm_dump_json_location(buffer, parser, &cast->base.location);
7621
7622 pm_buffer_append_byte(buffer, '}');
7623 break;
7624 }
7625 case PM_REGULAR_EXPRESSION_NODE: {
7626 pm_buffer_append_string(buffer, "{\"type\":\"RegularExpressionNode\",\"location\":", 43);
7627
7628 const pm_regular_expression_node_t *cast = (const pm_regular_expression_node_t *) node;
7629 pm_dump_json_location(buffer, parser, &cast->base.location);
7630
7631 // Dump the RegularExpressionFlags field
7632 pm_buffer_append_byte(buffer, ',');
7633 pm_buffer_append_string(buffer, "\"RegularExpressionFlags\":", 25);
7634 size_t flags = 0;
7635 pm_buffer_append_byte(buffer, '[');
7636 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
7637 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7638 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
7639 flags++;
7640 }
7641 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
7642 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7643 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
7644 flags++;
7645 }
7646 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
7647 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7648 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
7649 flags++;
7650 }
7651 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
7652 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7653 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
7654 flags++;
7655 }
7656 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
7657 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7658 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
7659 flags++;
7660 }
7661 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
7662 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7663 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
7664 flags++;
7665 }
7666 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
7667 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7668 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
7669 flags++;
7670 }
7671 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
7672 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7673 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
7674 flags++;
7675 }
7676 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
7677 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7678 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
7679 flags++;
7680 }
7681 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
7682 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7683 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
7684 flags++;
7685 }
7686 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
7687 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7688 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
7689 flags++;
7690 }
7691 pm_buffer_append_byte(buffer, ']');
7692
7693 // Dump the opening_loc field
7694 pm_buffer_append_byte(buffer, ',');
7695 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
7696 pm_dump_json_location(buffer, parser, &cast->opening_loc);
7697
7698 // Dump the content_loc field
7699 pm_buffer_append_byte(buffer, ',');
7700 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
7701 pm_dump_json_location(buffer, parser, &cast->content_loc);
7702
7703 // Dump the closing_loc field
7704 pm_buffer_append_byte(buffer, ',');
7705 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
7706 pm_dump_json_location(buffer, parser, &cast->closing_loc);
7707
7708 // Dump the unescaped field
7709 pm_buffer_append_byte(buffer, ',');
7710 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
7711 const pm_string_t *unescaped = &cast->unescaped;
7712 pm_buffer_append_byte(buffer, '"');
7713 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
7714 pm_buffer_append_byte(buffer, '"');
7715
7716 pm_buffer_append_byte(buffer, '}');
7717 break;
7718 }
7719 case PM_REQUIRED_KEYWORD_PARAMETER_NODE: {
7720 pm_buffer_append_string(buffer, "{\"type\":\"RequiredKeywordParameterNode\",\"location\":", 50);
7721
7722 const pm_required_keyword_parameter_node_t *cast = (const pm_required_keyword_parameter_node_t *) node;
7723 pm_dump_json_location(buffer, parser, &cast->base.location);
7724
7725 // Dump the ParameterFlags field
7726 pm_buffer_append_byte(buffer, ',');
7727 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7728 size_t flags = 0;
7729 pm_buffer_append_byte(buffer, '[');
7730 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
7731 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7732 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7733 flags++;
7734 }
7735 pm_buffer_append_byte(buffer, ']');
7736
7737 // Dump the name field
7738 pm_buffer_append_byte(buffer, ',');
7739 pm_buffer_append_string(buffer, "\"name\":", 7);
7740 pm_dump_json_constant(buffer, parser, cast->name);
7741
7742 // Dump the name_loc field
7743 pm_buffer_append_byte(buffer, ',');
7744 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7745 pm_dump_json_location(buffer, parser, &cast->name_loc);
7746
7747 pm_buffer_append_byte(buffer, '}');
7748 break;
7749 }
7750 case PM_REQUIRED_PARAMETER_NODE: {
7751 pm_buffer_append_string(buffer, "{\"type\":\"RequiredParameterNode\",\"location\":", 43);
7752
7753 const pm_required_parameter_node_t *cast = (const pm_required_parameter_node_t *) node;
7754 pm_dump_json_location(buffer, parser, &cast->base.location);
7755
7756 // Dump the ParameterFlags field
7757 pm_buffer_append_byte(buffer, ',');
7758 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7759 size_t flags = 0;
7760 pm_buffer_append_byte(buffer, '[');
7761 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
7762 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7763 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7764 flags++;
7765 }
7766 pm_buffer_append_byte(buffer, ']');
7767
7768 // Dump the name field
7769 pm_buffer_append_byte(buffer, ',');
7770 pm_buffer_append_string(buffer, "\"name\":", 7);
7771 pm_dump_json_constant(buffer, parser, cast->name);
7772
7773 pm_buffer_append_byte(buffer, '}');
7774 break;
7775 }
7776 case PM_RESCUE_MODIFIER_NODE: {
7777 pm_buffer_append_string(buffer, "{\"type\":\"RescueModifierNode\",\"location\":", 40);
7778
7779 const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node;
7780 pm_dump_json_location(buffer, parser, &cast->base.location);
7781
7782 // Dump the expression field
7783 pm_buffer_append_byte(buffer, ',');
7784 pm_buffer_append_string(buffer, "\"expression\":", 13);
7785 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
7786
7787 // Dump the keyword_loc field
7788 pm_buffer_append_byte(buffer, ',');
7789 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7790 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7791
7792 // Dump the rescue_expression field
7793 pm_buffer_append_byte(buffer, ',');
7794 pm_buffer_append_string(buffer, "\"rescue_expression\":", 20);
7795 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_expression);
7796
7797 pm_buffer_append_byte(buffer, '}');
7798 break;
7799 }
7800 case PM_RESCUE_NODE: {
7801 pm_buffer_append_string(buffer, "{\"type\":\"RescueNode\",\"location\":", 32);
7802
7803 const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node;
7804 pm_dump_json_location(buffer, parser, &cast->base.location);
7805
7806 // Dump the keyword_loc field
7807 pm_buffer_append_byte(buffer, ',');
7808 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7809 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7810
7811 // Dump the exceptions field
7812 pm_buffer_append_byte(buffer, ',');
7813 pm_buffer_append_string(buffer, "\"exceptions\":", 13);
7814 const pm_node_list_t *exceptions = &cast->exceptions;
7815 pm_buffer_append_byte(buffer, '[');
7816
7817 for (size_t index = 0; index < exceptions->size; index++) {
7818 if (index != 0) pm_buffer_append_byte(buffer, ',');
7819 pm_dump_json(buffer, parser, exceptions->nodes[index]);
7820 }
7821 pm_buffer_append_byte(buffer, ']');
7822
7823 // Dump the operator_loc field
7824 pm_buffer_append_byte(buffer, ',');
7825 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7826 if (cast->operator_loc.start != NULL) {
7827 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7828 } else {
7829 pm_buffer_append_string(buffer, "null", 4);
7830 }
7831
7832 // Dump the reference field
7833 pm_buffer_append_byte(buffer, ',');
7834 pm_buffer_append_string(buffer, "\"reference\":", 12);
7835 if (cast->reference != NULL) {
7836 pm_dump_json(buffer, parser, (const pm_node_t *) cast->reference);
7837 } else {
7838 pm_buffer_append_string(buffer, "null", 4);
7839 }
7840
7841 // Dump the then_keyword_loc field
7842 pm_buffer_append_byte(buffer, ',');
7843 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
7844 if (cast->then_keyword_loc.start != NULL) {
7845 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
7846 } else {
7847 pm_buffer_append_string(buffer, "null", 4);
7848 }
7849
7850 // Dump the statements field
7851 pm_buffer_append_byte(buffer, ',');
7852 pm_buffer_append_string(buffer, "\"statements\":", 13);
7853 if (cast->statements != NULL) {
7854 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
7855 } else {
7856 pm_buffer_append_string(buffer, "null", 4);
7857 }
7858
7859 // Dump the subsequent field
7860 pm_buffer_append_byte(buffer, ',');
7861 pm_buffer_append_string(buffer, "\"subsequent\":", 13);
7862 if (cast->subsequent != NULL) {
7863 pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent);
7864 } else {
7865 pm_buffer_append_string(buffer, "null", 4);
7866 }
7867
7868 pm_buffer_append_byte(buffer, '}');
7869 break;
7870 }
7871 case PM_REST_PARAMETER_NODE: {
7872 pm_buffer_append_string(buffer, "{\"type\":\"RestParameterNode\",\"location\":", 39);
7873
7874 const pm_rest_parameter_node_t *cast = (const pm_rest_parameter_node_t *) node;
7875 pm_dump_json_location(buffer, parser, &cast->base.location);
7876
7877 // Dump the ParameterFlags field
7878 pm_buffer_append_byte(buffer, ',');
7879 pm_buffer_append_string(buffer, "\"ParameterFlags\":", 17);
7880 size_t flags = 0;
7881 pm_buffer_append_byte(buffer, '[');
7882 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
7883 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7884 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
7885 flags++;
7886 }
7887 pm_buffer_append_byte(buffer, ']');
7888
7889 // Dump the name field
7890 pm_buffer_append_byte(buffer, ',');
7891 pm_buffer_append_string(buffer, "\"name\":", 7);
7892 if (cast->name != PM_CONSTANT_ID_UNSET) {
7893 pm_dump_json_constant(buffer, parser, cast->name);
7894 } else {
7895 pm_buffer_append_string(buffer, "null", 4);
7896 }
7897
7898 // Dump the name_loc field
7899 pm_buffer_append_byte(buffer, ',');
7900 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
7901 if (cast->name_loc.start != NULL) {
7902 pm_dump_json_location(buffer, parser, &cast->name_loc);
7903 } else {
7904 pm_buffer_append_string(buffer, "null", 4);
7905 }
7906
7907 // Dump the operator_loc field
7908 pm_buffer_append_byte(buffer, ',');
7909 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
7910 pm_dump_json_location(buffer, parser, &cast->operator_loc);
7911
7912 pm_buffer_append_byte(buffer, '}');
7913 break;
7914 }
7915 case PM_RETRY_NODE: {
7916 pm_buffer_append_string(buffer, "{\"type\":\"RetryNode\",\"location\":", 31);
7917
7918 const pm_retry_node_t *cast = (const pm_retry_node_t *) node;
7919 pm_dump_json_location(buffer, parser, &cast->base.location);
7920
7921 pm_buffer_append_byte(buffer, '}');
7922 break;
7923 }
7924 case PM_RETURN_NODE: {
7925 pm_buffer_append_string(buffer, "{\"type\":\"ReturnNode\",\"location\":", 32);
7926
7927 const pm_return_node_t *cast = (const pm_return_node_t *) node;
7928 pm_dump_json_location(buffer, parser, &cast->base.location);
7929
7930 // Dump the keyword_loc field
7931 pm_buffer_append_byte(buffer, ',');
7932 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
7933 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
7934
7935 // Dump the arguments field
7936 pm_buffer_append_byte(buffer, ',');
7937 pm_buffer_append_string(buffer, "\"arguments\":", 12);
7938 if (cast->arguments != NULL) {
7939 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
7940 } else {
7941 pm_buffer_append_string(buffer, "null", 4);
7942 }
7943
7944 pm_buffer_append_byte(buffer, '}');
7945 break;
7946 }
7947 case PM_SELF_NODE: {
7948 pm_buffer_append_string(buffer, "{\"type\":\"SelfNode\",\"location\":", 30);
7949
7950 const pm_self_node_t *cast = (const pm_self_node_t *) node;
7951 pm_dump_json_location(buffer, parser, &cast->base.location);
7952
7953 pm_buffer_append_byte(buffer, '}');
7954 break;
7955 }
7956 case PM_SHAREABLE_CONSTANT_NODE: {
7957 pm_buffer_append_string(buffer, "{\"type\":\"ShareableConstantNode\",\"location\":", 43);
7958
7959 const pm_shareable_constant_node_t *cast = (const pm_shareable_constant_node_t *) node;
7960 pm_dump_json_location(buffer, parser, &cast->base.location);
7961
7962 // Dump the ShareableConstantNodeFlags field
7963 pm_buffer_append_byte(buffer, ',');
7964 pm_buffer_append_string(buffer, "\"ShareableConstantNodeFlags\":", 29);
7965 size_t flags = 0;
7966 pm_buffer_append_byte(buffer, '[');
7967 if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL)) {
7968 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7969 pm_buffer_append_string(buffer, "\"LITERAL\"", 9);
7970 flags++;
7971 }
7972 if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING)) {
7973 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7974 pm_buffer_append_string(buffer, "\"EXPERIMENTAL_EVERYTHING\"", 25);
7975 flags++;
7976 }
7977 if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY)) {
7978 if (flags != 0) pm_buffer_append_byte(buffer, ',');
7979 pm_buffer_append_string(buffer, "\"EXPERIMENTAL_COPY\"", 19);
7980 flags++;
7981 }
7982 pm_buffer_append_byte(buffer, ']');
7983
7984 // Dump the write field
7985 pm_buffer_append_byte(buffer, ',');
7986 pm_buffer_append_string(buffer, "\"write\":", 8);
7987 pm_dump_json(buffer, parser, (const pm_node_t *) cast->write);
7988
7989 pm_buffer_append_byte(buffer, '}');
7990 break;
7991 }
7992 case PM_SINGLETON_CLASS_NODE: {
7993 pm_buffer_append_string(buffer, "{\"type\":\"SingletonClassNode\",\"location\":", 40);
7994
7995 const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node;
7996 pm_dump_json_location(buffer, parser, &cast->base.location);
7997
7998 // Dump the locals field
7999 pm_buffer_append_byte(buffer, ',');
8000 pm_buffer_append_string(buffer, "\"locals\":", 9);
8001 const pm_constant_id_list_t *locals = &cast->locals;
8002 pm_buffer_append_byte(buffer, '[');
8003
8004 for (size_t index = 0; index < locals->size; index++) {
8005 if (index != 0) pm_buffer_append_byte(buffer, ',');
8006 pm_dump_json_constant(buffer, parser, locals->ids[index]);
8007 }
8008 pm_buffer_append_byte(buffer, ']');
8009
8010 // Dump the class_keyword_loc field
8011 pm_buffer_append_byte(buffer, ',');
8012 pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20);
8013 pm_dump_json_location(buffer, parser, &cast->class_keyword_loc);
8014
8015 // Dump the operator_loc field
8016 pm_buffer_append_byte(buffer, ',');
8017 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
8018 pm_dump_json_location(buffer, parser, &cast->operator_loc);
8019
8020 // Dump the expression field
8021 pm_buffer_append_byte(buffer, ',');
8022 pm_buffer_append_string(buffer, "\"expression\":", 13);
8023 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
8024
8025 // Dump the body field
8026 pm_buffer_append_byte(buffer, ',');
8027 pm_buffer_append_string(buffer, "\"body\":", 7);
8028 if (cast->body != NULL) {
8029 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
8030 } else {
8031 pm_buffer_append_string(buffer, "null", 4);
8032 }
8033
8034 // Dump the end_keyword_loc field
8035 pm_buffer_append_byte(buffer, ',');
8036 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
8037 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
8038
8039 pm_buffer_append_byte(buffer, '}');
8040 break;
8041 }
8042 case PM_SOURCE_ENCODING_NODE: {
8043 pm_buffer_append_string(buffer, "{\"type\":\"SourceEncodingNode\",\"location\":", 40);
8044
8045 const pm_source_encoding_node_t *cast = (const pm_source_encoding_node_t *) node;
8046 pm_dump_json_location(buffer, parser, &cast->base.location);
8047
8048 pm_buffer_append_byte(buffer, '}');
8049 break;
8050 }
8051 case PM_SOURCE_FILE_NODE: {
8052 pm_buffer_append_string(buffer, "{\"type\":\"SourceFileNode\",\"location\":", 36);
8053
8054 const pm_source_file_node_t *cast = (const pm_source_file_node_t *) node;
8055 pm_dump_json_location(buffer, parser, &cast->base.location);
8056
8057 // Dump the StringFlags field
8058 pm_buffer_append_byte(buffer, ',');
8059 pm_buffer_append_string(buffer, "\"StringFlags\":", 14);
8060 size_t flags = 0;
8061 pm_buffer_append_byte(buffer, '[');
8062 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_UTF8_ENCODING)) {
8063 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8064 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8065 flags++;
8066 }
8067 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_BINARY_ENCODING)) {
8068 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8069 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8070 flags++;
8071 }
8072 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) {
8073 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8074 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
8075 flags++;
8076 }
8077 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_MUTABLE)) {
8078 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8079 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
8080 flags++;
8081 }
8082 pm_buffer_append_byte(buffer, ']');
8083
8084 // Dump the filepath field
8085 pm_buffer_append_byte(buffer, ',');
8086 pm_buffer_append_string(buffer, "\"filepath\":", 11);
8087 const pm_string_t *filepath = &cast->filepath;
8088 pm_buffer_append_byte(buffer, '"');
8089 pm_buffer_append_source(buffer, pm_string_source(filepath), pm_string_length(filepath), PM_BUFFER_ESCAPING_JSON);
8090 pm_buffer_append_byte(buffer, '"');
8091
8092 pm_buffer_append_byte(buffer, '}');
8093 break;
8094 }
8095 case PM_SOURCE_LINE_NODE: {
8096 pm_buffer_append_string(buffer, "{\"type\":\"SourceLineNode\",\"location\":", 36);
8097
8098 const pm_source_line_node_t *cast = (const pm_source_line_node_t *) node;
8099 pm_dump_json_location(buffer, parser, &cast->base.location);
8100
8101 pm_buffer_append_byte(buffer, '}');
8102 break;
8103 }
8104 case PM_SPLAT_NODE: {
8105 pm_buffer_append_string(buffer, "{\"type\":\"SplatNode\",\"location\":", 31);
8106
8107 const pm_splat_node_t *cast = (const pm_splat_node_t *) node;
8108 pm_dump_json_location(buffer, parser, &cast->base.location);
8109
8110 // Dump the operator_loc field
8111 pm_buffer_append_byte(buffer, ',');
8112 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
8113 pm_dump_json_location(buffer, parser, &cast->operator_loc);
8114
8115 // Dump the expression field
8116 pm_buffer_append_byte(buffer, ',');
8117 pm_buffer_append_string(buffer, "\"expression\":", 13);
8118 if (cast->expression != NULL) {
8119 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
8120 } else {
8121 pm_buffer_append_string(buffer, "null", 4);
8122 }
8123
8124 pm_buffer_append_byte(buffer, '}');
8125 break;
8126 }
8127 case PM_STATEMENTS_NODE: {
8128 pm_buffer_append_string(buffer, "{\"type\":\"StatementsNode\",\"location\":", 36);
8129
8130 const pm_statements_node_t *cast = (const pm_statements_node_t *) node;
8131 pm_dump_json_location(buffer, parser, &cast->base.location);
8132
8133 // Dump the body field
8134 pm_buffer_append_byte(buffer, ',');
8135 pm_buffer_append_string(buffer, "\"body\":", 7);
8136 const pm_node_list_t *body = &cast->body;
8137 pm_buffer_append_byte(buffer, '[');
8138
8139 for (size_t index = 0; index < body->size; index++) {
8140 if (index != 0) pm_buffer_append_byte(buffer, ',');
8141 pm_dump_json(buffer, parser, body->nodes[index]);
8142 }
8143 pm_buffer_append_byte(buffer, ']');
8144
8145 pm_buffer_append_byte(buffer, '}');
8146 break;
8147 }
8148 case PM_STRING_NODE: {
8149 pm_buffer_append_string(buffer, "{\"type\":\"StringNode\",\"location\":", 32);
8150
8151 const pm_string_node_t *cast = (const pm_string_node_t *) node;
8152 pm_dump_json_location(buffer, parser, &cast->base.location);
8153
8154 // Dump the StringFlags field
8155 pm_buffer_append_byte(buffer, ',');
8156 pm_buffer_append_string(buffer, "\"StringFlags\":", 14);
8157 size_t flags = 0;
8158 pm_buffer_append_byte(buffer, '[');
8159 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_UTF8_ENCODING)) {
8160 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8161 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8162 flags++;
8163 }
8164 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_BINARY_ENCODING)) {
8165 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8166 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8167 flags++;
8168 }
8169 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) {
8170 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8171 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
8172 flags++;
8173 }
8174 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_MUTABLE)) {
8175 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8176 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
8177 flags++;
8178 }
8179 pm_buffer_append_byte(buffer, ']');
8180
8181 // Dump the opening_loc field
8182 pm_buffer_append_byte(buffer, ',');
8183 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
8184 if (cast->opening_loc.start != NULL) {
8185 pm_dump_json_location(buffer, parser, &cast->opening_loc);
8186 } else {
8187 pm_buffer_append_string(buffer, "null", 4);
8188 }
8189
8190 // Dump the content_loc field
8191 pm_buffer_append_byte(buffer, ',');
8192 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
8193 pm_dump_json_location(buffer, parser, &cast->content_loc);
8194
8195 // Dump the closing_loc field
8196 pm_buffer_append_byte(buffer, ',');
8197 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8198 if (cast->closing_loc.start != NULL) {
8199 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8200 } else {
8201 pm_buffer_append_string(buffer, "null", 4);
8202 }
8203
8204 // Dump the unescaped field
8205 pm_buffer_append_byte(buffer, ',');
8206 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
8207 const pm_string_t *unescaped = &cast->unescaped;
8208 pm_buffer_append_byte(buffer, '"');
8209 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
8210 pm_buffer_append_byte(buffer, '"');
8211
8212 pm_buffer_append_byte(buffer, '}');
8213 break;
8214 }
8215 case PM_SUPER_NODE: {
8216 pm_buffer_append_string(buffer, "{\"type\":\"SuperNode\",\"location\":", 31);
8217
8218 const pm_super_node_t *cast = (const pm_super_node_t *) node;
8219 pm_dump_json_location(buffer, parser, &cast->base.location);
8220
8221 // Dump the keyword_loc field
8222 pm_buffer_append_byte(buffer, ',');
8223 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8224 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8225
8226 // Dump the lparen_loc field
8227 pm_buffer_append_byte(buffer, ',');
8228 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
8229 if (cast->lparen_loc.start != NULL) {
8230 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
8231 } else {
8232 pm_buffer_append_string(buffer, "null", 4);
8233 }
8234
8235 // Dump the arguments field
8236 pm_buffer_append_byte(buffer, ',');
8237 pm_buffer_append_string(buffer, "\"arguments\":", 12);
8238 if (cast->arguments != NULL) {
8239 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
8240 } else {
8241 pm_buffer_append_string(buffer, "null", 4);
8242 }
8243
8244 // Dump the rparen_loc field
8245 pm_buffer_append_byte(buffer, ',');
8246 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
8247 if (cast->rparen_loc.start != NULL) {
8248 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
8249 } else {
8250 pm_buffer_append_string(buffer, "null", 4);
8251 }
8252
8253 // Dump the block field
8254 pm_buffer_append_byte(buffer, ',');
8255 pm_buffer_append_string(buffer, "\"block\":", 8);
8256 if (cast->block != NULL) {
8257 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
8258 } else {
8259 pm_buffer_append_string(buffer, "null", 4);
8260 }
8261
8262 pm_buffer_append_byte(buffer, '}');
8263 break;
8264 }
8265 case PM_SYMBOL_NODE: {
8266 pm_buffer_append_string(buffer, "{\"type\":\"SymbolNode\",\"location\":", 32);
8267
8268 const pm_symbol_node_t *cast = (const pm_symbol_node_t *) node;
8269 pm_dump_json_location(buffer, parser, &cast->base.location);
8270
8271 // Dump the SymbolFlags field
8272 pm_buffer_append_byte(buffer, ',');
8273 pm_buffer_append_string(buffer, "\"SymbolFlags\":", 14);
8274 size_t flags = 0;
8275 pm_buffer_append_byte(buffer, '[');
8276 if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING)) {
8277 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8278 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8279 flags++;
8280 }
8281 if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING)) {
8282 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8283 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8284 flags++;
8285 }
8286 if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING)) {
8287 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8288 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
8289 flags++;
8290 }
8291 pm_buffer_append_byte(buffer, ']');
8292
8293 // Dump the opening_loc field
8294 pm_buffer_append_byte(buffer, ',');
8295 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
8296 if (cast->opening_loc.start != NULL) {
8297 pm_dump_json_location(buffer, parser, &cast->opening_loc);
8298 } else {
8299 pm_buffer_append_string(buffer, "null", 4);
8300 }
8301
8302 // Dump the value_loc field
8303 pm_buffer_append_byte(buffer, ',');
8304 pm_buffer_append_string(buffer, "\"value_loc\":", 12);
8305 if (cast->value_loc.start != NULL) {
8306 pm_dump_json_location(buffer, parser, &cast->value_loc);
8307 } else {
8308 pm_buffer_append_string(buffer, "null", 4);
8309 }
8310
8311 // Dump the closing_loc field
8312 pm_buffer_append_byte(buffer, ',');
8313 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8314 if (cast->closing_loc.start != NULL) {
8315 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8316 } else {
8317 pm_buffer_append_string(buffer, "null", 4);
8318 }
8319
8320 // Dump the unescaped field
8321 pm_buffer_append_byte(buffer, ',');
8322 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
8323 const pm_string_t *unescaped = &cast->unescaped;
8324 pm_buffer_append_byte(buffer, '"');
8325 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
8326 pm_buffer_append_byte(buffer, '"');
8327
8328 pm_buffer_append_byte(buffer, '}');
8329 break;
8330 }
8331 case PM_TRUE_NODE: {
8332 pm_buffer_append_string(buffer, "{\"type\":\"TrueNode\",\"location\":", 30);
8333
8334 const pm_true_node_t *cast = (const pm_true_node_t *) node;
8335 pm_dump_json_location(buffer, parser, &cast->base.location);
8336
8337 pm_buffer_append_byte(buffer, '}');
8338 break;
8339 }
8340 case PM_UNDEF_NODE: {
8341 pm_buffer_append_string(buffer, "{\"type\":\"UndefNode\",\"location\":", 31);
8342
8343 const pm_undef_node_t *cast = (const pm_undef_node_t *) node;
8344 pm_dump_json_location(buffer, parser, &cast->base.location);
8345
8346 // Dump the names field
8347 pm_buffer_append_byte(buffer, ',');
8348 pm_buffer_append_string(buffer, "\"names\":", 8);
8349 const pm_node_list_t *names = &cast->names;
8350 pm_buffer_append_byte(buffer, '[');
8351
8352 for (size_t index = 0; index < names->size; index++) {
8353 if (index != 0) pm_buffer_append_byte(buffer, ',');
8354 pm_dump_json(buffer, parser, names->nodes[index]);
8355 }
8356 pm_buffer_append_byte(buffer, ']');
8357
8358 // Dump the keyword_loc field
8359 pm_buffer_append_byte(buffer, ',');
8360 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8361 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8362
8363 pm_buffer_append_byte(buffer, '}');
8364 break;
8365 }
8366 case PM_UNLESS_NODE: {
8367 pm_buffer_append_string(buffer, "{\"type\":\"UnlessNode\",\"location\":", 32);
8368
8369 const pm_unless_node_t *cast = (const pm_unless_node_t *) node;
8370 pm_dump_json_location(buffer, parser, &cast->base.location);
8371
8372 // Dump the keyword_loc field
8373 pm_buffer_append_byte(buffer, ',');
8374 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8375 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8376
8377 // Dump the predicate field
8378 pm_buffer_append_byte(buffer, ',');
8379 pm_buffer_append_string(buffer, "\"predicate\":", 12);
8380 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
8381
8382 // Dump the then_keyword_loc field
8383 pm_buffer_append_byte(buffer, ',');
8384 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
8385 if (cast->then_keyword_loc.start != NULL) {
8386 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
8387 } else {
8388 pm_buffer_append_string(buffer, "null", 4);
8389 }
8390
8391 // Dump the statements field
8392 pm_buffer_append_byte(buffer, ',');
8393 pm_buffer_append_string(buffer, "\"statements\":", 13);
8394 if (cast->statements != NULL) {
8395 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8396 } else {
8397 pm_buffer_append_string(buffer, "null", 4);
8398 }
8399
8400 // Dump the else_clause field
8401 pm_buffer_append_byte(buffer, ',');
8402 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
8403 if (cast->else_clause != NULL) {
8404 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
8405 } else {
8406 pm_buffer_append_string(buffer, "null", 4);
8407 }
8408
8409 // Dump the end_keyword_loc field
8410 pm_buffer_append_byte(buffer, ',');
8411 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
8412 if (cast->end_keyword_loc.start != NULL) {
8413 pm_dump_json_location(buffer, parser, &cast->end_keyword_loc);
8414 } else {
8415 pm_buffer_append_string(buffer, "null", 4);
8416 }
8417
8418 pm_buffer_append_byte(buffer, '}');
8419 break;
8420 }
8421 case PM_UNTIL_NODE: {
8422 pm_buffer_append_string(buffer, "{\"type\":\"UntilNode\",\"location\":", 31);
8423
8424 const pm_until_node_t *cast = (const pm_until_node_t *) node;
8425 pm_dump_json_location(buffer, parser, &cast->base.location);
8426
8427 // Dump the LoopFlags field
8428 pm_buffer_append_byte(buffer, ',');
8429 pm_buffer_append_string(buffer, "\"LoopFlags\":", 12);
8430 size_t flags = 0;
8431 pm_buffer_append_byte(buffer, '[');
8432 if (PM_NODE_FLAG_P(cast, PM_LOOP_FLAGS_BEGIN_MODIFIER)) {
8433 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8434 pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16);
8435 flags++;
8436 }
8437 pm_buffer_append_byte(buffer, ']');
8438
8439 // Dump the keyword_loc field
8440 pm_buffer_append_byte(buffer, ',');
8441 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8442 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8443
8444 // Dump the do_keyword_loc field
8445 pm_buffer_append_byte(buffer, ',');
8446 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
8447 if (cast->do_keyword_loc.start != NULL) {
8448 pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
8449 } else {
8450 pm_buffer_append_string(buffer, "null", 4);
8451 }
8452
8453 // Dump the closing_loc field
8454 pm_buffer_append_byte(buffer, ',');
8455 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8456 if (cast->closing_loc.start != NULL) {
8457 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8458 } else {
8459 pm_buffer_append_string(buffer, "null", 4);
8460 }
8461
8462 // Dump the predicate field
8463 pm_buffer_append_byte(buffer, ',');
8464 pm_buffer_append_string(buffer, "\"predicate\":", 12);
8465 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
8466
8467 // Dump the statements field
8468 pm_buffer_append_byte(buffer, ',');
8469 pm_buffer_append_string(buffer, "\"statements\":", 13);
8470 if (cast->statements != NULL) {
8471 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8472 } else {
8473 pm_buffer_append_string(buffer, "null", 4);
8474 }
8475
8476 pm_buffer_append_byte(buffer, '}');
8477 break;
8478 }
8479 case PM_WHEN_NODE: {
8480 pm_buffer_append_string(buffer, "{\"type\":\"WhenNode\",\"location\":", 30);
8481
8482 const pm_when_node_t *cast = (const pm_when_node_t *) node;
8483 pm_dump_json_location(buffer, parser, &cast->base.location);
8484
8485 // Dump the keyword_loc field
8486 pm_buffer_append_byte(buffer, ',');
8487 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8488 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8489
8490 // Dump the conditions field
8491 pm_buffer_append_byte(buffer, ',');
8492 pm_buffer_append_string(buffer, "\"conditions\":", 13);
8493 const pm_node_list_t *conditions = &cast->conditions;
8494 pm_buffer_append_byte(buffer, '[');
8495
8496 for (size_t index = 0; index < conditions->size; index++) {
8497 if (index != 0) pm_buffer_append_byte(buffer, ',');
8498 pm_dump_json(buffer, parser, conditions->nodes[index]);
8499 }
8500 pm_buffer_append_byte(buffer, ']');
8501
8502 // Dump the then_keyword_loc field
8503 pm_buffer_append_byte(buffer, ',');
8504 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
8505 if (cast->then_keyword_loc.start != NULL) {
8506 pm_dump_json_location(buffer, parser, &cast->then_keyword_loc);
8507 } else {
8508 pm_buffer_append_string(buffer, "null", 4);
8509 }
8510
8511 // Dump the statements field
8512 pm_buffer_append_byte(buffer, ',');
8513 pm_buffer_append_string(buffer, "\"statements\":", 13);
8514 if (cast->statements != NULL) {
8515 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8516 } else {
8517 pm_buffer_append_string(buffer, "null", 4);
8518 }
8519
8520 pm_buffer_append_byte(buffer, '}');
8521 break;
8522 }
8523 case PM_WHILE_NODE: {
8524 pm_buffer_append_string(buffer, "{\"type\":\"WhileNode\",\"location\":", 31);
8525
8526 const pm_while_node_t *cast = (const pm_while_node_t *) node;
8527 pm_dump_json_location(buffer, parser, &cast->base.location);
8528
8529 // Dump the LoopFlags field
8530 pm_buffer_append_byte(buffer, ',');
8531 pm_buffer_append_string(buffer, "\"LoopFlags\":", 12);
8532 size_t flags = 0;
8533 pm_buffer_append_byte(buffer, '[');
8534 if (PM_NODE_FLAG_P(cast, PM_LOOP_FLAGS_BEGIN_MODIFIER)) {
8535 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8536 pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16);
8537 flags++;
8538 }
8539 pm_buffer_append_byte(buffer, ']');
8540
8541 // Dump the keyword_loc field
8542 pm_buffer_append_byte(buffer, ',');
8543 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8544 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8545
8546 // Dump the do_keyword_loc field
8547 pm_buffer_append_byte(buffer, ',');
8548 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
8549 if (cast->do_keyword_loc.start != NULL) {
8550 pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
8551 } else {
8552 pm_buffer_append_string(buffer, "null", 4);
8553 }
8554
8555 // Dump the closing_loc field
8556 pm_buffer_append_byte(buffer, ',');
8557 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8558 if (cast->closing_loc.start != NULL) {
8559 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8560 } else {
8561 pm_buffer_append_string(buffer, "null", 4);
8562 }
8563
8564 // Dump the predicate field
8565 pm_buffer_append_byte(buffer, ',');
8566 pm_buffer_append_string(buffer, "\"predicate\":", 12);
8567 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
8568
8569 // Dump the statements field
8570 pm_buffer_append_byte(buffer, ',');
8571 pm_buffer_append_string(buffer, "\"statements\":", 13);
8572 if (cast->statements != NULL) {
8573 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
8574 } else {
8575 pm_buffer_append_string(buffer, "null", 4);
8576 }
8577
8578 pm_buffer_append_byte(buffer, '}');
8579 break;
8580 }
8581 case PM_X_STRING_NODE: {
8582 pm_buffer_append_string(buffer, "{\"type\":\"XStringNode\",\"location\":", 33);
8583
8584 const pm_x_string_node_t *cast = (const pm_x_string_node_t *) node;
8585 pm_dump_json_location(buffer, parser, &cast->base.location);
8586
8587 // Dump the EncodingFlags field
8588 pm_buffer_append_byte(buffer, ',');
8589 pm_buffer_append_string(buffer, "\"EncodingFlags\":", 16);
8590 size_t flags = 0;
8591 pm_buffer_append_byte(buffer, '[');
8592 if (PM_NODE_FLAG_P(cast, PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING)) {
8593 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8594 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
8595 flags++;
8596 }
8597 if (PM_NODE_FLAG_P(cast, PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING)) {
8598 if (flags != 0) pm_buffer_append_byte(buffer, ',');
8599 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
8600 flags++;
8601 }
8602 pm_buffer_append_byte(buffer, ']');
8603
8604 // Dump the opening_loc field
8605 pm_buffer_append_byte(buffer, ',');
8606 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
8607 pm_dump_json_location(buffer, parser, &cast->opening_loc);
8608
8609 // Dump the content_loc field
8610 pm_buffer_append_byte(buffer, ',');
8611 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
8612 pm_dump_json_location(buffer, parser, &cast->content_loc);
8613
8614 // Dump the closing_loc field
8615 pm_buffer_append_byte(buffer, ',');
8616 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
8617 pm_dump_json_location(buffer, parser, &cast->closing_loc);
8618
8619 // Dump the unescaped field
8620 pm_buffer_append_byte(buffer, ',');
8621 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
8622 const pm_string_t *unescaped = &cast->unescaped;
8623 pm_buffer_append_byte(buffer, '"');
8624 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
8625 pm_buffer_append_byte(buffer, '"');
8626
8627 pm_buffer_append_byte(buffer, '}');
8628 break;
8629 }
8630 case PM_YIELD_NODE: {
8631 pm_buffer_append_string(buffer, "{\"type\":\"YieldNode\",\"location\":", 31);
8632
8633 const pm_yield_node_t *cast = (const pm_yield_node_t *) node;
8634 pm_dump_json_location(buffer, parser, &cast->base.location);
8635
8636 // Dump the keyword_loc field
8637 pm_buffer_append_byte(buffer, ',');
8638 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
8639 pm_dump_json_location(buffer, parser, &cast->keyword_loc);
8640
8641 // Dump the lparen_loc field
8642 pm_buffer_append_byte(buffer, ',');
8643 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
8644 if (cast->lparen_loc.start != NULL) {
8645 pm_dump_json_location(buffer, parser, &cast->lparen_loc);
8646 } else {
8647 pm_buffer_append_string(buffer, "null", 4);
8648 }
8649
8650 // Dump the arguments field
8651 pm_buffer_append_byte(buffer, ',');
8652 pm_buffer_append_string(buffer, "\"arguments\":", 12);
8653 if (cast->arguments != NULL) {
8654 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
8655 } else {
8656 pm_buffer_append_string(buffer, "null", 4);
8657 }
8658
8659 // Dump the rparen_loc field
8660 pm_buffer_append_byte(buffer, ',');
8661 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
8662 if (cast->rparen_loc.start != NULL) {
8663 pm_dump_json_location(buffer, parser, &cast->rparen_loc);
8664 } else {
8665 pm_buffer_append_string(buffer, "null", 4);
8666 }
8667
8668 pm_buffer_append_byte(buffer, '}');
8669 break;
8670 }
8671 case PM_SCOPE_NODE:
8672 break;
8673 }
8674}
8675
8676#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:1129
pm_alias_global_variable_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1108
pm_alias_global_variable_node::new_name
struct pm_node * new_name
AliasGlobalVariableNode::new_name.
Definition ast.h:1119
pm_alias_global_variable_node::keyword_loc
pm_location_t keyword_loc
AliasGlobalVariableNode::keyword_loc.
Definition ast.h:1139
pm_alias_method_node::old_name
struct pm_node * old_name
AliasMethodNode::old_name.
Definition ast.h:1189
pm_alias_method_node::new_name
struct pm_node * new_name
AliasMethodNode::new_name.
Definition ast.h:1173
pm_alias_method_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1156
pm_alias_method_node::keyword_loc
pm_location_t keyword_loc
AliasMethodNode::keyword_loc.
Definition ast.h:1199
pm_alternation_pattern_node::operator_loc
pm_location_t operator_loc
AlternationPatternNode::operator_loc.
Definition ast.h:1247
pm_alternation_pattern_node::left
struct pm_node * left
AlternationPatternNode::left.
Definition ast.h:1227
pm_alternation_pattern_node::right
struct pm_node * right
AlternationPatternNode::right.
Definition ast.h:1237
pm_alternation_pattern_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1216
pm_and_node::left
struct pm_node * left
AndNode::left.
Definition ast.h:1278
pm_and_node::right
struct pm_node * right
AndNode::right.
Definition ast.h:1291
pm_and_node::operator_loc
pm_location_t operator_loc
AndNode::operator_loc.
Definition ast.h:1301
pm_and_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1264
pm_arguments_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1325
pm_arguments_node::arguments
struct pm_node_list arguments
ArgumentsNode::arguments.
Definition ast.h:1336
pm_array_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1356
pm_array_node::closing_loc
pm_location_t closing_loc
ArrayNode::closing_loc.
Definition ast.h:1388
pm_array_node::elements
struct pm_node_list elements
ArrayNode::elements.
Definition ast.h:1364
pm_array_node::opening_loc
pm_location_t opening_loc
ArrayNode::opening_loc.
Definition ast.h:1376
pm_array_pattern_node::requireds
struct pm_node_list requireds
ArrayPatternNode::requireds.
Definition ast.h:1444
pm_array_pattern_node::rest
struct pm_node * rest
ArrayPatternNode::rest.
Definition ast.h:1454
pm_array_pattern_node::constant
struct pm_node * constant
ArrayPatternNode::constant.
Definition ast.h:1434
pm_array_pattern_node::opening_loc
pm_location_t opening_loc
ArrayPatternNode::opening_loc.
Definition ast.h:1474
pm_array_pattern_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1417
pm_array_pattern_node::closing_loc
pm_location_t closing_loc
ArrayPatternNode::closing_loc.
Definition ast.h:1484
pm_array_pattern_node::posts
struct pm_node_list posts
ArrayPatternNode::posts.
Definition ast.h:1464
pm_assoc_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1501
pm_assoc_node::value
struct pm_node * value
AssocNode::value.
Definition ast.h:1531
pm_assoc_node::key
struct pm_node * key
AssocNode::key.
Definition ast.h:1518
pm_assoc_node::operator_loc
pm_location_t operator_loc
AssocNode::operator_loc.
Definition ast.h:1541
pm_assoc_splat_node::value
struct pm_node * value
AssocSplatNode::value.
Definition ast.h:1569
pm_assoc_splat_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1558
pm_assoc_splat_node::operator_loc
pm_location_t operator_loc
AssocSplatNode::operator_loc.
Definition ast.h:1579
pm_back_reference_read_node::name
pm_constant_id_t name
BackReferenceReadNode::name.
Definition ast.h:1608
pm_back_reference_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1596
pm_begin_node::ensure_clause
struct pm_ensure_node * ensure_clause
BeginNode::ensure_clause.
Definition ast.h:1678
pm_begin_node::rescue_clause
struct pm_rescue_node * rescue_clause
BeginNode::rescue_clause.
Definition ast.h:1658
pm_begin_node::statements
struct pm_statements_node * statements
BeginNode::statements.
Definition ast.h:1648
pm_begin_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1627
pm_begin_node::end_keyword_loc
pm_location_t end_keyword_loc
BeginNode::end_keyword_loc.
Definition ast.h:1688
pm_begin_node::begin_keyword_loc
pm_location_t begin_keyword_loc
BeginNode::begin_keyword_loc.
Definition ast.h:1638
pm_begin_node::else_clause
struct pm_else_node * else_clause
BeginNode::else_clause.
Definition ast.h:1668
pm_block_argument_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1705
pm_block_argument_node::expression
struct pm_node * expression
BlockArgumentNode::expression.
Definition ast.h:1716
pm_block_argument_node::operator_loc
pm_location_t operator_loc
BlockArgumentNode::operator_loc.
Definition ast.h:1726
pm_block_local_variable_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1746
pm_block_local_variable_node::name
pm_constant_id_t name
BlockLocalVariableNode::name.
Definition ast.h:1757
pm_block_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1774
pm_block_node::closing_loc
pm_location_t closing_loc
BlockNode::closing_loc.
Definition ast.h:1829
pm_block_node::parameters
struct pm_node * parameters
BlockNode::parameters.
Definition ast.h:1799
pm_block_node::opening_loc
pm_location_t opening_loc
BlockNode::opening_loc.
Definition ast.h:1819
pm_block_node::body
struct pm_node * body
BlockNode::body.
Definition ast.h:1809
pm_block_node::locals
pm_constant_id_list_t locals
BlockNode::locals.
Definition ast.h:1785
pm_block_parameter_node::operator_loc
pm_location_t operator_loc
BlockParameterNode::operator_loc.
Definition ast.h:1883
pm_block_parameter_node::name_loc
pm_location_t name_loc
BlockParameterNode::name_loc.
Definition ast.h:1872
pm_block_parameter_node::name
pm_constant_id_t name
BlockParameterNode::name.
Definition ast.h:1862
pm_block_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1850
pm_block_parameters_node::parameters
struct pm_parameters_node * parameters
BlockParametersNode::parameters.
Definition ast.h:1919
pm_block_parameters_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1904
pm_block_parameters_node::locals
struct pm_node_list locals
BlockParametersNode::locals.
Definition ast.h:1933
pm_block_parameters_node::closing_loc
pm_location_t closing_loc
BlockParametersNode::closing_loc.
Definition ast.h:1961
pm_block_parameters_node::opening_loc
pm_location_t opening_loc
BlockParametersNode::opening_loc.
Definition ast.h:1947
pm_break_node::arguments
struct pm_arguments_node * arguments
BreakNode::arguments.
Definition ast.h:1989
pm_break_node::keyword_loc
pm_location_t keyword_loc
BreakNode::keyword_loc.
Definition ast.h:1999
pm_break_node::base
pm_node_t base
The embedded base node.
Definition ast.h:1978
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:2083
pm_call_and_write_node::value
struct pm_node * value
CallAndWriteNode::value.
Definition ast.h:2093
pm_call_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2022
pm_call_and_write_node::call_operator_loc
pm_location_t call_operator_loc
CallAndWriteNode::call_operator_loc.
Definition ast.h:2043
pm_call_and_write_node::message_loc
pm_location_t message_loc
CallAndWriteNode::message_loc.
Definition ast.h:2053
pm_call_and_write_node::read_name
pm_constant_id_t read_name
CallAndWriteNode::read_name.
Definition ast.h:2063
pm_call_and_write_node::write_name
pm_constant_id_t write_name
CallAndWriteNode::write_name.
Definition ast.h:2073
pm_call_and_write_node::receiver
struct pm_node * receiver
CallAndWriteNode::receiver.
Definition ast.h:2033
pm_call_node::opening_loc
pm_location_t opening_loc
CallNode::opening_loc.
Definition ast.h:2190
pm_call_node::closing_loc
pm_location_t closing_loc
CallNode::closing_loc.
Definition ast.h:2210
pm_call_node::receiver
struct pm_node * receiver
CallNode::receiver.
Definition ast.h:2148
pm_call_node::name
pm_constant_id_t name
CallNode::name.
Definition ast.h:2171
pm_call_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2131
pm_call_node::call_operator_loc
pm_location_t call_operator_loc
CallNode::call_operator_loc.
Definition ast.h:2161
pm_call_node::message_loc
pm_location_t message_loc
CallNode::message_loc.
Definition ast.h:2181
pm_call_node::arguments
struct pm_arguments_node * arguments
CallNode::arguments.
Definition ast.h:2200
pm_call_node::block
struct pm_node * block
CallNode::block.
Definition ast.h:2220
pm_call_operator_write_node::read_name
pm_constant_id_t read_name
CallOperatorWriteNode::read_name.
Definition ast.h:2284
pm_call_operator_write_node::binary_operator
pm_constant_id_t binary_operator
CallOperatorWriteNode::binary_operator.
Definition ast.h:2304
pm_call_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
CallOperatorWriteNode::binary_operator_loc.
Definition ast.h:2314
pm_call_operator_write_node::receiver
struct pm_node * receiver
CallOperatorWriteNode::receiver.
Definition ast.h:2254
pm_call_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2243
pm_call_operator_write_node::write_name
pm_constant_id_t write_name
CallOperatorWriteNode::write_name.
Definition ast.h:2294
pm_call_operator_write_node::message_loc
pm_location_t message_loc
CallOperatorWriteNode::message_loc.
Definition ast.h:2274
pm_call_operator_write_node::value
struct pm_node * value
CallOperatorWriteNode::value.
Definition ast.h:2324
pm_call_operator_write_node::call_operator_loc
pm_location_t call_operator_loc
CallOperatorWriteNode::call_operator_loc.
Definition ast.h:2264
pm_call_or_write_node::operator_loc
pm_location_t operator_loc
CallOrWriteNode::operator_loc.
Definition ast.h:2408
pm_call_or_write_node::call_operator_loc
pm_location_t call_operator_loc
CallOrWriteNode::call_operator_loc.
Definition ast.h:2368
pm_call_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2347
pm_call_or_write_node::receiver
struct pm_node * receiver
CallOrWriteNode::receiver.
Definition ast.h:2358
pm_call_or_write_node::value
struct pm_node * value
CallOrWriteNode::value.
Definition ast.h:2418
pm_call_or_write_node::write_name
pm_constant_id_t write_name
CallOrWriteNode::write_name.
Definition ast.h:2398
pm_call_or_write_node::read_name
pm_constant_id_t read_name
CallOrWriteNode::read_name.
Definition ast.h:2388
pm_call_or_write_node::message_loc
pm_location_t message_loc
CallOrWriteNode::message_loc.
Definition ast.h:2378
pm_call_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2449
pm_call_target_node::name
pm_constant_id_t name
CallTargetNode::name.
Definition ast.h:2480
pm_call_target_node::receiver
struct pm_node * receiver
CallTargetNode::receiver.
Definition ast.h:2460
pm_call_target_node::call_operator_loc
pm_location_t call_operator_loc
CallTargetNode::call_operator_loc.
Definition ast.h:2470
pm_call_target_node::message_loc
pm_location_t message_loc
CallTargetNode::message_loc.
Definition ast.h:2490
pm_capture_pattern_node::target
struct pm_local_variable_target_node * target
CapturePatternNode::target.
Definition ast.h:2528
pm_capture_pattern_node::operator_loc
pm_location_t operator_loc
CapturePatternNode::operator_loc.
Definition ast.h:2538
pm_capture_pattern_node::value
struct pm_node * value
CapturePatternNode::value.
Definition ast.h:2518
pm_capture_pattern_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2507
pm_case_match_node::end_keyword_loc
pm_location_t end_keyword_loc
CaseMatchNode::end_keyword_loc.
Definition ast.h:2608
pm_case_match_node::conditions
struct pm_node_list conditions
CaseMatchNode::conditions.
Definition ast.h:2578
pm_case_match_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2557
pm_case_match_node::case_keyword_loc
pm_location_t case_keyword_loc
CaseMatchNode::case_keyword_loc.
Definition ast.h:2598
pm_case_match_node::else_clause
struct pm_else_node * else_clause
CaseMatchNode::else_clause.
Definition ast.h:2588
pm_case_match_node::predicate
struct pm_node * predicate
CaseMatchNode::predicate.
Definition ast.h:2568
pm_case_node::predicate
struct pm_node * predicate
CaseNode::predicate.
Definition ast.h:2638
pm_case_node::else_clause
struct pm_else_node * else_clause
CaseNode::else_clause.
Definition ast.h:2658
pm_case_node::conditions
struct pm_node_list conditions
CaseNode::conditions.
Definition ast.h:2648
pm_case_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2627
pm_case_node::case_keyword_loc
pm_location_t case_keyword_loc
CaseNode::case_keyword_loc.
Definition ast.h:2668
pm_case_node::end_keyword_loc
pm_location_t end_keyword_loc
CaseNode::end_keyword_loc.
Definition ast.h:2678
pm_class_node::class_keyword_loc
pm_location_t class_keyword_loc
ClassNode::class_keyword_loc.
Definition ast.h:2711
pm_class_node::end_keyword_loc
pm_location_t end_keyword_loc
ClassNode::end_keyword_loc.
Definition ast.h:2757
pm_class_node::constant_path
struct pm_node * constant_path
ClassNode::constant_path.
Definition ast.h:2716
pm_class_node::locals
pm_constant_id_list_t locals
ClassNode::locals.
Definition ast.h:2701
pm_class_node::inheritance_operator_loc
pm_location_t inheritance_operator_loc
ClassNode::inheritance_operator_loc.
Definition ast.h:2726
pm_class_node::name
pm_constant_id_t name
ClassNode::name.
Definition ast.h:2766
pm_class_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2695
pm_class_node::body
struct pm_node * body
ClassNode::body.
Definition ast.h:2747
pm_class_node::superclass
struct pm_node * superclass
ClassNode::superclass.
Definition ast.h:2736
pm_class_variable_and_write_node::value
struct pm_node * value
ClassVariableAndWriteNode::value.
Definition ast.h:2824
pm_class_variable_and_write_node::name
pm_constant_id_t name
ClassVariableAndWriteNode::name.
Definition ast.h:2794
pm_class_variable_and_write_node::operator_loc
pm_location_t operator_loc
ClassVariableAndWriteNode::operator_loc.
Definition ast.h:2814
pm_class_variable_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2783
pm_class_variable_and_write_node::name_loc
pm_location_t name_loc
ClassVariableAndWriteNode::name_loc.
Definition ast.h:2804
pm_class_variable_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2841
pm_class_variable_operator_write_node::name
pm_constant_id_t name
ClassVariableOperatorWriteNode::name.
Definition ast.h:2847
pm_class_variable_operator_write_node::name_loc
pm_location_t name_loc
ClassVariableOperatorWriteNode::name_loc.
Definition ast.h:2852
pm_class_variable_operator_write_node::binary_operator
pm_constant_id_t binary_operator
ClassVariableOperatorWriteNode::binary_operator.
Definition ast.h:2867
pm_class_variable_operator_write_node::value
struct pm_node * value
ClassVariableOperatorWriteNode::value.
Definition ast.h:2862
pm_class_variable_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
ClassVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:2857
pm_class_variable_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2884
pm_class_variable_or_write_node::name_loc
pm_location_t name_loc
ClassVariableOrWriteNode::name_loc.
Definition ast.h:2895
pm_class_variable_or_write_node::operator_loc
pm_location_t operator_loc
ClassVariableOrWriteNode::operator_loc.
Definition ast.h:2900
pm_class_variable_or_write_node::name
pm_constant_id_t name
ClassVariableOrWriteNode::name.
Definition ast.h:2890
pm_class_variable_or_write_node::value
struct pm_node * value
ClassVariableOrWriteNode::value.
Definition ast.h:2905
pm_class_variable_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2922
pm_class_variable_read_node::name
pm_constant_id_t name
ClassVariableReadNode::name.
Definition ast.h:2934
pm_class_variable_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2951
pm_class_variable_target_node::name
pm_constant_id_t name
ClassVariableTargetNode::name.
Definition ast.h:2957
pm_class_variable_write_node::name_loc
pm_location_t name_loc
ClassVariableWriteNode::name_loc.
Definition ast.h:2996
pm_class_variable_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:2974
pm_class_variable_write_node::value
struct pm_node * value
ClassVariableWriteNode::value.
Definition ast.h:3009
pm_class_variable_write_node::operator_loc
pm_location_t operator_loc
ClassVariableWriteNode::operator_loc.
Definition ast.h:3019
pm_class_variable_write_node::name
pm_constant_id_t name
ClassVariableWriteNode::name.
Definition ast.h:2986
pm_constant_and_write_node::operator_loc
pm_location_t operator_loc
ConstantAndWriteNode::operator_loc.
Definition ast.h:3052
pm_constant_and_write_node::name_loc
pm_location_t name_loc
ConstantAndWriteNode::name_loc.
Definition ast.h:3047
pm_constant_and_write_node::name
pm_constant_id_t name
ConstantAndWriteNode::name.
Definition ast.h:3042
pm_constant_and_write_node::value
struct pm_node * value
ConstantAndWriteNode::value.
Definition ast.h:3057
pm_constant_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3036
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:3080
pm_constant_operator_write_node::name_loc
pm_location_t name_loc
ConstantOperatorWriteNode::name_loc.
Definition ast.h:3085
pm_constant_operator_write_node::binary_operator
pm_constant_id_t binary_operator
ConstantOperatorWriteNode::binary_operator.
Definition ast.h:3100
pm_constant_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
ConstantOperatorWriteNode::binary_operator_loc.
Definition ast.h:3090
pm_constant_operator_write_node::value
struct pm_node * value
ConstantOperatorWriteNode::value.
Definition ast.h:3095
pm_constant_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3074
pm_constant_or_write_node::operator_loc
pm_location_t operator_loc
ConstantOrWriteNode::operator_loc.
Definition ast.h:3133
pm_constant_or_write_node::name_loc
pm_location_t name_loc
ConstantOrWriteNode::name_loc.
Definition ast.h:3128
pm_constant_or_write_node::name
pm_constant_id_t name
ConstantOrWriteNode::name.
Definition ast.h:3123
pm_constant_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3117
pm_constant_or_write_node::value
struct pm_node * value
ConstantOrWriteNode::value.
Definition ast.h:3138
pm_constant_path_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3155
pm_constant_path_and_write_node::target
struct pm_constant_path_node * target
ConstantPathAndWriteNode::target.
Definition ast.h:3161
pm_constant_path_and_write_node::operator_loc
pm_location_t operator_loc
ConstantPathAndWriteNode::operator_loc.
Definition ast.h:3166
pm_constant_path_and_write_node::value
struct pm_node * value
ConstantPathAndWriteNode::value.
Definition ast.h:3171
pm_constant_path_node::delimiter_loc
pm_location_t delimiter_loc
ConstantPathNode::delimiter_loc.
Definition ast.h:3225
pm_constant_path_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3188
pm_constant_path_node::name_loc
pm_location_t name_loc
ConstantPathNode::name_loc.
Definition ast.h:3238
pm_constant_path_node::name
pm_constant_id_t name
ConstantPathNode::name.
Definition ast.h:3212
pm_constant_path_node::parent
struct pm_node * parent
ConstantPathNode::parent.
Definition ast.h:3205
pm_constant_path_operator_write_node::target
struct pm_constant_path_node * target
ConstantPathOperatorWriteNode::target.
Definition ast.h:3261
pm_constant_path_operator_write_node::value
struct pm_node * value
ConstantPathOperatorWriteNode::value.
Definition ast.h:3271
pm_constant_path_operator_write_node::binary_operator
pm_constant_id_t binary_operator
ConstantPathOperatorWriteNode::binary_operator.
Definition ast.h:3276
pm_constant_path_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3255
pm_constant_path_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
ConstantPathOperatorWriteNode::binary_operator_loc.
Definition ast.h:3266
pm_constant_path_or_write_node::operator_loc
pm_location_t operator_loc
ConstantPathOrWriteNode::operator_loc.
Definition ast.h:3304
pm_constant_path_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3293
pm_constant_path_or_write_node::value
struct pm_node * value
ConstantPathOrWriteNode::value.
Definition ast.h:3309
pm_constant_path_or_write_node::target
struct pm_constant_path_node * target
ConstantPathOrWriteNode::target.
Definition ast.h:3299
pm_constant_path_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3326
pm_constant_path_target_node::parent
struct pm_node * parent
ConstantPathTargetNode::parent.
Definition ast.h:3332
pm_constant_path_target_node::delimiter_loc
pm_location_t delimiter_loc
ConstantPathTargetNode::delimiter_loc.
Definition ast.h:3342
pm_constant_path_target_node::name
pm_constant_id_t name
ConstantPathTargetNode::name.
Definition ast.h:3337
pm_constant_path_target_node::name_loc
pm_location_t name_loc
ConstantPathTargetNode::name_loc.
Definition ast.h:3347
pm_constant_path_write_node::target
struct pm_constant_path_node * target
ConstantPathWriteNode::target.
Definition ast.h:3384
pm_constant_path_write_node::operator_loc
pm_location_t operator_loc
ConstantPathWriteNode::operator_loc.
Definition ast.h:3394
pm_constant_path_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3370
pm_constant_path_write_node::value
struct pm_node * value
ConstantPathWriteNode::value.
Definition ast.h:3404
pm_constant_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3421
pm_constant_read_node::name
pm_constant_id_t name
ConstantReadNode::name.
Definition ast.h:3433
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:3450
pm_constant_target_node::name
pm_constant_id_t name
ConstantTargetNode::name.
Definition ast.h:3456
pm_constant_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3473
pm_constant_write_node::value
struct pm_node * value
ConstantWriteNode::value.
Definition ast.h:3508
pm_constant_write_node::name
pm_constant_id_t name
ConstantWriteNode::name.
Definition ast.h:3485
pm_constant_write_node::name_loc
pm_location_t name_loc
ConstantWriteNode::name_loc.
Definition ast.h:3495
pm_constant_write_node::operator_loc
pm_location_t operator_loc
ConstantWriteNode::operator_loc.
Definition ast.h:3518
pm_def_node::parameters
struct pm_parameters_node * parameters
DefNode::parameters.
Definition ast.h:3557
pm_def_node::end_keyword_loc
pm_location_t end_keyword_loc
DefNode::end_keyword_loc.
Definition ast.h:3597
pm_def_node::name
pm_constant_id_t name
DefNode::name.
Definition ast.h:3542
pm_def_node::name_loc
pm_location_t name_loc
DefNode::name_loc.
Definition ast.h:3547
pm_def_node::rparen_loc
pm_location_t rparen_loc
DefNode::rparen_loc.
Definition ast.h:3587
pm_def_node::body
struct pm_node * body
DefNode::body.
Definition ast.h:3562
pm_def_node::equal_loc
pm_location_t equal_loc
DefNode::equal_loc.
Definition ast.h:3592
pm_def_node::def_keyword_loc
pm_location_t def_keyword_loc
DefNode::def_keyword_loc.
Definition ast.h:3572
pm_def_node::receiver
struct pm_node * receiver
DefNode::receiver.
Definition ast.h:3552
pm_def_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3536
pm_def_node::lparen_loc
pm_location_t lparen_loc
DefNode::lparen_loc.
Definition ast.h:3582
pm_def_node::operator_loc
pm_location_t operator_loc
DefNode::operator_loc.
Definition ast.h:3577
pm_def_node::locals
pm_constant_id_list_t locals
DefNode::locals.
Definition ast.h:3567
pm_defined_node::lparen_loc
pm_location_t lparen_loc
DefinedNode::lparen_loc.
Definition ast.h:3620
pm_defined_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3614
pm_defined_node::rparen_loc
pm_location_t rparen_loc
DefinedNode::rparen_loc.
Definition ast.h:3630
pm_defined_node::keyword_loc
pm_location_t keyword_loc
DefinedNode::keyword_loc.
Definition ast.h:3635
pm_defined_node::value
struct pm_node * value
DefinedNode::value.
Definition ast.h:3625
pm_else_node::statements
struct pm_statements_node * statements
ElseNode::statements.
Definition ast.h:3663
pm_else_node::else_keyword_loc
pm_location_t else_keyword_loc
ElseNode::else_keyword_loc.
Definition ast.h:3658
pm_else_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3652
pm_else_node::end_keyword_loc
pm_location_t end_keyword_loc
ElseNode::end_keyword_loc.
Definition ast.h:3668
pm_embedded_statements_node::closing_loc
pm_location_t closing_loc
EmbeddedStatementsNode::closing_loc.
Definition ast.h:3701
pm_embedded_statements_node::statements
struct pm_statements_node * statements
EmbeddedStatementsNode::statements.
Definition ast.h:3696
pm_embedded_statements_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3685
pm_embedded_statements_node::opening_loc
pm_location_t opening_loc
EmbeddedStatementsNode::opening_loc.
Definition ast.h:3691
pm_embedded_variable_node::variable
struct pm_node * variable
EmbeddedVariableNode::variable.
Definition ast.h:3729
pm_embedded_variable_node::operator_loc
pm_location_t operator_loc
EmbeddedVariableNode::operator_loc.
Definition ast.h:3724
pm_embedded_variable_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3718
pm_ensure_node::statements
struct pm_statements_node * statements
EnsureNode::statements.
Definition ast.h:3761
pm_ensure_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3750
pm_ensure_node::ensure_keyword_loc
pm_location_t ensure_keyword_loc
EnsureNode::ensure_keyword_loc.
Definition ast.h:3756
pm_ensure_node::end_keyword_loc
pm_location_t end_keyword_loc
EnsureNode::end_keyword_loc.
Definition ast.h:3766
pm_false_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3783
pm_find_pattern_node::constant
struct pm_node * constant
FindPatternNode::constant.
Definition ast.h:3821
pm_find_pattern_node::right
struct pm_node * right
FindPatternNode::right.
Definition ast.h:3860
pm_find_pattern_node::opening_loc
pm_location_t opening_loc
FindPatternNode::opening_loc.
Definition ast.h:3873
pm_find_pattern_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3810
pm_find_pattern_node::requireds
struct pm_node_list requireds
FindPatternNode::requireds.
Definition ast.h:3847
pm_find_pattern_node::left
struct pm_splat_node * left
FindPatternNode::left.
Definition ast.h:3834
pm_find_pattern_node::closing_loc
pm_location_t closing_loc
FindPatternNode::closing_loc.
Definition ast.h:3886
pm_flip_flop_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3906
pm_flip_flop_node::operator_loc
pm_location_t operator_loc
FlipFlopNode::operator_loc.
Definition ast.h:3922
pm_flip_flop_node::left
struct pm_node * left
FlipFlopNode::left.
Definition ast.h:3912
pm_flip_flop_node::right
struct pm_node * right
FlipFlopNode::right.
Definition ast.h:3917
pm_float_node::value
double value
FloatNode::value.
Definition ast.h:3947
pm_float_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3939
pm_for_node::statements
struct pm_statements_node * statements
ForNode::statements.
Definition ast.h:3997
pm_for_node::index
struct pm_node * index
ForNode::index.
Definition ast.h:3975
pm_for_node::collection
struct pm_node * collection
ForNode::collection.
Definition ast.h:3985
pm_for_node::base
pm_node_t base
The embedded base node.
Definition ast.h:3964
pm_for_node::end_keyword_loc
pm_location_t end_keyword_loc
ForNode::end_keyword_loc.
Definition ast.h:4037
pm_for_node::for_keyword_loc
pm_location_t for_keyword_loc
ForNode::for_keyword_loc.
Definition ast.h:4007
pm_for_node::do_keyword_loc
pm_location_t do_keyword_loc
ForNode::do_keyword_loc.
Definition ast.h:4027
pm_for_node::in_keyword_loc
pm_location_t in_keyword_loc
ForNode::in_keyword_loc.
Definition ast.h:4017
pm_forwarding_arguments_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4056
pm_forwarding_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4075
pm_forwarding_super_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4093
pm_forwarding_super_node::block
struct pm_block_node * block
ForwardingSuperNode::block.
Definition ast.h:4099
pm_global_variable_and_write_node::operator_loc
pm_location_t operator_loc
GlobalVariableAndWriteNode::operator_loc.
Definition ast.h:4132
pm_global_variable_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4116
pm_global_variable_and_write_node::name_loc
pm_location_t name_loc
GlobalVariableAndWriteNode::name_loc.
Definition ast.h:4127
pm_global_variable_and_write_node::value
struct pm_node * value
GlobalVariableAndWriteNode::value.
Definition ast.h:4137
pm_global_variable_and_write_node::name
pm_constant_id_t name
GlobalVariableAndWriteNode::name.
Definition ast.h:4122
pm_global_variable_operator_write_node::name
pm_constant_id_t name
GlobalVariableOperatorWriteNode::name.
Definition ast.h:4160
pm_global_variable_operator_write_node::binary_operator
pm_constant_id_t binary_operator
GlobalVariableOperatorWriteNode::binary_operator.
Definition ast.h:4180
pm_global_variable_operator_write_node::value
struct pm_node * value
GlobalVariableOperatorWriteNode::value.
Definition ast.h:4175
pm_global_variable_operator_write_node::name_loc
pm_location_t name_loc
GlobalVariableOperatorWriteNode::name_loc.
Definition ast.h:4165
pm_global_variable_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4154
pm_global_variable_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
GlobalVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:4170
pm_global_variable_or_write_node::name
pm_constant_id_t name
GlobalVariableOrWriteNode::name.
Definition ast.h:4203
pm_global_variable_or_write_node::name_loc
pm_location_t name_loc
GlobalVariableOrWriteNode::name_loc.
Definition ast.h:4208
pm_global_variable_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4197
pm_global_variable_or_write_node::operator_loc
pm_location_t operator_loc
GlobalVariableOrWriteNode::operator_loc.
Definition ast.h:4213
pm_global_variable_or_write_node::value
struct pm_node * value
GlobalVariableOrWriteNode::value.
Definition ast.h:4218
pm_global_variable_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4235
pm_global_variable_read_node::name
pm_constant_id_t name
GlobalVariableReadNode::name.
Definition ast.h:4247
pm_global_variable_target_node::name
pm_constant_id_t name
GlobalVariableTargetNode::name.
Definition ast.h:4270
pm_global_variable_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4264
pm_global_variable_write_node::value
struct pm_node * value
GlobalVariableWriteNode::value.
Definition ast.h:4322
pm_global_variable_write_node::name_loc
pm_location_t name_loc
GlobalVariableWriteNode::name_loc.
Definition ast.h:4309
pm_global_variable_write_node::operator_loc
pm_location_t operator_loc
GlobalVariableWriteNode::operator_loc.
Definition ast.h:4332
pm_global_variable_write_node::name
pm_constant_id_t name
GlobalVariableWriteNode::name.
Definition ast.h:4299
pm_global_variable_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4287
pm_hash_node::elements
struct pm_node_list elements
HashNode::elements.
Definition ast.h:4373
pm_hash_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4349
pm_hash_node::closing_loc
pm_location_t closing_loc
HashNode::closing_loc.
Definition ast.h:4383
pm_hash_node::opening_loc
pm_location_t opening_loc
HashNode::opening_loc.
Definition ast.h:4360
pm_hash_pattern_node::elements
struct pm_node_list elements
HashPatternNode::elements.
Definition ast.h:4433
pm_hash_pattern_node::opening_loc
pm_location_t opening_loc
HashPatternNode::opening_loc.
Definition ast.h:4462
pm_hash_pattern_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4409
pm_hash_pattern_node::rest
struct pm_node * rest
HashPatternNode::rest.
Definition ast.h:4449
pm_hash_pattern_node::closing_loc
pm_location_t closing_loc
HashPatternNode::closing_loc.
Definition ast.h:4475
pm_hash_pattern_node::constant
struct pm_node * constant
HashPatternNode::constant.
Definition ast.h:4423
pm_if_node::predicate
struct pm_node * predicate
IfNode::predicate.
Definition ast.h:4529
pm_if_node::end_keyword_loc
pm_location_t end_keyword_loc
IfNode::end_keyword_loc.
Definition ast.h:4587
pm_if_node::if_keyword_loc
pm_location_t if_keyword_loc
IfNode::if_keyword_loc.
Definition ast.h:4511
pm_if_node::statements
struct pm_statements_node * statements
IfNode::statements.
Definition ast.h:4556
pm_if_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4498
pm_if_node::subsequent
struct pm_node * subsequent
IfNode::subsequent.
Definition ast.h:4575
pm_if_node::then_keyword_loc
pm_location_t then_keyword_loc
IfNode::then_keyword_loc.
Definition ast.h:4542
pm_imaginary_node::numeric
struct pm_node * numeric
ImaginaryNode::numeric.
Definition ast.h:4610
pm_imaginary_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4604
pm_implicit_node::value
struct pm_node * value
ImplicitNode::value.
Definition ast.h:4639
pm_implicit_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4633
pm_implicit_rest_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4665
pm_in_node::statements
struct pm_statements_node * statements
InNode::statements.
Definition ast.h:4694
pm_in_node::pattern
struct pm_node * pattern
InNode::pattern.
Definition ast.h:4689
pm_in_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4683
pm_in_node::then_loc
pm_location_t then_loc
InNode::then_loc.
Definition ast.h:4704
pm_in_node::in_loc
pm_location_t in_loc
InNode::in_loc.
Definition ast.h:4699
pm_index_and_write_node::arguments
struct pm_arguments_node * arguments
IndexAndWriteNode::arguments.
Definition ast.h:4748
pm_index_and_write_node::receiver
struct pm_node * receiver
IndexAndWriteNode::receiver.
Definition ast.h:4733
pm_index_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4727
pm_index_and_write_node::block
struct pm_block_argument_node * block
IndexAndWriteNode::block.
Definition ast.h:4758
pm_index_and_write_node::value
struct pm_node * value
IndexAndWriteNode::value.
Definition ast.h:4768
pm_index_and_write_node::operator_loc
pm_location_t operator_loc
IndexAndWriteNode::operator_loc.
Definition ast.h:4763
pm_index_and_write_node::closing_loc
pm_location_t closing_loc
IndexAndWriteNode::closing_loc.
Definition ast.h:4753
pm_index_and_write_node::opening_loc
pm_location_t opening_loc
IndexAndWriteNode::opening_loc.
Definition ast.h:4743
pm_index_and_write_node::call_operator_loc
pm_location_t call_operator_loc
IndexAndWriteNode::call_operator_loc.
Definition ast.h:4738
pm_index_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4791
pm_index_operator_write_node::block
struct pm_block_argument_node * block
IndexOperatorWriteNode::block.
Definition ast.h:4822
pm_index_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
IndexOperatorWriteNode::binary_operator_loc.
Definition ast.h:4832
pm_index_operator_write_node::value
struct pm_node * value
IndexOperatorWriteNode::value.
Definition ast.h:4837
pm_index_operator_write_node::opening_loc
pm_location_t opening_loc
IndexOperatorWriteNode::opening_loc.
Definition ast.h:4807
pm_index_operator_write_node::call_operator_loc
pm_location_t call_operator_loc
IndexOperatorWriteNode::call_operator_loc.
Definition ast.h:4802
pm_index_operator_write_node::closing_loc
pm_location_t closing_loc
IndexOperatorWriteNode::closing_loc.
Definition ast.h:4817
pm_index_operator_write_node::arguments
struct pm_arguments_node * arguments
IndexOperatorWriteNode::arguments.
Definition ast.h:4812
pm_index_operator_write_node::binary_operator
pm_constant_id_t binary_operator
IndexOperatorWriteNode::binary_operator.
Definition ast.h:4827
pm_index_operator_write_node::receiver
struct pm_node * receiver
IndexOperatorWriteNode::receiver.
Definition ast.h:4797
pm_index_or_write_node::closing_loc
pm_location_t closing_loc
IndexOrWriteNode::closing_loc.
Definition ast.h:4886
pm_index_or_write_node::call_operator_loc
pm_location_t call_operator_loc
IndexOrWriteNode::call_operator_loc.
Definition ast.h:4871
pm_index_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4860
pm_index_or_write_node::block
struct pm_block_argument_node * block
IndexOrWriteNode::block.
Definition ast.h:4891
pm_index_or_write_node::operator_loc
pm_location_t operator_loc
IndexOrWriteNode::operator_loc.
Definition ast.h:4896
pm_index_or_write_node::receiver
struct pm_node * receiver
IndexOrWriteNode::receiver.
Definition ast.h:4866
pm_index_or_write_node::opening_loc
pm_location_t opening_loc
IndexOrWriteNode::opening_loc.
Definition ast.h:4876
pm_index_or_write_node::value
struct pm_node * value
IndexOrWriteNode::value.
Definition ast.h:4901
pm_index_or_write_node::arguments
struct pm_arguments_node * arguments
IndexOrWriteNode::arguments.
Definition ast.h:4881
pm_index_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4932
pm_index_target_node::receiver
struct pm_node * receiver
IndexTargetNode::receiver.
Definition ast.h:4938
pm_index_target_node::closing_loc
pm_location_t closing_loc
IndexTargetNode::closing_loc.
Definition ast.h:4953
pm_index_target_node::arguments
struct pm_arguments_node * arguments
IndexTargetNode::arguments.
Definition ast.h:4948
pm_index_target_node::opening_loc
pm_location_t opening_loc
IndexTargetNode::opening_loc.
Definition ast.h:4943
pm_index_target_node::block
struct pm_block_argument_node * block
IndexTargetNode::block.
Definition ast.h:4958
pm_instance_variable_and_write_node::operator_loc
pm_location_t operator_loc
InstanceVariableAndWriteNode::operator_loc.
Definition ast.h:4991
pm_instance_variable_and_write_node::name_loc
pm_location_t name_loc
InstanceVariableAndWriteNode::name_loc.
Definition ast.h:4986
pm_instance_variable_and_write_node::value
struct pm_node * value
InstanceVariableAndWriteNode::value.
Definition ast.h:4996
pm_instance_variable_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:4975
pm_instance_variable_and_write_node::name
pm_constant_id_t name
InstanceVariableAndWriteNode::name.
Definition ast.h:4981
pm_instance_variable_operator_write_node::value
struct pm_node * value
InstanceVariableOperatorWriteNode::value.
Definition ast.h:5034
pm_instance_variable_operator_write_node::binary_operator
pm_constant_id_t binary_operator
InstanceVariableOperatorWriteNode::binary_operator.
Definition ast.h:5039
pm_instance_variable_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
InstanceVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:5029
pm_instance_variable_operator_write_node::name
pm_constant_id_t name
InstanceVariableOperatorWriteNode::name.
Definition ast.h:5019
pm_instance_variable_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5013
pm_instance_variable_operator_write_node::name_loc
pm_location_t name_loc
InstanceVariableOperatorWriteNode::name_loc.
Definition ast.h:5024
pm_instance_variable_or_write_node::operator_loc
pm_location_t operator_loc
InstanceVariableOrWriteNode::operator_loc.
Definition ast.h:5072
pm_instance_variable_or_write_node::value
struct pm_node * value
InstanceVariableOrWriteNode::value.
Definition ast.h:5077
pm_instance_variable_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5056
pm_instance_variable_or_write_node::name_loc
pm_location_t name_loc
InstanceVariableOrWriteNode::name_loc.
Definition ast.h:5067
pm_instance_variable_or_write_node::name
pm_constant_id_t name
InstanceVariableOrWriteNode::name.
Definition ast.h:5062
pm_instance_variable_read_node::name
pm_constant_id_t name
InstanceVariableReadNode::name.
Definition ast.h:5106
pm_instance_variable_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5094
pm_instance_variable_target_node::name
pm_constant_id_t name
InstanceVariableTargetNode::name.
Definition ast.h:5129
pm_instance_variable_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5123
pm_instance_variable_write_node::operator_loc
pm_location_t operator_loc
InstanceVariableWriteNode::operator_loc.
Definition ast.h:5191
pm_instance_variable_write_node::name
pm_constant_id_t name
InstanceVariableWriteNode::name.
Definition ast.h:5158
pm_instance_variable_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5146
pm_instance_variable_write_node::value
struct pm_node * value
InstanceVariableWriteNode::value.
Definition ast.h:5181
pm_instance_variable_write_node::name_loc
pm_location_t name_loc
InstanceVariableWriteNode::name_loc.
Definition ast.h:5168
pm_integer_node::value
pm_integer_t value
IntegerNode::value.
Definition ast.h:5222
pm_integer_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5214
pm_interpolated_match_last_line_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5252
pm_interpolated_match_last_line_node::closing_loc
pm_location_t closing_loc
InterpolatedMatchLastLineNode::closing_loc.
Definition ast.h:5268
pm_interpolated_match_last_line_node::parts
struct pm_node_list parts
InterpolatedMatchLastLineNode::parts.
Definition ast.h:5263
pm_interpolated_match_last_line_node::opening_loc
pm_location_t opening_loc
InterpolatedMatchLastLineNode::opening_loc.
Definition ast.h:5258
pm_interpolated_regular_expression_node::opening_loc
pm_location_t opening_loc
InterpolatedRegularExpressionNode::opening_loc.
Definition ast.h:5304
pm_interpolated_regular_expression_node::parts
struct pm_node_list parts
InterpolatedRegularExpressionNode::parts.
Definition ast.h:5309
pm_interpolated_regular_expression_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5298
pm_interpolated_regular_expression_node::closing_loc
pm_location_t closing_loc
InterpolatedRegularExpressionNode::closing_loc.
Definition ast.h:5314
pm_interpolated_string_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5335
pm_interpolated_string_node::closing_loc
pm_location_t closing_loc
InterpolatedStringNode::closing_loc.
Definition ast.h:5351
pm_interpolated_string_node::opening_loc
pm_location_t opening_loc
InterpolatedStringNode::opening_loc.
Definition ast.h:5341
pm_interpolated_string_node::parts
struct pm_node_list parts
InterpolatedStringNode::parts.
Definition ast.h:5346
pm_interpolated_symbol_node::parts
struct pm_node_list parts
InterpolatedSymbolNode::parts.
Definition ast.h:5379
pm_interpolated_symbol_node::closing_loc
pm_location_t closing_loc
InterpolatedSymbolNode::closing_loc.
Definition ast.h:5384
pm_interpolated_symbol_node::opening_loc
pm_location_t opening_loc
InterpolatedSymbolNode::opening_loc.
Definition ast.h:5374
pm_interpolated_symbol_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5368
pm_interpolated_x_string_node::opening_loc
pm_location_t opening_loc
InterpolatedXStringNode::opening_loc.
Definition ast.h:5407
pm_interpolated_x_string_node::closing_loc
pm_location_t closing_loc
InterpolatedXStringNode::closing_loc.
Definition ast.h:5417
pm_interpolated_x_string_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5401
pm_interpolated_x_string_node::parts
struct pm_node_list parts
InterpolatedXStringNode::parts.
Definition ast.h:5412
pm_it_local_variable_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5434
pm_it_parameters_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5452
pm_keyword_hash_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5473
pm_keyword_hash_node::elements
struct pm_node_list elements
KeywordHashNode::elements.
Definition ast.h:5479
pm_keyword_rest_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5500
pm_keyword_rest_parameter_node::name
pm_constant_id_t name
KeywordRestParameterNode::name.
Definition ast.h:5506
pm_keyword_rest_parameter_node::operator_loc
pm_location_t operator_loc
KeywordRestParameterNode::operator_loc.
Definition ast.h:5516
pm_keyword_rest_parameter_node::name_loc
pm_location_t name_loc
KeywordRestParameterNode::name_loc.
Definition ast.h:5511
pm_lambda_node::closing_loc
pm_location_t closing_loc
LambdaNode::closing_loc.
Definition ast.h:5554
pm_lambda_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5533
pm_lambda_node::body
struct pm_node * body
LambdaNode::body.
Definition ast.h:5564
pm_lambda_node::opening_loc
pm_location_t opening_loc
LambdaNode::opening_loc.
Definition ast.h:5549
pm_lambda_node::parameters
struct pm_node * parameters
LambdaNode::parameters.
Definition ast.h:5559
pm_lambda_node::operator_loc
pm_location_t operator_loc
LambdaNode::operator_loc.
Definition ast.h:5544
pm_lambda_node::locals
pm_constant_id_list_t locals
LambdaNode::locals.
Definition ast.h:5539
pm_local_variable_and_write_node::name
pm_constant_id_t name
LocalVariableAndWriteNode::name.
Definition ast.h:5602
pm_local_variable_and_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5581
pm_local_variable_and_write_node::depth
uint32_t depth
LocalVariableAndWriteNode::depth.
Definition ast.h:5607
pm_local_variable_and_write_node::operator_loc
pm_location_t operator_loc
LocalVariableAndWriteNode::operator_loc.
Definition ast.h:5592
pm_local_variable_and_write_node::value
struct pm_node * value
LocalVariableAndWriteNode::value.
Definition ast.h:5597
pm_local_variable_and_write_node::name_loc
pm_location_t name_loc
LocalVariableAndWriteNode::name_loc.
Definition ast.h:5587
pm_local_variable_operator_write_node::depth
uint32_t depth
LocalVariableOperatorWriteNode::depth.
Definition ast.h:5655
pm_local_variable_operator_write_node::binary_operator
pm_constant_id_t binary_operator
LocalVariableOperatorWriteNode::binary_operator.
Definition ast.h:5650
pm_local_variable_operator_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5624
pm_local_variable_operator_write_node::value
struct pm_node * value
LocalVariableOperatorWriteNode::value.
Definition ast.h:5640
pm_local_variable_operator_write_node::name_loc
pm_location_t name_loc
LocalVariableOperatorWriteNode::name_loc.
Definition ast.h:5630
pm_local_variable_operator_write_node::binary_operator_loc
pm_location_t binary_operator_loc
LocalVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:5635
pm_local_variable_operator_write_node::name
pm_constant_id_t name
LocalVariableOperatorWriteNode::name.
Definition ast.h:5645
pm_local_variable_or_write_node::depth
uint32_t depth
LocalVariableOrWriteNode::depth.
Definition ast.h:5698
pm_local_variable_or_write_node::operator_loc
pm_location_t operator_loc
LocalVariableOrWriteNode::operator_loc.
Definition ast.h:5683
pm_local_variable_or_write_node::value
struct pm_node * value
LocalVariableOrWriteNode::value.
Definition ast.h:5688
pm_local_variable_or_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5672
pm_local_variable_or_write_node::name
pm_constant_id_t name
LocalVariableOrWriteNode::name.
Definition ast.h:5693
pm_local_variable_or_write_node::name_loc
pm_location_t name_loc
LocalVariableOrWriteNode::name_loc.
Definition ast.h:5678
pm_local_variable_read_node::depth
uint32_t depth
LocalVariableReadNode::depth.
Definition ast.h:5744
pm_local_variable_read_node::name
pm_constant_id_t name
LocalVariableReadNode::name.
Definition ast.h:5731
pm_local_variable_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5715
pm_local_variable_target_node::depth
uint32_t depth
LocalVariableTargetNode::depth.
Definition ast.h:5775
pm_local_variable_target_node::name
pm_constant_id_t name
LocalVariableTargetNode::name.
Definition ast.h:5770
pm_local_variable_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5764
pm_local_variable_write_node::operator_loc
pm_location_t operator_loc
LocalVariableWriteNode::operator_loc.
Definition ast.h:5854
pm_local_variable_write_node::name_loc
pm_location_t name_loc
LocalVariableWriteNode::name_loc.
Definition ast.h:5827
pm_local_variable_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5792
pm_local_variable_write_node::value
struct pm_node * value
LocalVariableWriteNode::value.
Definition ast.h:5844
pm_local_variable_write_node::depth
uint32_t depth
LocalVariableWriteNode::depth.
Definition ast.h:5817
pm_local_variable_write_node::name
pm_constant_id_t name
LocalVariableWriteNode::name.
Definition ast.h:5804
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:5895
pm_match_last_line_node::opening_loc
pm_location_t opening_loc
MatchLastLineNode::opening_loc.
Definition ast.h:5890
pm_match_last_line_node::closing_loc
pm_location_t closing_loc
MatchLastLineNode::closing_loc.
Definition ast.h:5900
pm_match_last_line_node::unescaped
pm_string_t unescaped
MatchLastLineNode::unescaped.
Definition ast.h:5905
pm_match_last_line_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5884
pm_match_predicate_node::operator_loc
pm_location_t operator_loc
MatchPredicateNode::operator_loc.
Definition ast.h:5938
pm_match_predicate_node::pattern
struct pm_node * pattern
MatchPredicateNode::pattern.
Definition ast.h:5933
pm_match_predicate_node::value
struct pm_node * value
MatchPredicateNode::value.
Definition ast.h:5928
pm_match_predicate_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5922
pm_match_required_node::base
pm_node_t base
The embedded base node.
Definition ast.h:5955
pm_match_required_node::operator_loc
pm_location_t operator_loc
MatchRequiredNode::operator_loc.
Definition ast.h:6025
pm_match_required_node::value
struct pm_node * value
MatchRequiredNode::value.
Definition ast.h:5966
pm_match_required_node::pattern
struct pm_node * pattern
MatchRequiredNode::pattern.
Definition ast.h:6015
pm_match_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6042
pm_match_write_node::targets
struct pm_node_list targets
MatchWriteNode::targets.
Definition ast.h:6053
pm_match_write_node::call
struct pm_call_node * call
MatchWriteNode::call.
Definition ast.h:6048
pm_missing_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6067
pm_module_node::end_keyword_loc
pm_location_t end_keyword_loc
ModuleNode::end_keyword_loc.
Definition ast.h:6111
pm_module_node::constant_path
struct pm_node * constant_path
ModuleNode::constant_path.
Definition ast.h:6101
pm_module_node::body
struct pm_node * body
ModuleNode::body.
Definition ast.h:6106
pm_module_node::locals
pm_constant_id_list_t locals
ModuleNode::locals.
Definition ast.h:6091
pm_module_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6085
pm_module_node::module_keyword_loc
pm_location_t module_keyword_loc
ModuleNode::module_keyword_loc.
Definition ast.h:6096
pm_module_node::name
pm_constant_id_t name
ModuleNode::name.
Definition ast.h:6116
pm_multi_target_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6138
pm_multi_target_node::lparen_loc
pm_location_t lparen_loc
MultiTargetNode::lparen_loc.
Definition ast.h:6194
pm_multi_target_node::lefts
struct pm_node_list lefts
MultiTargetNode::lefts.
Definition ast.h:6154
pm_multi_target_node::rest
struct pm_node * rest
MultiTargetNode::rest.
Definition ast.h:6174
pm_multi_target_node::rparen_loc
pm_location_t rparen_loc
MultiTargetNode::rparen_loc.
Definition ast.h:6204
pm_multi_target_node::rights
struct pm_node_list rights
MultiTargetNode::rights.
Definition ast.h:6184
pm_multi_write_node::rparen_loc
pm_location_t rparen_loc
MultiWriteNode::rparen_loc.
Definition ast.h:6287
pm_multi_write_node::value
struct pm_node * value
MultiWriteNode::value.
Definition ast.h:6307
pm_multi_write_node::rest
struct pm_node * rest
MultiWriteNode::rest.
Definition ast.h:6257
pm_multi_write_node::rights
struct pm_node_list rights
MultiWriteNode::rights.
Definition ast.h:6267
pm_multi_write_node::operator_loc
pm_location_t operator_loc
MultiWriteNode::operator_loc.
Definition ast.h:6297
pm_multi_write_node::lparen_loc
pm_location_t lparen_loc
MultiWriteNode::lparen_loc.
Definition ast.h:6277
pm_multi_write_node::lefts
struct pm_node_list lefts
MultiWriteNode::lefts.
Definition ast.h:6237
pm_multi_write_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6221
pm_next_node::arguments
struct pm_arguments_node * arguments
NextNode::arguments.
Definition ast.h:6330
pm_next_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6324
pm_next_node::keyword_loc
pm_location_t keyword_loc
NextNode::keyword_loc.
Definition ast.h:6335
pm_nil_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6352
pm_no_keywords_parameter_node::keyword_loc
pm_location_t keyword_loc
NoKeywordsParameterNode::keyword_loc.
Definition ast.h:6382
pm_no_keywords_parameter_node::operator_loc
pm_location_t operator_loc
NoKeywordsParameterNode::operator_loc.
Definition ast.h:6377
pm_no_keywords_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6371
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:1091
pm_numbered_parameters_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6399
pm_numbered_parameters_node::maximum
uint8_t maximum
NumberedParametersNode::maximum.
Definition ast.h:6405
pm_numbered_reference_read_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6422
pm_numbered_reference_read_node::number
uint32_t number
NumberedReferenceReadNode::number.
Definition ast.h:6436
pm_optional_keyword_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6457
pm_optional_keyword_parameter_node::name
pm_constant_id_t name
OptionalKeywordParameterNode::name.
Definition ast.h:6463
pm_optional_keyword_parameter_node::value
struct pm_node * value
OptionalKeywordParameterNode::value.
Definition ast.h:6473
pm_optional_keyword_parameter_node::name_loc
pm_location_t name_loc
OptionalKeywordParameterNode::name_loc.
Definition ast.h:6468
pm_optional_parameter_node::name_loc
pm_location_t name_loc
OptionalParameterNode::name_loc.
Definition ast.h:6505
pm_optional_parameter_node::value
struct pm_node * value
OptionalParameterNode::value.
Definition ast.h:6515
pm_optional_parameter_node::name
pm_constant_id_t name
OptionalParameterNode::name.
Definition ast.h:6500
pm_optional_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6494
pm_optional_parameter_node::operator_loc
pm_location_t operator_loc
OptionalParameterNode::operator_loc.
Definition ast.h:6510
pm_or_node::left
struct pm_node * left
OrNode::left.
Definition ast.h:6546
pm_or_node::right
struct pm_node * right
OrNode::right.
Definition ast.h:6559
pm_or_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6532
pm_or_node::operator_loc
pm_location_t operator_loc
OrNode::operator_loc.
Definition ast.h:6569
pm_parameters_node::rest
struct pm_node * rest
ParametersNode::rest.
Definition ast.h:6603
pm_parameters_node::requireds
struct pm_node_list requireds
ParametersNode::requireds.
Definition ast.h:6593
pm_parameters_node::block
struct pm_block_parameter_node * block
ParametersNode::block.
Definition ast.h:6623
pm_parameters_node::optionals
struct pm_node_list optionals
ParametersNode::optionals.
Definition ast.h:6598
pm_parameters_node::posts
struct pm_node_list posts
ParametersNode::posts.
Definition ast.h:6608
pm_parameters_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6587
pm_parameters_node::keyword_rest
struct pm_node * keyword_rest
ParametersNode::keyword_rest.
Definition ast.h:6618
pm_parameters_node::keywords
struct pm_node_list keywords
ParametersNode::keywords.
Definition ast.h:6613
pm_parentheses_node::body
struct pm_node * body
ParenthesesNode::body.
Definition ast.h:6649
pm_parentheses_node::closing_loc
pm_location_t closing_loc
ParenthesesNode::closing_loc.
Definition ast.h:6659
pm_parentheses_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6643
pm_parentheses_node::opening_loc
pm_location_t opening_loc
ParenthesesNode::opening_loc.
Definition ast.h:6654
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:786
pm_parser::start
const uint8_t * start
The pointer to the start of the source.
Definition parser.h:691
pm_pinned_expression_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6676
pm_pinned_expression_node::rparen_loc
pm_location_t rparen_loc
PinnedExpressionNode::rparen_loc.
Definition ast.h:6717
pm_pinned_expression_node::expression
struct pm_node * expression
PinnedExpressionNode::expression.
Definition ast.h:6687
pm_pinned_expression_node::lparen_loc
pm_location_t lparen_loc
PinnedExpressionNode::lparen_loc.
Definition ast.h:6707
pm_pinned_expression_node::operator_loc
pm_location_t operator_loc
PinnedExpressionNode::operator_loc.
Definition ast.h:6697
pm_pinned_variable_node::variable
struct pm_node * variable
PinnedVariableNode::variable.
Definition ast.h:6745
pm_pinned_variable_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6734
pm_pinned_variable_node::operator_loc
pm_location_t operator_loc
PinnedVariableNode::operator_loc.
Definition ast.h:6755
pm_post_execution_node::closing_loc
pm_location_t closing_loc
PostExecutionNode::closing_loc.
Definition ast.h:6793
pm_post_execution_node::statements
struct pm_statements_node * statements
PostExecutionNode::statements.
Definition ast.h:6778
pm_post_execution_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6772
pm_post_execution_node::opening_loc
pm_location_t opening_loc
PostExecutionNode::opening_loc.
Definition ast.h:6788
pm_post_execution_node::keyword_loc
pm_location_t keyword_loc
PostExecutionNode::keyword_loc.
Definition ast.h:6783
pm_pre_execution_node::statements
struct pm_statements_node * statements
PreExecutionNode::statements.
Definition ast.h:6816
pm_pre_execution_node::closing_loc
pm_location_t closing_loc
PreExecutionNode::closing_loc.
Definition ast.h:6831
pm_pre_execution_node::opening_loc
pm_location_t opening_loc
PreExecutionNode::opening_loc.
Definition ast.h:6826
pm_pre_execution_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6810
pm_pre_execution_node::keyword_loc
pm_location_t keyword_loc
PreExecutionNode::keyword_loc.
Definition ast.h:6821
pm_program_node::statements
struct pm_statements_node * statements
ProgramNode::statements.
Definition ast.h:6856
pm_program_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6845
pm_program_node::locals
pm_constant_id_list_t locals
ProgramNode::locals.
Definition ast.h:6851
pm_range_node::right
struct pm_node * right
RangeNode::right.
Definition ast.h:6907
pm_range_node::operator_loc
pm_location_t operator_loc
RangeNode::operator_loc.
Definition ast.h:6914
pm_range_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6879
pm_range_node::left
struct pm_node * left
RangeNode::left.
Definition ast.h:6893
pm_rational_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6937
pm_rational_node::denominator
pm_integer_t denominator
RationalNode::denominator.
Definition ast.h:6956
pm_rational_node::numerator
pm_integer_t numerator
RationalNode::numerator.
Definition ast.h:6947
pm_redo_node::base
pm_node_t base
The embedded base node.
Definition ast.h:6973
pm_regular_expression_node::closing_loc
pm_location_t closing_loc
RegularExpressionNode::closing_loc.
Definition ast.h:7020
pm_regular_expression_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7004
pm_regular_expression_node::unescaped
pm_string_t unescaped
RegularExpressionNode::unescaped.
Definition ast.h:7025
pm_regular_expression_node::opening_loc
pm_location_t opening_loc
RegularExpressionNode::opening_loc.
Definition ast.h:7010
pm_regular_expression_node::content_loc
pm_location_t content_loc
RegularExpressionNode::content_loc.
Definition ast.h:7015
pm_required_keyword_parameter_node::name_loc
pm_location_t name_loc
RequiredKeywordParameterNode::name_loc.
Definition ast.h:7057
pm_required_keyword_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7046
pm_required_keyword_parameter_node::name
pm_constant_id_t name
RequiredKeywordParameterNode::name.
Definition ast.h:7052
pm_required_parameter_node::name
pm_constant_id_t name
RequiredParameterNode::name.
Definition ast.h:7084
pm_required_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7078
pm_rescue_modifier_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7101
pm_rescue_modifier_node::rescue_expression
struct pm_node * rescue_expression
RescueModifierNode::rescue_expression.
Definition ast.h:7117
pm_rescue_modifier_node::keyword_loc
pm_location_t keyword_loc
RescueModifierNode::keyword_loc.
Definition ast.h:7112
pm_rescue_modifier_node::expression
struct pm_node * expression
RescueModifierNode::expression.
Definition ast.h:7107
pm_rescue_node::keyword_loc
pm_location_t keyword_loc
RescueNode::keyword_loc.
Definition ast.h:7145
pm_rescue_node::subsequent
struct pm_rescue_node * subsequent
RescueNode::subsequent.
Definition ast.h:7175
pm_rescue_node::then_keyword_loc
pm_location_t then_keyword_loc
RescueNode::then_keyword_loc.
Definition ast.h:7165
pm_rescue_node::operator_loc
pm_location_t operator_loc
RescueNode::operator_loc.
Definition ast.h:7155
pm_rescue_node::reference
struct pm_node * reference
RescueNode::reference.
Definition ast.h:7160
pm_rescue_node::exceptions
struct pm_node_list exceptions
RescueNode::exceptions.
Definition ast.h:7150
pm_rescue_node::statements
struct pm_statements_node * statements
RescueNode::statements.
Definition ast.h:7170
pm_rescue_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7139
pm_rest_parameter_node::name
pm_constant_id_t name
RestParameterNode::name.
Definition ast.h:7202
pm_rest_parameter_node::name_loc
pm_location_t name_loc
RestParameterNode::name_loc.
Definition ast.h:7207
pm_rest_parameter_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7196
pm_rest_parameter_node::operator_loc
pm_location_t operator_loc
RestParameterNode::operator_loc.
Definition ast.h:7212
pm_retry_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7229
pm_return_node::keyword_loc
pm_location_t keyword_loc
ReturnNode::keyword_loc.
Definition ast.h:7253
pm_return_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7247
pm_return_node::arguments
struct pm_arguments_node * arguments
ReturnNode::arguments.
Definition ast.h:7258
pm_self_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7275
pm_shareable_constant_node::write
struct pm_node * write
ShareableConstantNode::write.
Definition ast.h:7307
pm_shareable_constant_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7299
pm_singleton_class_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7324
pm_singleton_class_node::locals
pm_constant_id_list_t locals
SingletonClassNode::locals.
Definition ast.h:7330
pm_singleton_class_node::operator_loc
pm_location_t operator_loc
SingletonClassNode::operator_loc.
Definition ast.h:7340
pm_singleton_class_node::expression
struct pm_node * expression
SingletonClassNode::expression.
Definition ast.h:7345
pm_singleton_class_node::end_keyword_loc
pm_location_t end_keyword_loc
SingletonClassNode::end_keyword_loc.
Definition ast.h:7355
pm_singleton_class_node::class_keyword_loc
pm_location_t class_keyword_loc
SingletonClassNode::class_keyword_loc.
Definition ast.h:7335
pm_singleton_class_node::body
struct pm_node * body
SingletonClassNode::body.
Definition ast.h:7350
pm_source_encoding_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7372
pm_source_file_node::filepath
pm_string_t filepath
SourceFileNode::filepath.
Definition ast.h:7404
pm_source_file_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7396
pm_source_line_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7421
pm_splat_node::expression
struct pm_node * expression
SplatNode::expression.
Definition ast.h:7450
pm_splat_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7439
pm_splat_node::operator_loc
pm_location_t operator_loc
SplatNode::operator_loc.
Definition ast.h:7445
pm_statements_node::body
struct pm_node_list body
StatementsNode::body.
Definition ast.h:7473
pm_statements_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7467
pm_string_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7502
pm_string_node::unescaped
pm_string_t unescaped
StringNode::unescaped.
Definition ast.h:7523
pm_string_node::content_loc
pm_location_t content_loc
StringNode::content_loc.
Definition ast.h:7513
pm_string_node::closing_loc
pm_location_t closing_loc
StringNode::closing_loc.
Definition ast.h:7518
pm_string_node::opening_loc
pm_location_t opening_loc
StringNode::opening_loc.
Definition ast.h:7508
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:7559
pm_super_node::lparen_loc
pm_location_t lparen_loc
SuperNode::lparen_loc.
Definition ast.h:7554
pm_super_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7543
pm_super_node::keyword_loc
pm_location_t keyword_loc
SuperNode::keyword_loc.
Definition ast.h:7549
pm_super_node::rparen_loc
pm_location_t rparen_loc
SuperNode::rparen_loc.
Definition ast.h:7564
pm_super_node::block
struct pm_node * block
SuperNode::block.
Definition ast.h:7569
pm_symbol_node::opening_loc
pm_location_t opening_loc
SymbolNode::opening_loc.
Definition ast.h:7600
pm_symbol_node::value_loc
pm_location_t value_loc
SymbolNode::value_loc.
Definition ast.h:7605
pm_symbol_node::closing_loc
pm_location_t closing_loc
SymbolNode::closing_loc.
Definition ast.h:7610
pm_symbol_node::unescaped
pm_string_t unescaped
SymbolNode::unescaped.
Definition ast.h:7615
pm_symbol_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7594
pm_true_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7632
pm_undef_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7650
pm_undef_node::keyword_loc
pm_location_t keyword_loc
UndefNode::keyword_loc.
Definition ast.h:7661
pm_undef_node::names
struct pm_node_list names
UndefNode::names.
Definition ast.h:7656
pm_unless_node::keyword_loc
pm_location_t keyword_loc
UnlessNode::keyword_loc.
Definition ast.h:7695
pm_unless_node::then_keyword_loc
pm_location_t then_keyword_loc
UnlessNode::then_keyword_loc.
Definition ast.h:7718
pm_unless_node::end_keyword_loc
pm_location_t end_keyword_loc
UnlessNode::end_keyword_loc.
Definition ast.h:7749
pm_unless_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7681
pm_unless_node::statements
struct pm_statements_node * statements
UnlessNode::statements.
Definition ast.h:7729
pm_unless_node::predicate
struct pm_node * predicate
UnlessNode::predicate.
Definition ast.h:7708
pm_unless_node::else_clause
struct pm_else_node * else_clause
UnlessNode::else_clause.
Definition ast.h:7739
pm_until_node::statements
struct pm_statements_node * statements
UntilNode::statements.
Definition ast.h:7798
pm_until_node::closing_loc
pm_location_t closing_loc
UntilNode::closing_loc.
Definition ast.h:7788
pm_until_node::predicate
struct pm_node * predicate
UntilNode::predicate.
Definition ast.h:7793
pm_until_node::keyword_loc
pm_location_t keyword_loc
UntilNode::keyword_loc.
Definition ast.h:7778
pm_until_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7772
pm_until_node::do_keyword_loc
pm_location_t do_keyword_loc
UntilNode::do_keyword_loc.
Definition ast.h:7783
pm_when_node::statements
struct pm_statements_node * statements
WhenNode::statements.
Definition ast.h:7838
pm_when_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7817
pm_when_node::then_keyword_loc
pm_location_t then_keyword_loc
WhenNode::then_keyword_loc.
Definition ast.h:7833
pm_when_node::keyword_loc
pm_location_t keyword_loc
WhenNode::keyword_loc.
Definition ast.h:7823
pm_when_node::conditions
struct pm_node_list conditions
WhenNode::conditions.
Definition ast.h:7828
pm_while_node::closing_loc
pm_location_t closing_loc
WhileNode::closing_loc.
Definition ast.h:7877
pm_while_node::keyword_loc
pm_location_t keyword_loc
WhileNode::keyword_loc.
Definition ast.h:7867
pm_while_node::statements
struct pm_statements_node * statements
WhileNode::statements.
Definition ast.h:7887
pm_while_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7861
pm_while_node::do_keyword_loc
pm_location_t do_keyword_loc
WhileNode::do_keyword_loc.
Definition ast.h:7872
pm_while_node::predicate
struct pm_node * predicate
WhileNode::predicate.
Definition ast.h:7882
pm_x_string_node::closing_loc
pm_location_t closing_loc
XStringNode::closing_loc.
Definition ast.h:7924
pm_x_string_node::opening_loc
pm_location_t opening_loc
XStringNode::opening_loc.
Definition ast.h:7914
pm_x_string_node::content_loc
pm_location_t content_loc
XStringNode::content_loc.
Definition ast.h:7919
pm_x_string_node::unescaped
pm_string_t unescaped
XStringNode::unescaped.
Definition ast.h:7929
pm_x_string_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7908
pm_yield_node::keyword_loc
pm_location_t keyword_loc
YieldNode::keyword_loc.
Definition ast.h:7952
pm_yield_node::lparen_loc
pm_location_t lparen_loc
YieldNode::lparen_loc.
Definition ast.h:7957
pm_yield_node::base
pm_node_t base
The embedded base node.
Definition ast.h:7946
pm_yield_node::rparen_loc
pm_location_t rparen_loc
YieldNode::rparen_loc.
Definition ast.h:7967
pm_yield_node::arguments
struct pm_arguments_node * arguments
YieldNode::arguments.
Definition ast.h:7962