Ruby 4.1.0dev (2026-09-05 revision ce1eaf724f17561a1978f61d780b8977230930c8)
json.c
1/*----------------------------------------------------------------------------*/
2/* This file is generated by the templates/template.rb script and should not */
3/* be modified manually. See */
4/* templates/src/json.c.erb */
5/* if you are looking to modify the */
6/* template */
7/*----------------------------------------------------------------------------*/
8
9#include "prism/json.h"
10
11// Ensure this translation unit is never empty, even when JSON is excluded.
12typedef int pm_json_unused_t;
13
14#ifndef PRISM_EXCLUDE_JSON
15
16#include "prism/internal/buffer.h"
17#include "prism/internal/constant_pool.h"
18#include "prism/internal/integer.h"
19#include "prism/internal/parser.h"
20
21#include <inttypes.h>
22
23static void
24pm_dump_json_constant(pm_buffer_t *buffer, const pm_parser_t *parser, pm_constant_id_t constant_id) {
25 const pm_constant_t *constant = pm_constant_pool_id_to_constant(&parser->constant_pool, constant_id);
26 pm_buffer_append_byte(buffer, '"');
27 pm_buffer_append_source(buffer, constant->start, constant->length, PM_BUFFER_ESCAPING_JSON);
28 pm_buffer_append_byte(buffer, '"');
29}
30
31static void
32pm_dump_json_location(pm_buffer_t *buffer, const pm_location_t *location) {
33 pm_buffer_append_format(buffer, "{\"start\":%" PRIu32 ",\"length\":%" PRIu32 "}", location->start, location->length);
34}
35
39void
40pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *node) {
41 switch (PM_NODE_TYPE(node)) {
42 case PM_ALIAS_GLOBAL_VARIABLE_NODE: {
43 pm_buffer_append_string(buffer, "{\"type\":\"AliasGlobalVariableNode\",\"location\":", 45);
44
46 pm_dump_json_location(buffer, &cast->base.location);
47
48 // Dump the new_name field
49 pm_buffer_append_byte(buffer, ',');
50 pm_buffer_append_string(buffer, "\"new_name\":", 11);
51 pm_dump_json(buffer, parser, (const pm_node_t *) cast->new_name);
52
53 // Dump the old_name field
54 pm_buffer_append_byte(buffer, ',');
55 pm_buffer_append_string(buffer, "\"old_name\":", 11);
56 pm_dump_json(buffer, parser, (const pm_node_t *) cast->old_name);
57
58 // Dump the keyword_loc field
59 pm_buffer_append_byte(buffer, ',');
60 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
61 pm_dump_json_location(buffer, &cast->keyword_loc);
62
63 pm_buffer_append_byte(buffer, '}');
64 break;
65 }
66 case PM_ALIAS_METHOD_NODE: {
67 pm_buffer_append_string(buffer, "{\"type\":\"AliasMethodNode\",\"location\":", 37);
68
69 const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node;
70 pm_dump_json_location(buffer, &cast->base.location);
71
72 // Dump the new_name field
73 pm_buffer_append_byte(buffer, ',');
74 pm_buffer_append_string(buffer, "\"new_name\":", 11);
75 pm_dump_json(buffer, parser, (const pm_node_t *) cast->new_name);
76
77 // Dump the old_name field
78 pm_buffer_append_byte(buffer, ',');
79 pm_buffer_append_string(buffer, "\"old_name\":", 11);
80 pm_dump_json(buffer, parser, (const pm_node_t *) cast->old_name);
81
82 // Dump the keyword_loc field
83 pm_buffer_append_byte(buffer, ',');
84 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
85 pm_dump_json_location(buffer, &cast->keyword_loc);
86
87 pm_buffer_append_byte(buffer, '}');
88 break;
89 }
90 case PM_ALTERNATION_PATTERN_NODE: {
91 pm_buffer_append_string(buffer, "{\"type\":\"AlternationPatternNode\",\"location\":", 44);
92
94 pm_dump_json_location(buffer, &cast->base.location);
95
96 // Dump the left field
97 pm_buffer_append_byte(buffer, ',');
98 pm_buffer_append_string(buffer, "\"left\":", 7);
99 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
100
101 // Dump the right field
102 pm_buffer_append_byte(buffer, ',');
103 pm_buffer_append_string(buffer, "\"right\":", 8);
104 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
105
106 // Dump the operator_loc field
107 pm_buffer_append_byte(buffer, ',');
108 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
109 pm_dump_json_location(buffer, &cast->operator_loc);
110
111 pm_buffer_append_byte(buffer, '}');
112 break;
113 }
114 case PM_AND_NODE: {
115 pm_buffer_append_string(buffer, "{\"type\":\"AndNode\",\"location\":", 29);
116
117 const pm_and_node_t *cast = (const pm_and_node_t *) node;
118 pm_dump_json_location(buffer, &cast->base.location);
119
120 // Dump the left field
121 pm_buffer_append_byte(buffer, ',');
122 pm_buffer_append_string(buffer, "\"left\":", 7);
123 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
124
125 // Dump the right field
126 pm_buffer_append_byte(buffer, ',');
127 pm_buffer_append_string(buffer, "\"right\":", 8);
128 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
129
130 // Dump the operator_loc field
131 pm_buffer_append_byte(buffer, ',');
132 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
133 pm_dump_json_location(buffer, &cast->operator_loc);
134
135 pm_buffer_append_byte(buffer, '}');
136 break;
137 }
138 case PM_ARGUMENTS_NODE: {
139 pm_buffer_append_string(buffer, "{\"type\":\"ArgumentsNode\",\"location\":", 35);
140
141 const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node;
142 pm_dump_json_location(buffer, &cast->base.location);
143
144 // Dump the ArgumentsNodeFlags field
145 pm_buffer_append_byte(buffer, ',');
146 pm_buffer_append_string(buffer, "\"flags\":", 8);
147 size_t flags = 0;
148 pm_buffer_append_byte(buffer, '[');
149 if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_FORWARDING)) {
150 if (flags != 0) pm_buffer_append_byte(buffer, ',');
151 pm_buffer_append_string(buffer, "\"CONTAINS_FORWARDING\"", 21);
152 flags++;
153 }
154 if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS)) {
155 if (flags != 0) pm_buffer_append_byte(buffer, ',');
156 pm_buffer_append_string(buffer, "\"CONTAINS_KEYWORDS\"", 19);
157 flags++;
158 }
159 if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT)) {
160 if (flags != 0) pm_buffer_append_byte(buffer, ',');
161 pm_buffer_append_string(buffer, "\"CONTAINS_KEYWORD_SPLAT\"", 24);
162 flags++;
163 }
164 if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT)) {
165 if (flags != 0) pm_buffer_append_byte(buffer, ',');
166 pm_buffer_append_string(buffer, "\"CONTAINS_SPLAT\"", 16);
167 flags++;
168 }
169 if (PM_NODE_FLAG_P(cast, PM_ARGUMENTS_NODE_FLAGS_CONTAINS_MULTIPLE_SPLATS)) {
170 if (flags != 0) pm_buffer_append_byte(buffer, ',');
171 pm_buffer_append_string(buffer, "\"CONTAINS_MULTIPLE_SPLATS\"", 26);
172 flags++;
173 }
174 pm_buffer_append_byte(buffer, ']');
175
176 // Dump the arguments field
177 pm_buffer_append_byte(buffer, ',');
178 pm_buffer_append_string(buffer, "\"arguments\":", 12);
179 const pm_node_list_t *arguments = &cast->arguments;
180 pm_buffer_append_byte(buffer, '[');
181
182 for (size_t index = 0; index < arguments->size; index++) {
183 if (index != 0) pm_buffer_append_byte(buffer, ',');
184 pm_dump_json(buffer, parser, arguments->nodes[index]);
185 }
186 pm_buffer_append_byte(buffer, ']');
187
188 pm_buffer_append_byte(buffer, '}');
189 break;
190 }
191 case PM_ARRAY_NODE: {
192 pm_buffer_append_string(buffer, "{\"type\":\"ArrayNode\",\"location\":", 31);
193
194 const pm_array_node_t *cast = (const pm_array_node_t *) node;
195 pm_dump_json_location(buffer, &cast->base.location);
196
197 // Dump the ArrayNodeFlags field
198 pm_buffer_append_byte(buffer, ',');
199 pm_buffer_append_string(buffer, "\"flags\":", 8);
200 size_t flags = 0;
201 pm_buffer_append_byte(buffer, '[');
202 if (PM_NODE_FLAG_P(cast, PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT)) {
203 if (flags != 0) pm_buffer_append_byte(buffer, ',');
204 pm_buffer_append_string(buffer, "\"CONTAINS_SPLAT\"", 16);
205 flags++;
206 }
207 pm_buffer_append_byte(buffer, ']');
208
209 // Dump the elements field
210 pm_buffer_append_byte(buffer, ',');
211 pm_buffer_append_string(buffer, "\"elements\":", 11);
212 const pm_node_list_t *elements = &cast->elements;
213 pm_buffer_append_byte(buffer, '[');
214
215 for (size_t index = 0; index < elements->size; index++) {
216 if (index != 0) pm_buffer_append_byte(buffer, ',');
217 pm_dump_json(buffer, parser, elements->nodes[index]);
218 }
219 pm_buffer_append_byte(buffer, ']');
220
221 // Dump the opening_loc field
222 pm_buffer_append_byte(buffer, ',');
223 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
224 if (cast->opening_loc.length != 0) {
225 pm_dump_json_location(buffer, &cast->opening_loc);
226 } else {
227 pm_buffer_append_string(buffer, "null", 4);
228 }
229
230 // Dump the closing_loc field
231 pm_buffer_append_byte(buffer, ',');
232 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
233 if (cast->closing_loc.length != 0) {
234 pm_dump_json_location(buffer, &cast->closing_loc);
235 } else {
236 pm_buffer_append_string(buffer, "null", 4);
237 }
238
239 pm_buffer_append_byte(buffer, '}');
240 break;
241 }
242 case PM_ARRAY_PATTERN_NODE: {
243 pm_buffer_append_string(buffer, "{\"type\":\"ArrayPatternNode\",\"location\":", 38);
244
245 const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node;
246 pm_dump_json_location(buffer, &cast->base.location);
247
248 // Dump the constant field
249 pm_buffer_append_byte(buffer, ',');
250 pm_buffer_append_string(buffer, "\"constant\":", 11);
251 if (cast->constant != NULL) {
252 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
253 } else {
254 pm_buffer_append_string(buffer, "null", 4);
255 }
256
257 // Dump the requireds field
258 pm_buffer_append_byte(buffer, ',');
259 pm_buffer_append_string(buffer, "\"requireds\":", 12);
260 const pm_node_list_t *requireds = &cast->requireds;
261 pm_buffer_append_byte(buffer, '[');
262
263 for (size_t index = 0; index < requireds->size; index++) {
264 if (index != 0) pm_buffer_append_byte(buffer, ',');
265 pm_dump_json(buffer, parser, requireds->nodes[index]);
266 }
267 pm_buffer_append_byte(buffer, ']');
268
269 // Dump the rest field
270 pm_buffer_append_byte(buffer, ',');
271 pm_buffer_append_string(buffer, "\"rest\":", 7);
272 if (cast->rest != NULL) {
273 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
274 } else {
275 pm_buffer_append_string(buffer, "null", 4);
276 }
277
278 // Dump the posts field
279 pm_buffer_append_byte(buffer, ',');
280 pm_buffer_append_string(buffer, "\"posts\":", 8);
281 const pm_node_list_t *posts = &cast->posts;
282 pm_buffer_append_byte(buffer, '[');
283
284 for (size_t index = 0; index < posts->size; index++) {
285 if (index != 0) pm_buffer_append_byte(buffer, ',');
286 pm_dump_json(buffer, parser, posts->nodes[index]);
287 }
288 pm_buffer_append_byte(buffer, ']');
289
290 // Dump the opening_loc field
291 pm_buffer_append_byte(buffer, ',');
292 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
293 if (cast->opening_loc.length != 0) {
294 pm_dump_json_location(buffer, &cast->opening_loc);
295 } else {
296 pm_buffer_append_string(buffer, "null", 4);
297 }
298
299 // Dump the closing_loc field
300 pm_buffer_append_byte(buffer, ',');
301 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
302 if (cast->closing_loc.length != 0) {
303 pm_dump_json_location(buffer, &cast->closing_loc);
304 } else {
305 pm_buffer_append_string(buffer, "null", 4);
306 }
307
308 pm_buffer_append_byte(buffer, '}');
309 break;
310 }
311 case PM_ASSOC_NODE: {
312 pm_buffer_append_string(buffer, "{\"type\":\"AssocNode\",\"location\":", 31);
313
314 const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node;
315 pm_dump_json_location(buffer, &cast->base.location);
316
317 // Dump the key field
318 pm_buffer_append_byte(buffer, ',');
319 pm_buffer_append_string(buffer, "\"key\":", 6);
320 pm_dump_json(buffer, parser, (const pm_node_t *) cast->key);
321
322 // Dump the value field
323 pm_buffer_append_byte(buffer, ',');
324 pm_buffer_append_string(buffer, "\"value\":", 8);
325 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
326
327 // Dump the operator_loc field
328 pm_buffer_append_byte(buffer, ',');
329 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
330 if (cast->operator_loc.length != 0) {
331 pm_dump_json_location(buffer, &cast->operator_loc);
332 } else {
333 pm_buffer_append_string(buffer, "null", 4);
334 }
335
336 pm_buffer_append_byte(buffer, '}');
337 break;
338 }
339 case PM_ASSOC_SPLAT_NODE: {
340 pm_buffer_append_string(buffer, "{\"type\":\"AssocSplatNode\",\"location\":", 36);
341
342 const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node;
343 pm_dump_json_location(buffer, &cast->base.location);
344
345 // Dump the value field
346 pm_buffer_append_byte(buffer, ',');
347 pm_buffer_append_string(buffer, "\"value\":", 8);
348 if (cast->value != NULL) {
349 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
350 } else {
351 pm_buffer_append_string(buffer, "null", 4);
352 }
353
354 // Dump the operator_loc field
355 pm_buffer_append_byte(buffer, ',');
356 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
357 pm_dump_json_location(buffer, &cast->operator_loc);
358
359 pm_buffer_append_byte(buffer, '}');
360 break;
361 }
362 case PM_BACK_REFERENCE_READ_NODE: {
363 pm_buffer_append_string(buffer, "{\"type\":\"BackReferenceReadNode\",\"location\":", 43);
364
366 pm_dump_json_location(buffer, &cast->base.location);
367
368 // Dump the name field
369 pm_buffer_append_byte(buffer, ',');
370 pm_buffer_append_string(buffer, "\"name\":", 7);
371 pm_dump_json_constant(buffer, parser, cast->name);
372
373 pm_buffer_append_byte(buffer, '}');
374 break;
375 }
376 case PM_BEGIN_NODE: {
377 pm_buffer_append_string(buffer, "{\"type\":\"BeginNode\",\"location\":", 31);
378
379 const pm_begin_node_t *cast = (const pm_begin_node_t *) node;
380 pm_dump_json_location(buffer, &cast->base.location);
381
382 // Dump the begin_keyword_loc field
383 pm_buffer_append_byte(buffer, ',');
384 pm_buffer_append_string(buffer, "\"begin_keyword_loc\":", 20);
385 if (cast->begin_keyword_loc.length != 0) {
386 pm_dump_json_location(buffer, &cast->begin_keyword_loc);
387 } else {
388 pm_buffer_append_string(buffer, "null", 4);
389 }
390
391 // Dump the statements field
392 pm_buffer_append_byte(buffer, ',');
393 pm_buffer_append_string(buffer, "\"statements\":", 13);
394 if (cast->statements != NULL) {
395 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
396 } else {
397 pm_buffer_append_string(buffer, "null", 4);
398 }
399
400 // Dump the rescue_clause field
401 pm_buffer_append_byte(buffer, ',');
402 pm_buffer_append_string(buffer, "\"rescue_clause\":", 16);
403 if (cast->rescue_clause != NULL) {
404 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_clause);
405 } else {
406 pm_buffer_append_string(buffer, "null", 4);
407 }
408
409 // Dump the else_clause field
410 pm_buffer_append_byte(buffer, ',');
411 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
412 if (cast->else_clause != NULL) {
413 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
414 } else {
415 pm_buffer_append_string(buffer, "null", 4);
416 }
417
418 // Dump the ensure_clause field
419 pm_buffer_append_byte(buffer, ',');
420 pm_buffer_append_string(buffer, "\"ensure_clause\":", 16);
421 if (cast->ensure_clause != NULL) {
422 pm_dump_json(buffer, parser, (const pm_node_t *) cast->ensure_clause);
423 } else {
424 pm_buffer_append_string(buffer, "null", 4);
425 }
426
427 // Dump the end_keyword_loc field
428 pm_buffer_append_byte(buffer, ',');
429 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
430 if (cast->end_keyword_loc.length != 0) {
431 pm_dump_json_location(buffer, &cast->end_keyword_loc);
432 } else {
433 pm_buffer_append_string(buffer, "null", 4);
434 }
435
436 pm_buffer_append_byte(buffer, '}');
437 break;
438 }
439 case PM_BLOCK_ARGUMENT_NODE: {
440 pm_buffer_append_string(buffer, "{\"type\":\"BlockArgumentNode\",\"location\":", 39);
441
442 const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node;
443 pm_dump_json_location(buffer, &cast->base.location);
444
445 // Dump the expression field
446 pm_buffer_append_byte(buffer, ',');
447 pm_buffer_append_string(buffer, "\"expression\":", 13);
448 if (cast->expression != NULL) {
449 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
450 } else {
451 pm_buffer_append_string(buffer, "null", 4);
452 }
453
454 // Dump the operator_loc field
455 pm_buffer_append_byte(buffer, ',');
456 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
457 pm_dump_json_location(buffer, &cast->operator_loc);
458
459 pm_buffer_append_byte(buffer, '}');
460 break;
461 }
462 case PM_BLOCK_LOCAL_VARIABLE_NODE: {
463 pm_buffer_append_string(buffer, "{\"type\":\"BlockLocalVariableNode\",\"location\":", 44);
464
466 pm_dump_json_location(buffer, &cast->base.location);
467
468 // Dump the ParameterFlags field
469 pm_buffer_append_byte(buffer, ',');
470 pm_buffer_append_string(buffer, "\"flags\":", 8);
471 size_t flags = 0;
472 pm_buffer_append_byte(buffer, '[');
473 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
474 if (flags != 0) pm_buffer_append_byte(buffer, ',');
475 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
476 flags++;
477 }
478 pm_buffer_append_byte(buffer, ']');
479
480 // Dump the name field
481 pm_buffer_append_byte(buffer, ',');
482 pm_buffer_append_string(buffer, "\"name\":", 7);
483 pm_dump_json_constant(buffer, parser, cast->name);
484
485 pm_buffer_append_byte(buffer, '}');
486 break;
487 }
488 case PM_BLOCK_NODE: {
489 pm_buffer_append_string(buffer, "{\"type\":\"BlockNode\",\"location\":", 31);
490
491 const pm_block_node_t *cast = (const pm_block_node_t *) node;
492 pm_dump_json_location(buffer, &cast->base.location);
493
494 // Dump the locals field
495 pm_buffer_append_byte(buffer, ',');
496 pm_buffer_append_string(buffer, "\"locals\":", 9);
497 const pm_constant_id_list_t *locals = &cast->locals;
498 pm_buffer_append_byte(buffer, '[');
499
500 for (size_t index = 0; index < locals->size; index++) {
501 if (index != 0) pm_buffer_append_byte(buffer, ',');
502 pm_dump_json_constant(buffer, parser, locals->ids[index]);
503 }
504 pm_buffer_append_byte(buffer, ']');
505
506 // Dump the parameters field
507 pm_buffer_append_byte(buffer, ',');
508 pm_buffer_append_string(buffer, "\"parameters\":", 13);
509 if (cast->parameters != NULL) {
510 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
511 } else {
512 pm_buffer_append_string(buffer, "null", 4);
513 }
514
515 // Dump the body field
516 pm_buffer_append_byte(buffer, ',');
517 pm_buffer_append_string(buffer, "\"body\":", 7);
518 if (cast->body != NULL) {
519 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
520 } else {
521 pm_buffer_append_string(buffer, "null", 4);
522 }
523
524 // Dump the opening_loc field
525 pm_buffer_append_byte(buffer, ',');
526 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
527 pm_dump_json_location(buffer, &cast->opening_loc);
528
529 // Dump the closing_loc field
530 pm_buffer_append_byte(buffer, ',');
531 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
532 pm_dump_json_location(buffer, &cast->closing_loc);
533
534 pm_buffer_append_byte(buffer, '}');
535 break;
536 }
537 case PM_BLOCK_PARAMETER_NODE: {
538 pm_buffer_append_string(buffer, "{\"type\":\"BlockParameterNode\",\"location\":", 40);
539
540 const pm_block_parameter_node_t *cast = (const pm_block_parameter_node_t *) node;
541 pm_dump_json_location(buffer, &cast->base.location);
542
543 // Dump the ParameterFlags field
544 pm_buffer_append_byte(buffer, ',');
545 pm_buffer_append_string(buffer, "\"flags\":", 8);
546 size_t flags = 0;
547 pm_buffer_append_byte(buffer, '[');
548 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
549 if (flags != 0) pm_buffer_append_byte(buffer, ',');
550 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
551 flags++;
552 }
553 pm_buffer_append_byte(buffer, ']');
554
555 // Dump the name field
556 pm_buffer_append_byte(buffer, ',');
557 pm_buffer_append_string(buffer, "\"name\":", 7);
558 if (cast->name != PM_CONSTANT_ID_UNSET) {
559 pm_dump_json_constant(buffer, parser, cast->name);
560 } else {
561 pm_buffer_append_string(buffer, "null", 4);
562 }
563
564 // Dump the name_loc field
565 pm_buffer_append_byte(buffer, ',');
566 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
567 if (cast->name_loc.length != 0) {
568 pm_dump_json_location(buffer, &cast->name_loc);
569 } else {
570 pm_buffer_append_string(buffer, "null", 4);
571 }
572
573 // Dump the operator_loc field
574 pm_buffer_append_byte(buffer, ',');
575 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
576 pm_dump_json_location(buffer, &cast->operator_loc);
577
578 pm_buffer_append_byte(buffer, '}');
579 break;
580 }
581 case PM_BLOCK_PARAMETERS_NODE: {
582 pm_buffer_append_string(buffer, "{\"type\":\"BlockParametersNode\",\"location\":", 41);
583
584 const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node;
585 pm_dump_json_location(buffer, &cast->base.location);
586
587 // Dump the parameters field
588 pm_buffer_append_byte(buffer, ',');
589 pm_buffer_append_string(buffer, "\"parameters\":", 13);
590 if (cast->parameters != NULL) {
591 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
592 } else {
593 pm_buffer_append_string(buffer, "null", 4);
594 }
595
596 // Dump the locals field
597 pm_buffer_append_byte(buffer, ',');
598 pm_buffer_append_string(buffer, "\"locals\":", 9);
599 const pm_node_list_t *locals = &cast->locals;
600 pm_buffer_append_byte(buffer, '[');
601
602 for (size_t index = 0; index < locals->size; index++) {
603 if (index != 0) pm_buffer_append_byte(buffer, ',');
604 pm_dump_json(buffer, parser, locals->nodes[index]);
605 }
606 pm_buffer_append_byte(buffer, ']');
607
608 // Dump the opening_loc field
609 pm_buffer_append_byte(buffer, ',');
610 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
611 if (cast->opening_loc.length != 0) {
612 pm_dump_json_location(buffer, &cast->opening_loc);
613 } else {
614 pm_buffer_append_string(buffer, "null", 4);
615 }
616
617 // Dump the closing_loc field
618 pm_buffer_append_byte(buffer, ',');
619 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
620 if (cast->closing_loc.length != 0) {
621 pm_dump_json_location(buffer, &cast->closing_loc);
622 } else {
623 pm_buffer_append_string(buffer, "null", 4);
624 }
625
626 pm_buffer_append_byte(buffer, '}');
627 break;
628 }
629 case PM_BREAK_NODE: {
630 pm_buffer_append_string(buffer, "{\"type\":\"BreakNode\",\"location\":", 31);
631
632 const pm_break_node_t *cast = (const pm_break_node_t *) node;
633 pm_dump_json_location(buffer, &cast->base.location);
634
635 // Dump the arguments field
636 pm_buffer_append_byte(buffer, ',');
637 pm_buffer_append_string(buffer, "\"arguments\":", 12);
638 if (cast->arguments != NULL) {
639 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
640 } else {
641 pm_buffer_append_string(buffer, "null", 4);
642 }
643
644 // Dump the keyword_loc field
645 pm_buffer_append_byte(buffer, ',');
646 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
647 pm_dump_json_location(buffer, &cast->keyword_loc);
648
649 pm_buffer_append_byte(buffer, '}');
650 break;
651 }
652 case PM_CALL_AND_WRITE_NODE: {
653 pm_buffer_append_string(buffer, "{\"type\":\"CallAndWriteNode\",\"location\":", 38);
654
655 const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node;
656 pm_dump_json_location(buffer, &cast->base.location);
657
658 // Dump the CallNodeFlags field
659 pm_buffer_append_byte(buffer, ',');
660 pm_buffer_append_string(buffer, "\"flags\":", 8);
661 size_t flags = 0;
662 pm_buffer_append_byte(buffer, '[');
663 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
664 if (flags != 0) pm_buffer_append_byte(buffer, ',');
665 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
666 flags++;
667 }
668 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
669 if (flags != 0) pm_buffer_append_byte(buffer, ',');
670 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
671 flags++;
672 }
673 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
674 if (flags != 0) pm_buffer_append_byte(buffer, ',');
675 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
676 flags++;
677 }
678 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
679 if (flags != 0) pm_buffer_append_byte(buffer, ',');
680 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
681 flags++;
682 }
683 pm_buffer_append_byte(buffer, ']');
684
685 // Dump the receiver field
686 pm_buffer_append_byte(buffer, ',');
687 pm_buffer_append_string(buffer, "\"receiver\":", 11);
688 if (cast->receiver != NULL) {
689 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
690 } else {
691 pm_buffer_append_string(buffer, "null", 4);
692 }
693
694 // Dump the call_operator_loc field
695 pm_buffer_append_byte(buffer, ',');
696 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
697 if (cast->call_operator_loc.length != 0) {
698 pm_dump_json_location(buffer, &cast->call_operator_loc);
699 } else {
700 pm_buffer_append_string(buffer, "null", 4);
701 }
702
703 // Dump the message_loc field
704 pm_buffer_append_byte(buffer, ',');
705 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
706 if (cast->message_loc.length != 0) {
707 pm_dump_json_location(buffer, &cast->message_loc);
708 } else {
709 pm_buffer_append_string(buffer, "null", 4);
710 }
711
712 // Dump the read_name field
713 pm_buffer_append_byte(buffer, ',');
714 pm_buffer_append_string(buffer, "\"read_name\":", 12);
715 pm_dump_json_constant(buffer, parser, cast->read_name);
716
717 // Dump the write_name field
718 pm_buffer_append_byte(buffer, ',');
719 pm_buffer_append_string(buffer, "\"write_name\":", 13);
720 pm_dump_json_constant(buffer, parser, cast->write_name);
721
722 // Dump the operator_loc field
723 pm_buffer_append_byte(buffer, ',');
724 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
725 pm_dump_json_location(buffer, &cast->operator_loc);
726
727 // Dump the value field
728 pm_buffer_append_byte(buffer, ',');
729 pm_buffer_append_string(buffer, "\"value\":", 8);
730 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
731
732 pm_buffer_append_byte(buffer, '}');
733 break;
734 }
735 case PM_CALL_NODE: {
736 pm_buffer_append_string(buffer, "{\"type\":\"CallNode\",\"location\":", 30);
737
738 const pm_call_node_t *cast = (const pm_call_node_t *) node;
739 pm_dump_json_location(buffer, &cast->base.location);
740
741 // Dump the CallNodeFlags field
742 pm_buffer_append_byte(buffer, ',');
743 pm_buffer_append_string(buffer, "\"flags\":", 8);
744 size_t flags = 0;
745 pm_buffer_append_byte(buffer, '[');
746 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
747 if (flags != 0) pm_buffer_append_byte(buffer, ',');
748 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
749 flags++;
750 }
751 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
752 if (flags != 0) pm_buffer_append_byte(buffer, ',');
753 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
754 flags++;
755 }
756 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
757 if (flags != 0) pm_buffer_append_byte(buffer, ',');
758 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
759 flags++;
760 }
761 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
762 if (flags != 0) pm_buffer_append_byte(buffer, ',');
763 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
764 flags++;
765 }
766 pm_buffer_append_byte(buffer, ']');
767
768 // Dump the receiver field
769 pm_buffer_append_byte(buffer, ',');
770 pm_buffer_append_string(buffer, "\"receiver\":", 11);
771 if (cast->receiver != NULL) {
772 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
773 } else {
774 pm_buffer_append_string(buffer, "null", 4);
775 }
776
777 // Dump the call_operator_loc field
778 pm_buffer_append_byte(buffer, ',');
779 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
780 if (cast->call_operator_loc.length != 0) {
781 pm_dump_json_location(buffer, &cast->call_operator_loc);
782 } else {
783 pm_buffer_append_string(buffer, "null", 4);
784 }
785
786 // Dump the name field
787 pm_buffer_append_byte(buffer, ',');
788 pm_buffer_append_string(buffer, "\"name\":", 7);
789 pm_dump_json_constant(buffer, parser, cast->name);
790
791 // Dump the message_loc field
792 pm_buffer_append_byte(buffer, ',');
793 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
794 if (cast->message_loc.length != 0) {
795 pm_dump_json_location(buffer, &cast->message_loc);
796 } else {
797 pm_buffer_append_string(buffer, "null", 4);
798 }
799
800 // Dump the opening_loc field
801 pm_buffer_append_byte(buffer, ',');
802 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
803 if (cast->opening_loc.length != 0) {
804 pm_dump_json_location(buffer, &cast->opening_loc);
805 } else {
806 pm_buffer_append_string(buffer, "null", 4);
807 }
808
809 // Dump the arguments field
810 pm_buffer_append_byte(buffer, ',');
811 pm_buffer_append_string(buffer, "\"arguments\":", 12);
812 if (cast->arguments != NULL) {
813 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
814 } else {
815 pm_buffer_append_string(buffer, "null", 4);
816 }
817
818 // Dump the closing_loc field
819 pm_buffer_append_byte(buffer, ',');
820 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
821 if (cast->closing_loc.length != 0) {
822 pm_dump_json_location(buffer, &cast->closing_loc);
823 } else {
824 pm_buffer_append_string(buffer, "null", 4);
825 }
826
827 // Dump the equal_loc field
828 pm_buffer_append_byte(buffer, ',');
829 pm_buffer_append_string(buffer, "\"equal_loc\":", 12);
830 if (cast->equal_loc.length != 0) {
831 pm_dump_json_location(buffer, &cast->equal_loc);
832 } else {
833 pm_buffer_append_string(buffer, "null", 4);
834 }
835
836 // Dump the block field
837 pm_buffer_append_byte(buffer, ',');
838 pm_buffer_append_string(buffer, "\"block\":", 8);
839 if (cast->block != NULL) {
840 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
841 } else {
842 pm_buffer_append_string(buffer, "null", 4);
843 }
844
845 pm_buffer_append_byte(buffer, '}');
846 break;
847 }
848 case PM_CALL_OPERATOR_WRITE_NODE: {
849 pm_buffer_append_string(buffer, "{\"type\":\"CallOperatorWriteNode\",\"location\":", 43);
850
852 pm_dump_json_location(buffer, &cast->base.location);
853
854 // Dump the CallNodeFlags field
855 pm_buffer_append_byte(buffer, ',');
856 pm_buffer_append_string(buffer, "\"flags\":", 8);
857 size_t flags = 0;
858 pm_buffer_append_byte(buffer, '[');
859 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
860 if (flags != 0) pm_buffer_append_byte(buffer, ',');
861 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
862 flags++;
863 }
864 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
865 if (flags != 0) pm_buffer_append_byte(buffer, ',');
866 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
867 flags++;
868 }
869 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
870 if (flags != 0) pm_buffer_append_byte(buffer, ',');
871 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
872 flags++;
873 }
874 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
875 if (flags != 0) pm_buffer_append_byte(buffer, ',');
876 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
877 flags++;
878 }
879 pm_buffer_append_byte(buffer, ']');
880
881 // Dump the receiver field
882 pm_buffer_append_byte(buffer, ',');
883 pm_buffer_append_string(buffer, "\"receiver\":", 11);
884 if (cast->receiver != NULL) {
885 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
886 } else {
887 pm_buffer_append_string(buffer, "null", 4);
888 }
889
890 // Dump the call_operator_loc field
891 pm_buffer_append_byte(buffer, ',');
892 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
893 if (cast->call_operator_loc.length != 0) {
894 pm_dump_json_location(buffer, &cast->call_operator_loc);
895 } else {
896 pm_buffer_append_string(buffer, "null", 4);
897 }
898
899 // Dump the message_loc field
900 pm_buffer_append_byte(buffer, ',');
901 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
902 if (cast->message_loc.length != 0) {
903 pm_dump_json_location(buffer, &cast->message_loc);
904 } else {
905 pm_buffer_append_string(buffer, "null", 4);
906 }
907
908 // Dump the read_name field
909 pm_buffer_append_byte(buffer, ',');
910 pm_buffer_append_string(buffer, "\"read_name\":", 12);
911 pm_dump_json_constant(buffer, parser, cast->read_name);
912
913 // Dump the write_name field
914 pm_buffer_append_byte(buffer, ',');
915 pm_buffer_append_string(buffer, "\"write_name\":", 13);
916 pm_dump_json_constant(buffer, parser, cast->write_name);
917
918 // Dump the binary_operator field
919 pm_buffer_append_byte(buffer, ',');
920 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
921 pm_dump_json_constant(buffer, parser, cast->binary_operator);
922
923 // Dump the binary_operator_loc field
924 pm_buffer_append_byte(buffer, ',');
925 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
926 pm_dump_json_location(buffer, &cast->binary_operator_loc);
927
928 // Dump the value field
929 pm_buffer_append_byte(buffer, ',');
930 pm_buffer_append_string(buffer, "\"value\":", 8);
931 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
932
933 pm_buffer_append_byte(buffer, '}');
934 break;
935 }
936 case PM_CALL_OR_WRITE_NODE: {
937 pm_buffer_append_string(buffer, "{\"type\":\"CallOrWriteNode\",\"location\":", 37);
938
939 const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node;
940 pm_dump_json_location(buffer, &cast->base.location);
941
942 // Dump the CallNodeFlags field
943 pm_buffer_append_byte(buffer, ',');
944 pm_buffer_append_string(buffer, "\"flags\":", 8);
945 size_t flags = 0;
946 pm_buffer_append_byte(buffer, '[');
947 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
948 if (flags != 0) pm_buffer_append_byte(buffer, ',');
949 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
950 flags++;
951 }
952 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
953 if (flags != 0) pm_buffer_append_byte(buffer, ',');
954 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
955 flags++;
956 }
957 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
958 if (flags != 0) pm_buffer_append_byte(buffer, ',');
959 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
960 flags++;
961 }
962 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
963 if (flags != 0) pm_buffer_append_byte(buffer, ',');
964 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
965 flags++;
966 }
967 pm_buffer_append_byte(buffer, ']');
968
969 // Dump the receiver field
970 pm_buffer_append_byte(buffer, ',');
971 pm_buffer_append_string(buffer, "\"receiver\":", 11);
972 if (cast->receiver != NULL) {
973 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
974 } else {
975 pm_buffer_append_string(buffer, "null", 4);
976 }
977
978 // Dump the call_operator_loc field
979 pm_buffer_append_byte(buffer, ',');
980 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
981 if (cast->call_operator_loc.length != 0) {
982 pm_dump_json_location(buffer, &cast->call_operator_loc);
983 } else {
984 pm_buffer_append_string(buffer, "null", 4);
985 }
986
987 // Dump the message_loc field
988 pm_buffer_append_byte(buffer, ',');
989 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
990 if (cast->message_loc.length != 0) {
991 pm_dump_json_location(buffer, &cast->message_loc);
992 } else {
993 pm_buffer_append_string(buffer, "null", 4);
994 }
995
996 // Dump the read_name field
997 pm_buffer_append_byte(buffer, ',');
998 pm_buffer_append_string(buffer, "\"read_name\":", 12);
999 pm_dump_json_constant(buffer, parser, cast->read_name);
1000
1001 // Dump the write_name field
1002 pm_buffer_append_byte(buffer, ',');
1003 pm_buffer_append_string(buffer, "\"write_name\":", 13);
1004 pm_dump_json_constant(buffer, parser, cast->write_name);
1005
1006 // Dump the operator_loc field
1007 pm_buffer_append_byte(buffer, ',');
1008 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1009 pm_dump_json_location(buffer, &cast->operator_loc);
1010
1011 // Dump the value field
1012 pm_buffer_append_byte(buffer, ',');
1013 pm_buffer_append_string(buffer, "\"value\":", 8);
1014 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1015
1016 pm_buffer_append_byte(buffer, '}');
1017 break;
1018 }
1019 case PM_CALL_TARGET_NODE: {
1020 pm_buffer_append_string(buffer, "{\"type\":\"CallTargetNode\",\"location\":", 36);
1021
1022 const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node;
1023 pm_dump_json_location(buffer, &cast->base.location);
1024
1025 // Dump the CallNodeFlags field
1026 pm_buffer_append_byte(buffer, ',');
1027 pm_buffer_append_string(buffer, "\"flags\":", 8);
1028 size_t flags = 0;
1029 pm_buffer_append_byte(buffer, '[');
1030 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
1031 if (flags != 0) pm_buffer_append_byte(buffer, ',');
1032 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
1033 flags++;
1034 }
1035 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
1036 if (flags != 0) pm_buffer_append_byte(buffer, ',');
1037 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
1038 flags++;
1039 }
1040 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
1041 if (flags != 0) pm_buffer_append_byte(buffer, ',');
1042 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
1043 flags++;
1044 }
1045 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
1046 if (flags != 0) pm_buffer_append_byte(buffer, ',');
1047 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
1048 flags++;
1049 }
1050 pm_buffer_append_byte(buffer, ']');
1051
1052 // Dump the receiver field
1053 pm_buffer_append_byte(buffer, ',');
1054 pm_buffer_append_string(buffer, "\"receiver\":", 11);
1055 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
1056
1057 // Dump the call_operator_loc field
1058 pm_buffer_append_byte(buffer, ',');
1059 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
1060 pm_dump_json_location(buffer, &cast->call_operator_loc);
1061
1062 // Dump the name field
1063 pm_buffer_append_byte(buffer, ',');
1064 pm_buffer_append_string(buffer, "\"name\":", 7);
1065 pm_dump_json_constant(buffer, parser, cast->name);
1066
1067 // Dump the message_loc field
1068 pm_buffer_append_byte(buffer, ',');
1069 pm_buffer_append_string(buffer, "\"message_loc\":", 14);
1070 pm_dump_json_location(buffer, &cast->message_loc);
1071
1072 pm_buffer_append_byte(buffer, '}');
1073 break;
1074 }
1075 case PM_CAPTURE_PATTERN_NODE: {
1076 pm_buffer_append_string(buffer, "{\"type\":\"CapturePatternNode\",\"location\":", 40);
1077
1078 const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node;
1079 pm_dump_json_location(buffer, &cast->base.location);
1080
1081 // Dump the value field
1082 pm_buffer_append_byte(buffer, ',');
1083 pm_buffer_append_string(buffer, "\"value\":", 8);
1084 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1085
1086 // Dump the target field
1087 pm_buffer_append_byte(buffer, ',');
1088 pm_buffer_append_string(buffer, "\"target\":", 9);
1089 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
1090
1091 // Dump the operator_loc field
1092 pm_buffer_append_byte(buffer, ',');
1093 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1094 pm_dump_json_location(buffer, &cast->operator_loc);
1095
1096 pm_buffer_append_byte(buffer, '}');
1097 break;
1098 }
1099 case PM_CASE_MATCH_NODE: {
1100 pm_buffer_append_string(buffer, "{\"type\":\"CaseMatchNode\",\"location\":", 35);
1101
1102 const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node;
1103 pm_dump_json_location(buffer, &cast->base.location);
1104
1105 // Dump the predicate field
1106 pm_buffer_append_byte(buffer, ',');
1107 pm_buffer_append_string(buffer, "\"predicate\":", 12);
1108 if (cast->predicate != NULL) {
1109 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
1110 } else {
1111 pm_buffer_append_string(buffer, "null", 4);
1112 }
1113
1114 // Dump the conditions field
1115 pm_buffer_append_byte(buffer, ',');
1116 pm_buffer_append_string(buffer, "\"conditions\":", 13);
1117 const pm_node_list_t *conditions = &cast->conditions;
1118 pm_buffer_append_byte(buffer, '[');
1119
1120 for (size_t index = 0; index < conditions->size; index++) {
1121 if (index != 0) pm_buffer_append_byte(buffer, ',');
1122 pm_dump_json(buffer, parser, conditions->nodes[index]);
1123 }
1124 pm_buffer_append_byte(buffer, ']');
1125
1126 // Dump the else_clause field
1127 pm_buffer_append_byte(buffer, ',');
1128 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
1129 if (cast->else_clause != NULL) {
1130 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
1131 } else {
1132 pm_buffer_append_string(buffer, "null", 4);
1133 }
1134
1135 // Dump the case_keyword_loc field
1136 pm_buffer_append_byte(buffer, ',');
1137 pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19);
1138 pm_dump_json_location(buffer, &cast->case_keyword_loc);
1139
1140 // Dump the end_keyword_loc field
1141 pm_buffer_append_byte(buffer, ',');
1142 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
1143 pm_dump_json_location(buffer, &cast->end_keyword_loc);
1144
1145 pm_buffer_append_byte(buffer, '}');
1146 break;
1147 }
1148 case PM_CASE_NODE: {
1149 pm_buffer_append_string(buffer, "{\"type\":\"CaseNode\",\"location\":", 30);
1150
1151 const pm_case_node_t *cast = (const pm_case_node_t *) node;
1152 pm_dump_json_location(buffer, &cast->base.location);
1153
1154 // Dump the predicate field
1155 pm_buffer_append_byte(buffer, ',');
1156 pm_buffer_append_string(buffer, "\"predicate\":", 12);
1157 if (cast->predicate != NULL) {
1158 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
1159 } else {
1160 pm_buffer_append_string(buffer, "null", 4);
1161 }
1162
1163 // Dump the conditions field
1164 pm_buffer_append_byte(buffer, ',');
1165 pm_buffer_append_string(buffer, "\"conditions\":", 13);
1166 const pm_node_list_t *conditions = &cast->conditions;
1167 pm_buffer_append_byte(buffer, '[');
1168
1169 for (size_t index = 0; index < conditions->size; index++) {
1170 if (index != 0) pm_buffer_append_byte(buffer, ',');
1171 pm_dump_json(buffer, parser, conditions->nodes[index]);
1172 }
1173 pm_buffer_append_byte(buffer, ']');
1174
1175 // Dump the else_clause field
1176 pm_buffer_append_byte(buffer, ',');
1177 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
1178 if (cast->else_clause != NULL) {
1179 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
1180 } else {
1181 pm_buffer_append_string(buffer, "null", 4);
1182 }
1183
1184 // Dump the case_keyword_loc field
1185 pm_buffer_append_byte(buffer, ',');
1186 pm_buffer_append_string(buffer, "\"case_keyword_loc\":", 19);
1187 pm_dump_json_location(buffer, &cast->case_keyword_loc);
1188
1189 // Dump the end_keyword_loc field
1190 pm_buffer_append_byte(buffer, ',');
1191 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
1192 pm_dump_json_location(buffer, &cast->end_keyword_loc);
1193
1194 pm_buffer_append_byte(buffer, '}');
1195 break;
1196 }
1197 case PM_CLASS_NODE: {
1198 pm_buffer_append_string(buffer, "{\"type\":\"ClassNode\",\"location\":", 31);
1199
1200 const pm_class_node_t *cast = (const pm_class_node_t *) node;
1201 pm_dump_json_location(buffer, &cast->base.location);
1202
1203 // Dump the locals field
1204 pm_buffer_append_byte(buffer, ',');
1205 pm_buffer_append_string(buffer, "\"locals\":", 9);
1206 const pm_constant_id_list_t *locals = &cast->locals;
1207 pm_buffer_append_byte(buffer, '[');
1208
1209 for (size_t index = 0; index < locals->size; index++) {
1210 if (index != 0) pm_buffer_append_byte(buffer, ',');
1211 pm_dump_json_constant(buffer, parser, locals->ids[index]);
1212 }
1213 pm_buffer_append_byte(buffer, ']');
1214
1215 // Dump the class_keyword_loc field
1216 pm_buffer_append_byte(buffer, ',');
1217 pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20);
1218 pm_dump_json_location(buffer, &cast->class_keyword_loc);
1219
1220 // Dump the constant_path field
1221 pm_buffer_append_byte(buffer, ',');
1222 pm_buffer_append_string(buffer, "\"constant_path\":", 16);
1223 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path);
1224
1225 // Dump the inheritance_operator_loc field
1226 pm_buffer_append_byte(buffer, ',');
1227 pm_buffer_append_string(buffer, "\"inheritance_operator_loc\":", 27);
1228 if (cast->inheritance_operator_loc.length != 0) {
1229 pm_dump_json_location(buffer, &cast->inheritance_operator_loc);
1230 } else {
1231 pm_buffer_append_string(buffer, "null", 4);
1232 }
1233
1234 // Dump the superclass field
1235 pm_buffer_append_byte(buffer, ',');
1236 pm_buffer_append_string(buffer, "\"superclass\":", 13);
1237 if (cast->superclass != NULL) {
1238 pm_dump_json(buffer, parser, (const pm_node_t *) cast->superclass);
1239 } else {
1240 pm_buffer_append_string(buffer, "null", 4);
1241 }
1242
1243 // Dump the body field
1244 pm_buffer_append_byte(buffer, ',');
1245 pm_buffer_append_string(buffer, "\"body\":", 7);
1246 if (cast->body != NULL) {
1247 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
1248 } else {
1249 pm_buffer_append_string(buffer, "null", 4);
1250 }
1251
1252 // Dump the end_keyword_loc field
1253 pm_buffer_append_byte(buffer, ',');
1254 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
1255 pm_dump_json_location(buffer, &cast->end_keyword_loc);
1256
1257 // Dump the name field
1258 pm_buffer_append_byte(buffer, ',');
1259 pm_buffer_append_string(buffer, "\"name\":", 7);
1260 pm_dump_json_constant(buffer, parser, cast->name);
1261
1262 pm_buffer_append_byte(buffer, '}');
1263 break;
1264 }
1265 case PM_CLASS_VARIABLE_AND_WRITE_NODE: {
1266 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableAndWriteNode\",\"location\":", 47);
1267
1269 pm_dump_json_location(buffer, &cast->base.location);
1270
1271 // Dump the name field
1272 pm_buffer_append_byte(buffer, ',');
1273 pm_buffer_append_string(buffer, "\"name\":", 7);
1274 pm_dump_json_constant(buffer, parser, cast->name);
1275
1276 // Dump the name_loc field
1277 pm_buffer_append_byte(buffer, ',');
1278 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1279 pm_dump_json_location(buffer, &cast->name_loc);
1280
1281 // Dump the operator_loc field
1282 pm_buffer_append_byte(buffer, ',');
1283 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1284 pm_dump_json_location(buffer, &cast->operator_loc);
1285
1286 // Dump the value field
1287 pm_buffer_append_byte(buffer, ',');
1288 pm_buffer_append_string(buffer, "\"value\":", 8);
1289 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1290
1291 pm_buffer_append_byte(buffer, '}');
1292 break;
1293 }
1294 case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
1295 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOperatorWriteNode\",\"location\":", 52);
1296
1298 pm_dump_json_location(buffer, &cast->base.location);
1299
1300 // Dump the name field
1301 pm_buffer_append_byte(buffer, ',');
1302 pm_buffer_append_string(buffer, "\"name\":", 7);
1303 pm_dump_json_constant(buffer, parser, cast->name);
1304
1305 // Dump the name_loc field
1306 pm_buffer_append_byte(buffer, ',');
1307 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1308 pm_dump_json_location(buffer, &cast->name_loc);
1309
1310 // Dump the binary_operator_loc field
1311 pm_buffer_append_byte(buffer, ',');
1312 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
1313 pm_dump_json_location(buffer, &cast->binary_operator_loc);
1314
1315 // Dump the value field
1316 pm_buffer_append_byte(buffer, ',');
1317 pm_buffer_append_string(buffer, "\"value\":", 8);
1318 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1319
1320 // Dump the binary_operator field
1321 pm_buffer_append_byte(buffer, ',');
1322 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
1323 pm_dump_json_constant(buffer, parser, cast->binary_operator);
1324
1325 pm_buffer_append_byte(buffer, '}');
1326 break;
1327 }
1328 case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
1329 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableOrWriteNode\",\"location\":", 46);
1330
1332 pm_dump_json_location(buffer, &cast->base.location);
1333
1334 // Dump the name field
1335 pm_buffer_append_byte(buffer, ',');
1336 pm_buffer_append_string(buffer, "\"name\":", 7);
1337 pm_dump_json_constant(buffer, parser, cast->name);
1338
1339 // Dump the name_loc field
1340 pm_buffer_append_byte(buffer, ',');
1341 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1342 pm_dump_json_location(buffer, &cast->name_loc);
1343
1344 // Dump the operator_loc field
1345 pm_buffer_append_byte(buffer, ',');
1346 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1347 pm_dump_json_location(buffer, &cast->operator_loc);
1348
1349 // Dump the value field
1350 pm_buffer_append_byte(buffer, ',');
1351 pm_buffer_append_string(buffer, "\"value\":", 8);
1352 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1353
1354 pm_buffer_append_byte(buffer, '}');
1355 break;
1356 }
1357 case PM_CLASS_VARIABLE_READ_NODE: {
1358 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableReadNode\",\"location\":", 43);
1359
1361 pm_dump_json_location(buffer, &cast->base.location);
1362
1363 // Dump the name field
1364 pm_buffer_append_byte(buffer, ',');
1365 pm_buffer_append_string(buffer, "\"name\":", 7);
1366 pm_dump_json_constant(buffer, parser, cast->name);
1367
1368 pm_buffer_append_byte(buffer, '}');
1369 break;
1370 }
1371 case PM_CLASS_VARIABLE_TARGET_NODE: {
1372 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableTargetNode\",\"location\":", 45);
1373
1375 pm_dump_json_location(buffer, &cast->base.location);
1376
1377 // Dump the name field
1378 pm_buffer_append_byte(buffer, ',');
1379 pm_buffer_append_string(buffer, "\"name\":", 7);
1380 pm_dump_json_constant(buffer, parser, cast->name);
1381
1382 pm_buffer_append_byte(buffer, '}');
1383 break;
1384 }
1385 case PM_CLASS_VARIABLE_WRITE_NODE: {
1386 pm_buffer_append_string(buffer, "{\"type\":\"ClassVariableWriteNode\",\"location\":", 44);
1387
1389 pm_dump_json_location(buffer, &cast->base.location);
1390
1391 // Dump the name field
1392 pm_buffer_append_byte(buffer, ',');
1393 pm_buffer_append_string(buffer, "\"name\":", 7);
1394 pm_dump_json_constant(buffer, parser, cast->name);
1395
1396 // Dump the name_loc field
1397 pm_buffer_append_byte(buffer, ',');
1398 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1399 pm_dump_json_location(buffer, &cast->name_loc);
1400
1401 // Dump the value field
1402 pm_buffer_append_byte(buffer, ',');
1403 pm_buffer_append_string(buffer, "\"value\":", 8);
1404 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1405
1406 // Dump the operator_loc field
1407 pm_buffer_append_byte(buffer, ',');
1408 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1409 pm_dump_json_location(buffer, &cast->operator_loc);
1410
1411 pm_buffer_append_byte(buffer, '}');
1412 break;
1413 }
1414 case PM_CONSTANT_AND_WRITE_NODE: {
1415 pm_buffer_append_string(buffer, "{\"type\":\"ConstantAndWriteNode\",\"location\":", 42);
1416
1418 pm_dump_json_location(buffer, &cast->base.location);
1419
1420 // Dump the name field
1421 pm_buffer_append_byte(buffer, ',');
1422 pm_buffer_append_string(buffer, "\"name\":", 7);
1423 pm_dump_json_constant(buffer, parser, cast->name);
1424
1425 // Dump the name_loc field
1426 pm_buffer_append_byte(buffer, ',');
1427 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1428 pm_dump_json_location(buffer, &cast->name_loc);
1429
1430 // Dump the operator_loc field
1431 pm_buffer_append_byte(buffer, ',');
1432 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1433 pm_dump_json_location(buffer, &cast->operator_loc);
1434
1435 // Dump the value field
1436 pm_buffer_append_byte(buffer, ',');
1437 pm_buffer_append_string(buffer, "\"value\":", 8);
1438 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1439
1440 pm_buffer_append_byte(buffer, '}');
1441 break;
1442 }
1443 case PM_CONSTANT_OPERATOR_WRITE_NODE: {
1444 pm_buffer_append_string(buffer, "{\"type\":\"ConstantOperatorWriteNode\",\"location\":", 47);
1445
1447 pm_dump_json_location(buffer, &cast->base.location);
1448
1449 // Dump the name field
1450 pm_buffer_append_byte(buffer, ',');
1451 pm_buffer_append_string(buffer, "\"name\":", 7);
1452 pm_dump_json_constant(buffer, parser, cast->name);
1453
1454 // Dump the name_loc field
1455 pm_buffer_append_byte(buffer, ',');
1456 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1457 pm_dump_json_location(buffer, &cast->name_loc);
1458
1459 // Dump the binary_operator_loc field
1460 pm_buffer_append_byte(buffer, ',');
1461 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
1462 pm_dump_json_location(buffer, &cast->binary_operator_loc);
1463
1464 // Dump the value field
1465 pm_buffer_append_byte(buffer, ',');
1466 pm_buffer_append_string(buffer, "\"value\":", 8);
1467 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1468
1469 // Dump the binary_operator field
1470 pm_buffer_append_byte(buffer, ',');
1471 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
1472 pm_dump_json_constant(buffer, parser, cast->binary_operator);
1473
1474 pm_buffer_append_byte(buffer, '}');
1475 break;
1476 }
1477 case PM_CONSTANT_OR_WRITE_NODE: {
1478 pm_buffer_append_string(buffer, "{\"type\":\"ConstantOrWriteNode\",\"location\":", 41);
1479
1480 const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node;
1481 pm_dump_json_location(buffer, &cast->base.location);
1482
1483 // Dump the name field
1484 pm_buffer_append_byte(buffer, ',');
1485 pm_buffer_append_string(buffer, "\"name\":", 7);
1486 pm_dump_json_constant(buffer, parser, cast->name);
1487
1488 // Dump the name_loc field
1489 pm_buffer_append_byte(buffer, ',');
1490 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1491 pm_dump_json_location(buffer, &cast->name_loc);
1492
1493 // Dump the operator_loc field
1494 pm_buffer_append_byte(buffer, ',');
1495 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1496 pm_dump_json_location(buffer, &cast->operator_loc);
1497
1498 // Dump the value field
1499 pm_buffer_append_byte(buffer, ',');
1500 pm_buffer_append_string(buffer, "\"value\":", 8);
1501 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1502
1503 pm_buffer_append_byte(buffer, '}');
1504 break;
1505 }
1506 case PM_CONSTANT_PATH_AND_WRITE_NODE: {
1507 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathAndWriteNode\",\"location\":", 46);
1508
1510 pm_dump_json_location(buffer, &cast->base.location);
1511
1512 // Dump the target field
1513 pm_buffer_append_byte(buffer, ',');
1514 pm_buffer_append_string(buffer, "\"target\":", 9);
1515 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
1516
1517 // Dump the operator_loc field
1518 pm_buffer_append_byte(buffer, ',');
1519 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1520 pm_dump_json_location(buffer, &cast->operator_loc);
1521
1522 // Dump the value field
1523 pm_buffer_append_byte(buffer, ',');
1524 pm_buffer_append_string(buffer, "\"value\":", 8);
1525 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1526
1527 pm_buffer_append_byte(buffer, '}');
1528 break;
1529 }
1530 case PM_CONSTANT_PATH_NODE: {
1531 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathNode\",\"location\":", 38);
1532
1533 const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node;
1534 pm_dump_json_location(buffer, &cast->base.location);
1535
1536 // Dump the parent field
1537 pm_buffer_append_byte(buffer, ',');
1538 pm_buffer_append_string(buffer, "\"parent\":", 9);
1539 if (cast->parent != NULL) {
1540 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent);
1541 } else {
1542 pm_buffer_append_string(buffer, "null", 4);
1543 }
1544
1545 // Dump the name field
1546 pm_buffer_append_byte(buffer, ',');
1547 pm_buffer_append_string(buffer, "\"name\":", 7);
1548 if (cast->name != PM_CONSTANT_ID_UNSET) {
1549 pm_dump_json_constant(buffer, parser, cast->name);
1550 } else {
1551 pm_buffer_append_string(buffer, "null", 4);
1552 }
1553
1554 // Dump the delimiter_loc field
1555 pm_buffer_append_byte(buffer, ',');
1556 pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16);
1557 pm_dump_json_location(buffer, &cast->delimiter_loc);
1558
1559 // Dump the name_loc field
1560 pm_buffer_append_byte(buffer, ',');
1561 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1562 pm_dump_json_location(buffer, &cast->name_loc);
1563
1564 pm_buffer_append_byte(buffer, '}');
1565 break;
1566 }
1567 case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
1568 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOperatorWriteNode\",\"location\":", 51);
1569
1571 pm_dump_json_location(buffer, &cast->base.location);
1572
1573 // Dump the target field
1574 pm_buffer_append_byte(buffer, ',');
1575 pm_buffer_append_string(buffer, "\"target\":", 9);
1576 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
1577
1578 // Dump the binary_operator_loc field
1579 pm_buffer_append_byte(buffer, ',');
1580 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
1581 pm_dump_json_location(buffer, &cast->binary_operator_loc);
1582
1583 // Dump the value field
1584 pm_buffer_append_byte(buffer, ',');
1585 pm_buffer_append_string(buffer, "\"value\":", 8);
1586 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1587
1588 // Dump the binary_operator field
1589 pm_buffer_append_byte(buffer, ',');
1590 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
1591 pm_dump_json_constant(buffer, parser, cast->binary_operator);
1592
1593 pm_buffer_append_byte(buffer, '}');
1594 break;
1595 }
1596 case PM_CONSTANT_PATH_OR_WRITE_NODE: {
1597 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathOrWriteNode\",\"location\":", 45);
1598
1600 pm_dump_json_location(buffer, &cast->base.location);
1601
1602 // Dump the target field
1603 pm_buffer_append_byte(buffer, ',');
1604 pm_buffer_append_string(buffer, "\"target\":", 9);
1605 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
1606
1607 // Dump the operator_loc field
1608 pm_buffer_append_byte(buffer, ',');
1609 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1610 pm_dump_json_location(buffer, &cast->operator_loc);
1611
1612 // Dump the value field
1613 pm_buffer_append_byte(buffer, ',');
1614 pm_buffer_append_string(buffer, "\"value\":", 8);
1615 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1616
1617 pm_buffer_append_byte(buffer, '}');
1618 break;
1619 }
1620 case PM_CONSTANT_PATH_TARGET_NODE: {
1621 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathTargetNode\",\"location\":", 44);
1622
1624 pm_dump_json_location(buffer, &cast->base.location);
1625
1626 // Dump the parent field
1627 pm_buffer_append_byte(buffer, ',');
1628 pm_buffer_append_string(buffer, "\"parent\":", 9);
1629 if (cast->parent != NULL) {
1630 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parent);
1631 } else {
1632 pm_buffer_append_string(buffer, "null", 4);
1633 }
1634
1635 // Dump the name field
1636 pm_buffer_append_byte(buffer, ',');
1637 pm_buffer_append_string(buffer, "\"name\":", 7);
1638 if (cast->name != PM_CONSTANT_ID_UNSET) {
1639 pm_dump_json_constant(buffer, parser, cast->name);
1640 } else {
1641 pm_buffer_append_string(buffer, "null", 4);
1642 }
1643
1644 // Dump the delimiter_loc field
1645 pm_buffer_append_byte(buffer, ',');
1646 pm_buffer_append_string(buffer, "\"delimiter_loc\":", 16);
1647 pm_dump_json_location(buffer, &cast->delimiter_loc);
1648
1649 // Dump the name_loc field
1650 pm_buffer_append_byte(buffer, ',');
1651 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1652 pm_dump_json_location(buffer, &cast->name_loc);
1653
1654 pm_buffer_append_byte(buffer, '}');
1655 break;
1656 }
1657 case PM_CONSTANT_PATH_WRITE_NODE: {
1658 pm_buffer_append_string(buffer, "{\"type\":\"ConstantPathWriteNode\",\"location\":", 43);
1659
1661 pm_dump_json_location(buffer, &cast->base.location);
1662
1663 // Dump the target field
1664 pm_buffer_append_byte(buffer, ',');
1665 pm_buffer_append_string(buffer, "\"target\":", 9);
1666 pm_dump_json(buffer, parser, (const pm_node_t *) cast->target);
1667
1668 // Dump the operator_loc field
1669 pm_buffer_append_byte(buffer, ',');
1670 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1671 pm_dump_json_location(buffer, &cast->operator_loc);
1672
1673 // Dump the value field
1674 pm_buffer_append_byte(buffer, ',');
1675 pm_buffer_append_string(buffer, "\"value\":", 8);
1676 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1677
1678 pm_buffer_append_byte(buffer, '}');
1679 break;
1680 }
1681 case PM_CONSTANT_READ_NODE: {
1682 pm_buffer_append_string(buffer, "{\"type\":\"ConstantReadNode\",\"location\":", 38);
1683
1684 const pm_constant_read_node_t *cast = (const pm_constant_read_node_t *) node;
1685 pm_dump_json_location(buffer, &cast->base.location);
1686
1687 // Dump the name field
1688 pm_buffer_append_byte(buffer, ',');
1689 pm_buffer_append_string(buffer, "\"name\":", 7);
1690 pm_dump_json_constant(buffer, parser, cast->name);
1691
1692 pm_buffer_append_byte(buffer, '}');
1693 break;
1694 }
1695 case PM_CONSTANT_TARGET_NODE: {
1696 pm_buffer_append_string(buffer, "{\"type\":\"ConstantTargetNode\",\"location\":", 40);
1697
1698 const pm_constant_target_node_t *cast = (const pm_constant_target_node_t *) node;
1699 pm_dump_json_location(buffer, &cast->base.location);
1700
1701 // Dump the name field
1702 pm_buffer_append_byte(buffer, ',');
1703 pm_buffer_append_string(buffer, "\"name\":", 7);
1704 pm_dump_json_constant(buffer, parser, cast->name);
1705
1706 pm_buffer_append_byte(buffer, '}');
1707 break;
1708 }
1709 case PM_CONSTANT_WRITE_NODE: {
1710 pm_buffer_append_string(buffer, "{\"type\":\"ConstantWriteNode\",\"location\":", 39);
1711
1712 const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node;
1713 pm_dump_json_location(buffer, &cast->base.location);
1714
1715 // Dump the name field
1716 pm_buffer_append_byte(buffer, ',');
1717 pm_buffer_append_string(buffer, "\"name\":", 7);
1718 pm_dump_json_constant(buffer, parser, cast->name);
1719
1720 // Dump the name_loc field
1721 pm_buffer_append_byte(buffer, ',');
1722 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1723 pm_dump_json_location(buffer, &cast->name_loc);
1724
1725 // Dump the value field
1726 pm_buffer_append_byte(buffer, ',');
1727 pm_buffer_append_string(buffer, "\"value\":", 8);
1728 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1729
1730 // Dump the operator_loc field
1731 pm_buffer_append_byte(buffer, ',');
1732 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1733 pm_dump_json_location(buffer, &cast->operator_loc);
1734
1735 pm_buffer_append_byte(buffer, '}');
1736 break;
1737 }
1738 case PM_DEF_NODE: {
1739 pm_buffer_append_string(buffer, "{\"type\":\"DefNode\",\"location\":", 29);
1740
1741 const pm_def_node_t *cast = (const pm_def_node_t *) node;
1742 pm_dump_json_location(buffer, &cast->base.location);
1743
1744 // Dump the name field
1745 pm_buffer_append_byte(buffer, ',');
1746 pm_buffer_append_string(buffer, "\"name\":", 7);
1747 pm_dump_json_constant(buffer, parser, cast->name);
1748
1749 // Dump the name_loc field
1750 pm_buffer_append_byte(buffer, ',');
1751 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
1752 pm_dump_json_location(buffer, &cast->name_loc);
1753
1754 // Dump the receiver field
1755 pm_buffer_append_byte(buffer, ',');
1756 pm_buffer_append_string(buffer, "\"receiver\":", 11);
1757 if (cast->receiver != NULL) {
1758 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
1759 } else {
1760 pm_buffer_append_string(buffer, "null", 4);
1761 }
1762
1763 // Dump the parameters field
1764 pm_buffer_append_byte(buffer, ',');
1765 pm_buffer_append_string(buffer, "\"parameters\":", 13);
1766 if (cast->parameters != NULL) {
1767 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
1768 } else {
1769 pm_buffer_append_string(buffer, "null", 4);
1770 }
1771
1772 // Dump the body field
1773 pm_buffer_append_byte(buffer, ',');
1774 pm_buffer_append_string(buffer, "\"body\":", 7);
1775 if (cast->body != NULL) {
1776 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
1777 } else {
1778 pm_buffer_append_string(buffer, "null", 4);
1779 }
1780
1781 // Dump the locals field
1782 pm_buffer_append_byte(buffer, ',');
1783 pm_buffer_append_string(buffer, "\"locals\":", 9);
1784 const pm_constant_id_list_t *locals = &cast->locals;
1785 pm_buffer_append_byte(buffer, '[');
1786
1787 for (size_t index = 0; index < locals->size; index++) {
1788 if (index != 0) pm_buffer_append_byte(buffer, ',');
1789 pm_dump_json_constant(buffer, parser, locals->ids[index]);
1790 }
1791 pm_buffer_append_byte(buffer, ']');
1792
1793 // Dump the def_keyword_loc field
1794 pm_buffer_append_byte(buffer, ',');
1795 pm_buffer_append_string(buffer, "\"def_keyword_loc\":", 18);
1796 pm_dump_json_location(buffer, &cast->def_keyword_loc);
1797
1798 // Dump the operator_loc field
1799 pm_buffer_append_byte(buffer, ',');
1800 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1801 if (cast->operator_loc.length != 0) {
1802 pm_dump_json_location(buffer, &cast->operator_loc);
1803 } else {
1804 pm_buffer_append_string(buffer, "null", 4);
1805 }
1806
1807 // Dump the lparen_loc field
1808 pm_buffer_append_byte(buffer, ',');
1809 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
1810 if (cast->lparen_loc.length != 0) {
1811 pm_dump_json_location(buffer, &cast->lparen_loc);
1812 } else {
1813 pm_buffer_append_string(buffer, "null", 4);
1814 }
1815
1816 // Dump the rparen_loc field
1817 pm_buffer_append_byte(buffer, ',');
1818 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
1819 if (cast->rparen_loc.length != 0) {
1820 pm_dump_json_location(buffer, &cast->rparen_loc);
1821 } else {
1822 pm_buffer_append_string(buffer, "null", 4);
1823 }
1824
1825 // Dump the equal_loc field
1826 pm_buffer_append_byte(buffer, ',');
1827 pm_buffer_append_string(buffer, "\"equal_loc\":", 12);
1828 if (cast->equal_loc.length != 0) {
1829 pm_dump_json_location(buffer, &cast->equal_loc);
1830 } else {
1831 pm_buffer_append_string(buffer, "null", 4);
1832 }
1833
1834 // Dump the end_keyword_loc field
1835 pm_buffer_append_byte(buffer, ',');
1836 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
1837 if (cast->end_keyword_loc.length != 0) {
1838 pm_dump_json_location(buffer, &cast->end_keyword_loc);
1839 } else {
1840 pm_buffer_append_string(buffer, "null", 4);
1841 }
1842
1843 pm_buffer_append_byte(buffer, '}');
1844 break;
1845 }
1846 case PM_DEFINED_NODE: {
1847 pm_buffer_append_string(buffer, "{\"type\":\"DefinedNode\",\"location\":", 33);
1848
1849 const pm_defined_node_t *cast = (const pm_defined_node_t *) node;
1850 pm_dump_json_location(buffer, &cast->base.location);
1851
1852 // Dump the lparen_loc field
1853 pm_buffer_append_byte(buffer, ',');
1854 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
1855 if (cast->lparen_loc.length != 0) {
1856 pm_dump_json_location(buffer, &cast->lparen_loc);
1857 } else {
1858 pm_buffer_append_string(buffer, "null", 4);
1859 }
1860
1861 // Dump the value field
1862 pm_buffer_append_byte(buffer, ',');
1863 pm_buffer_append_string(buffer, "\"value\":", 8);
1864 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
1865
1866 // Dump the rparen_loc field
1867 pm_buffer_append_byte(buffer, ',');
1868 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
1869 if (cast->rparen_loc.length != 0) {
1870 pm_dump_json_location(buffer, &cast->rparen_loc);
1871 } else {
1872 pm_buffer_append_string(buffer, "null", 4);
1873 }
1874
1875 // Dump the keyword_loc field
1876 pm_buffer_append_byte(buffer, ',');
1877 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
1878 pm_dump_json_location(buffer, &cast->keyword_loc);
1879
1880 pm_buffer_append_byte(buffer, '}');
1881 break;
1882 }
1883 case PM_ELSE_NODE: {
1884 pm_buffer_append_string(buffer, "{\"type\":\"ElseNode\",\"location\":", 30);
1885
1886 const pm_else_node_t *cast = (const pm_else_node_t *) node;
1887 pm_dump_json_location(buffer, &cast->base.location);
1888
1889 // Dump the else_keyword_loc field
1890 pm_buffer_append_byte(buffer, ',');
1891 pm_buffer_append_string(buffer, "\"else_keyword_loc\":", 19);
1892 pm_dump_json_location(buffer, &cast->else_keyword_loc);
1893
1894 // Dump the statements field
1895 pm_buffer_append_byte(buffer, ',');
1896 pm_buffer_append_string(buffer, "\"statements\":", 13);
1897 if (cast->statements != NULL) {
1898 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
1899 } else {
1900 pm_buffer_append_string(buffer, "null", 4);
1901 }
1902
1903 // Dump the end_keyword_loc field
1904 pm_buffer_append_byte(buffer, ',');
1905 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
1906 if (cast->end_keyword_loc.length != 0) {
1907 pm_dump_json_location(buffer, &cast->end_keyword_loc);
1908 } else {
1909 pm_buffer_append_string(buffer, "null", 4);
1910 }
1911
1912 pm_buffer_append_byte(buffer, '}');
1913 break;
1914 }
1915 case PM_EMBEDDED_STATEMENTS_NODE: {
1916 pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedStatementsNode\",\"location\":", 44);
1917
1919 pm_dump_json_location(buffer, &cast->base.location);
1920
1921 // Dump the opening_loc field
1922 pm_buffer_append_byte(buffer, ',');
1923 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
1924 pm_dump_json_location(buffer, &cast->opening_loc);
1925
1926 // Dump the statements field
1927 pm_buffer_append_byte(buffer, ',');
1928 pm_buffer_append_string(buffer, "\"statements\":", 13);
1929 if (cast->statements != NULL) {
1930 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
1931 } else {
1932 pm_buffer_append_string(buffer, "null", 4);
1933 }
1934
1935 // Dump the closing_loc field
1936 pm_buffer_append_byte(buffer, ',');
1937 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
1938 pm_dump_json_location(buffer, &cast->closing_loc);
1939
1940 pm_buffer_append_byte(buffer, '}');
1941 break;
1942 }
1943 case PM_EMBEDDED_VARIABLE_NODE: {
1944 pm_buffer_append_string(buffer, "{\"type\":\"EmbeddedVariableNode\",\"location\":", 42);
1945
1946 const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node;
1947 pm_dump_json_location(buffer, &cast->base.location);
1948
1949 // Dump the operator_loc field
1950 pm_buffer_append_byte(buffer, ',');
1951 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
1952 pm_dump_json_location(buffer, &cast->operator_loc);
1953
1954 // Dump the variable field
1955 pm_buffer_append_byte(buffer, ',');
1956 pm_buffer_append_string(buffer, "\"variable\":", 11);
1957 pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable);
1958
1959 pm_buffer_append_byte(buffer, '}');
1960 break;
1961 }
1962 case PM_ENSURE_NODE: {
1963 pm_buffer_append_string(buffer, "{\"type\":\"EnsureNode\",\"location\":", 32);
1964
1965 const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
1966 pm_dump_json_location(buffer, &cast->base.location);
1967
1968 // Dump the ensure_keyword_loc field
1969 pm_buffer_append_byte(buffer, ',');
1970 pm_buffer_append_string(buffer, "\"ensure_keyword_loc\":", 21);
1971 pm_dump_json_location(buffer, &cast->ensure_keyword_loc);
1972
1973 // Dump the statements field
1974 pm_buffer_append_byte(buffer, ',');
1975 pm_buffer_append_string(buffer, "\"statements\":", 13);
1976 if (cast->statements != NULL) {
1977 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
1978 } else {
1979 pm_buffer_append_string(buffer, "null", 4);
1980 }
1981
1982 // Dump the end_keyword_loc field
1983 pm_buffer_append_byte(buffer, ',');
1984 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
1985 pm_dump_json_location(buffer, &cast->end_keyword_loc);
1986
1987 pm_buffer_append_byte(buffer, '}');
1988 break;
1989 }
1990 case PM_ERROR_RECOVERY_NODE: {
1991 pm_buffer_append_string(buffer, "{\"type\":\"ErrorRecoveryNode\",\"location\":", 39);
1992
1993 const pm_error_recovery_node_t *cast = (const pm_error_recovery_node_t *) node;
1994 pm_dump_json_location(buffer, &cast->base.location);
1995
1996 // Dump the unexpected field
1997 pm_buffer_append_byte(buffer, ',');
1998 pm_buffer_append_string(buffer, "\"unexpected\":", 13);
1999 if (cast->unexpected != NULL) {
2000 pm_dump_json(buffer, parser, (const pm_node_t *) cast->unexpected);
2001 } else {
2002 pm_buffer_append_string(buffer, "null", 4);
2003 }
2004
2005 pm_buffer_append_byte(buffer, '}');
2006 break;
2007 }
2008 case PM_FALSE_NODE: {
2009 pm_buffer_append_string(buffer, "{\"type\":\"FalseNode\",\"location\":", 31);
2010
2011 const pm_false_node_t *cast = (const pm_false_node_t *) node;
2012 pm_dump_json_location(buffer, &cast->base.location);
2013
2014 pm_buffer_append_byte(buffer, '}');
2015 break;
2016 }
2017 case PM_FIND_PATTERN_NODE: {
2018 pm_buffer_append_string(buffer, "{\"type\":\"FindPatternNode\",\"location\":", 37);
2019
2020 const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node;
2021 pm_dump_json_location(buffer, &cast->base.location);
2022
2023 // Dump the constant field
2024 pm_buffer_append_byte(buffer, ',');
2025 pm_buffer_append_string(buffer, "\"constant\":", 11);
2026 if (cast->constant != NULL) {
2027 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
2028 } else {
2029 pm_buffer_append_string(buffer, "null", 4);
2030 }
2031
2032 // Dump the left field
2033 pm_buffer_append_byte(buffer, ',');
2034 pm_buffer_append_string(buffer, "\"left\":", 7);
2035 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
2036
2037 // Dump the requireds field
2038 pm_buffer_append_byte(buffer, ',');
2039 pm_buffer_append_string(buffer, "\"requireds\":", 12);
2040 const pm_node_list_t *requireds = &cast->requireds;
2041 pm_buffer_append_byte(buffer, '[');
2042
2043 for (size_t index = 0; index < requireds->size; index++) {
2044 if (index != 0) pm_buffer_append_byte(buffer, ',');
2045 pm_dump_json(buffer, parser, requireds->nodes[index]);
2046 }
2047 pm_buffer_append_byte(buffer, ']');
2048
2049 // Dump the right field
2050 pm_buffer_append_byte(buffer, ',');
2051 pm_buffer_append_string(buffer, "\"right\":", 8);
2052 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
2053
2054 // Dump the opening_loc field
2055 pm_buffer_append_byte(buffer, ',');
2056 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2057 if (cast->opening_loc.length != 0) {
2058 pm_dump_json_location(buffer, &cast->opening_loc);
2059 } else {
2060 pm_buffer_append_string(buffer, "null", 4);
2061 }
2062
2063 // Dump the closing_loc field
2064 pm_buffer_append_byte(buffer, ',');
2065 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2066 if (cast->closing_loc.length != 0) {
2067 pm_dump_json_location(buffer, &cast->closing_loc);
2068 } else {
2069 pm_buffer_append_string(buffer, "null", 4);
2070 }
2071
2072 pm_buffer_append_byte(buffer, '}');
2073 break;
2074 }
2075 case PM_FLIP_FLOP_NODE: {
2076 pm_buffer_append_string(buffer, "{\"type\":\"FlipFlopNode\",\"location\":", 34);
2077
2078 const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node;
2079 pm_dump_json_location(buffer, &cast->base.location);
2080
2081 // Dump the RangeFlags field
2082 pm_buffer_append_byte(buffer, ',');
2083 pm_buffer_append_string(buffer, "\"flags\":", 8);
2084 size_t flags = 0;
2085 pm_buffer_append_byte(buffer, '[');
2086 if (PM_NODE_FLAG_P(cast, PM_RANGE_FLAGS_EXCLUDE_END)) {
2087 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2088 pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13);
2089 flags++;
2090 }
2091 pm_buffer_append_byte(buffer, ']');
2092
2093 // Dump the left field
2094 pm_buffer_append_byte(buffer, ',');
2095 pm_buffer_append_string(buffer, "\"left\":", 7);
2096 if (cast->left != NULL) {
2097 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
2098 } else {
2099 pm_buffer_append_string(buffer, "null", 4);
2100 }
2101
2102 // Dump the right field
2103 pm_buffer_append_byte(buffer, ',');
2104 pm_buffer_append_string(buffer, "\"right\":", 8);
2105 if (cast->right != NULL) {
2106 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
2107 } else {
2108 pm_buffer_append_string(buffer, "null", 4);
2109 }
2110
2111 // Dump the operator_loc field
2112 pm_buffer_append_byte(buffer, ',');
2113 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2114 pm_dump_json_location(buffer, &cast->operator_loc);
2115
2116 pm_buffer_append_byte(buffer, '}');
2117 break;
2118 }
2119 case PM_FLOAT_NODE: {
2120 pm_buffer_append_string(buffer, "{\"type\":\"FloatNode\",\"location\":", 31);
2121
2122 const pm_float_node_t *cast = (const pm_float_node_t *) node;
2123 pm_dump_json_location(buffer, &cast->base.location);
2124
2125 // Dump the value field
2126 pm_buffer_append_byte(buffer, ',');
2127 pm_buffer_append_string(buffer, "\"value\":", 8);
2128 pm_buffer_append_format(buffer, "%f", cast->value);
2129
2130 pm_buffer_append_byte(buffer, '}');
2131 break;
2132 }
2133 case PM_FOR_NODE: {
2134 pm_buffer_append_string(buffer, "{\"type\":\"ForNode\",\"location\":", 29);
2135
2136 const pm_for_node_t *cast = (const pm_for_node_t *) node;
2137 pm_dump_json_location(buffer, &cast->base.location);
2138
2139 // Dump the index field
2140 pm_buffer_append_byte(buffer, ',');
2141 pm_buffer_append_string(buffer, "\"index\":", 8);
2142 pm_dump_json(buffer, parser, (const pm_node_t *) cast->index);
2143
2144 // Dump the collection field
2145 pm_buffer_append_byte(buffer, ',');
2146 pm_buffer_append_string(buffer, "\"collection\":", 13);
2147 pm_dump_json(buffer, parser, (const pm_node_t *) cast->collection);
2148
2149 // Dump the statements field
2150 pm_buffer_append_byte(buffer, ',');
2151 pm_buffer_append_string(buffer, "\"statements\":", 13);
2152 if (cast->statements != NULL) {
2153 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
2154 } else {
2155 pm_buffer_append_string(buffer, "null", 4);
2156 }
2157
2158 // Dump the for_keyword_loc field
2159 pm_buffer_append_byte(buffer, ',');
2160 pm_buffer_append_string(buffer, "\"for_keyword_loc\":", 18);
2161 pm_dump_json_location(buffer, &cast->for_keyword_loc);
2162
2163 // Dump the in_keyword_loc field
2164 pm_buffer_append_byte(buffer, ',');
2165 pm_buffer_append_string(buffer, "\"in_keyword_loc\":", 17);
2166 pm_dump_json_location(buffer, &cast->in_keyword_loc);
2167
2168 // Dump the do_keyword_loc field
2169 pm_buffer_append_byte(buffer, ',');
2170 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
2171 if (cast->do_keyword_loc.length != 0) {
2172 pm_dump_json_location(buffer, &cast->do_keyword_loc);
2173 } else {
2174 pm_buffer_append_string(buffer, "null", 4);
2175 }
2176
2177 // Dump the end_keyword_loc field
2178 pm_buffer_append_byte(buffer, ',');
2179 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
2180 pm_dump_json_location(buffer, &cast->end_keyword_loc);
2181
2182 pm_buffer_append_byte(buffer, '}');
2183 break;
2184 }
2185 case PM_FORWARDING_ARGUMENTS_NODE: {
2186 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingArgumentsNode\",\"location\":", 45);
2187
2189 pm_dump_json_location(buffer, &cast->base.location);
2190
2191 pm_buffer_append_byte(buffer, '}');
2192 break;
2193 }
2194 case PM_FORWARDING_PARAMETER_NODE: {
2195 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingParameterNode\",\"location\":", 45);
2196
2198 pm_dump_json_location(buffer, &cast->base.location);
2199
2200 pm_buffer_append_byte(buffer, '}');
2201 break;
2202 }
2203 case PM_FORWARDING_SUPER_NODE: {
2204 pm_buffer_append_string(buffer, "{\"type\":\"ForwardingSuperNode\",\"location\":", 41);
2205
2206 const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node;
2207 pm_dump_json_location(buffer, &cast->base.location);
2208
2209 // Dump the keyword_loc field
2210 pm_buffer_append_byte(buffer, ',');
2211 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
2212 pm_dump_json_location(buffer, &cast->keyword_loc);
2213
2214 // Dump the block field
2215 pm_buffer_append_byte(buffer, ',');
2216 pm_buffer_append_string(buffer, "\"block\":", 8);
2217 if (cast->block != NULL) {
2218 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
2219 } else {
2220 pm_buffer_append_string(buffer, "null", 4);
2221 }
2222
2223 pm_buffer_append_byte(buffer, '}');
2224 break;
2225 }
2226 case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: {
2227 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableAndWriteNode\",\"location\":", 48);
2228
2230 pm_dump_json_location(buffer, &cast->base.location);
2231
2232 // Dump the name field
2233 pm_buffer_append_byte(buffer, ',');
2234 pm_buffer_append_string(buffer, "\"name\":", 7);
2235 pm_dump_json_constant(buffer, parser, cast->name);
2236
2237 // Dump the name_loc field
2238 pm_buffer_append_byte(buffer, ',');
2239 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
2240 pm_dump_json_location(buffer, &cast->name_loc);
2241
2242 // Dump the operator_loc field
2243 pm_buffer_append_byte(buffer, ',');
2244 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2245 pm_dump_json_location(buffer, &cast->operator_loc);
2246
2247 // Dump the value field
2248 pm_buffer_append_byte(buffer, ',');
2249 pm_buffer_append_string(buffer, "\"value\":", 8);
2250 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2251
2252 pm_buffer_append_byte(buffer, '}');
2253 break;
2254 }
2255 case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
2256 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOperatorWriteNode\",\"location\":", 53);
2257
2259 pm_dump_json_location(buffer, &cast->base.location);
2260
2261 // Dump the name field
2262 pm_buffer_append_byte(buffer, ',');
2263 pm_buffer_append_string(buffer, "\"name\":", 7);
2264 pm_dump_json_constant(buffer, parser, cast->name);
2265
2266 // Dump the name_loc field
2267 pm_buffer_append_byte(buffer, ',');
2268 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
2269 pm_dump_json_location(buffer, &cast->name_loc);
2270
2271 // Dump the binary_operator_loc field
2272 pm_buffer_append_byte(buffer, ',');
2273 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
2274 pm_dump_json_location(buffer, &cast->binary_operator_loc);
2275
2276 // Dump the value field
2277 pm_buffer_append_byte(buffer, ',');
2278 pm_buffer_append_string(buffer, "\"value\":", 8);
2279 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2280
2281 // Dump the binary_operator field
2282 pm_buffer_append_byte(buffer, ',');
2283 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
2284 pm_dump_json_constant(buffer, parser, cast->binary_operator);
2285
2286 pm_buffer_append_byte(buffer, '}');
2287 break;
2288 }
2289 case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
2290 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableOrWriteNode\",\"location\":", 47);
2291
2293 pm_dump_json_location(buffer, &cast->base.location);
2294
2295 // Dump the name field
2296 pm_buffer_append_byte(buffer, ',');
2297 pm_buffer_append_string(buffer, "\"name\":", 7);
2298 pm_dump_json_constant(buffer, parser, cast->name);
2299
2300 // Dump the name_loc field
2301 pm_buffer_append_byte(buffer, ',');
2302 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
2303 pm_dump_json_location(buffer, &cast->name_loc);
2304
2305 // Dump the operator_loc field
2306 pm_buffer_append_byte(buffer, ',');
2307 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2308 pm_dump_json_location(buffer, &cast->operator_loc);
2309
2310 // Dump the value field
2311 pm_buffer_append_byte(buffer, ',');
2312 pm_buffer_append_string(buffer, "\"value\":", 8);
2313 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2314
2315 pm_buffer_append_byte(buffer, '}');
2316 break;
2317 }
2318 case PM_GLOBAL_VARIABLE_READ_NODE: {
2319 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableReadNode\",\"location\":", 44);
2320
2322 pm_dump_json_location(buffer, &cast->base.location);
2323
2324 // Dump the name field
2325 pm_buffer_append_byte(buffer, ',');
2326 pm_buffer_append_string(buffer, "\"name\":", 7);
2327 pm_dump_json_constant(buffer, parser, cast->name);
2328
2329 pm_buffer_append_byte(buffer, '}');
2330 break;
2331 }
2332 case PM_GLOBAL_VARIABLE_TARGET_NODE: {
2333 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableTargetNode\",\"location\":", 46);
2334
2336 pm_dump_json_location(buffer, &cast->base.location);
2337
2338 // Dump the name field
2339 pm_buffer_append_byte(buffer, ',');
2340 pm_buffer_append_string(buffer, "\"name\":", 7);
2341 pm_dump_json_constant(buffer, parser, cast->name);
2342
2343 pm_buffer_append_byte(buffer, '}');
2344 break;
2345 }
2346 case PM_GLOBAL_VARIABLE_WRITE_NODE: {
2347 pm_buffer_append_string(buffer, "{\"type\":\"GlobalVariableWriteNode\",\"location\":", 45);
2348
2350 pm_dump_json_location(buffer, &cast->base.location);
2351
2352 // Dump the name field
2353 pm_buffer_append_byte(buffer, ',');
2354 pm_buffer_append_string(buffer, "\"name\":", 7);
2355 pm_dump_json_constant(buffer, parser, cast->name);
2356
2357 // Dump the name_loc field
2358 pm_buffer_append_byte(buffer, ',');
2359 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
2360 pm_dump_json_location(buffer, &cast->name_loc);
2361
2362 // Dump the value field
2363 pm_buffer_append_byte(buffer, ',');
2364 pm_buffer_append_string(buffer, "\"value\":", 8);
2365 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2366
2367 // Dump the operator_loc field
2368 pm_buffer_append_byte(buffer, ',');
2369 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2370 pm_dump_json_location(buffer, &cast->operator_loc);
2371
2372 pm_buffer_append_byte(buffer, '}');
2373 break;
2374 }
2375 case PM_HASH_NODE: {
2376 pm_buffer_append_string(buffer, "{\"type\":\"HashNode\",\"location\":", 30);
2377
2378 const pm_hash_node_t *cast = (const pm_hash_node_t *) node;
2379 pm_dump_json_location(buffer, &cast->base.location);
2380
2381 // Dump the opening_loc field
2382 pm_buffer_append_byte(buffer, ',');
2383 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2384 pm_dump_json_location(buffer, &cast->opening_loc);
2385
2386 // Dump the elements field
2387 pm_buffer_append_byte(buffer, ',');
2388 pm_buffer_append_string(buffer, "\"elements\":", 11);
2389 const pm_node_list_t *elements = &cast->elements;
2390 pm_buffer_append_byte(buffer, '[');
2391
2392 for (size_t index = 0; index < elements->size; index++) {
2393 if (index != 0) pm_buffer_append_byte(buffer, ',');
2394 pm_dump_json(buffer, parser, elements->nodes[index]);
2395 }
2396 pm_buffer_append_byte(buffer, ']');
2397
2398 // Dump the closing_loc field
2399 pm_buffer_append_byte(buffer, ',');
2400 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2401 pm_dump_json_location(buffer, &cast->closing_loc);
2402
2403 pm_buffer_append_byte(buffer, '}');
2404 break;
2405 }
2406 case PM_HASH_PATTERN_NODE: {
2407 pm_buffer_append_string(buffer, "{\"type\":\"HashPatternNode\",\"location\":", 37);
2408
2409 const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node;
2410 pm_dump_json_location(buffer, &cast->base.location);
2411
2412 // Dump the constant field
2413 pm_buffer_append_byte(buffer, ',');
2414 pm_buffer_append_string(buffer, "\"constant\":", 11);
2415 if (cast->constant != NULL) {
2416 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant);
2417 } else {
2418 pm_buffer_append_string(buffer, "null", 4);
2419 }
2420
2421 // Dump the elements field
2422 pm_buffer_append_byte(buffer, ',');
2423 pm_buffer_append_string(buffer, "\"elements\":", 11);
2424 const pm_node_list_t *elements = &cast->elements;
2425 pm_buffer_append_byte(buffer, '[');
2426
2427 for (size_t index = 0; index < elements->size; index++) {
2428 if (index != 0) pm_buffer_append_byte(buffer, ',');
2429 pm_dump_json(buffer, parser, elements->nodes[index]);
2430 }
2431 pm_buffer_append_byte(buffer, ']');
2432
2433 // Dump the rest field
2434 pm_buffer_append_byte(buffer, ',');
2435 pm_buffer_append_string(buffer, "\"rest\":", 7);
2436 if (cast->rest != NULL) {
2437 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
2438 } else {
2439 pm_buffer_append_string(buffer, "null", 4);
2440 }
2441
2442 // Dump the opening_loc field
2443 pm_buffer_append_byte(buffer, ',');
2444 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2445 if (cast->opening_loc.length != 0) {
2446 pm_dump_json_location(buffer, &cast->opening_loc);
2447 } else {
2448 pm_buffer_append_string(buffer, "null", 4);
2449 }
2450
2451 // Dump the closing_loc field
2452 pm_buffer_append_byte(buffer, ',');
2453 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2454 if (cast->closing_loc.length != 0) {
2455 pm_dump_json_location(buffer, &cast->closing_loc);
2456 } else {
2457 pm_buffer_append_string(buffer, "null", 4);
2458 }
2459
2460 pm_buffer_append_byte(buffer, '}');
2461 break;
2462 }
2463 case PM_IF_NODE: {
2464 pm_buffer_append_string(buffer, "{\"type\":\"IfNode\",\"location\":", 28);
2465
2466 const pm_if_node_t *cast = (const pm_if_node_t *) node;
2467 pm_dump_json_location(buffer, &cast->base.location);
2468
2469 // Dump the if_keyword_loc field
2470 pm_buffer_append_byte(buffer, ',');
2471 pm_buffer_append_string(buffer, "\"if_keyword_loc\":", 17);
2472 if (cast->if_keyword_loc.length != 0) {
2473 pm_dump_json_location(buffer, &cast->if_keyword_loc);
2474 } else {
2475 pm_buffer_append_string(buffer, "null", 4);
2476 }
2477
2478 // Dump the predicate field
2479 pm_buffer_append_byte(buffer, ',');
2480 pm_buffer_append_string(buffer, "\"predicate\":", 12);
2481 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
2482
2483 // Dump the then_keyword_loc field
2484 pm_buffer_append_byte(buffer, ',');
2485 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
2486 if (cast->then_keyword_loc.length != 0) {
2487 pm_dump_json_location(buffer, &cast->then_keyword_loc);
2488 } else {
2489 pm_buffer_append_string(buffer, "null", 4);
2490 }
2491
2492 // Dump the statements field
2493 pm_buffer_append_byte(buffer, ',');
2494 pm_buffer_append_string(buffer, "\"statements\":", 13);
2495 if (cast->statements != NULL) {
2496 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
2497 } else {
2498 pm_buffer_append_string(buffer, "null", 4);
2499 }
2500
2501 // Dump the subsequent field
2502 pm_buffer_append_byte(buffer, ',');
2503 pm_buffer_append_string(buffer, "\"subsequent\":", 13);
2504 if (cast->subsequent != NULL) {
2505 pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent);
2506 } else {
2507 pm_buffer_append_string(buffer, "null", 4);
2508 }
2509
2510 // Dump the end_keyword_loc field
2511 pm_buffer_append_byte(buffer, ',');
2512 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
2513 if (cast->end_keyword_loc.length != 0) {
2514 pm_dump_json_location(buffer, &cast->end_keyword_loc);
2515 } else {
2516 pm_buffer_append_string(buffer, "null", 4);
2517 }
2518
2519 pm_buffer_append_byte(buffer, '}');
2520 break;
2521 }
2522 case PM_IMAGINARY_NODE: {
2523 pm_buffer_append_string(buffer, "{\"type\":\"ImaginaryNode\",\"location\":", 35);
2524
2525 const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node;
2526 pm_dump_json_location(buffer, &cast->base.location);
2527
2528 // Dump the numeric field
2529 pm_buffer_append_byte(buffer, ',');
2530 pm_buffer_append_string(buffer, "\"numeric\":", 10);
2531 pm_dump_json(buffer, parser, (const pm_node_t *) cast->numeric);
2532
2533 pm_buffer_append_byte(buffer, '}');
2534 break;
2535 }
2536 case PM_IMPLICIT_NODE: {
2537 pm_buffer_append_string(buffer, "{\"type\":\"ImplicitNode\",\"location\":", 34);
2538
2539 const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node;
2540 pm_dump_json_location(buffer, &cast->base.location);
2541
2542 // Dump the value field
2543 pm_buffer_append_byte(buffer, ',');
2544 pm_buffer_append_string(buffer, "\"value\":", 8);
2545 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2546
2547 pm_buffer_append_byte(buffer, '}');
2548 break;
2549 }
2550 case PM_IMPLICIT_REST_NODE: {
2551 pm_buffer_append_string(buffer, "{\"type\":\"ImplicitRestNode\",\"location\":", 38);
2552
2553 const pm_implicit_rest_node_t *cast = (const pm_implicit_rest_node_t *) node;
2554 pm_dump_json_location(buffer, &cast->base.location);
2555
2556 pm_buffer_append_byte(buffer, '}');
2557 break;
2558 }
2559 case PM_IN_NODE: {
2560 pm_buffer_append_string(buffer, "{\"type\":\"InNode\",\"location\":", 28);
2561
2562 const pm_in_node_t *cast = (const pm_in_node_t *) node;
2563 pm_dump_json_location(buffer, &cast->base.location);
2564
2565 // Dump the pattern field
2566 pm_buffer_append_byte(buffer, ',');
2567 pm_buffer_append_string(buffer, "\"pattern\":", 10);
2568 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
2569
2570 // Dump the statements field
2571 pm_buffer_append_byte(buffer, ',');
2572 pm_buffer_append_string(buffer, "\"statements\":", 13);
2573 if (cast->statements != NULL) {
2574 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
2575 } else {
2576 pm_buffer_append_string(buffer, "null", 4);
2577 }
2578
2579 // Dump the in_keyword_loc field
2580 pm_buffer_append_byte(buffer, ',');
2581 pm_buffer_append_string(buffer, "\"in_keyword_loc\":", 17);
2582 pm_dump_json_location(buffer, &cast->in_keyword_loc);
2583
2584 // Dump the then_keyword_loc field
2585 pm_buffer_append_byte(buffer, ',');
2586 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
2587 if (cast->then_keyword_loc.length != 0) {
2588 pm_dump_json_location(buffer, &cast->then_keyword_loc);
2589 } else {
2590 pm_buffer_append_string(buffer, "null", 4);
2591 }
2592
2593 pm_buffer_append_byte(buffer, '}');
2594 break;
2595 }
2596 case PM_INDEX_AND_WRITE_NODE: {
2597 pm_buffer_append_string(buffer, "{\"type\":\"IndexAndWriteNode\",\"location\":", 39);
2598
2599 const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node;
2600 pm_dump_json_location(buffer, &cast->base.location);
2601
2602 // Dump the CallNodeFlags field
2603 pm_buffer_append_byte(buffer, ',');
2604 pm_buffer_append_string(buffer, "\"flags\":", 8);
2605 size_t flags = 0;
2606 pm_buffer_append_byte(buffer, '[');
2607 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
2608 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2609 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
2610 flags++;
2611 }
2612 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
2613 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2614 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
2615 flags++;
2616 }
2617 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
2618 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2619 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
2620 flags++;
2621 }
2622 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
2623 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2624 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
2625 flags++;
2626 }
2627 pm_buffer_append_byte(buffer, ']');
2628
2629 // Dump the receiver field
2630 pm_buffer_append_byte(buffer, ',');
2631 pm_buffer_append_string(buffer, "\"receiver\":", 11);
2632 if (cast->receiver != NULL) {
2633 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
2634 } else {
2635 pm_buffer_append_string(buffer, "null", 4);
2636 }
2637
2638 // Dump the call_operator_loc field
2639 pm_buffer_append_byte(buffer, ',');
2640 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
2641 if (cast->call_operator_loc.length != 0) {
2642 pm_dump_json_location(buffer, &cast->call_operator_loc);
2643 } else {
2644 pm_buffer_append_string(buffer, "null", 4);
2645 }
2646
2647 // Dump the opening_loc field
2648 pm_buffer_append_byte(buffer, ',');
2649 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2650 pm_dump_json_location(buffer, &cast->opening_loc);
2651
2652 // Dump the arguments field
2653 pm_buffer_append_byte(buffer, ',');
2654 pm_buffer_append_string(buffer, "\"arguments\":", 12);
2655 if (cast->arguments != NULL) {
2656 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
2657 } else {
2658 pm_buffer_append_string(buffer, "null", 4);
2659 }
2660
2661 // Dump the closing_loc field
2662 pm_buffer_append_byte(buffer, ',');
2663 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2664 pm_dump_json_location(buffer, &cast->closing_loc);
2665
2666 // Dump the block field
2667 pm_buffer_append_byte(buffer, ',');
2668 pm_buffer_append_string(buffer, "\"block\":", 8);
2669 if (cast->block != NULL) {
2670 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
2671 } else {
2672 pm_buffer_append_string(buffer, "null", 4);
2673 }
2674
2675 // Dump the operator_loc field
2676 pm_buffer_append_byte(buffer, ',');
2677 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2678 pm_dump_json_location(buffer, &cast->operator_loc);
2679
2680 // Dump the value field
2681 pm_buffer_append_byte(buffer, ',');
2682 pm_buffer_append_string(buffer, "\"value\":", 8);
2683 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2684
2685 pm_buffer_append_byte(buffer, '}');
2686 break;
2687 }
2688 case PM_INDEX_OPERATOR_WRITE_NODE: {
2689 pm_buffer_append_string(buffer, "{\"type\":\"IndexOperatorWriteNode\",\"location\":", 44);
2690
2692 pm_dump_json_location(buffer, &cast->base.location);
2693
2694 // Dump the CallNodeFlags field
2695 pm_buffer_append_byte(buffer, ',');
2696 pm_buffer_append_string(buffer, "\"flags\":", 8);
2697 size_t flags = 0;
2698 pm_buffer_append_byte(buffer, '[');
2699 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
2700 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2701 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
2702 flags++;
2703 }
2704 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
2705 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2706 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
2707 flags++;
2708 }
2709 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
2710 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2711 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
2712 flags++;
2713 }
2714 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
2715 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2716 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
2717 flags++;
2718 }
2719 pm_buffer_append_byte(buffer, ']');
2720
2721 // Dump the receiver field
2722 pm_buffer_append_byte(buffer, ',');
2723 pm_buffer_append_string(buffer, "\"receiver\":", 11);
2724 if (cast->receiver != NULL) {
2725 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
2726 } else {
2727 pm_buffer_append_string(buffer, "null", 4);
2728 }
2729
2730 // Dump the call_operator_loc field
2731 pm_buffer_append_byte(buffer, ',');
2732 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
2733 if (cast->call_operator_loc.length != 0) {
2734 pm_dump_json_location(buffer, &cast->call_operator_loc);
2735 } else {
2736 pm_buffer_append_string(buffer, "null", 4);
2737 }
2738
2739 // Dump the opening_loc field
2740 pm_buffer_append_byte(buffer, ',');
2741 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2742 pm_dump_json_location(buffer, &cast->opening_loc);
2743
2744 // Dump the arguments field
2745 pm_buffer_append_byte(buffer, ',');
2746 pm_buffer_append_string(buffer, "\"arguments\":", 12);
2747 if (cast->arguments != NULL) {
2748 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
2749 } else {
2750 pm_buffer_append_string(buffer, "null", 4);
2751 }
2752
2753 // Dump the closing_loc field
2754 pm_buffer_append_byte(buffer, ',');
2755 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2756 pm_dump_json_location(buffer, &cast->closing_loc);
2757
2758 // Dump the block field
2759 pm_buffer_append_byte(buffer, ',');
2760 pm_buffer_append_string(buffer, "\"block\":", 8);
2761 if (cast->block != NULL) {
2762 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
2763 } else {
2764 pm_buffer_append_string(buffer, "null", 4);
2765 }
2766
2767 // Dump the binary_operator field
2768 pm_buffer_append_byte(buffer, ',');
2769 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
2770 pm_dump_json_constant(buffer, parser, cast->binary_operator);
2771
2772 // Dump the binary_operator_loc field
2773 pm_buffer_append_byte(buffer, ',');
2774 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
2775 pm_dump_json_location(buffer, &cast->binary_operator_loc);
2776
2777 // Dump the value field
2778 pm_buffer_append_byte(buffer, ',');
2779 pm_buffer_append_string(buffer, "\"value\":", 8);
2780 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2781
2782 pm_buffer_append_byte(buffer, '}');
2783 break;
2784 }
2785 case PM_INDEX_OR_WRITE_NODE: {
2786 pm_buffer_append_string(buffer, "{\"type\":\"IndexOrWriteNode\",\"location\":", 38);
2787
2788 const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node;
2789 pm_dump_json_location(buffer, &cast->base.location);
2790
2791 // Dump the CallNodeFlags field
2792 pm_buffer_append_byte(buffer, ',');
2793 pm_buffer_append_string(buffer, "\"flags\":", 8);
2794 size_t flags = 0;
2795 pm_buffer_append_byte(buffer, '[');
2796 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
2797 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2798 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
2799 flags++;
2800 }
2801 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
2802 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2803 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
2804 flags++;
2805 }
2806 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
2807 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2808 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
2809 flags++;
2810 }
2811 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
2812 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2813 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
2814 flags++;
2815 }
2816 pm_buffer_append_byte(buffer, ']');
2817
2818 // Dump the receiver field
2819 pm_buffer_append_byte(buffer, ',');
2820 pm_buffer_append_string(buffer, "\"receiver\":", 11);
2821 if (cast->receiver != NULL) {
2822 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
2823 } else {
2824 pm_buffer_append_string(buffer, "null", 4);
2825 }
2826
2827 // Dump the call_operator_loc field
2828 pm_buffer_append_byte(buffer, ',');
2829 pm_buffer_append_string(buffer, "\"call_operator_loc\":", 20);
2830 if (cast->call_operator_loc.length != 0) {
2831 pm_dump_json_location(buffer, &cast->call_operator_loc);
2832 } else {
2833 pm_buffer_append_string(buffer, "null", 4);
2834 }
2835
2836 // Dump the opening_loc field
2837 pm_buffer_append_byte(buffer, ',');
2838 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2839 pm_dump_json_location(buffer, &cast->opening_loc);
2840
2841 // Dump the arguments field
2842 pm_buffer_append_byte(buffer, ',');
2843 pm_buffer_append_string(buffer, "\"arguments\":", 12);
2844 if (cast->arguments != NULL) {
2845 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
2846 } else {
2847 pm_buffer_append_string(buffer, "null", 4);
2848 }
2849
2850 // Dump the closing_loc field
2851 pm_buffer_append_byte(buffer, ',');
2852 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2853 pm_dump_json_location(buffer, &cast->closing_loc);
2854
2855 // Dump the block field
2856 pm_buffer_append_byte(buffer, ',');
2857 pm_buffer_append_string(buffer, "\"block\":", 8);
2858 if (cast->block != NULL) {
2859 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
2860 } else {
2861 pm_buffer_append_string(buffer, "null", 4);
2862 }
2863
2864 // Dump the operator_loc field
2865 pm_buffer_append_byte(buffer, ',');
2866 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2867 pm_dump_json_location(buffer, &cast->operator_loc);
2868
2869 // Dump the value field
2870 pm_buffer_append_byte(buffer, ',');
2871 pm_buffer_append_string(buffer, "\"value\":", 8);
2872 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2873
2874 pm_buffer_append_byte(buffer, '}');
2875 break;
2876 }
2877 case PM_INDEX_TARGET_NODE: {
2878 pm_buffer_append_string(buffer, "{\"type\":\"IndexTargetNode\",\"location\":", 37);
2879
2880 const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node;
2881 pm_dump_json_location(buffer, &cast->base.location);
2882
2883 // Dump the CallNodeFlags field
2884 pm_buffer_append_byte(buffer, ',');
2885 pm_buffer_append_string(buffer, "\"flags\":", 8);
2886 size_t flags = 0;
2887 pm_buffer_append_byte(buffer, '[');
2888 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_SAFE_NAVIGATION)) {
2889 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2890 pm_buffer_append_string(buffer, "\"SAFE_NAVIGATION\"", 17);
2891 flags++;
2892 }
2893 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_VARIABLE_CALL)) {
2894 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2895 pm_buffer_append_string(buffer, "\"VARIABLE_CALL\"", 15);
2896 flags++;
2897 }
2898 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE)) {
2899 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2900 pm_buffer_append_string(buffer, "\"ATTRIBUTE_WRITE\"", 17);
2901 flags++;
2902 }
2903 if (PM_NODE_FLAG_P(cast, PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY)) {
2904 if (flags != 0) pm_buffer_append_byte(buffer, ',');
2905 pm_buffer_append_string(buffer, "\"IGNORE_VISIBILITY\"", 19);
2906 flags++;
2907 }
2908 pm_buffer_append_byte(buffer, ']');
2909
2910 // Dump the receiver field
2911 pm_buffer_append_byte(buffer, ',');
2912 pm_buffer_append_string(buffer, "\"receiver\":", 11);
2913 pm_dump_json(buffer, parser, (const pm_node_t *) cast->receiver);
2914
2915 // Dump the opening_loc field
2916 pm_buffer_append_byte(buffer, ',');
2917 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
2918 pm_dump_json_location(buffer, &cast->opening_loc);
2919
2920 // Dump the arguments field
2921 pm_buffer_append_byte(buffer, ',');
2922 pm_buffer_append_string(buffer, "\"arguments\":", 12);
2923 if (cast->arguments != NULL) {
2924 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
2925 } else {
2926 pm_buffer_append_string(buffer, "null", 4);
2927 }
2928
2929 // Dump the closing_loc field
2930 pm_buffer_append_byte(buffer, ',');
2931 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
2932 pm_dump_json_location(buffer, &cast->closing_loc);
2933
2934 // Dump the block field
2935 pm_buffer_append_byte(buffer, ',');
2936 pm_buffer_append_string(buffer, "\"block\":", 8);
2937 if (cast->block != NULL) {
2938 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
2939 } else {
2940 pm_buffer_append_string(buffer, "null", 4);
2941 }
2942
2943 pm_buffer_append_byte(buffer, '}');
2944 break;
2945 }
2946 case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
2947 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableAndWriteNode\",\"location\":", 50);
2948
2950 pm_dump_json_location(buffer, &cast->base.location);
2951
2952 // Dump the name field
2953 pm_buffer_append_byte(buffer, ',');
2954 pm_buffer_append_string(buffer, "\"name\":", 7);
2955 pm_dump_json_constant(buffer, parser, cast->name);
2956
2957 // Dump the name_loc field
2958 pm_buffer_append_byte(buffer, ',');
2959 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
2960 pm_dump_json_location(buffer, &cast->name_loc);
2961
2962 // Dump the operator_loc field
2963 pm_buffer_append_byte(buffer, ',');
2964 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
2965 pm_dump_json_location(buffer, &cast->operator_loc);
2966
2967 // Dump the value field
2968 pm_buffer_append_byte(buffer, ',');
2969 pm_buffer_append_string(buffer, "\"value\":", 8);
2970 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
2971
2972 pm_buffer_append_byte(buffer, '}');
2973 break;
2974 }
2975 case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
2976 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOperatorWriteNode\",\"location\":", 55);
2977
2979 pm_dump_json_location(buffer, &cast->base.location);
2980
2981 // Dump the name field
2982 pm_buffer_append_byte(buffer, ',');
2983 pm_buffer_append_string(buffer, "\"name\":", 7);
2984 pm_dump_json_constant(buffer, parser, cast->name);
2985
2986 // Dump the name_loc field
2987 pm_buffer_append_byte(buffer, ',');
2988 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
2989 pm_dump_json_location(buffer, &cast->name_loc);
2990
2991 // Dump the binary_operator_loc field
2992 pm_buffer_append_byte(buffer, ',');
2993 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
2994 pm_dump_json_location(buffer, &cast->binary_operator_loc);
2995
2996 // Dump the value field
2997 pm_buffer_append_byte(buffer, ',');
2998 pm_buffer_append_string(buffer, "\"value\":", 8);
2999 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3000
3001 // Dump the binary_operator field
3002 pm_buffer_append_byte(buffer, ',');
3003 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
3004 pm_dump_json_constant(buffer, parser, cast->binary_operator);
3005
3006 pm_buffer_append_byte(buffer, '}');
3007 break;
3008 }
3009 case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
3010 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableOrWriteNode\",\"location\":", 49);
3011
3013 pm_dump_json_location(buffer, &cast->base.location);
3014
3015 // Dump the name field
3016 pm_buffer_append_byte(buffer, ',');
3017 pm_buffer_append_string(buffer, "\"name\":", 7);
3018 pm_dump_json_constant(buffer, parser, cast->name);
3019
3020 // Dump the name_loc field
3021 pm_buffer_append_byte(buffer, ',');
3022 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3023 pm_dump_json_location(buffer, &cast->name_loc);
3024
3025 // Dump the operator_loc field
3026 pm_buffer_append_byte(buffer, ',');
3027 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3028 pm_dump_json_location(buffer, &cast->operator_loc);
3029
3030 // Dump the value field
3031 pm_buffer_append_byte(buffer, ',');
3032 pm_buffer_append_string(buffer, "\"value\":", 8);
3033 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3034
3035 pm_buffer_append_byte(buffer, '}');
3036 break;
3037 }
3038 case PM_INSTANCE_VARIABLE_READ_NODE: {
3039 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableReadNode\",\"location\":", 46);
3040
3042 pm_dump_json_location(buffer, &cast->base.location);
3043
3044 // Dump the name field
3045 pm_buffer_append_byte(buffer, ',');
3046 pm_buffer_append_string(buffer, "\"name\":", 7);
3047 pm_dump_json_constant(buffer, parser, cast->name);
3048
3049 pm_buffer_append_byte(buffer, '}');
3050 break;
3051 }
3052 case PM_INSTANCE_VARIABLE_TARGET_NODE: {
3053 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableTargetNode\",\"location\":", 48);
3054
3056 pm_dump_json_location(buffer, &cast->base.location);
3057
3058 // Dump the name field
3059 pm_buffer_append_byte(buffer, ',');
3060 pm_buffer_append_string(buffer, "\"name\":", 7);
3061 pm_dump_json_constant(buffer, parser, cast->name);
3062
3063 pm_buffer_append_byte(buffer, '}');
3064 break;
3065 }
3066 case PM_INSTANCE_VARIABLE_WRITE_NODE: {
3067 pm_buffer_append_string(buffer, "{\"type\":\"InstanceVariableWriteNode\",\"location\":", 47);
3068
3070 pm_dump_json_location(buffer, &cast->base.location);
3071
3072 // Dump the name field
3073 pm_buffer_append_byte(buffer, ',');
3074 pm_buffer_append_string(buffer, "\"name\":", 7);
3075 pm_dump_json_constant(buffer, parser, cast->name);
3076
3077 // Dump the name_loc field
3078 pm_buffer_append_byte(buffer, ',');
3079 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3080 pm_dump_json_location(buffer, &cast->name_loc);
3081
3082 // Dump the value field
3083 pm_buffer_append_byte(buffer, ',');
3084 pm_buffer_append_string(buffer, "\"value\":", 8);
3085 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
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, &cast->operator_loc);
3091
3092 pm_buffer_append_byte(buffer, '}');
3093 break;
3094 }
3095 case PM_INTEGER_NODE: {
3096 pm_buffer_append_string(buffer, "{\"type\":\"IntegerNode\",\"location\":", 33);
3097
3098 const pm_integer_node_t *cast = (const pm_integer_node_t *) node;
3099 pm_dump_json_location(buffer, &cast->base.location);
3100
3101 // Dump the IntegerBaseFlags field
3102 pm_buffer_append_byte(buffer, ',');
3103 pm_buffer_append_string(buffer, "\"flags\":", 8);
3104 size_t flags = 0;
3105 pm_buffer_append_byte(buffer, '[');
3106 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_BINARY)) {
3107 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3108 pm_buffer_append_string(buffer, "\"BINARY\"", 8);
3109 flags++;
3110 }
3111 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_DECIMAL)) {
3112 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3113 pm_buffer_append_string(buffer, "\"DECIMAL\"", 9);
3114 flags++;
3115 }
3116 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_OCTAL)) {
3117 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3118 pm_buffer_append_string(buffer, "\"OCTAL\"", 7);
3119 flags++;
3120 }
3121 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_HEXADECIMAL)) {
3122 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3123 pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13);
3124 flags++;
3125 }
3126 pm_buffer_append_byte(buffer, ']');
3127
3128 // Dump the value field
3129 pm_buffer_append_byte(buffer, ',');
3130 pm_buffer_append_string(buffer, "\"value\":", 8);
3131 pm_integer_string(buffer, &cast->value);
3132
3133 pm_buffer_append_byte(buffer, '}');
3134 break;
3135 }
3136 case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
3137 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedMatchLastLineNode\",\"location\":", 51);
3138
3140 pm_dump_json_location(buffer, &cast->base.location);
3141
3142 // Dump the RegularExpressionFlags field
3143 pm_buffer_append_byte(buffer, ',');
3144 pm_buffer_append_string(buffer, "\"flags\":", 8);
3145 size_t flags = 0;
3146 pm_buffer_append_byte(buffer, '[');
3147 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
3148 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3149 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
3150 flags++;
3151 }
3152 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
3153 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3154 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
3155 flags++;
3156 }
3157 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
3158 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3159 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
3160 flags++;
3161 }
3162 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
3163 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3164 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
3165 flags++;
3166 }
3167 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
3168 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3169 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
3170 flags++;
3171 }
3172 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
3173 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3174 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
3175 flags++;
3176 }
3177 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
3178 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3179 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
3180 flags++;
3181 }
3182 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
3183 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3184 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
3185 flags++;
3186 }
3187 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
3188 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3189 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
3190 flags++;
3191 }
3192 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
3193 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3194 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
3195 flags++;
3196 }
3197 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
3198 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3199 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
3200 flags++;
3201 }
3202 pm_buffer_append_byte(buffer, ']');
3203
3204 // Dump the opening_loc field
3205 pm_buffer_append_byte(buffer, ',');
3206 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3207 pm_dump_json_location(buffer, &cast->opening_loc);
3208
3209 // Dump the parts field
3210 pm_buffer_append_byte(buffer, ',');
3211 pm_buffer_append_string(buffer, "\"parts\":", 8);
3212 const pm_node_list_t *parts = &cast->parts;
3213 pm_buffer_append_byte(buffer, '[');
3214
3215 for (size_t index = 0; index < parts->size; index++) {
3216 if (index != 0) pm_buffer_append_byte(buffer, ',');
3217 pm_dump_json(buffer, parser, parts->nodes[index]);
3218 }
3219 pm_buffer_append_byte(buffer, ']');
3220
3221 // Dump the closing_loc field
3222 pm_buffer_append_byte(buffer, ',');
3223 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3224 pm_dump_json_location(buffer, &cast->closing_loc);
3225
3226 pm_buffer_append_byte(buffer, '}');
3227 break;
3228 }
3229 case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
3230 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedRegularExpressionNode\",\"location\":", 55);
3231
3233 pm_dump_json_location(buffer, &cast->base.location);
3234
3235 // Dump the RegularExpressionFlags field
3236 pm_buffer_append_byte(buffer, ',');
3237 pm_buffer_append_string(buffer, "\"flags\":", 8);
3238 size_t flags = 0;
3239 pm_buffer_append_byte(buffer, '[');
3240 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
3241 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3242 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
3243 flags++;
3244 }
3245 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
3246 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3247 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
3248 flags++;
3249 }
3250 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
3251 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3252 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
3253 flags++;
3254 }
3255 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
3256 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3257 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
3258 flags++;
3259 }
3260 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
3261 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3262 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
3263 flags++;
3264 }
3265 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
3266 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3267 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
3268 flags++;
3269 }
3270 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
3271 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3272 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
3273 flags++;
3274 }
3275 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
3276 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3277 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
3278 flags++;
3279 }
3280 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
3281 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3282 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
3283 flags++;
3284 }
3285 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
3286 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3287 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
3288 flags++;
3289 }
3290 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
3291 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3292 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
3293 flags++;
3294 }
3295 pm_buffer_append_byte(buffer, ']');
3296
3297 // Dump the opening_loc field
3298 pm_buffer_append_byte(buffer, ',');
3299 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3300 pm_dump_json_location(buffer, &cast->opening_loc);
3301
3302 // Dump the parts field
3303 pm_buffer_append_byte(buffer, ',');
3304 pm_buffer_append_string(buffer, "\"parts\":", 8);
3305 const pm_node_list_t *parts = &cast->parts;
3306 pm_buffer_append_byte(buffer, '[');
3307
3308 for (size_t index = 0; index < parts->size; index++) {
3309 if (index != 0) pm_buffer_append_byte(buffer, ',');
3310 pm_dump_json(buffer, parser, parts->nodes[index]);
3311 }
3312 pm_buffer_append_byte(buffer, ']');
3313
3314 // Dump the closing_loc field
3315 pm_buffer_append_byte(buffer, ',');
3316 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3317 pm_dump_json_location(buffer, &cast->closing_loc);
3318
3319 pm_buffer_append_byte(buffer, '}');
3320 break;
3321 }
3322 case PM_INTERPOLATED_STRING_NODE: {
3323 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedStringNode\",\"location\":", 44);
3324
3326 pm_dump_json_location(buffer, &cast->base.location);
3327
3328 // Dump the InterpolatedStringNodeFlags field
3329 pm_buffer_append_byte(buffer, ',');
3330 pm_buffer_append_string(buffer, "\"flags\":", 8);
3331 size_t flags = 0;
3332 pm_buffer_append_byte(buffer, '[');
3333 if (PM_NODE_FLAG_P(cast, PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN)) {
3334 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3335 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
3336 flags++;
3337 }
3338 if (PM_NODE_FLAG_P(cast, PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE)) {
3339 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3340 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
3341 flags++;
3342 }
3343 pm_buffer_append_byte(buffer, ']');
3344
3345 // Dump the opening_loc field
3346 pm_buffer_append_byte(buffer, ',');
3347 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3348 if (cast->opening_loc.length != 0) {
3349 pm_dump_json_location(buffer, &cast->opening_loc);
3350 } else {
3351 pm_buffer_append_string(buffer, "null", 4);
3352 }
3353
3354 // Dump the parts field
3355 pm_buffer_append_byte(buffer, ',');
3356 pm_buffer_append_string(buffer, "\"parts\":", 8);
3357 const pm_node_list_t *parts = &cast->parts;
3358 pm_buffer_append_byte(buffer, '[');
3359
3360 for (size_t index = 0; index < parts->size; index++) {
3361 if (index != 0) pm_buffer_append_byte(buffer, ',');
3362 pm_dump_json(buffer, parser, parts->nodes[index]);
3363 }
3364 pm_buffer_append_byte(buffer, ']');
3365
3366 // Dump the closing_loc field
3367 pm_buffer_append_byte(buffer, ',');
3368 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3369 if (cast->closing_loc.length != 0) {
3370 pm_dump_json_location(buffer, &cast->closing_loc);
3371 } else {
3372 pm_buffer_append_string(buffer, "null", 4);
3373 }
3374
3375 pm_buffer_append_byte(buffer, '}');
3376 break;
3377 }
3378 case PM_INTERPOLATED_SYMBOL_NODE: {
3379 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedSymbolNode\",\"location\":", 44);
3380
3382 pm_dump_json_location(buffer, &cast->base.location);
3383
3384 // Dump the opening_loc field
3385 pm_buffer_append_byte(buffer, ',');
3386 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3387 if (cast->opening_loc.length != 0) {
3388 pm_dump_json_location(buffer, &cast->opening_loc);
3389 } else {
3390 pm_buffer_append_string(buffer, "null", 4);
3391 }
3392
3393 // Dump the parts field
3394 pm_buffer_append_byte(buffer, ',');
3395 pm_buffer_append_string(buffer, "\"parts\":", 8);
3396 const pm_node_list_t *parts = &cast->parts;
3397 pm_buffer_append_byte(buffer, '[');
3398
3399 for (size_t index = 0; index < parts->size; index++) {
3400 if (index != 0) pm_buffer_append_byte(buffer, ',');
3401 pm_dump_json(buffer, parser, parts->nodes[index]);
3402 }
3403 pm_buffer_append_byte(buffer, ']');
3404
3405 // Dump the closing_loc field
3406 pm_buffer_append_byte(buffer, ',');
3407 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3408 if (cast->closing_loc.length != 0) {
3409 pm_dump_json_location(buffer, &cast->closing_loc);
3410 } else {
3411 pm_buffer_append_string(buffer, "null", 4);
3412 }
3413
3414 pm_buffer_append_byte(buffer, '}');
3415 break;
3416 }
3417 case PM_INTERPOLATED_X_STRING_NODE: {
3418 pm_buffer_append_string(buffer, "{\"type\":\"InterpolatedXStringNode\",\"location\":", 45);
3419
3421 pm_dump_json_location(buffer, &cast->base.location);
3422
3423 // Dump the opening_loc field
3424 pm_buffer_append_byte(buffer, ',');
3425 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3426 pm_dump_json_location(buffer, &cast->opening_loc);
3427
3428 // Dump the parts field
3429 pm_buffer_append_byte(buffer, ',');
3430 pm_buffer_append_string(buffer, "\"parts\":", 8);
3431 const pm_node_list_t *parts = &cast->parts;
3432 pm_buffer_append_byte(buffer, '[');
3433
3434 for (size_t index = 0; index < parts->size; index++) {
3435 if (index != 0) pm_buffer_append_byte(buffer, ',');
3436 pm_dump_json(buffer, parser, parts->nodes[index]);
3437 }
3438 pm_buffer_append_byte(buffer, ']');
3439
3440 // Dump the closing_loc field
3441 pm_buffer_append_byte(buffer, ',');
3442 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3443 pm_dump_json_location(buffer, &cast->closing_loc);
3444
3445 pm_buffer_append_byte(buffer, '}');
3446 break;
3447 }
3448 case PM_IT_LOCAL_VARIABLE_READ_NODE: {
3449 pm_buffer_append_string(buffer, "{\"type\":\"ItLocalVariableReadNode\",\"location\":", 45);
3450
3452 pm_dump_json_location(buffer, &cast->base.location);
3453
3454 pm_buffer_append_byte(buffer, '}');
3455 break;
3456 }
3457 case PM_IT_PARAMETERS_NODE: {
3458 pm_buffer_append_string(buffer, "{\"type\":\"ItParametersNode\",\"location\":", 38);
3459
3460 const pm_it_parameters_node_t *cast = (const pm_it_parameters_node_t *) node;
3461 pm_dump_json_location(buffer, &cast->base.location);
3462
3463 pm_buffer_append_byte(buffer, '}');
3464 break;
3465 }
3466 case PM_KEYWORD_HASH_NODE: {
3467 pm_buffer_append_string(buffer, "{\"type\":\"KeywordHashNode\",\"location\":", 37);
3468
3469 const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node;
3470 pm_dump_json_location(buffer, &cast->base.location);
3471
3472 // Dump the KeywordHashNodeFlags field
3473 pm_buffer_append_byte(buffer, ',');
3474 pm_buffer_append_string(buffer, "\"flags\":", 8);
3475 size_t flags = 0;
3476 pm_buffer_append_byte(buffer, '[');
3477 if (PM_NODE_FLAG_P(cast, PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS)) {
3478 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3479 pm_buffer_append_string(buffer, "\"SYMBOL_KEYS\"", 13);
3480 flags++;
3481 }
3482 pm_buffer_append_byte(buffer, ']');
3483
3484 // Dump the elements field
3485 pm_buffer_append_byte(buffer, ',');
3486 pm_buffer_append_string(buffer, "\"elements\":", 11);
3487 const pm_node_list_t *elements = &cast->elements;
3488 pm_buffer_append_byte(buffer, '[');
3489
3490 for (size_t index = 0; index < elements->size; index++) {
3491 if (index != 0) pm_buffer_append_byte(buffer, ',');
3492 pm_dump_json(buffer, parser, elements->nodes[index]);
3493 }
3494 pm_buffer_append_byte(buffer, ']');
3495
3496 pm_buffer_append_byte(buffer, '}');
3497 break;
3498 }
3499 case PM_KEYWORD_REST_PARAMETER_NODE: {
3500 pm_buffer_append_string(buffer, "{\"type\":\"KeywordRestParameterNode\",\"location\":", 46);
3501
3503 pm_dump_json_location(buffer, &cast->base.location);
3504
3505 // Dump the ParameterFlags field
3506 pm_buffer_append_byte(buffer, ',');
3507 pm_buffer_append_string(buffer, "\"flags\":", 8);
3508 size_t flags = 0;
3509 pm_buffer_append_byte(buffer, '[');
3510 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
3511 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3512 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
3513 flags++;
3514 }
3515 pm_buffer_append_byte(buffer, ']');
3516
3517 // Dump the name field
3518 pm_buffer_append_byte(buffer, ',');
3519 pm_buffer_append_string(buffer, "\"name\":", 7);
3520 if (cast->name != PM_CONSTANT_ID_UNSET) {
3521 pm_dump_json_constant(buffer, parser, cast->name);
3522 } else {
3523 pm_buffer_append_string(buffer, "null", 4);
3524 }
3525
3526 // Dump the name_loc field
3527 pm_buffer_append_byte(buffer, ',');
3528 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3529 if (cast->name_loc.length != 0) {
3530 pm_dump_json_location(buffer, &cast->name_loc);
3531 } else {
3532 pm_buffer_append_string(buffer, "null", 4);
3533 }
3534
3535 // Dump the operator_loc field
3536 pm_buffer_append_byte(buffer, ',');
3537 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3538 pm_dump_json_location(buffer, &cast->operator_loc);
3539
3540 pm_buffer_append_byte(buffer, '}');
3541 break;
3542 }
3543 case PM_LAMBDA_NODE: {
3544 pm_buffer_append_string(buffer, "{\"type\":\"LambdaNode\",\"location\":", 32);
3545
3546 const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node;
3547 pm_dump_json_location(buffer, &cast->base.location);
3548
3549 // Dump the locals field
3550 pm_buffer_append_byte(buffer, ',');
3551 pm_buffer_append_string(buffer, "\"locals\":", 9);
3552 const pm_constant_id_list_t *locals = &cast->locals;
3553 pm_buffer_append_byte(buffer, '[');
3554
3555 for (size_t index = 0; index < locals->size; index++) {
3556 if (index != 0) pm_buffer_append_byte(buffer, ',');
3557 pm_dump_json_constant(buffer, parser, locals->ids[index]);
3558 }
3559 pm_buffer_append_byte(buffer, ']');
3560
3561 // Dump the operator_loc field
3562 pm_buffer_append_byte(buffer, ',');
3563 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3564 pm_dump_json_location(buffer, &cast->operator_loc);
3565
3566 // Dump the opening_loc field
3567 pm_buffer_append_byte(buffer, ',');
3568 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3569 pm_dump_json_location(buffer, &cast->opening_loc);
3570
3571 // Dump the closing_loc field
3572 pm_buffer_append_byte(buffer, ',');
3573 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3574 pm_dump_json_location(buffer, &cast->closing_loc);
3575
3576 // Dump the parameters field
3577 pm_buffer_append_byte(buffer, ',');
3578 pm_buffer_append_string(buffer, "\"parameters\":", 13);
3579 if (cast->parameters != NULL) {
3580 pm_dump_json(buffer, parser, (const pm_node_t *) cast->parameters);
3581 } else {
3582 pm_buffer_append_string(buffer, "null", 4);
3583 }
3584
3585 // Dump the body field
3586 pm_buffer_append_byte(buffer, ',');
3587 pm_buffer_append_string(buffer, "\"body\":", 7);
3588 if (cast->body != NULL) {
3589 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
3590 } else {
3591 pm_buffer_append_string(buffer, "null", 4);
3592 }
3593
3594 pm_buffer_append_byte(buffer, '}');
3595 break;
3596 }
3597 case PM_LOCAL_VARIABLE_AND_WRITE_NODE: {
3598 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableAndWriteNode\",\"location\":", 47);
3599
3601 pm_dump_json_location(buffer, &cast->base.location);
3602
3603 // Dump the name_loc field
3604 pm_buffer_append_byte(buffer, ',');
3605 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3606 pm_dump_json_location(buffer, &cast->name_loc);
3607
3608 // Dump the operator_loc field
3609 pm_buffer_append_byte(buffer, ',');
3610 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3611 pm_dump_json_location(buffer, &cast->operator_loc);
3612
3613 // Dump the value field
3614 pm_buffer_append_byte(buffer, ',');
3615 pm_buffer_append_string(buffer, "\"value\":", 8);
3616 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3617
3618 // Dump the name field
3619 pm_buffer_append_byte(buffer, ',');
3620 pm_buffer_append_string(buffer, "\"name\":", 7);
3621 pm_dump_json_constant(buffer, parser, cast->name);
3622
3623 // Dump the depth field
3624 pm_buffer_append_byte(buffer, ',');
3625 pm_buffer_append_string(buffer, "\"depth\":", 8);
3626 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
3627
3628 pm_buffer_append_byte(buffer, '}');
3629 break;
3630 }
3631 case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
3632 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOperatorWriteNode\",\"location\":", 52);
3633
3635 pm_dump_json_location(buffer, &cast->base.location);
3636
3637 // Dump the name_loc field
3638 pm_buffer_append_byte(buffer, ',');
3639 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3640 pm_dump_json_location(buffer, &cast->name_loc);
3641
3642 // Dump the binary_operator_loc field
3643 pm_buffer_append_byte(buffer, ',');
3644 pm_buffer_append_string(buffer, "\"binary_operator_loc\":", 22);
3645 pm_dump_json_location(buffer, &cast->binary_operator_loc);
3646
3647 // Dump the value field
3648 pm_buffer_append_byte(buffer, ',');
3649 pm_buffer_append_string(buffer, "\"value\":", 8);
3650 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3651
3652 // Dump the name field
3653 pm_buffer_append_byte(buffer, ',');
3654 pm_buffer_append_string(buffer, "\"name\":", 7);
3655 pm_dump_json_constant(buffer, parser, cast->name);
3656
3657 // Dump the binary_operator field
3658 pm_buffer_append_byte(buffer, ',');
3659 pm_buffer_append_string(buffer, "\"binary_operator\":", 18);
3660 pm_dump_json_constant(buffer, parser, cast->binary_operator);
3661
3662 // Dump the depth field
3663 pm_buffer_append_byte(buffer, ',');
3664 pm_buffer_append_string(buffer, "\"depth\":", 8);
3665 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
3666
3667 pm_buffer_append_byte(buffer, '}');
3668 break;
3669 }
3670 case PM_LOCAL_VARIABLE_OR_WRITE_NODE: {
3671 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableOrWriteNode\",\"location\":", 46);
3672
3674 pm_dump_json_location(buffer, &cast->base.location);
3675
3676 // Dump the name_loc field
3677 pm_buffer_append_byte(buffer, ',');
3678 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3679 pm_dump_json_location(buffer, &cast->name_loc);
3680
3681 // Dump the operator_loc field
3682 pm_buffer_append_byte(buffer, ',');
3683 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3684 pm_dump_json_location(buffer, &cast->operator_loc);
3685
3686 // Dump the value field
3687 pm_buffer_append_byte(buffer, ',');
3688 pm_buffer_append_string(buffer, "\"value\":", 8);
3689 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3690
3691 // Dump the name field
3692 pm_buffer_append_byte(buffer, ',');
3693 pm_buffer_append_string(buffer, "\"name\":", 7);
3694 pm_dump_json_constant(buffer, parser, cast->name);
3695
3696 // Dump the depth field
3697 pm_buffer_append_byte(buffer, ',');
3698 pm_buffer_append_string(buffer, "\"depth\":", 8);
3699 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
3700
3701 pm_buffer_append_byte(buffer, '}');
3702 break;
3703 }
3704 case PM_LOCAL_VARIABLE_READ_NODE: {
3705 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableReadNode\",\"location\":", 43);
3706
3708 pm_dump_json_location(buffer, &cast->base.location);
3709
3710 // Dump the name field
3711 pm_buffer_append_byte(buffer, ',');
3712 pm_buffer_append_string(buffer, "\"name\":", 7);
3713 pm_dump_json_constant(buffer, parser, cast->name);
3714
3715 // Dump the depth field
3716 pm_buffer_append_byte(buffer, ',');
3717 pm_buffer_append_string(buffer, "\"depth\":", 8);
3718 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
3719
3720 pm_buffer_append_byte(buffer, '}');
3721 break;
3722 }
3723 case PM_LOCAL_VARIABLE_TARGET_NODE: {
3724 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableTargetNode\",\"location\":", 45);
3725
3727 pm_dump_json_location(buffer, &cast->base.location);
3728
3729 // Dump the name field
3730 pm_buffer_append_byte(buffer, ',');
3731 pm_buffer_append_string(buffer, "\"name\":", 7);
3732 pm_dump_json_constant(buffer, parser, cast->name);
3733
3734 // Dump the depth field
3735 pm_buffer_append_byte(buffer, ',');
3736 pm_buffer_append_string(buffer, "\"depth\":", 8);
3737 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
3738
3739 pm_buffer_append_byte(buffer, '}');
3740 break;
3741 }
3742 case PM_LOCAL_VARIABLE_WRITE_NODE: {
3743 pm_buffer_append_string(buffer, "{\"type\":\"LocalVariableWriteNode\",\"location\":", 44);
3744
3746 pm_dump_json_location(buffer, &cast->base.location);
3747
3748 // Dump the name field
3749 pm_buffer_append_byte(buffer, ',');
3750 pm_buffer_append_string(buffer, "\"name\":", 7);
3751 pm_dump_json_constant(buffer, parser, cast->name);
3752
3753 // Dump the depth field
3754 pm_buffer_append_byte(buffer, ',');
3755 pm_buffer_append_string(buffer, "\"depth\":", 8);
3756 pm_buffer_append_format(buffer, "%" PRIu32, cast->depth);
3757
3758 // Dump the name_loc field
3759 pm_buffer_append_byte(buffer, ',');
3760 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
3761 pm_dump_json_location(buffer, &cast->name_loc);
3762
3763 // Dump the value field
3764 pm_buffer_append_byte(buffer, ',');
3765 pm_buffer_append_string(buffer, "\"value\":", 8);
3766 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3767
3768 // Dump the operator_loc field
3769 pm_buffer_append_byte(buffer, ',');
3770 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3771 pm_dump_json_location(buffer, &cast->operator_loc);
3772
3773 pm_buffer_append_byte(buffer, '}');
3774 break;
3775 }
3776 case PM_MATCH_LAST_LINE_NODE: {
3777 pm_buffer_append_string(buffer, "{\"type\":\"MatchLastLineNode\",\"location\":", 39);
3778
3779 const pm_match_last_line_node_t *cast = (const pm_match_last_line_node_t *) node;
3780 pm_dump_json_location(buffer, &cast->base.location);
3781
3782 // Dump the RegularExpressionFlags field
3783 pm_buffer_append_byte(buffer, ',');
3784 pm_buffer_append_string(buffer, "\"flags\":", 8);
3785 size_t flags = 0;
3786 pm_buffer_append_byte(buffer, '[');
3787 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
3788 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3789 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
3790 flags++;
3791 }
3792 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
3793 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3794 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
3795 flags++;
3796 }
3797 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
3798 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3799 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
3800 flags++;
3801 }
3802 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
3803 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3804 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
3805 flags++;
3806 }
3807 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
3808 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3809 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
3810 flags++;
3811 }
3812 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
3813 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3814 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
3815 flags++;
3816 }
3817 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
3818 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3819 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
3820 flags++;
3821 }
3822 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
3823 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3824 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
3825 flags++;
3826 }
3827 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
3828 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3829 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
3830 flags++;
3831 }
3832 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
3833 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3834 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
3835 flags++;
3836 }
3837 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
3838 if (flags != 0) pm_buffer_append_byte(buffer, ',');
3839 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
3840 flags++;
3841 }
3842 pm_buffer_append_byte(buffer, ']');
3843
3844 // Dump the opening_loc field
3845 pm_buffer_append_byte(buffer, ',');
3846 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
3847 pm_dump_json_location(buffer, &cast->opening_loc);
3848
3849 // Dump the content_loc field
3850 pm_buffer_append_byte(buffer, ',');
3851 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
3852 pm_dump_json_location(buffer, &cast->content_loc);
3853
3854 // Dump the closing_loc field
3855 pm_buffer_append_byte(buffer, ',');
3856 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
3857 pm_dump_json_location(buffer, &cast->closing_loc);
3858
3859 // Dump the unescaped field
3860 pm_buffer_append_byte(buffer, ',');
3861 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
3862 const pm_string_t *unescaped = &cast->unescaped;
3863 pm_buffer_append_byte(buffer, '"');
3864 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
3865 pm_buffer_append_byte(buffer, '"');
3866
3867 pm_buffer_append_byte(buffer, '}');
3868 break;
3869 }
3870 case PM_MATCH_PREDICATE_NODE: {
3871 pm_buffer_append_string(buffer, "{\"type\":\"MatchPredicateNode\",\"location\":", 40);
3872
3873 const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node;
3874 pm_dump_json_location(buffer, &cast->base.location);
3875
3876 // Dump the value field
3877 pm_buffer_append_byte(buffer, ',');
3878 pm_buffer_append_string(buffer, "\"value\":", 8);
3879 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
3880
3881 // Dump the pattern field
3882 pm_buffer_append_byte(buffer, ',');
3883 pm_buffer_append_string(buffer, "\"pattern\":", 10);
3884 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
3885
3886 // Dump the keyword_loc field
3887 pm_buffer_append_byte(buffer, ',');
3888 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
3889 pm_dump_json_location(buffer, &cast->keyword_loc);
3890
3891 pm_buffer_append_byte(buffer, '}');
3892 break;
3893 }
3894 case PM_MATCH_REQUIRED_NODE: {
3895 pm_buffer_append_string(buffer, "{\"type\":\"MatchRequiredNode\",\"location\":", 39);
3896
3897 const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node;
3898 pm_dump_json_location(buffer, &cast->base.location);
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 // Dump the pattern field
3906 pm_buffer_append_byte(buffer, ',');
3907 pm_buffer_append_string(buffer, "\"pattern\":", 10);
3908 pm_dump_json(buffer, parser, (const pm_node_t *) cast->pattern);
3909
3910 // Dump the operator_loc field
3911 pm_buffer_append_byte(buffer, ',');
3912 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
3913 pm_dump_json_location(buffer, &cast->operator_loc);
3914
3915 pm_buffer_append_byte(buffer, '}');
3916 break;
3917 }
3918 case PM_MATCH_WRITE_NODE: {
3919 pm_buffer_append_string(buffer, "{\"type\":\"MatchWriteNode\",\"location\":", 36);
3920
3921 const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node;
3922 pm_dump_json_location(buffer, &cast->base.location);
3923
3924 // Dump the call field
3925 pm_buffer_append_byte(buffer, ',');
3926 pm_buffer_append_string(buffer, "\"call\":", 7);
3927 pm_dump_json(buffer, parser, (const pm_node_t *) cast->call);
3928
3929 // Dump the targets field
3930 pm_buffer_append_byte(buffer, ',');
3931 pm_buffer_append_string(buffer, "\"targets\":", 10);
3932 const pm_node_list_t *targets = &cast->targets;
3933 pm_buffer_append_byte(buffer, '[');
3934
3935 for (size_t index = 0; index < targets->size; index++) {
3936 if (index != 0) pm_buffer_append_byte(buffer, ',');
3937 pm_dump_json(buffer, parser, targets->nodes[index]);
3938 }
3939 pm_buffer_append_byte(buffer, ']');
3940
3941 pm_buffer_append_byte(buffer, '}');
3942 break;
3943 }
3944 case PM_MODULE_NODE: {
3945 pm_buffer_append_string(buffer, "{\"type\":\"ModuleNode\",\"location\":", 32);
3946
3947 const pm_module_node_t *cast = (const pm_module_node_t *) node;
3948 pm_dump_json_location(buffer, &cast->base.location);
3949
3950 // Dump the locals field
3951 pm_buffer_append_byte(buffer, ',');
3952 pm_buffer_append_string(buffer, "\"locals\":", 9);
3953 const pm_constant_id_list_t *locals = &cast->locals;
3954 pm_buffer_append_byte(buffer, '[');
3955
3956 for (size_t index = 0; index < locals->size; index++) {
3957 if (index != 0) pm_buffer_append_byte(buffer, ',');
3958 pm_dump_json_constant(buffer, parser, locals->ids[index]);
3959 }
3960 pm_buffer_append_byte(buffer, ']');
3961
3962 // Dump the module_keyword_loc field
3963 pm_buffer_append_byte(buffer, ',');
3964 pm_buffer_append_string(buffer, "\"module_keyword_loc\":", 21);
3965 pm_dump_json_location(buffer, &cast->module_keyword_loc);
3966
3967 // Dump the constant_path field
3968 pm_buffer_append_byte(buffer, ',');
3969 pm_buffer_append_string(buffer, "\"constant_path\":", 16);
3970 pm_dump_json(buffer, parser, (const pm_node_t *) cast->constant_path);
3971
3972 // Dump the body field
3973 pm_buffer_append_byte(buffer, ',');
3974 pm_buffer_append_string(buffer, "\"body\":", 7);
3975 if (cast->body != NULL) {
3976 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
3977 } else {
3978 pm_buffer_append_string(buffer, "null", 4);
3979 }
3980
3981 // Dump the end_keyword_loc field
3982 pm_buffer_append_byte(buffer, ',');
3983 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
3984 pm_dump_json_location(buffer, &cast->end_keyword_loc);
3985
3986 // Dump the name field
3987 pm_buffer_append_byte(buffer, ',');
3988 pm_buffer_append_string(buffer, "\"name\":", 7);
3989 pm_dump_json_constant(buffer, parser, cast->name);
3990
3991 pm_buffer_append_byte(buffer, '}');
3992 break;
3993 }
3994 case PM_MULTI_TARGET_NODE: {
3995 pm_buffer_append_string(buffer, "{\"type\":\"MultiTargetNode\",\"location\":", 37);
3996
3997 const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node;
3998 pm_dump_json_location(buffer, &cast->base.location);
3999
4000 // Dump the lefts field
4001 pm_buffer_append_byte(buffer, ',');
4002 pm_buffer_append_string(buffer, "\"lefts\":", 8);
4003 const pm_node_list_t *lefts = &cast->lefts;
4004 pm_buffer_append_byte(buffer, '[');
4005
4006 for (size_t index = 0; index < lefts->size; index++) {
4007 if (index != 0) pm_buffer_append_byte(buffer, ',');
4008 pm_dump_json(buffer, parser, lefts->nodes[index]);
4009 }
4010 pm_buffer_append_byte(buffer, ']');
4011
4012 // Dump the rest field
4013 pm_buffer_append_byte(buffer, ',');
4014 pm_buffer_append_string(buffer, "\"rest\":", 7);
4015 if (cast->rest != NULL) {
4016 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
4017 } else {
4018 pm_buffer_append_string(buffer, "null", 4);
4019 }
4020
4021 // Dump the rights field
4022 pm_buffer_append_byte(buffer, ',');
4023 pm_buffer_append_string(buffer, "\"rights\":", 9);
4024 const pm_node_list_t *rights = &cast->rights;
4025 pm_buffer_append_byte(buffer, '[');
4026
4027 for (size_t index = 0; index < rights->size; index++) {
4028 if (index != 0) pm_buffer_append_byte(buffer, ',');
4029 pm_dump_json(buffer, parser, rights->nodes[index]);
4030 }
4031 pm_buffer_append_byte(buffer, ']');
4032
4033 // Dump the lparen_loc field
4034 pm_buffer_append_byte(buffer, ',');
4035 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4036 if (cast->lparen_loc.length != 0) {
4037 pm_dump_json_location(buffer, &cast->lparen_loc);
4038 } else {
4039 pm_buffer_append_string(buffer, "null", 4);
4040 }
4041
4042 // Dump the rparen_loc field
4043 pm_buffer_append_byte(buffer, ',');
4044 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4045 if (cast->rparen_loc.length != 0) {
4046 pm_dump_json_location(buffer, &cast->rparen_loc);
4047 } else {
4048 pm_buffer_append_string(buffer, "null", 4);
4049 }
4050
4051 pm_buffer_append_byte(buffer, '}');
4052 break;
4053 }
4054 case PM_MULTI_WRITE_NODE: {
4055 pm_buffer_append_string(buffer, "{\"type\":\"MultiWriteNode\",\"location\":", 36);
4056
4057 const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node;
4058 pm_dump_json_location(buffer, &cast->base.location);
4059
4060 // Dump the lefts field
4061 pm_buffer_append_byte(buffer, ',');
4062 pm_buffer_append_string(buffer, "\"lefts\":", 8);
4063 const pm_node_list_t *lefts = &cast->lefts;
4064 pm_buffer_append_byte(buffer, '[');
4065
4066 for (size_t index = 0; index < lefts->size; index++) {
4067 if (index != 0) pm_buffer_append_byte(buffer, ',');
4068 pm_dump_json(buffer, parser, lefts->nodes[index]);
4069 }
4070 pm_buffer_append_byte(buffer, ']');
4071
4072 // Dump the rest field
4073 pm_buffer_append_byte(buffer, ',');
4074 pm_buffer_append_string(buffer, "\"rest\":", 7);
4075 if (cast->rest != NULL) {
4076 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
4077 } else {
4078 pm_buffer_append_string(buffer, "null", 4);
4079 }
4080
4081 // Dump the rights field
4082 pm_buffer_append_byte(buffer, ',');
4083 pm_buffer_append_string(buffer, "\"rights\":", 9);
4084 const pm_node_list_t *rights = &cast->rights;
4085 pm_buffer_append_byte(buffer, '[');
4086
4087 for (size_t index = 0; index < rights->size; index++) {
4088 if (index != 0) pm_buffer_append_byte(buffer, ',');
4089 pm_dump_json(buffer, parser, rights->nodes[index]);
4090 }
4091 pm_buffer_append_byte(buffer, ']');
4092
4093 // Dump the lparen_loc field
4094 pm_buffer_append_byte(buffer, ',');
4095 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4096 if (cast->lparen_loc.length != 0) {
4097 pm_dump_json_location(buffer, &cast->lparen_loc);
4098 } else {
4099 pm_buffer_append_string(buffer, "null", 4);
4100 }
4101
4102 // Dump the rparen_loc field
4103 pm_buffer_append_byte(buffer, ',');
4104 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4105 if (cast->rparen_loc.length != 0) {
4106 pm_dump_json_location(buffer, &cast->rparen_loc);
4107 } else {
4108 pm_buffer_append_string(buffer, "null", 4);
4109 }
4110
4111 // Dump the operator_loc field
4112 pm_buffer_append_byte(buffer, ',');
4113 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4114 pm_dump_json_location(buffer, &cast->operator_loc);
4115
4116 // Dump the value field
4117 pm_buffer_append_byte(buffer, ',');
4118 pm_buffer_append_string(buffer, "\"value\":", 8);
4119 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4120
4121 pm_buffer_append_byte(buffer, '}');
4122 break;
4123 }
4124 case PM_NEXT_NODE: {
4125 pm_buffer_append_string(buffer, "{\"type\":\"NextNode\",\"location\":", 30);
4126
4127 const pm_next_node_t *cast = (const pm_next_node_t *) node;
4128 pm_dump_json_location(buffer, &cast->base.location);
4129
4130 // Dump the arguments field
4131 pm_buffer_append_byte(buffer, ',');
4132 pm_buffer_append_string(buffer, "\"arguments\":", 12);
4133 if (cast->arguments != NULL) {
4134 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
4135 } else {
4136 pm_buffer_append_string(buffer, "null", 4);
4137 }
4138
4139 // Dump the keyword_loc field
4140 pm_buffer_append_byte(buffer, ',');
4141 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4142 pm_dump_json_location(buffer, &cast->keyword_loc);
4143
4144 pm_buffer_append_byte(buffer, '}');
4145 break;
4146 }
4147 case PM_NIL_NODE: {
4148 pm_buffer_append_string(buffer, "{\"type\":\"NilNode\",\"location\":", 29);
4149
4150 const pm_nil_node_t *cast = (const pm_nil_node_t *) node;
4151 pm_dump_json_location(buffer, &cast->base.location);
4152
4153 pm_buffer_append_byte(buffer, '}');
4154 break;
4155 }
4156 case PM_NO_BLOCK_PARAMETER_NODE: {
4157 pm_buffer_append_string(buffer, "{\"type\":\"NoBlockParameterNode\",\"location\":", 42);
4158
4160 pm_dump_json_location(buffer, &cast->base.location);
4161
4162 // Dump the operator_loc field
4163 pm_buffer_append_byte(buffer, ',');
4164 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4165 pm_dump_json_location(buffer, &cast->operator_loc);
4166
4167 // Dump the keyword_loc field
4168 pm_buffer_append_byte(buffer, ',');
4169 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4170 pm_dump_json_location(buffer, &cast->keyword_loc);
4171
4172 pm_buffer_append_byte(buffer, '}');
4173 break;
4174 }
4175 case PM_NO_KEYWORDS_PARAMETER_NODE: {
4176 pm_buffer_append_string(buffer, "{\"type\":\"NoKeywordsParameterNode\",\"location\":", 45);
4177
4179 pm_dump_json_location(buffer, &cast->base.location);
4180
4181 // Dump the operator_loc field
4182 pm_buffer_append_byte(buffer, ',');
4183 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4184 pm_dump_json_location(buffer, &cast->operator_loc);
4185
4186 // Dump the keyword_loc field
4187 pm_buffer_append_byte(buffer, ',');
4188 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4189 pm_dump_json_location(buffer, &cast->keyword_loc);
4190
4191 pm_buffer_append_byte(buffer, '}');
4192 break;
4193 }
4194 case PM_NUMBERED_PARAMETERS_NODE: {
4195 pm_buffer_append_string(buffer, "{\"type\":\"NumberedParametersNode\",\"location\":", 44);
4196
4198 pm_dump_json_location(buffer, &cast->base.location);
4199
4200 // Dump the maximum field
4201 pm_buffer_append_byte(buffer, ',');
4202 pm_buffer_append_string(buffer, "\"maximum\":", 10);
4203 pm_buffer_append_format(buffer, "%" PRIu8, cast->maximum);
4204
4205 pm_buffer_append_byte(buffer, '}');
4206 break;
4207 }
4208 case PM_NUMBERED_REFERENCE_READ_NODE: {
4209 pm_buffer_append_string(buffer, "{\"type\":\"NumberedReferenceReadNode\",\"location\":", 47);
4210
4212 pm_dump_json_location(buffer, &cast->base.location);
4213
4214 // Dump the number field
4215 pm_buffer_append_byte(buffer, ',');
4216 pm_buffer_append_string(buffer, "\"number\":", 9);
4217 pm_buffer_append_format(buffer, "%" PRIu32, cast->number);
4218
4219 pm_buffer_append_byte(buffer, '}');
4220 break;
4221 }
4222 case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
4223 pm_buffer_append_string(buffer, "{\"type\":\"OptionalKeywordParameterNode\",\"location\":", 50);
4224
4226 pm_dump_json_location(buffer, &cast->base.location);
4227
4228 // Dump the ParameterFlags field
4229 pm_buffer_append_byte(buffer, ',');
4230 pm_buffer_append_string(buffer, "\"flags\":", 8);
4231 size_t flags = 0;
4232 pm_buffer_append_byte(buffer, '[');
4233 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
4234 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4235 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
4236 flags++;
4237 }
4238 pm_buffer_append_byte(buffer, ']');
4239
4240 // Dump the name field
4241 pm_buffer_append_byte(buffer, ',');
4242 pm_buffer_append_string(buffer, "\"name\":", 7);
4243 pm_dump_json_constant(buffer, parser, cast->name);
4244
4245 // Dump the name_loc field
4246 pm_buffer_append_byte(buffer, ',');
4247 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4248 pm_dump_json_location(buffer, &cast->name_loc);
4249
4250 // Dump the value field
4251 pm_buffer_append_byte(buffer, ',');
4252 pm_buffer_append_string(buffer, "\"value\":", 8);
4253 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4254
4255 pm_buffer_append_byte(buffer, '}');
4256 break;
4257 }
4258 case PM_OPTIONAL_PARAMETER_NODE: {
4259 pm_buffer_append_string(buffer, "{\"type\":\"OptionalParameterNode\",\"location\":", 43);
4260
4262 pm_dump_json_location(buffer, &cast->base.location);
4263
4264 // Dump the ParameterFlags field
4265 pm_buffer_append_byte(buffer, ',');
4266 pm_buffer_append_string(buffer, "\"flags\":", 8);
4267 size_t flags = 0;
4268 pm_buffer_append_byte(buffer, '[');
4269 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
4270 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4271 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
4272 flags++;
4273 }
4274 pm_buffer_append_byte(buffer, ']');
4275
4276 // Dump the name field
4277 pm_buffer_append_byte(buffer, ',');
4278 pm_buffer_append_string(buffer, "\"name\":", 7);
4279 pm_dump_json_constant(buffer, parser, cast->name);
4280
4281 // Dump the name_loc field
4282 pm_buffer_append_byte(buffer, ',');
4283 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4284 pm_dump_json_location(buffer, &cast->name_loc);
4285
4286 // Dump the operator_loc field
4287 pm_buffer_append_byte(buffer, ',');
4288 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4289 pm_dump_json_location(buffer, &cast->operator_loc);
4290
4291 // Dump the value field
4292 pm_buffer_append_byte(buffer, ',');
4293 pm_buffer_append_string(buffer, "\"value\":", 8);
4294 pm_dump_json(buffer, parser, (const pm_node_t *) cast->value);
4295
4296 pm_buffer_append_byte(buffer, '}');
4297 break;
4298 }
4299 case PM_OR_NODE: {
4300 pm_buffer_append_string(buffer, "{\"type\":\"OrNode\",\"location\":", 28);
4301
4302 const pm_or_node_t *cast = (const pm_or_node_t *) node;
4303 pm_dump_json_location(buffer, &cast->base.location);
4304
4305 // Dump the left field
4306 pm_buffer_append_byte(buffer, ',');
4307 pm_buffer_append_string(buffer, "\"left\":", 7);
4308 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
4309
4310 // Dump the right field
4311 pm_buffer_append_byte(buffer, ',');
4312 pm_buffer_append_string(buffer, "\"right\":", 8);
4313 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
4314
4315 // Dump the operator_loc field
4316 pm_buffer_append_byte(buffer, ',');
4317 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4318 pm_dump_json_location(buffer, &cast->operator_loc);
4319
4320 pm_buffer_append_byte(buffer, '}');
4321 break;
4322 }
4323 case PM_PARAMETERS_NODE: {
4324 pm_buffer_append_string(buffer, "{\"type\":\"ParametersNode\",\"location\":", 36);
4325
4326 const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node;
4327 pm_dump_json_location(buffer, &cast->base.location);
4328
4329 // Dump the requireds field
4330 pm_buffer_append_byte(buffer, ',');
4331 pm_buffer_append_string(buffer, "\"requireds\":", 12);
4332 const pm_node_list_t *requireds = &cast->requireds;
4333 pm_buffer_append_byte(buffer, '[');
4334
4335 for (size_t index = 0; index < requireds->size; index++) {
4336 if (index != 0) pm_buffer_append_byte(buffer, ',');
4337 pm_dump_json(buffer, parser, requireds->nodes[index]);
4338 }
4339 pm_buffer_append_byte(buffer, ']');
4340
4341 // Dump the optionals field
4342 pm_buffer_append_byte(buffer, ',');
4343 pm_buffer_append_string(buffer, "\"optionals\":", 12);
4344 const pm_node_list_t *optionals = &cast->optionals;
4345 pm_buffer_append_byte(buffer, '[');
4346
4347 for (size_t index = 0; index < optionals->size; index++) {
4348 if (index != 0) pm_buffer_append_byte(buffer, ',');
4349 pm_dump_json(buffer, parser, optionals->nodes[index]);
4350 }
4351 pm_buffer_append_byte(buffer, ']');
4352
4353 // Dump the rest field
4354 pm_buffer_append_byte(buffer, ',');
4355 pm_buffer_append_string(buffer, "\"rest\":", 7);
4356 if (cast->rest != NULL) {
4357 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rest);
4358 } else {
4359 pm_buffer_append_string(buffer, "null", 4);
4360 }
4361
4362 // Dump the posts field
4363 pm_buffer_append_byte(buffer, ',');
4364 pm_buffer_append_string(buffer, "\"posts\":", 8);
4365 const pm_node_list_t *posts = &cast->posts;
4366 pm_buffer_append_byte(buffer, '[');
4367
4368 for (size_t index = 0; index < posts->size; index++) {
4369 if (index != 0) pm_buffer_append_byte(buffer, ',');
4370 pm_dump_json(buffer, parser, posts->nodes[index]);
4371 }
4372 pm_buffer_append_byte(buffer, ']');
4373
4374 // Dump the keywords field
4375 pm_buffer_append_byte(buffer, ',');
4376 pm_buffer_append_string(buffer, "\"keywords\":", 11);
4377 const pm_node_list_t *keywords = &cast->keywords;
4378 pm_buffer_append_byte(buffer, '[');
4379
4380 for (size_t index = 0; index < keywords->size; index++) {
4381 if (index != 0) pm_buffer_append_byte(buffer, ',');
4382 pm_dump_json(buffer, parser, keywords->nodes[index]);
4383 }
4384 pm_buffer_append_byte(buffer, ']');
4385
4386 // Dump the keyword_rest field
4387 pm_buffer_append_byte(buffer, ',');
4388 pm_buffer_append_string(buffer, "\"keyword_rest\":", 15);
4389 if (cast->keyword_rest != NULL) {
4390 pm_dump_json(buffer, parser, (const pm_node_t *) cast->keyword_rest);
4391 } else {
4392 pm_buffer_append_string(buffer, "null", 4);
4393 }
4394
4395 // Dump the block field
4396 pm_buffer_append_byte(buffer, ',');
4397 pm_buffer_append_string(buffer, "\"block\":", 8);
4398 if (cast->block != NULL) {
4399 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
4400 } else {
4401 pm_buffer_append_string(buffer, "null", 4);
4402 }
4403
4404 pm_buffer_append_byte(buffer, '}');
4405 break;
4406 }
4407 case PM_PARENTHESES_NODE: {
4408 pm_buffer_append_string(buffer, "{\"type\":\"ParenthesesNode\",\"location\":", 37);
4409
4410 const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node;
4411 pm_dump_json_location(buffer, &cast->base.location);
4412
4413 // Dump the ParenthesesNodeFlags field
4414 pm_buffer_append_byte(buffer, ',');
4415 pm_buffer_append_string(buffer, "\"flags\":", 8);
4416 size_t flags = 0;
4417 pm_buffer_append_byte(buffer, '[');
4418 if (PM_NODE_FLAG_P(cast, PM_PARENTHESES_NODE_FLAGS_MULTIPLE_STATEMENTS)) {
4419 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4420 pm_buffer_append_string(buffer, "\"MULTIPLE_STATEMENTS\"", 21);
4421 flags++;
4422 }
4423 pm_buffer_append_byte(buffer, ']');
4424
4425 // Dump the body field
4426 pm_buffer_append_byte(buffer, ',');
4427 pm_buffer_append_string(buffer, "\"body\":", 7);
4428 if (cast->body != NULL) {
4429 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
4430 } else {
4431 pm_buffer_append_string(buffer, "null", 4);
4432 }
4433
4434 // Dump the opening_loc field
4435 pm_buffer_append_byte(buffer, ',');
4436 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
4437 pm_dump_json_location(buffer, &cast->opening_loc);
4438
4439 // Dump the closing_loc field
4440 pm_buffer_append_byte(buffer, ',');
4441 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
4442 pm_dump_json_location(buffer, &cast->closing_loc);
4443
4444 pm_buffer_append_byte(buffer, '}');
4445 break;
4446 }
4447 case PM_PINNED_EXPRESSION_NODE: {
4448 pm_buffer_append_string(buffer, "{\"type\":\"PinnedExpressionNode\",\"location\":", 42);
4449
4450 const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node;
4451 pm_dump_json_location(buffer, &cast->base.location);
4452
4453 // Dump the expression field
4454 pm_buffer_append_byte(buffer, ',');
4455 pm_buffer_append_string(buffer, "\"expression\":", 13);
4456 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
4457
4458 // Dump the operator_loc field
4459 pm_buffer_append_byte(buffer, ',');
4460 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4461 pm_dump_json_location(buffer, &cast->operator_loc);
4462
4463 // Dump the lparen_loc field
4464 pm_buffer_append_byte(buffer, ',');
4465 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
4466 pm_dump_json_location(buffer, &cast->lparen_loc);
4467
4468 // Dump the rparen_loc field
4469 pm_buffer_append_byte(buffer, ',');
4470 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
4471 pm_dump_json_location(buffer, &cast->rparen_loc);
4472
4473 pm_buffer_append_byte(buffer, '}');
4474 break;
4475 }
4476 case PM_PINNED_VARIABLE_NODE: {
4477 pm_buffer_append_string(buffer, "{\"type\":\"PinnedVariableNode\",\"location\":", 40);
4478
4479 const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node;
4480 pm_dump_json_location(buffer, &cast->base.location);
4481
4482 // Dump the variable field
4483 pm_buffer_append_byte(buffer, ',');
4484 pm_buffer_append_string(buffer, "\"variable\":", 11);
4485 pm_dump_json(buffer, parser, (const pm_node_t *) cast->variable);
4486
4487 // Dump the operator_loc field
4488 pm_buffer_append_byte(buffer, ',');
4489 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4490 pm_dump_json_location(buffer, &cast->operator_loc);
4491
4492 pm_buffer_append_byte(buffer, '}');
4493 break;
4494 }
4495 case PM_POST_EXECUTION_NODE: {
4496 pm_buffer_append_string(buffer, "{\"type\":\"PostExecutionNode\",\"location\":", 39);
4497
4498 const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node;
4499 pm_dump_json_location(buffer, &cast->base.location);
4500
4501 // Dump the statements field
4502 pm_buffer_append_byte(buffer, ',');
4503 pm_buffer_append_string(buffer, "\"statements\":", 13);
4504 if (cast->statements != NULL) {
4505 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4506 } else {
4507 pm_buffer_append_string(buffer, "null", 4);
4508 }
4509
4510 // Dump the keyword_loc field
4511 pm_buffer_append_byte(buffer, ',');
4512 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4513 pm_dump_json_location(buffer, &cast->keyword_loc);
4514
4515 // Dump the opening_loc field
4516 pm_buffer_append_byte(buffer, ',');
4517 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
4518 pm_dump_json_location(buffer, &cast->opening_loc);
4519
4520 // Dump the closing_loc field
4521 pm_buffer_append_byte(buffer, ',');
4522 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
4523 pm_dump_json_location(buffer, &cast->closing_loc);
4524
4525 pm_buffer_append_byte(buffer, '}');
4526 break;
4527 }
4528 case PM_PRE_EXECUTION_NODE: {
4529 pm_buffer_append_string(buffer, "{\"type\":\"PreExecutionNode\",\"location\":", 38);
4530
4531 const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node;
4532 pm_dump_json_location(buffer, &cast->base.location);
4533
4534 // Dump the statements field
4535 pm_buffer_append_byte(buffer, ',');
4536 pm_buffer_append_string(buffer, "\"statements\":", 13);
4537 if (cast->statements != NULL) {
4538 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4539 } else {
4540 pm_buffer_append_string(buffer, "null", 4);
4541 }
4542
4543 // Dump the keyword_loc field
4544 pm_buffer_append_byte(buffer, ',');
4545 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4546 pm_dump_json_location(buffer, &cast->keyword_loc);
4547
4548 // Dump the opening_loc field
4549 pm_buffer_append_byte(buffer, ',');
4550 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
4551 pm_dump_json_location(buffer, &cast->opening_loc);
4552
4553 // Dump the closing_loc field
4554 pm_buffer_append_byte(buffer, ',');
4555 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
4556 pm_dump_json_location(buffer, &cast->closing_loc);
4557
4558 pm_buffer_append_byte(buffer, '}');
4559 break;
4560 }
4561 case PM_PROGRAM_NODE: {
4562 pm_buffer_append_string(buffer, "{\"type\":\"ProgramNode\",\"location\":", 33);
4563
4564 const pm_program_node_t *cast = (const pm_program_node_t *) node;
4565 pm_dump_json_location(buffer, &cast->base.location);
4566
4567 // Dump the locals field
4568 pm_buffer_append_byte(buffer, ',');
4569 pm_buffer_append_string(buffer, "\"locals\":", 9);
4570 const pm_constant_id_list_t *locals = &cast->locals;
4571 pm_buffer_append_byte(buffer, '[');
4572
4573 for (size_t index = 0; index < locals->size; index++) {
4574 if (index != 0) pm_buffer_append_byte(buffer, ',');
4575 pm_dump_json_constant(buffer, parser, locals->ids[index]);
4576 }
4577 pm_buffer_append_byte(buffer, ']');
4578
4579 // Dump the statements field
4580 pm_buffer_append_byte(buffer, ',');
4581 pm_buffer_append_string(buffer, "\"statements\":", 13);
4582 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4583
4584 pm_buffer_append_byte(buffer, '}');
4585 break;
4586 }
4587 case PM_RANGE_NODE: {
4588 pm_buffer_append_string(buffer, "{\"type\":\"RangeNode\",\"location\":", 31);
4589
4590 const pm_range_node_t *cast = (const pm_range_node_t *) node;
4591 pm_dump_json_location(buffer, &cast->base.location);
4592
4593 // Dump the RangeFlags field
4594 pm_buffer_append_byte(buffer, ',');
4595 pm_buffer_append_string(buffer, "\"flags\":", 8);
4596 size_t flags = 0;
4597 pm_buffer_append_byte(buffer, '[');
4598 if (PM_NODE_FLAG_P(cast, PM_RANGE_FLAGS_EXCLUDE_END)) {
4599 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4600 pm_buffer_append_string(buffer, "\"EXCLUDE_END\"", 13);
4601 flags++;
4602 }
4603 pm_buffer_append_byte(buffer, ']');
4604
4605 // Dump the left field
4606 pm_buffer_append_byte(buffer, ',');
4607 pm_buffer_append_string(buffer, "\"left\":", 7);
4608 if (cast->left != NULL) {
4609 pm_dump_json(buffer, parser, (const pm_node_t *) cast->left);
4610 } else {
4611 pm_buffer_append_string(buffer, "null", 4);
4612 }
4613
4614 // Dump the right field
4615 pm_buffer_append_byte(buffer, ',');
4616 pm_buffer_append_string(buffer, "\"right\":", 8);
4617 if (cast->right != NULL) {
4618 pm_dump_json(buffer, parser, (const pm_node_t *) cast->right);
4619 } else {
4620 pm_buffer_append_string(buffer, "null", 4);
4621 }
4622
4623 // Dump the operator_loc field
4624 pm_buffer_append_byte(buffer, ',');
4625 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4626 pm_dump_json_location(buffer, &cast->operator_loc);
4627
4628 pm_buffer_append_byte(buffer, '}');
4629 break;
4630 }
4631 case PM_RATIONAL_NODE: {
4632 pm_buffer_append_string(buffer, "{\"type\":\"RationalNode\",\"location\":", 34);
4633
4634 const pm_rational_node_t *cast = (const pm_rational_node_t *) node;
4635 pm_dump_json_location(buffer, &cast->base.location);
4636
4637 // Dump the IntegerBaseFlags field
4638 pm_buffer_append_byte(buffer, ',');
4639 pm_buffer_append_string(buffer, "\"flags\":", 8);
4640 size_t flags = 0;
4641 pm_buffer_append_byte(buffer, '[');
4642 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_BINARY)) {
4643 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4644 pm_buffer_append_string(buffer, "\"BINARY\"", 8);
4645 flags++;
4646 }
4647 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_DECIMAL)) {
4648 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4649 pm_buffer_append_string(buffer, "\"DECIMAL\"", 9);
4650 flags++;
4651 }
4652 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_OCTAL)) {
4653 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4654 pm_buffer_append_string(buffer, "\"OCTAL\"", 7);
4655 flags++;
4656 }
4657 if (PM_NODE_FLAG_P(cast, PM_INTEGER_BASE_FLAGS_HEXADECIMAL)) {
4658 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4659 pm_buffer_append_string(buffer, "\"HEXADECIMAL\"", 13);
4660 flags++;
4661 }
4662 pm_buffer_append_byte(buffer, ']');
4663
4664 // Dump the numerator field
4665 pm_buffer_append_byte(buffer, ',');
4666 pm_buffer_append_string(buffer, "\"numerator\":", 12);
4667 pm_integer_string(buffer, &cast->numerator);
4668
4669 // Dump the denominator field
4670 pm_buffer_append_byte(buffer, ',');
4671 pm_buffer_append_string(buffer, "\"denominator\":", 14);
4672 pm_integer_string(buffer, &cast->denominator);
4673
4674 pm_buffer_append_byte(buffer, '}');
4675 break;
4676 }
4677 case PM_REDO_NODE: {
4678 pm_buffer_append_string(buffer, "{\"type\":\"RedoNode\",\"location\":", 30);
4679
4680 const pm_redo_node_t *cast = (const pm_redo_node_t *) node;
4681 pm_dump_json_location(buffer, &cast->base.location);
4682
4683 pm_buffer_append_byte(buffer, '}');
4684 break;
4685 }
4686 case PM_REGULAR_EXPRESSION_NODE: {
4687 pm_buffer_append_string(buffer, "{\"type\":\"RegularExpressionNode\",\"location\":", 43);
4688
4690 pm_dump_json_location(buffer, &cast->base.location);
4691
4692 // Dump the RegularExpressionFlags field
4693 pm_buffer_append_byte(buffer, ',');
4694 pm_buffer_append_string(buffer, "\"flags\":", 8);
4695 size_t flags = 0;
4696 pm_buffer_append_byte(buffer, '[');
4697 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE)) {
4698 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4699 pm_buffer_append_string(buffer, "\"IGNORE_CASE\"", 13);
4700 flags++;
4701 }
4702 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EXTENDED)) {
4703 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4704 pm_buffer_append_string(buffer, "\"EXTENDED\"", 10);
4705 flags++;
4706 }
4707 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE)) {
4708 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4709 pm_buffer_append_string(buffer, "\"MULTI_LINE\"", 12);
4710 flags++;
4711 }
4712 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ONCE)) {
4713 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4714 pm_buffer_append_string(buffer, "\"ONCE\"", 6);
4715 flags++;
4716 }
4717 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_EUC_JP)) {
4718 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4719 pm_buffer_append_string(buffer, "\"EUC_JP\"", 8);
4720 flags++;
4721 }
4722 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT)) {
4723 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4724 pm_buffer_append_string(buffer, "\"ASCII_8BIT\"", 12);
4725 flags++;
4726 }
4727 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J)) {
4728 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4729 pm_buffer_append_string(buffer, "\"WINDOWS_31J\"", 13);
4730 flags++;
4731 }
4732 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_UTF_8)) {
4733 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4734 pm_buffer_append_string(buffer, "\"UTF_8\"", 7);
4735 flags++;
4736 }
4737 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING)) {
4738 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4739 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
4740 flags++;
4741 }
4742 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING)) {
4743 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4744 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
4745 flags++;
4746 }
4747 if (PM_NODE_FLAG_P(cast, PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING)) {
4748 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4749 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
4750 flags++;
4751 }
4752 pm_buffer_append_byte(buffer, ']');
4753
4754 // Dump the opening_loc field
4755 pm_buffer_append_byte(buffer, ',');
4756 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
4757 pm_dump_json_location(buffer, &cast->opening_loc);
4758
4759 // Dump the content_loc field
4760 pm_buffer_append_byte(buffer, ',');
4761 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
4762 pm_dump_json_location(buffer, &cast->content_loc);
4763
4764 // Dump the closing_loc field
4765 pm_buffer_append_byte(buffer, ',');
4766 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
4767 pm_dump_json_location(buffer, &cast->closing_loc);
4768
4769 // Dump the unescaped field
4770 pm_buffer_append_byte(buffer, ',');
4771 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
4772 const pm_string_t *unescaped = &cast->unescaped;
4773 pm_buffer_append_byte(buffer, '"');
4774 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
4775 pm_buffer_append_byte(buffer, '"');
4776
4777 pm_buffer_append_byte(buffer, '}');
4778 break;
4779 }
4780 case PM_REQUIRED_KEYWORD_PARAMETER_NODE: {
4781 pm_buffer_append_string(buffer, "{\"type\":\"RequiredKeywordParameterNode\",\"location\":", 50);
4782
4784 pm_dump_json_location(buffer, &cast->base.location);
4785
4786 // Dump the ParameterFlags field
4787 pm_buffer_append_byte(buffer, ',');
4788 pm_buffer_append_string(buffer, "\"flags\":", 8);
4789 size_t flags = 0;
4790 pm_buffer_append_byte(buffer, '[');
4791 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
4792 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4793 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
4794 flags++;
4795 }
4796 pm_buffer_append_byte(buffer, ']');
4797
4798 // Dump the name field
4799 pm_buffer_append_byte(buffer, ',');
4800 pm_buffer_append_string(buffer, "\"name\":", 7);
4801 pm_dump_json_constant(buffer, parser, cast->name);
4802
4803 // Dump the name_loc field
4804 pm_buffer_append_byte(buffer, ',');
4805 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4806 pm_dump_json_location(buffer, &cast->name_loc);
4807
4808 pm_buffer_append_byte(buffer, '}');
4809 break;
4810 }
4811 case PM_REQUIRED_PARAMETER_NODE: {
4812 pm_buffer_append_string(buffer, "{\"type\":\"RequiredParameterNode\",\"location\":", 43);
4813
4815 pm_dump_json_location(buffer, &cast->base.location);
4816
4817 // Dump the ParameterFlags field
4818 pm_buffer_append_byte(buffer, ',');
4819 pm_buffer_append_string(buffer, "\"flags\":", 8);
4820 size_t flags = 0;
4821 pm_buffer_append_byte(buffer, '[');
4822 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
4823 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4824 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
4825 flags++;
4826 }
4827 pm_buffer_append_byte(buffer, ']');
4828
4829 // Dump the name field
4830 pm_buffer_append_byte(buffer, ',');
4831 pm_buffer_append_string(buffer, "\"name\":", 7);
4832 pm_dump_json_constant(buffer, parser, cast->name);
4833
4834 pm_buffer_append_byte(buffer, '}');
4835 break;
4836 }
4837 case PM_RESCUE_MODIFIER_NODE: {
4838 pm_buffer_append_string(buffer, "{\"type\":\"RescueModifierNode\",\"location\":", 40);
4839
4840 const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node;
4841 pm_dump_json_location(buffer, &cast->base.location);
4842
4843 // Dump the expression field
4844 pm_buffer_append_byte(buffer, ',');
4845 pm_buffer_append_string(buffer, "\"expression\":", 13);
4846 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
4847
4848 // Dump the keyword_loc field
4849 pm_buffer_append_byte(buffer, ',');
4850 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4851 pm_dump_json_location(buffer, &cast->keyword_loc);
4852
4853 // Dump the rescue_expression field
4854 pm_buffer_append_byte(buffer, ',');
4855 pm_buffer_append_string(buffer, "\"rescue_expression\":", 20);
4856 pm_dump_json(buffer, parser, (const pm_node_t *) cast->rescue_expression);
4857
4858 pm_buffer_append_byte(buffer, '}');
4859 break;
4860 }
4861 case PM_RESCUE_NODE: {
4862 pm_buffer_append_string(buffer, "{\"type\":\"RescueNode\",\"location\":", 32);
4863
4864 const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node;
4865 pm_dump_json_location(buffer, &cast->base.location);
4866
4867 // Dump the keyword_loc field
4868 pm_buffer_append_byte(buffer, ',');
4869 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4870 pm_dump_json_location(buffer, &cast->keyword_loc);
4871
4872 // Dump the exceptions field
4873 pm_buffer_append_byte(buffer, ',');
4874 pm_buffer_append_string(buffer, "\"exceptions\":", 13);
4875 const pm_node_list_t *exceptions = &cast->exceptions;
4876 pm_buffer_append_byte(buffer, '[');
4877
4878 for (size_t index = 0; index < exceptions->size; index++) {
4879 if (index != 0) pm_buffer_append_byte(buffer, ',');
4880 pm_dump_json(buffer, parser, exceptions->nodes[index]);
4881 }
4882 pm_buffer_append_byte(buffer, ']');
4883
4884 // Dump the operator_loc field
4885 pm_buffer_append_byte(buffer, ',');
4886 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4887 if (cast->operator_loc.length != 0) {
4888 pm_dump_json_location(buffer, &cast->operator_loc);
4889 } else {
4890 pm_buffer_append_string(buffer, "null", 4);
4891 }
4892
4893 // Dump the reference field
4894 pm_buffer_append_byte(buffer, ',');
4895 pm_buffer_append_string(buffer, "\"reference\":", 12);
4896 if (cast->reference != NULL) {
4897 pm_dump_json(buffer, parser, (const pm_node_t *) cast->reference);
4898 } else {
4899 pm_buffer_append_string(buffer, "null", 4);
4900 }
4901
4902 // Dump the then_keyword_loc field
4903 pm_buffer_append_byte(buffer, ',');
4904 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
4905 if (cast->then_keyword_loc.length != 0) {
4906 pm_dump_json_location(buffer, &cast->then_keyword_loc);
4907 } else {
4908 pm_buffer_append_string(buffer, "null", 4);
4909 }
4910
4911 // Dump the statements field
4912 pm_buffer_append_byte(buffer, ',');
4913 pm_buffer_append_string(buffer, "\"statements\":", 13);
4914 if (cast->statements != NULL) {
4915 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
4916 } else {
4917 pm_buffer_append_string(buffer, "null", 4);
4918 }
4919
4920 // Dump the subsequent field
4921 pm_buffer_append_byte(buffer, ',');
4922 pm_buffer_append_string(buffer, "\"subsequent\":", 13);
4923 if (cast->subsequent != NULL) {
4924 pm_dump_json(buffer, parser, (const pm_node_t *) cast->subsequent);
4925 } else {
4926 pm_buffer_append_string(buffer, "null", 4);
4927 }
4928
4929 pm_buffer_append_byte(buffer, '}');
4930 break;
4931 }
4932 case PM_REST_PARAMETER_NODE: {
4933 pm_buffer_append_string(buffer, "{\"type\":\"RestParameterNode\",\"location\":", 39);
4934
4935 const pm_rest_parameter_node_t *cast = (const pm_rest_parameter_node_t *) node;
4936 pm_dump_json_location(buffer, &cast->base.location);
4937
4938 // Dump the ParameterFlags field
4939 pm_buffer_append_byte(buffer, ',');
4940 pm_buffer_append_string(buffer, "\"flags\":", 8);
4941 size_t flags = 0;
4942 pm_buffer_append_byte(buffer, '[');
4943 if (PM_NODE_FLAG_P(cast, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
4944 if (flags != 0) pm_buffer_append_byte(buffer, ',');
4945 pm_buffer_append_string(buffer, "\"REPEATED_PARAMETER\"", 20);
4946 flags++;
4947 }
4948 pm_buffer_append_byte(buffer, ']');
4949
4950 // Dump the name field
4951 pm_buffer_append_byte(buffer, ',');
4952 pm_buffer_append_string(buffer, "\"name\":", 7);
4953 if (cast->name != PM_CONSTANT_ID_UNSET) {
4954 pm_dump_json_constant(buffer, parser, cast->name);
4955 } else {
4956 pm_buffer_append_string(buffer, "null", 4);
4957 }
4958
4959 // Dump the name_loc field
4960 pm_buffer_append_byte(buffer, ',');
4961 pm_buffer_append_string(buffer, "\"name_loc\":", 11);
4962 if (cast->name_loc.length != 0) {
4963 pm_dump_json_location(buffer, &cast->name_loc);
4964 } else {
4965 pm_buffer_append_string(buffer, "null", 4);
4966 }
4967
4968 // Dump the operator_loc field
4969 pm_buffer_append_byte(buffer, ',');
4970 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
4971 pm_dump_json_location(buffer, &cast->operator_loc);
4972
4973 pm_buffer_append_byte(buffer, '}');
4974 break;
4975 }
4976 case PM_RETRY_NODE: {
4977 pm_buffer_append_string(buffer, "{\"type\":\"RetryNode\",\"location\":", 31);
4978
4979 const pm_retry_node_t *cast = (const pm_retry_node_t *) node;
4980 pm_dump_json_location(buffer, &cast->base.location);
4981
4982 pm_buffer_append_byte(buffer, '}');
4983 break;
4984 }
4985 case PM_RETURN_NODE: {
4986 pm_buffer_append_string(buffer, "{\"type\":\"ReturnNode\",\"location\":", 32);
4987
4988 const pm_return_node_t *cast = (const pm_return_node_t *) node;
4989 pm_dump_json_location(buffer, &cast->base.location);
4990
4991 // Dump the keyword_loc field
4992 pm_buffer_append_byte(buffer, ',');
4993 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
4994 pm_dump_json_location(buffer, &cast->keyword_loc);
4995
4996 // Dump the arguments field
4997 pm_buffer_append_byte(buffer, ',');
4998 pm_buffer_append_string(buffer, "\"arguments\":", 12);
4999 if (cast->arguments != NULL) {
5000 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5001 } else {
5002 pm_buffer_append_string(buffer, "null", 4);
5003 }
5004
5005 pm_buffer_append_byte(buffer, '}');
5006 break;
5007 }
5008 case PM_SELF_NODE: {
5009 pm_buffer_append_string(buffer, "{\"type\":\"SelfNode\",\"location\":", 30);
5010
5011 const pm_self_node_t *cast = (const pm_self_node_t *) node;
5012 pm_dump_json_location(buffer, &cast->base.location);
5013
5014 pm_buffer_append_byte(buffer, '}');
5015 break;
5016 }
5017 case PM_SHAREABLE_CONSTANT_NODE: {
5018 pm_buffer_append_string(buffer, "{\"type\":\"ShareableConstantNode\",\"location\":", 43);
5019
5021 pm_dump_json_location(buffer, &cast->base.location);
5022
5023 // Dump the ShareableConstantNodeFlags field
5024 pm_buffer_append_byte(buffer, ',');
5025 pm_buffer_append_string(buffer, "\"flags\":", 8);
5026 size_t flags = 0;
5027 pm_buffer_append_byte(buffer, '[');
5028 if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL)) {
5029 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5030 pm_buffer_append_string(buffer, "\"LITERAL\"", 9);
5031 flags++;
5032 }
5033 if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING)) {
5034 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5035 pm_buffer_append_string(buffer, "\"EXPERIMENTAL_EVERYTHING\"", 25);
5036 flags++;
5037 }
5038 if (PM_NODE_FLAG_P(cast, PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY)) {
5039 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5040 pm_buffer_append_string(buffer, "\"EXPERIMENTAL_COPY\"", 19);
5041 flags++;
5042 }
5043 pm_buffer_append_byte(buffer, ']');
5044
5045 // Dump the write field
5046 pm_buffer_append_byte(buffer, ',');
5047 pm_buffer_append_string(buffer, "\"write\":", 8);
5048 pm_dump_json(buffer, parser, (const pm_node_t *) cast->write);
5049
5050 pm_buffer_append_byte(buffer, '}');
5051 break;
5052 }
5053 case PM_SINGLETON_CLASS_NODE: {
5054 pm_buffer_append_string(buffer, "{\"type\":\"SingletonClassNode\",\"location\":", 40);
5055
5056 const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node;
5057 pm_dump_json_location(buffer, &cast->base.location);
5058
5059 // Dump the locals field
5060 pm_buffer_append_byte(buffer, ',');
5061 pm_buffer_append_string(buffer, "\"locals\":", 9);
5062 const pm_constant_id_list_t *locals = &cast->locals;
5063 pm_buffer_append_byte(buffer, '[');
5064
5065 for (size_t index = 0; index < locals->size; index++) {
5066 if (index != 0) pm_buffer_append_byte(buffer, ',');
5067 pm_dump_json_constant(buffer, parser, locals->ids[index]);
5068 }
5069 pm_buffer_append_byte(buffer, ']');
5070
5071 // Dump the class_keyword_loc field
5072 pm_buffer_append_byte(buffer, ',');
5073 pm_buffer_append_string(buffer, "\"class_keyword_loc\":", 20);
5074 pm_dump_json_location(buffer, &cast->class_keyword_loc);
5075
5076 // Dump the operator_loc field
5077 pm_buffer_append_byte(buffer, ',');
5078 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5079 pm_dump_json_location(buffer, &cast->operator_loc);
5080
5081 // Dump the expression field
5082 pm_buffer_append_byte(buffer, ',');
5083 pm_buffer_append_string(buffer, "\"expression\":", 13);
5084 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
5085
5086 // Dump the body field
5087 pm_buffer_append_byte(buffer, ',');
5088 pm_buffer_append_string(buffer, "\"body\":", 7);
5089 if (cast->body != NULL) {
5090 pm_dump_json(buffer, parser, (const pm_node_t *) cast->body);
5091 } else {
5092 pm_buffer_append_string(buffer, "null", 4);
5093 }
5094
5095 // Dump the end_keyword_loc field
5096 pm_buffer_append_byte(buffer, ',');
5097 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5098 pm_dump_json_location(buffer, &cast->end_keyword_loc);
5099
5100 pm_buffer_append_byte(buffer, '}');
5101 break;
5102 }
5103 case PM_SOURCE_ENCODING_NODE: {
5104 pm_buffer_append_string(buffer, "{\"type\":\"SourceEncodingNode\",\"location\":", 40);
5105
5106 const pm_source_encoding_node_t *cast = (const pm_source_encoding_node_t *) node;
5107 pm_dump_json_location(buffer, &cast->base.location);
5108
5109 pm_buffer_append_byte(buffer, '}');
5110 break;
5111 }
5112 case PM_SOURCE_FILE_NODE: {
5113 pm_buffer_append_string(buffer, "{\"type\":\"SourceFileNode\",\"location\":", 36);
5114
5115 const pm_source_file_node_t *cast = (const pm_source_file_node_t *) node;
5116 pm_dump_json_location(buffer, &cast->base.location);
5117
5118 // Dump the StringFlags field
5119 pm_buffer_append_byte(buffer, ',');
5120 pm_buffer_append_string(buffer, "\"flags\":", 8);
5121 size_t flags = 0;
5122 pm_buffer_append_byte(buffer, '[');
5123 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_UTF8_ENCODING)) {
5124 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5125 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
5126 flags++;
5127 }
5128 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_BINARY_ENCODING)) {
5129 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5130 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
5131 flags++;
5132 }
5133 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) {
5134 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5135 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
5136 flags++;
5137 }
5138 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_MUTABLE)) {
5139 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5140 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
5141 flags++;
5142 }
5143 pm_buffer_append_byte(buffer, ']');
5144
5145 // Dump the filepath field
5146 pm_buffer_append_byte(buffer, ',');
5147 pm_buffer_append_string(buffer, "\"filepath\":", 11);
5148 const pm_string_t *filepath = &cast->filepath;
5149 pm_buffer_append_byte(buffer, '"');
5150 pm_buffer_append_source(buffer, pm_string_source(filepath), pm_string_length(filepath), PM_BUFFER_ESCAPING_JSON);
5151 pm_buffer_append_byte(buffer, '"');
5152
5153 pm_buffer_append_byte(buffer, '}');
5154 break;
5155 }
5156 case PM_SOURCE_LINE_NODE: {
5157 pm_buffer_append_string(buffer, "{\"type\":\"SourceLineNode\",\"location\":", 36);
5158
5159 const pm_source_line_node_t *cast = (const pm_source_line_node_t *) node;
5160 pm_dump_json_location(buffer, &cast->base.location);
5161
5162 pm_buffer_append_byte(buffer, '}');
5163 break;
5164 }
5165 case PM_SPLAT_NODE: {
5166 pm_buffer_append_string(buffer, "{\"type\":\"SplatNode\",\"location\":", 31);
5167
5168 const pm_splat_node_t *cast = (const pm_splat_node_t *) node;
5169 pm_dump_json_location(buffer, &cast->base.location);
5170
5171 // Dump the operator_loc field
5172 pm_buffer_append_byte(buffer, ',');
5173 pm_buffer_append_string(buffer, "\"operator_loc\":", 15);
5174 pm_dump_json_location(buffer, &cast->operator_loc);
5175
5176 // Dump the expression field
5177 pm_buffer_append_byte(buffer, ',');
5178 pm_buffer_append_string(buffer, "\"expression\":", 13);
5179 if (cast->expression != NULL) {
5180 pm_dump_json(buffer, parser, (const pm_node_t *) cast->expression);
5181 } else {
5182 pm_buffer_append_string(buffer, "null", 4);
5183 }
5184
5185 pm_buffer_append_byte(buffer, '}');
5186 break;
5187 }
5188 case PM_STATEMENTS_NODE: {
5189 pm_buffer_append_string(buffer, "{\"type\":\"StatementsNode\",\"location\":", 36);
5190
5191 const pm_statements_node_t *cast = (const pm_statements_node_t *) node;
5192 pm_dump_json_location(buffer, &cast->base.location);
5193
5194 // Dump the body field
5195 pm_buffer_append_byte(buffer, ',');
5196 pm_buffer_append_string(buffer, "\"body\":", 7);
5197 const pm_node_list_t *body = &cast->body;
5198 pm_buffer_append_byte(buffer, '[');
5199
5200 for (size_t index = 0; index < body->size; index++) {
5201 if (index != 0) pm_buffer_append_byte(buffer, ',');
5202 pm_dump_json(buffer, parser, body->nodes[index]);
5203 }
5204 pm_buffer_append_byte(buffer, ']');
5205
5206 pm_buffer_append_byte(buffer, '}');
5207 break;
5208 }
5209 case PM_STRING_NODE: {
5210 pm_buffer_append_string(buffer, "{\"type\":\"StringNode\",\"location\":", 32);
5211
5212 const pm_string_node_t *cast = (const pm_string_node_t *) node;
5213 pm_dump_json_location(buffer, &cast->base.location);
5214
5215 // Dump the StringFlags field
5216 pm_buffer_append_byte(buffer, ',');
5217 pm_buffer_append_string(buffer, "\"flags\":", 8);
5218 size_t flags = 0;
5219 pm_buffer_append_byte(buffer, '[');
5220 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_UTF8_ENCODING)) {
5221 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5222 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
5223 flags++;
5224 }
5225 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FORCED_BINARY_ENCODING)) {
5226 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5227 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
5228 flags++;
5229 }
5230 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_FROZEN)) {
5231 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5232 pm_buffer_append_string(buffer, "\"FROZEN\"", 8);
5233 flags++;
5234 }
5235 if (PM_NODE_FLAG_P(cast, PM_STRING_FLAGS_MUTABLE)) {
5236 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5237 pm_buffer_append_string(buffer, "\"MUTABLE\"", 9);
5238 flags++;
5239 }
5240 pm_buffer_append_byte(buffer, ']');
5241
5242 // Dump the opening_loc field
5243 pm_buffer_append_byte(buffer, ',');
5244 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5245 if (cast->opening_loc.length != 0) {
5246 pm_dump_json_location(buffer, &cast->opening_loc);
5247 } else {
5248 pm_buffer_append_string(buffer, "null", 4);
5249 }
5250
5251 // Dump the content_loc field
5252 pm_buffer_append_byte(buffer, ',');
5253 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
5254 pm_dump_json_location(buffer, &cast->content_loc);
5255
5256 // Dump the closing_loc field
5257 pm_buffer_append_byte(buffer, ',');
5258 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5259 if (cast->closing_loc.length != 0) {
5260 pm_dump_json_location(buffer, &cast->closing_loc);
5261 } else {
5262 pm_buffer_append_string(buffer, "null", 4);
5263 }
5264
5265 // Dump the unescaped field
5266 pm_buffer_append_byte(buffer, ',');
5267 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
5268 const pm_string_t *unescaped = &cast->unescaped;
5269 pm_buffer_append_byte(buffer, '"');
5270 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
5271 pm_buffer_append_byte(buffer, '"');
5272
5273 pm_buffer_append_byte(buffer, '}');
5274 break;
5275 }
5276 case PM_SUPER_NODE: {
5277 pm_buffer_append_string(buffer, "{\"type\":\"SuperNode\",\"location\":", 31);
5278
5279 const pm_super_node_t *cast = (const pm_super_node_t *) node;
5280 pm_dump_json_location(buffer, &cast->base.location);
5281
5282 // Dump the keyword_loc field
5283 pm_buffer_append_byte(buffer, ',');
5284 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
5285 pm_dump_json_location(buffer, &cast->keyword_loc);
5286
5287 // Dump the lparen_loc field
5288 pm_buffer_append_byte(buffer, ',');
5289 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
5290 if (cast->lparen_loc.length != 0) {
5291 pm_dump_json_location(buffer, &cast->lparen_loc);
5292 } else {
5293 pm_buffer_append_string(buffer, "null", 4);
5294 }
5295
5296 // Dump the arguments field
5297 pm_buffer_append_byte(buffer, ',');
5298 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5299 if (cast->arguments != NULL) {
5300 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5301 } else {
5302 pm_buffer_append_string(buffer, "null", 4);
5303 }
5304
5305 // Dump the rparen_loc field
5306 pm_buffer_append_byte(buffer, ',');
5307 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
5308 if (cast->rparen_loc.length != 0) {
5309 pm_dump_json_location(buffer, &cast->rparen_loc);
5310 } else {
5311 pm_buffer_append_string(buffer, "null", 4);
5312 }
5313
5314 // Dump the block field
5315 pm_buffer_append_byte(buffer, ',');
5316 pm_buffer_append_string(buffer, "\"block\":", 8);
5317 if (cast->block != NULL) {
5318 pm_dump_json(buffer, parser, (const pm_node_t *) cast->block);
5319 } else {
5320 pm_buffer_append_string(buffer, "null", 4);
5321 }
5322
5323 pm_buffer_append_byte(buffer, '}');
5324 break;
5325 }
5326 case PM_SYMBOL_NODE: {
5327 pm_buffer_append_string(buffer, "{\"type\":\"SymbolNode\",\"location\":", 32);
5328
5329 const pm_symbol_node_t *cast = (const pm_symbol_node_t *) node;
5330 pm_dump_json_location(buffer, &cast->base.location);
5331
5332 // Dump the SymbolFlags field
5333 pm_buffer_append_byte(buffer, ',');
5334 pm_buffer_append_string(buffer, "\"flags\":", 8);
5335 size_t flags = 0;
5336 pm_buffer_append_byte(buffer, '[');
5337 if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING)) {
5338 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5339 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
5340 flags++;
5341 }
5342 if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING)) {
5343 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5344 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
5345 flags++;
5346 }
5347 if (PM_NODE_FLAG_P(cast, PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING)) {
5348 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5349 pm_buffer_append_string(buffer, "\"FORCED_US_ASCII_ENCODING\"", 26);
5350 flags++;
5351 }
5352 pm_buffer_append_byte(buffer, ']');
5353
5354 // Dump the opening_loc field
5355 pm_buffer_append_byte(buffer, ',');
5356 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5357 if (cast->opening_loc.length != 0) {
5358 pm_dump_json_location(buffer, &cast->opening_loc);
5359 } else {
5360 pm_buffer_append_string(buffer, "null", 4);
5361 }
5362
5363 // Dump the value_loc field
5364 pm_buffer_append_byte(buffer, ',');
5365 pm_buffer_append_string(buffer, "\"value_loc\":", 12);
5366 if (cast->value_loc.length != 0) {
5367 pm_dump_json_location(buffer, &cast->value_loc);
5368 } else {
5369 pm_buffer_append_string(buffer, "null", 4);
5370 }
5371
5372 // Dump the closing_loc field
5373 pm_buffer_append_byte(buffer, ',');
5374 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5375 if (cast->closing_loc.length != 0) {
5376 pm_dump_json_location(buffer, &cast->closing_loc);
5377 } else {
5378 pm_buffer_append_string(buffer, "null", 4);
5379 }
5380
5381 // Dump the unescaped field
5382 pm_buffer_append_byte(buffer, ',');
5383 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
5384 const pm_string_t *unescaped = &cast->unescaped;
5385 pm_buffer_append_byte(buffer, '"');
5386 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
5387 pm_buffer_append_byte(buffer, '"');
5388
5389 pm_buffer_append_byte(buffer, '}');
5390 break;
5391 }
5392 case PM_TRUE_NODE: {
5393 pm_buffer_append_string(buffer, "{\"type\":\"TrueNode\",\"location\":", 30);
5394
5395 const pm_true_node_t *cast = (const pm_true_node_t *) node;
5396 pm_dump_json_location(buffer, &cast->base.location);
5397
5398 pm_buffer_append_byte(buffer, '}');
5399 break;
5400 }
5401 case PM_UNDEF_NODE: {
5402 pm_buffer_append_string(buffer, "{\"type\":\"UndefNode\",\"location\":", 31);
5403
5404 const pm_undef_node_t *cast = (const pm_undef_node_t *) node;
5405 pm_dump_json_location(buffer, &cast->base.location);
5406
5407 // Dump the names field
5408 pm_buffer_append_byte(buffer, ',');
5409 pm_buffer_append_string(buffer, "\"names\":", 8);
5410 const pm_node_list_t *names = &cast->names;
5411 pm_buffer_append_byte(buffer, '[');
5412
5413 for (size_t index = 0; index < names->size; index++) {
5414 if (index != 0) pm_buffer_append_byte(buffer, ',');
5415 pm_dump_json(buffer, parser, names->nodes[index]);
5416 }
5417 pm_buffer_append_byte(buffer, ']');
5418
5419 // Dump the keyword_loc field
5420 pm_buffer_append_byte(buffer, ',');
5421 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
5422 pm_dump_json_location(buffer, &cast->keyword_loc);
5423
5424 pm_buffer_append_byte(buffer, '}');
5425 break;
5426 }
5427 case PM_UNLESS_NODE: {
5428 pm_buffer_append_string(buffer, "{\"type\":\"UnlessNode\",\"location\":", 32);
5429
5430 const pm_unless_node_t *cast = (const pm_unless_node_t *) node;
5431 pm_dump_json_location(buffer, &cast->base.location);
5432
5433 // Dump the unless_keyword_loc field
5434 pm_buffer_append_byte(buffer, ',');
5435 pm_buffer_append_string(buffer, "\"unless_keyword_loc\":", 21);
5436 pm_dump_json_location(buffer, &cast->unless_keyword_loc);
5437
5438 // Dump the predicate field
5439 pm_buffer_append_byte(buffer, ',');
5440 pm_buffer_append_string(buffer, "\"predicate\":", 12);
5441 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
5442
5443 // Dump the then_keyword_loc field
5444 pm_buffer_append_byte(buffer, ',');
5445 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
5446 if (cast->then_keyword_loc.length != 0) {
5447 pm_dump_json_location(buffer, &cast->then_keyword_loc);
5448 } else {
5449 pm_buffer_append_string(buffer, "null", 4);
5450 }
5451
5452 // Dump the statements field
5453 pm_buffer_append_byte(buffer, ',');
5454 pm_buffer_append_string(buffer, "\"statements\":", 13);
5455 if (cast->statements != NULL) {
5456 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5457 } else {
5458 pm_buffer_append_string(buffer, "null", 4);
5459 }
5460
5461 // Dump the else_clause field
5462 pm_buffer_append_byte(buffer, ',');
5463 pm_buffer_append_string(buffer, "\"else_clause\":", 14);
5464 if (cast->else_clause != NULL) {
5465 pm_dump_json(buffer, parser, (const pm_node_t *) cast->else_clause);
5466 } else {
5467 pm_buffer_append_string(buffer, "null", 4);
5468 }
5469
5470 // Dump the end_keyword_loc field
5471 pm_buffer_append_byte(buffer, ',');
5472 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5473 if (cast->end_keyword_loc.length != 0) {
5474 pm_dump_json_location(buffer, &cast->end_keyword_loc);
5475 } else {
5476 pm_buffer_append_string(buffer, "null", 4);
5477 }
5478
5479 pm_buffer_append_byte(buffer, '}');
5480 break;
5481 }
5482 case PM_UNTIL_NODE: {
5483 pm_buffer_append_string(buffer, "{\"type\":\"UntilNode\",\"location\":", 31);
5484
5485 const pm_until_node_t *cast = (const pm_until_node_t *) node;
5486 pm_dump_json_location(buffer, &cast->base.location);
5487
5488 // Dump the LoopFlags field
5489 pm_buffer_append_byte(buffer, ',');
5490 pm_buffer_append_string(buffer, "\"flags\":", 8);
5491 size_t flags = 0;
5492 pm_buffer_append_byte(buffer, '[');
5493 if (PM_NODE_FLAG_P(cast, PM_LOOP_FLAGS_BEGIN_MODIFIER)) {
5494 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5495 pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16);
5496 flags++;
5497 }
5498 pm_buffer_append_byte(buffer, ']');
5499
5500 // Dump the until_keyword_loc field
5501 pm_buffer_append_byte(buffer, ',');
5502 pm_buffer_append_string(buffer, "\"until_keyword_loc\":", 20);
5503 pm_dump_json_location(buffer, &cast->until_keyword_loc);
5504
5505 // Dump the do_keyword_loc field
5506 pm_buffer_append_byte(buffer, ',');
5507 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
5508 if (cast->do_keyword_loc.length != 0) {
5509 pm_dump_json_location(buffer, &cast->do_keyword_loc);
5510 } else {
5511 pm_buffer_append_string(buffer, "null", 4);
5512 }
5513
5514 // Dump the end_keyword_loc field
5515 pm_buffer_append_byte(buffer, ',');
5516 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5517 if (cast->end_keyword_loc.length != 0) {
5518 pm_dump_json_location(buffer, &cast->end_keyword_loc);
5519 } else {
5520 pm_buffer_append_string(buffer, "null", 4);
5521 }
5522
5523 // Dump the predicate field
5524 pm_buffer_append_byte(buffer, ',');
5525 pm_buffer_append_string(buffer, "\"predicate\":", 12);
5526 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
5527
5528 // Dump the statements field
5529 pm_buffer_append_byte(buffer, ',');
5530 pm_buffer_append_string(buffer, "\"statements\":", 13);
5531 if (cast->statements != NULL) {
5532 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5533 } else {
5534 pm_buffer_append_string(buffer, "null", 4);
5535 }
5536
5537 pm_buffer_append_byte(buffer, '}');
5538 break;
5539 }
5540 case PM_WHEN_NODE: {
5541 pm_buffer_append_string(buffer, "{\"type\":\"WhenNode\",\"location\":", 30);
5542
5543 const pm_when_node_t *cast = (const pm_when_node_t *) node;
5544 pm_dump_json_location(buffer, &cast->base.location);
5545
5546 // Dump the when_keyword_loc field
5547 pm_buffer_append_byte(buffer, ',');
5548 pm_buffer_append_string(buffer, "\"when_keyword_loc\":", 19);
5549 pm_dump_json_location(buffer, &cast->when_keyword_loc);
5550
5551 // Dump the conditions field
5552 pm_buffer_append_byte(buffer, ',');
5553 pm_buffer_append_string(buffer, "\"conditions\":", 13);
5554 const pm_node_list_t *conditions = &cast->conditions;
5555 pm_buffer_append_byte(buffer, '[');
5556
5557 for (size_t index = 0; index < conditions->size; index++) {
5558 if (index != 0) pm_buffer_append_byte(buffer, ',');
5559 pm_dump_json(buffer, parser, conditions->nodes[index]);
5560 }
5561 pm_buffer_append_byte(buffer, ']');
5562
5563 // Dump the then_keyword_loc field
5564 pm_buffer_append_byte(buffer, ',');
5565 pm_buffer_append_string(buffer, "\"then_keyword_loc\":", 19);
5566 if (cast->then_keyword_loc.length != 0) {
5567 pm_dump_json_location(buffer, &cast->then_keyword_loc);
5568 } else {
5569 pm_buffer_append_string(buffer, "null", 4);
5570 }
5571
5572 // Dump the statements field
5573 pm_buffer_append_byte(buffer, ',');
5574 pm_buffer_append_string(buffer, "\"statements\":", 13);
5575 if (cast->statements != NULL) {
5576 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5577 } else {
5578 pm_buffer_append_string(buffer, "null", 4);
5579 }
5580
5581 pm_buffer_append_byte(buffer, '}');
5582 break;
5583 }
5584 case PM_WHILE_NODE: {
5585 pm_buffer_append_string(buffer, "{\"type\":\"WhileNode\",\"location\":", 31);
5586
5587 const pm_while_node_t *cast = (const pm_while_node_t *) node;
5588 pm_dump_json_location(buffer, &cast->base.location);
5589
5590 // Dump the LoopFlags field
5591 pm_buffer_append_byte(buffer, ',');
5592 pm_buffer_append_string(buffer, "\"flags\":", 8);
5593 size_t flags = 0;
5594 pm_buffer_append_byte(buffer, '[');
5595 if (PM_NODE_FLAG_P(cast, PM_LOOP_FLAGS_BEGIN_MODIFIER)) {
5596 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5597 pm_buffer_append_string(buffer, "\"BEGIN_MODIFIER\"", 16);
5598 flags++;
5599 }
5600 pm_buffer_append_byte(buffer, ']');
5601
5602 // Dump the while_keyword_loc field
5603 pm_buffer_append_byte(buffer, ',');
5604 pm_buffer_append_string(buffer, "\"while_keyword_loc\":", 20);
5605 pm_dump_json_location(buffer, &cast->while_keyword_loc);
5606
5607 // Dump the do_keyword_loc field
5608 pm_buffer_append_byte(buffer, ',');
5609 pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
5610 if (cast->do_keyword_loc.length != 0) {
5611 pm_dump_json_location(buffer, &cast->do_keyword_loc);
5612 } else {
5613 pm_buffer_append_string(buffer, "null", 4);
5614 }
5615
5616 // Dump the end_keyword_loc field
5617 pm_buffer_append_byte(buffer, ',');
5618 pm_buffer_append_string(buffer, "\"end_keyword_loc\":", 18);
5619 if (cast->end_keyword_loc.length != 0) {
5620 pm_dump_json_location(buffer, &cast->end_keyword_loc);
5621 } else {
5622 pm_buffer_append_string(buffer, "null", 4);
5623 }
5624
5625 // Dump the predicate field
5626 pm_buffer_append_byte(buffer, ',');
5627 pm_buffer_append_string(buffer, "\"predicate\":", 12);
5628 pm_dump_json(buffer, parser, (const pm_node_t *) cast->predicate);
5629
5630 // Dump the statements field
5631 pm_buffer_append_byte(buffer, ',');
5632 pm_buffer_append_string(buffer, "\"statements\":", 13);
5633 if (cast->statements != NULL) {
5634 pm_dump_json(buffer, parser, (const pm_node_t *) cast->statements);
5635 } else {
5636 pm_buffer_append_string(buffer, "null", 4);
5637 }
5638
5639 pm_buffer_append_byte(buffer, '}');
5640 break;
5641 }
5642 case PM_X_STRING_NODE: {
5643 pm_buffer_append_string(buffer, "{\"type\":\"XStringNode\",\"location\":", 33);
5644
5645 const pm_x_string_node_t *cast = (const pm_x_string_node_t *) node;
5646 pm_dump_json_location(buffer, &cast->base.location);
5647
5648 // Dump the EncodingFlags field
5649 pm_buffer_append_byte(buffer, ',');
5650 pm_buffer_append_string(buffer, "\"flags\":", 8);
5651 size_t flags = 0;
5652 pm_buffer_append_byte(buffer, '[');
5653 if (PM_NODE_FLAG_P(cast, PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING)) {
5654 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5655 pm_buffer_append_string(buffer, "\"FORCED_UTF8_ENCODING\"", 22);
5656 flags++;
5657 }
5658 if (PM_NODE_FLAG_P(cast, PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING)) {
5659 if (flags != 0) pm_buffer_append_byte(buffer, ',');
5660 pm_buffer_append_string(buffer, "\"FORCED_BINARY_ENCODING\"", 24);
5661 flags++;
5662 }
5663 pm_buffer_append_byte(buffer, ']');
5664
5665 // Dump the opening_loc field
5666 pm_buffer_append_byte(buffer, ',');
5667 pm_buffer_append_string(buffer, "\"opening_loc\":", 14);
5668 pm_dump_json_location(buffer, &cast->opening_loc);
5669
5670 // Dump the content_loc field
5671 pm_buffer_append_byte(buffer, ',');
5672 pm_buffer_append_string(buffer, "\"content_loc\":", 14);
5673 pm_dump_json_location(buffer, &cast->content_loc);
5674
5675 // Dump the closing_loc field
5676 pm_buffer_append_byte(buffer, ',');
5677 pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
5678 pm_dump_json_location(buffer, &cast->closing_loc);
5679
5680 // Dump the unescaped field
5681 pm_buffer_append_byte(buffer, ',');
5682 pm_buffer_append_string(buffer, "\"unescaped\":", 12);
5683 const pm_string_t *unescaped = &cast->unescaped;
5684 pm_buffer_append_byte(buffer, '"');
5685 pm_buffer_append_source(buffer, pm_string_source(unescaped), pm_string_length(unescaped), PM_BUFFER_ESCAPING_JSON);
5686 pm_buffer_append_byte(buffer, '"');
5687
5688 pm_buffer_append_byte(buffer, '}');
5689 break;
5690 }
5691 case PM_YIELD_NODE: {
5692 pm_buffer_append_string(buffer, "{\"type\":\"YieldNode\",\"location\":", 31);
5693
5694 const pm_yield_node_t *cast = (const pm_yield_node_t *) node;
5695 pm_dump_json_location(buffer, &cast->base.location);
5696
5697 // Dump the keyword_loc field
5698 pm_buffer_append_byte(buffer, ',');
5699 pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
5700 pm_dump_json_location(buffer, &cast->keyword_loc);
5701
5702 // Dump the lparen_loc field
5703 pm_buffer_append_byte(buffer, ',');
5704 pm_buffer_append_string(buffer, "\"lparen_loc\":", 13);
5705 if (cast->lparen_loc.length != 0) {
5706 pm_dump_json_location(buffer, &cast->lparen_loc);
5707 } else {
5708 pm_buffer_append_string(buffer, "null", 4);
5709 }
5710
5711 // Dump the arguments field
5712 pm_buffer_append_byte(buffer, ',');
5713 pm_buffer_append_string(buffer, "\"arguments\":", 12);
5714 if (cast->arguments != NULL) {
5715 pm_dump_json(buffer, parser, (const pm_node_t *) cast->arguments);
5716 } else {
5717 pm_buffer_append_string(buffer, "null", 4);
5718 }
5719
5720 // Dump the rparen_loc field
5721 pm_buffer_append_byte(buffer, ',');
5722 pm_buffer_append_string(buffer, "\"rparen_loc\":", 13);
5723 if (cast->rparen_loc.length != 0) {
5724 pm_dump_json_location(buffer, &cast->rparen_loc);
5725 } else {
5726 pm_buffer_append_string(buffer, "null", 4);
5727 }
5728
5729 pm_buffer_append_byte(buffer, '}');
5730 break;
5731 }
5732 case PM_SCOPE_NODE:
5733 break;
5734 }
5735}
5736
5737#endif
uint32_t pm_constant_id_t
A constant id is a unique identifier for a constant in the constant pool.
AliasGlobalVariableNode.
Definition ast.h:1156
PM_NODE_ALIGNAS struct pm_node * new_name
AliasGlobalVariableNode::new_name.
Definition ast.h:1168
pm_node_t base
The embedded base node.
Definition ast.h:1158
pm_location_t keyword_loc
AliasGlobalVariableNode::keyword_loc.
Definition ast.h:1188
PM_NODE_ALIGNAS struct pm_node * old_name
AliasGlobalVariableNode::old_name.
Definition ast.h:1178
AliasMethodNode.
Definition ast.h:1203
PM_NODE_ALIGNAS struct pm_node * old_name
AliasMethodNode::old_name.
Definition ast.h:1237
pm_node_t base
The embedded base node.
Definition ast.h:1205
pm_location_t keyword_loc
AliasMethodNode::keyword_loc.
Definition ast.h:1247
PM_NODE_ALIGNAS struct pm_node * new_name
AliasMethodNode::new_name.
Definition ast.h:1221
AlternationPatternNode.
Definition ast.h:1262
pm_location_t operator_loc
AlternationPatternNode::operator_loc.
Definition ast.h:1294
PM_NODE_ALIGNAS struct pm_node * left
AlternationPatternNode::left.
Definition ast.h:1274
pm_node_t base
The embedded base node.
Definition ast.h:1264
PM_NODE_ALIGNAS struct pm_node * right
AlternationPatternNode::right.
Definition ast.h:1284
AndNode.
Definition ast.h:1309
PM_NODE_ALIGNAS struct pm_node * left
AndNode::left.
Definition ast.h:1324
PM_NODE_ALIGNAS struct pm_node * right
AndNode::right.
Definition ast.h:1337
pm_location_t operator_loc
AndNode::operator_loc.
Definition ast.h:1347
pm_node_t base
The embedded base node.
Definition ast.h:1311
ArgumentsNode.
Definition ast.h:1369
pm_node_t base
The embedded base node.
Definition ast.h:1371
struct pm_node_list arguments
ArgumentsNode::arguments.
Definition ast.h:1381
ArrayNode.
Definition ast.h:1399
pm_node_t base
The embedded base node.
Definition ast.h:1401
pm_location_t closing_loc
ArrayNode::closing_loc.
Definition ast.h:1432
struct pm_node_list elements
ArrayNode::elements.
Definition ast.h:1408
pm_location_t opening_loc
ArrayNode::opening_loc.
Definition ast.h:1420
ArrayPatternNode.
Definition ast.h:1459
struct pm_node_list requireds
ArrayPatternNode::requireds.
Definition ast.h:1487
PM_NODE_ALIGNAS struct pm_node * rest
ArrayPatternNode::rest.
Definition ast.h:1497
PM_NODE_ALIGNAS struct pm_node * constant
ArrayPatternNode::constant.
Definition ast.h:1477
pm_location_t opening_loc
ArrayPatternNode::opening_loc.
Definition ast.h:1517
pm_node_t base
The embedded base node.
Definition ast.h:1461
pm_location_t closing_loc
ArrayPatternNode::closing_loc.
Definition ast.h:1527
struct pm_node_list posts
ArrayPatternNode::posts.
Definition ast.h:1507
AssocNode.
Definition ast.h:1542
pm_node_t base
The embedded base node.
Definition ast.h:1544
PM_NODE_ALIGNAS struct pm_node * value
AssocNode::value.
Definition ast.h:1573
PM_NODE_ALIGNAS struct pm_node * key
AssocNode::key.
Definition ast.h:1560
pm_location_t operator_loc
AssocNode::operator_loc.
Definition ast.h:1583
AssocSplatNode.
Definition ast.h:1598
pm_node_t base
The embedded base node.
Definition ast.h:1600
pm_location_t operator_loc
AssocSplatNode::operator_loc.
Definition ast.h:1620
PM_NODE_ALIGNAS struct pm_node * value
AssocSplatNode::value.
Definition ast.h:1610
BackReferenceReadNode.
Definition ast.h:1635
pm_constant_id_t name
BackReferenceReadNode::name.
Definition ast.h:1648
pm_node_t base
The embedded base node.
Definition ast.h:1637
BeginNode.
Definition ast.h:1665
PM_NODE_ALIGNAS struct pm_else_node * else_clause
BeginNode::else_clause.
Definition ast.h:1707
PM_NODE_ALIGNAS struct pm_ensure_node * ensure_clause
BeginNode::ensure_clause.
Definition ast.h:1717
PM_NODE_ALIGNAS struct pm_statements_node * statements
BeginNode::statements.
Definition ast.h:1687
PM_NODE_ALIGNAS struct pm_rescue_node * rescue_clause
BeginNode::rescue_clause.
Definition ast.h:1697
pm_node_t base
The embedded base node.
Definition ast.h:1667
pm_location_t end_keyword_loc
BeginNode::end_keyword_loc.
Definition ast.h:1727
pm_location_t begin_keyword_loc
BeginNode::begin_keyword_loc.
Definition ast.h:1677
BlockArgumentNode.
Definition ast.h:1742
PM_NODE_ALIGNAS struct pm_node * expression
BlockArgumentNode::expression.
Definition ast.h:1754
pm_node_t base
The embedded base node.
Definition ast.h:1744
pm_location_t operator_loc
BlockArgumentNode::operator_loc.
Definition ast.h:1764
BlockLocalVariableNode.
Definition ast.h:1782
pm_node_t base
The embedded base node.
Definition ast.h:1784
pm_constant_id_t name
BlockLocalVariableNode::name.
Definition ast.h:1794
BlockNode.
Definition ast.h:1809
pm_node_t base
The embedded base node.
Definition ast.h:1811
pm_location_t closing_loc
BlockNode::closing_loc.
Definition ast.h:1865
PM_NODE_ALIGNAS struct pm_node * parameters
BlockNode::parameters.
Definition ast.h:1835
pm_location_t opening_loc
BlockNode::opening_loc.
Definition ast.h:1855
pm_constant_id_list_t locals
BlockNode::locals.
Definition ast.h:1821
PM_NODE_ALIGNAS struct pm_node * body
BlockNode::body.
Definition ast.h:1845
BlockParameterNode.
Definition ast.h:1884
pm_location_t operator_loc
BlockParameterNode::operator_loc.
Definition ast.h:1918
pm_location_t name_loc
BlockParameterNode::name_loc.
Definition ast.h:1907
pm_constant_id_t name
BlockParameterNode::name.
Definition ast.h:1897
pm_node_t base
The embedded base node.
Definition ast.h:1886
BlockParametersNode.
Definition ast.h:1937
pm_node_t base
The embedded base node.
Definition ast.h:1939
struct pm_node_list locals
BlockParametersNode::locals.
Definition ast.h:1967
PM_NODE_ALIGNAS struct pm_parameters_node * parameters
BlockParametersNode::parameters.
Definition ast.h:1953
pm_location_t closing_loc
BlockParametersNode::closing_loc.
Definition ast.h:1995
pm_location_t opening_loc
BlockParametersNode::opening_loc.
Definition ast.h:1981
BreakNode.
Definition ast.h:2010
pm_location_t keyword_loc
BreakNode::keyword_loc.
Definition ast.h:2032
pm_node_t base
The embedded base node.
Definition ast.h:2012
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
BreakNode::arguments.
Definition ast.h:2022
CallAndWriteNode.
Definition ast.h:2053
pm_location_t operator_loc
CallAndWriteNode::operator_loc.
Definition ast.h:2115
PM_NODE_ALIGNAS struct pm_node * receiver
CallAndWriteNode::receiver.
Definition ast.h:2065
pm_node_t base
The embedded base node.
Definition ast.h:2055
PM_NODE_ALIGNAS struct pm_node * value
CallAndWriteNode::value.
Definition ast.h:2125
pm_location_t call_operator_loc
CallAndWriteNode::call_operator_loc.
Definition ast.h:2075
pm_location_t message_loc
CallAndWriteNode::message_loc.
Definition ast.h:2085
pm_constant_id_t read_name
CallAndWriteNode::read_name.
Definition ast.h:2095
pm_constant_id_t write_name
CallAndWriteNode::write_name.
Definition ast.h:2105
CallNode.
Definition ast.h:2161
pm_location_t opening_loc
CallNode::opening_loc.
Definition ast.h:2222
pm_location_t closing_loc
CallNode::closing_loc.
Definition ast.h:2242
pm_constant_id_t name
CallNode::name.
Definition ast.h:2202
pm_node_t base
The embedded base node.
Definition ast.h:2163
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
CallNode::arguments.
Definition ast.h:2232
pm_location_t equal_loc
CallNode::equal_loc.
Definition ast.h:2255
pm_location_t call_operator_loc
CallNode::call_operator_loc.
Definition ast.h:2192
pm_location_t message_loc
CallNode::message_loc.
Definition ast.h:2212
PM_NODE_ALIGNAS struct pm_node * block
CallNode::block.
Definition ast.h:2265
PM_NODE_ALIGNAS struct pm_node * receiver
CallNode::receiver.
Definition ast.h:2179
CallOperatorWriteNode.
Definition ast.h:2286
pm_constant_id_t read_name
CallOperatorWriteNode::read_name.
Definition ast.h:2328
pm_constant_id_t binary_operator
CallOperatorWriteNode::binary_operator.
Definition ast.h:2348
pm_location_t binary_operator_loc
CallOperatorWriteNode::binary_operator_loc.
Definition ast.h:2358
pm_node_t base
The embedded base node.
Definition ast.h:2288
pm_constant_id_t write_name
CallOperatorWriteNode::write_name.
Definition ast.h:2338
pm_location_t message_loc
CallOperatorWriteNode::message_loc.
Definition ast.h:2318
PM_NODE_ALIGNAS struct pm_node * receiver
CallOperatorWriteNode::receiver.
Definition ast.h:2298
PM_NODE_ALIGNAS struct pm_node * value
CallOperatorWriteNode::value.
Definition ast.h:2368
pm_location_t call_operator_loc
CallOperatorWriteNode::call_operator_loc.
Definition ast.h:2308
CallOrWriteNode.
Definition ast.h:2389
pm_location_t operator_loc
CallOrWriteNode::operator_loc.
Definition ast.h:2451
pm_location_t call_operator_loc
CallOrWriteNode::call_operator_loc.
Definition ast.h:2411
PM_NODE_ALIGNAS struct pm_node * receiver
CallOrWriteNode::receiver.
Definition ast.h:2401
pm_node_t base
The embedded base node.
Definition ast.h:2391
PM_NODE_ALIGNAS struct pm_node * value
CallOrWriteNode::value.
Definition ast.h:2461
pm_constant_id_t write_name
CallOrWriteNode::write_name.
Definition ast.h:2441
pm_constant_id_t read_name
CallOrWriteNode::read_name.
Definition ast.h:2431
pm_location_t message_loc
CallOrWriteNode::message_loc.
Definition ast.h:2421
CallTargetNode.
Definition ast.h:2490
pm_node_t base
The embedded base node.
Definition ast.h:2492
pm_constant_id_t name
CallTargetNode::name.
Definition ast.h:2522
PM_NODE_ALIGNAS struct pm_node * receiver
CallTargetNode::receiver.
Definition ast.h:2502
pm_location_t call_operator_loc
CallTargetNode::call_operator_loc.
Definition ast.h:2512
pm_location_t message_loc
CallTargetNode::message_loc.
Definition ast.h:2532
CapturePatternNode.
Definition ast.h:2547
pm_location_t operator_loc
CapturePatternNode::operator_loc.
Definition ast.h:2579
pm_node_t base
The embedded base node.
Definition ast.h:2549
PM_NODE_ALIGNAS struct pm_node * value
CapturePatternNode::value.
Definition ast.h:2559
PM_NODE_ALIGNAS struct pm_local_variable_target_node * target
CapturePatternNode::target.
Definition ast.h:2569
CaseMatchNode.
Definition ast.h:2596
pm_location_t end_keyword_loc
CaseMatchNode::end_keyword_loc.
Definition ast.h:2648
struct pm_node_list conditions
CaseMatchNode::conditions.
Definition ast.h:2618
pm_node_t base
The embedded base node.
Definition ast.h:2598
pm_location_t case_keyword_loc
CaseMatchNode::case_keyword_loc.
Definition ast.h:2638
PM_NODE_ALIGNAS struct pm_node * predicate
CaseMatchNode::predicate.
Definition ast.h:2608
PM_NODE_ALIGNAS struct pm_else_node * else_clause
CaseMatchNode::else_clause.
Definition ast.h:2628
CaseNode.
Definition ast.h:2665
PM_NODE_ALIGNAS struct pm_else_node * else_clause
CaseNode::else_clause.
Definition ast.h:2697
struct pm_node_list conditions
CaseNode::conditions.
Definition ast.h:2687
PM_NODE_ALIGNAS struct pm_node * predicate
CaseNode::predicate.
Definition ast.h:2677
pm_node_t base
The embedded base node.
Definition ast.h:2667
pm_location_t case_keyword_loc
CaseNode::case_keyword_loc.
Definition ast.h:2707
pm_location_t end_keyword_loc
CaseNode::end_keyword_loc.
Definition ast.h:2717
ClassNode.
Definition ast.h:2732
pm_location_t class_keyword_loc
ClassNode::class_keyword_loc.
Definition ast.h:2749
pm_location_t end_keyword_loc
ClassNode::end_keyword_loc.
Definition ast.h:2794
pm_constant_id_list_t locals
ClassNode::locals.
Definition ast.h:2739
PM_NODE_ALIGNAS struct pm_node * superclass
ClassNode::superclass.
Definition ast.h:2774
pm_location_t inheritance_operator_loc
ClassNode::inheritance_operator_loc.
Definition ast.h:2764
pm_constant_id_t name
ClassNode::name.
Definition ast.h:2803
pm_node_t base
The embedded base node.
Definition ast.h:2734
PM_NODE_ALIGNAS struct pm_node * constant_path
ClassNode::constant_path.
Definition ast.h:2754
PM_NODE_ALIGNAS struct pm_node * body
ClassNode::body.
Definition ast.h:2784
ClassVariableAndWriteNode.
Definition ast.h:2818
PM_NODE_ALIGNAS struct pm_node * value
ClassVariableAndWriteNode::value.
Definition ast.h:2860
pm_constant_id_t name
ClassVariableAndWriteNode::name.
Definition ast.h:2830
pm_location_t operator_loc
ClassVariableAndWriteNode::operator_loc.
Definition ast.h:2850
pm_node_t base
The embedded base node.
Definition ast.h:2820
pm_location_t name_loc
ClassVariableAndWriteNode::name_loc.
Definition ast.h:2840
ClassVariableOperatorWriteNode.
Definition ast.h:2875
pm_node_t base
The embedded base node.
Definition ast.h:2877
pm_constant_id_t name
ClassVariableOperatorWriteNode::name.
Definition ast.h:2882
PM_NODE_ALIGNAS struct pm_node * value
ClassVariableOperatorWriteNode::value.
Definition ast.h:2897
pm_location_t name_loc
ClassVariableOperatorWriteNode::name_loc.
Definition ast.h:2887
pm_constant_id_t binary_operator
ClassVariableOperatorWriteNode::binary_operator.
Definition ast.h:2902
pm_location_t binary_operator_loc
ClassVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:2892
ClassVariableOrWriteNode.
Definition ast.h:2917
pm_node_t base
The embedded base node.
Definition ast.h:2919
PM_NODE_ALIGNAS struct pm_node * value
ClassVariableOrWriteNode::value.
Definition ast.h:2939
pm_location_t name_loc
ClassVariableOrWriteNode::name_loc.
Definition ast.h:2929
pm_location_t operator_loc
ClassVariableOrWriteNode::operator_loc.
Definition ast.h:2934
pm_constant_id_t name
ClassVariableOrWriteNode::name.
Definition ast.h:2924
ClassVariableReadNode.
Definition ast.h:2954
pm_node_t base
The embedded base node.
Definition ast.h:2956
pm_constant_id_t name
ClassVariableReadNode::name.
Definition ast.h:2967
ClassVariableTargetNode.
Definition ast.h:2982
pm_node_t base
The embedded base node.
Definition ast.h:2984
pm_constant_id_t name
ClassVariableTargetNode::name.
Definition ast.h:2989
ClassVariableWriteNode.
Definition ast.h:3004
pm_location_t name_loc
ClassVariableWriteNode::name_loc.
Definition ast.h:3027
PM_NODE_ALIGNAS struct pm_node * value
ClassVariableWriteNode::value.
Definition ast.h:3040
pm_node_t base
The embedded base node.
Definition ast.h:3006
pm_location_t operator_loc
ClassVariableWriteNode::operator_loc.
Definition ast.h:3050
pm_constant_id_t name
ClassVariableWriteNode::name.
Definition ast.h:3017
ConstantAndWriteNode.
Definition ast.h:3065
pm_location_t operator_loc
ConstantAndWriteNode::operator_loc.
Definition ast.h:3082
PM_NODE_ALIGNAS struct pm_node * value
ConstantAndWriteNode::value.
Definition ast.h:3087
pm_location_t name_loc
ConstantAndWriteNode::name_loc.
Definition ast.h:3077
pm_constant_id_t name
ConstantAndWriteNode::name.
Definition ast.h:3072
pm_node_t base
The embedded base node.
Definition ast.h:3067
A list of constant IDs.
size_t size
The number of constant ids in the list.
pm_constant_id_t * ids
The constant ids in the list.
ConstantOperatorWriteNode.
Definition ast.h:3102
pm_constant_id_t name
ConstantOperatorWriteNode::name.
Definition ast.h:3109
pm_location_t name_loc
ConstantOperatorWriteNode::name_loc.
Definition ast.h:3114
pm_constant_id_t binary_operator
ConstantOperatorWriteNode::binary_operator.
Definition ast.h:3129
pm_location_t binary_operator_loc
ConstantOperatorWriteNode::binary_operator_loc.
Definition ast.h:3119
PM_NODE_ALIGNAS struct pm_node * value
ConstantOperatorWriteNode::value.
Definition ast.h:3124
pm_node_t base
The embedded base node.
Definition ast.h:3104
ConstantOrWriteNode.
Definition ast.h:3144
pm_location_t operator_loc
ConstantOrWriteNode::operator_loc.
Definition ast.h:3161
PM_NODE_ALIGNAS struct pm_node * value
ConstantOrWriteNode::value.
Definition ast.h:3166
pm_location_t name_loc
ConstantOrWriteNode::name_loc.
Definition ast.h:3156
pm_constant_id_t name
ConstantOrWriteNode::name.
Definition ast.h:3151
pm_node_t base
The embedded base node.
Definition ast.h:3146
ConstantPathAndWriteNode.
Definition ast.h:3181
PM_NODE_ALIGNAS struct pm_constant_path_node * target
ConstantPathAndWriteNode::target.
Definition ast.h:3188
pm_node_t base
The embedded base node.
Definition ast.h:3183
PM_NODE_ALIGNAS struct pm_node * value
ConstantPathAndWriteNode::value.
Definition ast.h:3198
pm_location_t operator_loc
ConstantPathAndWriteNode::operator_loc.
Definition ast.h:3193
ConstantPathNode.
Definition ast.h:3213
pm_location_t delimiter_loc
ConstantPathNode::delimiter_loc.
Definition ast.h:3251
pm_node_t base
The embedded base node.
Definition ast.h:3215
PM_NODE_ALIGNAS struct pm_node * parent
ConstantPathNode::parent.
Definition ast.h:3231
pm_location_t name_loc
ConstantPathNode::name_loc.
Definition ast.h:3264
pm_constant_id_t name
ConstantPathNode::name.
Definition ast.h:3238
ConstantPathOperatorWriteNode.
Definition ast.h:3279
PM_NODE_ALIGNAS struct pm_constant_path_node * target
ConstantPathOperatorWriteNode::target.
Definition ast.h:3286
pm_constant_id_t binary_operator
ConstantPathOperatorWriteNode::binary_operator.
Definition ast.h:3301
pm_node_t base
The embedded base node.
Definition ast.h:3281
pm_location_t binary_operator_loc
ConstantPathOperatorWriteNode::binary_operator_loc.
Definition ast.h:3291
PM_NODE_ALIGNAS struct pm_node * value
ConstantPathOperatorWriteNode::value.
Definition ast.h:3296
ConstantPathOrWriteNode.
Definition ast.h:3316
pm_location_t operator_loc
ConstantPathOrWriteNode::operator_loc.
Definition ast.h:3328
pm_node_t base
The embedded base node.
Definition ast.h:3318
PM_NODE_ALIGNAS struct pm_node * value
ConstantPathOrWriteNode::value.
Definition ast.h:3333
PM_NODE_ALIGNAS struct pm_constant_path_node * target
ConstantPathOrWriteNode::target.
Definition ast.h:3323
ConstantPathTargetNode.
Definition ast.h:3348
pm_node_t base
The embedded base node.
Definition ast.h:3350
pm_location_t delimiter_loc
ConstantPathTargetNode::delimiter_loc.
Definition ast.h:3365
pm_constant_id_t name
ConstantPathTargetNode::name.
Definition ast.h:3360
PM_NODE_ALIGNAS struct pm_node * parent
ConstantPathTargetNode::parent.
Definition ast.h:3355
pm_location_t name_loc
ConstantPathTargetNode::name_loc.
Definition ast.h:3370
ConstantPathWriteNode.
Definition ast.h:3391
PM_NODE_ALIGNAS struct pm_node * value
ConstantPathWriteNode::value.
Definition ast.h:3426
pm_location_t operator_loc
ConstantPathWriteNode::operator_loc.
Definition ast.h:3416
pm_node_t base
The embedded base node.
Definition ast.h:3393
PM_NODE_ALIGNAS struct pm_constant_path_node * target
ConstantPathWriteNode::target.
Definition ast.h:3406
ConstantReadNode.
Definition ast.h:3441
pm_node_t base
The embedded base node.
Definition ast.h:3443
pm_constant_id_t name
ConstantReadNode::name.
Definition ast.h:3454
ConstantTargetNode.
Definition ast.h:3469
pm_node_t base
The embedded base node.
Definition ast.h:3471
pm_constant_id_t name
ConstantTargetNode::name.
Definition ast.h:3476
ConstantWriteNode.
Definition ast.h:3491
pm_node_t base
The embedded base node.
Definition ast.h:3493
PM_NODE_ALIGNAS struct pm_node * value
ConstantWriteNode::value.
Definition ast.h:3527
pm_constant_id_t name
ConstantWriteNode::name.
Definition ast.h:3504
pm_location_t name_loc
ConstantWriteNode::name_loc.
Definition ast.h:3514
pm_location_t operator_loc
ConstantWriteNode::operator_loc.
Definition ast.h:3537
DefNode.
Definition ast.h:3553
pm_location_t end_keyword_loc
DefNode::end_keyword_loc.
Definition ast.h:3615
pm_constant_id_t name
DefNode::name.
Definition ast.h:3560
pm_location_t name_loc
DefNode::name_loc.
Definition ast.h:3565
pm_location_t rparen_loc
DefNode::rparen_loc.
Definition ast.h:3605
PM_NODE_ALIGNAS struct pm_parameters_node * parameters
DefNode::parameters.
Definition ast.h:3575
pm_location_t equal_loc
DefNode::equal_loc.
Definition ast.h:3610
pm_location_t def_keyword_loc
DefNode::def_keyword_loc.
Definition ast.h:3590
pm_node_t base
The embedded base node.
Definition ast.h:3555
pm_location_t lparen_loc
DefNode::lparen_loc.
Definition ast.h:3600
PM_NODE_ALIGNAS struct pm_node * receiver
DefNode::receiver.
Definition ast.h:3570
PM_NODE_ALIGNAS struct pm_node * body
DefNode::body.
Definition ast.h:3580
pm_location_t operator_loc
DefNode::operator_loc.
Definition ast.h:3595
pm_constant_id_list_t locals
DefNode::locals.
Definition ast.h:3585
DefinedNode.
Definition ast.h:3630
PM_NODE_ALIGNAS struct pm_node * value
DefinedNode::value.
Definition ast.h:3642
pm_location_t lparen_loc
DefinedNode::lparen_loc.
Definition ast.h:3637
pm_node_t base
The embedded base node.
Definition ast.h:3632
pm_location_t rparen_loc
DefinedNode::rparen_loc.
Definition ast.h:3647
pm_location_t keyword_loc
DefinedNode::keyword_loc.
Definition ast.h:3652
ElseNode.
Definition ast.h:3667
pm_location_t else_keyword_loc
ElseNode::else_keyword_loc.
Definition ast.h:3674
pm_node_t base
The embedded base node.
Definition ast.h:3669
PM_NODE_ALIGNAS struct pm_statements_node * statements
ElseNode::statements.
Definition ast.h:3679
pm_location_t end_keyword_loc
ElseNode::end_keyword_loc.
Definition ast.h:3684
EmbeddedStatementsNode.
Definition ast.h:3699
PM_NODE_ALIGNAS struct pm_statements_node * statements
EmbeddedStatementsNode::statements.
Definition ast.h:3711
pm_location_t closing_loc
EmbeddedStatementsNode::closing_loc.
Definition ast.h:3716
pm_node_t base
The embedded base node.
Definition ast.h:3701
pm_location_t opening_loc
EmbeddedStatementsNode::opening_loc.
Definition ast.h:3706
EmbeddedVariableNode.
Definition ast.h:3731
PM_NODE_ALIGNAS struct pm_node * variable
EmbeddedVariableNode::variable.
Definition ast.h:3743
pm_location_t operator_loc
EmbeddedVariableNode::operator_loc.
Definition ast.h:3738
pm_node_t base
The embedded base node.
Definition ast.h:3733
EnsureNode.
Definition ast.h:3762
PM_NODE_ALIGNAS struct pm_statements_node * statements
EnsureNode::statements.
Definition ast.h:3774
pm_node_t base
The embedded base node.
Definition ast.h:3764
pm_location_t ensure_keyword_loc
EnsureNode::ensure_keyword_loc.
Definition ast.h:3769
pm_location_t end_keyword_loc
EnsureNode::end_keyword_loc.
Definition ast.h:3779
ErrorRecoveryNode.
Definition ast.h:3791
PM_NODE_ALIGNAS struct pm_node * unexpected
ErrorRecoveryNode::unexpected.
Definition ast.h:3800
pm_node_t base
The embedded base node.
Definition ast.h:3793
FalseNode.
Definition ast.h:3815
pm_node_t base
The embedded base node.
Definition ast.h:3817
FindPatternNode.
Definition ast.h:3841
PM_NODE_ALIGNAS struct pm_splat_node * left
FindPatternNode::left.
Definition ast.h:3866
PM_NODE_ALIGNAS struct pm_splat_node * right
FindPatternNode::right.
Definition ast.h:3892
pm_location_t opening_loc
FindPatternNode::opening_loc.
Definition ast.h:3905
pm_node_t base
The embedded base node.
Definition ast.h:3843
PM_NODE_ALIGNAS struct pm_node * constant
FindPatternNode::constant.
Definition ast.h:3853
struct pm_node_list requireds
FindPatternNode::requireds.
Definition ast.h:3879
pm_location_t closing_loc
FindPatternNode::closing_loc.
Definition ast.h:3918
FlipFlopNode.
Definition ast.h:3936
PM_NODE_ALIGNAS struct pm_node * left
FlipFlopNode::left.
Definition ast.h:3943
pm_node_t base
The embedded base node.
Definition ast.h:3938
pm_location_t operator_loc
FlipFlopNode::operator_loc.
Definition ast.h:3953
PM_NODE_ALIGNAS struct pm_node * right
FlipFlopNode::right.
Definition ast.h:3948
FloatNode.
Definition ast.h:3968
double value
FloatNode::value.
Definition ast.h:3977
pm_node_t base
The embedded base node.
Definition ast.h:3970
ForNode.
Definition ast.h:3992
PM_NODE_ALIGNAS struct pm_node * index
ForNode::index.
Definition ast.h:4004
PM_NODE_ALIGNAS struct pm_node * collection
ForNode::collection.
Definition ast.h:4014
pm_node_t base
The embedded base node.
Definition ast.h:3994
PM_NODE_ALIGNAS struct pm_statements_node * statements
ForNode::statements.
Definition ast.h:4026
pm_location_t end_keyword_loc
ForNode::end_keyword_loc.
Definition ast.h:4066
pm_location_t for_keyword_loc
ForNode::for_keyword_loc.
Definition ast.h:4036
pm_location_t do_keyword_loc
ForNode::do_keyword_loc.
Definition ast.h:4056
pm_location_t in_keyword_loc
ForNode::in_keyword_loc.
Definition ast.h:4046
ForwardingArgumentsNode.
Definition ast.h:4083
pm_node_t base
The embedded base node.
Definition ast.h:4085
ForwardingParameterNode.
Definition ast.h:4101
pm_node_t base
The embedded base node.
Definition ast.h:4103
ForwardingSuperNode.
Definition ast.h:4123
pm_node_t base
The embedded base node.
Definition ast.h:4125
PM_NODE_ALIGNAS struct pm_block_node * block
ForwardingSuperNode::block.
Definition ast.h:4143
pm_location_t keyword_loc
ForwardingSuperNode::keyword_loc.
Definition ast.h:4136
GlobalVariableAndWriteNode.
Definition ast.h:4158
pm_location_t operator_loc
GlobalVariableAndWriteNode::operator_loc.
Definition ast.h:4175
pm_node_t base
The embedded base node.
Definition ast.h:4160
PM_NODE_ALIGNAS struct pm_node * value
GlobalVariableAndWriteNode::value.
Definition ast.h:4180
pm_location_t name_loc
GlobalVariableAndWriteNode::name_loc.
Definition ast.h:4170
pm_constant_id_t name
GlobalVariableAndWriteNode::name.
Definition ast.h:4165
GlobalVariableOperatorWriteNode.
Definition ast.h:4195
PM_NODE_ALIGNAS struct pm_node * value
GlobalVariableOperatorWriteNode::value.
Definition ast.h:4217
pm_constant_id_t name
GlobalVariableOperatorWriteNode::name.
Definition ast.h:4202
pm_constant_id_t binary_operator
GlobalVariableOperatorWriteNode::binary_operator.
Definition ast.h:4222
pm_location_t name_loc
GlobalVariableOperatorWriteNode::name_loc.
Definition ast.h:4207
pm_node_t base
The embedded base node.
Definition ast.h:4197
pm_location_t binary_operator_loc
GlobalVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:4212
GlobalVariableOrWriteNode.
Definition ast.h:4237
pm_constant_id_t name
GlobalVariableOrWriteNode::name.
Definition ast.h:4244
pm_location_t name_loc
GlobalVariableOrWriteNode::name_loc.
Definition ast.h:4249
pm_node_t base
The embedded base node.
Definition ast.h:4239
pm_location_t operator_loc
GlobalVariableOrWriteNode::operator_loc.
Definition ast.h:4254
PM_NODE_ALIGNAS struct pm_node * value
GlobalVariableOrWriteNode::value.
Definition ast.h:4259
GlobalVariableReadNode.
Definition ast.h:4274
pm_node_t base
The embedded base node.
Definition ast.h:4276
pm_constant_id_t name
GlobalVariableReadNode::name.
Definition ast.h:4287
GlobalVariableTargetNode.
Definition ast.h:4302
pm_constant_id_t name
GlobalVariableTargetNode::name.
Definition ast.h:4309
pm_node_t base
The embedded base node.
Definition ast.h:4304
GlobalVariableWriteNode.
Definition ast.h:4324
pm_location_t name_loc
GlobalVariableWriteNode::name_loc.
Definition ast.h:4347
pm_location_t operator_loc
GlobalVariableWriteNode::operator_loc.
Definition ast.h:4370
pm_constant_id_t name
GlobalVariableWriteNode::name.
Definition ast.h:4337
pm_node_t base
The embedded base node.
Definition ast.h:4326
PM_NODE_ALIGNAS struct pm_node * value
GlobalVariableWriteNode::value.
Definition ast.h:4360
HashNode.
Definition ast.h:4385
struct pm_node_list elements
HashNode::elements.
Definition ast.h:4410
pm_node_t base
The embedded base node.
Definition ast.h:4387
pm_location_t closing_loc
HashNode::closing_loc.
Definition ast.h:4420
pm_location_t opening_loc
HashNode::opening_loc.
Definition ast.h:4397
HashPatternNode.
Definition ast.h:4444
PM_NODE_ALIGNAS struct pm_node * constant
HashPatternNode::constant.
Definition ast.h:4459
struct pm_node_list elements
HashPatternNode::elements.
Definition ast.h:4469
pm_location_t opening_loc
HashPatternNode::opening_loc.
Definition ast.h:4498
pm_node_t base
The embedded base node.
Definition ast.h:4446
pm_location_t closing_loc
HashPatternNode::closing_loc.
Definition ast.h:4511
PM_NODE_ALIGNAS struct pm_node * rest
HashPatternNode::rest.
Definition ast.h:4485
IfNode.
Definition ast.h:4532
PM_NODE_ALIGNAS struct pm_node * predicate
IfNode::predicate.
Definition ast.h:4564
pm_location_t end_keyword_loc
IfNode::end_keyword_loc.
Definition ast.h:4622
pm_location_t if_keyword_loc
IfNode::if_keyword_loc.
Definition ast.h:4546
PM_NODE_ALIGNAS struct pm_statements_node * statements
IfNode::statements.
Definition ast.h:4591
pm_node_t base
The embedded base node.
Definition ast.h:4534
pm_location_t then_keyword_loc
IfNode::then_keyword_loc.
Definition ast.h:4577
PM_NODE_ALIGNAS struct pm_node * subsequent
IfNode::subsequent.
Definition ast.h:4610
ImaginaryNode.
Definition ast.h:4637
pm_node_t base
The embedded base node.
Definition ast.h:4639
PM_NODE_ALIGNAS struct pm_node * numeric
ImaginaryNode::numeric.
Definition ast.h:4644
ImplicitNode.
Definition ast.h:4665
pm_node_t base
The embedded base node.
Definition ast.h:4667
PM_NODE_ALIGNAS struct pm_node * value
ImplicitNode::value.
Definition ast.h:4672
ImplicitRestNode.
Definition ast.h:4696
pm_node_t base
The embedded base node.
Definition ast.h:4698
InNode.
Definition ast.h:4713
pm_location_t in_keyword_loc
InNode::in_keyword_loc.
Definition ast.h:4730
PM_NODE_ALIGNAS struct pm_node * pattern
InNode::pattern.
Definition ast.h:4720
PM_NODE_ALIGNAS struct pm_statements_node * statements
InNode::statements.
Definition ast.h:4725
pm_location_t then_keyword_loc
InNode::then_keyword_loc.
Definition ast.h:4735
pm_node_t base
The embedded base node.
Definition ast.h:4715
IndexAndWriteNode.
Definition ast.h:4756
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
IndexAndWriteNode::arguments.
Definition ast.h:4778
pm_node_t base
The embedded base node.
Definition ast.h:4758
pm_location_t operator_loc
IndexAndWriteNode::operator_loc.
Definition ast.h:4793
pm_location_t closing_loc
IndexAndWriteNode::closing_loc.
Definition ast.h:4783
pm_location_t opening_loc
IndexAndWriteNode::opening_loc.
Definition ast.h:4773
pm_location_t call_operator_loc
IndexAndWriteNode::call_operator_loc.
Definition ast.h:4768
PM_NODE_ALIGNAS struct pm_block_argument_node * block
IndexAndWriteNode::block.
Definition ast.h:4788
PM_NODE_ALIGNAS struct pm_node * receiver
IndexAndWriteNode::receiver.
Definition ast.h:4763
PM_NODE_ALIGNAS struct pm_node * value
IndexAndWriteNode::value.
Definition ast.h:4798
IndexOperatorWriteNode.
Definition ast.h:4819
PM_NODE_ALIGNAS struct pm_block_argument_node * block
IndexOperatorWriteNode::block.
Definition ast.h:4851
pm_node_t base
The embedded base node.
Definition ast.h:4821
PM_NODE_ALIGNAS struct pm_node * receiver
IndexOperatorWriteNode::receiver.
Definition ast.h:4826
pm_location_t binary_operator_loc
IndexOperatorWriteNode::binary_operator_loc.
Definition ast.h:4861
PM_NODE_ALIGNAS struct pm_node * value
IndexOperatorWriteNode::value.
Definition ast.h:4866
pm_location_t opening_loc
IndexOperatorWriteNode::opening_loc.
Definition ast.h:4836
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
IndexOperatorWriteNode::arguments.
Definition ast.h:4841
pm_location_t call_operator_loc
IndexOperatorWriteNode::call_operator_loc.
Definition ast.h:4831
pm_location_t closing_loc
IndexOperatorWriteNode::closing_loc.
Definition ast.h:4846
pm_constant_id_t binary_operator
IndexOperatorWriteNode::binary_operator.
Definition ast.h:4856
IndexOrWriteNode.
Definition ast.h:4887
pm_location_t closing_loc
IndexOrWriteNode::closing_loc.
Definition ast.h:4914
pm_location_t call_operator_loc
IndexOrWriteNode::call_operator_loc.
Definition ast.h:4899
pm_node_t base
The embedded base node.
Definition ast.h:4889
pm_location_t operator_loc
IndexOrWriteNode::operator_loc.
Definition ast.h:4924
pm_location_t opening_loc
IndexOrWriteNode::opening_loc.
Definition ast.h:4904
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
IndexOrWriteNode::arguments.
Definition ast.h:4909
PM_NODE_ALIGNAS struct pm_node * value
IndexOrWriteNode::value.
Definition ast.h:4929
PM_NODE_ALIGNAS struct pm_node * receiver
IndexOrWriteNode::receiver.
Definition ast.h:4894
PM_NODE_ALIGNAS struct pm_block_argument_node * block
IndexOrWriteNode::block.
Definition ast.h:4919
IndexTargetNode.
Definition ast.h:4958
pm_node_t base
The embedded base node.
Definition ast.h:4960
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
IndexTargetNode::arguments.
Definition ast.h:4975
pm_location_t closing_loc
IndexTargetNode::closing_loc.
Definition ast.h:4980
PM_NODE_ALIGNAS struct pm_block_argument_node * block
IndexTargetNode::block.
Definition ast.h:4985
pm_location_t opening_loc
IndexTargetNode::opening_loc.
Definition ast.h:4970
PM_NODE_ALIGNAS struct pm_node * receiver
IndexTargetNode::receiver.
Definition ast.h:4965
InstanceVariableAndWriteNode.
Definition ast.h:5000
PM_NODE_ALIGNAS struct pm_node * value
InstanceVariableAndWriteNode::value.
Definition ast.h:5022
pm_location_t operator_loc
InstanceVariableAndWriteNode::operator_loc.
Definition ast.h:5017
pm_location_t name_loc
InstanceVariableAndWriteNode::name_loc.
Definition ast.h:5012
pm_node_t base
The embedded base node.
Definition ast.h:5002
pm_constant_id_t name
InstanceVariableAndWriteNode::name.
Definition ast.h:5007
InstanceVariableOperatorWriteNode.
Definition ast.h:5037
pm_constant_id_t binary_operator
InstanceVariableOperatorWriteNode::binary_operator.
Definition ast.h:5064
PM_NODE_ALIGNAS struct pm_node * value
InstanceVariableOperatorWriteNode::value.
Definition ast.h:5059
pm_location_t binary_operator_loc
InstanceVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:5054
pm_constant_id_t name
InstanceVariableOperatorWriteNode::name.
Definition ast.h:5044
pm_node_t base
The embedded base node.
Definition ast.h:5039
pm_location_t name_loc
InstanceVariableOperatorWriteNode::name_loc.
Definition ast.h:5049
InstanceVariableOrWriteNode.
Definition ast.h:5079
pm_location_t operator_loc
InstanceVariableOrWriteNode::operator_loc.
Definition ast.h:5096
pm_node_t base
The embedded base node.
Definition ast.h:5081
pm_location_t name_loc
InstanceVariableOrWriteNode::name_loc.
Definition ast.h:5091
pm_constant_id_t name
InstanceVariableOrWriteNode::name.
Definition ast.h:5086
PM_NODE_ALIGNAS struct pm_node * value
InstanceVariableOrWriteNode::value.
Definition ast.h:5101
InstanceVariableReadNode.
Definition ast.h:5116
pm_constant_id_t name
InstanceVariableReadNode::name.
Definition ast.h:5129
pm_node_t base
The embedded base node.
Definition ast.h:5118
InstanceVariableTargetNode.
Definition ast.h:5144
pm_constant_id_t name
InstanceVariableTargetNode::name.
Definition ast.h:5151
pm_node_t base
The embedded base node.
Definition ast.h:5146
InstanceVariableWriteNode.
Definition ast.h:5166
pm_location_t operator_loc
InstanceVariableWriteNode::operator_loc.
Definition ast.h:5212
PM_NODE_ALIGNAS struct pm_node * value
InstanceVariableWriteNode::value.
Definition ast.h:5202
pm_constant_id_t name
InstanceVariableWriteNode::name.
Definition ast.h:5179
pm_node_t base
The embedded base node.
Definition ast.h:5168
pm_location_t name_loc
InstanceVariableWriteNode::name_loc.
Definition ast.h:5189
IntegerNode.
Definition ast.h:5233
pm_integer_t value
IntegerNode::value.
Definition ast.h:5242
pm_node_t base
The embedded base node.
Definition ast.h:5235
InterpolatedMatchLastLineNode.
Definition ast.h:5270
pm_node_t base
The embedded base node.
Definition ast.h:5272
pm_location_t closing_loc
InterpolatedMatchLastLineNode::closing_loc.
Definition ast.h:5287
struct pm_node_list parts
InterpolatedMatchLastLineNode::parts.
Definition ast.h:5282
pm_location_t opening_loc
InterpolatedMatchLastLineNode::opening_loc.
Definition ast.h:5277
InterpolatedRegularExpressionNode.
Definition ast.h:5315
pm_location_t opening_loc
InterpolatedRegularExpressionNode::opening_loc.
Definition ast.h:5322
struct pm_node_list parts
InterpolatedRegularExpressionNode::parts.
Definition ast.h:5327
pm_node_t base
The embedded base node.
Definition ast.h:5317
pm_location_t closing_loc
InterpolatedRegularExpressionNode::closing_loc.
Definition ast.h:5332
InterpolatedStringNode.
Definition ast.h:5351
pm_node_t base
The embedded base node.
Definition ast.h:5353
pm_location_t closing_loc
InterpolatedStringNode::closing_loc.
Definition ast.h:5368
pm_location_t opening_loc
InterpolatedStringNode::opening_loc.
Definition ast.h:5358
struct pm_node_list parts
InterpolatedStringNode::parts.
Definition ast.h:5363
InterpolatedSymbolNode.
Definition ast.h:5383
struct pm_node_list parts
InterpolatedSymbolNode::parts.
Definition ast.h:5395
pm_location_t closing_loc
InterpolatedSymbolNode::closing_loc.
Definition ast.h:5400
pm_location_t opening_loc
InterpolatedSymbolNode::opening_loc.
Definition ast.h:5390
pm_node_t base
The embedded base node.
Definition ast.h:5385
InterpolatedXStringNode.
Definition ast.h:5415
pm_location_t opening_loc
InterpolatedXStringNode::opening_loc.
Definition ast.h:5422
pm_location_t closing_loc
InterpolatedXStringNode::closing_loc.
Definition ast.h:5432
pm_node_t base
The embedded base node.
Definition ast.h:5417
struct pm_node_list parts
InterpolatedXStringNode::parts.
Definition ast.h:5427
ItLocalVariableReadNode.
Definition ast.h:5447
pm_node_t base
The embedded base node.
Definition ast.h:5449
ItParametersNode.
Definition ast.h:5464
pm_node_t base
The embedded base node.
Definition ast.h:5466
KeywordHashNode.
Definition ast.h:5484
pm_node_t base
The embedded base node.
Definition ast.h:5486
struct pm_node_list elements
KeywordHashNode::elements.
Definition ast.h:5491
KeywordRestParameterNode.
Definition ast.h:5510
pm_node_t base
The embedded base node.
Definition ast.h:5512
pm_constant_id_t name
KeywordRestParameterNode::name.
Definition ast.h:5517
pm_location_t operator_loc
KeywordRestParameterNode::operator_loc.
Definition ast.h:5527
pm_location_t name_loc
KeywordRestParameterNode::name_loc.
Definition ast.h:5522
LambdaNode.
Definition ast.h:5542
pm_location_t closing_loc
LambdaNode::closing_loc.
Definition ast.h:5564
pm_node_t base
The embedded base node.
Definition ast.h:5544
pm_location_t opening_loc
LambdaNode::opening_loc.
Definition ast.h:5559
pm_location_t operator_loc
LambdaNode::operator_loc.
Definition ast.h:5554
pm_constant_id_list_t locals
LambdaNode::locals.
Definition ast.h:5549
PM_NODE_ALIGNAS struct pm_node * body
LambdaNode::body.
Definition ast.h:5574
PM_NODE_ALIGNAS struct pm_node * parameters
LambdaNode::parameters.
Definition ast.h:5569
LocalVariableAndWriteNode.
Definition ast.h:5589
pm_constant_id_t name
LocalVariableAndWriteNode::name.
Definition ast.h:5611
pm_node_t base
The embedded base node.
Definition ast.h:5591
uint32_t depth
LocalVariableAndWriteNode::depth.
Definition ast.h:5616
pm_location_t operator_loc
LocalVariableAndWriteNode::operator_loc.
Definition ast.h:5601
PM_NODE_ALIGNAS struct pm_node * value
LocalVariableAndWriteNode::value.
Definition ast.h:5606
pm_location_t name_loc
LocalVariableAndWriteNode::name_loc.
Definition ast.h:5596
LocalVariableOperatorWriteNode.
Definition ast.h:5631
uint32_t depth
LocalVariableOperatorWriteNode::depth.
Definition ast.h:5663
pm_constant_id_t binary_operator
LocalVariableOperatorWriteNode::binary_operator.
Definition ast.h:5658
pm_node_t base
The embedded base node.
Definition ast.h:5633
pm_location_t name_loc
LocalVariableOperatorWriteNode::name_loc.
Definition ast.h:5638
pm_location_t binary_operator_loc
LocalVariableOperatorWriteNode::binary_operator_loc.
Definition ast.h:5643
PM_NODE_ALIGNAS struct pm_node * value
LocalVariableOperatorWriteNode::value.
Definition ast.h:5648
pm_constant_id_t name
LocalVariableOperatorWriteNode::name.
Definition ast.h:5653
LocalVariableOrWriteNode.
Definition ast.h:5678
PM_NODE_ALIGNAS struct pm_node * value
LocalVariableOrWriteNode::value.
Definition ast.h:5695
uint32_t depth
LocalVariableOrWriteNode::depth.
Definition ast.h:5705
pm_location_t operator_loc
LocalVariableOrWriteNode::operator_loc.
Definition ast.h:5690
pm_node_t base
The embedded base node.
Definition ast.h:5680
pm_constant_id_t name
LocalVariableOrWriteNode::name.
Definition ast.h:5700
pm_location_t name_loc
LocalVariableOrWriteNode::name_loc.
Definition ast.h:5685
LocalVariableReadNode.
Definition ast.h:5720
uint32_t depth
LocalVariableReadNode::depth.
Definition ast.h:5750
pm_constant_id_t name
LocalVariableReadNode::name.
Definition ast.h:5737
pm_node_t base
The embedded base node.
Definition ast.h:5722
LocalVariableTargetNode.
Definition ast.h:5768
uint32_t depth
LocalVariableTargetNode::depth.
Definition ast.h:5780
pm_constant_id_t name
LocalVariableTargetNode::name.
Definition ast.h:5775
pm_node_t base
The embedded base node.
Definition ast.h:5770
LocalVariableWriteNode.
Definition ast.h:5795
PM_NODE_ALIGNAS struct pm_node * value
LocalVariableWriteNode::value.
Definition ast.h:5848
pm_location_t operator_loc
LocalVariableWriteNode::operator_loc.
Definition ast.h:5858
pm_location_t name_loc
LocalVariableWriteNode::name_loc.
Definition ast.h:5831
pm_node_t base
The embedded base node.
Definition ast.h:5797
uint32_t depth
LocalVariableWriteNode::depth.
Definition ast.h:5821
pm_constant_id_t name
LocalVariableWriteNode::name.
Definition ast.h:5808
This struct represents a slice in the source code, defined by an offset and a length.
Definition ast.h:572
uint32_t start
The offset of the location from the start of the source.
Definition ast.h:574
uint32_t length
The length of the location.
Definition ast.h:577
MatchLastLineNode.
Definition ast.h:5886
pm_location_t content_loc
MatchLastLineNode::content_loc.
Definition ast.h:5898
pm_location_t opening_loc
MatchLastLineNode::opening_loc.
Definition ast.h:5893
pm_location_t closing_loc
MatchLastLineNode::closing_loc.
Definition ast.h:5903
pm_string_t unescaped
MatchLastLineNode::unescaped.
Definition ast.h:5908
pm_node_t base
The embedded base node.
Definition ast.h:5888
MatchPredicateNode.
Definition ast.h:5923
pm_location_t keyword_loc
MatchPredicateNode::keyword_loc.
Definition ast.h:5940
PM_NODE_ALIGNAS struct pm_node * pattern
MatchPredicateNode::pattern.
Definition ast.h:5935
PM_NODE_ALIGNAS struct pm_node * value
MatchPredicateNode::value.
Definition ast.h:5930
pm_node_t base
The embedded base node.
Definition ast.h:5925
MatchRequiredNode.
Definition ast.h:5955
pm_node_t base
The embedded base node.
Definition ast.h:5957
pm_location_t operator_loc
MatchRequiredNode::operator_loc.
Definition ast.h:6026
PM_NODE_ALIGNAS struct pm_node * pattern
MatchRequiredNode::pattern.
Definition ast.h:6016
PM_NODE_ALIGNAS struct pm_node * value
MatchRequiredNode::value.
Definition ast.h:5967
MatchWriteNode.
Definition ast.h:6041
pm_node_t base
The embedded base node.
Definition ast.h:6043
PM_NODE_ALIGNAS struct pm_call_node * call
MatchWriteNode::call.
Definition ast.h:6048
struct pm_node_list targets
MatchWriteNode::targets.
Definition ast.h:6053
ModuleNode.
Definition ast.h:6068
pm_location_t end_keyword_loc
ModuleNode::end_keyword_loc.
Definition ast.h:6095
PM_NODE_ALIGNAS struct pm_node * constant_path
ModuleNode::constant_path.
Definition ast.h:6085
PM_NODE_ALIGNAS struct pm_node * body
ModuleNode::body.
Definition ast.h:6090
pm_constant_id_list_t locals
ModuleNode::locals.
Definition ast.h:6075
pm_node_t base
The embedded base node.
Definition ast.h:6070
pm_location_t module_keyword_loc
ModuleNode::module_keyword_loc.
Definition ast.h:6080
pm_constant_id_t name
ModuleNode::name.
Definition ast.h:6100
MultiTargetNode.
Definition ast.h:6120
PM_NODE_ALIGNAS struct pm_node * rest
MultiTargetNode::rest.
Definition ast.h:6157
pm_node_t base
The embedded base node.
Definition ast.h:6122
pm_location_t lparen_loc
MultiTargetNode::lparen_loc.
Definition ast.h:6177
struct pm_node_list lefts
MultiTargetNode::lefts.
Definition ast.h:6137
pm_location_t rparen_loc
MultiTargetNode::rparen_loc.
Definition ast.h:6187
struct pm_node_list rights
MultiTargetNode::rights.
Definition ast.h:6167
MultiWriteNode.
Definition ast.h:6202
pm_location_t rparen_loc
MultiWriteNode::rparen_loc.
Definition ast.h:6269
PM_NODE_ALIGNAS struct pm_node * rest
MultiWriteNode::rest.
Definition ast.h:6239
struct pm_node_list rights
MultiWriteNode::rights.
Definition ast.h:6249
pm_location_t operator_loc
MultiWriteNode::operator_loc.
Definition ast.h:6279
PM_NODE_ALIGNAS struct pm_node * value
MultiWriteNode::value.
Definition ast.h:6289
pm_location_t lparen_loc
MultiWriteNode::lparen_loc.
Definition ast.h:6259
struct pm_node_list lefts
MultiWriteNode::lefts.
Definition ast.h:6219
pm_node_t base
The embedded base node.
Definition ast.h:6204
NextNode.
Definition ast.h:6304
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
NextNode::arguments.
Definition ast.h:6311
pm_node_t base
The embedded base node.
Definition ast.h:6306
pm_location_t keyword_loc
NextNode::keyword_loc.
Definition ast.h:6316
NilNode.
Definition ast.h:6331
pm_node_t base
The embedded base node.
Definition ast.h:6333
NoBlockParameterNode.
Definition ast.h:6349
pm_location_t keyword_loc
NoBlockParameterNode::keyword_loc.
Definition ast.h:6361
pm_node_t base
The embedded base node.
Definition ast.h:6351
pm_location_t operator_loc
NoBlockParameterNode::operator_loc.
Definition ast.h:6356
NoKeywordsParameterNode.
Definition ast.h:6377
pm_location_t keyword_loc
NoKeywordsParameterNode::keyword_loc.
Definition ast.h:6389
pm_location_t operator_loc
NoKeywordsParameterNode::operator_loc.
Definition ast.h:6384
pm_node_t base
The embedded base node.
Definition ast.h:6379
A list of nodes in the source, most often used for lists of children.
Definition ast.h:585
size_t size
The number of nodes in the list.
Definition ast.h:587
struct pm_node ** nodes
The nodes in the list.
Definition ast.h:593
This is the base structure that represents a node in the syntax tree.
Definition ast.h:1083
pm_location_t location
This is the location of the node in the source.
Definition ast.h:1106
NumberedParametersNode.
Definition ast.h:6404
pm_node_t base
The embedded base node.
Definition ast.h:6406
uint8_t maximum
NumberedParametersNode::maximum.
Definition ast.h:6411
NumberedReferenceReadNode.
Definition ast.h:6426
pm_node_t base
The embedded base node.
Definition ast.h:6428
uint32_t number
NumberedReferenceReadNode::number.
Definition ast.h:6441
OptionalKeywordParameterNode.
Definition ast.h:6460
pm_node_t base
The embedded base node.
Definition ast.h:6462
pm_constant_id_t name
OptionalKeywordParameterNode::name.
Definition ast.h:6467
PM_NODE_ALIGNAS struct pm_node * value
OptionalKeywordParameterNode::value.
Definition ast.h:6477
pm_location_t name_loc
OptionalKeywordParameterNode::name_loc.
Definition ast.h:6472
OptionalParameterNode.
Definition ast.h:6496
pm_location_t name_loc
OptionalParameterNode::name_loc.
Definition ast.h:6508
pm_constant_id_t name
OptionalParameterNode::name.
Definition ast.h:6503
pm_node_t base
The embedded base node.
Definition ast.h:6498
pm_location_t operator_loc
OptionalParameterNode::operator_loc.
Definition ast.h:6513
PM_NODE_ALIGNAS struct pm_node * value
OptionalParameterNode::value.
Definition ast.h:6518
OrNode.
Definition ast.h:6533
PM_NODE_ALIGNAS struct pm_node * right
OrNode::right.
Definition ast.h:6561
pm_node_t base
The embedded base node.
Definition ast.h:6535
PM_NODE_ALIGNAS struct pm_node * left
OrNode::left.
Definition ast.h:6548
pm_location_t operator_loc
OrNode::operator_loc.
Definition ast.h:6571
ParametersNode.
Definition ast.h:6587
PM_NODE_ALIGNAS struct pm_node * block
ParametersNode::block.
Definition ast.h:6624
struct pm_node_list requireds
ParametersNode::requireds.
Definition ast.h:6594
struct pm_node_list optionals
ParametersNode::optionals.
Definition ast.h:6599
struct pm_node_list posts
ParametersNode::posts.
Definition ast.h:6609
pm_node_t base
The embedded base node.
Definition ast.h:6589
PM_NODE_ALIGNAS struct pm_node * rest
ParametersNode::rest.
Definition ast.h:6604
struct pm_node_list keywords
ParametersNode::keywords.
Definition ast.h:6614
PM_NODE_ALIGNAS struct pm_node * keyword_rest
ParametersNode::keyword_rest.
Definition ast.h:6619
ParenthesesNode.
Definition ast.h:6642
pm_location_t closing_loc
ParenthesesNode::closing_loc.
Definition ast.h:6659
pm_node_t base
The embedded base node.
Definition ast.h:6644
pm_location_t opening_loc
ParenthesesNode::opening_loc.
Definition ast.h:6654
PM_NODE_ALIGNAS struct pm_node * body
ParenthesesNode::body.
Definition ast.h:6649
PinnedExpressionNode.
Definition ast.h:6674
pm_node_t base
The embedded base node.
Definition ast.h:6676
pm_location_t rparen_loc
PinnedExpressionNode::rparen_loc.
Definition ast.h:6716
pm_location_t lparen_loc
PinnedExpressionNode::lparen_loc.
Definition ast.h:6706
PM_NODE_ALIGNAS struct pm_node * expression
PinnedExpressionNode::expression.
Definition ast.h:6686
pm_location_t operator_loc
PinnedExpressionNode::operator_loc.
Definition ast.h:6696
PinnedVariableNode.
Definition ast.h:6731
pm_node_t base
The embedded base node.
Definition ast.h:6733
PM_NODE_ALIGNAS struct pm_node * variable
PinnedVariableNode::variable.
Definition ast.h:6743
pm_location_t operator_loc
PinnedVariableNode::operator_loc.
Definition ast.h:6753
PostExecutionNode.
Definition ast.h:6768
pm_location_t closing_loc
PostExecutionNode::closing_loc.
Definition ast.h:6790
pm_node_t base
The embedded base node.
Definition ast.h:6770
pm_location_t opening_loc
PostExecutionNode::opening_loc.
Definition ast.h:6785
pm_location_t keyword_loc
PostExecutionNode::keyword_loc.
Definition ast.h:6780
PM_NODE_ALIGNAS struct pm_statements_node * statements
PostExecutionNode::statements.
Definition ast.h:6775
PreExecutionNode.
Definition ast.h:6805
pm_location_t closing_loc
PreExecutionNode::closing_loc.
Definition ast.h:6827
pm_location_t opening_loc
PreExecutionNode::opening_loc.
Definition ast.h:6822
PM_NODE_ALIGNAS struct pm_statements_node * statements
PreExecutionNode::statements.
Definition ast.h:6812
pm_node_t base
The embedded base node.
Definition ast.h:6807
pm_location_t keyword_loc
PreExecutionNode::keyword_loc.
Definition ast.h:6817
ProgramNode.
Definition ast.h:6839
pm_node_t base
The embedded base node.
Definition ast.h:6841
PM_NODE_ALIGNAS struct pm_statements_node * statements
ProgramNode::statements.
Definition ast.h:6851
pm_constant_id_list_t locals
ProgramNode::locals.
Definition ast.h:6846
RangeNode.
Definition ast.h:6872
pm_location_t operator_loc
RangeNode::operator_loc.
Definition ast.h:6908
pm_node_t base
The embedded base node.
Definition ast.h:6874
PM_NODE_ALIGNAS struct pm_node * right
RangeNode::right.
Definition ast.h:6901
PM_NODE_ALIGNAS struct pm_node * left
RangeNode::left.
Definition ast.h:6887
RationalNode.
Definition ast.h:6929
pm_node_t base
The embedded base node.
Definition ast.h:6931
pm_integer_t denominator
RationalNode::denominator.
Definition ast.h:6949
pm_integer_t numerator
RationalNode::numerator.
Definition ast.h:6940
RedoNode.
Definition ast.h:6964
pm_node_t base
The embedded base node.
Definition ast.h:6966
RegularExpressionNode.
Definition ast.h:6994
pm_location_t closing_loc
RegularExpressionNode::closing_loc.
Definition ast.h:7011
pm_node_t base
The embedded base node.
Definition ast.h:6996
pm_string_t unescaped
RegularExpressionNode::unescaped.
Definition ast.h:7016
pm_location_t opening_loc
RegularExpressionNode::opening_loc.
Definition ast.h:7001
pm_location_t content_loc
RegularExpressionNode::content_loc.
Definition ast.h:7006
RequiredKeywordParameterNode.
Definition ast.h:7035
pm_location_t name_loc
RequiredKeywordParameterNode::name_loc.
Definition ast.h:7047
pm_node_t base
The embedded base node.
Definition ast.h:7037
pm_constant_id_t name
RequiredKeywordParameterNode::name.
Definition ast.h:7042
RequiredParameterNode.
Definition ast.h:7066
pm_constant_id_t name
RequiredParameterNode::name.
Definition ast.h:7073
pm_node_t base
The embedded base node.
Definition ast.h:7068
RescueModifierNode.
Definition ast.h:7088
PM_NODE_ALIGNAS struct pm_node * expression
RescueModifierNode::expression.
Definition ast.h:7095
pm_node_t base
The embedded base node.
Definition ast.h:7090
pm_location_t keyword_loc
RescueModifierNode::keyword_loc.
Definition ast.h:7100
PM_NODE_ALIGNAS struct pm_node * rescue_expression
RescueModifierNode::rescue_expression.
Definition ast.h:7105
RescueNode.
Definition ast.h:7125
PM_NODE_ALIGNAS struct pm_statements_node * statements
RescueNode::statements.
Definition ast.h:7157
PM_NODE_ALIGNAS struct pm_rescue_node * subsequent
RescueNode::subsequent.
Definition ast.h:7162
pm_location_t keyword_loc
RescueNode::keyword_loc.
Definition ast.h:7132
PM_NODE_ALIGNAS struct pm_node * reference
RescueNode::reference.
Definition ast.h:7147
pm_location_t then_keyword_loc
RescueNode::then_keyword_loc.
Definition ast.h:7152
pm_location_t operator_loc
RescueNode::operator_loc.
Definition ast.h:7142
struct pm_node_list exceptions
RescueNode::exceptions.
Definition ast.h:7137
pm_node_t base
The embedded base node.
Definition ast.h:7127
RestParameterNode.
Definition ast.h:7181
pm_constant_id_t name
RestParameterNode::name.
Definition ast.h:7188
pm_location_t name_loc
RestParameterNode::name_loc.
Definition ast.h:7193
pm_node_t base
The embedded base node.
Definition ast.h:7183
pm_location_t operator_loc
RestParameterNode::operator_loc.
Definition ast.h:7198
RetryNode.
Definition ast.h:7213
pm_node_t base
The embedded base node.
Definition ast.h:7215
ReturnNode.
Definition ast.h:7230
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
ReturnNode::arguments.
Definition ast.h:7242
pm_location_t keyword_loc
ReturnNode::keyword_loc.
Definition ast.h:7237
pm_node_t base
The embedded base node.
Definition ast.h:7232
SelfNode.
Definition ast.h:7257
pm_node_t base
The embedded base node.
Definition ast.h:7259
ShareableConstantNode.
Definition ast.h:7280
PM_NODE_ALIGNAS struct pm_node * write
ShareableConstantNode::write.
Definition ast.h:7289
pm_node_t base
The embedded base node.
Definition ast.h:7282
SingletonClassNode.
Definition ast.h:7304
PM_NODE_ALIGNAS struct pm_node * body
SingletonClassNode::body.
Definition ast.h:7331
pm_node_t base
The embedded base node.
Definition ast.h:7306
pm_constant_id_list_t locals
SingletonClassNode::locals.
Definition ast.h:7311
pm_location_t operator_loc
SingletonClassNode::operator_loc.
Definition ast.h:7321
PM_NODE_ALIGNAS struct pm_node * expression
SingletonClassNode::expression.
Definition ast.h:7326
pm_location_t end_keyword_loc
SingletonClassNode::end_keyword_loc.
Definition ast.h:7336
pm_location_t class_keyword_loc
SingletonClassNode::class_keyword_loc.
Definition ast.h:7316
SourceEncodingNode.
Definition ast.h:7351
pm_node_t base
The embedded base node.
Definition ast.h:7353
SourceFileNode.
Definition ast.h:7374
pm_string_t filepath
SourceFileNode::filepath.
Definition ast.h:7383
pm_node_t base
The embedded base node.
Definition ast.h:7376
SourceLineNode.
Definition ast.h:7398
pm_node_t base
The embedded base node.
Definition ast.h:7400
SplatNode.
Definition ast.h:7415
pm_node_t base
The embedded base node.
Definition ast.h:7417
PM_NODE_ALIGNAS struct pm_node * expression
SplatNode::expression.
Definition ast.h:7427
pm_location_t operator_loc
SplatNode::operator_loc.
Definition ast.h:7422
StatementsNode.
Definition ast.h:7442
struct pm_node_list body
StatementsNode::body.
Definition ast.h:7449
pm_node_t base
The embedded base node.
Definition ast.h:7444
StringNode.
Definition ast.h:7476
pm_node_t base
The embedded base node.
Definition ast.h:7478
pm_string_t unescaped
StringNode::unescaped.
Definition ast.h:7498
pm_location_t content_loc
StringNode::content_loc.
Definition ast.h:7488
pm_location_t closing_loc
StringNode::closing_loc.
Definition ast.h:7493
pm_location_t opening_loc
StringNode::opening_loc.
Definition ast.h:7483
A generic string type that can have various ownership semantics.
Definition stringy.h:18
SuperNode.
Definition ast.h:7518
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
SuperNode::arguments.
Definition ast.h:7537
pm_location_t lparen_loc
SuperNode::lparen_loc.
Definition ast.h:7530
pm_node_t base
The embedded base node.
Definition ast.h:7520
pm_location_t keyword_loc
SuperNode::keyword_loc.
Definition ast.h:7525
pm_location_t rparen_loc
SuperNode::rparen_loc.
Definition ast.h:7542
PM_NODE_ALIGNAS struct pm_node * block
SuperNode::block.
Definition ast.h:7547
SymbolNode.
Definition ast.h:7570
pm_location_t opening_loc
SymbolNode::opening_loc.
Definition ast.h:7577
pm_location_t value_loc
SymbolNode::value_loc.
Definition ast.h:7582
pm_location_t closing_loc
SymbolNode::closing_loc.
Definition ast.h:7587
pm_string_t unescaped
SymbolNode::unescaped.
Definition ast.h:7592
pm_node_t base
The embedded base node.
Definition ast.h:7572
TrueNode.
Definition ast.h:7607
pm_node_t base
The embedded base node.
Definition ast.h:7609
UndefNode.
Definition ast.h:7624
pm_node_t base
The embedded base node.
Definition ast.h:7626
pm_location_t keyword_loc
UndefNode::keyword_loc.
Definition ast.h:7636
struct pm_node_list names
UndefNode::names.
Definition ast.h:7631
UnlessNode.
Definition ast.h:7654
pm_location_t then_keyword_loc
UnlessNode::then_keyword_loc.
Definition ast.h:7692
PM_NODE_ALIGNAS struct pm_node * predicate
UnlessNode::predicate.
Definition ast.h:7682
PM_NODE_ALIGNAS struct pm_statements_node * statements
UnlessNode::statements.
Definition ast.h:7703
pm_location_t end_keyword_loc
UnlessNode::end_keyword_loc.
Definition ast.h:7723
PM_NODE_ALIGNAS struct pm_else_node * else_clause
UnlessNode::else_clause.
Definition ast.h:7713
pm_node_t base
The embedded base node.
Definition ast.h:7656
pm_location_t unless_keyword_loc
UnlessNode::unless_keyword_loc.
Definition ast.h:7669
UntilNode.
Definition ast.h:7744
pm_location_t end_keyword_loc
UntilNode::end_keyword_loc.
Definition ast.h:7761
pm_location_t until_keyword_loc
UntilNode::until_keyword_loc.
Definition ast.h:7751
pm_node_t base
The embedded base node.
Definition ast.h:7746
PM_NODE_ALIGNAS struct pm_statements_node * statements
UntilNode::statements.
Definition ast.h:7771
pm_location_t do_keyword_loc
UntilNode::do_keyword_loc.
Definition ast.h:7756
PM_NODE_ALIGNAS struct pm_node * predicate
UntilNode::predicate.
Definition ast.h:7766
WhenNode.
Definition ast.h:7788
pm_location_t when_keyword_loc
WhenNode::when_keyword_loc.
Definition ast.h:7795
pm_node_t base
The embedded base node.
Definition ast.h:7790
pm_location_t then_keyword_loc
WhenNode::then_keyword_loc.
Definition ast.h:7805
PM_NODE_ALIGNAS struct pm_statements_node * statements
WhenNode::statements.
Definition ast.h:7810
struct pm_node_list conditions
WhenNode::conditions.
Definition ast.h:7800
WhileNode.
Definition ast.h:7831
PM_NODE_ALIGNAS struct pm_statements_node * statements
WhileNode::statements.
Definition ast.h:7858
pm_location_t while_keyword_loc
WhileNode::while_keyword_loc.
Definition ast.h:7838
pm_location_t end_keyword_loc
WhileNode::end_keyword_loc.
Definition ast.h:7848
pm_node_t base
The embedded base node.
Definition ast.h:7833
pm_location_t do_keyword_loc
WhileNode::do_keyword_loc.
Definition ast.h:7843
PM_NODE_ALIGNAS struct pm_node * predicate
WhileNode::predicate.
Definition ast.h:7853
XStringNode.
Definition ast.h:7877
pm_location_t closing_loc
XStringNode::closing_loc.
Definition ast.h:7894
pm_location_t opening_loc
XStringNode::opening_loc.
Definition ast.h:7884
pm_location_t content_loc
XStringNode::content_loc.
Definition ast.h:7889
pm_string_t unescaped
XStringNode::unescaped.
Definition ast.h:7899
pm_node_t base
The embedded base node.
Definition ast.h:7879
YieldNode.
Definition ast.h:7914
pm_location_t keyword_loc
YieldNode::keyword_loc.
Definition ast.h:7921
pm_location_t lparen_loc
YieldNode::lparen_loc.
Definition ast.h:7926
pm_node_t base
The embedded base node.
Definition ast.h:7916
pm_location_t rparen_loc
YieldNode::rparen_loc.
Definition ast.h:7936
PM_NODE_ALIGNAS struct pm_arguments_node * arguments
YieldNode::arguments.
Definition ast.h:7931