prism 2.0.0.rc1-x86_64-linux-gnu

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