yarp 0.6.0 → 0.8.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +55 -0
  3. data/CONTRIBUTING.md +4 -0
  4. data/{Makefile.in → Makefile} +5 -4
  5. data/README.md +6 -3
  6. data/config.yml +83 -274
  7. data/docs/build_system.md +4 -15
  8. data/docs/building.md +1 -5
  9. data/docs/encoding.md +1 -0
  10. data/docs/{extension.md → ruby_api.md} +6 -3
  11. data/docs/serialization.md +71 -24
  12. data/ext/yarp/api_node.c +173 -585
  13. data/ext/yarp/extconf.rb +15 -10
  14. data/ext/yarp/extension.c +4 -2
  15. data/ext/yarp/extension.h +1 -1
  16. data/include/yarp/ast.h +167 -306
  17. data/include/yarp/defines.h +5 -15
  18. data/include/yarp/enc/yp_encoding.h +1 -0
  19. data/include/yarp/unescape.h +1 -1
  20. data/include/yarp/util/yp_buffer.h +9 -0
  21. data/include/yarp/util/yp_constant_pool.h +3 -0
  22. data/include/yarp/util/yp_list.h +7 -7
  23. data/include/yarp/util/yp_newline_list.h +4 -0
  24. data/include/yarp/util/yp_state_stack.h +1 -1
  25. data/include/yarp/util/yp_string.h +5 -1
  26. data/include/yarp/version.h +2 -3
  27. data/include/yarp.h +4 -2
  28. data/lib/yarp/ffi.rb +226 -0
  29. data/lib/yarp/lex_compat.rb +16 -2
  30. data/lib/yarp/node.rb +594 -1437
  31. data/lib/yarp/ripper_compat.rb +3 -3
  32. data/lib/yarp/serialize.rb +312 -149
  33. data/lib/yarp.rb +167 -2
  34. data/src/enc/yp_unicode.c +9 -0
  35. data/src/node.c +92 -250
  36. data/src/prettyprint.c +81 -206
  37. data/src/serialize.c +124 -149
  38. data/src/unescape.c +29 -35
  39. data/src/util/yp_buffer.c +18 -0
  40. data/src/util/yp_list.c +7 -16
  41. data/src/util/yp_state_stack.c +0 -6
  42. data/src/util/yp_string.c +8 -17
  43. data/src/yarp.c +444 -717
  44. data/yarp.gemspec +5 -5
  45. metadata +6 -6
  46. data/config.h.in +0 -25
  47. data/configure +0 -4487
data/lib/yarp/node.rb CHANGED
@@ -33,7 +33,6 @@ module YARP
33
33
  visitor.visit_alias_node(self)
34
34
  end
35
35
 
36
-
37
36
  # def child_nodes: () -> Array[nil | Node]
38
37
  def child_nodes
39
38
  [new_name, old_name]
@@ -80,7 +79,6 @@ module YARP
80
79
  visitor.visit_alternation_pattern_node(self)
81
80
  end
82
81
 
83
-
84
82
  # def child_nodes: () -> Array[nil | Node]
85
83
  def child_nodes
86
84
  [left, right]
@@ -127,7 +125,6 @@ module YARP
127
125
  visitor.visit_and_node(self)
128
126
  end
129
127
 
130
-
131
128
  # def child_nodes: () -> Array[nil | Node]
132
129
  def child_nodes
133
130
  [left, right]
@@ -147,6 +144,52 @@ module YARP
147
144
  end
148
145
  end
149
146
 
147
+ # Represents the use of the `&&=` operator.
148
+ #
149
+ # target &&= value
150
+ # ^^^^^^^^^^^^^^^^
151
+ class AndWriteNode < Node
152
+ # attr_reader target: Node
153
+ attr_reader :target
154
+
155
+ # attr_reader value: Node
156
+ attr_reader :value
157
+
158
+ # attr_reader operator_loc: Location
159
+ attr_reader :operator_loc
160
+
161
+ # def initialize: (target: Node, value: Node, operator_loc: Location, location: Location) -> void
162
+ def initialize(target, value, operator_loc, location)
163
+ @target = target
164
+ @value = value
165
+ @operator_loc = operator_loc
166
+ @location = location
167
+ end
168
+
169
+ # def accept: (visitor: Visitor) -> void
170
+ def accept(visitor)
171
+ visitor.visit_and_write_node(self)
172
+ end
173
+
174
+ # def child_nodes: () -> Array[nil | Node]
175
+ def child_nodes
176
+ [target, value]
177
+ end
178
+
179
+ # def deconstruct: () -> Array[nil | Node]
180
+ alias deconstruct child_nodes
181
+
182
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
183
+ def deconstruct_keys(keys)
184
+ { target: target, value: value, operator_loc: operator_loc, location: location }
185
+ end
186
+
187
+ # def operator: () -> String
188
+ def operator
189
+ operator_loc.slice
190
+ end
191
+ end
192
+
150
193
  # Represents a set of arguments to a method or a keyword.
151
194
  #
152
195
  # return foo, bar, baz
@@ -166,7 +209,6 @@ module YARP
166
209
  visitor.visit_arguments_node(self)
167
210
  end
168
211
 
169
-
170
212
  # def child_nodes: () -> Array[nil | Node]
171
213
  def child_nodes
172
214
  [*arguments]
@@ -209,7 +251,6 @@ module YARP
209
251
  visitor.visit_array_node(self)
210
252
  end
211
253
 
212
-
213
254
  # def child_nodes: () -> Array[nil | Node]
214
255
  def child_nodes
215
256
  [*elements]
@@ -285,7 +326,6 @@ module YARP
285
326
  visitor.visit_array_pattern_node(self)
286
327
  end
287
328
 
288
-
289
329
  # def child_nodes: () -> Array[nil | Node]
290
330
  def child_nodes
291
331
  [constant, *requireds, rest, *posts]
@@ -337,7 +377,6 @@ module YARP
337
377
  visitor.visit_assoc_node(self)
338
378
  end
339
379
 
340
-
341
380
  # def child_nodes: () -> Array[nil | Node]
342
381
  def child_nodes
343
382
  [key, value]
@@ -380,7 +419,6 @@ module YARP
380
419
  visitor.visit_assoc_splat_node(self)
381
420
  end
382
421
 
383
-
384
422
  # def child_nodes: () -> Array[nil | Node]
385
423
  def child_nodes
386
424
  [value]
@@ -415,7 +453,6 @@ module YARP
415
453
  visitor.visit_back_reference_read_node(self)
416
454
  end
417
455
 
418
-
419
456
  # def child_nodes: () -> Array[nil | Node]
420
457
  def child_nodes
421
458
  []
@@ -522,7 +559,6 @@ module YARP
522
559
  visitor.visit_block_argument_node(self)
523
560
  end
524
561
 
525
-
526
562
  # def child_nodes: () -> Array[nil | Node]
527
563
  def child_nodes
528
564
  [expression]
@@ -553,8 +589,8 @@ module YARP
553
589
  # attr_reader parameters: Node?
554
590
  attr_reader :parameters
555
591
 
556
- # attr_reader statements: Node?
557
- attr_reader :statements
592
+ # attr_reader body: Node?
593
+ attr_reader :body
558
594
 
559
595
  # attr_reader opening_loc: Location
560
596
  attr_reader :opening_loc
@@ -562,11 +598,11 @@ module YARP
562
598
  # attr_reader closing_loc: Location
563
599
  attr_reader :closing_loc
564
600
 
565
- # def initialize: (locals: Array[Symbol], parameters: Node?, statements: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
566
- def initialize(locals, parameters, statements, opening_loc, closing_loc, location)
601
+ # def initialize: (locals: Array[Symbol], parameters: Node?, body: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
602
+ def initialize(locals, parameters, body, opening_loc, closing_loc, location)
567
603
  @locals = locals
568
604
  @parameters = parameters
569
- @statements = statements
605
+ @body = body
570
606
  @opening_loc = opening_loc
571
607
  @closing_loc = closing_loc
572
608
  @location = location
@@ -577,10 +613,9 @@ module YARP
577
613
  visitor.visit_block_node(self)
578
614
  end
579
615
 
580
-
581
616
  # def child_nodes: () -> Array[nil | Node]
582
617
  def child_nodes
583
- [parameters, statements]
618
+ [parameters, body]
584
619
  end
585
620
 
586
621
  # def deconstruct: () -> Array[nil | Node]
@@ -588,7 +623,7 @@ module YARP
588
623
 
589
624
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
590
625
  def deconstruct_keys(keys)
