yarp 0.6.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 (82) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +76 -0
  3. data/CONTRIBUTING.md +51 -0
  4. data/LICENSE.md +7 -0
  5. data/Makefile.in +79 -0
  6. data/README.md +86 -0
  7. data/config.h.in +25 -0
  8. data/config.yml +2147 -0
  9. data/configure +4487 -0
  10. data/docs/build_system.md +85 -0
  11. data/docs/building.md +26 -0
  12. data/docs/configuration.md +56 -0
  13. data/docs/design.md +53 -0
  14. data/docs/encoding.md +116 -0
  15. data/docs/extension.md +20 -0
  16. data/docs/fuzzing.md +93 -0
  17. data/docs/heredocs.md +36 -0
  18. data/docs/mapping.md +117 -0
  19. data/docs/ripper.md +36 -0
  20. data/docs/serialization.md +130 -0
  21. data/docs/testing.md +55 -0
  22. data/ext/yarp/api_node.c +3680 -0
  23. data/ext/yarp/api_pack.c +256 -0
  24. data/ext/yarp/extconf.rb +131 -0
  25. data/ext/yarp/extension.c +547 -0
  26. data/ext/yarp/extension.h +18 -0
  27. data/include/yarp/ast.h +1412 -0
  28. data/include/yarp/defines.h +54 -0
  29. data/include/yarp/diagnostic.h +24 -0
  30. data/include/yarp/enc/yp_encoding.h +94 -0
  31. data/include/yarp/node.h +36 -0
  32. data/include/yarp/pack.h +141 -0
  33. data/include/yarp/parser.h +389 -0
  34. data/include/yarp/regexp.h +19 -0
  35. data/include/yarp/unescape.h +42 -0
  36. data/include/yarp/util/yp_buffer.h +39 -0
  37. data/include/yarp/util/yp_char.h +75 -0
  38. data/include/yarp/util/yp_constant_pool.h +64 -0
  39. data/include/yarp/util/yp_list.h +67 -0
  40. data/include/yarp/util/yp_memchr.h +14 -0
  41. data/include/yarp/util/yp_newline_list.h +54 -0
  42. data/include/yarp/util/yp_state_stack.h +24 -0
  43. data/include/yarp/util/yp_string.h +57 -0
  44. data/include/yarp/util/yp_string_list.h +28 -0
  45. data/include/yarp/util/yp_strpbrk.h +29 -0
  46. data/include/yarp/version.h +5 -0
  47. data/include/yarp.h +69 -0
  48. data/lib/yarp/lex_compat.rb +759 -0
  49. data/lib/yarp/node.rb +7428 -0
  50. data/lib/yarp/pack.rb +185 -0
  51. data/lib/yarp/ripper_compat.rb +174 -0
  52. data/lib/yarp/serialize.rb +389 -0
  53. data/lib/yarp.rb +330 -0
  54. data/src/diagnostic.c +25 -0
  55. data/src/enc/yp_big5.c +79 -0
  56. data/src/enc/yp_euc_jp.c +85 -0
  57. data/src/enc/yp_gbk.c +88 -0
  58. data/src/enc/yp_shift_jis.c +83 -0
  59. data/src/enc/yp_tables.c +509 -0
  60. data/src/enc/yp_unicode.c +2320 -0
  61. data/src/enc/yp_windows_31j.c +83 -0
  62. data/src/node.c +2011 -0
  63. data/src/pack.c +493 -0
  64. data/src/prettyprint.c +1782 -0
  65. data/src/regexp.c +580 -0
  66. data/src/serialize.c +1576 -0
  67. data/src/token_type.c +347 -0
  68. data/src/unescape.c +576 -0
  69. data/src/util/yp_buffer.c +78 -0
  70. data/src/util/yp_char.c +229 -0
  71. data/src/util/yp_constant_pool.c +147 -0
  72. data/src/util/yp_list.c +50 -0
  73. data/src/util/yp_memchr.c +31 -0
  74. data/src/util/yp_newline_list.c +119 -0
  75. data/src/util/yp_state_stack.c +25 -0
  76. data/src/util/yp_string.c +207 -0
  77. data/src/util/yp_string_list.c +32 -0
  78. data/src/util/yp_strncasecmp.c +20 -0
  79. data/src/util/yp_strpbrk.c +66 -0
  80. data/src/yarp.c +13211 -0
  81. data/yarp.gemspec +100 -0
  82. metadata +125 -0
