jruby-prism-parser 0.23.0.pre.SNAPSHOT-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +401 -0
  3. data/CODE_OF_CONDUCT.md +76 -0
  4. data/CONTRIBUTING.md +62 -0
  5. data/LICENSE.md +7 -0
  6. data/Makefile +101 -0
  7. data/README.md +98 -0
  8. data/config.yml +2902 -0
  9. data/docs/build_system.md +91 -0
  10. data/docs/configuration.md +64 -0
  11. data/docs/cruby_compilation.md +27 -0
  12. data/docs/design.md +53 -0
  13. data/docs/encoding.md +121 -0
  14. data/docs/fuzzing.md +88 -0
  15. data/docs/heredocs.md +36 -0
  16. data/docs/javascript.md +118 -0
  17. data/docs/local_variable_depth.md +229 -0
  18. data/docs/mapping.md +117 -0
  19. data/docs/parser_translation.md +34 -0
  20. data/docs/parsing_rules.md +19 -0
  21. data/docs/releasing.md +98 -0
  22. data/docs/ripper.md +36 -0
  23. data/docs/ruby_api.md +43 -0
  24. data/docs/ruby_parser_translation.md +19 -0
  25. data/docs/serialization.md +209 -0
  26. data/docs/testing.md +55 -0
  27. data/ext/prism/api_node.c +5098 -0
  28. data/ext/prism/api_pack.c +267 -0
  29. data/ext/prism/extconf.rb +110 -0
  30. data/ext/prism/extension.c +1155 -0
  31. data/ext/prism/extension.h +18 -0
  32. data/include/prism/ast.h +5807 -0
  33. data/include/prism/defines.h +102 -0
  34. data/include/prism/diagnostic.h +339 -0
  35. data/include/prism/encoding.h +265 -0
  36. data/include/prism/node.h +57 -0
  37. data/include/prism/options.h +230 -0
  38. data/include/prism/pack.h +152 -0
  39. data/include/prism/parser.h +732 -0
  40. data/include/prism/prettyprint.h +26 -0
  41. data/include/prism/regexp.h +33 -0
  42. data/include/prism/util/pm_buffer.h +155 -0
  43. data/include/prism/util/pm_char.h +205 -0
  44. data/include/prism/util/pm_constant_pool.h +209 -0
  45. data/include/prism/util/pm_list.h +97 -0
  46. data/include/prism/util/pm_memchr.h +29 -0
  47. data/include/prism/util/pm_newline_list.h +93 -0
  48. data/include/prism/util/pm_state_stack.h +42 -0
  49. data/include/prism/util/pm_string.h +150 -0
  50. data/include/prism/util/pm_string_list.h +44 -0
  51. data/include/prism/util/pm_strncasecmp.h +32 -0
  52. data/include/prism/util/pm_strpbrk.h +46 -0
  53. data/include/prism/version.h +29 -0
  54. data/include/prism.h +289 -0
  55. data/jruby-prism.jar +0 -0
  56. data/lib/prism/compiler.rb +486 -0
  57. data/lib/prism/debug.rb +206 -0
  58. data/lib/prism/desugar_compiler.rb +207 -0
  59. data/lib/prism/dispatcher.rb +2150 -0
  60. data/lib/prism/dot_visitor.rb +4634 -0
  61. data/lib/prism/dsl.rb +785 -0
  62. data/lib/prism/ffi.rb +346 -0
  63. data/lib/prism/lex_compat.rb +908 -0
  64. data/lib/prism/mutation_compiler.rb +753 -0
  65. data/lib/prism/node.rb +17864 -0
  66. data/lib/prism/node_ext.rb +212 -0
  67. data/lib/prism/node_inspector.rb +68 -0
  68. data/lib/prism/pack.rb +224 -0
  69. data/lib/prism/parse_result/comments.rb +177 -0
  70. data/lib/prism/parse_result/newlines.rb +64 -0
  71. data/lib/prism/parse_result.rb +498 -0
  72. data/lib/prism/pattern.rb +250 -0
  73. data/lib/prism/serialize.rb +1354 -0
  74. data/lib/prism/translation/parser/compiler.rb +1838 -0
  75. data/lib/prism/translation/parser/lexer.rb +335 -0
  76. data/lib/prism/translation/parser/rubocop.rb +37 -0
  77. data/lib/prism/translation/parser.rb +178 -0
  78. data/lib/prism/translation/ripper.rb +577 -0
  79. data/lib/prism/translation/ruby_parser.rb +1521 -0
  80. data/lib/prism/translation.rb +11 -0
  81. data/lib/prism/version.rb +3 -0
  82. data/lib/prism/visitor.rb +495 -0
  83. data/lib/prism.rb +99 -0
  84. data/prism.gemspec +135 -0
  85. data/rbi/prism.rbi +7767 -0
  86. data/rbi/prism_static.rbi +207 -0
  87. data/sig/prism.rbs +4773 -0
  88. data/sig/prism_static.rbs +201 -0
  89. data/src/diagnostic.c +400 -0
  90. data/src/encoding.c +5132 -0
  91. data/src/node.c +2786 -0
  92. data/src/options.c +213 -0
  93. data/src/pack.c +493 -0
  94. data/src/prettyprint.c +8881 -0
  95. data/src/prism.c +18406 -0
  96. data/src/regexp.c +638 -0
  97. data/src/serialize.c +1554 -0
  98. data/src/token_type.c +700 -0
  99. data/src/util/pm_buffer.c +190 -0
  100. data/src/util/pm_char.c +318 -0
  101. data/src/util/pm_constant_pool.c +322 -0
  102. data/src/util/pm_list.c +49 -0
  103. data/src/util/pm_memchr.c +35 -0
  104. data/src/util/pm_newline_list.c +84 -0
  105. data/src/util/pm_state_stack.c +25 -0
  106. data/src/util/pm_string.c +203 -0
  107. data/src/util/pm_string_list.c +28 -0
  108. data/src/util/pm_strncasecmp.c +24 -0
  109. data/src/util/pm_strpbrk.c +180 -0
  110. metadata +156 -0