591
- { locals: locals, parameters: parameters, statements: statements, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
626
+ { locals: locals, parameters: parameters, body: body, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
592
627
  end
593
628
 
594
629
  # def opening: () -> String
@@ -626,7 +661,6 @@ module YARP
626
661
  visitor.visit_block_parameter_node(self)
627
662
  end
628
663
 
629
-
630
664
  # def child_nodes: () -> Array[nil | Node]
631
665
  def child_nodes
632
666
  []
@@ -686,7 +720,6 @@ module YARP
686
720
  visitor.visit_block_parameters_node(self)
687
721
  end
688
722
 
689
-
690
723
  # def child_nodes: () -> Array[nil | Node]
691
724
  def child_nodes
692
725
  [parameters]
@@ -734,7 +767,6 @@ module YARP
734
767
  visitor.visit_break_node(self)
735
768
  end
736
769
 
737
-
738
770
  # def child_nodes: () -> Array[nil | Node]
739
771
  def child_nodes
740
772
  [arguments]
@@ -820,7 +852,6 @@ module YARP
820
852
  visitor.visit_call_node(self)
821
853
  end
822
854
 
823
-
824
855
  # def child_nodes: () -> Array[nil | Node]
825
856
  def child_nodes
826
857
  [receiver, arguments, block]
@@ -853,6 +884,16 @@ module YARP
853
884
  def closing
854
885
  closing_loc&.slice
855
886
  end
887
+
888
+ # def safe_navigation?: () -> bool
889
+ def safe_navigation?
890
+ flags.anybits?(CallNodeFlags::SAFE_NAVIGATION)
891
+ end
892
+
893
+ # def variable_call?: () -> bool
894
+ def variable_call?
895
+ flags.anybits?(CallNodeFlags::VARIABLE_CALL)
896
+ end
856
897
  end
857
898
 
858
899
  # Represents the use of the `&&=` operator on a call.
@@ -882,7 +923,6 @@ module YARP
882
923
  visitor.visit_call_operator_and_write_node(self)
883
924
  end
884
925
 
885
-
886
926
  # def child_nodes: () -> Array[nil | Node]
887
927
  def child_nodes
888
928
  [target, value]
@@ -929,7 +969,6 @@ module YARP
929
969
  visitor.visit_call_operator_or_write_node(self)
930
970
  end
931
971
 
932
-
933
972
  # def child_nodes: () -> Array[nil | Node]
934
973
  def child_nodes
935
974
  [target, value]
@@ -980,7 +1019,6 @@ module YARP
980
1019
  visitor.visit_call_operator_write_node(self)
981
1020
  end
982
1021
 
983
-
984
1022
  # def child_nodes: () -> Array[nil | Node]
985
1023
  def child_nodes
986
1024
  [target, value]
@@ -1027,7 +1065,6 @@ module YARP
1027
1065
  visitor.visit_capture_pattern_node(self)
1028
1066
  end
1029
1067
 
1030
-
1031
1068
  # def child_nodes: () -> Array[nil | Node]
1032
1069
  def child_nodes
1033
1070
  [value, target]
@@ -1084,7 +1121,6 @@ module YARP
1084
1121
  visitor.visit_case_node(self)
1085
1122
  end
1086
1123
 
1087
-
1088
1124
  # def child_nodes: () -> Array[nil | Node]
1089
1125
  def child_nodes
1090
1126
  [predicate, *conditions, consequent]
@@ -1129,20 +1165,20 @@ module YARP
1129
1165
  # attr_reader superclass: Node?
1130
1166
  attr_reader :superclass
1131
1167
 
1132
- # attr_reader statements: Node?
1133
- attr_reader :statements
1168
+ # attr_reader body: Node?
1169
+ attr_reader :body
1134
1170
 
1135
1171
  # attr_reader end_keyword_loc: Location
1136
1172
  attr_reader :end_keyword_loc
1137
1173
 
1138
- # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, constant_path: Node, inheritance_operator_loc: Location?, superclass: Node?, statements: Node?, end_keyword_loc: Location, location: Location) -> void
1139
- def initialize(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, statements, end_keyword_loc, location)
1174
+ # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, constant_path: Node, inheritance_operator_loc: Location?, superclass: Node?, body: Node?, end_keyword_loc: Location, location: Location) -> void
1175
+ def initialize(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, location)
1140
1176
  @locals = locals
1141
1177
  @class_keyword_loc = class_keyword_loc
1142
1178
  @constant_path = constant_path
1143
1179
  @inheritance_operator_loc = inheritance_operator_loc
1144
1180
  @superclass = superclass
1145
- @statements = statements
1181
+ @body = body
1146
1182
  @end_keyword_loc = end_keyword_loc
1147
1183
  @location = location
1148
1184
  end
@@ -1152,10 +1188,9 @@ module YARP
1152
1188
  visitor.visit_class_node(self)
1153
1189
  end
1154
1190
 
1155
-
1156
1191
  # def child_nodes: () -> Array[nil | Node]
1157
1192
  def child_nodes
1158
- [constant_path, superclass, statements]
1193
+ [constant_path, superclass, body]
1159
1194
  end
1160
1195
 
1161
1196
  # def deconstruct: () -> Array[nil | Node]
@@ -1163,7 +1198,7 @@ module YARP
1163
1198
 
1164
1199
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1165
1200
  def deconstruct_keys(keys)
1166
- { locals: locals, class_keyword_loc: class_keyword_loc, constant_path: constant_path, inheritance_operator_loc: inheritance_operator_loc, superclass: superclass, statements: statements, end_keyword_loc: end_keyword_loc, location: location }
1201
+ { locals: locals, class_keyword_loc: class_keyword_loc, constant_path: constant_path, inheritance_operator_loc: inheritance_operator_loc, superclass: superclass, body: body, end_keyword_loc: end_keyword_loc, location: location }
1167
1202
  end
1168
1203
 
1169
1204
  # def class_keyword: () -> String
@@ -1182,34 +1217,62 @@ module YARP
1182
1217
  end
1183
1218
  end
1184
1219
 
1185
- # Represents the use of the `&&=` operator for assignment to a class variable.
1220
+ # Represents referencing a class variable.
1186
1221
  #
1187
- # @@target &&= value
1188
- # ^^^^^^^^^^^^^^^^
1189
- class ClassVariableOperatorAndWriteNode < Node
1222
+ # @@foo
1223
+ # ^^^^^
1224
+ class ClassVariableReadNode < Node
1225
+ # def initialize: (location: Location) -> void
1226
+ def initialize(location)
1227
+ @location = location
1228
+ end
1229
+
1230
+ # def accept: (visitor: Visitor) -> void
1231
+ def accept(visitor)
1232
+ visitor.visit_class_variable_read_node(self)
1233
+ end
1234
+
1235
+ # def child_nodes: () -> Array[nil | Node]
1236
+ def child_nodes
1237
+ []
1238
+ end
1239
+
1240
+ # def deconstruct: () -> Array[nil | Node]
1241
+ alias deconstruct child_nodes
1242
+
1243
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1244
+ def deconstruct_keys(keys)
1245
+ { location: location }
1246
+ end
1247
+ end
1248
+
1249
+ # Represents writing to a class variable.
1250
+ #
1251
+ # @@foo = 1
1252
+ # ^^^^^^^^^
1253
+ class ClassVariableWriteNode < Node
1190
1254
  # attr_reader name_loc: Location
1191
1255
  attr_reader :name_loc
1192
1256
 
1193
- # attr_reader operator_loc: Location
1194
- attr_reader :operator_loc
1195
-
1196
- # attr_reader value: Node
1257
+ # attr_reader value: Node?
1197
1258
  attr_reader :value
1198
1259
 
1199
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1200
- def initialize(name_loc, operator_loc, value, location)
1260
+ # attr_reader operator_loc: Location?
1261
+ attr_reader :operator_loc
1262
+
1263
+ # def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
1264
+ def initialize(name_loc, value, operator_loc, location)
1201
1265
  @name_loc = name_loc
1202
- @operator_loc = operator_loc
1203
1266
  @value = value
1267
+ @operator_loc = operator_loc
1204
1268
  @location = location
1205
1269
  end
1206
1270
 
1207
1271
  # def accept: (visitor: Visitor) -> void
1208
1272
  def accept(visitor)
1209
- visitor.visit_class_variable_operator_and_write_node(self)
1273
+ visitor.visit_class_variable_write_node(self)
1210
1274
  end
1211
1275
 
1212
-
1213
1276
  # def child_nodes: () -> Array[nil | Node]
1214
1277
  def child_nodes
1215
1278
  [value]
@@ -1220,7 +1283,7 @@ module YARP
1220
1283
 
1221
1284
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1222
1285
  def deconstruct_keys(keys)
1223
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1286
+ { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location }
1224
1287
  end
1225
1288
 
1226
1289
  # def name: () -> String
@@ -1228,43 +1291,42 @@ module YARP
1228
1291
  name_loc.slice
1229
1292
  end
1230
1293
 
1231
- # def operator: () -> String
1294
+ # def operator: () -> String?
1232
1295
  def operator
1233
- operator_loc.slice
1296
+ operator_loc&.slice
1234
1297
  end
1235
1298
  end
1236
1299
 
1237
- # Represents the use of the `||=` operator for assignment to a class variable.
1300
+ # Represents accessing a constant through a path of `::` operators.
1238
1301
  #
1239
- # @@target ||= value
1240
- # ^^^^^^^^^^^^^^^^^^
1241
- class ClassVariableOperatorOrWriteNode < Node
1242
- # attr_reader name_loc: Location
1243
- attr_reader :name_loc
1302
+ # Foo::Bar
1303
+ # ^^^^^^^^
1304
+ class ConstantPathNode < Node
1305
+ # attr_reader parent: Node?
1306
+ attr_reader :parent
1244
1307
 
1245
- # attr_reader operator_loc: Location
1246
- attr_reader :operator_loc
1308
+ # attr_reader child: Node
1309
+ attr_reader :child
1247
1310
 
1248
- # attr_reader value: Node
1249
- attr_reader :value
1311
+ # attr_reader delimiter_loc: Location
1312
+ attr_reader :delimiter_loc
1250
1313
 
1251
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1252
- def initialize(name_loc, operator_loc, value, location)
1253
- @name_loc = name_loc
1254
- @operator_loc = operator_loc
1255
- @value = value
1314
+ # def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void
1315
+ def initialize(parent, child, delimiter_loc, location)
1316
+ @parent = parent
1317
+ @child = child
1318
+ @delimiter_loc = delimiter_loc
1256
1319
  @location = location
1257
1320
  end
1258
1321
 
1259
1322
  # def accept: (visitor: Visitor) -> void
1260
1323
  def accept(visitor)
1261
- visitor.visit_class_variable_operator_or_write_node(self)
1324
+ visitor.visit_constant_path_node(self)
1262
1325
  end
1263
1326
 
1264
-
1265
1327
  # def child_nodes: () -> Array[nil | Node]
1266
1328
  def child_nodes
1267
- [value]
1329
+ [parent, child]
1268
1330
  end
1269
1331
 
1270
1332
  # def deconstruct: () -> Array[nil | Node]
@@ -1272,55 +1334,51 @@ module YARP
1272
1334
 
1273
1335
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1274
1336
  def deconstruct_keys(keys)
1275
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1276
- end
1277
-
1278
- # def name: () -> String
1279
- def name
1280
- name_loc.slice
1337
+ { parent: parent, child: child, delimiter_loc: delimiter_loc, location: location }
1281
1338
  end
1282
1339
 
1283
- # def operator: () -> String
1284
- def operator
1285
- operator_loc.slice
1340
+ # def delimiter: () -> String
1341
+ def delimiter
1342
+ delimiter_loc.slice
1286
1343
  end
1287
1344
  end
1288
1345
 
1289
- # Represents assigning to a class variable using an operator that isn't `=`.
1346
+ # Represents writing to a constant path.
1290
1347
  #
1291
- # @@target += value
1292
- # ^^^^^^^^^^^^^^^^^
1293
- class ClassVariableOperatorWriteNode < Node
1294
- # attr_reader name_loc: Location
1295
- attr_reader :name_loc
1348
+ # ::Foo = 1
1349
+ # ^^^^^^^^^
1350
+ #
1351
+ # Foo::Bar = 1
1352
+ # ^^^^^^^^^^^^
1353
+ #
1354
+ # ::Foo::Bar = 1
1355
+ # ^^^^^^^^^^^^^^
1356
+ class ConstantPathWriteNode < Node
1357
+ # attr_reader target: Node
1358
+ attr_reader :target
1296
1359
 
1297
- # attr_reader operator_loc: Location
1360
+ # attr_reader operator_loc: Location?
1298
1361
  attr_reader :operator_loc
1299
1362
 
1300
- # attr_reader value: Node
1363
+ # attr_reader value: Node?
1301
1364
  attr_reader :value
1302
1365
 
1303
- # attr_reader operator: Symbol
1304
- attr_reader :operator
1305
-
1306
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1307
- def initialize(name_loc, operator_loc, value, operator, location)
1308
- @name_loc = name_loc
1366
+ # def initialize: (target: Node, operator_loc: Location?, value: Node?, location: Location) -> void
1367
+ def initialize(target, operator_loc, value, location)
1368
+ @target = target
1309
1369
  @operator_loc = operator_loc
1310
1370
  @value = value
1311
- @operator = operator
1312
1371
  @location = location
1313
1372
  end
1314
1373
 
1315
1374
  # def accept: (visitor: Visitor) -> void
1316
1375
  def accept(visitor)
1317
- visitor.visit_class_variable_operator_write_node(self)
1376
+ visitor.visit_constant_path_write_node(self)
1318
1377
  end
1319
1378
 
1320
-
1321
1379
  # def child_nodes: () -> Array[nil | Node]
1322
1380
  def child_nodes
1323
- [value]
1381
+ [target, value]
1324
1382
  end
1325
1383
 
1326
1384
  # def deconstruct: () -> Array[nil | Node]
@@ -1328,20 +1386,20 @@ module YARP
1328
1386
 
1329
1387
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1330
1388
  def deconstruct_keys(keys)
1331
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
1389
+ { target: target, operator_loc: operator_loc, value: value, location: location }
1332
1390
  end
1333
1391
 
1334
- # def name: () -> String
1335
- def name
1336
- name_loc.slice
1392
+ # def operator: () -> String?
1393
+ def operator
1394
+ operator_loc&.slice
1337
1395
  end
1338
1396
  end
1339
1397
 
1340
- # Represents referencing a class variable.
1398
+ # Represents referencing a constant.
1341
1399
  #
1342
- # @@foo
1343
- # ^^^^^
1344
- class ClassVariableReadNode < Node
1400
+ # Foo
1401
+ # ^^^
1402
+ class ConstantReadNode < Node
1345
1403
  # def initialize: (location: Location) -> void
1346
1404
  def initialize(location)
1347
1405
  @location = location
@@ -1349,10 +1407,9 @@ module YARP
1349
1407
 
1350
1408
  # def accept: (visitor: Visitor) -> void
1351
1409
  def accept(visitor)
1352
- visitor.visit_class_variable_read_node(self)
1410
+ visitor.visit_constant_read_node(self)
1353
1411
  end
1354
1412
 
1355
-
1356
1413
  # def child_nodes: () -> Array[nil | Node]
1357
1414
  def child_nodes
1358
1415
  []
@@ -1367,11 +1424,11 @@ module YARP
1367
1424
  end
1368
1425
  end
1369
1426
 
1370
- # Represents writing to a class variable.
1427
+ # Represents writing to a constant.
1371
1428
  #
1372
- # @@foo = 1
1373
- # ^^^^^^^^^
1374
- class ClassVariableWriteNode < Node
1429
+ # Foo = 1
1430
+ # ^^^^^^^
1431
+ class ConstantWriteNode < Node
1375
1432
  # attr_reader name_loc: Location
1376
1433
  attr_reader :name_loc
1377
1434
 
@@ -1391,10 +1448,9 @@ module YARP
1391
1448
 
1392
1449
  # def accept: (visitor: Visitor) -> void
1393
1450
  def accept(visitor)
1394
- visitor.visit_class_variable_write_node(self)
1451
+ visitor.visit_constant_write_node(self)
1395
1452
  end
1396
1453
 
1397
-
1398
1454
  # def child_nodes: () -> Array[nil | Node]
1399
1455
  def child_nodes
1400
1456
  [value]
@@ -1419,500 +1475,23 @@ module YARP
1419
1475
  end
1420
1476
  end
1421
1477
 
1422
- # Represents the use of the `&&=` operator for assignment to a constant.
1478
+ # Represents a method definition.
1423
1479
  #
1424
- # Target &&= value
1425
- # ^^^^^^^^^^^^^^^^
1426
- class ConstantOperatorAndWriteNode < Node
1480
+ # def method
1481
+ # end
1482
+ # ^^^^^^^^^^
1483
+ class DefNode < Node
1427
1484
  # attr_reader name_loc: Location
1428
1485
  attr_reader :name_loc
1429
1486
 
1430
- # attr_reader operator_loc: Location
1431
- attr_reader :operator_loc
1487
+ # attr_reader receiver: Node?
1488
+ attr_reader :receiver
1432
1489
 
1433
- # attr_reader value: Node
1434
- attr_reader :value
1490
+ # attr_reader parameters: Node?
1491
+ attr_reader :parameters
1435
1492
 
1436
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1437
- def initialize(name_loc, operator_loc, value, location)
1438
- @name_loc = name_loc
1439
- @operator_loc = operator_loc
1440
- @value = value
1441
- @location = location
1442
- end
1443
-
1444
- # def accept: (visitor: Visitor) -> void
1445
- def accept(visitor)
1446
- visitor.visit_constant_operator_and_write_node(self)
1447
- end
1448
-
1449
-
1450
- # def child_nodes: () -> Array[nil | Node]
1451
- def child_nodes
1452
- [value]
1453
- end
1454
-
1455
- # def deconstruct: () -> Array[nil | Node]
1456
- alias deconstruct child_nodes
1457
-
1458
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1459
- def deconstruct_keys(keys)
1460
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1461
- end
1462
-
1463
- # def name: () -> String
1464
- def name
1465
- name_loc.slice
1466
- end
1467
-
1468
- # def operator: () -> String
1469
- def operator
1470
- operator_loc.slice
1471
- end
1472
- end
1473
-
1474
- # Represents the use of the `||=` operator for assignment to a constant.
1475
- #
1476
- # Target ||= value
1477
- # ^^^^^^^^^^^^^^^^
1478
- class ConstantOperatorOrWriteNode < Node
1479
- # attr_reader name_loc: Location
1480
- attr_reader :name_loc
1481
-
1482
- # attr_reader operator_loc: Location
1483
- attr_reader :operator_loc
1484
-
1485
- # attr_reader value: Node
1486
- attr_reader :value
1487
-
1488
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
1489
- def initialize(name_loc, operator_loc, value, location)
1490
- @name_loc = name_loc
1491
- @operator_loc = operator_loc
1492
- @value = value
1493
- @location = location
1494
- end
1495
-
1496
- # def accept: (visitor: Visitor) -> void
1497
- def accept(visitor)
1498
- visitor.visit_constant_operator_or_write_node(self)
1499
- end
1500
-
1501
-
1502
- # def child_nodes: () -> Array[nil | Node]
1503
- def child_nodes
1504
- [value]
1505
- end
1506
-
1507
- # def deconstruct: () -> Array[nil | Node]
1508
- alias deconstruct child_nodes
1509
-
1510
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1511
- def deconstruct_keys(keys)
1512
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
1513
- end
1514
-
1515
- # def name: () -> String
1516
- def name
1517
- name_loc.slice
1518
- end
1519
-
1520
- # def operator: () -> String
1521
- def operator
1522
- operator_loc.slice
1523
- end
1524
- end
1525
-
1526
- # Represents assigning to a constant using an operator that isn't `=`.
1527
- #
1528
- # Target += value
1529
- # ^^^^^^^^^^^^^^^
1530
- class ConstantOperatorWriteNode < Node
1531
- # attr_reader name_loc: Location
1532
- attr_reader :name_loc
1533
-
1534
- # attr_reader operator_loc: Location
1535
- attr_reader :operator_loc
1536
-
1537
- # attr_reader value: Node
1538
- attr_reader :value
1539
-
1540
- # attr_reader operator: Symbol
1541
- attr_reader :operator
1542
-
1543
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1544
- def initialize(name_loc, operator_loc, value, operator, location)
1545
- @name_loc = name_loc
1546
- @operator_loc = operator_loc
1547
- @value = value
1548
- @operator = operator
1549
- @location = location
1550
- end
1551
-
1552
- # def accept: (visitor: Visitor) -> void
1553
- def accept(visitor)
1554
- visitor.visit_constant_operator_write_node(self)
1555
- end
1556
-
1557
-
1558
- # def child_nodes: () -> Array[nil | Node]
1559
- def child_nodes
1560
- [value]
1561
- end
1562
-
1563
- # def deconstruct: () -> Array[nil | Node]
1564
- alias deconstruct child_nodes
1565
-
1566
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1567
- def deconstruct_keys(keys)
1568
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
1569
- end
1570
-
1571
- # def name: () -> String
1572
- def name
1573
- name_loc.slice
1574
- end
1575
- end
1576
-
1577
- # Represents accessing a constant through a path of `::` operators.
1578
- #
1579
- # Foo::Bar
1580
- # ^^^^^^^^
1581
- class ConstantPathNode < Node
1582
- # attr_reader parent: Node?
1583
- attr_reader :parent
1584
-
1585
- # attr_reader child: Node
1586
- attr_reader :child
1587
-
1588
- # attr_reader delimiter_loc: Location
1589
- attr_reader :delimiter_loc
1590
-
1591
- # def initialize: (parent: Node?, child: Node, delimiter_loc: Location, location: Location) -> void
1592
- def initialize(parent, child, delimiter_loc, location)
1593
- @parent = parent
1594
- @child = child
1595
- @delimiter_loc = delimiter_loc
1596
- @location = location
1597
- end
1598
-
1599
- # def accept: (visitor: Visitor) -> void
1600
- def accept(visitor)
1601
- visitor.visit_constant_path_node(self)
1602
- end
1603
-
1604
-
1605
- # def child_nodes: () -> Array[nil | Node]
1606
- def child_nodes
1607
- [parent, child]
1608
- end
1609
-
1610
- # def deconstruct: () -> Array[nil | Node]
1611
- alias deconstruct child_nodes
1612
-
1613
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1614
- def deconstruct_keys(keys)
1615
- { parent: parent, child: child, delimiter_loc: delimiter_loc, location: location }
1616
- end
1617
-
1618
- # def delimiter: () -> String
1619
- def delimiter
1620
- delimiter_loc.slice
1621
- end
1622
- end
1623
-
1624
- # Represents the use of the `&&=` operator for assignment to a constant path.
1625
- #
1626
- # Parent::Child &&= value
1627
- # ^^^^^^^^^^^^^^^^^^^^^^^
1628
- class ConstantPathOperatorAndWriteNode < Node
1629
- # attr_reader target: Node
1630
- attr_reader :target
1631
-
1632
- # attr_reader operator_loc: Location
1633
- attr_reader :operator_loc
1634
-
1635
- # attr_reader value: Node
1636
- attr_reader :value
1637
-
1638
- # def initialize: (target: Node, operator_loc: Location, value: Node, location: Location) -> void
1639
- def initialize(target, operator_loc, value, location)
1640
- @target = target
1641
- @operator_loc = operator_loc
1642
- @value = value
1643
- @location = location
1644
- end
1645
-
1646
- # def accept: (visitor: Visitor) -> void
1647
- def accept(visitor)
1648
- visitor.visit_constant_path_operator_and_write_node(self)
1649
- end
1650
-
1651
-
1652
- # def child_nodes: () -> Array[nil | Node]
1653
- def child_nodes
1654
- [target, value]
1655
- end
1656
-
1657
- # def deconstruct: () -> Array[nil | Node]
1658
- alias deconstruct child_nodes
1659
-
1660
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1661
- def deconstruct_keys(keys)
1662
- { target: target, operator_loc: operator_loc, value: value, location: location }
1663
- end
1664
-
1665
- # def operator: () -> String
1666
- def operator
1667
- operator_loc.slice
1668
- end
1669
- end
1670
-
1671
- # Represents the use of the `||=` operator for assignment to a constant path.
1672
- #
1673
- # Parent::Child ||= value
1674
- # ^^^^^^^^^^^^^^^^^^^^^^^
1675
- class ConstantPathOperatorOrWriteNode < Node
1676
- # attr_reader target: Node
1677
- attr_reader :target
1678
-
1679
- # attr_reader operator_loc: Location
1680
- attr_reader :operator_loc
1681
-
1682
- # attr_reader value: Node
1683
- attr_reader :value
1684
-
1685
- # def initialize: (target: Node, operator_loc: Location, value: Node, location: Location) -> void
1686
- def initialize(target, operator_loc, value, location)
1687
- @target = target
1688
- @operator_loc = operator_loc
1689
- @value = value
1690
- @location = location
1691
- end
1692
-
1693
- # def accept: (visitor: Visitor) -> void
1694
- def accept(visitor)
1695
- visitor.visit_constant_path_operator_or_write_node(self)
1696
- end
1697
-
1698
-
1699
- # def child_nodes: () -> Array[nil | Node]
1700
- def child_nodes
1701
- [target, value]
1702
- end
1703
-
1704
- # def deconstruct: () -> Array[nil | Node]
1705
- alias deconstruct child_nodes
1706
-
1707
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1708
- def deconstruct_keys(keys)
1709
- { target: target, operator_loc: operator_loc, value: value, location: location }
1710
- end
1711
-
1712
- # def operator: () -> String
1713
- def operator
1714
- operator_loc.slice
1715
- end
1716
- end
1717
-
1718
- # Represents assigning to a constant path using an operator that isn't `=`.
1719
- #
1720
- # Parent::Child += value
1721
- # ^^^^^^^^^^^^^^^^^^^^^^
1722
- class ConstantPathOperatorWriteNode < Node
1723
- # attr_reader target: Node
1724
- attr_reader :target
1725
-
1726
- # attr_reader operator_loc: Location
1727
- attr_reader :operator_loc
1728
-
1729
- # attr_reader value: Node
1730
- attr_reader :value
1731
-
1732
- # attr_reader operator: Symbol
1733
- attr_reader :operator
1734
-
1735
- # def initialize: (target: Node, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
1736
- def initialize(target, operator_loc, value, operator, location)
1737
- @target = target
1738
- @operator_loc = operator_loc
1739
- @value = value
1740
- @operator = operator
1741
- @location = location
1742
- end
1743
-
1744
- # def accept: (visitor: Visitor) -> void
1745
- def accept(visitor)
1746
- visitor.visit_constant_path_operator_write_node(self)
1747
- end
1748
-
1749
-
1750
- # def child_nodes: () -> Array[nil | Node]
1751
- def child_nodes
1752
- [target, value]
1753
- end
1754
-
1755
- # def deconstruct: () -> Array[nil | Node]
1756
- alias deconstruct child_nodes
1757
-
1758
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1759
- def deconstruct_keys(keys)
1760
- { target: target, operator_loc: operator_loc, value: value, operator: operator, location: location }
1761
- end
1762
- end
1763
-
1764
- # Represents writing to a constant path.
1765
- #
1766
- # ::Foo = 1
1767
- # ^^^^^^^^^
1768
- #
1769
- # Foo::Bar = 1
1770
- # ^^^^^^^^^^^^
1771
- #
1772
- # ::Foo::Bar = 1
1773
- # ^^^^^^^^^^^^^^
1774
- class ConstantPathWriteNode < Node
1775
- # attr_reader target: Node
1776
- attr_reader :target
1777
-
1778
- # attr_reader operator_loc: Location?
1779
- attr_reader :operator_loc
1780
-
1781
- # attr_reader value: Node?
1782
- attr_reader :value
1783
-
1784
- # def initialize: (target: Node, operator_loc: Location?, value: Node?, location: Location) -> void
1785
- def initialize(target, operator_loc, value, location)
1786
- @target = target
1787
- @operator_loc = operator_loc
1788
- @value = value
1789
- @location = location
1790
- end
1791
-
1792
- # def accept: (visitor: Visitor) -> void
1793
- def accept(visitor)
1794
- visitor.visit_constant_path_write_node(self)
1795
- end
1796
-
1797
-
1798
- # def child_nodes: () -> Array[nil | Node]
1799
- def child_nodes
1800
- [target, value]
1801
- end
1802
-
1803
- # def deconstruct: () -> Array[nil | Node]
1804
- alias deconstruct child_nodes
1805
-
1806
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1807
- def deconstruct_keys(keys)
1808
- { target: target, operator_loc: operator_loc, value: value, location: location }
1809
- end
1810
-
1811
- # def operator: () -> String?
1812
- def operator
1813
- operator_loc&.slice
1814
- end
1815
- end
1816
-
1817
- # Represents referencing a constant.
1818
- #
1819
- # Foo
1820
- # ^^^
1821
- class ConstantReadNode < Node
1822
- # def initialize: (location: Location) -> void
1823
- def initialize(location)
1824
- @location = location
1825
- end
1826
-
1827
- # def accept: (visitor: Visitor) -> void
1828
- def accept(visitor)
1829
- visitor.visit_constant_read_node(self)
1830
- end
1831
-
1832
-
1833
- # def child_nodes: () -> Array[nil | Node]
1834
- def child_nodes
1835
- []
1836
- end
1837
-
1838
- # def deconstruct: () -> Array[nil | Node]
1839
- alias deconstruct child_nodes
1840
-
1841
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1842
- def deconstruct_keys(keys)
1843
- { location: location }
1844
- end
1845
- end
1846
-
1847
- # Represents writing to a constant.
1848
- #
1849
- # Foo = 1
1850
- # ^^^^^^^
1851
- class ConstantWriteNode < Node
1852
- # attr_reader name_loc: Location
1853
- attr_reader :name_loc
1854
-
1855
- # attr_reader value: Node?
1856
- attr_reader :value
1857
-
1858
- # attr_reader operator_loc: Location?
1859
- attr_reader :operator_loc
1860
-
1861
- # def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
1862
- def initialize(name_loc, value, operator_loc, location)
1863
- @name_loc = name_loc
1864
- @value = value
1865
- @operator_loc = operator_loc
1866
- @location = location
1867
- end
1868
-
1869
- # def accept: (visitor: Visitor) -> void
1870
- def accept(visitor)
1871
- visitor.visit_constant_write_node(self)
1872
- end
1873
-
1874
-
1875
- # def child_nodes: () -> Array[nil | Node]
1876
- def child_nodes
1877
- [value]
1878
- end
1879
-
1880
- # def deconstruct: () -> Array[nil | Node]
1881
- alias deconstruct child_nodes
1882
-
1883
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1884
- def deconstruct_keys(keys)
1885
- { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location }
1886
- end
1887
-
1888
- # def name: () -> String
1889
- def name
1890
- name_loc.slice
1891
- end
1892
-
1893
- # def operator: () -> String?
1894
- def operator
1895
- operator_loc&.slice
1896
- end
1897
- end
1898
-
1899
- # Represents a method definition.
1900
- #
1901
- # def method
1902
- # end
1903
- # ^^^^^^^^^^
1904
- class DefNode < Node
1905
- # attr_reader name_loc: Location
1906
- attr_reader :name_loc
1907
-
1908
- # attr_reader receiver: Node?
1909
- attr_reader :receiver
1910
-
1911
- # attr_reader parameters: Node?
1912
- attr_reader :parameters
1913
-
1914
- # attr_reader statements: Node?
1915
- attr_reader :statements
1493
+ # attr_reader body: Node?
1494
+ attr_reader :body
1916
1495
 
1917
1496
  # attr_reader locals: Array[Symbol]
1918
1497
  attr_reader :locals
@@ -1935,12 +1514,12 @@ module YARP
1935
1514
  # attr_reader end_keyword_loc: Location?
1936
1515
  attr_reader :end_keyword_loc
1937
1516
 
1938
- # def initialize: (name_loc: Location, receiver: Node?, parameters: Node?, statements: Node?, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location?, location: Location) -> void
1939
- def initialize(name_loc, receiver, parameters, statements, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
1517
+ # def initialize: (name_loc: Location, receiver: Node?, parameters: Node?, body: Node?, locals: Array[Symbol], def_keyword_loc: Location, operator_loc: Location?, lparen_loc: Location?, rparen_loc: Location?, equal_loc: Location?, end_keyword_loc: Location?, location: Location) -> void
1518
+ def initialize(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
1940
1519
  @name_loc = name_loc
1941
1520
  @receiver = receiver
1942
1521
  @parameters = parameters
1943
- @statements = statements
1522
+ @body = body
1944
1523
  @locals = locals
1945
1524
  @def_keyword_loc = def_keyword_loc
1946
1525
  @operator_loc = operator_loc
@@ -1956,10 +1535,9 @@ module YARP
1956
1535
  visitor.visit_def_node(self)
1957
1536
  end
1958
1537
 
1959
-
1960
1538
  # def child_nodes: () -> Array[nil | Node]
1961
1539
  def child_nodes
1962
- [receiver, parameters, statements]
1540
+ [receiver, parameters, body]
1963
1541
  end
1964
1542
 
1965
1543
  # def deconstruct: () -> Array[nil | Node]
@@ -1967,7 +1545,7 @@ module YARP
1967
1545
 
1968
1546
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1969
1547
  def deconstruct_keys(keys)
1970
- { name_loc: name_loc, receiver: receiver, parameters: parameters, statements: statements, locals: locals, def_keyword_loc: def_keyword_loc, operator_loc: operator_loc, lparen_loc: lparen_loc, rparen_loc: rparen_loc, equal_loc: equal_loc, end_keyword_loc: end_keyword_loc, location: location }
1548
+ { name_loc: name_loc, receiver: receiver, parameters: parameters, body: body, locals: locals, def_keyword_loc: def_keyword_loc, operator_loc: operator_loc, lparen_loc: lparen_loc, rparen_loc: rparen_loc, equal_loc: equal_loc, end_keyword_loc: end_keyword_loc, location: location }
1971
1549
  end
1972
1550
 
1973
1551
  # def name: () -> String
@@ -2037,7 +1615,6 @@ module YARP
2037
1615
  visitor.visit_defined_node(self)
2038
1616
  end
2039
1617
 
2040
-
2041
1618
  # def child_nodes: () -> Array[nil | Node]
2042
1619
  def child_nodes
2043
1620
  [value]
@@ -2094,7 +1671,6 @@ module YARP
2094
1671
  visitor.visit_else_node(self)
2095
1672
  end
2096
1673
 
2097
-
2098
1674
  # def child_nodes: () -> Array[nil | Node]
2099
1675
  def child_nodes
2100
1676
  [statements]
@@ -2146,7 +1722,6 @@ module YARP
2146
1722
  visitor.visit_embedded_statements_node(self)
2147
1723
  end
2148
1724
 
2149
-
2150
1725
  # def child_nodes: () -> Array[nil | Node]
2151
1726
  def child_nodes
2152
1727
  [statements]
@@ -2194,7 +1769,6 @@ module YARP
2194
1769
  visitor.visit_embedded_variable_node(self)
2195
1770
  end
2196
1771
 
2197
-
2198
1772
  # def child_nodes: () -> Array[nil | Node]
2199
1773
  def child_nodes
2200
1774
  [variable]
@@ -2245,7 +1819,6 @@ module YARP
2245
1819
  visitor.visit_ensure_node(self)
2246
1820
  end
2247
1821
 
2248
-
2249
1822
  # def child_nodes: () -> Array[nil | Node]
2250
1823
  def child_nodes
2251
1824
  [statements]
@@ -2285,7 +1858,6 @@ module YARP
2285
1858
  visitor.visit_false_node(self)
2286
1859
  end
2287
1860
 
2288
-
2289
1861
  # def child_nodes: () -> Array[nil | Node]
2290
1862
  def child_nodes
2291
1863
  []
@@ -2345,7 +1917,6 @@ module YARP
2345
1917
  visitor.visit_find_pattern_node(self)
2346
1918
  end
2347
1919
 
2348
-
2349
1920
  # def child_nodes: () -> Array[nil | Node]
2350
1921
  def child_nodes
2351
1922
  [constant, left, *requireds, right]
@@ -2370,6 +1941,61 @@ module YARP
2370
1941
  end
2371
1942
  end
2372
1943
 
1944
+ # Represents the use of the `..` or `...` operators to create flip flops.
1945
+ #
1946
+ # baz if foo .. bar
1947
+ # ^^^^^^^^^^
1948
+ class FlipFlopNode < Node
1949
+ # attr_reader left: Node?
1950
+ attr_reader :left
1951
+
1952
+ # attr_reader right: Node?
1953
+ attr_reader :right
1954
+
1955
+ # attr_reader operator_loc: Location
1956
+ attr_reader :operator_loc
1957
+
1958
+ # attr_reader flags: Integer
1959
+ attr_reader :flags
1960
+
1961
+ # def initialize: (left: Node?, right: Node?, operator_loc: Location, flags: Integer, location: Location) -> void
1962
+ def initialize(left, right, operator_loc, flags, location)
1963
+ @left = left
1964
+ @right = right
1965
+ @operator_loc = operator_loc
1966
+ @flags = flags
1967
+ @location = location
1968
+ end
1969
+
1970
+ # def accept: (visitor: Visitor) -> void
1971
+ def accept(visitor)
1972
+ visitor.visit_flip_flop_node(self)
1973
+ end
1974
+
1975
+ # def child_nodes: () -> Array[nil | Node]
1976
+ def child_nodes
1977
+ [left, right]
1978
+ end
1979
+
1980
+ # def deconstruct: () -> Array[nil | Node]
1981
+ alias deconstruct child_nodes
1982
+
1983
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
1984
+ def deconstruct_keys(keys)
1985
+ { left: left, right: right, operator_loc: operator_loc, flags: flags, location: location }
1986
+ end
1987
+
1988
+ # def operator: () -> String
1989
+ def operator
1990
+ operator_loc.slice
1991
+ end
1992
+
1993
+ # def exclude_end?: () -> bool
1994
+ def exclude_end?
1995
+ flags.anybits?(RangeFlags::EXCLUDE_END)
1996
+ end
1997
+ end
1998
+
2373
1999
  # Represents a floating point number literal.
2374
2000
  #
2375
2001
  # 1.0
@@ -2385,7 +2011,6 @@ module YARP
2385
2011
  visitor.visit_float_node(self)
2386
2012
  end
2387
2013
 
2388
-
2389
2014
  # def child_nodes: () -> Array[nil | Node]
2390
2015
  def child_nodes
2391
2016
  []
@@ -2443,7 +2068,6 @@ module YARP
2443
2068
  visitor.visit_for_node(self)
2444
2069
  end
2445
2070
 
2446
-
2447
2071
  # def child_nodes: () -> Array[nil | Node]
2448
2072
  def child_nodes
2449
2073
  [index, collection, statements]
@@ -2473,139 +2097,31 @@ module YARP
2473
2097
  end
2474
2098
 
2475
2099
  # def end_keyword: () -> String
2476
- def end_keyword
2477
- end_keyword_loc.slice
2478
- end
2479
- end
2480
-
2481
- # Represents forwarding all arguments to this method to another method.
2482
- #
2483
- # def foo(...)
2484
- # bar(...)
2485
- # ^^^^^^^^
2486
- # end
2487
- class ForwardingArgumentsNode < Node
2488
- # def initialize: (location: Location) -> void
2489
- def initialize(location)
2490
- @location = location
2491
- end
2492
-
2493
- # def accept: (visitor: Visitor) -> void
2494
- def accept(visitor)
2495
- visitor.visit_forwarding_arguments_node(self)
2496
- end
2497
-
2498
-
2499
- # def child_nodes: () -> Array[nil | Node]
2500
- def child_nodes
2501
- []
2502
- end
2503
-
2504
- # def deconstruct: () -> Array[nil | Node]
2505
- alias deconstruct child_nodes
2506
-
2507
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2508
- def deconstruct_keys(keys)
2509
- { location: location }
2510
- end
2511
- end
2512
-
2513
- # Represents the use of the forwarding parameter in a method, block, or lambda declaration.
2514
- #
2515
- # def foo(...)
2516
- # ^^^
2517
- # end
2518
- class ForwardingParameterNode < Node
2519
- # def initialize: (location: Location) -> void
2520
- def initialize(location)
2521
- @location = location
2522
- end
2523
-
2524
- # def accept: (visitor: Visitor) -> void
2525
- def accept(visitor)
2526
- visitor.visit_forwarding_parameter_node(self)
2527
- end
2528
-
2529
-
2530
- # def child_nodes: () -> Array[nil | Node]
2531
- def child_nodes
2532
- []
2533
- end
2534
-
2535
- # def deconstruct: () -> Array[nil | Node]
2536
- alias deconstruct child_nodes
2537
-
2538
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2539
- def deconstruct_keys(keys)
2540
- { location: location }
2541
- end
2542
- end
2543
-
2544
- # Represents the use of the `super` keyword without parentheses or arguments.
2545
- #
2546
- # super
2547
- # ^^^^^
2548
- class ForwardingSuperNode < Node
2549
- # attr_reader block: Node?
2550
- attr_reader :block
2551
-
2552
- # def initialize: (block: Node?, location: Location) -> void
2553
- def initialize(block, location)
2554
- @block = block
2555
- @location = location
2556
- end
2557
-
2558
- # def accept: (visitor: Visitor) -> void
2559
- def accept(visitor)
2560
- visitor.visit_forwarding_super_node(self)
2561
- end
2562
-
2563
-
2564
- # def child_nodes: () -> Array[nil | Node]
2565
- def child_nodes
2566
- [block]
2567
- end
2568
-
2569
- # def deconstruct: () -> Array[nil | Node]
2570
- alias deconstruct child_nodes
2571
-
2572
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2573
- def deconstruct_keys(keys)
2574
- { block: block, location: location }
2575
- end
2576
- end
2577
-
2578
- # Represents the use of the `&&=` operator for assignment to a global variable.
2579
- #
2580
- # $target &&= value
2581
- # ^^^^^^^^^^^^^^^^^
2582
- class GlobalVariableOperatorAndWriteNode < Node
2583
- # attr_reader name_loc: Location
2584
- attr_reader :name_loc
2585
-
2586
- # attr_reader operator_loc: Location
2587
- attr_reader :operator_loc
2588
-
2589
- # attr_reader value: Node
2590
- attr_reader :value
2100
+ def end_keyword
2101
+ end_keyword_loc.slice
2102
+ end
2103
+ end
2591
2104
 
2592
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
2593
- def initialize(name_loc, operator_loc, value, location)
2594
- @name_loc = name_loc
2595
- @operator_loc = operator_loc
2596
- @value = value
2105
+ # Represents forwarding all arguments to this method to another method.
2106
+ #
2107
+ # def foo(...)
2108
+ # bar(...)
2109
+ # ^^^^^^^^
2110
+ # end
2111
+ class ForwardingArgumentsNode < Node
2112
+ # def initialize: (location: Location) -> void
2113
+ def initialize(location)
2597
2114
  @location = location
2598
2115
  end
2599
2116
 
2600
2117
  # def accept: (visitor: Visitor) -> void
2601
2118
  def accept(visitor)
2602
- visitor.visit_global_variable_operator_and_write_node(self)
2119
+ visitor.visit_forwarding_arguments_node(self)
2603
2120
  end
2604
2121
 
2605
-
2606
2122
  # def child_nodes: () -> Array[nil | Node]
2607
2123
  def child_nodes
2608
- [value]
2124
+ []
2609
2125
  end
2610
2126
 
2611
2127
  # def deconstruct: () -> Array[nil | Node]
@@ -2613,51 +2129,29 @@ module YARP
2613
2129
 
2614
2130
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2615
2131
  def deconstruct_keys(keys)
2616
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
2617
- end
2618
-
2619
- # def name: () -> String
2620
- def name
2621
- name_loc.slice
2622
- end
2623
-
2624
- # def operator: () -> String
2625
- def operator
2626
- operator_loc.slice
2132
+ { location: location }
2627
2133
  end
2628
2134
  end
2629
2135
 
2630
- # Represents the use of the `||=` operator for assignment to a global variable.
2136
+ # Represents the use of the forwarding parameter in a method, block, or lambda declaration.
2631
2137
  #
2632
- # $target ||= value
2633
- # ^^^^^^^^^^^^^^^^^
2634
- class GlobalVariableOperatorOrWriteNode < Node
2635
- # attr_reader name_loc: Location
2636
- attr_reader :name_loc
2637
-
2638
- # attr_reader operator_loc: Location
2639
- attr_reader :operator_loc
2640
-
2641
- # attr_reader value: Node
2642
- attr_reader :value
2643
-
2644
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
2645
- def initialize(name_loc, operator_loc, value, location)
2646
- @name_loc = name_loc
2647
- @operator_loc = operator_loc
2648
- @value = value
2138
+ # def foo(...)
2139
+ # ^^^
2140
+ # end
2141
+ class ForwardingParameterNode < Node
2142
+ # def initialize: (location: Location) -> void
2143
+ def initialize(location)
2649
2144
  @location = location
2650
2145
  end
2651
2146
 
2652
2147
  # def accept: (visitor: Visitor) -> void
2653
2148
  def accept(visitor)
2654
- visitor.visit_global_variable_operator_or_write_node(self)
2149
+ visitor.visit_forwarding_parameter_node(self)
2655
2150
  end
2656
2151
 
2657
-
2658
2152
  # def child_nodes: () -> Array[nil | Node]
2659
2153
  def child_nodes
2660
- [value]
2154
+ []
2661
2155
  end
2662
2156
 
2663
2157
  # def deconstruct: () -> Array[nil | Node]
@@ -2665,55 +2159,32 @@ module YARP
2665
2159
 
2666
2160
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2667
2161
  def deconstruct_keys(keys)
2668
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
2669
- end
2670
-
2671
- # def name: () -> String
2672
- def name
2673
- name_loc.slice
2674
- end
2675
-
2676
- # def operator: () -> String
2677
- def operator
2678
- operator_loc.slice
2162
+ { location: location }
2679
2163
  end
2680
2164
  end
2681
2165
 
2682
- # Represents assigning to a global variable using an operator that isn't `=`.
2166
+ # Represents the use of the `super` keyword without parentheses or arguments.
2683
2167
  #
2684
- # $target += value
2685
- # ^^^^^^^^^^^^^^^^
2686
- class GlobalVariableOperatorWriteNode < Node
2687
- # attr_reader name_loc: Location
2688
- attr_reader :name_loc
2689
-
2690
- # attr_reader operator_loc: Location
2691
- attr_reader :operator_loc
2692
-
2693
- # attr_reader value: Node
2694
- attr_reader :value
2695
-
2696
- # attr_reader operator: Symbol
2697
- attr_reader :operator
2168
+ # super
2169
+ # ^^^^^
2170
+ class ForwardingSuperNode < Node
2171
+ # attr_reader block: Node?
2172
+ attr_reader :block
2698
2173
 
2699
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
2700
- def initialize(name_loc, operator_loc, value, operator, location)
2701
- @name_loc = name_loc
2702
- @operator_loc = operator_loc
2703
- @value = value
2704
- @operator = operator
2174
+ # def initialize: (block: Node?, location: Location) -> void
2175
+ def initialize(block, location)
2176
+ @block = block
2705
2177
  @location = location
2706
2178
  end
2707
2179
 
2708
2180
  # def accept: (visitor: Visitor) -> void
2709
2181
  def accept(visitor)
2710
- visitor.visit_global_variable_operator_write_node(self)
2182
+ visitor.visit_forwarding_super_node(self)
2711
2183
  end
2712
2184
 
2713
-
2714
2185
  # def child_nodes: () -> Array[nil | Node]
2715
2186
  def child_nodes
2716
- [value]
2187
+ [block]
2717
2188
  end
2718
2189
 
2719
2190
  # def deconstruct: () -> Array[nil | Node]
@@ -2721,12 +2192,7 @@ module YARP
2721
2192
 
2722
2193
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
2723
2194
  def deconstruct_keys(keys)
2724
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
2725
- end
2726
-
2727
- # def name: () -> String
2728
- def name
2729
- name_loc.slice
2195
+ { block: block, location: location }
2730
2196
  end
2731
2197
  end
2732
2198
 
@@ -2745,7 +2211,6 @@ module YARP
2745
2211
  visitor.visit_global_variable_read_node(self)
2746
2212
  end
2747
2213
 
2748
-
2749
2214
  # def child_nodes: () -> Array[nil | Node]
2750
2215
  def child_nodes
2751
2216
  []
@@ -2787,7 +2252,6 @@ module YARP
2787
2252
  visitor.visit_global_variable_write_node(self)
2788
2253
  end
2789
2254
 
2790
-
2791
2255
  # def child_nodes: () -> Array[nil | Node]
2792
2256
  def child_nodes
2793
2257
  [value]
@@ -2839,7 +2303,6 @@ module YARP
2839
2303
  visitor.visit_hash_node(self)
2840
2304
  end
2841
2305
 
2842
-
2843
2306
  # def child_nodes: () -> Array[nil | Node]
2844
2307
  def child_nodes
2845
2308
  [*elements]
@@ -2902,7 +2365,6 @@ module YARP
2902
2365
  visitor.visit_hash_pattern_node(self)
2903
2366
  end
2904
2367
 
2905
-
2906
2368
  # def child_nodes: () -> Array[nil | Node]
2907
2369
  def child_nodes
2908
2370
  [constant, *assocs, kwrest]
@@ -2993,179 +2455,28 @@ module YARP
2993
2455
  end
2994
2456
  end
2995
2457
 
2996
- # Represents an imaginary number literal.
2997
- #
2998
- # 1.0i
2999
- # ^^^^
3000
- class ImaginaryNode < Node
3001
- # attr_reader numeric: Node
3002
- attr_reader :numeric
3003
-
3004
- # def initialize: (numeric: Node, location: Location) -> void
3005
- def initialize(numeric, location)
3006
- @numeric = numeric
3007
- @location = location
3008
- end
3009
-
3010
- # def accept: (visitor: Visitor) -> void
3011
- def accept(visitor)
3012
- visitor.visit_imaginary_node(self)
3013
- end
3014
-
3015
-
3016
- # def child_nodes: () -> Array[nil | Node]
3017
- def child_nodes
3018
- [numeric]
3019
- end
3020
-
3021
- # def deconstruct: () -> Array[nil | Node]
3022
- alias deconstruct child_nodes
3023
-
3024
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3025
- def deconstruct_keys(keys)
3026
- { numeric: numeric, location: location }
3027
- end
3028
- end
3029
-
3030
- # Represents the use of the `in` keyword in a case statement.
3031
- #
3032
- # case a; in b then c end
3033
- # ^^^^^^^^^^^
3034
- class InNode < Node
3035
- # attr_reader pattern: Node
3036
- attr_reader :pattern
3037
-
3038
- # attr_reader statements: Node?
3039
- attr_reader :statements
3040
-
3041
- # attr_reader in_loc: Location
3042
- attr_reader :in_loc
3043
-
3044
- # attr_reader then_loc: Location?
3045
- attr_reader :then_loc
3046
-
3047
- # def initialize: (pattern: Node, statements: Node?, in_loc: Location, then_loc: Location?, location: Location) -> void
3048
- def initialize(pattern, statements, in_loc, then_loc, location)
3049
- @pattern = pattern
3050
- @statements = statements
3051
- @in_loc = in_loc
3052
- @then_loc = then_loc
3053
- @location = location
3054
- end
3055
-
3056
- # def accept: (visitor: Visitor) -> void
3057
- def accept(visitor)
3058
- visitor.visit_in_node(self)
3059
- end
3060
-
3061
-
3062
- # def child_nodes: () -> Array[nil | Node]
3063
- def child_nodes
3064
- [pattern, statements]
3065
- end
3066
-
3067
- # def deconstruct: () -> Array[nil | Node]
3068
- alias deconstruct child_nodes
3069
-
3070
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3071
- def deconstruct_keys(keys)
3072
- { pattern: pattern, statements: statements, in_loc: in_loc, then_loc: then_loc, location: location }
3073
- end
3074
-
3075
- # def in: () -> String
3076
- def in
3077
- in_loc.slice
3078
- end
3079
-
3080
- # def then: () -> String?
3081
- def then
3082
- then_loc&.slice
3083
- end
3084
- end
3085
-
3086
- # Represents the use of the `&&=` operator for assignment to an instance variable.
3087
- #
3088
- # @target &&= value
3089
- # ^^^^^^^^^^^^^^^^^
3090
- class InstanceVariableOperatorAndWriteNode < Node
3091
- # attr_reader name_loc: Location
3092
- attr_reader :name_loc
3093
-
3094
- # attr_reader operator_loc: Location
3095
- attr_reader :operator_loc
3096
-
3097
- # attr_reader value: Node
3098
- attr_reader :value
3099
-
3100
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
3101
- def initialize(name_loc, operator_loc, value, location)
3102
- @name_loc = name_loc
3103
- @operator_loc = operator_loc
3104
- @value = value
3105
- @location = location
3106
- end
3107
-
3108
- # def accept: (visitor: Visitor) -> void
3109
- def accept(visitor)
3110
- visitor.visit_instance_variable_operator_and_write_node(self)
3111
- end
3112
-
3113
-
3114
- # def child_nodes: () -> Array[nil | Node]
3115
- def child_nodes
3116
- [value]
3117
- end
3118
-
3119
- # def deconstruct: () -> Array[nil | Node]
3120
- alias deconstruct child_nodes
3121
-
3122
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3123
- def deconstruct_keys(keys)
3124
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
3125
- end
3126
-
3127
- # def name: () -> String
3128
- def name
3129
- name_loc.slice
3130
- end
3131
-
3132
- # def operator: () -> String
3133
- def operator
3134
- operator_loc.slice
3135
- end
3136
- end
3137
-
3138
- # Represents the use of the `||=` operator for assignment to an instance variable.
3139
- #
3140
- # @target ||= value
3141
- # ^^^^^^^^^^^^^^^^^
3142
- class InstanceVariableOperatorOrWriteNode < Node
3143
- # attr_reader name_loc: Location
3144
- attr_reader :name_loc
3145
-
3146
- # attr_reader operator_loc: Location
3147
- attr_reader :operator_loc
3148
-
3149
- # attr_reader value: Node
3150
- attr_reader :value
2458
+ # Represents an imaginary number literal.
2459
+ #
2460
+ # 1.0i
2461
+ # ^^^^
2462
+ class ImaginaryNode < Node
2463
+ # attr_reader numeric: Node
2464
+ attr_reader :numeric
3151
2465
 
3152
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
3153
- def initialize(name_loc, operator_loc, value, location)
3154
- @name_loc = name_loc
3155
- @operator_loc = operator_loc
3156
- @value = value
2466
+ # def initialize: (numeric: Node, location: Location) -> void
2467
+ def initialize(numeric, location)
2468
+ @numeric = numeric
3157
2469
  @location = location
3158
2470
  end
3159
2471
 
3160
2472
  # def accept: (visitor: Visitor) -> void
3161
2473
  def accept(visitor)
3162
- visitor.visit_instance_variable_operator_or_write_node(self)
2474
+ visitor.visit_imaginary_node(self)
3163
2475
  end
3164
2476
 
3165
-
3166
2477
  # def child_nodes: () -> Array[nil | Node]
3167
2478
  def child_nodes
3168
- [value]
2479
+ [numeric]
3169
2480
  end
3170
2481
 
3171
2482
  # def deconstruct: () -> Array[nil | Node]
@@ -3173,55 +2484,44 @@ module YARP
3173
2484
 
3174
2485
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3175
2486
  def deconstruct_keys(keys)
3176
- { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location }
3177
- end
3178
-
3179
- # def name: () -> String
3180
- def name
3181
- name_loc.slice
3182
- end
3183
-
3184
- # def operator: () -> String
3185
- def operator
3186
- operator_loc.slice
2487
+ { numeric: numeric, location: location }
3187
2488
  end
3188
2489
  end
3189
2490
 
3190
- # Represents assigning to an instance variable using an operator that isn't `=`.
2491
+ # Represents the use of the `in` keyword in a case statement.
3191
2492
  #
3192
- # @target += value
3193
- # ^^^^^^^^^^^^^^^^
3194
- class InstanceVariableOperatorWriteNode < Node
3195
- # attr_reader name_loc: Location
3196
- attr_reader :name_loc
2493
+ # case a; in b then c end
2494
+ # ^^^^^^^^^^^
2495
+ class InNode < Node
2496
+ # attr_reader pattern: Node
2497
+ attr_reader :pattern
3197
2498
 
3198
- # attr_reader operator_loc: Location
3199
- attr_reader :operator_loc
2499
+ # attr_reader statements: Node?
2500
+ attr_reader :statements
3200
2501
 
3201
- # attr_reader value: Node
3202
- attr_reader :value
2502
+ # attr_reader in_loc: Location
2503
+ attr_reader :in_loc
3203
2504
 
3204
- # attr_reader operator: Symbol
3205
- attr_reader :operator
2505
+ # attr_reader then_loc: Location?
2506
+ attr_reader :then_loc
3206
2507
 
3207
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, operator: Symbol, location: Location) -> void
3208
- def initialize(name_loc, operator_loc, value, operator, location)
3209
- @name_loc = name_loc
3210
- @operator_loc = operator_loc
3211
- @value = value
3212
- @operator = operator
2508
+ # def initialize: (pattern: Node, statements: Node?, in_loc: Location, then_loc: Location?, location: Location) -> void
2509
+ def initialize(pattern, statements, in_loc, then_loc, location)
2510
+ @pattern = pattern
2511
+ @statements = statements
2512
+ @in_loc = in_loc
2513
+ @then_loc = then_loc
3213
2514
  @location = location
3214
2515
  end
3215
2516
 
3216
2517
  # def accept: (visitor: Visitor) -> void
3217
2518
  def accept(visitor)
3218
- visitor.visit_instance_variable_operator_write_node(self)
2519
+ visitor.visit_in_node(self)
3219
2520
  end
3220
2521
 
3221
-
3222
2522
  # def child_nodes: () -> Array[nil | Node]
3223
2523
  def child_nodes
3224
- [value]
2524
+ [pattern, statements]
3225
2525
  end
3226
2526
 
3227
2527
  # def deconstruct: () -> Array[nil | Node]
@@ -3229,12 +2529,17 @@ module YARP
3229
2529
 
3230
2530
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3231
2531
  def deconstruct_keys(keys)
3232
- { name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
2532
+ { pattern: pattern, statements: statements, in_loc: in_loc, then_loc: then_loc, location: location }
3233
2533
  end
3234
2534
 
3235
- # def name: () -> String
3236
- def name
3237
- name_loc.slice
2535
+ # def in: () -> String
2536
+ def in
2537
+ in_loc.slice
2538
+ end
2539
+
2540
+ # def then: () -> String?
2541
+ def then
2542
+ then_loc&.slice
3238
2543
  end
3239
2544
  end
3240
2545
 
@@ -3253,7 +2558,6 @@ module YARP
3253
2558
  visitor.visit_instance_variable_read_node(self)
3254
2559
  end
3255
2560
 
3256
-
3257
2561
  # def child_nodes: () -> Array[nil | Node]
3258
2562
  def child_nodes
3259
2563
  []
@@ -3295,7 +2599,6 @@ module YARP
3295
2599
  visitor.visit_instance_variable_write_node(self)
3296
2600
  end
3297
2601
 
3298
-
3299
2602
  # def child_nodes: () -> Array[nil | Node]
3300
2603
  def child_nodes
3301
2604
  [value]
@@ -3335,7 +2638,6 @@ module YARP
3335
2638
  visitor.visit_integer_node(self)
3336
2639
  end
3337
2640
 
3338
-
3339
2641
  # def child_nodes: () -> Array[nil | Node]
3340
2642
  def child_nodes
3341
2643
  []
@@ -3408,6 +2710,46 @@ module YARP
3408
2710
  def closing
3409
2711
  closing_loc.slice
3410
2712
  end
2713
+
2714
+ # def ignore_case?: () -> bool
2715
+ def ignore_case?
2716
+ flags.anybits?(RegularExpressionFlags::IGNORE_CASE)
2717
+ end
2718
+
2719
+ # def multi_line?: () -> bool
2720
+ def multi_line?
2721
+ flags.anybits?(RegularExpressionFlags::MULTI_LINE)
2722
+ end
2723
+
2724
+ # def extended?: () -> bool
2725
+ def extended?
2726
+ flags.anybits?(RegularExpressionFlags::EXTENDED)
2727
+ end
2728
+
2729
+ # def euc_jp?: () -> bool
2730
+ def euc_jp?
2731
+ flags.anybits?(RegularExpressionFlags::EUC_JP)
2732
+ end
2733
+
2734
+ # def ascii_8bit?: () -> bool
2735
+ def ascii_8bit?
2736
+ flags.anybits?(RegularExpressionFlags::ASCII_8BIT)
2737
+ end
2738
+
2739
+ # def windows_31j?: () -> bool
2740
+ def windows_31j?
2741
+ flags.anybits?(RegularExpressionFlags::WINDOWS_31J)
2742
+ end
2743
+
2744
+ # def utf_8?: () -> bool
2745
+ def utf_8?
2746
+ flags.anybits?(RegularExpressionFlags::UTF_8)
2747
+ end
2748
+
2749
+ # def once?: () -> bool
2750
+ def once?
2751
+ flags.anybits?(RegularExpressionFlags::ONCE)
2752
+ end
3411
2753
  end
3412
2754
 
3413
2755
  # Represents a string literal that contains interpolation.
@@ -3597,7 +2939,6 @@ module YARP
3597
2939
  visitor.visit_keyword_hash_node(self)
3598
2940
  end
3599
2941
 
3600
-
3601
2942
  # def child_nodes: () -> Array[nil | Node]
3602
2943
  def child_nodes
3603
2944
  [*elements]
@@ -3640,7 +2981,6 @@ module YARP
3640
2981
  visitor.visit_keyword_parameter_node(self)
3641
2982
  end
3642
2983
 
3643
-
3644
2984
  # def child_nodes: () -> Array[nil | Node]
3645
2985
  def child_nodes
3646
2986
  [value]
@@ -3684,7 +3024,6 @@ module YARP
3684
3024
  visitor.visit_keyword_rest_parameter_node(self)
3685
3025
  end
3686
3026
 
3687
-
3688
3027
  # def child_nodes: () -> Array[nil | Node]
3689
3028
  def child_nodes
3690
3029
  []
@@ -3723,194 +3062,26 @@ module YARP
3723
3062
  # attr_reader parameters: Node?
3724
3063
  attr_reader :parameters
3725
3064
 
3726
- # attr_reader statements: Node?
3727
- attr_reader :statements
3728
-
3729
- # def initialize: (locals: Array[Symbol], opening_loc: Location, parameters: Node?, statements: Node?, location: Location) -> void
3730
- def initialize(locals, opening_loc, parameters, statements, location)
3731
- @locals = locals
3732
- @opening_loc = opening_loc
3733
- @parameters = parameters
3734
- @statements = statements
3735
- @location = location
3736
- end
3737
-
3738
- # def accept: (visitor: Visitor) -> void
3739
- def accept(visitor)
3740
- visitor.visit_lambda_node(self)
3741
- end
3742
-
3743
-
3744
- # def child_nodes: () -> Array[nil | Node]
3745
- def child_nodes
3746
- [parameters, statements]
3747
- end
3748
-
3749
- # def deconstruct: () -> Array[nil | Node]
3750
- alias deconstruct child_nodes
3751
-
3752
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3753
- def deconstruct_keys(keys)
3754
- { locals: locals, opening_loc: opening_loc, parameters: parameters, statements: statements, location: location }
3755
- end
3756
-
3757
- # def opening: () -> String
3758
- def opening
3759
- opening_loc.slice
3760
- end
3761
- end
3762
-
3763
- # Represents the use of the `&&=` operator for assignment to a local variable.
3764
- #
3765
- # target &&= value
3766
- # ^^^^^^^^^^^^^^^^
3767
- class LocalVariableOperatorAndWriteNode < Node
3768
- # attr_reader name_loc: Location
3769
- attr_reader :name_loc
3770
-
3771
- # attr_reader operator_loc: Location
3772
- attr_reader :operator_loc
3773
-
3774
- # attr_reader value: Node
3775
- attr_reader :value
3776
-
3777
- # attr_reader constant_id: Symbol
3778
- attr_reader :constant_id
3779
-
3780
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, location: Location) -> void
3781
- def initialize(name_loc, operator_loc, value, constant_id, location)
3782
- @name_loc = name_loc
3783
- @operator_loc = operator_loc
3784
- @value = value
3785
- @constant_id = constant_id
3786
- @location = location
3787
- end
3788
-
3789
- # def accept: (visitor: Visitor) -> void
3790
- def accept(visitor)
3791
- visitor.visit_local_variable_operator_and_write_node(self)
3792
- end
3793
-
3794
-
3795
- # def child_nodes: () -> Array[nil | Node]
3796
- def child_nodes
3797
- [value]
3798
- end
3799
-
3800
- # def deconstruct: () -> Array[nil | Node]
3801
- alias deconstruct child_nodes
3802
-
3803
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3804
- def deconstruct_keys(keys)
3805
- { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location }
3806
- end
3807
-
3808
- # def name: () -> String
3809
- def name
3810
- name_loc.slice
3811
- end
3812
-
3813
- # def operator: () -> String
3814
- def operator
3815
- operator_loc.slice
3816
- end
3817
- end
3818
-
3819
- # Represents the use of the `||=` operator for assignment to a local variable.
3820
- #
3821
- # target ||= value
3822
- # ^^^^^^^^^^^^^^^^
3823
- class LocalVariableOperatorOrWriteNode < Node
3824
- # attr_reader name_loc: Location
3825
- attr_reader :name_loc
3826
-
3827
- # attr_reader operator_loc: Location
3828
- attr_reader :operator_loc
3829
-
3830
- # attr_reader value: Node
3831
- attr_reader :value
3832
-
3833
- # attr_reader constant_id: Symbol
3834
- attr_reader :constant_id
3835
-
3836
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, location: Location) -> void
3837
- def initialize(name_loc, operator_loc, value, constant_id, location)
3838
- @name_loc = name_loc
3839
- @operator_loc = operator_loc
3840
- @value = value
3841
- @constant_id = constant_id
3842
- @location = location
3843
- end
3844
-
3845
- # def accept: (visitor: Visitor) -> void
3846
- def accept(visitor)
3847
- visitor.visit_local_variable_operator_or_write_node(self)
3848
- end
3849
-
3850
-
3851
- # def child_nodes: () -> Array[nil | Node]
3852
- def child_nodes
3853
- [value]
3854
- end
3855
-
3856
- # def deconstruct: () -> Array[nil | Node]
3857
- alias deconstruct child_nodes
3858
-
3859
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3860
- def deconstruct_keys(keys)
3861
- { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location }
3862
- end
3863
-
3864
- # def name: () -> String
3865
- def name
3866
- name_loc.slice
3867
- end
3868
-
3869
- # def operator: () -> String
3870
- def operator
3871
- operator_loc.slice
3872
- end
3873
- end
3874
-
3875
- # Represents assigning to a local variable using an operator that isn't `=`.
3876
- #
3877
- # target += value
3878
- # ^^^^^^^^^^^^^^^
3879
- class LocalVariableOperatorWriteNode < Node
3880
- # attr_reader name_loc: Location
3881
- attr_reader :name_loc
3882
-
3883
- # attr_reader operator_loc: Location
3884
- attr_reader :operator_loc
3885
-
3886
- # attr_reader value: Node
3887
- attr_reader :value
3888
-
3889
- # attr_reader constant_id: Symbol
3890
- attr_reader :constant_id
3891
-
3892
- # attr_reader operator_id: Symbol
3893
- attr_reader :operator_id
3894
-
3895
- # def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, operator_id: Symbol, location: Location) -> void
3896
- def initialize(name_loc, operator_loc, value, constant_id, operator_id, location)
3897
- @name_loc = name_loc
3898
- @operator_loc = operator_loc
3899
- @value = value
3900
- @constant_id = constant_id
3901
- @operator_id = operator_id
3065
+ # attr_reader body: Node?
3066
+ attr_reader :body
3067
+
3068
+ # def initialize: (locals: Array[Symbol], opening_loc: Location, parameters: Node?, body: Node?, location: Location) -> void
3069
+ def initialize(locals, opening_loc, parameters, body, location)
3070
+ @locals = locals
3071
+ @opening_loc = opening_loc
3072
+ @parameters = parameters
3073
+ @body = body
3902
3074
  @location = location
3903
3075
  end
3904
3076
 
3905
3077
  # def accept: (visitor: Visitor) -> void
3906
3078
  def accept(visitor)
3907
- visitor.visit_local_variable_operator_write_node(self)
3079
+ visitor.visit_lambda_node(self)
3908
3080
  end
3909
3081
 
3910
-
3911
3082
  # def child_nodes: () -> Array[nil | Node]
3912
3083
  def child_nodes
3913
- [value]
3084
+ [parameters, body]
3914
3085
  end
3915
3086
 
3916
3087
  # def deconstruct: () -> Array[nil | Node]
@@ -3918,17 +3089,12 @@ module YARP
3918
3089
 
3919
3090
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3920
3091
  def deconstruct_keys(keys)
3921
- { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, operator_id: operator_id, location: location }
3092
+ { locals: locals, opening_loc: opening_loc, parameters: parameters, body: body, location: location }
3922
3093
  end
3923
3094
 
3924
- # def name: () -> String
3925
- def name
3926
- name_loc.slice
3927
- end
3928
-
3929
- # def operator: () -> String
3930
- def operator
3931
- operator_loc.slice
3095
+ # def opening: () -> String
3096
+ def opening
3097
+ opening_loc.slice
3932
3098
  end
3933
3099
  end
3934
3100
 
@@ -3957,7 +3123,6 @@ module YARP
3957
3123
  visitor.visit_local_variable_read_node(self)
3958
3124
  end
3959
3125
 
3960
-
3961
3126
  # def child_nodes: () -> Array[nil | Node]
3962
3127
  def child_nodes
3963
3128
  []
@@ -4007,7 +3172,6 @@ module YARP
4007
3172
  visitor.visit_local_variable_write_node(self)
4008
3173
  end
4009
3174
 
4010
-
4011
3175
  # def child_nodes: () -> Array[nil | Node]
4012
3176
  def child_nodes
4013
3177
  [value]
@@ -4059,7 +3223,6 @@ module YARP
4059
3223
  visitor.visit_match_predicate_node(self)
4060
3224
  end
4061
3225
 
4062
-
4063
3226
  # def child_nodes: () -> Array[nil | Node]
4064
3227
  def child_nodes
4065
3228
  [value, pattern]
@@ -4106,7 +3269,6 @@ module YARP
4106
3269
  visitor.visit_match_required_node(self)
4107
3270
  end
4108
3271
 
4109
-
4110
3272
  # def child_nodes: () -> Array[nil | Node]
4111
3273
  def child_nodes
4112
3274
  [value, pattern]
@@ -4139,7 +3301,6 @@ module YARP
4139
3301
  visitor.visit_missing_node(self)
4140
3302
  end
4141
3303
 
4142
-
4143
3304
  # def child_nodes: () -> Array[nil | Node]
4144
3305
  def child_nodes
4145
3306
  []
@@ -4168,18 +3329,18 @@ module YARP
4168
3329
  # attr_reader constant_path: Node
4169
3330
  attr_reader :constant_path
4170
3331
 
4171
- # attr_reader statements: Node?
4172
- attr_reader :statements
3332
+ # attr_reader body: Node?
3333
+ attr_reader :body
4173
3334
 
4174
3335
  # attr_reader end_keyword_loc: Location
4175
3336
  attr_reader :end_keyword_loc
4176
3337
 
4177
- # def initialize: (locals: Array[Symbol], module_keyword_loc: Location, constant_path: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void
4178
- def initialize(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location)
3338
+ # def initialize: (locals: Array[Symbol], module_keyword_loc: Location, constant_path: Node, body: Node?, end_keyword_loc: Location, location: Location) -> void
3339
+ def initialize(locals, module_keyword_loc, constant_path, body, end_keyword_loc, location)
4179
3340
  @locals = locals
4180
3341
  @module_keyword_loc = module_keyword_loc
4181
3342
  @constant_path = constant_path
4182
- @statements = statements
3343
+ @body = body
4183
3344
  @end_keyword_loc = end_keyword_loc
4184
3345
  @location = location
4185
3346
  end
@@ -4189,10 +3350,9 @@ module YARP
4189
3350
  visitor.visit_module_node(self)
4190
3351
  end
4191
3352
 
4192
-
4193
3353
  # def child_nodes: () -> Array[nil | Node]
4194
3354
  def child_nodes
4195
- [constant_path, statements]
3355
+ [constant_path, body]
4196
3356
  end
4197
3357
 
4198
3358
  # def deconstruct: () -> Array[nil | Node]
@@ -4200,7 +3360,7 @@ module YARP
4200
3360
 
4201
3361
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
4202
3362
  def deconstruct_keys(keys)
4203
- { locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path, statements: statements, end_keyword_loc: end_keyword_loc, location: location }
3363
+ { locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path, body: body, end_keyword_loc: end_keyword_loc, location: location }
4204
3364
  end
4205
3365
 
4206
3366
  # def module_keyword: () -> String
@@ -4249,7 +3409,6 @@ module YARP
4249
3409
  visitor.visit_multi_write_node(self)
4250
3410
  end
4251
3411
 
4252
-
4253
3412
  # def child_nodes: () -> Array[nil | Node]
4254
3413
  def child_nodes
4255
3414
  [*targets, value]
@@ -4302,7 +3461,6 @@ module YARP
4302
3461
  visitor.visit_next_node(self)
4303
3462
  end
4304
3463
 
4305
-
4306
3464
  # def child_nodes: () -> Array[nil | Node]
4307
3465
  def child_nodes
4308
3466
  [arguments]
@@ -4337,7 +3495,6 @@ module YARP
4337
3495
  visitor.visit_nil_node(self)
4338
3496
  end
4339
3497
 
4340
-
4341
3498
  # def child_nodes: () -> Array[nil | Node]
4342
3499
  def child_nodes
4343
3500
  []
@@ -4376,7 +3533,6 @@ module YARP
4376
3533
  visitor.visit_no_keywords_parameter_node(self)
4377
3534
  end
4378
3535
 
4379
-
4380
3536
  # def child_nodes: () -> Array[nil | Node]
4381
3537
  def child_nodes
4382
3538
  []
@@ -4416,7 +3572,6 @@ module YARP
4416
3572
  visitor.visit_numbered_reference_read_node(self)
4417
3573
  end
4418
3574
 
4419
-
4420
3575
  # def child_nodes: () -> Array[nil | Node]
4421
3576
  def child_nodes
4422
3577
  []
@@ -4431,6 +3586,51 @@ module YARP
4431
3586
  end
4432
3587
  end
4433
3588
 
3589
+ # Represents the use of an operator on a write.
3590
+ #
3591
+ # target += value
3592
+ # ^^^^^^^^^^^^^^^
3593
+ class OperatorWriteNode < Node
3594
+ # attr_reader target: Node
3595
+ attr_reader :target
3596
+
3597
+ # attr_reader operator_loc: Location
3598
+ attr_reader :operator_loc
3599
+
3600
+ # attr_reader operator: Symbol
3601
+ attr_reader :operator
3602
+
3603
+ # attr_reader value: Node
3604
+ attr_reader :value
3605
+
3606
+ # def initialize: (target: Node, operator_loc: Location, operator: Symbol, value: Node, location: Location) -> void
3607
+ def initialize(target, operator_loc, operator, value, location)
3608
+ @target = target
3609
+ @operator_loc = operator_loc
3610
+ @operator = operator
3611
+ @value = value
3612
+ @location = location
3613
+ end
3614
+
3615
+ # def accept: (visitor: Visitor) -> void
3616
+ def accept(visitor)
3617
+ visitor.visit_operator_write_node(self)
3618
+ end
3619
+
3620
+ # def child_nodes: () -> Array[nil | Node]
3621
+ def child_nodes
3622
+ [target, value]
3623
+ end
3624
+
3625
+ # def deconstruct: () -> Array[nil | Node]
3626
+ alias deconstruct child_nodes
3627
+
3628
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3629
+ def deconstruct_keys(keys)
3630
+ { target: target, operator_loc: operator_loc, operator: operator, value: value, location: location }
3631
+ end
3632
+ end
3633
+
4434
3634
  # Represents an optional parameter to a method, block, or lambda definition.
4435
3635
  #
4436
3636
  # def a(b = 1)
@@ -4463,7 +3663,6 @@ module YARP
4463
3663
  visitor.visit_optional_parameter_node(self)
4464
3664
  end
4465
3665
 
4466
-
4467
3666
  # def child_nodes: () -> Array[nil | Node]
4468
3667
  def child_nodes
4469
3668
  [value]
@@ -4515,7 +3714,6 @@ module YARP
4515
3714
  visitor.visit_or_node(self)
4516
3715
  end
4517
3716
 
4518
-
4519
3717
  # def child_nodes: () -> Array[nil | Node]
4520
3718
  def child_nodes
4521
3719
  [left, right]
@@ -4535,6 +3733,52 @@ module YARP
4535
3733
  end
4536
3734
  end
4537
3735
 
3736
+ # Represents the use of the `||=` operator.
3737
+ #
3738
+ # target ||= value
3739
+ # ^^^^^^^^^^^^^^^^
3740
+ class OrWriteNode < Node
3741
+ # attr_reader target: Node
3742
+ attr_reader :target
3743
+
3744
+ # attr_reader value: Node
3745
+ attr_reader :value
3746
+
3747
+ # attr_reader operator_loc: Location
3748
+ attr_reader :operator_loc
3749
+
3750
+ # def initialize: (target: Node, value: Node, operator_loc: Location, location: Location) -> void
3751
+ def initialize(target, value, operator_loc, location)
3752
+ @target = target
3753
+ @value = value
3754
+ @operator_loc = operator_loc
3755
+ @location = location
3756
+ end
3757
+
3758
+ # def accept: (visitor: Visitor) -> void
3759
+ def accept(visitor)
3760
+ visitor.visit_or_write_node(self)
3761
+ end
3762
+
3763
+ # def child_nodes: () -> Array[nil | Node]
3764
+ def child_nodes
3765
+ [target, value]
3766
+ end
3767
+
3768
+ # def deconstruct: () -> Array[nil | Node]
3769
+ alias deconstruct child_nodes
3770
+
3771
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
3772
+ def deconstruct_keys(keys)
3773
+ { target: target, value: value, operator_loc: operator_loc, location: location }
3774
+ end
3775
+
3776
+ # def operator: () -> String
3777
+ def operator
3778
+ operator_loc.slice
3779
+ end
3780
+ end
3781
+
4538
3782
  # Represents the list of parameters on a method, block, or lambda definition.
4539
3783
  #
4540
3784
  # def a(b, c, d)
@@ -4579,7 +3823,6 @@ module YARP
4579
3823
  visitor.visit_parameters_node(self)
4580
3824
  end
4581
3825
 
4582
-
4583
3826
  # def child_nodes: () -> Array[nil | Node]
4584
3827
  def child_nodes
4585
3828
  [*requireds, *optionals, *posts, rest, *keywords, keyword_rest, block]
@@ -4599,8 +3842,8 @@ module YARP
4599
3842
  # (10 + 34)
4600
3843
  # ^^^^^^^^^
4601
3844
  class ParenthesesNode < Node
4602
- # attr_reader statements: Node?
4603
- attr_reader :statements
3845
+ # attr_reader body: Node?
3846
+ attr_reader :body
4604
3847
 
4605
3848
  # attr_reader opening_loc: Location
4606
3849
  attr_reader :opening_loc
@@ -4608,9 +3851,9 @@ module YARP
4608
3851
  # attr_reader closing_loc: Location
4609
3852
  attr_reader :closing_loc
4610
3853
 
4611
- # def initialize: (statements: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
4612
- def initialize(statements, opening_loc, closing_loc, location)
4613
- @statements = statements
3854
+ # def initialize: (body: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
3855
+ def initialize(body, opening_loc, closing_loc, location)
3856
+ @body = body
4614
3857
  @opening_loc = opening_loc
4615
3858
  @closing_loc = closing_loc
4616
3859
  @location = location
@@ -4627,7 +3870,7 @@ module YARP
4627
3870
 
4628
3871
  # def child_nodes: () -> Array[nil | Node]
4629
3872
  def child_nodes
4630
- [statements]
3873
+ [body]
4631
3874
  end
4632
3875
 
4633
3876
  # def deconstruct: () -> Array[nil | Node]
@@ -4635,7 +3878,7 @@ module YARP
4635
3878
 
4636
3879
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
4637
3880
  def deconstruct_keys(keys)
4638
- { statements: statements, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
3881
+ { body: body, opening_loc: opening_loc, closing_loc: closing_loc, location: location }
4639
3882
  end
4640
3883
 
4641
3884
  # def opening: () -> String
@@ -4681,7 +3924,6 @@ module YARP
4681
3924
  visitor.visit_pinned_expression_node(self)
4682
3925
  end
4683
3926
 
4684
-
4685
3927
  # def child_nodes: () -> Array[nil | Node]
4686
3928
  def child_nodes
4687
3929
  [expression]
@@ -4735,7 +3977,6 @@ module YARP
4735
3977
  visitor.visit_pinned_variable_node(self)
4736
3978
  end
4737
3979
 
4738
-
4739
3980
  # def child_nodes: () -> Array[nil | Node]
4740
3981
  def child_nodes
4741
3982
  [variable]
@@ -4786,7 +4027,6 @@ module YARP
4786
4027
  visitor.visit_post_execution_node(self)
4787
4028
  end
4788
4029
 
4789
-
4790
4030
  # def child_nodes: () -> Array[nil | Node]
4791
4031
  def child_nodes
4792
4032
  [statements]
@@ -4847,7 +4087,6 @@ module YARP
4847
4087
  visitor.visit_pre_execution_node(self)
4848
4088
  end
4849
4089
 
4850
-
4851
4090
  # def child_nodes: () -> Array[nil | Node]
4852
4091
  def child_nodes
4853
4092
  [statements]
@@ -4897,7 +4136,6 @@ module YARP
4897
4136
  visitor.visit_program_node(self)
4898
4137
  end
4899
4138
 
4900
-
4901
4139
  # def child_nodes: () -> Array[nil | Node]
4902
4140
  def child_nodes
4903
4141
  [statements]
@@ -4946,7 +4184,6 @@ module YARP
4946
4184
  visitor.visit_range_node(self)
4947
4185
  end
4948
4186
 
4949
-
4950
4187
  # def child_nodes: () -> Array[nil | Node]
4951
4188
  def child_nodes
4952
4189
  [left, right]
@@ -4964,6 +4201,11 @@ module YARP
4964
4201
  def operator
4965
4202
  operator_loc.slice
4966
4203
  end
4204
+
4205
+ # def exclude_end?: () -> bool
4206
+ def exclude_end?
4207
+ flags.anybits?(RangeFlags::EXCLUDE_END)
4208
+ end
4967
4209
  end
4968
4210
 
4969
4211
  # Represents a rational number literal.
@@ -4985,7 +4227,6 @@ module YARP
4985
4227
  visitor.visit_rational_node(self)
4986
4228
  end
4987
4229
 
4988
-
4989
4230
  # def child_nodes: () -> Array[nil | Node]
4990
4231
  def child_nodes
4991
4232
  [numeric]
@@ -5015,7 +4256,6 @@ module YARP
5015
4256
  visitor.visit_redo_node(self)
5016
4257
  end
5017
4258
 
5018
-
5019
4259
  # def child_nodes: () -> Array[nil | Node]
5020
4260
  def child_nodes
5021
4261
  []
@@ -5065,7 +4305,6 @@ module YARP
5065
4305
  visitor.visit_regular_expression_node(self)
5066
4306
  end
5067
4307
 
5068
-
5069
4308
  # def child_nodes: () -> Array[nil | Node]
5070
4309
  def child_nodes
5071
4310
  []
@@ -5093,6 +4332,46 @@ module YARP
5093
4332
  def closing
5094
4333
  closing_loc.slice
5095
4334
  end
4335
+
4336
+ # def ignore_case?: () -> bool
4337
+ def ignore_case?
4338
+ flags.anybits?(RegularExpressionFlags::IGNORE_CASE)
4339
+ end
4340
+
4341
+ # def multi_line?: () -> bool
4342
+ def multi_line?
4343
+ flags.anybits?(RegularExpressionFlags::MULTI_LINE)
4344
+ end
4345
+
4346
+ # def extended?: () -> bool
4347
+ def extended?
4348
+ flags.anybits?(RegularExpressionFlags::EXTENDED)
4349
+ end
4350
+
4351
+ # def euc_jp?: () -> bool
4352
+ def euc_jp?
4353
+ flags.anybits?(RegularExpressionFlags::EUC_JP)
4354
+ end
4355
+
4356
+ # def ascii_8bit?: () -> bool
4357
+ def ascii_8bit?
4358
+ flags.anybits?(RegularExpressionFlags::ASCII_8BIT)
4359
+ end
4360
+
4361
+ # def windows_31j?: () -> bool
4362
+ def windows_31j?
4363
+ flags.anybits?(RegularExpressionFlags::WINDOWS_31J)
4364
+ end
4365
+
4366
+ # def utf_8?: () -> bool
4367
+ def utf_8?
4368
+ flags.anybits?(RegularExpressionFlags::UTF_8)
4369
+ end
4370
+
4371
+ # def once?: () -> bool
4372
+ def once?
4373
+ flags.anybits?(RegularExpressionFlags::ONCE)
4374
+ end
5096
4375
  end
5097
4376
 
5098
4377
  # Represents a destructured required parameter node.
@@ -5123,7 +4402,6 @@ module YARP
5123
4402
  visitor.visit_required_destructured_parameter_node(self)
5124
4403
  end
5125
4404
 
5126
-
5127
4405
  # def child_nodes: () -> Array[nil | Node]
5128
4406
  def child_nodes
5129
4407
  [*parameters]
@@ -5168,7 +4446,6 @@ module YARP
5168
4446
  visitor.visit_required_parameter_node(self)
5169
4447
  end
5170
4448
 
5171
-
5172
4449
  # def child_nodes: () -> Array[nil | Node]
5173
4450
  def child_nodes
5174
4451
  []
@@ -5278,7 +4555,6 @@ module YARP
5278
4555
  visitor.visit_rescue_node(self)
5279
4556
  end
5280
4557
 
5281
-
5282
4558
  # def child_nodes: () -> Array[nil | Node]
5283
4559
  def child_nodes
5284
4560
  [*exceptions, reference, statements, consequent]
@@ -5327,7 +4603,6 @@ module YARP
5327
4603
  visitor.visit_rest_parameter_node(self)
5328
4604
  end
5329
4605
 
5330
-
5331
4606
  # def child_nodes: () -> Array[nil | Node]
5332
4607
  def child_nodes
5333
4608
  []
@@ -5367,7 +4642,6 @@ module YARP
5367
4642
  visitor.visit_retry_node(self)
5368
4643
  end
5369
4644
 
5370
-
5371
4645
  # def child_nodes: () -> Array[nil | Node]
5372
4646
  def child_nodes
5373
4647
  []
@@ -5405,7 +4679,6 @@ module YARP
5405
4679
  visitor.visit_return_node(self)
5406
4680
  end
5407
4681
 
5408
-
5409
4682
  # def child_nodes: () -> Array[nil | Node]
5410
4683
  def child_nodes
5411
4684
  [arguments]
@@ -5440,7 +4713,6 @@ module YARP
5440
4713
  visitor.visit_self_node(self)
5441
4714
  end
5442
4715
 
5443
-
5444
4716
  # def child_nodes: () -> Array[nil | Node]
5445
4717
  def child_nodes
5446
4718
  []
@@ -5472,19 +4744,19 @@ module YARP
5472
4744
  # attr_reader expression: Node
5473
4745
  attr_reader :expression
5474
4746
 
5475
- # attr_reader statements: Node?
5476
- attr_reader :statements
4747
+ # attr_reader body: Node?
4748
+ attr_reader :body
5477
4749
 
5478
4750
  # attr_reader end_keyword_loc: Location
5479
4751
  attr_reader :end_keyword_loc
5480
4752
 
5481
- # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void
5482
- def initialize(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location)
4753
+ # def initialize: (locals: Array[Symbol], class_keyword_loc: Location, operator_loc: Location, expression: Node, body: Node?, end_keyword_loc: Location, location: Location) -> void
4754
+ def initialize(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
5483
4755
  @locals = locals
5484
4756
  @class_keyword_loc = class_keyword_loc
5485
4757
  @operator_loc = operator_loc
5486
4758
  @expression = expression
5487
- @statements = statements
4759
+ @body = body
5488
4760
  @end_keyword_loc = end_keyword_loc
5489
4761
  @location = location
5490
4762
  end
@@ -5494,10 +4766,9 @@ module YARP
5494
4766
  visitor.visit_singleton_class_node(self)
5495
4767
  end
5496
4768
 
5497
-
5498
4769
  # def child_nodes: () -> Array[nil | Node]
5499
4770
  def child_nodes
5500
- [expression, statements]
4771
+ [expression, body]
5501
4772
  end
5502
4773
 
5503
4774
  # def deconstruct: () -> Array[nil | Node]
@@ -5505,7 +4776,7 @@ module YARP
5505
4776
 
5506
4777
  # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
5507
4778
  def deconstruct_keys(keys)
5508
- { locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression, statements: statements, end_keyword_loc: end_keyword_loc, location: location }
4779
+ { locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression, body: body, end_keyword_loc: end_keyword_loc, location: location }
5509
4780
  end
5510
4781
 
5511
4782
  # def class_keyword: () -> String
@@ -5539,7 +4810,6 @@ module YARP
5539
4810
  visitor.visit_source_encoding_node(self)
5540
4811
  end
5541
4812
 
5542
-
5543
4813
  # def child_nodes: () -> Array[nil | Node]
5544
4814
  def child_nodes
5545
4815
  []
@@ -5573,7 +4843,6 @@ module YARP
5573
4843
  visitor.visit_source_file_node(self)
5574
4844
  end
5575
4845
 
5576
-
5577
4846
  # def child_nodes: () -> Array[nil | Node]
5578
4847
  def child_nodes
5579
4848
  []
@@ -5603,7 +4872,6 @@ module YARP
5603
4872
  visitor.visit_source_line_node(self)
5604
4873
  end
5605
4874
 
5606
-
5607
4875
  # def child_nodes: () -> Array[nil | Node]
5608
4876
  def child_nodes
5609
4877
  []
@@ -5641,7 +4909,6 @@ module YARP
5641
4909
  visitor.visit_splat_node(self)
5642
4910
  end
5643
4911
 
5644
-
5645
4912
  # def child_nodes: () -> Array[nil | Node]
5646
4913
  def child_nodes
5647
4914
  [expression]
@@ -5680,7 +4947,6 @@ module YARP
5680
4947
  visitor.visit_statements_node(self)
5681
4948
  end
5682
4949
 
5683
-
5684
4950
  # def child_nodes: () -> Array[nil | Node]
5685
4951
  def child_nodes
5686
4952
  [*body]
@@ -5718,7 +4984,6 @@ module YARP
5718
4984
  visitor.visit_string_concat_node(self)
5719
4985
  end
5720
4986
 
5721
-
5722
4987
  # def child_nodes: () -> Array[nil | Node]
5723
4988
  def child_nodes
5724
4989
  [left, right]
@@ -5771,7 +5036,6 @@ module YARP
5771
5036
  visitor.visit_string_node(self)
5772
5037
  end
5773
5038
 
5774
-
5775
5039
  # def child_nodes: () -> Array[nil | Node]
5776
5040
  def child_nodes
5777
5041
  []
@@ -5839,7 +5103,6 @@ module YARP
5839
5103
  visitor.visit_super_node(self)
5840
5104
  end
5841
5105
 
5842
-
5843
5106
  # def child_nodes: () -> Array[nil | Node]
5844
5107
  def child_nodes
5845
5108
  [arguments, block]
@@ -5903,7 +5166,6 @@ module YARP
5903
5166
  visitor.visit_symbol_node(self)
5904
5167
  end
5905
5168
 
5906
-
5907
5169
  # def child_nodes: () -> Array[nil | Node]
5908
5170
  def child_nodes
5909
5171
  []
@@ -5948,7 +5210,6 @@ module YARP
5948
5210
  visitor.visit_true_node(self)
5949
5211
  end
5950
5212
 
5951
-
5952
5213
  # def child_nodes: () -> Array[nil | Node]
5953
5214
  def child_nodes
5954
5215
  []
@@ -5986,7 +5247,6 @@ module YARP
5986
5247
  visitor.visit_undef_node(self)
5987
5248
  end
5988
5249
 
5989
-
5990
5250
  # def child_nodes: () -> Array[nil | Node]
5991
5251
  def child_nodes
5992
5252
  [*names]
@@ -6127,12 +5387,19 @@ module YARP
6127
5387
  def keyword
6128
5388
  keyword_loc.slice
6129
5389
  end
5390
+
5391
+ # def begin_modifier?: () -> bool
5392
+ def begin_modifier?
5393
+ flags.anybits?(LoopFlags::BEGIN_MODIFIER)
5394
+ end
6130
5395
  end
6131
5396
 
6132
- # case true
6133
- # when true
6134
- # ^^^^^^^^^
6135
- # end
5397
+ # Represents the use of the `when` keyword within a case statement.
5398
+ #
5399
+ # case true
5400
+ # when true
5401
+ # ^^^^^^^^^
5402
+ # end
6136
5403
  class WhenNode < Node
6137
5404
  # attr_reader keyword_loc: Location
6138
5405
  attr_reader :keyword_loc
@@ -6156,7 +5423,6 @@ module YARP
6156
5423
  visitor.visit_when_node(self)
6157
5424
  end
6158
5425
 
6159
-
6160
5426
  # def child_nodes: () -> Array[nil | Node]
6161
5427
  def child_nodes
6162
5428
  [*conditions, statements]
@@ -6231,6 +5497,11 @@ module YARP
6231
5497
  def keyword
6232
5498
  keyword_loc.slice
6233
5499
  end
5500
+
5501
+ # def begin_modifier?: () -> bool
5502
+ def begin_modifier?
5503
+ flags.anybits?(LoopFlags::BEGIN_MODIFIER)
5504
+ end
6234
5505
  end
6235
5506
 
6236
5507
  # Represents an xstring literal with no interpolation.
@@ -6264,7 +5535,6 @@ module YARP
6264
5535
  visitor.visit_x_string_node(self)
6265
5536
  end
6266
5537
 
6267
-
6268
5538
  # def child_nodes: () -> Array[nil | Node]
6269
5539
  def child_nodes
6270
5540
  []
@@ -6325,7 +5595,6 @@ module YARP
6325
5595
  visitor.visit_yield_node(self)
6326
5596
  end
6327
5597
 
6328
-
6329
5598
  # def child_nodes: () -> Array[nil | Node]
6330
5599
  def child_nodes
6331
5600
  [arguments]
@@ -6368,7 +5637,7 @@ module YARP
6368
5637
  BEGIN_MODIFIER = 1 << 0
6369
5638
  end
6370
5639
 
6371
- module RangeNodeFlags
5640
+ module RangeFlags
6372
5641
  # ... operator
6373
5642
  EXCLUDE_END = 1 << 0
6374
5643
  end
@@ -6409,6 +5678,9 @@ module YARP
6409
5678
  # Visit a AndNode node
6410
5679
  alias visit_and_node visit_child_nodes
6411
5680
 
5681
+ # Visit a AndWriteNode node
5682
+ alias visit_and_write_node visit_child_nodes
5683
+
6412
5684
  # Visit a ArgumentsNode node
6413
5685
  alias visit_arguments_node visit_child_nodes
6414
5686
 
@@ -6466,42 +5738,15 @@ module YARP
6466
5738
  # Visit a ClassNode node
6467
5739
  alias visit_class_node visit_child_nodes
6468
5740
 
6469
- # Visit a ClassVariableOperatorAndWriteNode node
6470
- alias visit_class_variable_operator_and_write_node visit_child_nodes
6471
-
6472
- # Visit a ClassVariableOperatorOrWriteNode node
6473
- alias visit_class_variable_operator_or_write_node visit_child_nodes
6474
-
6475
- # Visit a ClassVariableOperatorWriteNode node
6476
- alias visit_class_variable_operator_write_node visit_child_nodes
6477
-
6478
5741
  # Visit a ClassVariableReadNode node
6479
5742
  alias visit_class_variable_read_node visit_child_nodes
6480
5743
 
6481
5744
  # Visit a ClassVariableWriteNode node
6482
5745
  alias visit_class_variable_write_node visit_child_nodes
6483
5746
 
6484
- # Visit a ConstantOperatorAndWriteNode node
6485
- alias visit_constant_operator_and_write_node visit_child_nodes
6486
-
6487
- # Visit a ConstantOperatorOrWriteNode node
6488
- alias visit_constant_operator_or_write_node visit_child_nodes
6489
-
6490
- # Visit a ConstantOperatorWriteNode node
6491
- alias visit_constant_operator_write_node visit_child_nodes
6492
-
6493
5747
  # Visit a ConstantPathNode node
6494
5748
  alias visit_constant_path_node visit_child_nodes
6495
5749
 
6496
- # Visit a ConstantPathOperatorAndWriteNode node
6497
- alias visit_constant_path_operator_and_write_node visit_child_nodes
6498
-
6499
- # Visit a ConstantPathOperatorOrWriteNode node
6500
- alias visit_constant_path_operator_or_write_node visit_child_nodes
6501
-
6502
- # Visit a ConstantPathOperatorWriteNode node
6503
- alias visit_constant_path_operator_write_node visit_child_nodes
6504
-
6505
5750
  # Visit a ConstantPathWriteNode node
6506
5751
  alias visit_constant_path_write_node visit_child_nodes
6507
5752
 
@@ -6535,6 +5780,9 @@ module YARP
6535
5780
  # Visit a FindPatternNode node
6536
5781
  alias visit_find_pattern_node visit_child_nodes
6537
5782
 
5783
+ # Visit a FlipFlopNode node
5784
+ alias visit_flip_flop_node visit_child_nodes
5785
+
6538
5786
  # Visit a FloatNode node
6539
5787
  alias visit_float_node visit_child_nodes
6540
5788
 
@@ -6550,15 +5798,6 @@ module YARP
6550
5798
  # Visit a ForwardingSuperNode node
6551
5799
  alias visit_forwarding_super_node visit_child_nodes
6552
5800
 
6553
- # Visit a GlobalVariableOperatorAndWriteNode node
6554
- alias visit_global_variable_operator_and_write_node visit_child_nodes
6555
-
6556
- # Visit a GlobalVariableOperatorOrWriteNode node
6557
- alias visit_global_variable_operator_or_write_node visit_child_nodes
6558
-
6559
- # Visit a GlobalVariableOperatorWriteNode node
6560
- alias visit_global_variable_operator_write_node visit_child_nodes
6561
-
6562
5801
  # Visit a GlobalVariableReadNode node
6563
5802
  alias visit_global_variable_read_node visit_child_nodes
6564
5803
 
@@ -6580,15 +5819,6 @@ module YARP
6580
5819
  # Visit a InNode node
6581
5820
  alias visit_in_node visit_child_nodes
6582
5821
 
6583
- # Visit a InstanceVariableOperatorAndWriteNode node
6584
- alias visit_instance_variable_operator_and_write_node visit_child_nodes
6585
-
6586
- # Visit a InstanceVariableOperatorOrWriteNode node
6587
- alias visit_instance_variable_operator_or_write_node visit_child_nodes
6588
-
6589
- # Visit a InstanceVariableOperatorWriteNode node
6590
- alias visit_instance_variable_operator_write_node visit_child_nodes
6591
-
6592
5822
  # Visit a InstanceVariableReadNode node
6593
5823
  alias visit_instance_variable_read_node visit_child_nodes
6594
5824
 
@@ -6622,15 +5852,6 @@ module YARP
6622
5852
  # Visit a LambdaNode node
6623
5853
  alias visit_lambda_node visit_child_nodes
6624
5854
 
6625
- # Visit a LocalVariableOperatorAndWriteNode node
6626
- alias visit_local_variable_operator_and_write_node visit_child_nodes
6627
-
6628
- # Visit a LocalVariableOperatorOrWriteNode node
6629
- alias visit_local_variable_operator_or_write_node visit_child_nodes
6630
-
6631
- # Visit a LocalVariableOperatorWriteNode node
6632
- alias visit_local_variable_operator_write_node visit_child_nodes
6633
-
6634
5855
  # Visit a LocalVariableReadNode node
6635
5856
  alias visit_local_variable_read_node visit_child_nodes
6636
5857
 
@@ -6664,12 +5885,18 @@ module YARP
6664
5885
  # Visit a NumberedReferenceReadNode node
6665
5886
  alias visit_numbered_reference_read_node visit_child_nodes
6666
5887
 
5888
+ # Visit a OperatorWriteNode node
5889
+ alias visit_operator_write_node visit_child_nodes
5890
+
6667
5891
  # Visit a OptionalParameterNode node
6668
5892
  alias visit_optional_parameter_node visit_child_nodes
6669
5893
 
6670
5894
  # Visit a OrNode node
6671
5895
  alias visit_or_node visit_child_nodes
6672
5896
 
5897
+ # Visit a OrWriteNode node
5898
+ alias visit_or_write_node visit_child_nodes
5899
+
6673
5900
  # Visit a ParametersNode node
6674
5901
  alias visit_parameters_node visit_child_nodes
6675
5902
 
@@ -6805,6 +6032,11 @@ module YARP
6805
6032
  AndNode.new(left, right, operator_loc, location)
6806
6033
  end
6807
6034
 
6035
+ # Create a new AndWriteNode node
6036
+ def AndWriteNode(target, value, operator_loc, location = Location())
6037
+ AndWriteNode.new(target, value, operator_loc, location)
6038
+ end
6039
+
6808
6040
  # Create a new ArgumentsNode node
6809
6041
  def ArgumentsNode(arguments, location = Location())
6810
6042
  ArgumentsNode.new(arguments, location)
@@ -6846,8 +6078,8 @@ module YARP
6846
6078
  end
6847
6079
 
6848
6080
  # Create a new BlockNode node
6849
- def BlockNode(locals, parameters, statements, opening_loc, closing_loc, location = Location())
6850
- BlockNode.new(locals, parameters, statements, opening_loc, closing_loc, location)
6081
+ def BlockNode(locals, parameters, body, opening_loc, closing_loc, location = Location())
6082
+ BlockNode.new(locals, parameters, body, opening_loc, closing_loc, location)
6851
6083
  end
6852
6084
 
6853
6085
  # Create a new BlockParameterNode node
@@ -6896,23 +6128,8 @@ module YARP
6896
6128
  end
6897
6129
 
6898
6130
  # Create a new ClassNode node
6899
- def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, statements, end_keyword_loc, location = Location())
6900
- ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, statements, end_keyword_loc, location)
6901
- end
6902
-
6903
- # Create a new ClassVariableOperatorAndWriteNode node
6904
- def ClassVariableOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
6905
- ClassVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
6906
- end
6907
-
6908
- # Create a new ClassVariableOperatorOrWriteNode node
6909
- def ClassVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
6910
- ClassVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
6911
- end
6912
-
6913
- # Create a new ClassVariableOperatorWriteNode node
6914
- def ClassVariableOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
6915
- ClassVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
6131
+ def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, location = Location())
6132
+ ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, location)
6916
6133
  end
