yarp 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/Makefile +5 -1
  4. data/config.yml +156 -125
  5. data/docs/encoding.md +5 -5
  6. data/docs/serialization.md +2 -2
  7. data/ext/yarp/api_node.c +142 -98
  8. data/ext/yarp/extension.c +21 -7
  9. data/ext/yarp/extension.h +1 -1
  10. data/include/yarp/ast.h +327 -18
  11. data/include/yarp/defines.h +2 -1
  12. data/include/yarp/diagnostic.h +3 -3
  13. data/include/yarp/enc/yp_encoding.h +10 -10
  14. data/include/yarp/parser.h +19 -19
  15. data/include/yarp/regexp.h +1 -1
  16. data/include/yarp/unescape.h +4 -4
  17. data/include/yarp/util/yp_buffer.h +3 -0
  18. data/include/yarp/util/yp_char.h +16 -16
  19. data/include/yarp/util/yp_constant_pool.h +2 -2
  20. data/include/yarp/util/yp_newline_list.h +5 -5
  21. data/include/yarp/util/yp_string.h +4 -4
  22. data/include/yarp/util/yp_string_list.h +0 -3
  23. data/include/yarp/util/yp_strpbrk.h +1 -1
  24. data/include/yarp/version.h +2 -2
  25. data/include/yarp.h +5 -4
  26. data/lib/yarp/desugar_visitor.rb +59 -122
  27. data/lib/yarp/node.rb +230 -240
  28. data/lib/yarp/serialize.rb +16 -16
  29. data/lib/yarp.rb +5 -5
  30. data/src/diagnostic.c +1 -1
  31. data/src/enc/yp_big5.c +15 -42
  32. data/src/enc/yp_euc_jp.c +16 -43
  33. data/src/enc/yp_gbk.c +19 -46
  34. data/src/enc/yp_shift_jis.c +16 -43
  35. data/src/enc/yp_tables.c +36 -38
  36. data/src/enc/yp_unicode.c +20 -25
  37. data/src/enc/yp_windows_31j.c +16 -43
  38. data/src/node.c +1271 -899
  39. data/src/prettyprint.c +87 -48
  40. data/src/regexp.c +21 -21
  41. data/src/serialize.c +28 -15
  42. data/src/unescape.c +151 -121
  43. data/src/util/yp_buffer.c +7 -2
  44. data/src/util/yp_char.c +34 -34
  45. data/src/util/yp_constant_pool.c +4 -4
  46. data/src/util/yp_memchr.c +1 -1
  47. data/src/util/yp_newline_list.c +5 -4
  48. data/src/util/yp_string.c +22 -20
  49. data/src/util/yp_string_list.c +0 -6
  50. data/src/util/yp_strncasecmp.c +3 -6
  51. data/src/util/yp_strpbrk.c +8 -8
  52. data/src/yarp.c +355 -216
  53. data/yarp.gemspec +1 -1
  54. metadata +2 -2
data/config.yml CHANGED
@@ -361,7 +361,7 @@ flags:
361
361
  comment: "o - only interpolates values into the regular expression once"
362
362
  nodes:
363
363
  - name: AliasNode
364
- child_nodes:
364
+ fields:
365
365
  - name: new_name
366
366
  type: node
367
367
  - name: old_name
@@ -374,7 +374,7 @@ nodes:
374
374
  alias foo bar
375
375
  ^^^^^^^^^^^^^
376
376
  - name: AlternationPatternNode
377
- child_nodes:
377
+ fields:
378
378
  - name: left
379
379
  type: node
380
380
  - name: right
@@ -387,7 +387,7 @@ nodes:
387
387
  foo => bar | baz
388
388
  ^^^^^^^^^
389
389
  - name: AndNode
390
- child_nodes:
390
+ fields:
391
391
  - name: left
392
392
  type: node
393
393
  - name: right
@@ -400,7 +400,7 @@ nodes:
400
400
  left and right
401
401
  ^^^^^^^^^^^^^^
402
402
  - name: ArgumentsNode
403
- child_nodes:
403
+ fields:
404
404
  - name: arguments
405
405
  type: node[]
406
406
  comment: |
@@ -409,7 +409,7 @@ nodes:
409
409
  return foo, bar, baz
410
410
  ^^^^^^^^^^^^^
411
411
  - name: ArrayNode
412
- child_nodes:
412
+ fields:
413
413
  - name: elements
414
414
  type: node[]
415
415
  - name: opening_loc
@@ -423,7 +423,7 @@ nodes:
423
423
  [1, 2, 3]
424
424
  ^^^^^^^^^
425
425
  - name: ArrayPatternNode
426
- child_nodes:
426
+ fields:
427
427
  - name: constant
428
428
  type: node?
429
429
  - name: requireds
@@ -454,7 +454,7 @@ nodes:
454
454
  foo in Bar[1, 2, 3]
455
455
  ^^^^^^^^^^^^^^^^^^^
456
456
  - name: AssocNode
457
- child_nodes:
457
+ fields:
458
458
  - name: key
459
459
  type: node
460
460
  - name: value
@@ -467,7 +467,7 @@ nodes:
467
467
  { a => b }
468
468
  ^^^^^^
469
469
  - name: AssocSplatNode
470
- child_nodes:
470
+ fields:
471
471
  - name: value
472
472
  type: node?
473
473
  - name: operator_loc
@@ -484,7 +484,7 @@ nodes:
484
484
  $'
485
485
  ^^
