backburn 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/Makefile +50 -0
  4. data/README.md +520 -0
  5. data/docs/cli-and-outputs.md +226 -0
  6. data/docs/technical-spec.md +656 -0
  7. data/exe/backburn +8 -0
  8. data/ext/backburn/extconf.rb +31 -0
  9. data/ext/backburn/prism/COMMIT +1 -0
  10. data/ext/backburn/prism/LICENSE.md +7 -0
  11. data/ext/backburn/prism/Makefile +213 -0
  12. data/ext/backburn/prism/include/prism/arena.h +45 -0
  13. data/ext/backburn/prism/include/prism/arena.hpp +42 -0
  14. data/ext/backburn/prism/include/prism/ast.h +10395 -0
  15. data/ext/backburn/prism/include/prism/ast.hpp +641 -0
  16. data/ext/backburn/prism/include/prism/buffer.h +60 -0
  17. data/ext/backburn/prism/include/prism/buffer.hpp +55 -0
  18. data/ext/backburn/prism/include/prism/comments.h +72 -0
  19. data/ext/backburn/prism/include/prism/compiler/accel.h +26 -0
  20. data/ext/backburn/prism/include/prism/compiler/align.h +36 -0
  21. data/ext/backburn/prism/include/prism/compiler/assume.h +25 -0
  22. data/ext/backburn/prism/include/prism/compiler/branch.h +26 -0
  23. data/ext/backburn/prism/include/prism/compiler/bswap.h +46 -0
  24. data/ext/backburn/prism/include/prism/compiler/cplusplus.hpp +16 -0
  25. data/ext/backburn/prism/include/prism/compiler/endianness.h +34 -0
  26. data/ext/backburn/prism/include/prism/compiler/exceptions.hpp +17 -0
  27. data/ext/backburn/prism/include/prism/compiler/exported.h +24 -0
  28. data/ext/backburn/prism/include/prism/compiler/fallthrough.h +22 -0
  29. data/ext/backburn/prism/include/prism/compiler/filesystem.h +32 -0
  30. data/ext/backburn/prism/include/prism/compiler/flex_array.h +19 -0
  31. data/ext/backburn/prism/include/prism/compiler/force_inline.h +21 -0
  32. data/ext/backburn/prism/include/prism/compiler/format.h +27 -0
  33. data/ext/backburn/prism/include/prism/compiler/inline.h +17 -0
  34. data/ext/backburn/prism/include/prism/compiler/lifetimebound.hpp +25 -0
  35. data/ext/backburn/prism/include/prism/compiler/nodiscard.h +22 -0
  36. data/ext/backburn/prism/include/prism/compiler/nonnull.h +18 -0
  37. data/ext/backburn/prism/include/prism/compiler/noreturn.h +24 -0
  38. data/ext/backburn/prism/include/prism/compiler/stack.h +60 -0
  39. data/ext/backburn/prism/include/prism/compiler/unused.h +18 -0
  40. data/ext/backburn/prism/include/prism/constant_pool.h +112 -0
  41. data/ext/backburn/prism/include/prism/diagnostic.h +121 -0
  42. data/ext/backburn/prism/include/prism/errors_format.h +63 -0
  43. data/ext/backburn/prism/include/prism/excludes.h +29 -0
  44. data/ext/backburn/prism/include/prism/integer.h +79 -0
  45. data/ext/backburn/prism/include/prism/internal/allocator.h +68 -0
  46. data/ext/backburn/prism/include/prism/internal/allocator_debug.h +88 -0
  47. data/ext/backburn/prism/include/prism/internal/arena.h +223 -0
  48. data/ext/backburn/prism/include/prism/internal/assert.h +14 -0
  49. data/ext/backburn/prism/include/prism/internal/bignum.h +239 -0
  50. data/ext/backburn/prism/include/prism/internal/bit.h +66 -0
  51. data/ext/backburn/prism/include/prism/internal/buffer.h +104 -0
  52. data/ext/backburn/prism/include/prism/internal/char.h +145 -0
  53. data/ext/backburn/prism/include/prism/internal/comments.h +54 -0
  54. data/ext/backburn/prism/include/prism/internal/constant_pool.h +155 -0
  55. data/ext/backburn/prism/include/prism/internal/diagnostic.h +392 -0
  56. data/ext/backburn/prism/include/prism/internal/double.h +19 -0
  57. data/ext/backburn/prism/include/prism/internal/encoding.h +326 -0
  58. data/ext/backburn/prism/include/prism/internal/integer.h +66 -0
  59. data/ext/backburn/prism/include/prism/internal/isinf.h +16 -0
  60. data/ext/backburn/prism/include/prism/internal/line_offset_list.h +50 -0
  61. data/ext/backburn/prism/include/prism/internal/list.h +62 -0
  62. data/ext/backburn/prism/include/prism/internal/magic_comments.h +23 -0
  63. data/ext/backburn/prism/include/prism/internal/memchr.h +15 -0
  64. data/ext/backburn/prism/include/prism/internal/node.h +197 -0
  65. data/ext/backburn/prism/include/prism/internal/oom.h +16 -0
  66. data/ext/backburn/prism/include/prism/internal/options.h +248 -0
  67. data/ext/backburn/prism/include/prism/internal/parser.h +1170 -0
  68. data/ext/backburn/prism/include/prism/internal/regexp.h +70 -0
  69. data/ext/backburn/prism/include/prism/internal/serialize.h +39 -0
  70. data/ext/backburn/prism/include/prism/internal/source.h +72 -0
  71. data/ext/backburn/prism/include/prism/internal/static_literals.h +60 -0
  72. data/ext/backburn/prism/include/prism/internal/stringy.h +37 -0
  73. data/ext/backburn/prism/include/prism/internal/strncasecmp.h +18 -0
  74. data/ext/backburn/prism/include/prism/internal/strpbrk.h +61 -0
  75. data/ext/backburn/prism/include/prism/internal/tokens.h +11 -0
  76. data/ext/backburn/prism/include/prism/internal/xxh3.h +16 -0
  77. data/ext/backburn/prism/include/prism/json.h +40 -0
  78. data/ext/backburn/prism/include/prism/line_offset_list.h +69 -0
  79. data/ext/backburn/prism/include/prism/magic_comments.h +53 -0
  80. data/ext/backburn/prism/include/prism/node.h +139 -0
  81. data/ext/backburn/prism/include/prism/node.hpp +272 -0
  82. data/ext/backburn/prism/include/prism/node_type.hpp +38 -0
  83. data/ext/backburn/prism/include/prism/options.h +393 -0
  84. data/ext/backburn/prism/include/prism/options.hpp +43 -0
  85. data/ext/backburn/prism/include/prism/parser.h +433 -0
  86. data/ext/backburn/prism/include/prism/parser.hpp +274 -0
  87. data/ext/backburn/prism/include/prism/prettyprint.h +39 -0
  88. data/ext/backburn/prism/include/prism/serialize.h +123 -0
  89. data/ext/backburn/prism/include/prism/source.h +163 -0
  90. data/ext/backburn/prism/include/prism/stream.h +36 -0
  91. data/ext/backburn/prism/include/prism/string_query.h +97 -0
  92. data/ext/backburn/prism/include/prism/stringy.h +61 -0
  93. data/ext/backburn/prism/include/prism/stringy.hpp +31 -0
  94. data/ext/backburn/prism/include/prism/version.h +46 -0
  95. data/ext/backburn/prism/include/prism.h +123 -0
  96. data/ext/backburn/prism/include/prism.hpp +24 -0
  97. data/ext/backburn/prism/src/arena.c +200 -0
  98. data/ext/backburn/prism/src/bignum.c +399 -0
  99. data/ext/backburn/prism/src/buffer.c +405 -0
  100. data/ext/backburn/prism/src/char.c +289 -0
  101. data/ext/backburn/prism/src/comments.c +455 -0
  102. data/ext/backburn/prism/src/constant_pool.c +410 -0
  103. data/ext/backburn/prism/src/diagnostic.c +918 -0
  104. data/ext/backburn/prism/src/double.c +394 -0
  105. data/ext/backburn/prism/src/encoding.c +1701 -0
  106. data/ext/backburn/prism/src/errors_format.c +650 -0
  107. data/ext/backburn/prism/src/integer.c +675 -0
  108. data/ext/backburn/prism/src/json.c +5745 -0
  109. data/ext/backburn/prism/src/line_offset_list.c +99 -0
  110. data/ext/backburn/prism/src/list.c +24 -0
  111. data/ext/backburn/prism/src/memchr.c +37 -0
  112. data/ext/backburn/prism/src/node.c +4464 -0
  113. data/ext/backburn/prism/src/options.c +475 -0
  114. data/ext/backburn/prism/src/parser.c +371 -0
  115. data/ext/backburn/prism/src/prettyprint.c +9038 -0
  116. data/ext/backburn/prism/src/prism.c +23615 -0
  117. data/ext/backburn/prism/src/regexp.c +3833 -0
  118. data/ext/backburn/prism/src/serialize.c +2656 -0
  119. data/ext/backburn/prism/src/source.c +525 -0
  120. data/ext/backburn/prism/src/static_literals.c +562 -0
  121. data/ext/backburn/prism/src/string_query.c +195 -0
  122. data/ext/backburn/prism/src/stringy.c +77 -0
  123. data/ext/backburn/prism/src/strncasecmp.c +37 -0
  124. data/ext/backburn/prism/src/strpbrk.c +465 -0
  125. data/ext/backburn/prism/src/tokens.c +724 -0
  126. data/ext/backburn/prism/src/xxh3.c +292 -0
  127. data/lib/backburn/version.rb +7 -0
  128. data/presets/devise.roots +11 -0
  129. data/presets/fast-mcp.roots +5 -0
  130. data/presets/graphql.roots +6 -0
  131. data/presets/phlex.roots +7 -0
  132. data/presets/pundit.roots +3 -0
  133. data/presets/rails-framework.roots +10 -0
  134. data/presets/rails.roots +83 -0
  135. data/presets/sidekiq.roots +4 -0
  136. data/presets/thor.roots +3 -0
  137. data/rails.roots +99 -0
  138. data/scripts/embed-presets.sh +13 -0
  139. data/scripts/version-h.sh +7 -0
  140. data/src/analysis/analysis.c +95 -0
  141. data/src/analysis/analysis.h +24 -0
  142. data/src/analysis/batches.c +127 -0
  143. data/src/analysis/batches.h +17 -0
  144. data/src/analysis/graph.c +238 -0
  145. data/src/analysis/graph.h +34 -0
  146. data/src/analysis/mark.c +300 -0
  147. data/src/analysis/mark.h +21 -0
  148. data/src/analysis/roots.c +229 -0
  149. data/src/analysis/roots.h +29 -0
  150. data/src/cli/cli.c +237 -0
  151. data/src/cli/cli.h +9 -0
  152. data/src/cli/config.c +112 -0
  153. data/src/cli/config.h +14 -0
  154. data/src/cli/options.c +17 -0
  155. data/src/cli/options.h +35 -0
  156. data/src/commands/commands.h +11 -0
  157. data/src/commands/explain.c +255 -0
  158. data/src/commands/gemfile.c +126 -0
  159. data/src/commands/gemfile.h +27 -0
  160. data/src/commands/gems.c +408 -0
  161. data/src/commands/init.c +92 -0
  162. data/src/commands/roots.c +82 -0
  163. data/src/commands/scan.c +91 -0
  164. data/src/core/intern.c +94 -0
  165. data/src/core/intern.h +40 -0
  166. data/src/core/json.c +17 -0
  167. data/src/core/json.h +9 -0
  168. data/src/core/model.c +25 -0
  169. data/src/core/model.h +85 -0
  170. data/src/core/util.c +116 -0
  171. data/src/core/util.h +48 -0
  172. data/src/index/erb.c +40 -0
  173. data/src/index/erb.h +9 -0
  174. data/src/index/haml.c +334 -0
  175. data/src/index/haml.h +10 -0
  176. data/src/index/indexer.c +702 -0
  177. data/src/index/indexer.h +19 -0
  178. data/src/index/walk.c +144 -0
  179. data/src/index/walk.h +14 -0
  180. data/src/main.c +81 -0
  181. data/src/output/baseline.c +101 -0
  182. data/src/output/baseline.h +15 -0
  183. data/src/output/report.c +440 -0
  184. data/src/output/report.h +28 -0
  185. metadata +231 -0