6917
6134
 
6918
6135
  # Create a new ClassVariableReadNode node
@@ -6925,41 +6142,11 @@ module YARP
6925
6142
  ClassVariableWriteNode.new(name_loc, value, operator_loc, location)
6926
6143
  end
6927
6144
 
6928
- # Create a new ConstantOperatorAndWriteNode node
6929
- def ConstantOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
6930
- ConstantOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
6931
- end
6932
-
6933
- # Create a new ConstantOperatorOrWriteNode node
6934
- def ConstantOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
6935
- ConstantOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
6936
- end
6937
-
6938
- # Create a new ConstantOperatorWriteNode node
6939
- def ConstantOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
6940
- ConstantOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
6941
- end
6942
-
6943
6145
  # Create a new ConstantPathNode node
6944
6146
  def ConstantPathNode(parent, child, delimiter_loc, location = Location())
6945
6147
  ConstantPathNode.new(parent, child, delimiter_loc, location)
6946
6148
  end
6947
6149
 
6948
- # Create a new ConstantPathOperatorAndWriteNode node
6949
- def ConstantPathOperatorAndWriteNode(target, operator_loc, value, location = Location())
6950
- ConstantPathOperatorAndWriteNode.new(target, operator_loc, value, location)
6951
- end
6952
-
6953
- # Create a new ConstantPathOperatorOrWriteNode node
6954
- def ConstantPathOperatorOrWriteNode(target, operator_loc, value, location = Location())
6955
- ConstantPathOperatorOrWriteNode.new(target, operator_loc, value, location)
6956
- end
6957
-
6958
- # Create a new ConstantPathOperatorWriteNode node
6959
- def ConstantPathOperatorWriteNode(target, operator_loc, value, operator, location = Location())
6960
- ConstantPathOperatorWriteNode.new(target, operator_loc, value, operator, location)
6961
- end
6962
-
6963
6150
  # Create a new ConstantPathWriteNode node