486
486
  - name: BeginNode
487
- child_nodes:
487
+ fields:
488
488
  - name: begin_keyword_loc
489
489
  type: location?
490
490
  - name: statements
@@ -510,7 +510,7 @@ nodes:
510
510
  end
511
511
  ^^^^^
512
512
  - name: BlockArgumentNode
513
- child_nodes:
513
+ fields:
514
514
  - name: expression
515
515
  type: node?
516
516
  - name: operator_loc
@@ -521,7 +521,7 @@ nodes:
521
521
  bar(&args)
522
522
  ^^^^^^^^^^
523
523
  - name: BlockNode
524
- child_nodes:
524
+ fields:
525
525
  - name: locals
526
526
  type: constant[]
527
527
  - name: parameters
@@ -539,7 +539,7 @@ nodes:
539
539
  [1, 2, 3].each { |i| puts x }
540
540
  ^^^^^^^^^^^^^^
541
541
  - name: BlockParameterNode
542
- child_nodes:
542
+ fields:
543
543
  - name: name_loc
544
544
  type: location?
545
545
  - name: operator_loc
@@ -551,7 +551,7 @@ nodes:
551
551
  ^^
552
552
  end
553
553
  - name: BlockParametersNode
554
- child_nodes:
554
+ fields:
555
555
  - name: parameters
556
556
  type: node?
557
557
  kind: ParametersNode
@@ -571,7 +571,7 @@ nodes:
571
571
  ^^^^^^^^^^^^^^^^^
572
572
  end
573
573
  - name: BreakNode
574
- child_nodes:
574
+ fields:
575
575
  - name: arguments
576
576
  type: node?
577
577
  kind: ArgumentsNode
@@ -583,7 +583,7 @@ nodes:
583
583
  break foo
584
584
  ^^^^^^^^^
585
585
  - name: CallNode
586
- child_nodes:
586
+ fields:
587
587
  - name: receiver
588
588
  type: node?
589
589
  - name: operator_loc
@@ -626,7 +626,7 @@ nodes:
626
626
  foo&.bar
627
627
  ^^^^^^^^
628
628
  - name: CallOperatorAndWriteNode
629
- child_nodes:
629
+ fields:
630
630
  - name: target
631
631
  type: node
632
632
  kind: CallNode
@@ -640,7 +640,7 @@ nodes:
640
640
  foo.bar &&= value
641
641
  ^^^^^^^^^^^^^^^^^
642
642
  - name: CallOperatorOrWriteNode
643
- child_nodes:
643
+ fields:
644
644
  - name: target
645
645
  type: node
646
646
  kind: CallNode
@@ -654,7 +654,7 @@ nodes:
654
654
  foo.bar ||= value
655
655
  ^^^^^^^^^^^^^^^^^
656
656
  - name: CallOperatorWriteNode
657
- child_nodes:
657
+ fields:
658
658
  - name: target
659
659
  type: node
660
660
  kind: CallNode
@@ -662,7 +662,7 @@ nodes:
662
662
  type: location
663
663
  - name: value
664
664
  type: node
665
- - name: operator_id
665
+ - name: operator
666
666
  type: constant
667
667
  comment: |
668
668
  Represents the use of an assignment operator on a call.
@@ -670,7 +670,7 @@ nodes:
670
670
  foo.bar += baz
671
671
  ^^^^^^^^^^^^^^
672
672
  - name: CapturePatternNode
673
- child_nodes:
673
+ fields:
674
674
  - name: value
675
675
  type: node
676
676
  - name: target
@@ -683,7 +683,7 @@ nodes:
683
683
  foo => [bar => baz]
684
684
  ^^^^^^^^^^^^
685
685
  - name: CaseNode
686
- child_nodes:
686
+ fields:
687
687
  - name: predicate
688
688
  type: node?
689
689
  - name: conditions
@@ -703,7 +703,7 @@ nodes:
703
703
  when false
704
704
  end
705
705
  - name: ClassNode
706
- child_nodes:
706
+ fields:
707
707
  - name: locals
708
708
  type: constant[]
709
709
  - name: class_keyword_loc
@@ -726,7 +726,9 @@ nodes:
726
726
  class Foo end
727
727
  ^^^^^^^^^^^^^
728
728
  - name: ClassVariableAndWriteNode
729
- child_nodes:
729
+ fields:
730
+ - name: name
731
+ type: constant
730
732
  - name: name_loc
731
733
  type: location
732
734
  - name: operator_loc
@@ -739,7 +741,9 @@ nodes:
739
741
  @@target &&= value
740
742
  ^^^^^^^^^^^^^^^^
741
743
  - name: ClassVariableOperatorWriteNode
742
- child_nodes:
744
+ fields:
745
+ - name: name
746
+ type: constant
743
747
  - name: name_loc
744
748
  type: location
745
749
  - name: operator_loc
@@ -754,7 +758,9 @@ nodes:
754
758
  @@target += value
755
759
  ^^^^^^^^^^^^^^^^^
756
760
  - name: ClassVariableOrWriteNode
757
- child_nodes:
761
+ fields:
762
+ - name: name
763
+ type: constant
758
764
  - name: name_loc
759
765
  type: location
760
766
  - name: operator_loc
@@ -767,19 +773,27 @@ nodes:
767
773
  @@target ||= value
768
774
  ^^^^^^^^^^^^^^^^^^
769
775
  - name: ClassVariableReadNode
