Ruby: prism/prettyprint.c Source File

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

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