yarp 0.8.0 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef0d177f2be8f0d5ecd0ba54901e3cdf17fd6ec6f44a1b04160082ae5a1cb519
4
- data.tar.gz: 776a4c7b981d4d6f3848bef030a448ea7d402f6ea75c20fcd87d3cbf935ecfe5
3
+ metadata.gz: '028bafce371c205e4f9a845aa0328a8911519b064ec92be9a970c0077088ca5c'
4
+ data.tar.gz: ed653e7a3734884de2f42d1df304be7eb1532b29d7acf63214c747ee84426ec0
5
5
  SHA512:
6
- metadata.gz: 2e462ba8f51d24c8164ca67804a372d1bea6f6706828801cb2404af02ee183c301e221fef21725d59e013a64652eab06eae84b3e10a427f58ee7e0eed35c3950
7
- data.tar.gz: 9594d53c55fc434c92c0601db17c548f473ca62812a0ab57b229d5b9753315198742c83f57a44744b6572def60b4b9659cfa1f93e4d86d66fd6b2f73e0db5234
6
+ metadata.gz: e33c681424d19626c0ee1d5c21265bcdfce4ec56909a5707d4bf7025ea5356b5ac41b080a1e54a8490124065a1595bd5833af8e488558f0ff01c4f14a92d0430
7
+ data.tar.gz: d55c0483e944f9a33e76a2baeef11841da8f8bf8755512ff90497d07b0fedf2dc568f6ad8c384831b6b382b1482e34177c6dbd8314d6570542c59faca71ad23e
data/CHANGELOG.md CHANGED
@@ -6,6 +6,38 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.0] - 2023-08-25
10
+
11
+ ### Added
12
+
13
+ - Regular expressions can now be bound by `\n`, `\r`, and a combination of `\r\n`.
14
+ - Strings delimited by `%`, `%q`, and `%Q` can now be bound by `\n`, `\r`, and a combination of `\r\n`.
15
+ - `IntegerNode#value` now returns the value of the integer as a Ruby `Integer`.
16
+ - `FloatNode#value` now returns the value of the float as a Ruby `Float`.
17
+ - `RationalNode#value` now returns the value of the rational as a Ruby `Rational`.
18
+ - `ImaginaryNode#value` now returns the value of the imaginary as a Ruby `Complex`.
19
+ - `ClassNode#name` is now a string that returns the name of just the class, without the namespace.
20
+ - `ModuleNode#name` is now a string that returns the name of just the module, without the namespace.
21
+ - Regular expressions and strings found after a heredoc declaration but before the heredoc body are now parsed correctly.
22
+ - The serialization API now supports shared strings, which should help reduce the size of the serialized AST.
23
+ - `*Node#copy` is introduced, which returns a copy of the node with the given overrides.
24
+ - `Location#copy` is introduced, which returns a copy of the location with the given overrides.
25
+ - `DesugarVisitor` is introduced, which provides a simpler AST for use in tools that want to process fewer node types.
26
+ - `{ClassVariable,Constant,ConstantPath,GlobalVariable,InstanceVariable,LocalVariable}TargetNode` are introduced. These nodes represent the target of writes in locations where a value cannot be provided, like a multi write or a rescue reference.
27
+ - `UntilNode#closing_loc` and `WhileNode#closing_loc` are now provided.
28
+ - `Location#join` is now provided, which joins two locations together.
29
+ - `YARP::parse_lex` and `YARP::parse_lex_file` are introduced to parse and lex in one result.
30
+
31
+ ### Changed
32
+
33
+ - When there is a magic encoding comment, the encoding of the first token's source string is now properly reencoded.
34
+ - Constants followed by unary `&` are now properly parsed as a call with a passed block argument.
35
+ - Escaping multi-byte characters in a string literal will now properly escape the entire character.
36
+ - `YARP.lex_compat` now has more accurate behavior when a byte-order mark is present in the file.
37
+ - **BREAKING**: `AndWriteNode`, `OrWriteNode`, and `OperatorWriteNode` have been split back up into their `0.7.0` versions.
38
+ - We now properly support spaces between the `encoding` and `=`/`:` in a magic encoding comment.
39
+ - We now properly parse `-> foo: bar do end`.
40
+
9
41
  ## [0.8.0] - 2023-08-18
