yarp 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81d6e0266ee0d13563faafa47a0c0d09c5feabe870e2324f32564a7f68299dff
4
- data.tar.gz: 771e9fd99caaf99cf7493d897cf9fdd5f93824e90bf09c22a1e5b5ec0e1a4bcf
3
+ metadata.gz: ef0d177f2be8f0d5ecd0ba54901e3cdf17fd6ec6f44a1b04160082ae5a1cb519
4
+ data.tar.gz: 776a4c7b981d4d6f3848bef030a448ea7d402f6ea75c20fcd87d3cbf935ecfe5
5
5
  SHA512:
6
- metadata.gz: 16525d9ed87d00d9fd94af5cab5f99b8278ac4a81c7117195e80d3cd3cc6b12358fd0f2255cbe7df15ef1adef609719371bc3a210d8a2273d6e34fbdcb4b1a58
7
- data.tar.gz: efbf02ccd9a7cb6a13b6ba56dc8fc3fc6e425d7d779583614fc9c24c74216fe3d89eadc83999f197a7227bfd90ca8ba9446c1b71c128e4874609f44f0869eb72
6
+ metadata.gz: 2e462ba8f51d24c8164ca67804a372d1bea6f6706828801cb2404af02ee183c301e221fef21725d59e013a64652eab06eae84b3e10a427f58ee7e0eed35c3950
7
+ data.tar.gz: 9594d53c55fc434c92c0601db17c548f473ca62812a0ab57b229d5b9753315198742c83f57a44744b6572def60b4b9659cfa1f93e4d86d66fd6b2f73e0db5234
data/CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ 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.8.0] - 2023-08-18
10
+
11
+ ### Added
12
+
13
+ - Some performance improvements when converting from the C AST to the Ruby AST.
14
+ - Two rust crates have been added: `yarp-sys` and `yarp`. They are as yet unpublished.
15
+
16
+ ### Changed
17
+
18
+ - Escaped newlines in strings and heredocs are now handled more correctly.
19
+ - Dedenting heredocs that result in empty string nodes will now drop those string nodes from the list.
20
+ - Beginless and endless ranges in conditional expressions now properly form a flip flop node.
21
+ - `%` at the end of files no longer crashes.
22
+ - Location information has been corrected for `if/elsif` chains that have no `else`.
23
+ - `__END__` at the very end of the file was previously parsed as an identifier, but is now correct.
24
+ - **BREAKING**: Nodes that reference `&&=`, `||=`, and other writing operators have been consolidated. Previously, they were separate individual nodes. Now they are a tree with the target being the left-hand side and the value being the right-hand side with a joining `AndWriteNode`, `OrWriteNode`, or `OperatorWriteNode` in the middle. This impacts all of the nodes that match this pattern: `{ClassVariable,Constant,ConstantPath,GlobalVariable,InstanceVariable,LocalVariable}Operator{And,Or,}WriteNode`.
25
+ - **BREAKING**: `BlockParametersNode`, `ClassNode`, `DefNode`, `LambdaNode`, `ModuleNode`, `ParenthesesNode`, and `SingletonClassNode` have had their `statements` field renamed to `body` to give a hint that it might not be a `StatementsNode` (it could also be a `BeginNode`).
26
+
9
27
  ## [0.7.0] - 2023-08-14
10
28
 
11
29
  ### Added
@@ -22,7 +40,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
22
40
 
23
41
  - Autotools has been removed from the build system, so when the gem is installed it will no longer need to go through a configure step.
24
42
  - The AST for `foo = *bar` has changed to have an explicit array on the right hand side, rather than a splat node. This is more consistent with how other parsers handle this.
25
- - `RangeNodeFlags` has been renamed to `RangeFlags`.
43
+ - **BREAKING**: `RangeNodeFlags` has been renamed to `RangeFlags`.
26
44
  - Unary minus on number literals is now parsed as part of the literal, rather than a call to a unary operator. This is more consistent with how other parsers handle this.
27
45
 
28
46
  ## [0.6.0] - 2023-08-09
@@ -31,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
31
49
 