@@ -0,0 +1,4464 @@
1
+ /*----------------------------------------------------------------------------*/
2
+ /* This file is generated by the templates/template.rb script and should not */
3
+ /* be modified manually. See */
4
+ /* templates/src/node.c.erb */
5
+ /* if you are looking to modify the */
6
+ /* template */
7
+ /*----------------------------------------------------------------------------*/
8
+
9
+ #line 2 "prism/templates/src/node.c.erb"
10
+ #include "prism/internal/node.h"
11
+
12
+ #include "prism/internal/arena.h"
13
+ #include "prism/internal/oom.h"
14
+
15
+ /**
16
+ * Attempts to grow the scratch list to the next size. If there is already
17
+ * capacity in the list, this function does nothing. Otherwise it allocates a
18
+ * new array from the arena (abandon-and-copy strategy) and copies the existing
19
+ * data into it.
20
+ */
21
+ static void
22
+ pm_scratch_node_list_grow(pm_arena_t *arena, pm_scratch_node_list_t *list, uint32_t size) {
23
+ uint32_t requested_size = list->size + size;
24
+
25
+ // Guard against overflow on the addition.
26
+ if (requested_size < list->size) PRISM_OOM();
27
+
28
+ // If the requested size is within the existing capacity, return.
29
+ if (requested_size <= list->capacity) return;
30
+
31
+ // Otherwise, compute the next capacity by doubling.
32
+ uint32_t next_capacity = list->capacity == 0 ? 4 : list->capacity * 2;
33
+
34
+ // Guard against overflow on the doubling.
35
+ while (requested_size > next_capacity) {
36
+ if (next_capacity == 0) PRISM_OOM();
37
+ next_capacity *= 2;
38
+ }
39
+
40
+ // Allocate a new array from the arena (old array is abandoned).
41
+ pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, next_capacity);
42
+
43
+ // Copy old data into the new array.
44
+ if (list->size > 0) {
45
+ memcpy(nodes, list->nodes, list->size * sizeof(pm_node_t *));
46
+ }
47
+
48
+ list->nodes = nodes;
49
+ list->capacity = next_capacity;
50
+ }
51
+
52
+ /**
53
+ * Slow path for pm_scratch_node_list_append: grow the list and append the
54
+ * node. Do not call directly - use pm_scratch_node_list_append instead.
55
+ */
56
+ void
57
+ pm_scratch_node_list_append_slow(pm_arena_t *arena, pm_scratch_node_list_t *list, pm_node_t *node) {
58
+ pm_scratch_node_list_grow(arena, list, 1);
59
+ list->nodes[list->size++] = node;
60
+ }
61
+
62
+ /**
63
+ * Append every node of the other scratch list onto the end of the list.
64
+ */
65
+ void
66
+ pm_scratch_node_list_concat(pm_arena_t *arena, pm_scratch_node_list_t *list, const pm_scratch_node_list_t *other) {
67
+ if (other->size > 0) {
68
+ pm_scratch_node_list_grow(arena, list, other->size);
69
+ memcpy(list->nodes + list->size, other->nodes, other->size * sizeof(pm_node_t *));
70
+ list->size += other->size;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Append a node onto the end of a node list. A node list's array is always
76
+ * exactly its size, so it grows to exactly one more node, in place when it is
77
+ * the most recent allocation in the arena and by copying it otherwise.
78
+ */
79
+ void
80
+ pm_node_list_append(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
81
+ if (list->size == 0) {
82
+ *list = pm_node_list_single(arena, node);
83
+ return;
84
+ }
85
+
86
+ list->nodes = PM_ARENA_REALLOC(arena, list->nodes, sizeof(pm_node_t *) * (list->size + 1), sizeof(pm_node_t *) * list->size, pm_node_t *);
87
+ list->nodes[list->size++] = node;
88
+ }
89
+
90
+ /**
91
+ * Carve a new batch of chunks out of the arena and hand out its first one.
92
+ * Request alignment to the chunk size through pm_arena_alloc_aligned; neither
93
+ * the chunk type nor the arena's blocks guarantee that alignment on their own.
94
+ * The chunk-sized stride preserves this alignment for every chunk in the batch.
95
+ */
96
+ static pm_node_chunk_t *
97
+ pm_node_chunks_carve(pm_node_chunks_t *chunks) {
98
+ pm_node_chunk_t *batch = (pm_node_chunk_t *) pm_arena_alloc_aligned(chunks->arena, PM_NODE_CHUNK_BATCH * PM_NODE_CHUNK_SIZE, PM_NODE_CHUNK_SIZE);
99
+
100
+ chunks->next = batch + 1;
101
+ chunks->end = batch + PM_NODE_CHUNK_BATCH;
102
+ return batch;
103
+ }
104
+
105
+ /**
106
+ * Get a chunk, preferring the most recently returned one since it is the most
107
+ * likely to still be in cache, then the current batch, then a new batch.
108
+ */
109
+ static PRISM_INLINE pm_node_chunk_t *
110
+ pm_node_chunk_acquire(pm_node_chunks_t *chunks) {
111
+ pm_node_chunk_t *chunk = chunks->free;
112
+
113
+ if (chunk != NULL) {
114
+ chunks->free = chunk->prev;
115
+ return chunk;
116
+ }
117
+
118
+ if (chunks->next != chunks->end) return chunks->next++;
119
+ return pm_node_chunks_carve(chunks);
120
+ }
121
+
122
+ /**
123
+ * Slow path for pm_node_list_open_append: link a new chunk onto the end of the
124
+ * list and append the node to it. Do not call directly - use
125
+ * pm_node_list_open_append instead.
126
+ */
127
+ void
128
+ pm_node_list_open_append_slow(pm_node_chunks_t *chunks, pm_node_list_t *list, pm_node_t *node) {
129
+ pm_node_chunk_t *chunk = pm_node_chunk_acquire(chunks);
130
+ chunk->prev = list->nodes == NULL ? NULL : PM_NODE_CHUNK_OF(list->nodes - 1);
131
+ chunk->slots[0] = node;
132
+
133
+ list->nodes = &chunk->slots[1];
134
+ list->size++;
135
+ }
136
+
137
+ /**
138
+ * Copy an open list into an array of exactly its size allocated from the given
139
+ * arena. Chunks are linked from the last one backward, so the array is filled
140
+ * from its end. The whole chain then goes back on the freelist at once.
141
+ */
142
+ void
143
+ pm_node_list_finalize(pm_node_chunks_t *chunks, pm_arena_t *arena, pm_node_list_t *list) {
144
+ if (list->size == 0) return;
145
+
146
+ pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, list->size);
147
+ pm_node_chunk_t *last = PM_NODE_CHUNK_OF(list->nodes - 1);
148
+ pm_node_chunk_t *chunk = last;
149
+
150
+ size_t count = (size_t) (list->nodes - chunk->slots);
151
+ size_t offset = list->size;
152
+
153
+ for (;;) {
154
+ offset -= count;
155
+ memcpy(nodes + offset, chunk->slots, count * sizeof(pm_node_t *));
156
+
157
+ if (chunk->prev == NULL) break;
158
+ chunk = chunk->prev;
159
+ count = PM_NODE_CHUNK_SLOTS;
160
+ }
161
+
162
+ chunk->prev = chunks->free;
163
+ chunks->free = last;
164
+ list->nodes = nodes;
165
+ }
166
+
167
+ /**
168
+ * A finalized list holding just the given node. A list with one node is known
169
+ * to be complete when it is made, so it skips chunks entirely.
170
+ */
171
+ pm_node_list_t
172
+ pm_node_list_single(pm_arena_t *arena, pm_node_t *node) {
173
+ pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, 1);
174
+ nodes[0] = node;
175
+ return (pm_node_list_t) { .size = 1, .nodes = nodes };
176
+ }
177
+
178
+ /**
179
+ * Prepend a node onto the beginning of a finalized list. Every existing node
180
+ * moves over by one, so the list is copied into a new array.
181
+ */
182
+ void
183
+ pm_node_list_prepend_finalized(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
184
+ pm_node_t **nodes = PM_ARENA_ALLOC_ARRAY(arena, pm_node_t *, list->size + 1);
185
+ nodes[0] = node;
186
+
187
+ if (list->size > 0) {
188
+ memcpy(nodes + 1, list->nodes, sizeof(pm_node_t *) * list->size);
189
+ }
190
+
191
+ list->nodes = nodes;
192
+ list->size++;
193
+ }
194
+
195
+ /**
196
+ * Returns a string representation of the given node type.
197
+ */
198
+ const char *
199
+ pm_node_type(pm_node_type_t node_type)
200
+ {
201
+ switch (node_type) {
202
+ case PM_ALIAS_GLOBAL_VARIABLE_NODE:
203
+ return "PM_ALIAS_GLOBAL_VARIABLE_NODE";
204
+ case PM_ALIAS_METHOD_NODE:
205
+ return "PM_ALIAS_METHOD_NODE";
206
+ case PM_ALTERNATION_PATTERN_NODE:
207
+ return "PM_ALTERNATION_PATTERN_NODE";
208
+ case PM_AND_NODE:
209
+ return "PM_AND_NODE";
210
+ case PM_ARGUMENTS_NODE:
211
+ return "PM_ARGUMENTS_NODE";
212
+ case PM_ARRAY_NODE:
213
+ return "PM_ARRAY_NODE";
214
+ case PM_ARRAY_PATTERN_NODE:
215
+ return "PM_ARRAY_PATTERN_NODE";
216
+ case PM_ASSOC_NODE:
217
+ return "PM_ASSOC_NODE";
218
+ case PM_ASSOC_SPLAT_NODE:
219
+ return "PM_ASSOC_SPLAT_NODE";
220
+ case PM_BACK_REFERENCE_READ_NODE:
221
+ return "PM_BACK_REFERENCE_READ_NODE";
222
+ case PM_BEGIN_NODE:
223
+ return "PM_BEGIN_NODE";
224
+ case PM_BLOCK_ARGUMENT_NODE:
225
+ return "PM_BLOCK_ARGUMENT_NODE";
226
+ case PM_BLOCK_LOCAL_VARIABLE_NODE:
227
+ return "PM_BLOCK_LOCAL_VARIABLE_NODE";
228
+ case PM_BLOCK_NODE:
229
+ return "PM_BLOCK_NODE";
230
+ case PM_BLOCK_PARAMETER_NODE:
231
+ return "PM_BLOCK_PARAMETER_NODE";
232
+ case PM_BLOCK_PARAMETERS_NODE:
233
+ return "PM_BLOCK_PARAMETERS_NODE";
234
+ case PM_BREAK_NODE:
235
+ return "PM_BREAK_NODE";
236
+ case PM_CALL_AND_WRITE_NODE:
237
+ return "PM_CALL_AND_WRITE_NODE";
238
+ case PM_CALL_NODE:
239
+ return "PM_CALL_NODE";
240
+ case PM_CALL_OPERATOR_WRITE_NODE:
241
+ return "PM_CALL_OPERATOR_WRITE_NODE";
242
+ case PM_CALL_OR_WRITE_NODE:
243
+ return "PM_CALL_OR_WRITE_NODE";
244
+ case PM_CALL_TARGET_NODE:
245
+ return "PM_CALL_TARGET_NODE";
246
+ case PM_CAPTURE_PATTERN_NODE:
247
+ return "PM_CAPTURE_PATTERN_NODE";
248
+ case PM_CASE_MATCH_NODE:
249
+ return "PM_CASE_MATCH_NODE";
250
+ case PM_CASE_NODE:
251
+ return "PM_CASE_NODE";
252
+ case PM_CLASS_NODE:
253
+ return "PM_CLASS_NODE";
254
+ case PM_CLASS_VARIABLE_AND_WRITE_NODE:
255
+ return "PM_CLASS_VARIABLE_AND_WRITE_NODE";
256
+ case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE:
257
+ return "PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE";
258
+ case PM_CLASS_VARIABLE_OR_WRITE_NODE:
259
+ return "PM_CLASS_VARIABLE_OR_WRITE_NODE";
260
+ case PM_CLASS_VARIABLE_READ_NODE:
261
+ return "PM_CLASS_VARIABLE_READ_NODE";
262
+ case PM_CLASS_VARIABLE_TARGET_NODE:
263
+ return "PM_CLASS_VARIABLE_TARGET_NODE";
264
+ case PM_CLASS_VARIABLE_WRITE_NODE:
265
+ return "PM_CLASS_VARIABLE_WRITE_NODE";
266
+ case PM_CONSTANT_AND_WRITE_NODE:
267
+ return "PM_CONSTANT_AND_WRITE_NODE";
268
+ case PM_CONSTANT_OPERATOR_WRITE_NODE:
269
+ return "PM_CONSTANT_OPERATOR_WRITE_NODE";
270
+ case PM_CONSTANT_OR_WRITE_NODE:
271
+ return "PM_CONSTANT_OR_WRITE_NODE";
272
+ case PM_CONSTANT_PATH_AND_WRITE_NODE:
273
+ return "PM_CONSTANT_PATH_AND_WRITE_NODE";
274
+ case PM_CONSTANT_PATH_NODE:
275
+ return "PM_CONSTANT_PATH_NODE";
276
+ case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE:
277
+ return "PM_CONSTANT_PATH_OPERATOR_WRITE_NODE";
278
+ case PM_CONSTANT_PATH_OR_WRITE_NODE:
279
+ return "PM_CONSTANT_PATH_OR_WRITE_NODE";
280
+ case PM_CONSTANT_PATH_TARGET_NODE:
281
+ return "PM_CONSTANT_PATH_TARGET_NODE";
282
+ case PM_CONSTANT_PATH_WRITE_NODE:
283
+ return "PM_CONSTANT_PATH_WRITE_NODE";
284
+ case PM_CONSTANT_READ_NODE:
285
+ return "PM_CONSTANT_READ_NODE";
286
+ case PM_CONSTANT_TARGET_NODE:
287
+ return "PM_CONSTANT_TARGET_NODE";
288
+ case PM_CONSTANT_WRITE_NODE:
289
+ return "PM_CONSTANT_WRITE_NODE";
290
+ case PM_DEF_NODE:
291
+ return "PM_DEF_NODE";
292
+ case PM_DEFINED_NODE:
293
+ return "PM_DEFINED_NODE";
294
+ case PM_ELSE_NODE:
295
+ return "PM_ELSE_NODE";
296
+ case PM_EMBEDDED_STATEMENTS_NODE:
297
+ return "PM_EMBEDDED_STATEMENTS_NODE";
298
+ case PM_EMBEDDED_VARIABLE_NODE:
299
+ return "PM_EMBEDDED_VARIABLE_NODE";
300
+ case PM_ENSURE_NODE:
301
+ return "PM_ENSURE_NODE";
302
+ case PM_ERROR_RECOVERY_NODE:
303
+ return "PM_ERROR_RECOVERY_NODE";
304
+ case PM_FALSE_NODE:
305
+ return "PM_FALSE_NODE";
306
+ case PM_FIND_PATTERN_NODE:
307
+ return "PM_FIND_PATTERN_NODE";
308
+ case PM_FLIP_FLOP_NODE:
309
+ return "PM_FLIP_FLOP_NODE";
310
+ case PM_FLOAT_NODE:
311
+ return "PM_FLOAT_NODE";
312
+ case PM_FOR_NODE:
313
+ return "PM_FOR_NODE";
314
+ case PM_FORWARDING_ARGUMENTS_NODE:
315
+ return "PM_FORWARDING_ARGUMENTS_NODE";
316
+ case PM_FORWARDING_PARAMETER_NODE:
317
+ return "PM_FORWARDING_PARAMETER_NODE";
318
+ case PM_FORWARDING_SUPER_NODE:
319
+ return "PM_FORWARDING_SUPER_NODE";
320
+ case PM_GLOBAL_VARIABLE_AND_WRITE_NODE:
321
+ return "PM_GLOBAL_VARIABLE_AND_WRITE_NODE";
322
+ case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE:
323
+ return "PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE";
324
+ case PM_GLOBAL_VARIABLE_OR_WRITE_NODE:
325
+ return "PM_GLOBAL_VARIABLE_OR_WRITE_NODE";
326
+ case PM_GLOBAL_VARIABLE_READ_NODE:
327
+ return "PM_GLOBAL_VARIABLE_READ_NODE";
328
+ case PM_GLOBAL_VARIABLE_TARGET_NODE:
329
+ return "PM_GLOBAL_VARIABLE_TARGET_NODE";
330
+ case PM_GLOBAL_VARIABLE_WRITE_NODE:
331
+ return "PM_GLOBAL_VARIABLE_WRITE_NODE";
332
+ case PM_HASH_NODE:
333
+ return "PM_HASH_NODE";
334
+ case PM_HASH_PATTERN_NODE:
335
+ return "PM_HASH_PATTERN_NODE";
336
+ case PM_IF_NODE:
337
+ return "PM_IF_NODE";
338
+ case PM_IMAGINARY_NODE:
339
+ return "PM_IMAGINARY_NODE";
340
+ case PM_IMPLICIT_NODE:
341
+ return "PM_IMPLICIT_NODE";
342
+ case PM_IMPLICIT_REST_NODE:
343
+ return "PM_IMPLICIT_REST_NODE";
344
+ case PM_IN_NODE:
345
+ return "PM_IN_NODE";
346
+ case PM_INDEX_AND_WRITE_NODE:
347
+ return "PM_INDEX_AND_WRITE_NODE";
348
+ case PM_INDEX_OPERATOR_WRITE_NODE:
349
+ return "PM_INDEX_OPERATOR_WRITE_NODE";
350
+ case PM_INDEX_OR_WRITE_NODE:
351
+ return "PM_INDEX_OR_WRITE_NODE";
352
+ case PM_INDEX_TARGET_NODE:
353
+ return "PM_INDEX_TARGET_NODE";
354
+ case PM_INSTANCE_VARIABLE_AND_WRITE_NODE:
355
+ return "PM_INSTANCE_VARIABLE_AND_WRITE_NODE";
356
+ case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE:
357
+ return "PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE";
358
+ case PM_INSTANCE_VARIABLE_OR_WRITE_NODE:
359
+ return "PM_INSTANCE_VARIABLE_OR_WRITE_NODE";
360
+ case PM_INSTANCE_VARIABLE_READ_NODE:
361
+ return "PM_INSTANCE_VARIABLE_READ_NODE";
362
+ case PM_INSTANCE_VARIABLE_TARGET_NODE:
363
+ return "PM_INSTANCE_VARIABLE_TARGET_NODE";
364
+ case PM_INSTANCE_VARIABLE_WRITE_NODE:
365
+ return "PM_INSTANCE_VARIABLE_WRITE_NODE";
366
+ case PM_INTEGER_NODE:
367
+ return "PM_INTEGER_NODE";
368
+ case PM_INTERPOLATED_MATCH_LAST_LINE_NODE:
369
+ return "PM_INTERPOLATED_MATCH_LAST_LINE_NODE";
370
+ case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE:
371
+ return "PM_INTERPOLATED_REGULAR_EXPRESSION_NODE";
372
+ case PM_INTERPOLATED_STRING_NODE:
373
+ return "PM_INTERPOLATED_STRING_NODE";
374
+ case PM_INTERPOLATED_SYMBOL_NODE:
375
+ return "PM_INTERPOLATED_SYMBOL_NODE";
376
+ case PM_INTERPOLATED_X_STRING_NODE:
377
+ return "PM_INTERPOLATED_X_STRING_NODE";
378
+ case PM_IT_LOCAL_VARIABLE_READ_NODE:
379
+ return "PM_IT_LOCAL_VARIABLE_READ_NODE";
380
+ case PM_IT_PARAMETERS_NODE:
381
+ return "PM_IT_PARAMETERS_NODE";
382
+ case PM_KEYWORD_HASH_NODE:
383
+ return "PM_KEYWORD_HASH_NODE";
384
+ case PM_KEYWORD_REST_PARAMETER_NODE:
385
+ return "PM_KEYWORD_REST_PARAMETER_NODE";
386
+ case PM_LAMBDA_NODE:
387
+ return "PM_LAMBDA_NODE";
388
+ case PM_LOCAL_VARIABLE_AND_WRITE_NODE:
389
+ return "PM_LOCAL_VARIABLE_AND_WRITE_NODE";
390
+ case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE:
391
+ return "PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE";
392
+ case PM_LOCAL_VARIABLE_OR_WRITE_NODE:
393
+ return "PM_LOCAL_VARIABLE_OR_WRITE_NODE";
394
+ case PM_LOCAL_VARIABLE_READ_NODE:
395
+ return "PM_LOCAL_VARIABLE_READ_NODE";
396
+ case PM_LOCAL_VARIABLE_TARGET_NODE:
397
+ return "PM_LOCAL_VARIABLE_TARGET_NODE";
398
+ case PM_LOCAL_VARIABLE_WRITE_NODE:
399
+ return "PM_LOCAL_VARIABLE_WRITE_NODE";
400
+ case PM_MATCH_LAST_LINE_NODE:
401
+ return "PM_MATCH_LAST_LINE_NODE";
402
+ case PM_MATCH_PREDICATE_NODE:
403
+ return "PM_MATCH_PREDICATE_NODE";
404
+ case PM_MATCH_REQUIRED_NODE:
405
+ return "PM_MATCH_REQUIRED_NODE";
406
+ case PM_MATCH_WRITE_NODE:
407
+ return "PM_MATCH_WRITE_NODE";
408
+ case PM_MODULE_NODE:
409
+ return "PM_MODULE_NODE";
410
+ case PM_MULTI_TARGET_NODE:
411
+ return "PM_MULTI_TARGET_NODE";
412
+ case PM_MULTI_WRITE_NODE:
413
+ return "PM_MULTI_WRITE_NODE";
414
+ case PM_NEXT_NODE:
415
+ return "PM_NEXT_NODE";
416
+ case PM_NIL_NODE:
417
+ return "PM_NIL_NODE";
418
+ case PM_NO_BLOCK_PARAMETER_NODE:
419
+ return "PM_NO_BLOCK_PARAMETER_NODE";
420
+ case PM_NO_KEYWORDS_PARAMETER_NODE:
421
+ return "PM_NO_KEYWORDS_PARAMETER_NODE";
422
+ case PM_NUMBERED_PARAMETERS_NODE:
423
+ return "PM_NUMBERED_PARAMETERS_NODE";
424
+ case PM_NUMBERED_REFERENCE_READ_NODE:
425
+ return "PM_NUMBERED_REFERENCE_READ_NODE";
426
+ case PM_OPTIONAL_KEYWORD_PARAMETER_NODE:
427
+ return "PM_OPTIONAL_KEYWORD_PARAMETER_NODE";
428
+ case PM_OPTIONAL_PARAMETER_NODE:
429
+ return "PM_OPTIONAL_PARAMETER_NODE";
430
+ case PM_OR_NODE:
431
+ return "PM_OR_NODE";
432
+ case PM_PARAMETERS_NODE:
433
+ return "PM_PARAMETERS_NODE";
434
+ case PM_PARENTHESES_NODE:
435
+ return "PM_PARENTHESES_NODE";
436
+ case PM_PINNED_EXPRESSION_NODE:
437
+ return "PM_PINNED_EXPRESSION_NODE";
438
+ case PM_PINNED_VARIABLE_NODE:
439
+ return "PM_PINNED_VARIABLE_NODE";
440
+ case PM_POST_EXECUTION_NODE:
441
+ return "PM_POST_EXECUTION_NODE";
442
+ case PM_PRE_EXECUTION_NODE:
443
+ return "PM_PRE_EXECUTION_NODE";
444
+ case PM_PROGRAM_NODE:
445
+ return "PM_PROGRAM_NODE";
446
+ case PM_RANGE_NODE:
447
+ return "PM_RANGE_NODE";
448
+ case PM_RATIONAL_NODE:
449
+ return "PM_RATIONAL_NODE";
450
+ case PM_REDO_NODE:
451
+ return "PM_REDO_NODE";
452
+ case PM_REGULAR_EXPRESSION_NODE:
453
+ return "PM_REGULAR_EXPRESSION_NODE";
454
+ case PM_REQUIRED_KEYWORD_PARAMETER_NODE:
455
+ return "PM_REQUIRED_KEYWORD_PARAMETER_NODE";
456
+ case PM_REQUIRED_PARAMETER_NODE:
457
+ return "PM_REQUIRED_PARAMETER_NODE";
458
+ case PM_RESCUE_MODIFIER_NODE:
459
+ return "PM_RESCUE_MODIFIER_NODE";
460
+ case PM_RESCUE_NODE:
461
+ return "PM_RESCUE_NODE";
462
+ case PM_REST_PARAMETER_NODE:
463
+ return "PM_REST_PARAMETER_NODE";
464
+ case PM_RETRY_NODE:
465
+ return "PM_RETRY_NODE";
466
+ case PM_RETURN_NODE:
467
+ return "PM_RETURN_NODE";
468
+ case PM_SELF_NODE:
469
+ return "PM_SELF_NODE";
470
+ case PM_SHAREABLE_CONSTANT_NODE:
471
+ return "PM_SHAREABLE_CONSTANT_NODE";
472
+ case PM_SINGLETON_CLASS_NODE:
473
+ return "PM_SINGLETON_CLASS_NODE";
474
+ case PM_SOURCE_ENCODING_NODE:
475
+ return "PM_SOURCE_ENCODING_NODE";
476
+ case PM_SOURCE_FILE_NODE:
477
+ return "PM_SOURCE_FILE_NODE";
478
+ case PM_SOURCE_LINE_NODE:
479
+ return "PM_SOURCE_LINE_NODE";
480
+ case PM_SPLAT_NODE:
481
+ return "PM_SPLAT_NODE";
482
+ case PM_STATEMENTS_NODE:
483
+ return "PM_STATEMENTS_NODE";
484
+ case PM_STRING_NODE:
485
+ return "PM_STRING_NODE";
486
+ case PM_SUPER_NODE:
487
+ return "PM_SUPER_NODE";
488
+ case PM_SYMBOL_NODE:
489
+ return "PM_SYMBOL_NODE";
490
+ case PM_TRUE_NODE:
491
+ return "PM_TRUE_NODE";
492
+ case PM_UNDEF_NODE:
493
+ return "PM_UNDEF_NODE";
494
+ case PM_UNLESS_NODE:
495
+ return "PM_UNLESS_NODE";
496
+ case PM_UNTIL_NODE:
497
+ return "PM_UNTIL_NODE";
498
+ case PM_WHEN_NODE:
499
+ return "PM_WHEN_NODE";
500
+ case PM_WHILE_NODE:
501
+ return "PM_WHILE_NODE";
502
+ case PM_X_STRING_NODE:
503
+ return "PM_X_STRING_NODE";
504
+ case PM_YIELD_NODE:
505
+ return "PM_YIELD_NODE";
506
+ }
507
+ return "";
508
+ }
509
+
510
+ /**
511
+ * Visit each of the nodes in this subtree using the given visitor callback. The
512
+ * callback function will be called for each node in the subtree, and its
513
+ * return value determines whether the walk visits that node's children, skips
514
+ * them, or stops entirely. The data parameter is treated as an opaque pointer
515
+ * and is passed to the visitor callback for consumers to use as they see fit.
516
+ */
517
+ bool
518
+ pm_visit_node(const pm_node_t *node, pm_visit_callback_t visitor, void *data) {
519
+ pm_visit_result_t result = visitor(node, data);
520
+ if (result == PM_VISIT_DESCEND) return pm_visit_child_nodes(node, visitor, data);
521
+ return result != PM_VISIT_STOP;
522
+ }
523
+
524
+ /**
525
+ * Visit the children of the given node with the given callback. This is the
526
+ * default behavior for walking the tree that is called from pm_visit_node if
527
+ * the callback returns PM_VISIT_DESCEND. A stop from any child returns false
528
+ * immediately, so that it propagates up through every enclosing call.
529
+ */
530
+ bool
531
+ pm_visit_child_nodes(const pm_node_t *node, pm_visit_callback_t visitor, void *data) {
532
+ switch (PM_NODE_TYPE(node)) {
533
+ case PM_ALIAS_GLOBAL_VARIABLE_NODE: {
534
+ const pm_alias_global_variable_node_t *cast = (const pm_alias_global_variable_node_t *) node;
535
+
536
+ // Visit the new_name field
537
+ if (!pm_visit_node((const pm_node_t *) cast->new_name, visitor, data)) return false;
538
+
539
+ // Visit the old_name field
540
+ if (!pm_visit_node((const pm_node_t *) cast->old_name, visitor, data)) return false;
541
+
542
+ break;
543
+ }
544
+ case PM_ALIAS_METHOD_NODE: {
545
+ const pm_alias_method_node_t *cast = (const pm_alias_method_node_t *) node;
546
+
547
+ // Visit the new_name field
548
+ if (!pm_visit_node((const pm_node_t *) cast->new_name, visitor, data)) return false;
549
+
550
+ // Visit the old_name field
551
+ if (!pm_visit_node((const pm_node_t *) cast->old_name, visitor, data)) return false;
552
+
553
+ break;
554
+ }
555
+ case PM_ALTERNATION_PATTERN_NODE: {
556
+ const pm_alternation_pattern_node_t *cast = (const pm_alternation_pattern_node_t *) node;
557
+
558
+ // Visit the left field
559
+ if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
560
+
561
+ // Visit the right field
562
+ if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
563
+
564
+ break;
565
+ }
566
+ case PM_AND_NODE: {
567
+ const pm_and_node_t *cast = (const pm_and_node_t *) node;
568
+
569
+ // Visit the left field
570
+ if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
571
+
572
+ // Visit the right field
573
+ if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
574
+
575
+ break;
576
+ }
577
+ case PM_ARGUMENTS_NODE: {
578
+ const pm_arguments_node_t *cast = (const pm_arguments_node_t *) node;
579
+
580
+ // Visit the arguments field
581
+ const pm_node_list_t *arguments = &cast->arguments;
582
+ for (size_t index = 0; index < arguments->size; index++) {
583
+ if (!pm_visit_node(arguments->nodes[index], visitor, data)) return false;
584
+ }
585
+
586
+ break;
587
+ }
588
+ case PM_ARRAY_NODE: {
589
+ const pm_array_node_t *cast = (const pm_array_node_t *) node;
590
+
591
+ // Visit the elements field
592
+ const pm_node_list_t *elements = &cast->elements;
593
+ for (size_t index = 0; index < elements->size; index++) {
594
+ if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
595
+ }
596
+
597
+ break;
598
+ }
599
+ case PM_ARRAY_PATTERN_NODE: {
600
+ const pm_array_pattern_node_t *cast = (const pm_array_pattern_node_t *) node;
601
+
602
+ // Visit the constant field
603
+ if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)) return false;
604
+
605
+ // Visit the requireds field
606
+ const pm_node_list_t *requireds = &cast->requireds;
607
+ for (size_t index = 0; index < requireds->size; index++) {
608
+ if (!pm_visit_node(requireds->nodes[index], visitor, data)) return false;
609
+ }
610
+
611
+ // Visit the rest field
612
+ if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
613
+
614
+ // Visit the posts field
615
+ const pm_node_list_t *posts = &cast->posts;
616
+ for (size_t index = 0; index < posts->size; index++) {
617
+ if (!pm_visit_node(posts->nodes[index], visitor, data)) return false;
618
+ }
619
+
620
+ break;
621
+ }
622
+ case PM_ASSOC_NODE: {
623
+ const pm_assoc_node_t *cast = (const pm_assoc_node_t *) node;
624
+
625
+ // Visit the key field
626
+ if (!pm_visit_node((const pm_node_t *) cast->key, visitor, data)) return false;
627
+
628
+ // Visit the value field
629
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
630
+
631
+ break;
632
+ }
633
+ case PM_ASSOC_SPLAT_NODE: {
634
+ const pm_assoc_splat_node_t *cast = (const pm_assoc_splat_node_t *) node;
635
+
636
+ // Visit the value field
637
+ if (cast->value != NULL && !pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
638
+
639
+ break;
640
+ }
641
+ case PM_BACK_REFERENCE_READ_NODE:
642
+ break;
643
+ case PM_BEGIN_NODE: {
644
+ const pm_begin_node_t *cast = (const pm_begin_node_t *) node;
645
+
646
+ // Visit the statements field
647
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
648
+
649
+ // Visit the rescue_clause field
650
+ if (cast->rescue_clause != NULL && !pm_visit_node((const pm_node_t *) cast->rescue_clause, visitor, data)) return false;
651
+
652
+ // Visit the else_clause field
653
+ if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
654
+
655
+ // Visit the ensure_clause field
656
+ if (cast->ensure_clause != NULL && !pm_visit_node((const pm_node_t *) cast->ensure_clause, visitor, data)) return false;
657
+
658
+ break;
659
+ }
660
+ case PM_BLOCK_ARGUMENT_NODE: {
661
+ const pm_block_argument_node_t *cast = (const pm_block_argument_node_t *) node;
662
+
663
+ // Visit the expression field
664
+ if (cast->expression != NULL && !pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
665
+
666
+ break;
667
+ }
668
+ case PM_BLOCK_LOCAL_VARIABLE_NODE:
669
+ break;
670
+ case PM_BLOCK_NODE: {
671
+ const pm_block_node_t *cast = (const pm_block_node_t *) node;
672
+
673
+ // Visit the parameters field
674
+ if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
675
+
676
+ // Visit the body field
677
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
678
+
679
+ break;
680
+ }
681
+ case PM_BLOCK_PARAMETER_NODE:
682
+ break;
683
+ case PM_BLOCK_PARAMETERS_NODE: {
684
+ const pm_block_parameters_node_t *cast = (const pm_block_parameters_node_t *) node;
685
+
686
+ // Visit the parameters field
687
+ if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
688
+
689
+ // Visit the locals field
690
+ const pm_node_list_t *locals = &cast->locals;
691
+ for (size_t index = 0; index < locals->size; index++) {
692
+ if (!pm_visit_node(locals->nodes[index], visitor, data)) return false;
693
+ }
694
+
695
+ break;
696
+ }
697
+ case PM_BREAK_NODE: {
698
+ const pm_break_node_t *cast = (const pm_break_node_t *) node;
699
+
700
+ // Visit the arguments field
701
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
702
+
703
+ break;
704
+ }
705
+ case PM_CALL_AND_WRITE_NODE: {
706
+ const pm_call_and_write_node_t *cast = (const pm_call_and_write_node_t *) node;
707
+
708
+ // Visit the receiver field
709
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
710
+
711
+ // Visit the value field
712
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
713
+
714
+ break;
715
+ }
716
+ case PM_CALL_NODE: {
717
+ const pm_call_node_t *cast = (const pm_call_node_t *) node;
718
+
719
+ // Visit the receiver field
720
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
721
+
722
+ // Visit the arguments field
723
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
724
+
725
+ // Visit the block field
726
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
727
+
728
+ break;
729
+ }
730
+ case PM_CALL_OPERATOR_WRITE_NODE: {
731
+ const pm_call_operator_write_node_t *cast = (const pm_call_operator_write_node_t *) node;
732
+
733
+ // Visit the receiver field
734
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
735
+
736
+ // Visit the value field
737
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
738
+
739
+ break;
740
+ }
741
+ case PM_CALL_OR_WRITE_NODE: {
742
+ const pm_call_or_write_node_t *cast = (const pm_call_or_write_node_t *) node;
743
+
744
+ // Visit the receiver field
745
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
746
+
747
+ // Visit the value field
748
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
749
+
750
+ break;
751
+ }
752
+ case PM_CALL_TARGET_NODE: {
753
+ const pm_call_target_node_t *cast = (const pm_call_target_node_t *) node;
754
+
755
+ // Visit the receiver field
756
+ if (!pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
757
+
758
+ break;
759
+ }
760
+ case PM_CAPTURE_PATTERN_NODE: {
761
+ const pm_capture_pattern_node_t *cast = (const pm_capture_pattern_node_t *) node;
762
+
763
+ // Visit the value field
764
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
765
+
766
+ // Visit the target field
767
+ if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
768
+
769
+ break;
770
+ }
771
+ case PM_CASE_MATCH_NODE: {
772
+ const pm_case_match_node_t *cast = (const pm_case_match_node_t *) node;
773
+
774
+ // Visit the predicate field
775
+ if (cast->predicate != NULL && !pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
776
+
777
+ // Visit the conditions field
778
+ const pm_node_list_t *conditions = &cast->conditions;
779
+ for (size_t index = 0; index < conditions->size; index++) {
780
+ if (!pm_visit_node(conditions->nodes[index], visitor, data)) return false;
781
+ }
782
+
783
+ // Visit the else_clause field
784
+ if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
785
+
786
+ break;
787
+ }
788
+ case PM_CASE_NODE: {
789
+ const pm_case_node_t *cast = (const pm_case_node_t *) node;
790
+
791
+ // Visit the predicate field
792
+ if (cast->predicate != NULL && !pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
793
+
794
+ // Visit the conditions field
795
+ const pm_node_list_t *conditions = &cast->conditions;
796
+ for (size_t index = 0; index < conditions->size; index++) {
797
+ if (!pm_visit_node(conditions->nodes[index], visitor, data)) return false;
798
+ }
799
+
800
+ // Visit the else_clause field
801
+ if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
802
+
803
+ break;
804
+ }
805
+ case PM_CLASS_NODE: {
806
+ const pm_class_node_t *cast = (const pm_class_node_t *) node;
807
+
808
+ // Visit the constant_path field
809
+ if (!pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data)) return false;
810
+
811
+ // Visit the superclass field
812
+ if (cast->superclass != NULL && !pm_visit_node((const pm_node_t *) cast->superclass, visitor, data)) return false;
813
+
814
+ // Visit the body field
815
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
816
+
817
+ break;
818
+ }
819
+ case PM_CLASS_VARIABLE_AND_WRITE_NODE: {
820
+ const pm_class_variable_and_write_node_t *cast = (const pm_class_variable_and_write_node_t *) node;
821
+
822
+ // Visit the value field
823
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
824
+
825
+ break;
826
+ }
827
+ case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
828
+ const pm_class_variable_operator_write_node_t *cast = (const pm_class_variable_operator_write_node_t *) node;
829
+
830
+ // Visit the value field
831
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
832
+
833
+ break;
834
+ }
835
+ case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
836
+ const pm_class_variable_or_write_node_t *cast = (const pm_class_variable_or_write_node_t *) node;
837
+
838
+ // Visit the value field
839
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
840
+
841
+ break;
842
+ }
843
+ case PM_CLASS_VARIABLE_READ_NODE:
844
+ break;
845
+ case PM_CLASS_VARIABLE_TARGET_NODE:
846
+ break;
847
+ case PM_CLASS_VARIABLE_WRITE_NODE: {
848
+ const pm_class_variable_write_node_t *cast = (const pm_class_variable_write_node_t *) node;
849
+
850
+ // Visit the value field
851
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
852
+
853
+ break;
854
+ }
855
+ case PM_CONSTANT_AND_WRITE_NODE: {
856
+ const pm_constant_and_write_node_t *cast = (const pm_constant_and_write_node_t *) node;
857
+
858
+ // Visit the value field
859
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
860
+
861
+ break;
862
+ }
863
+ case PM_CONSTANT_OPERATOR_WRITE_NODE: {
864
+ const pm_constant_operator_write_node_t *cast = (const pm_constant_operator_write_node_t *) node;
865
+
866
+ // Visit the value field
867
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
868
+
869
+ break;
870
+ }
871
+ case PM_CONSTANT_OR_WRITE_NODE: {
872
+ const pm_constant_or_write_node_t *cast = (const pm_constant_or_write_node_t *) node;
873
+
874
+ // Visit the value field
875
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
876
+
877
+ break;
878
+ }
879
+ case PM_CONSTANT_PATH_AND_WRITE_NODE: {
880
+ const pm_constant_path_and_write_node_t *cast = (const pm_constant_path_and_write_node_t *) node;
881
+
882
+ // Visit the target field
883
+ if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
884
+
885
+ // Visit the value field
886
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
887
+
888
+ break;
889
+ }
890
+ case PM_CONSTANT_PATH_NODE: {
891
+ const pm_constant_path_node_t *cast = (const pm_constant_path_node_t *) node;
892
+
893
+ // Visit the parent field
894
+ if (cast->parent != NULL && !pm_visit_node((const pm_node_t *) cast->parent, visitor, data)) return false;
895
+
896
+ break;
897
+ }
898
+ case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
899
+ const pm_constant_path_operator_write_node_t *cast = (const pm_constant_path_operator_write_node_t *) node;
900
+
901
+ // Visit the target field
902
+ if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
903
+
904
+ // Visit the value field
905
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
906
+
907
+ break;
908
+ }
909
+ case PM_CONSTANT_PATH_OR_WRITE_NODE: {
910
+ const pm_constant_path_or_write_node_t *cast = (const pm_constant_path_or_write_node_t *) node;
911
+
912
+ // Visit the target field
913
+ if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
914
+
915
+ // Visit the value field
916
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
917
+
918
+ break;
919
+ }
920
+ case PM_CONSTANT_PATH_TARGET_NODE: {
921
+ const pm_constant_path_target_node_t *cast = (const pm_constant_path_target_node_t *) node;
922
+
923
+ // Visit the parent field
924
+ if (cast->parent != NULL && !pm_visit_node((const pm_node_t *) cast->parent, visitor, data)) return false;
925
+
926
+ break;
927
+ }
928
+ case PM_CONSTANT_PATH_WRITE_NODE: {
929
+ const pm_constant_path_write_node_t *cast = (const pm_constant_path_write_node_t *) node;
930
+
931
+ // Visit the target field
932
+ if (!pm_visit_node((const pm_node_t *) cast->target, visitor, data)) return false;
933
+
934
+ // Visit the value field
935
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
936
+
937
+ break;
938
+ }
939
+ case PM_CONSTANT_READ_NODE:
940
+ break;
941
+ case PM_CONSTANT_TARGET_NODE:
942
+ break;
943
+ case PM_CONSTANT_WRITE_NODE: {
944
+ const pm_constant_write_node_t *cast = (const pm_constant_write_node_t *) node;
945
+
946
+ // Visit the value field
947
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
948
+
949
+ break;
950
+ }
951
+ case PM_DEF_NODE: {
952
+ const pm_def_node_t *cast = (const pm_def_node_t *) node;
953
+
954
+ // Visit the receiver field
955
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
956
+
957
+ // Visit the parameters field
958
+ if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
959
+
960
+ // Visit the body field
961
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
962
+
963
+ break;
964
+ }
965
+ case PM_DEFINED_NODE: {
966
+ const pm_defined_node_t *cast = (const pm_defined_node_t *) node;
967
+
968
+ // Visit the value field
969
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
970
+
971
+ break;
972
+ }
973
+ case PM_ELSE_NODE: {
974
+ const pm_else_node_t *cast = (const pm_else_node_t *) node;
975
+
976
+ // Visit the statements field
977
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
978
+
979
+ break;
980
+ }
981
+ case PM_EMBEDDED_STATEMENTS_NODE: {
982
+ const pm_embedded_statements_node_t *cast = (const pm_embedded_statements_node_t *) node;
983
+
984
+ // Visit the statements field
985
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
986
+
987
+ break;
988
+ }
989
+ case PM_EMBEDDED_VARIABLE_NODE: {
990
+ const pm_embedded_variable_node_t *cast = (const pm_embedded_variable_node_t *) node;
991
+
992
+ // Visit the variable field
993
+ if (!pm_visit_node((const pm_node_t *) cast->variable, visitor, data)) return false;
994
+
995
+ break;
996
+ }
997
+ case PM_ENSURE_NODE: {
998
+ const pm_ensure_node_t *cast = (const pm_ensure_node_t *) node;
999
+
1000
+ // Visit the statements field
1001
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1002
+
1003
+ break;
1004
+ }
1005
+ case PM_ERROR_RECOVERY_NODE: {
1006
+ const pm_error_recovery_node_t *cast = (const pm_error_recovery_node_t *) node;
1007
+
1008
+ // Visit the unexpected field
1009
+ if (cast->unexpected != NULL && !pm_visit_node((const pm_node_t *) cast->unexpected, visitor, data)) return false;
1010
+
1011
+ break;
1012
+ }
1013
+ case PM_FALSE_NODE:
1014
+ break;
1015
+ case PM_FIND_PATTERN_NODE: {
1016
+ const pm_find_pattern_node_t *cast = (const pm_find_pattern_node_t *) node;
1017
+
1018
+ // Visit the constant field
1019
+ if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)) return false;
1020
+
1021
+ // Visit the left field
1022
+ if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
1023
+
1024
+ // Visit the requireds field
1025
+ const pm_node_list_t *requireds = &cast->requireds;
1026
+ for (size_t index = 0; index < requireds->size; index++) {
1027
+ if (!pm_visit_node(requireds->nodes[index], visitor, data)) return false;
1028
+ }
1029
+
1030
+ // Visit the right field
1031
+ if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
1032
+
1033
+ break;
1034
+ }
1035
+ case PM_FLIP_FLOP_NODE: {
1036
+ const pm_flip_flop_node_t *cast = (const pm_flip_flop_node_t *) node;
1037
+
1038
+ // Visit the left field
1039
+ if (cast->left != NULL && !pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
1040
+
1041
+ // Visit the right field
1042
+ if (cast->right != NULL && !pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
1043
+
1044
+ break;
1045
+ }
1046
+ case PM_FLOAT_NODE:
1047
+ break;
1048
+ case PM_FOR_NODE: {
1049
+ const pm_for_node_t *cast = (const pm_for_node_t *) node;
1050
+
1051
+ // Visit the index field
1052
+ if (!pm_visit_node((const pm_node_t *) cast->index, visitor, data)) return false;
1053
+
1054
+ // Visit the collection field
1055
+ if (!pm_visit_node((const pm_node_t *) cast->collection, visitor, data)) return false;
1056
+
1057
+ // Visit the statements field
1058
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1059
+
1060
+ break;
1061
+ }
1062
+ case PM_FORWARDING_ARGUMENTS_NODE:
1063
+ break;
1064
+ case PM_FORWARDING_PARAMETER_NODE:
1065
+ break;
1066
+ case PM_FORWARDING_SUPER_NODE: {
1067
+ const pm_forwarding_super_node_t *cast = (const pm_forwarding_super_node_t *) node;
1068
+
1069
+ // Visit the block field
1070
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1071
+
1072
+ break;
1073
+ }
1074
+ case PM_GLOBAL_VARIABLE_AND_WRITE_NODE: {
1075
+ const pm_global_variable_and_write_node_t *cast = (const pm_global_variable_and_write_node_t *) node;
1076
+
1077
+ // Visit the value field
1078
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1079
+
1080
+ break;
1081
+ }
1082
+ case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
1083
+ const pm_global_variable_operator_write_node_t *cast = (const pm_global_variable_operator_write_node_t *) node;
1084
+
1085
+ // Visit the value field
1086
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1087
+
1088
+ break;
1089
+ }
1090
+ case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
1091
+ const pm_global_variable_or_write_node_t *cast = (const pm_global_variable_or_write_node_t *) node;
1092
+
1093
+ // Visit the value field
1094
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1095
+
1096
+ break;
1097
+ }
1098
+ case PM_GLOBAL_VARIABLE_READ_NODE:
1099
+ break;
1100
+ case PM_GLOBAL_VARIABLE_TARGET_NODE:
1101
+ break;
1102
+ case PM_GLOBAL_VARIABLE_WRITE_NODE: {
1103
+ const pm_global_variable_write_node_t *cast = (const pm_global_variable_write_node_t *) node;
1104
+
1105
+ // Visit the value field
1106
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1107
+
1108
+ break;
1109
+ }
1110
+ case PM_HASH_NODE: {
1111
+ const pm_hash_node_t *cast = (const pm_hash_node_t *) node;
1112
+
1113
+ // Visit the elements field
1114
+ const pm_node_list_t *elements = &cast->elements;
1115
+ for (size_t index = 0; index < elements->size; index++) {
1116
+ if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
1117
+ }
1118
+
1119
+ break;
1120
+ }
1121
+ case PM_HASH_PATTERN_NODE: {
1122
+ const pm_hash_pattern_node_t *cast = (const pm_hash_pattern_node_t *) node;
1123
+
1124
+ // Visit the constant field
1125
+ if (cast->constant != NULL && !pm_visit_node((const pm_node_t *) cast->constant, visitor, data)) return false;
1126
+
1127
+ // Visit the elements field
1128
+ const pm_node_list_t *elements = &cast->elements;
1129
+ for (size_t index = 0; index < elements->size; index++) {
1130
+ if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
1131
+ }
1132
+
1133
+ // Visit the rest field
1134
+ if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1135
+
1136
+ break;
1137
+ }
1138
+ case PM_IF_NODE: {
1139
+ const pm_if_node_t *cast = (const pm_if_node_t *) node;
1140
+
1141
+ // Visit the predicate field
1142
+ if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1143
+
1144
+ // Visit the statements field
1145
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1146
+
1147
+ // Visit the subsequent field
1148
+ if (cast->subsequent != NULL && !pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data)) return false;
1149
+
1150
+ break;
1151
+ }
1152
+ case PM_IMAGINARY_NODE: {
1153
+ const pm_imaginary_node_t *cast = (const pm_imaginary_node_t *) node;
1154
+
1155
+ // Visit the numeric field
1156
+ if (!pm_visit_node((const pm_node_t *) cast->numeric, visitor, data)) return false;
1157
+
1158
+ break;
1159
+ }
1160
+ case PM_IMPLICIT_NODE: {
1161
+ const pm_implicit_node_t *cast = (const pm_implicit_node_t *) node;
1162
+
1163
+ // Visit the value field
1164
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1165
+
1166
+ break;
1167
+ }
1168
+ case PM_IMPLICIT_REST_NODE:
1169
+ break;
1170
+ case PM_IN_NODE: {
1171
+ const pm_in_node_t *cast = (const pm_in_node_t *) node;
1172
+
1173
+ // Visit the pattern field
1174
+ if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return false;
1175
+
1176
+ // Visit the statements field
1177
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1178
+
1179
+ break;
1180
+ }
1181
+ case PM_INDEX_AND_WRITE_NODE: {
1182
+ const pm_index_and_write_node_t *cast = (const pm_index_and_write_node_t *) node;
1183
+
1184
+ // Visit the receiver field
1185
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1186
+
1187
+ // Visit the arguments field
1188
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1189
+
1190
+ // Visit the block field
1191
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1192
+
1193
+ // Visit the value field
1194
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1195
+
1196
+ break;
1197
+ }
1198
+ case PM_INDEX_OPERATOR_WRITE_NODE: {
1199
+ const pm_index_operator_write_node_t *cast = (const pm_index_operator_write_node_t *) node;
1200
+
1201
+ // Visit the receiver field
1202
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1203
+
1204
+ // Visit the arguments field
1205
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1206
+
1207
+ // Visit the block field
1208
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1209
+
1210
+ // Visit the value field
1211
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1212
+
1213
+ break;
1214
+ }
1215
+ case PM_INDEX_OR_WRITE_NODE: {
1216
+ const pm_index_or_write_node_t *cast = (const pm_index_or_write_node_t *) node;
1217
+
1218
+ // Visit the receiver field
1219
+ if (cast->receiver != NULL && !pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1220
+
1221
+ // Visit the arguments field
1222
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1223
+
1224
+ // Visit the block field
1225
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1226
+
1227
+ // Visit the value field
1228
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1229
+
1230
+ break;
1231
+ }
1232
+ case PM_INDEX_TARGET_NODE: {
1233
+ const pm_index_target_node_t *cast = (const pm_index_target_node_t *) node;
1234
+
1235
+ // Visit the receiver field
1236
+ if (!pm_visit_node((const pm_node_t *) cast->receiver, visitor, data)) return false;
1237
+
1238
+ // Visit the arguments field
1239
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1240
+
1241
+ // Visit the block field
1242
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1243
+
1244
+ break;
1245
+ }
1246
+ case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
1247
+ const pm_instance_variable_and_write_node_t *cast = (const pm_instance_variable_and_write_node_t *) node;
1248
+
1249
+ // Visit the value field
1250
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1251
+
1252
+ break;
1253
+ }
1254
+ case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
1255
+ const pm_instance_variable_operator_write_node_t *cast = (const pm_instance_variable_operator_write_node_t *) node;
1256
+
1257
+ // Visit the value field
1258
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1259
+
1260
+ break;
1261
+ }
1262
+ case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
1263
+ const pm_instance_variable_or_write_node_t *cast = (const pm_instance_variable_or_write_node_t *) node;
1264
+
1265
+ // Visit the value field
1266
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1267
+
1268
+ break;
1269
+ }
1270
+ case PM_INSTANCE_VARIABLE_READ_NODE:
1271
+ break;
1272
+ case PM_INSTANCE_VARIABLE_TARGET_NODE:
1273
+ break;
1274
+ case PM_INSTANCE_VARIABLE_WRITE_NODE: {
1275
+ const pm_instance_variable_write_node_t *cast = (const pm_instance_variable_write_node_t *) node;
1276
+
1277
+ // Visit the value field
1278
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1279
+
1280
+ break;
1281
+ }
1282
+ case PM_INTEGER_NODE:
1283
+ break;
1284
+ case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
1285
+ const pm_interpolated_match_last_line_node_t *cast = (const pm_interpolated_match_last_line_node_t *) node;
1286
+
1287
+ // Visit the parts field
1288
+ const pm_node_list_t *parts = &cast->parts;
1289
+ for (size_t index = 0; index < parts->size; index++) {
1290
+ if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1291
+ }
1292
+
1293
+ break;
1294
+ }
1295
+ case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
1296
+ const pm_interpolated_regular_expression_node_t *cast = (const pm_interpolated_regular_expression_node_t *) node;
1297
+
1298
+ // Visit the parts field
1299
+ const pm_node_list_t *parts = &cast->parts;
1300
+ for (size_t index = 0; index < parts->size; index++) {
1301
+ if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1302
+ }
1303
+
1304
+ break;
1305
+ }
1306
+ case PM_INTERPOLATED_STRING_NODE: {
1307
+ const pm_interpolated_string_node_t *cast = (const pm_interpolated_string_node_t *) node;
1308
+
1309
+ // Visit the parts field
1310
+ const pm_node_list_t *parts = &cast->parts;
1311
+ for (size_t index = 0; index < parts->size; index++) {
1312
+ if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1313
+ }
1314
+
1315
+ break;
1316
+ }
1317
+ case PM_INTERPOLATED_SYMBOL_NODE: {
1318
+ const pm_interpolated_symbol_node_t *cast = (const pm_interpolated_symbol_node_t *) node;
1319
+
1320
+ // Visit the parts field
1321
+ const pm_node_list_t *parts = &cast->parts;
1322
+ for (size_t index = 0; index < parts->size; index++) {
1323
+ if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1324
+ }
1325
+
1326
+ break;
1327
+ }
1328
+ case PM_INTERPOLATED_X_STRING_NODE: {
1329
+ const pm_interpolated_x_string_node_t *cast = (const pm_interpolated_x_string_node_t *) node;
1330
+
1331
+ // Visit the parts field
1332
+ const pm_node_list_t *parts = &cast->parts;
1333
+ for (size_t index = 0; index < parts->size; index++) {
1334
+ if (!pm_visit_node(parts->nodes[index], visitor, data)) return false;
1335
+ }
1336
+
1337
+ break;
1338
+ }
1339
+ case PM_IT_LOCAL_VARIABLE_READ_NODE:
1340
+ break;
1341
+ case PM_IT_PARAMETERS_NODE:
1342
+ break;
1343
+ case PM_KEYWORD_HASH_NODE: {
1344
+ const pm_keyword_hash_node_t *cast = (const pm_keyword_hash_node_t *) node;
1345
+
1346
+ // Visit the elements field
1347
+ const pm_node_list_t *elements = &cast->elements;
1348
+ for (size_t index = 0; index < elements->size; index++) {
1349
+ if (!pm_visit_node(elements->nodes[index], visitor, data)) return false;
1350
+ }
1351
+
1352
+ break;
1353
+ }
1354
+ case PM_KEYWORD_REST_PARAMETER_NODE:
1355
+ break;
1356
+ case PM_LAMBDA_NODE: {
1357
+ const pm_lambda_node_t *cast = (const pm_lambda_node_t *) node;
1358
+
1359
+ // Visit the parameters field
1360
+ if (cast->parameters != NULL && !pm_visit_node((const pm_node_t *) cast->parameters, visitor, data)) return false;
1361
+
1362
+ // Visit the body field
1363
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1364
+
1365
+ break;
1366
+ }
1367
+ case PM_LOCAL_VARIABLE_AND_WRITE_NODE: {
1368
+ const pm_local_variable_and_write_node_t *cast = (const pm_local_variable_and_write_node_t *) node;
1369
+
1370
+ // Visit the value field
1371
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1372
+
1373
+ break;
1374
+ }
1375
+ case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
1376
+ const pm_local_variable_operator_write_node_t *cast = (const pm_local_variable_operator_write_node_t *) node;
1377
+
1378
+ // Visit the value field
1379
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1380
+
1381
+ break;
1382
+ }
1383
+ case PM_LOCAL_VARIABLE_OR_WRITE_NODE: {
1384
+ const pm_local_variable_or_write_node_t *cast = (const pm_local_variable_or_write_node_t *) node;
1385
+
1386
+ // Visit the value field
1387
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1388
+
1389
+ break;
1390
+ }
1391
+ case PM_LOCAL_VARIABLE_READ_NODE:
1392
+ break;
1393
+ case PM_LOCAL_VARIABLE_TARGET_NODE:
1394
+ break;
1395
+ case PM_LOCAL_VARIABLE_WRITE_NODE: {
1396
+ const pm_local_variable_write_node_t *cast = (const pm_local_variable_write_node_t *) node;
1397
+
1398
+ // Visit the value field
1399
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1400
+
1401
+ break;
1402
+ }
1403
+ case PM_MATCH_LAST_LINE_NODE:
1404
+ break;
1405
+ case PM_MATCH_PREDICATE_NODE: {
1406
+ const pm_match_predicate_node_t *cast = (const pm_match_predicate_node_t *) node;
1407
+
1408
+ // Visit the value field
1409
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1410
+
1411
+ // Visit the pattern field
1412
+ if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return false;
1413
+
1414
+ break;
1415
+ }
1416
+ case PM_MATCH_REQUIRED_NODE: {
1417
+ const pm_match_required_node_t *cast = (const pm_match_required_node_t *) node;
1418
+
1419
+ // Visit the value field
1420
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1421
+
1422
+ // Visit the pattern field
1423
+ if (!pm_visit_node((const pm_node_t *) cast->pattern, visitor, data)) return false;
1424
+
1425
+ break;
1426
+ }
1427
+ case PM_MATCH_WRITE_NODE: {
1428
+ const pm_match_write_node_t *cast = (const pm_match_write_node_t *) node;
1429
+
1430
+ // Visit the call field
1431
+ if (!pm_visit_node((const pm_node_t *) cast->call, visitor, data)) return false;
1432
+
1433
+ // Visit the targets field
1434
+ const pm_node_list_t *targets = &cast->targets;
1435
+ for (size_t index = 0; index < targets->size; index++) {
1436
+ if (!pm_visit_node(targets->nodes[index], visitor, data)) return false;
1437
+ }
1438
+
1439
+ break;
1440
+ }
1441
+ case PM_MODULE_NODE: {
1442
+ const pm_module_node_t *cast = (const pm_module_node_t *) node;
1443
+
1444
+ // Visit the constant_path field
1445
+ if (!pm_visit_node((const pm_node_t *) cast->constant_path, visitor, data)) return false;
1446
+
1447
+ // Visit the body field
1448
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1449
+
1450
+ break;
1451
+ }
1452
+ case PM_MULTI_TARGET_NODE: {
1453
+ const pm_multi_target_node_t *cast = (const pm_multi_target_node_t *) node;
1454
+
1455
+ // Visit the lefts field
1456
+ const pm_node_list_t *lefts = &cast->lefts;
1457
+ for (size_t index = 0; index < lefts->size; index++) {
1458
+ if (!pm_visit_node(lefts->nodes[index], visitor, data)) return false;
1459
+ }
1460
+
1461
+ // Visit the rest field
1462
+ if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1463
+
1464
+ // Visit the rights field
1465
+ const pm_node_list_t *rights = &cast->rights;
1466
+ for (size_t index = 0; index < rights->size; index++) {
1467
+ if (!pm_visit_node(rights->nodes[index], visitor, data)) return false;
1468
+ }
1469
+
1470
+ break;
1471
+ }
1472
+ case PM_MULTI_WRITE_NODE: {
1473
+ const pm_multi_write_node_t *cast = (const pm_multi_write_node_t *) node;
1474
+
1475
+ // Visit the lefts field
1476
+ const pm_node_list_t *lefts = &cast->lefts;
1477
+ for (size_t index = 0; index < lefts->size; index++) {
1478
+ if (!pm_visit_node(lefts->nodes[index], visitor, data)) return false;
1479
+ }
1480
+
1481
+ // Visit the rest field
1482
+ if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1483
+
1484
+ // Visit the rights field
1485
+ const pm_node_list_t *rights = &cast->rights;
1486
+ for (size_t index = 0; index < rights->size; index++) {
1487
+ if (!pm_visit_node(rights->nodes[index], visitor, data)) return false;
1488
+ }
1489
+
1490
+ // Visit the value field
1491
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1492
+
1493
+ break;
1494
+ }
1495
+ case PM_NEXT_NODE: {
1496
+ const pm_next_node_t *cast = (const pm_next_node_t *) node;
1497
+
1498
+ // Visit the arguments field
1499
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1500
+
1501
+ break;
1502
+ }
1503
+ case PM_NIL_NODE:
1504
+ break;
1505
+ case PM_NO_BLOCK_PARAMETER_NODE:
1506
+ break;
1507
+ case PM_NO_KEYWORDS_PARAMETER_NODE:
1508
+ break;
1509
+ case PM_NUMBERED_PARAMETERS_NODE:
1510
+ break;
1511
+ case PM_NUMBERED_REFERENCE_READ_NODE:
1512
+ break;
1513
+ case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
1514
+ const pm_optional_keyword_parameter_node_t *cast = (const pm_optional_keyword_parameter_node_t *) node;
1515
+
1516
+ // Visit the value field
1517
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1518
+
1519
+ break;
1520
+ }
1521
+ case PM_OPTIONAL_PARAMETER_NODE: {
1522
+ const pm_optional_parameter_node_t *cast = (const pm_optional_parameter_node_t *) node;
1523
+
1524
+ // Visit the value field
1525
+ if (!pm_visit_node((const pm_node_t *) cast->value, visitor, data)) return false;
1526
+
1527
+ break;
1528
+ }
1529
+ case PM_OR_NODE: {
1530
+ const pm_or_node_t *cast = (const pm_or_node_t *) node;
1531
+
1532
+ // Visit the left field
1533
+ if (!pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
1534
+
1535
+ // Visit the right field
1536
+ if (!pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
1537
+
1538
+ break;
1539
+ }
1540
+ case PM_PARAMETERS_NODE: {
1541
+ const pm_parameters_node_t *cast = (const pm_parameters_node_t *) node;
1542
+
1543
+ // Visit the requireds field
1544
+ const pm_node_list_t *requireds = &cast->requireds;
1545
+ for (size_t index = 0; index < requireds->size; index++) {
1546
+ if (!pm_visit_node(requireds->nodes[index], visitor, data)) return false;
1547
+ }
1548
+
1549
+ // Visit the optionals field
1550
+ const pm_node_list_t *optionals = &cast->optionals;
1551
+ for (size_t index = 0; index < optionals->size; index++) {
1552
+ if (!pm_visit_node(optionals->nodes[index], visitor, data)) return false;
1553
+ }
1554
+
1555
+ // Visit the rest field
1556
+ if (cast->rest != NULL && !pm_visit_node((const pm_node_t *) cast->rest, visitor, data)) return false;
1557
+
1558
+ // Visit the posts field
1559
+ const pm_node_list_t *posts = &cast->posts;
1560
+ for (size_t index = 0; index < posts->size; index++) {
1561
+ if (!pm_visit_node(posts->nodes[index], visitor, data)) return false;
1562
+ }
1563
+
1564
+ // Visit the keywords field
1565
+ const pm_node_list_t *keywords = &cast->keywords;
1566
+ for (size_t index = 0; index < keywords->size; index++) {
1567
+ if (!pm_visit_node(keywords->nodes[index], visitor, data)) return false;
1568
+ }
1569
+
1570
+ // Visit the keyword_rest field
1571
+ if (cast->keyword_rest != NULL && !pm_visit_node((const pm_node_t *) cast->keyword_rest, visitor, data)) return false;
1572
+
1573
+ // Visit the block field
1574
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1575
+
1576
+ break;
1577
+ }
1578
+ case PM_PARENTHESES_NODE: {
1579
+ const pm_parentheses_node_t *cast = (const pm_parentheses_node_t *) node;
1580
+
1581
+ // Visit the body field
1582
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1583
+
1584
+ break;
1585
+ }
1586
+ case PM_PINNED_EXPRESSION_NODE: {
1587
+ const pm_pinned_expression_node_t *cast = (const pm_pinned_expression_node_t *) node;
1588
+
1589
+ // Visit the expression field
1590
+ if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1591
+
1592
+ break;
1593
+ }
1594
+ case PM_PINNED_VARIABLE_NODE: {
1595
+ const pm_pinned_variable_node_t *cast = (const pm_pinned_variable_node_t *) node;
1596
+
1597
+ // Visit the variable field
1598
+ if (!pm_visit_node((const pm_node_t *) cast->variable, visitor, data)) return false;
1599
+
1600
+ break;
1601
+ }
1602
+ case PM_POST_EXECUTION_NODE: {
1603
+ const pm_post_execution_node_t *cast = (const pm_post_execution_node_t *) node;
1604
+
1605
+ // Visit the statements field
1606
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1607
+
1608
+ break;
1609
+ }
1610
+ case PM_PRE_EXECUTION_NODE: {
1611
+ const pm_pre_execution_node_t *cast = (const pm_pre_execution_node_t *) node;
1612
+
1613
+ // Visit the statements field
1614
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1615
+
1616
+ break;
1617
+ }
1618
+ case PM_PROGRAM_NODE: {
1619
+ const pm_program_node_t *cast = (const pm_program_node_t *) node;
1620
+
1621
+ // Visit the statements field
1622
+ if (!pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1623
+
1624
+ break;
1625
+ }
1626
+ case PM_RANGE_NODE: {
1627
+ const pm_range_node_t *cast = (const pm_range_node_t *) node;
1628
+
1629
+ // Visit the left field
1630
+ if (cast->left != NULL && !pm_visit_node((const pm_node_t *) cast->left, visitor, data)) return false;
1631
+
1632
+ // Visit the right field
1633
+ if (cast->right != NULL && !pm_visit_node((const pm_node_t *) cast->right, visitor, data)) return false;
1634
+
1635
+ break;
1636
+ }
1637
+ case PM_RATIONAL_NODE:
1638
+ break;
1639
+ case PM_REDO_NODE:
1640
+ break;
1641
+ case PM_REGULAR_EXPRESSION_NODE:
1642
+ break;
1643
+ case PM_REQUIRED_KEYWORD_PARAMETER_NODE:
1644
+ break;
1645
+ case PM_REQUIRED_PARAMETER_NODE:
1646
+ break;
1647
+ case PM_RESCUE_MODIFIER_NODE: {
1648
+ const pm_rescue_modifier_node_t *cast = (const pm_rescue_modifier_node_t *) node;
1649
+
1650
+ // Visit the expression field
1651
+ if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1652
+
1653
+ // Visit the rescue_expression field
1654
+ if (!pm_visit_node((const pm_node_t *) cast->rescue_expression, visitor, data)) return false;
1655
+
1656
+ break;
1657
+ }
1658
+ case PM_RESCUE_NODE: {
1659
+ const pm_rescue_node_t *cast = (const pm_rescue_node_t *) node;
1660
+
1661
+ // Visit the exceptions field
1662
+ const pm_node_list_t *exceptions = &cast->exceptions;
1663
+ for (size_t index = 0; index < exceptions->size; index++) {
1664
+ if (!pm_visit_node(exceptions->nodes[index], visitor, data)) return false;
1665
+ }
1666
+
1667
+ // Visit the reference field
1668
+ if (cast->reference != NULL && !pm_visit_node((const pm_node_t *) cast->reference, visitor, data)) return false;
1669
+
1670
+ // Visit the statements field
1671
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1672
+
1673
+ // Visit the subsequent field
1674
+ if (cast->subsequent != NULL && !pm_visit_node((const pm_node_t *) cast->subsequent, visitor, data)) return false;
1675
+
1676
+ break;
1677
+ }
1678
+ case PM_REST_PARAMETER_NODE:
1679
+ break;
1680
+ case PM_RETRY_NODE:
1681
+ break;
1682
+ case PM_RETURN_NODE: {
1683
+ const pm_return_node_t *cast = (const pm_return_node_t *) node;
1684
+
1685
+ // Visit the arguments field
1686
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1687
+
1688
+ break;
1689
+ }
1690
+ case PM_SELF_NODE:
1691
+ break;
1692
+ case PM_SHAREABLE_CONSTANT_NODE: {
1693
+ const pm_shareable_constant_node_t *cast = (const pm_shareable_constant_node_t *) node;
1694
+
1695
+ // Visit the write field
1696
+ if (!pm_visit_node((const pm_node_t *) cast->write, visitor, data)) return false;
1697
+
1698
+ break;
1699
+ }
1700
+ case PM_SINGLETON_CLASS_NODE: {
1701
+ const pm_singleton_class_node_t *cast = (const pm_singleton_class_node_t *) node;
1702
+
1703
+ // Visit the expression field
1704
+ if (!pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1705
+
1706
+ // Visit the body field
1707
+ if (cast->body != NULL && !pm_visit_node((const pm_node_t *) cast->body, visitor, data)) return false;
1708
+
1709
+ break;
1710
+ }
1711
+ case PM_SOURCE_ENCODING_NODE:
1712
+ break;
1713
+ case PM_SOURCE_FILE_NODE:
1714
+ break;
1715
+ case PM_SOURCE_LINE_NODE:
1716
+ break;
1717
+ case PM_SPLAT_NODE: {
1718
+ const pm_splat_node_t *cast = (const pm_splat_node_t *) node;
1719
+
1720
+ // Visit the expression field
1721
+ if (cast->expression != NULL && !pm_visit_node((const pm_node_t *) cast->expression, visitor, data)) return false;
1722
+
1723
+ break;
1724
+ }
1725
+ case PM_STATEMENTS_NODE: {
1726
+ const pm_statements_node_t *cast = (const pm_statements_node_t *) node;
1727
+
1728
+ // Visit the body field
1729
+ const pm_node_list_t *body = &cast->body;
1730
+ for (size_t index = 0; index < body->size; index++) {
1731
+ if (!pm_visit_node(body->nodes[index], visitor, data)) return false;
1732
+ }
1733
+
1734
+ break;
1735
+ }
1736
+ case PM_STRING_NODE:
1737
+ break;
1738
+ case PM_SUPER_NODE: {
1739
+ const pm_super_node_t *cast = (const pm_super_node_t *) node;
1740
+
1741
+ // Visit the arguments field
1742
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1743
+
1744
+ // Visit the block field
1745
+ if (cast->block != NULL && !pm_visit_node((const pm_node_t *) cast->block, visitor, data)) return false;
1746
+
1747
+ break;
1748
+ }
1749
+ case PM_SYMBOL_NODE:
1750
+ break;
1751
+ case PM_TRUE_NODE:
1752
+ break;
1753
+ case PM_UNDEF_NODE: {
1754
+ const pm_undef_node_t *cast = (const pm_undef_node_t *) node;
1755
+
1756
+ // Visit the names field
1757
+ const pm_node_list_t *names = &cast->names;
1758
+ for (size_t index = 0; index < names->size; index++) {
1759
+ if (!pm_visit_node(names->nodes[index], visitor, data)) return false;
1760
+ }
1761
+
1762
+ break;
1763
+ }
1764
+ case PM_UNLESS_NODE: {
1765
+ const pm_unless_node_t *cast = (const pm_unless_node_t *) node;
1766
+
1767
+ // Visit the predicate field
1768
+ if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1769
+
1770
+ // Visit the statements field
1771
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1772
+
1773
+ // Visit the else_clause field
1774
+ if (cast->else_clause != NULL && !pm_visit_node((const pm_node_t *) cast->else_clause, visitor, data)) return false;
1775
+
1776
+ break;
1777
+ }
1778
+ case PM_UNTIL_NODE: {
1779
+ const pm_until_node_t *cast = (const pm_until_node_t *) node;
1780
+
1781
+ // Visit the predicate field
1782
+ if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1783
+
1784
+ // Visit the statements field
1785
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1786
+
1787
+ break;
1788
+ }
1789
+ case PM_WHEN_NODE: {
1790
+ const pm_when_node_t *cast = (const pm_when_node_t *) node;
1791
+
1792
+ // Visit the conditions field
1793
+ const pm_node_list_t *conditions = &cast->conditions;
1794
+ for (size_t index = 0; index < conditions->size; index++) {
1795
+ if (!pm_visit_node(conditions->nodes[index], visitor, data)) return false;
1796
+ }
1797
+
1798
+ // Visit the statements field
1799
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1800
+
1801
+ break;
1802
+ }
1803
+ case PM_WHILE_NODE: {
1804
+ const pm_while_node_t *cast = (const pm_while_node_t *) node;
1805
+
1806
+ // Visit the predicate field
1807
+ if (!pm_visit_node((const pm_node_t *) cast->predicate, visitor, data)) return false;
1808
+
1809
+ // Visit the statements field
1810
+ if (cast->statements != NULL && !pm_visit_node((const pm_node_t *) cast->statements, visitor, data)) return false;
1811
+
1812
+ break;
1813
+ }
1814
+ case PM_X_STRING_NODE:
1815
+ break;
1816
+ case PM_YIELD_NODE: {
1817
+ const pm_yield_node_t *cast = (const pm_yield_node_t *) node;
1818
+
1819
+ // Visit the arguments field
1820
+ if (cast->arguments != NULL && !pm_visit_node((const pm_node_t *) cast->arguments, visitor, data)) return false;
1821
+
1822
+ break;
1823
+ }
1824
+ case PM_SCOPE_NODE:
1825
+ break;
1826
+ }
1827
+
1828
+ return true;
1829
+ }
1830
+
1831
+ /**
1832
+ * Allocate and initialize a new AliasGlobalVariableNode node.
1833
+ */
1834
+ pm_alias_global_variable_node_t *
1835
+ pm_alias_global_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *new_name, struct pm_node *old_name, pm_location_t keyword_loc) {
1836
+ pm_alias_global_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_alias_global_variable_node_t);
1837
+
1838
+ *node = (pm_alias_global_variable_node_t) {
1839
+ .base = { .type = PM_ALIAS_GLOBAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
1840
+ .new_name = new_name,
1841
+ .old_name = old_name,
1842
+ .keyword_loc = keyword_loc
1843
+ };
1844
+
1845
+ return node;
1846
+ }
1847
+
1848
+ /**
1849
+ * Allocate and initialize a new AliasMethodNode node.
1850
+ */
1851
+ pm_alias_method_node_t *
1852
+ pm_alias_method_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *new_name, struct pm_node *old_name, pm_location_t keyword_loc) {
1853
+ pm_alias_method_node_t *node = PM_ARENA_ALLOC(arena, pm_alias_method_node_t);
1854
+
1855
+ *node = (pm_alias_method_node_t) {
1856
+ .base = { .type = PM_ALIAS_METHOD_NODE, .flags = flags, .node_id = node_id, .location = location },
1857
+ .new_name = new_name,
1858
+ .old_name = old_name,
1859
+ .keyword_loc = keyword_loc
1860
+ };
1861
+
1862
+ return node;
1863
+ }
1864
+
1865
+ /**
1866
+ * Allocate and initialize a new AlternationPatternNode node.
1867
+ */
1868
+ pm_alternation_pattern_node_t *
1869
+ pm_alternation_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
1870
+ pm_alternation_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_alternation_pattern_node_t);
1871
+
1872
+ *node = (pm_alternation_pattern_node_t) {
1873
+ .base = { .type = PM_ALTERNATION_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
1874
+ .left = left,
1875
+ .right = right,
1876
+ .operator_loc = operator_loc
1877
+ };
1878
+
1879
+ return node;
1880
+ }
1881
+
1882
+ /**
1883
+ * Allocate and initialize a new AndNode node.
1884
+ */
1885
+ pm_and_node_t *
1886
+ pm_and_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
1887
+ pm_and_node_t *node = PM_ARENA_ALLOC(arena, pm_and_node_t);
1888
+
1889
+ *node = (pm_and_node_t) {
1890
+ .base = { .type = PM_AND_NODE, .flags = flags, .node_id = node_id, .location = location },
1891
+ .left = left,
1892
+ .right = right,
1893
+ .operator_loc = operator_loc
1894
+ };
1895
+
1896
+ return node;
1897
+ }
1898
+
1899
+ /**
1900
+ * Allocate and initialize a new ArgumentsNode node.
1901
+ */
1902
+ pm_arguments_node_t *
1903
+ pm_arguments_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t arguments) {
1904
+ pm_arguments_node_t *node = PM_ARENA_ALLOC(arena, pm_arguments_node_t);
1905
+
1906
+ *node = (pm_arguments_node_t) {
1907
+ .base = { .type = PM_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
1908
+ .arguments = arguments
1909
+ };
1910
+
1911
+ return node;
1912
+ }
1913
+
1914
+ /**
1915
+ * Allocate and initialize a new ArrayNode node.
1916
+ */
1917
+ pm_array_node_t *
1918
+ pm_array_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t elements, pm_location_t opening_loc, pm_location_t closing_loc) {
1919
+ pm_array_node_t *node = PM_ARENA_ALLOC(arena, pm_array_node_t);
1920
+
1921
+ *node = (pm_array_node_t) {
1922
+ .base = { .type = PM_ARRAY_NODE, .flags = flags, .node_id = node_id, .location = location },
1923
+ .elements = elements,
1924
+ .opening_loc = opening_loc,
1925
+ .closing_loc = closing_loc
1926
+ };
1927
+
1928
+ return node;
1929
+ }
1930
+
1931
+ /**
1932
+ * Allocate and initialize a new ArrayPatternNode node.
1933
+ */
1934
+ pm_array_pattern_node_t *
1935
+ pm_array_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, pm_node_list_t requireds, struct pm_node *rest, pm_node_list_t posts, pm_location_t opening_loc, pm_location_t closing_loc) {
1936
+ pm_array_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_array_pattern_node_t);
1937
+
1938
+ *node = (pm_array_pattern_node_t) {
1939
+ .base = { .type = PM_ARRAY_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
1940
+ .constant = constant,
1941
+ .requireds = requireds,
1942
+ .rest = rest,
1943
+ .posts = posts,
1944
+ .opening_loc = opening_loc,
1945
+ .closing_loc = closing_loc
1946
+ };
1947
+
1948
+ return node;
1949
+ }
1950
+
1951
+ /**
1952
+ * Allocate and initialize a new AssocNode node.
1953
+ */
1954
+ pm_assoc_node_t *
1955
+ pm_assoc_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *key, struct pm_node *value, pm_location_t operator_loc) {
1956
+ pm_assoc_node_t *node = PM_ARENA_ALLOC(arena, pm_assoc_node_t);
1957
+
1958
+ *node = (pm_assoc_node_t) {
1959
+ .base = { .type = PM_ASSOC_NODE, .flags = flags, .node_id = node_id, .location = location },
1960
+ .key = key,
1961
+ .value = value,
1962
+ .operator_loc = operator_loc
1963
+ };
1964
+
1965
+ return node;
1966
+ }
1967
+
1968
+ /**
1969
+ * Allocate and initialize a new AssocSplatNode node.
1970
+ */
1971
+ pm_assoc_splat_node_t *
1972
+ pm_assoc_splat_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, pm_location_t operator_loc) {
1973
+ pm_assoc_splat_node_t *node = PM_ARENA_ALLOC(arena, pm_assoc_splat_node_t);
1974
+
1975
+ *node = (pm_assoc_splat_node_t) {
1976
+ .base = { .type = PM_ASSOC_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location },
1977
+ .value = value,
1978
+ .operator_loc = operator_loc
1979
+ };
1980
+
1981
+ return node;
1982
+ }
1983
+
1984
+ /**
1985
+ * Allocate and initialize a new BackReferenceReadNode node.
1986
+ */
1987
+ pm_back_reference_read_node_t *
1988
+ pm_back_reference_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
1989
+ pm_back_reference_read_node_t *node = PM_ARENA_ALLOC(arena, pm_back_reference_read_node_t);
1990
+
1991
+ *node = (pm_back_reference_read_node_t) {
1992
+ .base = { .type = PM_BACK_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
1993
+ .name = name
1994
+ };
1995
+
1996
+ return node;
1997
+ }
1998
+
1999
+ /**
2000
+ * Allocate and initialize a new BeginNode node.
2001
+ */
2002
+ pm_begin_node_t *
2003
+ pm_begin_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t begin_keyword_loc, struct pm_statements_node *statements, struct pm_rescue_node *rescue_clause, struct pm_else_node *else_clause, struct pm_ensure_node *ensure_clause, pm_location_t end_keyword_loc) {
2004
+ pm_begin_node_t *node = PM_ARENA_ALLOC(arena, pm_begin_node_t);
2005
+
2006
+ *node = (pm_begin_node_t) {
2007
+ .base = { .type = PM_BEGIN_NODE, .flags = flags, .node_id = node_id, .location = location },
2008
+ .begin_keyword_loc = begin_keyword_loc,
2009
+ .statements = statements,
2010
+ .rescue_clause = rescue_clause,
2011
+ .else_clause = else_clause,
2012
+ .ensure_clause = ensure_clause,
2013
+ .end_keyword_loc = end_keyword_loc
2014
+ };
2015
+
2016
+ return node;
2017
+ }
2018
+
2019
+ /**
2020
+ * Allocate and initialize a new BlockArgumentNode node.
2021
+ */
2022
+ pm_block_argument_node_t *
2023
+ pm_block_argument_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t operator_loc) {
2024
+ pm_block_argument_node_t *node = PM_ARENA_ALLOC(arena, pm_block_argument_node_t);
2025
+
2026
+ *node = (pm_block_argument_node_t) {
2027
+ .base = { .type = PM_BLOCK_ARGUMENT_NODE, .flags = flags, .node_id = node_id, .location = location },
2028
+ .expression = expression,
2029
+ .operator_loc = operator_loc
2030
+ };
2031
+
2032
+ return node;
2033
+ }
2034
+
2035
+ /**
2036
+ * Allocate and initialize a new BlockLocalVariableNode node.
2037
+ */
2038
+ pm_block_local_variable_node_t *
2039
+ pm_block_local_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2040
+ pm_block_local_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_block_local_variable_node_t);
2041
+
2042
+ *node = (pm_block_local_variable_node_t) {
2043
+ .base = { .type = PM_BLOCK_LOCAL_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
2044
+ .name = name
2045
+ };
2046
+
2047
+ return node;
2048
+ }
2049
+
2050
+ /**
2051
+ * Allocate and initialize a new BlockNode node.
2052
+ */
2053
+ pm_block_node_t *
2054
+ pm_block_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, struct pm_node *parameters, struct pm_node *body, pm_location_t opening_loc, pm_location_t closing_loc) {
2055
+ pm_block_node_t *node = PM_ARENA_ALLOC(arena, pm_block_node_t);
2056
+
2057
+ *node = (pm_block_node_t) {
2058
+ .base = { .type = PM_BLOCK_NODE, .flags = flags, .node_id = node_id, .location = location },
2059
+ .locals = locals,
2060
+ .parameters = parameters,
2061
+ .body = body,
2062
+ .opening_loc = opening_loc,
2063
+ .closing_loc = closing_loc
2064
+ };
2065
+
2066
+ return node;
2067
+ }
2068
+
2069
+ /**
2070
+ * Allocate and initialize a new BlockParameterNode node.
2071
+ */
2072
+ pm_block_parameter_node_t *
2073
+ pm_block_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) {
2074
+ pm_block_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_block_parameter_node_t);
2075
+
2076
+ *node = (pm_block_parameter_node_t) {
2077
+ .base = { .type = PM_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
2078
+ .name = name,
2079
+ .name_loc = name_loc,
2080
+ .operator_loc = operator_loc
2081
+ };
2082
+
2083
+ return node;
2084
+ }
2085
+
2086
+ /**
2087
+ * Allocate and initialize a new BlockParametersNode node.
2088
+ */
2089
+ pm_block_parameters_node_t *
2090
+ pm_block_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_parameters_node *parameters, pm_node_list_t locals, pm_location_t opening_loc, pm_location_t closing_loc) {
2091
+ pm_block_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_block_parameters_node_t);
2092
+
2093
+ *node = (pm_block_parameters_node_t) {
2094
+ .base = { .type = PM_BLOCK_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
2095
+ .parameters = parameters,
2096
+ .locals = locals,
2097
+ .opening_loc = opening_loc,
2098
+ .closing_loc = closing_loc
2099
+ };
2100
+
2101
+ return node;
2102
+ }
2103
+
2104
+ /**
2105
+ * Allocate and initialize a new BreakNode node.
2106
+ */
2107
+ pm_break_node_t *
2108
+ pm_break_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_arguments_node *arguments, pm_location_t keyword_loc) {
2109
+ pm_break_node_t *node = PM_ARENA_ALLOC(arena, pm_break_node_t);
2110
+
2111
+ *node = (pm_break_node_t) {
2112
+ .base = { .type = PM_BREAK_NODE, .flags = flags, .node_id = node_id, .location = location },
2113
+ .arguments = arguments,
2114
+ .keyword_loc = keyword_loc
2115
+ };
2116
+
2117
+ return node;
2118
+ }
2119
+
2120
+ /**
2121
+ * Allocate and initialize a new CallAndWriteNode node.
2122
+ */
2123
+ pm_call_and_write_node_t *
2124
+ pm_call_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_location_t operator_loc, struct pm_node *value) {
2125
+ pm_call_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_call_and_write_node_t);
2126
+
2127
+ *node = (pm_call_and_write_node_t) {
2128
+ .base = { .type = PM_CALL_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2129
+ .receiver = receiver,
2130
+ .call_operator_loc = call_operator_loc,
2131
+ .message_loc = message_loc,
2132
+ .read_name = read_name,
2133
+ .write_name = write_name,
2134
+ .operator_loc = operator_loc,
2135
+ .value = value
2136
+ };
2137
+
2138
+ return node;
2139
+ }
2140
+
2141
+ /**
2142
+ * Allocate and initialize a new CallNode node.
2143
+ */
2144
+ pm_call_node_t *
2145
+ pm_call_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_constant_id_t name, pm_location_t message_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, pm_location_t equal_loc, struct pm_node *block) {
2146
+ pm_call_node_t *node = PM_ARENA_ALLOC(arena, pm_call_node_t);
2147
+
2148
+ *node = (pm_call_node_t) {
2149
+ .base = { .type = PM_CALL_NODE, .flags = flags, .node_id = node_id, .location = location },
2150
+ .receiver = receiver,
2151
+ .call_operator_loc = call_operator_loc,
2152
+ .name = name,
2153
+ .message_loc = message_loc,
2154
+ .opening_loc = opening_loc,
2155
+ .arguments = arguments,
2156
+ .closing_loc = closing_loc,
2157
+ .equal_loc = equal_loc,
2158
+ .block = block
2159
+ };
2160
+
2161
+ return node;
2162
+ }
2163
+
2164
+ /**
2165
+ * Allocate and initialize a new CallOperatorWriteNode node.
2166
+ */
2167
+ pm_call_operator_write_node_t *
2168
+ pm_call_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_constant_id_t binary_operator, pm_location_t binary_operator_loc, struct pm_node *value) {
2169
+ pm_call_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_call_operator_write_node_t);
2170
+
2171
+ *node = (pm_call_operator_write_node_t) {
2172
+ .base = { .type = PM_CALL_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2173
+ .receiver = receiver,
2174
+ .call_operator_loc = call_operator_loc,
2175
+ .message_loc = message_loc,
2176
+ .read_name = read_name,
2177
+ .write_name = write_name,
2178
+ .binary_operator = binary_operator,
2179
+ .binary_operator_loc = binary_operator_loc,
2180
+ .value = value
2181
+ };
2182
+
2183
+ return node;
2184
+ }
2185
+
2186
+ /**
2187
+ * Allocate and initialize a new CallOrWriteNode node.
2188
+ */
2189
+ pm_call_or_write_node_t *
2190
+ pm_call_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t message_loc, pm_constant_id_t read_name, pm_constant_id_t write_name, pm_location_t operator_loc, struct pm_node *value) {
2191
+ pm_call_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_call_or_write_node_t);
2192
+
2193
+ *node = (pm_call_or_write_node_t) {
2194
+ .base = { .type = PM_CALL_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2195
+ .receiver = receiver,
2196
+ .call_operator_loc = call_operator_loc,
2197
+ .message_loc = message_loc,
2198
+ .read_name = read_name,
2199
+ .write_name = write_name,
2200
+ .operator_loc = operator_loc,
2201
+ .value = value
2202
+ };
2203
+
2204
+ return node;
2205
+ }
2206
+
2207
+ /**
2208
+ * Allocate and initialize a new CallTargetNode node.
2209
+ */
2210
+ pm_call_target_node_t *
2211
+ pm_call_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_constant_id_t name, pm_location_t message_loc) {
2212
+ pm_call_target_node_t *node = PM_ARENA_ALLOC(arena, pm_call_target_node_t);
2213
+
2214
+ *node = (pm_call_target_node_t) {
2215
+ .base = { .type = PM_CALL_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2216
+ .receiver = receiver,
2217
+ .call_operator_loc = call_operator_loc,
2218
+ .name = name,
2219
+ .message_loc = message_loc
2220
+ };
2221
+
2222
+ return node;
2223
+ }
2224
+
2225
+ /**
2226
+ * Allocate and initialize a new CapturePatternNode node.
2227
+ */
2228
+ pm_capture_pattern_node_t *
2229
+ pm_capture_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_local_variable_target_node *target, pm_location_t operator_loc) {
2230
+ pm_capture_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_capture_pattern_node_t);
2231
+
2232
+ *node = (pm_capture_pattern_node_t) {
2233
+ .base = { .type = PM_CAPTURE_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2234
+ .value = value,
2235
+ .target = target,
2236
+ .operator_loc = operator_loc
2237
+ };
2238
+
2239
+ return node;
2240
+ }
2241
+
2242
+ /**
2243
+ * Allocate and initialize a new CaseMatchNode node.
2244
+ */
2245
+ pm_case_match_node_t *
2246
+ pm_case_match_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *predicate, pm_node_list_t conditions, struct pm_else_node *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc) {
2247
+ pm_case_match_node_t *node = PM_ARENA_ALLOC(arena, pm_case_match_node_t);
2248
+
2249
+ *node = (pm_case_match_node_t) {
2250
+ .base = { .type = PM_CASE_MATCH_NODE, .flags = flags, .node_id = node_id, .location = location },
2251
+ .predicate = predicate,
2252
+ .conditions = conditions,
2253
+ .else_clause = else_clause,
2254
+ .case_keyword_loc = case_keyword_loc,
2255
+ .end_keyword_loc = end_keyword_loc
2256
+ };
2257
+
2258
+ return node;
2259
+ }
2260
+
2261
+ /**
2262
+ * Allocate and initialize a new CaseNode node.
2263
+ */
2264
+ pm_case_node_t *
2265
+ pm_case_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *predicate, pm_node_list_t conditions, struct pm_else_node *else_clause, pm_location_t case_keyword_loc, pm_location_t end_keyword_loc) {
2266
+ pm_case_node_t *node = PM_ARENA_ALLOC(arena, pm_case_node_t);
2267
+
2268
+ *node = (pm_case_node_t) {
2269
+ .base = { .type = PM_CASE_NODE, .flags = flags, .node_id = node_id, .location = location },
2270
+ .predicate = predicate,
2271
+ .conditions = conditions,
2272
+ .else_clause = else_clause,
2273
+ .case_keyword_loc = case_keyword_loc,
2274
+ .end_keyword_loc = end_keyword_loc
2275
+ };
2276
+
2277
+ return node;
2278
+ }
2279
+
2280
+ /**
2281
+ * Allocate and initialize a new ClassNode node.
2282
+ */
2283
+ pm_class_node_t *
2284
+ pm_class_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t class_keyword_loc, struct pm_node *constant_path, pm_location_t inheritance_operator_loc, struct pm_node *superclass, struct pm_node *body, pm_location_t end_keyword_loc, pm_constant_id_t name) {
2285
+ pm_class_node_t *node = PM_ARENA_ALLOC(arena, pm_class_node_t);
2286
+
2287
+ *node = (pm_class_node_t) {
2288
+ .base = { .type = PM_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location },
2289
+ .locals = locals,
2290
+ .class_keyword_loc = class_keyword_loc,
2291
+ .constant_path = constant_path,
2292
+ .inheritance_operator_loc = inheritance_operator_loc,
2293
+ .superclass = superclass,
2294
+ .body = body,
2295
+ .end_keyword_loc = end_keyword_loc,
2296
+ .name = name
2297
+ };
2298
+
2299
+ return node;
2300
+ }
2301
+
2302
+ /**
2303
+ * Allocate and initialize a new ClassVariableAndWriteNode node.
2304
+ */
2305
+ pm_class_variable_and_write_node_t *
2306
+ pm_class_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2307
+ pm_class_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_and_write_node_t);
2308
+
2309
+ *node = (pm_class_variable_and_write_node_t) {
2310
+ .base = { .type = PM_CLASS_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2311
+ .name = name,
2312
+ .name_loc = name_loc,
2313
+ .operator_loc = operator_loc,
2314
+ .value = value
2315
+ };
2316
+
2317
+ return node;
2318
+ }
2319
+
2320
+ /**
2321
+ * Allocate and initialize a new ClassVariableOperatorWriteNode node.
2322
+ */
2323
+ pm_class_variable_operator_write_node_t *
2324
+ pm_class_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2325
+ pm_class_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_operator_write_node_t);
2326
+
2327
+ *node = (pm_class_variable_operator_write_node_t) {
2328
+ .base = { .type = PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2329
+ .name = name,
2330
+ .name_loc = name_loc,
2331
+ .binary_operator_loc = binary_operator_loc,
2332
+ .value = value,
2333
+ .binary_operator = binary_operator
2334
+ };
2335
+
2336
+ return node;
2337
+ }
2338
+
2339
+ /**
2340
+ * Allocate and initialize a new ClassVariableOrWriteNode node.
2341
+ */
2342
+ pm_class_variable_or_write_node_t *
2343
+ pm_class_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2344
+ pm_class_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_or_write_node_t);
2345
+
2346
+ *node = (pm_class_variable_or_write_node_t) {
2347
+ .base = { .type = PM_CLASS_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2348
+ .name = name,
2349
+ .name_loc = name_loc,
2350
+ .operator_loc = operator_loc,
2351
+ .value = value
2352
+ };
2353
+
2354
+ return node;
2355
+ }
2356
+
2357
+ /**
2358
+ * Allocate and initialize a new ClassVariableReadNode node.
2359
+ */
2360
+ pm_class_variable_read_node_t *
2361
+ pm_class_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2362
+ pm_class_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_read_node_t);
2363
+
2364
+ *node = (pm_class_variable_read_node_t) {
2365
+ .base = { .type = PM_CLASS_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2366
+ .name = name
2367
+ };
2368
+
2369
+ return node;
2370
+ }
2371
+
2372
+ /**
2373
+ * Allocate and initialize a new ClassVariableTargetNode node.
2374
+ */
2375
+ pm_class_variable_target_node_t *
2376
+ pm_class_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2377
+ pm_class_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_target_node_t);
2378
+
2379
+ *node = (pm_class_variable_target_node_t) {
2380
+ .base = { .type = PM_CLASS_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2381
+ .name = name
2382
+ };
2383
+
2384
+ return node;
2385
+ }
2386
+
2387
+ /**
2388
+ * Allocate and initialize a new ClassVariableWriteNode node.
2389
+ */
2390
+ pm_class_variable_write_node_t *
2391
+ pm_class_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
2392
+ pm_class_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_class_variable_write_node_t);
2393
+
2394
+ *node = (pm_class_variable_write_node_t) {
2395
+ .base = { .type = PM_CLASS_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2396
+ .name = name,
2397
+ .name_loc = name_loc,
2398
+ .value = value,
2399
+ .operator_loc = operator_loc
2400
+ };
2401
+
2402
+ return node;
2403
+ }
2404
+
2405
+ /**
2406
+ * Allocate and initialize a new ConstantAndWriteNode node.
2407
+ */
2408
+ pm_constant_and_write_node_t *
2409
+ pm_constant_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2410
+ pm_constant_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_and_write_node_t);
2411
+
2412
+ *node = (pm_constant_and_write_node_t) {
2413
+ .base = { .type = PM_CONSTANT_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2414
+ .name = name,
2415
+ .name_loc = name_loc,
2416
+ .operator_loc = operator_loc,
2417
+ .value = value
2418
+ };
2419
+
2420
+ return node;
2421
+ }
2422
+
2423
+ /**
2424
+ * Allocate and initialize a new ConstantOperatorWriteNode node.
2425
+ */
2426
+ pm_constant_operator_write_node_t *
2427
+ pm_constant_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2428
+ pm_constant_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_operator_write_node_t);
2429
+
2430
+ *node = (pm_constant_operator_write_node_t) {
2431
+ .base = { .type = PM_CONSTANT_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2432
+ .name = name,
2433
+ .name_loc = name_loc,
2434
+ .binary_operator_loc = binary_operator_loc,
2435
+ .value = value,
2436
+ .binary_operator = binary_operator
2437
+ };
2438
+
2439
+ return node;
2440
+ }
2441
+
2442
+ /**
2443
+ * Allocate and initialize a new ConstantOrWriteNode node.
2444
+ */
2445
+ pm_constant_or_write_node_t *
2446
+ pm_constant_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2447
+ pm_constant_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_or_write_node_t);
2448
+
2449
+ *node = (pm_constant_or_write_node_t) {
2450
+ .base = { .type = PM_CONSTANT_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2451
+ .name = name,
2452
+ .name_loc = name_loc,
2453
+ .operator_loc = operator_loc,
2454
+ .value = value
2455
+ };
2456
+
2457
+ return node;
2458
+ }
2459
+
2460
+ /**
2461
+ * Allocate and initialize a new ConstantPathAndWriteNode node.
2462
+ */
2463
+ pm_constant_path_and_write_node_t *
2464
+ pm_constant_path_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) {
2465
+ pm_constant_path_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_and_write_node_t);
2466
+
2467
+ *node = (pm_constant_path_and_write_node_t) {
2468
+ .base = { .type = PM_CONSTANT_PATH_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2469
+ .target = target,
2470
+ .operator_loc = operator_loc,
2471
+ .value = value
2472
+ };
2473
+
2474
+ return node;
2475
+ }
2476
+
2477
+ /**
2478
+ * Allocate and initialize a new ConstantPathNode node.
2479
+ */
2480
+ pm_constant_path_node_t *
2481
+ pm_constant_path_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *parent, pm_constant_id_t name, pm_location_t delimiter_loc, pm_location_t name_loc) {
2482
+ pm_constant_path_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_node_t);
2483
+
2484
+ *node = (pm_constant_path_node_t) {
2485
+ .base = { .type = PM_CONSTANT_PATH_NODE, .flags = flags, .node_id = node_id, .location = location },
2486
+ .parent = parent,
2487
+ .name = name,
2488
+ .delimiter_loc = delimiter_loc,
2489
+ .name_loc = name_loc
2490
+ };
2491
+
2492
+ return node;
2493
+ }
2494
+
2495
+ /**
2496
+ * Allocate and initialize a new ConstantPathOperatorWriteNode node.
2497
+ */
2498
+ pm_constant_path_operator_write_node_t *
2499
+ pm_constant_path_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2500
+ pm_constant_path_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_operator_write_node_t);
2501
+
2502
+ *node = (pm_constant_path_operator_write_node_t) {
2503
+ .base = { .type = PM_CONSTANT_PATH_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2504
+ .target = target,
2505
+ .binary_operator_loc = binary_operator_loc,
2506
+ .value = value,
2507
+ .binary_operator = binary_operator
2508
+ };
2509
+
2510
+ return node;
2511
+ }
2512
+
2513
+ /**
2514
+ * Allocate and initialize a new ConstantPathOrWriteNode node.
2515
+ */
2516
+ pm_constant_path_or_write_node_t *
2517
+ pm_constant_path_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) {
2518
+ pm_constant_path_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_or_write_node_t);
2519
+
2520
+ *node = (pm_constant_path_or_write_node_t) {
2521
+ .base = { .type = PM_CONSTANT_PATH_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2522
+ .target = target,
2523
+ .operator_loc = operator_loc,
2524
+ .value = value
2525
+ };
2526
+
2527
+ return node;
2528
+ }
2529
+
2530
+ /**
2531
+ * Allocate and initialize a new ConstantPathTargetNode node.
2532
+ */
2533
+ pm_constant_path_target_node_t *
2534
+ pm_constant_path_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *parent, pm_constant_id_t name, pm_location_t delimiter_loc, pm_location_t name_loc) {
2535
+ pm_constant_path_target_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_target_node_t);
2536
+
2537
+ *node = (pm_constant_path_target_node_t) {
2538
+ .base = { .type = PM_CONSTANT_PATH_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2539
+ .parent = parent,
2540
+ .name = name,
2541
+ .delimiter_loc = delimiter_loc,
2542
+ .name_loc = name_loc
2543
+ };
2544
+
2545
+ return node;
2546
+ }
2547
+
2548
+ /**
2549
+ * Allocate and initialize a new ConstantPathWriteNode node.
2550
+ */
2551
+ pm_constant_path_write_node_t *
2552
+ pm_constant_path_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_constant_path_node *target, pm_location_t operator_loc, struct pm_node *value) {
2553
+ pm_constant_path_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_path_write_node_t);
2554
+
2555
+ *node = (pm_constant_path_write_node_t) {
2556
+ .base = { .type = PM_CONSTANT_PATH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2557
+ .target = target,
2558
+ .operator_loc = operator_loc,
2559
+ .value = value
2560
+ };
2561
+
2562
+ return node;
2563
+ }
2564
+
2565
+ /**
2566
+ * Allocate and initialize a new ConstantReadNode node.
2567
+ */
2568
+ pm_constant_read_node_t *
2569
+ pm_constant_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2570
+ pm_constant_read_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_read_node_t);
2571
+
2572
+ *node = (pm_constant_read_node_t) {
2573
+ .base = { .type = PM_CONSTANT_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2574
+ .name = name
2575
+ };
2576
+
2577
+ return node;
2578
+ }
2579
+
2580
+ /**
2581
+ * Allocate and initialize a new ConstantTargetNode node.
2582
+ */
2583
+ pm_constant_target_node_t *
2584
+ pm_constant_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2585
+ pm_constant_target_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_target_node_t);
2586
+
2587
+ *node = (pm_constant_target_node_t) {
2588
+ .base = { .type = PM_CONSTANT_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2589
+ .name = name
2590
+ };
2591
+
2592
+ return node;
2593
+ }
2594
+
2595
+ /**
2596
+ * Allocate and initialize a new ConstantWriteNode node.
2597
+ */
2598
+ pm_constant_write_node_t *
2599
+ pm_constant_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
2600
+ pm_constant_write_node_t *node = PM_ARENA_ALLOC(arena, pm_constant_write_node_t);
2601
+
2602
+ *node = (pm_constant_write_node_t) {
2603
+ .base = { .type = PM_CONSTANT_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2604
+ .name = name,
2605
+ .name_loc = name_loc,
2606
+ .value = value,
2607
+ .operator_loc = operator_loc
2608
+ };
2609
+
2610
+ return node;
2611
+ }
2612
+
2613
+ /**
2614
+ * Allocate and initialize a new DefNode node.
2615
+ */
2616
+ pm_def_node_t *
2617
+ pm_def_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *receiver, struct pm_parameters_node *parameters, struct pm_node *body, pm_constant_id_list_t locals, pm_location_t def_keyword_loc, pm_location_t operator_loc, pm_location_t lparen_loc, pm_location_t rparen_loc, pm_location_t equal_loc, pm_location_t end_keyword_loc) {
2618
+ pm_def_node_t *node = PM_ARENA_ALLOC(arena, pm_def_node_t);
2619
+
2620
+ *node = (pm_def_node_t) {
2621
+ .base = { .type = PM_DEF_NODE, .flags = flags, .node_id = node_id, .location = location },
2622
+ .name = name,
2623
+ .name_loc = name_loc,
2624
+ .receiver = receiver,
2625
+ .parameters = parameters,
2626
+ .body = body,
2627
+ .locals = locals,
2628
+ .def_keyword_loc = def_keyword_loc,
2629
+ .operator_loc = operator_loc,
2630
+ .lparen_loc = lparen_loc,
2631
+ .rparen_loc = rparen_loc,
2632
+ .equal_loc = equal_loc,
2633
+ .end_keyword_loc = end_keyword_loc
2634
+ };
2635
+
2636
+ return node;
2637
+ }
2638
+
2639
+ /**
2640
+ * Allocate and initialize a new DefinedNode node.
2641
+ */
2642
+ pm_defined_node_t *
2643
+ pm_defined_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t lparen_loc, struct pm_node *value, pm_location_t rparen_loc, pm_location_t keyword_loc) {
2644
+ pm_defined_node_t *node = PM_ARENA_ALLOC(arena, pm_defined_node_t);
2645
+
2646
+ *node = (pm_defined_node_t) {
2647
+ .base = { .type = PM_DEFINED_NODE, .flags = flags, .node_id = node_id, .location = location },
2648
+ .lparen_loc = lparen_loc,
2649
+ .value = value,
2650
+ .rparen_loc = rparen_loc,
2651
+ .keyword_loc = keyword_loc
2652
+ };
2653
+
2654
+ return node;
2655
+ }
2656
+
2657
+ /**
2658
+ * Allocate and initialize a new ElseNode node.
2659
+ */
2660
+ pm_else_node_t *
2661
+ pm_else_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t else_keyword_loc, struct pm_statements_node *statements, pm_location_t end_keyword_loc) {
2662
+ pm_else_node_t *node = PM_ARENA_ALLOC(arena, pm_else_node_t);
2663
+
2664
+ *node = (pm_else_node_t) {
2665
+ .base = { .type = PM_ELSE_NODE, .flags = flags, .node_id = node_id, .location = location },
2666
+ .else_keyword_loc = else_keyword_loc,
2667
+ .statements = statements,
2668
+ .end_keyword_loc = end_keyword_loc
2669
+ };
2670
+
2671
+ return node;
2672
+ }
2673
+
2674
+ /**
2675
+ * Allocate and initialize a new EmbeddedStatementsNode node.
2676
+ */
2677
+ pm_embedded_statements_node_t *
2678
+ pm_embedded_statements_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, struct pm_statements_node *statements, pm_location_t closing_loc) {
2679
+ pm_embedded_statements_node_t *node = PM_ARENA_ALLOC(arena, pm_embedded_statements_node_t);
2680
+
2681
+ *node = (pm_embedded_statements_node_t) {
2682
+ .base = { .type = PM_EMBEDDED_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
2683
+ .opening_loc = opening_loc,
2684
+ .statements = statements,
2685
+ .closing_loc = closing_loc
2686
+ };
2687
+
2688
+ return node;
2689
+ }
2690
+
2691
+ /**
2692
+ * Allocate and initialize a new EmbeddedVariableNode node.
2693
+ */
2694
+ pm_embedded_variable_node_t *
2695
+ pm_embedded_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, struct pm_node *variable) {
2696
+ pm_embedded_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_embedded_variable_node_t);
2697
+
2698
+ *node = (pm_embedded_variable_node_t) {
2699
+ .base = { .type = PM_EMBEDDED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
2700
+ .operator_loc = operator_loc,
2701
+ .variable = variable
2702
+ };
2703
+
2704
+ return node;
2705
+ }
2706
+
2707
+ /**
2708
+ * Allocate and initialize a new EnsureNode node.
2709
+ */
2710
+ pm_ensure_node_t *
2711
+ pm_ensure_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t ensure_keyword_loc, struct pm_statements_node *statements, pm_location_t end_keyword_loc) {
2712
+ pm_ensure_node_t *node = PM_ARENA_ALLOC(arena, pm_ensure_node_t);
2713
+
2714
+ *node = (pm_ensure_node_t) {
2715
+ .base = { .type = PM_ENSURE_NODE, .flags = flags, .node_id = node_id, .location = location },
2716
+ .ensure_keyword_loc = ensure_keyword_loc,
2717
+ .statements = statements,
2718
+ .end_keyword_loc = end_keyword_loc
2719
+ };
2720
+
2721
+ return node;
2722
+ }
2723
+
2724
+ /**
2725
+ * Allocate and initialize a new ErrorRecoveryNode node.
2726
+ */
2727
+ pm_error_recovery_node_t *
2728
+ pm_error_recovery_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *unexpected) {
2729
+ pm_error_recovery_node_t *node = PM_ARENA_ALLOC(arena, pm_error_recovery_node_t);
2730
+
2731
+ *node = (pm_error_recovery_node_t) {
2732
+ .base = { .type = PM_ERROR_RECOVERY_NODE, .flags = flags, .node_id = node_id, .location = location },
2733
+ .unexpected = unexpected
2734
+ };
2735
+
2736
+ return node;
2737
+ }
2738
+
2739
+ /**
2740
+ * Allocate and initialize a new FalseNode node.
2741
+ */
2742
+ pm_false_node_t *
2743
+ pm_false_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2744
+ pm_false_node_t *node = PM_ARENA_ALLOC(arena, pm_false_node_t);
2745
+
2746
+ *node = (pm_false_node_t) {
2747
+ .base = { .type = PM_FALSE_NODE, .flags = flags, .node_id = node_id, .location = location }
2748
+ };
2749
+
2750
+ return node;
2751
+ }
2752
+
2753
+ /**
2754
+ * Allocate and initialize a new FindPatternNode node.
2755
+ */
2756
+ pm_find_pattern_node_t *
2757
+ pm_find_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, struct pm_splat_node *left, pm_node_list_t requireds, struct pm_splat_node *right, pm_location_t opening_loc, pm_location_t closing_loc) {
2758
+ pm_find_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_find_pattern_node_t);
2759
+
2760
+ *node = (pm_find_pattern_node_t) {
2761
+ .base = { .type = PM_FIND_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2762
+ .constant = constant,
2763
+ .left = left,
2764
+ .requireds = requireds,
2765
+ .right = right,
2766
+ .opening_loc = opening_loc,
2767
+ .closing_loc = closing_loc
2768
+ };
2769
+
2770
+ return node;
2771
+ }
2772
+
2773
+ /**
2774
+ * Allocate and initialize a new FlipFlopNode node.
2775
+ */
2776
+ pm_flip_flop_node_t *
2777
+ pm_flip_flop_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
2778
+ pm_flip_flop_node_t *node = PM_ARENA_ALLOC(arena, pm_flip_flop_node_t);
2779
+
2780
+ *node = (pm_flip_flop_node_t) {
2781
+ .base = { .type = PM_FLIP_FLOP_NODE, .flags = flags, .node_id = node_id, .location = location },
2782
+ .left = left,
2783
+ .right = right,
2784
+ .operator_loc = operator_loc
2785
+ };
2786
+
2787
+ return node;
2788
+ }
2789
+
2790
+ /**
2791
+ * Allocate and initialize a new FloatNode node.
2792
+ */
2793
+ pm_float_node_t *
2794
+ pm_float_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, double value) {
2795
+ pm_float_node_t *node = PM_ARENA_ALLOC(arena, pm_float_node_t);
2796
+
2797
+ *node = (pm_float_node_t) {
2798
+ .base = { .type = PM_FLOAT_NODE, .flags = flags, .node_id = node_id, .location = location },
2799
+ .value = value
2800
+ };
2801
+
2802
+ return node;
2803
+ }
2804
+
2805
+ /**
2806
+ * Allocate and initialize a new ForNode node.
2807
+ */
2808
+ pm_for_node_t *
2809
+ pm_for_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *index, struct pm_node *collection, struct pm_statements_node *statements, pm_location_t for_keyword_loc, pm_location_t in_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc) {
2810
+ pm_for_node_t *node = PM_ARENA_ALLOC(arena, pm_for_node_t);
2811
+
2812
+ *node = (pm_for_node_t) {
2813
+ .base = { .type = PM_FOR_NODE, .flags = flags, .node_id = node_id, .location = location },
2814
+ .index = index,
2815
+ .collection = collection,
2816
+ .statements = statements,
2817
+ .for_keyword_loc = for_keyword_loc,
2818
+ .in_keyword_loc = in_keyword_loc,
2819
+ .do_keyword_loc = do_keyword_loc,
2820
+ .end_keyword_loc = end_keyword_loc
2821
+ };
2822
+
2823
+ return node;
2824
+ }
2825
+
2826
+ /**
2827
+ * Allocate and initialize a new ForwardingArgumentsNode node.
2828
+ */
2829
+ pm_forwarding_arguments_node_t *
2830
+ pm_forwarding_arguments_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2831
+ pm_forwarding_arguments_node_t *node = PM_ARENA_ALLOC(arena, pm_forwarding_arguments_node_t);
2832
+
2833
+ *node = (pm_forwarding_arguments_node_t) {
2834
+ .base = { .type = PM_FORWARDING_ARGUMENTS_NODE, .flags = flags, .node_id = node_id, .location = location }
2835
+ };
2836
+
2837
+ return node;
2838
+ }
2839
+
2840
+ /**
2841
+ * Allocate and initialize a new ForwardingParameterNode node.
2842
+ */
2843
+ pm_forwarding_parameter_node_t *
2844
+ pm_forwarding_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
2845
+ pm_forwarding_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_forwarding_parameter_node_t);
2846
+
2847
+ *node = (pm_forwarding_parameter_node_t) {
2848
+ .base = { .type = PM_FORWARDING_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location }
2849
+ };
2850
+
2851
+ return node;
2852
+ }
2853
+
2854
+ /**
2855
+ * Allocate and initialize a new ForwardingSuperNode node.
2856
+ */
2857
+ pm_forwarding_super_node_t *
2858
+ pm_forwarding_super_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, struct pm_block_node *block) {
2859
+ pm_forwarding_super_node_t *node = PM_ARENA_ALLOC(arena, pm_forwarding_super_node_t);
2860
+
2861
+ *node = (pm_forwarding_super_node_t) {
2862
+ .base = { .type = PM_FORWARDING_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location },
2863
+ .keyword_loc = keyword_loc,
2864
+ .block = block
2865
+ };
2866
+
2867
+ return node;
2868
+ }
2869
+
2870
+ /**
2871
+ * Allocate and initialize a new GlobalVariableAndWriteNode node.
2872
+ */
2873
+ pm_global_variable_and_write_node_t *
2874
+ pm_global_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2875
+ pm_global_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_and_write_node_t);
2876
+
2877
+ *node = (pm_global_variable_and_write_node_t) {
2878
+ .base = { .type = PM_GLOBAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2879
+ .name = name,
2880
+ .name_loc = name_loc,
2881
+ .operator_loc = operator_loc,
2882
+ .value = value
2883
+ };
2884
+
2885
+ return node;
2886
+ }
2887
+
2888
+ /**
2889
+ * Allocate and initialize a new GlobalVariableOperatorWriteNode node.
2890
+ */
2891
+ pm_global_variable_operator_write_node_t *
2892
+ pm_global_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
2893
+ pm_global_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_operator_write_node_t);
2894
+
2895
+ *node = (pm_global_variable_operator_write_node_t) {
2896
+ .base = { .type = PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2897
+ .name = name,
2898
+ .name_loc = name_loc,
2899
+ .binary_operator_loc = binary_operator_loc,
2900
+ .value = value,
2901
+ .binary_operator = binary_operator
2902
+ };
2903
+
2904
+ return node;
2905
+ }
2906
+
2907
+ /**
2908
+ * Allocate and initialize a new GlobalVariableOrWriteNode node.
2909
+ */
2910
+ pm_global_variable_or_write_node_t *
2911
+ pm_global_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
2912
+ pm_global_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_or_write_node_t);
2913
+
2914
+ *node = (pm_global_variable_or_write_node_t) {
2915
+ .base = { .type = PM_GLOBAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2916
+ .name = name,
2917
+ .name_loc = name_loc,
2918
+ .operator_loc = operator_loc,
2919
+ .value = value
2920
+ };
2921
+
2922
+ return node;
2923
+ }
2924
+
2925
+ /**
2926
+ * Allocate and initialize a new GlobalVariableReadNode node.
2927
+ */
2928
+ pm_global_variable_read_node_t *
2929
+ pm_global_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2930
+ pm_global_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_read_node_t);
2931
+
2932
+ *node = (pm_global_variable_read_node_t) {
2933
+ .base = { .type = PM_GLOBAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
2934
+ .name = name
2935
+ };
2936
+
2937
+ return node;
2938
+ }
2939
+
2940
+ /**
2941
+ * Allocate and initialize a new GlobalVariableTargetNode node.
2942
+ */
2943
+ pm_global_variable_target_node_t *
2944
+ pm_global_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
2945
+ pm_global_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_target_node_t);
2946
+
2947
+ *node = (pm_global_variable_target_node_t) {
2948
+ .base = { .type = PM_GLOBAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
2949
+ .name = name
2950
+ };
2951
+
2952
+ return node;
2953
+ }
2954
+
2955
+ /**
2956
+ * Allocate and initialize a new GlobalVariableWriteNode node.
2957
+ */
2958
+ pm_global_variable_write_node_t *
2959
+ pm_global_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
2960
+ pm_global_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_global_variable_write_node_t);
2961
+
2962
+ *node = (pm_global_variable_write_node_t) {
2963
+ .base = { .type = PM_GLOBAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
2964
+ .name = name,
2965
+ .name_loc = name_loc,
2966
+ .value = value,
2967
+ .operator_loc = operator_loc
2968
+ };
2969
+
2970
+ return node;
2971
+ }
2972
+
2973
+ /**
2974
+ * Allocate and initialize a new HashNode node.
2975
+ */
2976
+ pm_hash_node_t *
2977
+ pm_hash_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t elements, pm_location_t closing_loc) {
2978
+ pm_hash_node_t *node = PM_ARENA_ALLOC(arena, pm_hash_node_t);
2979
+
2980
+ *node = (pm_hash_node_t) {
2981
+ .base = { .type = PM_HASH_NODE, .flags = flags, .node_id = node_id, .location = location },
2982
+ .opening_loc = opening_loc,
2983
+ .elements = elements,
2984
+ .closing_loc = closing_loc
2985
+ };
2986
+
2987
+ return node;
2988
+ }
2989
+
2990
+ /**
2991
+ * Allocate and initialize a new HashPatternNode node.
2992
+ */
2993
+ pm_hash_pattern_node_t *
2994
+ pm_hash_pattern_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *constant, pm_node_list_t elements, struct pm_node *rest, pm_location_t opening_loc, pm_location_t closing_loc) {
2995
+ pm_hash_pattern_node_t *node = PM_ARENA_ALLOC(arena, pm_hash_pattern_node_t);
2996
+
2997
+ *node = (pm_hash_pattern_node_t) {
2998
+ .base = { .type = PM_HASH_PATTERN_NODE, .flags = flags, .node_id = node_id, .location = location },
2999
+ .constant = constant,
3000
+ .elements = elements,
3001
+ .rest = rest,
3002
+ .opening_loc = opening_loc,
3003
+ .closing_loc = closing_loc
3004
+ };
3005
+
3006
+ return node;
3007
+ }
3008
+
3009
+ /**
3010
+ * Allocate and initialize a new IfNode node.
3011
+ */
3012
+ pm_if_node_t *
3013
+ pm_if_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t if_keyword_loc, struct pm_node *predicate, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_node *subsequent, pm_location_t end_keyword_loc) {
3014
+ pm_if_node_t *node = PM_ARENA_ALLOC(arena, pm_if_node_t);
3015
+
3016
+ *node = (pm_if_node_t) {
3017
+ .base = { .type = PM_IF_NODE, .flags = flags, .node_id = node_id, .location = location },
3018
+ .if_keyword_loc = if_keyword_loc,
3019
+ .predicate = predicate,
3020
+ .then_keyword_loc = then_keyword_loc,
3021
+ .statements = statements,
3022
+ .subsequent = subsequent,
3023
+ .end_keyword_loc = end_keyword_loc
3024
+ };
3025
+
3026
+ return node;
3027
+ }
3028
+
3029
+ /**
3030
+ * Allocate and initialize a new ImaginaryNode node.
3031
+ */
3032
+ pm_imaginary_node_t *
3033
+ pm_imaginary_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *numeric) {
3034
+ pm_imaginary_node_t *node = PM_ARENA_ALLOC(arena, pm_imaginary_node_t);
3035
+
3036
+ *node = (pm_imaginary_node_t) {
3037
+ .base = { .type = PM_IMAGINARY_NODE, .flags = flags, .node_id = node_id, .location = location },
3038
+ .numeric = numeric
3039
+ };
3040
+
3041
+ return node;
3042
+ }
3043
+
3044
+ /**
3045
+ * Allocate and initialize a new ImplicitNode node.
3046
+ */
3047
+ pm_implicit_node_t *
3048
+ pm_implicit_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value) {
3049
+ pm_implicit_node_t *node = PM_ARENA_ALLOC(arena, pm_implicit_node_t);
3050
+
3051
+ *node = (pm_implicit_node_t) {
3052
+ .base = { .type = PM_IMPLICIT_NODE, .flags = flags, .node_id = node_id, .location = location },
3053
+ .value = value
3054
+ };
3055
+
3056
+ return node;
3057
+ }
3058
+
3059
+ /**
3060
+ * Allocate and initialize a new ImplicitRestNode node.
3061
+ */
3062
+ pm_implicit_rest_node_t *
3063
+ pm_implicit_rest_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3064
+ pm_implicit_rest_node_t *node = PM_ARENA_ALLOC(arena, pm_implicit_rest_node_t);
3065
+
3066
+ *node = (pm_implicit_rest_node_t) {
3067
+ .base = { .type = PM_IMPLICIT_REST_NODE, .flags = flags, .node_id = node_id, .location = location }
3068
+ };
3069
+
3070
+ return node;
3071
+ }
3072
+
3073
+ /**
3074
+ * Allocate and initialize a new InNode node.
3075
+ */
3076
+ pm_in_node_t *
3077
+ pm_in_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *pattern, struct pm_statements_node *statements, pm_location_t in_keyword_loc, pm_location_t then_keyword_loc) {
3078
+ pm_in_node_t *node = PM_ARENA_ALLOC(arena, pm_in_node_t);
3079
+
3080
+ *node = (pm_in_node_t) {
3081
+ .base = { .type = PM_IN_NODE, .flags = flags, .node_id = node_id, .location = location },
3082
+ .pattern = pattern,
3083
+ .statements = statements,
3084
+ .in_keyword_loc = in_keyword_loc,
3085
+ .then_keyword_loc = then_keyword_loc
3086
+ };
3087
+
3088
+ return node;
3089
+ }
3090
+
3091
+ /**
3092
+ * Allocate and initialize a new IndexAndWriteNode node.
3093
+ */
3094
+ pm_index_and_write_node_t *
3095
+ pm_index_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_location_t operator_loc, struct pm_node *value) {
3096
+ pm_index_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_index_and_write_node_t);
3097
+
3098
+ *node = (pm_index_and_write_node_t) {
3099
+ .base = { .type = PM_INDEX_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3100
+ .receiver = receiver,
3101
+ .call_operator_loc = call_operator_loc,
3102
+ .opening_loc = opening_loc,
3103
+ .arguments = arguments,
3104
+ .closing_loc = closing_loc,
3105
+ .block = block,
3106
+ .operator_loc = operator_loc,
3107
+ .value = value
3108
+ };
3109
+
3110
+ return node;
3111
+ }
3112
+
3113
+ /**
3114
+ * Allocate and initialize a new IndexOperatorWriteNode node.
3115
+ */
3116
+ pm_index_operator_write_node_t *
3117
+ pm_index_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_constant_id_t binary_operator, pm_location_t binary_operator_loc, struct pm_node *value) {
3118
+ pm_index_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_index_operator_write_node_t);
3119
+
3120
+ *node = (pm_index_operator_write_node_t) {
3121
+ .base = { .type = PM_INDEX_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3122
+ .receiver = receiver,
3123
+ .call_operator_loc = call_operator_loc,
3124
+ .opening_loc = opening_loc,
3125
+ .arguments = arguments,
3126
+ .closing_loc = closing_loc,
3127
+ .block = block,
3128
+ .binary_operator = binary_operator,
3129
+ .binary_operator_loc = binary_operator_loc,
3130
+ .value = value
3131
+ };
3132
+
3133
+ return node;
3134
+ }
3135
+
3136
+ /**
3137
+ * Allocate and initialize a new IndexOrWriteNode node.
3138
+ */
3139
+ pm_index_or_write_node_t *
3140
+ pm_index_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t call_operator_loc, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block, pm_location_t operator_loc, struct pm_node *value) {
3141
+ pm_index_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_index_or_write_node_t);
3142
+
3143
+ *node = (pm_index_or_write_node_t) {
3144
+ .base = { .type = PM_INDEX_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3145
+ .receiver = receiver,
3146
+ .call_operator_loc = call_operator_loc,
3147
+ .opening_loc = opening_loc,
3148
+ .arguments = arguments,
3149
+ .closing_loc = closing_loc,
3150
+ .block = block,
3151
+ .operator_loc = operator_loc,
3152
+ .value = value
3153
+ };
3154
+
3155
+ return node;
3156
+ }
3157
+
3158
+ /**
3159
+ * Allocate and initialize a new IndexTargetNode node.
3160
+ */
3161
+ pm_index_target_node_t *
3162
+ pm_index_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *receiver, pm_location_t opening_loc, struct pm_arguments_node *arguments, pm_location_t closing_loc, struct pm_block_argument_node *block) {
3163
+ pm_index_target_node_t *node = PM_ARENA_ALLOC(arena, pm_index_target_node_t);
3164
+
3165
+ *node = (pm_index_target_node_t) {
3166
+ .base = { .type = PM_INDEX_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3167
+ .receiver = receiver,
3168
+ .opening_loc = opening_loc,
3169
+ .arguments = arguments,
3170
+ .closing_loc = closing_loc,
3171
+ .block = block
3172
+ };
3173
+
3174
+ return node;
3175
+ }
3176
+
3177
+ /**
3178
+ * Allocate and initialize a new InstanceVariableAndWriteNode node.
3179
+ */
3180
+ pm_instance_variable_and_write_node_t *
3181
+ pm_instance_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
3182
+ pm_instance_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_and_write_node_t);
3183
+
3184
+ *node = (pm_instance_variable_and_write_node_t) {
3185
+ .base = { .type = PM_INSTANCE_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3186
+ .name = name,
3187
+ .name_loc = name_loc,
3188
+ .operator_loc = operator_loc,
3189
+ .value = value
3190
+ };
3191
+
3192
+ return node;
3193
+ }
3194
+
3195
+ /**
3196
+ * Allocate and initialize a new InstanceVariableOperatorWriteNode node.
3197
+ */
3198
+ pm_instance_variable_operator_write_node_t *
3199
+ pm_instance_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t binary_operator) {
3200
+ pm_instance_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_operator_write_node_t);
3201
+
3202
+ *node = (pm_instance_variable_operator_write_node_t) {
3203
+ .base = { .type = PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3204
+ .name = name,
3205
+ .name_loc = name_loc,
3206
+ .binary_operator_loc = binary_operator_loc,
3207
+ .value = value,
3208
+ .binary_operator = binary_operator
3209
+ };
3210
+
3211
+ return node;
3212
+ }
3213
+
3214
+ /**
3215
+ * Allocate and initialize a new InstanceVariableOrWriteNode node.
3216
+ */
3217
+ pm_instance_variable_or_write_node_t *
3218
+ pm_instance_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
3219
+ pm_instance_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_or_write_node_t);
3220
+
3221
+ *node = (pm_instance_variable_or_write_node_t) {
3222
+ .base = { .type = PM_INSTANCE_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3223
+ .name = name,
3224
+ .name_loc = name_loc,
3225
+ .operator_loc = operator_loc,
3226
+ .value = value
3227
+ };
3228
+
3229
+ return node;
3230
+ }
3231
+
3232
+ /**
3233
+ * Allocate and initialize a new InstanceVariableReadNode node.
3234
+ */
3235
+ pm_instance_variable_read_node_t *
3236
+ pm_instance_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
3237
+ pm_instance_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_read_node_t);
3238
+
3239
+ *node = (pm_instance_variable_read_node_t) {
3240
+ .base = { .type = PM_INSTANCE_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3241
+ .name = name
3242
+ };
3243
+
3244
+ return node;
3245
+ }
3246
+
3247
+ /**
3248
+ * Allocate and initialize a new InstanceVariableTargetNode node.
3249
+ */
3250
+ pm_instance_variable_target_node_t *
3251
+ pm_instance_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
3252
+ pm_instance_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_target_node_t);
3253
+
3254
+ *node = (pm_instance_variable_target_node_t) {
3255
+ .base = { .type = PM_INSTANCE_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3256
+ .name = name
3257
+ };
3258
+
3259
+ return node;
3260
+ }
3261
+
3262
+ /**
3263
+ * Allocate and initialize a new InstanceVariableWriteNode node.
3264
+ */
3265
+ pm_instance_variable_write_node_t *
3266
+ pm_instance_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
3267
+ pm_instance_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_instance_variable_write_node_t);
3268
+
3269
+ *node = (pm_instance_variable_write_node_t) {
3270
+ .base = { .type = PM_INSTANCE_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3271
+ .name = name,
3272
+ .name_loc = name_loc,
3273
+ .value = value,
3274
+ .operator_loc = operator_loc
3275
+ };
3276
+
3277
+ return node;
3278
+ }
3279
+
3280
+ /**
3281
+ * Allocate and initialize a new IntegerNode node.
3282
+ */
3283
+ pm_integer_node_t *
3284
+ pm_integer_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_integer_t value) {
3285
+ pm_integer_node_t *node = PM_ARENA_ALLOC(arena, pm_integer_node_t);
3286
+
3287
+ *node = (pm_integer_node_t) {
3288
+ .base = { .type = PM_INTEGER_NODE, .flags = flags, .node_id = node_id, .location = location },
3289
+ .value = value
3290
+ };
3291
+
3292
+ return node;
3293
+ }
3294
+
3295
+ /**
3296
+ * Allocate and initialize a new InterpolatedMatchLastLineNode node.
3297
+ */
3298
+ pm_interpolated_match_last_line_node_t *
3299
+ pm_interpolated_match_last_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3300
+ pm_interpolated_match_last_line_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_match_last_line_node_t);
3301
+
3302
+ *node = (pm_interpolated_match_last_line_node_t) {
3303
+ .base = { .type = PM_INTERPOLATED_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location },
3304
+ .opening_loc = opening_loc,
3305
+ .parts = parts,
3306
+ .closing_loc = closing_loc
3307
+ };
3308
+
3309
+ return node;
3310
+ }
3311
+
3312
+ /**
3313
+ * Allocate and initialize a new InterpolatedRegularExpressionNode node.
3314
+ */
3315
+ pm_interpolated_regular_expression_node_t *
3316
+ pm_interpolated_regular_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3317
+ pm_interpolated_regular_expression_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_regular_expression_node_t);
3318
+
3319
+ *node = (pm_interpolated_regular_expression_node_t) {
3320
+ .base = { .type = PM_INTERPOLATED_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3321
+ .opening_loc = opening_loc,
3322
+ .parts = parts,
3323
+ .closing_loc = closing_loc
3324
+ };
3325
+
3326
+ return node;
3327
+ }
3328
+
3329
+ /**
3330
+ * Allocate and initialize a new InterpolatedStringNode node.
3331
+ */
3332
+ pm_interpolated_string_node_t *
3333
+ pm_interpolated_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3334
+ pm_interpolated_string_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_string_node_t);
3335
+
3336
+ *node = (pm_interpolated_string_node_t) {
3337
+ .base = { .type = PM_INTERPOLATED_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
3338
+ .opening_loc = opening_loc,
3339
+ .parts = parts,
3340
+ .closing_loc = closing_loc
3341
+ };
3342
+
3343
+ return node;
3344
+ }
3345
+
3346
+ /**
3347
+ * Allocate and initialize a new InterpolatedSymbolNode node.
3348
+ */
3349
+ pm_interpolated_symbol_node_t *
3350
+ pm_interpolated_symbol_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3351
+ pm_interpolated_symbol_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_symbol_node_t);
3352
+
3353
+ *node = (pm_interpolated_symbol_node_t) {
3354
+ .base = { .type = PM_INTERPOLATED_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location },
3355
+ .opening_loc = opening_loc,
3356
+ .parts = parts,
3357
+ .closing_loc = closing_loc
3358
+ };
3359
+
3360
+ return node;
3361
+ }
3362
+
3363
+ /**
3364
+ * Allocate and initialize a new InterpolatedXStringNode node.
3365
+ */
3366
+ pm_interpolated_x_string_node_t *
3367
+ pm_interpolated_x_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_node_list_t parts, pm_location_t closing_loc) {
3368
+ pm_interpolated_x_string_node_t *node = PM_ARENA_ALLOC(arena, pm_interpolated_x_string_node_t);
3369
+
3370
+ *node = (pm_interpolated_x_string_node_t) {
3371
+ .base = { .type = PM_INTERPOLATED_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
3372
+ .opening_loc = opening_loc,
3373
+ .parts = parts,
3374
+ .closing_loc = closing_loc
3375
+ };
3376
+
3377
+ return node;
3378
+ }
3379
+
3380
+ /**
3381
+ * Allocate and initialize a new ItLocalVariableReadNode node.
3382
+ */
3383
+ pm_it_local_variable_read_node_t *
3384
+ pm_it_local_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3385
+ pm_it_local_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_it_local_variable_read_node_t);
3386
+
3387
+ *node = (pm_it_local_variable_read_node_t) {
3388
+ .base = { .type = PM_IT_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location }
3389
+ };
3390
+
3391
+ return node;
3392
+ }
3393
+
3394
+ /**
3395
+ * Allocate and initialize a new ItParametersNode node.
3396
+ */
3397
+ pm_it_parameters_node_t *
3398
+ pm_it_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3399
+ pm_it_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_it_parameters_node_t);
3400
+
3401
+ *node = (pm_it_parameters_node_t) {
3402
+ .base = { .type = PM_IT_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location }
3403
+ };
3404
+
3405
+ return node;
3406
+ }
3407
+
3408
+ /**
3409
+ * Allocate and initialize a new KeywordHashNode node.
3410
+ */
3411
+ pm_keyword_hash_node_t *
3412
+ pm_keyword_hash_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t elements) {
3413
+ pm_keyword_hash_node_t *node = PM_ARENA_ALLOC(arena, pm_keyword_hash_node_t);
3414
+
3415
+ *node = (pm_keyword_hash_node_t) {
3416
+ .base = { .type = PM_KEYWORD_HASH_NODE, .flags = flags, .node_id = node_id, .location = location },
3417
+ .elements = elements
3418
+ };
3419
+
3420
+ return node;
3421
+ }
3422
+
3423
+ /**
3424
+ * Allocate and initialize a new KeywordRestParameterNode node.
3425
+ */
3426
+ pm_keyword_rest_parameter_node_t *
3427
+ pm_keyword_rest_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) {
3428
+ pm_keyword_rest_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_keyword_rest_parameter_node_t);
3429
+
3430
+ *node = (pm_keyword_rest_parameter_node_t) {
3431
+ .base = { .type = PM_KEYWORD_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3432
+ .name = name,
3433
+ .name_loc = name_loc,
3434
+ .operator_loc = operator_loc
3435
+ };
3436
+
3437
+ return node;
3438
+ }
3439
+
3440
+ /**
3441
+ * Allocate and initialize a new LambdaNode node.
3442
+ */
3443
+ pm_lambda_node_t *
3444
+ pm_lambda_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t operator_loc, pm_location_t opening_loc, pm_location_t closing_loc, struct pm_node *parameters, struct pm_node *body) {
3445
+ pm_lambda_node_t *node = PM_ARENA_ALLOC(arena, pm_lambda_node_t);
3446
+
3447
+ *node = (pm_lambda_node_t) {
3448
+ .base = { .type = PM_LAMBDA_NODE, .flags = flags, .node_id = node_id, .location = location },
3449
+ .locals = locals,
3450
+ .operator_loc = operator_loc,
3451
+ .opening_loc = opening_loc,
3452
+ .closing_loc = closing_loc,
3453
+ .parameters = parameters,
3454
+ .body = body
3455
+ };
3456
+
3457
+ return node;
3458
+ }
3459
+
3460
+ /**
3461
+ * Allocate and initialize a new LocalVariableAndWriteNode node.
3462
+ */
3463
+ pm_local_variable_and_write_node_t *
3464
+ pm_local_variable_and_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value, pm_constant_id_t name, uint32_t depth) {
3465
+ pm_local_variable_and_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_and_write_node_t);
3466
+
3467
+ *node = (pm_local_variable_and_write_node_t) {
3468
+ .base = { .type = PM_LOCAL_VARIABLE_AND_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3469
+ .name_loc = name_loc,
3470
+ .operator_loc = operator_loc,
3471
+ .value = value,
3472
+ .name = name,
3473
+ .depth = depth
3474
+ };
3475
+
3476
+ return node;
3477
+ }
3478
+
3479
+ /**
3480
+ * Allocate and initialize a new LocalVariableOperatorWriteNode node.
3481
+ */
3482
+ pm_local_variable_operator_write_node_t *
3483
+ pm_local_variable_operator_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t binary_operator_loc, struct pm_node *value, pm_constant_id_t name, pm_constant_id_t binary_operator, uint32_t depth) {
3484
+ pm_local_variable_operator_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_operator_write_node_t);
3485
+
3486
+ *node = (pm_local_variable_operator_write_node_t) {
3487
+ .base = { .type = PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3488
+ .name_loc = name_loc,
3489
+ .binary_operator_loc = binary_operator_loc,
3490
+ .value = value,
3491
+ .name = name,
3492
+ .binary_operator = binary_operator,
3493
+ .depth = depth
3494
+ };
3495
+
3496
+ return node;
3497
+ }
3498
+
3499
+ /**
3500
+ * Allocate and initialize a new LocalVariableOrWriteNode node.
3501
+ */
3502
+ pm_local_variable_or_write_node_t *
3503
+ pm_local_variable_or_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value, pm_constant_id_t name, uint32_t depth) {
3504
+ pm_local_variable_or_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_or_write_node_t);
3505
+
3506
+ *node = (pm_local_variable_or_write_node_t) {
3507
+ .base = { .type = PM_LOCAL_VARIABLE_OR_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3508
+ .name_loc = name_loc,
3509
+ .operator_loc = operator_loc,
3510
+ .value = value,
3511
+ .name = name,
3512
+ .depth = depth
3513
+ };
3514
+
3515
+ return node;
3516
+ }
3517
+
3518
+ /**
3519
+ * Allocate and initialize a new LocalVariableReadNode node.
3520
+ */
3521
+ pm_local_variable_read_node_t *
3522
+ pm_local_variable_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth) {
3523
+ pm_local_variable_read_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_read_node_t);
3524
+
3525
+ *node = (pm_local_variable_read_node_t) {
3526
+ .base = { .type = PM_LOCAL_VARIABLE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3527
+ .name = name,
3528
+ .depth = depth
3529
+ };
3530
+
3531
+ return node;
3532
+ }
3533
+
3534
+ /**
3535
+ * Allocate and initialize a new LocalVariableTargetNode node.
3536
+ */
3537
+ pm_local_variable_target_node_t *
3538
+ pm_local_variable_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth) {
3539
+ pm_local_variable_target_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_target_node_t);
3540
+
3541
+ *node = (pm_local_variable_target_node_t) {
3542
+ .base = { .type = PM_LOCAL_VARIABLE_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3543
+ .name = name,
3544
+ .depth = depth
3545
+ };
3546
+
3547
+ return node;
3548
+ }
3549
+
3550
+ /**
3551
+ * Allocate and initialize a new LocalVariableWriteNode node.
3552
+ */
3553
+ pm_local_variable_write_node_t *
3554
+ pm_local_variable_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, uint32_t depth, pm_location_t name_loc, struct pm_node *value, pm_location_t operator_loc) {
3555
+ pm_local_variable_write_node_t *node = PM_ARENA_ALLOC(arena, pm_local_variable_write_node_t);
3556
+
3557
+ *node = (pm_local_variable_write_node_t) {
3558
+ .base = { .type = PM_LOCAL_VARIABLE_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3559
+ .name = name,
3560
+ .depth = depth,
3561
+ .name_loc = name_loc,
3562
+ .value = value,
3563
+ .operator_loc = operator_loc
3564
+ };
3565
+
3566
+ return node;
3567
+ }
3568
+
3569
+ /**
3570
+ * Allocate and initialize a new MatchLastLineNode node.
3571
+ */
3572
+ pm_match_last_line_node_t *
3573
+ pm_match_last_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
3574
+ pm_match_last_line_node_t *node = PM_ARENA_ALLOC(arena, pm_match_last_line_node_t);
3575
+
3576
+ *node = (pm_match_last_line_node_t) {
3577
+ .base = { .type = PM_MATCH_LAST_LINE_NODE, .flags = flags, .node_id = node_id, .location = location },
3578
+ .opening_loc = opening_loc,
3579
+ .content_loc = content_loc,
3580
+ .closing_loc = closing_loc,
3581
+ .unescaped = unescaped
3582
+ };
3583
+
3584
+ return node;
3585
+ }
3586
+
3587
+ /**
3588
+ * Allocate and initialize a new MatchPredicateNode node.
3589
+ */
3590
+ pm_match_predicate_node_t *
3591
+ pm_match_predicate_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_node *pattern, pm_location_t keyword_loc) {
3592
+ pm_match_predicate_node_t *node = PM_ARENA_ALLOC(arena, pm_match_predicate_node_t);
3593
+
3594
+ *node = (pm_match_predicate_node_t) {
3595
+ .base = { .type = PM_MATCH_PREDICATE_NODE, .flags = flags, .node_id = node_id, .location = location },
3596
+ .value = value,
3597
+ .pattern = pattern,
3598
+ .keyword_loc = keyword_loc
3599
+ };
3600
+
3601
+ return node;
3602
+ }
3603
+
3604
+ /**
3605
+ * Allocate and initialize a new MatchRequiredNode node.
3606
+ */
3607
+ pm_match_required_node_t *
3608
+ pm_match_required_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *value, struct pm_node *pattern, pm_location_t operator_loc) {
3609
+ pm_match_required_node_t *node = PM_ARENA_ALLOC(arena, pm_match_required_node_t);
3610
+
3611
+ *node = (pm_match_required_node_t) {
3612
+ .base = { .type = PM_MATCH_REQUIRED_NODE, .flags = flags, .node_id = node_id, .location = location },
3613
+ .value = value,
3614
+ .pattern = pattern,
3615
+ .operator_loc = operator_loc
3616
+ };
3617
+
3618
+ return node;
3619
+ }
3620
+
3621
+ /**
3622
+ * Allocate and initialize a new MatchWriteNode node.
3623
+ */
3624
+ pm_match_write_node_t *
3625
+ pm_match_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_call_node *call, pm_node_list_t targets) {
3626
+ pm_match_write_node_t *node = PM_ARENA_ALLOC(arena, pm_match_write_node_t);
3627
+
3628
+ *node = (pm_match_write_node_t) {
3629
+ .base = { .type = PM_MATCH_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3630
+ .call = call,
3631
+ .targets = targets
3632
+ };
3633
+
3634
+ return node;
3635
+ }
3636
+
3637
+ /**
3638
+ * Allocate and initialize a new ModuleNode node.
3639
+ */
3640
+ pm_module_node_t *
3641
+ pm_module_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t module_keyword_loc, struct pm_node *constant_path, struct pm_node *body, pm_location_t end_keyword_loc, pm_constant_id_t name) {
3642
+ pm_module_node_t *node = PM_ARENA_ALLOC(arena, pm_module_node_t);
3643
+
3644
+ *node = (pm_module_node_t) {
3645
+ .base = { .type = PM_MODULE_NODE, .flags = flags, .node_id = node_id, .location = location },
3646
+ .locals = locals,
3647
+ .module_keyword_loc = module_keyword_loc,
3648
+ .constant_path = constant_path,
3649
+ .body = body,
3650
+ .end_keyword_loc = end_keyword_loc,
3651
+ .name = name
3652
+ };
3653
+
3654
+ return node;
3655
+ }
3656
+
3657
+ /**
3658
+ * Allocate and initialize a new MultiTargetNode node.
3659
+ */
3660
+ pm_multi_target_node_t *
3661
+ pm_multi_target_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t lefts, struct pm_node *rest, pm_node_list_t rights, pm_location_t lparen_loc, pm_location_t rparen_loc) {
3662
+ pm_multi_target_node_t *node = PM_ARENA_ALLOC(arena, pm_multi_target_node_t);
3663
+
3664
+ *node = (pm_multi_target_node_t) {
3665
+ .base = { .type = PM_MULTI_TARGET_NODE, .flags = flags, .node_id = node_id, .location = location },
3666
+ .lefts = lefts,
3667
+ .rest = rest,
3668
+ .rights = rights,
3669
+ .lparen_loc = lparen_loc,
3670
+ .rparen_loc = rparen_loc
3671
+ };
3672
+
3673
+ return node;
3674
+ }
3675
+
3676
+ /**
3677
+ * Allocate and initialize a new MultiWriteNode node.
3678
+ */
3679
+ pm_multi_write_node_t *
3680
+ pm_multi_write_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t lefts, struct pm_node *rest, pm_node_list_t rights, pm_location_t lparen_loc, pm_location_t rparen_loc, pm_location_t operator_loc, struct pm_node *value) {
3681
+ pm_multi_write_node_t *node = PM_ARENA_ALLOC(arena, pm_multi_write_node_t);
3682
+
3683
+ *node = (pm_multi_write_node_t) {
3684
+ .base = { .type = PM_MULTI_WRITE_NODE, .flags = flags, .node_id = node_id, .location = location },
3685
+ .lefts = lefts,
3686
+ .rest = rest,
3687
+ .rights = rights,
3688
+ .lparen_loc = lparen_loc,
3689
+ .rparen_loc = rparen_loc,
3690
+ .operator_loc = operator_loc,
3691
+ .value = value
3692
+ };
3693
+
3694
+ return node;
3695
+ }
3696
+
3697
+ /**
3698
+ * Allocate and initialize a new NextNode node.
3699
+ */
3700
+ pm_next_node_t *
3701
+ pm_next_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_arguments_node *arguments, pm_location_t keyword_loc) {
3702
+ pm_next_node_t *node = PM_ARENA_ALLOC(arena, pm_next_node_t);
3703
+
3704
+ *node = (pm_next_node_t) {
3705
+ .base = { .type = PM_NEXT_NODE, .flags = flags, .node_id = node_id, .location = location },
3706
+ .arguments = arguments,
3707
+ .keyword_loc = keyword_loc
3708
+ };
3709
+
3710
+ return node;
3711
+ }
3712
+
3713
+ /**
3714
+ * Allocate and initialize a new NilNode node.
3715
+ */
3716
+ pm_nil_node_t *
3717
+ pm_nil_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
3718
+ pm_nil_node_t *node = PM_ARENA_ALLOC(arena, pm_nil_node_t);
3719
+
3720
+ *node = (pm_nil_node_t) {
3721
+ .base = { .type = PM_NIL_NODE, .flags = flags, .node_id = node_id, .location = location }
3722
+ };
3723
+
3724
+ return node;
3725
+ }
3726
+
3727
+ /**
3728
+ * Allocate and initialize a new NoBlockParameterNode node.
3729
+ */
3730
+ pm_no_block_parameter_node_t *
3731
+ pm_no_block_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, pm_location_t keyword_loc) {
3732
+ pm_no_block_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_no_block_parameter_node_t);
3733
+
3734
+ *node = (pm_no_block_parameter_node_t) {
3735
+ .base = { .type = PM_NO_BLOCK_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3736
+ .operator_loc = operator_loc,
3737
+ .keyword_loc = keyword_loc
3738
+ };
3739
+
3740
+ return node;
3741
+ }
3742
+
3743
+ /**
3744
+ * Allocate and initialize a new NoKeywordsParameterNode node.
3745
+ */
3746
+ pm_no_keywords_parameter_node_t *
3747
+ pm_no_keywords_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, pm_location_t keyword_loc) {
3748
+ pm_no_keywords_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_no_keywords_parameter_node_t);
3749
+
3750
+ *node = (pm_no_keywords_parameter_node_t) {
3751
+ .base = { .type = PM_NO_KEYWORDS_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3752
+ .operator_loc = operator_loc,
3753
+ .keyword_loc = keyword_loc
3754
+ };
3755
+
3756
+ return node;
3757
+ }
3758
+
3759
+ /**
3760
+ * Allocate and initialize a new NumberedParametersNode node.
3761
+ */
3762
+ pm_numbered_parameters_node_t *
3763
+ pm_numbered_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, uint8_t maximum) {
3764
+ pm_numbered_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_numbered_parameters_node_t);
3765
+
3766
+ *node = (pm_numbered_parameters_node_t) {
3767
+ .base = { .type = PM_NUMBERED_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
3768
+ .maximum = maximum
3769
+ };
3770
+
3771
+ return node;
3772
+ }
3773
+
3774
+ /**
3775
+ * Allocate and initialize a new NumberedReferenceReadNode node.
3776
+ */
3777
+ pm_numbered_reference_read_node_t *
3778
+ pm_numbered_reference_read_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, uint32_t number) {
3779
+ pm_numbered_reference_read_node_t *node = PM_ARENA_ALLOC(arena, pm_numbered_reference_read_node_t);
3780
+
3781
+ *node = (pm_numbered_reference_read_node_t) {
3782
+ .base = { .type = PM_NUMBERED_REFERENCE_READ_NODE, .flags = flags, .node_id = node_id, .location = location },
3783
+ .number = number
3784
+ };
3785
+
3786
+ return node;
3787
+ }
3788
+
3789
+ /**
3790
+ * Allocate and initialize a new OptionalKeywordParameterNode node.
3791
+ */
3792
+ pm_optional_keyword_parameter_node_t *
3793
+ pm_optional_keyword_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, struct pm_node *value) {
3794
+ pm_optional_keyword_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_optional_keyword_parameter_node_t);
3795
+
3796
+ *node = (pm_optional_keyword_parameter_node_t) {
3797
+ .base = { .type = PM_OPTIONAL_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3798
+ .name = name,
3799
+ .name_loc = name_loc,
3800
+ .value = value
3801
+ };
3802
+
3803
+ return node;
3804
+ }
3805
+
3806
+ /**
3807
+ * Allocate and initialize a new OptionalParameterNode node.
3808
+ */
3809
+ pm_optional_parameter_node_t *
3810
+ pm_optional_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc, struct pm_node *value) {
3811
+ pm_optional_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_optional_parameter_node_t);
3812
+
3813
+ *node = (pm_optional_parameter_node_t) {
3814
+ .base = { .type = PM_OPTIONAL_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
3815
+ .name = name,
3816
+ .name_loc = name_loc,
3817
+ .operator_loc = operator_loc,
3818
+ .value = value
3819
+ };
3820
+
3821
+ return node;
3822
+ }
3823
+
3824
+ /**
3825
+ * Allocate and initialize a new OrNode node.
3826
+ */
3827
+ pm_or_node_t *
3828
+ pm_or_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
3829
+ pm_or_node_t *node = PM_ARENA_ALLOC(arena, pm_or_node_t);
3830
+
3831
+ *node = (pm_or_node_t) {
3832
+ .base = { .type = PM_OR_NODE, .flags = flags, .node_id = node_id, .location = location },
3833
+ .left = left,
3834
+ .right = right,
3835
+ .operator_loc = operator_loc
3836
+ };
3837
+
3838
+ return node;
3839
+ }
3840
+
3841
+ /**
3842
+ * Allocate and initialize a new ParametersNode node.
3843
+ */
3844
+ pm_parameters_node_t *
3845
+ pm_parameters_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t requireds, pm_node_list_t optionals, struct pm_node *rest, pm_node_list_t posts, pm_node_list_t keywords, struct pm_node *keyword_rest, struct pm_node *block) {
3846
+ pm_parameters_node_t *node = PM_ARENA_ALLOC(arena, pm_parameters_node_t);
3847
+
3848
+ *node = (pm_parameters_node_t) {
3849
+ .base = { .type = PM_PARAMETERS_NODE, .flags = flags, .node_id = node_id, .location = location },
3850
+ .requireds = requireds,
3851
+ .optionals = optionals,
3852
+ .rest = rest,
3853
+ .posts = posts,
3854
+ .keywords = keywords,
3855
+ .keyword_rest = keyword_rest,
3856
+ .block = block
3857
+ };
3858
+
3859
+ return node;
3860
+ }
3861
+
3862
+ /**
3863
+ * Allocate and initialize a new ParenthesesNode node.
3864
+ */
3865
+ pm_parentheses_node_t *
3866
+ pm_parentheses_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *body, pm_location_t opening_loc, pm_location_t closing_loc) {
3867
+ pm_parentheses_node_t *node = PM_ARENA_ALLOC(arena, pm_parentheses_node_t);
3868
+
3869
+ *node = (pm_parentheses_node_t) {
3870
+ .base = { .type = PM_PARENTHESES_NODE, .flags = flags, .node_id = node_id, .location = location },
3871
+ .body = body,
3872
+ .opening_loc = opening_loc,
3873
+ .closing_loc = closing_loc
3874
+ };
3875
+
3876
+ return node;
3877
+ }
3878
+
3879
+ /**
3880
+ * Allocate and initialize a new PinnedExpressionNode node.
3881
+ */
3882
+ pm_pinned_expression_node_t *
3883
+ pm_pinned_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t operator_loc, pm_location_t lparen_loc, pm_location_t rparen_loc) {
3884
+ pm_pinned_expression_node_t *node = PM_ARENA_ALLOC(arena, pm_pinned_expression_node_t);
3885
+
3886
+ *node = (pm_pinned_expression_node_t) {
3887
+ .base = { .type = PM_PINNED_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
3888
+ .expression = expression,
3889
+ .operator_loc = operator_loc,
3890
+ .lparen_loc = lparen_loc,
3891
+ .rparen_loc = rparen_loc
3892
+ };
3893
+
3894
+ return node;
3895
+ }
3896
+
3897
+ /**
3898
+ * Allocate and initialize a new PinnedVariableNode node.
3899
+ */
3900
+ pm_pinned_variable_node_t *
3901
+ pm_pinned_variable_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *variable, pm_location_t operator_loc) {
3902
+ pm_pinned_variable_node_t *node = PM_ARENA_ALLOC(arena, pm_pinned_variable_node_t);
3903
+
3904
+ *node = (pm_pinned_variable_node_t) {
3905
+ .base = { .type = PM_PINNED_VARIABLE_NODE, .flags = flags, .node_id = node_id, .location = location },
3906
+ .variable = variable,
3907
+ .operator_loc = operator_loc
3908
+ };
3909
+
3910
+ return node;
3911
+ }
3912
+
3913
+ /**
3914
+ * Allocate and initialize a new PostExecutionNode node.
3915
+ */
3916
+ pm_post_execution_node_t *
3917
+ pm_post_execution_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_statements_node *statements, pm_location_t keyword_loc, pm_location_t opening_loc, pm_location_t closing_loc) {
3918
+ pm_post_execution_node_t *node = PM_ARENA_ALLOC(arena, pm_post_execution_node_t);
3919
+
3920
+ *node = (pm_post_execution_node_t) {
3921
+ .base = { .type = PM_POST_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location },
3922
+ .statements = statements,
3923
+ .keyword_loc = keyword_loc,
3924
+ .opening_loc = opening_loc,
3925
+ .closing_loc = closing_loc
3926
+ };
3927
+
3928
+ return node;
3929
+ }
3930
+
3931
+ /**
3932
+ * Allocate and initialize a new PreExecutionNode node.
3933
+ */
3934
+ pm_pre_execution_node_t *
3935
+ pm_pre_execution_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_statements_node *statements, pm_location_t keyword_loc, pm_location_t opening_loc, pm_location_t closing_loc) {
3936
+ pm_pre_execution_node_t *node = PM_ARENA_ALLOC(arena, pm_pre_execution_node_t);
3937
+
3938
+ *node = (pm_pre_execution_node_t) {
3939
+ .base = { .type = PM_PRE_EXECUTION_NODE, .flags = flags, .node_id = node_id, .location = location },
3940
+ .statements = statements,
3941
+ .keyword_loc = keyword_loc,
3942
+ .opening_loc = opening_loc,
3943
+ .closing_loc = closing_loc
3944
+ };
3945
+
3946
+ return node;
3947
+ }
3948
+
3949
+ /**
3950
+ * Allocate and initialize a new ProgramNode node.
3951
+ */
3952
+ pm_program_node_t *
3953
+ pm_program_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, struct pm_statements_node *statements) {
3954
+ pm_program_node_t *node = PM_ARENA_ALLOC(arena, pm_program_node_t);
3955
+
3956
+ *node = (pm_program_node_t) {
3957
+ .base = { .type = PM_PROGRAM_NODE, .flags = flags, .node_id = node_id, .location = location },
3958
+ .locals = locals,
3959
+ .statements = statements
3960
+ };
3961
+
3962
+ return node;
3963
+ }
3964
+
3965
+ /**
3966
+ * Allocate and initialize a new RangeNode node.
3967
+ */
3968
+ pm_range_node_t *
3969
+ pm_range_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *left, struct pm_node *right, pm_location_t operator_loc) {
3970
+ pm_range_node_t *node = PM_ARENA_ALLOC(arena, pm_range_node_t);
3971
+
3972
+ *node = (pm_range_node_t) {
3973
+ .base = { .type = PM_RANGE_NODE, .flags = flags, .node_id = node_id, .location = location },
3974
+ .left = left,
3975
+ .right = right,
3976
+ .operator_loc = operator_loc
3977
+ };
3978
+
3979
+ return node;
3980
+ }
3981
+
3982
+ /**
3983
+ * Allocate and initialize a new RationalNode node.
3984
+ */
3985
+ pm_rational_node_t *
3986
+ pm_rational_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_integer_t numerator, pm_integer_t denominator) {
3987
+ pm_rational_node_t *node = PM_ARENA_ALLOC(arena, pm_rational_node_t);
3988
+
3989
+ *node = (pm_rational_node_t) {
3990
+ .base = { .type = PM_RATIONAL_NODE, .flags = flags, .node_id = node_id, .location = location },
3991
+ .numerator = numerator,
3992
+ .denominator = denominator
3993
+ };
3994
+
3995
+ return node;
3996
+ }
3997
+
3998
+ /**
3999
+ * Allocate and initialize a new RedoNode node.
4000
+ */
4001
+ pm_redo_node_t *
4002
+ pm_redo_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4003
+ pm_redo_node_t *node = PM_ARENA_ALLOC(arena, pm_redo_node_t);
4004
+
4005
+ *node = (pm_redo_node_t) {
4006
+ .base = { .type = PM_REDO_NODE, .flags = flags, .node_id = node_id, .location = location }
4007
+ };
4008
+
4009
+ return node;
4010
+ }
4011
+
4012
+ /**
4013
+ * Allocate and initialize a new RegularExpressionNode node.
4014
+ */
4015
+ pm_regular_expression_node_t *
4016
+ pm_regular_expression_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4017
+ pm_regular_expression_node_t *node = PM_ARENA_ALLOC(arena, pm_regular_expression_node_t);
4018
+
4019
+ *node = (pm_regular_expression_node_t) {
4020
+ .base = { .type = PM_REGULAR_EXPRESSION_NODE, .flags = flags, .node_id = node_id, .location = location },
4021
+ .opening_loc = opening_loc,
4022
+ .content_loc = content_loc,
4023
+ .closing_loc = closing_loc,
4024
+ .unescaped = unescaped
4025
+ };
4026
+
4027
+ return node;
4028
+ }
4029
+
4030
+ /**
4031
+ * Allocate and initialize a new RequiredKeywordParameterNode node.
4032
+ */
4033
+ pm_required_keyword_parameter_node_t *
4034
+ pm_required_keyword_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc) {
4035
+ pm_required_keyword_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_required_keyword_parameter_node_t);
4036
+
4037
+ *node = (pm_required_keyword_parameter_node_t) {
4038
+ .base = { .type = PM_REQUIRED_KEYWORD_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4039
+ .name = name,
4040
+ .name_loc = name_loc
4041
+ };
4042
+
4043
+ return node;
4044
+ }
4045
+
4046
+ /**
4047
+ * Allocate and initialize a new RequiredParameterNode node.
4048
+ */
4049
+ pm_required_parameter_node_t *
4050
+ pm_required_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name) {
4051
+ pm_required_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_required_parameter_node_t);
4052
+
4053
+ *node = (pm_required_parameter_node_t) {
4054
+ .base = { .type = PM_REQUIRED_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4055
+ .name = name
4056
+ };
4057
+
4058
+ return node;
4059
+ }
4060
+
4061
+ /**
4062
+ * Allocate and initialize a new RescueModifierNode node.
4063
+ */
4064
+ pm_rescue_modifier_node_t *
4065
+ pm_rescue_modifier_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *expression, pm_location_t keyword_loc, struct pm_node *rescue_expression) {
4066
+ pm_rescue_modifier_node_t *node = PM_ARENA_ALLOC(arena, pm_rescue_modifier_node_t);
4067
+
4068
+ *node = (pm_rescue_modifier_node_t) {
4069
+ .base = { .type = PM_RESCUE_MODIFIER_NODE, .flags = flags, .node_id = node_id, .location = location },
4070
+ .expression = expression,
4071
+ .keyword_loc = keyword_loc,
4072
+ .rescue_expression = rescue_expression
4073
+ };
4074
+
4075
+ return node;
4076
+ }
4077
+
4078
+ /**
4079
+ * Allocate and initialize a new RescueNode node.
4080
+ */
4081
+ pm_rescue_node_t *
4082
+ pm_rescue_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_node_list_t exceptions, pm_location_t operator_loc, struct pm_node *reference, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_rescue_node *subsequent) {
4083
+ pm_rescue_node_t *node = PM_ARENA_ALLOC(arena, pm_rescue_node_t);
4084
+
4085
+ *node = (pm_rescue_node_t) {
4086
+ .base = { .type = PM_RESCUE_NODE, .flags = flags, .node_id = node_id, .location = location },
4087
+ .keyword_loc = keyword_loc,
4088
+ .exceptions = exceptions,
4089
+ .operator_loc = operator_loc,
4090
+ .reference = reference,
4091
+ .then_keyword_loc = then_keyword_loc,
4092
+ .statements = statements,
4093
+ .subsequent = subsequent
4094
+ };
4095
+
4096
+ return node;
4097
+ }
4098
+
4099
+ /**
4100
+ * Allocate and initialize a new RestParameterNode node.
4101
+ */
4102
+ pm_rest_parameter_node_t *
4103
+ pm_rest_parameter_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_t name, pm_location_t name_loc, pm_location_t operator_loc) {
4104
+ pm_rest_parameter_node_t *node = PM_ARENA_ALLOC(arena, pm_rest_parameter_node_t);
4105
+
4106
+ *node = (pm_rest_parameter_node_t) {
4107
+ .base = { .type = PM_REST_PARAMETER_NODE, .flags = flags, .node_id = node_id, .location = location },
4108
+ .name = name,
4109
+ .name_loc = name_loc,
4110
+ .operator_loc = operator_loc
4111
+ };
4112
+
4113
+ return node;
4114
+ }
4115
+
4116
+ /**
4117
+ * Allocate and initialize a new RetryNode node.
4118
+ */
4119
+ pm_retry_node_t *
4120
+ pm_retry_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4121
+ pm_retry_node_t *node = PM_ARENA_ALLOC(arena, pm_retry_node_t);
4122
+
4123
+ *node = (pm_retry_node_t) {
4124
+ .base = { .type = PM_RETRY_NODE, .flags = flags, .node_id = node_id, .location = location }
4125
+ };
4126
+
4127
+ return node;
4128
+ }
4129
+
4130
+ /**
4131
+ * Allocate and initialize a new ReturnNode node.
4132
+ */
4133
+ pm_return_node_t *
4134
+ pm_return_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, struct pm_arguments_node *arguments) {
4135
+ pm_return_node_t *node = PM_ARENA_ALLOC(arena, pm_return_node_t);
4136
+
4137
+ *node = (pm_return_node_t) {
4138
+ .base = { .type = PM_RETURN_NODE, .flags = flags, .node_id = node_id, .location = location },
4139
+ .keyword_loc = keyword_loc,
4140
+ .arguments = arguments
4141
+ };
4142
+
4143
+ return node;
4144
+ }
4145
+
4146
+ /**
4147
+ * Allocate and initialize a new SelfNode node.
4148
+ */
4149
+ pm_self_node_t *
4150
+ pm_self_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4151
+ pm_self_node_t *node = PM_ARENA_ALLOC(arena, pm_self_node_t);
4152
+
4153
+ *node = (pm_self_node_t) {
4154
+ .base = { .type = PM_SELF_NODE, .flags = flags, .node_id = node_id, .location = location }
4155
+ };
4156
+
4157
+ return node;
4158
+ }
4159
+
4160
+ /**
4161
+ * Allocate and initialize a new ShareableConstantNode node.
4162
+ */
4163
+ pm_shareable_constant_node_t *
4164
+ pm_shareable_constant_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, struct pm_node *write) {
4165
+ pm_shareable_constant_node_t *node = PM_ARENA_ALLOC(arena, pm_shareable_constant_node_t);
4166
+
4167
+ *node = (pm_shareable_constant_node_t) {
4168
+ .base = { .type = PM_SHAREABLE_CONSTANT_NODE, .flags = flags, .node_id = node_id, .location = location },
4169
+ .write = write
4170
+ };
4171
+
4172
+ return node;
4173
+ }
4174
+
4175
+ /**
4176
+ * Allocate and initialize a new SingletonClassNode node.
4177
+ */
4178
+ pm_singleton_class_node_t *
4179
+ pm_singleton_class_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_constant_id_list_t locals, pm_location_t class_keyword_loc, pm_location_t operator_loc, struct pm_node *expression, struct pm_node *body, pm_location_t end_keyword_loc) {
4180
+ pm_singleton_class_node_t *node = PM_ARENA_ALLOC(arena, pm_singleton_class_node_t);
4181
+
4182
+ *node = (pm_singleton_class_node_t) {
4183
+ .base = { .type = PM_SINGLETON_CLASS_NODE, .flags = flags, .node_id = node_id, .location = location },
4184
+ .locals = locals,
4185
+ .class_keyword_loc = class_keyword_loc,
4186
+ .operator_loc = operator_loc,
4187
+ .expression = expression,
4188
+ .body = body,
4189
+ .end_keyword_loc = end_keyword_loc
4190
+ };
4191
+
4192
+ return node;
4193
+ }
4194
+
4195
+ /**
4196
+ * Allocate and initialize a new SourceEncodingNode node.
4197
+ */
4198
+ pm_source_encoding_node_t *
4199
+ pm_source_encoding_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4200
+ pm_source_encoding_node_t *node = PM_ARENA_ALLOC(arena, pm_source_encoding_node_t);
4201
+
4202
+ *node = (pm_source_encoding_node_t) {
4203
+ .base = { .type = PM_SOURCE_ENCODING_NODE, .flags = flags, .node_id = node_id, .location = location }
4204
+ };
4205
+
4206
+ return node;
4207
+ }
4208
+
4209
+ /**
4210
+ * Allocate and initialize a new SourceFileNode node.
4211
+ */
4212
+ pm_source_file_node_t *
4213
+ pm_source_file_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_string_t filepath) {
4214
+ pm_source_file_node_t *node = PM_ARENA_ALLOC(arena, pm_source_file_node_t);
4215
+
4216
+ *node = (pm_source_file_node_t) {
4217
+ .base = { .type = PM_SOURCE_FILE_NODE, .flags = flags, .node_id = node_id, .location = location },
4218
+ .filepath = filepath
4219
+ };
4220
+
4221
+ return node;
4222
+ }
4223
+
4224
+ /**
4225
+ * Allocate and initialize a new SourceLineNode node.
4226
+ */
4227
+ pm_source_line_node_t *
4228
+ pm_source_line_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4229
+ pm_source_line_node_t *node = PM_ARENA_ALLOC(arena, pm_source_line_node_t);
4230
+
4231
+ *node = (pm_source_line_node_t) {
4232
+ .base = { .type = PM_SOURCE_LINE_NODE, .flags = flags, .node_id = node_id, .location = location }
4233
+ };
4234
+
4235
+ return node;
4236
+ }
4237
+
4238
+ /**
4239
+ * Allocate and initialize a new SplatNode node.
4240
+ */
4241
+ pm_splat_node_t *
4242
+ pm_splat_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t operator_loc, struct pm_node *expression) {
4243
+ pm_splat_node_t *node = PM_ARENA_ALLOC(arena, pm_splat_node_t);
4244
+
4245
+ *node = (pm_splat_node_t) {
4246
+ .base = { .type = PM_SPLAT_NODE, .flags = flags, .node_id = node_id, .location = location },
4247
+ .operator_loc = operator_loc,
4248
+ .expression = expression
4249
+ };
4250
+
4251
+ return node;
4252
+ }
4253
+
4254
+ /**
4255
+ * Allocate and initialize a new StatementsNode node.
4256
+ */
4257
+ pm_statements_node_t *
4258
+ pm_statements_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t body) {
4259
+ pm_statements_node_t *node = PM_ARENA_ALLOC(arena, pm_statements_node_t);
4260
+
4261
+ *node = (pm_statements_node_t) {
4262
+ .base = { .type = PM_STATEMENTS_NODE, .flags = flags, .node_id = node_id, .location = location },
4263
+ .body = body
4264
+ };
4265
+
4266
+ return node;
4267
+ }
4268
+
4269
+ /**
4270
+ * Allocate and initialize a new StringNode node.
4271
+ */
4272
+ pm_string_node_t *
4273
+ pm_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4274
+ pm_string_node_t *node = PM_ARENA_ALLOC(arena, pm_string_node_t);
4275
+
4276
+ *node = (pm_string_node_t) {
4277
+ .base = { .type = PM_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
4278
+ .opening_loc = opening_loc,
4279
+ .content_loc = content_loc,
4280
+ .closing_loc = closing_loc,
4281
+ .unescaped = unescaped
4282
+ };
4283
+
4284
+ return node;
4285
+ }
4286
+
4287
+ /**
4288
+ * Allocate and initialize a new SuperNode node.
4289
+ */
4290
+ pm_super_node_t *
4291
+ pm_super_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_location_t lparen_loc, struct pm_arguments_node *arguments, pm_location_t rparen_loc, struct pm_node *block) {
4292
+ pm_super_node_t *node = PM_ARENA_ALLOC(arena, pm_super_node_t);
4293
+
4294
+ *node = (pm_super_node_t) {
4295
+ .base = { .type = PM_SUPER_NODE, .flags = flags, .node_id = node_id, .location = location },
4296
+ .keyword_loc = keyword_loc,
4297
+ .lparen_loc = lparen_loc,
4298
+ .arguments = arguments,
4299
+ .rparen_loc = rparen_loc,
4300
+ .block = block
4301
+ };
4302
+
4303
+ return node;
4304
+ }
4305
+
4306
+ /**
4307
+ * Allocate and initialize a new SymbolNode node.
4308
+ */
4309
+ pm_symbol_node_t *
4310
+ pm_symbol_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4311
+ pm_symbol_node_t *node = PM_ARENA_ALLOC(arena, pm_symbol_node_t);
4312
+
4313
+ *node = (pm_symbol_node_t) {
4314
+ .base = { .type = PM_SYMBOL_NODE, .flags = flags, .node_id = node_id, .location = location },
4315
+ .opening_loc = opening_loc,
4316
+ .content_loc = content_loc,
4317
+ .closing_loc = closing_loc,
4318
+ .unescaped = unescaped
4319
+ };
4320
+
4321
+ return node;
4322
+ }
4323
+
4324
+ /**
4325
+ * Allocate and initialize a new TrueNode node.
4326
+ */
4327
+ pm_true_node_t *
4328
+ pm_true_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location) {
4329
+ pm_true_node_t *node = PM_ARENA_ALLOC(arena, pm_true_node_t);
4330
+
4331
+ *node = (pm_true_node_t) {
4332
+ .base = { .type = PM_TRUE_NODE, .flags = flags, .node_id = node_id, .location = location }
4333
+ };
4334
+
4335
+ return node;
4336
+ }
4337
+
4338
+ /**
4339
+ * Allocate and initialize a new UndefNode node.
4340
+ */
4341
+ pm_undef_node_t *
4342
+ pm_undef_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_node_list_t names, pm_location_t keyword_loc) {
4343
+ pm_undef_node_t *node = PM_ARENA_ALLOC(arena, pm_undef_node_t);
4344
+
4345
+ *node = (pm_undef_node_t) {
4346
+ .base = { .type = PM_UNDEF_NODE, .flags = flags, .node_id = node_id, .location = location },
4347
+ .names = names,
4348
+ .keyword_loc = keyword_loc
4349
+ };
4350
+
4351
+ return node;
4352
+ }
4353
+
4354
+ /**
4355
+ * Allocate and initialize a new UnlessNode node.
4356
+ */
4357
+ pm_unless_node_t *
4358
+ pm_unless_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t unless_keyword_loc, struct pm_node *predicate, pm_location_t then_keyword_loc, struct pm_statements_node *statements, struct pm_else_node *else_clause, pm_location_t end_keyword_loc) {
4359
+ pm_unless_node_t *node = PM_ARENA_ALLOC(arena, pm_unless_node_t);
4360
+
4361
+ *node = (pm_unless_node_t) {
4362
+ .base = { .type = PM_UNLESS_NODE, .flags = flags, .node_id = node_id, .location = location },
4363
+ .unless_keyword_loc = unless_keyword_loc,
4364
+ .predicate = predicate,
4365
+ .then_keyword_loc = then_keyword_loc,
4366
+ .statements = statements,
4367
+ .else_clause = else_clause,
4368
+ .end_keyword_loc = end_keyword_loc
4369
+ };
4370
+
4371
+ return node;
4372
+ }
4373
+
4374
+ /**
4375
+ * Allocate and initialize a new UntilNode node.
4376
+ */
4377
+ pm_until_node_t *
4378
+ pm_until_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t until_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc, struct pm_node *predicate, struct pm_statements_node *statements) {
4379
+ pm_until_node_t *node = PM_ARENA_ALLOC(arena, pm_until_node_t);
4380
+
4381
+ *node = (pm_until_node_t) {
4382
+ .base = { .type = PM_UNTIL_NODE, .flags = flags, .node_id = node_id, .location = location },
4383
+ .until_keyword_loc = until_keyword_loc,
4384
+ .do_keyword_loc = do_keyword_loc,
4385
+ .end_keyword_loc = end_keyword_loc,
4386
+ .predicate = predicate,
4387
+ .statements = statements
4388
+ };
4389
+
4390
+ return node;
4391
+ }
4392
+
4393
+ /**
4394
+ * Allocate and initialize a new WhenNode node.
4395
+ */
4396
+ pm_when_node_t *
4397
+ pm_when_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t when_keyword_loc, pm_node_list_t conditions, pm_location_t then_keyword_loc, struct pm_statements_node *statements) {
4398
+ pm_when_node_t *node = PM_ARENA_ALLOC(arena, pm_when_node_t);
4399
+
4400
+ *node = (pm_when_node_t) {
4401
+ .base = { .type = PM_WHEN_NODE, .flags = flags, .node_id = node_id, .location = location },
4402
+ .when_keyword_loc = when_keyword_loc,
4403
+ .conditions = conditions,
4404
+ .then_keyword_loc = then_keyword_loc,
4405
+ .statements = statements
4406
+ };
4407
+
4408
+ return node;
4409
+ }
4410
+
4411
+ /**
4412
+ * Allocate and initialize a new WhileNode node.
4413
+ */
4414
+ pm_while_node_t *
4415
+ pm_while_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t while_keyword_loc, pm_location_t do_keyword_loc, pm_location_t end_keyword_loc, struct pm_node *predicate, struct pm_statements_node *statements) {
4416
+ pm_while_node_t *node = PM_ARENA_ALLOC(arena, pm_while_node_t);
4417
+
4418
+ *node = (pm_while_node_t) {
4419
+ .base = { .type = PM_WHILE_NODE, .flags = flags, .node_id = node_id, .location = location },
4420
+ .while_keyword_loc = while_keyword_loc,
4421
+ .do_keyword_loc = do_keyword_loc,
4422
+ .end_keyword_loc = end_keyword_loc,
4423
+ .predicate = predicate,
4424
+ .statements = statements
4425
+ };
4426
+
4427
+ return node;
4428
+ }
4429
+
4430
+ /**
4431
+ * Allocate and initialize a new XStringNode node.
4432
+ */
4433
+ pm_x_string_node_t *
4434
+ pm_x_string_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t opening_loc, pm_location_t content_loc, pm_location_t closing_loc, pm_string_t unescaped) {
4435
+ pm_x_string_node_t *node = PM_ARENA_ALLOC(arena, pm_x_string_node_t);
4436
+
4437
+ *node = (pm_x_string_node_t) {
4438
+ .base = { .type = PM_X_STRING_NODE, .flags = flags, .node_id = node_id, .location = location },
4439
+ .opening_loc = opening_loc,
4440
+ .content_loc = content_loc,
4441
+ .closing_loc = closing_loc,
4442
+ .unescaped = unescaped
4443
+ };
4444
+
4445
+ return node;
4446
+ }
4447
+
4448
+ /**
4449
+ * Allocate and initialize a new YieldNode node.
4450
+ */
4451
+ pm_yield_node_t *
4452
+ pm_yield_node_new(pm_arena_t *arena, uint32_t node_id, pm_node_flags_t flags, pm_location_t location, pm_location_t keyword_loc, pm_location_t lparen_loc, struct pm_arguments_node *arguments, pm_location_t rparen_loc) {
4453
+ pm_yield_node_t *node = PM_ARENA_ALLOC(arena, pm_yield_node_t);
4454
+
4455
+ *node = (pm_yield_node_t) {
4456
+ .base = { .type = PM_YIELD_NODE, .flags = flags, .node_id = node_id, .location = location },
4457
+ .keyword_loc = keyword_loc,
4458
+ .lparen_loc = lparen_loc,
4459
+ .arguments = arguments,
4460
+ .rparen_loc = rparen_loc
4461
+ };
4462
+
4463
+ return node;
4464
+ }