10
42
 
11
43
  ### Added
@@ -49,7 +81,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
49
81
 
50
82
  - 🎉 Initial release! 🎉
51
83
 
52
- [unreleased]: https://github.com/ruby/yarp/compare/v0.8.0...HEAD
84
+ [unreleased]: https://github.com/ruby/yarp/compare/v0.9.0...HEAD
85
+ [0.9.0]: https://github.com/ruby/yarp/compare/v0.8.0...v0.9.0
53
86
  [0.8.0]: https://github.com/ruby/yarp/compare/v0.7.0...v0.8.0
54
87
  [0.7.0]: https://github.com/ruby/yarp/compare/v0.6.0...v0.7.0
55
88
  [0.6.0]: https://github.com/ruby/yarp/compare/d60531...v0.6.0
data/README.md CHANGED
@@ -14,7 +14,6 @@ The repository contains the infrastructure for both a shared library (librubypar
14
14
  │   ├── lex runs the lexer on a file or string, prints the tokens, and compares to ripper
15
15
  │   └── parse runs the parser on a file or string and prints the syntax tree
16
16
  ├── config.yml specification for tokens and nodes in the tree
17
- ├── configure.ac configuration to generate the Makefile
18
17
  ├── docs documentation about the project
19
18
  ├── ext
20
19
  │   └── yarp
@@ -30,6 +29,7 @@ The repository contains the infrastructure for both a shared library (librubypar
30
29
  │   └── yarp.rb main entrypoint for the Ruby library
31
30
  ├── rakelib various Rake tasks for the project
32
31
  ├── rust
32
+ │   ├── yarp Rustified crate for the shared library
33
33
  │   └── yarp-sys FFI binding for Rust
34
34
  ├── src
35
35
  │   ├── enc various encoding files
@@ -38,8 +38,9 @@ The repository contains the infrastructure for both a shared library (librubypar
38
38
  ├── templates contains ERB templates generated by templates/template.rb
39
39
  │   └── template.rb generates code from the nodes and tokens configured by config.yml
40
40
  └── test
41
-    ├── fixtures Ruby code used for testing
42
-    └── snapshots snapshots of generated syntax trees corresponding to fixtures
41
+ └── yarp
42
+ ├── fixtures Ruby code used for testing
43
+ └── snapshots snapshots of generated syntax trees corresponding to fixtures
43
44
  ```
44
45
 
45
46
  ## Getting started
data/config.yml CHANGED
@@ -399,19 +399,6 @@ nodes:
399
399
 
400
400
  left and right
401
401
  ^^^^^^^^^^^^^^
402
- - name: AndWriteNode
403
- child_nodes:
404
- - name: target
405
- type: node
406
- - name: value
407
- type: node
408
- - name: operator_loc
409
- type: location
410
- comment: |
411
- Represents the use of the `&&=` operator.
412
-
413
- target &&= value
414
- ^^^^^^^^^^^^^^^^
415
402
  - name: ArgumentsNode
416
403
  child_nodes:
417
404
  - name: arguments
@@ -731,17 +718,66 @@ nodes:
731
718
  type: node?
732
719
  - name: end_keyword_loc
733
720
  type: location
721
+ - name: name
722
+ type: string
734
723
  comment: |
735
724
  Represents a class declaration involving the `class` keyword.
736
725
 
737
726
  class Foo end
738
727
  ^^^^^^^^^^^^^
728
+ - name: ClassVariableAndWriteNode
729
+ child_nodes:
730
+ - name: name_loc
731
+ type: location
732
+ - name: operator_loc
733
+ type: location
734
+ - name: value
735
+ type: node
736
+ comment: |
737
+ Represents the use of the `&&=` operator for assignment to a class variable.
738
+
739
+ @@target &&= value
740
+ ^^^^^^^^^^^^^^^^
741
+ - name: ClassVariableOperatorWriteNode
742
+ child_nodes:
743
+ - name: name_loc
744
+ type: location
745
+ - name: operator_loc
746
+ type: location
747
+ - name: value
748
+ type: node
749
+ - name: operator
750
+ type: constant
751
+ comment: |
752
+ Represents assigning to a class variable using an operator that isn't `=`.
753
+
754
+ @@target += value
755
+ ^^^^^^^^^^^^^^^^^
756
+ - name: ClassVariableOrWriteNode
757
+ child_nodes:
758
+ - name: name_loc
759
+ type: location
760
+ - name: operator_loc
761
+ type: location
762
+ - name: value
763
+ type: node
764
+ comment: |
765
+ Represents the use of the `||=` operator for assignment to a class variable.
766
+
767
+ @@target ||= value
768
+ ^^^^^^^^^^^^^^^^^^
739
769
  - name: ClassVariableReadNode
740
770
  comment: |
741
771
  Represents referencing a class variable.
742
772
 
743
773
  @@foo
744
774
  ^^^^^
775
+ - name: ClassVariableTargetNode
776
+ comment: |
777
+ Represents writing to a class variable in a context that doesn't have an explicit value.
778
+
779
+ @@foo, @@bar = baz
780
+ ^^^^^ ^^^^^
745
781
  - name: ClassVariableWriteNode
746
782
  child_nodes:
747
783
  - name: name_loc
@@ -755,6 +791,61 @@ nodes:
755
791
 
756
792
  @@foo = 1
757
793
  ^^^^^^^^^
794
+ - name: ConstantAndWriteNode
795
+ child_nodes:
796
+ - name: name_loc
797
+ type: location
798
+ - name: operator_loc
799
+ type: location
800
+ - name: value
801
+ type: node
802
+ comment: |
803
+ Represents the use of the `&&=` operator for assignment to a constant.
804
+
805
+ Target &&= value
806
+ ^^^^^^^^^^^^^^^^
807
+ - name: ConstantOperatorWriteNode
808
+ child_nodes:
809
+ - name: name_loc
810
+ type: location
811
+ - name: operator_loc
812
+ type: location
813
+ - name: value
814
+ type: node
815
+ - name: operator
816
+ type: constant
817
+ comment: |
818
+ Represents assigning to a constant using an operator that isn't `=`.
819
+
820
+ Target += value
821
+ ^^^^^^^^^^^^^^^
822
+ - name: ConstantOrWriteNode
823
+ child_nodes:
824
+ - name: name_loc
825
+ type: location
826
+ - name: operator_loc
827
+ type: location
828
+ - name: value
829
+ type: node
830
+ comment: |
831
+ Represents the use of the `||=` operator for assignment to a constant.
832
+
833
+ Target ||= value
834
+ ^^^^^^^^^^^^^^^^
835
+ - name: ConstantPathAndWriteNode
836
+ child_nodes:
837
+ - name: target
838
+ type: node
839
+ kind: ConstantPathNode
840
+ - name: operator_loc
841
+ type: location
842
+ - name: value
843
+ type: node
844
+ comment: |
845
+ Represents the use of the `&&=` operator for assignment to a constant path.
846
+
847
+ Parent::Child &&= value
848
+ ^^^^^^^^^^^^^^^^^^^^^^^
758
849
  - name: ConstantPathNode
759
850
  child_nodes:
760
851
  - name: parent
@@ -768,15 +859,58 @@ nodes:
768
859
 
769
860
  Foo::Bar
770
861
  ^^^^^^^^
771
- - name: ConstantPathWriteNode
862
+ - name: ConstantPathOperatorWriteNode
772
863
  child_nodes:
773
864
  - name: target
774
865
  type: node
775
866
  kind: ConstantPathNode
776
867
  - name: operator_loc
777
- type: location?
868
+ type: location
869
+ - name: value
870
+ type: node
871
+ - name: operator
872
+ type: constant
873
+ comment: |
874
+ Represents assigning to a constant path using an operator that isn't `=`.
875
+
876
+ Parent::Child += value
877
+ ^^^^^^^^^^^^^^^^^^^^^^
878
+ - name: ConstantPathOrWriteNode
879
+ child_nodes:
880
+ - name: target
881
+ type: node
882
+ kind: ConstantPathNode
883
+ - name: operator_loc
884
+ type: location
778
885
  - name: value
886
+ type: node
887
+ comment: |
888
+ Represents the use of the `||=` operator for assignment to a constant path.
889
+
890
+ Parent::Child ||= value
891
+ ^^^^^^^^^^^^^^^^^^^^^^^
892
+ - name: ConstantPathTargetNode
893
+ child_nodes:
894
+ - name: parent
779
895
  type: node?
896
+ - name: child
897
+ type: node
898
+ - name: delimiter_loc
899
+ type: location
900
+ comment: |
901
+ Represents writing to a constant path in a context that doesn't have an explicit value.
902
+
903
+ Foo::Foo, Bar::Bar = baz
904
+ ^^^^^^^^ ^^^^^^^^
905
+ - name: ConstantPathWriteNode
906
+ child_nodes:
907
+ - name: target
908
+ type: node
909
+ kind: ConstantPathNode
910
+ - name: operator_loc
911
+ type: location
912
+ - name: value
913
+ type: node
780
914
  comment: |
781
915
  Represents writing to a constant path.
782
916
 
@@ -794,14 +928,20 @@ nodes:
794
928
 
795
929
  Foo
796
930
  ^^^
931
+ - name: ConstantTargetNode
932
+ comment: |
933
+ Represents writing to a constant in a context that doesn't have an explicit value.
934
+
935
+ Foo, Bar = baz
936
+ ^^^ ^^^
797
937
  - name: ConstantWriteNode
798
938
  child_nodes:
799
939
  - name: name_loc
800
940
  type: location
801
941
  - name: value
802
- type: node?
942
+ type: node
803
943
  - name: operator_loc
804
- type: location?
944
+ type: location
805
945
  comment: |
806
946
  Represents writing to a constant.
807
947
 
@@ -1010,20 +1150,67 @@ nodes:
1010
1150
 
1011
1151
  super
1012
1152
  ^^^^^
1153
+ - name: GlobalVariableAndWriteNode
1154
+ child_nodes:
1155
+ - name: name_loc
1156
+ type: location
1157
+ - name: operator_loc
1158
+ type: location
1159
+ - name: value
1160
+ type: node
1161
+ comment: |
1162
+ Represents the use of the `&&=` operator for assignment to a global variable.
1163
+
1164
+ $target &&= value
1165
+ ^^^^^^^^^^^^^^^^^
1166
+ - name: GlobalVariableOperatorWriteNode
1167
+ child_nodes:
1168
+ - name: name_loc
1169
+ type: location
1170
+ - name: operator_loc
1171
+ type: location
1172
+ - name: value
1173
+ type: node
1174
+ - name: operator
1175
+ type: constant
1176
+ comment: |
1177
+ Represents assigning to a global variable using an operator that isn't `=`.
1178
+
1179
+ $target += value
1180
+ ^^^^^^^^^^^^^^^^
1181
+ - name: GlobalVariableOrWriteNode
1182
+ child_nodes:
1183
+ - name: name_loc
1184
+ type: location
1185
+ - name: operator_loc
1186
+ type: location
1187
+ - name: value
1188
+ type: node
1189
+ comment: |
1190
+ Represents the use of the `||=` operator for assignment to a global variable.
1191
+
1192
+ $target ||= value
1193
+ ^^^^^^^^^^^^^^^^^
1013
1194
  - name: GlobalVariableReadNode
1014
1195
  comment: |
1015
1196
  Represents referencing a global variable.
1016
1197
 
1017
1198
  $foo
1018
1199
  ^^^^
1200
+ - name: GlobalVariableTargetNode
1201
+ comment: |
1202
+ Represents writing to a global variable in a context that doesn't have an explicit value.
1203
+
1204
+ $foo, $bar = baz
1205
+ ^^^^ ^^^^
1019
1206
  - name: GlobalVariableWriteNode
1020
1207
  child_nodes:
1021
1208
  - name: name_loc
1022
1209
  type: location
1023
1210
  - name: operator_loc
1024
- type: location?
1211
+ type: location
1025
1212
  - name: value
1026
- type: node?
1213
+ type: node
1027
1214
  comment: |
1028
1215
  Represents writing to a global variable.
1029
1216
 
@@ -1109,20 +1296,67 @@ nodes:
1109
1296
 
1110
1297
  case a; in b then c end
1111
1298
  ^^^^^^^^^^^
1299
+ - name: InstanceVariableAndWriteNode
1300
+ child_nodes:
1301
+ - name: name_loc
1302
+ type: location
1303
+ - name: operator_loc
1304
+ type: location
1305
+ - name: value
1306
+ type: node
1307
+ comment: |
1308
+ Represents the use of the `&&=` operator for assignment to an instance variable.
1309
+
1310
+ @target &&= value
1311
+ ^^^^^^^^^^^^^^^^^
1312
+ - name: InstanceVariableOperatorWriteNode
1313
+ child_nodes:
1314
+ - name: name_loc
1315
+ type: location
1316
+ - name: operator_loc
1317
+ type: location
1318
+ - name: value
1319
+ type: node
1320
+ - name: operator
1321
+ type: constant
1322
+ comment: |
1323
+ Represents assigning to an instance variable using an operator that isn't `=`.
1324
+
1325
+ @target += value
1326
+ ^^^^^^^^^^^^^^^^
1327
+ - name: InstanceVariableOrWriteNode
1328
+ child_nodes:
1329
+ - name: name_loc
1330
+ type: location
1331
+ - name: operator_loc
1332
+ type: location
1333
+ - name: value
1334
+ type: node
1335
+ comment: |
1336
+ Represents the use of the `||=` operator for assignment to an instance variable.
1337
+
1338
+ @target ||= value
1339
+ ^^^^^^^^^^^^^^^^^
1112
1340
  - name: InstanceVariableReadNode
1113
1341
  comment: |
1114
1342
  Represents referencing an instance variable.
1115
1343
 
1116
1344
  @foo
1117
1345
  ^^^^
1346
+ - name: InstanceVariableTargetNode
1347
+ comment: |
1348
+ Represents writing to an instance variable in a context that doesn't have an explicit value.
1349
+
1350
+ @foo, @bar = baz
1351
+ ^^^^ ^^^^
1118
1352
  - name: InstanceVariableWriteNode
1119
1353
  child_nodes:
1120
1354
  - name: name_loc
1121
1355
  type: location
1122
1356
  - name: value
1123
- type: node?
1357
+ type: node
1124
1358
  - name: operator_loc
1125
- type: location?
1359
+ type: location
1126
1360
  comment: |
1127
1361
  Represents writing to an instance variable.
1128
1362
 
@@ -1234,8 +1468,12 @@ nodes:
1234
1468
  child_nodes:
1235
1469
  - name: locals
1236
1470
  type: constant[]
1471
+ - name: operator_loc
1472
+ type: location
1237
1473
  - name: opening_loc
1238
1474
  type: location
1475
+ - name: closing_loc
1476
+ type: location
1239
1477
  - name: parameters
1240
1478
  type: node?
1241
1479
  kind: BlockParametersNode
@@ -1246,6 +1484,59 @@ nodes:
1246
1484
 
1247
1485
  ->(value) { value * 2 }
1248
1486
  ^^^^^^^^^^^^^^^^^^^^^^^
1487
+ - name: LocalVariableAndWriteNode
1488
+ child_nodes:
1489
+ - name: name_loc
1490
+ type: location
1491
+ - name: operator_loc
1492
+ type: location
1493
+ - name: value
1494
+ type: node
1495
+ - name: constant_id
1496
+ type: constant
1497
+ - name: depth
1498
+ type: uint32
1499
+ comment: |
1500
+ Represents the use of the `&&=` operator for assignment to a local variable.
1501
+
1502
+ target &&= value
1503
+ ^^^^^^^^^^^^^^^^
1504
+ - name: LocalVariableOperatorWriteNode
1505
+ child_nodes:
1506
+ - name: name_loc
1507
+ type: location
1508
+ - name: operator_loc
1509
+ type: location
1510
+ - name: value
1511
+ type: node
1512
+ - name: constant_id
1513
+ type: constant
1514
+ - name: operator_id
1515
+ type: constant
1516
+ - name: depth
1517
+ type: uint32
1518
+ comment: |
1519
+ Represents assigning to a local variable using an operator that isn't `=`.
1520
+
1521
+ target += value
1522
+ ^^^^^^^^^^^^^^^
1523
+ - name: LocalVariableOrWriteNode
1524
+ child_nodes:
1525
+ - name: name_loc
1526
+ type: location
1527
+ - name: operator_loc
1528
+ type: location
1529
+ - name: value
1530
+ type: node
1531
+ - name: constant_id
1532
+ type: constant
1533
+ - name: depth
1534
+ type: uint32
1535
+ comment: |
1536
+ Represents the use of the `||=` operator for assignment to a local variable.
1537
+
1538
+ target ||= value
1539
+ ^^^^^^^^^^^^^^^^
1249
1540
  - name: LocalVariableReadNode
1250
1541
  child_nodes:
1251
1542
  - name: constant_id
@@ -1259,6 +1550,17 @@ nodes:
1259
1550
 
1260
1551
  foo
1261
1552
  ^^^
1553
+ - name: LocalVariableTargetNode
1554
+ child_nodes:
1555
+ - name: constant_id
1556
+ type: constant
1557
+ - name: depth
1558
+ type: uint32
1559
+ comment: |
1560
+ Represents writing to a local variable in a context that doesn't have an explicit value.
1561
+
1562
+ foo, bar = baz
1563
+ ^^^ ^^^
1262
1564
  - name: LocalVariableWriteNode
1263
1565
  child_nodes:
1264
1566
  - name: constant_id
@@ -1266,11 +1568,11 @@ nodes:
1266
1568
  - name: depth
1267
1569
  type: uint32
1268
1570
  - name: value
1269
- type: node?
1571
+ type: node
1270
1572
  - name: name_loc
1271
1573
  type: location
1272
1574
  - name: operator_loc
1273
- type: location?
1575
+ type: location
1274
1576
  comment: |
1275
1577
  Represents writing to a local variable.
1276
1578
 
@@ -1318,6 +1620,8 @@ nodes:
1318
1620
  type: node?
1319
1621
  - name: end_keyword_loc
1320
1622
  type: location
1623
+ - name: name
1624
+ type: string
1321
1625
  comment: |
1322
1626
  Represents a module declaration involving the `module` keyword.
1323
1627
 
@@ -1376,21 +1680,6 @@ nodes:
1376
1680
 
1377
1681
  $1
1378
1682
  ^^
1379
- - name: OperatorWriteNode
1380
- child_nodes:
1381
- - name: target
1382
- type: node
1383
- - name: operator_loc
1384
- type: location
1385
- - name: operator
1386
- type: constant
1387
- - name: value
1388
- type: node
1389
- comment: |
1390
- Represents the use of an operator on a write.
1391
-
1392
- target += value
1393
- ^^^^^^^^^^^^^^^
1394
1683
  - name: OptionalParameterNode
1395
1684
  child_nodes:
1396
1685
  - name: constant_id
@@ -1420,19 +1709,6 @@ nodes:
1420
1709
 
1421
1710
  left or right
1422
1711
  ^^^^^^^^^^^^^
1423
- - name: OrWriteNode
1424
- child_nodes:
1425
- - name: target
1426
- type: node
1427
- - name: value
1428
- type: node
1429
- - name: operator_loc
1430
- type: location
1431
- comment: |
1432
- Represents the use of the `||=` operator.
1433
-
1434
- target ||= value
1435
- ^^^^^^^^^^^^^^^^
1436
1712
  - name: ParametersNode
1437
1713
  child_nodes:
1438
1714
  - name: requireds
@@ -1812,7 +2088,7 @@ nodes:
1812
2088
  - name: opening_loc
1813
2089
  type: location?
1814
2090
  - name: value_loc
1815
- type: location
2091
+ type: location?
1816
2092
  - name: closing_loc
1817
2093
  type: location?
1818
2094
  - name: unescaped
@@ -1869,6 +2145,8 @@ nodes:
1869
2145
  child_nodes:
1870
2146
  - name: keyword_loc
1871
2147
  type: location
2148
+ - name: closing_loc
2149
+ type: location?
1872
2150
  - name: predicate
1873
2151
  type: node
1874
2152
  - name: statements
@@ -1906,6 +2184,8 @@ nodes:
1906
2184
  child_nodes:
1907
2185
  - name: keyword_loc
1908
2186
  type: location
2187
+ - name: closing_loc
2188
+ type: location?
1909
2189
  - name: predicate
1910
2190
  type: node
1911
2191
  - name: statements
@@ -7,6 +7,7 @@ A lot of code in YARP's repository is templated from a single configuration file
7
7
  * `java/org/yarp/AbstractNodeVisitor.java` - for defining the visitor interface for the nodes in Java
8
8
  * `java/org/yarp/Loader.java` - for defining how to deserialize the nodes in Java
9
9
  * `java/org/yarp/Nodes.java` - for defining the nodes in Java
10
+ * `lib/yarp/mutation_visitor.rb` - for defining the mutation visitor for the nodes in Ruby
10
11
  * `lib/yarp/node.rb` - for defining the nodes in Ruby
11
12
  * `lib/yarp/serialize.rb` - for defining how to deserialize the nodes in Ruby
12
13
  * `src/node.c` - for defining how to free the nodes in C and calculate the size in memory in C
data/docs/ruby_api.md CHANGED
@@ -20,4 +20,6 @@ The full API is documented below.
20
20
  * `YARP.lex_file(filepath)` - parse the tokens corresponding to the given source file and return them as an array within a parse result
21
21
  * `YARP.parse(source)` - parse the syntax tree corresponding to the given source string and return it within a parse result
22
22
  * `YARP.parse_file(filepath)` - parse the syntax tree corresponding to the given source file and return it within a parse result
23
+ * `YARP.parse_lex(source)` - parse the syntax tree corresponding to the given source string and return it within a parse result, along with the tokens
24
+ * `YARP.parse_lex_file(filepath)` - parse the syntax tree corresponding to the given source file and return it within a parse result, along with the tokens
23
25
  * `YARP.load(source, serialized)` - load the serialized syntax tree using the source as a reference into a syntax tree
@@ -73,7 +73,7 @@ The header is structured like the following table:
73
73
  | varint | content pool size |
74
74
 
75
75
  After the header comes the body of the serialized string.
76
- The body consistents of a sequence of nodes that is built using a prefix traversal order of the syntax tree.
76
+ The body consists of a sequence of nodes that is built using a prefix traversal order of the syntax tree.
77
77
  Each node is structured like the following table:
78
78
 
79
79
  | # bytes | field |
data/docs/testing.md CHANGED
@@ -12,9 +12,9 @@ These test specific YARP implementation details like comments, errors, and regul
12
12
 
13
13
  ### Snapshot tests
14
14
 
15
- Snapshot tests ensure that parsed output is equivalent to previous parsed output. There are many categorized examples of valid syntax within the `test/fixtures/` directory. When the test suite runs, it will parse all of this syntax, and compare it against corresponding files in the `test/snapshots/` directory. For example, `test/fixtures/strings.txt` has a corresponding `test/snapshots/strings.txt`.
15
+ Snapshot tests ensure that parsed output is equivalent to previous parsed output. There are many categorized examples of valid syntax within the `test/yarp/fixtures/` directory. When the test suite runs, it will parse all of this syntax, and compare it against corresponding files in the `test/yarp/snapshots/` directory. For example, `test/yarp/fixtures/strings.txt` has a corresponding `test/yarp/snapshots/strings.txt`.
16
16
 
17
- If the parsed files do not match, it will raise an error. If there is not a corresponding file in the `test/snapshots/` directory, one will be created so that it exists for the next test run.
17
+ If the parsed files do not match, it will raise an error. If there is not a corresponding file in the `test/yarp/snapshots/` directory, one will be created so that it exists for the next test run.
18
18
 
19
19
  ### Testing against repositories
20
20