776
+ fields:
777
+ - name: name
778
+ type: constant
770
779
  comment: |
771
780
  Represents referencing a class variable.
772
781
 
773
782
  @@foo
774
783
  ^^^^^
775
784
  - name: ClassVariableTargetNode
785
+ fields:
786
+ - name: name
787
+ type: constant
776
788
  comment: |
777
789
  Represents writing to a class variable in a context that doesn't have an explicit value.
778
790
 
779
791
  @@foo, @@bar = baz
780
792
  ^^^^^ ^^^^^
781
793
  - name: ClassVariableWriteNode
782
- child_nodes:
794
+ fields:
795
+ - name: name
796
+ type: constant
783
797
  - name: name_loc
784
798
  type: location
785
799
  - name: value
@@ -792,7 +806,7 @@ nodes:
792
806
  @@foo = 1
793
807
  ^^^^^^^^^
794
808
  - name: ConstantAndWriteNode
795
- child_nodes:
809
+ fields:
796
810
  - name: name_loc
797
811
  type: location
798
812
  - name: operator_loc
@@ -805,7 +819,7 @@ nodes:
805
819
  Target &&= value
806
820
  ^^^^^^^^^^^^^^^^
807
821
  - name: ConstantOperatorWriteNode
808
- child_nodes:
822
+ fields:
809
823
  - name: name_loc
810
824
  type: location
811
825
  - name: operator_loc
@@ -820,7 +834,7 @@ nodes:
820
834
  Target += value
821
835
  ^^^^^^^^^^^^^^^
822
836
  - name: ConstantOrWriteNode
823
- child_nodes:
837
+ fields:
824
838
  - name: name_loc
825
839
  type: location
826
840
  - name: operator_loc
@@ -833,7 +847,7 @@ nodes:
833
847
  Target ||= value
834
848
  ^^^^^^^^^^^^^^^^
835
849
  - name: ConstantPathAndWriteNode
836
- child_nodes:
850
+ fields:
837
851
  - name: target
838
852
  type: node
839
853
  kind: ConstantPathNode
@@ -847,7 +861,7 @@ nodes:
847
861
  Parent::Child &&= value
848
862
  ^^^^^^^^^^^^^^^^^^^^^^^
849
863
  - name: ConstantPathNode
850
- child_nodes:
864
+ fields:
851
865
  - name: parent
852
866
  type: node?
853
867
  - name: child
@@ -860,7 +874,7 @@ nodes:
860
874
  Foo::Bar
861
875
  ^^^^^^^^
862
876
  - name: ConstantPathOperatorWriteNode
863
- child_nodes:
877
+ fields:
864
878
  - name: target
865
879
  type: node
866
880
  kind: ConstantPathNode
@@ -876,7 +890,7 @@ nodes:
876
890
  Parent::Child += value
877
891
  ^^^^^^^^^^^^^^^^^^^^^^
878
892
  - name: ConstantPathOrWriteNode
879
- child_nodes:
893
+ fields:
880
894
  - name: target
881
895
  type: node
882
896
  kind: ConstantPathNode
@@ -890,7 +904,7 @@ nodes:
890
904
  Parent::Child ||= value
891
905
  ^^^^^^^^^^^^^^^^^^^^^^^
892
906
  - name: ConstantPathTargetNode
893
- child_nodes:
907
+ fields:
894
908
  - name: parent
895
909
  type: node?
896
910
  - name: child
@@ -903,7 +917,7 @@ nodes:
903
917
  Foo::Foo, Bar::Bar = baz
904
918
  ^^^^^^^^ ^^^^^^^^
905
919
  - name: ConstantPathWriteNode
906
- child_nodes:
920
+ fields:
907
921
  - name: target
908
922
  type: node
909
923
  kind: ConstantPathNode
@@ -935,7 +949,7 @@ nodes:
935
949
  Foo, Bar = baz
936
950
  ^^^ ^^^
937
951
  - name: ConstantWriteNode
938
- child_nodes:
952
+ fields:
939
953
  - name: name_loc
940
954
  type: location
941
955
  - name: value
@@ -948,7 +962,7 @@ nodes:
948
962
  Foo = 1
949
963
  ^^^^^^^
950
964
  - name: DefNode
951
- child_nodes:
965
+ fields:
952
966
  - name: name_loc
953
967
  type: location
954
968
  - name: receiver
@@ -979,7 +993,7 @@ nodes:
979
993
  end
980
994
  ^^^^^^^^^^
981
995
  - name: DefinedNode
982
- child_nodes:
996
+ fields:
983
997
  - name: lparen_loc
984
998
  type: location?
985
999
  - name: value
@@ -994,7 +1008,7 @@ nodes:
994
1008
  defined?(a)
995
1009
  ^^^^^^^^^^^
996
1010
  - name: ElseNode
997
- child_nodes:
1011
+ fields:
998
1012
  - name: else_keyword_loc
999
1013
  type: location
1000
1014
  - name: statements
@@ -1008,7 +1022,7 @@ nodes:
1008
1022
  if a then b else c end
1009
1023
  ^^^^^^^^^^
1010
1024
  - name: EmbeddedStatementsNode
1011
- child_nodes:
1025
+ fields:
1012
1026
  - name: opening_loc
1013
1027
  type: location
1014
1028
  - name: statements
@@ -1022,7 +1036,7 @@ nodes:
1022
1036
  "foo #{bar}"
1023
1037
  ^^^^^^
1024
1038
  - name: EmbeddedVariableNode
