yarp 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +51 -0
- data/LICENSE.md +7 -0
- data/Makefile.in +79 -0
- data/README.md +86 -0
- data/config.h.in +25 -0
- data/config.yml +2147 -0
- data/configure +4487 -0
- data/docs/build_system.md +85 -0
- data/docs/building.md +26 -0
- data/docs/configuration.md +56 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +116 -0
- data/docs/extension.md +20 -0
- data/docs/fuzzing.md +93 -0
- data/docs/heredocs.md +36 -0
- data/docs/mapping.md +117 -0
- data/docs/ripper.md +36 -0
- data/docs/serialization.md +130 -0
- data/docs/testing.md +55 -0
- data/ext/yarp/api_node.c +3680 -0
- data/ext/yarp/api_pack.c +256 -0
- data/ext/yarp/extconf.rb +131 -0
- data/ext/yarp/extension.c +547 -0
- data/ext/yarp/extension.h +18 -0
- data/include/yarp/ast.h +1412 -0
- data/include/yarp/defines.h +54 -0
- data/include/yarp/diagnostic.h +24 -0
- data/include/yarp/enc/yp_encoding.h +94 -0
- data/include/yarp/node.h +36 -0
- data/include/yarp/pack.h +141 -0
- data/include/yarp/parser.h +389 -0
- data/include/yarp/regexp.h +19 -0
- data/include/yarp/unescape.h +42 -0
- data/include/yarp/util/yp_buffer.h +39 -0
- data/include/yarp/util/yp_char.h +75 -0
- data/include/yarp/util/yp_constant_pool.h +64 -0
- data/include/yarp/util/yp_list.h +67 -0
- data/include/yarp/util/yp_memchr.h +14 -0
- data/include/yarp/util/yp_newline_list.h +54 -0
- data/include/yarp/util/yp_state_stack.h +24 -0
- data/include/yarp/util/yp_string.h +57 -0
- data/include/yarp/util/yp_string_list.h +28 -0
- data/include/yarp/util/yp_strpbrk.h +29 -0
- data/include/yarp/version.h +5 -0
- data/include/yarp.h +69 -0
- data/lib/yarp/lex_compat.rb +759 -0
- data/lib/yarp/node.rb +7428 -0
- data/lib/yarp/pack.rb +185 -0
- data/lib/yarp/ripper_compat.rb +174 -0
- data/lib/yarp/serialize.rb +389 -0
- data/lib/yarp.rb +330 -0
- data/src/diagnostic.c +25 -0
- data/src/enc/yp_big5.c +79 -0
- data/src/enc/yp_euc_jp.c +85 -0
- data/src/enc/yp_gbk.c +88 -0
- data/src/enc/yp_shift_jis.c +83 -0
- data/src/enc/yp_tables.c +509 -0
- data/src/enc/yp_unicode.c +2320 -0
- data/src/enc/yp_windows_31j.c +83 -0
- data/src/node.c +2011 -0
- data/src/pack.c +493 -0
- data/src/prettyprint.c +1782 -0
- data/src/regexp.c +580 -0
- data/src/serialize.c +1576 -0
- data/src/token_type.c +347 -0
- data/src/unescape.c +576 -0
- data/src/util/yp_buffer.c +78 -0
- data/src/util/yp_char.c +229 -0
- data/src/util/yp_constant_pool.c +147 -0
- data/src/util/yp_list.c +50 -0
- data/src/util/yp_memchr.c +31 -0
- data/src/util/yp_newline_list.c +119 -0
- data/src/util/yp_state_stack.c +25 -0
- data/src/util/yp_string.c +207 -0
- data/src/util/yp_string_list.c +32 -0
- data/src/util/yp_strncasecmp.c +20 -0
- data/src/util/yp_strpbrk.c +66 -0
- data/src/yarp.c +13211 -0
- data/yarp.gemspec +100 -0
- metadata +125 -0
data/src/prettyprint.c
ADDED
@@ -0,0 +1,1782 @@
|
|
1
|
+
/******************************************************************************/
|
2
|
+
/* This file is generated by the bin/template script and should not be */
|
3
|
+
/* modified manually. See */
|
4
|
+
/* templates/src/prettyprint.c.erb */
|
5
|
+
/* if you are looking to modify the */
|
6
|
+
/* template */
|
7
|
+
/******************************************************************************/
|
8
|
+
#include "yarp/defines.h"
|
9
|
+
|
10
|
+
#include <stdio.h>
|
11
|
+
|
12
|
+
#include "yarp/ast.h"
|
13
|
+
#include "yarp/parser.h"
|
14
|
+
#include "yarp/util/yp_buffer.h"
|
15
|
+
|
16
|
+
static void
|
17
|
+
prettyprint_location(yp_buffer_t *buffer, yp_parser_t *parser, yp_location_t *location) {
|
18
|
+
char printed[] = "[0000-0000]";
|
19
|
+
yp_snprintf(printed, sizeof(printed), "[%04ld-%04ld]", (long int)(location->start - parser->start), (long int)(location->end - parser->start));
|
20
|
+
yp_buffer_append_str(buffer, printed, strlen(printed));
|
21
|
+
}
|
22
|
+
|
23
|
+
static void
|
24
|
+
prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
25
|
+
switch (YP_NODE_TYPE(node)) {
|
26
|
+
case YP_NODE_ALIAS_NODE: {
|
27
|
+
yp_buffer_append_str(buffer, "AliasNode(", 10);
|
28
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_node_t *)node)->new_name);
|
29
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_node_t *)node)->old_name);
|
30
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_alias_node_t *)node)->keyword_loc);
|
31
|
+
yp_buffer_append_str(buffer, ")", 1);
|
32
|
+
break;
|
33
|
+
}
|
34
|
+
case YP_NODE_ALTERNATION_PATTERN_NODE: {
|
35
|
+
yp_buffer_append_str(buffer, "AlternationPatternNode(", 23);
|
36
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_alternation_pattern_node_t *)node)->left);
|
37
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_alternation_pattern_node_t *)node)->right);
|
38
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_alternation_pattern_node_t *)node)->operator_loc);
|
39
|
+
yp_buffer_append_str(buffer, ")", 1);
|
40
|
+
break;
|
41
|
+
}
|
42
|
+
case YP_NODE_AND_NODE: {
|
43
|
+
yp_buffer_append_str(buffer, "AndNode(", 8);
|
44
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_and_node_t *)node)->left);
|
45
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_and_node_t *)node)->right);
|
46
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_and_node_t *)node)->operator_loc);
|
47
|
+
yp_buffer_append_str(buffer, ")", 1);
|
48
|
+
break;
|
49
|
+
}
|
50
|
+
case YP_NODE_ARGUMENTS_NODE: {
|
51
|
+
yp_buffer_append_str(buffer, "ArgumentsNode(", 14);
|
52
|
+
yp_buffer_append_str(buffer, "[", 1);
|
53
|
+
for (uint32_t index = 0; index < ((yp_arguments_node_t *)node)->arguments.size; index++) {
|
54
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
55
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_arguments_node_t *) node)->arguments.nodes[index]);
|
56
|
+
}
|
57
|
+
yp_buffer_append_str(buffer, "]", 1);
|
58
|
+
yp_buffer_append_str(buffer, ")", 1);
|
59
|
+
break;
|
60
|
+
}
|
61
|
+
case YP_NODE_ARRAY_NODE: {
|
62
|
+
yp_buffer_append_str(buffer, "ArrayNode(", 10);
|
63
|
+
yp_buffer_append_str(buffer, "[", 1);
|
64
|
+
for (uint32_t index = 0; index < ((yp_array_node_t *)node)->elements.size; index++) {
|
65
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
66
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_array_node_t *) node)->elements.nodes[index]);
|
67
|
+
}
|
68
|
+
yp_buffer_append_str(buffer, "]", 1);
|
69
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_array_node_t *)node)->opening_loc.start == NULL) {
|
70
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
71
|
+
} else {
|
72
|
+
prettyprint_location(buffer, parser, &((yp_array_node_t *)node)->opening_loc);
|
73
|
+
}
|
74
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_array_node_t *)node)->closing_loc.start == NULL) {
|
75
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
76
|
+
} else {
|
77
|
+
prettyprint_location(buffer, parser, &((yp_array_node_t *)node)->closing_loc);
|
78
|
+
}
|
79
|
+
yp_buffer_append_str(buffer, ")", 1);
|
80
|
+
break;
|
81
|
+
}
|
82
|
+
case YP_NODE_ARRAY_PATTERN_NODE: {
|
83
|
+
yp_buffer_append_str(buffer, "ArrayPatternNode(", 17);
|
84
|
+
if (((yp_array_pattern_node_t *)node)->constant == NULL) {
|
85
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
86
|
+
} else {
|
87
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_array_pattern_node_t *)node)->constant);
|
88
|
+
}
|
89
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
90
|
+
for (uint32_t index = 0; index < ((yp_array_pattern_node_t *)node)->requireds.size; index++) {
|
91
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
92
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_array_pattern_node_t *) node)->requireds.nodes[index]);
|
93
|
+
}
|
94
|
+
yp_buffer_append_str(buffer, "]", 1);
|
95
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_array_pattern_node_t *)node)->rest == NULL) {
|
96
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
97
|
+
} else {
|
98
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_array_pattern_node_t *)node)->rest);
|
99
|
+
}
|
100
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
101
|
+
for (uint32_t index = 0; index < ((yp_array_pattern_node_t *)node)->posts.size; index++) {
|
102
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
103
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_array_pattern_node_t *) node)->posts.nodes[index]);
|
104
|
+
}
|
105
|
+
yp_buffer_append_str(buffer, "]", 1);
|
106
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_array_pattern_node_t *)node)->opening_loc.start == NULL) {
|
107
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
108
|
+
} else {
|
109
|
+
prettyprint_location(buffer, parser, &((yp_array_pattern_node_t *)node)->opening_loc);
|
110
|
+
}
|
111
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_array_pattern_node_t *)node)->closing_loc.start == NULL) {
|
112
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
113
|
+
} else {
|
114
|
+
prettyprint_location(buffer, parser, &((yp_array_pattern_node_t *)node)->closing_loc);
|
115
|
+
}
|
116
|
+
yp_buffer_append_str(buffer, ")", 1);
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
case YP_NODE_ASSOC_NODE: {
|
120
|
+
yp_buffer_append_str(buffer, "AssocNode(", 10);
|
121
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_assoc_node_t *)node)->key);
|
122
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_assoc_node_t *)node)->value == NULL) {
|
123
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
124
|
+
} else {
|
125
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_assoc_node_t *)node)->value);
|
126
|
+
}
|
127
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_assoc_node_t *)node)->operator_loc.start == NULL) {
|
128
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
129
|
+
} else {
|
130
|
+
prettyprint_location(buffer, parser, &((yp_assoc_node_t *)node)->operator_loc);
|
131
|
+
}
|
132
|
+
yp_buffer_append_str(buffer, ")", 1);
|
133
|
+
break;
|
134
|
+
}
|
135
|
+
case YP_NODE_ASSOC_SPLAT_NODE: {
|
136
|
+
yp_buffer_append_str(buffer, "AssocSplatNode(", 15);
|
137
|
+
if (((yp_assoc_splat_node_t *)node)->value == NULL) {
|
138
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
139
|
+
} else {
|
140
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_assoc_splat_node_t *)node)->value);
|
141
|
+
}
|
142
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_assoc_splat_node_t *)node)->operator_loc);
|
143
|
+
yp_buffer_append_str(buffer, ")", 1);
|
144
|
+
break;
|
145
|
+
}
|
146
|
+
case YP_NODE_BACK_REFERENCE_READ_NODE: {
|
147
|
+
yp_buffer_append_str(buffer, "BackReferenceReadNode(", 22);
|
148
|
+
yp_buffer_append_str(buffer, ")", 1);
|
149
|
+
break;
|
150
|
+
}
|
151
|
+
case YP_NODE_BEGIN_NODE: {
|
152
|
+
yp_buffer_append_str(buffer, "BeginNode(", 10);
|
153
|
+
if (((yp_begin_node_t *)node)->begin_keyword_loc.start == NULL) {
|
154
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
155
|
+
} else {
|
156
|
+
prettyprint_location(buffer, parser, &((yp_begin_node_t *)node)->begin_keyword_loc);
|
157
|
+
}
|
158
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_begin_node_t *)node)->statements == NULL) {
|
159
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
160
|
+
} else {
|
161
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_begin_node_t *)node)->statements);
|
162
|
+
}
|
163
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_begin_node_t *)node)->rescue_clause == NULL) {
|
164
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
165
|
+
} else {
|
166
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_begin_node_t *)node)->rescue_clause);
|
167
|
+
}
|
168
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_begin_node_t *)node)->else_clause == NULL) {
|
169
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
170
|
+
} else {
|
171
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_begin_node_t *)node)->else_clause);
|
172
|
+
}
|
173
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_begin_node_t *)node)->ensure_clause == NULL) {
|
174
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
175
|
+
} else {
|
176
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_begin_node_t *)node)->ensure_clause);
|
177
|
+
}
|
178
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_begin_node_t *)node)->end_keyword_loc.start == NULL) {
|
179
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
180
|
+
} else {
|
181
|
+
prettyprint_location(buffer, parser, &((yp_begin_node_t *)node)->end_keyword_loc);
|
182
|
+
}
|
183
|
+
yp_buffer_append_str(buffer, ")", 1);
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
case YP_NODE_BLOCK_ARGUMENT_NODE: {
|
187
|
+
yp_buffer_append_str(buffer, "BlockArgumentNode(", 18);
|
188
|
+
if (((yp_block_argument_node_t *)node)->expression == NULL) {
|
189
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
190
|
+
} else {
|
191
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_argument_node_t *)node)->expression);
|
192
|
+
}
|
193
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_block_argument_node_t *)node)->operator_loc);
|
194
|
+
yp_buffer_append_str(buffer, ")", 1);
|
195
|
+
break;
|
196
|
+
}
|
197
|
+
case YP_NODE_BLOCK_NODE: {
|
198
|
+
yp_buffer_append_str(buffer, "BlockNode(", 10);
|
199
|
+
yp_buffer_append_str(buffer, "[", 1);
|
200
|
+
for (uint32_t index = 0; index < ((yp_block_node_t *)node)->locals.size; index++) {
|
201
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
202
|
+
char locals_buffer[12];
|
203
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_block_node_t *)node)->locals.ids[index]);
|
204
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
205
|
+
}
|
206
|
+
yp_buffer_append_str(buffer, "]", 1);
|
207
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_block_node_t *)node)->parameters == NULL) {
|
208
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
209
|
+
} else {
|
210
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_node_t *)node)->parameters);
|
211
|
+
}
|
212
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_block_node_t *)node)->statements == NULL) {
|
213
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
214
|
+
} else {
|
215
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_node_t *)node)->statements);
|
216
|
+
}
|
217
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_block_node_t *)node)->opening_loc);
|
218
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_block_node_t *)node)->closing_loc);
|
219
|
+
yp_buffer_append_str(buffer, ")", 1);
|
220
|
+
break;
|
221
|
+
}
|
222
|
+
case YP_NODE_BLOCK_PARAMETER_NODE: {
|
223
|
+
yp_buffer_append_str(buffer, "BlockParameterNode(", 19);
|
224
|
+
if (((yp_block_parameter_node_t *)node)->name_loc.start == NULL) {
|
225
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
226
|
+
} else {
|
227
|
+
prettyprint_location(buffer, parser, &((yp_block_parameter_node_t *)node)->name_loc);
|
228
|
+
}
|
229
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_block_parameter_node_t *)node)->operator_loc);
|
230
|
+
yp_buffer_append_str(buffer, ")", 1);
|
231
|
+
break;
|
232
|
+
}
|
233
|
+
case YP_NODE_BLOCK_PARAMETERS_NODE: {
|
234
|
+
yp_buffer_append_str(buffer, "BlockParametersNode(", 20);
|
235
|
+
if (((yp_block_parameters_node_t *)node)->parameters == NULL) {
|
236
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
237
|
+
} else {
|
238
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_parameters_node_t *)node)->parameters);
|
239
|
+
}
|
240
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
241
|
+
for (uint32_t index = 0; index < ((yp_block_parameters_node_t *)node)->locals.size; index++) {
|
242
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
243
|
+
prettyprint_location(buffer, parser, &((yp_block_parameters_node_t *)node)->locals.locations[index]);
|
244
|
+
}
|
245
|
+
yp_buffer_append_str(buffer, "]", 1);
|
246
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_block_parameters_node_t *)node)->opening_loc.start == NULL) {
|
247
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
248
|
+
} else {
|
249
|
+
prettyprint_location(buffer, parser, &((yp_block_parameters_node_t *)node)->opening_loc);
|
250
|
+
}
|
251
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_block_parameters_node_t *)node)->closing_loc.start == NULL) {
|
252
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
253
|
+
} else {
|
254
|
+
prettyprint_location(buffer, parser, &((yp_block_parameters_node_t *)node)->closing_loc);
|
255
|
+
}
|
256
|
+
yp_buffer_append_str(buffer, ")", 1);
|
257
|
+
break;
|
258
|
+
}
|
259
|
+
case YP_NODE_BREAK_NODE: {
|
260
|
+
yp_buffer_append_str(buffer, "BreakNode(", 10);
|
261
|
+
if (((yp_break_node_t *)node)->arguments == NULL) {
|
262
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
263
|
+
} else {
|
264
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_break_node_t *)node)->arguments);
|
265
|
+
}
|
266
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_break_node_t *)node)->keyword_loc);
|
267
|
+
yp_buffer_append_str(buffer, ")", 1);
|
268
|
+
break;
|
269
|
+
}
|
270
|
+
case YP_NODE_CALL_NODE: {
|
271
|
+
yp_buffer_append_str(buffer, "CallNode(", 9);
|
272
|
+
if (((yp_call_node_t *)node)->receiver == NULL) {
|
273
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
274
|
+
} else {
|
275
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_node_t *)node)->receiver);
|
276
|
+
}
|
277
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_call_node_t *)node)->operator_loc.start == NULL) {
|
278
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
279
|
+
} else {
|
280
|
+
prettyprint_location(buffer, parser, &((yp_call_node_t *)node)->operator_loc);
|
281
|
+
}
|
282
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_call_node_t *)node)->message_loc.start == NULL) {
|
283
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
284
|
+
} else {
|
285
|
+
prettyprint_location(buffer, parser, &((yp_call_node_t *)node)->message_loc);
|
286
|
+
}
|
287
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_call_node_t *)node)->opening_loc.start == NULL) {
|
288
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
289
|
+
} else {
|
290
|
+
prettyprint_location(buffer, parser, &((yp_call_node_t *)node)->opening_loc);
|
291
|
+
}
|
292
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_call_node_t *)node)->arguments == NULL) {
|
293
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
294
|
+
} else {
|
295
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_node_t *)node)->arguments);
|
296
|
+
}
|
297
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_call_node_t *)node)->closing_loc.start == NULL) {
|
298
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
299
|
+
} else {
|
300
|
+
prettyprint_location(buffer, parser, &((yp_call_node_t *)node)->closing_loc);
|
301
|
+
}
|
302
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_call_node_t *)node)->block == NULL) {
|
303
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
304
|
+
} else {
|
305
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_node_t *)node)->block);
|
306
|
+
}
|
307
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
308
|
+
yp_snprintf(flags_buffer, sizeof(flags_buffer), "+%d", ((yp_call_node_t *)node)->flags);
|
309
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
310
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
311
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_call_node_t *)node)->name), yp_string_length(&((yp_call_node_t *)node)->name));
|
312
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
313
|
+
yp_buffer_append_str(buffer, ")", 1);
|
314
|
+
break;
|
315
|
+
}
|
316
|
+
case YP_NODE_CALL_OPERATOR_AND_WRITE_NODE: {
|
317
|
+
yp_buffer_append_str(buffer, "CallOperatorAndWriteNode(", 25);
|
318
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_operator_and_write_node_t *)node)->target);
|
319
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_call_operator_and_write_node_t *)node)->operator_loc);
|
320
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_operator_and_write_node_t *)node)->value);
|
321
|
+
yp_buffer_append_str(buffer, ")", 1);
|
322
|
+
break;
|
323
|
+
}
|
324
|
+
case YP_NODE_CALL_OPERATOR_OR_WRITE_NODE: {
|
325
|
+
yp_buffer_append_str(buffer, "CallOperatorOrWriteNode(", 24);
|
326
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_operator_or_write_node_t *)node)->target);
|
327
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_operator_or_write_node_t *)node)->value);
|
328
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_call_operator_or_write_node_t *)node)->operator_loc);
|
329
|
+
yp_buffer_append_str(buffer, ")", 1);
|
330
|
+
break;
|
331
|
+
}
|
332
|
+
case YP_NODE_CALL_OPERATOR_WRITE_NODE: {
|
333
|
+
yp_buffer_append_str(buffer, "CallOperatorWriteNode(", 22);
|
334
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_operator_write_node_t *)node)->target);
|
335
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_call_operator_write_node_t *)node)->operator_loc);
|
336
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_operator_write_node_t *)node)->value);
|
337
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_id_buffer[12];
|
338
|
+
yp_snprintf(operator_id_buffer, sizeof(operator_id_buffer), "%u", ((yp_call_operator_write_node_t *)node)->operator_id);
|
339
|
+
yp_buffer_append_str(buffer, operator_id_buffer, strlen(operator_id_buffer));
|
340
|
+
yp_buffer_append_str(buffer, ")", 1);
|
341
|
+
break;
|
342
|
+
}
|
343
|
+
case YP_NODE_CAPTURE_PATTERN_NODE: {
|
344
|
+
yp_buffer_append_str(buffer, "CapturePatternNode(", 19);
|
345
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_capture_pattern_node_t *)node)->value);
|
346
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_capture_pattern_node_t *)node)->target);
|
347
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_capture_pattern_node_t *)node)->operator_loc);
|
348
|
+
yp_buffer_append_str(buffer, ")", 1);
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
case YP_NODE_CASE_NODE: {
|
352
|
+
yp_buffer_append_str(buffer, "CaseNode(", 9);
|
353
|
+
if (((yp_case_node_t *)node)->predicate == NULL) {
|
354
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
355
|
+
} else {
|
356
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_case_node_t *)node)->predicate);
|
357
|
+
}
|
358
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
359
|
+
for (uint32_t index = 0; index < ((yp_case_node_t *)node)->conditions.size; index++) {
|
360
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
361
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_case_node_t *) node)->conditions.nodes[index]);
|
362
|
+
}
|
363
|
+
yp_buffer_append_str(buffer, "]", 1);
|
364
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_case_node_t *)node)->consequent == NULL) {
|
365
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
366
|
+
} else {
|
367
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_case_node_t *)node)->consequent);
|
368
|
+
}
|
369
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_case_node_t *)node)->case_keyword_loc);
|
370
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_case_node_t *)node)->end_keyword_loc);
|
371
|
+
yp_buffer_append_str(buffer, ")", 1);
|
372
|
+
break;
|
373
|
+
}
|
374
|
+
case YP_NODE_CLASS_NODE: {
|
375
|
+
yp_buffer_append_str(buffer, "ClassNode(", 10);
|
376
|
+
yp_buffer_append_str(buffer, "[", 1);
|
377
|
+
for (uint32_t index = 0; index < ((yp_class_node_t *)node)->locals.size; index++) {
|
378
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
379
|
+
char locals_buffer[12];
|
380
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_class_node_t *)node)->locals.ids[index]);
|
381
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
382
|
+
}
|
383
|
+
yp_buffer_append_str(buffer, "]", 1);
|
384
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_node_t *)node)->class_keyword_loc);
|
385
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->constant_path);
|
386
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_node_t *)node)->inheritance_operator_loc.start == NULL) {
|
387
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
388
|
+
} else {
|
389
|
+
prettyprint_location(buffer, parser, &((yp_class_node_t *)node)->inheritance_operator_loc);
|
390
|
+
}
|
391
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_node_t *)node)->superclass == NULL) {
|
392
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
393
|
+
} else {
|
394
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->superclass);
|
395
|
+
}
|
396
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_node_t *)node)->statements == NULL) {
|
397
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
398
|
+
} else {
|
399
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->statements);
|
400
|
+
}
|
401
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_node_t *)node)->end_keyword_loc);
|
402
|
+
yp_buffer_append_str(buffer, ")", 1);
|
403
|
+
break;
|
404
|
+
}
|
405
|
+
case YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
406
|
+
yp_buffer_append_str(buffer, "ClassVariableOperatorAndWriteNode(", 34);
|
407
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_operator_and_write_node_t *)node)->name_loc);
|
408
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_and_write_node_t *)node)->operator_loc);
|
409
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_and_write_node_t *)node)->value);
|
410
|
+
yp_buffer_append_str(buffer, ")", 1);
|
411
|
+
break;
|
412
|
+
}
|
413
|
+
case YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
414
|
+
yp_buffer_append_str(buffer, "ClassVariableOperatorOrWriteNode(", 33);
|
415
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_operator_or_write_node_t *)node)->name_loc);
|
416
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_or_write_node_t *)node)->operator_loc);
|
417
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_or_write_node_t *)node)->value);
|
418
|
+
yp_buffer_append_str(buffer, ")", 1);
|
419
|
+
break;
|
420
|
+
}
|
421
|
+
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
422
|
+
yp_buffer_append_str(buffer, "ClassVariableOperatorWriteNode(", 31);
|
423
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_operator_write_node_t *)node)->name_loc);
|
424
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_write_node_t *)node)->operator_loc);
|
425
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_write_node_t *)node)->value);
|
426
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
427
|
+
yp_snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_class_variable_operator_write_node_t *)node)->operator);
|
428
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
429
|
+
yp_buffer_append_str(buffer, ")", 1);
|
430
|
+
break;
|
431
|
+
}
|
432
|
+
case YP_NODE_CLASS_VARIABLE_READ_NODE: {
|
433
|
+
yp_buffer_append_str(buffer, "ClassVariableReadNode(", 22);
|
434
|
+
yp_buffer_append_str(buffer, ")", 1);
|
435
|
+
break;
|
436
|
+
}
|
437
|
+
case YP_NODE_CLASS_VARIABLE_WRITE_NODE: {
|
438
|
+
yp_buffer_append_str(buffer, "ClassVariableWriteNode(", 23);
|
439
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_write_node_t *)node)->name_loc);
|
440
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_variable_write_node_t *)node)->value == NULL) {
|
441
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
442
|
+
} else {
|
443
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_write_node_t *)node)->value);
|
444
|
+
}
|
445
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_variable_write_node_t *)node)->operator_loc.start == NULL) {
|
446
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
447
|
+
} else {
|
448
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_write_node_t *)node)->operator_loc);
|
449
|
+
}
|
450
|
+
yp_buffer_append_str(buffer, ")", 1);
|
451
|
+
break;
|
452
|
+
}
|
453
|
+
case YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE: {
|
454
|
+
yp_buffer_append_str(buffer, "ConstantOperatorAndWriteNode(", 29);
|
455
|
+
prettyprint_location(buffer, parser, &((yp_constant_operator_and_write_node_t *)node)->name_loc);
|
456
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_and_write_node_t *)node)->operator_loc);
|
457
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_and_write_node_t *)node)->value);
|
458
|
+
yp_buffer_append_str(buffer, ")", 1);
|
459
|
+
break;
|
460
|
+
}
|
461
|
+
case YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE: {
|
462
|
+
yp_buffer_append_str(buffer, "ConstantOperatorOrWriteNode(", 28);
|
463
|
+
prettyprint_location(buffer, parser, &((yp_constant_operator_or_write_node_t *)node)->name_loc);
|
464
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_or_write_node_t *)node)->operator_loc);
|
465
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_or_write_node_t *)node)->value);
|
466
|
+
yp_buffer_append_str(buffer, ")", 1);
|
467
|
+
break;
|
468
|
+
}
|
469
|
+
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
470
|
+
yp_buffer_append_str(buffer, "ConstantOperatorWriteNode(", 26);
|
471
|
+
prettyprint_location(buffer, parser, &((yp_constant_operator_write_node_t *)node)->name_loc);
|
472
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_write_node_t *)node)->operator_loc);
|
473
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_write_node_t *)node)->value);
|
474
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
475
|
+
yp_snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_constant_operator_write_node_t *)node)->operator);
|
476
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
477
|
+
yp_buffer_append_str(buffer, ")", 1);
|
478
|
+
break;
|
479
|
+
}
|
480
|
+
case YP_NODE_CONSTANT_PATH_NODE: {
|
481
|
+
yp_buffer_append_str(buffer, "ConstantPathNode(", 17);
|
482
|
+
if (((yp_constant_path_node_t *)node)->parent == NULL) {
|
483
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
484
|
+
} else {
|
485
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_node_t *)node)->parent);
|
486
|
+
}
|
487
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_node_t *)node)->child);
|
488
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_node_t *)node)->delimiter_loc);
|
489
|
+
yp_buffer_append_str(buffer, ")", 1);
|
490
|
+
break;
|
491
|
+
}
|
492
|
+
case YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE: {
|
493
|
+
yp_buffer_append_str(buffer, "ConstantPathOperatorAndWriteNode(", 33);
|
494
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_and_write_node_t *)node)->target);
|
495
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_and_write_node_t *)node)->operator_loc);
|
496
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_and_write_node_t *)node)->value);
|
497
|
+
yp_buffer_append_str(buffer, ")", 1);
|
498
|
+
break;
|
499
|
+
}
|
500
|
+
case YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE: {
|
501
|
+
yp_buffer_append_str(buffer, "ConstantPathOperatorOrWriteNode(", 32);
|
502
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_or_write_node_t *)node)->target);
|
503
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_or_write_node_t *)node)->operator_loc);
|
504
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_or_write_node_t *)node)->value);
|
505
|
+
yp_buffer_append_str(buffer, ")", 1);
|
506
|
+
break;
|
507
|
+
}
|
508
|
+
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
509
|
+
yp_buffer_append_str(buffer, "ConstantPathOperatorWriteNode(", 30);
|
510
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_write_node_t *)node)->target);
|
511
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_write_node_t *)node)->operator_loc);
|
512
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_write_node_t *)node)->value);
|
513
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
514
|
+
yp_snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_constant_path_operator_write_node_t *)node)->operator);
|
515
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
516
|
+
yp_buffer_append_str(buffer, ")", 1);
|
517
|
+
break;
|
518
|
+
}
|
519
|
+
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
520
|
+
yp_buffer_append_str(buffer, "ConstantPathWriteNode(", 22);
|
521
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_write_node_t *)node)->target);
|
522
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_constant_path_write_node_t *)node)->operator_loc.start == NULL) {
|
523
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
524
|
+
} else {
|
525
|
+
prettyprint_location(buffer, parser, &((yp_constant_path_write_node_t *)node)->operator_loc);
|
526
|
+
}
|
527
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_constant_path_write_node_t *)node)->value == NULL) {
|
528
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
529
|
+
} else {
|
530
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_write_node_t *)node)->value);
|
531
|
+
}
|
532
|
+
yp_buffer_append_str(buffer, ")", 1);
|
533
|
+
break;
|
534
|
+
}
|
535
|
+
case YP_NODE_CONSTANT_READ_NODE: {
|
536
|
+
yp_buffer_append_str(buffer, "ConstantReadNode(", 17);
|
537
|
+
yp_buffer_append_str(buffer, ")", 1);
|
538
|
+
break;
|
539
|
+
}
|
540
|
+
case YP_NODE_CONSTANT_WRITE_NODE: {
|
541
|
+
yp_buffer_append_str(buffer, "ConstantWriteNode(", 18);
|
542
|
+
prettyprint_location(buffer, parser, &((yp_constant_write_node_t *)node)->name_loc);
|
543
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_constant_write_node_t *)node)->value == NULL) {
|
544
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
545
|
+
} else {
|
546
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_write_node_t *)node)->value);
|
547
|
+
}
|
548
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_constant_write_node_t *)node)->operator_loc.start == NULL) {
|
549
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
550
|
+
} else {
|
551
|
+
prettyprint_location(buffer, parser, &((yp_constant_write_node_t *)node)->operator_loc);
|
552
|
+
}
|
553
|
+
yp_buffer_append_str(buffer, ")", 1);
|
554
|
+
break;
|
555
|
+
}
|
556
|
+
case YP_NODE_DEF_NODE: {
|
557
|
+
yp_buffer_append_str(buffer, "DefNode(", 8);
|
558
|
+
prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->name_loc);
|
559
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->receiver == NULL) {
|
560
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
561
|
+
} else {
|
562
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_def_node_t *)node)->receiver);
|
563
|
+
}
|
564
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->parameters == NULL) {
|
565
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
566
|
+
} else {
|
567
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_def_node_t *)node)->parameters);
|
568
|
+
}
|
569
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->statements == NULL) {
|
570
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
571
|
+
} else {
|
572
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_def_node_t *)node)->statements);
|
573
|
+
}
|
574
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
575
|
+
for (uint32_t index = 0; index < ((yp_def_node_t *)node)->locals.size; index++) {
|
576
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
577
|
+
char locals_buffer[12];
|
578
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_def_node_t *)node)->locals.ids[index]);
|
579
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
580
|
+
}
|
581
|
+
yp_buffer_append_str(buffer, "]", 1);
|
582
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->def_keyword_loc);
|
583
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->operator_loc.start == NULL) {
|
584
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
585
|
+
} else {
|
586
|
+
prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->operator_loc);
|
587
|
+
}
|
588
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->lparen_loc.start == NULL) {
|
589
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
590
|
+
} else {
|
591
|
+
prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->lparen_loc);
|
592
|
+
}
|
593
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->rparen_loc.start == NULL) {
|
594
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
595
|
+
} else {
|
596
|
+
prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->rparen_loc);
|
597
|
+
}
|
598
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->equal_loc.start == NULL) {
|
599
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
600
|
+
} else {
|
601
|
+
prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->equal_loc);
|
602
|
+
}
|
603
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->end_keyword_loc.start == NULL) {
|
604
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
605
|
+
} else {
|
606
|
+
prettyprint_location(buffer, parser, &((yp_def_node_t *)node)->end_keyword_loc);
|
607
|
+
}
|
608
|
+
yp_buffer_append_str(buffer, ")", 1);
|
609
|
+
break;
|
610
|
+
}
|
611
|
+
case YP_NODE_DEFINED_NODE: {
|
612
|
+
yp_buffer_append_str(buffer, "DefinedNode(", 12);
|
613
|
+
if (((yp_defined_node_t *)node)->lparen_loc.start == NULL) {
|
614
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
615
|
+
} else {
|
616
|
+
prettyprint_location(buffer, parser, &((yp_defined_node_t *)node)->lparen_loc);
|
617
|
+
}
|
618
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_defined_node_t *)node)->value);
|
619
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_defined_node_t *)node)->rparen_loc.start == NULL) {
|
620
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
621
|
+
} else {
|
622
|
+
prettyprint_location(buffer, parser, &((yp_defined_node_t *)node)->rparen_loc);
|
623
|
+
}
|
624
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_defined_node_t *)node)->keyword_loc);
|
625
|
+
yp_buffer_append_str(buffer, ")", 1);
|
626
|
+
break;
|
627
|
+
}
|
628
|
+
case YP_NODE_ELSE_NODE: {
|
629
|
+
yp_buffer_append_str(buffer, "ElseNode(", 9);
|
630
|
+
prettyprint_location(buffer, parser, &((yp_else_node_t *)node)->else_keyword_loc);
|
631
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_else_node_t *)node)->statements == NULL) {
|
632
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
633
|
+
} else {
|
634
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_else_node_t *)node)->statements);
|
635
|
+
}
|
636
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_else_node_t *)node)->end_keyword_loc.start == NULL) {
|
637
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
638
|
+
} else {
|
639
|
+
prettyprint_location(buffer, parser, &((yp_else_node_t *)node)->end_keyword_loc);
|
640
|
+
}
|
641
|
+
yp_buffer_append_str(buffer, ")", 1);
|
642
|
+
break;
|
643
|
+
}
|
644
|
+
case YP_NODE_EMBEDDED_STATEMENTS_NODE: {
|
645
|
+
yp_buffer_append_str(buffer, "EmbeddedStatementsNode(", 23);
|
646
|
+
prettyprint_location(buffer, parser, &((yp_embedded_statements_node_t *)node)->opening_loc);
|
647
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_embedded_statements_node_t *)node)->statements == NULL) {
|
648
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
649
|
+
} else {
|
650
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_embedded_statements_node_t *)node)->statements);
|
651
|
+
}
|
652
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_embedded_statements_node_t *)node)->closing_loc);
|
653
|
+
yp_buffer_append_str(buffer, ")", 1);
|
654
|
+
break;
|
655
|
+
}
|
656
|
+
case YP_NODE_EMBEDDED_VARIABLE_NODE: {
|
657
|
+
yp_buffer_append_str(buffer, "EmbeddedVariableNode(", 21);
|
658
|
+
prettyprint_location(buffer, parser, &((yp_embedded_variable_node_t *)node)->operator_loc);
|
659
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_embedded_variable_node_t *)node)->variable);
|
660
|
+
yp_buffer_append_str(buffer, ")", 1);
|
661
|
+
break;
|
662
|
+
}
|
663
|
+
case YP_NODE_ENSURE_NODE: {
|
664
|
+
yp_buffer_append_str(buffer, "EnsureNode(", 11);
|
665
|
+
prettyprint_location(buffer, parser, &((yp_ensure_node_t *)node)->ensure_keyword_loc);
|
666
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_ensure_node_t *)node)->statements == NULL) {
|
667
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
668
|
+
} else {
|
669
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_ensure_node_t *)node)->statements);
|
670
|
+
}
|
671
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_ensure_node_t *)node)->end_keyword_loc);
|
672
|
+
yp_buffer_append_str(buffer, ")", 1);
|
673
|
+
break;
|
674
|
+
}
|
675
|
+
case YP_NODE_FALSE_NODE: {
|
676
|
+
yp_buffer_append_str(buffer, "FalseNode(", 10);
|
677
|
+
yp_buffer_append_str(buffer, ")", 1);
|
678
|
+
break;
|
679
|
+
}
|
680
|
+
case YP_NODE_FIND_PATTERN_NODE: {
|
681
|
+
yp_buffer_append_str(buffer, "FindPatternNode(", 16);
|
682
|
+
if (((yp_find_pattern_node_t *)node)->constant == NULL) {
|
683
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
684
|
+
} else {
|
685
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_find_pattern_node_t *)node)->constant);
|
686
|
+
}
|
687
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_find_pattern_node_t *)node)->left);
|
688
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
689
|
+
for (uint32_t index = 0; index < ((yp_find_pattern_node_t *)node)->requireds.size; index++) {
|
690
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
691
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_find_pattern_node_t *) node)->requireds.nodes[index]);
|
692
|
+
}
|
693
|
+
yp_buffer_append_str(buffer, "]", 1);
|
694
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_find_pattern_node_t *)node)->right);
|
695
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_find_pattern_node_t *)node)->opening_loc.start == NULL) {
|
696
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
697
|
+
} else {
|
698
|
+
prettyprint_location(buffer, parser, &((yp_find_pattern_node_t *)node)->opening_loc);
|
699
|
+
}
|
700
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_find_pattern_node_t *)node)->closing_loc.start == NULL) {
|
701
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
702
|
+
} else {
|
703
|
+
prettyprint_location(buffer, parser, &((yp_find_pattern_node_t *)node)->closing_loc);
|
704
|
+
}
|
705
|
+
yp_buffer_append_str(buffer, ")", 1);
|
706
|
+
break;
|
707
|
+
}
|
708
|
+
case YP_NODE_FLOAT_NODE: {
|
709
|
+
yp_buffer_append_str(buffer, "FloatNode(", 10);
|
710
|
+
yp_buffer_append_str(buffer, ")", 1);
|
711
|
+
break;
|
712
|
+
}
|
713
|
+
case YP_NODE_FOR_NODE: {
|
714
|
+
yp_buffer_append_str(buffer, "ForNode(", 8);
|
715
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_for_node_t *)node)->index);
|
716
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_for_node_t *)node)->collection);
|
717
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_for_node_t *)node)->statements == NULL) {
|
718
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
719
|
+
} else {
|
720
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_for_node_t *)node)->statements);
|
721
|
+
}
|
722
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_for_node_t *)node)->for_keyword_loc);
|
723
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_for_node_t *)node)->in_keyword_loc);
|
724
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_for_node_t *)node)->do_keyword_loc.start == NULL) {
|
725
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
726
|
+
} else {
|
727
|
+
prettyprint_location(buffer, parser, &((yp_for_node_t *)node)->do_keyword_loc);
|
728
|
+
}
|
729
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_for_node_t *)node)->end_keyword_loc);
|
730
|
+
yp_buffer_append_str(buffer, ")", 1);
|
731
|
+
break;
|
732
|
+
}
|
733
|
+
case YP_NODE_FORWARDING_ARGUMENTS_NODE: {
|
734
|
+
yp_buffer_append_str(buffer, "ForwardingArgumentsNode(", 24);
|
735
|
+
yp_buffer_append_str(buffer, ")", 1);
|
736
|
+
break;
|
737
|
+
}
|
738
|
+
case YP_NODE_FORWARDING_PARAMETER_NODE: {
|
739
|
+
yp_buffer_append_str(buffer, "ForwardingParameterNode(", 24);
|
740
|
+
yp_buffer_append_str(buffer, ")", 1);
|
741
|
+
break;
|
742
|
+
}
|
743
|
+
case YP_NODE_FORWARDING_SUPER_NODE: {
|
744
|
+
yp_buffer_append_str(buffer, "ForwardingSuperNode(", 20);
|
745
|
+
if (((yp_forwarding_super_node_t *)node)->block == NULL) {
|
746
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
747
|
+
} else {
|
748
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_forwarding_super_node_t *)node)->block);
|
749
|
+
}
|
750
|
+
yp_buffer_append_str(buffer, ")", 1);
|
751
|
+
break;
|
752
|
+
}
|
753
|
+
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
754
|
+
yp_buffer_append_str(buffer, "GlobalVariableOperatorAndWriteNode(", 35);
|
755
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_operator_and_write_node_t *)node)->name_loc);
|
756
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_and_write_node_t *)node)->operator_loc);
|
757
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_and_write_node_t *)node)->value);
|
758
|
+
yp_buffer_append_str(buffer, ")", 1);
|
759
|
+
break;
|
760
|
+
}
|
761
|
+
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
762
|
+
yp_buffer_append_str(buffer, "GlobalVariableOperatorOrWriteNode(", 34);
|
763
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_operator_or_write_node_t *)node)->name_loc);
|
764
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_or_write_node_t *)node)->operator_loc);
|
765
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_or_write_node_t *)node)->value);
|
766
|
+
yp_buffer_append_str(buffer, ")", 1);
|
767
|
+
break;
|
768
|
+
}
|
769
|
+
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
770
|
+
yp_buffer_append_str(buffer, "GlobalVariableOperatorWriteNode(", 32);
|
771
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_operator_write_node_t *)node)->name_loc);
|
772
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_write_node_t *)node)->operator_loc);
|
773
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_write_node_t *)node)->value);
|
774
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
775
|
+
yp_snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_global_variable_operator_write_node_t *)node)->operator);
|
776
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
777
|
+
yp_buffer_append_str(buffer, ")", 1);
|
778
|
+
break;
|
779
|
+
}
|
780
|
+
case YP_NODE_GLOBAL_VARIABLE_READ_NODE: {
|
781
|
+
yp_buffer_append_str(buffer, "GlobalVariableReadNode(", 23);
|
782
|
+
yp_buffer_append_str(buffer, ")", 1);
|
783
|
+
break;
|
784
|
+
}
|
785
|
+
case YP_NODE_GLOBAL_VARIABLE_WRITE_NODE: {
|
786
|
+
yp_buffer_append_str(buffer, "GlobalVariableWriteNode(", 24);
|
787
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_write_node_t *)node)->name_loc);
|
788
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_global_variable_write_node_t *)node)->operator_loc.start == NULL) {
|
789
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
790
|
+
} else {
|
791
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_write_node_t *)node)->operator_loc);
|
792
|
+
}
|
793
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_global_variable_write_node_t *)node)->value == NULL) {
|
794
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
795
|
+
} else {
|
796
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_write_node_t *)node)->value);
|
797
|
+
}
|
798
|
+
yp_buffer_append_str(buffer, ")", 1);
|
799
|
+
break;
|
800
|
+
}
|
801
|
+
case YP_NODE_HASH_NODE: {
|
802
|
+
yp_buffer_append_str(buffer, "HashNode(", 9);
|
803
|
+
prettyprint_location(buffer, parser, &((yp_hash_node_t *)node)->opening_loc);
|
804
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
805
|
+
for (uint32_t index = 0; index < ((yp_hash_node_t *)node)->elements.size; index++) {
|
806
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
807
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_hash_node_t *) node)->elements.nodes[index]);
|
808
|
+
}
|
809
|
+
yp_buffer_append_str(buffer, "]", 1);
|
810
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_hash_node_t *)node)->closing_loc);
|
811
|
+
yp_buffer_append_str(buffer, ")", 1);
|
812
|
+
break;
|
813
|
+
}
|
814
|
+
case YP_NODE_HASH_PATTERN_NODE: {
|
815
|
+
yp_buffer_append_str(buffer, "HashPatternNode(", 16);
|
816
|
+
if (((yp_hash_pattern_node_t *)node)->constant == NULL) {
|
817
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
818
|
+
} else {
|
819
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_hash_pattern_node_t *)node)->constant);
|
820
|
+
}
|
821
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
822
|
+
for (uint32_t index = 0; index < ((yp_hash_pattern_node_t *)node)->assocs.size; index++) {
|
823
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
824
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_hash_pattern_node_t *) node)->assocs.nodes[index]);
|
825
|
+
}
|
826
|
+
yp_buffer_append_str(buffer, "]", 1);
|
827
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_hash_pattern_node_t *)node)->kwrest == NULL) {
|
828
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
829
|
+
} else {
|
830
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_hash_pattern_node_t *)node)->kwrest);
|
831
|
+
}
|
832
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_hash_pattern_node_t *)node)->opening_loc.start == NULL) {
|
833
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
834
|
+
} else {
|
835
|
+
prettyprint_location(buffer, parser, &((yp_hash_pattern_node_t *)node)->opening_loc);
|
836
|
+
}
|
837
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_hash_pattern_node_t *)node)->closing_loc.start == NULL) {
|
838
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
839
|
+
} else {
|
840
|
+
prettyprint_location(buffer, parser, &((yp_hash_pattern_node_t *)node)->closing_loc);
|
841
|
+
}
|
842
|
+
yp_buffer_append_str(buffer, ")", 1);
|
843
|
+
break;
|
844
|
+
}
|
845
|
+
case YP_NODE_IF_NODE: {
|
846
|
+
yp_buffer_append_str(buffer, "IfNode(", 7);
|
847
|
+
if (((yp_if_node_t *)node)->if_keyword_loc.start == NULL) {
|
848
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
849
|
+
} else {
|
850
|
+
prettyprint_location(buffer, parser, &((yp_if_node_t *)node)->if_keyword_loc);
|
851
|
+
}
|
852
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_if_node_t *)node)->predicate);
|
853
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_if_node_t *)node)->statements == NULL) {
|
854
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
855
|
+
} else {
|
856
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_if_node_t *)node)->statements);
|
857
|
+
}
|
858
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_if_node_t *)node)->consequent == NULL) {
|
859
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
860
|
+
} else {
|
861
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_if_node_t *)node)->consequent);
|
862
|
+
}
|
863
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_if_node_t *)node)->end_keyword_loc.start == NULL) {
|
864
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
865
|
+
} else {
|
866
|
+
prettyprint_location(buffer, parser, &((yp_if_node_t *)node)->end_keyword_loc);
|
867
|
+
}
|
868
|
+
yp_buffer_append_str(buffer, ")", 1);
|
869
|
+
break;
|
870
|
+
}
|
871
|
+
case YP_NODE_IMAGINARY_NODE: {
|
872
|
+
yp_buffer_append_str(buffer, "ImaginaryNode(", 14);
|
873
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_imaginary_node_t *)node)->numeric);
|
874
|
+
yp_buffer_append_str(buffer, ")", 1);
|
875
|
+
break;
|
876
|
+
}
|
877
|
+
case YP_NODE_IN_NODE: {
|
878
|
+
yp_buffer_append_str(buffer, "InNode(", 7);
|
879
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_in_node_t *)node)->pattern);
|
880
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_in_node_t *)node)->statements == NULL) {
|
881
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
882
|
+
} else {
|
883
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_in_node_t *)node)->statements);
|
884
|
+
}
|
885
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_in_node_t *)node)->in_loc);
|
886
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_in_node_t *)node)->then_loc.start == NULL) {
|
887
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
888
|
+
} else {
|
889
|
+
prettyprint_location(buffer, parser, &((yp_in_node_t *)node)->then_loc);
|
890
|
+
}
|
891
|
+
yp_buffer_append_str(buffer, ")", 1);
|
892
|
+
break;
|
893
|
+
}
|
894
|
+
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
895
|
+
yp_buffer_append_str(buffer, "InstanceVariableOperatorAndWriteNode(", 37);
|
896
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_and_write_node_t *)node)->name_loc);
|
897
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_and_write_node_t *)node)->operator_loc);
|
898
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_and_write_node_t *)node)->value);
|
899
|
+
yp_buffer_append_str(buffer, ")", 1);
|
900
|
+
break;
|
901
|
+
}
|
902
|
+
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
903
|
+
yp_buffer_append_str(buffer, "InstanceVariableOperatorOrWriteNode(", 36);
|
904
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_or_write_node_t *)node)->name_loc);
|
905
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_or_write_node_t *)node)->operator_loc);
|
906
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_or_write_node_t *)node)->value);
|
907
|
+
yp_buffer_append_str(buffer, ")", 1);
|
908
|
+
break;
|
909
|
+
}
|
910
|
+
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
911
|
+
yp_buffer_append_str(buffer, "InstanceVariableOperatorWriteNode(", 34);
|
912
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_write_node_t *)node)->name_loc);
|
913
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_write_node_t *)node)->operator_loc);
|
914
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_write_node_t *)node)->value);
|
915
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
916
|
+
yp_snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_instance_variable_operator_write_node_t *)node)->operator);
|
917
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
918
|
+
yp_buffer_append_str(buffer, ")", 1);
|
919
|
+
break;
|
920
|
+
}
|
921
|
+
case YP_NODE_INSTANCE_VARIABLE_READ_NODE: {
|
922
|
+
yp_buffer_append_str(buffer, "InstanceVariableReadNode(", 25);
|
923
|
+
yp_buffer_append_str(buffer, ")", 1);
|
924
|
+
break;
|
925
|
+
}
|
926
|
+
case YP_NODE_INSTANCE_VARIABLE_WRITE_NODE: {
|
927
|
+
yp_buffer_append_str(buffer, "InstanceVariableWriteNode(", 26);
|
928
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_write_node_t *)node)->name_loc);
|
929
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_instance_variable_write_node_t *)node)->value == NULL) {
|
930
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
931
|
+
} else {
|
932
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_write_node_t *)node)->value);
|
933
|
+
}
|
934
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_instance_variable_write_node_t *)node)->operator_loc.start == NULL) {
|
935
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
936
|
+
} else {
|
937
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_write_node_t *)node)->operator_loc);
|
938
|
+
}
|
939
|
+
yp_buffer_append_str(buffer, ")", 1);
|
940
|
+
break;
|
941
|
+
}
|
942
|
+
case YP_NODE_INTEGER_NODE: {
|
943
|
+
yp_buffer_append_str(buffer, "IntegerNode(", 12);
|
944
|
+
yp_buffer_append_str(buffer, ")", 1);
|
945
|
+
break;
|
946
|
+
}
|
947
|
+
case YP_NODE_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
|
948
|
+
yp_buffer_append_str(buffer, "InterpolatedRegularExpressionNode(", 34);
|
949
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_regular_expression_node_t *)node)->opening_loc);
|
950
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
951
|
+
for (uint32_t index = 0; index < ((yp_interpolated_regular_expression_node_t *)node)->parts.size; index++) {
|
952
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
953
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_interpolated_regular_expression_node_t *) node)->parts.nodes[index]);
|
954
|
+
}
|
955
|
+
yp_buffer_append_str(buffer, "]", 1);
|
956
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_interpolated_regular_expression_node_t *)node)->closing_loc);
|
957
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
958
|
+
yp_snprintf(flags_buffer, sizeof(flags_buffer), "+%d", ((yp_interpolated_regular_expression_node_t *)node)->flags);
|
959
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
960
|
+
yp_buffer_append_str(buffer, ")", 1);
|
961
|
+
break;
|
962
|
+
}
|
963
|
+
case YP_NODE_INTERPOLATED_STRING_NODE: {
|
964
|
+
yp_buffer_append_str(buffer, "InterpolatedStringNode(", 23);
|
965
|
+
if (((yp_interpolated_string_node_t *)node)->opening_loc.start == NULL) {
|
966
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
967
|
+
} else {
|
968
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_string_node_t *)node)->opening_loc);
|
969
|
+
}
|
970
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
971
|
+
for (uint32_t index = 0; index < ((yp_interpolated_string_node_t *)node)->parts.size; index++) {
|
972
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
973
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_interpolated_string_node_t *) node)->parts.nodes[index]);
|
974
|
+
}
|
975
|
+
yp_buffer_append_str(buffer, "]", 1);
|
976
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_interpolated_string_node_t *)node)->closing_loc.start == NULL) {
|
977
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
978
|
+
} else {
|
979
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_string_node_t *)node)->closing_loc);
|
980
|
+
}
|
981
|
+
yp_buffer_append_str(buffer, ")", 1);
|
982
|
+
break;
|
983
|
+
}
|
984
|
+
case YP_NODE_INTERPOLATED_SYMBOL_NODE: {
|
985
|
+
yp_buffer_append_str(buffer, "InterpolatedSymbolNode(", 23);
|
986
|
+
if (((yp_interpolated_symbol_node_t *)node)->opening_loc.start == NULL) {
|
987
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
988
|
+
} else {
|
989
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_symbol_node_t *)node)->opening_loc);
|
990
|
+
}
|
991
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
992
|
+
for (uint32_t index = 0; index < ((yp_interpolated_symbol_node_t *)node)->parts.size; index++) {
|
993
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
994
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_interpolated_symbol_node_t *) node)->parts.nodes[index]);
|
995
|
+
}
|
996
|
+
yp_buffer_append_str(buffer, "]", 1);
|
997
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_interpolated_symbol_node_t *)node)->closing_loc.start == NULL) {
|
998
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
999
|
+
} else {
|
1000
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_symbol_node_t *)node)->closing_loc);
|
1001
|
+
}
|
1002
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1003
|
+
break;
|
1004
|
+
}
|
1005
|
+
case YP_NODE_INTERPOLATED_X_STRING_NODE: {
|
1006
|
+
yp_buffer_append_str(buffer, "InterpolatedXStringNode(", 24);
|
1007
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_x_string_node_t *)node)->opening_loc);
|
1008
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1009
|
+
for (uint32_t index = 0; index < ((yp_interpolated_x_string_node_t *)node)->parts.size; index++) {
|
1010
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1011
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_interpolated_x_string_node_t *) node)->parts.nodes[index]);
|
1012
|
+
}
|
1013
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1014
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_interpolated_x_string_node_t *)node)->closing_loc);
|
1015
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1016
|
+
break;
|
1017
|
+
}
|
1018
|
+
case YP_NODE_KEYWORD_HASH_NODE: {
|
1019
|
+
yp_buffer_append_str(buffer, "KeywordHashNode(", 16);
|
1020
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1021
|
+
for (uint32_t index = 0; index < ((yp_keyword_hash_node_t *)node)->elements.size; index++) {
|
1022
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1023
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_keyword_hash_node_t *) node)->elements.nodes[index]);
|
1024
|
+
}
|
1025
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1026
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1027
|
+
break;
|
1028
|
+
}
|
1029
|
+
case YP_NODE_KEYWORD_PARAMETER_NODE: {
|
1030
|
+
yp_buffer_append_str(buffer, "KeywordParameterNode(", 21);
|
1031
|
+
prettyprint_location(buffer, parser, &((yp_keyword_parameter_node_t *)node)->name_loc);
|
1032
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_keyword_parameter_node_t *)node)->value == NULL) {
|
1033
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1034
|
+
} else {
|
1035
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_keyword_parameter_node_t *)node)->value);
|
1036
|
+
}
|
1037
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1038
|
+
break;
|
1039
|
+
}
|
1040
|
+
case YP_NODE_KEYWORD_REST_PARAMETER_NODE: {
|
1041
|
+
yp_buffer_append_str(buffer, "KeywordRestParameterNode(", 25);
|
1042
|
+
prettyprint_location(buffer, parser, &((yp_keyword_rest_parameter_node_t *)node)->operator_loc);
|
1043
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_keyword_rest_parameter_node_t *)node)->name_loc.start == NULL) {
|
1044
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1045
|
+
} else {
|
1046
|
+
prettyprint_location(buffer, parser, &((yp_keyword_rest_parameter_node_t *)node)->name_loc);
|
1047
|
+
}
|
1048
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1049
|
+
break;
|
1050
|
+
}
|
1051
|
+
case YP_NODE_LAMBDA_NODE: {
|
1052
|
+
yp_buffer_append_str(buffer, "LambdaNode(", 11);
|
1053
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1054
|
+
for (uint32_t index = 0; index < ((yp_lambda_node_t *)node)->locals.size; index++) {
|
1055
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1056
|
+
char locals_buffer[12];
|
1057
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_lambda_node_t *)node)->locals.ids[index]);
|
1058
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
1059
|
+
}
|
1060
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1061
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_lambda_node_t *)node)->opening_loc);
|
1062
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_lambda_node_t *)node)->parameters == NULL) {
|
1063
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1064
|
+
} else {
|
1065
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_lambda_node_t *)node)->parameters);
|
1066
|
+
}
|
1067
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_lambda_node_t *)node)->statements == NULL) {
|
1068
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1069
|
+
} else {
|
1070
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_lambda_node_t *)node)->statements);
|
1071
|
+
}
|
1072
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1073
|
+
break;
|
1074
|
+
}
|
1075
|
+
case YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
1076
|
+
yp_buffer_append_str(buffer, "LocalVariableOperatorAndWriteNode(", 34);
|
1077
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_operator_and_write_node_t *)node)->name_loc);
|
1078
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_and_write_node_t *)node)->operator_loc);
|
1079
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_and_write_node_t *)node)->value);
|
1080
|
+
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1081
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_and_write_node_t *)node)->constant_id);
|
1082
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1083
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1084
|
+
break;
|
1085
|
+
}
|
1086
|
+
case YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
1087
|
+
yp_buffer_append_str(buffer, "LocalVariableOperatorOrWriteNode(", 33);
|
1088
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_operator_or_write_node_t *)node)->name_loc);
|
1089
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_or_write_node_t *)node)->operator_loc);
|
1090
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_or_write_node_t *)node)->value);
|
1091
|
+
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1092
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_or_write_node_t *)node)->constant_id);
|
1093
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1094
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1095
|
+
break;
|
1096
|
+
}
|
1097
|
+
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
1098
|
+
yp_buffer_append_str(buffer, "LocalVariableOperatorWriteNode(", 31);
|
1099
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_operator_write_node_t *)node)->name_loc);
|
1100
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_write_node_t *)node)->operator_loc);
|
1101
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_write_node_t *)node)->value);
|
1102
|
+
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1103
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_write_node_t *)node)->constant_id);
|
1104
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1105
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_id_buffer[12];
|
1106
|
+
yp_snprintf(operator_id_buffer, sizeof(operator_id_buffer), "%u", ((yp_local_variable_operator_write_node_t *)node)->operator_id);
|
1107
|
+
yp_buffer_append_str(buffer, operator_id_buffer, strlen(operator_id_buffer));
|
1108
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1109
|
+
break;
|
1110
|
+
}
|
1111
|
+
case YP_NODE_LOCAL_VARIABLE_READ_NODE: {
|
1112
|
+
yp_buffer_append_str(buffer, "LocalVariableReadNode(", 22);
|
1113
|
+
char constant_id_buffer[12];
|
1114
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_read_node_t *)node)->constant_id);
|
1115
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1116
|
+
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
1117
|
+
yp_snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_read_node_t *)node)->depth);
|
1118
|
+
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
1119
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1120
|
+
break;
|
1121
|
+
}
|
1122
|
+
case YP_NODE_LOCAL_VARIABLE_WRITE_NODE: {
|
1123
|
+
yp_buffer_append_str(buffer, "LocalVariableWriteNode(", 23);
|
1124
|
+
char constant_id_buffer[12];
|
1125
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_write_node_t *)node)->constant_id);
|
1126
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1127
|
+
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
1128
|
+
yp_snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_write_node_t *)node)->depth);
|
1129
|
+
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
1130
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_local_variable_write_node_t *)node)->value == NULL) {
|
1131
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1132
|
+
} else {
|
1133
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_write_node_t *)node)->value);
|
1134
|
+
}
|
1135
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_write_node_t *)node)->name_loc);
|
1136
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_local_variable_write_node_t *)node)->operator_loc.start == NULL) {
|
1137
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1138
|
+
} else {
|
1139
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_write_node_t *)node)->operator_loc);
|
1140
|
+
}
|
1141
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1142
|
+
break;
|
1143
|
+
}
|
1144
|
+
case YP_NODE_MATCH_PREDICATE_NODE: {
|
1145
|
+
yp_buffer_append_str(buffer, "MatchPredicateNode(", 19);
|
1146
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_match_predicate_node_t *)node)->value);
|
1147
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_match_predicate_node_t *)node)->pattern);
|
1148
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_match_predicate_node_t *)node)->operator_loc);
|
1149
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1150
|
+
break;
|
1151
|
+
}
|
1152
|
+
case YP_NODE_MATCH_REQUIRED_NODE: {
|
1153
|
+
yp_buffer_append_str(buffer, "MatchRequiredNode(", 18);
|
1154
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_match_required_node_t *)node)->value);
|
1155
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_match_required_node_t *)node)->pattern);
|
1156
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_match_required_node_t *)node)->operator_loc);
|
1157
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1158
|
+
break;
|
1159
|
+
}
|
1160
|
+
case YP_NODE_MISSING_NODE: {
|
1161
|
+
yp_buffer_append_str(buffer, "MissingNode(", 12);
|
1162
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1163
|
+
break;
|
1164
|
+
}
|
1165
|
+
case YP_NODE_MODULE_NODE: {
|
1166
|
+
yp_buffer_append_str(buffer, "ModuleNode(", 11);
|
1167
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1168
|
+
for (uint32_t index = 0; index < ((yp_module_node_t *)node)->locals.size; index++) {
|
1169
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1170
|
+
char locals_buffer[12];
|
1171
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_module_node_t *)node)->locals.ids[index]);
|
1172
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
1173
|
+
}
|
1174
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1175
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_module_node_t *)node)->module_keyword_loc);
|
1176
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_module_node_t *)node)->constant_path);
|
1177
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_module_node_t *)node)->statements == NULL) {
|
1178
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1179
|
+
} else {
|
1180
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_module_node_t *)node)->statements);
|
1181
|
+
}
|
1182
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_module_node_t *)node)->end_keyword_loc);
|
1183
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1184
|
+
break;
|
1185
|
+
}
|
1186
|
+
case YP_NODE_MULTI_WRITE_NODE: {
|
1187
|
+
yp_buffer_append_str(buffer, "MultiWriteNode(", 15);
|
1188
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1189
|
+
for (uint32_t index = 0; index < ((yp_multi_write_node_t *)node)->targets.size; index++) {
|
1190
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1191
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_multi_write_node_t *) node)->targets.nodes[index]);
|
1192
|
+
}
|
1193
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1194
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_multi_write_node_t *)node)->operator_loc.start == NULL) {
|
1195
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1196
|
+
} else {
|
1197
|
+
prettyprint_location(buffer, parser, &((yp_multi_write_node_t *)node)->operator_loc);
|
1198
|
+
}
|
1199
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_multi_write_node_t *)node)->value == NULL) {
|
1200
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1201
|
+
} else {
|
1202
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_multi_write_node_t *)node)->value);
|
1203
|
+
}
|
1204
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_multi_write_node_t *)node)->lparen_loc.start == NULL) {
|
1205
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1206
|
+
} else {
|
1207
|
+
prettyprint_location(buffer, parser, &((yp_multi_write_node_t *)node)->lparen_loc);
|
1208
|
+
}
|
1209
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_multi_write_node_t *)node)->rparen_loc.start == NULL) {
|
1210
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1211
|
+
} else {
|
1212
|
+
prettyprint_location(buffer, parser, &((yp_multi_write_node_t *)node)->rparen_loc);
|
1213
|
+
}
|
1214
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1215
|
+
break;
|
1216
|
+
}
|
1217
|
+
case YP_NODE_NEXT_NODE: {
|
1218
|
+
yp_buffer_append_str(buffer, "NextNode(", 9);
|
1219
|
+
if (((yp_next_node_t *)node)->arguments == NULL) {
|
1220
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1221
|
+
} else {
|
1222
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_next_node_t *)node)->arguments);
|
1223
|
+
}
|
1224
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_next_node_t *)node)->keyword_loc);
|
1225
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1226
|
+
break;
|
1227
|
+
}
|
1228
|
+
case YP_NODE_NIL_NODE: {
|
1229
|
+
yp_buffer_append_str(buffer, "NilNode(", 8);
|
1230
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1231
|
+
break;
|
1232
|
+
}
|
1233
|
+
case YP_NODE_NO_KEYWORDS_PARAMETER_NODE: {
|
1234
|
+
yp_buffer_append_str(buffer, "NoKeywordsParameterNode(", 24);
|
1235
|
+
prettyprint_location(buffer, parser, &((yp_no_keywords_parameter_node_t *)node)->operator_loc);
|
1236
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_no_keywords_parameter_node_t *)node)->keyword_loc);
|
1237
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1238
|
+
break;
|
1239
|
+
}
|
1240
|
+
case YP_NODE_NUMBERED_REFERENCE_READ_NODE: {
|
1241
|
+
yp_buffer_append_str(buffer, "NumberedReferenceReadNode(", 26);
|
1242
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1243
|
+
break;
|
1244
|
+
}
|
1245
|
+
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
1246
|
+
yp_buffer_append_str(buffer, "OptionalParameterNode(", 22);
|
1247
|
+
char constant_id_buffer[12];
|
1248
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_optional_parameter_node_t *)node)->constant_id);
|
1249
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1250
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_optional_parameter_node_t *)node)->name_loc);
|
1251
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_optional_parameter_node_t *)node)->operator_loc);
|
1252
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_optional_parameter_node_t *)node)->value);
|
1253
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1254
|
+
break;
|
1255
|
+
}
|
1256
|
+
case YP_NODE_OR_NODE: {
|
1257
|
+
yp_buffer_append_str(buffer, "OrNode(", 7);
|
1258
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_or_node_t *)node)->left);
|
1259
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_or_node_t *)node)->right);
|
1260
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_or_node_t *)node)->operator_loc);
|
1261
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1262
|
+
break;
|
1263
|
+
}
|
1264
|
+
case YP_NODE_PARAMETERS_NODE: {
|
1265
|
+
yp_buffer_append_str(buffer, "ParametersNode(", 15);
|
1266
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1267
|
+
for (uint32_t index = 0; index < ((yp_parameters_node_t *)node)->requireds.size; index++) {
|
1268
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1269
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_parameters_node_t *) node)->requireds.nodes[index]);
|
1270
|
+
}
|
1271
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1272
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1273
|
+
for (uint32_t index = 0; index < ((yp_parameters_node_t *)node)->optionals.size; index++) {
|
1274
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1275
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_parameters_node_t *) node)->optionals.nodes[index]);
|
1276
|
+
}
|
1277
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1278
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1279
|
+
for (uint32_t index = 0; index < ((yp_parameters_node_t *)node)->posts.size; index++) {
|
1280
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1281
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_parameters_node_t *) node)->posts.nodes[index]);
|
1282
|
+
}
|
1283
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1284
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_parameters_node_t *)node)->rest == NULL) {
|
1285
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1286
|
+
} else {
|
1287
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parameters_node_t *)node)->rest);
|
1288
|
+
}
|
1289
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1290
|
+
for (uint32_t index = 0; index < ((yp_parameters_node_t *)node)->keywords.size; index++) {
|
1291
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1292
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_parameters_node_t *) node)->keywords.nodes[index]);
|
1293
|
+
}
|
1294
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1295
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_parameters_node_t *)node)->keyword_rest == NULL) {
|
1296
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1297
|
+
} else {
|
1298
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parameters_node_t *)node)->keyword_rest);
|
1299
|
+
}
|
1300
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_parameters_node_t *)node)->block == NULL) {
|
1301
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1302
|
+
} else {
|
1303
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parameters_node_t *)node)->block);
|
1304
|
+
}
|
1305
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1306
|
+
break;
|
1307
|
+
}
|
1308
|
+
case YP_NODE_PARENTHESES_NODE: {
|
1309
|
+
yp_buffer_append_str(buffer, "ParenthesesNode(", 16);
|
1310
|
+
if (((yp_parentheses_node_t *)node)->statements == NULL) {
|
1311
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1312
|
+
} else {
|
1313
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parentheses_node_t *)node)->statements);
|
1314
|
+
}
|
1315
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_parentheses_node_t *)node)->opening_loc);
|
1316
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_parentheses_node_t *)node)->closing_loc);
|
1317
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1318
|
+
break;
|
1319
|
+
}
|
1320
|
+
case YP_NODE_PINNED_EXPRESSION_NODE: {
|
1321
|
+
yp_buffer_append_str(buffer, "PinnedExpressionNode(", 21);
|
1322
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_pinned_expression_node_t *)node)->expression);
|
1323
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pinned_expression_node_t *)node)->operator_loc);
|
1324
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pinned_expression_node_t *)node)->lparen_loc);
|
1325
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pinned_expression_node_t *)node)->rparen_loc);
|
1326
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1327
|
+
break;
|
1328
|
+
}
|
1329
|
+
case YP_NODE_PINNED_VARIABLE_NODE: {
|
1330
|
+
yp_buffer_append_str(buffer, "PinnedVariableNode(", 19);
|
1331
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_pinned_variable_node_t *)node)->variable);
|
1332
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pinned_variable_node_t *)node)->operator_loc);
|
1333
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1334
|
+
break;
|
1335
|
+
}
|
1336
|
+
case YP_NODE_POST_EXECUTION_NODE: {
|
1337
|
+
yp_buffer_append_str(buffer, "PostExecutionNode(", 18);
|
1338
|
+
if (((yp_post_execution_node_t *)node)->statements == NULL) {
|
1339
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1340
|
+
} else {
|
1341
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_post_execution_node_t *)node)->statements);
|
1342
|
+
}
|
1343
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_post_execution_node_t *)node)->keyword_loc);
|
1344
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_post_execution_node_t *)node)->opening_loc);
|
1345
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_post_execution_node_t *)node)->closing_loc);
|
1346
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1347
|
+
break;
|
1348
|
+
}
|
1349
|
+
case YP_NODE_PRE_EXECUTION_NODE: {
|
1350
|
+
yp_buffer_append_str(buffer, "PreExecutionNode(", 17);
|
1351
|
+
if (((yp_pre_execution_node_t *)node)->statements == NULL) {
|
1352
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1353
|
+
} else {
|
1354
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_pre_execution_node_t *)node)->statements);
|
1355
|
+
}
|
1356
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pre_execution_node_t *)node)->keyword_loc);
|
1357
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pre_execution_node_t *)node)->opening_loc);
|
1358
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_pre_execution_node_t *)node)->closing_loc);
|
1359
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1360
|
+
break;
|
1361
|
+
}
|
1362
|
+
case YP_NODE_PROGRAM_NODE: {
|
1363
|
+
yp_buffer_append_str(buffer, "ProgramNode(", 12);
|
1364
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1365
|
+
for (uint32_t index = 0; index < ((yp_program_node_t *)node)->locals.size; index++) {
|
1366
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1367
|
+
char locals_buffer[12];
|
1368
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_program_node_t *)node)->locals.ids[index]);
|
1369
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
1370
|
+
}
|
1371
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1372
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_program_node_t *)node)->statements);
|
1373
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1374
|
+
break;
|
1375
|
+
}
|
1376
|
+
case YP_NODE_RANGE_NODE: {
|
1377
|
+
yp_buffer_append_str(buffer, "RangeNode(", 10);
|
1378
|
+
if (((yp_range_node_t *)node)->left == NULL) {
|
1379
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1380
|
+
} else {
|
1381
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_range_node_t *)node)->left);
|
1382
|
+
}
|
1383
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_range_node_t *)node)->right == NULL) {
|
1384
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1385
|
+
} else {
|
1386
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_range_node_t *)node)->right);
|
1387
|
+
}
|
1388
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_range_node_t *)node)->operator_loc);
|
1389
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1390
|
+
yp_snprintf(flags_buffer, sizeof(flags_buffer), "+%d", ((yp_range_node_t *)node)->flags);
|
1391
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1392
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1393
|
+
break;
|
1394
|
+
}
|
1395
|
+
case YP_NODE_RATIONAL_NODE: {
|
1396
|
+
yp_buffer_append_str(buffer, "RationalNode(", 13);
|
1397
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_rational_node_t *)node)->numeric);
|
1398
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1399
|
+
break;
|
1400
|
+
}
|
1401
|
+
case YP_NODE_REDO_NODE: {
|
1402
|
+
yp_buffer_append_str(buffer, "RedoNode(", 9);
|
1403
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1404
|
+
break;
|
1405
|
+
}
|
1406
|
+
case YP_NODE_REGULAR_EXPRESSION_NODE: {
|
1407
|
+
yp_buffer_append_str(buffer, "RegularExpressionNode(", 22);
|
1408
|
+
prettyprint_location(buffer, parser, &((yp_regular_expression_node_t *)node)->opening_loc);
|
1409
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_regular_expression_node_t *)node)->content_loc);
|
1410
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_regular_expression_node_t *)node)->closing_loc);
|
1411
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
1412
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_regular_expression_node_t *)node)->unescaped), yp_string_length(&((yp_regular_expression_node_t *)node)->unescaped));
|
1413
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1414
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1415
|
+
yp_snprintf(flags_buffer, sizeof(flags_buffer), "+%d", ((yp_regular_expression_node_t *)node)->flags);
|
1416
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1417
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1418
|
+
break;
|
1419
|
+
}
|
1420
|
+
case YP_NODE_REQUIRED_DESTRUCTURED_PARAMETER_NODE: {
|
1421
|
+
yp_buffer_append_str(buffer, "RequiredDestructuredParameterNode(", 34);
|
1422
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1423
|
+
for (uint32_t index = 0; index < ((yp_required_destructured_parameter_node_t *)node)->parameters.size; index++) {
|
1424
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1425
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_required_destructured_parameter_node_t *) node)->parameters.nodes[index]);
|
1426
|
+
}
|
1427
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1428
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_required_destructured_parameter_node_t *)node)->opening_loc);
|
1429
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_required_destructured_parameter_node_t *)node)->closing_loc);
|
1430
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1431
|
+
break;
|
1432
|
+
}
|
1433
|
+
case YP_NODE_REQUIRED_PARAMETER_NODE: {
|
1434
|
+
yp_buffer_append_str(buffer, "RequiredParameterNode(", 22);
|
1435
|
+
char constant_id_buffer[12];
|
1436
|
+
yp_snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_required_parameter_node_t *)node)->constant_id);
|
1437
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1438
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1439
|
+
break;
|
1440
|
+
}
|
1441
|
+
case YP_NODE_RESCUE_MODIFIER_NODE: {
|
1442
|
+
yp_buffer_append_str(buffer, "RescueModifierNode(", 19);
|
1443
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_rescue_modifier_node_t *)node)->expression);
|
1444
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_rescue_modifier_node_t *)node)->keyword_loc);
|
1445
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_rescue_modifier_node_t *)node)->rescue_expression);
|
1446
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1447
|
+
break;
|
1448
|
+
}
|
1449
|
+
case YP_NODE_RESCUE_NODE: {
|
1450
|
+
yp_buffer_append_str(buffer, "RescueNode(", 11);
|
1451
|
+
prettyprint_location(buffer, parser, &((yp_rescue_node_t *)node)->keyword_loc);
|
1452
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1453
|
+
for (uint32_t index = 0; index < ((yp_rescue_node_t *)node)->exceptions.size; index++) {
|
1454
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1455
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_rescue_node_t *) node)->exceptions.nodes[index]);
|
1456
|
+
}
|
1457
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1458
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_rescue_node_t *)node)->operator_loc.start == NULL) {
|
1459
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1460
|
+
} else {
|
1461
|
+
prettyprint_location(buffer, parser, &((yp_rescue_node_t *)node)->operator_loc);
|
1462
|
+
}
|
1463
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_rescue_node_t *)node)->reference == NULL) {
|
1464
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1465
|
+
} else {
|
1466
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_rescue_node_t *)node)->reference);
|
1467
|
+
}
|
1468
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_rescue_node_t *)node)->statements == NULL) {
|
1469
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1470
|
+
} else {
|
1471
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_rescue_node_t *)node)->statements);
|
1472
|
+
}
|
1473
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_rescue_node_t *)node)->consequent == NULL) {
|
1474
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1475
|
+
} else {
|
1476
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_rescue_node_t *)node)->consequent);
|
1477
|
+
}
|
1478
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1479
|
+
break;
|
1480
|
+
}
|
1481
|
+
case YP_NODE_REST_PARAMETER_NODE: {
|
1482
|
+
yp_buffer_append_str(buffer, "RestParameterNode(", 18);
|
1483
|
+
prettyprint_location(buffer, parser, &((yp_rest_parameter_node_t *)node)->operator_loc);
|
1484
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_rest_parameter_node_t *)node)->name_loc.start == NULL) {
|
1485
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1486
|
+
} else {
|
1487
|
+
prettyprint_location(buffer, parser, &((yp_rest_parameter_node_t *)node)->name_loc);
|
1488
|
+
}
|
1489
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1490
|
+
break;
|
1491
|
+
}
|
1492
|
+
case YP_NODE_RETRY_NODE: {
|
1493
|
+
yp_buffer_append_str(buffer, "RetryNode(", 10);
|
1494
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1495
|
+
break;
|
1496
|
+
}
|
1497
|
+
case YP_NODE_RETURN_NODE: {
|
1498
|
+
yp_buffer_append_str(buffer, "ReturnNode(", 11);
|
1499
|
+
prettyprint_location(buffer, parser, &((yp_return_node_t *)node)->keyword_loc);
|
1500
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_return_node_t *)node)->arguments == NULL) {
|
1501
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1502
|
+
} else {
|
1503
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_return_node_t *)node)->arguments);
|
1504
|
+
}
|
1505
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1506
|
+
break;
|
1507
|
+
}
|
1508
|
+
case YP_NODE_SELF_NODE: {
|
1509
|
+
yp_buffer_append_str(buffer, "SelfNode(", 9);
|
1510
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1511
|
+
break;
|
1512
|
+
}
|
1513
|
+
case YP_NODE_SINGLETON_CLASS_NODE: {
|
1514
|
+
yp_buffer_append_str(buffer, "SingletonClassNode(", 19);
|
1515
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1516
|
+
for (uint32_t index = 0; index < ((yp_singleton_class_node_t *)node)->locals.size; index++) {
|
1517
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1518
|
+
char locals_buffer[12];
|
1519
|
+
yp_snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_singleton_class_node_t *)node)->locals.ids[index]);
|
1520
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
1521
|
+
}
|
1522
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1523
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_singleton_class_node_t *)node)->class_keyword_loc);
|
1524
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_singleton_class_node_t *)node)->operator_loc);
|
1525
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_singleton_class_node_t *)node)->expression);
|
1526
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_singleton_class_node_t *)node)->statements == NULL) {
|
1527
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1528
|
+
} else {
|
1529
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_singleton_class_node_t *)node)->statements);
|
1530
|
+
}
|
1531
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_singleton_class_node_t *)node)->end_keyword_loc);
|
1532
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1533
|
+
break;
|
1534
|
+
}
|
1535
|
+
case YP_NODE_SOURCE_ENCODING_NODE: {
|
1536
|
+
yp_buffer_append_str(buffer, "SourceEncodingNode(", 19);
|
1537
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1538
|
+
break;
|
1539
|
+
}
|
1540
|
+
case YP_NODE_SOURCE_FILE_NODE: {
|
1541
|
+
yp_buffer_append_str(buffer, "SourceFileNode(", 15);
|
1542
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1543
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_source_file_node_t *)node)->filepath), yp_string_length(&((yp_source_file_node_t *)node)->filepath));
|
1544
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1545
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1546
|
+
break;
|
1547
|
+
}
|
1548
|
+
case YP_NODE_SOURCE_LINE_NODE: {
|
1549
|
+
yp_buffer_append_str(buffer, "SourceLineNode(", 15);
|
1550
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1551
|
+
break;
|
1552
|
+
}
|
1553
|
+
case YP_NODE_SPLAT_NODE: {
|
1554
|
+
yp_buffer_append_str(buffer, "SplatNode(", 10);
|
1555
|
+
prettyprint_location(buffer, parser, &((yp_splat_node_t *)node)->operator_loc);
|
1556
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_splat_node_t *)node)->expression == NULL) {
|
1557
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1558
|
+
} else {
|
1559
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_splat_node_t *)node)->expression);
|
1560
|
+
}
|
1561
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1562
|
+
break;
|
1563
|
+
}
|
1564
|
+
case YP_NODE_STATEMENTS_NODE: {
|
1565
|
+
yp_buffer_append_str(buffer, "StatementsNode(", 15);
|
1566
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1567
|
+
for (uint32_t index = 0; index < ((yp_statements_node_t *)node)->body.size; index++) {
|
1568
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1569
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_statements_node_t *) node)->body.nodes[index]);
|
1570
|
+
}
|
1571
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1572
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1573
|
+
break;
|
1574
|
+
}
|
1575
|
+
case YP_NODE_STRING_CONCAT_NODE: {
|
1576
|
+
yp_buffer_append_str(buffer, "StringConcatNode(", 17);
|
1577
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_string_concat_node_t *)node)->left);
|
1578
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_string_concat_node_t *)node)->right);
|
1579
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1580
|
+
break;
|
1581
|
+
}
|
1582
|
+
case YP_NODE_STRING_NODE: {
|
1583
|
+
yp_buffer_append_str(buffer, "StringNode(", 11);
|
1584
|
+
if (((yp_string_node_t *)node)->opening_loc.start == NULL) {
|
1585
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1586
|
+
} else {
|
1587
|
+
prettyprint_location(buffer, parser, &((yp_string_node_t *)node)->opening_loc);
|
1588
|
+
}
|
1589
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_string_node_t *)node)->content_loc);
|
1590
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_string_node_t *)node)->closing_loc.start == NULL) {
|
1591
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1592
|
+
} else {
|
1593
|
+
prettyprint_location(buffer, parser, &((yp_string_node_t *)node)->closing_loc);
|
1594
|
+
}
|
1595
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
1596
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_string_node_t *)node)->unescaped), yp_string_length(&((yp_string_node_t *)node)->unescaped));
|
1597
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1598
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1599
|
+
break;
|
1600
|
+
}
|
1601
|
+
case YP_NODE_SUPER_NODE: {
|
1602
|
+
yp_buffer_append_str(buffer, "SuperNode(", 10);
|
1603
|
+
prettyprint_location(buffer, parser, &((yp_super_node_t *)node)->keyword_loc);
|
1604
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_super_node_t *)node)->lparen_loc.start == NULL) {
|
1605
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1606
|
+
} else {
|
1607
|
+
prettyprint_location(buffer, parser, &((yp_super_node_t *)node)->lparen_loc);
|
1608
|
+
}
|
1609
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_super_node_t *)node)->arguments == NULL) {
|
1610
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1611
|
+
} else {
|
1612
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_super_node_t *)node)->arguments);
|
1613
|
+
}
|
1614
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_super_node_t *)node)->rparen_loc.start == NULL) {
|
1615
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1616
|
+
} else {
|
1617
|
+
prettyprint_location(buffer, parser, &((yp_super_node_t *)node)->rparen_loc);
|
1618
|
+
}
|
1619
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_super_node_t *)node)->block == NULL) {
|
1620
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1621
|
+
} else {
|
1622
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_super_node_t *)node)->block);
|
1623
|
+
}
|
1624
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1625
|
+
break;
|
1626
|
+
}
|
1627
|
+
case YP_NODE_SYMBOL_NODE: {
|
1628
|
+
yp_buffer_append_str(buffer, "SymbolNode(", 11);
|
1629
|
+
if (((yp_symbol_node_t *)node)->opening_loc.start == NULL) {
|
1630
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1631
|
+
} else {
|
1632
|
+
prettyprint_location(buffer, parser, &((yp_symbol_node_t *)node)->opening_loc);
|
1633
|
+
}
|
1634
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_symbol_node_t *)node)->value_loc);
|
1635
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_symbol_node_t *)node)->closing_loc.start == NULL) {
|
1636
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1637
|
+
} else {
|
1638
|
+
prettyprint_location(buffer, parser, &((yp_symbol_node_t *)node)->closing_loc);
|
1639
|
+
}
|
1640
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
1641
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_symbol_node_t *)node)->unescaped), yp_string_length(&((yp_symbol_node_t *)node)->unescaped));
|
1642
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1643
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1644
|
+
break;
|
1645
|
+
}
|
1646
|
+
case YP_NODE_TRUE_NODE: {
|
1647
|
+
yp_buffer_append_str(buffer, "TrueNode(", 9);
|
1648
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1649
|
+
break;
|
1650
|
+
}
|
1651
|
+
case YP_NODE_UNDEF_NODE: {
|
1652
|
+
yp_buffer_append_str(buffer, "UndefNode(", 10);
|
1653
|
+
yp_buffer_append_str(buffer, "[", 1);
|
1654
|
+
for (uint32_t index = 0; index < ((yp_undef_node_t *)node)->names.size; index++) {
|
1655
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1656
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_undef_node_t *) node)->names.nodes[index]);
|
1657
|
+
}
|
1658
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1659
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_undef_node_t *)node)->keyword_loc);
|
1660
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1661
|
+
break;
|
1662
|
+
}
|
1663
|
+
case YP_NODE_UNLESS_NODE: {
|
1664
|
+
yp_buffer_append_str(buffer, "UnlessNode(", 11);
|
1665
|
+
prettyprint_location(buffer, parser, &((yp_unless_node_t *)node)->keyword_loc);
|
1666
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_unless_node_t *)node)->predicate);
|
1667
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_unless_node_t *)node)->statements == NULL) {
|
1668
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1669
|
+
} else {
|
1670
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_unless_node_t *)node)->statements);
|
1671
|
+
}
|
1672
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_unless_node_t *)node)->consequent == NULL) {
|
1673
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1674
|
+
} else {
|
1675
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_unless_node_t *)node)->consequent);
|
1676
|
+
}
|
1677
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_unless_node_t *)node)->end_keyword_loc.start == NULL) {
|
1678
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1679
|
+
} else {
|
1680
|
+
prettyprint_location(buffer, parser, &((yp_unless_node_t *)node)->end_keyword_loc);
|
1681
|
+
}
|
1682
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1683
|
+
break;
|
1684
|
+
}
|
1685
|
+
case YP_NODE_UNTIL_NODE: {
|
1686
|
+
yp_buffer_append_str(buffer, "UntilNode(", 10);
|
1687
|
+
prettyprint_location(buffer, parser, &((yp_until_node_t *)node)->keyword_loc);
|
1688
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_until_node_t *)node)->predicate);
|
1689
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_until_node_t *)node)->statements == NULL) {
|
1690
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1691
|
+
} else {
|
1692
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_until_node_t *)node)->statements);
|
1693
|
+
}
|
1694
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1695
|
+
yp_snprintf(flags_buffer, sizeof(flags_buffer), "+%d", ((yp_until_node_t *)node)->flags);
|
1696
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1697
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1698
|
+
break;
|
1699
|
+
}
|
1700
|
+
case YP_NODE_WHEN_NODE: {
|
1701
|
+
yp_buffer_append_str(buffer, "WhenNode(", 9);
|
1702
|
+
prettyprint_location(buffer, parser, &((yp_when_node_t *)node)->keyword_loc);
|
1703
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1704
|
+
for (uint32_t index = 0; index < ((yp_when_node_t *)node)->conditions.size; index++) {
|
1705
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1706
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_when_node_t *) node)->conditions.nodes[index]);
|
1707
|
+
}
|
1708
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1709
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_when_node_t *)node)->statements == NULL) {
|
1710
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1711
|
+
} else {
|
1712
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_when_node_t *)node)->statements);
|
1713
|
+
}
|
1714
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1715
|
+
break;
|
1716
|
+
}
|
1717
|
+
case YP_NODE_WHILE_NODE: {
|
1718
|
+
yp_buffer_append_str(buffer, "WhileNode(", 10);
|
1719
|
+
prettyprint_location(buffer, parser, &((yp_while_node_t *)node)->keyword_loc);
|
1720
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_while_node_t *)node)->predicate);
|
1721
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_while_node_t *)node)->statements == NULL) {
|
1722
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1723
|
+
} else {
|
1724
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_while_node_t *)node)->statements);
|
1725
|
+
}
|
1726
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1727
|
+
yp_snprintf(flags_buffer, sizeof(flags_buffer), "+%d", ((yp_while_node_t *)node)->flags);
|
1728
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1729
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1730
|
+
break;
|
1731
|
+
}
|
1732
|
+
case YP_NODE_X_STRING_NODE: {
|
1733
|
+
yp_buffer_append_str(buffer, "XStringNode(", 12);
|
1734
|
+
prettyprint_location(buffer, parser, &((yp_x_string_node_t *)node)->opening_loc);
|
1735
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_x_string_node_t *)node)->content_loc);
|
1736
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_x_string_node_t *)node)->closing_loc);
|
1737
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
1738
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_x_string_node_t *)node)->unescaped), yp_string_length(&((yp_x_string_node_t *)node)->unescaped));
|
1739
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1740
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1741
|
+
break;
|
1742
|
+
}
|
1743
|
+
case YP_NODE_YIELD_NODE: {
|
1744
|
+
yp_buffer_append_str(buffer, "YieldNode(", 10);
|
1745
|
+
prettyprint_location(buffer, parser, &((yp_yield_node_t *)node)->keyword_loc);
|
1746
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_yield_node_t *)node)->lparen_loc.start == NULL) {
|
1747
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1748
|
+
} else {
|
1749
|
+
prettyprint_location(buffer, parser, &((yp_yield_node_t *)node)->lparen_loc);
|
1750
|
+
}
|
1751
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_yield_node_t *)node)->arguments == NULL) {
|
1752
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1753
|
+
} else {
|
1754
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_yield_node_t *)node)->arguments);
|
1755
|
+
}
|
1756
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_yield_node_t *)node)->rparen_loc.start == NULL) {
|
1757
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1758
|
+
} else {
|
1759
|
+
prettyprint_location(buffer, parser, &((yp_yield_node_t *)node)->rparen_loc);
|
1760
|
+
}
|
1761
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1762
|
+
break;
|
1763
|
+
}
|
1764
|
+
}
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
void
|
1768
|
+
yp_print_node(yp_parser_t *parser, yp_node_t *node) {
|
1769
|
+
yp_buffer_t buffer;
|
1770
|
+
if (!yp_buffer_init(&buffer)) return;
|
1771
|
+
|
1772
|
+
prettyprint_node(&buffer, parser, node);
|
1773
|
+
printf("%.*s\n", (int) buffer.length, buffer.value);
|
1774
|
+
|
1775
|
+
yp_buffer_free(&buffer);
|
1776
|
+
}
|
1777
|
+
|
1778
|
+
// Pretty-prints the AST represented by the given node to the given buffer.
|
1779
|
+
YP_EXPORTED_FUNCTION void
|
1780
|
+
yp_prettyprint(yp_parser_t *parser, yp_node_t *node, yp_buffer_t *buffer) {
|
1781
|
+
prettyprint_node(buffer, parser, node);
|
1782
|
+
}
|