prism 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +172 -0
  3. data/CODE_OF_CONDUCT.md +76 -0
  4. data/CONTRIBUTING.md +62 -0
  5. data/LICENSE.md +7 -0
  6. data/Makefile +84 -0
  7. data/README.md +89 -0
  8. data/config.yml +2481 -0
  9. data/docs/build_system.md +74 -0
  10. data/docs/building.md +22 -0
  11. data/docs/configuration.md +60 -0
  12. data/docs/design.md +53 -0
  13. data/docs/encoding.md +117 -0
  14. data/docs/fuzzing.md +93 -0
  15. data/docs/heredocs.md +36 -0
  16. data/docs/mapping.md +117 -0
  17. data/docs/ripper.md +36 -0
  18. data/docs/ruby_api.md +25 -0
  19. data/docs/serialization.md +181 -0
  20. data/docs/testing.md +55 -0
  21. data/ext/prism/api_node.c +4725 -0
  22. data/ext/prism/api_pack.c +256 -0
  23. data/ext/prism/extconf.rb +136 -0
  24. data/ext/prism/extension.c +626 -0
  25. data/ext/prism/extension.h +18 -0
  26. data/include/prism/ast.h +1932 -0
  27. data/include/prism/defines.h +45 -0
  28. data/include/prism/diagnostic.h +231 -0
  29. data/include/prism/enc/pm_encoding.h +95 -0
  30. data/include/prism/node.h +41 -0
  31. data/include/prism/pack.h +141 -0
  32. data/include/prism/parser.h +418 -0
  33. data/include/prism/regexp.h +19 -0
  34. data/include/prism/unescape.h +48 -0
  35. data/include/prism/util/pm_buffer.h +51 -0
  36. data/include/prism/util/pm_char.h +91 -0
  37. data/include/prism/util/pm_constant_pool.h +78 -0
  38. data/include/prism/util/pm_list.h +67 -0
  39. data/include/prism/util/pm_memchr.h +14 -0
  40. data/include/prism/util/pm_newline_list.h +61 -0
  41. data/include/prism/util/pm_state_stack.h +24 -0
  42. data/include/prism/util/pm_string.h +61 -0
  43. data/include/prism/util/pm_string_list.h +25 -0
  44. data/include/prism/util/pm_strpbrk.h +29 -0
  45. data/include/prism/version.h +4 -0
  46. data/include/prism.h +82 -0
  47. data/lib/prism/compiler.rb +465 -0
  48. data/lib/prism/debug.rb +157 -0
  49. data/lib/prism/desugar_compiler.rb +206 -0
  50. data/lib/prism/dispatcher.rb +2051 -0
  51. data/lib/prism/dsl.rb +750 -0
  52. data/lib/prism/ffi.rb +251 -0
  53. data/lib/prism/lex_compat.rb +838 -0
  54. data/lib/prism/mutation_compiler.rb +718 -0
  55. data/lib/prism/node.rb +14540 -0
  56. data/lib/prism/node_ext.rb +55 -0
  57. data/lib/prism/node_inspector.rb +68 -0
  58. data/lib/prism/pack.rb +185 -0
  59. data/lib/prism/parse_result/comments.rb +172 -0
  60. data/lib/prism/parse_result/newlines.rb +60 -0
  61. data/lib/prism/parse_result.rb +266 -0
  62. data/lib/prism/pattern.rb +239 -0
  63. data/lib/prism/ripper_compat.rb +174 -0
  64. data/lib/prism/serialize.rb +662 -0
  65. data/lib/prism/visitor.rb +470 -0
  66. data/lib/prism.rb +64 -0
  67. data/prism.gemspec +113 -0
  68. data/src/diagnostic.c +287 -0
  69. data/src/enc/pm_big5.c +52 -0
  70. data/src/enc/pm_euc_jp.c +58 -0
  71. data/src/enc/pm_gbk.c +61 -0
  72. data/src/enc/pm_shift_jis.c +56 -0
  73. data/src/enc/pm_tables.c +507 -0
  74. data/src/enc/pm_unicode.c +2324 -0
  75. data/src/enc/pm_windows_31j.c +56 -0
  76. data/src/node.c +2633 -0
  77. data/src/pack.c +493 -0
  78. data/src/prettyprint.c +2136 -0
  79. data/src/prism.c +14587 -0
  80. data/src/regexp.c +580 -0
  81. data/src/serialize.c +1899 -0
  82. data/src/token_type.c +349 -0
  83. data/src/unescape.c +637 -0
  84. data/src/util/pm_buffer.c +103 -0
  85. data/src/util/pm_char.c +272 -0
  86. data/src/util/pm_constant_pool.c +252 -0
  87. data/src/util/pm_list.c +41 -0
  88. data/src/util/pm_memchr.c +33 -0
  89. data/src/util/pm_newline_list.c +134 -0
  90. data/src/util/pm_state_stack.c +19 -0
  91. data/src/util/pm_string.c +200 -0
  92. data/src/util/pm_string_list.c +29 -0
  93. data/src/util/pm_strncasecmp.c +17 -0
  94. data/src/util/pm_strpbrk.c +66 -0
  95. metadata +138 -0