1025
- child_nodes:
1039
+ fields:
1026
1040
  - name: operator_loc
1027
1041
  type: location
1028
1042
  - name: variable
@@ -1033,7 +1047,7 @@ nodes:
1033
1047
  "foo #@bar"
1034
1048
  ^^^^^
1035
1049
  - name: EnsureNode
1036
- child_nodes:
1050
+ fields:
1037
1051
  - name: ensure_keyword_loc
1038
1052
  type: location
1039
1053
  - name: statements
@@ -1057,7 +1071,7 @@ nodes:
1057
1071
  false
1058
1072
  ^^^^^
1059
1073
  - name: FindPatternNode
1060
- child_nodes:
1074
+ fields:
1061
1075
  - name: constant
1062
1076
  type: node?
1063
1077
  - name: left
@@ -1082,7 +1096,7 @@ nodes:
1082
1096
  foo in Foo(*bar, baz, *qux)
1083
1097
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1084
1098
  - name: FlipFlopNode
1085
- child_nodes:
1099
+ fields:
1086
1100
  - name: left
1087
1101
  type: node?
1088
1102
  - name: right
@@ -1104,7 +1118,7 @@ nodes:
1104
1118
  1.0
1105
1119
  ^^^
1106
1120
  - name: ForNode
1107
- child_nodes:
1121
+ fields:
1108
1122
  - name: index
1109
1123
  type: node
1110
1124
  - name: collection
@@ -1141,7 +1155,7 @@ nodes:
1141
1155
  ^^^
1142
1156
  end
1143
1157
  - name: ForwardingSuperNode
1144
- child_nodes:
1158
+ fields:
1145
1159
  - name: block
1146
1160
  type: node?
1147
1161
  kind: BlockNode
@@ -1151,7 +1165,7 @@ nodes:
1151
1165
  super
1152
1166
  ^^^^^
1153
1167
  - name: GlobalVariableAndWriteNode
1154
- child_nodes:
1168
+ fields:
1155
1169
  - name: name_loc
1156
1170
  type: location
1157
1171
  - name: operator_loc
@@ -1164,7 +1178,7 @@ nodes:
1164
1178
  $target &&= value
1165
1179
  ^^^^^^^^^^^^^^^^^
1166
1180
  - name: GlobalVariableOperatorWriteNode
1167
- child_nodes:
1181
+ fields:
1168
1182
  - name: name_loc
1169
1183
  type: location
1170
1184
  - name: operator_loc
@@ -1179,7 +1193,7 @@ nodes:
1179
1193
  $target += value
1180
1194
  ^^^^^^^^^^^^^^^^
1181
1195
  - name: GlobalVariableOrWriteNode
1182
- child_nodes:
1196
+ fields:
1183
1197
  - name: name_loc
1184
1198
  type: location
1185
1199
  - name: operator_loc
@@ -1204,20 +1218,20 @@ nodes:
1204
1218
  $foo, $bar = baz
1205
1219
  ^^^^ ^^^^
1206
1220
  - name: GlobalVariableWriteNode
1207
- child_nodes:
1221
+ fields:
1208
1222
  - name: name_loc
1209
1223
  type: location
1210
- - name: operator_loc
1211
- type: location
1212
1224
  - name: value
1213
1225
  type: node
1226
+ - name: operator_loc
1227
+ type: location
1214
1228
  comment: |
1215
1229
  Represents writing to a global variable.
1216
1230
 
1217
1231
  $foo = 1
1218
1232
  ^^^^^^^^
1219
1233
  - name: HashNode
1220
- child_nodes:
1234
+ fields:
1221
1235
  - name: opening_loc
1222
1236
  type: location
1223
1237
  - name: elements
@@ -1230,7 +1244,7 @@ nodes:
1230
1244
  { a => b }
1231
1245
  ^^^^^^^^^^
1232
1246
  - name: HashPatternNode
1233
- child_nodes:
1247
+ fields:
1234
1248
  - name: constant
1235
1249
  type: node?
1236
1250
  - name: assocs
@@ -1250,7 +1264,7 @@ nodes:
1250
1264
  foo => { a: 1, b: 2, **c }
1251
1265
  ^^^^^^^^^^^^^^^^^^^
1252
1266
  - name: IfNode
1253
- child_nodes:
1267
+ fields:
1254
1268
  - name: if_keyword_loc
1255
1269
  type: location?
1256
1270
  - name: predicate
@@ -1272,7 +1286,7 @@ nodes:
1272
1286
  if foo then bar end
1273
1287
  ^^^^^^^^^^^^^^^^^^^
1274
1288
  - name: ImaginaryNode
1275
- child_nodes:
1289
+ fields:
1276
1290
  - name: numeric
1277
1291
  type: node
1278
1292
  comment: |
@@ -1281,7 +1295,7 @@ nodes:
1281
1295
  1.0i
1282
1296
  ^^^^
1283
1297
  - name: InNode
1284
- child_nodes:
1298
+ fields:
1285
1299
  - name: pattern
1286
1300
  type: node
1287
1301
  - name: statements
@@ -1297,7 +1311,9 @@ nodes:
1297
1311
  case a; in b then c end
1298
1312
  ^^^^^^^^^^^
1299
1313
  - name: InstanceVariableAndWriteNode
1300
- child_nodes:
1314
+ fields:
1315
+ - name: name
1316
+ type: constant
1301
1317
  - name: name_loc
1302
1318
  type: location