data/config.yml ADDED
@@ -0,0 +1,2147 @@
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: MINUS
236
+ comment: "-"
237
+ - name: MINUS_EQUAL
238
+ comment: "-="
239
+ - name: MINUS_GREATER
240
+ comment: "->"
241
+ - name: NEWLINE
242
+ comment: "a newline character outside of other tokens"
243
+ - name: NUMBERED_REFERENCE
244
+ comment: "a numbered reference to a capture group in the previous regular expression match"
245
+ - name: PARENTHESIS_LEFT
246
+ comment: "("
247
+ - name: PARENTHESIS_LEFT_PARENTHESES
248
+ comment: "( for a parentheses node"
249
+ - name: PARENTHESIS_RIGHT
250
+ comment: ")"
251
+ - name: PERCENT
252
+ comment: "%"
253
+ - name: PERCENT_EQUAL
254
+ comment: "%="
255
+ - name: PERCENT_LOWER_I
256
+ comment: "%i"
257
+ - name: PERCENT_LOWER_W
258
+ comment: "%w"
259
+ - name: PERCENT_LOWER_X
260
+ comment: "%x"
261
+ - name: PERCENT_UPPER_I
262
+ comment: "%I"
263
+ - name: PERCENT_UPPER_W
264
+ comment: "%W"
265
+ - name: PIPE
266
+ comment: "|"
267
+ - name: PIPE_EQUAL
268
+ comment: "|="
269
+ - name: PIPE_PIPE
270
+ comment: "||"
271
+ - name: PIPE_PIPE_EQUAL
272
+ comment: "||="
273
+ - name: PLUS
274
+ comment: "+"
275
+ - name: PLUS_EQUAL
276
+ comment: "+="
277
+ - name: QUESTION_MARK
278
+ comment: "?"
279
+ - name: REGEXP_BEGIN
280
+ comment: "the beginning of a regular expression"
281
+ - name: REGEXP_END
282
+ comment: "the end of a regular expression"
283
+ - name: SEMICOLON
284
+ comment: ";"
285
+ - name: SLASH
286
+ comment: "/"
287
+ - name: SLASH_EQUAL
288
+ comment: "/="
289
+ - name: STAR
290
+ comment: "*"
291
+ - name: STAR_EQUAL
292
+ comment: "*="
293
+ - name: STAR_STAR
294
+ comment: "**"
295
+ - name: STAR_STAR_EQUAL
296
+ comment: "**="
297
+ - name: STRING_BEGIN
298
+ comment: "the beginning of a string"
299
+ - name: STRING_CONTENT
300
+ comment: "the contents of a string"
301
+ - name: STRING_END
302
+ comment: "the end of a string"
303
+ - name: SYMBOL_BEGIN
304
+ comment: "the beginning of a symbol"
305
+ - name: TILDE
306
+ comment: "~ or ~@"
307
+ - name: UAMPERSAND
308
+ comment: "unary &"
309
+ - name: UCOLON_COLON
310
+ comment: "unary ::"
311
+ - name: UDOT_DOT
312
+ comment: "unary .."
313
+ - name: UDOT_DOT_DOT
314
+ comment: "unary ..."
315
+ - name: UMINUS
316
+ comment: "-@"
317
+ - name: UMINUS_NUM
318
+ comment: "-@ for a number"
319
+ - name: UPLUS
320
+ comment: "+@"
321
+ - name: USTAR
322
+ comment: "unary *"
323
+ - name: USTAR_STAR
324
+ comment: "unary **"
325
+ - name: WORDS_SEP
326
+ comment: "a separator between words in a list"
327
+ - name: __END__
328
+ comment: "marker for the point in the file at which the parser should stop"
329
+ flags:
330
+ - name: CallNodeFlags
331
+ values:
332
+ - name: SAFE_NAVIGATION
333
+ comment: "&. operator"
334
+ - name: VARIABLE_CALL
335
+ comment: "a call that could have been a local variable"
336
+ - name: LoopFlags
337
+ values:
338
+ - name: BEGIN_MODIFIER
339
+ comment: "a loop after a begin statement, so the body is executed first before the condition"
340
+ - name: RangeNodeFlags
341
+ values:
342
+ - name: EXCLUDE_END
343
+ comment: "... operator"
344
+ - name: RegularExpressionFlags
345
+ values:
346
+ - name: IGNORE_CASE
347
+ comment: "i - ignores the case of characters when matching"
348
+ - name: MULTI_LINE
349
+ comment: "m - allows $ to match the end of lines within strings"
350
+ - name: EXTENDED
351
+ comment: "x - ignores whitespace and allows comments in regular expressions"
352
+ - name: EUC_JP
353
+ comment: "e - forces the EUC-JP encoding"
354
+ - name: ASCII_8BIT
355
+ comment: "n - forces the ASCII-8BIT encoding"
356
+ - name: WINDOWS_31J
357
+ comment: "s - forces the Windows-31J encoding"
358
+ - name: UTF_8
359
+ comment: "u - forces the UTF-8 encoding"
360
+ - name: ONCE
361
+ comment: "o - only interpolates values into the regular expression once"
362
+ nodes:
363
+ - name: AliasNode
364
+ child_nodes:
365
+ - name: new_name
366
+ type: node
367
+ - name: old_name
368
+ type: node
369
+ - name: keyword_loc
370
+ type: location
371
+ comment: |
372
+ Represents the use of the `alias` keyword.
373
+
374
+ alias foo bar
375
+ ^^^^^^^^^^^^^
376
+ - name: AlternationPatternNode
377
+ child_nodes:
378
+ - name: left
379
+ type: node
380
+ - name: right
381
+ type: node
382
+ - name: operator_loc
383
+ type: location
384
+ comment: |
385
+ Represents an alternation pattern in pattern matching.
386
+
387
+ foo => bar | baz
388
+ ^^^^^^^^^
389
+ - name: AndNode
390
+ child_nodes:
391
+ - name: left
392
+ type: node
393
+ - name: right
394
+ type: node
395
+ - name: operator_loc
396
+ type: location
397
+ comment: |
398
+ Represents the use of the `&&` operator or the `and` keyword.
399
+
400
+ left and right
401
+ ^^^^^^^^^^^^^^
402
+ - name: ArgumentsNode
403
+ child_nodes:
404
+ - name: arguments
405
+ type: node[]
406
+ comment: |
407
+ Represents a set of arguments to a method or a keyword.
408
+
409
+ return foo, bar, baz
410
+ ^^^^^^^^^^^^^
411
+ - name: ArrayNode
412
+ child_nodes:
413
+ - name: elements
414
+ type: node[]
415
+ - name: opening_loc
416
+ type: location?
417
+ - name: closing_loc
418
+ type: location?
419
+ comment: |
420
+ Represents an array literal. This can be a regular array using brackets or
421
+ a special array using % like %w or %i.
422
+
423
+ [1, 2, 3]
424
+ ^^^^^^^^^
425
+ - name: ArrayPatternNode
426
+ child_nodes:
427
+ - name: constant
428
+ type: node?
429
+ - name: requireds
430
+ type: node[]
431
+ - name: rest
432
+ type: node?
433
+ - name: posts
434
+ type: node[]
435
+ - name: opening_loc
436
+ type: location?
437
+ - name: closing_loc
438
+ type: location?
439
+ comment: |
440
+ Represents an array pattern in pattern matching.
441
+
442
+ foo in 1, 2
443
+ ^^^^^^^^^^^
444
+
445
+ foo in [1, 2]
446
+ ^^^^^^^^^^^^^
447
+
448
+ foo in *1
449
+ ^^^^^^^^^
450
+
451
+ foo in Bar[]
452
+ ^^^^^^^^^^^^
453
+
454
+ foo in Bar[1, 2, 3]
455
+ ^^^^^^^^^^^^^^^^^^^
456
+ - name: AssocNode
457
+ child_nodes:
458
+ - name: key
459
+ type: node
460
+ - name: value
461
+ type: node?
462
+ - name: operator_loc
463
+ type: location?
464
+ comment: |
465
+ Represents a hash key/value pair.
466
+
467
+ { a => b }
468
+ ^^^^^^
469
+ - name: AssocSplatNode
470
+ child_nodes:
471
+ - name: value
472
+ type: node?
473
+ - name: operator_loc
474
+ type: location
475
+ comment: |
476
+ Represents a splat in a hash literal.
477
+
478
+ { **foo }
479
+ ^^^^^
480
+ - name: BackReferenceReadNode
481
+ comment: |
482
+ Represents reading a reference to a field in the previous match.
483
+
484
+ $'
485
+ ^^
486
+ - name: BeginNode
487
+ child_nodes:
488
+ - name: begin_keyword_loc
489
+ type: location?
490
+ - name: statements
491
+ type: node?
492
+ kind: StatementsNode
493
+ - name: rescue_clause
494
+ type: node?
495
+ kind: RescueNode
496
+ - name: else_clause
497
+ type: node?
498
+ kind: ElseNode
499
+ - name: ensure_clause
500
+ type: node?
501
+ kind: EnsureNode
502
+ - name: end_keyword_loc
503
+ type: location?
504
+ newline: false
505
+ comment: |
506
+ Represents a begin statement.
507
+
508
+ begin
509
+ foo
510
+ end
511
+ ^^^^^
512
+ - name: BlockArgumentNode
513
+ child_nodes:
514
+ - name: expression
515
+ type: node?
516
+ - name: operator_loc
517
+ type: location
518
+ comment: |
519
+ Represents block method arguments.
520
+
521
+ bar(&args)
522
+ ^^^^^^^^^^
523
+ - name: BlockNode
524
+ child_nodes:
525
+ - name: locals
526
+ type: constant[]
527
+ - name: parameters
528
+ type: node?
529
+ kind: BlockParametersNode
530
+ - name: statements
531
+ type: node?
532
+ - name: opening_loc
533
+ type: location
534
+ - name: closing_loc
535
+ type: location
536
+ comment: |
537
+ Represents a block of ruby code.
538
+
539
+ [1, 2, 3].each { |i| puts x }
540
+ ^^^^^^^^^^^^^^
541
+ - name: BlockParameterNode
542
+ child_nodes:
543
+ - name: name_loc
544
+ type: location?
545
+ - name: operator_loc
546
+ type: location
547
+ comment: |
548
+ Represents a block parameter to a method, block, or lambda definition.
549
+
550
+ def a(&b)
551
+ ^^
552
+ end
553
+ - name: BlockParametersNode
554
+ child_nodes:
555
+ - name: parameters
556
+ type: node?
557
+ kind: ParametersNode
558
+ - name: locals
559
+ type: location[]
560
+ - name: opening_loc
561
+ type: location?
562
+ - name: closing_loc
563
+ type: location?
564
+ comment: |
565
+ Represents a block's parameters declaration.
566
+
567
+ -> (a, b = 1; local) { }
568
+ ^^^^^^^^^^^^^^^^^
569
+
570
+ foo do |a, b = 1; local|
571
+ ^^^^^^^^^^^^^^^^^
572
+ end
573
+ - name: BreakNode
574
+ child_nodes:
575
+ - name: arguments
576
+ type: node?
577
+ kind: ArgumentsNode
578
+ - name: keyword_loc
579
+ type: location
580
+ comment: |
581
+ Represents the use of the `break` keyword.
582
+
583
+ break foo
584
+ ^^^^^^^^^
585
+ - name: CallNode
586
+ child_nodes:
587
+ - name: receiver
588
+ type: node?
589
+ - name: operator_loc
590
+ type: location?
591
+ - name: message_loc
592
+ type: location?
593
+ - name: opening_loc
594
+ type: location?
595
+ - name: arguments
596
+ type: node?
597
+ kind: ArgumentsNode
598
+ - name: closing_loc
599
+ type: location?
600
+ - name: block
601
+ type: node?
602
+ kind: BlockNode
603
+ - name: flags
604
+ type: uint32
605
+ - name: name
606
+ type: string
607
+ comment: |
608
+ Represents a method call, in all of the various forms that can take.
609
+
610
+ foo
611
+ ^^^
612
+
613
+ foo()
614
+ ^^^^^
615
+
616
+ +foo
617
+ ^^^^
618
+
619
+ foo + bar
620
+ ^^^^^^^^^
621
+
622
+ foo.bar
623
+ ^^^^^^^
624
+
625
+ foo&.bar
626
+ ^^^^^^^^
627
+ - name: CallOperatorAndWriteNode
628
+ child_nodes:
629
+ - name: target
630
+ type: node
631
+ kind: CallNode
632
+ - name: operator_loc
633
+ type: location
634
+ - name: value
635
+ type: node
636
+ comment: |
637
+ Represents the use of the `&&=` operator on a call.
638
+
639
+ foo.bar &&= value
640
+ ^^^^^^^^^^^^^^^^^
641
+ - name: CallOperatorOrWriteNode
642
+ child_nodes:
643
+ - name: target
644
+ type: node
645
+ kind: CallNode
646
+ - name: value
647
+ type: node
648
+ - name: operator_loc
649
+ type: location
650
+ comment: |
651
+ Represents the use of the `||=` operator on a call.
652
+
653
+ foo.bar ||= value
654
+ ^^^^^^^^^^^^^^^^^
655
+ - name: CallOperatorWriteNode
656
+ child_nodes:
657
+ - name: target
658
+ type: node
659
+ kind: CallNode
660
+ - name: operator_loc
661
+ type: location
662
+ - name: value
663
+ type: node
664
+ - name: operator_id
665
+ type: constant
666
+ comment: |
667
+ Represents the use of an assignment operator on a call.
668
+
669
+ foo.bar += baz
670
+ ^^^^^^^^^^^^^^
671
+ - name: CapturePatternNode
672
+ child_nodes:
673
+ - name: value
674
+ type: node
675
+ - name: target
676
+ type: node
677
+ - name: operator_loc
678
+ type: location
679
+ comment: |
680
+ Represents assigning to a local variable in pattern matching.
681
+
682
+ foo => [bar => baz]
683
+ ^^^^^^^^^^^^
684
+ - name: CaseNode
685
+ child_nodes:
686
+ - name: predicate
687
+ type: node?
688
+ - name: conditions
689
+ type: node[]
690
+ - name: consequent
691
+ type: node?
692
+ kind: ElseNode
693
+ - name: case_keyword_loc
694
+ type: location
695
+ - name: end_keyword_loc
696
+ type: location
697
+ comment: |
698
+ Represents the use of a case statement.
699
+
700
+ case true
701
+ ^^^^^^^^^
702
+ when false
703
+ end
704
+ - name: ClassNode
705
+ child_nodes:
706
+ - name: locals
707
+ type: constant[]
708
+ - name: class_keyword_loc
709
+ type: location
710
+ - name: constant_path
711
+ type: node
712
+ - name: inheritance_operator_loc
713
+ type: location?
714
+ - name: superclass
715
+ type: node?
716
+ - name: statements
717
+ type: node?
718
+ - name: end_keyword_loc
719
+ type: location
720
+ comment: |
721
+ Represents a class declaration involving the `class` keyword.
722
+
723
+ class Foo end
724
+ ^^^^^^^^^^^^^
725
+ - name: ClassVariableOperatorAndWriteNode
726
+ child_nodes:
727
+ - name: name_loc
728
+ type: location
729
+ - name: operator_loc
730
+ type: location
731
+ - name: value
732
+ type: node
733
+ comment: |
734
+ Represents the use of the `&&=` operator for assignment to a class variable.
735
+
736
+ @@target &&= value
737
+ ^^^^^^^^^^^^^^^^
738
+ - name: ClassVariableOperatorOrWriteNode
739
+ child_nodes:
740
+ - name: name_loc
741
+ type: location
742
+ - name: operator_loc
743
+ type: location
744
+ - name: value
745
+ type: node
746
+ comment: |
747
+ Represents the use of the `||=` operator for assignment to a class variable.
748
+
749
+ @@target ||= value
750
+ ^^^^^^^^^^^^^^^^^^
751
+ - name: ClassVariableOperatorWriteNode
752
+ child_nodes:
753
+ - name: name_loc
754
+ type: location
755
+ - name: operator_loc
756
+ type: location
757
+ - name: value
758
+ type: node
759
+ - name: operator
760
+ type: constant
761
+ comment: |
762
+ Represents assigning to a class variable using an operator that isn't `=`.
763
+
764
+ @@target += value
765
+ ^^^^^^^^^^^^^^^^^
766
+ - name: ClassVariableReadNode
767
+ comment: |
768
+ Represents referencing a class variable.
769
+
770
+ @@foo
771
+ ^^^^^
772
+ - name: ClassVariableWriteNode
773
+ child_nodes:
774
+ - name: name_loc
775
+ type: location
776
+ - name: value
777
+ type: node?
778
+ - name: operator_loc
779
+ type: location?
780
+ comment: |
781
+ Represents writing to a class variable.
782
+
783
+ @@foo = 1
784
+ ^^^^^^^^^
785
+ - name: ConstantOperatorAndWriteNode
786
+ child_nodes:
787
+ - name: name_loc
788
+ type: location
789
+ - name: operator_loc
790
+ type: location
791
+ - name: value
792
+ type: node
793
+ comment: |
794
+ Represents the use of the `&&=` operator for assignment to a constant.
795
+
796
+ Target &&= value
797
+ ^^^^^^^^^^^^^^^^
798
+ - name: ConstantOperatorOrWriteNode
799
+ child_nodes:
800
+ - name: name_loc
801
+ type: location
802
+ - name: operator_loc
803
+ type: location
804
+ - name: value
805
+ type: node
806
+ comment: |
807
+ Represents the use of the `||=` operator for assignment to a constant.
808
+
809
+ Target ||= value
810
+ ^^^^^^^^^^^^^^^^
811
+ - name: ConstantOperatorWriteNode
812
+ child_nodes:
813
+ - name: name_loc
814
+ type: location
815
+ - name: operator_loc
816
+ type: location
817
+ - name: value
818
+ type: node
819
+ - name: operator
820
+ type: constant
821
+ comment: |
822
+ Represents assigning to a constant using an operator that isn't `=`.
823
+
824
+ Target += value
825
+ ^^^^^^^^^^^^^^^
826
+ - name: ConstantPathNode
827
+ child_nodes:
828
+ - name: parent
829
+ type: node?
830
+ - name: child
831
+ type: node
832
+ - name: delimiter_loc
833
+ type: location
834
+ comment: |
835
+ Represents accessing a constant through a path of `::` operators.
836
+
837
+ Foo::Bar
838
+ ^^^^^^^^
839
+ - name: ConstantPathOperatorAndWriteNode
840
+ child_nodes:
841
+ - name: target
842
+ type: node
843
+ kind: ConstantPathNode
844
+ - name: operator_loc
845
+ type: location
846
+ - name: value
847
+ type: node
848
+ comment: |
849
+ Represents the use of the `&&=` operator for assignment to a constant path.
850
+
851
+ Parent::Child &&= value
852
+ ^^^^^^^^^^^^^^^^^^^^^^^
853
+ - name: ConstantPathOperatorOrWriteNode
854
+ child_nodes:
855
+ - name: target
856
+ type: node
857
+ kind: ConstantPathNode
858
+ - name: operator_loc
859
+ type: location
860
+ - name: value
861
+ type: node
862
+ comment: |
863
+ Represents the use of the `||=` operator for assignment to a constant path.
864
+
865
+ Parent::Child ||= value
866
+ ^^^^^^^^^^^^^^^^^^^^^^^
867
+ - name: ConstantPathOperatorWriteNode
868
+ child_nodes:
869
+ - name: target
870
+ type: node
871
+ kind: ConstantPathNode
872
+ - name: operator_loc
873
+ type: location
874
+ - name: value
875
+ type: node
876
+ - name: operator
877
+ type: constant
878
+ comment: |
879
+ Represents assigning to a constant path using an operator that isn't `=`.
880
+
881
+ Parent::Child += value
882
+ ^^^^^^^^^^^^^^^^^^^^^^
883
+ - name: ConstantPathWriteNode
884
+ child_nodes:
885
+ - name: target
886
+ type: node
887
+ kind: ConstantPathNode
888
+ - name: operator_loc
889
+ type: location?
890
+ - name: value
891
+ type: node?
892
+ comment: |
893
+ Represents writing to a constant path.
894
+
895
+ ::Foo = 1
896
+ ^^^^^^^^^
897
+
898
+ Foo::Bar = 1
899
+ ^^^^^^^^^^^^
900
+
901
+ ::Foo::Bar = 1
902
+ ^^^^^^^^^^^^^^
903
+ - name: ConstantReadNode
904
+ comment: |
905
+ Represents referencing a constant.
906
+
907
+ Foo
908
+ ^^^
909
+ - name: ConstantWriteNode
910
+ child_nodes:
911
+ - name: name_loc
912
+ type: location
913
+ - name: value
914
+ type: node?
915
+ - name: operator_loc
916
+ type: location?
917
+ comment: |
918
+ Represents writing to a constant.
919
+
920
+ Foo = 1
921
+ ^^^^^^^
922
+ - name: DefNode
923
+ child_nodes:
924
+ - name: name_loc
925
+ type: location
926
+ - name: receiver
927
+ type: node?
928
+ - name: parameters
929
+ type: node?
930
+ kind: ParametersNode
931
+ - name: statements
932
+ type: node?
933
+ - name: locals
934
+ type: constant[]
935
+ - name: def_keyword_loc
936
+ type: location
937
+ - name: operator_loc
938
+ type: location?
939
+ - name: lparen_loc
940
+ type: location?
941
+ - name: rparen_loc
942
+ type: location?
943
+ - name: equal_loc
944
+ type: location?
945
+ - name: end_keyword_loc
946
+ type: location?
947
+ comment: |
948
+ Represents a method definition.
949
+
950
+ def method
951
+ end
952
+ ^^^^^^^^^^
953
+ - name: DefinedNode
954
+ child_nodes:
955
+ - name: lparen_loc
956
+ type: location?
957
+ - name: value
958
+ type: node
959
+ - name: rparen_loc
960
+ type: location?
961
+ - name: keyword_loc
962
+ type: location
963
+ comment: |
964
+ Represents the use of the `defined?` keyword.
965
+
966
+ defined?(a)
967
+ ^^^^^^^^^^^
968
+ - name: ElseNode
969
+ child_nodes:
970
+ - name: else_keyword_loc
971
+ type: location
972
+ - name: statements
973
+ type: node?
974
+ kind: StatementsNode
975
+ - name: end_keyword_loc
976
+ type: location?
977
+ comment: |
978
+ Represents an `else` clause in a `case`, `if`, or `unless` statement.
979
+
980
+ if a then b else c end
981
+ ^^^^^^^^^^
982
+ - name: EmbeddedStatementsNode
983
+ child_nodes:
984
+ - name: opening_loc
985
+ type: location
986
+ - name: statements
987
+ type: node?
988
+ kind: StatementsNode
989
+ - name: closing_loc
990
+ type: location
991
+ comment: |
992
+ Represents an interpolated set of statements.
993
+
994
+ "foo #{bar}"
995
+ ^^^^^^
996
+ - name: EmbeddedVariableNode
997
+ child_nodes:
998
+ - name: operator_loc
999
+ type: location
1000
+ - name: variable
1001
+ type: node
1002
+ comment: |
1003
+ Represents an interpolated variable.
1004
+
1005
+ "foo #@bar"
1006
+ ^^^^^
1007
+ - name: EnsureNode
1008
+ child_nodes:
1009
+ - name: ensure_keyword_loc
1010
+ type: location
1011
+ - name: statements
1012
+ type: node?
1013
+ kind: StatementsNode
1014
+ - name: end_keyword_loc
1015
+ type: location
1016
+ comment: |
1017
+ Represents an `ensure` clause in a `begin` statement.
1018
+
1019
+ begin
1020
+ foo
1021
+ ensure
1022
+ ^^^^^^
1023
+ bar
1024
+ end
1025
+ - name: FalseNode
1026
+ comment: |
1027
+ Represents the use of the literal `false` keyword.
1028
+
1029
+ false
1030
+ ^^^^^
1031
+ - name: FindPatternNode
1032
+ child_nodes:
1033
+ - name: constant
1034
+ type: node?
1035
+ - name: left
1036
+ type: node
1037
+ - name: requireds
1038
+ type: node[]
1039
+ - name: right
1040
+ type: node
1041
+ - name: opening_loc
1042
+ type: location?
1043
+ - name: closing_loc
1044
+ type: location?
1045
+ comment: |
1046
+ Represents a find pattern in pattern matching.
1047
+
1048
+ foo in *bar, baz, *qux
1049
+ ^^^^^^^^^^^^^^^^^^^^^^
1050
+
1051
+ foo in [*bar, baz, *qux]
1052
+ ^^^^^^^^^^^^^^^^^^^^^^^^
1053
+
1054
+ foo in Foo(*bar, baz, *qux)
1055
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1056
+ - name: FloatNode
1057
+ comment: |
1058
+ Represents a floating point number literal.
1059
+
1060
+ 1.0
1061
+ ^^^
1062
+ - name: ForNode
1063
+ child_nodes:
1064
+ - name: index
1065
+ type: node
1066
+ - name: collection
1067
+ type: node
1068
+ - name: statements
1069
+ type: node?
1070
+ kind: StatementsNode
1071
+ - name: for_keyword_loc
1072
+ type: location
1073
+ - name: in_keyword_loc
1074
+ type: location
1075
+ - name: do_keyword_loc
1076
+ type: location?
1077
+ - name: end_keyword_loc
1078
+ type: location
1079
+ comment: |
1080
+ Represents the use of the `for` keyword.
1081
+
1082
+ for i in a end
1083
+ ^^^^^^^^^^^^^^
1084
+ - name: ForwardingArgumentsNode
1085
+ comment: |
1086
+ Represents forwarding all arguments to this method to another method.
1087
+
1088
+ def foo(...)
1089
+ bar(...)
1090
+ ^^^^^^^^
1091
+ end
1092
+ - name: ForwardingParameterNode
1093
+ comment: |
1094
+ Represents the use of the forwarding parameter in a method, block, or lambda declaration.
1095
+
1096
+ def foo(...)
1097
+ ^^^
1098
+ end
1099
+ - name: ForwardingSuperNode
1100
+ child_nodes:
1101
+ - name: block
1102
+ type: node?
1103
+ kind: BlockNode
1104
+ comment: |
1105
+ Represents the use of the `super` keyword without parentheses or arguments.
1106
+
1107
+ super
1108
+ ^^^^^
1109
+ - name: GlobalVariableOperatorAndWriteNode
1110
+ child_nodes:
1111
+ - name: name_loc
1112
+ type: location
1113
+ - name: operator_loc
1114
+ type: location
1115
+ - name: value
1116
+ type: node
1117
+ comment: |
1118
+ Represents the use of the `&&=` operator for assignment to a global variable.
1119
+
1120
+ $target &&= value
1121
+ ^^^^^^^^^^^^^^^^^
1122
+ - name: GlobalVariableOperatorOrWriteNode
1123
+ child_nodes:
1124
+ - name: name_loc
1125
+ type: location
1126
+ - name: operator_loc
1127
+ type: location
1128
+ - name: value
1129
+ type: node
1130
+ comment: |
1131
+ Represents the use of the `||=` operator for assignment to a global variable.
1132
+
1133
+ $target ||= value
1134
+ ^^^^^^^^^^^^^^^^^
1135
+ - name: GlobalVariableOperatorWriteNode
1136
+ child_nodes:
1137
+ - name: name_loc
1138
+ type: location
1139
+ - name: operator_loc
1140
+ type: location
1141
+ - name: value
1142
+ type: node
1143
+ - name: operator
1144
+ type: constant
1145
+ comment: |
1146
+ Represents assigning to a global variable using an operator that isn't `=`.
1147
+
1148
+ $target += value
1149
+ ^^^^^^^^^^^^^^^^
1150
+ - name: GlobalVariableReadNode
1151
+ comment: |
1152
+ Represents referencing a global variable.
1153
+
1154
+ $foo
1155
+ ^^^^
1156
+ - name: GlobalVariableWriteNode
1157
+ child_nodes:
1158
+ - name: name_loc
1159
+ type: location
1160
+ - name: operator_loc
1161
+ type: location?
1162
+ - name: value
1163
+ type: node?
1164
+ comment: |
1165
+ Represents writing to a global variable.
1166
+
1167
+ $foo = 1
1168
+ ^^^^^^^^
1169
+ - name: HashNode
1170
+ child_nodes:
1171
+ - name: opening_loc
1172
+ type: location
1173
+ - name: elements
1174
+ type: node[]
1175
+ - name: closing_loc
1176
+ type: location
1177
+ comment: |
1178
+ Represents a hash literal.
1179
+
1180
+ { a => b }
1181
+ ^^^^^^^^^^
1182
+ - name: HashPatternNode
1183
+ child_nodes:
1184
+ - name: constant
1185
+ type: node?
1186
+ - name: assocs
1187
+ type: node[]
1188
+ - name: kwrest
1189
+ type: node?
1190
+ - name: opening_loc
1191
+ type: location?
1192
+ - name: closing_loc
1193
+ type: location?
1194
+ comment: |
1195
+ Represents a hash pattern in pattern matching.
1196
+
1197
+ foo => { a: 1, b: 2 }
1198
+ ^^^^^^^^^^^^^^
1199
+
1200
+ foo => { a: 1, b: 2, **c }
1201
+ ^^^^^^^^^^^^^^^^^^^
1202
+ - name: IfNode
1203
+ child_nodes:
1204
+ - name: if_keyword_loc
1205
+ type: location?
1206
+ - name: predicate
1207
+ type: node
1208
+ - name: statements
1209
+ type: node?
1210
+ kind: StatementsNode
1211
+ - name: consequent
1212
+ type: node?
1213
+ - name: end_keyword_loc
1214
+ type: location?
1215
+ newline: predicate
1216
+ comment: |
1217
+ Represents the use of the `if` keyword, either in the block form or the modifier form.
1218
+
1219
+ bar if foo
1220
+ ^^^^^^^^^^
1221
+
1222
+ if foo then bar end
1223
+ ^^^^^^^^^^^^^^^^^^^
1224
+ - name: ImaginaryNode
1225
+ child_nodes:
1226
+ - name: numeric
1227
+ type: node
1228
+ comment: |
1229
+ Represents an imaginary number literal.
1230
+
1231
+ 1.0i
1232
+ ^^^^
1233
+ - name: InNode
1234
+ child_nodes:
1235
+ - name: pattern
1236
+ type: node
1237
+ - name: statements
1238
+ type: node?
1239
+ kind: StatementsNode
1240
+ - name: in_loc
1241
+ type: location
1242
+ - name: then_loc
1243
+ type: location?
1244
+ comment: |
1245
+ Represents the use of the `in` keyword in a case statement.
1246
+
1247
+ case a; in b then c end
1248
+ ^^^^^^^^^^^
1249
+ - name: InstanceVariableOperatorAndWriteNode
1250
+ child_nodes:
1251
+ - name: name_loc
1252
+ type: location
1253
+ - name: operator_loc
1254
+ type: location
1255
+ - name: value
1256
+ type: node
1257
+ comment: |
1258
+ Represents the use of the `&&=` operator for assignment to an instance variable.
1259
+
1260
+ @target &&= value
1261
+ ^^^^^^^^^^^^^^^^^
1262
+ - name: InstanceVariableOperatorOrWriteNode
1263
+ child_nodes:
1264
+ - name: name_loc
1265
+ type: location
1266
+ - name: operator_loc
1267
+ type: location
1268
+ - name: value
1269
+ type: node
1270
+ comment: |
1271
+ Represents the use of the `||=` operator for assignment to an instance variable.
1272
+
1273
+ @target ||= value
1274
+ ^^^^^^^^^^^^^^^^^
1275
+ - name: InstanceVariableOperatorWriteNode
1276
+ child_nodes:
1277
+ - name: name_loc
1278
+ type: location
1279
+ - name: operator_loc
1280
+ type: location
1281
+ - name: value
1282
+ type: node
1283
+ - name: operator
1284
+ type: constant
1285
+ comment: |
1286
+ Represents assigning to an instance variable using an operator that isn't `=`.
1287
+
1288
+ @target += value
1289
+ ^^^^^^^^^^^^^^^^
1290
+ - name: InstanceVariableReadNode
1291
+ comment: |
1292
+ Represents referencing an instance variable.
1293
+
1294
+ @foo
1295
+ ^^^^
1296
+ - name: InstanceVariableWriteNode
1297
+ child_nodes:
1298
+ - name: name_loc
1299
+ type: location
1300
+ - name: value
1301
+ type: node?
1302
+ - name: operator_loc
1303
+ type: location?
1304
+ comment: |
1305
+ Represents writing to an instance variable.
1306
+
1307
+ @foo = 1
1308
+ ^^^^^^^^
1309
+ - name: IntegerNode
1310
+ comment: |
1311
+ Represents an integer number literal.
1312
+
1313
+ 1
1314
+ ^
1315
+ - name: InterpolatedRegularExpressionNode
1316
+ child_nodes:
1317
+ - name: opening_loc
1318
+ type: location
1319
+ - name: parts
1320
+ type: node[]
1321
+ - name: closing_loc
1322
+ type: location
1323
+ - name: flags
1324
+ type: uint32
1325
+ newline: parts
1326
+ comment: |
1327
+ Represents a regular expression literal that contains interpolation.
1328
+
1329
+ /foo #{bar} baz/
1330
+ ^^^^^^^^^^^^^^^^
1331
+ - name: InterpolatedStringNode
1332
+ child_nodes:
1333
+ - name: opening_loc
1334
+ type: location?
1335
+ - name: parts
1336
+ type: node[]
1337
+ - name: closing_loc
1338
+ type: location?
1339
+ newline: parts
1340
+ comment: |
1341
+ Represents a string literal that contains interpolation.
1342
+
1343
+ "foo #{bar} baz"
1344
+ ^^^^^^^^^^^^^^^^
1345
+ - name: InterpolatedSymbolNode
1346
+ child_nodes:
1347
+ - name: opening_loc
1348
+ type: location?
1349
+ - name: parts
1350
+ type: node[]
1351
+ - name: closing_loc
1352
+ type: location?
1353
+ newline: parts
1354
+ comment: |
1355
+ Represents a symbol literal that contains interpolation.
1356
+
1357
+ :"foo #{bar} baz"
1358
+ ^^^^^^^^^^^^^^^^^
1359
+ - name: InterpolatedXStringNode
1360
+ child_nodes:
1361
+ - name: opening_loc
1362
+ type: location
1363
+ - name: parts
1364
+ type: node[]
1365
+ - name: closing_loc
1366
+ type: location
1367
+ newline: parts
1368
+ comment: |
1369
+ Represents an xstring literal that contains interpolation.
1370
+
1371
+ `foo #{bar} baz`
1372
+ ^^^^^^^^^^^^^^^^
1373
+ - name: KeywordHashNode
1374
+ child_nodes:
1375
+ - name: elements
1376
+ type: node[]
1377
+ comment: |
1378
+ Represents a hash literal without opening and closing braces.
1379
+
1380
+ foo(a: b)
1381
+ ^^^^
1382
+ - name: KeywordParameterNode
1383
+ child_nodes:
1384
+ - name: name_loc
1385
+ type: location
1386
+ - name: value
1387
+ type: node?
1388
+ comment: |
1389
+ Represents a keyword parameter to a method, block, or lambda definition.
1390
+
1391
+ def a(b:)
1392
+ ^^
1393
+ end
1394
+
1395
+ def a(b: 1)
1396
+ ^^^^
1397
+ end
1398
+ - name: KeywordRestParameterNode
1399
+ child_nodes:
1400
+ - name: operator_loc
1401
+ type: location
1402
+ - name: name_loc
1403
+ type: location?
1404
+ comment: |
1405
+ Represents a keyword rest parameter to a method, block, or lambda definition.
1406
+
1407
+ def a(**b)
1408
+ ^^^
1409
+ end
1410
+ - name: LambdaNode
1411
+ child_nodes:
1412
+ - name: locals
1413
+ type: constant[]
1414
+ - name: opening_loc
1415
+ type: location
1416
+ - name: parameters
1417
+ type: node?
1418
+ kind: BlockParametersNode
1419
+ - name: statements
1420
+ type: node?
1421
+ comment: |
1422
+ Represents using a lambda literal (not the lambda method call).
1423
+
1424
+ ->(value) { value * 2 }
1425
+ ^^^^^^^^^^^^^^^^^^^^^^^
1426
+ - name: LocalVariableOperatorAndWriteNode
1427
+ child_nodes:
1428
+ - name: name_loc
1429
+ type: location
1430
+ - name: operator_loc
1431
+ type: location
1432
+ - name: value
1433
+ type: node
1434
+ - name: constant_id
1435
+ type: constant
1436
+ comment: |
1437
+ Represents the use of the `&&=` operator for assignment to a local variable.
1438
+
1439
+ target &&= value
1440
+ ^^^^^^^^^^^^^^^^
1441
+ - name: LocalVariableOperatorOrWriteNode
1442
+ child_nodes:
1443
+ - name: name_loc
1444
+ type: location
1445
+ - name: operator_loc
1446
+ type: location
1447
+ - name: value
1448
+ type: node
1449
+ - name: constant_id
1450
+ type: constant
1451
+ comment: |
1452
+ Represents the use of the `||=` operator for assignment to a local variable.
1453
+
1454
+ target ||= value
1455
+ ^^^^^^^^^^^^^^^^
1456
+ - name: LocalVariableOperatorWriteNode
1457
+ child_nodes:
1458
+ - name: name_loc
1459
+ type: location
1460
+ - name: operator_loc
1461
+ type: location
1462
+ - name: value
1463
+ type: node
1464
+ - name: constant_id
1465
+ type: constant
1466
+ - name: operator_id
1467
+ type: constant
1468
+ comment: |
1469
+ Represents assigning to a local variable using an operator that isn't `=`.
1470
+
1471
+ target += value
1472
+ ^^^^^^^^^^^^^^^
1473
+ - name: LocalVariableReadNode
1474
+ child_nodes:
1475
+ - name: constant_id
1476
+ type: constant
1477
+ - name: depth
1478
+ type: uint32
1479
+ comment: |
1480
+ Represents reading a local variable. Note that this requires that a local
1481
+ variable of the same name has already been written to in the same scope,
1482
+ otherwise it is parsed as a method call.
1483
+
1484
+ foo
1485
+ ^^^
1486
+ - name: LocalVariableWriteNode
1487
+ child_nodes:
1488
+ - name: constant_id
1489
+ type: constant
1490
+ - name: depth
1491
+ type: uint32
1492
+ - name: value
1493
+ type: node?
1494
+ - name: name_loc
1495
+ type: location
1496
+ - name: operator_loc
1497
+ type: location?
1498
+ comment: |
1499
+ Represents writing to a local variable.
1500
+
1501
+ foo = 1
1502
+ ^^^^^^^
1503
+ - name: MatchPredicateNode
1504
+ child_nodes:
1505
+ - name: value
1506
+ type: node
1507
+ - name: pattern
1508
+ type: node
1509
+ - name: operator_loc
1510
+ type: location
1511
+ comment: |
1512
+ Represents the use of the modifier `in` operator.
1513
+
1514
+ foo in bar
1515
+ ^^^^^^^^^^
1516
+ - name: MatchRequiredNode
1517
+ child_nodes:
1518
+ - name: value
1519
+ type: node
1520
+ - name: pattern
1521
+ type: node
1522
+ - name: operator_loc
1523
+ type: location
1524
+ comment: |
1525
+ Represents the use of the `=>` operator.
1526
+
1527
+ foo => bar
1528
+ ^^^^^^^^^^
1529
+ - name: MissingNode
1530
+ comment: |
1531
+ Represents a node that is missing from the source and results in a syntax
1532
+ error.
1533
+ - name: ModuleNode
1534
+ child_nodes:
1535
+ - name: locals
1536
+ type: constant[]
1537
+ - name: module_keyword_loc
1538
+ type: location
1539
+ - name: constant_path
1540
+ type: node
1541
+ - name: statements
1542
+ type: node?
1543
+ - name: end_keyword_loc
1544
+ type: location
1545
+ comment: |
1546
+ Represents a module declaration involving the `module` keyword.
1547
+
1548
+ module Foo end
1549
+ ^^^^^^^^^^^^^^
1550
+ - name: MultiWriteNode
1551
+ child_nodes:
1552
+ - name: targets
1553
+ type: node[]
1554
+ - name: operator_loc
1555
+ type: location?
1556
+ - name: value
1557
+ type: node?
1558
+ - name: lparen_loc
1559
+ type: location?
1560
+ - name: rparen_loc
1561
+ type: location?
1562
+ comment: |
1563
+ Represents a multi-target expression.
1564
+
1565
+ a, b, c = 1, 2, 3
1566
+ ^^^^^^^^^^^^^^^^^
1567
+ - name: NextNode
1568
+ child_nodes:
1569
+ - name: arguments
1570
+ type: node?
1571
+ kind: ArgumentsNode
1572
+ - name: keyword_loc
1573
+ type: location
1574
+ comment: |
1575
+ Represents the use of the `next` keyword.
1576
+
1577
+ next 1
1578
+ ^^^^^^
1579
+ - name: NilNode
1580
+ comment: |
1581
+ Represents the use of the `nil` keyword.
1582
+
1583
+ nil
1584
+ ^^^
1585
+ - name: NoKeywordsParameterNode
1586
+ child_nodes:
1587
+ - name: operator_loc
1588
+ type: location
1589
+ - name: keyword_loc
1590
+ type: location
1591
+ comment: |
1592
+ Represents the use of `**nil` inside method arguments.
1593
+
1594
+ def a(**nil)
1595
+ ^^^^^
1596
+ end
1597
+ - name: NumberedReferenceReadNode
1598
+ comment: |
1599
+ Represents reading a numbered reference to a capture in the previous match.
1600
+
1601
+ $1
1602
+ ^^
1603
+ - name: OptionalParameterNode
1604
+ child_nodes:
1605
+ - name: constant_id
1606
+ type: constant
1607
+ - name: name_loc
1608
+ type: location
1609
+ - name: operator_loc
1610
+ type: location
1611
+ - name: value
1612
+ type: node
1613
+ comment: |
1614
+ Represents an optional parameter to a method, block, or lambda definition.
1615
+
1616
+ def a(b = 1)
1617
+ ^^^^^
1618
+ end
1619
+ - name: OrNode
1620
+ child_nodes:
1621
+ - name: left
1622
+ type: node
1623
+ - name: right
1624
+ type: node
1625
+ - name: operator_loc
1626
+ type: location
1627
+ comment: |
1628
+ Represents the use of the `||` operator or the `or` keyword.
1629
+
1630
+ left or right
1631
+ ^^^^^^^^^^^^^
1632
+ - name: ParametersNode
1633
+ child_nodes:
1634
+ - name: requireds
1635
+ type: node[]
1636
+ - name: optionals
1637
+ type: node[]
1638
+ - name: posts
1639
+ type: node[]
1640
+ - name: rest
1641
+ type: node?
1642
+ kind: RestParameterNode
1643
+ - name: keywords
1644
+ type: node[]
1645
+ - name: keyword_rest
1646
+ type: node?
1647
+ - name: block
1648
+ type: node?
1649
+ kind: BlockParameterNode
1650
+ comment: |
1651
+ Represents the list of parameters on a method, block, or lambda definition.
1652
+
1653
+ def a(b, c, d)
1654
+ ^^^^^^^
1655
+ end
1656
+ - name: ParenthesesNode
1657
+ child_nodes:
1658
+ - name: statements
1659
+ type: node?
1660
+ - name: opening_loc
1661
+ type: location
1662
+ - name: closing_loc
1663
+ type: location
1664
+ newline: false
1665
+ comment: |
1666
+ Represents a parenthesized expression
1667
+
1668
+ (10 + 34)
1669
+ ^^^^^^^^^
1670
+ - name: PinnedExpressionNode
1671
+ child_nodes:
1672
+ - name: expression
1673
+ type: node
1674
+ - name: operator_loc
1675
+ type: location
1676
+ - name: lparen_loc
1677
+ type: location
1678
+ - name: rparen_loc
1679
+ type: location
1680
+ comment: |
1681
+ Represents the use of the `^` operator for pinning an expression in a
1682
+ pattern matching expression.
1683
+
1684
+ foo in ^(bar)
1685
+ ^^^^^^
1686
+ - name: PinnedVariableNode
1687
+ child_nodes:
1688
+ - name: variable
1689
+ type: node
1690
+ - name: operator_loc
1691
+ type: location
1692
+ comment: |
1693
+ Represents the use of the `^` operator for pinning a variable in a pattern
1694
+ matching expression.
1695
+
1696
+ foo in ^bar
1697
+ ^^^^
1698
+ - name: PostExecutionNode
1699
+ child_nodes:
1700
+ - name: statements
1701
+ type: node?
1702
+ kind: StatementsNode
1703
+ - name: keyword_loc
1704
+ type: location
1705
+ - name: opening_loc
1706
+ type: location
1707
+ - name: closing_loc
1708
+ type: location
1709
+ comment: |
1710
+ Represents the use of the `END` keyword.
1711
+
1712
+ END { foo }
1713
+ ^^^^^^^^^^^
1714
+ - name: PreExecutionNode
1715
+ child_nodes:
1716
+ - name: statements
1717
+ type: node?
1718
+ kind: StatementsNode
1719
+ - name: keyword_loc
1720
+ type: location
1721
+ - name: opening_loc
1722
+ type: location
1723
+ - name: closing_loc
1724
+ type: location
1725
+ comment: |
1726
+ Represents the use of the `BEGIN` keyword.
1727
+
1728
+ BEGIN { foo }
1729
+ ^^^^^^^^^^^^^
1730
+ - name: ProgramNode
1731
+ child_nodes:
1732
+ - name: locals
1733
+ type: constant[]
1734
+ - name: statements
1735
+ type: node
1736
+ kind: StatementsNode
1737
+ comment: The top level node of any parse tree.
1738
+ - name: RangeNode
1739
+ child_nodes:
1740
+ - name: left
1741
+ type: node?
1742
+ - name: right
1743
+ type: node?
1744
+ - name: operator_loc
1745
+ type: location
1746
+ - name: flags
1747
+ type: uint32
1748
+ comment: |
1749
+ Represents the use of the `..` or `...` operators.
1750
+
1751
+ 1..2
1752
+ ^^^^
1753
+
1754
+ c if a =~ /left/ ... b =~ /right/
1755
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1756
+ - name: RationalNode
1757
+ child_nodes:
1758
+ - name: numeric
1759
+ type: node
1760
+ comment: |
1761
+ Represents a rational number literal.
1762
+
1763
+ 1.0r
1764
+ ^^^^
1765
+ - name: RedoNode
1766
+ comment: |
1767
+ Represents the use of the `redo` keyword.
1768
+
1769
+ redo
1770
+ ^^^^
1771
+ - name: RegularExpressionNode
1772
+ child_nodes:
1773
+ - name: opening_loc
1774
+ type: location
1775
+ - name: content_loc
1776
+ type: location
1777
+ - name: closing_loc
1778
+ type: location
1779
+ - name: unescaped
1780
+ type: string
1781
+ - name: flags
1782
+ type: uint32
1783
+ comment: |
1784
+ Represents a regular expression literal with no interpolation.
1785
+
1786
+ /foo/i
1787
+ ^^^^^^
1788
+ - name: RequiredDestructuredParameterNode
1789
+ child_nodes:
1790
+ - name: parameters
1791
+ type: node[]
1792
+ - name: opening_loc
1793
+ type: location
1794
+ - name: closing_loc
1795
+ type: location
1796
+ comment: |
1797
+ Represents a destructured required parameter node.
1798
+
1799
+ def foo((bar, baz))
1800
+ ^^^^^^^^^^
1801
+ end
1802
+ - name: RequiredParameterNode
1803
+ child_nodes:
1804
+ - name: constant_id
1805
+ type: constant
1806
+ comment: |
1807
+ Represents a required parameter to a method, block, or lambda definition.
1808
+
1809
+ def a(b)
1810
+ ^
1811
+ end
1812
+ - name: RescueModifierNode
1813
+ child_nodes:
1814
+ - name: expression
1815
+ type: node
1816
+ - name: keyword_loc
1817
+ type: location
1818
+ - name: rescue_expression
1819
+ type: node
1820
+ newline: expression
1821
+ comment: |
1822
+ Represents an expression modified with a rescue.
1823
+
1824
+ foo rescue nil
1825
+ ^^^^^^^^^^^^^^
1826
+ - name: RescueNode
1827
+ child_nodes:
1828
+ - name: keyword_loc
1829
+ type: location
1830
+ - name: exceptions
1831
+ type: node[]
1832
+ - name: operator_loc
1833
+ type: location?
1834
+ - name: reference
1835
+ type: node?
1836
+ - name: statements
1837
+ type: node?
1838
+ kind: StatementsNode
1839
+ - name: consequent
1840
+ type: node?
1841
+ kind: RescueNode
1842
+ comment: |
1843
+ Represents a rescue statement.
1844
+
1845
+ begin
1846
+ rescue Foo, *splat, Bar => ex
1847
+ ^^^^^^
1848
+ foo
1849
+ end
1850
+
1851
+ `Foo, *splat, Bar` are in the `exceptions` field.
1852
+ `ex` is in the `exception` field.
1853
+ - name: RestParameterNode
1854
+ child_nodes:
1855
+ - name: operator_loc
1856
+ type: location
1857
+ - name: name_loc
1858
+ type: location?
1859
+ comment: |
1860
+ Represents a rest parameter to a method, block, or lambda definition.
1861
+
1862
+ def a(*b)
1863
+ ^^
1864
+ end
1865
+ - name: RetryNode
1866
+ comment: |
1867
+ Represents the use of the `retry` keyword.
1868
+
1869
+ retry
1870
+ ^^^^^
1871
+ - name: ReturnNode
1872
+ child_nodes:
1873
+ - name: keyword_loc
1874
+ type: location
1875
+ - name: arguments
1876
+ type: node?
1877
+ kind: ArgumentsNode
1878
+ comment: |
1879
+ Represents the use of the `return` keyword.
1880
+
1881
+ return 1
1882
+ ^^^^^^^^
1883
+ - name: SelfNode
1884
+ comment: |
1885
+ Represents the `self` keyword.
1886
+
1887
+ self
1888
+ ^^^^
1889
+ - name: SingletonClassNode
1890
+ child_nodes:
1891
+ - name: locals
1892
+ type: constant[]
1893
+ - name: class_keyword_loc
1894
+ type: location
1895
+ - name: operator_loc
1896
+ type: location
1897
+ - name: expression
1898
+ type: node
1899
+ - name: statements
1900
+ type: node?
1901
+ - name: end_keyword_loc
1902
+ type: location
1903
+ comment: |
1904
+ Represents a singleton class declaration involving the `class` keyword.
1905
+
1906
+ class << self end
1907
+ ^^^^^^^^^^^^^^^^^
1908
+ - name: SourceEncodingNode
1909
+ comment: |
1910
+ Represents the use of the `__ENCODING__` keyword.
1911
+
1912
+ __ENCODING__
1913
+ ^^^^^^^^^^^^
1914
+ - name: SourceFileNode
1915
+ is_migrated: true
1916
+ child_nodes:
1917
+ - name: filepath
1918
+ type: string
1919
+ comment: |
1920
+ Represents the use of the `__FILE__` keyword.
1921
+
1922
+ __FILE__
1923
+ ^^^^^^^^
1924
+ - name: SourceLineNode
1925
+ comment: |
1926
+ Represents the use of the `__LINE__` keyword.
1927
+
1928
+ __LINE__
1929
+ ^^^^^^^^
1930
+ - name: SplatNode
1931
+ child_nodes:
1932
+ - name: operator_loc
1933
+ type: location
1934
+ - name: expression
1935
+ type: node?
1936
+ comment: |
1937
+ Represents the use of the splat operator.
1938
+
1939
+ [*a]
1940
+ ^^
1941
+ - name: StatementsNode
1942
+ child_nodes:
1943
+ - name: body
1944
+ type: node[]
1945
+ comment: |
1946
+ Represents a set of statements contained within some scope.
1947
+
1948
+ foo; bar; baz
1949
+ ^^^^^^^^^^^^^
1950
+ - name: StringConcatNode
1951
+ child_nodes:
1952
+ - name: left
1953
+ type: node
1954
+ - name: right
1955
+ type: node
1956
+ comment: |
1957
+ Represents the use of compile-time string concatenation.
1958
+
1959
+ "foo" "bar"
1960
+ ^^^^^^^^^^^
1961
+ - name: StringNode
1962
+ child_nodes:
1963
+ - name: opening_loc
1964
+ type: location?
1965
+ - name: content_loc
1966
+ type: location
1967
+ - name: closing_loc
1968
+ type: location?
1969
+ - name: unescaped
1970
+ type: string
1971
+ comment: |
1972
+ Represents a string literal, a string contained within a `%w` list, or
1973
+ plain string content within an interpolated string.
1974
+
1975
+ "foo"
1976
+ ^^^^^
1977
+
1978
+ %w[foo]
1979
+ ^^^
1980
+
1981
+ "foo #{bar} baz"
1982
+ ^^^^ ^^^^
1983
+ - name: SuperNode
1984
+ child_nodes:
1985
+ - name: keyword_loc
1986
+ type: location
1987
+ - name: lparen_loc
1988
+ type: location?
1989
+ - name: arguments
1990
+ type: node?
1991
+ kind: ArgumentsNode
1992
+ - name: rparen_loc
1993
+ type: location?
1994
+ - name: block
1995
+ type: node?
1996
+ kind: BlockNode
1997
+ comment: |
1998
+ Represents the use of the `super` keyword with parentheses or arguments.
1999
+
2000
+ super()
2001
+ ^^^^^^^
2002
+
2003
+ super foo, bar
2004
+ ^^^^^^^^^^^^^^
2005
+ - name: SymbolNode
2006
+ child_nodes:
2007
+ - name: opening_loc
2008
+ type: location?
2009
+ - name: value_loc
2010
+ type: location
2011
+ - name: closing_loc
2012
+ type: location?
2013
+ - name: unescaped
2014
+ type: string
2015
+ comment: |
2016
+ Represents a symbol literal or a symbol contained within a `%i` list.
2017
+
2018
+ :foo
2019
+ ^^^^
2020
+
2021
+ %i[foo]
2022
+ ^^^
2023
+ - name: TrueNode
2024
+ comment: |
2025
+ Represents the use of the literal `true` keyword.
2026
+
2027
+ true
2028
+ ^^^^
2029
+ - name: UndefNode
2030
+ child_nodes:
2031
+ - name: names
2032
+ type: node[]
2033
+ - name: keyword_loc
2034
+ type: location
2035
+ comment: |
2036
+ Represents the use of the `undef` keyword.
2037
+
2038
+ undef :foo, :bar, :baz
2039
+ ^^^^^^^^^^^^^^^^^^^^^^
2040
+ - name: UnlessNode
2041
+ child_nodes:
2042
+ - name: keyword_loc
2043
+ type: location
2044
+ - name: predicate
2045
+ type: node
2046
+ - name: statements
2047
+ type: node?
2048
+ kind: StatementsNode
2049
+ - name: consequent
2050
+ type: node?
2051
+ kind: ElseNode
2052
+ - name: end_keyword_loc
2053
+ type: location?
2054
+ newline: predicate
2055
+ comment: |
2056
+ Represents the use of the `unless` keyword, either in the block form or the modifier form.
2057
+
2058
+ bar unless foo
2059
+ ^^^^^^^^^^^^^^
2060
+
2061
+ unless foo then bar end
2062
+ ^^^^^^^^^^^^^^^^^^^^^^^
2063
+ - name: UntilNode
2064
+ child_nodes:
2065
+ - name: keyword_loc
2066
+ type: location
2067
+ - name: predicate
2068
+ type: node
2069
+ - name: statements
2070
+ type: node?
2071
+ kind: StatementsNode
2072
+ - name: flags
2073
+ type: uint32
2074
+ newline: predicate
2075
+ comment: |
2076
+ Represents the use of the `until` keyword, either in the block form or the modifier form.
2077
+
2078
+ bar until foo
2079
+ ^^^^^^^^^^^^^
2080
+
2081
+ until foo do bar end
2082
+ ^^^^^^^^^^^^^^^^^^^^
2083
+ - name: WhenNode
2084
+ child_nodes:
2085
+ - name: keyword_loc
2086
+ type: location
2087
+ - name: conditions
2088
+ type: node[]
2089
+ - name: statements
2090
+ type: node?
2091
+ kind: StatementsNode
2092
+ comment: |
2093
+ case true
2094
+ when true
2095
+ ^^^^^^^^^
2096
+ end
2097
+ - name: WhileNode
2098
+ child_nodes:
2099
+ - name: keyword_loc
2100
+ type: location
2101
+ - name: predicate
2102
+ type: node
2103
+ - name: statements
2104
+ type: node?
2105
+ kind: StatementsNode
2106
+ - name: flags
2107
+ type: uint32
2108
+ newline: predicate
2109
+ comment: |
2110
+ Represents the use of the `while` keyword, either in the block form or the modifier form.
2111
+
2112
+ bar while foo
2113
+ ^^^^^^^^^^^^^
2114
+
2115
+ while foo do bar end
2116
+ ^^^^^^^^^^^^^^^^^^^^
2117
+ - name: XStringNode
2118
+ child_nodes:
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 an xstring literal with no interpolation.
2129
+
2130
+ `foo`
2131
+ ^^^^^
2132
+ - name: YieldNode
2133
+ child_nodes:
2134
+ - name: keyword_loc
2135
+ type: location
2136
+ - name: lparen_loc
2137
+ type: location?
2138
+ - name: arguments
2139
+ type: node?
2140
+ kind: ArgumentsNode
2141
+ - name: rparen_loc
2142
+ type: location?
2143
+ comment: |
2144
+ Represents the use of the `yield` keyword.
2145
+
2146
+ yield 1
2147
+ ^^^^^^^