32
50
  - 🎉 Initial release! 🎉
33
51
 
34
- [unreleased]: https://github.com/ruby/yarp/compare/v0.7.0...HEAD
52
+ [unreleased]: https://github.com/ruby/yarp/compare/v0.8.0...HEAD
53
+ [0.8.0]: https://github.com/ruby/yarp/compare/v0.7.0...v0.8.0
35
54
  [0.7.0]: https://github.com/ruby/yarp/compare/v0.6.0...v0.7.0
36
55
  [0.6.0]: https://github.com/ruby/yarp/compare/d60531...v0.6.0
data/Makefile CHANGED
@@ -61,6 +61,8 @@ fuzz-docker-build: fuzz/docker/Dockerfile
61
61
  $(Q) docker build -t yarp/fuzz fuzz/docker/
62
62
 
63
63
  fuzz-run-%: FORCE fuzz-docker-build
64
+ $(ECHO) "generating templates"
65
+ $(Q) bundle exec rake templates
64
66
  $(ECHO) "running $* fuzzer"
65
67
  $(Q) docker run --rm -v $(shell pwd):/yarp yarp/fuzz /bin/bash -c "FUZZ_FLAGS=\"$(FUZZ_FLAGS)\" make build/fuzz.$*"
66
68
  $(ECHO) "starting AFL++ run"