1303
1319
  - name: operator_loc
@@ -1310,7 +1326,9 @@ nodes:
1310
1326
  @target &&= value
1311
1327
  ^^^^^^^^^^^^^^^^^
1312
1328
  - name: InstanceVariableOperatorWriteNode
1313
- child_nodes:
1329
+ fields:
1330
+ - name: name
1331
+ type: constant
1314
1332
  - name: name_loc
1315
1333
  type: location
1316
1334
  - name: operator_loc
@@ -1325,7 +1343,9 @@ nodes:
1325
1343
  @target += value
1326
1344
  ^^^^^^^^^^^^^^^^
1327
1345
  - name: InstanceVariableOrWriteNode
1328
- child_nodes:
1346
+ fields:
1347
+ - name: name
1348
+ type: constant
1329
1349
  - name: name_loc
1330
1350
  type: location
1331
1351
  - name: operator_loc
@@ -1338,19 +1358,27 @@ nodes:
1338
1358
  @target ||= value
1339
1359
  ^^^^^^^^^^^^^^^^^
1340
1360
  - name: InstanceVariableReadNode
1361
+ fields:
1362
+ - name: name
1363
+ type: constant
1341
1364
  comment: |
1342
1365
  Represents referencing an instance variable.
1343
1366
 
1344
1367
  @foo
1345
1368
  ^^^^
1346
1369
  - name: InstanceVariableTargetNode
1370
+ fields:
1371
+ - name: name
1372
+ type: constant
1347
1373
  comment: |
1348
1374
  Represents writing to an instance variable in a context that doesn't have an explicit value.
1349
1375
 
1350
1376
  @foo, @bar = baz
1351
1377
  ^^^^ ^^^^
1352
1378
  - name: InstanceVariableWriteNode
1353
- child_nodes:
1379
+ fields:
1380
+ - name: name
1381
+ type: constant
1354
1382
  - name: name_loc
1355
1383
  type: location
1356
1384
  - name: value
@@ -1369,7 +1397,7 @@ nodes:
1369
1397
  1
1370
1398
  ^
1371
1399
  - name: InterpolatedRegularExpressionNode
1372
- child_nodes:
1400
+ fields:
1373
1401
  - name: opening_loc
1374
1402
  type: location
1375
1403
  - name: parts
@@ -1386,7 +1414,7 @@ nodes:
1386
1414
  /foo #{bar} baz/
1387
1415
  ^^^^^^^^^^^^^^^^
1388
1416
  - name: InterpolatedStringNode
1389
- child_nodes:
1417
+ fields:
1390
1418
  - name: opening_loc
1391
1419
  type: location?
1392
1420
  - name: parts
@@ -1400,7 +1428,7 @@ nodes:
1400
1428
  "foo #{bar} baz"
1401
1429
  ^^^^^^^^^^^^^^^^
1402
1430
  - name: InterpolatedSymbolNode
1403
- child_nodes:
1431
+ fields:
1404
1432
  - name: opening_loc
1405
1433
  type: location?
1406
1434
  - name: parts
@@ -1414,7 +1442,7 @@ nodes:
1414
1442
  :"foo #{bar} baz"
1415
1443
  ^^^^^^^^^^^^^^^^^
1416
1444
  - name: InterpolatedXStringNode
1417
- child_nodes:
1445
+ fields:
1418
1446
  - name: opening_loc
1419
1447
  type: location
1420
1448
  - name: parts
@@ -1428,7 +1456,7 @@ nodes:
1428
1456
  `foo #{bar} baz`
1429
1457
  ^^^^^^^^^^^^^^^^
1430
1458
  - name: KeywordHashNode
1431
- child_nodes:
1459
+ fields:
1432
1460
  - name: elements
1433
1461
  type: node[]
1434
1462
  comment: |
@@ -1437,7 +1465,7 @@ nodes:
1437
1465
  foo(a: b)
1438
1466
  ^^^^
1439
1467
  - name: KeywordParameterNode
1440
- child_nodes:
1468
+ fields:
1441
1469
  - name: name_loc
1442
1470
  type: location
1443
1471
  - name: value
@@ -1453,7 +1481,7 @@ nodes:
1453
1481
  ^^^^
1454
1482
  end
1455
1483
  - name: KeywordRestParameterNode
1456
- child_nodes:
1484
+ fields:
1457
1485
  - name: operator_loc
1458
1486
  type: location
1459
1487
  - name: name_loc
@@ -1465,7 +1493,7 @@ nodes:
1465
1493
  ^^^
1466
1494
  end
1467
1495
  - name: LambdaNode
1468
- child_nodes:
1496
+ fields:
1469
1497
  - name: locals
1470
1498
  type: constant[]
1471
1499
  - name: operator_loc
@@ -1485,14 +1513,14 @@ nodes:
1485
1513
  ->(value) { value * 2 }
1486
1514
  ^^^^^^^^^^^^^^^^^^^^^^^
1487
1515
  - name: LocalVariableAndWriteNode
1488
- child_nodes:
1516
+ fields:
1489
1517
  - name: name_loc
1490
1518
  type: location
1491
1519
  - name: operator_loc
1492
1520
  type: location
1493
1521
  - name: value
1494
1522
  type: node
1495
- - name: constant_id
1523
+ - name: name
1496
1524
  type: constant
1497
1525
  - name: depth
1498
1526
  type: uint32
@@ -1502,16 +1530,16 @@ nodes:
1502
1530
  target &&= value
