prism 2.0.0.rc1-arm64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. checksums.yaml +7 -0
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +870 -0
  4. data/CODE_OF_CONDUCT.md +76 -0
  5. data/CONTRIBUTING.md +58 -0
  6. data/LICENSE.md +7 -0
  7. data/Makefile +145 -0
  8. data/README.md +81 -0
  9. data/config.yml +4752 -0
  10. data/docs/build_system.md +119 -0
  11. data/docs/configuration.md +69 -0
  12. data/docs/cruby_compilation.md +27 -0
  13. data/docs/design.md +53 -0
  14. data/docs/encoding.md +121 -0
  15. data/docs/fuzzing.md +81 -0
  16. data/docs/heredocs.md +36 -0
  17. data/docs/javascript.md +133 -0
  18. data/docs/local_variable_depth.md +229 -0
  19. data/docs/mapping.md +117 -0
  20. data/docs/parser_translation.md +24 -0
  21. data/docs/parsing_rules.md +22 -0
  22. data/docs/releasing.md +147 -0
  23. data/docs/relocation.md +32 -0
  24. data/docs/ripper_translation.md +63 -0
  25. data/docs/ruby_api.md +45 -0
  26. data/docs/ruby_parser_translation.md +19 -0
  27. data/docs/serialization.md +230 -0
  28. data/docs/testing.md +72 -0
  29. data/ext/prism/api_node.c +7005 -0
  30. data/ext/prism/extconf.rb +126 -0
  31. data/ext/prism/extension.c +1783 -0
  32. data/ext/prism/extension.h +19 -0
  33. data/include/prism/arena.h +37 -0
  34. data/include/prism/ast.h +10371 -0
  35. data/include/prism/buffer.h +52 -0
  36. data/include/prism/comments.h +55 -0
  37. data/include/prism/compiler/accel.h +24 -0
  38. data/include/prism/compiler/align.h +36 -0
  39. data/include/prism/compiler/assume.h +25 -0
  40. data/include/prism/compiler/exported.h +24 -0
  41. data/include/prism/compiler/fallthrough.h +22 -0
  42. data/include/prism/compiler/filesystem.h +32 -0
  43. data/include/prism/compiler/flex_array.h +19 -0
  44. data/include/prism/compiler/force_inline.h +21 -0
  45. data/include/prism/compiler/format.h +25 -0
  46. data/include/prism/compiler/inline.h +17 -0
  47. data/include/prism/compiler/nodiscard.h +22 -0
  48. data/include/prism/compiler/nonnull.h +18 -0
  49. data/include/prism/compiler/unused.h +18 -0
  50. data/include/prism/constant_pool.h +81 -0
  51. data/include/prism/diagnostic.h +93 -0
  52. data/include/prism/errors_format.h +53 -0
  53. data/include/prism/excludes.h +29 -0
  54. data/include/prism/integer.h +41 -0
  55. data/include/prism/internal/allocator.h +68 -0
  56. data/include/prism/internal/allocator_debug.h +88 -0
  57. data/include/prism/internal/arena.h +108 -0
  58. data/include/prism/internal/bit.h +42 -0
  59. data/include/prism/internal/buffer.h +91 -0
  60. data/include/prism/internal/char.h +145 -0
  61. data/include/prism/internal/comments.h +53 -0
  62. data/include/prism/internal/constant_pool.h +152 -0
  63. data/include/prism/internal/diagnostic.h +389 -0
  64. data/include/prism/internal/encoding.h +242 -0
  65. data/include/prism/internal/integer.h +68 -0
  66. data/include/prism/internal/isinf.h +16 -0
  67. data/include/prism/internal/line_offset_list.h +34 -0
  68. data/include/prism/internal/list.h +62 -0
  69. data/include/prism/internal/magic_comments.h +23 -0
  70. data/include/prism/internal/memchr.h +15 -0
  71. data/include/prism/internal/node.h +38 -0
  72. data/include/prism/internal/options.h +232 -0
  73. data/include/prism/internal/parser.h +984 -0
  74. data/include/prism/internal/regexp.h +26 -0
  75. data/include/prism/internal/serialize.h +39 -0
  76. data/include/prism/internal/source.h +72 -0
  77. data/include/prism/internal/static_literals.h +100 -0
  78. data/include/prism/internal/stringy.h +35 -0
  79. data/include/prism/internal/strncasecmp.h +18 -0
  80. data/include/prism/internal/strpbrk.h +33 -0
  81. data/include/prism/internal/tokens.h +11 -0
  82. data/include/prism/json.h +32 -0
  83. data/include/prism/line_offset_list.h +61 -0
  84. data/include/prism/magic_comments.h +35 -0
  85. data/include/prism/node.h +94 -0
  86. data/include/prism/options.h +354 -0
  87. data/include/prism/parser.h +404 -0
  88. data/include/prism/prettyprint.h +31 -0
  89. data/include/prism/serialize.h +115 -0
  90. data/include/prism/source.h +155 -0
  91. data/include/prism/stream.h +28 -0
  92. data/include/prism/string_query.h +63 -0
  93. data/include/prism/stringy.h +72 -0
  94. data/include/prism/version.h +38 -0
  95. data/include/prism.h +131 -0
  96. data/lib/prism/3.3/prism.bundle +0 -0
  97. data/lib/prism/3.4/prism.bundle +0 -0
  98. data/lib/prism/4.0/prism.bundle +0 -0
  99. data/lib/prism/compiler.rb +815 -0
  100. data/lib/prism/desugar_compiler.rb +463 -0
  101. data/lib/prism/dispatcher.rb +2383 -0
  102. data/lib/prism/dot_visitor.rb +4848 -0
  103. data/lib/prism/dsl.rb +1369 -0
  104. data/lib/prism/ffi.rb +740 -0
  105. data/lib/prism/inspect_visitor.rb +2425 -0
  106. data/lib/prism/lex_compat.rb +953 -0
  107. data/lib/prism/mutation_compiler.rb +780 -0
  108. data/lib/prism/node.rb +33204 -0
  109. data/lib/prism/node_ext.rb +504 -0
  110. data/lib/prism/node_find.rb +215 -0
  111. data/lib/prism/parse_result/errors.rb +72 -0
  112. data/lib/prism/parse_result/newlines.rb +423 -0
  113. data/lib/prism/parse_result.rb +1221 -0
  114. data/lib/prism/pattern.rb +314 -0
  115. data/lib/prism/polyfill/append_as_bytes.rb +15 -0
  116. data/lib/prism/polyfill/byteindex.rb +13 -0
  117. data/lib/prism/polyfill/scan_byte.rb +14 -0
  118. data/lib/prism/polyfill/unpack1.rb +14 -0
  119. data/lib/prism/polyfill/warn.rb +36 -0
  120. data/lib/prism/reflection.rb +427 -0
  121. data/lib/prism/relocation.rb +567 -0
  122. data/lib/prism/serialize.rb +5308 -0
  123. data/lib/prism/string_query.rb +46 -0
  124. data/lib/prism/translation/parser/builder.rb +70 -0
  125. data/lib/prism/translation/parser/compiler.rb +2226 -0
  126. data/lib/prism/translation/parser/lexer.rb +769 -0
  127. data/lib/prism/translation/parser.rb +376 -0
  128. data/lib/prism/translation/parser_current.rb +26 -0
  129. data/lib/prism/translation/parser_versions.rb +36 -0
  130. data/lib/prism/translation/ripper/filter.rb +53 -0
  131. data/lib/prism/translation/ripper/lexer.rb +133 -0
  132. data/lib/prism/translation/ripper/sexp.rb +118 -0
  133. data/lib/prism/translation/ripper/shim.rb +7 -0
  134. data/lib/prism/translation/ripper.rb +4278 -0
  135. data/lib/prism/translation/ruby_parser.rb +1721 -0
  136. data/lib/prism/translation.rb +20 -0
  137. data/lib/prism/visitor.rb +1440 -0
  138. data/lib/prism.rb +168 -0
  139. data/prism.gemspec +234 -0
  140. data/rbi/generated/prism/compiler.rbi +489 -0
  141. data/rbi/generated/prism/desugar_compiler.rbi +306 -0
  142. data/rbi/generated/prism/dispatcher.rbi +1138 -0
  143. data/rbi/generated/prism/dot_visitor.rbi +618 -0
  144. data/rbi/generated/prism/dsl.rbi +751 -0
  145. data/rbi/generated/prism/inspect_visitor.rbi +503 -0
  146. data/rbi/generated/prism/lex_compat.rbi +162 -0
  147. data/rbi/generated/prism/mutation_compiler.rbi +464 -0
  148. data/rbi/generated/prism/node.rbi +13681 -0
  149. data/rbi/generated/prism/node_ext.rbi +259 -0
  150. data/rbi/generated/prism/node_find.rbi +79 -0
  151. data/rbi/generated/prism/parse_result/errors.rbi +21 -0
  152. data/rbi/generated/prism/parse_result/newlines.rbi +208 -0
  153. data/rbi/generated/prism/parse_result.rbi +764 -0
  154. data/rbi/generated/prism/pattern.rbi +134 -0
  155. data/rbi/generated/prism/reflection.rbi +89 -0
  156. data/rbi/generated/prism/relocation.rbi +329 -0
  157. data/rbi/generated/prism/serialize.rbi +181 -0
  158. data/rbi/generated/prism/string_query.rbi +36 -0
  159. data/rbi/generated/prism/translation.rbi +7 -0
  160. data/rbi/generated/prism/visitor.rbi +650 -0
  161. data/rbi/generated/prism.rbi +86 -0
  162. data/rbi/prism/translation/parser.rbi +11 -0
  163. data/rbi/prism/translation/parser_versions.rbi +28 -0
  164. data/rbi/prism/translation/ripper.rbi +15 -0
  165. data/rbi/rubyvm/node_find.rbi +14 -0
  166. data/sig/generated/prism/compiler.rbs +492 -0
  167. data/sig/generated/prism/desugar_compiler.rbs +305 -0
  168. data/sig/generated/prism/dispatcher.rbs +1292 -0
  169. data/sig/generated/prism/dot_visitor.rbs +635 -0
  170. data/sig/generated/prism/dsl.rbs +928 -0
  171. data/sig/generated/prism/inspect_visitor.rbs +509 -0
  172. data/sig/generated/prism/lex_compat.rbs +166 -0
  173. data/sig/generated/prism/mutation_compiler.rbs +464 -0
  174. data/sig/generated/prism/node.rbs +20160 -0
  175. data/sig/generated/prism/node_ext.rbs +290 -0
  176. data/sig/generated/prism/node_find.rbs +90 -0
  177. data/sig/generated/prism/parse_result/errors.rbs +22 -0
  178. data/sig/generated/prism/parse_result/newlines.rbs +223 -0
  179. data/sig/generated/prism/parse_result.rbs +859 -0
  180. data/sig/generated/prism/pattern.rbs +156 -0
  181. data/sig/generated/prism/reflection.rbs +101 -0
  182. data/sig/generated/prism/relocation.rbs +428 -0
  183. data/sig/generated/prism/serialize.rbs +195 -0
  184. data/sig/generated/prism/string_query.rbs +36 -0
  185. data/sig/generated/prism/translation.rbs +8 -0
  186. data/sig/generated/prism/visitor.rbs +1111 -0
  187. data/sig/generated/prism.rbs +84 -0
  188. data/sig/manifest.yaml +2 -0
  189. data/src/arena.c +117 -0
  190. data/src/buffer.c +380 -0
  191. data/src/char.c +289 -0
  192. data/src/comments.c +454 -0
  193. data/src/constant_pool.c +406 -0
  194. data/src/diagnostic.c +886 -0
  195. data/src/encoding.c +5345 -0
  196. data/src/errors_format.c +519 -0
  197. data/src/integer.c +681 -0
  198. data/src/json.c +5733 -0
  199. data/src/line_offset_list.c +100 -0
  200. data/src/list.c +24 -0
  201. data/src/memchr.c +37 -0
  202. data/src/node.c +4515 -0
  203. data/src/options.c +451 -0
  204. data/src/parser.c +349 -0
  205. data/src/prettyprint.c +9024 -0
  206. data/src/prism.c +23739 -0
  207. data/src/regexp.c +1706 -0
  208. data/src/serialize.c +2309 -0
  209. data/src/source.c +518 -0
  210. data/src/static_literals.c +685 -0
  211. data/src/string_query.c +166 -0
  212. data/src/stringy.c +91 -0
  213. data/src/strncasecmp.c +37 -0
  214. data/src/strpbrk.c +447 -0
  215. data/src/tokens.c +724 -0
  216. metadata +259 -0