data/README.md CHANGED
@@ -29,6 +29,8 @@ The repository contains the infrastructure for both a shared library (librubypar
29
29
  │   ├── yarp Ruby library files
30
30
  │   └── yarp.rb main entrypoint for the Ruby library
31
31
  ├── rakelib various Rake tasks for the project
32
+ ├── rust
33
+ │   └── yarp-sys FFI binding for Rust
32
34
  ├── src
33
35
  │   ├── enc various encoding files
34
36
  │   ├── util various utility files
@@ -45,7 +47,7 @@ The repository contains the infrastructure for both a shared library (librubypar
45
47
  To compile the shared library, you will need:
46
48
 
47
49
  * A C99 compiler
48
- * autotools (autoconf, automake, libtool)
50
+ * autotools autoconf, automake, libtool)
49
51
  * make
50
52
  * Ruby 3.3.0-preview1 or later
51
53
 
@@ -77,10 +79,11 @@ See the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information. We additio
77
79
  * [Configuration](docs/configuration.md)
78
80
  * [Design](docs/design.md)
79
81
  * [Encoding](docs/encoding.md)
80
- * [Extension](docs/extension.md)
81
82
  * [Fuzzing](docs/fuzzing.md)
82
83
  * [Heredocs](docs/heredocs.md)
83
84
  * [Mapping](docs/mapping.md)
84
85
  * [Ripper](docs/ripper.md)
86
+ * [Ruby API](docs/ruby_api.md)
85
87
  * [Serialization](docs/serialization.md)
86
88
  * [Testing](docs/testing.md)
89
+
data/config.yml CHANGED
@@ -399,6 +399,19 @@ 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
+ ^^^^^^^^^^^^^^^^
402
415
  - name: ArgumentsNode
403
416
  child_nodes:
404
417
  - name: arguments
@@ -527,7 +540,7 @@ nodes:
527
540
  - name: parameters
528
541
  type: node?
529
542
  kind: BlockParametersNode
530
- - name: statements
543
+ - name: body
531
544
  type: node?
532
545
  - name: opening_loc
533
546
  type: location
@@ -714,7 +727,7 @@ nodes:
714
727
  type: location?
715
728
  - name: superclass
716
729
  type: node?
717
- - name: statements
730
+ - name: body
718
731
  type: node?
719
732
  - name: end_keyword_loc
720
733
  type: location
@@ -723,47 +736,6 @@ nodes:
723
736
 
724
737
  class Foo end
725
738
  ^^^^^^^^^^^^^
726
- - name: ClassVariableOperatorAndWriteNode
727
- child_nodes:
728
- - name: name_loc
729
- type: location
730
- - name: operator_loc
731
- type: location
732
- - name: value
733
- type: node
734
- comment: |
735
- Represents the use of the `&&=` operator for assignment to a class variable.
736
-
737
- @@target &&= value
738
- ^^^^^^^^^^^^^^^^
739
- - name: ClassVariableOperatorOrWriteNode
740
- child_nodes:
741
- - name: name_loc
742
- type: location
743
- - name: operator_loc
744
- type: location
745
- - name: value
746
- type: node
747
- comment: |
748
- Represents the use of the `||=` operator for assignment to a class variable.
749
-
750
- @@target ||= value
751
- ^^^^^^^^^^^^^^^^^^
752
- - name: ClassVariableOperatorWriteNode
753
- child_nodes:
754
- - name: name_loc
755
- type: location
756
- - name: operator_loc
757
- type: location
758
- - name: value
759
- type: node
760
- - name: operator
761
- type: constant
762
- comment: |
763
- Represents assigning to a class variable using an operator that isn't `=`.
764
-
765
- @@target += value
766
- ^^^^^^^^^^^^^^^^^
767
739
  - name: ClassVariableReadNode
768
740
  comment: |
769
741
  Represents referencing a class variable.
@@ -783,47 +755,6 @@ nodes:
783
755
 
784
756
  @@foo = 1
785
757
  ^^^^^^^^^
786
- - name: ConstantOperatorAndWriteNode
787
- child_nodes:
788
- - name: name_loc
789
- type: location
790
- - name: operator_loc
791
- type: location
792
- - name: value
793
- type: node
794
- comment: |
795
- Represents the use of the `&&=` operator for assignment to a constant.
796
-
797
- Target &&= value
798
- ^^^^^^^^^^^^^^^^
799
- - name: ConstantOperatorOrWriteNode
800
- child_nodes:
801
- - name: name_loc
802
- type: location
803
- - name: operator_loc
804
- type: location
805
- - name: value
806
- type: node
807
- comment: |
808
- Represents the use of the `||=` operator for assignment to a constant.
809
-
810
- Target ||= value
811
- ^^^^^^^^^^^^^^^^
812
- - name: ConstantOperatorWriteNode
813
- child_nodes:
814
- - name: name_loc
815
- type: location
816
- - name: operator_loc
817
- type: location
818
- - name: value
819
- type: node
820
- - name: operator
821
- type: constant
822
- comment: |
823
- Represents assigning to a constant using an operator that isn't `=`.
824
-
825
- Target += value
826
- ^^^^^^^^^^^^^^^
827
758
  - name: ConstantPathNode
828
759
  child_nodes:
829
760
  - name: parent
@@ -837,50 +768,6 @@ nodes:
837
768
 
838
769
  Foo::Bar
839
770
  ^^^^^^^^
840
- - name: ConstantPathOperatorAndWriteNode
841
- child_nodes:
842
- - name: target
843
- type: node
844
- kind: ConstantPathNode
845
- - name: operator_loc
846
- type: location
847
- - name: value
848
- type: node
849
- comment: |
850
- Represents the use of the `&&=` operator for assignment to a constant path.
851
-
852
- Parent::Child &&= value
853
- ^^^^^^^^^^^^^^^^^^^^^^^
854
- - name: ConstantPathOperatorOrWriteNode
855
- child_nodes:
856
- - name: target
857
- type: node
858
- kind: ConstantPathNode
859
- - name: operator_loc
860
- type: location
861
- - name: value
862
- type: node
863
- comment: |
864
- Represents the use of the `||=` operator for assignment to a constant path.
865
-
866
- Parent::Child ||= value
867
- ^^^^^^^^^^^^^^^^^^^^^^^
868
- - name: ConstantPathOperatorWriteNode
869
- child_nodes:
870
- - name: target
871
- type: node
872
- kind: ConstantPathNode
873
- - name: operator_loc
874
- type: location
875
- - name: value
876
- type: node
877
- - name: operator
878
- type: constant
879
- comment: |
880
- Represents assigning to a constant path using an operator that isn't `=`.
881
-
882
- Parent::Child += value
883
- ^^^^^^^^^^^^^^^^^^^^^^
884
771
  - name: ConstantPathWriteNode
885
772
  child_nodes:
886
773
  - name: target
@@ -929,7 +816,7 @@ nodes:
929
816
  - name: parameters
930
817
  type: node?
931
818
  kind: ParametersNode
932
- - name: statements
819
+ - name: body
933
820
  type: node?
934
821
  - name: locals
935
822
  type: constant[]
@@ -1123,47 +1010,6 @@ nodes:
1123
1010
 
1124
1011
  super
1125
1012
  ^^^^^
1126
- - name: GlobalVariableOperatorAndWriteNode
1127
- child_nodes:
1128
- - name: name_loc
1129
- type: location
1130
- - name: operator_loc
1131
- type: location
1132
- - name: value
1133
- type: node
1134
- comment: |
1135
- Represents the use of the `&&=` operator for assignment to a global variable.
1136
-
1137
- $target &&= value
1138
- ^^^^^^^^^^^^^^^^^
1139
- - name: GlobalVariableOperatorOrWriteNode
1140
- child_nodes:
1141
- - name: name_loc
1142
- type: location
1143
- - name: operator_loc
1144
- type: location
1145
- - name: value
1146
- type: node
1147
- comment: |
1148
- Represents the use of the `||=` operator for assignment to a global variable.
1149
-
1150
- $target ||= value
1151
- ^^^^^^^^^^^^^^^^^
1152
- - name: GlobalVariableOperatorWriteNode
1153
- child_nodes:
1154
- - name: name_loc
1155
- type: location
1156
- - name: operator_loc
1157
- type: location
1158
- - name: value
1159
- type: node
1160
- - name: operator
1161
- type: constant
1162
- comment: |
1163
- Represents assigning to a global variable using an operator that isn't `=`.
1164
-
1165
- $target += value
1166
- ^^^^^^^^^^^^^^^^
1167
1013
  - name: GlobalVariableReadNode
1168
1014
  comment: |
1169
1015
  Represents referencing a global variable.
@@ -1263,47 +1109,6 @@ nodes:
1263
1109
 
1264
1110
  case a; in b then c end
1265
1111
  ^^^^^^^^^^^
1266
- - name: InstanceVariableOperatorAndWriteNode
1267
- child_nodes:
1268
- - name: name_loc
1269
- type: location
1270
- - name: operator_loc
1271
- type: location
1272
- - name: value
1273
- type: node
1274
- comment: |
1275
- Represents the use of the `&&=` operator for assignment to an instance variable.
1276
-
1277
- @target &&= value
1278
- ^^^^^^^^^^^^^^^^^
1279
- - name: InstanceVariableOperatorOrWriteNode
1280
- child_nodes:
1281
- - name: name_loc
1282
- type: location
1283
- - name: operator_loc
1284
- type: location
1285
- - name: value
1286
- type: node
1287
- comment: |
1288
- Represents the use of the `||=` operator for assignment to an instance variable.
1289
-
1290
- @target ||= value
1291
- ^^^^^^^^^^^^^^^^^
1292
- - name: InstanceVariableOperatorWriteNode
1293
- child_nodes:
1294
- - name: name_loc
1295
- type: location
1296
- - name: operator_loc
1297
- type: location
1298
- - name: value
1299
- type: node
1300
- - name: operator
1301
- type: constant
1302
- comment: |
1303
- Represents assigning to an instance variable using an operator that isn't `=`.
1304
-
1305
- @target += value
1306
- ^^^^^^^^^^^^^^^^
1307
1112
  - name: InstanceVariableReadNode
1308
1113
  comment: |
1309
1114
  Represents referencing an instance variable.
@@ -1434,60 +1239,13 @@ nodes:
1434
1239
  - name: parameters
1435
1240
  type: node?
1436
1241
  kind: BlockParametersNode
1437
- - name: statements
1242
+ - name: body
1438
1243
  type: node?
1439
1244
  comment: |
1440
1245
  Represents using a lambda literal (not the lambda method call).
1441
1246
 
1442
1247
  ->(value) { value * 2 }
1443
1248
  ^^^^^^^^^^^^^^^^^^^^^^^
1444
- - name: LocalVariableOperatorAndWriteNode
1445
- child_nodes:
1446
- - name: name_loc
1447
- type: location
1448
- - name: operator_loc
1449
- type: location
1450
- - name: value
1451
- type: node
1452
- - name: constant_id
1453
- type: constant
1454
- comment: |
1455
- Represents the use of the `&&=` operator for assignment to a local variable.
1456
-
1457
- target &&= value
1458
- ^^^^^^^^^^^^^^^^
1459
- - name: LocalVariableOperatorOrWriteNode
1460
- child_nodes:
1461
- - name: name_loc
1462
- type: location
1463
- - name: operator_loc
1464
- type: location
1465
- - name: value
1466
- type: node
1467
- - name: constant_id
1468
- type: constant
1469
- comment: |
1470
- Represents the use of the `||=` operator for assignment to a local variable.
1471
-
1472
- target ||= value
1473
- ^^^^^^^^^^^^^^^^
1474
- - name: LocalVariableOperatorWriteNode
1475
- child_nodes:
1476
- - name: name_loc
1477
- type: location
1478
- - name: operator_loc
1479
- type: location
1480
- - name: value
1481
- type: node
1482
- - name: constant_id
1483
- type: constant
1484
- - name: operator_id
1485
- type: constant
1486
- comment: |
1487
- Represents assigning to a local variable using an operator that isn't `=`.
1488
-
1489
- target += value
1490
- ^^^^^^^^^^^^^^^
1491
1249
  - name: LocalVariableReadNode
1492
1250
  child_nodes:
1493
1251
  - name: constant_id
@@ -1556,7 +1314,7 @@ nodes:
1556
1314
  type: location
1557
1315
  - name: constant_path
1558
1316
  type: node
1559
- - name: statements
1317
+ - name: body
1560
1318
  type: node?
1561
1319
  - name: end_keyword_loc
1562
1320
  type: location
@@ -1618,6 +1376,21 @@ nodes:
1618
1376
 
1619
1377
  $1
1620
1378
  ^^
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
+ ^^^^^^^^^^^^^^^
1621
1394
  - name: OptionalParameterNode
1622
1395
  child_nodes:
1623
1396
  - name: constant_id
@@ -1647,6 +1420,19 @@ nodes:
1647
1420
 
1648
1421
  left or right
1649
1422
  ^^^^^^^^^^^^^
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
+ ^^^^^^^^^^^^^^^^
1650
1436
  - name: ParametersNode
1651
1437
  child_nodes:
1652
1438
  - name: requireds
@@ -1673,7 +1459,7 @@ nodes:
1673
1459
  end
1674
1460
  - name: ParenthesesNode
1675
1461
  child_nodes:
1676
- - name: statements
1462
+ - name: body
1677
1463
  type: node?
1678
1464
  - name: opening_loc
1679
1465
  type: location
@@ -1916,7 +1702,7 @@ nodes:
1916
1702
  type: location
1917
1703
  - name: expression
1918
1704
  type: node
1919
- - name: statements
1705
+ - name: body
1920
1706
  type: node?
1921
1707
  - name: end_keyword_loc
1922
1708
  type: location
@@ -1932,7 +1718,6 @@ nodes:
1932
1718
  __ENCODING__
1933
1719
  ^^^^^^^^^^^^
1934
1720
  - name: SourceFileNode
1935
- is_migrated: true
1936
1721
  child_nodes:
1937
1722
  - name: filepath
1938
1723
  type: string
@@ -2111,10 +1896,12 @@ nodes:
2111
1896
  type: node?
2112
1897
  kind: StatementsNode
2113
1898
  comment: |
2114
- case true
2115
- when true
2116
- ^^^^^^^^^
2117
- end
1899
+ Represents the use of the `when` keyword within a case statement.
1900
+
1901
+ case true
1902
+ when true
1903
+ ^^^^^^^^^
1904
+ end
2118
1905
  - name: WhileNode
2119
1906
  child_nodes:
2120
1907
  - name: keyword_loc