1503
1531
  ^^^^^^^^^^^^^^^^
1504
1532
  - name: LocalVariableOperatorWriteNode
1505
- child_nodes:
1533
+ fields:
1506
1534
  - name: name_loc
1507
1535
  type: location
1508
1536
  - name: operator_loc
1509
1537
  type: location
1510
1538
  - name: value
1511
1539
  type: node
1512
- - name: constant_id
1540
+ - name: name
1513
1541
  type: constant
1514
- - name: operator_id
1542
+ - name: operator
1515
1543
  type: constant
1516
1544
  - name: depth
1517
1545
  type: uint32
@@ -1521,14 +1549,14 @@ nodes:
1521
1549
  target += value
1522
1550
  ^^^^^^^^^^^^^^^
1523
1551
  - name: LocalVariableOrWriteNode
1524
- child_nodes:
1552
+ fields:
1525
1553
  - name: name_loc
1526
1554
  type: location
1527
1555
  - name: operator_loc
1528
1556
  type: location
1529
1557
  - name: value
1530
1558
  type: node
1531
- - name: constant_id
1559
+ - name: name
1532
1560
  type: constant
1533
1561
  - name: depth
1534
1562
  type: uint32
@@ -1538,8 +1566,8 @@ nodes:
1538
1566
  target ||= value
1539
1567
  ^^^^^^^^^^^^^^^^
1540
1568
  - name: LocalVariableReadNode
1541
- child_nodes:
1542
- - name: constant_id
1569
+ fields:
1570
+ - name: name
1543
1571
  type: constant
1544
1572
  - name: depth
1545
1573
  type: uint32
@@ -1551,8 +1579,8 @@ nodes:
1551
1579
  foo
1552
1580
  ^^^
1553
1581
  - name: LocalVariableTargetNode
1554
- child_nodes:
1555
- - name: constant_id
1582
+ fields:
1583
+ - name: name
1556
1584
  type: constant
1557
1585
  - name: depth
1558
1586
  type: uint32
@@ -1562,15 +1590,15 @@ nodes:
1562
1590
  foo, bar = baz
1563
1591
  ^^^ ^^^
1564
1592
  - name: LocalVariableWriteNode
1565
- child_nodes:
1566
- - name: constant_id
1593
+ fields:
1594
+ - name: name
1567
1595
  type: constant
1568
1596
  - name: depth
1569
1597
  type: uint32
1570
- - name: value
1571
- type: node
1572
1598
  - name: name_loc
1573
1599
  type: location
1600
+ - name: value
1601
+ type: node
1574
1602
  - name: operator_loc
1575
1603
  type: location
1576
1604
  comment: |
@@ -1579,7 +1607,7 @@ nodes:
1579
1607
  foo = 1
1580
1608
  ^^^^^^^
1581
1609
  - name: MatchPredicateNode
1582
- child_nodes:
1610
+ fields:
1583
1611
  - name: value
1584
1612
  type: node
1585
1613
  - name: pattern
@@ -1592,7 +1620,7 @@ nodes:
1592
1620
  foo in bar
1593
1621
  ^^^^^^^^^^
1594
1622
  - name: MatchRequiredNode
1595
- child_nodes:
1623
+ fields:
1596
1624
  - name: value
1597
1625
  type: node
1598
1626
  - name: pattern
@@ -1609,7 +1637,7 @@ nodes:
1609
1637
  Represents a node that is missing from the source and results in a syntax
1610
1638
  error.
1611
1639
  - name: ModuleNode
1612
- child_nodes:
1640
+ fields:
1613
1641
  - name: locals
1614
1642
  type: constant[]
1615
1643
  - name: module_keyword_loc
@@ -1628,7 +1656,7 @@ nodes:
1628
1656
  module Foo end
1629
1657
  ^^^^^^^^^^^^^^
1630
1658
  - name: MultiWriteNode
1631
- child_nodes:
1659
+ fields:
1632
1660
  - name: targets
1633
1661
  type: node[]
1634
1662
  - name: operator_loc
@@ -1645,7 +1673,7 @@ nodes:
1645
1673
  a, b, c = 1, 2, 3
1646
1674
  ^^^^^^^^^^^^^^^^^
1647
1675
  - name: NextNode
1648
- child_nodes:
1676
+ fields:
1649
1677
  - name: arguments
1650
1678
  type: node?
1651
1679
  kind: ArgumentsNode
@@ -1663,7 +1691,7 @@ nodes:
1663
1691
  nil
1664
1692
  ^^^
1665
1693
  - name: NoKeywordsParameterNode
1666
- child_nodes:
1694
+ fields:
1667
1695
  - name: operator_loc
1668
1696
  type: location
1669
1697
  - name: keyword_loc
@@ -1675,14 +1703,17 @@ nodes:
1675
1703
  ^^^^^
1676
1704
  end
1677
1705
  - name: NumberedReferenceReadNode
1706
+ fields:
1707
+ - name: number
1708
+ type: uint32
1678
1709
  comment: |
1679
1710
  Represents reading a numbered reference to a capture in the previous match.
1680
1711
 
1681
1712
  $1
1682
1713
  ^^
1683
1714
  - name: OptionalParameterNode
1684
- child_nodes:
1685
- - name: constant_id
1715
+ fields:
1716
+ - name: name
1686
1717
  type: constant
1687
1718
  - name: name_loc
1688
1719
  type: location