data/config.yml ADDED
@@ -0,0 +1,2902 @@
1
+ tokens:
2
+ - name: EOF
3
+ value: 1
4
+ comment: final token in the file
5
+ - name: MISSING
6
+ comment: "a token that was expected but not found"
7
+ - name: NOT_PROVIDED
8
+ comment: "a token that was not present but it is okay"
9
+ - name: AMPERSAND
10
+ comment: "&"
11
+ - name: AMPERSAND_AMPERSAND
12
+ comment: "&&"
13
+ - name: AMPERSAND_AMPERSAND_EQUAL
14
+ comment: "&&="
15
+ - name: AMPERSAND_DOT
16
+ comment: "&."
17
+ - name: AMPERSAND_EQUAL
18
+ comment: "&="
19
+ - name: BACKTICK
20
+ comment: "`"
21
+ - name: BACK_REFERENCE
22
+ comment: "a back reference"
23
+ - name: BANG
24
+ comment: "! or !@"
25
+ - name: BANG_EQUAL
26
+ comment: "!="
27
+ - name: BANG_TILDE
28
+ comment: "!~"
29
+ - name: BRACE_LEFT
30
+ comment: "{"
31
+ - name: BRACE_RIGHT
32
+ comment: "}"
33
+ - name: BRACKET_LEFT
34
+ comment: "["
35
+ - name: BRACKET_LEFT_ARRAY
36
+ comment: "[ for the beginning of an array"
37
+ - name: BRACKET_LEFT_RIGHT
38
+ comment: "[]"
39
+ - name: BRACKET_LEFT_RIGHT_EQUAL
40
+ comment: "[]="
41
+ - name: BRACKET_RIGHT
42
+ comment: "]"
43
+ - name: CARET
44
+ comment: "^"
45
+ - name: CARET_EQUAL
46
+ comment: "^="
47
+ - name: CHARACTER_LITERAL
48
+ comment: "a character literal"
49
+ - name: CLASS_VARIABLE
50
+ comment: "a class variable"
51
+ - name: COLON
52
+ comment: ":"
53
+ - name: COLON_COLON
54
+ comment: "::"
55
+ - name: COMMA
56
+ comment: ","
57
+ - name: COMMENT
58
+ comment: "a comment"
59
+ - name: CONSTANT
60
+ comment: "a constant"
61
+ - name: DOT
62
+ comment: "the . call operator"
63
+ - name: DOT_DOT
64
+ comment: "the .. range operator"
65
+ - name: DOT_DOT_DOT
66
+ comment: "the ... range operator or forwarding parameter"
67
+ - name: EMBDOC_BEGIN
68
+ comment: "=begin"
69
+ - name: EMBDOC_END
70
+ comment: "=end"
71
+ - name: EMBDOC_LINE
72
+ comment: "a line inside of embedded documentation"
73
+ - name: EMBEXPR_BEGIN
74
+ comment: "#{"
75
+ - name: EMBEXPR_END
76
+ comment: "}"
77
+ - name: EMBVAR
78
+ comment: "#"
79
+ - name: EQUAL
80
+ comment: "="
81
+ - name: EQUAL_EQUAL
82
+ comment: "=="
83
+ - name: EQUAL_EQUAL_EQUAL
84
+ comment: "==="
85
+ - name: EQUAL_GREATER
86
+ comment: "=>"
87
+ - name: EQUAL_TILDE
88
+ comment: "=~"
89
+ - name: FLOAT
90
+ comment: "a floating point number"
91
+ - name: FLOAT_IMAGINARY
92
+ comment: "a floating pointer number with an imaginary suffix"
93
+ - name: FLOAT_RATIONAL
94
+ comment: "a floating pointer number with a rational suffix"
95
+ - name: FLOAT_RATIONAL_IMAGINARY
96
+ comment: "a floating pointer number with a rational and imaginary suffix"
97
+ - name: GLOBAL_VARIABLE
98
+ comment: "a global variable"
99
+ - name: GREATER
100
+ comment: ">"
101
+ - name: GREATER_EQUAL
102
+ comment: ">="
103
+ - name: GREATER_GREATER
104
+ comment: ">>"
105
+ - name: GREATER_GREATER_EQUAL
106
+ comment: ">>="
107
+ - name: HEREDOC_END
108
+ comment: "the end of a heredoc"
109
+ - name: HEREDOC_START
110
+ comment: "the start of a heredoc"
111
+ - name: IDENTIFIER
112
+ comment: "an identifier"
113
+ - name: IGNORED_NEWLINE
114
+ comment: "an ignored newline"
115
+ - name: INSTANCE_VARIABLE
116
+ comment: "an instance variable"
117
+ - name: INTEGER
118
+ comment: "an integer (any base)"
119
+ - name: INTEGER_IMAGINARY
120
+ comment: "an integer with an imaginary suffix"
121
+ - name: INTEGER_RATIONAL
122
+ comment: "an integer with a rational suffix"
123
+ - name: INTEGER_RATIONAL_IMAGINARY
124
+ comment: "an integer with a rational and imaginary suffix"
125
+ - name: KEYWORD_ALIAS
126
+ comment: "alias"
127
+ - name: KEYWORD_AND
128
+ comment: "and"
129
+ - name: KEYWORD_BEGIN
130
+ comment: "begin"
131
+ - name: KEYWORD_BEGIN_UPCASE
132
+ comment: "BEGIN"
133
+ - name: KEYWORD_BREAK
134
+ comment: "break"
135
+ - name: KEYWORD_CASE
136
+ comment: "case"
137
+ - name: KEYWORD_CLASS
138
+ comment: "class"
139
+ - name: KEYWORD_DEF
140
+ comment: "def"
141
+ - name: KEYWORD_DEFINED
142
+ comment: "defined?"
143
+ - name: KEYWORD_DO
144
+ comment: "do"
145
+ - name: KEYWORD_DO_LOOP
146
+ comment: "do keyword for a predicate in a while, until, or for loop"
147
+ - name: KEYWORD_ELSE
148
+ comment: "else"
149
+ - name: KEYWORD_ELSIF
150
+ comment: "elsif"
151
+ - name: KEYWORD_END
152
+ comment: "end"
153
+ - name: KEYWORD_END_UPCASE
154
+ comment: "END"
155
+ - name: KEYWORD_ENSURE
156
+ comment: "ensure"
157
+ - name: KEYWORD_FALSE
158
+ comment: "false"
159
+ - name: KEYWORD_FOR
160
+ comment: "for"
161
+ - name: KEYWORD_IF
162
+ comment: "if"
163
+ - name: KEYWORD_IF_MODIFIER
164
+ comment: "if in the modifier form"
165
+ - name: KEYWORD_IN
166
+ comment: "in"
167
+ - name: KEYWORD_MODULE
168
+ comment: "module"
169
+ - name: KEYWORD_NEXT
170
+ comment: "next"
171
+ - name: KEYWORD_NIL
172
+ comment: "nil"
173
+ - name: KEYWORD_NOT
174
+ comment: "not"
175
+ - name: KEYWORD_OR
176
+ comment: "or"
177
+ - name: KEYWORD_REDO
178
+ comment: "redo"
179
+ - name: KEYWORD_RESCUE
180
+ comment: "rescue"
181
+ - name: KEYWORD_RESCUE_MODIFIER
182
+ comment: "rescue in the modifier form"
183
+ - name: KEYWORD_RETRY
184
+ comment: "retry"
185
+ - name: KEYWORD_RETURN
186
+ comment: "return"
187
+ - name: KEYWORD_SELF
188
+ comment: "self"
189
+ - name: KEYWORD_SUPER
190
+ comment: "super"
191
+ - name: KEYWORD_THEN
192
+ comment: "then"
193
+ - name: KEYWORD_TRUE
194
+ comment: "true"
195
+ - name: KEYWORD_UNDEF
196
+ comment: "undef"
197
+ - name: KEYWORD_UNLESS
198
+ comment: "unless"
199
+ - name: KEYWORD_UNLESS_MODIFIER
200
+ comment: "unless in the modifier form"
201
+ - name: KEYWORD_UNTIL
202
+ comment: "until"
203
+ - name: KEYWORD_UNTIL_MODIFIER
204
+ comment: "until in the modifier form"
205
+ - name: KEYWORD_WHEN
206
+ comment: "when"
207
+ - name: KEYWORD_WHILE
208
+ comment: "while"
209
+ - name: KEYWORD_WHILE_MODIFIER
210
+ comment: "while in the modifier form"
211
+ - name: KEYWORD_YIELD
212
+ comment: "yield"
213
+ - name: KEYWORD___ENCODING__
214
+ comment: "__ENCODING__"
215
+ - name: KEYWORD___FILE__
216
+ comment: "__FILE__"
217
+ - name: KEYWORD___LINE__
218
+ comment: "__LINE__"
219
+ - name: LABEL
220
+ comment: "a label"
221
+ - name: LABEL_END
222
+ comment: "the end of a label"
223
+ - name: LAMBDA_BEGIN
224
+ comment: "{"
225
+ - name: LESS
226
+ comment: "<"
227
+ - name: LESS_EQUAL
228
+ comment: "<="
229
+ - name: LESS_EQUAL_GREATER
230
+ comment: "<=>"
231
+ - name: LESS_LESS
232
+ comment: "<<"
233
+ - name: LESS_LESS_EQUAL
234
+ comment: "<<="
235
+ - name: METHOD_NAME
236
+ comment: "a method name"
237
+ - name: MINUS
238
+ comment: "-"
239
+ - name: MINUS_EQUAL
240
+ comment: "-="
241
+ - name: MINUS_GREATER
242
+ comment: "->"
243
+ - name: NEWLINE
244
+ comment: "a newline character outside of other tokens"
245
+ - name: NUMBERED_REFERENCE
246
+ comment: "a numbered reference to a capture group in the previous regular expression match"
247
+ - name: PARENTHESIS_LEFT
248
+ comment: "("
249
+ - name: PARENTHESIS_LEFT_PARENTHESES
250
+ comment: "( for a parentheses node"
251
+ - name: PARENTHESIS_RIGHT
252
+ comment: ")"
253
+ - name: PERCENT
254
+ comment: "%"
255
+ - name: PERCENT_EQUAL
256
+ comment: "%="
257
+ - name: PERCENT_LOWER_I
258
+ comment: "%i"
259
+ - name: PERCENT_LOWER_W
260
+ comment: "%w"
261
+ - name: PERCENT_LOWER_X
262
+ comment: "%x"
263
+ - name: PERCENT_UPPER_I
264
+ comment: "%I"
265
+ - name: PERCENT_UPPER_W
266
+ comment: "%W"
267
+ - name: PIPE
268
+ comment: "|"
269
+ - name: PIPE_EQUAL
270
+ comment: "|="
271
+ - name: PIPE_PIPE
272
+ comment: "||"
273
+ - name: PIPE_PIPE_EQUAL
274
+ comment: "||="
275
+ - name: PLUS
276
+ comment: "+"
277
+ - name: PLUS_EQUAL
278
+ comment: "+="
279
+ - name: QUESTION_MARK
280
+ comment: "?"
281
+ - name: REGEXP_BEGIN
282
+ comment: "the beginning of a regular expression"
283
+ - name: REGEXP_END
284
+ comment: "the end of a regular expression"
285
+ - name: SEMICOLON
286
+ comment: ";"
287
+ - name: SLASH
288
+ comment: "/"
289
+ - name: SLASH_EQUAL
290
+ comment: "/="
291
+ - name: STAR
292
+ comment: "*"
293
+ - name: STAR_EQUAL
294
+ comment: "*="
295
+ - name: STAR_STAR
296
+ comment: "**"
297
+ - name: STAR_STAR_EQUAL
298
+ comment: "**="
299
+ - name: STRING_BEGIN
300
+ comment: "the beginning of a string"
301
+ - name: STRING_CONTENT
302
+ comment: "the contents of a string"
303
+ - name: STRING_END
304
+ comment: "the end of a string"
305
+ - name: SYMBOL_BEGIN
306
+ comment: "the beginning of a symbol"
307
+ - name: TILDE
308
+ comment: "~ or ~@"
309
+ - name: UAMPERSAND
310
+ comment: "unary &"
311
+ - name: UCOLON_COLON
312
+ comment: "unary ::"
313
+ - name: UDOT_DOT
314
+ comment: "unary .. operator"
315
+ - name: UDOT_DOT_DOT
316
+ comment: "unary ... operator"
317
+ - name: UMINUS
318
+ comment: "-@"
319
+ - name: UMINUS_NUM
320
+ comment: "-@ for a number"
321
+ - name: UPLUS
322
+ comment: "+@"
323
+ - name: USTAR
324
+ comment: "unary *"
325
+ - name: USTAR_STAR
326
+ comment: "unary **"
327
+ - name: WORDS_SEP
328
+ comment: "a separator between words in a list"
329
+ - name: __END__
330
+ comment: "marker for the point in the file at which the parser should stop"
331
+ flags:
332
+ - name: ArgumentsNodeFlags
333
+ values:
334
+ - name: CONTAINS_KEYWORD_SPLAT
335
+ comment: "if arguments contain keyword splat"
336
+ comment: Flags for arguments nodes.
337
+ - name: ArrayNodeFlags
338
+ values:
339
+ - name: CONTAINS_SPLAT
340
+ comment: "if array contains splat nodes"
341
+ comment: Flags for array nodes.
342
+ - name: CallNodeFlags
343
+ values:
344
+ - name: SAFE_NAVIGATION
345
+ comment: "&. operator"
346
+ - name: VARIABLE_CALL
347
+ comment: "a call that could have been a local variable"
348
+ - name: ATTRIBUTE_WRITE
349
+ comment: "a call that is an attribute write, so the value being written should be returned"
350
+ - name: IGNORE_VISIBILITY
351
+ comment: "a call that ignores method visibility"
352
+ comment: Flags for call nodes.
353
+ - name: EncodingFlags
354
+ values:
355
+ - name: FORCED_UTF8_ENCODING
356
+ comment: "internal bytes forced the encoding to UTF-8"
357
+ - name: FORCED_BINARY_ENCODING
358
+ comment: "internal bytes forced the encoding to binary"
359
+ comment: Flags for nodes that have unescaped content.
360
+ - name: IntegerBaseFlags
361
+ values:
362
+ - name: BINARY
363
+ comment: "0b prefix"
364
+ - name: DECIMAL
365
+ comment: "0d or no prefix"
366
+ - name: OCTAL
367
+ comment: "0o or 0 prefix"
368
+ - name: HEXADECIMAL
369
+ comment: "0x prefix"
370
+ comment: Flags for integer nodes that correspond to the base of the integer.
371
+ - name: KeywordHashNodeFlags
372
+ values:
373
+ - name: SYMBOL_KEYS
374
+ comment: "a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments"
375
+ comment: Flags for keyword hash nodes.
376
+ - name: LoopFlags
377
+ values:
378
+ - name: BEGIN_MODIFIER
379
+ comment: "a loop after a begin statement, so the body is executed first before the condition"
380
+ comment: Flags for while and until loop nodes.
381
+ - name: ParameterFlags
382
+ values:
383
+ - name: REPEATED_PARAMETER
384
+ comment: "a parameter name that has been repeated in the method signature"
385
+ comment: Flags for parameter nodes.
386
+ - name: RangeFlags
387
+ values:
388
+ - name: EXCLUDE_END
389
+ comment: "... operator"
390
+ comment: Flags for range and flip-flop nodes.
391
+ - name: RegularExpressionFlags
392
+ values:
393
+ - name: IGNORE_CASE
394
+ comment: "i - ignores the case of characters when matching"
395
+ - name: EXTENDED
396
+ comment: "x - ignores whitespace and allows comments in regular expressions"
397
+ - name: MULTI_LINE
398
+ comment: "m - allows $ to match the end of lines within strings"
399
+ - name: ONCE
400
+ comment: "o - only interpolates values into the regular expression once"
401
+ - name: EUC_JP
402
+ comment: "e - forces the EUC-JP encoding"
403
+ - name: ASCII_8BIT
404
+ comment: "n - forces the ASCII-8BIT encoding"
405
+ - name: WINDOWS_31J
406
+ comment: "s - forces the Windows-31J encoding"
407
+ - name: UTF_8
408
+ comment: "u - forces the UTF-8 encoding"
409
+ - name: FORCED_UTF8_ENCODING
410
+ comment: "internal bytes forced the encoding to UTF-8"
411
+ - name: FORCED_BINARY_ENCODING
412
+ comment: "internal bytes forced the encoding to binary"
413
+ - name: FORCED_US_ASCII_ENCODING
414
+ comment: "internal bytes forced the encoding to US-ASCII"
415
+ comment: Flags for regular expression and match last line nodes.
416
+ - name: StringFlags
417
+ values:
418
+ - name: FORCED_UTF8_ENCODING
419
+ comment: "internal bytes forced the encoding to UTF-8"
420
+ - name: FORCED_BINARY_ENCODING
421
+ comment: "internal bytes forced the encoding to binary"
422
+ - name: FROZEN
423
+ comment: "frozen by virtue of a `frozen_string_literal` comment"
424
+ comment: Flags for string nodes.
425
+ - name: SymbolFlags
426
+ values:
427
+ - name: FORCED_UTF8_ENCODING
428
+ comment: "internal bytes forced the encoding to UTF-8"
429
+ - name: FORCED_BINARY_ENCODING
430
+ comment: "internal bytes forced the encoding to binary"
431
+ - name: FORCED_US_ASCII_ENCODING
432
+ comment: "internal bytes forced the encoding to US-ASCII"
433
+ comment: Flags for symbol nodes.
434
+ nodes:
435
+ - name: AliasGlobalVariableNode
436
+ fields:
437
+ - name: new_name
438
+ type: node
439
+ - name: old_name
440
+ type: node
441
+ - name: keyword_loc
442
+ type: location
443
+ comment: |
444
+ Represents the use of the `alias` keyword to alias a global variable.
445
+
446
+ alias $foo $bar
447
+ ^^^^^^^^^^^^^^^
448
+ - name: AliasMethodNode
449
+ fields:
450
+ - name: new_name
451
+ type: node
452
+ - name: old_name
453
+ type: node
454
+ - name: keyword_loc
455
+ type: location
456
+ comment: |
457
+ Represents the use of the `alias` keyword to alias a method.
458
+
459
+ alias foo bar
460
+ ^^^^^^^^^^^^^
461
+ - name: AlternationPatternNode
462
+ fields:
463
+ - name: left
464
+ type: node
465
+ - name: right
466
+ type: node
467
+ - name: operator_loc
468
+ type: location
469
+ comment: |
470
+ Represents an alternation pattern in pattern matching.
471
+
472
+ foo => bar | baz
473
+ ^^^^^^^^^
474
+ - name: AndNode
475
+ fields:
476
+ - name: left
477
+ type: node
478
+ comment: |
479
+ 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).
480
+
481
+ left and right
482
+ ^^^^
483
+
484
+ 1 && 2
485
+ ^
486
+ - name: right
487
+ type: node
488
+ comment: |
489
+ Represents the right 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).
490
+
491
+ left && right
492
+ ^^^^^
493
+
494
+ 1 and 2
495
+ ^
496
+ - name: operator_loc
497
+ type: location
498
+ comment: |
499
+ The location of the `and` keyword or the `&&` operator.
500
+
501
+ left and right
502
+ ^^^
503
+ comment: |
504
+ Represents the use of the `&&` operator or the `and` keyword.
505
+
506
+ left and right
507
+ ^^^^^^^^^^^^^^
508
+ - name: ArgumentsNode
509
+ fields:
510
+ - name: flags
511
+ type: flags
512
+ kind: ArgumentsNodeFlags
513
+ - name: arguments
514
+ type: node[]
515
+ comment: |
516
+ Represents a set of arguments to a method or a keyword.
517
+
518
+ return foo, bar, baz
519
+ ^^^^^^^^^^^^^
520
+ - name: ArrayNode
521
+ fields:
522
+ - name: flags
523
+ type: flags
524
+ kind: ArrayNodeFlags
525
+ - name: elements
526
+ type: node[]
527
+ - name: opening_loc
528
+ type: location?
529
+ - name: closing_loc
530
+ type: location?
531
+ comment: |
532
+ Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
533
+
534
+ [1, 2, 3]
535
+ ^^^^^^^^^
536
+ - name: ArrayPatternNode
537
+ fields:
538
+ - name: constant
539
+ type: node?
540
+ - name: requireds
541
+ type: node[]
542
+ - name: rest
543
+ type: node?
544
+ - name: posts
545
+ type: node[]
546
+ - name: opening_loc
547
+ type: location?
548
+ - name: closing_loc
549
+ type: location?
550
+ comment: |
551
+ Represents an array pattern in pattern matching.
552
+
553
+ foo in 1, 2
554
+ ^^^^^^^^^^^
555
+
556
+ foo in [1, 2]
557
+ ^^^^^^^^^^^^^
558
+
559
+ foo in *1
560
+ ^^^^^^^^^
561
+
562
+ foo in Bar[]
563
+ ^^^^^^^^^^^^
564
+
565
+ foo in Bar[1, 2, 3]
566
+ ^^^^^^^^^^^^^^^^^^^
567
+ - name: AssocNode
568
+ fields:
569
+ - name: key
570
+ type: node
571
+ comment: |
572
+ 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).
573
+
574
+ { a: b }
575
+ ^
576
+
577
+ { foo => bar }
578
+ ^^^
579
+
580
+ { def a; end => 1 }
581
+ ^^^^^^^^^^
582
+ - name: value
583
+ type: node
584
+ comment: |
585
+ 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).
586
+
587
+ { foo => bar }
588
+ ^^^
589
+
590
+ { x: 1 }
591
+ ^
592
+ - name: operator_loc
593
+ type: location?
594
+ comment: |
595
+ The location of the `=>` operator, if present.
596
+
597
+ { foo => bar }
598
+ ^^
599
+ comment: |
600
+ Represents a hash key/value pair.
601
+
602
+ { a => b }
603
+ ^^^^^^
604
+ - name: AssocSplatNode
605
+ fields:
606
+ - name: value
607
+ type: node?
608
+ comment: |
609
+ The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
610
+
611
+ { **foo }
612
+ ^^^
613
+ - name: operator_loc
614
+ type: location
615
+ comment: |
616
+ The location of the `**` operator.
617
+
618
+ { **x }
619
+ ^^
620
+ comment: |
621
+ Represents a splat in a hash literal.
622
+
623
+ { **foo }
624
+ ^^^^^
625
+ - name: BackReferenceReadNode
626
+ fields:
627
+ - name: name
628
+ type: constant
629
+ comment: |
630
+ The name of the back-reference variable, including the leading `$`.
631
+
632
+ $& # name `:$&`
633
+
634
+ $+ # name `:$+`
635
+ comment: |
636
+ Represents reading a reference to a field in the previous match.
637
+
638
+ $'
639
+ ^^
640
+ - name: BeginNode
641
+ fields:
642
+ - name: begin_keyword_loc
643
+ type: location?
644
+ - name: statements
645
+ type: node?
646
+ kind: StatementsNode
647
+ - name: rescue_clause
648
+ type: node?
649
+ kind: RescueNode
650
+ - name: else_clause
651
+ type: node?
652
+ kind: ElseNode
653
+ - name: ensure_clause
654
+ type: node?
655
+ kind: EnsureNode
656
+ - name: end_keyword_loc
657
+ type: location?
658
+ newline: false
659
+ comment: |
660
+ Represents a begin statement.
661
+
662
+ begin
663
+ foo
664
+ end
665
+ ^^^^^
666
+ - name: BlockArgumentNode
667
+ fields:
668
+ - name: expression
669
+ type: node?
670
+ - name: operator_loc
671
+ type: location
672
+ comment: |
673
+ Represents block method arguments.
674
+
675
+ bar(&args)
676
+ ^^^^^^^^^^
677
+ - name: BlockLocalVariableNode
678
+ fields:
679
+ - name: flags
680
+ type: flags
681
+ kind: ParameterFlags
682
+ - name: name
683
+ type: constant
684
+ comment: |
685
+ Represents a block local variable.
686
+
687
+ a { |; b| }
688
+ ^
689
+ - name: BlockNode
690
+ fields:
691
+ - name: locals
692
+ type: constant[]
693
+ - name: parameters
694
+ type: node?
695
+ - name: body
696
+ type: node?
697
+ - name: opening_loc
698
+ type: location
699
+ - name: closing_loc
700
+ type: location
701
+ comment: |
702
+ Represents a block of ruby code.
703
+
704
+ [1, 2, 3].each { |i| puts x }
705
+ ^^^^^^^^^^^^^^
706
+ - name: BlockParameterNode
707
+ fields:
708
+ - name: flags
709
+ type: flags
710
+ kind: ParameterFlags
711
+ - name: name
712
+ type: constant?
713
+ - name: name_loc
714
+ type: location?
715
+ - name: operator_loc
716
+ type: location
717
+ comment: |
718
+ Represents a block parameter to a method, block, or lambda definition.
719
+
720
+ def a(&b)
721
+ ^^
722
+ end
723
+ - name: BlockParametersNode
724
+ fields:
725
+ - name: parameters
726
+ type: node?
727
+ kind: ParametersNode
728
+ - name: locals
729
+ type: node[]
730
+ - name: opening_loc
731
+ type: location?
732
+ - name: closing_loc
733
+ type: location?
734
+ comment: |
735
+ Represents a block's parameters declaration.
736
+
737
+ -> (a, b = 1; local) { }
738
+ ^^^^^^^^^^^^^^^^^
739
+
740
+ foo do |a, b = 1; local|
741
+ ^^^^^^^^^^^^^^^^^
742
+ end
743
+ - name: BreakNode
744
+ fields:
745
+ - name: arguments
746
+ type: node?
747
+ kind: ArgumentsNode
748
+ - name: keyword_loc
749
+ type: location
750
+ comment: |
751
+ Represents the use of the `break` keyword.
752
+
753
+ break foo
754
+ ^^^^^^^^^
755
+ - name: CallAndWriteNode
756
+ fields:
757
+ - name: flags
758
+ type: flags
759
+ kind: CallNodeFlags
760
+ - name: receiver
761
+ type: node?
762
+ - name: call_operator_loc
763
+ type: location?
764
+ - name: message_loc
765
+ type: location?
766
+ - name: read_name
767
+ type: constant
768
+ - name: write_name
769
+ type: constant
770
+ - name: operator_loc
771
+ type: location
772
+ - name: value
773
+ type: node
774
+ comment: |
775
+ Represents the use of the `&&=` operator on a call.
776
+
777
+ foo.bar &&= value
778
+ ^^^^^^^^^^^^^^^^^
779
+ - name: CallNode
780
+ fields:
781
+ - name: flags
782
+ type: flags
783
+ kind: CallNodeFlags
784
+ - name: receiver
785
+ type: node?
786
+ comment: |
787
+ 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).
788
+
789
+ foo.bar
790
+ ^^^
791
+
792
+ +foo
793
+ ^^^
794
+
795
+ foo + bar
796
+ ^^^
797
+ - name: call_operator_loc
798
+ type: location?
799
+ - name: name
800
+ type: constant
801
+ - name: message_loc
802
+ type: location?
803
+ - name: opening_loc
804
+ type: location?
805
+ - name: arguments
806
+ type: node?
807
+ kind: ArgumentsNode
808
+ - name: closing_loc
809
+ type: location?
810
+ - name: block
811
+ type: node?
812
+ comment: |
813
+ Represents a method call, in all of the various forms that can take.
814
+
815
+ foo
816
+ ^^^
817
+
818
+ foo()
819
+ ^^^^^
820
+
821
+ +foo
822
+ ^^^^
823
+
824
+ foo + bar
825
+ ^^^^^^^^^
826
+
827
+ foo.bar
828
+ ^^^^^^^
829
+
830
+ foo&.bar
831
+ ^^^^^^^^
832
+ - name: CallOperatorWriteNode
833
+ fields:
834
+ - name: flags
835
+ type: flags
836
+ kind: CallNodeFlags
837
+ - name: receiver
838
+ type: node?
839
+ - name: call_operator_loc
840
+ type: location?
841
+ - name: message_loc
842
+ type: location?
843
+ - name: read_name
844
+ type: constant
845
+ - name: write_name
846
+ type: constant
847
+ - name: operator
848
+ type: constant
849
+ - name: operator_loc
850
+ type: location
851
+ - name: value
852
+ type: node
853
+ comment: |
854
+ Represents the use of an assignment operator on a call.
855
+
856
+ foo.bar += baz
857
+ ^^^^^^^^^^^^^^
858
+ - name: CallOrWriteNode
859
+ fields:
860
+ - name: flags
861
+ type: flags
862
+ kind: CallNodeFlags
863
+ - name: receiver
864
+ type: node?
865
+ - name: call_operator_loc
866
+ type: location?
867
+ - name: message_loc
868
+ type: location?
869
+ - name: read_name
870
+ type: constant
871
+ - name: write_name
872
+ type: constant
873
+ - name: operator_loc
874
+ type: location
875
+ - name: value
876
+ type: node
877
+ comment: |
878
+ Represents the use of the `||=` operator on a call.
879
+
880
+ foo.bar ||= value
881
+ ^^^^^^^^^^^^^^^^^
882
+ - name: CallTargetNode
883
+ fields:
884
+ - name: flags
885
+ type: flags
886
+ kind: CallNodeFlags
887
+ - name: receiver
888
+ type: node
889
+ - name: call_operator_loc
890
+ type: location
891
+ - name: name
892
+ type: constant
893
+ - name: message_loc
894
+ type: location
895
+ comment: |
896
+ Represents assigning to a method call.
897
+
898
+ foo.bar, = 1
899
+ ^^^^^^^
900
+
901
+ begin
902
+ rescue => foo.bar
903
+ ^^^^^^^
904
+ end
905
+
906
+ for foo.bar in baz do end
907
+ ^^^^^^^
908
+ - name: CapturePatternNode
909
+ fields:
910
+ - name: value
911
+ type: node
912
+ - name: target
913
+ type: node
914
+ - name: operator_loc
915
+ type: location
916
+ comment: |
917
+ Represents assigning to a local variable in pattern matching.
918
+
919
+ foo => [bar => baz]
920
+ ^^^^^^^^^^^^
921
+ - name: CaseMatchNode
922
+ fields:
923
+ - name: predicate
924
+ type: node?
925
+ - name: conditions
926
+ type: node[]
927
+ - name: consequent
928
+ type: node?
929
+ kind: ElseNode
930
+ - name: case_keyword_loc
931
+ type: location
932
+ - name: end_keyword_loc
933
+ type: location
934
+ comment: |
935
+ Represents the use of a case statement for pattern matching.
936
+
937
+ case true
938
+ in false
939
+ end
940
+ ^^^^^^^^^
941
+ - name: CaseNode
942
+ fields:
943
+ - name: predicate
944
+ type: node?
945
+ - name: conditions
946
+ type: node[]
947
+ - name: consequent
948
+ type: node?
949
+ kind: ElseNode
950
+ - name: case_keyword_loc
951
+ type: location
952
+ - name: end_keyword_loc
953
+ type: location
954
+ comment: |
955
+ Represents the use of a case statement.
956
+
957
+ case true
958
+ when false
959
+ end
960
+ ^^^^^^^^^^
961
+ - name: ClassNode
962
+ fields:
963
+ - name: locals
964
+ type: constant[]
965
+ - name: class_keyword_loc
966
+ type: location
967
+ - name: constant_path
968
+ type: node
969
+ - name: inheritance_operator_loc
970
+ type: location?
971
+ - name: superclass
972
+ type: node?
973
+ - name: body
974
+ type: node?
975
+ - name: end_keyword_loc
976
+ type: location
977
+ - name: name
978
+ type: constant
979
+ comment: |
980
+ Represents a class declaration involving the `class` keyword.
981
+
982
+ class Foo end
983
+ ^^^^^^^^^^^^^
984
+ - name: ClassVariableAndWriteNode
985
+ fields:
986
+ - name: name
987
+ type: constant
988
+ - name: name_loc
989
+ type: location
990
+ - name: operator_loc
991
+ type: location
992
+ - name: value
993
+ type: node
994
+ comment: |
995
+ Represents the use of the `&&=` operator for assignment to a class variable.
996
+
997
+ @@target &&= value
998
+ ^^^^^^^^^^^^^^^^^^
999
+ - name: ClassVariableOperatorWriteNode
1000
+ fields:
1001
+ - name: name
1002
+ type: constant
1003
+ - name: name_loc
1004
+ type: location
1005
+ - name: operator_loc
1006
+ type: location
1007
+ - name: value
1008
+ type: node
1009
+ - name: operator
1010
+ type: constant
1011
+ comment: |
1012
+ Represents assigning to a class variable using an operator that isn't `=`.
1013
+
1014
+ @@target += value
1015
+ ^^^^^^^^^^^^^^^^^
1016
+ - name: ClassVariableOrWriteNode
1017
+ fields:
1018
+ - name: name
1019
+ type: constant
1020
+ - name: name_loc
1021
+ type: location
1022
+ - name: operator_loc
1023
+ type: location
1024
+ - name: value
1025
+ type: node
1026
+ comment: |
1027
+ Represents the use of the `||=` operator for assignment to a class variable.
1028
+
1029
+ @@target ||= value
1030
+ ^^^^^^^^^^^^^^^^^^
1031
+ - name: ClassVariableReadNode
1032
+ fields:
1033
+ - name: name
1034
+ type: constant
1035
+ comment: |
1036
+ 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).
1037
+
1038
+ @@abc # name `:@@abc`
1039
+
1040
+ @@_test # name `:@@_test`
1041
+ comment: |
1042
+ Represents referencing a class variable.
1043
+
1044
+ @@foo
1045
+ ^^^^^
1046
+ - name: ClassVariableTargetNode
1047
+ fields:
1048
+ - name: name
1049
+ type: constant
1050
+ comment: |
1051
+ Represents writing to a class variable in a context that doesn't have an explicit value.
1052
+
1053
+ @@foo, @@bar = baz
1054
+ ^^^^^ ^^^^^
1055
+ - name: ClassVariableWriteNode
1056
+ fields:
1057
+ - name: name
1058
+ type: constant
1059
+ - name: name_loc
1060
+ type: location
1061
+ - name: value
1062
+ type: node
1063
+ - name: operator_loc
1064
+ type: location?
1065
+ comment: |
1066
+ Represents writing to a class variable.
1067
+
1068
+ @@foo = 1
1069
+ ^^^^^^^^^
1070
+ - name: ConstantAndWriteNode
1071
+ fields:
1072
+ - name: name
1073
+ type: constant
1074
+ - name: name_loc
1075
+ type: location
1076
+ - name: operator_loc
1077
+ type: location
1078
+ - name: value
1079
+ type: node
1080
+ comment: |
1081
+ Represents the use of the `&&=` operator for assignment to a constant.
1082
+
1083
+ Target &&= value
1084
+ ^^^^^^^^^^^^^^^^
1085
+ - name: ConstantOperatorWriteNode
1086
+ fields:
1087
+ - name: name
1088
+ type: constant
1089
+ - name: name_loc
1090
+ type: location
1091
+ - name: operator_loc
1092
+ type: location
1093
+ - name: value
1094
+ type: node
1095
+ - name: operator
1096
+ type: constant
1097
+ comment: |
1098
+ Represents assigning to a constant using an operator that isn't `=`.
1099
+
1100
+ Target += value
1101
+ ^^^^^^^^^^^^^^^
1102
+ - name: ConstantOrWriteNode
1103
+ fields:
1104
+ - name: name
1105
+ type: constant
1106
+ - name: name_loc
1107
+ type: location
1108
+ - name: operator_loc
1109
+ type: location
1110
+ - name: value
1111
+ type: node
1112
+ comment: |
1113
+ Represents the use of the `||=` operator for assignment to a constant.
1114
+
1115
+ Target ||= value
1116
+ ^^^^^^^^^^^^^^^^
1117
+ - name: ConstantPathAndWriteNode
1118
+ fields:
1119
+ - name: target
1120
+ type: node
1121
+ kind: ConstantPathNode
1122
+ - name: operator_loc
1123
+ type: location
1124
+ - name: value
1125
+ type: node
1126
+ comment: |
1127
+ Represents the use of the `&&=` operator for assignment to a constant path.
1128
+
1129
+ Parent::Child &&= value
1130
+ ^^^^^^^^^^^^^^^^^^^^^^^
1131
+ - name: ConstantPathNode
1132
+ fields:
1133
+ - name: parent
1134
+ type: node?
1135
+ - name: child
1136
+ type: node
1137
+ - name: delimiter_loc
1138
+ type: location
1139
+ comment: |
1140
+ Represents accessing a constant through a path of `::` operators.
1141
+
1142
+ Foo::Bar
1143
+ ^^^^^^^^
1144
+ - name: ConstantPathOperatorWriteNode
1145
+ fields:
1146
+ - name: target
1147
+ type: node
1148
+ kind: ConstantPathNode
1149
+ - name: operator_loc
1150
+ type: location
1151
+ - name: value
1152
+ type: node
1153
+ - name: operator
1154
+ type: constant
1155
+ comment: |
1156
+ Represents assigning to a constant path using an operator that isn't `=`.
1157
+
1158
+ Parent::Child += value
1159
+ ^^^^^^^^^^^^^^^^^^^^^^
1160
+ - name: ConstantPathOrWriteNode
1161
+ fields:
1162
+ - name: target
1163
+ type: node
1164
+ kind: ConstantPathNode
1165
+ - name: operator_loc
1166
+ type: location
1167
+ - name: value
1168
+ type: node
1169
+ comment: |
1170
+ Represents the use of the `||=` operator for assignment to a constant path.
1171
+
1172
+ Parent::Child ||= value
1173
+ ^^^^^^^^^^^^^^^^^^^^^^^
1174
+ - name: ConstantPathTargetNode
1175
+ fields:
1176
+ - name: parent
1177
+ type: node?
1178
+ - name: child
1179
+ type: node
1180
+ - name: delimiter_loc
1181
+ type: location
1182
+ comment: |
1183
+ Represents writing to a constant path in a context that doesn't have an explicit value.
1184
+
1185
+ Foo::Foo, Bar::Bar = baz
1186
+ ^^^^^^^^ ^^^^^^^^
1187
+ - name: ConstantPathWriteNode
1188
+ fields:
1189
+ - name: target
1190
+ type: node
1191
+ kind: ConstantPathNode
1192
+ - name: operator_loc
1193
+ type: location
1194
+ - name: value
1195
+ type: node
1196
+ comment: |
1197
+ Represents writing to a constant path.
1198
+
1199
+ ::Foo = 1
1200
+ ^^^^^^^^^
1201
+
1202
+ Foo::Bar = 1
1203
+ ^^^^^^^^^^^^
1204
+
1205
+ ::Foo::Bar = 1
1206
+ ^^^^^^^^^^^^^^
1207
+ - name: ConstantReadNode
1208
+ fields:
1209
+ - name: name
1210
+ type: constant
1211
+ comment: |
1212
+ The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
1213
+
1214
+ X # name `:X`
1215
+
1216
+ SOME_CONSTANT # name `:SOME_CONSTANT`
1217
+ comment: |
1218
+ Represents referencing a constant.
1219
+
1220
+ Foo
1221
+ ^^^
1222
+ - name: ConstantTargetNode
1223
+ fields:
1224
+ - name: name
1225
+ type: constant
1226
+ comment: |
1227
+ Represents writing to a constant in a context that doesn't have an explicit value.
1228
+
1229
+ Foo, Bar = baz
1230
+ ^^^ ^^^
1231
+ - name: ConstantWriteNode
1232
+ fields:
1233
+ - name: name
1234
+ type: constant
1235
+ - name: name_loc
1236
+ type: location
1237
+ - name: value
1238
+ type: node
1239
+ - name: operator_loc
1240
+ type: location
1241
+ comment: |
1242
+ Represents writing to a constant.
1243
+
1244
+ Foo = 1
1245
+ ^^^^^^^
1246
+ - name: DefNode
1247
+ fields:
1248
+ - name: name
1249
+ type: constant
1250
+ - name: name_loc
1251
+ type: location
1252
+ - name: receiver
1253
+ type: node?
1254
+ - name: parameters
1255
+ type: node?
1256
+ kind: ParametersNode
1257
+ - name: body
1258
+ type: node?
1259
+ - name: locals
1260
+ type: constant[]
1261
+ - name: def_keyword_loc
1262
+ type: location
1263
+ - name: operator_loc
1264
+ type: location?
1265
+ - name: lparen_loc
1266
+ type: location?
1267
+ - name: rparen_loc
1268
+ type: location?
1269
+ - name: equal_loc
1270
+ type: location?
1271
+ - name: end_keyword_loc
1272
+ type: location?
1273
+ comment: |
1274
+ Represents a method definition.
1275
+
1276
+ def method
1277
+ end
1278
+ ^^^^^^^^^^
1279
+ - name: DefinedNode
1280
+ fields:
1281
+ - name: lparen_loc
1282
+ type: location?
1283
+ - name: value
1284
+ type: node
1285
+ - name: rparen_loc
1286
+ type: location?
1287
+ - name: keyword_loc
1288
+ type: location
1289
+ comment: |
1290
+ Represents the use of the `defined?` keyword.
1291
+
1292
+ defined?(a)
1293
+ ^^^^^^^^^^^
1294
+ - name: ElseNode
1295
+ fields:
1296
+ - name: else_keyword_loc
1297
+ type: location
1298
+ - name: statements
1299
+ type: node?
1300
+ kind: StatementsNode
1301
+ - name: end_keyword_loc
1302
+ type: location?
1303
+ comment: |
1304
+ Represents an `else` clause in a `case`, `if`, or `unless` statement.
1305
+
1306
+ if a then b else c end
1307
+ ^^^^^^^^^^
1308
+ - name: EmbeddedStatementsNode
1309
+ fields:
1310
+ - name: opening_loc
1311
+ type: location
1312
+ - name: statements
1313
+ type: node?
1314
+ kind: StatementsNode
1315
+ - name: closing_loc
1316
+ type: location
1317
+ comment: |
1318
+ Represents an interpolated set of statements.
1319
+
1320
+ "foo #{bar}"
1321
+ ^^^^^^
1322
+ - name: EmbeddedVariableNode
1323
+ fields:
1324
+ - name: operator_loc
1325
+ type: location
1326
+ - name: variable
1327
+ type: node
1328
+ comment: |
1329
+ Represents an interpolated variable.
1330
+
1331
+ "foo #@bar"
1332
+ ^^^^^
1333
+ - name: EnsureNode
1334
+ fields:
1335
+ - name: ensure_keyword_loc
1336
+ type: location
1337
+ - name: statements
1338
+ type: node?
1339
+ kind: StatementsNode
1340
+ - name: end_keyword_loc
1341
+ type: location
1342
+ comment: |
1343
+ Represents an `ensure` clause in a `begin` statement.
1344
+
1345
+ begin
1346
+ foo
1347
+ ensure
1348
+ ^^^^^^
1349
+ bar
1350
+ end
1351
+ - name: FalseNode
1352
+ comment: |
1353
+ Represents the use of the literal `false` keyword.
1354
+
1355
+ false
1356
+ ^^^^^
1357
+ - name: FindPatternNode
1358
+ fields:
1359
+ - name: constant
1360
+ type: node?
1361
+ - name: left
1362
+ type: node
1363
+ - name: requireds
1364
+ type: node[]
1365
+ - name: right
1366
+ type: node
1367
+ - name: opening_loc
1368
+ type: location?
1369
+ - name: closing_loc
1370
+ type: location?
1371
+ comment: |
1372
+ Represents a find pattern in pattern matching.
1373
+
1374
+ foo in *bar, baz, *qux
1375
+ ^^^^^^^^^^^^^^^
1376
+
1377
+ foo in [*bar, baz, *qux]
1378
+ ^^^^^^^^^^^^^^^^^
1379
+
1380
+ foo in Foo(*bar, baz, *qux)
1381
+ ^^^^^^^^^^^^^^^^^^^^
1382
+ - name: FlipFlopNode
1383
+ fields:
1384
+ - name: flags
1385
+ type: flags
1386
+ kind: RangeFlags
1387
+ - name: left
1388
+ type: node?
1389
+ - name: right
1390
+ type: node?
1391
+ - name: operator_loc
1392
+ type: location
1393
+ comment: |
1394
+ Represents the use of the `..` or `...` operators to create flip flops.
1395
+
1396
+ baz if foo .. bar
1397
+ ^^^^^^^^^^
1398
+ - name: FloatNode
1399
+ comment: |
1400
+ Represents a floating point number literal.
1401
+
1402
+ 1.0
1403
+ ^^^
1404
+ - name: ForNode
1405
+ fields:
1406
+ - name: index
1407
+ type: node
1408
+ - name: collection
1409
+ type: node
1410
+ - name: statements
1411
+ type: node?
1412
+ kind: StatementsNode
1413
+ - name: for_keyword_loc
1414
+ type: location
1415
+ - name: in_keyword_loc
1416
+ type: location
1417
+ - name: do_keyword_loc
1418
+ type: location?
1419
+ - name: end_keyword_loc
1420
+ type: location
1421
+ comment: |
1422
+ Represents the use of the `for` keyword.
1423
+
1424
+ for i in a end
1425
+ ^^^^^^^^^^^^^^
1426
+ - name: ForwardingArgumentsNode
1427
+ comment: |
1428
+ Represents forwarding all arguments to this method to another method.
1429
+
1430
+ def foo(...)
1431
+ bar(...)
1432
+ ^^^
1433
+ end
1434
+ - name: ForwardingParameterNode
1435
+ comment: |
1436
+ Represents the use of the forwarding parameter in a method, block, or lambda declaration.
1437
+
1438
+ def foo(...)
1439
+ ^^^
1440
+ end
1441
+ - name: ForwardingSuperNode
1442
+ fields:
1443
+ - name: block
1444
+ type: node?
1445
+ kind: BlockNode
1446
+ comment: |
1447
+ Represents the use of the `super` keyword without parentheses or arguments.
1448
+
1449
+ super
1450
+ ^^^^^
1451
+ - name: GlobalVariableAndWriteNode
1452
+ fields:
1453
+ - name: name
1454
+ type: constant
1455
+ - name: name_loc
1456
+ type: location
1457
+ - name: operator_loc
1458
+ type: location
1459
+ - name: value
1460
+ type: node
1461
+ comment: |
1462
+ Represents the use of the `&&=` operator for assignment to a global variable.
1463
+
1464
+ $target &&= value
1465
+ ^^^^^^^^^^^^^^^^^
1466
+ - name: GlobalVariableOperatorWriteNode
1467
+ fields:
1468
+ - name: name
1469
+ type: constant
1470
+ - name: name_loc
1471
+ type: location
1472
+ - name: operator_loc
1473
+ type: location
1474
+ - name: value
1475
+ type: node
1476
+ - name: operator
1477
+ type: constant
1478
+ comment: |
1479
+ Represents assigning to a global variable using an operator that isn't `=`.
1480
+
1481
+ $target += value
1482
+ ^^^^^^^^^^^^^^^^
1483
+ - name: GlobalVariableOrWriteNode
1484
+ fields:
1485
+ - name: name
1486
+ type: constant
1487
+ - name: name_loc
1488
+ type: location
1489
+ - name: operator_loc
1490
+ type: location
1491
+ - name: value
1492
+ type: node
1493
+ comment: |
1494
+ Represents the use of the `||=` operator for assignment to a global variable.
1495
+
1496
+ $target ||= value
1497
+ ^^^^^^^^^^^^^^^^^
1498
+ - name: GlobalVariableReadNode
1499
+ fields:
1500
+ - name: name
1501
+ type: constant
1502
+ comment: |
1503
+ 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.
1504
+
1505
+ $foo # name `:$foo`
1506
+
1507
+ $_Test # name `:$_Test`
1508
+ comment: |
1509
+ Represents referencing a global variable.
1510
+
1511
+ $foo
1512
+ ^^^^
1513
+ - name: GlobalVariableTargetNode
1514
+ fields:
1515
+ - name: name
1516
+ type: constant
1517
+ comment: |
1518
+ Represents writing to a global variable in a context that doesn't have an explicit value.
1519
+
1520
+ $foo, $bar = baz
1521
+ ^^^^ ^^^^
1522
+ - name: GlobalVariableWriteNode
1523
+ fields:
1524
+ - name: name
1525
+ type: constant
1526
+ - name: name_loc
1527
+ type: location
1528
+ - name: value
1529
+ type: node
1530
+ - name: operator_loc
1531
+ type: location
1532
+ comment: |
1533
+ Represents writing to a global variable.
1534
+
1535
+ $foo = 1
1536
+ ^^^^^^^^
1537
+ - name: HashNode
1538
+ fields:
1539
+ - name: opening_loc
1540
+ type: location
1541
+ comment: |
1542
+ The location of the opening brace.
1543
+
1544
+ { a => b }
1545
+ ^
1546
+ - name: elements
1547
+ type: node[]
1548
+ comment: |
1549
+ The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
1550
+
1551
+ { a: b }
1552
+ ^^^^
1553
+
1554
+ { **foo }
1555
+ ^^^^^
1556
+ - name: closing_loc
1557
+ type: location
1558
+ comment: |
1559
+ The location of the closing brace.
1560
+
1561
+ { a => b }
1562
+ ^
1563
+ comment: |
1564
+ Represents a hash literal.
1565
+
1566
+ { a => b }
1567
+ ^^^^^^^^^^
1568
+ - name: HashPatternNode
1569
+ fields:
1570
+ - name: constant
1571
+ type: node?
1572
+ - name: elements
1573
+ type: node[]
1574
+ - name: rest
1575
+ type: node?
1576
+ - name: opening_loc
1577
+ type: location?
1578
+ - name: closing_loc
1579
+ type: location?
1580
+ comment: |
1581
+ Represents a hash pattern in pattern matching.
1582
+
1583
+ foo => { a: 1, b: 2 }
1584
+ ^^^^^^^^^^^^^^
1585
+
1586
+ foo => { a: 1, b: 2, **c }
1587
+ ^^^^^^^^^^^^^^^^^^^
1588
+ - name: IfNode
1589
+ fields:
1590
+ - name: if_keyword_loc
1591
+ type: location?
1592
+ - name: predicate
1593
+ type: node
1594
+ - name: then_keyword_loc
1595
+ type: location?
1596
+ - name: statements
1597
+ type: node?
1598
+ kind: StatementsNode
1599
+ - name: consequent
1600
+ type: node?
1601
+ - name: end_keyword_loc
1602
+ type: location?
1603
+ newline: predicate
1604
+ comment: |
1605
+ Represents the use of the `if` keyword, either in the block form or the modifier form.
1606
+
1607
+ bar if foo
1608
+ ^^^^^^^^^^
1609
+
1610
+ if foo then bar end
1611
+ ^^^^^^^^^^^^^^^^^^^
1612
+ - name: ImaginaryNode
1613
+ fields:
1614
+ - name: numeric
1615
+ type: node
1616
+ comment: |
1617
+ Represents an imaginary number literal.
1618
+
1619
+ 1.0i
1620
+ ^^^^
1621
+ - name: ImplicitNode
1622
+ fields:
1623
+ - name: value
1624
+ type: node
1625
+ comment: |
1626
+ Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
1627
+
1628
+ { foo: }
1629
+ ^^^^
1630
+
1631
+ { Foo: }
1632
+ ^^^^
1633
+
1634
+ foo in { bar: }
1635
+ ^^^^
1636
+ - name: ImplicitRestNode
1637
+ comment: |
1638
+ Represents using a trailing comma to indicate an implicit rest parameter.
1639
+
1640
+ foo { |bar,| }
1641
+ ^
1642
+
1643
+ foo in [bar,]
1644
+ ^
1645
+
1646
+ for foo, in bar do end
1647
+ ^
1648
+
1649
+ foo, = bar
1650
+ ^
1651
+ - name: InNode
1652
+ fields:
1653
+ - name: pattern
1654
+ type: node
1655
+ - name: statements
1656
+ type: node?
1657
+ kind: StatementsNode
1658
+ - name: in_loc
1659
+ type: location
1660
+ - name: then_loc
1661
+ type: location?
1662
+ comment: |
1663
+ Represents the use of the `in` keyword in a case statement.
1664
+
1665
+ case a; in b then c end
1666
+ ^^^^^^^^^^^
1667
+ - name: IndexAndWriteNode
1668
+ fields:
1669
+ - name: flags
1670
+ type: flags
1671
+ kind: CallNodeFlags
1672
+ - name: receiver
1673
+ type: node?
1674
+ - name: call_operator_loc
1675
+ type: location?
1676
+ - name: opening_loc
1677
+ type: location
1678
+ - name: arguments
1679
+ type: node?
1680
+ kind: ArgumentsNode
1681
+ - name: closing_loc
1682
+ type: location
1683
+ - name: block
1684
+ type: node?
1685
+ - name: operator_loc
1686
+ type: location
1687
+ - name: value
1688
+ type: node
1689
+ comment: |
1690
+ Represents the use of the `&&=` operator on a call to the `[]` method.
1691
+
1692
+ foo.bar[baz] &&= value
1693
+ ^^^^^^^^^^^^^^^^^^^^^^
1694
+ - name: IndexOperatorWriteNode
1695
+ fields:
1696
+ - name: flags
1697
+ type: flags
1698
+ kind: CallNodeFlags
1699
+ - name: receiver
1700
+ type: node?
1701
+ - name: call_operator_loc
1702
+ type: location?
1703
+ - name: opening_loc
1704
+ type: location
1705
+ - name: arguments
1706
+ type: node?
1707
+ kind: ArgumentsNode
1708
+ - name: closing_loc
1709
+ type: location
1710
+ - name: block
1711
+ type: node?
1712
+ - name: operator
1713
+ type: constant
1714
+ - name: operator_loc
1715
+ type: location
1716
+ - name: value
1717
+ type: node
1718
+ comment: |
1719
+ Represents the use of an assignment operator on a call to `[]`.
1720
+
1721
+ foo.bar[baz] += value
1722
+ ^^^^^^^^^^^^^^^^^^^^^
1723
+ - name: IndexOrWriteNode
1724
+ fields:
1725
+ - name: flags
1726
+ type: flags
1727
+ kind: CallNodeFlags
1728
+ - name: receiver
1729
+ type: node?
1730
+ - name: call_operator_loc
1731
+ type: location?
1732
+ - name: opening_loc
1733
+ type: location
1734
+ - name: arguments
1735
+ type: node?
1736
+ kind: ArgumentsNode
1737
+ - name: closing_loc
1738
+ type: location
1739
+ - name: block
1740
+ type: node?
1741
+ - name: operator_loc
1742
+ type: location
1743
+ - name: value
1744
+ type: node
1745
+ comment: |
1746
+ Represents the use of the `||=` operator on a call to `[]`.
1747
+
1748
+ foo.bar[baz] ||= value
1749
+ ^^^^^^^^^^^^^^^^^^^^^^
1750
+ - name: IndexTargetNode
1751
+ fields:
1752
+ - name: flags
1753
+ type: flags
1754
+ kind: CallNodeFlags
1755
+ - name: receiver
1756
+ type: node
1757
+ - name: opening_loc
1758
+ type: location
1759
+ - name: arguments
1760
+ type: node?
1761
+ kind: ArgumentsNode
1762
+ - name: closing_loc
1763
+ type: location
1764
+ - name: block
1765
+ type: node?
1766
+ comment: |
1767
+ Represents assigning to an index.
1768
+
1769
+ foo[bar], = 1
1770
+ ^^^^^^^^
1771
+
1772
+ begin
1773
+ rescue => foo[bar]
1774
+ ^^^^^^^^
1775
+ end
1776
+
1777
+ for foo[bar] in baz do end
1778
+ ^^^^^^^^
1779
+ - name: InstanceVariableAndWriteNode
1780
+ fields:
1781
+ - name: name
1782
+ type: constant
1783
+ - name: name_loc
1784
+ type: location
1785
+ - name: operator_loc
1786
+ type: location
1787
+ - name: value
1788
+ type: node
1789
+ comment: |
1790
+ Represents the use of the `&&=` operator for assignment to an instance variable.
1791
+
1792
+ @target &&= value
1793
+ ^^^^^^^^^^^^^^^^^
1794
+ - name: InstanceVariableOperatorWriteNode
1795
+ fields:
1796
+ - name: name
1797
+ type: constant
1798
+ - name: name_loc
1799
+ type: location
1800
+ - name: operator_loc
1801
+ type: location
1802
+ - name: value
1803
+ type: node
1804
+ - name: operator
1805
+ type: constant
1806
+ comment: |
1807
+ Represents assigning to an instance variable using an operator that isn't `=`.
1808
+
1809
+ @target += value
1810
+ ^^^^^^^^^^^^^^^^
1811
+ - name: InstanceVariableOrWriteNode
1812
+ fields:
1813
+ - name: name
1814
+ type: constant
1815
+ - name: name_loc
1816
+ type: location
1817
+ - name: operator_loc
1818
+ type: location
1819
+ - name: value
1820
+ type: node
1821
+ comment: |
1822
+ Represents the use of the `||=` operator for assignment to an instance variable.
1823
+
1824
+ @target ||= value
1825
+ ^^^^^^^^^^^^^^^^^
1826
+ - name: InstanceVariableReadNode
1827
+ fields:
1828
+ - name: name
1829
+ type: constant
1830
+ comment: |
1831
+ 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).
1832
+
1833
+ @x # name `:@x`
1834
+
1835
+ @_test # name `:@_test`
1836
+ comment: |
1837
+ Represents referencing an instance variable.
1838
+
1839
+ @foo
1840
+ ^^^^
1841
+ - name: InstanceVariableTargetNode
1842
+ fields:
1843
+ - name: name
1844
+ type: constant
1845
+ comment: |
1846
+ Represents writing to an instance variable in a context that doesn't have an explicit value.
1847
+
1848
+ @foo, @bar = baz
1849
+ ^^^^ ^^^^
1850
+ - name: InstanceVariableWriteNode
1851
+ fields:
1852
+ - name: name
1853
+ type: constant
1854
+ - name: name_loc
1855
+ type: location
1856
+ - name: value
1857
+ type: node
1858
+ - name: operator_loc
1859
+ type: location
1860
+ comment: |
1861
+ Represents writing to an instance variable.
1862
+
1863
+ @foo = 1
1864
+ ^^^^^^^^
1865
+ - name: IntegerNode
1866
+ fields:
1867
+ - name: flags
1868
+ type: flags
1869
+ kind: IntegerBaseFlags
1870
+ comment: |
1871
+ Represents an integer number literal.
1872
+
1873
+ 1
1874
+ ^
1875
+ - name: InterpolatedMatchLastLineNode
1876
+ fields:
1877
+ - name: flags
1878
+ type: flags
1879
+ kind: RegularExpressionFlags
1880
+ - name: opening_loc
1881
+ type: location
1882
+ - name: parts
1883
+ type: node[]
1884
+ - name: closing_loc
1885
+ type: location
1886
+ newline: parts
1887
+ comment: |
1888
+ 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.
1889
+
1890
+ if /foo #{bar} baz/ then end
1891
+ ^^^^^^^^^^^^^^^^
1892
+ - name: InterpolatedRegularExpressionNode
1893
+ fields:
1894
+ - name: flags
1895
+ type: flags
1896
+ kind: RegularExpressionFlags
1897
+ - name: opening_loc
1898
+ type: location
1899
+ - name: parts
1900
+ type: node[]
1901
+ - name: closing_loc
1902
+ type: location
1903
+ newline: parts
1904
+ comment: |
1905
+ Represents a regular expression literal that contains interpolation.
1906
+
1907
+ /foo #{bar} baz/
1908
+ ^^^^^^^^^^^^^^^^
1909
+ - name: InterpolatedStringNode
1910
+ fields:
1911
+ - name: opening_loc
1912
+ type: location?
1913
+ - name: parts
1914
+ type: node[]
1915
+ - name: closing_loc
1916
+ type: location?
1917
+ newline: parts
1918
+ comment: |
1919
+ Represents a string literal that contains interpolation.
1920
+
1921
+ "foo #{bar} baz"
1922
+ ^^^^^^^^^^^^^^^^
1923
+ - name: InterpolatedSymbolNode
1924
+ fields:
1925
+ - name: opening_loc
1926
+ type: location?
1927
+ - name: parts
1928
+ type: node[]
1929
+ - name: closing_loc
1930
+ type: location?
1931
+ newline: parts
1932
+ comment: |
1933
+ Represents a symbol literal that contains interpolation.
1934
+
1935
+ :"foo #{bar} baz"
1936
+ ^^^^^^^^^^^^^^^^^
1937
+ - name: InterpolatedXStringNode
1938
+ fields:
1939
+ - name: opening_loc
1940
+ type: location
1941
+ - name: parts
1942
+ type: node[]
1943
+ - name: closing_loc
1944
+ type: location
1945
+ newline: parts
1946
+ comment: |
1947
+ Represents an xstring literal that contains interpolation.
1948
+
1949
+ `foo #{bar} baz`
1950
+ ^^^^^^^^^^^^^^^^
1951
+ - name: KeywordHashNode
1952
+ fields:
1953
+ - name: flags
1954
+ type: flags
1955
+ kind: KeywordHashNodeFlags
1956
+ - name: elements
1957
+ type: node[]
1958
+ comment: |
1959
+ Represents a hash literal without opening and closing braces.
1960
+
1961
+ foo(a: b)
1962
+ ^^^^
1963
+ - name: KeywordRestParameterNode
1964
+ fields:
1965
+ - name: flags
1966
+ type: flags
1967
+ kind: ParameterFlags
1968
+ - name: name
1969
+ type: constant?
1970
+ - name: name_loc
1971
+ type: location?
1972
+ - name: operator_loc
1973
+ type: location
1974
+ comment: |
1975
+ Represents a keyword rest parameter to a method, block, or lambda definition.
1976
+
1977
+ def a(**b)
1978
+ ^^^
1979
+ end
1980
+ - name: LambdaNode
1981
+ fields:
1982
+ - name: locals
1983
+ type: constant[]
1984
+ - name: operator_loc
1985
+ type: location
1986
+ - name: opening_loc
1987
+ type: location
1988
+ - name: closing_loc
1989
+ type: location
1990
+ - name: parameters
1991
+ type: node?
1992
+ - name: body
1993
+ type: node?
1994
+ comment: |
1995
+ Represents using a lambda literal (not the lambda method call).
1996
+
1997
+ ->(value) { value * 2 }
1998
+ ^^^^^^^^^^^^^^^^^^^^^^^
1999
+ - name: LocalVariableAndWriteNode
2000
+ fields:
2001
+ - name: name_loc
2002
+ type: location
2003
+ - name: operator_loc
2004
+ type: location
2005
+ - name: value
2006
+ type: node
2007
+ - name: name
2008
+ type: constant
2009
+ - name: depth
2010
+ type: uint32
2011
+ comment: |
2012
+ Represents the use of the `&&=` operator for assignment to a local variable.
2013
+
2014
+ target &&= value
2015
+ ^^^^^^^^^^^^^^^^
2016
+ - name: LocalVariableOperatorWriteNode
2017
+ fields:
2018
+ - name: name_loc
2019
+ type: location
2020
+ - name: operator_loc
2021
+ type: location
2022
+ - name: value
2023
+ type: node
2024
+ - name: name
2025
+ type: constant
2026
+ - name: operator
2027
+ type: constant
2028
+ - name: depth
2029
+ type: uint32
2030
+ comment: |
2031
+ Represents assigning to a local variable using an operator that isn't `=`.
2032
+
2033
+ target += value
2034
+ ^^^^^^^^^^^^^^^
2035
+ - name: LocalVariableOrWriteNode
2036
+ fields:
2037
+ - name: name_loc
2038
+ type: location
2039
+ - name: operator_loc
2040
+ type: location
2041
+ - name: value
2042
+ type: node
2043
+ - name: name
2044
+ type: constant
2045
+ - name: depth
2046
+ type: uint32
2047
+ comment: |
2048
+ Represents the use of the `||=` operator for assignment to a local variable.
2049
+
2050
+ target ||= value
2051
+ ^^^^^^^^^^^^^^^^
2052
+ - name: LocalVariableReadNode
2053
+ fields:
2054
+ - name: name
2055
+ type: constant
2056
+ comment: |
2057
+ The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
2058
+
2059
+ x # name `:x`
2060
+
2061
+ _Test # name `:_Test`
2062
+
2063
+ Note that this can also be an underscore followed by a number for the default block parameters.
2064
+
2065
+ _1 # name `:_1`
2066
+
2067
+ Finally, for the default `it` block parameter, the name is `0it`. This is to distinguish it from an `it` local variable that is explicitly declared.
2068
+
2069
+ it # name `:0it`
2070
+
2071
+ - name: depth
2072
+ type: uint32
2073
+ comment: |
2074
+ The number of visible scopes that should be searched to find the origin of this local variable.
2075
+
2076
+ foo = 1; foo # depth 0
2077
+
2078
+ bar = 2; tap { bar } # depth 1
2079
+
2080
+ 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).
2081
+ comment: |
2082
+ 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.
2083
+
2084
+ foo
2085
+ ^^^
2086
+ - name: LocalVariableTargetNode
2087
+ fields:
2088
+ - name: name
2089
+ type: constant
2090
+ - name: depth
2091
+ type: uint32
2092
+ comment: |
2093
+ Represents writing to a local variable in a context that doesn't have an explicit value.
2094
+
2095
+ foo, bar = baz
2096
+ ^^^ ^^^
2097
+ - name: LocalVariableWriteNode
2098
+ fields:
2099
+ - name: name
2100
+ type: constant
2101
+ - name: depth
2102
+ type: uint32
2103
+ - name: name_loc
2104
+ type: location
2105
+ - name: value
2106
+ type: node
2107
+ - name: operator_loc
2108
+ type: location
2109
+ comment: |
2110
+ Represents writing to a local variable.
2111
+
2112
+ foo = 1
2113
+ ^^^^^^^
2114
+ - name: MatchLastLineNode
2115
+ fields:
2116
+ - name: flags
2117
+ type: flags
2118
+ kind: RegularExpressionFlags
2119
+ - name: opening_loc
2120
+ type: location
2121
+ - name: content_loc
2122
+ type: location
2123
+ - name: closing_loc
2124
+ type: location
2125
+ - name: unescaped
2126
+ type: string
2127
+ comment: |
2128
+ Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
2129
+
2130
+ if /foo/i then end
2131
+ ^^^^^^
2132
+ - name: MatchPredicateNode
2133
+ fields:
2134
+ - name: value
2135
+ type: node
2136
+ - name: pattern
2137
+ type: node
2138
+ - name: operator_loc
2139
+ type: location
2140
+ comment: |
2141
+ Represents the use of the modifier `in` operator.
2142
+
2143
+ foo in bar
2144
+ ^^^^^^^^^^
2145
+ - name: MatchRequiredNode
2146
+ fields:
2147
+ - name: value
2148
+ type: node
2149
+ - name: pattern
2150
+ type: node
2151
+ - name: operator_loc
2152
+ type: location
2153
+ comment: |
2154
+ Represents the use of the `=>` operator.
2155
+
2156
+ foo => bar
2157
+ ^^^^^^^^^^
2158
+ - name: MatchWriteNode
2159
+ fields:
2160
+ - name: call
2161
+ type: node
2162
+ kind: CallNode
2163
+ - name: targets
2164
+ type: node[]
2165
+ comment: |
2166
+ Represents writing local variables using a regular expression match with named capture groups.
2167
+
2168
+ /(?<foo>bar)/ =~ baz
2169
+ ^^^^^^^^^^^^^^^^^^^^
2170
+ - name: MissingNode
2171
+ comment: |
2172
+ Represents a node that is missing from the source and results in a syntax error.
2173
+ - name: ModuleNode
2174
+ fields:
2175
+ - name: locals
2176
+ type: constant[]
2177
+ - name: module_keyword_loc
2178
+ type: location
2179
+ - name: constant_path
2180
+ type: node
2181
+ - name: body
2182
+ type: node?
2183
+ - name: end_keyword_loc
2184
+ type: location
2185
+ - name: name
2186
+ type: constant
2187
+ comment: |
2188
+ Represents a module declaration involving the `module` keyword.
2189
+
2190
+ module Foo end
2191
+ ^^^^^^^^^^^^^^
2192
+ - name: MultiTargetNode
2193
+ fields:
2194
+ - name: lefts
2195
+ type: node[]
2196
+ - name: rest
2197
+ type: node?
2198
+ - name: rights
2199
+ type: node[]
2200
+ - name: lparen_loc
2201
+ type: location?
2202
+ - name: rparen_loc
2203
+ type: location?
2204
+ comment: |
2205
+ Represents a multi-target expression.
2206
+
2207
+ a, (b, c) = 1, 2, 3
2208
+ ^^^^^^
2209
+ - name: MultiWriteNode
2210
+ fields:
2211
+ - name: lefts
2212
+ type: node[]
2213
+ - name: rest
2214
+ type: node?
2215
+ - name: rights
2216
+ type: node[]
2217
+ - name: lparen_loc
2218
+ type: location?
2219
+ - name: rparen_loc
2220
+ type: location?
2221
+ - name: operator_loc
2222
+ type: location
2223
+ - name: value
2224
+ type: node
2225
+ comment: |
2226
+ Represents a write to a multi-target expression.
2227
+
2228
+ a, b, c = 1, 2, 3
2229
+ ^^^^^^^^^^^^^^^^^
2230
+ - name: NextNode
2231
+ fields:
2232
+ - name: arguments
2233
+ type: node?
2234
+ kind: ArgumentsNode
2235
+ - name: keyword_loc
2236
+ type: location
2237
+ comment: |
2238
+ Represents the use of the `next` keyword.
2239
+
2240
+ next 1
2241
+ ^^^^^^
2242
+ - name: NilNode
2243
+ comment: |
2244
+ Represents the use of the `nil` keyword.
2245
+
2246
+ nil
2247
+ ^^^
2248
+ - name: NoKeywordsParameterNode
2249
+ fields:
2250
+ - name: operator_loc
2251
+ type: location
2252
+ - name: keyword_loc
2253
+ type: location
2254
+ comment: |
2255
+ Represents the use of `**nil` inside method arguments.
2256
+
2257
+ def a(**nil)
2258
+ ^^^^^
2259
+ end
2260
+ - name: NumberedParametersNode
2261
+ fields:
2262
+ - name: maximum
2263
+ type: uint8
2264
+ comment: |
2265
+ Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
2266
+
2267
+ -> { _1 + _2 }
2268
+ ^^^^^^^^^^^^^^
2269
+ - name: NumberedReferenceReadNode
2270
+ fields:
2271
+ - name: number
2272
+ type: uint32
2273
+ comment: |
2274
+ The (1-indexed, from the left) number of the capture group. Numbered references that would overflow a `uint32` result in a `number` of exactly `2**32 - 1`.
2275
+
2276
+ $1 # number `1`
2277
+
2278
+ $5432 # number `5432`
2279
+
2280
+ $4294967296 # number `4294967295`
2281
+ comment: |
2282
+ Represents reading a numbered reference to a capture in the previous match.
2283
+
2284
+ $1
2285
+ ^^
2286
+ - name: OptionalKeywordParameterNode
2287
+ fields:
2288
+ - name: flags
2289
+ type: flags
2290
+ kind: ParameterFlags
2291
+ - name: name
2292
+ type: constant
2293
+ - name: name_loc
2294
+ type: location
2295
+ - name: value
2296
+ type: node
2297
+ comment: |
2298
+ Represents an optional keyword parameter to a method, block, or lambda definition.
2299
+
2300
+ def a(b: 1)
2301
+ ^^^^
2302
+ end
2303
+ - name: OptionalParameterNode
2304
+ fields:
2305
+ - name: flags
2306
+ type: flags
2307
+ kind: ParameterFlags
2308
+ - name: name
2309
+ type: constant
2310
+ - name: name_loc
2311
+ type: location
2312
+ - name: operator_loc
2313
+ type: location
2314
+ - name: value
2315
+ type: node
2316
+ comment: |
2317
+ Represents an optional parameter to a method, block, or lambda definition.
2318
+
2319
+ def a(b = 1)
2320
+ ^^^^^
2321
+ end
2322
+ - name: OrNode
2323
+ fields:
2324
+ - name: left
2325
+ type: node
2326
+ comment: |
2327
+ 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).
2328
+
2329
+ left or right
2330
+ ^^^^
2331
+
2332
+ 1 || 2
2333
+ ^
2334
+ - name: right
2335
+ type: node
2336
+ comment: |
2337
+ Represents the right 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).
2338
+
2339
+ left || right
2340
+ ^^^^^
2341
+
2342
+ 1 or 2
2343
+ ^
2344
+ - name: operator_loc
2345
+ type: location
2346
+ comment: |
2347
+ The location of the `or` keyword or the `||` operator.
2348
+
2349
+ left or right
2350
+ ^^
2351
+ comment: |
2352
+ Represents the use of the `||` operator or the `or` keyword.
2353
+
2354
+ left or right
2355
+ ^^^^^^^^^^^^^
2356
+ - name: ParametersNode
2357
+ fields:
2358
+ - name: requireds
2359
+ type: node[]
2360
+ - name: optionals
2361
+ type: node[]
2362
+ - name: rest
2363
+ type: node?
2364
+ - name: posts
2365
+ type: node[]
2366
+ - name: keywords
2367
+ type: node[]
2368
+ - name: keyword_rest
2369
+ type: node?
2370
+ - name: block
2371
+ type: node?
2372
+ kind: BlockParameterNode
2373
+ comment: |
2374
+ Represents the list of parameters on a method, block, or lambda definition.
2375
+
2376
+ def a(b, c, d)
2377
+ ^^^^^^^
2378
+ end
2379
+ - name: ParenthesesNode
2380
+ fields:
2381
+ - name: body
2382
+ type: node?
2383
+ - name: opening_loc
2384
+ type: location
2385
+ - name: closing_loc
2386
+ type: location
2387
+ newline: false
2388
+ comment: |
2389
+ Represents a parenthesized expression
2390
+
2391
+ (10 + 34)
2392
+ ^^^^^^^^^
2393
+ - name: PinnedExpressionNode
2394
+ fields:
2395
+ - name: expression
2396
+ type: node
2397
+ - name: operator_loc
2398
+ type: location
2399
+ - name: lparen_loc
2400
+ type: location
2401
+ - name: rparen_loc
2402
+ type: location
2403
+ comment: |
2404
+ Represents the use of the `^` operator for pinning an expression in a pattern matching expression.
2405
+
2406
+ foo in ^(bar)
2407
+ ^^^^^^
2408
+ - name: PinnedVariableNode
2409
+ fields:
2410
+ - name: variable
2411
+ type: node
2412
+ - name: operator_loc
2413
+ type: location
2414
+ comment: |
2415
+ Represents the use of the `^` operator for pinning a variable in a pattern matching expression.
2416
+
2417
+ foo in ^bar
2418
+ ^^^^
2419
+ - name: PostExecutionNode
2420
+ fields:
2421
+ - name: statements
2422
+ type: node?
2423
+ kind: StatementsNode
2424
+ - name: keyword_loc
2425
+ type: location
2426
+ - name: opening_loc
2427
+ type: location
2428
+ - name: closing_loc
2429
+ type: location
2430
+ comment: |
2431
+ Represents the use of the `END` keyword.
2432
+
2433
+ END { foo }
2434
+ ^^^^^^^^^^^
2435
+ - name: PreExecutionNode
2436
+ fields:
2437
+ - name: statements
2438
+ type: node?
2439
+ kind: StatementsNode
2440
+ - name: keyword_loc
2441
+ type: location
2442
+ - name: opening_loc
2443
+ type: location
2444
+ - name: closing_loc
2445
+ type: location
2446
+ comment: |
2447
+ Represents the use of the `BEGIN` keyword.
2448
+
2449
+ BEGIN { foo }
2450
+ ^^^^^^^^^^^^^
2451
+ - name: ProgramNode
2452
+ fields:
2453
+ - name: locals
2454
+ type: constant[]
2455
+ - name: statements
2456
+ type: node
2457
+ kind: StatementsNode
2458
+ comment: The top level node of any parse tree.
2459
+ - name: RangeNode
2460
+ fields:
2461
+ - name: flags
2462
+ type: flags
2463
+ kind: RangeFlags
2464
+ - name: left
2465
+ type: node?
2466
+ comment: |
2467
+ 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).
2468
+
2469
+ 1...
2470
+ ^
2471
+
2472
+ hello...goodbye
2473
+ ^^^^^
2474
+ - name: right
2475
+ type: node?
2476
+ comment: |
2477
+ 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).
2478
+
2479
+ ..5
2480
+ ^
2481
+
2482
+ 1...foo
2483
+ ^^^
2484
+ If neither right-hand or left-hand side was included, this will be a MissingNode.
2485
+ - name: operator_loc
2486
+ type: location
2487
+ comment: |
2488
+ The location of the `..` or `...` operator.
2489
+ comment: |
2490
+ Represents the use of the `..` or `...` operators.
2491
+
2492
+ 1..2
2493
+ ^^^^
2494
+
2495
+ c if a =~ /left/ ... b =~ /right/
2496
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2497
+ - name: RationalNode
2498
+ fields:
2499
+ - name: numeric
2500
+ type: node
2501
+ comment: |
2502
+ Represents a rational number literal.
2503
+
2504
+ 1.0r
2505
+ ^^^^
2506
+ - name: RedoNode
2507
+ comment: |
2508
+ Represents the use of the `redo` keyword.
2509
+
2510
+ redo
2511
+ ^^^^
2512
+ - name: RegularExpressionNode
2513
+ fields:
2514
+ - name: flags
2515
+ type: flags
2516
+ kind: RegularExpressionFlags
2517
+ - name: opening_loc
2518
+ type: location
2519
+ - name: content_loc
2520
+ type: location
2521
+ - name: closing_loc
2522
+ type: location
2523
+ - name: unescaped
2524
+ type: string
2525
+ comment: |
2526
+ Represents a regular expression literal with no interpolation.
2527
+
2528
+ /foo/i
2529
+ ^^^^^^
2530
+ - name: RequiredKeywordParameterNode
2531
+ fields:
2532
+ - name: flags
2533
+ type: flags
2534
+ kind: ParameterFlags
2535
+ - name: name
2536
+ type: constant
2537
+ - name: name_loc
2538
+ type: location
2539
+ comment: |
2540
+ Represents a required keyword parameter to a method, block, or lambda definition.
2541
+
2542
+ def a(b: )
2543
+ ^^
2544
+ end
2545
+ - name: RequiredParameterNode
2546
+ fields:
2547
+ - name: flags
2548
+ type: flags
2549
+ kind: ParameterFlags
2550
+ - name: name
2551
+ type: constant
2552
+ comment: |
2553
+ Represents a required parameter to a method, block, or lambda definition.
2554
+
2555
+ def a(b)
2556
+ ^
2557
+ end
2558
+ - name: RescueModifierNode
2559
+ fields:
2560
+ - name: expression
2561
+ type: node
2562
+ - name: keyword_loc
2563
+ type: location
2564
+ - name: rescue_expression
2565
+ type: node
2566
+ newline: expression
2567
+ comment: |
2568
+ Represents an expression modified with a rescue.
2569
+
2570
+ foo rescue nil
2571
+ ^^^^^^^^^^^^^^
2572
+ - name: RescueNode
2573
+ fields:
2574
+ - name: keyword_loc
2575
+ type: location
2576
+ - name: exceptions
2577
+ type: node[]
2578
+ - name: operator_loc
2579
+ type: location?
2580
+ - name: reference
2581
+ type: node?
2582
+ - name: statements
2583
+ type: node?
2584
+ kind: StatementsNode
2585
+ - name: consequent
2586
+ type: node?
2587
+ kind: RescueNode
2588
+ comment: |
2589
+ Represents a rescue statement.
2590
+
2591
+ begin
2592
+ rescue Foo, *splat, Bar => ex
2593
+ foo
2594
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2595
+ end
2596
+
2597
+ `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `exception` field.
2598
+ - name: RestParameterNode
2599
+ fields:
2600
+ - name: flags
2601
+ type: flags
2602
+ kind: ParameterFlags
2603
+ - name: name
2604
+ type: constant?
2605
+ - name: name_loc
2606
+ type: location?
2607
+ - name: operator_loc
2608
+ type: location
2609
+ comment: |
2610
+ Represents a rest parameter to a method, block, or lambda definition.
2611
+
2612
+ def a(*b)
2613
+ ^^
2614
+ end
2615
+ - name: RetryNode
2616
+ comment: |
2617
+ Represents the use of the `retry` keyword.
2618
+
2619
+ retry
2620
+ ^^^^^
2621
+ - name: ReturnNode
2622
+ fields:
2623
+ - name: keyword_loc
2624
+ type: location
2625
+ - name: arguments
2626
+ type: node?
2627
+ kind: ArgumentsNode
2628
+ comment: |
2629
+ Represents the use of the `return` keyword.
2630
+
2631
+ return 1
2632
+ ^^^^^^^^
2633
+ - name: SelfNode
2634
+ comment: |
2635
+ Represents the `self` keyword.
2636
+
2637
+ self
2638
+ ^^^^
2639
+ - name: SingletonClassNode
2640
+ fields:
2641
+ - name: locals
2642
+ type: constant[]
2643
+ - name: class_keyword_loc
2644
+ type: location
2645
+ - name: operator_loc
2646
+ type: location
2647
+ - name: expression
2648
+ type: node
2649
+ - name: body
2650
+ type: node?
2651
+ - name: end_keyword_loc
2652
+ type: location
2653
+ comment: |
2654
+ Represents a singleton class declaration involving the `class` keyword.
2655
+
2656
+ class << self end
2657
+ ^^^^^^^^^^^^^^^^^
2658
+ - name: SourceEncodingNode
2659
+ comment: |
2660
+ Represents the use of the `__ENCODING__` keyword.
2661
+
2662
+ __ENCODING__
2663
+ ^^^^^^^^^^^^
2664
+ - name: SourceFileNode
2665
+ fields:
2666
+ - name: filepath
2667
+ type: string
2668
+ comment: |
2669
+ Represents the use of the `__FILE__` keyword.
2670
+
2671
+ __FILE__
2672
+ ^^^^^^^^
2673
+ - name: SourceLineNode
2674
+ comment: |
2675
+ Represents the use of the `__LINE__` keyword.
2676
+
2677
+ __LINE__
2678
+ ^^^^^^^^
2679
+ - name: SplatNode
2680
+ fields:
2681
+ - name: operator_loc
2682
+ type: location
2683
+ - name: expression
2684
+ type: node?
2685
+ comment: |
2686
+ Represents the use of the splat operator.
2687
+
2688
+ [*a]
2689
+ ^^
2690
+ - name: StatementsNode
2691
+ fields:
2692
+ - name: body
2693
+ type: node[]
2694
+ comment: |
2695
+ Represents a set of statements contained within some scope.
2696
+
2697
+ foo; bar; baz
2698
+ ^^^^^^^^^^^^^
2699
+ - name: StringNode
2700
+ fields:
2701
+ - name: flags
2702
+ type: flags
2703
+ kind: StringFlags
2704
+ - name: opening_loc
2705
+ type: location?
2706
+ - name: content_loc
2707
+ type: location
2708
+ - name: closing_loc
2709
+ type: location?
2710
+ - name: unescaped
2711
+ type: string
2712
+ comment: |
2713
+ Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string.
2714
+
2715
+ "foo"
2716
+ ^^^^^
2717
+
2718
+ %w[foo]
2719
+ ^^^
2720
+
2721
+ "foo #{bar} baz"
2722
+ ^^^^ ^^^^
2723
+ - name: SuperNode
2724
+ fields:
2725
+ - name: keyword_loc
2726
+ type: location
2727
+ - name: lparen_loc
2728
+ type: location?
2729
+ - name: arguments
2730
+ type: node?
2731
+ kind: ArgumentsNode
2732
+ - name: rparen_loc
2733
+ type: location?
2734
+ - name: block
2735
+ type: node?
2736
+ comment: |
2737
+ Represents the use of the `super` keyword with parentheses or arguments.
2738
+
2739
+ super()
2740
+ ^^^^^^^
2741
+
2742
+ super foo, bar
2743
+ ^^^^^^^^^^^^^^
2744
+ - name: SymbolNode
2745
+ fields:
2746
+ - name: flags
2747
+ type: flags
2748
+ kind: SymbolFlags
2749
+ - name: opening_loc
2750
+ type: location?
2751
+ - name: value_loc
2752
+ type: location?
2753
+ - name: closing_loc
2754
+ type: location?
2755
+ - name: unescaped
2756
+ type: string
2757
+ comment: |
2758
+ Represents a symbol literal or a symbol contained within a `%i` list.
2759
+
2760
+ :foo
2761
+ ^^^^
2762
+
2763
+ %i[foo]
2764
+ ^^^
2765
+ - name: TrueNode
2766
+ comment: |
2767
+ Represents the use of the literal `true` keyword.
2768
+
2769
+ true
2770
+ ^^^^
2771
+ - name: UndefNode
2772
+ fields:
2773
+ - name: names
2774
+ type: node[]
2775
+ - name: keyword_loc
2776
+ type: location
2777
+ comment: |
2778
+ Represents the use of the `undef` keyword.
2779
+
2780
+ undef :foo, :bar, :baz
2781
+ ^^^^^^^^^^^^^^^^^^^^^^
2782
+ - name: UnlessNode
2783
+ fields:
2784
+ - name: keyword_loc
2785
+ type: location
2786
+ - name: predicate
2787
+ type: node
2788
+ - name: then_keyword_loc
2789
+ type: location?
2790
+ - name: statements
2791
+ type: node?
2792
+ kind: StatementsNode
2793
+ - name: consequent
2794
+ type: node?
2795
+ kind: ElseNode
2796
+ - name: end_keyword_loc
2797
+ type: location?
2798
+ newline: predicate
2799
+ comment: |
2800
+ Represents the use of the `unless` keyword, either in the block form or the modifier form.
2801
+
2802
+ bar unless foo
2803
+ ^^^^^^^^^^^^^^
2804
+
2805
+ unless foo then bar end
2806
+ ^^^^^^^^^^^^^^^^^^^^^^^
2807
+ - name: UntilNode
2808
+ fields:
2809
+ - name: flags
2810
+ type: flags
2811
+ kind: LoopFlags
2812
+ - name: keyword_loc
2813
+ type: location
2814
+ - name: closing_loc
2815
+ type: location?
2816
+ - name: predicate
2817
+ type: node
2818
+ - name: statements
2819
+ type: node?
2820
+ kind: StatementsNode
2821
+ newline: predicate
2822
+ comment: |
2823
+ Represents the use of the `until` keyword, either in the block form or the modifier form.
2824
+
2825
+ bar until foo
2826
+ ^^^^^^^^^^^^^
2827
+
2828
+ until foo do bar end
2829
+ ^^^^^^^^^^^^^^^^^^^^
2830
+ - name: WhenNode
2831
+ fields:
2832
+ - name: keyword_loc
2833
+ type: location
2834
+ - name: conditions
2835
+ type: node[]
2836
+ - name: statements
2837
+ type: node?
2838
+ kind: StatementsNode
2839
+ comment: |
2840
+ Represents the use of the `when` keyword within a case statement.
2841
+
2842
+ case true
2843
+ when true
2844
+ ^^^^^^^^^
2845
+ end
2846
+ - name: WhileNode
2847
+ fields:
2848
+ - name: flags
2849
+ type: flags
2850
+ kind: LoopFlags
2851
+ - name: keyword_loc
2852
+ type: location
2853
+ - name: closing_loc
2854
+ type: location?
2855
+ - name: predicate
2856
+ type: node
2857
+ - name: statements
2858
+ type: node?
2859
+ kind: StatementsNode
2860
+ newline: predicate
2861
+ comment: |
2862
+ Represents the use of the `while` keyword, either in the block form or the modifier form.
2863
+
2864
+ bar while foo
2865
+ ^^^^^^^^^^^^^
2866
+
2867
+ while foo do bar end
2868
+ ^^^^^^^^^^^^^^^^^^^^
2869
+ - name: XStringNode
2870
+ fields:
2871
+ - name: flags
2872
+ type: flags
2873
+ kind: EncodingFlags
2874
+ - name: opening_loc
2875
+ type: location
2876
+ - name: content_loc
2877
+ type: location
2878
+ - name: closing_loc
2879
+ type: location
2880
+ - name: unescaped
2881
+ type: string
2882
+ comment: |
2883
+ Represents an xstring literal with no interpolation.
2884
+
2885
+ `foo`
2886
+ ^^^^^
2887
+ - name: YieldNode
2888
+ fields:
2889
+ - name: keyword_loc
2890
+ type: location
2891
+ - name: lparen_loc
2892
+ type: location?
2893
+ - name: arguments
2894
+ type: node?
2895
+ kind: ArgumentsNode
2896
+ - name: rparen_loc
2897
+ type: location?
2898
+ comment: |
2899
+ Represents the use of the `yield` keyword.
2900
+
2901
+ yield 1
2902
+ ^^^^^^^