6964
6151
  def ConstantPathWriteNode(target, operator_loc, value, location = Location())
6965
6152
  ConstantPathWriteNode.new(target, operator_loc, value, location)
@@ -6976,8 +6163,8 @@ module YARP
6976
6163
  end
6977
6164
 
6978
6165
  # Create a new DefNode node
6979
- def DefNode(name_loc, receiver, parameters, statements, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
6980
- DefNode.new(name_loc, receiver, parameters, statements, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
6166
+ def DefNode(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
6167
+ DefNode.new(name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
6981
6168
  end
6982
6169
 
6983
6170
  # Create a new DefinedNode node
@@ -7015,6 +6202,11 @@ module YARP
7015
6202
  FindPatternNode.new(constant, left, requireds, right, opening_loc, closing_loc, location)
7016
6203
  end
7017
6204
 
6205
+ # Create a new FlipFlopNode node
6206
+ def FlipFlopNode(left, right, operator_loc, flags, location = Location())
6207
+ FlipFlopNode.new(left, right, operator_loc, flags, location)
6208
+ end
6209
+
7018
6210
  # Create a new FloatNode node
7019
6211
  def FloatNode(location = Location())
7020
6212
  FloatNode.new(location)
@@ -7040,21 +6232,6 @@ module YARP
7040
6232
  ForwardingSuperNode.new(block, location)
7041
6233
  end
7042
6234
 
7043
- # Create a new GlobalVariableOperatorAndWriteNode node
7044
- def GlobalVariableOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
7045
- GlobalVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
7046
- end
7047
-
7048
- # Create a new GlobalVariableOperatorOrWriteNode node
7049
- def GlobalVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
7050
- GlobalVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
7051
- end
7052
-
7053
- # Create a new GlobalVariableOperatorWriteNode node
7054
- def GlobalVariableOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
7055
- GlobalVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
7056
- end
7057
-
7058
6235
  # Create a new GlobalVariableReadNode node
7059
6236
  def GlobalVariableReadNode(location = Location())
7060
6237
  GlobalVariableReadNode.new(location)
@@ -7090,21 +6267,6 @@ module YARP
7090
6267
  InNode.new(pattern, statements, in_loc, then_loc, location)
7091
6268
  end
7092
6269
 
7093
- # Create a new InstanceVariableOperatorAndWriteNode node
7094
- def InstanceVariableOperatorAndWriteNode(name_loc, operator_loc, value, location = Location())
7095
- InstanceVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, location)
7096
- end
7097
-
7098
- # Create a new InstanceVariableOperatorOrWriteNode node
7099
- def InstanceVariableOperatorOrWriteNode(name_loc, operator_loc, value, location = Location())
7100
- InstanceVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, location)
7101
- end
7102
-
7103
- # Create a new InstanceVariableOperatorWriteNode node
7104
- def InstanceVariableOperatorWriteNode(name_loc, operator_loc, value, operator, location = Location())
7105
- InstanceVariableOperatorWriteNode.new(name_loc, operator_loc, value, operator, location)
7106
- end
7107
-
7108
6270
  # Create a new InstanceVariableReadNode node
7109
6271
  def InstanceVariableReadNode(location = Location())
7110
6272
  InstanceVariableReadNode.new(location)
@@ -7156,23 +6318,8 @@ module YARP
7156
6318
  end
7157
6319
 
7158
6320
  # Create a new LambdaNode node
7159
- def LambdaNode(locals, opening_loc, parameters, statements, location = Location())
7160
- LambdaNode.new(locals, opening_loc, parameters, statements, location)
7161
- end
7162
-
7163
- # Create a new LocalVariableOperatorAndWriteNode node
7164
- def LocalVariableOperatorAndWriteNode(name_loc, operator_loc, value, constant_id, location = Location())
7165
- LocalVariableOperatorAndWriteNode.new(name_loc, operator_loc, value, constant_id, location)
7166
- end
7167
-
7168
- # Create a new LocalVariableOperatorOrWriteNode node
7169
- def LocalVariableOperatorOrWriteNode(name_loc, operator_loc, value, constant_id, location = Location())
7170
- LocalVariableOperatorOrWriteNode.new(name_loc, operator_loc, value, constant_id, location)
7171
- end
7172
-
7173
- # Create a new LocalVariableOperatorWriteNode node
7174
- def LocalVariableOperatorWriteNode(name_loc, operator_loc, value, constant_id, operator_id, location = Location())
7175
- LocalVariableOperatorWriteNode.new(name_loc, operator_loc, value, constant_id, operator_id, location)
6321
+ def LambdaNode(locals, opening_loc, parameters, body, location = Location())
6322
+ LambdaNode.new(locals, opening_loc, parameters, body, location)
7176
6323
  end
7177
6324
 
7178
6325
  # Create a new LocalVariableReadNode node
@@ -7201,8 +6348,8 @@ module YARP
7201
6348
  end
7202
6349
 
7203
6350
  # Create a new ModuleNode node
7204
- def ModuleNode(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location = Location())
7205
- ModuleNode.new(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location)
6351
+ def ModuleNode(locals, module_keyword_loc, constant_path, body, end_keyword_loc, location = Location())
6352
+ ModuleNode.new(locals, module_keyword_loc, constant_path, body, end_keyword_loc, location)
7206
6353
  end
7207
6354
 
7208
6355
  # Create a new MultiWriteNode node
@@ -7230,6 +6377,11 @@ module YARP
7230
6377
  NumberedReferenceReadNode.new(location)
7231
6378
  end
7232
6379
 
6380
+ # Create a new OperatorWriteNode node
6381
+ def OperatorWriteNode(target, operator_loc, operator, value, location = Location())
6382
+ OperatorWriteNode.new(target, operator_loc, operator, value, location)
6383
+ end
6384
+
7233
6385
  # Create a new OptionalParameterNode node
7234
6386
  def OptionalParameterNode(constant_id, name_loc, operator_loc, value, location = Location())
7235
6387
  OptionalParameterNode.new(constant_id, name_loc, operator_loc, value, location)
@@ -7240,14 +6392,19 @@ module YARP
7240
6392
  OrNode.new(left, right, operator_loc, location)
7241
6393
  end
7242
6394
 
6395
+ # Create a new OrWriteNode node
6396
+ def OrWriteNode(target, value, operator_loc, location = Location())
6397
+ OrWriteNode.new(target, value, operator_loc, location)
6398
+ end
6399
+
7243
6400
  # Create a new ParametersNode node
7244
6401
  def ParametersNode(requireds, optionals, posts, rest, keywords, keyword_rest, block, location = Location())
7245
6402
  ParametersNode.new(requireds, optionals, posts, rest, keywords, keyword_rest, block, location)
7246
6403
  end
7247
6404
 
7248
6405
  # Create a new ParenthesesNode node
7249
- def ParenthesesNode(statements, opening_loc, closing_loc, location = Location())
7250
- ParenthesesNode.new(statements, opening_loc, closing_loc, location)
6406
+ def ParenthesesNode(body, opening_loc, closing_loc, location = Location())
6407
+ ParenthesesNode.new(body, opening_loc, closing_loc, location)
7251
6408
  end
7252
6409
 
7253
6410
  # Create a new PinnedExpressionNode node
@@ -7336,8 +6493,8 @@ module YARP
7336
6493
  end
7337
6494
 
7338
6495
  # Create a new SingletonClassNode node
7339
- def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location = Location())
7340
- SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location)
6496
+ def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location = Location())
6497
+ SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
7341
6498
  end
7342
6499
 
7343
6500
  # Create a new SourceEncodingNode node