@@ -1697,7 +1728,7 @@ nodes:
1697
1728
  ^^^^^
1698
1729
  end
1699
1730
  - name: OrNode
1700
- child_nodes:
1731
+ fields:
1701
1732
  - name: left
1702
1733
  type: node
1703
1734
  - name: right
@@ -1710,7 +1741,7 @@ nodes:
1710
1741
  left or right
1711
1742
  ^^^^^^^^^^^^^
1712
1743
  - name: ParametersNode
1713
- child_nodes:
1744
+ fields:
1714
1745
  - name: requireds
1715
1746
  type: node[]
1716
1747
  - name: optionals
@@ -1734,7 +1765,7 @@ nodes:
1734
1765
  ^^^^^^^
1735
1766
  end
1736
1767
  - name: ParenthesesNode
1737
- child_nodes:
1768
+ fields:
1738
1769
  - name: body
1739
1770
  type: node?
1740
1771
  - name: opening_loc
@@ -1748,7 +1779,7 @@ nodes:
1748
1779
  (10 + 34)
1749
1780
  ^^^^^^^^^
1750
1781
  - name: PinnedExpressionNode
1751
- child_nodes:
1782
+ fields:
1752
1783
  - name: expression
1753
1784
  type: node
1754
1785
  - name: operator_loc
@@ -1764,7 +1795,7 @@ nodes:
1764
1795
  foo in ^(bar)
1765
1796
  ^^^^^^
1766
1797
  - name: PinnedVariableNode
1767
- child_nodes:
1798
+ fields:
1768
1799
  - name: variable
1769
1800
  type: node
1770
1801
  - name: operator_loc
@@ -1776,7 +1807,7 @@ nodes:
1776
1807
  foo in ^bar
1777
1808
  ^^^^
1778
1809
  - name: PostExecutionNode
1779
- child_nodes:
1810
+ fields:
1780
1811
  - name: statements
1781
1812
  type: node?
1782
1813
  kind: StatementsNode
@@ -1792,7 +1823,7 @@ nodes:
1792
1823
  END { foo }
1793
1824
  ^^^^^^^^^^^
1794
1825
  - name: PreExecutionNode
1795
- child_nodes:
1826
+ fields:
1796
1827
  - name: statements
1797
1828
  type: node?
1798
1829
  kind: StatementsNode
@@ -1808,7 +1839,7 @@ nodes:
1808
1839
  BEGIN { foo }
1809
1840
  ^^^^^^^^^^^^^
1810
1841
  - name: ProgramNode
1811
- child_nodes:
1842
+ fields:
1812
1843
  - name: locals
1813
1844
  type: constant[]
1814
1845
  - name: statements
@@ -1816,7 +1847,7 @@ nodes:
1816
1847
  kind: StatementsNode
1817
1848
  comment: The top level node of any parse tree.
1818
1849
  - name: RangeNode
1819
- child_nodes:
1850
+ fields:
1820
1851
  - name: left
1821
1852
  type: node?
1822
1853
  - name: right
@@ -1835,7 +1866,7 @@ nodes:
1835
1866
  c if a =~ /left/ ... b =~ /right/
1836
1867
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1837
1868
  - name: RationalNode
1838
- child_nodes:
1869
+ fields:
1839
1870
  - name: numeric
1840
1871
  type: node
1841
1872
  comment: |
@@ -1850,7 +1881,7 @@ nodes:
1850
1881
  redo
1851
1882
  ^^^^
1852
1883
  - name: RegularExpressionNode
1853
- child_nodes:
1884
+ fields:
1854
1885
  - name: opening_loc
1855
1886
  type: location
1856
1887
  - name: content_loc
@@ -1868,7 +1899,7 @@ nodes:
1868
1899
  /foo/i
1869
1900
  ^^^^^^
1870
1901
  - name: RequiredDestructuredParameterNode
1871
- child_nodes:
1902
+ fields:
1872
1903
  - name: parameters
1873
1904
  type: node[]
1874
1905
  - name: opening_loc
@@ -1882,8 +1913,8 @@ nodes:
1882
1913
  ^^^^^^^^^^
1883
1914
  end
1884
1915
  - name: RequiredParameterNode
1885
- child_nodes:
1886
- - name: constant_id
1916
+ fields:
1917
+ - name: name
1887
1918
  type: constant
1888
1919
  comment: |
1889
1920
  Represents a required parameter to a method, block, or lambda definition.
@@ -1892,7 +1923,7 @@ nodes:
1892
1923
  ^
1893
1924
  end
1894
1925
  - name: RescueModifierNode
1895
- child_nodes:
1926
+ fields:
1896
1927
  - name: expression
1897
1928
  type: node
1898
1929
  - name: keyword_loc
@@ -1906,7 +1937,7 @@ nodes:
1906
1937
  foo rescue nil
1907
1938
  ^^^^^^^^^^^^^^
1908
1939
  - name: RescueNode
1909
- child_nodes:
1940
+ fields:
1910
1941
  - name: keyword_loc
1911
1942
  type: location
1912
1943
  - name: exceptions
@@ -1933,7 +1964,7 @@ nodes:
1933
1964
  `Foo, *splat, Bar` are in the `exceptions` field.
1934
1965
  `ex` is in the `exception` field.
1935
1966
  - name: RestParameterNode
1936
- child_nodes:
1967
+ fields:
1937
1968
  - name: operator_loc
1938
1969
  type: location
1939
1970
  - name: name_loc
