prism 2.0.0-aarch64-mingw-ucrt

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