data/config.yml ADDED
@@ -0,0 +1,4752 @@
1
+ errors:
2
+ - ALIAS_ARGUMENT
3
+ - ALIAS_ARGUMENT_NUMBERED_REFERENCE
4
+ - AMPAMPEQ_MULTI_ASSIGN
5
+ - ARGUMENT_AFTER_BLOCK
6
+ - ARGUMENT_AFTER_FORWARDING_ELLIPSES
7
+ - ARGUMENT_BARE_HASH
8
+ - ARGUMENT_BLOCK_MULTI
9
+ - ARGUMENT_CONFLICT_AMPERSAND
10
+ - ARGUMENT_CONFLICT_STAR
11
+ - ARGUMENT_CONFLICT_STAR_STAR
12
+ - ARGUMENT_FORMAL_CLASS
13
+ - ARGUMENT_FORMAL_CONSTANT
14
+ - ARGUMENT_FORMAL_GLOBAL
15
+ - ARGUMENT_FORMAL_IVAR
16
+ - ARGUMENT_FORWARDING_UNBOUND
17
+ - ARGUMENT_NO_FORWARDING_AMPERSAND
18
+ - ARGUMENT_NO_FORWARDING_ELLIPSES
19
+ - ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA
20
+ - ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK
21
+ - ARGUMENT_NO_FORWARDING_STAR
22
+ - ARGUMENT_NO_FORWARDING_STAR_STAR
23
+ - ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
24
+ - ARGUMENT_SPLAT_AFTER_SPLAT
25
+ - ARGUMENT_TERM_PAREN
26
+ - ARGUMENT_UNEXPECTED_BLOCK
27
+ - ARRAY_ELEMENT
28
+ - ARRAY_EXPRESSION
29
+ - ARRAY_EXPRESSION_AFTER_STAR
30
+ - ARRAY_SEPARATOR
31
+ - ARRAY_TERM
32
+ - BEGIN_LONELY_ELSE
33
+ - BEGIN_TERM
34
+ - BEGIN_UPCASE_BRACE
35
+ - BEGIN_UPCASE_TERM
36
+ - BEGIN_UPCASE_TOPLEVEL
37
+ - BLOCK_PARAM_LOCAL_VARIABLE
38
+ - BLOCK_PARAM_PIPE_TERM
39
+ - BLOCK_TERM_BRACE
40
+ - BLOCK_TERM_END
41
+ - CANNOT_PARSE_EXPRESSION
42
+ - CANNOT_PARSE_STRING_PART
43
+ - CASE_EXPRESSION_AFTER_CASE
44
+ - CASE_EXPRESSION_AFTER_WHEN
45
+ - CASE_MATCH_MISSING_PREDICATE
46
+ - CASE_MISSING_CONDITIONS
47
+ - CASE_TERM
48
+ - CLASS_IN_METHOD
49
+ - CLASS_NAME
50
+ - CLASS_SUPERCLASS
51
+ - CLASS_TERM
52
+ - CLASS_UNEXPECTED_END
53
+ - CLASS_VARIABLE_BARE
54
+ - CONDITIONAL_ELSIF_PREDICATE
55
+ - CONDITIONAL_IF_PREDICATE
56
+ - CONDITIONAL_PREDICATE_TERM
57
+ - CONDITIONAL_TERM
58
+ - CONDITIONAL_TERM_ELSE
59
+ - CONDITIONAL_UNLESS_PREDICATE
60
+ - CONDITIONAL_UNTIL_PREDICATE
61
+ - CONDITIONAL_WHILE_PREDICATE
62
+ - CONSTANT_PATH_COLON_COLON_CONSTANT
63
+ - DEF_ENDLESS
64
+ - DEF_ENDLESS_PARAMETERS
65
+ - DEF_ENDLESS_SETTER
66
+ - DEF_ENDLESS_DO_BLOCK
67
+ - DEF_NAME
68
+ - DEF_PARAMS_TERM
69
+ - DEF_PARAMS_TERM_PAREN
70
+ - DEF_RECEIVER
71
+ - DEF_RECEIVER_TERM
72
+ - DEF_TERM
73
+ - DEFINED_EXPRESSION
74
+ - EMBDOC_TERM
75
+ - EMBEXPR_END
76
+ - EMBVAR_INVALID
77
+ - END_UPCASE_BRACE
78
+ - END_UPCASE_TERM
79
+ - ESCAPE_INVALID_CONTROL
80
+ - ESCAPE_INVALID_CONTROL_REPEAT
81
+ - ESCAPE_INVALID_HEXADECIMAL
82
+ - ESCAPE_INVALID_META
83
+ - ESCAPE_INVALID_META_REPEAT
84
+ - ESCAPE_INVALID_UNICODE
85
+ - ESCAPE_INVALID_UNICODE_CM_FLAGS
86
+ - ESCAPE_INVALID_UNICODE_LIST
87
+ - ESCAPE_INVALID_UNICODE_LITERAL
88
+ - ESCAPE_INVALID_UNICODE_LONG
89
+ - ESCAPE_INVALID_UNICODE_SHORT
90
+ - ESCAPE_INVALID_UNICODE_TERM
91
+ - EXPECT_ARGUMENT
92
+ - EXPECT_EOL_AFTER_STATEMENT
93
+ - EXPECT_EXPRESSION_AFTER_AMPAMPEQ
94
+ - EXPECT_EXPRESSION_AFTER_COMMA
95
+ - EXPECT_EXPRESSION_AFTER_EQUAL
96
+ - EXPECT_EXPRESSION_AFTER_LESS_LESS
97
+ - EXPECT_EXPRESSION_AFTER_LPAREN
98
+ - EXPECT_EXPRESSION_AFTER_OPERATOR
99
+ - EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
100
+ - EXPECT_EXPRESSION_AFTER_SPLAT
101
+ - EXPECT_EXPRESSION_AFTER_SPLAT_HASH
102
+ - EXPECT_EXPRESSION_AFTER_STAR
103
+ - EXPECT_FOR_DELIMITER
104
+ - EXPECT_IDENT_REQ_PARAMETER
105
+ - EXPECT_IN_DELIMITER
106
+ - EXPECT_LPAREN_AFTER_NOT_LPAREN
107
+ - EXPECT_LPAREN_AFTER_NOT_OTHER
108
+ - EXPECT_LPAREN_REQ_PARAMETER
109
+ - EXPECT_MESSAGE
110
+ - EXPECT_RBRACKET
111
+ - EXPECT_RPAREN
112
+ - EXPECT_RPAREN_AFTER_MULTI
113
+ - EXPECT_RPAREN_REQ_PARAMETER
114
+ - EXPECT_SINGLETON_CLASS_DELIMITER
115
+ - EXPECT_STRING_CONTENT
116
+ - EXPECT_WHEN_DELIMITER
117
+ - EXPRESSION_BARE_HASH
118
+ - EXPRESSION_NOT_WRITABLE
119
+ - EXPRESSION_NOT_WRITABLE_ENCODING
120
+ - EXPRESSION_NOT_WRITABLE_FALSE
121
+ - EXPRESSION_NOT_WRITABLE_FILE
122
+ - EXPRESSION_NOT_WRITABLE_LINE
123
+ - EXPRESSION_NOT_WRITABLE_NIL
124
+ - EXPRESSION_NOT_WRITABLE_NUMBERED
125
+ - EXPRESSION_NOT_WRITABLE_SELF
126
+ - EXPRESSION_NOT_WRITABLE_TRUE
127
+ - FLOAT_PARSE
128
+ - FOR_COLLECTION
129
+ - FOR_IN
130
+ - FOR_INDEX
131
+ - FOR_TERM
132
+ - GLOBAL_VARIABLE_BARE
133
+ - HASH_EXPRESSION_AFTER_LABEL
134
+ - HASH_KEY
135
+ - HASH_ROCKET
136
+ - HASH_TERM
137
+ - HASH_VALUE
138
+ - HEREDOC_IDENTIFIER
139
+ - HEREDOC_TERM
140
+ - INCOMPLETE_QUESTION_MARK
141
+ - INCOMPLETE_VARIABLE_CLASS
142
+ - INCOMPLETE_VARIABLE_CLASS_3_3
143
+ - INCOMPLETE_VARIABLE_INSTANCE
144
+ - INCOMPLETE_VARIABLE_INSTANCE_3_3
145
+ - INSTANCE_VARIABLE_BARE
146
+ - INVALID_BLOCK_EXIT
147
+ - INVALID_CHARACTER
148
+ - INVALID_COMMA
149
+ - INVALID_ENCODING_MAGIC_COMMENT
150
+ - INVALID_ESCAPE_CHARACTER
151
+ - INVALID_FLOAT_EXPONENT
152
+ - INVALID_LOCAL_VARIABLE_READ
153
+ - INVALID_LOCAL_VARIABLE_WRITE
154
+ - INVALID_MULTIBYTE_CHAR
155
+ - INVALID_MULTIBYTE_CHARACTER
156
+ - INVALID_MULTIBYTE_ESCAPE
157
+ - INVALID_NUMBER_BINARY
158
+ - INVALID_NUMBER_DECIMAL
159
+ - INVALID_NUMBER_FRACTION
160
+ - INVALID_NUMBER_HEXADECIMAL
161
+ - INVALID_NUMBER_OCTAL
162
+ - INVALID_NUMBER_UNDERSCORE_INNER
163
+ - INVALID_NUMBER_UNDERSCORE_TRAILING
164
+ - INVALID_PERCENT
165
+ - INVALID_PERCENT_EOF
166
+ - INVALID_PRINTABLE_CHARACTER
167
+ - INVALID_RETRY_AFTER_ELSE
168
+ - INVALID_RETRY_AFTER_ENSURE
169
+ - INVALID_RETRY_WITHOUT_RESCUE
170
+ - INVALID_SYMBOL
171
+ - INVALID_VARIABLE_GLOBAL
172
+ - INVALID_VARIABLE_GLOBAL_3_3
173
+ - INVALID_YIELD
174
+ - IT_NOT_ALLOWED_NUMBERED
175
+ - IT_NOT_ALLOWED_ORDINARY
176
+ - LAMBDA_OPEN
177
+ - LAMBDA_TERM_BRACE
178
+ - LAMBDA_TERM_END
179
+ - LIST_I_LOWER_ELEMENT
180
+ - LIST_I_LOWER_TERM
181
+ - LIST_I_UPPER_ELEMENT
182
+ - LIST_I_UPPER_TERM
183
+ - LIST_W_LOWER_ELEMENT
184
+ - LIST_W_LOWER_TERM
185
+ - LIST_W_UPPER_ELEMENT
186
+ - LIST_W_UPPER_TERM
187
+ - MALLOC_FAILED
188
+ - MIXED_ENCODING
189
+ - MODULE_IN_METHOD
190
+ - MODULE_NAME
191
+ - MODULE_TERM
192
+ - MULTI_ASSIGN_MULTI_SPLATS
193
+ - MULTI_ASSIGN_UNEXPECTED_REST
194
+ - NESTING_TOO_DEEP
195
+ - NO_LOCAL_VARIABLE
196
+ - NON_ASSOCIATIVE_OPERATOR
197
+ - NOT_EXPRESSION
198
+ - NUMBER_LITERAL_UNDERSCORE
199
+ - NUMBERED_PARAMETER_INNER_BLOCK
200
+ - NUMBERED_PARAMETER_IT
201
+ - NUMBERED_PARAMETER_ORDINARY
202
+ - NUMBERED_PARAMETER_OUTER_BLOCK
203
+ - OPERATOR_MULTI_ASSIGN
204
+ - OPERATOR_WRITE_ARGUMENTS
205
+ - OPERATOR_WRITE_BLOCK
206
+ - PARAMETER_ASSOC_SPLAT_MULTI
207
+ - PARAMETER_BLOCK_MULTI
208
+ - PARAMETER_CIRCULAR
209
+ - PARAMETER_FORWARDING_AFTER_REST
210
+ - PARAMETER_METHOD_NAME
211
+ - PARAMETER_NAME_DUPLICATED
212
+ - PARAMETER_NO_DEFAULT
213
+ - PARAMETER_NO_DEFAULT_KW
214
+ - PARAMETER_NUMBERED_RESERVED
215
+ - PARAMETER_ORDER
216
+ - PARAMETER_SPLAT_MULTI
217
+ - PARAMETER_STAR
218
+ - PARAMETER_UNEXPECTED_FWD
219
+ - PARAMETER_UNEXPECTED_NO_KW
220
+ - PARAMETER_WILD_LOOSE_COMMA
221
+ - PATTERN_ARRAY_MULTIPLE_RESTS
222
+ - PATTERN_CAPTURE_DUPLICATE
223
+ - PATTERN_CAPTURE_IN_ALTERNATIVE
224
+ - PATTERN_EXPRESSION_AFTER_BRACKET
225
+ - PATTERN_EXPRESSION_AFTER_COMMA
226
+ - PATTERN_EXPRESSION_AFTER_HROCKET
227
+ - PATTERN_EXPRESSION_AFTER_IN
228
+ - PATTERN_EXPRESSION_AFTER_KEY
229
+ - PATTERN_EXPRESSION_AFTER_PAREN
230
+ - PATTERN_EXPRESSION_AFTER_PIN
231
+ - PATTERN_EXPRESSION_AFTER_PIPE
232
+ - PATTERN_EXPRESSION_AFTER_RANGE
233
+ - PATTERN_EXPRESSION_AFTER_REST
234
+ - PATTERN_FIND_MISSING_INNER
235
+ - PATTERN_HASH_IMPLICIT
236
+ - PATTERN_HASH_KEY
237
+ - PATTERN_HASH_KEY_DUPLICATE
238
+ - PATTERN_HASH_KEY_INTERPOLATED
239
+ - PATTERN_HASH_KEY_LABEL
240
+ - PATTERN_HASH_KEY_LOCALS
241
+ - PATTERN_IDENT_AFTER_HROCKET
242
+ - PATTERN_LABEL_AFTER_COMMA
243
+ - PATTERN_REST
244
+ - PATTERN_TERM_BRACE
245
+ - PATTERN_TERM_BRACKET
246
+ - PATTERN_TERM_PAREN
247
+ - PIPEPIPEEQ_MULTI_ASSIGN
248
+ - REGEXP_ENCODING_OPTION_MISMATCH
249
+ - REGEXP_ESCAPED_NON_ASCII_IN_UTF8
250
+ - REGEXP_INCOMPAT_CHAR_ENCODING
251
+ - REGEXP_INVALID_CHAR_PROPERTY
252
+ - REGEXP_INVALID_UNICODE_RANGE
253
+ - REGEXP_NON_ESCAPED_MBC
254
+ - REGEXP_PARSE_ERROR
255
+ - REGEXP_TERM
256
+ - REGEXP_UNKNOWN_OPTIONS
257
+ - REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
258
+ - RESCUE_EXPRESSION
259
+ - RESCUE_MODIFIER_VALUE
260
+ - RESCUE_TERM
261
+ - RESCUE_VARIABLE
262
+ - RETURN_INVALID
263
+ - SCRIPT_NOT_FOUND
264
+ - SINGLETON_FOR_LITERALS
265
+ - STATEMENT_ALIAS
266
+ - STATEMENT_POSTEXE_END
267
+ - STATEMENT_PREEXE_BEGIN
268
+ - STATEMENT_UNDEF
269
+ - STRING_CONCATENATION
270
+ - STRING_INTERPOLATED_TERM
271
+ - STRING_LITERAL_EOF
272
+ - STRING_LITERAL_TERM
273
+ - SYMBOL_INVALID
274
+ - SYMBOL_TERM_DYNAMIC
275
+ - SYMBOL_TERM_INTERPOLATED
276
+ - TERNARY_COLON
277
+ - TERNARY_EXPRESSION_FALSE
278
+ - TERNARY_EXPRESSION_TRUE
279
+ - UNARY_DISALLOWED
280
+ - UNARY_RECEIVER
281
+ - UNDEF_ARGUMENT
282
+ - UNEXPECTED_BLOCK_ARGUMENT
283
+ - UNEXPECTED_INDEX_BLOCK
284
+ - UNEXPECTED_INDEX_KEYWORDS
285
+ - UNEXPECTED_LABEL
286
+ - UNEXPECTED_MULTI_WRITE
287
+ - UNEXPECTED_PARAMETER_DEFAULT_VALUE
288
+ - UNEXPECTED_RANGE_OPERATOR
289
+ - UNEXPECTED_SAFE_NAVIGATION
290
+ - UNEXPECTED_TOKEN_CLOSE_CONTEXT
291
+ - UNEXPECTED_TOKEN_IGNORE
292
+ - UNTIL_TERM
293
+ - VOID_EXPRESSION
294
+ - WHILE_TERM
295
+ - WRITE_TARGET_IN_METHOD
296
+ - WRITE_TARGET_READONLY
297
+ - WRITE_TARGET_UNEXPECTED
298
+ - XSTRING_TERM
299
+ warnings:
300
+ - AMBIGUOUS_BINARY_OPERATOR
301
+ - AMBIGUOUS_FIRST_ARGUMENT_MINUS
302
+ - AMBIGUOUS_FIRST_ARGUMENT_PLUS
303
+ - AMBIGUOUS_PREFIX_AMPERSAND
304
+ - AMBIGUOUS_PREFIX_STAR
305
+ - AMBIGUOUS_PREFIX_STAR_STAR
306
+ - AMBIGUOUS_SLASH
307
+ - COMPARISON_AFTER_COMPARISON
308
+ - DOT_DOT_DOT_EOL
309
+ - EQUAL_IN_CONDITIONAL
310
+ - EQUAL_IN_CONDITIONAL_3_3
311
+ - END_IN_METHOD
312
+ - DUPLICATED_HASH_KEY
313
+ - DUPLICATED_WHEN_CLAUSE
314
+ - FLOAT_OUT_OF_RANGE
315
+ - IGNORED_FROZEN_STRING_LITERAL
316
+ - INDENTATION_MISMATCH
317
+ - INTEGER_IN_FLIP_FLOP
318
+ - INVALID_CHARACTER
319
+ - INVALID_MAGIC_COMMENT_VALUE
320
+ - INVALID_NUMBERED_REFERENCE
321
+ - KEYWORD_EOL
322
+ - LITERAL_IN_CONDITION_DEFAULT
323
+ - LITERAL_IN_CONDITION_VERBOSE
324
+ - SHAREABLE_CONSTANT_VALUE_LINE
325
+ - SHEBANG_CARRIAGE_RETURN
326
+ - UNEXPECTED_CARRIAGE_RETURN
327
+ - UNREACHABLE_STATEMENT
328
+ - UNUSED_LOCAL_VARIABLE
329
+ - VOID_STATEMENT
330
+ tokens:
331
+ # The order of the tokens at the beginning is important, because we use them
332
+ # for a lookup table.
333
+ - name: EOF
334
+ value: 1
335
+ comment: final token in the file
336
+ - name: BRACE_RIGHT
337
+ comment: "}"
338
+ - name: COMMA
339
+ comment: ","
340
+ - name: EMBEXPR_END
341
+ comment: "}"
342
+ - name: KEYWORD_DO
343
+ comment: "do"
344
+ - name: KEYWORD_ELSE
345
+ comment: "else"
346
+ - name: KEYWORD_ELSIF
347
+ comment: "elsif"
348
+ - name: KEYWORD_END
349
+ comment: "end"
350
+ - name: KEYWORD_ENSURE
351
+ comment: "ensure"
352
+ - name: KEYWORD_IN
353
+ comment: "in"
354
+ - name: KEYWORD_RESCUE
355
+ comment: "rescue"
356
+ - name: KEYWORD_THEN
357
+ comment: "then"
358
+ - name: KEYWORD_WHEN
359
+ comment: "when"
360
+ - name: NEWLINE
361
+ comment: "a newline character outside of other tokens"
362
+ - name: NEWLINE_TERMINATOR
363
+ comment: "a newline that terminates a construct where a newline is otherwise insignificant"
364
+ - name: PARENTHESIS_RIGHT
365
+ comment: ")"
366
+ - name: PIPE
367
+ comment: "|"
368
+ - name: SEMICOLON
369
+ comment: ";"
370
+ # Tokens from here on are not used for lookup, and can be in any order.
371
+ - name: AMPERSAND
372
+ comment: "&"
373
+ - name: AMPERSAND_AMPERSAND
374
+ comment: "&&"
375
+ - name: AMPERSAND_AMPERSAND_EQUAL
376
+ comment: "&&="
377
+ - name: AMPERSAND_DOT
378
+ comment: "&."
379
+ - name: AMPERSAND_EQUAL
380
+ comment: "&="
381
+ - name: BACKTICK
382
+ comment: "` as a method name"
383
+ - name: BACK_REFERENCE
384
+ comment: "a back reference"
385
+ - name: BANG
386
+ comment: "! or !@"
387
+ - name: BANG_EQUAL
388
+ comment: "!="
389
+ - name: BANG_TILDE
390
+ comment: "!~"
391
+ - name: BRACE_LEFT
392
+ comment: "{"
393
+ - name: BRACE_LEFT_ARGUMENT
394
+ comment: "{ for a block following a parenthesized argument"
395
+ - name: BRACE_LEFT_HASH
396
+ comment: "{ for a hash literal"
397
+ - name: BRACKET_LEFT
398
+ comment: "["
399
+ - name: BRACKET_LEFT_ARRAY
400
+ comment: "[ for the beginning of an array"
401
+ - name: BRACKET_LEFT_RIGHT
402
+ comment: "[]"
403
+ - name: BRACKET_LEFT_RIGHT_EQUAL
404
+ comment: "[]="
405
+ - name: BRACKET_RIGHT
406
+ comment: "]"
407
+ - name: CARET
408
+ comment: "^"
409
+ - name: CARET_EQUAL
410
+ comment: "^="
411
+ - name: CHARACTER_LITERAL
412
+ comment: "a character literal"
413
+ - name: CLASS_VARIABLE
414
+ comment: "a class variable"
415
+ - name: COLON
416
+ comment: ":"
417
+ - name: COLON_COLON
418
+ comment: "::"
419
+ - name: COMMENT
420
+ comment: "a comment"
421
+ - name: CONSTANT
422
+ comment: "a constant"
423
+ - name: DOT
424
+ comment: "the . call operator"
425
+ - name: DOT_DOT
426
+ comment: "the .. range operator"
427
+ - name: DOT_DOT_DOT
428
+ comment: "the ... range operator or forwarding parameter"
429
+ - name: EMBDOC_BEGIN
430
+ comment: "=begin"
431
+ - name: EMBDOC_END
432
+ comment: "=end"
433
+ - name: EMBDOC_LINE
434
+ comment: "a line inside of embedded documentation"
435
+ - name: EMBEXPR_BEGIN
436
+ comment: "#{"
437
+ - name: EMBVAR
438
+ comment: "#"
439
+ - name: EQUAL
440
+ comment: "="
441
+ - name: EQUAL_EQUAL
442
+ comment: "=="
443
+ - name: EQUAL_EQUAL_EQUAL
444
+ comment: "==="
445
+ - name: EQUAL_GREATER
446
+ comment: "=>"
447
+ - name: EQUAL_TILDE
448
+ comment: "=~"
449
+ - name: FLOAT
450
+ comment: "a floating point number"
451
+ - name: FLOAT_IMAGINARY
452
+ comment: "a floating pointer number with an imaginary suffix"
453
+ - name: FLOAT_RATIONAL
454
+ comment: "a floating pointer number with a rational suffix"
455
+ - name: FLOAT_RATIONAL_IMAGINARY
456
+ comment: "a floating pointer number with a rational and imaginary suffix"
457
+ - name: GLOBAL_VARIABLE
458
+ comment: "a global variable"
459
+ - name: GREATER
460
+ comment: ">"
461
+ - name: GREATER_EQUAL
462
+ comment: ">="
463
+ - name: GREATER_GREATER
464
+ comment: ">>"
465
+ - name: GREATER_GREATER_EQUAL
466
+ comment: ">>="
467
+ - name: HEREDOC_END
468
+ comment: "the end of a heredoc"
469
+ - name: HEREDOC_START
470
+ comment: "the start of a heredoc"
471
+ - name: IDENTIFIER
472
+ comment: "an identifier"
473
+ - name: IGNORED_NEWLINE
474
+ comment: "an ignored newline"
475
+ - name: INSTANCE_VARIABLE
476
+ comment: "an instance variable"
477
+ - name: INTEGER
478
+ comment: "an integer (any base)"
479
+ - name: INTEGER_IMAGINARY
480
+ comment: "an integer with an imaginary suffix"
481
+ - name: INTEGER_RATIONAL
482
+ comment: "an integer with a rational suffix"
483
+ - name: INTEGER_RATIONAL_IMAGINARY
484
+ comment: "an integer with a rational and imaginary suffix"
485
+ - name: KEYWORD_ALIAS
486
+ comment: "alias"
487
+ - name: KEYWORD_AND
488
+ comment: "and"
489
+ - name: KEYWORD_BEGIN
490
+ comment: "begin"
491
+ - name: KEYWORD_BEGIN_UPCASE
492
+ comment: "BEGIN"
493
+ - name: KEYWORD_BREAK
494
+ comment: "break"
495
+ - name: KEYWORD_CASE
496
+ comment: "case"
497
+ - name: KEYWORD_CLASS
498
+ comment: "class"
499
+ - name: KEYWORD_DEF
500
+ comment: "def"
501
+ - name: KEYWORD_DEFINED
502
+ comment: "defined?"
503
+ - name: KEYWORD_DO_BLOCK
504
+ comment: "do keyword for a block attached to a command"
505
+ - name: KEYWORD_DO_LAMBDA
506
+ comment: "do keyword that opens the body of a lambda literal"
507
+ - name: KEYWORD_DO_LOOP
508
+ comment: "do keyword for a predicate in a while, until, or for loop"
509
+ - name: KEYWORD_END_UPCASE
510
+ comment: "END"
511
+ - name: KEYWORD_FALSE
512
+ comment: "false"
513
+ - name: KEYWORD_FOR
514
+ comment: "for"
515
+ - name: KEYWORD_IF
516
+ comment: "if"
517
+ - name: KEYWORD_IF_MODIFIER
518
+ comment: "if in the modifier form"
519
+ - name: KEYWORD_MODULE
520
+ comment: "module"
521
+ - name: KEYWORD_NEXT
522
+ comment: "next"
523
+ - name: KEYWORD_NIL
524
+ comment: "nil"
525
+ - name: KEYWORD_NOT
526
+ comment: "not"
527
+ - name: KEYWORD_OR
528
+ comment: "or"
529
+ - name: KEYWORD_REDO
530
+ comment: "redo"
531
+ - name: KEYWORD_RESCUE_MODIFIER
532
+ comment: "rescue in the modifier form"
533
+ - name: KEYWORD_RETRY
534
+ comment: "retry"
535
+ - name: KEYWORD_RETURN
536
+ comment: "return"
537
+ - name: KEYWORD_SELF
538
+ comment: "self"
539
+ - name: KEYWORD_SUPER
540
+ comment: "super"
541
+ - name: KEYWORD_TRUE
542
+ comment: "true"
543
+ - name: KEYWORD_UNDEF
544
+ comment: "undef"
545
+ - name: KEYWORD_UNLESS
546
+ comment: "unless"
547
+ - name: KEYWORD_UNLESS_MODIFIER
548
+ comment: "unless in the modifier form"
549
+ - name: KEYWORD_UNTIL
550
+ comment: "until"
551
+ - name: KEYWORD_UNTIL_MODIFIER
552
+ comment: "until in the modifier form"
553
+ - name: KEYWORD_WHILE
554
+ comment: "while"
555
+ - name: KEYWORD_WHILE_MODIFIER
556
+ comment: "while in the modifier form"
557
+ - name: KEYWORD_YIELD
558
+ comment: "yield"
559
+ - name: KEYWORD___ENCODING__
560
+ comment: "__ENCODING__"
561
+ - name: KEYWORD___FILE__
562
+ comment: "__FILE__"
563
+ - name: KEYWORD___LINE__
564
+ comment: "__LINE__"
565
+ - name: LABEL
566
+ comment: "a label"
567
+ - name: LABEL_END
568
+ comment: "the end of a label"
569
+ - name: LAMBDA_BEGIN
570
+ comment: "{"
571
+ - name: LESS
572
+ comment: "<"
573
+ - name: LESS_EQUAL
574
+ comment: "<="
575
+ - name: LESS_EQUAL_GREATER
576
+ comment: "<=>"
577
+ - name: LESS_LESS
578
+ comment: "<<"
579
+ - name: LESS_LESS_EQUAL
580
+ comment: "<<="
581
+ - name: METHOD_NAME
582
+ comment: "a method name"
583
+ - name: MINUS
584
+ comment: "-"
585
+ - name: MINUS_EQUAL
586
+ comment: "-="
587
+ - name: MINUS_GREATER
588
+ comment: "->"
589
+ - name: NUMBERED_REFERENCE
590
+ comment: "a numbered reference to a capture group in the previous regular expression match"
591
+ - name: PARENTHESIS_LEFT
592
+ comment: "("
593
+ - name: PARENTHESIS_LEFT_GROUPING
594
+ comment: "( scanned at the beginning of an expression"
595
+ - name: PARENTHESIS_LEFT_PARENTHESES
596
+ comment: "( for a parentheses node"
597
+ - name: PERCENT
598
+ comment: "%"
599
+ - name: PERCENT_EQUAL
600
+ comment: "%="
601
+ - name: PERCENT_LOWER_I
602
+ comment: "%i"
603
+ - name: PERCENT_LOWER_W
604
+ comment: "%w"
605
+ - name: PERCENT_LOWER_X
606
+ comment: "%x"
607
+ - name: PERCENT_UPPER_I
608
+ comment: "%I"
609
+ - name: PERCENT_UPPER_W
610
+ comment: "%W"
611
+ - name: PIPE_EQUAL
612
+ comment: "|="
613
+ - name: PIPE_PIPE
614
+ comment: "||"
615
+ - name: PIPE_PIPE_EQUAL
616
+ comment: "||="
617
+ - name: PLUS
618
+ comment: "+"
619
+ - name: PLUS_EQUAL
620
+ comment: "+="
621
+ - name: QUESTION_MARK
622
+ comment: "?"
623
+ - name: REGEXP_BEGIN
624
+ comment: "the beginning of a regular expression"
625
+ - name: REGEXP_END
626
+ comment: "the end of a regular expression"
627
+ - name: SLASH
628
+ comment: "/"
629
+ - name: SLASH_EQUAL
630
+ comment: "/="
631
+ - name: STAR
632
+ comment: "*"
633
+ - name: STAR_EQUAL
634
+ comment: "*="
635
+ - name: STAR_STAR
636
+ comment: "**"
637
+ - name: STAR_STAR_EQUAL
638
+ comment: "**="
639
+ - name: STRING_BEGIN
640
+ comment: "the beginning of a string"
641
+ - name: STRING_CONTENT
642
+ comment: "the contents of a string"
643
+ - name: STRING_END
644
+ comment: "the end of a string"
645
+ - name: SYMBOL_BEGIN
646
+ comment: "the beginning of a symbol"
647
+ - name: TILDE
648
+ comment: "~ or ~@"
649
+ - name: UAMPERSAND
650
+ comment: "unary &"
651
+ - name: UCOLON_COLON
652
+ comment: "unary ::"
653
+ - name: UDOT_DOT
654
+ comment: "unary .. operator"
655
+ - name: UDOT_DOT_DOT
656
+ comment: "unary ... operator"
657
+ - name: UMINUS
658
+ comment: "-@"
659
+ - name: UMINUS_NUM
660
+ comment: "-@ for a number"
661
+ - name: UPLUS
662
+ comment: "+@"
663
+ - name: USTAR
664
+ comment: "unary *"
665
+ - name: USTAR_STAR
666
+ comment: "unary **"
667
+ - name: WORDS_SEP
668
+ comment: "a separator between words in a list"
669
+ - name: WORDS_SEP_IMPLICIT
670
+ comment: "a separator between words in a list that has no source characters"
671
+ - name: XSTRING_BEGIN
672
+ comment: "the beginning of an execution string"
673
+ - name: __END__
674
+ comment: "marker for the point in the file at which the parser should stop"
675
+ flags:
676
+ - name: ArgumentsNodeFlags
677
+ values:
678
+ - name: CONTAINS_FORWARDING
679
+ comment: "if the arguments contain forwarding"
680
+ - name: CONTAINS_KEYWORDS
681
+ comment: "if the arguments contain keywords"
682
+ - name: CONTAINS_KEYWORD_SPLAT
683
+ comment: "if the arguments contain a keyword splat"
684
+ - name: CONTAINS_SPLAT
685
+ comment: "if the arguments contain a splat"
686
+ - name: CONTAINS_MULTIPLE_SPLATS
687
+ comment: "if the arguments contain multiple splats"
688
+ comment: Flags for arguments nodes.
689
+ - name: ArrayNodeFlags
690
+ values:
691
+ - name: CONTAINS_SPLAT
692
+ comment: "if array contains splat nodes"
693
+ comment: Flags for array nodes.
694
+ - name: CallNodeFlags
695
+ values:
696
+ - name: SAFE_NAVIGATION
697
+ comment: "&. operator"
698
+ - name: VARIABLE_CALL
699
+ comment: "a call that could have been a local variable"
700
+ - name: ATTRIBUTE_WRITE
701
+ comment: "a call that is an attribute write, so the value being written should be returned"
702
+ - name: IGNORE_VISIBILITY
703
+ comment: "a call that ignores method visibility"
704
+ comment: Flags for call nodes.
705
+ - name: EncodingFlags
706
+ values:
707
+ - name: FORCED_UTF8_ENCODING
708
+ comment: "internal bytes forced the encoding to UTF-8"
709
+ - name: FORCED_BINARY_ENCODING
710
+ comment: "internal bytes forced the encoding to binary"
711
+ comment: Flags for nodes that have unescaped content.
712
+ - name: IntegerBaseFlags
713
+ values:
714
+ - name: BINARY
715
+ comment: "0b prefix"
716
+ - name: DECIMAL
717
+ comment: "0d or no prefix"
718
+ - name: OCTAL
719
+ comment: "0o or 0 prefix"
720
+ - name: HEXADECIMAL
721
+ comment: "0x prefix"
722
+ comment: Flags for integer nodes that correspond to the base of the integer.
723
+ - name: InterpolatedStringNodeFlags
724
+ values:
725
+ - name: FROZEN
726
+ comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
727
+ - name: MUTABLE
728
+ comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
729
+ comment: Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
730
+ - name: KeywordHashNodeFlags
731
+ values:
732
+ - name: SYMBOL_KEYS
733
+ comment: "a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments"
734
+ comment: Flags for keyword hash nodes.
735
+ - name: LoopFlags
736
+ values:
737
+ - name: BEGIN_MODIFIER
738
+ comment: "a loop after a begin statement, so the body is executed first before the condition"
739
+ comment: Flags for while and until loop nodes.
740
+ - name: ParameterFlags
741
+ values:
742
+ - name: REPEATED_PARAMETER
743
+ comment: "a parameter name that has been repeated in the method signature"
744
+ comment: Flags for parameter nodes.
745
+ - name: ParenthesesNodeFlags
746
+ values:
747
+ - name: MULTIPLE_STATEMENTS
748
+ comment: "parentheses that contain multiple potentially void statements"
749
+ comment: Flags for parentheses nodes.
750
+ - name: RangeFlags
751
+ values:
752
+ - name: EXCLUDE_END
753
+ comment: "... operator"
754
+ comment: Flags for range and flip-flop nodes.
755
+ - name: RegularExpressionFlags
756
+ values:
757
+ - name: IGNORE_CASE
758
+ comment: "i - ignores the case of characters when matching"
759
+ - name: EXTENDED
760
+ comment: "x - ignores whitespace and allows comments in regular expressions"
761
+ - name: MULTI_LINE
762
+ comment: "m - allows $ to match the end of lines within strings"
763
+ - name: ONCE
764
+ comment: "o - only interpolates values into the regular expression once"
765
+ - name: EUC_JP
766
+ comment: "e - forces the EUC-JP encoding"
767
+ - name: ASCII_8BIT
768
+ comment: "n - forces the ASCII-8BIT encoding"
769
+ - name: WINDOWS_31J
770
+ comment: "s - forces the Windows-31J encoding"
771
+ - name: UTF_8
772
+ comment: "u - forces the UTF-8 encoding"
773
+ - name: FORCED_UTF8_ENCODING
774
+ comment: "internal bytes forced the encoding to UTF-8"
775
+ - name: FORCED_BINARY_ENCODING
776
+ comment: "internal bytes forced the encoding to binary"
777
+ - name: FORCED_US_ASCII_ENCODING
778
+ comment: "internal bytes forced the encoding to US-ASCII"
779
+ comment: Flags for regular expression and match last line nodes.
780
+ - name: ShareableConstantNodeFlags
781
+ values:
782
+ - name: LITERAL
783
+ comment: "constant writes that should be modified with shareable constant value literal"
784
+ - name: EXPERIMENTAL_EVERYTHING
785
+ comment: "constant writes that should be modified with shareable constant value experimental everything"
786
+ - name: EXPERIMENTAL_COPY
787
+ comment: "constant writes that should be modified with shareable constant value experimental copy"
788
+ comment: Flags for shareable constant nodes.
789
+ - name: StringFlags
790
+ values:
791
+ - name: FORCED_UTF8_ENCODING
792
+ comment: "internal bytes forced the encoding to UTF-8"
793
+ - name: FORCED_BINARY_ENCODING
794
+ comment: "internal bytes forced the encoding to binary"
795
+ - name: FROZEN
796
+ comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`"
797
+ - name: MUTABLE
798
+ comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`"
799
+ comment: Flags for string nodes.
800
+ - name: SymbolFlags
801
+ values:
802
+ - name: FORCED_UTF8_ENCODING
803
+ comment: "internal bytes forced the encoding to UTF-8"
804
+ - name: FORCED_BINARY_ENCODING
805
+ comment: "internal bytes forced the encoding to binary"
806
+ - name: FORCED_US_ASCII_ENCODING
807
+ comment: "internal bytes forced the encoding to US-ASCII"
808
+ comment: Flags for symbol nodes.
809
+ nodes:
810
+ - name: AliasGlobalVariableNode
811
+ fields:
812
+ - name: new_name
813
+ type: node
814
+ kind:
815
+ - GlobalVariableReadNode
816
+ - BackReferenceReadNode
817
+ - NumberedReferenceReadNode
818
+ comment: |
819
+ Represents the new name of the global variable that can be used after aliasing.
820
+
821
+ alias $foo $bar
822
+ ^^^^
823
+ - name: old_name
824
+ type: node
825
+ kind:
826
+ - GlobalVariableReadNode
827
+ - BackReferenceReadNode
828
+ - NumberedReferenceReadNode
829
+ comment: |
830
+ Represents the old name of the global variable that can be used before aliasing.
831
+
832
+ alias $foo $bar
833
+ ^^^^
834
+ - name: keyword_loc
835
+ type: location
836
+ comment: |
837
+ The Location of the `alias` keyword.
838
+
839
+ alias $foo $bar
840
+ ^^^^^
841
+ comment: |
842
+ Represents the use of the `alias` keyword to alias a global variable.
843
+
844
+ alias $foo $bar
845
+ ^^^^^^^^^^^^^^^
846
+ - name: AliasMethodNode
847
+ fields:
848
+ - name: new_name
849
+ type: node
850
+ kind:
851
+ - SymbolNode
852
+ - InterpolatedSymbolNode
853
+ comment: |
854
+ Represents the new name of the method that will be aliased.
855
+
856
+ alias foo bar
857
+ ^^^
858
+
859
+ alias :foo :bar
860
+ ^^^^
861
+
862
+ alias :"#{foo}" :"#{bar}"
863
+ ^^^^^^^^^
864
+ - name: old_name
865
+ type: node
866
+ kind:
867
+ - SymbolNode
868
+ - InterpolatedSymbolNode
869
+ comment: |
870
+ Represents the old name of the method that will be aliased.
871
+
872
+ alias foo bar
873
+ ^^^
874
+
875
+ alias :foo :bar
876
+ ^^^^
877
+
878
+ alias :"#{foo}" :"#{bar}"
879
+ ^^^^^^^^^
880
+ - name: keyword_loc
881
+ type: location
882
+ comment: |
883
+ Represents the Location of the `alias` keyword.
884
+
885
+ alias foo bar
886
+ ^^^^^
887
+ comment: |
888
+ Represents the use of the `alias` keyword to alias a method.
889
+
890
+ alias foo bar
891
+ ^^^^^^^^^^^^^
892
+ - name: AlternationPatternNode
893
+ fields:
894
+ - name: left
895
+ type: node
896
+ kind: pattern expression
897
+ comment: |
898
+ Represents the left side of the expression.
899
+
900
+ foo => bar | baz
901
+ ^^^
902
+ - name: right
903
+ type: node
904
+ kind: pattern expression
905
+ comment: |
906
+ Represents the right side of the expression.
907
+
908
+ foo => bar | baz
909
+ ^^^
910
+ - name: operator_loc
911
+ type: location
912
+ comment: |
913
+ Represents the alternation operator Location.
914
+
915
+ foo => bar | baz
916
+ ^
917
+ comment: |
918
+ Represents an alternation pattern in pattern matching.
919
+
920
+ foo => bar | baz
921
+ ^^^^^^^^^
922
+ - name: AndNode
923
+ fields:
924
+ - name: left
925
+ type: node
926
+ kind: non-void expression
927
+ comment: |
928
+ Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
929
+
930
+ left and right
931
+ ^^^^
932
+
933
+ 1 && 2
934
+ ^
935
+ - name: right
936
+ type: node
937
+ kind: Node
938
+ comment: |
939
+ Represents the right side of the expression.
940
+
941
+ left && right
942
+ ^^^^^
943
+
944
+ 1 and 2
945
+ ^
946
+ - name: operator_loc
947
+ type: location
948
+ comment: |
949
+ The Location of the `and` keyword or the `&&` operator.
950
+
951
+ left and right
952
+ ^^^
953
+ comment: |
954
+ Represents the use of the `&&` operator or the `and` keyword.
955
+
956
+ left and right
957
+ ^^^^^^^^^^^^^^
958
+ - name: ArgumentsNode
959
+ flags: ArgumentsNodeFlags
960
+ fields:
961
+ - name: arguments
962
+ type: node[]
963
+ kind: non-void expression
964
+ comment: |
965
+ The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
966
+
967
+ foo(bar, baz)
968
+ ^^^^^^^^
969
+ comment: |
970
+ Represents a set of arguments to a method or a keyword.
971
+
972
+ return foo, bar, baz
973
+ ^^^^^^^^^^^^^
974
+ - name: ArrayNode
975
+ flags: ArrayNodeFlags
976
+ fields:
977
+ - name: elements
978
+ type: node[]
979
+ kind: non-void expression
980
+ comment: Represent the list of zero or more [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression) within the array.
981
+ - name: opening_loc
982
+ type: location?
983
+ comment: |
984
+ Represents the optional source Location for the opening token.
985
+
986
+ [1,2,3] # "["
987
+ %w[foo bar baz] # "%w["
988
+ %I(apple orange banana) # "%I("
989
+ foo = 1, 2, 3 # nil
990
+ - name: closing_loc
991
+ type: location?
992
+ comment: |
993
+ Represents the optional source Location for the closing token.
994
+
995
+ [1,2,3] # "]"
996
+ %w[foo bar baz] # "]"
997
+ %I(apple orange banana) # ")"
998
+ foo = 1, 2, 3 # nil
999
+ comment: |
1000
+ Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
1001
+
1002
+ [1, 2, 3]
1003
+ ^^^^^^^^^
1004
+ - name: ArrayPatternNode
1005
+ fields:
1006
+ - name: constant
1007
+ type: node?
1008
+ kind:
1009
+ - ConstantPathNode
1010
+ - ConstantReadNode
1011
+ comment: |
1012
+ Represents the optional constant preceding the Array
1013
+
1014
+ foo in Bar[]
1015
+ ^^^
1016
+
1017
+ foo in Bar[1, 2, 3]
1018
+ ^^^
1019
+
1020
+ foo in Bar::Baz[1, 2, 3]
1021
+ ^^^^^^^^
1022
+ - name: requireds
1023
+ type: node[]
1024
+ kind: pattern expression
1025
+ comment: |
1026
+ Represents the required elements of the array pattern.
1027
+
1028
+ foo in [1, 2]
1029
+ ^ ^
1030
+ - name: rest
1031
+ type: node?
1032
+ kind:
1033
+ - ImplicitRestNode
1034
+ - SplatNode
1035
+ comment: |
1036
+ Represents the rest element of the array pattern.
1037
+
1038
+ foo in *bar
1039
+ ^^^^
1040
+ - name: posts
1041
+ type: node[]
1042
+ kind: pattern expression
1043
+ comment: |
1044
+ Represents the elements after the rest element of the array pattern.
1045
+
1046
+ foo in *bar, baz
1047
+ ^^^
1048
+ - name: opening_loc
1049
+ type: location?
1050
+ comment: |
1051
+ Represents the opening Location of the array pattern.
1052
+
1053
+ foo in [1, 2]
1054
+ ^
1055
+ - name: closing_loc
1056
+ type: location?
1057
+ comment: |
1058
+ Represents the closing Location of the array pattern.
1059
+
1060
+ foo in [1, 2]
1061
+ ^
1062
+ comment: |
1063
+ Represents an array pattern in pattern matching.
1064
+
1065
+ foo in 1, 2
1066
+ ^^^^
1067
+
1068
+ foo in [1, 2]
1069
+ ^^^^^^
1070
+
1071
+ foo in *bar
1072
+ ^^^^
1073
+
1074
+ foo in Bar[]
1075
+ ^^^^^
1076
+
1077
+ foo in Bar[1, 2, 3]
1078
+ ^^^^^^^^^^^^
1079
+ - name: AssocNode
1080
+ fields:
1081
+ - name: key
1082
+ type: node
1083
+ kind: non-void expression
1084
+ comment: |
1085
+ The key of the association. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1086
+
1087
+ { a: b }
1088
+ ^
1089
+
1090
+ { foo => bar }
1091
+ ^^^
1092
+
1093
+ { def a; end => 1 }
1094
+ ^^^^^^^^^^
1095
+ - name: value
1096
+ type: node
1097
+ kind: non-void expression
1098
+ comment: |
1099
+ The value of the association, if present. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1100
+
1101
+ { foo => bar }
1102
+ ^^^
1103
+
1104
+ { x: 1 }
1105
+ ^
1106
+ - name: operator_loc
1107
+ type: location?
1108
+ comment: |
1109
+ The Location of the `=>` operator, if present.
1110
+
1111
+ { foo => bar }
1112
+ ^^
1113
+ comment: |
1114
+ Represents a hash key/value pair.
1115
+
1116
+ { a => b }
1117
+ ^^^^^^
1118
+ - name: AssocSplatNode
1119
+ fields:
1120
+ - name: value
1121
+ type: node?
1122
+ kind: non-void expression
1123
+ comment: |
1124
+ The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
1125
+
1126
+ { **foo }
1127
+ ^^^
1128
+ - name: operator_loc
1129
+ type: location
1130
+ comment: |
1131
+ The Location of the `**` operator.
1132
+
1133
+ { **x }
1134
+ ^^
1135
+ comment: |
1136
+ Represents a splat in a hash literal.
1137
+
1138
+ { **foo }
1139
+ ^^^^^
1140
+ - name: BackReferenceReadNode
1141
+ fields:
1142
+ - name: name
1143
+ type: constant
1144
+ comment: |
1145
+ The name of the back-reference variable, including the leading `$`.
1146
+
1147
+ $& # name `:$&`
1148
+
1149
+ $+ # name `:$+`
1150
+ comment: |
1151
+ Represents reading a reference to a field in the previous match.
1152
+
1153
+ $'
1154
+ ^^
1155
+ - name: BeginNode
1156
+ fields:
1157
+ - name: begin_keyword_loc
1158
+ type: location?
1159
+ comment: |
1160
+ Represents the Location of the `begin` keyword.
1161
+
1162
+ begin x end
1163
+ ^^^^^
1164
+ - name: statements
1165
+ type: node?
1166
+ kind: StatementsNode
1167
+ comment: |
1168
+ Represents the statements within the begin block.
1169
+
1170
+ begin x end
1171
+ ^
1172
+ - name: rescue_clause
1173
+ type: node?
1174
+ kind: RescueNode
1175
+ comment: |
1176
+ Represents the rescue clause within the begin block.
1177
+
1178
+ begin x; rescue y; end
1179
+ ^^^^^^^^
1180
+ - name: else_clause
1181
+ type: node?
1182
+ kind: ElseNode
1183
+ comment: |
1184
+ Represents the else clause within the begin block.
1185
+
1186
+ begin x; rescue y; else z; end
1187
+ ^^^^^^^^^^^
1188
+ - name: ensure_clause
1189
+ type: node?
1190
+ kind: EnsureNode
1191
+ comment: |
1192
+ Represents the ensure clause within the begin block.
1193
+
1194
+ begin x; ensure y; end
1195
+ ^^^^^^^^
1196
+ - name: end_keyword_loc
1197
+ type: location?
1198
+ comment: |
1199
+ Represents the Location of the `end` keyword.
1200
+
1201
+ begin x end
1202
+ ^^^
1203
+ newline: false
1204
+ comment: |
1205
+ Represents a begin statement.
1206
+
1207
+ begin
1208
+ foo
1209
+ end
1210
+ ^^^^^
1211
+ - name: BlockArgumentNode
1212
+ fields:
1213
+ - name: expression
1214
+ type: node?
1215
+ kind: non-void expression
1216
+ comment: |
1217
+ The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1218
+
1219
+ foo(&args)
1220
+ ^^^^
1221
+ - name: operator_loc
1222
+ type: location
1223
+ comment: |
1224
+ Represents the Location of the `&` operator.
1225
+
1226
+ foo(&args)
1227
+ ^
1228
+ comment: |
1229
+ Represents a block argument using `&`.
1230
+
1231
+ bar(&args)
1232
+ ^^^^^
1233
+ - name: BlockLocalVariableNode
1234
+ flags: ParameterFlags
1235
+ fields:
1236
+ - name: name
1237
+ type: constant
1238
+ comment: |
1239
+ The name of the block local variable.
1240
+
1241
+ a { |; b| } # name `:b`
1242
+ ^
1243
+ comment: |
1244
+ Represents a block local variable.
1245
+
1246
+ a { |; b| }
1247
+ ^
1248
+ - name: BlockNode
1249
+ fields:
1250
+ - name: locals
1251
+ type: constant[]
1252
+ comment: |
1253
+ The local variables declared in the block.
1254
+
1255
+ [1, 2, 3].each { |i| puts x } # locals: [:i]
1256
+ ^
1257
+ - name: parameters
1258
+ type: node?
1259
+ kind:
1260
+ - BlockParametersNode
1261
+ - NumberedParametersNode
1262
+ - ItParametersNode
1263
+ comment: |
1264
+ The parameters of the block.
1265
+
1266
+ [1, 2, 3].each { |i| puts x }
1267
+ ^^^
1268
+ [1, 2, 3].each { puts _1 }
1269
+ ^^^^^^^^^^^
1270
+ [1, 2, 3].each { puts it }
1271
+ ^^^^^^^^^^^
1272
+ - name: body
1273
+ type: node?
1274
+ kind:
1275
+ - StatementsNode
1276
+ - BeginNode
1277
+ comment: |
1278
+ The body of the block.
1279
+
1280
+ [1, 2, 3].each { |i| puts x }
1281
+ ^^^^^^
1282
+ - name: opening_loc
1283
+ type: location
1284
+ comment: |
1285
+ Represents the Location of the opening `{` or `do`.
1286
+
1287
+ [1, 2, 3].each { |i| puts x }
1288
+ ^
1289
+ - name: closing_loc
1290
+ type: location
1291
+ comment: |
1292
+ Represents the Location of the closing `}` or `end`.
1293
+
1294
+ [1, 2, 3].each { |i| puts x }
1295
+ ^
1296
+ comment: |
1297
+ Represents a block of ruby code.
1298
+
1299
+ [1, 2, 3].each { |i| puts x }
1300
+ ^^^^^^^^^^^^^^
1301
+ - name: BlockParameterNode
1302
+ flags: ParameterFlags
1303
+ fields:
1304
+ - name: name
1305
+ type: constant?
1306
+ comment: |
1307
+ The name of the block parameter.
1308
+
1309
+ def a(&b) # name `:b`
1310
+ ^
1311
+ end
1312
+ - name: name_loc
1313
+ type: location?
1314
+ comment: |
1315
+ Represents the Location of the block parameter name.
1316
+
1317
+ def a(&b)
1318
+ ^
1319
+ - name: operator_loc
1320
+ type: location
1321
+ comment: |
1322
+ Represents the Location of the `&` operator.
1323
+
1324
+ def a(&b)
1325
+ ^
1326
+ end
1327
+ comment: |
1328
+ Represents a block parameter of a method, block, or lambda definition.
1329
+
1330
+ def a(&b)
1331
+ ^^
1332
+ end
1333
+ - name: BlockParametersNode
1334
+ fields:
1335
+ - name: parameters
1336
+ type: node?
1337
+ kind: ParametersNode
1338
+ comment: |
1339
+ Represents the parameters of the block.
1340
+
1341
+ -> (a, b = 1; local) { }
1342
+ ^^^^^^^^
1343
+
1344
+ foo do |a, b = 1; local|
1345
+ ^^^^^^^^
1346
+ end
1347
+ - name: locals
1348
+ type: node[]
1349
+ kind: BlockLocalVariableNode
1350
+ comment: |
1351
+ Represents the local variables of the block.
1352
+
1353
+ -> (a, b = 1; local) { }
1354
+ ^^^^^
1355
+
1356
+ foo do |a, b = 1; local|
1357
+ ^^^^^
1358
+ end
1359
+ - name: opening_loc
1360
+ type: location?
1361
+ comment: |
1362
+ Represents the opening Location of the block parameters.
1363
+
1364
+ -> (a, b = 1; local) { }
1365
+ ^
1366
+
1367
+ foo do |a, b = 1; local|
1368
+ ^
1369
+ end
1370
+ - name: closing_loc
1371
+ type: location?
1372
+ comment: |
1373
+ Represents the closing Location of the block parameters.
1374
+
1375
+ -> (a, b = 1; local) { }
1376
+ ^
1377
+
1378
+ foo do |a, b = 1; local|
1379
+ ^
1380
+ end
1381
+ comment: |
1382
+ Represents a block's parameters declaration.
1383
+
1384
+ -> (a, b = 1; local) { }
1385
+ ^^^^^^^^^^^^^^^^^
1386
+
1387
+ foo do |a, b = 1; local|
1388
+ ^^^^^^^^^^^^^^^^^
1389
+ end
1390
+ - name: BreakNode
1391
+ fields:
1392
+ - name: arguments
1393
+ type: node?
1394
+ kind: ArgumentsNode
1395
+ comment: |
1396
+ The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1397
+
1398
+ break foo
1399
+ ^^^
1400
+ - name: keyword_loc
1401
+ type: location
1402
+ comment: |
1403
+ The Location of the `break` keyword.
1404
+
1405
+ break foo
1406
+ ^^^^^
1407
+ comment: |
1408
+ Represents the use of the `break` keyword.
1409
+
1410
+ break foo
1411
+ ^^^^^^^^^
1412
+ - name: CallAndWriteNode
1413
+ flags: CallNodeFlags
1414
+ fields:
1415
+ - name: receiver
1416
+ type: node?
1417
+ kind: non-void expression
1418
+ comment: |
1419
+ The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1420
+
1421
+ foo.bar &&= value
1422
+ ^^^
1423
+ - name: call_operator_loc
1424
+ type: location?
1425
+ comment: |
1426
+ Represents the Location of the call operator.
1427
+
1428
+ foo.bar &&= value
1429
+ ^
1430
+ - name: message_loc
1431
+ type: location?
1432
+ comment: |
1433
+ Represents the Location of the message.
1434
+
1435
+ foo.bar &&= value
1436
+ ^^^
1437
+ - name: read_name
1438
+ type: constant
1439
+ comment: |
1440
+ Represents the name of the method being called.
1441
+
1442
+ foo.bar &&= value # read_name `:bar`
1443
+ ^^^
1444
+ - name: write_name
1445
+ type: constant
1446
+ comment: |
1447
+ Represents the name of the method being written to.
1448
+
1449
+ foo.bar &&= value # write_name `:bar=`
1450
+ ^^^
1451
+ - name: operator_loc
1452
+ type: location
1453
+ comment: |
1454
+ Represents the Location of the operator.
1455
+
1456
+ foo.bar &&= value
1457
+ ^^^
1458
+ - name: value
1459
+ type: node
1460
+ kind: non-void expression
1461
+ comment: |
1462
+ Represents the value being assigned.
1463
+
1464
+ foo.bar &&= value
1465
+ ^^^^^
1466
+ comment: |
1467
+ Represents the use of the `&&=` operator on a call.
1468
+
1469
+ foo.bar &&= value
1470
+ ^^^^^^^^^^^^^^^^^
1471
+ - name: CallNode
1472
+ flags: CallNodeFlags
1473
+ fields:
1474
+ - name: receiver
1475
+ type: node?
1476
+ kind: non-void expression
1477
+ comment: |
1478
+ The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1479
+
1480
+ foo.bar
1481
+ ^^^
1482
+
1483
+ +foo
1484
+ ^^^
1485
+
1486
+ foo + bar
1487
+ ^^^
1488
+ - name: call_operator_loc
1489
+ type: location?
1490
+ comment: |
1491
+ Represents the Location of the call operator.
1492
+
1493
+ foo.bar
1494
+ ^
1495
+
1496
+ foo&.bar
1497
+ ^^
1498
+ - name: name
1499
+ type: constant
1500
+ comment: |
1501
+ Represents the name of the method being called.
1502
+
1503
+ foo.bar # name `:foo`
1504
+ ^^^
1505
+ - name: message_loc
1506
+ type: location?
1507
+ comment: |
1508
+ Represents the Location of the message.
1509
+
1510
+ foo.bar
1511
+ ^^^
1512
+ - name: opening_loc
1513
+ type: location?
1514
+ comment: |
1515
+ Represents the Location of the left parenthesis.
1516
+
1517
+ foo(bar)
1518
+ ^
1519
+ - name: arguments
1520
+ type: node?
1521
+ kind: ArgumentsNode
1522
+ comment: |
1523
+ Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1524
+
1525
+ foo(bar)
1526
+ ^^^
1527
+ - name: closing_loc
1528
+ type: location?
1529
+ comment: |
1530
+ Represents the Location of the right parenthesis.
1531
+
1532
+ foo(bar)
1533
+ ^
1534
+ - name: equal_loc
1535
+ type: location?
1536
+ comment: |
1537
+ Represents the Location of the equal sign, in the case that this is an attribute write.
1538
+
1539
+ foo.bar = value
1540
+ ^
1541
+
1542
+ foo[bar] = value
1543
+ ^
1544
+ - name: block
1545
+ type: node?
1546
+ kind:
1547
+ - BlockNode
1548
+ - BlockArgumentNode
1549
+ comment: |
1550
+ Represents the block that is being passed to the method.
1551
+
1552
+ foo { |a| a }
1553
+ ^^^^^^^^^
1554
+ comment: |
1555
+ Represents a method call, in all of the various forms that can take.
1556
+
1557
+ foo
1558
+ ^^^
1559
+
1560
+ foo()
1561
+ ^^^^^
1562
+
1563
+ +foo
1564
+ ^^^^
1565
+
1566
+ foo + bar
1567
+ ^^^^^^^^^
1568
+
1569
+ foo.bar
1570
+ ^^^^^^^
1571
+
1572
+ foo&.bar
1573
+ ^^^^^^^^
1574
+ - name: CallOperatorWriteNode
1575
+ flags: CallNodeFlags
1576
+ fields:
1577
+ - name: receiver
1578
+ type: node?
1579
+ kind: non-void expression
1580
+ comment: |
1581
+ The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1582
+
1583
+ foo.bar += value
1584
+ ^^^
1585
+ - name: call_operator_loc
1586
+ type: location?
1587
+ comment: |
1588
+ Represents the Location of the call operator.
1589
+
1590
+ foo.bar += value
1591
+ ^
1592
+ - name: message_loc
1593
+ type: location?
1594
+ comment: |
1595
+ Represents the Location of the message.
1596
+
1597
+ foo.bar += value
1598
+ ^^^
1599
+ - name: read_name
1600
+ type: constant
1601
+ comment: |
1602
+ Represents the name of the method being called.
1603
+
1604
+ foo.bar += value # read_name `:bar`
1605
+ ^^^
1606
+ - name: write_name
1607
+ type: constant
1608
+ comment: |
1609
+ Represents the name of the method being written to.
1610
+
1611
+ foo.bar += value # write_name `:bar=`
1612
+ ^^^
1613
+ - name: binary_operator
1614
+ type: constant
1615
+ comment: |
1616
+ Represents the binary operator being used.
1617
+
1618
+ foo.bar += value # binary_operator `:+`
1619
+ ^
1620
+ - name: binary_operator_loc
1621
+ type: location
1622
+ comment: |
1623
+ Represents the Location of the binary operator.
1624
+
1625
+ foo.bar += value
1626
+ ^^
1627
+ - name: value
1628
+ type: node
1629
+ kind: non-void expression
1630
+ comment: |
1631
+ Represents the value being assigned.
1632
+
1633
+ foo.bar += value
1634
+ ^^^^^
1635
+ comment: |
1636
+ Represents the use of an assignment operator on a call.
1637
+
1638
+ foo.bar += baz
1639
+ ^^^^^^^^^^^^^^
1640
+ - name: CallOrWriteNode
1641
+ flags: CallNodeFlags
1642
+ fields:
1643
+ - name: receiver
1644
+ type: node?
1645
+ kind: non-void expression
1646
+ comment: |
1647
+ The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1648
+
1649
+ foo.bar ||= value
1650
+ ^^^
1651
+ - name: call_operator_loc
1652
+ type: location?
1653
+ comment: |
1654
+ Represents the Location of the call operator.
1655
+
1656
+ foo.bar ||= value
1657
+ ^
1658
+ - name: message_loc
1659
+ type: location?
1660
+ comment: |
1661
+ Represents the Location of the message.
1662
+
1663
+ foo.bar ||= value
1664
+ ^^^
1665
+ - name: read_name
1666
+ type: constant
1667
+ comment: |
1668
+ Represents the name of the method being called.
1669
+
1670
+ foo.bar ||= value # read_name `:bar`
1671
+ ^^^
1672
+ - name: write_name
1673
+ type: constant
1674
+ comment: |
1675
+ Represents the name of the method being written to.
1676
+
1677
+ foo.bar ||= value # write_name `:bar=`
1678
+ ^^^
1679
+ - name: operator_loc
1680
+ type: location
1681
+ comment: |
1682
+ Represents the Location of the operator.
1683
+
1684
+ foo.bar ||= value
1685
+ ^^^
1686
+ - name: value
1687
+ type: node
1688
+ kind: non-void expression
1689
+ comment: |
1690
+ Represents the value being assigned.
1691
+
1692
+ foo.bar ||= value
1693
+ ^^^^^
1694
+ comment: |
1695
+ Represents the use of the `||=` operator on a call.
1696
+
1697
+ foo.bar ||= value
1698
+ ^^^^^^^^^^^^^^^^^
1699
+ - name: CallTargetNode
1700
+ flags: CallNodeFlags
1701
+ fields:
1702
+ - name: receiver
1703
+ type: node
1704
+ kind: non-void expression
1705
+ comment: |
1706
+ The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1707
+
1708
+ foo.bar = 1
1709
+ ^^^
1710
+ - name: call_operator_loc
1711
+ type: location
1712
+ comment: |
1713
+ Represents the Location of the call operator.
1714
+
1715
+ foo.bar = 1
1716
+ ^
1717
+ - name: name
1718
+ type: constant
1719
+ comment: |
1720
+ Represents the name of the method being called.
1721
+
1722
+ foo.bar = 1 # name `:foo`
1723
+ ^^^
1724
+ - name: message_loc
1725
+ type: location
1726
+ comment: |
1727
+ Represents the Location of the message.
1728
+
1729
+ foo.bar = 1
1730
+ ^^^
1731
+ comment: |
1732
+ Represents assigning to a method call.
1733
+
1734
+ foo.bar, = 1
1735
+ ^^^^^^^
1736
+
1737
+ begin
1738
+ rescue => foo.bar
1739
+ ^^^^^^^
1740
+ end
1741
+
1742
+ for foo.bar in baz do end
1743
+ ^^^^^^^
1744
+ - name: CapturePatternNode
1745
+ fields:
1746
+ - name: value
1747
+ type: node
1748
+ kind: pattern expression
1749
+ comment: |
1750
+ Represents the value to capture.
1751
+
1752
+ foo => bar
1753
+ ^^^
1754
+ - name: target
1755
+ type: node
1756
+ kind: LocalVariableTargetNode
1757
+ comment: |
1758
+ Represents the target of the capture.
1759
+
1760
+ foo => bar
1761
+ ^^^
1762
+ - name: operator_loc
1763
+ type: location
1764
+ comment: |
1765
+ Represents the Location of the `=>` operator.
1766
+
1767
+ foo => bar
1768
+ ^^
1769
+ comment: |
1770
+ Represents assigning to a local variable in pattern matching.
1771
+
1772
+ foo => [bar => baz]
1773
+ ^^^^^^^^^^
1774
+ - name: CaseMatchNode
1775
+ fields:
1776
+ - name: predicate
1777
+ type: node?
1778
+ kind: non-void expression
1779
+ comment: |
1780
+ Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1781
+
1782
+ case true; in false; end
1783
+ ^^^^
1784
+ - name: conditions
1785
+ type: node[]
1786
+ kind: InNode
1787
+ comment: |
1788
+ Represents the conditions of the case match.
1789
+
1790
+ case true; in false; end
1791
+ ^^^^^^^^
1792
+ - name: else_clause
1793
+ type: node?
1794
+ kind: ElseNode
1795
+ comment: |
1796
+ Represents the else clause of the case match.
1797
+
1798
+ case true; in false; else; end
1799
+ ^^^^^^^^^
1800
+ - name: case_keyword_loc
1801
+ type: location
1802
+ comment: |
1803
+ Represents the Location of the `case` keyword.
1804
+
1805
+ case true; in false; end
1806
+ ^^^^
1807
+ - name: end_keyword_loc
1808
+ type: location
1809
+ comment: |
1810
+ Represents the Location of the `end` keyword.
1811
+
1812
+ case true; in false; end
1813
+ ^^^
1814
+ comment: |
1815
+ Represents the use of a case statement for pattern matching.
1816
+
1817
+ case true
1818
+ in false
1819
+ end
1820
+ ^^^^^^^^^
1821
+ - name: CaseNode
1822
+ fields:
1823
+ - name: predicate
1824
+ type: node?
1825
+ kind: non-void expression
1826
+ comment: |
1827
+ Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1828
+
1829
+ case true; when false; end
1830
+ ^^^^
1831
+ - name: conditions
1832
+ type: node[]
1833
+ kind: WhenNode
1834
+ comment: |
1835
+ Represents the conditions of the case statement.
1836
+
1837
+ case true; when false; end
1838
+ ^^^^^^^^^^
1839
+ - name: else_clause
1840
+ type: node?
1841
+ kind: ElseNode
1842
+ comment: |
1843
+ Represents the else clause of the case statement.
1844
+
1845
+ case true; when false; else; end
1846
+ ^^^^^^^^^
1847
+ - name: case_keyword_loc
1848
+ type: location
1849
+ comment: |
1850
+ Represents the Location of the `case` keyword.
1851
+
1852
+ case true; when false; end
1853
+ ^^^^
1854
+ - name: end_keyword_loc
1855
+ type: location
1856
+ comment: |
1857
+ Represents the Location of the `end` keyword.
1858
+
1859
+ case true; when false; end
1860
+ ^^^
1861
+ comment: |
1862
+ Represents the use of a case statement.
1863
+
1864
+ case true
1865
+ when false
1866
+ end
1867
+ ^^^^^^^^^^
1868
+ - name: ClassNode
1869
+ fields:
1870
+ - name: locals
1871
+ type: constant[]
1872
+ - name: class_keyword_loc
1873
+ type: location
1874
+ comment: |
1875
+ Represents the Location of the `class` keyword.
1876
+
1877
+ class Foo end
1878
+ ^^^^^
1879
+ - name: constant_path
1880
+ type: node
1881
+ kind:
1882
+ - ConstantReadNode
1883
+ - ConstantPathNode
1884
+ - name: inheritance_operator_loc
1885
+ type: location?
1886
+ comment: |
1887
+ Represents the Location of the `<` operator.
1888
+
1889
+ class Foo < Bar
1890
+ ^
1891
+ - name: superclass
1892
+ type: node?
1893
+ kind: non-void expression
1894
+ comment: |
1895
+ Represents the superclass of the class.
1896
+
1897
+ class Foo < Bar
1898
+ ^^^
1899
+ - name: body
1900
+ type: node?
1901
+ kind:
1902
+ - StatementsNode
1903
+ - BeginNode
1904
+ comment: |
1905
+ Represents the body of the class.
1906
+
1907
+ class Foo; bar; end
1908
+ ^^^
1909
+ - name: end_keyword_loc
1910
+ type: location
1911
+ comment: |
1912
+ Represents the Location of the `end` keyword.
1913
+
1914
+ class Foo end
1915
+ ^^^
1916
+ - name: name
1917
+ type: constant
1918
+ comment: |
1919
+ The name of the class.
1920
+
1921
+ class Foo end # name `:Foo`
1922
+ comment: |
1923
+ Represents a class declaration involving the `class` keyword.
1924
+
1925
+ class Foo end
1926
+ ^^^^^^^^^^^^^
1927
+ - name: ClassVariableAndWriteNode
1928
+ fields:
1929
+ - name: name
1930
+ type: constant
1931
+ comment: |
1932
+ The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
1933
+
1934
+ @@target &&= value # name `:@@target`
1935
+ ^^^^^^^^
1936
+ - name: name_loc
1937
+ type: location
1938
+ comment: |
1939
+ Represents the Location of the variable name.
1940
+
1941
+ @@target &&= value
1942
+ ^^^^^^^^
1943
+ - name: operator_loc
1944
+ type: location
1945
+ comment: |
1946
+ Represents the Location of the `&&=` operator.
1947
+
1948
+ @@target &&= value
1949
+ ^^^
1950
+ - name: value
1951
+ type: node
1952
+ kind: non-void expression
1953
+ comment: |
1954
+ Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1955
+
1956
+ @@target &&= value
1957
+ ^^^^^
1958
+ comment: |
1959
+ Represents the use of the `&&=` operator for assignment to a class variable.
1960
+
1961
+ @@target &&= value
1962
+ ^^^^^^^^^^^^^^^^^^
1963
+ - name: ClassVariableOperatorWriteNode
1964
+ fields:
1965
+ - name: name
1966
+ type: constant
1967
+ - name: name_loc
1968
+ type: location
1969
+ - name: binary_operator_loc
1970
+ type: location
1971
+ - name: value
1972
+ type: node
1973
+ kind: non-void expression
1974
+ - name: binary_operator
1975
+ type: constant
1976
+ comment: |
1977
+ Represents assigning to a class variable using an operator that isn't `=`.
1978
+
1979
+ @@target += value
1980
+ ^^^^^^^^^^^^^^^^^
1981
+ - name: ClassVariableOrWriteNode
1982
+ fields:
1983
+ - name: name
1984
+ type: constant
1985
+ - name: name_loc
1986
+ type: location
1987
+ - name: operator_loc
1988
+ type: location
1989
+ - name: value
1990
+ type: node
1991
+ kind: non-void expression
1992
+ comment: |
1993
+ Represents the use of the `||=` operator for assignment to a class variable.
1994
+
1995
+ @@target ||= value
1996
+ ^^^^^^^^^^^^^^^^^^
1997
+ - name: ClassVariableReadNode
1998
+ fields:
1999
+ - name: name
2000
+ type: constant
2001
+ comment: |
2002
+ The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
2003
+
2004
+ @@abc # name `:@@abc`
2005
+
2006
+ @@_test # name `:@@_test`
2007
+ comment: |
2008
+ Represents referencing a class variable.
2009
+
2010
+ @@foo
2011
+ ^^^^^
2012
+ - name: ClassVariableTargetNode
2013
+ fields:
2014
+ - name: name
2015
+ type: constant
2016
+ comment: |
2017
+ Represents writing to a class variable in a context that doesn't have an explicit value.
2018
+
2019
+ @@foo, @@bar = baz
2020
+ ^^^^^ ^^^^^
2021
+ - name: ClassVariableWriteNode
2022
+ fields:
2023
+ - name: name
2024
+ type: constant
2025
+ comment: |
2026
+ The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
2027
+
2028
+ @@abc = 123 # name `@@abc`
2029
+
2030
+ @@_test = :test # name `@@_test`
2031
+ - name: name_loc
2032
+ type: location
2033
+ comment: |
2034
+ The Location of the variable name.
2035
+
2036
+ @@foo = :bar
2037
+ ^^^^^
2038
+ - name: value
2039
+ type: node
2040
+ kind: non-void expression
2041
+ comment: |
2042
+ The value to write to the class variable. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2043
+
2044
+ @@foo = :bar
2045
+ ^^^^
2046
+
2047
+ @@_xyz = 123
2048
+ ^^^
2049
+ - name: operator_loc
2050
+ type: location
2051
+ comment: |
2052
+ The Location of the `=` operator.
2053
+
2054
+ @@foo = :bar
2055
+ ^
2056
+ comment: |
2057
+ Represents writing to a class variable.
2058
+
2059
+ @@foo = 1
2060
+ ^^^^^^^^^
2061
+ - name: ConstantAndWriteNode
2062
+ fields:
2063
+ - name: name
2064
+ type: constant
2065
+ - name: name_loc
2066
+ type: location
2067
+ - name: operator_loc
2068
+ type: location
2069
+ - name: value
2070
+ type: node
2071
+ kind: non-void expression
2072
+ comment: |
2073
+ Represents the use of the `&&=` operator for assignment to a constant.
2074
+
2075
+ Target &&= value
2076
+ ^^^^^^^^^^^^^^^^
2077
+ - name: ConstantOperatorWriteNode
2078
+ fields:
2079
+ - name: name
2080
+ type: constant
2081
+ - name: name_loc
2082
+ type: location
2083
+ - name: binary_operator_loc
2084
+ type: location
2085
+ - name: value
2086
+ type: node
2087
+ kind: non-void expression
2088
+ - name: binary_operator
2089
+ type: constant
2090
+ comment: |
2091
+ Represents assigning to a constant using an operator that isn't `=`.
2092
+
2093
+ Target += value
2094
+ ^^^^^^^^^^^^^^^
2095
+ - name: ConstantOrWriteNode
2096
+ fields:
2097
+ - name: name
2098
+ type: constant
2099
+ - name: name_loc
2100
+ type: location
2101
+ - name: operator_loc
2102
+ type: location
2103
+ - name: value
2104
+ type: node
2105
+ kind: non-void expression
2106
+ comment: |
2107
+ Represents the use of the `||=` operator for assignment to a constant.
2108
+
2109
+ Target ||= value
2110
+ ^^^^^^^^^^^^^^^^
2111
+ - name: ConstantPathAndWriteNode
2112
+ fields:
2113
+ - name: target
2114
+ type: node
2115
+ kind: ConstantPathNode
2116
+ - name: operator_loc
2117
+ type: location
2118
+ - name: value
2119
+ type: node
2120
+ kind: non-void expression
2121
+ comment: |
2122
+ Represents the use of the `&&=` operator for assignment to a constant path.
2123
+
2124
+ Parent::Child &&= value
2125
+ ^^^^^^^^^^^^^^^^^^^^^^^
2126
+ - name: ConstantPathNode
2127
+ fields:
2128
+ - name: parent
2129
+ type: node?
2130
+ kind: non-void expression
2131
+ comment: |
2132
+ The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree.
2133
+
2134
+ Foo::Bar
2135
+ ^^^
2136
+
2137
+ self::Test
2138
+ ^^^^
2139
+
2140
+ a.b::C
2141
+ ^^^
2142
+ - name: name
2143
+ type: constant?
2144
+ comment: The name of the constant being accessed. This could be `nil` in the event of a syntax error.
2145
+ - name: delimiter_loc
2146
+ type: location
2147
+ comment: |
2148
+ The Location of the `::` delimiter.
2149
+
2150
+ ::Foo
2151
+ ^^
2152
+
2153
+ One::Two
2154
+ ^^
2155
+ - name: name_loc
2156
+ type: location
2157
+ comment: |
2158
+ The Location of the name of the constant.
2159
+
2160
+ ::Foo
2161
+ ^^^
2162
+
2163
+ One::Two
2164
+ ^^^
2165
+ comment: |
2166
+ Represents accessing a constant through a path of `::` operators.
2167
+
2168
+ Foo::Bar
2169
+ ^^^^^^^^
2170
+ - name: ConstantPathOperatorWriteNode
2171
+ fields:
2172
+ - name: target
2173
+ type: node
2174
+ kind: ConstantPathNode
2175
+ - name: binary_operator_loc
2176
+ type: location
2177
+ - name: value
2178
+ type: node
2179
+ kind: non-void expression
2180
+ - name: binary_operator
2181
+ type: constant
2182
+ comment: |
2183
+ Represents assigning to a constant path using an operator that isn't `=`.
2184
+
2185
+ Parent::Child += value
2186
+ ^^^^^^^^^^^^^^^^^^^^^^
2187
+ - name: ConstantPathOrWriteNode
2188
+ fields:
2189
+ - name: target
2190
+ type: node
2191
+ kind: ConstantPathNode
2192
+ - name: operator_loc
2193
+ type: location
2194
+ - name: value
2195
+ type: node
2196
+ kind: non-void expression
2197
+ comment: |
2198
+ Represents the use of the `||=` operator for assignment to a constant path.
2199
+
2200
+ Parent::Child ||= value
2201
+ ^^^^^^^^^^^^^^^^^^^^^^^
2202
+ - name: ConstantPathTargetNode
2203
+ fields:
2204
+ - name: parent
2205
+ type: node?
2206
+ kind: non-void expression
2207
+ - name: name
2208
+ type: constant?
2209
+ - name: delimiter_loc
2210
+ type: location
2211
+ - name: name_loc
2212
+ type: location
2213
+ comment: |
2214
+ Represents writing to a constant path in a context that doesn't have an explicit value.
2215
+
2216
+ Foo::Foo, Bar::Bar = baz
2217
+ ^^^^^^^^ ^^^^^^^^
2218
+ - name: ConstantPathWriteNode
2219
+ fields:
2220
+ - name: target
2221
+ type: node
2222
+ kind: ConstantPathNode
2223
+ comment: |
2224
+ A node representing the constant path being written to.
2225
+
2226
+ Foo::Bar = 1
2227
+ ^^^^^^^^
2228
+
2229
+ ::Foo = :abc
2230
+ ^^^^^
2231
+ - name: operator_loc
2232
+ type: location
2233
+ comment: |
2234
+ The Location of the `=` operator.
2235
+
2236
+ ::ABC = 123
2237
+ ^
2238
+ - name: value
2239
+ type: node
2240
+ kind: non-void expression
2241
+ comment: |
2242
+ The value to write to the constant path. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2243
+
2244
+ FOO::BAR = :abc
2245
+ ^^^^
2246
+ comment: |
2247
+ Represents writing to a constant path.
2248
+
2249
+ ::Foo = 1
2250
+ ^^^^^^^^^
2251
+
2252
+ Foo::Bar = 1
2253
+ ^^^^^^^^^^^^
2254
+
2255
+ ::Foo::Bar = 1
2256
+ ^^^^^^^^^^^^^^
2257
+ - name: ConstantReadNode
2258
+ fields:
2259
+ - name: name
2260
+ type: constant
2261
+ comment: |
2262
+ The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
2263
+
2264
+ X # name `:X`
2265
+
2266
+ SOME_CONSTANT # name `:SOME_CONSTANT`
2267
+ comment: |
2268
+ Represents referencing a constant.
2269
+
2270
+ Foo
2271
+ ^^^
2272
+ - name: ConstantTargetNode
2273
+ fields:
2274
+ - name: name
2275
+ type: constant
2276
+ comment: |
2277
+ Represents writing to a constant in a context that doesn't have an explicit value.
2278
+
2279
+ Foo, Bar = baz
2280
+ ^^^ ^^^
2281
+ - name: ConstantWriteNode
2282
+ fields:
2283
+ - name: name
2284
+ type: constant
2285
+ comment: |
2286
+ The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
2287
+
2288
+ Foo = :bar # name `:Foo`
2289
+
2290
+ XYZ = 1 # name `:XYZ`
2291
+ - name: name_loc
2292
+ type: location
2293
+ comment: |
2294
+ The Location of the constant name.
2295
+
2296
+ FOO = 1
2297
+ ^^^
2298
+ - name: value
2299
+ type: node
2300
+ kind: non-void expression
2301
+ comment: |
2302
+ The value to write to the constant. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2303
+
2304
+ FOO = :bar
2305
+ ^^^^
2306
+
2307
+ MyClass = Class.new
2308
+ ^^^^^^^^^
2309
+ - name: operator_loc
2310
+ type: location
2311
+ comment: |
2312
+ The Location of the `=` operator.
2313
+
2314
+ FOO = :bar
2315
+ ^
2316
+ comment: |
2317
+ Represents writing to a constant.
2318
+
2319
+ Foo = 1
2320
+ ^^^^^^^
2321
+ - name: DefNode
2322
+ fields:
2323
+ - name: name
2324
+ type: constant
2325
+ - name: name_loc
2326
+ type: location
2327
+ - name: receiver
2328
+ type: node?
2329
+ kind: non-void expression
2330
+ - name: parameters
2331
+ type: node?
2332
+ kind: ParametersNode
2333
+ - name: body
2334
+ type: node?
2335
+ kind:
2336
+ - StatementsNode
2337
+ - BeginNode
2338
+ - name: locals
2339
+ type: constant[]
2340
+ - name: def_keyword_loc
2341
+ type: location
2342
+ - name: operator_loc
2343
+ type: location?
2344
+ - name: lparen_loc
2345
+ type: location?
2346
+ - name: rparen_loc
2347
+ type: location?
2348
+ - name: equal_loc
2349
+ type: location?
2350
+ - name: end_keyword_loc
2351
+ type: location?
2352
+ comment: |
2353
+ Represents a method definition.
2354
+
2355
+ def method
2356
+ end
2357
+ ^^^^^^^^^^
2358
+ - name: DefinedNode
2359
+ fields:
2360
+ - name: lparen_loc
2361
+ type: location?
2362
+ - name: value
2363
+ type: node
2364
+ kind: Node # More than non-void expression as defined?(return) is allowed, yet defined?(BEGIN{}) is SyntaxError
2365
+ - name: rparen_loc
2366
+ type: location?
2367
+ - name: keyword_loc
2368
+ type: location
2369
+ comment: |
2370
+ Represents the use of the `defined?` keyword.
2371
+
2372
+ defined?(a)
2373
+ ^^^^^^^^^^^
2374
+ - name: ElseNode
2375
+ fields:
2376
+ - name: else_keyword_loc
2377
+ type: location
2378
+ - name: statements
2379
+ type: node?
2380
+ kind: StatementsNode
2381
+ - name: end_keyword_loc
2382
+ type: location?
2383
+ comment: |
2384
+ Represents an `else` clause in a `case`, `if`, or `unless` statement.
2385
+
2386
+ if a then b else c end
2387
+ ^^^^^^^^^^
2388
+ - name: EmbeddedStatementsNode
2389
+ fields:
2390
+ - name: opening_loc
2391
+ type: location
2392
+ - name: statements
2393
+ type: node?
2394
+ kind: StatementsNode
2395
+ - name: closing_loc
2396
+ type: location
2397
+ comment: |
2398
+ Represents an interpolated set of statements.
2399
+
2400
+ "foo #{bar}"
2401
+ ^^^^^^
2402
+ - name: EmbeddedVariableNode
2403
+ fields:
2404
+ - name: operator_loc
2405
+ type: location
2406
+ - name: variable
2407
+ type: node
2408
+ kind:
2409
+ - InstanceVariableReadNode
2410
+ - ClassVariableReadNode
2411
+ - GlobalVariableReadNode
2412
+ - BackReferenceReadNode
2413
+ - NumberedReferenceReadNode
2414
+ comment: |
2415
+ Represents an interpolated variable.
2416
+
2417
+ "foo #@bar"
2418
+ ^^^^^
2419
+ - name: EnsureNode
2420
+ fields:
2421
+ - name: ensure_keyword_loc
2422
+ type: location
2423
+ - name: statements
2424
+ type: node?
2425
+ kind: StatementsNode
2426
+ - name: end_keyword_loc
2427
+ type: location
2428
+ comment: |
2429
+ Represents an `ensure` clause in a `begin` statement.
2430
+
2431
+ begin
2432
+ foo
2433
+ ensure
2434
+ ^^^^^^
2435
+ bar
2436
+ end
2437
+ - name: ErrorRecoveryNode
2438
+ fields:
2439
+ - name: unexpected
2440
+ type: node?
2441
+ kind: Node
2442
+ comment: |
2443
+ The unexpected node that was found in the tree, if there was one.
2444
+ comment: |
2445
+ Represents a node that is either missing or unexpected and results in a syntax error.
2446
+ - name: FalseNode
2447
+ comment: |
2448
+ Represents the use of the literal `false` keyword.
2449
+
2450
+ false
2451
+ ^^^^^
2452
+ - name: FindPatternNode
2453
+ fields:
2454
+ - name: constant
2455
+ type: node?
2456
+ kind:
2457
+ - ConstantPathNode
2458
+ - ConstantReadNode
2459
+ comment: |
2460
+ Represents the optional constant preceding the pattern
2461
+
2462
+ foo in Foo(*bar, baz, *qux)
2463
+ ^^^
2464
+ - name: left
2465
+ type: node
2466
+ kind: SplatNode
2467
+ comment: |
2468
+ Represents the first wildcard node in the pattern.
2469
+
2470
+ foo in *bar, baz, *qux
2471
+ ^^^^
2472
+
2473
+ foo in Foo(*bar, baz, *qux)
2474
+ ^^^^
2475
+ - name: requireds
2476
+ type: node[]
2477
+ kind: pattern expression
2478
+ comment: |
2479
+ Represents the nodes in between the wildcards.
2480
+
2481
+ foo in *bar, baz, *qux
2482
+ ^^^
2483
+
2484
+ foo in Foo(*bar, baz, 1, *qux)
2485
+ ^^^^^^
2486
+ - name: right
2487
+ type: node
2488
+ kind: SplatNode
2489
+ comment: |
2490
+ Represents the second wildcard node in the pattern.
2491
+
2492
+ foo in *bar, baz, *qux
2493
+ ^^^^
2494
+
2495
+ foo in Foo(*bar, baz, *qux)
2496
+ ^^^^
2497
+ - name: opening_loc
2498
+ type: location?
2499
+ comment: |
2500
+ The Location of the opening brace.
2501
+
2502
+ foo in [*bar, baz, *qux]
2503
+ ^
2504
+
2505
+ foo in Foo(*bar, baz, *qux)
2506
+ ^
2507
+ - name: closing_loc
2508
+ type: location?
2509
+ comment: |
2510
+ The Location of the closing brace.
2511
+
2512
+ foo in [*bar, baz, *qux]
2513
+ ^
2514
+
2515
+ foo in Foo(*bar, baz, *qux)
2516
+ ^
2517
+ comment: |
2518
+ Represents a find pattern in pattern matching.
2519
+
2520
+ foo in *bar, baz, *qux
2521
+ ^^^^^^^^^^^^^^^
2522
+
2523
+ foo in [*bar, baz, *qux]
2524
+ ^^^^^^^^^^^^^^^^^
2525
+
2526
+ foo in Foo(*bar, baz, *qux)
2527
+ ^^^^^^^^^^^^^^^^^^^^
2528
+
2529
+ foo => *bar, baz, *qux
2530
+ ^^^^^^^^^^^^^^^
2531
+ - name: FlipFlopNode
2532
+ flags: RangeFlags
2533
+ fields:
2534
+ - name: left
2535
+ type: node?
2536
+ kind: non-void expression
2537
+ - name: right
2538
+ type: node?
2539
+ kind: non-void expression
2540
+ - name: operator_loc
2541
+ type: location
2542
+ comment: |
2543
+ Represents the use of the `..` or `...` operators to create flip flops.
2544
+
2545
+ baz if foo .. bar
2546
+ ^^^^^^^^^^
2547
+ - name: FloatNode
2548
+ fields:
2549
+ - name: value
2550
+ type: double
2551
+ comment: The value of the floating point number as a Float.
2552
+ comment: |
2553
+ Represents a floating point number literal.
2554
+
2555
+ 1.0
2556
+ ^^^
2557
+ - name: ForNode
2558
+ fields:
2559
+ - name: index
2560
+ type: node
2561
+ kind:
2562
+ - LocalVariableTargetNode
2563
+ - InstanceVariableTargetNode
2564
+ - ClassVariableTargetNode
2565
+ - GlobalVariableTargetNode
2566
+ - ConstantTargetNode
2567
+ - ConstantPathTargetNode
2568
+ - CallTargetNode
2569
+ - IndexTargetNode
2570
+ - MultiTargetNode
2571
+ comment: |
2572
+ The index expression for `for` loops.
2573
+
2574
+ for i in a end
2575
+ ^
2576
+ - name: collection
2577
+ type: node
2578
+ kind: non-void expression
2579
+ comment: |
2580
+ The collection to iterate over.
2581
+
2582
+ for i in a end
2583
+ ^
2584
+ - name: statements
2585
+ type: node?
2586
+ kind: StatementsNode
2587
+ comment: |
2588
+ Represents the body of statements to execute for each iteration of the loop.
2589
+
2590
+ for i in a
2591
+ foo(i)
2592
+ ^^^^^^
2593
+ end
2594
+ - name: for_keyword_loc
2595
+ type: location
2596
+ comment: |
2597
+ The Location of the `for` keyword.
2598
+
2599
+ for i in a end
2600
+ ^^^
2601
+ - name: in_keyword_loc
2602
+ type: location
2603
+ comment: |
2604
+ The Location of the `in` keyword.
2605
+
2606
+ for i in a end
2607
+ ^^
2608
+ - name: do_keyword_loc
2609
+ type: location?
2610
+ comment: |
2611
+ The Location of the `do` keyword, if present.
2612
+
2613
+ for i in a do end
2614
+ ^^
2615
+ - name: end_keyword_loc
2616
+ type: location
2617
+ comment: |
2618
+ The Location of the `end` keyword.
2619
+
2620
+ for i in a end
2621
+ ^^^
2622
+ comment: |
2623
+ Represents the use of the `for` keyword.
2624
+
2625
+ for i in a end
2626
+ ^^^^^^^^^^^^^^
2627
+ - name: ForwardingArgumentsNode
2628
+ comment: |
2629
+ Represents forwarding all arguments to this method to another method.
2630
+
2631
+ def foo(...)
2632
+ bar(...)
2633
+ ^^^
2634
+ end
2635
+ - name: ForwardingParameterNode
2636
+ comment: |
2637
+ Represents the use of the forwarding parameter in a method, block, or lambda declaration.
2638
+
2639
+ def foo(...)
2640
+ ^^^
2641
+ end
2642
+ - name: ForwardingSuperNode
2643
+ fields:
2644
+ - name: keyword_loc
2645
+ type: location
2646
+ comment: |
2647
+ super
2648
+ ^^^^^
2649
+
2650
+ super { 123 }
2651
+ ^^^^^
2652
+ - name: block
2653
+ type: node?
2654
+ kind: BlockNode
2655
+ comment: |
2656
+ All other arguments are forwarded as normal, except the original block is replaced with the new block.
2657
+ comment: |
2658
+ Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
2659
+
2660
+ super
2661
+ ^^^^^
2662
+
2663
+ super { 123 }
2664
+ ^^^^^^^^^^^^^
2665
+
2666
+ If it has any other arguments, it would be a `SuperNode` instead.
2667
+ - name: GlobalVariableAndWriteNode
2668
+ fields:
2669
+ - name: name
2670
+ type: constant
2671
+ - name: name_loc
2672
+ type: location
2673
+ - name: operator_loc
2674
+ type: location
2675
+ - name: value
2676
+ type: node
2677
+ kind: non-void expression
2678
+ comment: |
2679
+ Represents the use of the `&&=` operator for assignment to a global variable.
2680
+
2681
+ $target &&= value
2682
+ ^^^^^^^^^^^^^^^^^
2683
+ - name: GlobalVariableOperatorWriteNode
2684
+ fields:
2685
+ - name: name
2686
+ type: constant
2687
+ - name: name_loc
2688
+ type: location
2689
+ - name: binary_operator_loc
2690
+ type: location
2691
+ - name: value
2692
+ type: node
2693
+ kind: non-void expression
2694
+ - name: binary_operator
2695
+ type: constant
2696
+ comment: |
2697
+ Represents assigning to a global variable using an operator that isn't `=`.
2698
+
2699
+ $target += value
2700
+ ^^^^^^^^^^^^^^^^
2701
+ - name: GlobalVariableOrWriteNode
2702
+ fields:
2703
+ - name: name
2704
+ type: constant
2705
+ - name: name_loc
2706
+ type: location
2707
+ - name: operator_loc
2708
+ type: location
2709
+ - name: value
2710
+ type: node
2711
+ kind: non-void expression
2712
+ comment: |
2713
+ Represents the use of the `||=` operator for assignment to a global variable.
2714
+
2715
+ $target ||= value
2716
+ ^^^^^^^^^^^^^^^^^
2717
+ - name: GlobalVariableReadNode
2718
+ fields:
2719
+ - name: name
2720
+ type: constant
2721
+ comment: |
2722
+ The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
2723
+
2724
+ $foo # name `:$foo`
2725
+
2726
+ $_Test # name `:$_Test`
2727
+ comment: |
2728
+ Represents referencing a global variable.
2729
+
2730
+ $foo
2731
+ ^^^^
2732
+ - name: GlobalVariableTargetNode
2733
+ fields:
2734
+ - name: name
2735
+ type: constant
2736
+ comment: |
2737
+ Represents writing to a global variable in a context that doesn't have an explicit value.
2738
+
2739
+ $foo, $bar = baz
2740
+ ^^^^ ^^^^
2741
+ - name: GlobalVariableWriteNode
2742
+ fields:
2743
+ - name: name
2744
+ type: constant
2745
+ comment: |
2746
+ The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
2747
+
2748
+ $foo = :bar # name `:$foo`
2749
+
2750
+ $_Test = 123 # name `:$_Test`
2751
+ - name: name_loc
2752
+ type: location
2753
+ comment: |
2754
+ The Location of the global variable's name.
2755
+
2756
+ $foo = :bar
2757
+ ^^^^
2758
+ - name: value
2759
+ type: node
2760
+ kind: non-void expression
2761
+ comment: |
2762
+ The value to write to the global variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
2763
+
2764
+ $foo = :bar
2765
+ ^^^^
2766
+
2767
+ $-xyz = 123
2768
+ ^^^
2769
+ - name: operator_loc
2770
+ type: location
2771
+ comment: |
2772
+ The Location of the `=` operator.
2773
+
2774
+ $foo = :bar
2775
+ ^
2776
+ comment: |
2777
+ Represents writing to a global variable.
2778
+
2779
+ $foo = 1
2780
+ ^^^^^^^^
2781
+ - name: HashNode
2782
+ fields:
2783
+ - name: opening_loc
2784
+ type: location
2785
+ comment: |
2786
+ The Location of the opening brace.
2787
+
2788
+ { a => b }
2789
+ ^
2790
+ - name: elements
2791
+ type: node[]
2792
+ kind:
2793
+ - AssocNode
2794
+ - AssocSplatNode
2795
+ comment: |
2796
+ The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
2797
+
2798
+ { a: b }
2799
+ ^^^^
2800
+
2801
+ { **foo }
2802
+ ^^^^^
2803
+ - name: closing_loc
2804
+ type: location
2805
+ comment: |
2806
+ The Location of the closing brace.
2807
+
2808
+ { a => b }
2809
+ ^
2810
+ comment: |
2811
+ Represents a hash literal.
2812
+
2813
+ { a => b }
2814
+ ^^^^^^^^^^
2815
+ - name: HashPatternNode
2816
+ fields:
2817
+ - name: constant
2818
+ type: node?
2819
+ kind:
2820
+ - ConstantPathNode
2821
+ - ConstantReadNode
2822
+ comment: |
2823
+ Represents the optional constant preceding the Hash.
2824
+
2825
+ foo => Bar[a: 1, b: 2]
2826
+ ^^^
2827
+
2828
+ foo => Bar::Baz[a: 1, b: 2]
2829
+ ^^^^^^^^
2830
+ - name: elements
2831
+ type: node[]
2832
+ kind: AssocNode
2833
+ comment: |
2834
+ Represents the explicit named hash keys and values.
2835
+
2836
+ foo => { a: 1, b:, ** }
2837
+ ^^^^^^^^
2838
+ - name: rest
2839
+ type: node?
2840
+ kind:
2841
+ - AssocSplatNode
2842
+ - NoKeywordsParameterNode
2843
+ comment: |
2844
+ Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`.
2845
+
2846
+ foo => { a: 1, b:, **c }
2847
+ ^^^
2848
+
2849
+ foo => { a: 1, b:, ** }
2850
+ ^^
2851
+
2852
+ foo => { a: 1, b:, **nil }
2853
+ ^^^^^
2854
+ - name: opening_loc
2855
+ type: location?
2856
+ comment: |
2857
+ The Location of the opening brace.
2858
+
2859
+ foo => { a: 1 }
2860
+ ^
2861
+
2862
+ foo => Bar[a: 1]
2863
+ ^
2864
+ - name: closing_loc
2865
+ type: location?
2866
+ comment: |
2867
+ The Location of the closing brace.
2868
+
2869
+ foo => { a: 1 }
2870
+ ^
2871
+
2872
+ foo => Bar[a: 1]
2873
+ ^
2874
+ comment: |
2875
+ Represents a hash pattern in pattern matching.
2876
+
2877
+ foo => { a: 1, b: 2 }
2878
+ ^^^^^^^^^^^^^^
2879
+
2880
+ foo => { a: 1, b: 2, **c }
2881
+ ^^^^^^^^^^^^^^^^^^^
2882
+
2883
+ foo => Bar[a: 1, b: 2]
2884
+ ^^^^^^^^^^^^^^^
2885
+
2886
+ foo in { a: 1, b: 2 }
2887
+ ^^^^^^^^^^^^^^
2888
+ - name: IfNode
2889
+ fields:
2890
+ - name: if_keyword_loc
2891
+ type: location?
2892
+ comment: |
2893
+ The Location of the `if` keyword if present.
2894
+
2895
+ bar if foo
2896
+ ^^
2897
+
2898
+ The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
2899
+ - name: predicate
2900
+ type: node
2901
+ kind: non-void expression
2902
+ comment: |
2903
+ The node for the condition the `IfNode` is testing.
2904
+
2905
+ if foo
2906
+ ^^^
2907
+ bar
2908
+ end
2909
+
2910
+ bar if foo
2911
+ ^^^
2912
+
2913
+ foo ? bar : baz
2914
+ ^^^
2915
+ - name: then_keyword_loc
2916
+ type: location?
2917
+ comment: |
2918
+ The Location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
2919
+
2920
+ if foo then bar end
2921
+ ^^^^
2922
+
2923
+ a ? b : c
2924
+ ^
2925
+ - name: statements
2926
+ type: node?
2927
+ kind: StatementsNode
2928
+ comment: |
2929
+ Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
2930
+
2931
+ if foo
2932
+ bar
2933
+ ^^^
2934
+ baz
2935
+ ^^^
2936
+ end
2937
+ - name: subsequent
2938
+ type: node?
2939
+ kind:
2940
+ - ElseNode
2941
+ - IfNode
2942
+ comment: |
2943
+ Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
2944
+
2945
+ if foo
2946
+ bar
2947
+ elsif baz
2948
+ ^^^^^^^^^
2949
+ qux
2950
+ ^^^
2951
+ end
2952
+ ^^^
2953
+
2954
+ if foo then bar else baz end
2955
+ ^^^^^^^^^^^^
2956
+ - name: end_keyword_loc
2957
+ type: location?
2958
+ comment: |
2959
+ The Location of the `end` keyword if present, `nil` otherwise.
2960
+
2961
+ if foo
2962
+ bar
2963
+ end
2964
+ ^^^
2965
+ newline: predicate
2966
+ comment: |
2967
+ Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.
2968
+
2969
+ bar if foo
2970
+ ^^^^^^^^^^
2971
+
2972
+ if foo then bar end
2973
+ ^^^^^^^^^^^^^^^^^^^
2974
+
2975
+ foo ? bar : baz
2976
+ ^^^^^^^^^^^^^^^
2977
+ - name: ImaginaryNode
2978
+ fields:
2979
+ - name: numeric
2980
+ type: node
2981
+ kind:
2982
+ - FloatNode
2983
+ - IntegerNode
2984
+ - RationalNode
2985
+ comment: |
2986
+ Represents an imaginary number literal.
2987
+
2988
+ 1.0i
2989
+ ^^^^
2990
+ - name: ImplicitNode
2991
+ fields:
2992
+ - name: value
2993
+ type: node
2994
+ kind:
2995
+ - LocalVariableReadNode
2996
+ - CallNode
2997
+ - ConstantReadNode
2998
+ - LocalVariableTargetNode
2999
+ comment: |
3000
+ Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
3001
+
3002
+ { foo: }
3003
+ ^^^^
3004
+
3005
+ { Foo: }
3006
+ ^^^^
3007
+
3008
+ foo in { bar: }
3009
+ ^^^^
3010
+ - name: ImplicitRestNode
3011
+ comment: |
3012
+ Represents using a trailing comma to indicate an implicit rest parameter.
3013
+
3014
+ foo { |bar,| }
3015
+ ^
3016
+
3017
+ foo in [bar,]
3018
+ ^
3019
+
3020
+ for foo, in bar do end
3021
+ ^
3022
+
3023
+ foo, = bar
3024
+ ^
3025
+ - name: InNode
3026
+ fields:
3027
+ - name: pattern
3028
+ type: node
3029
+ kind: pattern expression
3030
+ - name: statements
3031
+ type: node?
3032
+ kind: StatementsNode
3033
+ - name: in_keyword_loc
3034
+ type: location
3035
+ - name: then_keyword_loc
3036
+ type: location?
3037
+ comment: |
3038
+ Represents the use of the `in` keyword in a case statement.
3039
+
3040
+ case a; in b then c end
3041
+ ^^^^^^^^^^^
3042
+ - name: IndexAndWriteNode
3043
+ flags: CallNodeFlags
3044
+ fields:
3045
+ - name: receiver
3046
+ type: node?
3047
+ kind: non-void expression
3048
+ - name: call_operator_loc
3049
+ type: location?
3050
+ - name: opening_loc
3051
+ type: location
3052
+ - name: arguments
3053
+ type: node?
3054
+ kind: ArgumentsNode
3055
+ - name: closing_loc
3056
+ type: location
3057
+ - name: block
3058
+ type: node?
3059
+ kind: BlockArgumentNode # foo[&b] &&= value, only valid on Ruby < 3.4
3060
+ - name: operator_loc
3061
+ type: location
3062
+ - name: value
3063
+ type: node
3064
+ kind: non-void expression
3065
+ comment: |
3066
+ Represents the use of the `&&=` operator on a call to the `[]` method.
3067
+
3068
+ foo.bar[baz] &&= value
3069
+ ^^^^^^^^^^^^^^^^^^^^^^
3070
+ - name: IndexOperatorWriteNode
3071
+ flags: CallNodeFlags
3072
+ fields:
3073
+ - name: receiver
3074
+ type: node?
3075
+ kind: non-void expression
3076
+ - name: call_operator_loc
3077
+ type: location?
3078
+ - name: opening_loc
3079
+ type: location
3080
+ - name: arguments
3081
+ type: node?
3082
+ kind: ArgumentsNode
3083
+ - name: closing_loc
3084
+ type: location
3085
+ - name: block
3086
+ type: node?
3087
+ kind: BlockArgumentNode # foo[&b] += value, only valid on Ruby < 3.4
3088
+ - name: binary_operator
3089
+ type: constant
3090
+ - name: binary_operator_loc
3091
+ type: location
3092
+ - name: value
3093
+ type: node
3094
+ kind: non-void expression
3095
+ comment: |
3096
+ Represents the use of an assignment operator on a call to `[]`.
3097
+
3098
+ foo.bar[baz] += value
3099
+ ^^^^^^^^^^^^^^^^^^^^^
3100
+ - name: IndexOrWriteNode
3101
+ flags: CallNodeFlags
3102
+ fields:
3103
+ - name: receiver
3104
+ type: node?
3105
+ kind: non-void expression
3106
+ - name: call_operator_loc
3107
+ type: location?
3108
+ - name: opening_loc
3109
+ type: location
3110
+ - name: arguments
3111
+ type: node?
3112
+ kind: ArgumentsNode
3113
+ - name: closing_loc
3114
+ type: location
3115
+ - name: block
3116
+ type: node?
3117
+ kind: BlockArgumentNode # foo[&b] ||= value, only valid on Ruby < 3.4
3118
+ - name: operator_loc
3119
+ type: location
3120
+ - name: value
3121
+ type: node
3122
+ kind: non-void expression
3123
+ comment: |
3124
+ Represents the use of the `||=` operator on a call to `[]`.
3125
+
3126
+ foo.bar[baz] ||= value
3127
+ ^^^^^^^^^^^^^^^^^^^^^^
3128
+ - name: IndexTargetNode
3129
+ flags: CallNodeFlags
3130
+ fields:
3131
+ - name: receiver
3132
+ type: node
3133
+ kind: non-void expression
3134
+ - name: opening_loc
3135
+ type: location
3136
+ - name: arguments
3137
+ type: node?
3138
+ kind: ArgumentsNode
3139
+ - name: closing_loc
3140
+ type: location
3141
+ - name: block
3142
+ type: node?
3143
+ kind: BlockArgumentNode # foo[&b], = 1, only valid on Ruby < 3.4
3144
+ comment: |
3145
+ Represents assigning to an index.
3146
+
3147
+ foo[bar], = 1
3148
+ ^^^^^^^^
3149
+
3150
+ begin
3151
+ rescue => foo[bar]
3152
+ ^^^^^^^^
3153
+ end
3154
+
3155
+ for foo[bar] in baz do end
3156
+ ^^^^^^^^
3157
+ - name: InstanceVariableAndWriteNode
3158
+ fields:
3159
+ - name: name
3160
+ type: constant
3161
+ - name: name_loc
3162
+ type: location
3163
+ - name: operator_loc
3164
+ type: location
3165
+ - name: value
3166
+ type: node
3167
+ kind: non-void expression
3168
+ comment: |
3169
+ Represents the use of the `&&=` operator for assignment to an instance variable.
3170
+
3171
+ @target &&= value
3172
+ ^^^^^^^^^^^^^^^^^
3173
+ - name: InstanceVariableOperatorWriteNode
3174
+ fields:
3175
+ - name: name
3176
+ type: constant
3177
+ - name: name_loc
3178
+ type: location
3179
+ - name: binary_operator_loc
3180
+ type: location
3181
+ - name: value
3182
+ type: node
3183
+ kind: non-void expression
3184
+ - name: binary_operator
3185
+ type: constant
3186
+ comment: |
3187
+ Represents assigning to an instance variable using an operator that isn't `=`.
3188
+
3189
+ @target += value
3190
+ ^^^^^^^^^^^^^^^^
3191
+ - name: InstanceVariableOrWriteNode
3192
+ fields:
3193
+ - name: name
3194
+ type: constant
3195
+ - name: name_loc
3196
+ type: location
3197
+ - name: operator_loc
3198
+ type: location
3199
+ - name: value
3200
+ type: node
3201
+ kind: non-void expression
3202
+ comment: |
3203
+ Represents the use of the `||=` operator for assignment to an instance variable.
3204
+
3205
+ @target ||= value
3206
+ ^^^^^^^^^^^^^^^^^
3207
+ - name: InstanceVariableReadNode
3208
+ fields:
3209
+ - name: name
3210
+ type: constant
3211
+ comment: |
3212
+ The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3213
+
3214
+ @x # name `:@x`
3215
+
3216
+ @_test # name `:@_test`
3217
+ comment: |
3218
+ Represents referencing an instance variable.
3219
+
3220
+ @foo
3221
+ ^^^^
3222
+ - name: InstanceVariableTargetNode
3223
+ fields:
3224
+ - name: name
3225
+ type: constant
3226
+ comment: |
3227
+ Represents writing to an instance variable in a context that doesn't have an explicit value.
3228
+
3229
+ @foo, @bar = baz
3230
+ ^^^^ ^^^^
3231
+ - name: InstanceVariableWriteNode
3232
+ fields:
3233
+ - name: name
3234
+ type: constant
3235
+ comment: |
3236
+ The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3237
+
3238
+ @x = :y # name `:@x`
3239
+
3240
+ @_foo = "bar" # name `@_foo`
3241
+ - name: name_loc
3242
+ type: location
3243
+ comment: |
3244
+ The Location of the variable name.
3245
+
3246
+ @_x = 1
3247
+ ^^^
3248
+ - name: value
3249
+ type: node
3250
+ kind: non-void expression
3251
+ comment: |
3252
+ The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3253
+
3254
+ @foo = :bar
3255
+ ^^^^
3256
+
3257
+ @_x = 1234
3258
+ ^^^^
3259
+ - name: operator_loc
3260
+ type: location
3261
+ comment: |
3262
+ The Location of the `=` operator.
3263
+
3264
+ @x = y
3265
+ ^
3266
+ comment: |
3267
+ Represents writing to an instance variable.
3268
+
3269
+ @foo = 1
3270
+ ^^^^^^^^
3271
+ - name: IntegerNode
3272
+ flags: IntegerBaseFlags
3273
+ fields:
3274
+ - name: value
3275
+ type: integer
3276
+ comment: The value of the integer literal as a number.
3277
+ comment: |
3278
+ Represents an integer number literal.
3279
+
3280
+ 1
3281
+ ^
3282
+ - name: InterpolatedMatchLastLineNode
3283
+ flags: RegularExpressionFlags
3284
+ fields:
3285
+ - name: opening_loc
3286
+ type: location
3287
+ - name: parts
3288
+ type: node[]
3289
+ kind:
3290
+ - StringNode
3291
+ - EmbeddedStatementsNode
3292
+ - EmbeddedVariableNode
3293
+ - name: closing_loc
3294
+ type: location
3295
+ newline: parts
3296
+ comment: |
3297
+ Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object.
3298
+
3299
+ if /foo #{bar} baz/ then end
3300
+ ^^^^^^^^^^^^^^^^
3301
+ - name: InterpolatedRegularExpressionNode
3302
+ flags: RegularExpressionFlags
3303
+ fields:
3304
+ - name: opening_loc
3305
+ type: location
3306
+ - name: parts
3307
+ type: node[]
3308
+ kind:
3309
+ - StringNode
3310
+ - EmbeddedStatementsNode
3311
+ - EmbeddedVariableNode
3312
+ - name: closing_loc
3313
+ type: location
3314
+ newline: parts
3315
+ comment: |
3316
+ Represents a regular expression literal that contains interpolation.
3317
+
3318
+ /foo #{bar} baz/
3319
+ ^^^^^^^^^^^^^^^^
3320
+ - name: InterpolatedStringNode
3321
+ flags: InterpolatedStringNodeFlags
3322
+ fields:
3323
+ - name: opening_loc
3324
+ type: location?
3325
+ - name: parts
3326
+ type: node[]
3327
+ kind:
3328
+ - StringNode
3329
+ - EmbeddedStatementsNode
3330
+ - EmbeddedVariableNode
3331
+ - InterpolatedStringNode # `"a" "#{b}"`
3332
+ - name: closing_loc
3333
+ type: location?
3334
+ newline: parts
3335
+ comment: |
3336
+ Represents a string literal that contains interpolation.
3337
+
3338
+ "foo #{bar} baz"
3339
+ ^^^^^^^^^^^^^^^^
3340
+ - name: InterpolatedSymbolNode
3341
+ fields:
3342
+ - name: opening_loc
3343
+ type: location?
3344
+ - name: parts
3345
+ type: node[]
3346
+ kind:
3347
+ - StringNode
3348
+ - EmbeddedStatementsNode
3349
+ - EmbeddedVariableNode
3350
+ - name: closing_loc
3351
+ type: location?
3352
+ newline: parts
3353
+ comment: |
3354
+ Represents a symbol literal that contains interpolation.
3355
+
3356
+ :"foo #{bar} baz"
3357
+ ^^^^^^^^^^^^^^^^^
3358
+ - name: InterpolatedXStringNode
3359
+ fields:
3360
+ - name: opening_loc
3361
+ type: location
3362
+ - name: parts
3363
+ type: node[]
3364
+ kind:
3365
+ - StringNode
3366
+ - EmbeddedStatementsNode
3367
+ - EmbeddedVariableNode
3368
+ - name: closing_loc
3369
+ type: location
3370
+ newline: parts
3371
+ comment: |
3372
+ Represents an xstring literal that contains interpolation.
3373
+
3374
+ `foo #{bar} baz`
3375
+ ^^^^^^^^^^^^^^^^
3376
+ - name: ItLocalVariableReadNode
3377
+ comment: |
3378
+ Represents reading from the implicit `it` local variable.
3379
+
3380
+ -> { it }
3381
+ ^^
3382
+ - name: ItParametersNode
3383
+ comment: |
3384
+ Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
3385
+
3386
+ -> { it + it }
3387
+ ^^^^^^^^^^^^^^
3388
+ - name: KeywordHashNode
3389
+ flags: KeywordHashNodeFlags
3390
+ fields:
3391
+ - name: elements
3392
+ type: node[]
3393
+ kind:
3394
+ - AssocNode
3395
+ - AssocSplatNode
3396
+ comment: |
3397
+ Represents a hash literal without opening and closing braces.
3398
+
3399
+ foo(a: b)
3400
+ ^^^^
3401
+ - name: KeywordRestParameterNode
3402
+ flags: ParameterFlags
3403
+ fields:
3404
+ - name: name
3405
+ type: constant?
3406
+ - name: name_loc
3407
+ type: location?
3408
+ - name: operator_loc
3409
+ type: location
3410
+ comment: |
3411
+ Represents a keyword rest parameter to a method, block, or lambda definition.
3412
+
3413
+ def a(**b)
3414
+ ^^^
3415
+ end
3416
+ - name: LambdaNode
3417
+ fields:
3418
+ - name: locals
3419
+ type: constant[]
3420
+ - name: operator_loc
3421
+ type: location
3422
+ - name: opening_loc
3423
+ type: location
3424
+ - name: closing_loc
3425
+ type: location
3426
+ - name: parameters
3427
+ type: node?
3428
+ kind:
3429
+ - BlockParametersNode
3430
+ - NumberedParametersNode
3431
+ - ItParametersNode
3432
+ - name: body
3433
+ type: node?
3434
+ kind:
3435
+ - StatementsNode
3436
+ - BeginNode
3437
+ comment: |
3438
+ Represents using a lambda literal (not the lambda method call).
3439
+
3440
+ ->(value) { value * 2 }
3441
+ ^^^^^^^^^^^^^^^^^^^^^^^
3442
+ - name: LocalVariableAndWriteNode
3443
+ fields:
3444
+ - name: name_loc
3445
+ type: location
3446
+ - name: operator_loc
3447
+ type: location
3448
+ - name: value
3449
+ type: node
3450
+ kind: non-void expression
3451
+ - name: name
3452
+ type: constant
3453
+ - name: depth
3454
+ type: uint32
3455
+ comment: |
3456
+ Represents the use of the `&&=` operator for assignment to a local variable.
3457
+
3458
+ target &&= value
3459
+ ^^^^^^^^^^^^^^^^
3460
+ - name: LocalVariableOperatorWriteNode
3461
+ fields:
3462
+ - name: name_loc
3463
+ type: location
3464
+ - name: binary_operator_loc
3465
+ type: location
3466
+ - name: value
3467
+ type: node
3468
+ kind: non-void expression
3469
+ - name: name
3470
+ type: constant
3471
+ - name: binary_operator
3472
+ type: constant
3473
+ - name: depth
3474
+ type: uint32
3475
+ comment: |
3476
+ Represents assigning to a local variable using an operator that isn't `=`.
3477
+
3478
+ target += value
3479
+ ^^^^^^^^^^^^^^^
3480
+ - name: LocalVariableOrWriteNode
3481
+ fields:
3482
+ - name: name_loc
3483
+ type: location
3484
+ - name: operator_loc
3485
+ type: location
3486
+ - name: value
3487
+ type: node
3488
+ kind: non-void expression
3489
+ - name: name
3490
+ type: constant
3491
+ - name: depth
3492
+ type: uint32
3493
+ comment: |
3494
+ Represents the use of the `||=` operator for assignment to a local variable.
3495
+
3496
+ target ||= value
3497
+ ^^^^^^^^^^^^^^^^
3498
+ - name: LocalVariableReadNode
3499
+ fields:
3500
+ - name: name
3501
+ type: constant
3502
+ comment: |
3503
+ The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3504
+
3505
+ x # name `:x`
3506
+
3507
+ _Test # name `:_Test`
3508
+
3509
+ Note that this can also be an underscore followed by a number for the default block parameters.
3510
+
3511
+ _1 # name `:_1`
3512
+
3513
+ - name: depth
3514
+ type: uint32
3515
+ comment: |
3516
+ The number of visible scopes that should be searched to find the origin of this local variable.
3517
+
3518
+ foo = 1; foo # depth 0
3519
+
3520
+ bar = 2; tap { bar } # depth 1
3521
+
3522
+ The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
3523
+ comment: |
3524
+ Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call.
3525
+
3526
+ foo
3527
+ ^^^
3528
+ - name: LocalVariableTargetNode
3529
+ fields:
3530
+ - name: name
3531
+ type: constant
3532
+ - name: depth
3533
+ type: uint32
3534
+ comment: |
3535
+ Represents writing to a local variable in a context that doesn't have an explicit value.
3536
+
3537
+ foo, bar = baz
3538
+ ^^^ ^^^
3539
+
3540
+ foo => baz
3541
+ ^^^
3542
+ - name: LocalVariableWriteNode
3543
+ fields:
3544
+ - name: name
3545
+ type: constant
3546
+ comment: |
3547
+ The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3548
+
3549
+ foo = :bar # name `:foo`
3550
+
3551
+ abc = 123 # name `:abc`
3552
+ - name: depth
3553
+ type: uint32
3554
+ comment: |
3555
+ The number of semantic scopes we have to traverse to find the declaration of this variable.
3556
+
3557
+ foo = 1 # depth 0
3558
+
3559
+ tap { foo = 1 } # depth 1
3560
+
3561
+ The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
3562
+ - name: name_loc
3563
+ type: location
3564
+ comment: |
3565
+ The Location of the variable name.
3566
+
3567
+ foo = :bar
3568
+ ^^^
3569
+ - name: value
3570
+ type: node
3571
+ kind: non-void expression
3572
+ comment: |
3573
+ The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3574
+
3575
+ foo = :bar
3576
+ ^^^^
3577
+
3578
+ abc = 1234
3579
+ ^^^^
3580
+
3581
+ Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write.
3582
+
3583
+ foo = foo
3584
+ - name: operator_loc
3585
+ type: location
3586
+ comment: |
3587
+ The Location of the `=` operator.
3588
+
3589
+ x = :y
3590
+ ^
3591
+ comment: |
3592
+ Represents writing to a local variable.
3593
+
3594
+ foo = 1
3595
+ ^^^^^^^
3596
+ - name: MatchLastLineNode
3597
+ flags: RegularExpressionFlags
3598
+ fields:
3599
+ - name: opening_loc
3600
+ type: location
3601
+ - name: content_loc
3602
+ type: location
3603
+ - name: closing_loc
3604
+ type: location
3605
+ - name: unescaped
3606
+ type: string
3607
+ comment: |
3608
+ Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
3609
+
3610
+ if /foo/i then end
3611
+ ^^^^^^
3612
+ - name: MatchPredicateNode
3613
+ fields:
3614
+ - name: value
3615
+ type: node
3616
+ kind: non-void expression
3617
+ - name: pattern
3618
+ type: node
3619
+ kind: pattern expression
3620
+ - name: keyword_loc
3621
+ type: location
3622
+ comment: |
3623
+ Represents the use of the modifier `in` operator.
3624
+
3625
+ foo in bar
3626
+ ^^^^^^^^^^
3627
+ - name: MatchRequiredNode
3628
+ fields:
3629
+ - name: value
3630
+ type: node
3631
+ kind: non-void expression
3632
+ comment: |
3633
+ Represents the left-hand side of the operator.
3634
+
3635
+ foo => bar
3636
+ ^^^
3637
+ - name: pattern
3638
+ type: node
3639
+ kind: pattern expression
3640
+ comment: |
3641
+ Represents the right-hand side of the operator. The type of the node depends on the expression.
3642
+
3643
+ Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`.
3644
+
3645
+ foo => a # This is equivalent to writing `a = foo`
3646
+ ^
3647
+
3648
+ Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant.
3649
+
3650
+ foo => [a]
3651
+ ^^^
3652
+
3653
+ foo => a, b
3654
+ ^^^^
3655
+
3656
+ foo => Bar[a, b]
3657
+ ^^^^^^^^^
3658
+
3659
+ If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead.
3660
+
3661
+ foo => *, 1, *a
3662
+ ^^^^^
3663
+
3664
+ Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`.
3665
+
3666
+ foo => { a: 1, b: }
3667
+
3668
+ foo => Bar[a: 1, b:]
3669
+
3670
+ foo => Bar[**]
3671
+
3672
+ To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode`
3673
+
3674
+ foo => ^a
3675
+ ^^
3676
+
3677
+ Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`.
3678
+
3679
+ foo => ^(a + 1)
3680
+
3681
+ Anything else will result in the regular node for that expression, for example a `ConstantReadNode`.
3682
+
3683
+ foo => CONST
3684
+ - name: operator_loc
3685
+ type: location
3686
+ comment: |
3687
+ The Location of the operator.
3688
+
3689
+ foo => bar
3690
+ ^^
3691
+ comment: |
3692
+ Represents the use of the `=>` operator.
3693
+
3694
+ foo => bar
3695
+ ^^^^^^^^^^
3696
+ - name: MatchWriteNode
3697
+ fields:
3698
+ - name: call
3699
+ type: node
3700
+ kind: CallNode
3701
+ - name: targets
3702
+ type: node[]
3703
+ kind: LocalVariableTargetNode
3704
+ comment: |
3705
+ Represents writing local variables using a regular expression match with named capture groups.
3706
+
3707
+ /(?<foo>bar)/ =~ baz
3708
+ ^^^^^^^^^^^^^^^^^^^^
3709
+ - name: ModuleNode
3710
+ fields:
3711
+ - name: locals
3712
+ type: constant[]
3713
+ - name: module_keyword_loc
3714
+ type: location
3715
+ - name: constant_path
3716
+ type: node
3717
+ kind:
3718
+ - ConstantReadNode
3719
+ - ConstantPathNode
3720
+ - name: body
3721
+ type: node?
3722
+ kind:
3723
+ - StatementsNode
3724
+ - BeginNode
3725
+ - name: end_keyword_loc
3726
+ type: location
3727
+ - name: name
3728
+ type: constant
3729
+ comment: |
3730
+ Represents a module declaration involving the `module` keyword.
3731
+
3732
+ module Foo end
3733
+ ^^^^^^^^^^^^^^
3734
+ - name: MultiTargetNode
3735
+ fields:
3736
+ - name: lefts
3737
+ type: node[]
3738
+ kind:
3739
+ - LocalVariableTargetNode
3740
+ - InstanceVariableTargetNode
3741
+ - ClassVariableTargetNode
3742
+ - GlobalVariableTargetNode
3743
+ - ConstantTargetNode
3744
+ - ConstantPathTargetNode
3745
+ - CallTargetNode
3746
+ - IndexTargetNode
3747
+ - MultiTargetNode
3748
+ - RequiredParameterNode # def m((a,b)); end
3749
+ comment: |
3750
+ Represents the targets expressions before a splat node.
3751
+
3752
+ a, (b, c, *) = 1, 2, 3, 4, 5
3753
+ ^^^^
3754
+
3755
+ The splat node can be absent, in that case all target expressions are in the left field.
3756
+
3757
+ a, (b, c) = 1, 2, 3, 4, 5
3758
+ ^^^^
3759
+ - name: rest
3760
+ type: node?
3761
+ kind:
3762
+ - ImplicitRestNode
3763
+ - SplatNode
3764
+ comment: |
3765
+ Represents a splat node in the target expression.
3766
+
3767
+ a, (b, *c) = 1, 2, 3, 4
3768
+ ^^
3769
+
3770
+ The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
3771
+
3772
+ a, (b, *) = 1, 2, 3, 4
3773
+ ^
3774
+
3775
+ If the `*` is omitted, this field will contain an `ImplicitRestNode`
3776
+
3777
+ a, (b,) = 1, 2, 3, 4
3778
+ ^
3779
+ - name: rights
3780
+ type: node[]
3781
+ kind:
3782
+ - LocalVariableTargetNode
3783
+ - InstanceVariableTargetNode
3784
+ - ClassVariableTargetNode
3785
+ - GlobalVariableTargetNode
3786
+ - ConstantTargetNode
3787
+ - ConstantPathTargetNode
3788
+ - CallTargetNode
3789
+ - IndexTargetNode
3790
+ - MultiTargetNode
3791
+ - RequiredParameterNode # def m((*,b)); end
3792
+ comment: |
3793
+ Represents the targets expressions after a splat node.
3794
+
3795
+ a, (*, b, c) = 1, 2, 3, 4, 5
3796
+ ^^^^
3797
+ - name: lparen_loc
3798
+ type: location?
3799
+ comment: |
3800
+ The Location of the opening parenthesis.
3801
+
3802
+ a, (b, c) = 1, 2, 3
3803
+ ^
3804
+ - name: rparen_loc
3805
+ type: location?
3806
+ comment: |
3807
+ The Location of the closing parenthesis.
3808
+
3809
+ a, (b, c) = 1, 2, 3
3810
+ ^
3811
+ comment: |
3812
+ Represents a multi-target expression.
3813
+
3814
+ a, (b, c) = 1, 2, 3
3815
+ ^^^^^^
3816
+
3817
+ This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
3818
+
3819
+ for a, b in [[1, 2], [3, 4]]
3820
+ ^^^^
3821
+ - name: MultiWriteNode
3822
+ fields:
3823
+ - name: lefts
3824
+ type: node[]
3825
+ kind:
3826
+ - LocalVariableTargetNode
3827
+ - InstanceVariableTargetNode
3828
+ - ClassVariableTargetNode
3829
+ - GlobalVariableTargetNode
3830
+ - ConstantTargetNode
3831
+ - ConstantPathTargetNode
3832
+ - CallTargetNode
3833
+ - IndexTargetNode
3834
+ - MultiTargetNode
3835
+ comment: |
3836
+ Represents the targets expressions before a splat node.
3837
+
3838
+ a, b, * = 1, 2, 3, 4, 5
3839
+ ^^^^
3840
+
3841
+ The splat node can be absent, in that case all target expressions are in the left field.
3842
+
3843
+ a, b, c = 1, 2, 3, 4, 5
3844
+ ^^^^^^^
3845
+ - name: rest
3846
+ type: node?
3847
+ kind:
3848
+ - ImplicitRestNode
3849
+ - SplatNode
3850
+ comment: |
3851
+ Represents a splat node in the target expression.
3852
+
3853
+ a, b, *c = 1, 2, 3, 4
3854
+ ^^
3855
+
3856
+ The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
3857
+
3858
+ a, b, * = 1, 2, 3, 4
3859
+ ^
3860
+
3861
+ If the `*` is omitted, this field will contain an `ImplicitRestNode`
3862
+
3863
+ a, b, = 1, 2, 3, 4
3864
+ ^
3865
+ - name: rights
3866
+ type: node[]
3867
+ kind:
3868
+ - LocalVariableTargetNode
3869
+ - InstanceVariableTargetNode
3870
+ - ClassVariableTargetNode
3871
+ - GlobalVariableTargetNode
3872
+ - ConstantTargetNode
3873
+ - ConstantPathTargetNode
3874
+ - CallTargetNode
3875
+ - IndexTargetNode
3876
+ - MultiTargetNode
3877
+ comment: |
3878
+ Represents the targets expressions after a splat node.
3879
+
3880
+ a, *, b, c = 1, 2, 3, 4, 5
3881
+ ^^^^
3882
+ - name: lparen_loc
3883
+ type: location?
3884
+ comment: |
3885
+ The Location of the opening parenthesis.
3886
+
3887
+ (a, b, c) = 1, 2, 3
3888
+ ^
3889
+ - name: rparen_loc
3890
+ type: location?
3891
+ comment: |
3892
+ The Location of the closing parenthesis.
3893
+
3894
+ (a, b, c) = 1, 2, 3
3895
+ ^
3896
+ - name: operator_loc
3897
+ type: location
3898
+ comment: |
3899
+ The Location of the operator.
3900
+
3901
+ a, b, c = 1, 2, 3
3902
+ ^
3903
+ - name: value
3904
+ type: node
3905
+ kind: non-void expression
3906
+ comment: |
3907
+ The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
3908
+
3909
+ a, b, c = 1, 2, 3
3910
+ ^^^^^^^
3911
+ comment: |
3912
+ Represents a write to a multi-target expression.
3913
+
3914
+ a, b, c = 1, 2, 3
3915
+ ^^^^^^^^^^^^^^^^^
3916
+ - name: NextNode
3917
+ fields:
3918
+ - name: arguments
3919
+ type: node?
3920
+ kind: ArgumentsNode
3921
+ - name: keyword_loc
3922
+ type: location
3923
+ comment: |
3924
+ Represents the use of the `next` keyword.
3925
+
3926
+ next 1
3927
+ ^^^^^^
3928
+ - name: NilNode
3929
+ comment: |
3930
+ Represents the use of the `nil` keyword.
3931
+
3932
+ nil
3933
+ ^^^
3934
+ - name: NoBlockParameterNode
3935
+ fields:
3936
+ - name: operator_loc
3937
+ type: location
3938
+ - name: keyword_loc
3939
+ type: location
3940
+ comment: |
3941
+ Represents the use of `&nil` inside method arguments.
3942
+
3943
+ def a(&nil)
3944
+ ^^^^
3945
+ end
3946
+ - name: NoKeywordsParameterNode
3947
+ fields:
3948
+ - name: operator_loc
3949
+ type: location
3950
+ - name: keyword_loc
3951
+ type: location
3952
+ comment: |
3953
+ Represents the use of `**nil` inside method arguments.
3954
+
3955
+ def a(**nil)
3956
+ ^^^^^
3957
+ end
3958
+ - name: NumberedParametersNode
3959
+ fields:
3960
+ - name: maximum
3961
+ type: uint8
3962
+ comment: |
3963
+ Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
3964
+
3965
+ -> { _1 + _2 }
3966
+ ^^^^^^^^^^^^^^
3967
+ - name: NumberedReferenceReadNode
3968
+ fields:
3969
+ - name: number
3970
+ type: uint32
3971
+ comment: |
3972
+ The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
3973
+
3974
+ $1 # number `1`
3975
+
3976
+ $5432 # number `5432`
3977
+
3978
+ $4294967296 # number `0`
3979
+ comment: |
3980
+ Represents reading a numbered reference to a capture in the previous match.
3981
+
3982
+ $1
3983
+ ^^
3984
+ - name: OptionalKeywordParameterNode
3985
+ flags: ParameterFlags
3986
+ fields:
3987
+ - name: name
3988
+ type: constant
3989
+ - name: name_loc
3990
+ type: location
3991
+ - name: value
3992
+ type: node
3993
+ kind: non-void expression
3994
+ comment: |
3995
+ Represents an optional keyword parameter to a method, block, or lambda definition.
3996
+
3997
+ def a(b: 1)
3998
+ ^^^^
3999
+ end
4000
+ - name: OptionalParameterNode
4001
+ flags: ParameterFlags
4002
+ fields:
4003
+ - name: name
4004
+ type: constant
4005
+ - name: name_loc
4006
+ type: location
4007
+ - name: operator_loc
4008
+ type: location
4009
+ - name: value
4010
+ type: node
4011
+ kind: non-void expression
4012
+ comment: |
4013
+ Represents an optional parameter to a method, block, or lambda definition.
4014
+
4015
+ def a(b = 1)
4016
+ ^^^^^
4017
+ end
4018
+ - name: OrNode
4019
+ fields:
4020
+ - name: left
4021
+ type: node
4022
+ kind: non-void expression
4023
+ comment: |
4024
+ Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
4025
+
4026
+ left or right
4027
+ ^^^^
4028
+
4029
+ 1 || 2
4030
+ ^
4031
+ - name: right
4032
+ type: node
4033
+ kind: Node
4034
+ comment: |
4035
+ Represents the right side of the expression.
4036
+
4037
+ left || right
4038
+ ^^^^^
4039
+
4040
+ 1 or 2
4041
+ ^
4042
+ - name: operator_loc
4043
+ type: location
4044
+ comment: |
4045
+ The Location of the `or` keyword or the `||` operator.
4046
+
4047
+ left or right
4048
+ ^^
4049
+ comment: |
4050
+ Represents the use of the `||` operator or the `or` keyword.
4051
+
4052
+ left or right
4053
+ ^^^^^^^^^^^^^
4054
+ - name: ParametersNode
4055
+ fields:
4056
+ - name: requireds
4057
+ type: node[]
4058
+ kind:
4059
+ - RequiredParameterNode
4060
+ - MultiTargetNode
4061
+ - name: optionals
4062
+ type: node[]
4063
+ kind: OptionalParameterNode
4064
+ - name: rest
4065
+ type: node?
4066
+ kind:
4067
+ - RestParameterNode
4068
+ - ImplicitRestNode # Only in block parameters
4069
+ - name: posts
4070
+ type: node[]
4071
+ kind:
4072
+ - RequiredParameterNode
4073
+ - MultiTargetNode
4074
+ - name: keywords
4075
+ type: node[]
4076
+ kind:
4077
+ - RequiredKeywordParameterNode
4078
+ - OptionalKeywordParameterNode
4079
+ - name: keyword_rest
4080
+ type: node?
4081
+ kind:
4082
+ - KeywordRestParameterNode
4083
+ - ForwardingParameterNode
4084
+ - NoKeywordsParameterNode
4085
+ - name: block
4086
+ type: node?
4087
+ kind:
4088
+ - BlockParameterNode
4089
+ - NoBlockParameterNode
4090
+ comment: |
4091
+ Represents the list of parameters on a method, block, or lambda definition.
4092
+
4093
+ def a(b, c, d)
4094
+ ^^^^^^^
4095
+ end
4096
+ - name: ParenthesesNode
4097
+ flags: ParenthesesNodeFlags
4098
+ fields:
4099
+ - name: body
4100
+ type: node?
4101
+ kind: non-void expression # Usually a StatementsNode but not always e.g. `1 in (..10)`
4102
+ - name: opening_loc
4103
+ type: location
4104
+ - name: closing_loc
4105
+ type: location
4106
+ newline: false
4107
+ comment: |
4108
+ Represents a parenthesized expression
4109
+
4110
+ (10 + 34)
4111
+ ^^^^^^^^^
4112
+ - name: PinnedExpressionNode
4113
+ fields:
4114
+ - name: expression
4115
+ type: node
4116
+ kind: non-void expression
4117
+ comment: |
4118
+ The expression used in the pinned expression
4119
+
4120
+ foo in ^(bar)
4121
+ ^^^
4122
+ - name: operator_loc
4123
+ type: location
4124
+ comment: |
4125
+ The Location of the `^` operator
4126
+
4127
+ foo in ^(bar)
4128
+ ^
4129
+ - name: lparen_loc
4130
+ type: location
4131
+ comment: |
4132
+ The Location of the opening parenthesis.
4133
+
4134
+ foo in ^(bar)
4135
+ ^
4136
+ - name: rparen_loc
4137
+ type: location
4138
+ comment: |
4139
+ The Location of the closing parenthesis.
4140
+
4141
+ foo in ^(bar)
4142
+ ^
4143
+ comment: |
4144
+ Represents the use of the `^` operator for pinning an expression in a pattern matching expression.
4145
+
4146
+ foo in ^(bar)
4147
+ ^^^^^^
4148
+ - name: PinnedVariableNode
4149
+ fields:
4150
+ - name: variable
4151
+ type: node
4152
+ kind:
4153
+ - LocalVariableReadNode
4154
+ - InstanceVariableReadNode
4155
+ - ClassVariableReadNode
4156
+ - GlobalVariableReadNode # foo in ^$a
4157
+ - BackReferenceReadNode # foo in ^$&
4158
+ - NumberedReferenceReadNode # foo in ^$1
4159
+ - ItLocalVariableReadNode # proc { 1 in ^it }
4160
+ comment: |
4161
+ The variable used in the pinned expression
4162
+
4163
+ foo in ^bar
4164
+ ^^^
4165
+ - name: operator_loc
4166
+ type: location
4167
+ comment: |
4168
+ The Location of the `^` operator
4169
+
4170
+ foo in ^bar
4171
+ ^
4172
+ comment: |
4173
+ Represents the use of the `^` operator for pinning a variable in a pattern matching expression.
4174
+
4175
+ foo in ^bar
4176
+ ^^^^
4177
+ - name: PostExecutionNode
4178
+ fields:
4179
+ - name: statements
4180
+ type: node?
4181
+ kind: StatementsNode
4182
+ - name: keyword_loc
4183
+ type: location
4184
+ - name: opening_loc
4185
+ type: location
4186
+ - name: closing_loc
4187
+ type: location
4188
+ comment: |
4189
+ Represents the use of the `END` keyword.
4190
+
4191
+ END { foo }
4192
+ ^^^^^^^^^^^
4193
+ - name: PreExecutionNode
4194
+ fields:
4195
+ - name: statements
4196
+ type: node?
4197
+ kind: StatementsNode
4198
+ - name: keyword_loc
4199
+ type: location
4200
+ - name: opening_loc
4201
+ type: location
4202
+ - name: closing_loc
4203
+ type: location
4204
+ comment: |
4205
+ Represents the use of the `BEGIN` keyword.
4206
+
4207
+ BEGIN { foo }
4208
+ ^^^^^^^^^^^^^
4209
+ - name: ProgramNode
4210
+ fields:
4211
+ - name: locals
4212
+ type: constant[]
4213
+ - name: statements
4214
+ type: node
4215
+ kind: StatementsNode
4216
+ comment: The top level node of any parse tree.
4217
+ - name: RangeNode
4218
+ flags: RangeFlags
4219
+ fields:
4220
+ - name: left
4221
+ type: node?
4222
+ kind: non-void expression
4223
+ comment: |
4224
+ The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
4225
+
4226
+ 1...
4227
+ ^
4228
+
4229
+ hello...goodbye
4230
+ ^^^^^
4231
+ - name: right
4232
+ type: node?
4233
+ kind: non-void expression
4234
+ comment: |
4235
+ The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
4236
+
4237
+ ..5
4238
+ ^
4239
+
4240
+ 1...foo
4241
+ ^^^
4242
+ If neither right-hand or left-hand side was included, this will be an ErrorRecoveryNode.
4243
+ - name: operator_loc
4244
+ type: location
4245
+ comment: |
4246
+ The Location of the `..` or `...` operator.
4247
+ comment: |
4248
+ Represents the use of the `..` or `...` operators.
4249
+
4250
+ 1..2
4251
+ ^^^^
4252
+
4253
+ c if a =~ /left/ ... b =~ /right/
4254
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4255
+ - name: RationalNode
4256
+ flags: IntegerBaseFlags
4257
+ fields:
4258
+ - name: numerator
4259
+ type: integer
4260
+ comment: |
4261
+ The numerator of the rational number.
4262
+
4263
+ 1.5r # numerator 3
4264
+ - name: denominator
4265
+ type: integer
4266
+ comment: |
4267
+ The denominator of the rational number.
4268
+
4269
+ 1.5r # denominator 2
4270
+ comment: |
4271
+ Represents a rational number literal.
4272
+
4273
+ 1.0r
4274
+ ^^^^
4275
+ - name: RedoNode
4276
+ comment: |
4277
+ Represents the use of the `redo` keyword.
4278
+
4279
+ redo
4280
+ ^^^^
4281
+ - name: RegularExpressionNode
4282
+ flags: RegularExpressionFlags
4283
+ fields:
4284
+ - name: opening_loc
4285
+ type: location
4286
+ - name: content_loc
4287
+ type: location
4288
+ - name: closing_loc
4289
+ type: location
4290
+ - name: unescaped
4291
+ type: string
4292
+ comment: |
4293
+ Represents a regular expression literal with no interpolation.
4294
+
4295
+ /foo/i
4296
+ ^^^^^^
4297
+ - name: RequiredKeywordParameterNode
4298
+ flags: ParameterFlags
4299
+ fields:
4300
+ - name: name
4301
+ type: constant
4302
+ - name: name_loc
4303
+ type: location
4304
+ comment: |
4305
+ Represents a required keyword parameter to a method, block, or lambda definition.
4306
+
4307
+ def a(b: )
4308
+ ^^
4309
+ end
4310
+ - name: RequiredParameterNode
4311
+ flags: ParameterFlags
4312
+ fields:
4313
+ - name: name
4314
+ type: constant
4315
+ comment: |
4316
+ Represents a required parameter to a method, block, or lambda definition.
4317
+
4318
+ def a(b)
4319
+ ^
4320
+ end
4321
+ - name: RescueModifierNode
4322
+ fields:
4323
+ - name: expression
4324
+ type: node
4325
+ kind: Node
4326
+ - name: keyword_loc
4327
+ type: location
4328
+ - name: rescue_expression
4329
+ type: node
4330
+ kind: Node
4331
+ newline: expression
4332
+ comment: |
4333
+ Represents an expression modified with a rescue.
4334
+
4335
+ foo rescue nil
4336
+ ^^^^^^^^^^^^^^
4337
+ - name: RescueNode
4338
+ fields:
4339
+ - name: keyword_loc
4340
+ type: location
4341
+ - name: exceptions
4342
+ type: node[]
4343
+ kind: non-void expression
4344
+ - name: operator_loc
4345
+ type: location?
4346
+ - name: reference
4347
+ type: node?
4348
+ kind:
4349
+ - LocalVariableTargetNode
4350
+ - InstanceVariableTargetNode
4351
+ - ClassVariableTargetNode
4352
+ - GlobalVariableTargetNode
4353
+ - ConstantTargetNode
4354
+ - ConstantPathTargetNode
4355
+ - CallTargetNode
4356
+ - IndexTargetNode
4357
+ - name: then_keyword_loc
4358
+ type: location?
4359
+ - name: statements
4360
+ type: node?
4361
+ kind: StatementsNode
4362
+ - name: subsequent
4363
+ type: node?
4364
+ kind: RescueNode
4365
+ comment: |
4366
+ Represents a rescue statement.
4367
+
4368
+ begin
4369
+ rescue Foo, *splat, Bar => ex
4370
+ foo
4371
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4372
+ end
4373
+
4374
+ `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
4375
+ - name: RestParameterNode
4376
+ flags: ParameterFlags
4377
+ fields:
4378
+ - name: name
4379
+ type: constant?
4380
+ - name: name_loc
4381
+ type: location?
4382
+ - name: operator_loc
4383
+ type: location
4384
+ comment: |
4385
+ Represents a rest parameter to a method, block, or lambda definition.
4386
+
4387
+ def a(*b)
4388
+ ^^
4389
+ end
4390
+ - name: RetryNode
4391
+ comment: |
4392
+ Represents the use of the `retry` keyword.
4393
+
4394
+ retry
4395
+ ^^^^^
4396
+ - name: ReturnNode
4397
+ fields:
4398
+ - name: keyword_loc
4399
+ type: location
4400
+ - name: arguments
4401
+ type: node?
4402
+ kind: ArgumentsNode
4403
+ comment: |
4404
+ Represents the use of the `return` keyword.
4405
+
4406
+ return 1
4407
+ ^^^^^^^^
4408
+ - name: SelfNode
4409
+ comment: |
4410
+ Represents the `self` keyword.
4411
+
4412
+ self
4413
+ ^^^^
4414
+ - name: ShareableConstantNode
4415
+ flags: ShareableConstantNodeFlags
4416
+ fields:
4417
+ - name: write
4418
+ type: node
4419
+ kind:
4420
+ - ConstantWriteNode
4421
+ - ConstantAndWriteNode
4422
+ - ConstantOrWriteNode
4423
+ - ConstantOperatorWriteNode
4424
+ - ConstantPathWriteNode
4425
+ - ConstantPathAndWriteNode
4426
+ - ConstantPathOrWriteNode
4427
+ - ConstantPathOperatorWriteNode
4428
+ comment: The constant write that should be modified with the shareability state.
4429
+ comment: |
4430
+ This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
4431
+
4432
+ # shareable_constant_value: literal
4433
+ C = { a: 1 }
4434
+ ^^^^^^^^^^^^
4435
+ - name: SingletonClassNode
4436
+ fields:
4437
+ - name: locals
4438
+ type: constant[]
4439
+ - name: class_keyword_loc
4440
+ type: location
4441
+ - name: operator_loc
4442
+ type: location
4443
+ - name: expression
4444
+ type: node
4445
+ kind: non-void expression
4446
+ - name: body
4447
+ type: node?
4448
+ kind:
4449
+ - StatementsNode
4450
+ - BeginNode
4451
+ - name: end_keyword_loc
4452
+ type: location
4453
+ comment: |
4454
+ Represents a singleton class declaration involving the `class` keyword.
4455
+
4456
+ class << self end
4457
+ ^^^^^^^^^^^^^^^^^
4458
+ - name: SourceEncodingNode
4459
+ comment: |
4460
+ Represents the use of the `__ENCODING__` keyword.
4461
+
4462
+ __ENCODING__
4463
+ ^^^^^^^^^^^^
4464
+ - name: SourceFileNode
4465
+ flags: StringFlags
4466
+ fields:
4467
+ - name: filepath
4468
+ type: string
4469
+ comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism.parse*` APIs.
4470
+ comment: |
4471
+ Represents the use of the `__FILE__` keyword.
4472
+
4473
+ __FILE__
4474
+ ^^^^^^^^
4475
+ - name: SourceLineNode
4476
+ comment: |
4477
+ Represents the use of the `__LINE__` keyword.
4478
+
4479
+ __LINE__
4480
+ ^^^^^^^^
4481
+ - name: SplatNode
4482
+ fields:
4483
+ - name: operator_loc
4484
+ type: location
4485
+ - name: expression
4486
+ type: node?
4487
+ kind: non-void expression
4488
+ comment: |
4489
+ Represents the use of the splat operator.
4490
+
4491
+ [*a]
4492
+ ^^
4493
+ - name: StatementsNode
4494
+ fields:
4495
+ - name: body
4496
+ type: node[]
4497
+ kind: Node
4498
+ comment: |
4499
+ Represents a set of statements contained within some scope.
4500
+
4501
+ foo; bar; baz
4502
+ ^^^^^^^^^^^^^
4503
+ - name: StringNode
4504
+ flags: StringFlags
4505
+ fields:
4506
+ - name: opening_loc
4507
+ type: location?
4508
+ - name: content_loc
4509
+ type: location
4510
+ - name: closing_loc
4511
+ type: location?
4512
+ - name: unescaped
4513
+ type: string
4514
+ comment: |
4515
+ Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string.
4516
+
4517
+ "foo"
4518
+ ^^^^^
4519
+
4520
+ %w[foo]
4521
+ ^^^
4522
+
4523
+ "foo #{bar} baz"
4524
+ ^^^^ ^^^^
4525
+ - name: SuperNode
4526
+ fields:
4527
+ - name: keyword_loc
4528
+ type: location
4529
+ - name: lparen_loc
4530
+ type: location?
4531
+ - name: arguments
4532
+ type: node?
4533
+ kind: ArgumentsNode
4534
+ comment: "Can be only `nil` when there are empty parentheses, like `super()`."
4535
+ - name: rparen_loc
4536
+ type: location?
4537
+ - name: block
4538
+ type: node?
4539
+ kind:
4540
+ - BlockNode
4541
+ - BlockArgumentNode
4542
+ comment: |
4543
+ Represents the use of the `super` keyword with parentheses or arguments.
4544
+
4545
+ super()
4546
+ ^^^^^^^
4547
+
4548
+ super foo, bar
4549
+ ^^^^^^^^^^^^^^
4550
+
4551
+ If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
4552
+ - name: SymbolNode
4553
+ flags: SymbolFlags
4554
+ fields:
4555
+ - name: opening_loc
4556
+ type: location?
4557
+ - name: content_loc
4558
+ type: location
4559
+ - name: closing_loc
4560
+ type: location?
4561
+ - name: unescaped
4562
+ type: string
4563
+ comment: |
4564
+ Represents a symbol literal or a symbol contained within a `%i` list.
4565
+
4566
+ :foo
4567
+ ^^^^
4568
+
4569
+ %i[foo]
4570
+ ^^^
4571
+ - name: TrueNode
4572
+ comment: |
4573
+ Represents the use of the literal `true` keyword.
4574
+
4575
+ true
4576
+ ^^^^
4577
+ - name: UndefNode
4578
+ fields:
4579
+ - name: names
4580
+ type: node[]
4581
+ kind:
4582
+ - SymbolNode
4583
+ - InterpolatedSymbolNode
4584
+ - name: keyword_loc
4585
+ type: location
4586
+ comment: |
4587
+ Represents the use of the `undef` keyword.
4588
+
4589
+ undef :foo, :bar, :baz
4590
+ ^^^^^^^^^^^^^^^^^^^^^^
4591
+ - name: UnlessNode
4592
+ fields:
4593
+ - name: unless_keyword_loc
4594
+ type: location
4595
+ comment: |
4596
+ The Location of the `unless` keyword.
4597
+
4598
+ unless cond then bar end
4599
+ ^^^^^^
4600
+
4601
+ bar unless cond
4602
+ ^^^^^^
4603
+ - name: predicate
4604
+ type: node
4605
+ kind: non-void expression
4606
+ comment: |
4607
+ The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
4608
+
4609
+ unless cond then bar end
4610
+ ^^^^
4611
+
4612
+ bar unless cond
4613
+ ^^^^
4614
+ - name: then_keyword_loc
4615
+ type: location?
4616
+ comment: |
4617
+ The Location of the `then` keyword, if present.
4618
+
4619
+ unless cond then bar end
4620
+ ^^^^
4621
+ - name: statements
4622
+ type: node?
4623
+ kind: StatementsNode
4624
+ comment: |
4625
+ The body of statements that will executed if the unless condition is
4626
+ falsey. Will be `nil` if no body is provided.
4627
+
4628
+ unless cond then bar end
4629
+ ^^^
4630
+ - name: else_clause
4631
+ type: node?
4632
+ kind: ElseNode
4633
+ comment: |
4634
+ The else clause of the unless expression, if present.
4635
+
4636
+ unless cond then bar else baz end
4637
+ ^^^^^^^^^^^^
4638
+ - name: end_keyword_loc
4639
+ type: location?
4640
+ comment: |
4641
+ The Location of the `end` keyword, if present.
4642
+
4643
+ unless cond then bar end
4644
+ ^^^
4645
+ newline: predicate
4646
+ comment: |
4647
+ Represents the use of the `unless` keyword, either in the block form or the modifier form.
4648
+
4649
+ bar unless foo
4650
+ ^^^^^^^^^^^^^^
4651
+
4652
+ unless foo then bar end
4653
+ ^^^^^^^^^^^^^^^^^^^^^^^
4654
+ - name: UntilNode
4655
+ flags: LoopFlags
4656
+ fields:
4657
+ - name: until_keyword_loc
4658
+ type: location
4659
+ - name: do_keyword_loc
4660
+ type: location?
4661
+ - name: end_keyword_loc
4662
+ type: location?
4663
+ - name: predicate
4664
+ type: node
4665
+ kind: non-void expression
4666
+ - name: statements
4667
+ type: node?
4668
+ kind: StatementsNode
4669
+ newline: predicate
4670
+ comment: |
4671
+ Represents the use of the `until` keyword, either in the block form or the modifier form.
4672
+
4673
+ bar until foo
4674
+ ^^^^^^^^^^^^^
4675
+
4676
+ until foo do bar end
4677
+ ^^^^^^^^^^^^^^^^^^^^
4678
+ - name: WhenNode
4679
+ fields:
4680
+ - name: when_keyword_loc
4681
+ type: location
4682
+ - name: conditions
4683
+ type: node[]
4684
+ kind: non-void expression
4685
+ - name: then_keyword_loc
4686
+ type: location?
4687
+ - name: statements
4688
+ type: node?
4689
+ kind: StatementsNode
4690
+ comment: |
4691
+ Represents the use of the `when` keyword within a case statement.
4692
+
4693
+ case true
4694
+ when true
4695
+ ^^^^^^^^^
4696
+ end
4697
+ - name: WhileNode
4698
+ flags: LoopFlags
4699
+ fields:
4700
+ - name: while_keyword_loc
4701
+ type: location
4702
+ - name: do_keyword_loc
4703
+ type: location?
4704
+ - name: end_keyword_loc
4705
+ type: location?
4706
+ - name: predicate
4707
+ type: node
4708
+ kind: non-void expression
4709
+ - name: statements
4710
+ type: node?
4711
+ kind: StatementsNode
4712
+ newline: predicate
4713
+ comment: |
4714
+ Represents the use of the `while` keyword, either in the block form or the modifier form.
4715
+
4716
+ bar while foo
4717
+ ^^^^^^^^^^^^^
4718
+
4719
+ while foo do bar end
4720
+ ^^^^^^^^^^^^^^^^^^^^
4721
+ - name: XStringNode
4722
+ flags: EncodingFlags
4723
+ fields:
4724
+ - name: opening_loc
4725
+ type: location
4726
+ - name: content_loc
4727
+ type: location
4728
+ - name: closing_loc
4729
+ type: location
4730
+ - name: unescaped
4731
+ type: string
4732
+ comment: |
4733
+ Represents an xstring literal with no interpolation.
4734
+
4735
+ `foo`
4736
+ ^^^^^
4737
+ - name: YieldNode
4738
+ fields:
4739
+ - name: keyword_loc
4740
+ type: location
4741
+ - name: lparen_loc
4742
+ type: location?
4743
+ - name: arguments
4744
+ type: node?
4745
+ kind: ArgumentsNode
4746
+ - name: rparen_loc
4747
+ type: location?
4748
+ comment: |
4749
+ Represents the use of the `yield` keyword.
4750
+
4751
+ yield 1
4752
+ ^^^^^^^