@@ -1951,7 +1982,7 @@ nodes:
1951
1982
  retry
1952
1983
  ^^^^^
1953
1984
  - name: ReturnNode
1954
- child_nodes:
1985
+ fields:
1955
1986
  - name: keyword_loc
1956
1987
  type: location
1957
1988
  - name: arguments
@@ -1969,7 +2000,7 @@ nodes:
1969
2000
  self
1970
2001
  ^^^^
1971
2002
  - name: SingletonClassNode
1972
- child_nodes:
2003
+ fields:
1973
2004
  - name: locals
1974
2005
  type: constant[]
1975
2006
  - name: class_keyword_loc
@@ -1994,7 +2025,7 @@ nodes:
1994
2025
  __ENCODING__
1995
2026
  ^^^^^^^^^^^^
1996
2027
  - name: SourceFileNode
1997
- child_nodes:
2028
+ fields:
1998
2029
  - name: filepath
1999
2030
  type: string
2000
2031
  comment: |
@@ -2009,7 +2040,7 @@ nodes:
2009
2040
  __LINE__
2010
2041
  ^^^^^^^^
2011
2042
  - name: SplatNode
2012
- child_nodes:
2043
+ fields:
2013
2044
  - name: operator_loc
2014
2045
  type: location
2015
2046
  - name: expression
@@ -2020,7 +2051,7 @@ nodes:
2020
2051
  [*a]
2021
2052
  ^^
2022
2053
  - name: StatementsNode
2023
- child_nodes:
2054
+ fields:
2024
2055
  - name: body
2025
2056
  type: node[]
2026
2057
  comment: |
@@ -2029,7 +2060,7 @@ nodes:
2029
2060
  foo; bar; baz
2030
2061
  ^^^^^^^^^^^^^
2031
2062
  - name: StringConcatNode
2032
- child_nodes:
2063
+ fields:
2033
2064
  - name: left
2034
2065
  type: node
2035
2066
  - name: right
@@ -2040,7 +2071,7 @@ nodes:
2040
2071
  "foo" "bar"
2041
2072
  ^^^^^^^^^^^
2042
2073
  - name: StringNode
2043
- child_nodes:
2074
+ fields:
2044
2075
  - name: opening_loc
2045
2076
  type: location?
2046
2077
  - name: content_loc
@@ -2062,7 +2093,7 @@ nodes:
2062
2093
  "foo #{bar} baz"
2063
2094
  ^^^^ ^^^^
2064
2095
  - name: SuperNode
2065
- child_nodes:
2096
+ fields:
2066
2097
  - name: keyword_loc
2067
2098
  type: location
2068
2099
  - name: lparen_loc
@@ -2084,7 +2115,7 @@ nodes:
2084
2115
  super foo, bar
2085
2116
  ^^^^^^^^^^^^^^
2086
2117
  - name: SymbolNode
2087
- child_nodes:
2118
+ fields:
2088
2119
  - name: opening_loc
2089
2120
  type: location?
2090
2121
  - name: value_loc
@@ -2108,7 +2139,7 @@ nodes:
2108
2139
  true
2109
2140
  ^^^^
2110
2141
  - name: UndefNode
2111
- child_nodes:
2142
+ fields:
2112
2143
  - name: names
2113
2144
  type: node[]
2114
2145
  - name: keyword_loc
@@ -2119,7 +2150,7 @@ nodes:
2119
2150
  undef :foo, :bar, :baz
2120
2151
  ^^^^^^^^^^^^^^^^^^^^^^
2121
2152
  - name: UnlessNode
2122
- child_nodes:
2153
+ fields:
2123
2154
  - name: keyword_loc
2124
2155
  type: location
2125
2156
  - name: predicate
@@ -2142,7 +2173,7 @@ nodes:
2142
2173
  unless foo then bar end
2143
2174
  ^^^^^^^^^^^^^^^^^^^^^^^
2144
2175
  - name: UntilNode
2145
- child_nodes:
2176
+ fields:
2146
2177
  - name: keyword_loc
2147
2178
  type: location
2148
2179
  - name: closing_loc
@@ -2165,7 +2196,7 @@ nodes:
2165
2196
  until foo do bar end
2166
2197
  ^^^^^^^^^^^^^^^^^^^^
2167
2198
  - name: WhenNode
2168
- child_nodes:
2199
+ fields:
2169
2200
  - name: keyword_loc
2170
2201
  type: location
2171
2202
  - name: conditions
@@ -2181,7 +2212,7 @@ nodes:
2181
2212
  ^^^^^^^^^
2182
2213
  end
2183
2214
  - name: WhileNode
2184
- child_nodes:
2215
+ fields:
2185
2216
  - name: keyword_loc
2186
2217
  type: location
2187
2218
  - name: closing_loc
@@ -2204,7 +2235,7 @@ nodes:
2204
2235
  while foo do bar end
2205
2236
  ^^^^^^^^^^^^^^^^^^^^
2206
2237
  - name: XStringNode
2207
- child_nodes:
2238
+ fields:
2208
2239
  - name: opening_loc
2209
2240
  type: location
2210
2241
  - name: content_loc
@@ -2219,7 +2250,7 @@ nodes:
2219
2250
  `foo`
2220
2251
  ^^^^^
2221
2252
  - name: YieldNode
2222
- child_nodes:
2253
+ fields:
2223
2254
  - name: keyword_loc
2224
2255
  type: location
2225
2256
  - name: lparen_loc