authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-04-01 14:22:29+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-04-01 14:22:29+02:00
log381dc2d9509ffeaf60a1775ee0983c7dd1b9e346
tree34dc901cf638a113cd7bf84d90125b9c64685b3d
parent575a98a0813181c268e86d590b6267583736bafd
parenta0a854b1fc5e64a07b2026ac0668f8d417ab6bf1
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #15139 from ziglang/macos-13-fixes

Fixes for latest macOS 13.3 SDK release

7 files changed, 1960 insertions(+), 1794 deletions(-)

lib/libc/darwin/libSystem.13.tbd+207-672
...@@ -2,21 +2,8 @@...@@ -2,21 +2,8 @@
2tbd-version: 42tbd-version: 4
3targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
4 arm64e-macos, arm64e-maccatalyst ]4 arm64e-macos, arm64e-maccatalyst ]
5uuids:
6 - target: x86_64-macos
7 value: 085E3D5D-7871-3E9E-A097-AAD940171411
8 - target: x86_64-maccatalyst
9 value: 085E3D5D-7871-3E9E-A097-AAD940171411
10 - target: arm64-macos
11 value: 00000000-0000-0000-0000-000000000000
12 - target: arm64-maccatalyst
13 value: 00000000-0000-0000-0000-000000000000
14 - target: arm64e-macos
15 value: B54723A8-A25C-3D6C-A51B-2B8BBA733DD3
16 - target: arm64e-maccatalyst
17 value: B54723A8-A25C-3D6C-A51B-2B8BBA733DD3
18install-name: '/usr/lib/libSystem.B.dylib'5install-name: '/usr/lib/libSystem.B.dylib'
19current-version: 13196current-version: 1319.100.3
20reexported-libraries:7reexported-libraries:
21 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 8 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
22 arm64e-macos, arm64e-maccatalyst ]9 arm64e-macos, arm64e-maccatalyst ]
...@@ -57,21 +44,8 @@ exports:...@@ -57,21 +44,8 @@ exports:
57tbd-version: 444tbd-version: 4
58targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 45targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
59 arm64e-macos, arm64e-maccatalyst ]46 arm64e-macos, arm64e-maccatalyst ]
60uuids:
61 - target: x86_64-macos
62 value: A7D96CB6-7562-3C14-8B54-ED5E484B54E2
63 - target: x86_64-maccatalyst
64 value: A7D96CB6-7562-3C14-8B54-ED5E484B54E2
65 - target: arm64-macos
66 value: 00000000-0000-0000-0000-000000000000
67 - target: arm64-maccatalyst
68 value: 00000000-0000-0000-0000-000000000000
69 - target: arm64e-macos
70 value: 7A88909B-ED36-360D-ACE9-81107AF0FE14
71 - target: arm64e-maccatalyst
72 value: 7A88909B-ED36-360D-ACE9-81107AF0FE14
73install-name: '/usr/lib/system/libcache.dylib'47install-name: '/usr/lib/system/libcache.dylib'
74current-version: 9048current-version: 92
75parent-umbrella:49parent-umbrella:
76 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 50 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
77 arm64e-macos, arm64e-maccatalyst ]51 arm64e-macos, arm64e-maccatalyst ]
...@@ -95,21 +69,8 @@ exports:...@@ -95,21 +69,8 @@ exports:
95tbd-version: 469tbd-version: 4
96targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 70targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
97 arm64e-macos, arm64e-maccatalyst ]71 arm64e-macos, arm64e-maccatalyst ]
98uuids:
99 - target: x86_64-macos
100 value: 6E120635-E858-30FE-95F6-64D90E33095D
101 - target: x86_64-maccatalyst
102 value: 6E120635-E858-30FE-95F6-64D90E33095D
103 - target: arm64-macos
104 value: 00000000-0000-0000-0000-000000000000
105 - target: arm64-maccatalyst
106 value: 00000000-0000-0000-0000-000000000000
107 - target: arm64e-macos
108 value: 452A7C15-97FA-32A0-B514-744E117E2B39
109 - target: arm64e-maccatalyst
110 value: 452A7C15-97FA-32A0-B514-744E117E2B39
111install-name: '/usr/lib/system/libcommonCrypto.dylib'72install-name: '/usr/lib/system/libcommonCrypto.dylib'
112current-version: 60198.60.273current-version: 65535.100.4
113parent-umbrella:74parent-umbrella:
114 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 75 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
115 arm64e-macos, arm64e-maccatalyst ]76 arm64e-macos, arm64e-maccatalyst ]
...@@ -189,13 +150,6 @@ exports:...@@ -189,13 +150,6 @@ exports:
189--- !tapi-tbd150--- !tapi-tbd
190tbd-version: 4151tbd-version: 4
191targets: [ x86_64-macos, arm64-macos, arm64e-macos ]152targets: [ x86_64-macos, arm64-macos, arm64e-macos ]
192uuids:
193 - target: x86_64-macos
194 value: E9412018-811C-36B7-9F58-6471398EE465
195 - target: arm64-macos
196 value: 954CFCC0-97A8-329B-B5AA-FF9046F3E94F
197 - target: arm64e-macos
198 value: 9F57BC0A-3F18-3F00-B772-40B6A8616E26
199install-name: '/usr/lib/system/libcompiler_rt.dylib'153install-name: '/usr/lib/system/libcompiler_rt.dylib'
200current-version: 103.1154current-version: 103.1
201parent-umbrella:155parent-umbrella:
...@@ -424,19 +378,6 @@ exports:...@@ -424,19 +378,6 @@ exports:
424tbd-version: 4378tbd-version: 4
425targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 379targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
426 arm64e-macos, arm64e-maccatalyst ]380 arm64e-macos, arm64e-maccatalyst ]
427uuids:
428 - target: x86_64-macos
429 value: F92F30BA-35BE-3ED9-B562-FBEC1B7089B5
430 - target: x86_64-maccatalyst
431 value: F92F30BA-35BE-3ED9-B562-FBEC1B7089B5
432 - target: arm64-macos
433 value: 00000000-0000-0000-0000-000000000000
434 - target: arm64-maccatalyst
435 value: 00000000-0000-0000-0000-000000000000
436 - target: arm64e-macos
437 value: 3689048E-9EC2-32D9-B833-B5EDE2839092
438 - target: arm64e-maccatalyst
439 value: 3689048E-9EC2-32D9-B833-B5EDE2839092
440install-name: '/usr/lib/system/libcopyfile.dylib'381install-name: '/usr/lib/system/libcopyfile.dylib'
441parent-umbrella:382parent-umbrella:
442 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 383 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -452,21 +393,8 @@ exports:...@@ -452,21 +393,8 @@ exports:
452tbd-version: 4393tbd-version: 4
453targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 394targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
454 arm64e-macos, arm64e-maccatalyst ]395 arm64e-macos, arm64e-maccatalyst ]
455uuids:
456 - target: x86_64-macos
457 value: 1A8A8D34-268F-3D42-936A-8A0029817E22
458 - target: x86_64-maccatalyst
459 value: 1A8A8D34-268F-3D42-936A-8A0029817E22
460 - target: arm64-macos
461 value: 00000000-0000-0000-0000-000000000000
462 - target: arm64-maccatalyst
463 value: 00000000-0000-0000-0000-000000000000
464 - target: arm64e-macos
465 value: E32C0A9B-EDD0-376D-A504-A06C215E89FE
466 - target: arm64e-maccatalyst
467 value: E32C0A9B-EDD0-376D-A504-A06C215E89FE
468install-name: '/usr/lib/system/libcorecrypto.dylib'396install-name: '/usr/lib/system/libcorecrypto.dylib'
469current-version: 1386.60.8397current-version: 1387.100.43
470parent-umbrella:398parent-umbrella:
471 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 399 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
472 arm64e-macos, arm64e-maccatalyst ]400 arm64e-macos, arm64e-maccatalyst ]
...@@ -766,21 +694,8 @@ exports:...@@ -766,21 +694,8 @@ exports:
766tbd-version: 4694tbd-version: 4
767targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 695targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
768 arm64e-macos, arm64e-maccatalyst ]696 arm64e-macos, arm64e-maccatalyst ]
769uuids:
770 - target: x86_64-macos
771 value: 6282E528-6A67-334B-ACCF-1F8FD89369BD
772 - target: x86_64-maccatalyst
773 value: 6282E528-6A67-334B-ACCF-1F8FD89369BD
774 - target: arm64-macos
775 value: 00000000-0000-0000-0000-000000000000
776 - target: arm64-maccatalyst
777 value: 00000000-0000-0000-0000-000000000000
778 - target: arm64e-macos
779 value: 191028D2-0477-3EBC-9EEF-A85ACAFC7193
780 - target: arm64e-maccatalyst
781 value: 191028D2-0477-3EBC-9EEF-A85ACAFC7193
782install-name: '/usr/lib/system/libdispatch.dylib'697install-name: '/usr/lib/system/libdispatch.dylib'
783current-version: 1412698current-version: 1415.100.11
784parent-umbrella:699parent-umbrella:
785 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 700 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
786 arm64e-macos, arm64e-maccatalyst ]701 arm64e-macos, arm64e-maccatalyst ]
...@@ -942,19 +857,6 @@ exports:...@@ -942,19 +857,6 @@ exports:
942tbd-version: 4857tbd-version: 4
943targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 858targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
944 arm64e-macos, arm64e-maccatalyst ]859 arm64e-macos, arm64e-maccatalyst ]
945uuids:
946 - target: x86_64-macos
947 value: 6F97B8FD-BA81-3779-ADB2-5ECD91F42B75
948 - target: x86_64-maccatalyst
949 value: 6F97B8FD-BA81-3779-ADB2-5ECD91F42B75
950 - target: arm64-macos
951 value: 427D321B-B30E-367F-8E2C-1DA6FD2D0962
952 - target: arm64-maccatalyst
953 value: 427D321B-B30E-367F-8E2C-1DA6FD2D0962
954 - target: arm64e-macos
955 value: C1700833-CCA0-3BA5-8614-C149347F5503
956 - target: arm64e-maccatalyst
957 value: C1700833-CCA0-3BA5-8614-C149347F5503
958install-name: '/usr/lib/system/libdyld.dylib'860install-name: '/usr/lib/system/libdyld.dylib'
959parent-umbrella:861parent-umbrella:
960 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 862 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -1040,19 +942,6 @@ exports:...@@ -1040,19 +942,6 @@ exports:
1040tbd-version: 4942tbd-version: 4
1041targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 943targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1042 arm64e-macos, arm64e-maccatalyst ]944 arm64e-macos, arm64e-maccatalyst ]
1043uuids:
1044 - target: x86_64-macos
1045 value: 4C623CBE-6FF4-3731-A647-6EEF7A6F51C7
1046 - target: x86_64-maccatalyst
1047 value: 4C623CBE-6FF4-3731-A647-6EEF7A6F51C7
1048 - target: arm64-macos
1049 value: 00000000-0000-0000-0000-000000000000
1050 - target: arm64-maccatalyst
1051 value: 00000000-0000-0000-0000-000000000000
1052 - target: arm64e-macos
1053 value: B63E11DD-4648-3355-A51C-C1B650654C0F
1054 - target: arm64e-maccatalyst
1055 value: B63E11DD-4648-3355-A51C-C1B650654C0F
1056install-name: '/usr/lib/system/libkeymgr.dylib'945install-name: '/usr/lib/system/libkeymgr.dylib'
1057current-version: 31946current-version: 31
1058parent-umbrella:947parent-umbrella:
...@@ -1070,21 +959,8 @@ exports:...@@ -1070,21 +959,8 @@ exports:
1070--- !tapi-tbd959--- !tapi-tbd
1071tbd-version: 4960tbd-version: 4
1072targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64e-macos ]961targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64e-macos ]
1073uuids:
1074 - target: x86_64-macos
1075 value: 632C478C-AAF6-3330-AA8E-0D0FCA4C6237
1076 - target: x86_64-maccatalyst
1077 value: 632C478C-AAF6-3330-AA8E-0D0FCA4C6237
1078 - target: arm64-macos
1079 value: F71DA09E-609F-3C9A-95BF-22B22CFAD5A5
1080 - target: arm64-maccatalyst
1081 value: F71DA09E-609F-3C9A-95BF-22B22CFAD5A5
1082 - target: arm64e-macos
1083 value: 471DA066-B65F-36B1-93B7-243C71F8838B
1084 - target: arm64e-maccatalyst
1085 value: 471DA066-B65F-36B1-93B7-243C71F8838B
1086install-name: '/usr/lib/system/libmacho.dylib'962install-name: '/usr/lib/system/libmacho.dylib'
1087current-version: 1001.2963current-version: 1005
1088parent-umbrella:964parent-umbrella:
1089 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64e-macos ]965 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64e-macos ]
1090 umbrella: System966 umbrella: System
...@@ -1130,21 +1006,8 @@ exports:...@@ -1130,21 +1006,8 @@ exports:
1130tbd-version: 41006tbd-version: 4
1131targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1007targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1132 arm64e-macos, arm64e-maccatalyst ]1008 arm64e-macos, arm64e-maccatalyst ]
1133uuids:
1134 - target: x86_64-macos
1135 value: 9C3DCECF-ED9C-3F0F-9E9C-28DC842D4D65
1136 - target: x86_64-maccatalyst
1137 value: 9C3DCECF-ED9C-3F0F-9E9C-28DC842D4D65
1138 - target: arm64-macos
1139 value: 00000000-0000-0000-0000-000000000000
1140 - target: arm64-maccatalyst
1141 value: 00000000-0000-0000-0000-000000000000
1142 - target: arm64e-macos
1143 value: A052DB52-9ECA-39EC-8DD4-05A0856579B7
1144 - target: arm64e-maccatalyst
1145 value: A052DB52-9ECA-39EC-8DD4-05A0856579B7
1146install-name: '/usr/lib/system/libquarantine.dylib'1009install-name: '/usr/lib/system/libquarantine.dylib'
1147current-version: 146.60.21010current-version: 147.100.8
1148parent-umbrella:1011parent-umbrella:
1149 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1012 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1150 arm64e-macos, arm64e-maccatalyst ]1013 arm64e-macos, arm64e-maccatalyst ]
...@@ -1188,21 +1051,8 @@ exports:...@@ -1188,21 +1051,8 @@ exports:
1188tbd-version: 41051tbd-version: 4
1189targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1052targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1190 arm64e-macos, arm64e-maccatalyst ]1053 arm64e-macos, arm64e-maccatalyst ]
1191uuids:
1192 - target: x86_64-macos
1193 value: A7C519E4-A2A5-33E1-B9D6-52951921392F
1194 - target: x86_64-maccatalyst
1195 value: A7C519E4-A2A5-33E1-B9D6-52951921392F
1196 - target: arm64-macos
1197 value: 00000000-0000-0000-0000-000000000000
1198 - target: arm64-maccatalyst
1199 value: 00000000-0000-0000-0000-000000000000
1200 - target: arm64e-macos
1201 value: E785FBDF-82C9-3642-A38D-EDB07D118303
1202 - target: arm64e-maccatalyst
1203 value: E785FBDF-82C9-3642-A38D-EDB07D118303
1204install-name: '/usr/lib/system/libremovefile.dylib'1054install-name: '/usr/lib/system/libremovefile.dylib'
1205current-version: 631055current-version: 68
1206parent-umbrella:1056parent-umbrella:
1207 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1057 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1208 arm64e-macos, arm64e-maccatalyst ]1058 arm64e-macos, arm64e-maccatalyst ]
...@@ -1219,19 +1069,6 @@ exports:...@@ -1219,19 +1069,6 @@ exports:
1219tbd-version: 41069tbd-version: 4
1220targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1070targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1221 arm64e-macos, arm64e-maccatalyst ]1071 arm64e-macos, arm64e-maccatalyst ]
1222uuids:
1223 - target: x86_64-macos
1224 value: D32DFE04-D5D4-3BD7-B9B5-9ED721B993EE
1225 - target: x86_64-maccatalyst
1226 value: D32DFE04-D5D4-3BD7-B9B5-9ED721B993EE
1227 - target: arm64-macos
1228 value: 00000000-0000-0000-0000-000000000000
1229 - target: arm64-maccatalyst
1230 value: 00000000-0000-0000-0000-000000000000
1231 - target: arm64e-macos
1232 value: 1E8F925A-501E-32BD-9BE3-2EE5FDEA8818
1233 - target: arm64e-maccatalyst
1234 value: 1E8F925A-501E-32BD-9BE3-2EE5FDEA8818
1235install-name: '/usr/lib/system/libsystem_asl.dylib'1072install-name: '/usr/lib/system/libsystem_asl.dylib'
1236current-version: 3951073current-version: 395
1237parent-umbrella:1074parent-umbrella:
...@@ -1313,21 +1150,8 @@ exports:...@@ -1313,21 +1150,8 @@ exports:
1313tbd-version: 41150tbd-version: 4
1314targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1151targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1315 arm64e-macos, arm64e-maccatalyst ]1152 arm64e-macos, arm64e-maccatalyst ]
1316uuids:
1317 - target: x86_64-macos
1318 value: 942C1938-B1BC-3B74-912C-D7E7E2B6DC72
1319 - target: x86_64-maccatalyst
1320 value: 942C1938-B1BC-3B74-912C-D7E7E2B6DC72
1321 - target: arm64-macos
1322 value: 00000000-0000-0000-0000-000000000000
1323 - target: arm64-maccatalyst
1324 value: 00000000-0000-0000-0000-000000000000
1325 - target: arm64e-macos
1326 value: B126606C-8D07-3F9D-AD5E-9864CF11D901
1327 - target: arm64e-maccatalyst
1328 value: B126606C-8D07-3F9D-AD5E-9864CF11D901
1329install-name: '/usr/lib/system/libsystem_blocks.dylib'1153install-name: '/usr/lib/system/libsystem_blocks.dylib'
1330current-version: 841154current-version: 87
1331parent-umbrella:1155parent-umbrella:
1332 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1156 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1333 arm64e-macos, arm64e-maccatalyst ]1157 arm64e-macos, arm64e-maccatalyst ]
...@@ -1345,38 +1169,25 @@ exports:...@@ -1345,38 +1169,25 @@ exports:
1345tbd-version: 41169tbd-version: 4
1346targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1170targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1347 arm64e-macos, arm64e-maccatalyst ]1171 arm64e-macos, arm64e-maccatalyst ]
1348uuids:
1349 - target: x86_64-macos
1350 value: 376F7CB7-6DD2-3E00-976F-77DD755BDB0D
1351 - target: x86_64-maccatalyst
1352 value: 376F7CB7-6DD2-3E00-976F-77DD755BDB0D
1353 - target: arm64-macos
1354 value: 00000000-0000-0000-0000-000000000000
1355 - target: arm64-maccatalyst
1356 value: 00000000-0000-0000-0000-000000000000
1357 - target: arm64e-macos
1358 value: 756CD0D2-3241-3A74-8C59-02632DCEE221
1359 - target: arm64e-maccatalyst
1360 value: 756CD0D2-3241-3A74-8C59-02632DCEE221
1361install-name: '/usr/lib/system/libsystem_c.dylib'1172install-name: '/usr/lib/system/libsystem_c.dylib'
1362current-version: 1534.40.21173current-version: 1534.100.14
1363parent-umbrella:1174parent-umbrella:
1364 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1175 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1365 arm64e-macos, arm64e-maccatalyst ]1176 arm64e-macos, arm64e-maccatalyst ]
1366 umbrella: System1177 umbrella: System
1367exports:1178exports:
1368 - targets: [ x86_64-macos, x86_64-maccatalyst ]1179 - targets: [ x86_64-macos, x86_64-maccatalyst ]
1369 symbols: [ '___opendir2$INODE64', ___strtopx, '__readdir_unlocked$INODE64', 1180 symbols: [ '___opendir2$INODE64', '__readdir_unlocked$INODE64', '__seekdir$INODE64',
1370 '__seekdir$INODE64', '_alphasort$INODE64', '_daemon$1050', 1181 '_alphasort$INODE64', '_daemon$1050', '_fdopendir$INODE64',
1371 '_fdopendir$INODE64', _fstatx64_np, '_fstatx_np$INODE64', 1182 _fstatx64_np, '_fstatx_np$INODE64', '_fts_children$INODE64',
1372 '_fts_children$INODE64', '_fts_close$INODE64', '_fts_open$INODE64', 1183 '_fts_close$INODE64', '_fts_open$INODE64', '_fts_open_b$INODE64',
1373 '_fts_open_b$INODE64', '_fts_read$INODE64', '_fts_set$INODE64', 1184 '_fts_read$INODE64', '_fts_set$INODE64', '_ftw$INODE64', '_getmntinfo$INODE64',
1374 '_ftw$INODE64', '_getmntinfo$INODE64', _getmntinfo64, '_getmntinfo_r_np$INODE64', 1185 _getmntinfo64, '_getmntinfo_r_np$INODE64', '_glob$INODE64',
1375 '_glob$INODE64', '_glob_b$INODE64', _lstatx64_np, '_lstatx_np$INODE64', 1186 '_glob_b$INODE64', _lstatx64_np, '_lstatx_np$INODE64', '_nftw$INODE64',
1376 '_nftw$INODE64', '_opendir$INODE64', '_readdir$INODE64', '_readdir_r$INODE64', 1187 '_opendir$INODE64', '_readdir$INODE64', '_readdir_r$INODE64',
1377 '_rewinddir$INODE64', '_scandir$INODE64', '_scandir_b$INODE64', 1188 '_rewinddir$INODE64', '_scandir$INODE64', '_scandir_b$INODE64',
1378 '_seekdir$INODE64', _statx64_np, '_statx_np$INODE64', '_telldir$INODE64', 1189 '_seekdir$INODE64', _statx64_np, '_statx_np$INODE64', _strtoencf80_l,
1379 mcount ]1190 '_telldir$INODE64', mcount ]
1380 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1191 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1381 arm64e-macos, arm64e-maccatalyst ]1192 arm64e-macos, arm64e-maccatalyst ]
1382 symbols: [ '$ld$weak$os10.11$_basename_r', '$ld$weak$os10.11$_clock_getres', 1193 symbols: [ '$ld$weak$os10.11$_basename_r', '$ld$weak$os10.11$_clock_getres',
...@@ -1387,26 +1198,24 @@ exports:...@@ -1387,26 +1198,24 @@ exports:
1387 __CurrentRuneLocale, __DefaultRuneLocale, __Exit, __NSGetArgc, 1198 __CurrentRuneLocale, __DefaultRuneLocale, __Exit, __NSGetArgc,
1388 __NSGetArgv, __NSGetEnviron, __NSGetMachExecuteHeader, __NSGetProgname, 1199 __NSGetArgv, __NSGetEnviron, __NSGetMachExecuteHeader, __NSGetProgname,
1389 __PathLocale, __Read_RuneMagi, ___Balloc_D2A, ___Bfree_D2A, 1200 __PathLocale, __Read_RuneMagi, ___Balloc_D2A, ___Bfree_D2A,
1390 ___ULtod_D2A, ____mb_cur_max, ____mb_cur_max_l, ____runetype, 1201 ____mb_cur_max, ____mb_cur_max_l, ____runetype, ____runetype_l,
1391 ____runetype_l, ____tolower, ____tolower_l, ____toupper, ____toupper_l, 1202 ____tolower, ____tolower_l, ____toupper, ____toupper_l, ___add_ovflpage,
1392 ___add_ovflpage, ___addel, ___any_on_D2A, ___assert_rtn, ___b2d_D2A, 1203 ___addel, ___any_on_D2A, ___assert_rtn, ___b2d_D2A, ___big_delete,
1393 ___big_delete, ___big_insert, ___big_keydata, ___big_return, 1204 ___big_insert, ___big_keydata, ___big_return, ___big_split,
1394 ___big_split, ___bigtens_D2A, ___bt_close, ___bt_cmp, ___bt_defcmp, 1205 ___bigtens_D2A, ___bt_close, ___bt_cmp, ___bt_defcmp, ___bt_defpfx,
1395 ___bt_defpfx, ___bt_delete, ___bt_dleaf, ___bt_fd, ___bt_free, 1206 ___bt_delete, ___bt_dleaf, ___bt_fd, ___bt_free, ___bt_get,
1396 ___bt_get, ___bt_new, ___bt_open, ___bt_pgin, ___bt_pgout, 1207 ___bt_new, ___bt_open, ___bt_pgin, ___bt_pgout, ___bt_put,
1397 ___bt_put, ___bt_ret, ___bt_search, ___bt_seq, ___bt_setcur, 1208 ___bt_ret, ___bt_search, ___bt_seq, ___bt_setcur, ___bt_split,
1398 ___bt_split, ___bt_sync, ___buf_free, ___call_hash, ___cleanup, 1209 ___bt_sync, ___buf_free, ___call_hash, ___cleanup, ___cmp_D2A,
1399 ___cmp_D2A, ___collate_equiv_match, ___collate_load_error, 1210 ___collate_equiv_match, ___collate_load_error, ___collate_lookup,
1400 ___collate_lookup, ___collate_lookup_l, ___copybits_D2A, ___cxa_atexit, 1211 ___collate_lookup_l, ___copybits_D2A, ___cxa_atexit, ___cxa_finalize,
1401 ___cxa_finalize, ___cxa_finalize_ranges, ___cxa_thread_atexit, 1212 ___cxa_finalize_ranges, ___cxa_thread_atexit, ___d2b_D2A,
1402 ___d2b_D2A, ___dbpanic, ___decrement_D2A, ___default_hash, 1213 ___dbpanic, ___default_hash, ___default_utx, ___delpair, ___diff_D2A,
1403 ___default_utx, ___delpair, ___diff_D2A, ___dtoa, ___expand_table, 1214 ___dtoa, ___expand_table, ___fflush, ___fgetwc, ___find_bigpair,
1404 ___fflush, ___fgetwc, ___find_bigpair, ___find_last_page, 1215 ___find_last_page, ___fix_locale_grouping_str, ___fread, ___free_ovflpage,
1405 ___fix_locale_grouping_str, ___fread, ___free_ovflpage, ___freedtoa, 1216 ___freedtoa, ___gdtoa, ___gdtoa_locks, ___get_buf, ___get_page,
1406 ___gdtoa, ___gdtoa_locks, ___get_buf, ___get_page, ___gethex_D2A, 1217 ___getonlyClocaleconv, ___hash_open, ___hdtoa, ___hi0bits_D2A,
1407 ___getonlyClocaleconv, ___hash_open, ___hdtoa, ___hexdig_D2A, 1218 ___hldtoa, ___i2b_D2A, ___ibitmap, ___isctype, ___istype,
1408 ___hexdig_init_D2A, ___hexnan_D2A, ___hi0bits_D2A, ___hldtoa,
1409 ___i2b_D2A, ___ibitmap, ___increment_D2A, ___isctype, ___istype,
1410 ___istype_l, ___ldtoa, ___libc_init, ___lo0bits_D2A, ___log2, 1219 ___istype_l, ___ldtoa, ___libc_init, ___lo0bits_D2A, ___log2,
1411 ___lshift_D2A, ___maskrune, ___maskrune_l, ___match_D2A, ___mb_cur_max, 1220 ___lshift_D2A, ___maskrune, ___maskrune_l, ___match_D2A, ___mb_cur_max,
1412 ___mb_sb_limit, ___memccpy_chk, ___memcpy_chk, ___memmove_chk, 1221 ___mb_sb_limit, ___memccpy_chk, ___memcpy_chk, ___memmove_chk,
...@@ -1417,53 +1226,54 @@ exports:...@@ -1417,53 +1226,54 @@ exports:
1417 ___rec_iput, ___rec_open, ___rec_put, ___rec_ret, ___rec_search, 1226 ___rec_iput, ___rec_open, ___rec_put, ___rec_ret, ___rec_search,
1418 ___rec_seq, ___rec_sync, ___rec_vmap, ___rec_vpipe, ___reclaim_buf, 1227 ___rec_seq, ___rec_sync, ___rec_vmap, ___rec_vpipe, ___reclaim_buf,
1419 ___rshift_D2A, ___rv_alloc_D2A, ___s2b_D2A, ___sF, ___sclose, 1228 ___rshift_D2A, ___rv_alloc_D2A, ___s2b_D2A, ___sF, ___sclose,
1420 ___sdidinit, ___set_ones_D2A, ___setonlyClocaleconv, ___sflags, 1229 ___sdidinit, ___setonlyClocaleconv, ___sflags, ___sflush,
1421 ___sflush, ___sfp, ___sfvwrite, ___sglue, ___sinit, ___slbexpand, 1230 ___sfp, ___sfvwrite, ___sglue, ___sinit, ___slbexpand, ___smakebuf,
1422 ___smakebuf, ___snprintf_chk, ___snprintf_object_size_chk, 1231 ___snprintf_chk, ___snprintf_object_size_chk, ___split_page,
1423 ___split_page, ___sprintf_chk, ___sprintf_object_size_chk, 1232 ___sprintf_chk, ___sprintf_object_size_chk, ___sread, ___srefill,
1424 ___sread, ___srefill, ___srget, ___sseek, ___stack_chk_fail, 1233 ___srget, ___sseek, ___stack_chk_fail, ___stack_chk_guard,
1425 ___stack_chk_guard, ___stderrp, ___stdinp, ___stdoutp, ___stpcpy_chk, 1234 ___stderrp, ___stdinp, ___stdoutp, ___stpcpy_chk, ___stpncpy_chk,
1426 ___stpncpy_chk, ___strcat_chk, ___strcp_D2A, ___strcpy_chk, 1235 ___strcat_chk, ___strcp_D2A, ___strcpy_chk, ___strlcat_chk,
1427 ___strlcat_chk, ___strlcpy_chk, ___strncat_chk, ___strncpy_chk, 1236 ___strlcpy_chk, ___strncat_chk, ___strncpy_chk, ___sum_D2A,
1428 ___strtodg, ___strtopdd, ___sum_D2A, ___svfscanf, ___swbuf, 1237 ___svfscanf, ___swbuf, ___swhatbuf, ___swrite, ___swsetup,
1429 ___swhatbuf, ___swrite, ___swsetup, ___tens_D2A, ___tinytens_D2A, 1238 ___tens_D2A, ___tinytens_D2A, ___tolower, ___tolower_l, ___toupper,
1430 ___tolower, ___tolower_l, ___toupper, ___toupper_l, ___trailz_D2A, 1239 ___toupper_l, ___trailz_D2A, ___ulp_D2A, ___ungetc, ___ungetwc,
1431 ___ulp_D2A, ___ungetc, ___ungetwc, ___vsnprintf_chk, ___vsprintf_chk, 1240 ___vsnprintf_chk, ___vsprintf_chk, ___wcwidth, ___wcwidth_l,
1432 ___wcwidth, ___wcwidth_l, __allocenvstate, __atexit_receipt, 1241 __allocenvstate, __atexit_receipt, __c_locale, __cleanup,
1433 __c_locale, __cleanup, __closeutx, __copyenv, __cthread_init_routine, 1242 __closeutx, __copyenv, __cthread_init_routine, __deallocenvstate,
1434 __deallocenvstate, __endutxent, __flockfile_debug_stub, __fseeko, 1243 __endutxent, __flockfile_debug_stub, __fseeko, __ftello, __fwalk,
1435 __ftello, __fwalk, __getenvp, __getutxent, __getutxid, __getutxline, 1244 __getenvp, __getutxent, __getutxid, __getutxline, __inet_aton_check,
1436 __inet_aton_check, __init_clock_port, __int_to_time, __libc_fork_child, 1245 __init_clock_port, __int_to_time, __libc_fork_child, __libc_fork_parent,
1437 __libc_initializer, __long_to_time, __mkpath_np, __mktemp, 1246 __libc_fork_prepare, __libc_initializer, __long_to_time, __mkpath_np,
1438 __openutx, __os_assert_log, __os_assert_log_ctx, __os_assumes_log, 1247 __mktemp, __openutx, __os_assert_log, __os_assert_log_ctx,
1439 __os_assumes_log_ctx, __os_avoid_tail_call, __os_crash, __os_crash_callback, 1248 __os_assumes_log, __os_assumes_log_ctx, __os_avoid_tail_call,
1440 __os_crash_fmt, __os_crash_msg, __os_debug_log, __os_debug_log_error_offset, 1249 __os_crash, __os_crash_callback, __os_crash_fmt, __os_crash_msg,
1441 __os_debug_log_error_str, __putenvp, __pututxline, __rand48_add, 1250 __os_debug_log, __os_debug_log_error_offset, __os_debug_log_error_str,
1442 __rand48_mult, __rand48_seed, __readdir_unlocked, __reclaim_telldir, 1251 __putenvp, __pututxline, __rand48_add, __rand48_mult, __rand48_seed,
1443 __seekdir, __setenvp, __setutxent, __sigaction_nobind, __sigintr, 1252 __readdir_unlocked, __reclaim_telldir, __seekdir, __setenvp,
1444 __signal_nobind, __sigvec_nobind, __sread, __sseek, __subsystem_init, 1253 __setutxent, __sigaction_nobind, __sigintr, __signal_nobind,
1445 __swrite, __time32_to_time, __time64_to_time, __time_to_int, 1254 __sigvec_nobind, __sread, __sseek, __subsystem_init, __swrite,
1446 __time_to_long, __time_to_time32, __time_to_time64, __unsetenvp, 1255 __time32_to_time, __time64_to_time, __time_to_int, __time_to_long,
1447 __utmpxname, _a64l, _abort, _abort_report_np, _abs, _acl_add_flag_np, 1256 __time_to_time32, __time_to_time64, __unsetenvp, __utmpxname,
1448 _acl_add_perm, _acl_calc_mask, _acl_clear_flags_np, _acl_clear_perms, 1257 _a64l, _abort, _abort_report_np, _abs, _acl_add_flag_np, _acl_add_perm,
1449 _acl_copy_entry, _acl_copy_ext, _acl_copy_ext_native, _acl_copy_int, 1258 _acl_calc_mask, _acl_clear_flags_np, _acl_clear_perms, _acl_copy_entry,
1450 _acl_copy_int_native, _acl_create_entry, _acl_create_entry_np, 1259 _acl_copy_ext, _acl_copy_ext_native, _acl_copy_int, _acl_copy_int_native,
1451 _acl_delete_def_file, _acl_delete_entry, _acl_delete_fd_np, 1260 _acl_create_entry, _acl_create_entry_np, _acl_delete_def_file,
1452 _acl_delete_file_np, _acl_delete_flag_np, _acl_delete_link_np, 1261 _acl_delete_entry, _acl_delete_fd_np, _acl_delete_file_np,
1453 _acl_delete_perm, _acl_dup, _acl_free, _acl_from_text, _acl_get_entry, 1262 _acl_delete_flag_np, _acl_delete_link_np, _acl_delete_perm,
1454 _acl_get_fd, _acl_get_fd_np, _acl_get_file, _acl_get_flag_np, 1263 _acl_dup, _acl_free, _acl_from_text, _acl_get_entry, _acl_get_fd,
1455 _acl_get_flagset_np, _acl_get_link_np, _acl_get_perm_np, _acl_get_permset, 1264 _acl_get_fd_np, _acl_get_file, _acl_get_flag_np, _acl_get_flagset_np,
1456 _acl_get_permset_mask_np, _acl_get_qualifier, _acl_get_tag_type, 1265 _acl_get_link_np, _acl_get_perm_np, _acl_get_permset, _acl_get_permset_mask_np,
1457 _acl_init, _acl_maximal_permset_mask_np, _acl_set_fd, _acl_set_fd_np, 1266 _acl_get_qualifier, _acl_get_tag_type, _acl_init, _acl_maximal_permset_mask_np,
1458 _acl_set_file, _acl_set_flagset_np, _acl_set_link_np, _acl_set_permset, 1267 _acl_set_fd, _acl_set_fd_np, _acl_set_file, _acl_set_flagset_np,
1459 _acl_set_permset_mask_np, _acl_set_qualifier, _acl_set_tag_type, 1268 _acl_set_link_np, _acl_set_permset, _acl_set_permset_mask_np,
1460 _acl_size, _acl_to_text, _acl_valid, _acl_valid_fd_np, _acl_valid_file_np, 1269 _acl_set_qualifier, _acl_set_tag_type, _acl_size, _acl_to_text,
1461 _acl_valid_link, _addr2ascii, _alarm, _alphasort, _arc4random, 1270 _acl_valid, _acl_valid_fd_np, _acl_valid_file_np, _acl_valid_link,
1462 _arc4random_addrandom, _arc4random_buf, _arc4random_stir, 1271 _addr2ascii, _alarm, _alphasort, _arc4random, _arc4random_addrandom,
1463 _arc4random_uniform, _ascii2addr, _asctime, _asctime_r, _asprintf, 1272 _arc4random_buf, _arc4random_stir, _arc4random_uniform, _ascii2addr,
1464 _asprintf_l, _asxprintf, _asxprintf_exec, _atexit, _atexit_b, 1273 _asctime, _asctime_r, _asprintf, _asprintf_l, _asxprintf,
1465 _atof, _atof_l, _atoi, _atoi_l, _atol, _atol_l, _atoll, _atoll_l, 1274 _asxprintf_exec, _atexit, _atexit_b, _atof, _atof_l, _atoi,
1466 _backtrace, _backtrace_async, _backtrace_from_fp, _backtrace_image_offsets, 1275 _atoi_l, _atol, _atol_l, _atoll, _atoll_l, _backtrace, _backtrace_async,
1276 _backtrace_from_fp, _backtrace_image_offsets, _backtrace_set_pcs_func,
1467 _backtrace_symbols, _backtrace_symbols_fd, _basename, _basename_r, 1277 _backtrace_symbols, _backtrace_symbols_fd, _basename, _basename_r,
1468 _bcopy, _brk, _bsd_signal, _bsearch, _bsearch_b, _btowc, _btowc_l, 1278 _bcopy, _brk, _bsd_signal, _bsearch, _bsearch_b, _btowc, _btowc_l,
1469 _catclose, _catgets, _catopen, _cfgetispeed, _cfgetospeed, 1279 _catclose, _catgets, _catopen, _cfgetispeed, _cfgetospeed,
...@@ -1587,16 +1397,17 @@ exports:...@@ -1587,16 +1397,17 @@ exports:
1587 _strncat, _strndup, _strnstr, _strnunvis, _strnunvisx, _strnvis, 1397 _strncat, _strndup, _strnstr, _strnunvis, _strnunvisx, _strnvis,
1588 _strnvisx, _strpbrk, _strptime, _strptime_l, _strrchr, _strsenvisx, 1398 _strnvisx, _strpbrk, _strptime, _strptime_l, _strrchr, _strsenvisx,
1589 _strsep, _strsignal, _strsignal_r, _strsnvis, _strsnvisx, 1399 _strsep, _strsignal, _strsignal_r, _strsnvis, _strsnvisx,
1590 _strspn, _strsvis, _strsvisx, _strtod, _strtod_l, _strtof, 1400 _strspn, _strsvis, _strsvisx, _strtod, _strtod_l, _strtoencf16,
1591 _strtof_l, _strtofflags, _strtoimax, _strtoimax_l, _strtok, 1401 _strtoencf32, _strtoencf64, _strtoencf64x, _strtof, _strtof_l,
1592 _strtok_r, _strtol, _strtol_l, _strtold, _strtold_l, _strtoll, 1402 _strtofflags, _strtoimax, _strtoimax_l, _strtok, _strtok_r,
1593 _strtoll_l, _strtonum, _strtoq, _strtoq_l, _strtoul, _strtoul_l, 1403 _strtol, _strtol_l, _strtold, _strtold_l, _strtoll, _strtoll_l,
1594 _strtoull, _strtoull_l, _strtoumax, _strtoumax_l, _strtouq, 1404 _strtonum, _strtoq, _strtoq_l, _strtoul, _strtoul_l, _strtoull,
1595 _strtouq_l, _strunvis, _strunvisx, _strvis, _strvisx, _strxfrm, 1405 _strtoull_l, _strtoumax, _strtoumax_l, _strtouq, _strtouq_l,
1596 _strxfrm_l, _suboptarg, _svis, _swab, _swprintf, _swprintf_l, 1406 _strunvis, _strunvisx, _strvis, _strvisx, _strxfrm, _strxfrm_l,
1597 _swscanf, _swscanf_l, _sxprintf, _sxprintf_exec, _sync_volume_np, 1407 _suboptarg, _svis, _swab, _swprintf, _swprintf_l, _swscanf,
1598 _sys_errlist, _sys_nerr, _sys_siglist, _sys_signame, _sysconf, 1408 _swscanf_l, _sxprintf, _sxprintf_exec, _sync_volume_np, _sys_errlist,
1599 _sysctl, _sysctlbyname, _sysctlnametomib, _system, '_system$NOCANCEL', 1409 _sys_nerr, _sys_siglist, _sys_signame, _sysconf, _sysctl,
1410 _sysctlbyname, _sysctlnametomib, _system, '_system$NOCANCEL',
1600 _tcdrain, '_tcdrain$NOCANCEL', _tcflow, _tcflush, _tcgetattr, 1411 _tcdrain, '_tcdrain$NOCANCEL', _tcflow, _tcflush, _tcgetattr,
1601 _tcgetpgrp, _tcgetsid, _tcsendbreak, _tcsetattr, _tcsetpgrp, 1412 _tcgetpgrp, _tcgetsid, _tcsendbreak, _tcsetattr, _tcsetpgrp,
1602 _tdelete, _telldir, _tempnam, _tfind, _thread_stack_async_pcs, 1413 _tdelete, _telldir, _tempnam, _tfind, _thread_stack_async_pcs,
...@@ -1652,21 +1463,8 @@ reexports:...@@ -1652,21 +1463,8 @@ reexports:
1652tbd-version: 41463tbd-version: 4
1653targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1464targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1654 arm64e-macos, arm64e-maccatalyst ]1465 arm64e-macos, arm64e-maccatalyst ]
1655uuids:
1656 - target: x86_64-macos
1657 value: 2053883C-79F4-3AF8-A37C-DE204E208C60
1658 - target: x86_64-maccatalyst
1659 value: 2053883C-79F4-3AF8-A37C-DE204E208C60
1660 - target: arm64-macos
1661 value: 00000000-0000-0000-0000-000000000000
1662 - target: arm64-maccatalyst
1663 value: 00000000-0000-0000-0000-000000000000
1664 - target: arm64e-macos
1665 value: CB445464-28B4-353C-976E-59DA0E229FED
1666 - target: arm64e-maccatalyst
1667 value: CB445464-28B4-353C-976E-59DA0E229FED
1668install-name: '/usr/lib/system/libsystem_collections.dylib'1466install-name: '/usr/lib/system/libsystem_collections.dylib'
1669current-version: 1534.40.21467current-version: 1534.100.14
1670parent-umbrella:1468parent-umbrella:
1671 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1469 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1672 arm64e-macos, arm64e-maccatalyst ]1470 arm64e-macos, arm64e-maccatalyst ]
...@@ -1695,21 +1493,8 @@ exports:...@@ -1695,21 +1493,8 @@ exports:
1695tbd-version: 41493tbd-version: 4
1696targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1494targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1697 arm64e-macos, arm64e-maccatalyst ]1495 arm64e-macos, arm64e-maccatalyst ]
1698uuids:
1699 - target: x86_64-macos
1700 value: E7F80C5C-E18C-3201-ACB6-9A4C46B6574B
1701 - target: x86_64-maccatalyst
1702 value: E7F80C5C-E18C-3201-ACB6-9A4C46B6574B
1703 - target: arm64-macos
1704 value: 00000000-0000-0000-0000-000000000000
1705 - target: arm64-maccatalyst
1706 value: 00000000-0000-0000-0000-000000000000
1707 - target: arm64e-macos
1708 value: 113A1DDB-1B61-3C33-9FD5-B39A2A29D779
1709 - target: arm64e-maccatalyst
1710 value: 113A1DDB-1B61-3C33-9FD5-B39A2A29D779
1711install-name: '/usr/lib/system/libsystem_configuration.dylib'1496install-name: '/usr/lib/system/libsystem_configuration.dylib'
1712current-version: 1241.60.31497current-version: 1241.100.11
1713parent-umbrella:1498parent-umbrella:
1714 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1499 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1715 arm64e-macos, arm64e-maccatalyst ]1500 arm64e-macos, arm64e-maccatalyst ]
...@@ -1735,19 +1520,6 @@ exports:...@@ -1735,19 +1520,6 @@ exports:
1735tbd-version: 41520tbd-version: 4
1736targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1521targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1737 arm64e-macos, arm64e-maccatalyst ]1522 arm64e-macos, arm64e-maccatalyst ]
1738uuids:
1739 - target: x86_64-macos
1740 value: D44E0845-001C-3C46-B3A7-E4926DAEF6B3
1741 - target: x86_64-maccatalyst
1742 value: D44E0845-001C-3C46-B3A7-E4926DAEF6B3
1743 - target: arm64-macos
1744 value: 00000000-0000-0000-0000-000000000000
1745 - target: arm64-maccatalyst
1746 value: 00000000-0000-0000-0000-000000000000
1747 - target: arm64e-macos
1748 value: 2694748C-A452-3438-BB47-161D7B220AE2
1749 - target: arm64e-maccatalyst
1750 value: 2694748C-A452-3438-BB47-161D7B220AE2
1751install-name: '/usr/lib/system/libsystem_containermanager.dylib'1523install-name: '/usr/lib/system/libsystem_containermanager.dylib'
1752parent-umbrella:1524parent-umbrella:
1753 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1525 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -1792,6 +1564,7 @@ exports:...@@ -1792,6 +1564,7 @@ exports:
1792 _container_create_or_lookup_app_group_paths, _container_create_or_lookup_app_group_paths_for_current_user, 1564 _container_create_or_lookup_app_group_paths, _container_create_or_lookup_app_group_paths_for_current_user,
1793 _container_create_or_lookup_app_group_paths_for_platform, 1565 _container_create_or_lookup_app_group_paths_for_platform,
1794 _container_create_or_lookup_app_group_paths_from_entitlements, 1566 _container_create_or_lookup_app_group_paths_from_entitlements,
1567 _container_create_or_lookup_app_group_paths_from_entitlements_4ls,
1795 _container_create_or_lookup_for_current_user, _container_create_or_lookup_for_platform, 1568 _container_create_or_lookup_for_current_user, _container_create_or_lookup_for_platform,
1796 _container_create_or_lookup_group_container_paths_for_current_user, 1569 _container_create_or_lookup_group_container_paths_for_current_user,
1797 _container_create_or_lookup_path, _container_create_or_lookup_path_for_current_user, 1570 _container_create_or_lookup_path, _container_create_or_lookup_path_for_current_user,
...@@ -1910,19 +1683,6 @@ exports:...@@ -1910,19 +1683,6 @@ exports:
1910tbd-version: 41683tbd-version: 4
1911targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1684targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1912 arm64e-macos, arm64e-maccatalyst ]1685 arm64e-macos, arm64e-maccatalyst ]
1913uuids:
1914 - target: x86_64-macos
1915 value: D86D13CC-2AF9-3A17-BCF3-0D16703F99A7
1916 - target: x86_64-maccatalyst
1917 value: D86D13CC-2AF9-3A17-BCF3-0D16703F99A7
1918 - target: arm64-macos
1919 value: 00000000-0000-0000-0000-000000000000
1920 - target: arm64-maccatalyst
1921 value: 00000000-0000-0000-0000-000000000000
1922 - target: arm64e-macos
1923 value: 6E9DED8E-2A44-33E3-909F-74B4786482A2
1924 - target: arm64e-maccatalyst
1925 value: 6E9DED8E-2A44-33E3-909F-74B4786482A2
1926install-name: '/usr/lib/system/libsystem_coreservices.dylib'1686install-name: '/usr/lib/system/libsystem_coreservices.dylib'
1927current-version: 1291687current-version: 129
1928parent-umbrella:1688parent-umbrella:
...@@ -1944,19 +1704,6 @@ exports:...@@ -1944,19 +1704,6 @@ exports:
1944tbd-version: 41704tbd-version: 4
1945targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1705targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1946 arm64e-macos, arm64e-maccatalyst ]1706 arm64e-macos, arm64e-maccatalyst ]
1947uuids:
1948 - target: x86_64-macos
1949 value: E272E2C2-8511-3C94-8C39-F5319F2812BB
1950 - target: x86_64-maccatalyst
1951 value: E272E2C2-8511-3C94-8C39-F5319F2812BB
1952 - target: arm64-macos
1953 value: 00000000-0000-0000-0000-000000000000
1954 - target: arm64-maccatalyst
1955 value: 00000000-0000-0000-0000-000000000000
1956 - target: arm64e-macos
1957 value: 74F6C923-5FF6-39D0-90DE-8FB4812EA263
1958 - target: arm64e-maccatalyst
1959 value: 74F6C923-5FF6-39D0-90DE-8FB4812EA263
1960install-name: '/usr/lib/system/libsystem_darwin.dylib'1707install-name: '/usr/lib/system/libsystem_darwin.dylib'
1961parent-umbrella:1708parent-umbrella:
1962 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1709 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -1995,21 +1742,8 @@ exports:...@@ -1995,21 +1742,8 @@ exports:
1995tbd-version: 41742tbd-version: 4
1996targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1743targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
1997 arm64e-macos, arm64e-maccatalyst ]1744 arm64e-macos, arm64e-maccatalyst ]
1998uuids:
1999 - target: x86_64-macos
2000 value: 77610ACE-81D4-33E5-A343-5FDA27F53E10
2001 - target: x86_64-maccatalyst
2002 value: 77610ACE-81D4-33E5-A343-5FDA27F53E10
2003 - target: arm64-macos
2004 value: 00000000-0000-0000-0000-000000000000
2005 - target: arm64-maccatalyst
2006 value: 00000000-0000-0000-0000-000000000000
2007 - target: arm64e-macos
2008 value: F87EFC17-B673-3488-B503-C67E2FFDE6A0
2009 - target: arm64e-maccatalyst
2010 value: F87EFC17-B673-3488-B503-C67E2FFDE6A0
2011install-name: '/usr/lib/system/libsystem_dnssd.dylib'1745install-name: '/usr/lib/system/libsystem_dnssd.dylib'
2012current-version: 1790.60.251746current-version: 1807.101.2
2013parent-umbrella:1747parent-umbrella:
2014 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1748 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2015 arm64e-macos, arm64e-maccatalyst ]1749 arm64e-macos, arm64e-maccatalyst ]
...@@ -2045,21 +1779,8 @@ exports:...@@ -2045,21 +1779,8 @@ exports:
2045tbd-version: 41779tbd-version: 4
2046targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1780targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2047 arm64e-macos, arm64e-maccatalyst ]1781 arm64e-macos, arm64e-maccatalyst ]
2048uuids:
2049 - target: x86_64-macos
2050 value: 223BBDCF-6D59-3770-9E6A-38B762676030
2051 - target: x86_64-maccatalyst
2052 value: 223BBDCF-6D59-3770-9E6A-38B762676030
2053 - target: arm64-macos
2054 value: 00000000-0000-0000-0000-000000000000
2055 - target: arm64-maccatalyst
2056 value: 00000000-0000-0000-0000-000000000000
2057 - target: arm64e-macos
2058 value: EE355E15-A47F-3BED-A955-1041497449AE
2059 - target: arm64e-maccatalyst
2060 value: EE355E15-A47F-3BED-A955-1041497449AE
2061install-name: '/usr/lib/system/libsystem_featureflags.dylib'1782install-name: '/usr/lib/system/libsystem_featureflags.dylib'
2062current-version: 711783current-version: 74
2063parent-umbrella:1784parent-umbrella:
2064 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1785 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2065 arm64e-macos, arm64e-maccatalyst ]1786 arm64e-macos, arm64e-maccatalyst ]
...@@ -2072,19 +1793,6 @@ exports:...@@ -2072,19 +1793,6 @@ exports:
2072tbd-version: 41793tbd-version: 4
2073targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1794targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2074 arm64e-macos, arm64e-maccatalyst ]1795 arm64e-macos, arm64e-maccatalyst ]
2075uuids:
2076 - target: x86_64-macos
2077 value: 7B76D94D-56F7-3B8A-B63D-ED567EFA12F6
2078 - target: x86_64-maccatalyst
2079 value: 7B76D94D-56F7-3B8A-B63D-ED567EFA12F6
2080 - target: arm64-macos
2081 value: 00000000-0000-0000-0000-000000000000
2082 - target: arm64-maccatalyst
2083 value: 00000000-0000-0000-0000-000000000000
2084 - target: arm64e-macos
2085 value: 67168754-ABAC-33C6-AFF7-FF53F1A8745C
2086 - target: arm64e-maccatalyst
2087 value: 67168754-ABAC-33C6-AFF7-FF53F1A8745C
2088install-name: '/usr/lib/system/libsystem_info.dylib'1796install-name: '/usr/lib/system/libsystem_info.dylib'
2089parent-umbrella:1797parent-umbrella:
2090 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1798 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -2209,21 +1917,8 @@ exports:...@@ -2209,21 +1917,8 @@ exports:
2209tbd-version: 41917tbd-version: 4
2210targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1918targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2211 arm64e-macos, arm64e-maccatalyst ]1919 arm64e-macos, arm64e-maccatalyst ]
2212uuids:
2213 - target: x86_64-macos
2214 value: 7C3DCC95-9F42-3C7C-8796-476FF67B9CF7
2215 - target: x86_64-maccatalyst
2216 value: 7C3DCC95-9F42-3C7C-8796-476FF67B9CF7
2217 - target: arm64-macos
2218 value: EB0327EE-CB9C-37ED-AB6A-E9AF74E814F0
2219 - target: arm64-maccatalyst
2220 value: EB0327EE-CB9C-37ED-AB6A-E9AF74E814F0
2221 - target: arm64e-macos
2222 value: AEBF397E-E2EF-3A49-BE58-23D4558511F6
2223 - target: arm64e-maccatalyst
2224 value: AEBF397E-E2EF-3A49-BE58-23D4558511F6
2225install-name: '/usr/lib/system/libsystem_kernel.dylib'1920install-name: '/usr/lib/system/libsystem_kernel.dylib'
2226current-version: 8792.61.21921current-version: 8796.101.5
2227parent-umbrella:1922parent-umbrella:
2228 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 1923 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2229 arm64e-macos, arm64e-maccatalyst ]1924 arm64e-macos, arm64e-maccatalyst ]
...@@ -2243,19 +1938,20 @@ exports:...@@ -2243,19 +1938,20 @@ exports:
2243 ___channel_get_opt, ___channel_open, ___channel_set_opt, ___channel_sync, 1938 ___channel_get_opt, ___channel_open, ___channel_set_opt, ___channel_sync,
2244 ___chmod, ___chmod_extended, ___close_nocancel, ___coalition, 1939 ___chmod, ___chmod_extended, ___close_nocancel, ___coalition,
2245 ___coalition_info, ___coalition_ledger, ___commpage_gettimeofday, 1940 ___coalition_info, ___coalition_ledger, ___commpage_gettimeofday,
2246 ___connect, ___connect_nocancel, ___copyfile, ___csrctl, ___darwin_check_fd_set_overflow, 1941 ___connect, ___connect_nocancel, ___copyfile, ___crossarch_trap,
2247 ___debug_syscall_reject, ___debug_syscall_reject_config, ___delete, 1942 ___csrctl, ___darwin_check_fd_set_overflow, ___debug_syscall_reject,
2248 ___disable_threadsignal, ___error, ___execve, ___exit, ___fchmod, 1943 ___debug_syscall_reject_config, ___delete, ___disable_threadsignal,
2249 ___fchmod_extended, ___fcntl, ___fcntl_nocancel, ___fork, 1944 ___error, ___execve, ___exit, ___fchmod, ___fchmod_extended,
2250 ___fs_snapshot, ___fstat64_extended, ___fstat_extended, ___fsync_nocancel, 1945 ___fcntl, ___fcntl_nocancel, ___fork, ___fs_snapshot, ___fstat64_extended,
2251 ___get_remove_counter, ___getattrlist, ___getdirentries64, 1946 ___fstat_extended, ___fsync_nocancel, ___get_remove_counter,
2252 ___gethostuuid, ___getlogin, ___getpeername, ___getpid, ___getrlimit, 1947 ___getattrlist, ___getdirentries64, ___gethostuuid, ___getlogin,
2253 ___getsgroups, ___getsockname, ___gettid, ___gettimeofday, 1948 ___getpeername, ___getpid, ___getrlimit, ___getsgroups, ___getsockname,
2254 ___getwgroups, ___guarded_open_dprotected_np, ___guarded_open_np, 1949 ___gettid, ___gettimeofday, ___getwgroups, ___guarded_open_dprotected_np,
2255 ___identitysvc, ___inc_remove_counter, ___initgroups, ___ioctl, 1950 ___guarded_open_np, ___identitysvc, ___inc_remove_counter,
2256 ___iopolicysys, ___kdebug_trace, ___kdebug_trace64, ___kdebug_trace_string, 1951 ___initgroups, ___ioctl, ___iopolicysys, ___kdebug_trace,
2257 ___kdebug_typefilter, ___kill, ___kqueue_workloop_ctl, ___lchown, 1952 ___kdebug_trace64, ___kdebug_trace_string, ___kdebug_typefilter,
2258 ___libkernel_init, ___libkernel_init_after_boot_tasks, ___libkernel_init_late, 1953 ___kill, ___kqueue_workloop_ctl, ___lchown, ___libkernel_init,
1954 ___libkernel_init_after_boot_tasks, ___libkernel_init_late,
2259 ___libkernel_platform_init, ___libkernel_voucher_init, ___listen, 1955 ___libkernel_platform_init, ___libkernel_voucher_init, ___listen,
2260 ___log_data, ___lseek, ___lstat64_extended, ___lstat_extended, 1956 ___log_data, ___lseek, ___lstat64_extended, ___lstat_extended,
2261 ___mac_execve, ___mac_get_fd, ___mac_get_file, ___mac_get_link, 1957 ___mac_execve, ___mac_get_fd, ___mac_get_file, ___mac_get_link,
...@@ -2572,32 +2268,32 @@ exports:...@@ -2572,32 +2268,32 @@ exports:
2572 _posix_spawnattr_set_uid_np, _posix_spawnattr_setarchpref_np, 2268 _posix_spawnattr_set_uid_np, _posix_spawnattr_setarchpref_np,
2573 _posix_spawnattr_setauditsessionport_np, _posix_spawnattr_setbinpref_np, 2269 _posix_spawnattr_setauditsessionport_np, _posix_spawnattr_setbinpref_np,
2574 _posix_spawnattr_setcoalition_np, _posix_spawnattr_setcpumonitor, 2270 _posix_spawnattr_setcoalition_np, _posix_spawnattr_setcpumonitor,
2575 _posix_spawnattr_setcpumonitor_default, _posix_spawnattr_setexceptionports_np, 2271 _posix_spawnattr_setcpumonitor_default, _posix_spawnattr_setdataless_iopolicy_np,
2576 _posix_spawnattr_setflags, _posix_spawnattr_setjetsam_ext, 2272 _posix_spawnattr_setexceptionports_np, _posix_spawnattr_setflags,
2577 _posix_spawnattr_setmacpolicyinfo_np, _posix_spawnattr_setnosmt_np, 2273 _posix_spawnattr_setjetsam_ext, _posix_spawnattr_setmacpolicyinfo_np,
2578 _posix_spawnattr_setpcontrol_np, _posix_spawnattr_setpgroup, 2274 _posix_spawnattr_setnosmt_np, _posix_spawnattr_setpcontrol_np,
2579 _posix_spawnattr_setprocesstype_np, _posix_spawnattr_setsigdefault, 2275 _posix_spawnattr_setpgroup, _posix_spawnattr_setprocesstype_np,
2580 _posix_spawnattr_setsigmask, _posix_spawnattr_setspecialport_np, 2276 _posix_spawnattr_setsigdefault, _posix_spawnattr_setsigmask,
2581 _pread, '_pread$NOCANCEL', _preadv, '_preadv$NOCANCEL', _proc_clear_cpulimits, 2277 _posix_spawnattr_setspecialport_np, _pread, '_pread$NOCANCEL',
2582 _proc_clear_delayidlesleep, _proc_clear_dirty, _proc_clear_vmpressure, 2278 _preadv, '_preadv$NOCANCEL', _proc_clear_cpulimits, _proc_clear_delayidlesleep,
2583 _proc_current_thread_schedinfo, _proc_denap_assertion_begin_with_msg, 2279 _proc_clear_dirty, _proc_clear_vmpressure, _proc_current_thread_schedinfo,
2584 _proc_denap_assertion_complete, _proc_disable_apptype, _proc_disable_cpumon, 2280 _proc_denap_assertion_begin_with_msg, _proc_denap_assertion_complete,
2585 _proc_disable_wakemon, _proc_donate_importance_boost, _proc_enable_apptype, 2281 _proc_disable_apptype, _proc_disable_cpumon, _proc_disable_wakemon,
2586 _proc_get_cpumon_params, _proc_get_dirty, _proc_get_wakemon_params, 2282 _proc_donate_importance_boost, _proc_enable_apptype, _proc_get_cpumon_params,
2587 _proc_importance_assertion_begin_with_msg, _proc_importance_assertion_complete, 2283 _proc_get_dirty, _proc_get_wakemon_params, _proc_importance_assertion_begin_with_msg,
2588 _proc_kmsgbuf, _proc_libversion, _proc_list_dynkqueueids, 2284 _proc_importance_assertion_complete, _proc_kmsgbuf, _proc_libversion,
2589 _proc_list_uptrs, _proc_listallpids, _proc_listchildpids, 2285 _proc_list_dynkqueueids, _proc_list_uptrs, _proc_listallpids,
2590 _proc_listcoalitions, _proc_listpgrppids, _proc_listpids, 2286 _proc_listchildpids, _proc_listcoalitions, _proc_listpgrppids,
2591 _proc_listpidspath, _proc_name, _proc_pid_rusage, _proc_piddynkqueueinfo, 2287 _proc_listpids, _proc_listpidspath, _proc_name, _proc_pid_rusage,
2592 _proc_pidfdinfo, _proc_pidfileportinfo, _proc_pidinfo, _proc_pidoriginatorinfo, 2288 _proc_piddynkqueueinfo, _proc_pidfdinfo, _proc_pidfileportinfo,
2593 _proc_pidpath, _proc_pidpath_audittoken, _proc_regionfilename, 2289 _proc_pidinfo, _proc_pidoriginatorinfo, _proc_pidpath, _proc_pidpath_audittoken,
2594 _proc_reset_footprint_interval, _proc_resume_cpumon, _proc_rlimit_control, 2290 _proc_regionfilename, _proc_reset_footprint_interval, _proc_resume_cpumon,
2595 _proc_set_cpumon_defaults, _proc_set_cpumon_params, _proc_set_cpumon_params_fatal, 2291 _proc_rlimit_control, _proc_set_cpumon_defaults, _proc_set_cpumon_params,
2596 _proc_set_csm, _proc_set_delayidlesleep, _proc_set_dirty, 2292 _proc_set_cpumon_params_fatal, _proc_set_csm, _proc_set_delayidlesleep,
2597 _proc_set_no_smt, _proc_set_owner_vmpressure, _proc_set_wakemon_defaults, 2293 _proc_set_dirty, _proc_set_no_smt, _proc_set_owner_vmpressure,
2598 _proc_set_wakemon_params, _proc_setcpu_percentage, _proc_setpcontrol, 2294 _proc_set_wakemon_defaults, _proc_set_wakemon_params, _proc_setcpu_percentage,
2599 _proc_setthread_cpupercent, _proc_setthread_csm, _proc_setthread_no_smt, 2295 _proc_setpcontrol, _proc_setthread_cpupercent, _proc_setthread_csm,
2600 _proc_suppress, _proc_terminate, _proc_terminate_all_rsr, 2296 _proc_setthread_no_smt, _proc_suppress, _proc_terminate, _proc_terminate_all_rsr,
2601 _proc_trace_log, _proc_track_dirty, _proc_udata_info, _proc_uuid_policy, 2297 _proc_trace_log, _proc_track_dirty, _proc_udata_info, _proc_uuid_policy,
2602 _processor_assign, _processor_control, _processor_exit, _processor_get_assignment, 2298 _processor_assign, _processor_control, _processor_exit, _processor_get_assignment,
2603 _processor_info, _processor_set_create, _processor_set_default, 2299 _processor_info, _processor_set_create, _processor_set_default,
...@@ -2707,25 +2403,8 @@ exports:...@@ -2707,25 +2403,8 @@ exports:
2707tbd-version: 42403tbd-version: 4
2708targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, 2404targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst,
2709 arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]2405 arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]
2710uuids:
2711 - target: x86_64-macos
2712 value: DC460796-C8A7-3507-8539-C890D9EDDC8C
2713 - target: x86_64-maccatalyst
2714 value: DC460796-C8A7-3507-8539-C890D9EDDC8C
2715 - target: x86_64h-macos
2716 value: 73F0FC1C-FC2A-3B36-8796-7C2C2CBA7214
2717 - target: x86_64h-maccatalyst
2718 value: 73F0FC1C-FC2A-3B36-8796-7C2C2CBA7214
2719 - target: arm64-macos
2720 value: 00000000-0000-0000-0000-000000000000
2721 - target: arm64-maccatalyst
2722 value: 00000000-0000-0000-0000-000000000000
2723 - target: arm64e-macos
2724 value: 6BEE17F3-04F2-3B1F-B8EB-C94379ABA9BD
2725 - target: arm64e-maccatalyst
2726 value: 6BEE17F3-04F2-3B1F-B8EB-C94379ABA9BD
2727install-name: '/usr/lib/system/libsystem_m.dylib'2406install-name: '/usr/lib/system/libsystem_m.dylib'
2728current-version: 3226.0.12407current-version: 3226.100.4
2729parent-umbrella:2408parent-umbrella:
2730 - targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, 2409 - targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst,
2731 arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]2410 arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]
...@@ -2938,21 +2617,8 @@ exports:...@@ -2938,21 +2617,8 @@ exports:
2938tbd-version: 42617tbd-version: 4
2939targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2618targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2940 arm64e-macos, arm64e-maccatalyst ]2619 arm64e-macos, arm64e-maccatalyst ]
2941uuids:
2942 - target: x86_64-macos
2943 value: F609F029-BCD0-3A54-B48A-99B3CE8378CE
2944 - target: x86_64-maccatalyst
2945 value: F609F029-BCD0-3A54-B48A-99B3CE8378CE
2946 - target: arm64-macos
2947 value: 00000000-0000-0000-0000-000000000000
2948 - target: arm64-maccatalyst
2949 value: 00000000-0000-0000-0000-000000000000
2950 - target: arm64e-macos
2951 value: 04185997-16D2-30DA-8691-7C82612635A3
2952 - target: arm64e-maccatalyst
2953 value: 04185997-16D2-30DA-8691-7C82612635A3
2954install-name: '/usr/lib/system/libsystem_malloc.dylib'2620install-name: '/usr/lib/system/libsystem_malloc.dylib'
2955current-version: 409.60.62621current-version: 425.100.7
2956parent-umbrella:2622parent-umbrella:
2957 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2623 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
2958 arm64e-macos, arm64e-maccatalyst ]2624 arm64e-macos, arm64e-maccatalyst ]
...@@ -2992,7 +2658,7 @@ exports:...@@ -2992,7 +2658,7 @@ exports:
2992 _malloc_zone_print, _malloc_zone_print_ptr_info, _malloc_zone_realloc, 2658 _malloc_zone_print, _malloc_zone_print_ptr_info, _malloc_zone_realloc,
2993 _malloc_zone_register, _malloc_zone_statistics, _malloc_zone_unregister, 2659 _malloc_zone_register, _malloc_zone_statistics, _malloc_zone_unregister,
2994 _malloc_zone_valloc, _malloc_zones, _mstats, _pgm_diagnose_fault_from_crash_reporter, 2660 _malloc_zone_valloc, _malloc_zones, _mstats, _pgm_diagnose_fault_from_crash_reporter,
2995 _pgm_disable_for_current_thread, _posix_memalign, _quarantine_diagnose_fault_from_crash_reporter, 2661 _posix_memalign, _quarantine_diagnose_fault_from_crash_reporter,
2996 _realloc, '_reallocarray$DARWIN_EXTSN', '_reallocarrayf$DARWIN_EXTSN', 2662 _realloc, '_reallocarray$DARWIN_EXTSN', '_reallocarrayf$DARWIN_EXTSN',
2997 _scalable_zone_info, _scalable_zone_statistics, _set_malloc_singlethreaded, 2663 _scalable_zone_info, _scalable_zone_statistics, _set_malloc_singlethreaded,
2998 _stack_logging_enable_logging, _szone_check_counter, _szone_check_modulo, 2664 _stack_logging_enable_logging, _szone_check_counter, _szone_check_modulo,
...@@ -3002,19 +2668,6 @@ exports:...@@ -3002,19 +2668,6 @@ exports:
3002tbd-version: 42668tbd-version: 4
3003targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2669targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3004 arm64e-macos, arm64e-maccatalyst ]2670 arm64e-macos, arm64e-maccatalyst ]
3005uuids:
3006 - target: x86_64-macos
3007 value: 09114B12-EC3D-3943-A1BD-9909EE2F85B6
3008 - target: x86_64-maccatalyst
3009 value: 09114B12-EC3D-3943-A1BD-9909EE2F85B6
3010 - target: arm64-macos
3011 value: 00000000-0000-0000-0000-000000000000
3012 - target: arm64-maccatalyst
3013 value: 00000000-0000-0000-0000-000000000000
3014 - target: arm64e-macos
3015 value: 8737AB7F-91FA-3C06-B797-566A62D0751C
3016 - target: arm64e-maccatalyst
3017 value: 8737AB7F-91FA-3C06-B797-566A62D0751C
3018install-name: '/usr/lib/system/libsystem_networkextension.dylib'2671install-name: '/usr/lib/system/libsystem_networkextension.dylib'
3019parent-umbrella:2672parent-umbrella:
3020 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2673 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -3039,9 +2692,9 @@ exports:...@@ -3039,9 +2692,9 @@ exports:
3039 _NEHelperSettingsSetArray, _NEHelperSettingsSetBool, _NEHelperSettingsSetNumber, 2692 _NEHelperSettingsSetArray, _NEHelperSettingsSetBool, _NEHelperSettingsSetNumber,
3040 _NEHelperVPNConfigurationExists, _NEHelperVPNSetEnabled, _g_ne_read_uuid_cache, 2693 _NEHelperVPNConfigurationExists, _NEHelperVPNSetEnabled, _g_ne_read_uuid_cache,
3041 _g_ne_uuid_cache_hit, _ne_copy_cached_bundle_identifier_for_uuid, 2694 _g_ne_uuid_cache_hit, _ne_copy_cached_bundle_identifier_for_uuid,
3042 _ne_copy_cached_preferred_bundle_for_bundle_identifier, _ne_copy_cached_uuids_for_bundle_identifier, 2695 _ne_copy_cached_uuids_for_bundle_identifier, _ne_copy_signature_info_for_pid,
3043 _ne_copy_signature_info_for_pid, _ne_copy_signing_identifier_for_pid, 2696 _ne_copy_signing_identifier_for_pid, _ne_copy_uuid_cache,
3044 _ne_copy_uuid_cache, _ne_force_reset_uuid_cache, _ne_get_configuration_generation, 2697 _ne_force_reset_uuid_cache, _ne_get_configuration_generation,
3045 _ne_is_sockaddr_valid, _ne_log_large_obj, _ne_log_obj, _ne_print_backtrace, 2698 _ne_is_sockaddr_valid, _ne_log_large_obj, _ne_log_obj, _ne_print_backtrace,
3046 _ne_privacy_dns_netagent_id, _ne_privacy_proxy_netagent_id, 2699 _ne_privacy_dns_netagent_id, _ne_privacy_proxy_netagent_id,
3047 _ne_session_add_necp_drop_dest_from_dest_list, _ne_session_add_necp_drop_dest_from_path, 2700 _ne_session_add_necp_drop_dest_from_dest_list, _ne_session_add_necp_drop_dest_from_path,
...@@ -3069,20 +2722,20 @@ exports:...@@ -3069,20 +2722,20 @@ exports:
3069 _ne_session_policy_match_get_service, _ne_session_policy_match_get_service_action, 2722 _ne_session_policy_match_get_service, _ne_session_policy_match_get_service_action,
3070 _ne_session_policy_match_get_service_type, _ne_session_policy_match_is_drop, 2723 _ne_session_policy_match_get_service_type, _ne_session_policy_match_is_drop,
3071 _ne_session_policy_match_is_flow_divert, _ne_session_policy_match_service_is_registered, 2724 _ne_session_policy_match_is_flow_divert, _ne_session_policy_match_service_is_registered,
3072 _ne_session_release, _ne_session_retain, _ne_session_send_barrier, 2725 _ne_session_random_port_fallback, _ne_session_release, _ne_session_retain,
3073 _ne_session_service_get_dns_service_id, _ne_session_service_get_dns_service_id_for_interface, 2726 _ne_session_send_barrier, _ne_session_service_get_dns_service_id,
3074 _ne_session_service_matches_address, _ne_session_service_matches_address_for_interface, 2727 _ne_session_service_get_dns_service_id_for_interface, _ne_session_service_matches_address,
3075 _ne_session_set_event_handler, _ne_session_set_socket_attributes, 2728 _ne_session_service_matches_address_for_interface, _ne_session_set_event_handler,
3076 _ne_session_set_socket_context_attribute, _ne_session_set_socket_tracker_attributes, 2729 _ne_session_set_socket_attributes, _ne_session_set_socket_context_attribute,
3077 _ne_session_should_disable_nexus, _ne_session_start, _ne_session_start_on_behalf_of, 2730 _ne_session_set_socket_tracker_attributes, _ne_session_should_disable_nexus,
3078 _ne_session_start_with_options, _ne_session_status_to_string, 2731 _ne_session_start, _ne_session_start_on_behalf_of, _ne_session_start_with_options,
3079 _ne_session_stop, _ne_session_stop_all_with_plugin_type, _ne_session_stop_reason_to_string, 2732 _ne_session_status_to_string, _ne_session_stop, _ne_session_stop_all_with_plugin_type,
3080 _ne_session_type_to_string, _ne_session_use_as_system_vpn, 2733 _ne_session_stop_reason_to_string, _ne_session_type_to_string,
3081 _ne_session_vod_evaluate_connection_present, _ne_session_vpn_include_all_networks_configs_present, 2734 _ne_session_use_as_system_vpn, _ne_session_vod_evaluate_connection_present,
3082 _ne_socket_set_attribution, _ne_socket_set_domains, _ne_socket_set_is_app_initiated, 2735 _ne_session_vpn_include_all_networks_configs_present, _ne_socket_set_attribution,
3083 _ne_socket_set_website_attribution, _ne_tracker_build_cache, 2736 _ne_socket_set_domains, _ne_socket_set_is_app_initiated, _ne_socket_set_website_attribution,
3084 _ne_tracker_build_trie, _ne_tracker_check_info_changed, _ne_tracker_clear_cache, 2737 _ne_tracker_build_cache, _ne_tracker_build_trie, _ne_tracker_check_info_changed,
3085 _ne_tracker_context_get_domain, _ne_tracker_context_get_domain_owner, 2738 _ne_tracker_clear_cache, _ne_tracker_context_get_domain, _ne_tracker_context_get_domain_owner,
3086 _ne_tracker_context_is_from_app_list, _ne_tracker_context_is_from_web_list, 2739 _ne_tracker_context_is_from_app_list, _ne_tracker_context_is_from_web_list,
3087 _ne_tracker_get_ddg_dictionary, _ne_tracker_lookup_app_domains, 2740 _ne_tracker_get_ddg_dictionary, _ne_tracker_lookup_app_domains,
3088 _ne_tracker_set_test_domains, _ne_tracker_validate_domain, 2741 _ne_tracker_set_test_domains, _ne_tracker_validate_domain,
...@@ -3095,21 +2748,8 @@ exports:...@@ -3095,21 +2748,8 @@ exports:
3095tbd-version: 42748tbd-version: 4
3096targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2749targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3097 arm64e-macos, arm64e-maccatalyst ]2750 arm64e-macos, arm64e-maccatalyst ]
3098uuids:
3099 - target: x86_64-macos
3100 value: 0463374D-9E62-3E58-A668-C9EFF9DB217C
3101 - target: x86_64-maccatalyst
3102 value: 0463374D-9E62-3E58-A668-C9EFF9DB217C
3103 - target: arm64-macos
3104 value: 00000000-0000-0000-0000-000000000000
3105 - target: arm64-maccatalyst
3106 value: 00000000-0000-0000-0000-000000000000
3107 - target: arm64e-macos
3108 value: 62FA1CCF-D4BB-3606-BDC9-C2F247A12CE8
3109 - target: arm64e-maccatalyst
3110 value: 62FA1CCF-D4BB-3606-BDC9-C2F247A12CE8
3111install-name: '/usr/lib/system/libsystem_notify.dylib'2751install-name: '/usr/lib/system/libsystem_notify.dylib'
3112current-version: 3062752current-version: 312
3113parent-umbrella:2753parent-umbrella:
3114 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2754 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3115 arm64e-macos, arm64e-maccatalyst ]2755 arm64e-macos, arm64e-maccatalyst ]
...@@ -3128,21 +2768,8 @@ exports:...@@ -3128,21 +2768,8 @@ exports:
3128tbd-version: 42768tbd-version: 4
3129targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2769targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3130 arm64e-macos, arm64e-maccatalyst ]2770 arm64e-macos, arm64e-maccatalyst ]
3131uuids:
3132 - target: x86_64-macos
3133 value: F314B62B-98F4-3A7C-8296-8739F8B6855A
3134 - target: x86_64-maccatalyst
3135 value: F314B62B-98F4-3A7C-8296-8739F8B6855A
3136 - target: arm64-macos
3137 value: ABF0BAEB-706B-3AC1-B6AD-B5CF380B8963
3138 - target: arm64-maccatalyst
3139 value: ABF0BAEB-706B-3AC1-B6AD-B5CF380B8963
3140 - target: arm64e-macos
3141 value: B215AE90-4ED2-3FCD-8CCC-6C0D93CC4F41
3142 - target: arm64e-maccatalyst
3143 value: B215AE90-4ED2-3FCD-8CCC-6C0D93CC4F41
3144install-name: '/usr/lib/system/libsystem_platform.dylib'2771install-name: '/usr/lib/system/libsystem_platform.dylib'
3145current-version: 2882772current-version: 292.100.1
3146parent-umbrella:2773parent-umbrella:
3147 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2774 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3148 arm64e-macos, arm64e-maccatalyst ]2775 arm64e-macos, arm64e-maccatalyst ]
...@@ -3204,37 +2831,18 @@ exports:...@@ -3204,37 +2831,18 @@ exports:
3204 _os_unfair_lock_unlock, _os_unfair_lock_unlock_no_tsd, _os_unfair_recursive_lock_lock_with_options, 2831 _os_unfair_lock_unlock, _os_unfair_lock_unlock_no_tsd, _os_unfair_recursive_lock_lock_with_options,
3205 _os_unfair_recursive_lock_owned, _os_unfair_recursive_lock_trylock, 2832 _os_unfair_recursive_lock_owned, _os_unfair_recursive_lock_trylock,
3206 _os_unfair_recursive_lock_tryunlock4objc, _os_unfair_recursive_lock_unlock, 2833 _os_unfair_recursive_lock_tryunlock4objc, _os_unfair_recursive_lock_unlock,
3207 _os_unfair_recursive_lock_unlock_forked_child, _platform_task_attach, 2834 _os_unfair_recursive_lock_unlock_forked_child, _setcontext,
3208 _platform_task_copy_next_thread, _platform_task_detach, _platform_task_is_64_bit, 2835 _setjmp, _siglongjmp, _sigsetjmp, _spin_lock, _spin_lock_try,
3209 _platform_task_perform, _platform_task_resume_threads, _platform_task_suspend_threads, 2836 _spin_unlock, _swapcontext, _sys_cache_control, _sys_dcache_flush,
3210 _platform_task_update_threads, _platform_thread_abort_safely, 2837 _sys_icache_invalidate ]
3211 _platform_thread_get_pthread, _platform_thread_get_state,
3212 _platform_thread_get_unique_id, _platform_thread_info, _platform_thread_perform,
3213 _platform_thread_release, _platform_thread_resume, _platform_thread_set_state,
3214 _platform_thread_suspend, _setcontext, _setjmp, _siglongjmp,
3215 _sigsetjmp, _spin_lock, _spin_lock_try, _spin_unlock, _swapcontext,
3216 _sys_cache_control, _sys_dcache_flush, _sys_icache_invalidate ]
3217 - targets: [ arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]2838 - targets: [ arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ]
3218 symbols: [ __ctx_done ]2839 symbols: [ __ctx_done ]
3219--- !tapi-tbd2840--- !tapi-tbd
3220tbd-version: 42841tbd-version: 4
3221targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2842targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3222 arm64e-macos, arm64e-maccatalyst ]2843 arm64e-macos, arm64e-maccatalyst ]
3223uuids:
3224 - target: x86_64-macos
3225 value: 5920E36F-53EC-33F0-B675-8AE48B58418C
3226 - target: x86_64-maccatalyst
3227 value: 5920E36F-53EC-33F0-B675-8AE48B58418C
3228 - target: arm64-macos
3229 value: 51C613E3-4ABF-359C-B275-2608BB1BE0B6
3230 - target: arm64-maccatalyst
3231 value: 51C613E3-4ABF-359C-B275-2608BB1BE0B6
3232 - target: arm64e-macos
3233 value: 132084C6-C347-3489-9AC2-FCAAD21CDB73
3234 - target: arm64e-maccatalyst
3235 value: 132084C6-C347-3489-9AC2-FCAAD21CDB73
3236install-name: '/usr/lib/system/libsystem_pthread.dylib'2844install-name: '/usr/lib/system/libsystem_pthread.dylib'
3237current-version: 5142845current-version: 514.100.2
3238parent-umbrella:2846parent-umbrella:
3239 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2847 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3240 arm64e-macos, arm64e-maccatalyst ]2848 arm64e-macos, arm64e-maccatalyst ]
...@@ -3328,21 +2936,8 @@ exports:...@@ -3328,21 +2936,8 @@ exports:
3328tbd-version: 42936tbd-version: 4
3329targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2937targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3330 arm64e-macos, arm64e-maccatalyst ]2938 arm64e-macos, arm64e-maccatalyst ]
3331uuids:
3332 - target: x86_64-macos
3333 value: D199B283-8F09-3F2F-A17E-274BFF7733BE
3334 - target: x86_64-maccatalyst
3335 value: D199B283-8F09-3F2F-A17E-274BFF7733BE
3336 - target: arm64-macos
3337 value: 00000000-0000-0000-0000-000000000000
3338 - target: arm64-maccatalyst
3339 value: 00000000-0000-0000-0000-000000000000
3340 - target: arm64e-macos
3341 value: 3680811A-78F7-361A-ABBE-8E783165AC81
3342 - target: arm64e-maccatalyst
3343 value: 3680811A-78F7-361A-ABBE-8E783165AC81
3344install-name: '/usr/lib/system/libsystem_sandbox.dylib'2939install-name: '/usr/lib/system/libsystem_sandbox.dylib'
3345current-version: 1845.60.122940current-version: 1846.100.185
3346parent-umbrella:2941parent-umbrella:
3347 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 2942 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3348 arm64e-macos, arm64e-maccatalyst ]2943 arm64e-macos, arm64e-maccatalyst ]
...@@ -3370,8 +2965,8 @@ exports:...@@ -3370,8 +2965,8 @@ exports:
3370 _rootless_check_trusted_class, _rootless_check_trusted_fd, 2965 _rootless_check_trusted_class, _rootless_check_trusted_fd,
3371 _rootless_convert_to_datavault, _rootless_manifest_free, _rootless_manifest_parse, 2966 _rootless_convert_to_datavault, _rootless_manifest_free, _rootless_manifest_parse,
3372 _rootless_mkdir_datavault, _rootless_mkdir_nounlink, _rootless_mkdir_restricted, 2967 _rootless_mkdir_datavault, _rootless_mkdir_nounlink, _rootless_mkdir_restricted,
3373 _rootless_preflight, _rootless_protected_volume, _rootless_register_trusted_storage_class, 2968 _rootless_preflight, _rootless_protected_volume, _rootless_protected_volume_fd,
3374 _rootless_remove_datavault_in_favor_of_static_storage_class, 2969 _rootless_register_trusted_storage_class, _rootless_remove_datavault_in_favor_of_static_storage_class,
3375 _rootless_remove_restricted_in_favor_of_static_storage_class, 2970 _rootless_remove_restricted_in_favor_of_static_storage_class,
3376 _rootless_restricted_environment, _rootless_suspend, _rootless_trusted_by_self_token, 2971 _rootless_restricted_environment, _rootless_suspend, _rootless_trusted_by_self_token,
3377 _rootless_verify_trusted_by_self_token, _sandbox_builtin_query, 2972 _rootless_verify_trusted_by_self_token, _sandbox_builtin_query,
...@@ -3415,21 +3010,8 @@ exports:...@@ -3415,21 +3010,8 @@ exports:
3415tbd-version: 43010tbd-version: 4
3416targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3011targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3417 arm64e-macos, arm64e-maccatalyst ]3012 arm64e-macos, arm64e-maccatalyst ]
3418uuids:
3419 - target: x86_64-macos
3420 value: F24B1FA9-5692-35BA-9A9C-E071B7BFA5D7
3421 - target: x86_64-maccatalyst
3422 value: F24B1FA9-5692-35BA-9A9C-E071B7BFA5D7
3423 - target: arm64-macos
3424 value: 00000000-0000-0000-0000-000000000000
3425 - target: arm64-maccatalyst
3426 value: 00000000-0000-0000-0000-000000000000
3427 - target: arm64e-macos
3428 value: 82513DC5-565F-3A4E-9431-4511FB0C22FA
3429 - target: arm64e-maccatalyst
3430 value: 82513DC5-565F-3A4E-9431-4511FB0C22FA
3431install-name: '/usr/lib/system/libsystem_secinit.dylib'3013install-name: '/usr/lib/system/libsystem_secinit.dylib'
3432current-version: 119.40.23014current-version: 120.100.7
3433parent-umbrella:3015parent-umbrella:
3434 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3016 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3435 arm64e-macos, arm64e-maccatalyst ]3017 arm64e-macos, arm64e-maccatalyst ]
...@@ -3444,19 +3026,6 @@ exports:...@@ -3444,19 +3026,6 @@ exports:
3444tbd-version: 43026tbd-version: 4
3445targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3027targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3446 arm64e-macos, arm64e-maccatalyst ]3028 arm64e-macos, arm64e-maccatalyst ]
3447uuids:
3448 - target: x86_64-macos
3449 value: A5915FB2-F0C9-3BF0-ADC6-BEB571C73E57
3450 - target: x86_64-maccatalyst
3451 value: A5915FB2-F0C9-3BF0-ADC6-BEB571C73E57
3452 - target: arm64-macos
3453 value: 00000000-0000-0000-0000-000000000000
3454 - target: arm64-maccatalyst
3455 value: 00000000-0000-0000-0000-000000000000
3456 - target: arm64e-macos
3457 value: B31CD553-083B-39C6-BCB9-B0413ECAF562
3458 - target: arm64e-maccatalyst
3459 value: B31CD553-083B-39C6-BCB9-B0413ECAF562
3460install-name: '/usr/lib/system/libsystem_symptoms.dylib'3029install-name: '/usr/lib/system/libsystem_symptoms.dylib'
3461parent-umbrella:3030parent-umbrella:
3462 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3031 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
...@@ -3474,21 +3043,8 @@ exports:...@@ -3474,21 +3043,8 @@ exports:
3474tbd-version: 43043tbd-version: 4
3475targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3044targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3476 arm64e-macos, arm64e-maccatalyst ]3045 arm64e-macos, arm64e-maccatalyst ]
3477uuids:
3478 - target: x86_64-macos
3479 value: C5359E6E-7B63-3E51-A664-3E3581E15F52
3480 - target: x86_64-maccatalyst
3481 value: C5359E6E-7B63-3E51-A664-3E3581E15F52
3482 - target: arm64-macos
3483 value: 00000000-0000-0000-0000-000000000000
3484 - target: arm64-maccatalyst
3485 value: 00000000-0000-0000-0000-000000000000
3486 - target: arm64e-macos
3487 value: 616F473A-EB21-377D-B3B4-F1581F127F0D
3488 - target: arm64e-maccatalyst
3489 value: 616F473A-EB21-377D-B3B4-F1581F127F0D
3490install-name: '/usr/lib/system/libsystem_trace.dylib'3046install-name: '/usr/lib/system/libsystem_trace.dylib'
3491current-version: 1406.60.23047current-version: 1431.100.13
3492parent-umbrella:3048parent-umbrella:
3493 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3049 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3494 arm64e-macos, arm64e-maccatalyst ]3050 arm64e-macos, arm64e-maccatalyst ]
...@@ -3534,15 +3090,17 @@ exports:...@@ -3534,15 +3090,17 @@ exports:
3534 _os_log_backtrace_create_from_return_address, _os_log_backtrace_destroy, 3090 _os_log_backtrace_create_from_return_address, _os_log_backtrace_destroy,
3535 _os_log_backtrace_get_frames, _os_log_backtrace_get_length, 3091 _os_log_backtrace_get_frames, _os_log_backtrace_get_length,
3536 _os_log_backtrace_print_to_blob, _os_log_backtrace_serialize_to_blob, 3092 _os_log_backtrace_print_to_blob, _os_log_backtrace_serialize_to_blob,
3537 _os_log_create, _os_log_errors_count, _os_log_fault_default_callback, 3093 _os_log_compare_enablement, _os_log_copy_decorated_message,
3538 _os_log_faults_count, _os_log_fmt_compose, _os_log_fmt_convert_trace, 3094 _os_log_copy_message_string, _os_log_create, _os_log_errors_count,
3539 _os_log_fmt_extract_pubdata, _os_log_fmt_get_plugin, _os_log_get_type, 3095 _os_log_fault_default_callback, _os_log_faults_count, _os_log_fmt_compose,
3540 _os_log_is_debug_enabled, _os_log_is_enabled, _os_log_pack_compose, 3096 _os_log_fmt_convert_trace, _os_log_fmt_extract_pubdata, _os_log_fmt_get_plugin,
3541 _os_log_pack_send, _os_log_pack_send_and_compose, _os_log_set_client_type, 3097 _os_log_get_type, _os_log_is_debug_enabled, _os_log_is_enabled,
3542 _os_log_set_enabled, _os_log_set_fault_callback, _os_log_shim_enabled, 3098 _os_log_pack_compose, _os_log_pack_send, _os_log_pack_send_and_compose,
3099 _os_log_set_client_type, _os_log_set_enabled, _os_log_set_fault_callback,
3100 _os_log_set_hook, _os_log_set_test_callback, _os_log_shim_enabled,
3543 _os_log_shim_legacy_logging_enabled, _os_log_shim_with_CFString, 3101 _os_log_shim_legacy_logging_enabled, _os_log_shim_with_CFString,
3544 _os_log_type_enabled, _os_log_with_args, _os_signpost_enabled, 3102 _os_log_type_enabled, _os_log_type_get_name, _os_log_with_args,
3545 _os_signpost_id_generate, _os_signpost_id_make_with_pointer, 3103 _os_signpost_enabled, _os_signpost_id_generate, _os_signpost_id_make_with_pointer,
3546 _os_signpost_set_introspection_hook_4Perf, _os_state_add_handler, 3104 _os_signpost_set_introspection_hook_4Perf, _os_state_add_handler,
3547 _os_state_remove_handler, _os_trace_debug_enabled, _os_trace_get_mode, 3105 _os_state_remove_handler, _os_trace_debug_enabled, _os_trace_get_mode,
3548 _os_trace_get_type, _os_trace_info_enabled, _os_trace_set_mode ]3106 _os_trace_get_type, _os_trace_info_enabled, _os_trace_set_mode ]
...@@ -3551,21 +3109,8 @@ exports:...@@ -3551,21 +3109,8 @@ exports:
3551tbd-version: 43109tbd-version: 4
3552targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3110targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3553 arm64e-macos, arm64e-maccatalyst ]3111 arm64e-macos, arm64e-maccatalyst ]
3554uuids:
3555 - target: x86_64-macos
3556 value: E45FA86E-48EB-3926-A24C-323DB84D3700
3557 - target: x86_64-maccatalyst
3558 value: E45FA86E-48EB-3926-A24C-323DB84D3700
3559 - target: arm64-macos
3560 value: 00000000-0000-0000-0000-000000000000
3561 - target: arm64-maccatalyst
3562 value: 00000000-0000-0000-0000-000000000000
3563 - target: arm64e-macos
3564 value: 1228EDDF-7C61-3674-8C42-B537FFE9EDDA
3565 - target: arm64e-maccatalyst
3566 value: 1228EDDF-7C61-3674-8C42-B537FFE9EDDA
3567install-name: '/usr/lib/system/libunwind.dylib'3112install-name: '/usr/lib/system/libunwind.dylib'
3568current-version: 202.1003113current-version: 1500.26
3569parent-umbrella:3114parent-umbrella:
3570 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3115 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3571 arm64e-macos, arm64e-maccatalyst ]3116 arm64e-macos, arm64e-maccatalyst ]
...@@ -3614,7 +3159,8 @@ exports:...@@ -3614,7 +3159,8 @@ exports:
3614 __Unwind_GetLanguageSpecificData, __Unwind_GetRegionStart, 3159 __Unwind_GetLanguageSpecificData, __Unwind_GetRegionStart,
3615 __Unwind_GetTextRelBase, __Unwind_RaiseException, __Unwind_Resume, 3160 __Unwind_GetTextRelBase, __Unwind_RaiseException, __Unwind_Resume,
3616 __Unwind_Resume_or_Rethrow, __Unwind_SetGR, __Unwind_SetIP, 3161 __Unwind_Resume_or_Rethrow, __Unwind_SetGR, __Unwind_SetIP,
3617 ___deregister_frame, ___register_frame, ___unw_add_dynamic_fde, 3162 ___deregister_frame, ___register_frame, ___unw_add_dynamic_eh_frame_section,
3163 ___unw_add_dynamic_fde, ___unw_remove_dynamic_eh_frame_section,
3618 ___unw_remove_dynamic_fde, _unw_get_fpreg, _unw_get_proc_info, 3164 ___unw_remove_dynamic_fde, _unw_get_fpreg, _unw_get_proc_info,
3619 _unw_get_proc_name, _unw_get_reg, _unw_getcontext, _unw_init_local, 3165 _unw_get_proc_name, _unw_get_reg, _unw_getcontext, _unw_init_local,
3620 _unw_is_fpreg, _unw_is_signal_frame, _unw_iterate_dwarf_unwind_cache, 3166 _unw_is_fpreg, _unw_is_signal_frame, _unw_iterate_dwarf_unwind_cache,
...@@ -3624,21 +3170,8 @@ exports:...@@ -3624,21 +3170,8 @@ exports:
3624tbd-version: 43170tbd-version: 4
3625targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3171targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3626 arm64e-macos, arm64e-maccatalyst ]3172 arm64e-macos, arm64e-maccatalyst ]
3627uuids:
3628 - target: x86_64-macos
3629 value: 7E56F9FE-DC35-3354-BA23-4103C09E22DD
3630 - target: x86_64-maccatalyst
3631 value: 7E56F9FE-DC35-3354-BA23-4103C09E22DD
3632 - target: arm64-macos
3633 value: 00000000-0000-0000-0000-000000000000
3634 - target: arm64-maccatalyst
3635 value: 00000000-0000-0000-0000-000000000000
3636 - target: arm64e-macos
3637 value: 8EF4547D-1AF8-37CF-B15A-29405BF12642
3638 - target: arm64e-maccatalyst
3639 value: 8EF4547D-1AF8-37CF-B15A-29405BF12642
3640install-name: '/usr/lib/system/libxpc.dylib'3173install-name: '/usr/lib/system/libxpc.dylib'
3641current-version: 2462.60.153174current-version: 2462.100.95
3642parent-umbrella:3175parent-umbrella:
3643 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, 3176 - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst,
3644 arm64e-macos, arm64e-maccatalyst ]3177 arm64e-macos, arm64e-maccatalyst ]
...@@ -3685,12 +3218,13 @@ exports:...@@ -3685,12 +3218,13 @@ exports:
3685 _XPC_COALITION_INFO_KEY_RESOURCE_USAGE_BLOB, __availability_version_check, 3218 _XPC_COALITION_INFO_KEY_RESOURCE_USAGE_BLOB, __availability_version_check,
3686 __launch_job_routine, __launch_job_routine_async, __launch_msg2, 3219 __launch_job_routine, __launch_job_routine_async, __launch_msg2,
3687 __launch_server_test_routine, __launch_service_stats_copy_4ppse_impl, 3220 __launch_server_test_routine, __launch_service_stats_copy_4ppse_impl,
3688 __libxpc_initializer, __spawn_via_launchd, __system_ios_support_version_copy_string_sysctl, 3221 __launch_service_stats_copy_impl, __libxpc_initializer, __spawn_via_launchd,
3689 __system_version_copy_string_plist, __system_version_copy_string_sysctl, 3222 __system_ios_support_version_copy_string_sysctl, __system_version_copy_string_plist,
3690 __system_version_fallback, __system_version_parse_string, 3223 __system_version_copy_string_sysctl, __system_version_fallback,
3691 __vproc_get_last_exit_status, __vproc_grab_subset, __vproc_kickstart_by_label, 3224 __system_version_parse_string, __vproc_get_last_exit_status,
3692 __vproc_log, __vproc_log_error, __vproc_logv, __vproc_pid_is_managed, 3225 __vproc_grab_subset, __vproc_kickstart_by_label, __vproc_log,
3693 __vproc_post_fork_ping, __vproc_send_signal_by_label, __vproc_set_global_on_demand, 3226 __vproc_log_error, __vproc_logv, __vproc_pid_is_managed, __vproc_post_fork_ping,
3227 __vproc_send_signal_by_label, __vproc_set_global_on_demand,
3694 __vproc_standby_begin, __vproc_standby_count, __vproc_standby_end, 3228 __vproc_standby_begin, __vproc_standby_count, __vproc_standby_end,
3695 __vproc_standby_timeout, __vproc_transaction_begin, __vproc_transaction_count, 3229 __vproc_standby_timeout, __vproc_transaction_begin, __vproc_transaction_count,
3696 __vproc_transaction_count_for_pid, __vproc_transaction_end, 3230 __vproc_transaction_count_for_pid, __vproc_transaction_end,
...@@ -3762,16 +3296,17 @@ exports:...@@ -3762,16 +3296,17 @@ exports:
3762 _launch_perfcheck_property_endpoint_name, _launch_perfcheck_property_endpoint_needs_activation, 3296 _launch_perfcheck_property_endpoint_name, _launch_perfcheck_property_endpoint_needs_activation,
3763 _launch_perfcheck_property_endpoints, _launch_remove_external_service, 3297 _launch_perfcheck_property_endpoints, _launch_remove_external_service,
3764 _launch_service_instance_copy_uuids, _launch_service_instance_create, 3298 _launch_service_instance_copy_uuids, _launch_service_instance_create,
3765 _launch_service_instance_remove, _launch_service_stats_disable_4ppse, 3299 _launch_service_instance_remove, _launch_service_stats_disable,
3766 _launch_service_stats_enable_4ppse, _launch_service_stats_is_enabled_4ppse, 3300 _launch_service_stats_disable_4ppse, _launch_service_stats_enable,
3767 _launch_set_service_enabled, _launch_set_system_service_enabled, 3301 _launch_service_stats_enable_4ppse, _launch_service_stats_is_enabled,
3768 _launch_socket_service_check_in, _launch_version_for_user_service_4coresim, 3302 _launch_service_stats_is_enabled_4ppse, _launch_set_service_enabled,
3769 _launch_wait, _launchd_close, _launchd_fdopen, _launchd_getfd, 3303 _launch_set_system_service_enabled, _launch_socket_service_check_in,
3770 _launchd_msg_recv, _launchd_msg_send, _load_launchd_jobs_at_loginwindow_prompt, 3304 _launch_version_for_user_service_4coresim, _launch_wait, _launchd_close,
3771 _mpm_uncork_fork, _mpm_wait, _os_system_version_get_current_version, 3305 _launchd_fdopen, _launchd_getfd, _launchd_msg_recv, _launchd_msg_send,
3772 _os_system_version_get_ios_support_version, _os_system_version_sim_get_current_host_version, 3306 _load_launchd_jobs_at_loginwindow_prompt, _mpm_uncork_fork,
3773 _os_transaction_copy_description, _os_transaction_create, 3307 _mpm_wait, _os_system_version_get_current_version, _os_system_version_get_ios_support_version,
3774 _os_transaction_get_description, _os_transaction_get_timestamp, 3308 _os_system_version_sim_get_current_host_version, _os_transaction_copy_description,
3309 _os_transaction_create, _os_transaction_get_description, _os_transaction_get_timestamp,
3775 _os_transaction_needs_more_time, _place_hold_on_real_loginwindow, 3310 _os_transaction_needs_more_time, _place_hold_on_real_loginwindow,
3776 _reboot2, _reboot3, _vproc_release, _vproc_retain, _vproc_standby_begin, 3311 _reboot2, _reboot3, _vproc_release, _vproc_retain, _vproc_standby_begin,
3777 _vproc_standby_end, _vproc_swap_complex, _vproc_swap_integer, 3312 _vproc_standby_end, _vproc_swap_complex, _vproc_swap_integer,
src/link/tapi.zig+1-1
...@@ -36,7 +36,7 @@ pub const TbdV3 = struct {...@@ -36,7 +36,7 @@ pub const TbdV3 = struct {
36pub const TbdV4 = struct {36pub const TbdV4 = struct {
37 tbd_version: u3,37 tbd_version: u3,
38 targets: []const []const u8,38 targets: []const []const u8,
39 uuids: []const struct {39 uuids: ?[]const struct {
40 target: []const u8,40 target: []const u8,
41 value: []const u8,41 value: []const u8,
42 },42 },
src/link/tapi/Tokenizer.zig+338-223
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const Tokenizer = @This();1const Tokenizer = @This();
22
3const std = @import("std");3const std = @import("std");
4const log = std.log.scoped(.tapi);4const log = std.log.scoped(.yaml);
5const testing = std.testing;5const testing = std.testing;
66
7buffer: []const u8,7buffer: []const u8,
...@@ -13,29 +13,31 @@ pub const Token = struct {...@@ -13,29 +13,31 @@ pub const Token = struct {
13 end: usize,13 end: usize,
1414
15 pub const Id = enum {15 pub const Id = enum {
16 Eof,16 // zig fmt: off
1717 eof,
18 NewLine,18
19 DocStart, // ---19 new_line,
20 DocEnd, // ...20 doc_start, // ---
21 SeqItemInd, // -21 doc_end, // ...
22 MapValueInd, // :22 seq_item_ind, // -
23 FlowMapStart, // {23 map_value_ind, // :
24 FlowMapEnd, // }24 flow_map_start, // {
25 FlowSeqStart, // [25 flow_map_end, // }
26 FlowSeqEnd, // ]26 flow_seq_start, // [
2727 flow_seq_end, // ]
28 Comma,28
29 Space,29 comma,
30 Tab,30 space,
31 Comment, // #31 tab,
32 Alias, // *32 comment, // #
33 Anchor, // &33 alias, // *
34 Tag, // !34 anchor, // &
35 SingleQuote, // '35 tag, // !
36 DoubleQuote, // "36
3737 single_quoted, // '...'
38 Literal,38 double_quoted, // "..."
39 literal,
40 // zig fmt: on
39 };41 };
40};42};
4143
...@@ -45,8 +47,8 @@ pub const TokenIterator = struct {...@@ -45,8 +47,8 @@ pub const TokenIterator = struct {
45 buffer: []const Token,47 buffer: []const Token,
46 pos: TokenIndex = 0,48 pos: TokenIndex = 0,
4749
48 pub fn next(self: *TokenIterator) Token {50 pub fn next(self: *TokenIterator) ?Token {
49 const token = self.buffer[self.pos];51 const token = self.peek() orelse return null;
50 self.pos += 1;52 self.pos += 1;
51 return token;53 return token;
52 }54 }
...@@ -74,180 +76,212 @@ pub const TokenIterator = struct {...@@ -74,180 +76,212 @@ pub const TokenIterator = struct {
74 }76 }
75};77};
7678
79fn stringMatchesPattern(comptime pattern: []const u8, slice: []const u8) bool {
80 comptime var count: usize = 0;
81 inline while (count < pattern.len) : (count += 1) {
82 if (count >= slice.len) return false;
83 const c = slice[count];
84 if (pattern[count] != c) return false;
85 }
86 return true;
87}
88
89fn matchesPattern(self: Tokenizer, comptime pattern: []const u8) bool {
90 return stringMatchesPattern(pattern, self.buffer[self.index..]);
91}
92
77pub fn next(self: *Tokenizer) Token {93pub fn next(self: *Tokenizer) Token {
78 var result = Token{94 var result = Token{
79 .id = .Eof,95 .id = .eof,
80 .start = self.index,96 .start = self.index,
81 .end = undefined,97 .end = undefined,
82 };98 };
8399
84 var state: union(enum) {100 var state: enum {
85 Start,101 start,
86 NewLine,102 new_line,
87 Space,103 space,
88 Tab,104 tab,
89 Hyphen: usize,105 comment,
90 Dot: usize,106 single_quoted,
91 Literal,107 double_quoted,
92 } = .Start;108 literal,
109 } = .start;
93110
94 while (self.index < self.buffer.len) : (self.index += 1) {111 while (self.index < self.buffer.len) : (self.index += 1) {
95 const c = self.buffer[self.index];112 const c = self.buffer[self.index];
96 switch (state) {113 switch (state) {
97 .Start => switch (c) {114 .start => switch (c) {
98 ' ' => {115 ' ' => {
99 state = .Space;116 state = .space;
100 },117 },
101 '\t' => {118 '\t' => {
102 state = .Tab;119 state = .tab;
103 },120 },
104 '\n' => {121 '\n' => {
105 result.id = .NewLine;122 result.id = .new_line;
106 self.index += 1;123 self.index += 1;
107 break;124 break;
108 },125 },
109 '\r' => {126 '\r' => {
110 state = .NewLine;127 state = .new_line;
111 },128 },
112 '-' => {129
113 state = .{ .Hyphen = 1 };130 '-' => if (self.matchesPattern("---")) {
131 result.id = .doc_start;
132 self.index += "---".len;
133 break;
134 } else if (self.matchesPattern("- ")) {
135 result.id = .seq_item_ind;
136 self.index += "- ".len;
137 break;
138 } else {
139 state = .literal;
114 },140 },
115 '.' => {141
116 state = .{ .Dot = 1 };142 '.' => if (self.matchesPattern("...")) {
143 result.id = .doc_end;
144 self.index += "...".len;
145 break;
146 } else {
147 state = .literal;
117 },148 },
149
118 ',' => {150 ',' => {
119 result.id = .Comma;151 result.id = .comma;
120 self.index += 1;152 self.index += 1;
121 break;153 break;
122 },154 },
123 '#' => {155 '#' => {
124 result.id = .Comment;156 state = .comment;
125 self.index += 1;
126 break;
127 },157 },
128 '*' => {158 '*' => {
129 result.id = .Alias;159 result.id = .alias;
130 self.index += 1;160 self.index += 1;
131 break;161 break;
132 },162 },
133 '&' => {163 '&' => {
134 result.id = .Anchor;164 result.id = .anchor;
135 self.index += 1;165 self.index += 1;
136 break;166 break;
137 },167 },
138 '!' => {168 '!' => {
139 result.id = .Tag;169 result.id = .tag;
140 self.index += 1;
141 break;
142 },
143 '\'' => {
144 result.id = .SingleQuote;
145 self.index += 1;
146 break;
147 },
148 '"' => {
149 result.id = .DoubleQuote;
150 self.index += 1;170 self.index += 1;
151 break;171 break;
152 },172 },
153 '[' => {173 '[' => {
154 result.id = .FlowSeqStart;174 result.id = .flow_seq_start;
155 self.index += 1;175 self.index += 1;
156 break;176 break;
157 },177 },
158 ']' => {178 ']' => {
159 result.id = .FlowSeqEnd;179 result.id = .flow_seq_end;
160 self.index += 1;180 self.index += 1;
161 break;181 break;
162 },182 },
163 ':' => {183 ':' => {
164 result.id = .MapValueInd;184 result.id = .map_value_ind;
165 self.index += 1;185 self.index += 1;
166 break;186 break;
167 },187 },
168 '{' => {188 '{' => {
169 result.id = .FlowMapStart;189 result.id = .flow_map_start;
170 self.index += 1;190 self.index += 1;
171 break;191 break;
172 },192 },
173 '}' => {193 '}' => {
174 result.id = .FlowMapEnd;194 result.id = .flow_map_end;
175 self.index += 1;195 self.index += 1;
176 break;196 break;
177 },197 },
198 '\'' => {
199 state = .single_quoted;
200 },
201 '"' => {
202 state = .double_quoted;
203 },
178 else => {204 else => {
179 state = .Literal;205 state = .literal;
206 },
207 },
208
209 .comment => switch (c) {
210 '\r', '\n' => {
211 result.id = .comment;
212 break;
180 },213 },
214 else => {},
181 },215 },
182 .Space => switch (c) {216
217 .space => switch (c) {
183 ' ' => {},218 ' ' => {},
184 else => {219 else => {
185 result.id = .Space;220 result.id = .space;
186 break;221 break;
187 },222 },
188 },223 },
189 .Tab => switch (c) {224
225 .tab => switch (c) {
190 '\t' => {},226 '\t' => {},
191 else => {227 else => {
192 result.id = .Tab;228 result.id = .tab;
193 break;229 break;
194 },230 },
195 },231 },
196 .NewLine => switch (c) {232
233 .new_line => switch (c) {
197 '\n' => {234 '\n' => {
198 result.id = .NewLine;235 result.id = .new_line;
199 self.index += 1;236 self.index += 1;
200 break;237 break;
201 },238 },
202 else => {}, // TODO this should be an error condition239 else => {}, // TODO this should be an error condition
203 },240 },
204 .Hyphen => |*count| switch (c) {241
205 ' ' => {242 .single_quoted => switch (c) {
206 result.id = .SeqItemInd;243 '\'' => if (!self.matchesPattern("''")) {
244 result.id = .single_quoted;
207 self.index += 1;245 self.index += 1;
208 break;246 break;
247 } else {
248 self.index += "''".len - 1;
209 },249 },
210 '-' => {250 else => {},
211 count.* += 1;
212
213 if (count.* == 3) {
214 result.id = .DocStart;
215 self.index += 1;
216 break;
217 }
218 },
219 else => {
220 state = .Literal;
221 },
222 },251 },
223 .Dot => |*count| switch (c) {
224 '.' => {
225 count.* += 1;
226252
227 if (count.* == 3) {253 .double_quoted => switch (c) {
228 result.id = .DocEnd;254 '"' => {
255 if (stringMatchesPattern("\\", self.buffer[self.index - 1 ..])) {
256 self.index += 1;
257 } else {
258 result.id = .double_quoted;
229 self.index += 1;259 self.index += 1;
230 break;260 break;
231 }261 }
232 },262 },
233 else => {263 else => {},
234 state = .Literal;
235 },
236 },264 },
237 .Literal => switch (c) {265
266 .literal => switch (c) {
238 '\r', '\n', ' ', '\'', '"', ',', ':', ']', '}' => {267 '\r', '\n', ' ', '\'', '"', ',', ':', ']', '}' => {
239 result.id = .Literal;268 result.id = .literal;
240 break;269 break;
241 },270 },
242 else => {271 else => {
243 result.id = .Literal;272 result.id = .literal;
244 },273 },
245 },274 },
246 }275 }
247 }276 }
248277
249 if (state == .Literal and result.id == .Eof) {278 if (self.index >= self.buffer.len) {
250 result.id = .Literal;279 switch (state) {
280 .literal => {
281 result.id = .literal;
282 },
283 else => {},
284 }
251 }285 }
252286
253 result.end = self.index;287 result.end = self.index;
...@@ -263,22 +297,24 @@ fn testExpected(source: []const u8, expected: []const Token.Id) !void {...@@ -263,22 +297,24 @@ fn testExpected(source: []const u8, expected: []const Token.Id) !void {
263 .buffer = source,297 .buffer = source,
264 };298 };
265299
266 var token_len: usize = 0;300 var given = std.ArrayList(Token.Id).init(testing.allocator);
267 for (expected) |exp| {301 defer given.deinit();
268 token_len += 1;302
303 while (true) {
269 const token = tokenizer.next();304 const token = tokenizer.next();
270 try testing.expectEqual(exp, token.id);305 try given.append(token.id);
306 if (token.id == .eof) break;
271 }307 }
272308
273 while (tokenizer.next().id != .Eof) {309 try testing.expectEqualSlices(Token.Id, expected, given.items);
274 token_len += 1; // consume all tokens310}
275 }
276311
277 try testing.expectEqual(expected.len, token_len);312test {
313 std.testing.refAllDecls(@This());
278}314}
279315
280test "empty doc" {316test "empty doc" {
281 try testExpected("", &[_]Token.Id{.Eof});317 try testExpected("", &[_]Token.Id{.eof});
282}318}
283319
284test "empty doc with explicit markers" {320test "empty doc with explicit markers" {
...@@ -286,7 +322,22 @@ test "empty doc with explicit markers" {...@@ -286,7 +322,22 @@ test "empty doc with explicit markers" {
286 \\---322 \\---
287 \\...323 \\...
288 , &[_]Token.Id{324 , &[_]Token.Id{
289 .DocStart, .NewLine, .DocEnd, .Eof,325 .doc_start, .new_line, .doc_end, .eof,
326 });
327}
328
329test "empty doc with explicit markers and a directive" {
330 try testExpected(
331 \\--- !tbd-v1
332 \\...
333 , &[_]Token.Id{
334 .doc_start,
335 .space,
336 .tag,
337 .literal,
338 .new_line,
339 .doc_end,
340 .eof,
290 });341 });
291}342}
292343
...@@ -296,15 +347,15 @@ test "sequence of values" {...@@ -296,15 +347,15 @@ test "sequence of values" {
296 \\- 1347 \\- 1
297 \\- 2348 \\- 2
298 , &[_]Token.Id{349 , &[_]Token.Id{
299 .SeqItemInd,350 .seq_item_ind,
300 .Literal,351 .literal,
301 .NewLine,352 .new_line,
302 .SeqItemInd,353 .seq_item_ind,
303 .Literal,354 .literal,
304 .NewLine,355 .new_line,
305 .SeqItemInd,356 .seq_item_ind,
306 .Literal,357 .literal,
307 .Eof,358 .eof,
308 });359 });
309}360}
310361
...@@ -313,24 +364,24 @@ test "sequence of sequences" {...@@ -313,24 +364,24 @@ test "sequence of sequences" {
313 \\- [ val1, val2]364 \\- [ val1, val2]
314 \\- [val3, val4 ]365 \\- [val3, val4 ]
315 , &[_]Token.Id{366 , &[_]Token.Id{
316 .SeqItemInd,367 .seq_item_ind,
317 .FlowSeqStart,368 .flow_seq_start,
318 .Space,369 .space,
319 .Literal,370 .literal,
320 .Comma,371 .comma,
321 .Space,372 .space,
322 .Literal,373 .literal,
323 .FlowSeqEnd,374 .flow_seq_end,
324 .NewLine,375 .new_line,
325 .SeqItemInd,376 .seq_item_ind,
326 .FlowSeqStart,377 .flow_seq_start,
327 .Literal,378 .literal,
328 .Comma,379 .comma,
329 .Space,380 .space,
330 .Literal,381 .literal,
331 .Space,382 .space,
332 .FlowSeqEnd,383 .flow_seq_end,
333 .Eof,384 .eof,
334 });385 });
335}386}
336387
...@@ -339,16 +390,16 @@ test "mappings" {...@@ -339,16 +390,16 @@ test "mappings" {
339 \\key1: value1390 \\key1: value1
340 \\key2: value2391 \\key2: value2
341 , &[_]Token.Id{392 , &[_]Token.Id{
342 .Literal,393 .literal,
343 .MapValueInd,394 .map_value_ind,
344 .Space,395 .space,
345 .Literal,396 .literal,
346 .NewLine,397 .new_line,
347 .Literal,398 .literal,
348 .MapValueInd,399 .map_value_ind,
349 .Space,400 .space,
350 .Literal,401 .literal,
351 .Eof,402 .eof,
352 });403 });
353}404}
354405
...@@ -357,21 +408,21 @@ test "inline mapped sequence of values" {...@@ -357,21 +408,21 @@ test "inline mapped sequence of values" {
357 \\key : [ val1, 408 \\key : [ val1,
358 \\ val2 ]409 \\ val2 ]
359 , &[_]Token.Id{410 , &[_]Token.Id{
360 .Literal,411 .literal,
361 .Space,412 .space,
362 .MapValueInd,413 .map_value_ind,
363 .Space,414 .space,
364 .FlowSeqStart,415 .flow_seq_start,
365 .Space,416 .space,
366 .Literal,417 .literal,
367 .Comma,418 .comma,
368 .Space,419 .space,
369 .NewLine,420 .new_line,
370 .Space,421 .space,
371 .Literal,422 .literal,
372 .Space,423 .space,
373 .FlowSeqEnd,424 .flow_seq_end,
374 .Eof,425 .eof,
375 });426 });
376}427}
377428
...@@ -388,52 +439,50 @@ test "part of tbd" {...@@ -388,52 +439,50 @@ test "part of tbd" {
388 \\install-name: '/usr/lib/libSystem.B.dylib'439 \\install-name: '/usr/lib/libSystem.B.dylib'
389 \\...440 \\...
390 , &[_]Token.Id{441 , &[_]Token.Id{
391 .DocStart,442 .doc_start,
392 .Space,443 .space,
393 .Tag,444 .tag,
394 .Literal,445 .literal,
395 .NewLine,446 .new_line,
396 .Literal,447 .literal,
397 .MapValueInd,448 .map_value_ind,
398 .Space,449 .space,
399 .Literal,450 .literal,
400 .NewLine,451 .new_line,
401 .Literal,452 .literal,
402 .MapValueInd,453 .map_value_ind,
403 .Space,454 .space,
404 .FlowSeqStart,455 .flow_seq_start,
405 .Space,456 .space,
406 .Literal,457 .literal,
407 .Space,458 .space,
408 .FlowSeqEnd,459 .flow_seq_end,
409 .NewLine,460 .new_line,
410 .NewLine,461 .new_line,
411 .Literal,462 .literal,
412 .MapValueInd,463 .map_value_ind,
413 .NewLine,464 .new_line,
414 .Space,465 .space,
415 .SeqItemInd,466 .seq_item_ind,
416 .Literal,467 .literal,
417 .MapValueInd,468 .map_value_ind,
418 .Space,469 .space,
419 .Literal,470 .literal,
420 .NewLine,471 .new_line,
421 .Space,472 .space,
422 .Literal,473 .literal,
423 .MapValueInd,474 .map_value_ind,
424 .Space,475 .space,
425 .Literal,476 .literal,
426 .NewLine,477 .new_line,
427 .NewLine,478 .new_line,
428 .Literal,479 .literal,
429 .MapValueInd,480 .map_value_ind,
430 .Space,481 .space,
431 .SingleQuote,482 .single_quoted,
432 .Literal,483 .new_line,
433 .SingleQuote,484 .doc_end,
434 .NewLine,485 .eof,
435 .DocEnd,
436 .Eof,
437 });486 });
438}487}
439488
...@@ -443,18 +492,84 @@ test "Unindented list" {...@@ -443,18 +492,84 @@ test "Unindented list" {
443 \\- foo: 1492 \\- foo: 1
444 \\c: 1493 \\c: 1
445 , &[_]Token.Id{494 , &[_]Token.Id{
446 .Literal,495 .literal,
447 .MapValueInd,496 .map_value_ind,
448 .NewLine,497 .new_line,
449 .SeqItemInd,498 .seq_item_ind,
450 .Literal,499 .literal,
451 .MapValueInd,500 .map_value_ind,
452 .Space,501 .space,
453 .Literal,502 .literal,
454 .NewLine,503 .new_line,
455 .Literal,504 .literal,
456 .MapValueInd,505 .map_value_ind,
457 .Space,506 .space,
458 .Literal,507 .literal,
508 .eof,
509 });
510}
511
512test "escape sequences" {
513 try testExpected(
514 \\a: 'here''s an apostrophe'
515 \\b: "a newline\nand a\ttab"
516 \\c: "\"here\" and there"
517 , &[_]Token.Id{
518 .literal,
519 .map_value_ind,
520 .space,
521 .single_quoted,
522 .new_line,
523 .literal,
524 .map_value_ind,
525 .space,
526 .double_quoted,
527 .new_line,
528 .literal,
529 .map_value_ind,
530 .space,
531 .double_quoted,
532 .eof,
533 });
534}
535
536test "comments" {
537 try testExpected(
538 \\key: # some comment about the key
539 \\# first value
540 \\- val1
541 \\# second value
542 \\- val2
543 , &[_]Token.Id{
544 .literal,
545 .map_value_ind,
546 .space,
547 .comment,
548 .new_line,
549 .comment,
550 .new_line,
551 .seq_item_ind,
552 .literal,
553 .new_line,
554 .comment,
555 .new_line,
556 .seq_item_ind,
557 .literal,
558 .eof,
559 });
560}
561
562test "quoted literals" {
563 try testExpected(
564 \\'#000000'
565 \\'[000000'
566 \\"&someString"
567 , &[_]Token.Id{
568 .single_quoted,
569 .new_line,
570 .single_quoted,
571 .new_line,
572 .double_quoted,
573 .eof,
459 });574 });
460}575}
src/link/tapi/parse.zig+378-323
...@@ -1,8 +1,7 @@...@@ -1,8 +1,7 @@
1const std = @import("std");1const std = @import("std");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const log = std.log.scoped(.tapi);3const log = std.log.scoped(.yaml);
4const mem = std.mem;4const mem = std.mem;
5const testing = std.testing;
65
7const Allocator = mem.Allocator;6const Allocator = mem.Allocator;
8const Tokenizer = @import("Tokenizer.zig");7const Tokenizer = @import("Tokenizer.zig");
...@@ -11,9 +10,9 @@ const TokenIndex = Tokenizer.TokenIndex;...@@ -11,9 +10,9 @@ const TokenIndex = Tokenizer.TokenIndex;
11const TokenIterator = Tokenizer.TokenIterator;10const TokenIterator = Tokenizer.TokenIterator;
1211
13pub const ParseError = error{12pub const ParseError = error{
13 InvalidEscapeSequence,
14 MalformedYaml,14 MalformedYaml,
15 NestedDocuments,15 NestedDocuments,
16 UnexpectedTag,
17 UnexpectedEof,16 UnexpectedEof,
18 UnexpectedToken,17 UnexpectedToken,
19 Unhandled,18 Unhandled,
...@@ -22,6 +21,8 @@ pub const ParseError = error{...@@ -22,6 +21,8 @@ pub const ParseError = error{
22pub const Node = struct {21pub const Node = struct {
23 tag: Tag,22 tag: Tag,
24 tree: *const Tree,23 tree: *const Tree,
24 start: TokenIndex,
25 end: TokenIndex,
2526
26 pub const Tag = enum {27 pub const Tag = enum {
27 doc,28 doc,
...@@ -61,9 +62,12 @@ pub const Node = struct {...@@ -61,9 +62,12 @@ pub const Node = struct {
61 }62 }
6263
63 pub const Doc = struct {64 pub const Doc = struct {
64 base: Node = Node{ .tag = Tag.doc, .tree = undefined },65 base: Node = Node{
65 start: ?TokenIndex = null,66 .tag = Tag.doc,
66 end: ?TokenIndex = null,67 .tree = undefined,
68 .start = undefined,
69 .end = undefined,
70 },
67 directive: ?TokenIndex = null,71 directive: ?TokenIndex = null,
68 value: ?*Node = null,72 value: ?*Node = null,
6973
...@@ -86,10 +90,8 @@ pub const Node = struct {...@@ -86,10 +90,8 @@ pub const Node = struct {
86 _ = fmt;90 _ = fmt;
87 if (self.directive) |id| {91 if (self.directive) |id| {
88 try std.fmt.format(writer, "{{ ", .{});92 try std.fmt.format(writer, "{{ ", .{});
89 const directive = self.base.tree.tokens[id];93 const directive = self.base.tree.getRaw(id, id);
90 try std.fmt.format(writer, ".directive = {s}, ", .{94 try std.fmt.format(writer, ".directive = {s}, ", .{directive});
91 self.base.tree.source[directive.start..directive.end],
92 });
93 }95 }
94 if (self.value) |node| {96 if (self.value) |node| {
95 try std.fmt.format(writer, "{}", .{node});97 try std.fmt.format(writer, "{}", .{node});
...@@ -101,22 +103,27 @@ pub const Node = struct {...@@ -101,22 +103,27 @@ pub const Node = struct {
101 };103 };
102104
103 pub const Map = struct {105 pub const Map = struct {
104 base: Node = Node{ .tag = Tag.map, .tree = undefined },106 base: Node = Node{
105 start: ?TokenIndex = null,107 .tag = Tag.map,
106 end: ?TokenIndex = null,108 .tree = undefined,
109 .start = undefined,
110 .end = undefined,
111 },
107 values: std.ArrayListUnmanaged(Entry) = .{},112 values: std.ArrayListUnmanaged(Entry) = .{},
108113
109 pub const base_tag: Node.Tag = .map;114 pub const base_tag: Node.Tag = .map;
110115
111 pub const Entry = struct {116 pub const Entry = struct {
112 key: TokenIndex,117 key: TokenIndex,
113 value: *Node,118 value: ?*Node,
114 };119 };
115120
116 pub fn deinit(self: *Map, allocator: Allocator) void {121 pub fn deinit(self: *Map, allocator: Allocator) void {
117 for (self.values.items) |entry| {122 for (self.values.items) |entry| {
118 entry.value.deinit(allocator);123 if (entry.value) |value| {
119 allocator.destroy(entry.value);124 value.deinit(allocator);
125 allocator.destroy(value);
126 }
120 }127 }
121 self.values.deinit(allocator);128 self.values.deinit(allocator);
122 }129 }
...@@ -131,20 +138,24 @@ pub const Node = struct {...@@ -131,20 +138,24 @@ pub const Node = struct {
131 _ = fmt;138 _ = fmt;
132 try std.fmt.format(writer, "{{ ", .{});139 try std.fmt.format(writer, "{{ ", .{});
133 for (self.values.items) |entry| {140 for (self.values.items) |entry| {
134 const key = self.base.tree.tokens[entry.key];141 const key = self.base.tree.getRaw(entry.key, entry.key);
135 try std.fmt.format(writer, "{s} => {}, ", .{142 if (entry.value) |value| {
136 self.base.tree.source[key.start..key.end],143 try std.fmt.format(writer, "{s} => {}, ", .{ key, value });
137 entry.value,144 } else {
138 });145 try std.fmt.format(writer, "{s} => null, ", .{key});
146 }
139 }147 }
140 return std.fmt.format(writer, " }}", .{});148 return std.fmt.format(writer, " }}", .{});
141 }149 }
142 };150 };
143151
144 pub const List = struct {152 pub const List = struct {
145 base: Node = Node{ .tag = Tag.list, .tree = undefined },153 base: Node = Node{
146 start: ?TokenIndex = null,154 .tag = Tag.list,
147 end: ?TokenIndex = null,155 .tree = undefined,
156 .start = undefined,
157 .end = undefined,
158 },
148 values: std.ArrayListUnmanaged(*Node) = .{},159 values: std.ArrayListUnmanaged(*Node) = .{},
149160
150 pub const base_tag: Node.Tag = .list;161 pub const base_tag: Node.Tag = .list;
...@@ -174,15 +185,18 @@ pub const Node = struct {...@@ -174,15 +185,18 @@ pub const Node = struct {
174 };185 };
175186
176 pub const Value = struct {187 pub const Value = struct {
177 base: Node = Node{ .tag = Tag.value, .tree = undefined },188 base: Node = Node{
178 start: ?TokenIndex = null,189 .tag = Tag.value,
179 end: ?TokenIndex = null,190 .tree = undefined,
191 .start = undefined,
192 .end = undefined,
193 },
194 string_value: std.ArrayListUnmanaged(u8) = .{},
180195
181 pub const base_tag: Node.Tag = .value;196 pub const base_tag: Node.Tag = .value;
182197
183 pub fn deinit(self: *Value, allocator: Allocator) void {198 pub fn deinit(self: *Value, allocator: Allocator) void {
184 _ = self;199 self.string_value.deinit(allocator);
185 _ = allocator;
186 }200 }
187201
188 pub fn format(202 pub fn format(
...@@ -193,11 +207,8 @@ pub const Node = struct {...@@ -193,11 +207,8 @@ pub const Node = struct {
193 ) !void {207 ) !void {
194 _ = options;208 _ = options;
195 _ = fmt;209 _ = fmt;
196 const start = self.base.tree.tokens[self.start.?];210 const raw = self.base.tree.getRaw(self.base.start, self.base.end);
197 const end = self.base.tree.tokens[self.end.?];211 return std.fmt.format(writer, "{s}", .{raw});
198 return std.fmt.format(writer, "{s}", .{
199 self.base.tree.source[start.start..end.end],
200 });
201 }212 }
202 };213 };
203};214};
...@@ -233,6 +244,21 @@ pub const Tree = struct {...@@ -233,6 +244,21 @@ pub const Tree = struct {
233 self.docs.deinit(self.allocator);244 self.docs.deinit(self.allocator);
234 }245 }
235246
247 pub fn getDirective(self: Tree, doc_index: usize) ?[]const u8 {
248 assert(doc_index < self.docs.items.len);
249 const doc = self.docs.items[doc_index].cast(Node.Doc) orelse return null;
250 const id = doc.directive orelse return null;
251 return self.getRaw(id, id);
252 }
253
254 pub fn getRaw(self: Tree, start: TokenIndex, end: TokenIndex) []const u8 {
255 assert(start <= end);
256 assert(start < self.tokens.len and end < self.tokens.len);
257 const start_token = self.tokens[start];
258 const end_token = self.tokens[end];
259 return self.source[start_token.start..end_token.end];
260 }
261
236 pub fn parse(self: *Tree, source: []const u8) !void {262 pub fn parse(self: *Tree, source: []const u8) !void {
237 var tokenizer = Tokenizer{ .buffer = source };263 var tokenizer = Tokenizer{ .buffer = source };
238 var tokens = std.ArrayList(Token).init(self.allocator);264 var tokens = std.ArrayList(Token).init(self.allocator);
...@@ -252,8 +278,8 @@ pub const Tree = struct {...@@ -252,8 +278,8 @@ pub const Tree = struct {
252 });278 });
253279
254 switch (token.id) {280 switch (token.id) {
255 .Eof => break,281 .eof => break,
256 .NewLine => {282 .new_line => {
257 line += 1;283 line += 1;
258 prev_line_last_col = token.end;284 prev_line_last_col = token.end;
259 },285 },
...@@ -272,20 +298,20 @@ pub const Tree = struct {...@@ -272,20 +298,20 @@ pub const Tree = struct {
272 .line_cols = &self.line_cols,298 .line_cols = &self.line_cols,
273 };299 };
274300
275 while (true) {301 parser.eatCommentsAndSpace(&.{});
276 if (parser.token_it.peek() == null) return;
277302
278 const pos = parser.token_it.pos;303 while (true) {
279 const token = parser.token_it.next();304 parser.eatCommentsAndSpace(&.{});
305 const token = parser.token_it.next() orelse break;
280306
281 log.debug("Next token: {}, {}", .{ pos, token });307 log.debug("(main) next {s}@{d}", .{ @tagName(token.id), parser.token_it.pos - 1 });
282308
283 switch (token.id) {309 switch (token.id) {
284 .Space, .Comment, .NewLine => {},310 .eof => break,
285 .Eof => break,
286 else => {311 else => {
287 const doc = try parser.doc(pos);312 parser.token_it.seekBy(-1);
288 try self.docs.append(self.allocator, &doc.base);313 const doc = try parser.doc();
314 try self.docs.append(self.allocator, doc);
289 },315 },
290 }316 }
291 }317 }
...@@ -298,355 +324,308 @@ const Parser = struct {...@@ -298,355 +324,308 @@ const Parser = struct {
298 token_it: *TokenIterator,324 token_it: *TokenIterator,
299 line_cols: *const std.AutoHashMap(TokenIndex, LineCol),325 line_cols: *const std.AutoHashMap(TokenIndex, LineCol),
300326
301 fn doc(self: *Parser, start: TokenIndex) ParseError!*Node.Doc {327 fn value(self: *Parser) ParseError!?*Node {
328 self.eatCommentsAndSpace(&.{});
329
330 const pos = self.token_it.pos;
331 const token = self.token_it.next() orelse return error.UnexpectedEof;
332
333 log.debug(" next {s}@{d}", .{ @tagName(token.id), pos });
334
335 switch (token.id) {
336 .literal => if (self.eatToken(.map_value_ind, &.{ .new_line, .comment })) |_| {
337 // map
338 self.token_it.seekTo(pos);
339 return self.map();
340 } else {
341 // leaf value
342 self.token_it.seekTo(pos);
343 return self.leaf_value();
344 },
345 .single_quoted, .double_quoted => {
346 // leaf value
347 self.token_it.seekBy(-1);
348 return self.leaf_value();
349 },
350 .seq_item_ind => {
351 // list
352 self.token_it.seekBy(-1);
353 return self.list();
354 },
355 .flow_seq_start => {
356 // list
357 self.token_it.seekBy(-1);
358 return self.list_bracketed();
359 },
360 else => return null,
361 }
362 }
363
364 fn doc(self: *Parser) ParseError!*Node {
302 const node = try self.allocator.create(Node.Doc);365 const node = try self.allocator.create(Node.Doc);
303 errdefer self.allocator.destroy(node);366 errdefer self.allocator.destroy(node);
304 node.* = .{ .start = start };367 node.* = .{};
305 node.base.tree = self.tree;368 node.base.tree = self.tree;
369 node.base.start = self.token_it.pos;
306370
307 self.token_it.seekTo(start);371 log.debug("(doc) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start });
308
309 log.debug("Doc start: {}, {}", .{ start, self.tree.tokens[start] });
310372
311 const explicit_doc: bool = if (self.eatToken(.DocStart)) |_| explicit_doc: {373 // Parse header
312 if (self.eatToken(.Tag)) |_| {374 const explicit_doc: bool = if (self.eatToken(.doc_start, &.{})) |doc_pos| explicit_doc: {
313 node.directive = try self.expectToken(.Literal);375 if (self.getCol(doc_pos) > 0) return error.MalformedYaml;
376 if (self.eatToken(.tag, &.{ .new_line, .comment })) |_| {
377 node.directive = try self.expectToken(.literal, &.{ .new_line, .comment });
314 }378 }
315 _ = try self.expectToken(.NewLine);
316 break :explicit_doc true;379 break :explicit_doc true;
317 } else false;380 } else false;
318381
319 while (true) {382 // Parse value
320 const pos = self.token_it.pos;383 node.value = try self.value();
321 const token = self.token_it.next();384 if (node.value == null) {
322385 self.token_it.seekBy(-1);
323 log.debug("Next token: {}, {}", .{ pos, token });386 }
387 errdefer if (node.value) |val| {
388 val.deinit(self.allocator);
389 self.allocator.destroy(val);
390 };
324391
325 switch (token.id) {392 // Parse footer
326 .Tag => {393 footer: {
327 return error.UnexpectedTag;394 if (self.eatToken(.doc_end, &.{})) |pos| {
328 },395 if (!explicit_doc) return error.UnexpectedToken;
329 .Literal, .SingleQuote, .DoubleQuote => {396 if (self.getCol(pos) > 0) return error.MalformedYaml;
330 _ = try self.expectToken(.MapValueInd);397 node.base.end = pos;
331 const map_node = try self.map(pos);398 break :footer;
332 node.value = &map_node.base;399 }
333 },400 if (self.eatToken(.doc_start, &.{})) |pos| {
334 .SeqItemInd => {401 if (!explicit_doc) return error.UnexpectedToken;
335 const list_node = try self.list(pos);402 if (self.getCol(pos) > 0) return error.MalformedYaml;
336 node.value = &list_node.base;403 self.token_it.seekBy(-1);
337 },404 node.base.end = pos - 1;
338 .FlowSeqStart => {405 break :footer;
339 const list_node = try self.list_bracketed(pos);406 }
340 node.value = &list_node.base;407 if (self.eatToken(.eof, &.{})) |pos| {
341 },408 node.base.end = pos - 1;
342 .DocEnd => {409 break :footer;
343 if (explicit_doc) break;
344 return error.UnexpectedToken;
345 },
346 .DocStart, .Eof => {
347 self.token_it.seekBy(-1);
348 break;
349 },
350 else => {
351 return error.UnexpectedToken;
352 },
353 }410 }
411 return error.UnexpectedToken;
354 }412 }
355413
356 node.end = self.token_it.pos - 1;414 log.debug("(doc) end {s}@{d}", .{ @tagName(self.tree.tokens[node.base.end].id), node.base.end });
357415
358 log.debug("Doc end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] });416 return &node.base;
359
360 return node;
361 }417 }
362418
363 fn map(self: *Parser, start: TokenIndex) ParseError!*Node.Map {419 fn map(self: *Parser) ParseError!*Node {
364 const node = try self.allocator.create(Node.Map);420 const node = try self.allocator.create(Node.Map);
365 errdefer self.allocator.destroy(node);421 errdefer self.allocator.destroy(node);
366 node.* = .{ .start = start };422 node.* = .{};
367 node.base.tree = self.tree;423 node.base.tree = self.tree;
424 node.base.start = self.token_it.pos;
425 errdefer {
426 for (node.values.items) |entry| {
427 if (entry.value) |val| {
428 val.deinit(self.allocator);
429 self.allocator.destroy(val);
430 }
431 }
432 node.values.deinit(self.allocator);
433 }
368434
369 self.token_it.seekTo(start);435 log.debug("(map) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start });
370
371 log.debug("Map start: {}, {}", .{ start, self.tree.tokens[start] });
372436
373 const col = self.getCol(start);437 const col = self.getCol(node.base.start);
374438
375 while (true) {439 while (true) {
376 self.eatCommentsAndSpace();440 self.eatCommentsAndSpace(&.{});
377441
378 // Parse key.442 // Parse key
379 const key_pos = self.token_it.pos;443 const key_pos = self.token_it.pos;
380 if (self.getCol(key_pos) != col) {444 if (self.getCol(key_pos) < col) {
381 break;445 break;
382 }446 }
383447
384 const key = self.token_it.next();448 const key = self.token_it.next() orelse return error.UnexpectedEof;
385 switch (key.id) {449 switch (key.id) {
386 .Literal => {},450 .literal => {},
387 else => {451 .doc_start, .doc_end, .eof => {
388 self.token_it.seekBy(-1);452 self.token_it.seekBy(-1);
389 break;453 break;
390 },454 },
455 else => {
456 // TODO key not being a literal
457 return error.Unhandled;
458 },
391 }459 }
392460
393 log.debug("Map key: {}, '{s}'", .{ key, self.tree.source[key.start..key.end] });461 log.debug("(map) key {s}@{d}", .{ self.tree.getRaw(key_pos, key_pos), key_pos });
394462
395 // Separator463 // Separator
396 _ = try self.expectToken(.MapValueInd);464 _ = try self.expectToken(.map_value_ind, &.{ .new_line, .comment });
397465
398 // Parse value.466 // Parse value
399 const value: *Node = value: {467 const val = try self.value();
400 if (self.eatToken(.NewLine)) |_| {468 errdefer if (val) |v| {
401 self.eatCommentsAndSpace();469 v.deinit(self.allocator);
402470 self.allocator.destroy(v);
403 // Explicit, complex value such as list or map.471 };
404 const value_pos = self.token_it.pos;472
405 const value = self.token_it.next();473 if (val) |v| {
406 switch (value.id) {474 if (self.getCol(v.start) < self.getCol(key_pos)) {
407 .Literal, .SingleQuote, .DoubleQuote => {475 return error.MalformedYaml;
408 // Assume nested map.476 }
409 const map_node = try self.map(value_pos);477 if (v.cast(Node.Value)) |_| {
410 break :value &map_node.base;478 if (self.getCol(v.start) == self.getCol(key_pos)) {
411 },479 return error.MalformedYaml;
412 .SeqItemInd => {
413 // Assume list of values.
414 const list_node = try self.list(value_pos);
415 break :value &list_node.base;
416 },
417 else => {
418 log.err("{}", .{key});
419 return error.Unhandled;
420 },
421 }
422 } else {
423 self.eatCommentsAndSpace();
424
425 const value_pos = self.token_it.pos;
426 const value = self.token_it.next();
427 switch (value.id) {
428 .Literal, .SingleQuote, .DoubleQuote => {
429 // Assume leaf value.
430 const leaf_node = try self.leaf_value(value_pos);
431 break :value &leaf_node.base;
432 },
433 .FlowSeqStart => {
434 const list_node = try self.list_bracketed(value_pos);
435 break :value &list_node.base;
436 },
437 else => {
438 log.err("{}", .{key});
439 return error.Unhandled;
440 },
441 }480 }
442 }481 }
443 };482 }
444 log.debug("Map value: {}", .{value});
445483
446 try node.values.append(self.allocator, .{484 try node.values.append(self.allocator, .{
447 .key = key_pos,485 .key = key_pos,
448 .value = value,486 .value = val,
449 });487 });
450
451 _ = self.eatToken(.NewLine);
452 }488 }
453489
454 node.end = self.token_it.pos - 1;490 node.base.end = self.token_it.pos - 1;
455491
456 log.debug("Map end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] });492 log.debug("(map) end {s}@{d}", .{ @tagName(self.tree.tokens[node.base.end].id), node.base.end });
457493
458 return node;494 return &node.base;
459 }495 }
460496
461 fn list(self: *Parser, start: TokenIndex) ParseError!*Node.List {497 fn list(self: *Parser) ParseError!*Node {
462 const node = try self.allocator.create(Node.List);498 const node = try self.allocator.create(Node.List);
463 errdefer self.allocator.destroy(node);499 errdefer self.allocator.destroy(node);
464 node.* = .{500 node.* = .{};
465 .start = start,
466 };
467 node.base.tree = self.tree;501 node.base.tree = self.tree;
502 node.base.start = self.token_it.pos;
503 errdefer {
504 for (node.values.items) |val| {
505 val.deinit(self.allocator);
506 self.allocator.destroy(val);
507 }
508 node.values.deinit(self.allocator);
509 }
468510
469 self.token_it.seekTo(start);511 log.debug("(list) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start });
470
471 log.debug("List start: {}, {}", .{ start, self.tree.tokens[start] });
472
473 const col = self.getCol(start);
474512
475 while (true) {513 while (true) {
476 self.eatCommentsAndSpace();514 self.eatCommentsAndSpace(&.{});
477515
478 if (self.getCol(self.token_it.pos) != col) {516 _ = self.eatToken(.seq_item_ind, &.{}) orelse break;
479 break;
480 }
481 _ = self.eatToken(.SeqItemInd) orelse {
482 break;
483 };
484517
485 const pos = self.token_it.pos;518 const val = (try self.value()) orelse return error.MalformedYaml;
486 const token = self.token_it.next();519 try node.values.append(self.allocator, val);
487 const value: *Node = value: {
488 switch (token.id) {
489 .Literal, .SingleQuote, .DoubleQuote => {
490 if (self.eatToken(.MapValueInd)) |_| {
491 // nested map
492 const map_node = try self.map(pos);
493 break :value &map_node.base;
494 } else {
495 // standalone (leaf) value
496 const leaf_node = try self.leaf_value(pos);
497 break :value &leaf_node.base;
498 }
499 },
500 .FlowSeqStart => {
501 const list_node = try self.list_bracketed(pos);
502 break :value &list_node.base;
503 },
504 else => {
505 log.err("{}", .{token});
506 return error.Unhandled;
507 },
508 }
509 };
510 try node.values.append(self.allocator, value);
511
512 _ = self.eatToken(.NewLine);
513 }520 }
514521
515 node.end = self.token_it.pos - 1;522 node.base.end = self.token_it.pos - 1;
516523
517 log.debug("List end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] });524 log.debug("(list) end {s}@{d}", .{ @tagName(self.tree.tokens[node.base.end].id), node.base.end });
518525
519 return node;526 return &node.base;
520 }527 }
521528
522 fn list_bracketed(self: *Parser, start: TokenIndex) ParseError!*Node.List {529 fn list_bracketed(self: *Parser) ParseError!*Node {
523 const node = try self.allocator.create(Node.List);530 const node = try self.allocator.create(Node.List);
524 errdefer self.allocator.destroy(node);531 errdefer self.allocator.destroy(node);
525 node.* = .{ .start = start };532 node.* = .{};
526 node.base.tree = self.tree;533 node.base.tree = self.tree;
534 node.base.start = self.token_it.pos;
535 errdefer {
536 for (node.values.items) |val| {
537 val.deinit(self.allocator);
538 self.allocator.destroy(val);
539 }
540 node.values.deinit(self.allocator);
541 }
527542
528 self.token_it.seekTo(start);543 log.debug("(list) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start });
529
530 log.debug("List start: {}, {}", .{ start, self.tree.tokens[start] });
531544
532 _ = try self.expectToken(.FlowSeqStart);545 _ = try self.expectToken(.flow_seq_start, &.{});
533546
534 while (true) {547 while (true) {
535 _ = self.eatToken(.NewLine);548 self.eatCommentsAndSpace(&.{.comment});
536 self.eatCommentsAndSpace();
537549
538 const pos = self.token_it.pos;550 if (self.eatToken(.flow_seq_end, &.{.comment})) |pos| {
539 const token = self.token_it.next();551 node.base.end = pos;
540552 break;
541 log.debug("Next token: {}, {}", .{ pos, token });553 }
554 _ = self.eatToken(.comma, &.{.comment});
542555
543 const value: *Node = value: {556 const val = (try self.value()) orelse return error.MalformedYaml;
544 switch (token.id) {557 try node.values.append(self.allocator, val);
545 .FlowSeqStart => {
546 const list_node = try self.list_bracketed(pos);
547 break :value &list_node.base;
548 },
549 .FlowSeqEnd => {
550 break;
551 },
552 .Literal, .SingleQuote, .DoubleQuote => {
553 const leaf_node = try self.leaf_value(pos);
554 _ = self.eatToken(.Comma);
555 // TODO newline
556 break :value &leaf_node.base;
557 },
558 else => {
559 log.err("{}", .{token});
560 return error.Unhandled;
561 },
562 }
563 };
564 try node.values.append(self.allocator, value);
565 }558 }
566559
567 node.end = self.token_it.pos - 1;560 log.debug("(list) end {s}@{d}", .{ @tagName(self.tree.tokens[node.base.end].id), node.base.end });
568
569 log.debug("List end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] });
570561
571 return node;562 return &node.base;
572 }563 }
573564
574 fn leaf_value(self: *Parser, start: TokenIndex) ParseError!*Node.Value {565 fn leaf_value(self: *Parser) ParseError!*Node {
575 const node = try self.allocator.create(Node.Value);566 const node = try self.allocator.create(Node.Value);
576 errdefer self.allocator.destroy(node);567 errdefer self.allocator.destroy(node);
577 node.* = .{ .start = start };568 node.* = .{ .string_value = .{} };
578 node.base.tree = self.tree;569 node.base.tree = self.tree;
579570 node.base.start = self.token_it.pos;
580 self.token_it.seekTo(start);571 errdefer node.string_value.deinit(self.allocator);
581572
582 log.debug("Leaf start: {}, {}", .{ node.start.?, self.tree.tokens[node.start.?] });573 // TODO handle multiline strings in new block scope
583574 while (self.token_it.next()) |tok| {
584 parse: {575 switch (tok.id) {
585 if (self.eatToken(.SingleQuote)) |_| {576 .single_quoted => {
586 node.start = node.start.? + 1;577 node.base.end = self.token_it.pos - 1;
587 while (true) {578 const raw = self.tree.getRaw(node.base.start, node.base.end);
588 const tok = self.token_it.next();579 try self.parseSingleQuoted(node, raw);
589 switch (tok.id) {580 break;
590 .SingleQuote => {581 },
591 node.end = self.token_it.pos - 2;582 .double_quoted => {
592 break :parse;583 node.base.end = self.token_it.pos - 1;
593 },584 const raw = self.tree.getRaw(node.base.start, node.base.end);
594 .NewLine => return error.UnexpectedToken,585 try self.parseDoubleQuoted(node, raw);
595 else => {},586 break;
596 }587 },
597 }588 .literal => {},
598 }589 .space => {
599590 const trailing = self.token_it.pos - 2;
600 if (self.eatToken(.DoubleQuote)) |_| {591 self.eatCommentsAndSpace(&.{});
601 node.start = node.start.? + 1;592 if (self.token_it.peek()) |peek| {
602 while (true) {593 if (peek.id != .literal) {
603 const tok = self.token_it.next();594 node.base.end = trailing;
604 switch (tok.id) {595 const raw = self.tree.getRaw(node.base.start, node.base.end);
605 .DoubleQuote => {596 try node.string_value.appendSlice(self.allocator, raw);
606 node.end = self.token_it.pos - 2;597 break;
607 break :parse;
608 },
609 .NewLine => return error.UnexpectedToken,
610 else => {},
611 }
612 }
613 }
614
615 // TODO handle multiline strings in new block scope
616 while (true) {
617 const tok = self.token_it.next();
618 switch (tok.id) {
619 .Literal => {},
620 .Space => {
621 const trailing = self.token_it.pos - 2;
622 self.eatCommentsAndSpace();
623 if (self.token_it.peek()) |peek| {
624 if (peek.id != .Literal) {
625 node.end = trailing;
626 break;
627 }
628 }598 }
629 },599 }
630 else => {600 },
631 self.token_it.seekBy(-1);601 else => {
632 node.end = self.token_it.pos - 1;602 self.token_it.seekBy(-1);
633 break;603 node.base.end = self.token_it.pos - 1;
634 },604 const raw = self.tree.getRaw(node.base.start, node.base.end);
635 }605 try node.string_value.appendSlice(self.allocator, raw);
606 break;
607 },
636 }608 }
637 }609 }
638610
639 log.debug("Leaf end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] });611 log.debug("(leaf) {s}", .{self.tree.getRaw(node.base.start, node.base.end)});
640612
641 return node;613 return &node.base;
642 }614 }
643615
644 fn eatCommentsAndSpace(self: *Parser) void {616 fn eatCommentsAndSpace(self: *Parser, comptime exclusions: []const Token.Id) void {
645 while (true) {617 log.debug("eatCommentsAndSpace", .{});
646 _ = self.token_it.peek() orelse return;618 outer: while (self.token_it.next()) |token| {
647 const token = self.token_it.next();619 log.debug(" (token '{s}')", .{@tagName(token.id)});
648 switch (token.id) {620 switch (token.id) {
649 .Comment, .Space => {},621 .comment, .space, .new_line => |space| {
622 inline for (exclusions) |excl| {
623 if (excl == space) {
624 self.token_it.seekBy(-1);
625 break :outer;
626 }
627 } else continue;
628 },
650 else => {629 else => {
651 self.token_it.seekBy(-1);630 self.token_it.seekBy(-1);
652 break;631 break;
...@@ -655,25 +634,24 @@ const Parser = struct {...@@ -655,25 +634,24 @@ const Parser = struct {
655 }634 }
656 }635 }
657636
658 fn eatToken(self: *Parser, id: Token.Id) ?TokenIndex {637 fn eatToken(self: *Parser, id: Token.Id, comptime exclusions: []const Token.Id) ?TokenIndex {
659 while (true) {638 log.debug("eatToken('{s}')", .{@tagName(id)});
660 const pos = self.token_it.pos;639 self.eatCommentsAndSpace(exclusions);
661 _ = self.token_it.peek() orelse return null;640 const pos = self.token_it.pos;
662 const token = self.token_it.next();641 const token = self.token_it.next() orelse return null;
663 switch (token.id) {642 if (token.id == id) {
664 .Comment, .Space => continue,643 log.debug(" (found at {d})", .{pos});
665 else => |next_id| if (next_id == id) {644 return pos;
666 return pos;645 } else {
667 } else {646 log.debug(" (not found)", .{});
668 self.token_it.seekTo(pos);647 self.token_it.seekBy(-1);
669 return null;648 return null;
670 },
671 }
672 }649 }
673 }650 }
674651
675 fn expectToken(self: *Parser, id: Token.Id) ParseError!TokenIndex {652 fn expectToken(self: *Parser, id: Token.Id, comptime exclusions: []const Token.Id) ParseError!TokenIndex {
676 return self.eatToken(id) orelse error.UnexpectedToken;653 log.debug("expectToken('{s}')", .{@tagName(id)});
654 return self.eatToken(id, exclusions) orelse error.UnexpectedToken;
677 }655 }
678656
679 fn getLine(self: *Parser, index: TokenIndex) usize {657 fn getLine(self: *Parser, index: TokenIndex) usize {
...@@ -683,8 +661,85 @@ const Parser = struct {...@@ -683,8 +661,85 @@ const Parser = struct {
683 fn getCol(self: *Parser, index: TokenIndex) usize {661 fn getCol(self: *Parser, index: TokenIndex) usize {
684 return self.line_cols.get(index).?.col;662 return self.line_cols.get(index).?.col;
685 }663 }
664
665 fn parseSingleQuoted(self: *Parser, node: *Node.Value, raw: []const u8) ParseError!void {
666 assert(raw[0] == '\'' and raw[raw.len - 1] == '\'');
667
668 const raw_no_quotes = raw[1 .. raw.len - 1];
669 try node.string_value.ensureTotalCapacity(self.allocator, raw_no_quotes.len);
670
671 var state: enum {
672 start,
673 escape,
674 } = .start;
675 var index: usize = 0;
676
677 while (index < raw_no_quotes.len) : (index += 1) {
678 const c = raw_no_quotes[index];
679 switch (state) {
680 .start => switch (c) {
681 '\'' => {
682 state = .escape;
683 },
684 else => {
685 node.string_value.appendAssumeCapacity(c);
686 },
687 },
688 .escape => switch (c) {
689 '\'' => {
690 state = .start;
691 node.string_value.appendAssumeCapacity(c);
692 },
693 else => return error.InvalidEscapeSequence,
694 },
695 }
696 }
697 }
698
699 fn parseDoubleQuoted(self: *Parser, node: *Node.Value, raw: []const u8) ParseError!void {
700 assert(raw[0] == '"' and raw[raw.len - 1] == '"');
701
702 const raw_no_quotes = raw[1 .. raw.len - 1];
703 try node.string_value.ensureTotalCapacity(self.allocator, raw_no_quotes.len);
704
705 var state: enum {
706 start,
707 escape,
708 } = .start;
709
710 var index: usize = 0;
711 while (index < raw_no_quotes.len) : (index += 1) {
712 const c = raw_no_quotes[index];
713 switch (state) {
714 .start => switch (c) {
715 '\\' => {
716 state = .escape;
717 },
718 else => {
719 node.string_value.appendAssumeCapacity(c);
720 },
721 },
722 .escape => switch (c) {
723 'n' => {
724 state = .start;
725 node.string_value.appendAssumeCapacity('\n');
726 },
727 't' => {
728 state = .start;
729 node.string_value.appendAssumeCapacity('\t');
730 },
731 '"' => {
732 state = .start;
733 node.string_value.appendAssumeCapacity('"');
734 },
735 else => return error.InvalidEscapeSequence,
736 },
737 }
738 }
739 }
686};740};
687741
688test {742test {
743 std.testing.refAllDecls(@This());
689 _ = @import("parse/test.zig");744 _ = @import("parse/test.zig");
690}745}
src/link/tapi/parse/test.zig+385-179
...@@ -21,45 +21,45 @@ test "explicit doc" {...@@ -21,45 +21,45 @@ test "explicit doc" {
21 try testing.expectEqual(tree.docs.items.len, 1);21 try testing.expectEqual(tree.docs.items.len, 1);
2222
23 const doc = tree.docs.items[0].cast(Node.Doc).?;23 const doc = tree.docs.items[0].cast(Node.Doc).?;
24 try testing.expectEqual(doc.start.?, 0);24 try testing.expectEqual(doc.base.start, 0);
25 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);25 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
2626
27 const directive = tree.tokens[doc.directive.?];27 const directive = tree.tokens[doc.directive.?];
28 try testing.expectEqual(directive.id, .Literal);28 try testing.expectEqual(directive.id, .literal);
29 try testing.expect(mem.eql(u8, "tapi-tbd", tree.source[directive.start..directive.end]));29 try testing.expectEqualStrings("tapi-tbd", tree.source[directive.start..directive.end]);
3030
31 try testing.expect(doc.value != null);31 try testing.expect(doc.value != null);
32 try testing.expectEqual(doc.value.?.tag, .map);32 try testing.expectEqual(doc.value.?.tag, .map);
3333
34 const map = doc.value.?.cast(Node.Map).?;34 const map = doc.value.?.cast(Node.Map).?;
35 try testing.expectEqual(map.start.?, 5);35 try testing.expectEqual(map.base.start, 5);
36 try testing.expectEqual(map.end.?, 14);36 try testing.expectEqual(map.base.end, 14);
37 try testing.expectEqual(map.values.items.len, 2);37 try testing.expectEqual(map.values.items.len, 2);
3838
39 {39 {
40 const entry = map.values.items[0];40 const entry = map.values.items[0];
4141
42 const key = tree.tokens[entry.key];42 const key = tree.tokens[entry.key];
43 try testing.expectEqual(key.id, .Literal);43 try testing.expectEqual(key.id, .literal);
44 try testing.expect(mem.eql(u8, "tbd-version", tree.source[key.start..key.end]));44 try testing.expectEqualStrings("tbd-version", tree.source[key.start..key.end]);
4545
46 const value = entry.value.cast(Node.Value).?;46 const value = entry.value.?.cast(Node.Value).?;
47 const value_tok = tree.tokens[value.start.?];47 const value_tok = tree.tokens[value.base.start];
48 try testing.expectEqual(value_tok.id, .Literal);48 try testing.expectEqual(value_tok.id, .literal);
49 try testing.expect(mem.eql(u8, "4", tree.source[value_tok.start..value_tok.end]));49 try testing.expectEqualStrings("4", tree.source[value_tok.start..value_tok.end]);
50 }50 }
5151
52 {52 {
53 const entry = map.values.items[1];53 const entry = map.values.items[1];
5454
55 const key = tree.tokens[entry.key];55 const key = tree.tokens[entry.key];
56 try testing.expectEqual(key.id, .Literal);56 try testing.expectEqual(key.id, .literal);
57 try testing.expect(mem.eql(u8, "abc-version", tree.source[key.start..key.end]));57 try testing.expectEqualStrings("abc-version", tree.source[key.start..key.end]);
5858
59 const value = entry.value.cast(Node.Value).?;59 const value = entry.value.?.cast(Node.Value).?;
60 const value_tok = tree.tokens[value.start.?];60 const value_tok = tree.tokens[value.base.start];
61 try testing.expectEqual(value_tok.id, .Literal);61 try testing.expectEqual(value_tok.id, .literal);
62 try testing.expect(mem.eql(u8, "5", tree.source[value_tok.start..value_tok.end]));62 try testing.expectEqualStrings("5", tree.source[value_tok.start..value_tok.end]);
63 }63 }
64}64}
6565
...@@ -77,39 +77,31 @@ test "leaf in quotes" {...@@ -77,39 +77,31 @@ test "leaf in quotes" {
77 try testing.expectEqual(tree.docs.items.len, 1);77 try testing.expectEqual(tree.docs.items.len, 1);
7878
79 const doc = tree.docs.items[0].cast(Node.Doc).?;79 const doc = tree.docs.items[0].cast(Node.Doc).?;
80 try testing.expectEqual(doc.start.?, 0);80 try testing.expectEqual(doc.base.start, 0);
81 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);81 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
82 try testing.expect(doc.directive == null);82 try testing.expect(doc.directive == null);
8383
84 try testing.expect(doc.value != null);84 try testing.expect(doc.value != null);
85 try testing.expectEqual(doc.value.?.tag, .map);85 try testing.expectEqual(doc.value.?.tag, .map);
8686
87 const map = doc.value.?.cast(Node.Map).?;87 const map = doc.value.?.cast(Node.Map).?;
88 try testing.expectEqual(map.start.?, 0);88 try testing.expectEqual(map.base.start, 0);
89 try testing.expectEqual(map.end.?, tree.tokens.len - 2);89 try testing.expectEqual(map.base.end, tree.tokens.len - 2);
90 try testing.expectEqual(map.values.items.len, 3);90 try testing.expectEqual(map.values.items.len, 3);
9191
92 {92 {
93 const entry = map.values.items[0];93 const entry = map.values.items[0];
9494
95 const key = tree.tokens[entry.key];95 const key = tree.tokens[entry.key];
96 try testing.expectEqual(key.id, .Literal);96 try testing.expectEqual(key.id, .literal);
97 try testing.expect(mem.eql(97 try testing.expectEqualStrings("key1", tree.source[key.start..key.end]);
98 u8,98
99 "key1",99 const value = entry.value.?.cast(Node.Value).?;
100 tree.source[key.start..key.end],100 const start = tree.tokens[value.base.start];
101 ));101 const end = tree.tokens[value.base.end];
102102 try testing.expectEqual(start.id, .literal);
103 const value = entry.value.cast(Node.Value).?;103 try testing.expectEqual(end.id, .literal);
104 const start = tree.tokens[value.start.?];104 try testing.expectEqualStrings("no quotes", tree.source[start.start..end.end]);
105 const end = tree.tokens[value.end.?];
106 try testing.expectEqual(start.id, .Literal);
107 try testing.expectEqual(end.id, .Literal);
108 try testing.expect(mem.eql(
109 u8,
110 "no quotes",
111 tree.source[start.start..end.end],
112 ));
113 }105 }
114}106}
115107
...@@ -128,70 +120,60 @@ test "nested maps" {...@@ -128,70 +120,60 @@ test "nested maps" {
128 try testing.expectEqual(tree.docs.items.len, 1);120 try testing.expectEqual(tree.docs.items.len, 1);
129121
130 const doc = tree.docs.items[0].cast(Node.Doc).?;122 const doc = tree.docs.items[0].cast(Node.Doc).?;
131 try testing.expectEqual(doc.start.?, 0);123 try testing.expectEqual(doc.base.start, 0);
132 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);124 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
133 try testing.expect(doc.directive == null);125 try testing.expect(doc.directive == null);
134126
135 try testing.expect(doc.value != null);127 try testing.expect(doc.value != null);
136 try testing.expectEqual(doc.value.?.tag, .map);128 try testing.expectEqual(doc.value.?.tag, .map);
137129
138 const map = doc.value.?.cast(Node.Map).?;130 const map = doc.value.?.cast(Node.Map).?;
139 try testing.expectEqual(map.start.?, 0);131 try testing.expectEqual(map.base.start, 0);
140 try testing.expectEqual(map.end.?, tree.tokens.len - 2);132 try testing.expectEqual(map.base.end, tree.tokens.len - 2);
141 try testing.expectEqual(map.values.items.len, 2);133 try testing.expectEqual(map.values.items.len, 2);
142134
143 {135 {
144 const entry = map.values.items[0];136 const entry = map.values.items[0];
145137
146 const key = tree.tokens[entry.key];138 const key = tree.tokens[entry.key];
147 try testing.expectEqual(key.id, .Literal);139 try testing.expectEqual(key.id, .literal);
148 try testing.expect(mem.eql(u8, "key1", tree.source[key.start..key.end]));140 try testing.expectEqualStrings("key1", tree.source[key.start..key.end]);
149141
150 const nested_map = entry.value.cast(Node.Map).?;142 const nested_map = entry.value.?.cast(Node.Map).?;
151 try testing.expectEqual(nested_map.start.?, 4);143 try testing.expectEqual(nested_map.base.start, 4);
152 try testing.expectEqual(nested_map.end.?, 16);144 try testing.expectEqual(nested_map.base.end, 16);
153 try testing.expectEqual(nested_map.values.items.len, 2);145 try testing.expectEqual(nested_map.values.items.len, 2);
154146
155 {147 {
156 const nested_entry = nested_map.values.items[0];148 const nested_entry = nested_map.values.items[0];
157149
158 const nested_key = tree.tokens[nested_entry.key];150 const nested_key = tree.tokens[nested_entry.key];
159 try testing.expectEqual(nested_key.id, .Literal);151 try testing.expectEqual(nested_key.id, .literal);
160 try testing.expect(mem.eql(152 try testing.expectEqualStrings("key1_1", tree.source[nested_key.start..nested_key.end]);
161 u8,153
162 "key1_1",154 const nested_value = nested_entry.value.?.cast(Node.Value).?;
163 tree.source[nested_key.start..nested_key.end],155 const nested_value_tok = tree.tokens[nested_value.base.start];
164 ));156 try testing.expectEqual(nested_value_tok.id, .literal);
165157 try testing.expectEqualStrings(
166 const nested_value = nested_entry.value.cast(Node.Value).?;
167 const nested_value_tok = tree.tokens[nested_value.start.?];
168 try testing.expectEqual(nested_value_tok.id, .Literal);
169 try testing.expect(mem.eql(
170 u8,
171 "value1_1",158 "value1_1",
172 tree.source[nested_value_tok.start..nested_value_tok.end],159 tree.source[nested_value_tok.start..nested_value_tok.end],
173 ));160 );
174 }161 }
175162
176 {163 {
177 const nested_entry = nested_map.values.items[1];164 const nested_entry = nested_map.values.items[1];
178165
179 const nested_key = tree.tokens[nested_entry.key];166 const nested_key = tree.tokens[nested_entry.key];
180 try testing.expectEqual(nested_key.id, .Literal);167 try testing.expectEqual(nested_key.id, .literal);
181 try testing.expect(mem.eql(168 try testing.expectEqualStrings("key1_2", tree.source[nested_key.start..nested_key.end]);
182 u8,169
183 "key1_2",170 const nested_value = nested_entry.value.?.cast(Node.Value).?;
184 tree.source[nested_key.start..nested_key.end],171 const nested_value_tok = tree.tokens[nested_value.base.start];
185 ));172 try testing.expectEqual(nested_value_tok.id, .literal);
186173 try testing.expectEqualStrings(
187 const nested_value = nested_entry.value.cast(Node.Value).?;
188 const nested_value_tok = tree.tokens[nested_value.start.?];
189 try testing.expectEqual(nested_value_tok.id, .Literal);
190 try testing.expect(mem.eql(
191 u8,
192 "value1_2",174 "value1_2",
193 tree.source[nested_value_tok.start..nested_value_tok.end],175 tree.source[nested_value_tok.start..nested_value_tok.end],
194 ));176 );
195 }177 }
196 }178 }
197179
...@@ -199,17 +181,13 @@ test "nested maps" {...@@ -199,17 +181,13 @@ test "nested maps" {
199 const entry = map.values.items[1];181 const entry = map.values.items[1];
200182
201 const key = tree.tokens[entry.key];183 const key = tree.tokens[entry.key];
202 try testing.expectEqual(key.id, .Literal);184 try testing.expectEqual(key.id, .literal);
203 try testing.expect(mem.eql(u8, "key2", tree.source[key.start..key.end]));185 try testing.expectEqualStrings("key2", tree.source[key.start..key.end]);
204186
205 const value = entry.value.cast(Node.Value).?;187 const value = entry.value.?.cast(Node.Value).?;
206 const value_tok = tree.tokens[value.start.?];188 const value_tok = tree.tokens[value.base.start];
207 try testing.expectEqual(value_tok.id, .Literal);189 try testing.expectEqual(value_tok.id, .literal);
208 try testing.expect(mem.eql(190 try testing.expectEqualStrings("value2", tree.source[value_tok.start..value_tok.end]);
209 u8,
210 "value2",
211 tree.source[value_tok.start..value_tok.end],
212 ));
213 }191 }
214}192}
215193
...@@ -227,46 +205,46 @@ test "map of list of values" {...@@ -227,46 +205,46 @@ test "map of list of values" {
227 try testing.expectEqual(tree.docs.items.len, 1);205 try testing.expectEqual(tree.docs.items.len, 1);
228206
229 const doc = tree.docs.items[0].cast(Node.Doc).?;207 const doc = tree.docs.items[0].cast(Node.Doc).?;
230 try testing.expectEqual(doc.start.?, 0);208 try testing.expectEqual(doc.base.start, 0);
231 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);209 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
232210
233 try testing.expect(doc.value != null);211 try testing.expect(doc.value != null);
234 try testing.expectEqual(doc.value.?.tag, .map);212 try testing.expectEqual(doc.value.?.tag, .map);
235213
236 const map = doc.value.?.cast(Node.Map).?;214 const map = doc.value.?.cast(Node.Map).?;
237 try testing.expectEqual(map.start.?, 0);215 try testing.expectEqual(map.base.start, 0);
238 try testing.expectEqual(map.end.?, tree.tokens.len - 2);216 try testing.expectEqual(map.base.end, tree.tokens.len - 2);
239 try testing.expectEqual(map.values.items.len, 1);217 try testing.expectEqual(map.values.items.len, 1);
240218
241 const entry = map.values.items[0];219 const entry = map.values.items[0];
242 const key = tree.tokens[entry.key];220 const key = tree.tokens[entry.key];
243 try testing.expectEqual(key.id, .Literal);221 try testing.expectEqual(key.id, .literal);
244 try testing.expect(mem.eql(u8, "ints", tree.source[key.start..key.end]));222 try testing.expectEqualStrings("ints", tree.source[key.start..key.end]);
245223
246 const value = entry.value.cast(Node.List).?;224 const value = entry.value.?.cast(Node.List).?;
247 try testing.expectEqual(value.start.?, 4);225 try testing.expectEqual(value.base.start, 4);
248 try testing.expectEqual(value.end.?, tree.tokens.len - 2);226 try testing.expectEqual(value.base.end, tree.tokens.len - 2);
249 try testing.expectEqual(value.values.items.len, 3);227 try testing.expectEqual(value.values.items.len, 3);
250228
251 {229 {
252 const elem = value.values.items[0].cast(Node.Value).?;230 const elem = value.values.items[0].cast(Node.Value).?;
253 const leaf = tree.tokens[elem.start.?];231 const leaf = tree.tokens[elem.base.start];
254 try testing.expectEqual(leaf.id, .Literal);232 try testing.expectEqual(leaf.id, .literal);
255 try testing.expect(mem.eql(u8, "0", tree.source[leaf.start..leaf.end]));233 try testing.expectEqualStrings("0", tree.source[leaf.start..leaf.end]);
256 }234 }
257235
258 {236 {
259 const elem = value.values.items[1].cast(Node.Value).?;237 const elem = value.values.items[1].cast(Node.Value).?;
260 const leaf = tree.tokens[elem.start.?];238 const leaf = tree.tokens[elem.base.start];
261 try testing.expectEqual(leaf.id, .Literal);239 try testing.expectEqual(leaf.id, .literal);
262 try testing.expect(mem.eql(u8, "1", tree.source[leaf.start..leaf.end]));240 try testing.expectEqualStrings("1", tree.source[leaf.start..leaf.end]);
263 }241 }
264242
265 {243 {
266 const elem = value.values.items[2].cast(Node.Value).?;244 const elem = value.values.items[2].cast(Node.Value).?;
267 const leaf = tree.tokens[elem.start.?];245 const leaf = tree.tokens[elem.base.start];
268 try testing.expectEqual(leaf.id, .Literal);246 try testing.expectEqual(leaf.id, .literal);
269 try testing.expect(mem.eql(u8, "2", tree.source[leaf.start..leaf.end]));247 try testing.expectEqualStrings("2", tree.source[leaf.start..leaf.end]);
270 }248 }
271}249}
272250
...@@ -285,64 +263,64 @@ test "map of list of maps" {...@@ -285,64 +263,64 @@ test "map of list of maps" {
285 try testing.expectEqual(tree.docs.items.len, 1);263 try testing.expectEqual(tree.docs.items.len, 1);
286264
287 const doc = tree.docs.items[0].cast(Node.Doc).?;265 const doc = tree.docs.items[0].cast(Node.Doc).?;
288 try testing.expectEqual(doc.start.?, 0);266 try testing.expectEqual(doc.base.start, 0);
289 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);267 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
290268
291 try testing.expect(doc.value != null);269 try testing.expect(doc.value != null);
292 try testing.expectEqual(doc.value.?.tag, .map);270 try testing.expectEqual(doc.value.?.tag, .map);
293271
294 const map = doc.value.?.cast(Node.Map).?;272 const map = doc.value.?.cast(Node.Map).?;
295 try testing.expectEqual(map.start.?, 0);273 try testing.expectEqual(map.base.start, 0);
296 try testing.expectEqual(map.end.?, tree.tokens.len - 2);274 try testing.expectEqual(map.base.end, tree.tokens.len - 2);
297 try testing.expectEqual(map.values.items.len, 1);275 try testing.expectEqual(map.values.items.len, 1);
298276
299 const entry = map.values.items[0];277 const entry = map.values.items[0];
300 const key = tree.tokens[entry.key];278 const key = tree.tokens[entry.key];
301 try testing.expectEqual(key.id, .Literal);279 try testing.expectEqual(key.id, .literal);
302 try testing.expect(mem.eql(u8, "key1", tree.source[key.start..key.end]));280 try testing.expectEqualStrings("key1", tree.source[key.start..key.end]);
303281
304 const value = entry.value.cast(Node.List).?;282 const value = entry.value.?.cast(Node.List).?;
305 try testing.expectEqual(value.start.?, 3);283 try testing.expectEqual(value.base.start, 3);
306 try testing.expectEqual(value.end.?, tree.tokens.len - 2);284 try testing.expectEqual(value.base.end, tree.tokens.len - 2);
307 try testing.expectEqual(value.values.items.len, 3);285 try testing.expectEqual(value.values.items.len, 3);
308286
309 {287 {
310 const elem = value.values.items[0].cast(Node.Map).?;288 const elem = value.values.items[0].cast(Node.Map).?;
311 const nested = elem.values.items[0];289 const nested = elem.values.items[0];
312 const nested_key = tree.tokens[nested.key];290 const nested_key = tree.tokens[nested.key];
313 try testing.expectEqual(nested_key.id, .Literal);291 try testing.expectEqual(nested_key.id, .literal);
314 try testing.expect(mem.eql(u8, "key2", tree.source[nested_key.start..nested_key.end]));292 try testing.expectEqualStrings("key2", tree.source[nested_key.start..nested_key.end]);
315293
316 const nested_v = nested.value.cast(Node.Value).?;294 const nested_v = nested.value.?.cast(Node.Value).?;
317 const leaf = tree.tokens[nested_v.start.?];295 const leaf = tree.tokens[nested_v.base.start];
318 try testing.expectEqual(leaf.id, .Literal);296 try testing.expectEqual(leaf.id, .literal);
319 try testing.expect(mem.eql(u8, "value2", tree.source[leaf.start..leaf.end]));297 try testing.expectEqualStrings("value2", tree.source[leaf.start..leaf.end]);
320 }298 }
321299
322 {300 {
323 const elem = value.values.items[1].cast(Node.Map).?;301 const elem = value.values.items[1].cast(Node.Map).?;
324 const nested = elem.values.items[0];302 const nested = elem.values.items[0];
325 const nested_key = tree.tokens[nested.key];303 const nested_key = tree.tokens[nested.key];
326 try testing.expectEqual(nested_key.id, .Literal);304 try testing.expectEqual(nested_key.id, .literal);
327 try testing.expect(mem.eql(u8, "key3", tree.source[nested_key.start..nested_key.end]));305 try testing.expectEqualStrings("key3", tree.source[nested_key.start..nested_key.end]);
328306
329 const nested_v = nested.value.cast(Node.Value).?;307 const nested_v = nested.value.?.cast(Node.Value).?;
330 const leaf = tree.tokens[nested_v.start.?];308 const leaf = tree.tokens[nested_v.base.start];
331 try testing.expectEqual(leaf.id, .Literal);309 try testing.expectEqual(leaf.id, .literal);
332 try testing.expect(mem.eql(u8, "value3", tree.source[leaf.start..leaf.end]));310 try testing.expectEqualStrings("value3", tree.source[leaf.start..leaf.end]);
333 }311 }
334312
335 {313 {
336 const elem = value.values.items[2].cast(Node.Map).?;314 const elem = value.values.items[2].cast(Node.Map).?;
337 const nested = elem.values.items[0];315 const nested = elem.values.items[0];
338 const nested_key = tree.tokens[nested.key];316 const nested_key = tree.tokens[nested.key];
339 try testing.expectEqual(nested_key.id, .Literal);317 try testing.expectEqual(nested_key.id, .literal);
340 try testing.expect(mem.eql(u8, "key4", tree.source[nested_key.start..nested_key.end]));318 try testing.expectEqualStrings("key4", tree.source[nested_key.start..nested_key.end]);
341319
342 const nested_v = nested.value.cast(Node.Value).?;320 const nested_v = nested.value.?.cast(Node.Value).?;
343 const leaf = tree.tokens[nested_v.start.?];321 const leaf = tree.tokens[nested_v.base.start];
344 try testing.expectEqual(leaf.id, .Literal);322 try testing.expectEqual(leaf.id, .literal);
345 try testing.expect(mem.eql(u8, "value4", tree.source[leaf.start..leaf.end]));323 try testing.expectEqualStrings("value4", tree.source[leaf.start..leaf.end]);
346 }324 }
347}325}
348326
...@@ -360,15 +338,15 @@ test "list of lists" {...@@ -360,15 +338,15 @@ test "list of lists" {
360 try testing.expectEqual(tree.docs.items.len, 1);338 try testing.expectEqual(tree.docs.items.len, 1);
361339
362 const doc = tree.docs.items[0].cast(Node.Doc).?;340 const doc = tree.docs.items[0].cast(Node.Doc).?;
363 try testing.expectEqual(doc.start.?, 0);341 try testing.expectEqual(doc.base.start, 0);
364 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);342 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
365343
366 try testing.expect(doc.value != null);344 try testing.expect(doc.value != null);
367 try testing.expectEqual(doc.value.?.tag, .list);345 try testing.expectEqual(doc.value.?.tag, .list);
368346
369 const list = doc.value.?.cast(Node.List).?;347 const list = doc.value.?.cast(Node.List).?;
370 try testing.expectEqual(list.start.?, 0);348 try testing.expectEqual(list.base.start, 0);
371 try testing.expectEqual(list.end.?, tree.tokens.len - 2);349 try testing.expectEqual(list.base.end, tree.tokens.len - 2);
372 try testing.expectEqual(list.values.items.len, 3);350 try testing.expectEqual(list.values.items.len, 3);
373351
374 {352 {
...@@ -379,22 +357,22 @@ test "list of lists" {...@@ -379,22 +357,22 @@ test "list of lists" {
379 {357 {
380 try testing.expectEqual(nested.values.items[0].tag, .value);358 try testing.expectEqual(nested.values.items[0].tag, .value);
381 const value = nested.values.items[0].cast(Node.Value).?;359 const value = nested.values.items[0].cast(Node.Value).?;
382 const leaf = tree.tokens[value.start.?];360 const leaf = tree.tokens[value.base.start];
383 try testing.expect(mem.eql(u8, "name", tree.source[leaf.start..leaf.end]));361 try testing.expectEqualStrings("name", tree.source[leaf.start..leaf.end]);
384 }362 }
385363
386 {364 {
387 try testing.expectEqual(nested.values.items[1].tag, .value);365 try testing.expectEqual(nested.values.items[1].tag, .value);
388 const value = nested.values.items[1].cast(Node.Value).?;366 const value = nested.values.items[1].cast(Node.Value).?;
389 const leaf = tree.tokens[value.start.?];367 const leaf = tree.tokens[value.base.start];
390 try testing.expect(mem.eql(u8, "hr", tree.source[leaf.start..leaf.end]));368 try testing.expectEqualStrings("hr", tree.source[leaf.start..leaf.end]);
391 }369 }
392370
393 {371 {
394 try testing.expectEqual(nested.values.items[2].tag, .value);372 try testing.expectEqual(nested.values.items[2].tag, .value);
395 const value = nested.values.items[2].cast(Node.Value).?;373 const value = nested.values.items[2].cast(Node.Value).?;
396 const leaf = tree.tokens[value.start.?];374 const leaf = tree.tokens[value.base.start];
397 try testing.expect(mem.eql(u8, "avg", tree.source[leaf.start..leaf.end]));375 try testing.expectEqualStrings("avg", tree.source[leaf.start..leaf.end]);
398 }376 }
399 }377 }
400378
...@@ -406,23 +384,23 @@ test "list of lists" {...@@ -406,23 +384,23 @@ test "list of lists" {
406 {384 {
407 try testing.expectEqual(nested.values.items[0].tag, .value);385 try testing.expectEqual(nested.values.items[0].tag, .value);
408 const value = nested.values.items[0].cast(Node.Value).?;386 const value = nested.values.items[0].cast(Node.Value).?;
409 const start = tree.tokens[value.start.?];387 const start = tree.tokens[value.base.start];
410 const end = tree.tokens[value.end.?];388 const end = tree.tokens[value.base.end];
411 try testing.expect(mem.eql(u8, "Mark McGwire", tree.source[start.start..end.end]));389 try testing.expectEqualStrings("Mark McGwire", tree.source[start.start..end.end]);
412 }390 }
413391
414 {392 {
415 try testing.expectEqual(nested.values.items[1].tag, .value);393 try testing.expectEqual(nested.values.items[1].tag, .value);
416 const value = nested.values.items[1].cast(Node.Value).?;394 const value = nested.values.items[1].cast(Node.Value).?;
417 const leaf = tree.tokens[value.start.?];395 const leaf = tree.tokens[value.base.start];
418 try testing.expect(mem.eql(u8, "65", tree.source[leaf.start..leaf.end]));396 try testing.expectEqualStrings("65", tree.source[leaf.start..leaf.end]);
419 }397 }
420398
421 {399 {
422 try testing.expectEqual(nested.values.items[2].tag, .value);400 try testing.expectEqual(nested.values.items[2].tag, .value);
423 const value = nested.values.items[2].cast(Node.Value).?;401 const value = nested.values.items[2].cast(Node.Value).?;
424 const leaf = tree.tokens[value.start.?];402 const leaf = tree.tokens[value.base.start];
425 try testing.expect(mem.eql(u8, "0.278", tree.source[leaf.start..leaf.end]));403 try testing.expectEqualStrings("0.278", tree.source[leaf.start..leaf.end]);
426 }404 }
427 }405 }
428406
...@@ -434,23 +412,23 @@ test "list of lists" {...@@ -434,23 +412,23 @@ test "list of lists" {
434 {412 {
435 try testing.expectEqual(nested.values.items[0].tag, .value);413 try testing.expectEqual(nested.values.items[0].tag, .value);
436 const value = nested.values.items[0].cast(Node.Value).?;414 const value = nested.values.items[0].cast(Node.Value).?;
437 const start = tree.tokens[value.start.?];415 const start = tree.tokens[value.base.start];
438 const end = tree.tokens[value.end.?];416 const end = tree.tokens[value.base.end];
439 try testing.expect(mem.eql(u8, "Sammy Sosa", tree.source[start.start..end.end]));417 try testing.expectEqualStrings("Sammy Sosa", tree.source[start.start..end.end]);
440 }418 }
441419
442 {420 {
443 try testing.expectEqual(nested.values.items[1].tag, .value);421 try testing.expectEqual(nested.values.items[1].tag, .value);
444 const value = nested.values.items[1].cast(Node.Value).?;422 const value = nested.values.items[1].cast(Node.Value).?;
445 const leaf = tree.tokens[value.start.?];423 const leaf = tree.tokens[value.base.start];
446 try testing.expect(mem.eql(u8, "63", tree.source[leaf.start..leaf.end]));424 try testing.expectEqualStrings("63", tree.source[leaf.start..leaf.end]);
447 }425 }
448426
449 {427 {
450 try testing.expectEqual(nested.values.items[2].tag, .value);428 try testing.expectEqual(nested.values.items[2].tag, .value);
451 const value = nested.values.items[2].cast(Node.Value).?;429 const value = nested.values.items[2].cast(Node.Value).?;
452 const leaf = tree.tokens[value.start.?];430 const leaf = tree.tokens[value.base.start];
453 try testing.expect(mem.eql(u8, "0.288", tree.source[leaf.start..leaf.end]));431 try testing.expectEqualStrings("0.288", tree.source[leaf.start..leaf.end]);
454 }432 }
455 }433 }
456}434}
...@@ -467,36 +445,36 @@ test "inline list" {...@@ -467,36 +445,36 @@ test "inline list" {
467 try testing.expectEqual(tree.docs.items.len, 1);445 try testing.expectEqual(tree.docs.items.len, 1);
468446
469 const doc = tree.docs.items[0].cast(Node.Doc).?;447 const doc = tree.docs.items[0].cast(Node.Doc).?;
470 try testing.expectEqual(doc.start.?, 0);448 try testing.expectEqual(doc.base.start, 0);
471 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);449 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
472450
473 try testing.expect(doc.value != null);451 try testing.expect(doc.value != null);
474 try testing.expectEqual(doc.value.?.tag, .list);452 try testing.expectEqual(doc.value.?.tag, .list);
475453
476 const list = doc.value.?.cast(Node.List).?;454 const list = doc.value.?.cast(Node.List).?;
477 try testing.expectEqual(list.start.?, 0);455 try testing.expectEqual(list.base.start, 0);
478 try testing.expectEqual(list.end.?, tree.tokens.len - 2);456 try testing.expectEqual(list.base.end, tree.tokens.len - 2);
479 try testing.expectEqual(list.values.items.len, 3);457 try testing.expectEqual(list.values.items.len, 3);
480458
481 {459 {
482 try testing.expectEqual(list.values.items[0].tag, .value);460 try testing.expectEqual(list.values.items[0].tag, .value);
483 const value = list.values.items[0].cast(Node.Value).?;461 const value = list.values.items[0].cast(Node.Value).?;
484 const leaf = tree.tokens[value.start.?];462 const leaf = tree.tokens[value.base.start];
485 try testing.expect(mem.eql(u8, "name", tree.source[leaf.start..leaf.end]));463 try testing.expectEqualStrings("name", tree.source[leaf.start..leaf.end]);
486 }464 }
487465
488 {466 {
489 try testing.expectEqual(list.values.items[1].tag, .value);467 try testing.expectEqual(list.values.items[1].tag, .value);
490 const value = list.values.items[1].cast(Node.Value).?;468 const value = list.values.items[1].cast(Node.Value).?;
491 const leaf = tree.tokens[value.start.?];469 const leaf = tree.tokens[value.base.start];
492 try testing.expect(mem.eql(u8, "hr", tree.source[leaf.start..leaf.end]));470 try testing.expectEqualStrings("hr", tree.source[leaf.start..leaf.end]);
493 }471 }
494472
495 {473 {
496 try testing.expectEqual(list.values.items[2].tag, .value);474 try testing.expectEqual(list.values.items[2].tag, .value);
497 const value = list.values.items[2].cast(Node.Value).?;475 const value = list.values.items[2].cast(Node.Value).?;
498 const leaf = tree.tokens[value.start.?];476 const leaf = tree.tokens[value.base.start];
499 try testing.expect(mem.eql(u8, "avg", tree.source[leaf.start..leaf.end]));477 try testing.expectEqualStrings("avg", tree.source[leaf.start..leaf.end]);
500 }478 }
501}479}
502480
...@@ -514,45 +492,273 @@ test "inline list as mapping value" {...@@ -514,45 +492,273 @@ test "inline list as mapping value" {
514 try testing.expectEqual(tree.docs.items.len, 1);492 try testing.expectEqual(tree.docs.items.len, 1);
515493
516 const doc = tree.docs.items[0].cast(Node.Doc).?;494 const doc = tree.docs.items[0].cast(Node.Doc).?;
517 try testing.expectEqual(doc.start.?, 0);495 try testing.expectEqual(doc.base.start, 0);
518 try testing.expectEqual(doc.end.?, tree.tokens.len - 2);496 try testing.expectEqual(doc.base.end, tree.tokens.len - 2);
519497
520 try testing.expect(doc.value != null);498 try testing.expect(doc.value != null);
521 try testing.expectEqual(doc.value.?.tag, .map);499 try testing.expectEqual(doc.value.?.tag, .map);
522500
523 const map = doc.value.?.cast(Node.Map).?;501 const map = doc.value.?.cast(Node.Map).?;
524 try testing.expectEqual(map.start.?, 0);502 try testing.expectEqual(map.base.start, 0);
525 try testing.expectEqual(map.end.?, tree.tokens.len - 2);503 try testing.expectEqual(map.base.end, tree.tokens.len - 2);
526 try testing.expectEqual(map.values.items.len, 1);504 try testing.expectEqual(map.values.items.len, 1);
527505
528 const entry = map.values.items[0];506 const entry = map.values.items[0];
529 const key = tree.tokens[entry.key];507 const key = tree.tokens[entry.key];
530 try testing.expectEqual(key.id, .Literal);508 try testing.expectEqual(key.id, .literal);
531 try testing.expect(mem.eql(u8, "key", tree.source[key.start..key.end]));509 try testing.expectEqualStrings("key", tree.source[key.start..key.end]);
532510
533 const list = entry.value.cast(Node.List).?;511 const list = entry.value.?.cast(Node.List).?;
534 try testing.expectEqual(list.start.?, 4);512 try testing.expectEqual(list.base.start, 4);
535 try testing.expectEqual(list.end.?, tree.tokens.len - 2);513 try testing.expectEqual(list.base.end, tree.tokens.len - 2);
536 try testing.expectEqual(list.values.items.len, 3);514 try testing.expectEqual(list.values.items.len, 3);
537515
538 {516 {
539 try testing.expectEqual(list.values.items[0].tag, .value);517 try testing.expectEqual(list.values.items[0].tag, .value);
540 const value = list.values.items[0].cast(Node.Value).?;518 const value = list.values.items[0].cast(Node.Value).?;
541 const leaf = tree.tokens[value.start.?];519 const leaf = tree.tokens[value.base.start];
542 try testing.expect(mem.eql(u8, "name", tree.source[leaf.start..leaf.end]));520 try testing.expectEqualStrings("name", tree.source[leaf.start..leaf.end]);
543 }521 }
544522
545 {523 {
546 try testing.expectEqual(list.values.items[1].tag, .value);524 try testing.expectEqual(list.values.items[1].tag, .value);
547 const value = list.values.items[1].cast(Node.Value).?;525 const value = list.values.items[1].cast(Node.Value).?;
548 const leaf = tree.tokens[value.start.?];526 const leaf = tree.tokens[value.base.start];
549 try testing.expect(mem.eql(u8, "hr", tree.source[leaf.start..leaf.end]));527 try testing.expectEqualStrings("hr", tree.source[leaf.start..leaf.end]);
550 }528 }
551529
552 {530 {
553 try testing.expectEqual(list.values.items[2].tag, .value);531 try testing.expectEqual(list.values.items[2].tag, .value);
554 const value = list.values.items[2].cast(Node.Value).?;532 const value = list.values.items[2].cast(Node.Value).?;
555 const leaf = tree.tokens[value.start.?];533 const leaf = tree.tokens[value.base.start];
556 try testing.expect(mem.eql(u8, "avg", tree.source[leaf.start..leaf.end]));534 try testing.expectEqualStrings("avg", tree.source[leaf.start..leaf.end]);
557 }535 }
558}536}
537
538fn parseSuccess(comptime source: []const u8) !void {
539 var tree = Tree.init(testing.allocator);
540 defer tree.deinit();
541 try tree.parse(source);
542}
543
544fn parseError(comptime source: []const u8, err: parse.ParseError) !void {
545 var tree = Tree.init(testing.allocator);
546 defer tree.deinit();
547 try testing.expectError(err, tree.parse(source));
548}
549
550test "empty doc with spaces and comments" {
551 try parseSuccess(
552 \\
553 \\
554 \\ # this is a comment in a weird place
555 \\# and this one is too
556 );
557}
558
559test "comment between --- and ! in document start" {
560 try parseError(
561 \\--- # what is it?
562 \\!
563 , error.UnexpectedToken);
564}
565
566test "correct doc start with tag" {
567 try parseSuccess(
568 \\--- !some-tag
569 \\
570 );
571}
572
573test "doc close without explicit doc open" {
574 try parseError(
575 \\
576 \\
577 \\# something cool
578 \\...
579 , error.UnexpectedToken);
580}
581
582test "doc open and close are ok" {
583 try parseSuccess(
584 \\---
585 \\# first doc
586 \\
587 \\
588 \\---
589 \\# second doc
590 \\
591 \\
592 \\...
593 );
594}
595
596test "doc with a single string is ok" {
597 try parseSuccess(
598 \\a string of some sort
599 \\
600 );
601}
602
603test "explicit doc with a single string is ok" {
604 try parseSuccess(
605 \\--- !anchor
606 \\# nothing to see here except one string
607 \\ # not a lot to go on with
608 \\a single string
609 \\...
610 );
611}
612
613test "doc with two string is bad" {
614 try parseError(
615 \\first
616 \\second
617 \\# this should fail already
618 , error.UnexpectedToken);
619}
620
621test "single quote string can have new lines" {
622 try parseSuccess(
623 \\'what is this
624 \\ thing?'
625 );
626}
627
628test "single quote string on one line is fine" {
629 try parseSuccess(
630 \\'here''s an apostrophe'
631 );
632}
633
634test "double quote string can have new lines" {
635 try parseSuccess(
636 \\"what is this
637 \\ thing?"
638 );
639}
640
641test "double quote string on one line is fine" {
642 try parseSuccess(
643 \\"a newline\nand a\ttab"
644 );
645}
646
647test "map with key and value literals" {
648 try parseSuccess(
649 \\key1: val1
650 \\key2 : val2
651 );
652}
653
654test "map of maps" {
655 try parseSuccess(
656 \\
657 \\# the first key
658 \\key1:
659 \\ # the first subkey
660 \\ key1_1: 0
661 \\ key1_2: 1
662 \\# the second key
663 \\key2:
664 \\ key2_1: -1
665 \\ key2_2: -2
666 \\# the end of map
667 );
668}
669
670test "map value indicator needs to be on the same line" {
671 try parseError(
672 \\a
673 \\ : b
674 , error.UnexpectedToken);
675}
676
677test "value needs to be indented" {
678 try parseError(
679 \\a:
680 \\b
681 , error.MalformedYaml);
682}
683
684test "comment between a key and a value is fine" {
685 try parseSuccess(
686 \\a:
687 \\ # this is a value
688 \\ b
689 );
690}
691
692test "simple list" {
693 try parseSuccess(
694 \\# first el
695 \\- a
696 \\# second el
697 \\- b
698 \\# third el
699 \\- c
700 );
701}
702
703test "list indentation matters" {
704 try parseSuccess(
705 \\ - a
706 \\- b
707 );
708
709 try parseSuccess(
710 \\- a
711 \\ - b
712 );
713}
714
715test "unindented list is fine too" {
716 try parseSuccess(
717 \\a:
718 \\- 0
719 \\- 1
720 );
721}
722
723test "empty values in a map" {
724 try parseSuccess(
725 \\a:
726 \\b:
727 \\- 0
728 );
729}
730
731test "weirdly nested map of maps of lists" {
732 try parseSuccess(
733 \\a:
734 \\ b:
735 \\ - 0
736 \\ - 1
737 );
738}
739
740test "square brackets denote a list" {
741 try parseSuccess(
742 \\[ a,
743 \\ b, c ]
744 );
745}
746
747test "empty list" {
748 try parseSuccess(
749 \\[ ]
750 );
751}
752
753test "comment within a bracketed list is an error" {
754 try parseError(
755 \\[ # something
756 \\]
757 , error.MalformedYaml);
758}
759
760test "mixed ints with floats in a list" {
761 try parseSuccess(
762 \\[0, 1.0]
763 );
764}
src/link/tapi/yaml.zig+176-396
...@@ -2,8 +2,7 @@ const std = @import("std");...@@ -2,8 +2,7 @@ const std = @import("std");
2const assert = std.debug.assert;2const assert = std.debug.assert;
3const math = std.math;3const math = std.math;
4const mem = std.mem;4const mem = std.mem;
5const testing = std.testing;5const log = std.log.scoped(.yaml);
6const log = std.log.scoped(.tapi);
76
8const Allocator = mem.Allocator;7const Allocator = mem.Allocator;
9const ArenaAllocator = std.heap.ArenaAllocator;8const ArenaAllocator = std.heap.ArenaAllocator;
...@@ -17,22 +16,15 @@ const ParseError = parse.ParseError;...@@ -17,22 +16,15 @@ const ParseError = parse.ParseError;
1716
18pub const YamlError = error{17pub const YamlError = error{
19 UnexpectedNodeType,18 UnexpectedNodeType,
19 DuplicateMapKey,
20 OutOfMemory,20 OutOfMemory,
21 CannotEncodeValue,
21} || ParseError || std.fmt.ParseIntError;22} || ParseError || std.fmt.ParseIntError;
2223
23pub const ValueType = enum {
24 empty,
25 int,
26 float,
27 string,
28 list,
29 map,
30};
31
32pub const List = []Value;24pub const List = []Value;
33pub const Map = std.StringArrayHashMap(Value);25pub const Map = std.StringHashMap(Value);
3426
35pub const Value = union(ValueType) {27pub const Value = union(enum) {
36 empty,28 empty,
37 int: i64,29 int: i64,
38 float: f64,30 float: f64,
...@@ -70,9 +62,7 @@ pub const Value = union(ValueType) {...@@ -70,9 +62,7 @@ pub const Value = union(ValueType) {
70 should_inline_first_key: bool = false,62 should_inline_first_key: bool = false,
71 };63 };
7264
73 pub const StringifyError = std.os.WriteError;65 pub fn stringify(self: Value, writer: anytype, args: StringifyArgs) anyerror!void {
74
75 pub fn stringify(self: Value, writer: anytype, args: StringifyArgs) StringifyError!void {
76 switch (self) {66 switch (self) {
77 .empty => return,67 .empty => return,
78 .int => |int| return writer.print("{}", .{int}),68 .int => |int| return writer.print("{}", .{int}),
...@@ -83,7 +73,7 @@ pub const Value = union(ValueType) {...@@ -83,7 +73,7 @@ pub const Value = union(ValueType) {
83 if (len == 0) return;73 if (len == 0) return;
8474
85 const first = list[0];75 const first = list[0];
86 if (first.is_compound()) {76 if (first.isCompound()) {
87 for (list, 0..) |elem, i| {77 for (list, 0..) |elem, i| {
88 try writer.writeByteNTimes(' ', args.indentation);78 try writer.writeByteNTimes(' ', args.indentation);
89 try writer.writeAll("- ");79 try writer.writeAll("- ");
...@@ -108,20 +98,23 @@ pub const Value = union(ValueType) {...@@ -108,20 +98,23 @@ pub const Value = union(ValueType) {
108 try writer.writeAll(" ]");98 try writer.writeAll(" ]");
109 },99 },
110 .map => |map| {100 .map => |map| {
111 const keys = map.keys();101 const len = map.count();
112 const len = keys.len;
113 if (len == 0) return;102 if (len == 0) return;
114103
115 for (keys, 0..) |key, i| {104 var i: usize = 0;
105 var it = map.iterator();
106 while (it.next()) |entry| {
107 const key = entry.key_ptr.*;
108 const value = entry.value_ptr.*;
109
116 if (!args.should_inline_first_key or i != 0) {110 if (!args.should_inline_first_key or i != 0) {
117 try writer.writeByteNTimes(' ', args.indentation);111 try writer.writeByteNTimes(' ', args.indentation);
118 }112 }
119 try writer.print("{s}: ", .{key});113 try writer.print("{s}: ", .{key});
120114
121 const value = map.get(key) orelse unreachable;
122 const should_inline = blk: {115 const should_inline = blk: {
123 if (!value.is_compound()) break :blk true;116 if (!value.isCompound()) break :blk true;
124 if (value == .list and value.list.len > 0 and !value.list[0].is_compound()) break :blk true;117 if (value == .list and value.list.len > 0 and !value.list[0].isCompound()) break :blk true;
125 break :blk false;118 break :blk false;
126 };119 };
127120
...@@ -137,35 +130,44 @@ pub const Value = union(ValueType) {...@@ -137,35 +130,44 @@ pub const Value = union(ValueType) {
137 if (i < len - 1) {130 if (i < len - 1) {
138 try writer.writeByte('\n');131 try writer.writeByte('\n');
139 }132 }
133
134 i += 1;
140 }135 }
141 },136 },
142 }137 }
143 }138 }
144139
145 fn is_compound(self: Value) bool {140 fn isCompound(self: Value) bool {
146 return switch (self) {141 return switch (self) {
147 .list, .map => true,142 .list, .map => true,
148 else => false,143 else => false,
149 };144 };
150 }145 }
151146
152 fn fromNode(arena: Allocator, tree: *const Tree, node: *const Node, type_hint: ?ValueType) YamlError!Value {147 fn fromNode(arena: Allocator, tree: *const Tree, node: *const Node) YamlError!Value {
153 if (node.cast(Node.Doc)) |doc| {148 if (node.cast(Node.Doc)) |doc| {
154 const inner = doc.value orelse {149 const inner = doc.value orelse {
155 // empty doc150 // empty doc
156 return Value{ .empty = {} };151 return Value{ .empty = {} };
157 };152 };
158 return Value.fromNode(arena, tree, inner, null);153 return Value.fromNode(arena, tree, inner);
159 } else if (node.cast(Node.Map)) |map| {154 } else if (node.cast(Node.Map)) |map| {
160 var out_map = std.StringArrayHashMap(Value).init(arena);155 // TODO use ContextAdapted HashMap and do not duplicate keys, intern
161 try out_map.ensureUnusedCapacity(map.values.items.len);156 // in a contiguous string buffer.
157 var out_map = std.StringHashMap(Value).init(arena);
158 try out_map.ensureUnusedCapacity(math.cast(u32, map.values.items.len) orelse return error.Overflow);
162159
163 for (map.values.items) |entry| {160 for (map.values.items) |entry| {
164 const key_tok = tree.tokens[entry.key];161 const key = try arena.dupe(u8, tree.getRaw(entry.key, entry.key));
165 const key = try arena.dupe(u8, tree.source[key_tok.start..key_tok.end]);162 const gop = out_map.getOrPutAssumeCapacity(key);
166 const value = try Value.fromNode(arena, tree, entry.value, null);163 if (gop.found_existing) {
167164 return error.DuplicateMapKey;
168 out_map.putAssumeCapacityNoClobber(key, value);165 }
166 const value = if (entry.value) |value|
167 try Value.fromNode(arena, tree, value)
168 else
169 .empty;
170 gop.value_ptr.* = value;
169 }171 }
170172
171 return Value{ .map = out_map };173 return Value{ .map = out_map };
...@@ -173,56 +175,124 @@ pub const Value = union(ValueType) {...@@ -173,56 +175,124 @@ pub const Value = union(ValueType) {
173 var out_list = std.ArrayList(Value).init(arena);175 var out_list = std.ArrayList(Value).init(arena);
174 try out_list.ensureUnusedCapacity(list.values.items.len);176 try out_list.ensureUnusedCapacity(list.values.items.len);
175177
176 if (list.values.items.len > 0) {178 for (list.values.items) |elem| {
177 const hint = if (list.values.items[0].cast(Node.Value)) |value| hint: {179 const value = try Value.fromNode(arena, tree, elem);
178 const start = tree.tokens[value.start.?];180 out_list.appendAssumeCapacity(value);
179 const end = tree.tokens[value.end.?];
180 const raw = tree.source[start.start..end.end];
181 _ = std.fmt.parseInt(i64, raw, 10) catch {
182 _ = std.fmt.parseFloat(f64, raw) catch {
183 break :hint ValueType.string;
184 };
185 break :hint ValueType.float;
186 };
187 break :hint ValueType.int;
188 } else null;
189
190 for (list.values.items) |elem| {
191 const value = try Value.fromNode(arena, tree, elem, hint);
192 out_list.appendAssumeCapacity(value);
193 }
194 }181 }
195182
196 return Value{ .list = try out_list.toOwnedSlice() };183 return Value{ .list = try out_list.toOwnedSlice() };
197 } else if (node.cast(Node.Value)) |value| {184 } else if (node.cast(Node.Value)) |value| {
198 const start = tree.tokens[value.start.?];185 const raw = tree.getRaw(node.start, node.end);
199 const end = tree.tokens[value.end.?];
200 const raw = tree.source[start.start..end.end];
201
202 if (type_hint) |hint| {
203 return switch (hint) {
204 .int => Value{ .int = try std.fmt.parseInt(i64, raw, 10) },
205 .float => Value{ .float = try std.fmt.parseFloat(f64, raw) },
206 .string => Value{ .string = try arena.dupe(u8, raw) },
207 else => unreachable,
208 };
209 }
210186
211 try_int: {187 try_int: {
212 // TODO infer base for int188 // TODO infer base for int
213 const int = std.fmt.parseInt(i64, raw, 10) catch break :try_int;189 const int = std.fmt.parseInt(i64, raw, 10) catch break :try_int;
214 return Value{ .int = int };190 return Value{ .int = int };
215 }191 }
192
216 try_float: {193 try_float: {
217 const float = std.fmt.parseFloat(f64, raw) catch break :try_float;194 const float = std.fmt.parseFloat(f64, raw) catch break :try_float;
218 return Value{ .float = float };195 return Value{ .float = float };
219 }196 }
220 return Value{ .string = try arena.dupe(u8, raw) };197
198 return Value{ .string = try arena.dupe(u8, value.string_value.items) };
221 } else {199 } else {
222 log.err("Unexpected node type: {}", .{node.tag});200 log.err("Unexpected node type: {}", .{node.tag});
223 return error.UnexpectedNodeType;201 return error.UnexpectedNodeType;
224 }202 }
225 }203 }
204
205 fn encode(arena: Allocator, input: anytype) YamlError!?Value {
206 switch (@typeInfo(@TypeOf(input))) {
207 .ComptimeInt,
208 .Int,
209 => return Value{ .int = math.cast(i64, input) orelse return error.Overflow },
210
211 .Float => return Value{ .float = math.lossyCast(f64, input) },
212
213 .Struct => |info| if (info.is_tuple) {
214 var list = std.ArrayList(Value).init(arena);
215 errdefer list.deinit();
216 try list.ensureTotalCapacityPrecise(info.fields.len);
217
218 inline for (info.fields) |field| {
219 if (try encode(arena, @field(input, field.name))) |value| {
220 list.appendAssumeCapacity(value);
221 }
222 }
223
224 return Value{ .list = try list.toOwnedSlice() };
225 } else {
226 var map = Map.init(arena);
227 errdefer map.deinit();
228 try map.ensureTotalCapacity(info.fields.len);
229
230 inline for (info.fields) |field| {
231 if (try encode(arena, @field(input, field.name))) |value| {
232 const key = try arena.dupe(u8, field.name);
233 map.putAssumeCapacityNoClobber(key, value);
234 }
235 }
236
237 return Value{ .map = map };
238 },
239
240 .Union => |info| if (info.tag_type) |tag_type| {
241 inline for (info.fields) |field| {
242 if (@field(tag_type, field.name) == input) {
243 return try encode(arena, @field(input, field.name));
244 }
245 } else unreachable;
246 } else return error.UntaggedUnion,
247
248 .Array => return encode(arena, &input),
249
250 .Pointer => |info| switch (info.size) {
251 .One => switch (@typeInfo(info.child)) {
252 .Array => |child_info| {
253 const Slice = []const child_info.child;
254 return encode(arena, @as(Slice, input));
255 },
256 else => {
257 @compileError("Unhandled type: {s}" ++ @typeName(info.child));
258 },
259 },
260 .Slice => {
261 if (info.child == u8) {
262 return Value{ .string = try arena.dupe(u8, input) };
263 }
264
265 var list = std.ArrayList(Value).init(arena);
266 errdefer list.deinit();
267 try list.ensureTotalCapacityPrecise(input.len);
268
269 for (input) |elem| {
270 if (try encode(arena, elem)) |value| {
271 list.appendAssumeCapacity(value);
272 } else {
273 log.err("Could not encode value in a list: {any}", .{elem});
274 return error.CannotEncodeValue;
275 }
276 }
277
278 return Value{ .list = try list.toOwnedSlice() };
279 },
280 else => {
281 @compileError("Unhandled type: {s}" ++ @typeName(@TypeOf(input)));
282 },
283 },
284
285 // TODO we should probably have an option to encode `null` and also
286 // allow for some default value too.
287 .Optional => return if (input) |val| encode(arena, val) else null,
288
289 .Null => return null,
290
291 else => {
292 @compileError("Unhandled type: {s}" ++ @typeName(@TypeOf(input)));
293 },
294 }
295 }
226};296};
227297
228pub const Yaml = struct {298pub const Yaml = struct {
...@@ -234,30 +304,18 @@ pub const Yaml = struct {...@@ -234,30 +304,18 @@ pub const Yaml = struct {
234 self.arena.deinit();304 self.arena.deinit();
235 }305 }
236306
237 pub fn stringify(self: Yaml, writer: anytype) !void {
238 for (self.docs.items) |doc| {
239 // if (doc.directive) |directive| {
240 // try writer.print("--- !{s}\n", .{directive});
241 // }
242 try doc.stringify(writer, .{});
243 // if (doc.directive != null) {
244 // try writer.writeAll("...\n");
245 // }
246 }
247 }
248
249 pub fn load(allocator: Allocator, source: []const u8) !Yaml {307 pub fn load(allocator: Allocator, source: []const u8) !Yaml {
250 var arena = ArenaAllocator.init(allocator);308 var arena = ArenaAllocator.init(allocator);
251 const arena_allocator = arena.allocator();309 errdefer arena.deinit();
252310
253 var tree = Tree.init(arena_allocator);311 var tree = Tree.init(arena.allocator());
254 try tree.parse(source);312 try tree.parse(source);
255313
256 var docs = std.ArrayList(Value).init(arena_allocator);314 var docs = std.ArrayList(Value).init(arena.allocator());
257 try docs.ensureUnusedCapacity(tree.docs.items.len);315 try docs.ensureTotalCapacityPrecise(tree.docs.items.len);
258316
259 for (tree.docs.items) |node| {317 for (tree.docs.items) |node| {
260 const value = try Value.fromNode(arena_allocator, &tree, node, null);318 const value = try Value.fromNode(arena.allocator(), &tree, node);
261 docs.appendAssumeCapacity(value);319 docs.appendAssumeCapacity(value);
262 }320 }
263321
...@@ -316,17 +374,19 @@ pub const Yaml = struct {...@@ -316,17 +374,19 @@ pub const Yaml = struct {
316374
317 fn parseValue(self: *Yaml, comptime T: type, value: Value) Error!T {375 fn parseValue(self: *Yaml, comptime T: type, value: Value) Error!T {
318 return switch (@typeInfo(T)) {376 return switch (@typeInfo(T)) {
319 .Int => math.cast(T, try value.asInt()) orelse error.Overflow,377 .Int => math.cast(T, try value.asInt()) orelse return error.Overflow,
320 .Float => math.lossyCast(T, try value.asFloat()),378 .Float => if (value.asFloat()) |float| {
379 return math.lossyCast(T, float);
380 } else |_| {
381 return math.lossyCast(T, try value.asInt());
382 },
321 .Struct => self.parseStruct(T, try value.asMap()),383 .Struct => self.parseStruct(T, try value.asMap()),
322 .Union => self.parseUnion(T, value),384 .Union => self.parseUnion(T, value),
323 .Array => self.parseArray(T, try value.asList()),385 .Array => self.parseArray(T, try value.asList()),
324 .Pointer => {386 .Pointer => if (value.asList()) |list| {
325 if (value.asList()) |list| {387 return self.parsePointer(T, .{ .list = list });
326 return self.parsePointer(T, .{ .list = list });388 } else |_| {
327 } else |_| {389 return self.parsePointer(T, .{ .string = try value.asString() });
328 return self.parsePointer(T, .{ .string = try value.asString() });
329 }
330 },390 },
331 .Void => error.TypeMismatch,391 .Void => error.TypeMismatch,
332 .Optional => unreachable,392 .Optional => unreachable,
...@@ -372,7 +432,7 @@ pub const Yaml = struct {...@@ -372,7 +432,7 @@ pub const Yaml = struct {
372 }432 }
373433
374 const unwrapped = value orelse {434 const unwrapped = value orelse {
375 log.debug("missing struct field: {s}: {s}", .{ field.name, @typeName(field.type) });435 log.err("missing struct field: {s}: {s}", .{ field.name, @typeName(field.type) });
376 return error.StructFieldMissing;436 return error.StructFieldMissing;
377 };437 };
378 @field(parsed, field.name) = try self.parseValue(field.type, unwrapped);438 @field(parsed, field.name) = try self.parseValue(field.type, unwrapped);
...@@ -387,8 +447,7 @@ pub const Yaml = struct {...@@ -387,8 +447,7 @@ pub const Yaml = struct {
387447
388 switch (ptr_info.size) {448 switch (ptr_info.size) {
389 .Slice => {449 .Slice => {
390 const child_info = @typeInfo(ptr_info.child);450 if (ptr_info.child == u8) {
391 if (child_info == .Int and child_info.Int.bits == 8) {
392 return value.asString();451 return value.asString();
393 }452 }
394453
...@@ -413,315 +472,36 @@ pub const Yaml = struct {...@@ -413,315 +472,36 @@ pub const Yaml = struct {
413472
414 return parsed;473 return parsed;
415 }474 }
416};
417
418test {
419 testing.refAllDecls(@This());
420}
421
422test "simple list" {
423 const source =
424 \\- a
425 \\- b
426 \\- c
427 ;
428
429 var yaml = try Yaml.load(testing.allocator, source);
430 defer yaml.deinit();
431475
432 try testing.expectEqual(yaml.docs.items.len, 1);476 pub fn stringify(self: Yaml, writer: anytype) !void {
433477 for (self.docs.items, 0..) |doc, i| {
434 const list = yaml.docs.items[0].list;478 try writer.writeAll("---");
435 try testing.expectEqual(list.len, 3);479 if (self.tree.?.getDirective(i)) |directive| {
436480 try writer.print(" !{s}", .{directive});
437 try testing.expect(mem.eql(u8, list[0].string, "a"));481 }
438 try testing.expect(mem.eql(u8, list[1].string, "b"));482 try writer.writeByte('\n');
439 try testing.expect(mem.eql(u8, list[2].string, "c"));483 try doc.stringify(writer, .{});
440}484 try writer.writeByte('\n');
441485 }
442test "simple list typed as array of strings" {486 try writer.writeAll("...\n");
443 const source =
444 \\- a
445 \\- b
446 \\- c
447 ;
448
449 var yaml = try Yaml.load(testing.allocator, source);
450 defer yaml.deinit();
451
452 try testing.expectEqual(yaml.docs.items.len, 1);
453
454 const arr = try yaml.parse([3][]const u8);
455 try testing.expectEqual(arr.len, 3);
456 try testing.expect(mem.eql(u8, arr[0], "a"));
457 try testing.expect(mem.eql(u8, arr[1], "b"));
458 try testing.expect(mem.eql(u8, arr[2], "c"));
459}
460
461test "simple list typed as array of ints" {
462 const source =
463 \\- 0
464 \\- 1
465 \\- 2
466 ;
467
468 var yaml = try Yaml.load(testing.allocator, source);
469 defer yaml.deinit();
470
471 try testing.expectEqual(yaml.docs.items.len, 1);
472
473 const arr = try yaml.parse([3]u8);
474 try testing.expectEqual(arr.len, 3);
475 try testing.expectEqual(arr[0], 0);
476 try testing.expectEqual(arr[1], 1);
477 try testing.expectEqual(arr[2], 2);
478}
479
480test "list of mixed sign integer" {
481 const source =
482 \\- 0
483 \\- -1
484 \\- 2
485 ;
486
487 var yaml = try Yaml.load(testing.allocator, source);
488 defer yaml.deinit();
489
490 try testing.expectEqual(yaml.docs.items.len, 1);
491
492 const arr = try yaml.parse([3]i8);
493 try testing.expectEqual(arr.len, 3);
494 try testing.expectEqual(arr[0], 0);
495 try testing.expectEqual(arr[1], -1);
496 try testing.expectEqual(arr[2], 2);
497}
498
499test "simple map untyped" {
500 const source =
501 \\a: 0
502 ;
503
504 var yaml = try Yaml.load(testing.allocator, source);
505 defer yaml.deinit();
506
507 try testing.expectEqual(yaml.docs.items.len, 1);
508
509 const map = yaml.docs.items[0].map;
510 try testing.expect(map.contains("a"));
511 try testing.expectEqual(map.get("a").?.int, 0);
512}
513
514test "simple map untyped with a list of maps" {
515 const source =
516 \\a: 0
517 \\b:
518 \\ - foo: 1
519 \\ bar: 2
520 \\ - foo: 3
521 \\ bar: 4
522 \\c: 1
523 ;
524
525 var yaml = try Yaml.load(testing.allocator, source);
526 defer yaml.deinit();
527
528 try testing.expectEqual(yaml.docs.items.len, 1);
529
530 const map = yaml.docs.items[0].map;
531 try testing.expect(map.contains("a"));
532 try testing.expect(map.contains("b"));
533 try testing.expect(map.contains("c"));
534 try testing.expectEqual(map.get("a").?.int, 0);
535 try testing.expectEqual(map.get("c").?.int, 1);
536 try testing.expectEqual(map.get("b").?.list[0].map.get("foo").?.int, 1);
537 try testing.expectEqual(map.get("b").?.list[0].map.get("bar").?.int, 2);
538 try testing.expectEqual(map.get("b").?.list[1].map.get("foo").?.int, 3);
539 try testing.expectEqual(map.get("b").?.list[1].map.get("bar").?.int, 4);
540}
541
542test "simple map untyped with a list of maps. no indent" {
543 const source =
544 \\b:
545 \\- foo: 1
546 \\c: 1
547 ;
548
549 var yaml = try Yaml.load(testing.allocator, source);
550 defer yaml.deinit();
551
552 try testing.expectEqual(yaml.docs.items.len, 1);
553
554 const map = yaml.docs.items[0].map;
555 try testing.expect(map.contains("b"));
556 try testing.expect(map.contains("c"));
557 try testing.expectEqual(map.get("c").?.int, 1);
558 try testing.expectEqual(map.get("b").?.list[0].map.get("foo").?.int, 1);
559}
560
561test "simple map untyped with a list of maps. no indent 2" {
562 const source =
563 \\a: 0
564 \\b:
565 \\- foo: 1
566 \\ bar: 2
567 \\- foo: 3
568 \\ bar: 4
569 \\c: 1
570 ;
571
572 var yaml = try Yaml.load(testing.allocator, source);
573 defer yaml.deinit();
574
575 try testing.expectEqual(yaml.docs.items.len, 1);
576
577 const map = yaml.docs.items[0].map;
578 try testing.expect(map.contains("a"));
579 try testing.expect(map.contains("b"));
580 try testing.expect(map.contains("c"));
581 try testing.expectEqual(map.get("a").?.int, 0);
582 try testing.expectEqual(map.get("c").?.int, 1);
583 try testing.expectEqual(map.get("b").?.list[0].map.get("foo").?.int, 1);
584 try testing.expectEqual(map.get("b").?.list[0].map.get("bar").?.int, 2);
585 try testing.expectEqual(map.get("b").?.list[1].map.get("foo").?.int, 3);
586 try testing.expectEqual(map.get("b").?.list[1].map.get("bar").?.int, 4);
587}
588
589test "simple map typed" {
590 const source =
591 \\a: 0
592 \\b: hello there
593 \\c: 'wait, what?'
594 ;
595
596 var yaml = try Yaml.load(testing.allocator, source);
597 defer yaml.deinit();
598
599 const simple = try yaml.parse(struct { a: usize, b: []const u8, c: []const u8 });
600 try testing.expectEqual(simple.a, 0);
601 try testing.expect(mem.eql(u8, simple.b, "hello there"));
602 try testing.expect(mem.eql(u8, simple.c, "wait, what?"));
603}
604
605test "typed nested structs" {
606 const source =
607 \\a:
608 \\ b: hello there
609 \\ c: 'wait, what?'
610 ;
611
612 var yaml = try Yaml.load(testing.allocator, source);
613 defer yaml.deinit();
614
615 const simple = try yaml.parse(struct {
616 a: struct {
617 b: []const u8,
618 c: []const u8,
619 },
620 });
621 try testing.expect(mem.eql(u8, simple.a.b, "hello there"));
622 try testing.expect(mem.eql(u8, simple.a.c, "wait, what?"));
623}
624
625test "multidoc typed as a slice of structs" {
626 const source =
627 \\---
628 \\a: 0
629 \\---
630 \\a: 1
631 \\...
632 ;
633
634 var yaml = try Yaml.load(testing.allocator, source);
635 defer yaml.deinit();
636
637 {
638 const result = try yaml.parse([2]struct { a: usize });
639 try testing.expectEqual(result.len, 2);
640 try testing.expectEqual(result[0].a, 0);
641 try testing.expectEqual(result[1].a, 1);
642 }
643
644 {
645 const result = try yaml.parse([]struct { a: usize });
646 try testing.expectEqual(result.len, 2);
647 try testing.expectEqual(result[0].a, 0);
648 try testing.expectEqual(result[1].a, 1);
649 }487 }
650}488};
651
652test "multidoc typed as a struct is an error" {
653 const source =
654 \\---
655 \\a: 0
656 \\---
657 \\b: 1
658 \\...
659 ;
660
661 var yaml = try Yaml.load(testing.allocator, source);
662 defer yaml.deinit();
663
664 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(struct { a: usize }));
665 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(struct { b: usize }));
666 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(struct { a: usize, b: usize }));
667}
668
669test "multidoc typed as a slice of structs with optionals" {
670 const source =
671 \\---
672 \\a: 0
673 \\c: 1.0
674 \\---
675 \\a: 1
676 \\b: different field
677 \\...
678 ;
679
680 var yaml = try Yaml.load(testing.allocator, source);
681 defer yaml.deinit();
682
683 const result = try yaml.parse([]struct { a: usize, b: ?[]const u8, c: ?f16 });
684 try testing.expectEqual(result.len, 2);
685
686 try testing.expectEqual(result[0].a, 0);
687 try testing.expect(result[0].b == null);
688 try testing.expect(result[0].c != null);
689 try testing.expectEqual(result[0].c.?, 1.0);
690
691 try testing.expectEqual(result[1].a, 1);
692 try testing.expect(result[1].b != null);
693 try testing.expect(mem.eql(u8, result[1].b.?, "different field"));
694 try testing.expect(result[1].c == null);
695}
696
697test "empty yaml can be represented as void" {
698 const source = "";
699 var yaml = try Yaml.load(testing.allocator, source);
700 defer yaml.deinit();
701 const result = try yaml.parse(void);
702 try testing.expect(@TypeOf(result) == void);
703}
704489
705test "nonempty yaml cannot be represented as void" {490pub fn stringify(allocator: Allocator, input: anytype, writer: anytype) !void {
706 const source =491 var arena = ArenaAllocator.init(allocator);
707 \\a: b492 defer arena.deinit();
708 ;
709493
710 var yaml = try Yaml.load(testing.allocator, source);494 var maybe_value = try Value.encode(arena.allocator(), input);
711 defer yaml.deinit();
712495
713 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(void));496 if (maybe_value) |value| {
497 // TODO should we output as an explicit doc?
498 // How can allow the user to specify?
499 try value.stringify(writer, .{});
500 }
714}501}
715502
716test "typed array size mismatch" {503test {
717 const source =504 std.testing.refAllDecls(Tokenizer);
718 \\- 0505 std.testing.refAllDecls(parse);
719 \\- 0506 _ = @import("yaml/test.zig");
720 ;
721
722 var yaml = try Yaml.load(testing.allocator, source);
723 defer yaml.deinit();
724
725 try testing.expectError(Yaml.Error.ArraySizeMismatch, yaml.parse([1]usize));
726 try testing.expectError(Yaml.Error.ArraySizeMismatch, yaml.parse([5]usize));
727}507}
src/link/tapi/yaml/test.zig created+475
...@@ -0,0 +1,475 @@
1const std = @import("std");
2const mem = std.mem;
3const testing = std.testing;
4
5const yaml_mod = @import("../yaml.zig");
6const Yaml = yaml_mod.Yaml;
7
8test "simple list" {
9 const source =
10 \\- a
11 \\- b
12 \\- c
13 ;
14
15 var yaml = try Yaml.load(testing.allocator, source);
16 defer yaml.deinit();
17
18 try testing.expectEqual(yaml.docs.items.len, 1);
19
20 const list = yaml.docs.items[0].list;
21 try testing.expectEqual(list.len, 3);
22
23 try testing.expectEqualStrings("a", list[0].string);
24 try testing.expectEqualStrings("b", list[1].string);
25 try testing.expectEqualStrings("c", list[2].string);
26}
27
28test "simple list typed as array of strings" {
29 const source =
30 \\- a
31 \\- b
32 \\- c
33 ;
34
35 var yaml = try Yaml.load(testing.allocator, source);
36 defer yaml.deinit();
37
38 try testing.expectEqual(yaml.docs.items.len, 1);
39
40 const arr = try yaml.parse([3][]const u8);
41 try testing.expectEqual(3, arr.len);
42 try testing.expectEqualStrings("a", arr[0]);
43 try testing.expectEqualStrings("b", arr[1]);
44 try testing.expectEqualStrings("c", arr[2]);
45}
46
47test "simple list typed as array of ints" {
48 const source =
49 \\- 0
50 \\- 1
51 \\- 2
52 ;
53
54 var yaml = try Yaml.load(testing.allocator, source);
55 defer yaml.deinit();
56
57 try testing.expectEqual(yaml.docs.items.len, 1);
58
59 const arr = try yaml.parse([3]u8);
60 try testing.expectEqualSlices(u8, &[_]u8{ 0, 1, 2 }, &arr);
61}
62
63test "list of mixed sign integer" {
64 const source =
65 \\- 0
66 \\- -1
67 \\- 2
68 ;
69
70 var yaml = try Yaml.load(testing.allocator, source);
71 defer yaml.deinit();
72
73 try testing.expectEqual(yaml.docs.items.len, 1);
74
75 const arr = try yaml.parse([3]i8);
76 try testing.expectEqualSlices(i8, &[_]i8{ 0, -1, 2 }, &arr);
77}
78
79test "simple map untyped" {
80 const source =
81 \\a: 0
82 ;
83
84 var yaml = try Yaml.load(testing.allocator, source);
85 defer yaml.deinit();
86
87 try testing.expectEqual(yaml.docs.items.len, 1);
88
89 const map = yaml.docs.items[0].map;
90 try testing.expect(map.contains("a"));
91 try testing.expectEqual(@as(i64, 0), map.get("a").?.int);
92}
93
94test "simple map untyped with a list of maps" {
95 const source =
96 \\a: 0
97 \\b:
98 \\ - foo: 1
99 \\ bar: 2
100 \\ - foo: 3
101 \\ bar: 4
102 \\c: 1
103 ;
104
105 var yaml = try Yaml.load(testing.allocator, source);
106 defer yaml.deinit();
107
108 try testing.expectEqual(yaml.docs.items.len, 1);
109
110 const map = yaml.docs.items[0].map;
111 try testing.expect(map.contains("a"));
112 try testing.expect(map.contains("b"));
113 try testing.expect(map.contains("c"));
114 try testing.expectEqual(@as(i64, 0), map.get("a").?.int);
115 try testing.expectEqual(@as(i64, 1), map.get("c").?.int);
116 try testing.expectEqual(@as(i64, 1), map.get("b").?.list[0].map.get("foo").?.int);
117 try testing.expectEqual(@as(i64, 2), map.get("b").?.list[0].map.get("bar").?.int);
118 try testing.expectEqual(@as(i64, 3), map.get("b").?.list[1].map.get("foo").?.int);
119 try testing.expectEqual(@as(i64, 4), map.get("b").?.list[1].map.get("bar").?.int);
120}
121
122test "simple map untyped with a list of maps. no indent" {
123 const source =
124 \\b:
125 \\- foo: 1
126 \\c: 1
127 ;
128
129 var yaml = try Yaml.load(testing.allocator, source);
130 defer yaml.deinit();
131
132 try testing.expectEqual(yaml.docs.items.len, 1);
133
134 const map = yaml.docs.items[0].map;
135 try testing.expect(map.contains("b"));
136 try testing.expect(map.contains("c"));
137 try testing.expectEqual(@as(i64, 1), map.get("c").?.int);
138 try testing.expectEqual(@as(i64, 1), map.get("b").?.list[0].map.get("foo").?.int);
139}
140
141test "simple map untyped with a list of maps. no indent 2" {
142 const source =
143 \\a: 0
144 \\b:
145 \\- foo: 1
146 \\ bar: 2
147 \\- foo: 3
148 \\ bar: 4
149 \\c: 1
150 ;
151
152 var yaml = try Yaml.load(testing.allocator, source);
153 defer yaml.deinit();
154
155 try testing.expectEqual(yaml.docs.items.len, 1);
156
157 const map = yaml.docs.items[0].map;
158 try testing.expect(map.contains("a"));
159 try testing.expect(map.contains("b"));
160 try testing.expect(map.contains("c"));
161 try testing.expectEqual(@as(i64, 0), map.get("a").?.int);
162 try testing.expectEqual(@as(i64, 1), map.get("c").?.int);
163 try testing.expectEqual(@as(i64, 1), map.get("b").?.list[0].map.get("foo").?.int);
164 try testing.expectEqual(@as(i64, 2), map.get("b").?.list[0].map.get("bar").?.int);
165 try testing.expectEqual(@as(i64, 3), map.get("b").?.list[1].map.get("foo").?.int);
166 try testing.expectEqual(@as(i64, 4), map.get("b").?.list[1].map.get("bar").?.int);
167}
168
169test "simple map typed" {
170 const source =
171 \\a: 0
172 \\b: hello there
173 \\c: 'wait, what?'
174 ;
175
176 var yaml = try Yaml.load(testing.allocator, source);
177 defer yaml.deinit();
178
179 const simple = try yaml.parse(struct { a: usize, b: []const u8, c: []const u8 });
180 try testing.expectEqual(@as(usize, 0), simple.a);
181 try testing.expectEqualStrings("hello there", simple.b);
182 try testing.expectEqualStrings("wait, what?", simple.c);
183}
184
185test "typed nested structs" {
186 const source =
187 \\a:
188 \\ b: hello there
189 \\ c: 'wait, what?'
190 ;
191
192 var yaml = try Yaml.load(testing.allocator, source);
193 defer yaml.deinit();
194
195 const simple = try yaml.parse(struct {
196 a: struct {
197 b: []const u8,
198 c: []const u8,
199 },
200 });
201 try testing.expectEqualStrings("hello there", simple.a.b);
202 try testing.expectEqualStrings("wait, what?", simple.a.c);
203}
204
205test "single quoted string" {
206 const source =
207 \\- 'hello'
208 \\- 'here''s an escaped quote'
209 \\- 'newlines and tabs\nare not\tsupported'
210 ;
211
212 var yaml = try Yaml.load(testing.allocator, source);
213 defer yaml.deinit();
214
215 const arr = try yaml.parse([3][]const u8);
216 try testing.expectEqual(arr.len, 3);
217 try testing.expectEqualStrings("hello", arr[0]);
218 try testing.expectEqualStrings("here's an escaped quote", arr[1]);
219 try testing.expectEqualStrings("newlines and tabs\\nare not\\tsupported", arr[2]);
220}
221
222test "double quoted string" {
223 const source =
224 \\- "hello"
225 \\- "\"here\" are some escaped quotes"
226 \\- "newlines and tabs\nare\tsupported"
227 \\- "let's have
228 \\some fun!"
229 ;
230
231 var yaml = try Yaml.load(testing.allocator, source);
232 defer yaml.deinit();
233
234 const arr = try yaml.parse([4][]const u8);
235 try testing.expectEqual(arr.len, 4);
236 try testing.expectEqualStrings("hello", arr[0]);
237 try testing.expectEqualStrings(
238 \\"here" are some escaped quotes
239 , arr[1]);
240 try testing.expectEqualStrings(
241 \\newlines and tabs
242 \\are supported
243 , arr[2]);
244 try testing.expectEqualStrings(
245 \\let's have
246 \\some fun!
247 , arr[3]);
248}
249
250test "multidoc typed as a slice of structs" {
251 const source =
252 \\---
253 \\a: 0
254 \\---
255 \\a: 1
256 \\...
257 ;
258
259 var yaml = try Yaml.load(testing.allocator, source);
260 defer yaml.deinit();
261
262 {
263 const result = try yaml.parse([2]struct { a: usize });
264 try testing.expectEqual(result.len, 2);
265 try testing.expectEqual(result[0].a, 0);
266 try testing.expectEqual(result[1].a, 1);
267 }
268
269 {
270 const result = try yaml.parse([]struct { a: usize });
271 try testing.expectEqual(result.len, 2);
272 try testing.expectEqual(result[0].a, 0);
273 try testing.expectEqual(result[1].a, 1);
274 }
275}
276
277test "multidoc typed as a struct is an error" {
278 const source =
279 \\---
280 \\a: 0
281 \\---
282 \\b: 1
283 \\...
284 ;
285
286 var yaml = try Yaml.load(testing.allocator, source);
287 defer yaml.deinit();
288
289 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(struct { a: usize }));
290 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(struct { b: usize }));
291 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(struct { a: usize, b: usize }));
292}
293
294test "multidoc typed as a slice of structs with optionals" {
295 const source =
296 \\---
297 \\a: 0
298 \\c: 1.0
299 \\---
300 \\a: 1
301 \\b: different field
302 \\...
303 ;
304
305 var yaml = try Yaml.load(testing.allocator, source);
306 defer yaml.deinit();
307
308 const result = try yaml.parse([]struct { a: usize, b: ?[]const u8, c: ?f16 });
309 try testing.expectEqual(result.len, 2);
310
311 try testing.expectEqual(result[0].a, 0);
312 try testing.expect(result[0].b == null);
313 try testing.expect(result[0].c != null);
314 try testing.expectEqual(result[0].c.?, 1.0);
315
316 try testing.expectEqual(result[1].a, 1);
317 try testing.expect(result[1].b != null);
318 try testing.expectEqualStrings("different field", result[1].b.?);
319 try testing.expect(result[1].c == null);
320}
321
322test "empty yaml can be represented as void" {
323 const source = "";
324 var yaml = try Yaml.load(testing.allocator, source);
325 defer yaml.deinit();
326 const result = try yaml.parse(void);
327 try testing.expect(@TypeOf(result) == void);
328}
329
330test "nonempty yaml cannot be represented as void" {
331 const source =
332 \\a: b
333 ;
334
335 var yaml = try Yaml.load(testing.allocator, source);
336 defer yaml.deinit();
337
338 try testing.expectError(Yaml.Error.TypeMismatch, yaml.parse(void));
339}
340
341test "typed array size mismatch" {
342 const source =
343 \\- 0
344 \\- 0
345 ;
346
347 var yaml = try Yaml.load(testing.allocator, source);
348 defer yaml.deinit();
349
350 try testing.expectError(Yaml.Error.ArraySizeMismatch, yaml.parse([1]usize));
351 try testing.expectError(Yaml.Error.ArraySizeMismatch, yaml.parse([5]usize));
352}
353
354test "comments" {
355 const source =
356 \\
357 \\key: # this is the key
358 \\# first value
359 \\
360 \\- val1
361 \\
362 \\# second value
363 \\- val2
364 ;
365
366 var yaml = try Yaml.load(testing.allocator, source);
367 defer yaml.deinit();
368
369 const simple = try yaml.parse(struct {
370 key: []const []const u8,
371 });
372 try testing.expect(simple.key.len == 2);
373 try testing.expectEqualStrings("val1", simple.key[0]);
374 try testing.expectEqualStrings("val2", simple.key[1]);
375}
376
377test "promote ints to floats in a list mixed numeric types" {
378 const source =
379 \\a_list: [0, 1.0]
380 ;
381
382 var yaml = try Yaml.load(testing.allocator, source);
383 defer yaml.deinit();
384
385 const simple = try yaml.parse(struct {
386 a_list: []const f64,
387 });
388 try testing.expectEqualSlices(f64, &[_]f64{ 0.0, 1.0 }, simple.a_list);
389}
390
391test "demoting floats to ints in a list is an error" {
392 const source =
393 \\a_list: [0, 1.0]
394 ;
395
396 var yaml = try Yaml.load(testing.allocator, source);
397 defer yaml.deinit();
398
399 try testing.expectError(error.TypeMismatch, yaml.parse(struct {
400 a_list: []const u64,
401 }));
402}
403
404test "duplicate map keys" {
405 const source =
406 \\a: b
407 \\a: c
408 ;
409 try testing.expectError(error.DuplicateMapKey, Yaml.load(testing.allocator, source));
410}
411
412fn testStringify(expected: []const u8, input: anytype) !void {
413 var output = std.ArrayList(u8).init(testing.allocator);
414 defer output.deinit();
415
416 try yaml_mod.stringify(testing.allocator, input, output.writer());
417 try testing.expectEqualStrings(expected, output.items);
418}
419
420test "stringify an int" {
421 try testStringify("128", @as(u32, 128));
422}
423
424test "stringify a simple struct" {
425 try testStringify(
426 \\a: 1
427 \\b: 2
428 \\c: 2.5
429 , struct { a: i64, b: f64, c: f64 }{ .a = 1, .b = 2.0, .c = 2.5 });
430}
431
432test "stringify a struct with an optional" {
433 try testStringify(
434 \\a: 1
435 \\b: 2
436 \\c: 2.5
437 , struct { a: i64, b: ?f64, c: f64 }{ .a = 1, .b = 2.0, .c = 2.5 });
438
439 try testStringify(
440 \\a: 1
441 \\c: 2.5
442 , struct { a: i64, b: ?f64, c: f64 }{ .a = 1, .b = null, .c = 2.5 });
443}
444
445test "stringify a struct with all optionals" {
446 try testStringify("", struct { a: ?i64, b: ?f64 }{ .a = null, .b = null });
447}
448
449test "stringify an optional" {
450 try testStringify("", null);
451 try testStringify("", @as(?u64, null));
452}
453
454test "stringify a union" {
455 const Dummy = union(enum) {
456 x: u64,
457 y: f64,
458 };
459 try testStringify("a: 1", struct { a: Dummy }{ .a = .{ .x = 1 } });
460 try testStringify("a: 2.1", struct { a: Dummy }{ .a = .{ .y = 2.1 } });
461}
462
463test "stringify a string" {
464 try testStringify("a: name", struct { a: []const u8 }{ .a = "name" });
465 try testStringify("name", "name");
466}
467
468test "stringify a list" {
469 try testStringify("[ 1, 2, 3 ]", @as([]const u64, &.{ 1, 2, 3 }));
470 try testStringify("[ 1, 2, 3 ]", .{ @as(i64, 1), 2, 3 });
471 try testStringify("[ 1, name, 3 ]", .{ 1, "name", 3 });
472
473 const arr: [3]i64 = .{ 1, 2, 3 };
474 try testStringify("[ 1, 2, 3 ]", arr);
475}