data/config.yml ADDED
@@ -0,0 +1,2481 @@
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: "."
63
+ - name: DOT_DOT
64
+ comment: ".."
65
+ - name: DOT_DOT_DOT
66
+ comment: "..."
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 .."
315
+ - name: UDOT_DOT_DOT
316
+ comment: "unary ..."
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: CallNodeFlags
333
+ values:
334
+ - name: SAFE_NAVIGATION
335
+ comment: "&. operator"
336
+ - name: VARIABLE_CALL
337
+ comment: "a call that could have been a local variable"
338
+ - name: IntegerBaseFlags
339
+ values:
340
+ - name: BINARY
341
+ comment: "0b prefix"
342
+ - name: OCTAL
343
+ comment: "0o or 0 prefix"
344
+ - name: DECIMAL
345
+ comment: "0d or no prefix"
346
+ - name: HEXADECIMAL
347
+ comment: "0x prefix"
348
+ - name: LoopFlags
349
+ values:
350
+ - name: BEGIN_MODIFIER
351
+ comment: "a loop after a begin statement, so the body is executed first before the condition"
352
+ - name: RangeFlags
353
+ values:
354
+ - name: EXCLUDE_END
355
+ comment: "... operator"
356
+ - name: RegularExpressionFlags
357
+ values:
358
+ - name: IGNORE_CASE
359
+ comment: "i - ignores the case of characters when matching"
360
+ - name: EXTENDED
361
+ comment: "x - ignores whitespace and allows comments in regular expressions"
362
+ - name: MULTI_LINE
363
+ comment: "m - allows $ to match the end of lines within strings"
364
+ - name: EUC_JP
365
+ comment: "e - forces the EUC-JP encoding"
366
+ - name: ASCII_8BIT
367
+ comment: "n - forces the ASCII-8BIT encoding"
368
+ - name: WINDOWS_31J
369
+ comment: "s - forces the Windows-31J encoding"
370
+ - name: UTF_8
371
+ comment: "u - forces the UTF-8 encoding"
372
+ - name: ONCE
373
+ comment: "o - only interpolates values into the regular expression once"
374
+ - name: StringFlags
375
+ values:
376
+ - name: FROZEN
377
+ comment: "frozen by virtue of a frozen_string_literal comment"
378
+ nodes:
379
+ - name: AliasGlobalVariableNode
380
+ fields:
381
+ - name: new_name
382
+ type: node
383
+ - name: old_name
384
+ type: node
385
+ - name: keyword_loc
386
+ type: location
387
+ comment: |
388
+ Represents the use of the `alias` keyword to alias a global variable.
389
+
390
+ alias $foo $bar
391
+ ^^^^^^^^^^^^^^^
392
+ - name: AliasMethodNode
393
+ fields:
394
+ - name: new_name
395
+ type: node
396
+ - name: old_name
397
+ type: node
398
+ - name: keyword_loc
399
+ type: location
400
+ comment: |
401
+ Represents the use of the `alias` keyword to alias a method.
402
+
403
+ alias foo bar
404
+ ^^^^^^^^^^^^^
405
+ - name: AlternationPatternNode
406
+ fields:
407
+ - name: left
408
+ type: node
409
+ - name: right
410
+ type: node
411
+ - name: operator_loc
412
+ type: location
413
+ comment: |
414
+ Represents an alternation pattern in pattern matching.
415
+
416
+ foo => bar | baz
417
+ ^^^^^^^^^
418
+ - name: AndNode
419
+ fields:
420
+ - name: left
421
+ type: node
422
+ - name: right
423
+ type: node
424
+ - name: operator_loc
425
+ type: location
426
+ comment: |
427
+ Represents the use of the `&&` operator or the `and` keyword.
428
+
429
+ left and right
430
+ ^^^^^^^^^^^^^^
431
+ - name: ArgumentsNode
432
+ fields:
433
+ - name: arguments
434
+ type: node[]
435
+ comment: |
436
+ Represents a set of arguments to a method or a keyword.
437
+
438
+ return foo, bar, baz
439
+ ^^^^^^^^^^^^^
440
+ - name: ArrayNode
441
+ fields:
442
+ - name: elements
443
+ type: node[]
444
+ - name: opening_loc
445
+ type: location?
446
+ - name: closing_loc
447
+ type: location?
448
+ comment: |
449
+ Represents an array literal. This can be a regular array using brackets or
450
+ a special array using % like %w or %i.
451
+
452
+ [1, 2, 3]
453
+ ^^^^^^^^^
454
+ - name: ArrayPatternNode
455
+ fields:
456
+ - name: constant
457
+ type: node?
458
+ - name: requireds
459
+ type: node[]
460
+ - name: rest
461
+ type: node?
462
+ - name: posts
463
+ type: node[]
464
+ - name: opening_loc
465
+ type: location?
466
+ - name: closing_loc
467
+ type: location?
468
+ comment: |
469
+ Represents an array pattern in pattern matching.
470
+
471
+ foo in 1, 2
472
+ ^^^^^^^^^^^
473
+
474
+ foo in [1, 2]
475
+ ^^^^^^^^^^^^^
476
+
477
+ foo in *1
478
+ ^^^^^^^^^
479
+
480
+ foo in Bar[]
481
+ ^^^^^^^^^^^^
482
+
483
+ foo in Bar[1, 2, 3]
484
+ ^^^^^^^^^^^^^^^^^^^
485
+ - name: AssocNode
486
+ fields:
487
+ - name: key
488
+ type: node
489
+ - name: value
490
+ type: node?
491
+ - name: operator_loc
492
+ type: location?
493
+ comment: |
494
+ Represents a hash key/value pair.
495
+
496
+ { a => b }
497
+ ^^^^^^
498
+ - name: AssocSplatNode
499
+ fields:
500
+ - name: value
501
+ type: node?
502
+ - name: operator_loc
503
+ type: location
504
+ comment: |
505
+ Represents a splat in a hash literal.
506
+
507
+ { **foo }
508
+ ^^^^^
509
+ - name: BackReferenceReadNode
510
+ comment: |
511
+ Represents reading a reference to a field in the previous match.
512
+
513
+ $'
514
+ ^^
515
+ - name: BeginNode
516
+ fields:
517
+ - name: begin_keyword_loc
518
+ type: location?
519
+ - name: statements
520
+ type: node?
521
+ kind: StatementsNode
522
+ - name: rescue_clause
523
+ type: node?
524
+ kind: RescueNode
525
+ - name: else_clause
526
+ type: node?
527
+ kind: ElseNode
528
+ - name: ensure_clause
529
+ type: node?
530
+ kind: EnsureNode
531
+ - name: end_keyword_loc
532
+ type: location?
533
+ newline: false
534
+ comment: |
535
+ Represents a begin statement.
536
+
537
+ begin
538
+ foo
539
+ end
540
+ ^^^^^
541
+ - name: BlockArgumentNode
542
+ fields:
543
+ - name: expression
544
+ type: node?
545
+ - name: operator_loc
546
+ type: location
547
+ comment: |
548
+ Represents block method arguments.
549
+
550
+ bar(&args)
551
+ ^^^^^^^^^^
552
+ - name: BlockLocalVariableNode
553
+ fields:
554
+ - name: name
555
+ type: constant
556
+ comment: |
557
+ Represents a block local variable.
558
+
559
+ a { |; b| }
560
+ ^
561
+ - name: BlockNode
562
+ fields:
563
+ - name: locals
564
+ type: constant[]
565
+ - name: parameters
566
+ type: node?
567
+ kind: BlockParametersNode
568
+ - name: body
569
+ type: node?
570
+ - name: opening_loc
571
+ type: location
572
+ - name: closing_loc
573
+ type: location
574
+ comment: |
575
+ Represents a block of ruby code.
576
+
577
+ [1, 2, 3].each { |i| puts x }
578
+ ^^^^^^^^^^^^^^
579
+ - name: BlockParameterNode
580
+ fields:
581
+ - name: name
582
+ type: constant?
583
+ - name: name_loc
584
+ type: location?
585
+ - name: operator_loc
586
+ type: location
587
+ comment: |
588
+ Represents a block parameter to a method, block, or lambda definition.
589
+
590
+ def a(&b)
591
+ ^^
592
+ end
593
+ - name: BlockParametersNode
594
+ fields:
595
+ - name: parameters
596
+ type: node?
597
+ kind: ParametersNode
598
+ - name: locals
599
+ type: node[]
600
+ - name: opening_loc
601
+ type: location?
602
+ - name: closing_loc
603
+ type: location?
604
+ comment: |
605
+ Represents a block's parameters declaration.
606
+
607
+ -> (a, b = 1; local) { }
608
+ ^^^^^^^^^^^^^^^^^
609
+
610
+ foo do |a, b = 1; local|
611
+ ^^^^^^^^^^^^^^^^^
612
+ end
613
+ - name: BreakNode
614
+ fields:
615
+ - name: arguments
616
+ type: node?
617
+ kind: ArgumentsNode
618
+ - name: keyword_loc
619
+ type: location
620
+ comment: |
621
+ Represents the use of the `break` keyword.
622
+
623
+ break foo
624
+ ^^^^^^^^^
625
+ - name: CallAndWriteNode
626
+ fields:
627
+ - name: receiver
628
+ type: node?
629
+ - name: call_operator_loc
630
+ type: location?
631
+ - name: message_loc
632
+ type: location?
633
+ - name: opening_loc
634
+ type: location?
635
+ - name: arguments
636
+ type: node?
637
+ kind: ArgumentsNode
638
+ - name: closing_loc
639
+ type: location?
640
+ - name: flags
641
+ type: flags
642
+ kind: CallNodeFlags
643
+ - name: read_name
644
+ type: string
645
+ - name: write_name
646
+ type: string
647
+ - name: operator_loc
648
+ type: location
649
+ - name: value
650
+ type: node
651
+ comment: |
652
+ Represents the use of the `&&=` operator on a call.
653
+
654
+ foo.bar &&= value
655
+ ^^^^^^^^^^^^^^^^^
656
+ - name: CallNode
657
+ fields:
658
+ - name: receiver
659
+ type: node?
660
+ - name: call_operator_loc
661
+ type: location?
662
+ - name: message_loc
663
+ type: location?
664
+ - name: opening_loc
665
+ type: location?
666
+ - name: arguments
667
+ type: node?
668
+ kind: ArgumentsNode
669
+ - name: closing_loc
670
+ type: location?
671
+ - name: block
672
+ type: node?
673
+ - name: flags
674
+ type: flags
675
+ kind: CallNodeFlags
676
+ - name: name
677
+ type: string
678
+ comment: |
679
+ Represents a method call, in all of the various forms that can take.
680
+
681
+ foo
682
+ ^^^
683
+
684
+ foo()
685
+ ^^^^^
686
+
687
+ +foo
688
+ ^^^^
689
+
690
+ foo + bar
691
+ ^^^^^^^^^
692
+
693
+ foo.bar
694
+ ^^^^^^^
695
+
696
+ foo&.bar
697
+ ^^^^^^^^
698
+ - name: CallOperatorWriteNode
699
+ fields:
700
+ - name: receiver
701
+ type: node?
702
+ - name: call_operator_loc
703
+ type: location?
704
+ - name: message_loc
705
+ type: location?
706
+ - name: opening_loc
707
+ type: location?
708
+ - name: arguments
709
+ type: node?
710
+ kind: ArgumentsNode
711
+ - name: closing_loc
712
+ type: location?
713
+ - name: flags
714
+ type: flags
715
+ kind: CallNodeFlags
716
+ - name: read_name
717
+ type: string
718
+ - name: write_name
719
+ type: string
720
+ - name: operator
721
+ type: constant
722
+ - name: operator_loc
723
+ type: location
724
+ - name: value
725
+ type: node
726
+ comment: |
727
+ Represents the use of an assignment operator on a call.
728
+
729
+ foo.bar += baz
730
+ ^^^^^^^^^^^^^^
731
+ - name: CallOrWriteNode
732
+ fields:
733
+ - name: receiver
734
+ type: node?
735
+ - name: call_operator_loc
736
+ type: location?
737
+ - name: message_loc
738
+ type: location?
739
+ - name: opening_loc
740
+ type: location?
741
+ - name: arguments
742
+ type: node?
743
+ kind: ArgumentsNode
744
+ - name: closing_loc
745
+ type: location?
746
+ - name: flags
747
+ type: flags
748
+ kind: CallNodeFlags
749
+ - name: read_name
750
+ type: string
751
+ - name: write_name
752
+ type: string
753
+ - name: operator_loc
754
+ type: location
755
+ - name: value
756
+ type: node
757
+ comment: |
758
+ Represents the use of the `||=` operator on a call.
759
+
760
+ foo.bar ||= value
761
+ ^^^^^^^^^^^^^^^^^
762
+ - name: CapturePatternNode
763
+ fields:
764
+ - name: value
765
+ type: node
766
+ - name: target
767
+ type: node
768
+ - name: operator_loc
769
+ type: location
770
+ comment: |
771
+ Represents assigning to a local variable in pattern matching.
772
+
773
+ foo => [bar => baz]
774
+ ^^^^^^^^^^^^
775
+ - name: CaseNode
776
+ fields:
777
+ - name: predicate
778
+ type: node?
779
+ - name: conditions
780
+ type: node[]
781
+ - name: consequent
782
+ type: node?
783
+ kind: ElseNode
784
+ - name: case_keyword_loc
785
+ type: location
786
+ - name: end_keyword_loc
787
+ type: location
788
+ comment: |
789
+ Represents the use of a case statement.
790
+
791
+ case true
792
+ ^^^^^^^^^
793
+ when false
794
+ end
795
+ - name: ClassNode
796
+ fields:
797
+ - name: locals
798
+ type: constant[]
799
+ - name: class_keyword_loc
800
+ type: location
801
+ - name: constant_path
802
+ type: node
803
+ - name: inheritance_operator_loc
804
+ type: location?
805
+ - name: superclass
806
+ type: node?
807
+ - name: body
808
+ type: node?
809
+ - name: end_keyword_loc
810
+ type: location
811
+ - name: name
812
+ type: constant
813
+ comment: |
814
+ Represents a class declaration involving the `class` keyword.
815
+
816
+ class Foo end
817
+ ^^^^^^^^^^^^^
818
+ - name: ClassVariableAndWriteNode
819
+ fields:
820
+ - name: name
821
+ type: constant
822
+ - name: name_loc
823
+ type: location
824
+ - name: operator_loc
825
+ type: location
826
+ - name: value
827
+ type: node
828
+ comment: |
829
+ Represents the use of the `&&=` operator for assignment to a class variable.
830
+
831
+ @@target &&= value
832
+ ^^^^^^^^^^^^^^^^
833
+ - name: ClassVariableOperatorWriteNode
834
+ fields:
835
+ - name: name
836
+ type: constant
837
+ - name: name_loc
838
+ type: location
839
+ - name: operator_loc
840
+ type: location
841
+ - name: value
842
+ type: node
843
+ - name: operator
844
+ type: constant
845
+ comment: |
846
+ Represents assigning to a class variable using an operator that isn't `=`.
847
+
848
+ @@target += value
849
+ ^^^^^^^^^^^^^^^^^
850
+ - name: ClassVariableOrWriteNode
851
+ fields:
852
+ - name: name
853
+ type: constant
854
+ - name: name_loc
855
+ type: location
856
+ - name: operator_loc
857
+ type: location
858
+ - name: value
859
+ type: node
860
+ comment: |
861
+ Represents the use of the `||=` operator for assignment to a class variable.
862
+
863
+ @@target ||= value
864
+ ^^^^^^^^^^^^^^^^^^
865
+ - name: ClassVariableReadNode
866
+ fields:
867
+ - name: name
868
+ type: constant
869
+ comment: |
870
+ Represents referencing a class variable.
871
+
872
+ @@foo
873
+ ^^^^^
874
+ - name: ClassVariableTargetNode
875
+ fields:
876
+ - name: name
877
+ type: constant
878
+ comment: |
879
+ Represents writing to a class variable in a context that doesn't have an explicit value.
880
+
881
+ @@foo, @@bar = baz
882
+ ^^^^^ ^^^^^
883
+ - name: ClassVariableWriteNode
884
+ fields:
885
+ - name: name
886
+ type: constant
887
+ - name: name_loc
888
+ type: location
889
+ - name: value
890
+ type: node
891
+ - name: operator_loc
892
+ type: location?
893
+ comment: |
894
+ Represents writing to a class variable.
895
+
896
+ @@foo = 1
897
+ ^^^^^^^^^
898
+ - name: ConstantAndWriteNode
899
+ fields:
900
+ - name: name
901
+ type: constant
902
+ - name: name_loc
903
+ type: location
904
+ - name: operator_loc
905
+ type: location
906
+ - name: value
907
+ type: node
908
+ comment: |
909
+ Represents the use of the `&&=` operator for assignment to a constant.
910
+
911
+ Target &&= value
912
+ ^^^^^^^^^^^^^^^^
913
+ - name: ConstantOperatorWriteNode
914
+ fields:
915
+ - name: name
916
+ type: constant
917
+ - name: name_loc
918
+ type: location
919
+ - name: operator_loc
920
+ type: location
921
+ - name: value
922
+ type: node
923
+ - name: operator
924
+ type: constant
925
+ comment: |
926
+ Represents assigning to a constant using an operator that isn't `=`.
927
+
928
+ Target += value
929
+ ^^^^^^^^^^^^^^^
930
+ - name: ConstantOrWriteNode
931
+ fields:
932
+ - name: name
933
+ type: constant
934
+ - name: name_loc
935
+ type: location
936
+ - name: operator_loc
937
+ type: location
938
+ - name: value
939
+ type: node
940
+ comment: |
941
+ Represents the use of the `||=` operator for assignment to a constant.
942
+
943
+ Target ||= value
944
+ ^^^^^^^^^^^^^^^^
945
+ - name: ConstantPathAndWriteNode
946
+ fields:
947
+ - name: target
948
+ type: node
949
+ kind: ConstantPathNode
950
+ - name: operator_loc
951
+ type: location
952
+ - name: value
953
+ type: node
954
+ comment: |
955
+ Represents the use of the `&&=` operator for assignment to a constant path.
956
+
957
+ Parent::Child &&= value
958
+ ^^^^^^^^^^^^^^^^^^^^^^^
959
+ - name: ConstantPathNode
960
+ fields:
961
+ - name: parent
962
+ type: node?
963
+ - name: child
964
+ type: node
965
+ - name: delimiter_loc
966
+ type: location
967
+ comment: |
968
+ Represents accessing a constant through a path of `::` operators.
969
+
970
+ Foo::Bar
971
+ ^^^^^^^^
972
+ - name: ConstantPathOperatorWriteNode
973
+ fields:
974
+ - name: target
975
+ type: node
976
+ kind: ConstantPathNode
977
+ - name: operator_loc
978
+ type: location
979
+ - name: value
980
+ type: node
981
+ - name: operator
982
+ type: constant
983
+ comment: |
984
+ Represents assigning to a constant path using an operator that isn't `=`.
985
+
986
+ Parent::Child += value
987
+ ^^^^^^^^^^^^^^^^^^^^^^
988
+ - name: ConstantPathOrWriteNode
989
+ fields:
990
+ - name: target
991
+ type: node
992
+ kind: ConstantPathNode
993
+ - name: operator_loc
994
+ type: location
995
+ - name: value
996
+ type: node
997
+ comment: |
998
+ Represents the use of the `||=` operator for assignment to a constant path.
999
+
1000
+ Parent::Child ||= value
1001
+ ^^^^^^^^^^^^^^^^^^^^^^^
1002
+ - name: ConstantPathTargetNode
1003
+ fields:
1004
+ - name: parent
1005
+ type: node?
1006
+ - name: child
1007
+ type: node
1008
+ - name: delimiter_loc
1009
+ type: location
1010
+ comment: |
1011
+ Represents writing to a constant path in a context that doesn't have an explicit value.
1012
+
1013
+ Foo::Foo, Bar::Bar = baz
1014
+ ^^^^^^^^ ^^^^^^^^
1015
+ - name: ConstantPathWriteNode
1016
+ fields:
1017
+ - name: target
1018
+ type: node
1019
+ kind: ConstantPathNode
1020
+ - name: operator_loc
1021
+ type: location
1022
+ - name: value
1023
+ type: node
1024
+ comment: |
1025
+ Represents writing to a constant path.
1026
+
1027
+ ::Foo = 1
1028
+ ^^^^^^^^^
1029
+
1030
+ Foo::Bar = 1
1031
+ ^^^^^^^^^^^^
1032
+
1033
+ ::Foo::Bar = 1
1034
+ ^^^^^^^^^^^^^^
1035
+ - name: ConstantReadNode
1036
+ fields:
1037
+ - name: name
1038
+ type: constant
1039
+ comment: |
1040
+ Represents referencing a constant.
1041
+
1042
+ Foo
1043
+ ^^^
1044
+ - name: ConstantTargetNode
1045
+ fields:
1046
+ - name: name
1047
+ type: constant
1048
+ comment: |
1049
+ Represents writing to a constant in a context that doesn't have an explicit value.
1050
+
1051
+ Foo, Bar = baz
1052
+ ^^^ ^^^
1053
+ - name: ConstantWriteNode
1054
+ fields:
1055
+ - name: name
1056
+ type: constant
1057
+ - name: name_loc
1058
+ type: location
1059
+ - name: value
1060
+ type: node
1061
+ - name: operator_loc
1062
+ type: location
1063
+ comment: |
1064
+ Represents writing to a constant.
1065
+
1066
+ Foo = 1
1067
+ ^^^^^^^
1068
+ - name: DefNode
1069
+ fields:
1070
+ - name: name
1071
+ type: constant
1072
+ - name: name_loc
1073
+ type: location
1074
+ - name: receiver
1075
+ type: node?
1076
+ - name: parameters
1077
+ type: node?
1078
+ kind: ParametersNode
1079
+ - name: body
1080
+ type: node?
1081
+ - name: locals
1082
+ type: constant[]
1083
+ - name: def_keyword_loc
1084
+ type: location
1085
+ - name: operator_loc
1086
+ type: location?
1087
+ - name: lparen_loc
1088
+ type: location?
1089
+ - name: rparen_loc
1090
+ type: location?
1091
+ - name: equal_loc
1092
+ type: location?
1093
+ - name: end_keyword_loc
1094
+ type: location?
1095
+ comment: |
1096
+ Represents a method definition.
1097
+
1098
+ def method
1099
+ end
1100
+ ^^^^^^^^^^
1101
+ - name: DefinedNode
1102
+ fields:
1103
+ - name: lparen_loc
1104
+ type: location?
1105
+ - name: value
1106
+ type: node
1107
+ - name: rparen_loc
1108
+ type: location?
1109
+ - name: keyword_loc
1110
+ type: location
1111
+ comment: |
1112
+ Represents the use of the `defined?` keyword.
1113
+
1114
+ defined?(a)
1115
+ ^^^^^^^^^^^
1116
+ - name: ElseNode
1117
+ fields:
1118
+ - name: else_keyword_loc
1119
+ type: location
1120
+ - name: statements
1121
+ type: node?
1122
+ kind: StatementsNode
1123
+ - name: end_keyword_loc
1124
+ type: location?
1125
+ comment: |
1126
+ Represents an `else` clause in a `case`, `if`, or `unless` statement.
1127
+
1128
+ if a then b else c end
1129
+ ^^^^^^^^^^
1130
+ - name: EmbeddedStatementsNode
1131
+ fields:
1132
+ - name: opening_loc
1133
+ type: location
1134
+ - name: statements
1135
+ type: node?
1136
+ kind: StatementsNode
1137
+ - name: closing_loc
1138
+ type: location
1139
+ comment: |
1140
+ Represents an interpolated set of statements.
1141
+
1142
+ "foo #{bar}"
1143
+ ^^^^^^
1144
+ - name: EmbeddedVariableNode
1145
+ fields:
1146
+ - name: operator_loc
1147
+ type: location
1148
+ - name: variable
1149
+ type: node
1150
+ comment: |
1151
+ Represents an interpolated variable.
1152
+
1153
+ "foo #@bar"
1154
+ ^^^^^
1155
+ - name: EnsureNode
1156
+ fields:
1157
+ - name: ensure_keyword_loc
1158
+ type: location
1159
+ - name: statements
1160
+ type: node?
1161
+ kind: StatementsNode
1162
+ - name: end_keyword_loc
1163
+ type: location
1164
+ comment: |
1165
+ Represents an `ensure` clause in a `begin` statement.
1166
+
1167
+ begin
1168
+ foo
1169
+ ensure
1170
+ ^^^^^^
1171
+ bar
1172
+ end
1173
+ - name: FalseNode
1174
+ comment: |
1175
+ Represents the use of the literal `false` keyword.
1176
+
1177
+ false
1178
+ ^^^^^
1179
+ - name: FindPatternNode
1180
+ fields:
1181
+ - name: constant
1182
+ type: node?
1183
+ - name: left
1184
+ type: node
1185
+ - name: requireds
1186
+ type: node[]
1187
+ - name: right
1188
+ type: node
1189
+ - name: opening_loc
1190
+ type: location?
1191
+ - name: closing_loc
1192
+ type: location?
1193
+ comment: |
1194
+ Represents a find pattern in pattern matching.
1195
+
1196
+ foo in *bar, baz, *qux
1197
+ ^^^^^^^^^^^^^^^^^^^^^^
1198
+
1199
+ foo in [*bar, baz, *qux]
1200
+ ^^^^^^^^^^^^^^^^^^^^^^^^
1201
+
1202
+ foo in Foo(*bar, baz, *qux)
1203
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1204
+ - name: FlipFlopNode
1205
+ fields:
1206
+ - name: left
1207
+ type: node?
1208
+ - name: right
1209
+ type: node?
1210
+ - name: operator_loc
1211
+ type: location
1212
+ - name: flags
1213
+ type: flags
1214
+ kind: RangeFlags
1215
+ comment: |
1216
+ Represents the use of the `..` or `...` operators to create flip flops.
1217
+
1218
+ baz if foo .. bar
1219
+ ^^^^^^^^^^
1220
+ - name: FloatNode
1221
+ comment: |
1222
+ Represents a floating point number literal.
1223
+
1224
+ 1.0
1225
+ ^^^
1226
+ - name: ForNode
1227
+ fields:
1228
+ - name: index
1229
+ type: node
1230
+ - name: collection
1231
+ type: node
1232
+ - name: statements
1233
+ type: node?
1234
+ kind: StatementsNode
1235
+ - name: for_keyword_loc
1236
+ type: location
1237
+ - name: in_keyword_loc
1238
+ type: location
1239
+ - name: do_keyword_loc
1240
+ type: location?
1241
+ - name: end_keyword_loc
1242
+ type: location
1243
+ comment: |
1244
+ Represents the use of the `for` keyword.
1245
+
1246
+ for i in a end
1247
+ ^^^^^^^^^^^^^^
1248
+ - name: ForwardingArgumentsNode
1249
+ comment: |
1250
+ Represents forwarding all arguments to this method to another method.
1251
+
1252
+ def foo(...)
1253
+ bar(...)
1254
+ ^^^^^^^^
1255
+ end
1256
+ - name: ForwardingParameterNode
1257
+ comment: |
1258
+ Represents the use of the forwarding parameter in a method, block, or lambda declaration.
1259
+
1260
+ def foo(...)
1261
+ ^^^
1262
+ end
1263
+ - name: ForwardingSuperNode
1264
+ fields:
1265
+ - name: block
1266
+ type: node?
1267
+ kind: BlockNode
1268
+ comment: |
1269
+ Represents the use of the `super` keyword without parentheses or arguments.
1270
+
1271
+ super
1272
+ ^^^^^
1273
+ - name: GlobalVariableAndWriteNode
1274
+ fields:
1275
+ - name: name
1276
+ type: constant
1277
+ - name: name_loc
1278
+ type: location
1279
+ - name: operator_loc
1280
+ type: location
1281
+ - name: value
1282
+ type: node
1283
+ comment: |
1284
+ Represents the use of the `&&=` operator for assignment to a global variable.
1285
+
1286
+ $target &&= value
1287
+ ^^^^^^^^^^^^^^^^^
1288
+ - name: GlobalVariableOperatorWriteNode
1289
+ fields:
1290
+ - name: name
1291
+ type: constant
1292
+ - name: name_loc
1293
+ type: location
1294
+ - name: operator_loc
1295
+ type: location
1296
+ - name: value
1297
+ type: node
1298
+ - name: operator
1299
+ type: constant
1300
+ comment: |
1301
+ Represents assigning to a global variable using an operator that isn't `=`.
1302
+
1303
+ $target += value
1304
+ ^^^^^^^^^^^^^^^^
1305
+ - name: GlobalVariableOrWriteNode
1306
+ fields:
1307
+ - name: name
1308
+ type: constant
1309
+ - name: name_loc
1310
+ type: location
1311
+ - name: operator_loc
1312
+ type: location
1313
+ - name: value
1314
+ type: node
1315
+ comment: |
1316
+ Represents the use of the `||=` operator for assignment to a global variable.
1317
+
1318
+ $target ||= value
1319
+ ^^^^^^^^^^^^^^^^^
1320
+ - name: GlobalVariableReadNode
1321
+ fields:
1322
+ - name: name
1323
+ type: constant
1324
+ comment: |
1325
+ Represents referencing a global variable.
1326
+
1327
+ $foo
1328
+ ^^^^
1329
+ - name: GlobalVariableTargetNode
1330
+ fields:
1331
+ - name: name
1332
+ type: constant
1333
+ comment: |
1334
+ Represents writing to a global variable in a context that doesn't have an explicit value.
1335
+
1336
+ $foo, $bar = baz
1337
+ ^^^^ ^^^^
1338
+ - name: GlobalVariableWriteNode
1339
+ fields:
1340
+ - name: name
1341
+ type: constant
1342
+ - name: name_loc
1343
+ type: location
1344
+ - name: value
1345
+ type: node
1346
+ - name: operator_loc
1347
+ type: location
1348
+ comment: |
1349
+ Represents writing to a global variable.
1350
+
1351
+ $foo = 1
1352
+ ^^^^^^^^
1353
+ - name: HashNode
1354
+ fields:
1355
+ - name: opening_loc
1356
+ type: location
1357
+ - name: elements
1358
+ type: node[]
1359
+ - name: closing_loc
1360
+ type: location
1361
+ comment: |
1362
+ Represents a hash literal.
1363
+
1364
+ { a => b }
1365
+ ^^^^^^^^^^
1366
+ - name: HashPatternNode
1367
+ fields:
1368
+ - name: constant
1369
+ type: node?
1370
+ - name: assocs
1371
+ type: node[]
1372
+ - name: kwrest
1373
+ type: node?
1374
+ - name: opening_loc
1375
+ type: location?
1376
+ - name: closing_loc
1377
+ type: location?
1378
+ comment: |
1379
+ Represents a hash pattern in pattern matching.
1380
+
1381
+ foo => { a: 1, b: 2 }
1382
+ ^^^^^^^^^^^^^^
1383
+
1384
+ foo => { a: 1, b: 2, **c }
1385
+ ^^^^^^^^^^^^^^^^^^^
1386
+ - name: IfNode
1387
+ fields:
1388
+ - name: if_keyword_loc
1389
+ type: location?
1390
+ - name: predicate
1391
+ type: node
1392
+ - name: statements
1393
+ type: node?
1394
+ kind: StatementsNode
1395
+ - name: consequent
1396
+ type: node?
1397
+ - name: end_keyword_loc
1398
+ type: location?
1399
+ newline: predicate
1400
+ comment: |
1401
+ Represents the use of the `if` keyword, either in the block form or the modifier form.
1402
+
1403
+ bar if foo
1404
+ ^^^^^^^^^^
1405
+
1406
+ if foo then bar end
1407
+ ^^^^^^^^^^^^^^^^^^^
1408
+ - name: ImaginaryNode
1409
+ fields:
1410
+ - name: numeric
1411
+ type: node
1412
+ comment: |
1413
+ Represents an imaginary number literal.
1414
+
1415
+ 1.0i
1416
+ ^^^^
1417
+ - name: ImplicitNode
1418
+ fields:
1419
+ - name: value
1420
+ type: node
1421
+ comment: |
1422
+ Represents a node that is implicitly being added to the tree but doesn't
1423
+ correspond directly to a node in the source.
1424
+
1425
+ { foo: }
1426
+ ^^^^
1427
+
1428
+ { Foo: }
1429
+ ^^^^
1430
+ - name: InNode
1431
+ fields:
1432
+ - name: pattern
1433
+ type: node
1434
+ - name: statements
1435
+ type: node?
1436
+ kind: StatementsNode
1437
+ - name: in_loc
1438
+ type: location
1439
+ - name: then_loc
1440
+ type: location?
1441
+ comment: |
1442
+ Represents the use of the `in` keyword in a case statement.
1443
+
1444
+ case a; in b then c end
1445
+ ^^^^^^^^^^^
1446
+ - name: InstanceVariableAndWriteNode
1447
+ fields:
1448
+ - name: name
1449
+ type: constant
1450
+ - name: name_loc
1451
+ type: location
1452
+ - name: operator_loc
1453
+ type: location
1454
+ - name: value
1455
+ type: node
1456
+ comment: |
1457
+ Represents the use of the `&&=` operator for assignment to an instance variable.
1458
+
1459
+ @target &&= value
1460
+ ^^^^^^^^^^^^^^^^^
1461
+ - name: InstanceVariableOperatorWriteNode
1462
+ fields:
1463
+ - name: name
1464
+ type: constant
1465
+ - name: name_loc
1466
+ type: location
1467
+ - name: operator_loc
1468
+ type: location
1469
+ - name: value
1470
+ type: node
1471
+ - name: operator
1472
+ type: constant
1473
+ comment: |
1474
+ Represents assigning to an instance variable using an operator that isn't `=`.
1475
+
1476
+ @target += value
1477
+ ^^^^^^^^^^^^^^^^
1478
+ - name: InstanceVariableOrWriteNode
1479
+ fields:
1480
+ - name: name
1481
+ type: constant
1482
+ - name: name_loc
1483
+ type: location
1484
+ - name: operator_loc
1485
+ type: location
1486
+ - name: value
1487
+ type: node
1488
+ comment: |
1489
+ Represents the use of the `||=` operator for assignment to an instance variable.
1490
+
1491
+ @target ||= value
1492
+ ^^^^^^^^^^^^^^^^^
1493
+ - name: InstanceVariableReadNode
1494
+ fields:
1495
+ - name: name
1496
+ type: constant
1497
+ comment: |
1498
+ Represents referencing an instance variable.
1499
+
1500
+ @foo
1501
+ ^^^^
1502
+ - name: InstanceVariableTargetNode
1503
+ fields:
1504
+ - name: name
1505
+ type: constant
1506
+ comment: |
1507
+ Represents writing to an instance variable in a context that doesn't have an explicit value.
1508
+
1509
+ @foo, @bar = baz
1510
+ ^^^^ ^^^^
1511
+ - name: InstanceVariableWriteNode
1512
+ fields:
1513
+ - name: name
1514
+ type: constant
1515
+ - name: name_loc
1516
+ type: location
1517
+ - name: value
1518
+ type: node
1519
+ - name: operator_loc
1520
+ type: location
1521
+ comment: |
1522
+ Represents writing to an instance variable.
1523
+
1524
+ @foo = 1
1525
+ ^^^^^^^^
1526
+ - name: IntegerNode
1527
+ fields:
1528
+ - name: flags
1529
+ type: flags
1530
+ kind: IntegerBaseFlags
1531
+ comment: |
1532
+ Represents an integer number literal.
1533
+
1534
+ 1
1535
+ ^
1536
+ - name: InterpolatedMatchLastLineNode
1537
+ fields:
1538
+ - name: opening_loc
1539
+ type: location
1540
+ - name: parts
1541
+ type: node[]
1542
+ - name: closing_loc
1543
+ type: location
1544
+ - name: flags
1545
+ type: flags
1546
+ kind: RegularExpressionFlags
1547
+ newline: parts
1548
+ comment: |
1549
+ Represents a regular expression literal that contains interpolation that
1550
+ is being used in the predicate of a conditional to implicitly match
1551
+ against the last line read by an IO object.
1552
+
1553
+ if /foo #{bar} baz/ then end
1554
+ ^^^^^^^^^^^^^^^^
1555
+ - name: InterpolatedRegularExpressionNode
1556
+ fields:
1557
+ - name: opening_loc
1558
+ type: location
1559
+ - name: parts
1560
+ type: node[]
1561
+ - name: closing_loc
1562
+ type: location
1563
+ - name: flags
1564
+ type: flags
1565
+ kind: RegularExpressionFlags
1566
+ newline: parts
1567
+ comment: |
1568
+ Represents a regular expression literal that contains interpolation.
1569
+
1570
+ /foo #{bar} baz/
1571
+ ^^^^^^^^^^^^^^^^
1572
+ - name: InterpolatedStringNode
1573
+ fields:
1574
+ - name: opening_loc
1575
+ type: location?
1576
+ - name: parts
1577
+ type: node[]
1578
+ - name: closing_loc
1579
+ type: location?
1580
+ newline: parts
1581
+ comment: |
1582
+ Represents a string literal that contains interpolation.
1583
+
1584
+ "foo #{bar} baz"
1585
+ ^^^^^^^^^^^^^^^^
1586
+ - name: InterpolatedSymbolNode
1587
+ fields:
1588
+ - name: opening_loc
1589
+ type: location?
1590
+ - name: parts
1591
+ type: node[]
1592
+ - name: closing_loc
1593
+ type: location?
1594
+ newline: parts
1595
+ comment: |
1596
+ Represents a symbol literal that contains interpolation.
1597
+
1598
+ :"foo #{bar} baz"
1599
+ ^^^^^^^^^^^^^^^^^
1600
+ - name: InterpolatedXStringNode
1601
+ fields:
1602
+ - name: opening_loc
1603
+ type: location
1604
+ - name: parts
1605
+ type: node[]
1606
+ - name: closing_loc
1607
+ type: location
1608
+ newline: parts
1609
+ comment: |
1610
+ Represents an xstring literal that contains interpolation.
1611
+
1612
+ `foo #{bar} baz`
1613
+ ^^^^^^^^^^^^^^^^
1614
+ - name: KeywordHashNode
1615
+ fields:
1616
+ - name: elements
1617
+ type: node[]
1618
+ comment: |
1619
+ Represents a hash literal without opening and closing braces.
1620
+
1621
+ foo(a: b)
1622
+ ^^^^
1623
+ - name: KeywordParameterNode
1624
+ fields:
1625
+ - name: name
1626
+ type: constant
1627
+ - name: name_loc
1628
+ type: location
1629
+ - name: value
1630
+ type: node?
1631
+ comment: |
1632
+ Represents a keyword parameter to a method, block, or lambda definition.
1633
+
1634
+ def a(b:)
1635
+ ^^
1636
+ end
1637
+
1638
+ def a(b: 1)
1639
+ ^^^^
1640
+ end
1641
+ - name: KeywordRestParameterNode
1642
+ fields:
1643
+ - name: name
1644
+ type: constant?
1645
+ - name: name_loc
1646
+ type: location?
1647
+ - name: operator_loc
1648
+ type: location
1649
+ comment: |
1650
+ Represents a keyword rest parameter to a method, block, or lambda definition.
1651
+
1652
+ def a(**b)
1653
+ ^^^
1654
+ end
1655
+ - name: LambdaNode
1656
+ fields:
1657
+ - name: locals
1658
+ type: constant[]
1659
+ - name: operator_loc
1660
+ type: location
1661
+ - name: opening_loc
1662
+ type: location
1663
+ - name: closing_loc
1664
+ type: location
1665
+ - name: parameters
1666
+ type: node?
1667
+ kind: BlockParametersNode
1668
+ - name: body
1669
+ type: node?
1670
+ comment: |
1671
+ Represents using a lambda literal (not the lambda method call).
1672
+
1673
+ ->(value) { value * 2 }
1674
+ ^^^^^^^^^^^^^^^^^^^^^^^
1675
+ - name: LocalVariableAndWriteNode
1676
+ fields:
1677
+ - name: name_loc
1678
+ type: location
1679
+ - name: operator_loc
1680
+ type: location
1681
+ - name: value
1682
+ type: node
1683
+ - name: name
1684
+ type: constant
1685
+ - name: depth
1686
+ type: uint32
1687
+ comment: |
1688
+ Represents the use of the `&&=` operator for assignment to a local variable.
1689
+
1690
+ target &&= value
1691
+ ^^^^^^^^^^^^^^^^
1692
+ - name: LocalVariableOperatorWriteNode
1693
+ fields:
1694
+ - name: name_loc
1695
+ type: location
1696
+ - name: operator_loc
1697
+ type: location
1698
+ - name: value
1699
+ type: node
1700
+ - name: name
1701
+ type: constant
1702
+ - name: operator
1703
+ type: constant
1704
+ - name: depth
1705
+ type: uint32
1706
+ comment: |
1707
+ Represents assigning to a local variable using an operator that isn't `=`.
1708
+
1709
+ target += value
1710
+ ^^^^^^^^^^^^^^^
1711
+ - name: LocalVariableOrWriteNode
1712
+ fields:
1713
+ - name: name_loc
1714
+ type: location
1715
+ - name: operator_loc
1716
+ type: location
1717
+ - name: value
1718
+ type: node
1719
+ - name: name
1720
+ type: constant
1721
+ - name: depth
1722
+ type: uint32
1723
+ comment: |
1724
+ Represents the use of the `||=` operator for assignment to a local variable.
1725
+
1726
+ target ||= value
1727
+ ^^^^^^^^^^^^^^^^
1728
+ - name: LocalVariableReadNode
1729
+ fields:
1730
+ - name: name
1731
+ type: constant
1732
+ - name: depth
1733
+ type: uint32
1734
+ comment: |
1735
+ Represents reading a local variable. Note that this requires that a local
1736
+ variable of the same name has already been written to in the same scope,
1737
+ otherwise it is parsed as a method call.
1738
+
1739
+ foo
1740
+ ^^^
1741
+ - name: LocalVariableTargetNode
1742
+ fields:
1743
+ - name: name
1744
+ type: constant
1745
+ - name: depth
1746
+ type: uint32
1747
+ comment: |
1748
+ Represents writing to a local variable in a context that doesn't have an explicit value.
1749
+
1750
+ foo, bar = baz
1751
+ ^^^ ^^^
1752
+ - name: LocalVariableWriteNode
1753
+ fields:
1754
+ - name: name
1755
+ type: constant
1756
+ - name: depth
1757
+ type: uint32
1758
+ - name: name_loc
1759
+ type: location
1760
+ - name: value
1761
+ type: node
1762
+ - name: operator_loc
1763
+ type: location
1764
+ comment: |
1765
+ Represents writing to a local variable.
1766
+
1767
+ foo = 1
1768
+ ^^^^^^^
1769
+ - name: MatchLastLineNode
1770
+ fields:
1771
+ - name: opening_loc
1772
+ type: location
1773
+ - name: content_loc
1774
+ type: location
1775
+ semantic_field: true # https://github.com/ruby/prism/issues/1452
1776
+ - name: closing_loc
1777
+ type: location
1778
+ - name: unescaped
1779
+ type: string
1780
+ - name: flags
1781
+ type: flags
1782
+ kind: RegularExpressionFlags
1783
+ comment: |
1784
+ Represents a regular expression literal used in the predicate of a
1785
+ conditional to implicitly match against the last line read by an IO
1786
+ object.
1787
+
1788
+ if /foo/i then end
1789
+ ^^^^^^
1790
+ - name: MatchPredicateNode
1791
+ fields:
1792
+ - name: value
1793
+ type: node
1794
+ - name: pattern
1795
+ type: node
1796
+ - name: operator_loc
1797
+ type: location
1798
+ comment: |
1799
+ Represents the use of the modifier `in` operator.
1800
+
1801
+ foo in bar
1802
+ ^^^^^^^^^^
1803
+ - name: MatchRequiredNode
1804
+ fields:
1805
+ - name: value
1806
+ type: node
1807
+ - name: pattern
1808
+ type: node
1809
+ - name: operator_loc
1810
+ type: location
1811
+ comment: |
1812
+ Represents the use of the `=>` operator.
1813
+
1814
+ foo => bar
1815
+ ^^^^^^^^^^
1816
+ - name: MatchWriteNode
1817
+ fields:
1818
+ - name: call
1819
+ type: node
1820
+ kind: CallNode
1821
+ - name: locals
1822
+ type: constant[]
1823
+ comment: |
1824
+ Represents writing local variables using a regular expression match with
1825
+ named capture groups.
1826
+
1827
+ /(?<foo>bar)/ =~ baz
1828
+ ^^^^^^^^^^^^^^^^^^^^
1829
+ - name: MissingNode
1830
+ comment: |
1831
+ Represents a node that is missing from the source and results in a syntax
1832
+ error.
1833
+ - name: ModuleNode
1834
+ fields:
1835
+ - name: locals
1836
+ type: constant[]
1837
+ - name: module_keyword_loc
1838
+ type: location
1839
+ - name: constant_path
1840
+ type: node
1841
+ - name: body
1842
+ type: node?
1843
+ - name: end_keyword_loc
1844
+ type: location
1845
+ - name: name
1846
+ type: constant
1847
+ comment: |
1848
+ Represents a module declaration involving the `module` keyword.
1849
+
1850
+ module Foo end
1851
+ ^^^^^^^^^^^^^^
1852
+ - name: MultiTargetNode
1853
+ fields:
1854
+ - name: targets
1855
+ type: node[]
1856
+ - name: lparen_loc
1857
+ type: location?
1858
+ - name: rparen_loc
1859
+ type: location?
1860
+ comment: |
1861
+ Represents a multi-target expression.
1862
+
1863
+ a, b, c = 1, 2, 3
1864
+ ^^^^^^^
1865
+ - name: MultiWriteNode
1866
+ fields:
1867
+ - name: targets
1868
+ type: node[]
1869
+ - name: lparen_loc
1870
+ type: location?
1871
+ - name: rparen_loc
1872
+ type: location?
1873
+ - name: operator_loc
1874
+ type: location
1875
+ - name: value
1876
+ type: node
1877
+ comment: |
1878
+ Represents a write to a multi-target expression.
1879
+
1880
+ a, b, c = 1, 2, 3
1881
+ ^^^^^^^^^^^^^^^^^
1882
+ - name: NextNode
1883
+ fields:
1884
+ - name: arguments
1885
+ type: node?
1886
+ kind: ArgumentsNode
1887
+ - name: keyword_loc
1888
+ type: location
1889
+ comment: |
1890
+ Represents the use of the `next` keyword.
1891
+
1892
+ next 1
1893
+ ^^^^^^
1894
+ - name: NilNode
1895
+ comment: |
1896
+ Represents the use of the `nil` keyword.
1897
+
1898
+ nil
1899
+ ^^^
1900
+ - name: NoKeywordsParameterNode
1901
+ fields:
1902
+ - name: operator_loc
1903
+ type: location
1904
+ - name: keyword_loc
1905
+ type: location
1906
+ comment: |
1907
+ Represents the use of `**nil` inside method arguments.
1908
+
1909
+ def a(**nil)
1910
+ ^^^^^
1911
+ end
1912
+ - name: NumberedReferenceReadNode
1913
+ fields:
1914
+ - name: number
1915
+ type: uint32
1916
+ comment: |
1917
+ Represents reading a numbered reference to a capture in the previous match.
1918
+
1919
+ $1
1920
+ ^^
1921
+ - name: OptionalParameterNode
1922
+ fields:
1923
+ - name: name
1924
+ type: constant
1925
+ - name: name_loc
1926
+ type: location
1927
+ - name: operator_loc
1928
+ type: location
1929
+ - name: value
1930
+ type: node
1931
+ comment: |
1932
+ Represents an optional parameter to a method, block, or lambda definition.
1933
+
1934
+ def a(b = 1)
1935
+ ^^^^^
1936
+ end
1937
+ - name: OrNode
1938
+ fields:
1939
+ - name: left
1940
+ type: node
1941
+ - name: right
1942
+ type: node
1943
+ - name: operator_loc
1944
+ type: location
1945
+ comment: |
1946
+ Represents the use of the `||` operator or the `or` keyword.
1947
+
1948
+ left or right
1949
+ ^^^^^^^^^^^^^
1950
+ - name: ParametersNode
1951
+ fields:
1952
+ - name: requireds
1953
+ type: node[]
1954
+ - name: optionals
1955
+ type: node[]
1956
+ - name: rest
1957
+ type: node?
1958
+ kind: RestParameterNode
1959
+ - name: posts
1960
+ type: node[]
1961
+ - name: keywords
1962
+ type: node[]
1963
+ - name: keyword_rest
1964
+ type: node?
1965
+ - name: block
1966
+ type: node?
1967
+ kind: BlockParameterNode
1968
+ comment: |
1969
+ Represents the list of parameters on a method, block, or lambda definition.
1970
+
1971
+ def a(b, c, d)
1972
+ ^^^^^^^
1973
+ end
1974
+ - name: ParenthesesNode
1975
+ fields:
1976
+ - name: body
1977
+ type: node?
1978
+ - name: opening_loc
1979
+ type: location
1980
+ - name: closing_loc
1981
+ type: location
1982
+ newline: false
1983
+ comment: |
1984
+ Represents a parenthesized expression
1985
+
1986
+ (10 + 34)
1987
+ ^^^^^^^^^
1988
+ - name: PinnedExpressionNode
1989
+ fields:
1990
+ - name: expression
1991
+ type: node
1992
+ - name: operator_loc
1993
+ type: location
1994
+ - name: lparen_loc
1995
+ type: location
1996
+ - name: rparen_loc
1997
+ type: location
1998
+ comment: |
1999
+ Represents the use of the `^` operator for pinning an expression in a
2000
+ pattern matching expression.
2001
+
2002
+ foo in ^(bar)
2003
+ ^^^^^^
2004
+ - name: PinnedVariableNode
2005
+ fields:
2006
+ - name: variable
2007
+ type: node
2008
+ - name: operator_loc
2009
+ type: location
2010
+ comment: |
2011
+ Represents the use of the `^` operator for pinning a variable in a pattern
2012
+ matching expression.
2013
+
2014
+ foo in ^bar
2015
+ ^^^^
2016
+ - name: PostExecutionNode
2017
+ fields:
2018
+ - name: statements
2019
+ type: node?
2020
+ kind: StatementsNode
2021
+ - name: keyword_loc
2022
+ type: location
2023
+ - name: opening_loc
2024
+ type: location
2025
+ - name: closing_loc
2026
+ type: location
2027
+ comment: |
2028
+ Represents the use of the `END` keyword.
2029
+
2030
+ END { foo }
2031
+ ^^^^^^^^^^^
2032
+ - name: PreExecutionNode
2033
+ fields:
2034
+ - name: statements
2035
+ type: node?
2036
+ kind: StatementsNode
2037
+ - name: keyword_loc
2038
+ type: location
2039
+ - name: opening_loc
2040
+ type: location
2041
+ - name: closing_loc
2042
+ type: location
2043
+ comment: |
2044
+ Represents the use of the `BEGIN` keyword.
2045
+
2046
+ BEGIN { foo }
2047
+ ^^^^^^^^^^^^^
2048
+ - name: ProgramNode
2049
+ fields:
2050
+ - name: locals
2051
+ type: constant[]
2052
+ - name: statements
2053
+ type: node
2054
+ kind: StatementsNode
2055
+ comment: The top level node of any parse tree.
2056
+ - name: RangeNode
2057
+ fields:
2058
+ - name: left
2059
+ type: node?
2060
+ - name: right
2061
+ type: node?
2062
+ - name: operator_loc
2063
+ type: location
2064
+ - name: flags
2065
+ type: flags
2066
+ kind: RangeFlags
2067
+ comment: |
2068
+ Represents the use of the `..` or `...` operators.
2069
+
2070
+ 1..2
2071
+ ^^^^
2072
+
2073
+ c if a =~ /left/ ... b =~ /right/
2074
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2075
+ - name: RationalNode
2076
+ fields:
2077
+ - name: numeric
2078
+ type: node
2079
+ comment: |
2080
+ Represents a rational number literal.
2081
+
2082
+ 1.0r
2083
+ ^^^^
2084
+ - name: RedoNode
2085
+ comment: |
2086
+ Represents the use of the `redo` keyword.
2087
+
2088
+ redo
2089
+ ^^^^
2090
+ - name: RegularExpressionNode
2091
+ fields:
2092
+ - name: opening_loc
2093
+ type: location
2094
+ - name: content_loc
2095
+ type: location
2096
+ semantic_field: true # https://github.com/ruby/prism/issues/1452
2097
+ - name: closing_loc
2098
+ type: location
2099
+ - name: unescaped
2100
+ type: string
2101
+ - name: flags
2102
+ type: flags
2103
+ kind: RegularExpressionFlags
2104
+ comment: |
2105
+ Represents a regular expression literal with no interpolation.
2106
+
2107
+ /foo/i
2108
+ ^^^^^^
2109
+ - name: RequiredDestructuredParameterNode
2110
+ fields:
2111
+ - name: parameters
2112
+ type: node[]
2113
+ - name: opening_loc
2114
+ type: location
2115
+ - name: closing_loc
2116
+ type: location
2117
+ comment: |
2118
+ Represents a destructured required parameter node.
2119
+
2120
+ def foo((bar, baz))
2121
+ ^^^^^^^^^^
2122
+ end
2123
+ - name: RequiredParameterNode
2124
+ fields:
2125
+ - name: name
2126
+ type: constant
2127
+ comment: |
2128
+ Represents a required parameter to a method, block, or lambda definition.
2129
+
2130
+ def a(b)
2131
+ ^
2132
+ end
2133
+ - name: RescueModifierNode
2134
+ fields:
2135
+ - name: expression
2136
+ type: node
2137
+ - name: keyword_loc
2138
+ type: location
2139
+ - name: rescue_expression
2140
+ type: node
2141
+ newline: expression
2142
+ comment: |
2143
+ Represents an expression modified with a rescue.
2144
+
2145
+ foo rescue nil
2146
+ ^^^^^^^^^^^^^^
2147
+ - name: RescueNode
2148
+ fields:
2149
+ - name: keyword_loc
2150
+ type: location
2151
+ - name: exceptions
2152
+ type: node[]
2153
+ - name: operator_loc
2154
+ type: location?
2155
+ - name: reference
2156
+ type: node?
2157
+ - name: statements
2158
+ type: node?
2159
+ kind: StatementsNode
2160
+ - name: consequent
2161
+ type: node?
2162
+ kind: RescueNode
2163
+ comment: |
2164
+ Represents a rescue statement.
2165
+
2166
+ begin
2167
+ rescue Foo, *splat, Bar => ex
2168
+ ^^^^^^
2169
+ foo
2170
+ end
2171
+
2172
+ `Foo, *splat, Bar` are in the `exceptions` field.
2173
+ `ex` is in the `exception` field.
2174
+ - name: RestParameterNode
2175
+ fields:
2176
+ - name: name
2177
+ type: constant?
2178
+ - name: name_loc
2179
+ type: location?
2180
+ - name: operator_loc
2181
+ type: location
2182
+ comment: |
2183
+ Represents a rest parameter to a method, block, or lambda definition.
2184
+
2185
+ def a(*b)
2186
+ ^^
2187
+ end
2188
+ - name: RetryNode
2189
+ comment: |
2190
+ Represents the use of the `retry` keyword.
2191
+
2192
+ retry
2193
+ ^^^^^
2194
+ - name: ReturnNode
2195
+ fields:
2196
+ - name: keyword_loc
2197
+ type: location
2198
+ - name: arguments
2199
+ type: node?
2200
+ kind: ArgumentsNode
2201
+ comment: |
2202
+ Represents the use of the `return` keyword.
2203
+
2204
+ return 1
2205
+ ^^^^^^^^
2206
+ - name: SelfNode
2207
+ comment: |
2208
+ Represents the `self` keyword.
2209
+
2210
+ self
2211
+ ^^^^
2212
+ - name: SingletonClassNode
2213
+ fields:
2214
+ - name: locals
2215
+ type: constant[]
2216
+ - name: class_keyword_loc
2217
+ type: location
2218
+ - name: operator_loc
2219
+ type: location
2220
+ - name: expression
2221
+ type: node
2222
+ - name: body
2223
+ type: node?
2224
+ - name: end_keyword_loc
2225
+ type: location
2226
+ comment: |
2227
+ Represents a singleton class declaration involving the `class` keyword.
2228
+
2229
+ class << self end
2230
+ ^^^^^^^^^^^^^^^^^
2231
+ - name: SourceEncodingNode
2232
+ comment: |
2233
+ Represents the use of the `__ENCODING__` keyword.
2234
+
2235
+ __ENCODING__
2236
+ ^^^^^^^^^^^^
2237
+ - name: SourceFileNode
2238
+ fields:
2239
+ - name: filepath
2240
+ type: string
2241
+ comment: |
2242
+ Represents the use of the `__FILE__` keyword.
2243
+
2244
+ __FILE__
2245
+ ^^^^^^^^
2246
+ - name: SourceLineNode
2247
+ comment: |
2248
+ Represents the use of the `__LINE__` keyword.
2249
+
2250
+ __LINE__
2251
+ ^^^^^^^^
2252
+ - name: SplatNode
2253
+ fields:
2254
+ - name: operator_loc
2255
+ type: location
2256
+ - name: expression
2257
+ type: node?
2258
+ comment: |
2259
+ Represents the use of the splat operator.
2260
+
2261
+ [*a]
2262
+ ^^
2263
+ - name: StatementsNode
2264
+ fields:
2265
+ - name: body
2266
+ type: node[]
2267
+ comment: |
2268
+ Represents a set of statements contained within some scope.
2269
+
2270
+ foo; bar; baz
2271
+ ^^^^^^^^^^^^^
2272
+ - name: StringConcatNode
2273
+ fields:
2274
+ - name: left
2275
+ type: node
2276
+ - name: right
2277
+ type: node
2278
+ comment: |
2279
+ Represents the use of compile-time string concatenation.
2280
+
2281
+ "foo" "bar"
2282
+ ^^^^^^^^^^^
2283
+ - name: StringNode
2284
+ fields:
2285
+ - name: flags
2286
+ type: flags
2287
+ kind: StringFlags
2288
+ - name: opening_loc
2289
+ type: location?
2290
+ semantic_field: true # https://github.com/ruby/prism/issues/1452
2291
+ - name: content_loc
2292
+ type: location
2293
+ semantic_field: true # https://github.com/ruby/prism/issues/1452
2294
+ - name: closing_loc
2295
+ type: location?
2296
+ - name: unescaped
2297
+ type: string
2298
+ comment: |
2299
+ Represents a string literal, a string contained within a `%w` list, or
2300
+ plain string content within an interpolated string.
2301
+
2302
+ "foo"
2303
+ ^^^^^
2304
+
2305
+ %w[foo]
2306
+ ^^^
2307
+
2308
+ "foo #{bar} baz"
2309
+ ^^^^ ^^^^
2310
+ - name: SuperNode
2311
+ fields:
2312
+ - name: keyword_loc
2313
+ type: location
2314
+ - name: lparen_loc
2315
+ type: location?
2316
+ - name: arguments
2317
+ type: node?
2318
+ kind: ArgumentsNode
2319
+ - name: rparen_loc
2320
+ type: location?
2321
+ - name: block
2322
+ type: node?
2323
+ comment: |
2324
+ Represents the use of the `super` keyword with parentheses or arguments.
2325
+
2326
+ super()
2327
+ ^^^^^^^
2328
+
2329
+ super foo, bar
2330
+ ^^^^^^^^^^^^^^
2331
+ - name: SymbolNode
2332
+ fields:
2333
+ - name: opening_loc
2334
+ type: location?
2335
+ - name: value_loc
2336
+ type: location?
2337
+ - name: closing_loc
2338
+ type: location?
2339
+ - name: unescaped
2340
+ type: string
2341
+ comment: |
2342
+ Represents a symbol literal or a symbol contained within a `%i` list.
2343
+
2344
+ :foo
2345
+ ^^^^
2346
+
2347
+ %i[foo]
2348
+ ^^^
2349
+ - name: TrueNode
2350
+ comment: |
2351
+ Represents the use of the literal `true` keyword.
2352
+
2353
+ true
2354
+ ^^^^
2355
+ - name: UndefNode
2356
+ fields:
2357
+ - name: names
2358
+ type: node[]
2359
+ - name: keyword_loc
2360
+ type: location
2361
+ comment: |
2362
+ Represents the use of the `undef` keyword.
2363
+
2364
+ undef :foo, :bar, :baz
2365
+ ^^^^^^^^^^^^^^^^^^^^^^
2366
+ - name: UnlessNode
2367
+ fields:
2368
+ - name: keyword_loc
2369
+ type: location
2370
+ - name: predicate
2371
+ type: node
2372
+ - name: statements
2373
+ type: node?
2374
+ kind: StatementsNode
2375
+ - name: consequent
2376
+ type: node?
2377
+ kind: ElseNode
2378
+ - name: end_keyword_loc
2379
+ type: location?
2380
+ newline: predicate
2381
+ comment: |
2382
+ Represents the use of the `unless` keyword, either in the block form or the modifier form.
2383
+
2384
+ bar unless foo
2385
+ ^^^^^^^^^^^^^^
2386
+
2387
+ unless foo then bar end
2388
+ ^^^^^^^^^^^^^^^^^^^^^^^
2389
+ - name: UntilNode
2390
+ fields:
2391
+ - name: keyword_loc
2392
+ type: location
2393
+ - name: closing_loc
2394
+ type: location?
2395
+ - name: predicate
2396
+ type: node
2397
+ - name: statements
2398
+ type: node?
2399
+ kind: StatementsNode
2400
+ - name: flags
2401
+ type: flags
2402
+ kind: LoopFlags
2403
+ newline: predicate
2404
+ comment: |
2405
+ Represents the use of the `until` keyword, either in the block form or the modifier form.
2406
+
2407
+ bar until foo
2408
+ ^^^^^^^^^^^^^
2409
+
2410
+ until foo do bar end
2411
+ ^^^^^^^^^^^^^^^^^^^^
2412
+ - name: WhenNode
2413
+ fields:
2414
+ - name: keyword_loc
2415
+ type: location
2416
+ - name: conditions
2417
+ type: node[]
2418
+ - name: statements
2419
+ type: node?
2420
+ kind: StatementsNode
2421
+ comment: |
2422
+ Represents the use of the `when` keyword within a case statement.
2423
+
2424
+ case true
2425
+ when true
2426
+ ^^^^^^^^^
2427
+ end
2428
+ - name: WhileNode
2429
+ fields:
2430
+ - name: keyword_loc
2431
+ type: location
2432
+ - name: closing_loc
2433
+ type: location?
2434
+ - name: predicate
2435
+ type: node
2436
+ - name: statements
2437
+ type: node?
2438
+ kind: StatementsNode
2439
+ - name: flags
2440
+ type: flags
2441
+ kind: LoopFlags
2442
+ newline: predicate
2443
+ comment: |
2444
+ Represents the use of the `while` keyword, either in the block form or the modifier form.
2445
+
2446
+ bar while foo
2447
+ ^^^^^^^^^^^^^
2448
+
2449
+ while foo do bar end
2450
+ ^^^^^^^^^^^^^^^^^^^^
2451
+ - name: XStringNode
2452
+ fields:
2453
+ - name: opening_loc
2454
+ type: location
2455
+ - name: content_loc
2456
+ type: location
2457
+ - name: closing_loc
2458
+ type: location
2459
+ - name: unescaped
2460
+ type: string
2461
+ comment: |
2462
+ Represents an xstring literal with no interpolation.
2463
+
2464
+ `foo`
2465
+ ^^^^^
2466
+ - name: YieldNode
2467
+ fields:
2468
+ - name: keyword_loc
2469
+ type: location
2470
+ - name: lparen_loc
2471
+ type: location?
2472
+ - name: arguments
2473
+ type: node?
2474
+ kind: ArgumentsNode
2475
+ - name: rparen_loc
2476
+ type: location?
2477
+ comment: |
2478
+ Represents the use of the `yield` keyword.
2479
+
2480
+ yield 1
2481
+ ^^^^^^^