| author | |
| committer | |
| log | 381dc2d9509ffeaf60a1775ee0983c7dd1b9e346 |
| tree | 34dc901cf638a113cd7bf84d90125b9c64685b3d |
| parent | 575a98a0813181c268e86d590b6267583736bafd |
| parent | a0a854b1fc5e64a07b2026ac0668f8d417ab6bf1 |
| signature |
Fixes for latest macOS 13.3 SDK release7 files changed, 1960 insertions(+), 1794 deletions(-)
lib/libc/darwin/libSystem.13.tbd+207-672| ... | ... | @@ -2,21 +2,8 @@ |
| 2 | 2 | tbd-version: 4 |
| 3 | 3 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 4 | 4 | arm64e-macos, arm64e-maccatalyst ] |
| 5 | uuids: | |
| 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 | |
| 18 | 5 | install-name: '/usr/lib/libSystem.B.dylib' |
| 19 | current-version: 1319 | |
| 6 | current-version: 1319.100.3 | |
| 20 | 7 | reexported-libraries: |
| 21 | 8 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 22 | 9 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -57,21 +44,8 @@ exports: |
| 57 | 44 | tbd-version: 4 |
| 58 | 45 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 59 | 46 | arm64e-macos, arm64e-maccatalyst ] |
| 60 | uuids: | |
| 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 | |
| 73 | 47 | install-name: '/usr/lib/system/libcache.dylib' |
| 74 | current-version: 90 | |
| 48 | current-version: 92 | |
| 75 | 49 | parent-umbrella: |
| 76 | 50 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 77 | 51 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -95,21 +69,8 @@ exports: |
| 95 | 69 | tbd-version: 4 |
| 96 | 70 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 97 | 71 | arm64e-macos, arm64e-maccatalyst ] |
| 98 | uuids: | |
| 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 | |
| 111 | 72 | install-name: '/usr/lib/system/libcommonCrypto.dylib' |
| 112 | current-version: 60198.60.2 | |
| 73 | current-version: 65535.100.4 | |
| 113 | 74 | parent-umbrella: |
| 114 | 75 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 115 | 76 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -189,13 +150,6 @@ exports: |
| 189 | 150 | --- !tapi-tbd |
| 190 | 151 | tbd-version: 4 |
| 191 | 152 | targets: [ x86_64-macos, arm64-macos, arm64e-macos ] |
| 192 | uuids: | |
| 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 | |
| 199 | 153 | install-name: '/usr/lib/system/libcompiler_rt.dylib' |
| 200 | 154 | current-version: 103.1 |
| 201 | 155 | parent-umbrella: |
| ... | ... | @@ -424,19 +378,6 @@ exports: |
| 424 | 378 | tbd-version: 4 |
| 425 | 379 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 426 | 380 | arm64e-macos, arm64e-maccatalyst ] |
| 427 | uuids: | |
| 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 | |
| 440 | 381 | install-name: '/usr/lib/system/libcopyfile.dylib' |
| 441 | 382 | parent-umbrella: |
| 442 | 383 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -452,21 +393,8 @@ exports: |
| 452 | 393 | tbd-version: 4 |
| 453 | 394 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 454 | 395 | arm64e-macos, arm64e-maccatalyst ] |
| 455 | uuids: | |
| 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 | |
| 468 | 396 | install-name: '/usr/lib/system/libcorecrypto.dylib' |
| 469 | current-version: 1386.60.8 | |
| 397 | current-version: 1387.100.43 | |
| 470 | 398 | parent-umbrella: |
| 471 | 399 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 472 | 400 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -766,21 +694,8 @@ exports: |
| 766 | 694 | tbd-version: 4 |
| 767 | 695 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 768 | 696 | arm64e-macos, arm64e-maccatalyst ] |
| 769 | uuids: | |
| 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 | |
| 782 | 697 | install-name: '/usr/lib/system/libdispatch.dylib' |
| 783 | current-version: 1412 | |
| 698 | current-version: 1415.100.11 | |
| 784 | 699 | parent-umbrella: |
| 785 | 700 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 786 | 701 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -942,19 +857,6 @@ exports: |
| 942 | 857 | tbd-version: 4 |
| 943 | 858 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 944 | 859 | arm64e-macos, arm64e-maccatalyst ] |
| 945 | uuids: | |
| 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 | |
| 958 | 860 | install-name: '/usr/lib/system/libdyld.dylib' |
| 959 | 861 | parent-umbrella: |
| 960 | 862 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -1040,19 +942,6 @@ exports: |
| 1040 | 942 | tbd-version: 4 |
| 1041 | 943 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1042 | 944 | arm64e-macos, arm64e-maccatalyst ] |
| 1043 | uuids: | |
| 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 | |
| 1056 | 945 | install-name: '/usr/lib/system/libkeymgr.dylib' |
| 1057 | 946 | current-version: 31 |
| 1058 | 947 | parent-umbrella: |
| ... | ... | @@ -1070,21 +959,8 @@ exports: |
| 1070 | 959 | --- !tapi-tbd |
| 1071 | 960 | tbd-version: 4 |
| 1072 | 961 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64e-macos ] |
| 1073 | uuids: | |
| 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 | |
| 1086 | 962 | install-name: '/usr/lib/system/libmacho.dylib' |
| 1087 | current-version: 1001.2 | |
| 963 | current-version: 1005 | |
| 1088 | 964 | parent-umbrella: |
| 1089 | 965 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64e-macos ] |
| 1090 | 966 | umbrella: System |
| ... | ... | @@ -1130,21 +1006,8 @@ exports: |
| 1130 | 1006 | tbd-version: 4 |
| 1131 | 1007 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1132 | 1008 | arm64e-macos, arm64e-maccatalyst ] |
| 1133 | uuids: | |
| 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 | |
| 1146 | 1009 | install-name: '/usr/lib/system/libquarantine.dylib' |
| 1147 | current-version: 146.60.2 | |
| 1010 | current-version: 147.100.8 | |
| 1148 | 1011 | parent-umbrella: |
| 1149 | 1012 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1150 | 1013 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -1188,21 +1051,8 @@ exports: |
| 1188 | 1051 | tbd-version: 4 |
| 1189 | 1052 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1190 | 1053 | arm64e-macos, arm64e-maccatalyst ] |
| 1191 | uuids: | |
| 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 | |
| 1204 | 1054 | install-name: '/usr/lib/system/libremovefile.dylib' |
| 1205 | current-version: 63 | |
| 1055 | current-version: 68 | |
| 1206 | 1056 | parent-umbrella: |
| 1207 | 1057 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1208 | 1058 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -1219,19 +1069,6 @@ exports: |
| 1219 | 1069 | tbd-version: 4 |
| 1220 | 1070 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1221 | 1071 | arm64e-macos, arm64e-maccatalyst ] |
| 1222 | uuids: | |
| 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 | |
| 1235 | 1072 | install-name: '/usr/lib/system/libsystem_asl.dylib' |
| 1236 | 1073 | current-version: 395 |
| 1237 | 1074 | parent-umbrella: |
| ... | ... | @@ -1313,21 +1150,8 @@ exports: |
| 1313 | 1150 | tbd-version: 4 |
| 1314 | 1151 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1315 | 1152 | arm64e-macos, arm64e-maccatalyst ] |
| 1316 | uuids: | |
| 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 | |
| 1329 | 1153 | install-name: '/usr/lib/system/libsystem_blocks.dylib' |
| 1330 | current-version: 84 | |
| 1154 | current-version: 87 | |
| 1331 | 1155 | parent-umbrella: |
| 1332 | 1156 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1333 | 1157 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -1345,38 +1169,25 @@ exports: |
| 1345 | 1169 | tbd-version: 4 |
| 1346 | 1170 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1347 | 1171 | arm64e-macos, arm64e-maccatalyst ] |
| 1348 | uuids: | |
| 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 | |
| 1361 | 1172 | install-name: '/usr/lib/system/libsystem_c.dylib' |
| 1362 | current-version: 1534.40.2 | |
| 1173 | current-version: 1534.100.14 | |
| 1363 | 1174 | parent-umbrella: |
| 1364 | 1175 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1365 | 1176 | arm64e-macos, arm64e-maccatalyst ] |
| 1366 | 1177 | umbrella: System |
| 1367 | 1178 | exports: |
| 1368 | 1179 | - targets: [ x86_64-macos, x86_64-maccatalyst ] |
| 1369 | symbols: [ '___opendir2$INODE64', ___strtopx, '__readdir_unlocked$INODE64', | |
| 1370 | '__seekdir$INODE64', '_alphasort$INODE64', '_daemon$1050', | |
| 1371 | '_fdopendir$INODE64', _fstatx64_np, '_fstatx_np$INODE64', | |
| 1372 | '_fts_children$INODE64', '_fts_close$INODE64', '_fts_open$INODE64', | |
| 1373 | '_fts_open_b$INODE64', '_fts_read$INODE64', '_fts_set$INODE64', | |
| 1374 | '_ftw$INODE64', '_getmntinfo$INODE64', _getmntinfo64, '_getmntinfo_r_np$INODE64', | |
| 1375 | '_glob$INODE64', '_glob_b$INODE64', _lstatx64_np, '_lstatx_np$INODE64', | |
| 1376 | '_nftw$INODE64', '_opendir$INODE64', '_readdir$INODE64', '_readdir_r$INODE64', | |
| 1180 | symbols: [ '___opendir2$INODE64', '__readdir_unlocked$INODE64', '__seekdir$INODE64', | |
| 1181 | '_alphasort$INODE64', '_daemon$1050', '_fdopendir$INODE64', | |
| 1182 | _fstatx64_np, '_fstatx_np$INODE64', '_fts_children$INODE64', | |
| 1183 | '_fts_close$INODE64', '_fts_open$INODE64', '_fts_open_b$INODE64', | |
| 1184 | '_fts_read$INODE64', '_fts_set$INODE64', '_ftw$INODE64', '_getmntinfo$INODE64', | |
| 1185 | _getmntinfo64, '_getmntinfo_r_np$INODE64', '_glob$INODE64', | |
| 1186 | '_glob_b$INODE64', _lstatx64_np, '_lstatx_np$INODE64', '_nftw$INODE64', | |
| 1187 | '_opendir$INODE64', '_readdir$INODE64', '_readdir_r$INODE64', | |
| 1377 | 1188 | '_rewinddir$INODE64', '_scandir$INODE64', '_scandir_b$INODE64', |
| 1378 | '_seekdir$INODE64', _statx64_np, '_statx_np$INODE64', '_telldir$INODE64', | |
| 1379 | mcount ] | |
| 1189 | '_seekdir$INODE64', _statx64_np, '_statx_np$INODE64', _strtoencf80_l, | |
| 1190 | '_telldir$INODE64', mcount ] | |
| 1380 | 1191 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1381 | 1192 | arm64e-macos, arm64e-maccatalyst ] |
| 1382 | 1193 | symbols: [ '$ld$weak$os10.11$_basename_r', '$ld$weak$os10.11$_clock_getres', |
| ... | ... | @@ -1387,26 +1198,24 @@ exports: |
| 1387 | 1198 | __CurrentRuneLocale, __DefaultRuneLocale, __Exit, __NSGetArgc, |
| 1388 | 1199 | __NSGetArgv, __NSGetEnviron, __NSGetMachExecuteHeader, __NSGetProgname, |
| 1389 | 1200 | __PathLocale, __Read_RuneMagi, ___Balloc_D2A, ___Bfree_D2A, |
| 1390 | ___ULtod_D2A, ____mb_cur_max, ____mb_cur_max_l, ____runetype, | |
| 1391 | ____runetype_l, ____tolower, ____tolower_l, ____toupper, ____toupper_l, | |
| 1392 | ___add_ovflpage, ___addel, ___any_on_D2A, ___assert_rtn, ___b2d_D2A, | |
| 1393 | ___big_delete, ___big_insert, ___big_keydata, ___big_return, | |
| 1394 | ___big_split, ___bigtens_D2A, ___bt_close, ___bt_cmp, ___bt_defcmp, | |
| 1395 | ___bt_defpfx, ___bt_delete, ___bt_dleaf, ___bt_fd, ___bt_free, | |
| 1396 | ___bt_get, ___bt_new, ___bt_open, ___bt_pgin, ___bt_pgout, | |
| 1397 | ___bt_put, ___bt_ret, ___bt_search, ___bt_seq, ___bt_setcur, | |
| 1398 | ___bt_split, ___bt_sync, ___buf_free, ___call_hash, ___cleanup, | |
| 1399 | ___cmp_D2A, ___collate_equiv_match, ___collate_load_error, | |
| 1400 | ___collate_lookup, ___collate_lookup_l, ___copybits_D2A, ___cxa_atexit, | |
| 1401 | ___cxa_finalize, ___cxa_finalize_ranges, ___cxa_thread_atexit, | |
| 1402 | ___d2b_D2A, ___dbpanic, ___decrement_D2A, ___default_hash, | |
| 1403 | ___default_utx, ___delpair, ___diff_D2A, ___dtoa, ___expand_table, | |
| 1404 | ___fflush, ___fgetwc, ___find_bigpair, ___find_last_page, | |
| 1405 | ___fix_locale_grouping_str, ___fread, ___free_ovflpage, ___freedtoa, | |
| 1406 | ___gdtoa, ___gdtoa_locks, ___get_buf, ___get_page, ___gethex_D2A, | |
| 1407 | ___getonlyClocaleconv, ___hash_open, ___hdtoa, ___hexdig_D2A, | |
| 1408 | ___hexdig_init_D2A, ___hexnan_D2A, ___hi0bits_D2A, ___hldtoa, | |
| 1409 | ___i2b_D2A, ___ibitmap, ___increment_D2A, ___isctype, ___istype, | |
| 1201 | ____mb_cur_max, ____mb_cur_max_l, ____runetype, ____runetype_l, | |
| 1202 | ____tolower, ____tolower_l, ____toupper, ____toupper_l, ___add_ovflpage, | |
| 1203 | ___addel, ___any_on_D2A, ___assert_rtn, ___b2d_D2A, ___big_delete, | |
| 1204 | ___big_insert, ___big_keydata, ___big_return, ___big_split, | |
| 1205 | ___bigtens_D2A, ___bt_close, ___bt_cmp, ___bt_defcmp, ___bt_defpfx, | |
| 1206 | ___bt_delete, ___bt_dleaf, ___bt_fd, ___bt_free, ___bt_get, | |
| 1207 | ___bt_new, ___bt_open, ___bt_pgin, ___bt_pgout, ___bt_put, | |
| 1208 | ___bt_ret, ___bt_search, ___bt_seq, ___bt_setcur, ___bt_split, | |
| 1209 | ___bt_sync, ___buf_free, ___call_hash, ___cleanup, ___cmp_D2A, | |
| 1210 | ___collate_equiv_match, ___collate_load_error, ___collate_lookup, | |
| 1211 | ___collate_lookup_l, ___copybits_D2A, ___cxa_atexit, ___cxa_finalize, | |
| 1212 | ___cxa_finalize_ranges, ___cxa_thread_atexit, ___d2b_D2A, | |
| 1213 | ___dbpanic, ___default_hash, ___default_utx, ___delpair, ___diff_D2A, | |
| 1214 | ___dtoa, ___expand_table, ___fflush, ___fgetwc, ___find_bigpair, | |
| 1215 | ___find_last_page, ___fix_locale_grouping_str, ___fread, ___free_ovflpage, | |
| 1216 | ___freedtoa, ___gdtoa, ___gdtoa_locks, ___get_buf, ___get_page, | |
| 1217 | ___getonlyClocaleconv, ___hash_open, ___hdtoa, ___hi0bits_D2A, | |
| 1218 | ___hldtoa, ___i2b_D2A, ___ibitmap, ___isctype, ___istype, | |
| 1410 | 1219 | ___istype_l, ___ldtoa, ___libc_init, ___lo0bits_D2A, ___log2, |
| 1411 | 1220 | ___lshift_D2A, ___maskrune, ___maskrune_l, ___match_D2A, ___mb_cur_max, |
| 1412 | 1221 | ___mb_sb_limit, ___memccpy_chk, ___memcpy_chk, ___memmove_chk, |
| ... | ... | @@ -1417,53 +1226,54 @@ exports: |
| 1417 | 1226 | ___rec_iput, ___rec_open, ___rec_put, ___rec_ret, ___rec_search, |
| 1418 | 1227 | ___rec_seq, ___rec_sync, ___rec_vmap, ___rec_vpipe, ___reclaim_buf, |
| 1419 | 1228 | ___rshift_D2A, ___rv_alloc_D2A, ___s2b_D2A, ___sF, ___sclose, |
| 1420 | ___sdidinit, ___set_ones_D2A, ___setonlyClocaleconv, ___sflags, | |
| 1421 | ___sflush, ___sfp, ___sfvwrite, ___sglue, ___sinit, ___slbexpand, | |
| 1422 | ___smakebuf, ___snprintf_chk, ___snprintf_object_size_chk, | |
| 1423 | ___split_page, ___sprintf_chk, ___sprintf_object_size_chk, | |
| 1424 | ___sread, ___srefill, ___srget, ___sseek, ___stack_chk_fail, | |
| 1425 | ___stack_chk_guard, ___stderrp, ___stdinp, ___stdoutp, ___stpcpy_chk, | |
| 1426 | ___stpncpy_chk, ___strcat_chk, ___strcp_D2A, ___strcpy_chk, | |
| 1427 | ___strlcat_chk, ___strlcpy_chk, ___strncat_chk, ___strncpy_chk, | |
| 1428 | ___strtodg, ___strtopdd, ___sum_D2A, ___svfscanf, ___swbuf, | |
| 1429 | ___swhatbuf, ___swrite, ___swsetup, ___tens_D2A, ___tinytens_D2A, | |
| 1430 | ___tolower, ___tolower_l, ___toupper, ___toupper_l, ___trailz_D2A, | |
| 1431 | ___ulp_D2A, ___ungetc, ___ungetwc, ___vsnprintf_chk, ___vsprintf_chk, | |
| 1432 | ___wcwidth, ___wcwidth_l, __allocenvstate, __atexit_receipt, | |
| 1433 | __c_locale, __cleanup, __closeutx, __copyenv, __cthread_init_routine, | |
| 1434 | __deallocenvstate, __endutxent, __flockfile_debug_stub, __fseeko, | |
| 1435 | __ftello, __fwalk, __getenvp, __getutxent, __getutxid, __getutxline, | |
| 1436 | __inet_aton_check, __init_clock_port, __int_to_time, __libc_fork_child, | |
| 1437 | __libc_initializer, __long_to_time, __mkpath_np, __mktemp, | |
| 1438 | __openutx, __os_assert_log, __os_assert_log_ctx, __os_assumes_log, | |
| 1439 | __os_assumes_log_ctx, __os_avoid_tail_call, __os_crash, __os_crash_callback, | |
| 1440 | __os_crash_fmt, __os_crash_msg, __os_debug_log, __os_debug_log_error_offset, | |
| 1441 | __os_debug_log_error_str, __putenvp, __pututxline, __rand48_add, | |
| 1442 | __rand48_mult, __rand48_seed, __readdir_unlocked, __reclaim_telldir, | |
| 1443 | __seekdir, __setenvp, __setutxent, __sigaction_nobind, __sigintr, | |
| 1444 | __signal_nobind, __sigvec_nobind, __sread, __sseek, __subsystem_init, | |
| 1445 | __swrite, __time32_to_time, __time64_to_time, __time_to_int, | |
| 1446 | __time_to_long, __time_to_time32, __time_to_time64, __unsetenvp, | |
| 1447 | __utmpxname, _a64l, _abort, _abort_report_np, _abs, _acl_add_flag_np, | |
| 1448 | _acl_add_perm, _acl_calc_mask, _acl_clear_flags_np, _acl_clear_perms, | |
| 1449 | _acl_copy_entry, _acl_copy_ext, _acl_copy_ext_native, _acl_copy_int, | |
| 1450 | _acl_copy_int_native, _acl_create_entry, _acl_create_entry_np, | |
| 1451 | _acl_delete_def_file, _acl_delete_entry, _acl_delete_fd_np, | |
| 1452 | _acl_delete_file_np, _acl_delete_flag_np, _acl_delete_link_np, | |
| 1453 | _acl_delete_perm, _acl_dup, _acl_free, _acl_from_text, _acl_get_entry, | |
| 1454 | _acl_get_fd, _acl_get_fd_np, _acl_get_file, _acl_get_flag_np, | |
| 1455 | _acl_get_flagset_np, _acl_get_link_np, _acl_get_perm_np, _acl_get_permset, | |
| 1456 | _acl_get_permset_mask_np, _acl_get_qualifier, _acl_get_tag_type, | |
| 1457 | _acl_init, _acl_maximal_permset_mask_np, _acl_set_fd, _acl_set_fd_np, | |
| 1458 | _acl_set_file, _acl_set_flagset_np, _acl_set_link_np, _acl_set_permset, | |
| 1459 | _acl_set_permset_mask_np, _acl_set_qualifier, _acl_set_tag_type, | |
| 1460 | _acl_size, _acl_to_text, _acl_valid, _acl_valid_fd_np, _acl_valid_file_np, | |
| 1461 | _acl_valid_link, _addr2ascii, _alarm, _alphasort, _arc4random, | |
| 1462 | _arc4random_addrandom, _arc4random_buf, _arc4random_stir, | |
| 1463 | _arc4random_uniform, _ascii2addr, _asctime, _asctime_r, _asprintf, | |
| 1464 | _asprintf_l, _asxprintf, _asxprintf_exec, _atexit, _atexit_b, | |
| 1465 | _atof, _atof_l, _atoi, _atoi_l, _atol, _atol_l, _atoll, _atoll_l, | |
| 1466 | _backtrace, _backtrace_async, _backtrace_from_fp, _backtrace_image_offsets, | |
| 1229 | ___sdidinit, ___setonlyClocaleconv, ___sflags, ___sflush, | |
| 1230 | ___sfp, ___sfvwrite, ___sglue, ___sinit, ___slbexpand, ___smakebuf, | |
| 1231 | ___snprintf_chk, ___snprintf_object_size_chk, ___split_page, | |
| 1232 | ___sprintf_chk, ___sprintf_object_size_chk, ___sread, ___srefill, | |
| 1233 | ___srget, ___sseek, ___stack_chk_fail, ___stack_chk_guard, | |
| 1234 | ___stderrp, ___stdinp, ___stdoutp, ___stpcpy_chk, ___stpncpy_chk, | |
| 1235 | ___strcat_chk, ___strcp_D2A, ___strcpy_chk, ___strlcat_chk, | |
| 1236 | ___strlcpy_chk, ___strncat_chk, ___strncpy_chk, ___sum_D2A, | |
| 1237 | ___svfscanf, ___swbuf, ___swhatbuf, ___swrite, ___swsetup, | |
| 1238 | ___tens_D2A, ___tinytens_D2A, ___tolower, ___tolower_l, ___toupper, | |
| 1239 | ___toupper_l, ___trailz_D2A, ___ulp_D2A, ___ungetc, ___ungetwc, | |
| 1240 | ___vsnprintf_chk, ___vsprintf_chk, ___wcwidth, ___wcwidth_l, | |
| 1241 | __allocenvstate, __atexit_receipt, __c_locale, __cleanup, | |
| 1242 | __closeutx, __copyenv, __cthread_init_routine, __deallocenvstate, | |
| 1243 | __endutxent, __flockfile_debug_stub, __fseeko, __ftello, __fwalk, | |
| 1244 | __getenvp, __getutxent, __getutxid, __getutxline, __inet_aton_check, | |
| 1245 | __init_clock_port, __int_to_time, __libc_fork_child, __libc_fork_parent, | |
| 1246 | __libc_fork_prepare, __libc_initializer, __long_to_time, __mkpath_np, | |
| 1247 | __mktemp, __openutx, __os_assert_log, __os_assert_log_ctx, | |
| 1248 | __os_assumes_log, __os_assumes_log_ctx, __os_avoid_tail_call, | |
| 1249 | __os_crash, __os_crash_callback, __os_crash_fmt, __os_crash_msg, | |
| 1250 | __os_debug_log, __os_debug_log_error_offset, __os_debug_log_error_str, | |
| 1251 | __putenvp, __pututxline, __rand48_add, __rand48_mult, __rand48_seed, | |
| 1252 | __readdir_unlocked, __reclaim_telldir, __seekdir, __setenvp, | |
| 1253 | __setutxent, __sigaction_nobind, __sigintr, __signal_nobind, | |
| 1254 | __sigvec_nobind, __sread, __sseek, __subsystem_init, __swrite, | |
| 1255 | __time32_to_time, __time64_to_time, __time_to_int, __time_to_long, | |
| 1256 | __time_to_time32, __time_to_time64, __unsetenvp, __utmpxname, | |
| 1257 | _a64l, _abort, _abort_report_np, _abs, _acl_add_flag_np, _acl_add_perm, | |
| 1258 | _acl_calc_mask, _acl_clear_flags_np, _acl_clear_perms, _acl_copy_entry, | |
| 1259 | _acl_copy_ext, _acl_copy_ext_native, _acl_copy_int, _acl_copy_int_native, | |
| 1260 | _acl_create_entry, _acl_create_entry_np, _acl_delete_def_file, | |
| 1261 | _acl_delete_entry, _acl_delete_fd_np, _acl_delete_file_np, | |
| 1262 | _acl_delete_flag_np, _acl_delete_link_np, _acl_delete_perm, | |
| 1263 | _acl_dup, _acl_free, _acl_from_text, _acl_get_entry, _acl_get_fd, | |
| 1264 | _acl_get_fd_np, _acl_get_file, _acl_get_flag_np, _acl_get_flagset_np, | |
| 1265 | _acl_get_link_np, _acl_get_perm_np, _acl_get_permset, _acl_get_permset_mask_np, | |
| 1266 | _acl_get_qualifier, _acl_get_tag_type, _acl_init, _acl_maximal_permset_mask_np, | |
| 1267 | _acl_set_fd, _acl_set_fd_np, _acl_set_file, _acl_set_flagset_np, | |
| 1268 | _acl_set_link_np, _acl_set_permset, _acl_set_permset_mask_np, | |
| 1269 | _acl_set_qualifier, _acl_set_tag_type, _acl_size, _acl_to_text, | |
| 1270 | _acl_valid, _acl_valid_fd_np, _acl_valid_file_np, _acl_valid_link, | |
| 1271 | _addr2ascii, _alarm, _alphasort, _arc4random, _arc4random_addrandom, | |
| 1272 | _arc4random_buf, _arc4random_stir, _arc4random_uniform, _ascii2addr, | |
| 1273 | _asctime, _asctime_r, _asprintf, _asprintf_l, _asxprintf, | |
| 1274 | _asxprintf_exec, _atexit, _atexit_b, _atof, _atof_l, _atoi, | |
| 1275 | _atoi_l, _atol, _atol_l, _atoll, _atoll_l, _backtrace, _backtrace_async, | |
| 1276 | _backtrace_from_fp, _backtrace_image_offsets, _backtrace_set_pcs_func, | |
| 1467 | 1277 | _backtrace_symbols, _backtrace_symbols_fd, _basename, _basename_r, |
| 1468 | 1278 | _bcopy, _brk, _bsd_signal, _bsearch, _bsearch_b, _btowc, _btowc_l, |
| 1469 | 1279 | _catclose, _catgets, _catopen, _cfgetispeed, _cfgetospeed, |
| ... | ... | @@ -1587,16 +1397,17 @@ exports: |
| 1587 | 1397 | _strncat, _strndup, _strnstr, _strnunvis, _strnunvisx, _strnvis, |
| 1588 | 1398 | _strnvisx, _strpbrk, _strptime, _strptime_l, _strrchr, _strsenvisx, |
| 1589 | 1399 | _strsep, _strsignal, _strsignal_r, _strsnvis, _strsnvisx, |
| 1590 | _strspn, _strsvis, _strsvisx, _strtod, _strtod_l, _strtof, | |
| 1591 | _strtof_l, _strtofflags, _strtoimax, _strtoimax_l, _strtok, | |
| 1592 | _strtok_r, _strtol, _strtol_l, _strtold, _strtold_l, _strtoll, | |
| 1593 | _strtoll_l, _strtonum, _strtoq, _strtoq_l, _strtoul, _strtoul_l, | |
| 1594 | _strtoull, _strtoull_l, _strtoumax, _strtoumax_l, _strtouq, | |
| 1595 | _strtouq_l, _strunvis, _strunvisx, _strvis, _strvisx, _strxfrm, | |
| 1596 | _strxfrm_l, _suboptarg, _svis, _swab, _swprintf, _swprintf_l, | |
| 1597 | _swscanf, _swscanf_l, _sxprintf, _sxprintf_exec, _sync_volume_np, | |
| 1598 | _sys_errlist, _sys_nerr, _sys_siglist, _sys_signame, _sysconf, | |
| 1599 | _sysctl, _sysctlbyname, _sysctlnametomib, _system, '_system$NOCANCEL', | |
| 1400 | _strspn, _strsvis, _strsvisx, _strtod, _strtod_l, _strtoencf16, | |
| 1401 | _strtoencf32, _strtoencf64, _strtoencf64x, _strtof, _strtof_l, | |
| 1402 | _strtofflags, _strtoimax, _strtoimax_l, _strtok, _strtok_r, | |
| 1403 | _strtol, _strtol_l, _strtold, _strtold_l, _strtoll, _strtoll_l, | |
| 1404 | _strtonum, _strtoq, _strtoq_l, _strtoul, _strtoul_l, _strtoull, | |
| 1405 | _strtoull_l, _strtoumax, _strtoumax_l, _strtouq, _strtouq_l, | |
| 1406 | _strunvis, _strunvisx, _strvis, _strvisx, _strxfrm, _strxfrm_l, | |
| 1407 | _suboptarg, _svis, _swab, _swprintf, _swprintf_l, _swscanf, | |
| 1408 | _swscanf_l, _sxprintf, _sxprintf_exec, _sync_volume_np, _sys_errlist, | |
| 1409 | _sys_nerr, _sys_siglist, _sys_signame, _sysconf, _sysctl, | |
| 1410 | _sysctlbyname, _sysctlnametomib, _system, '_system$NOCANCEL', | |
| 1600 | 1411 | _tcdrain, '_tcdrain$NOCANCEL', _tcflow, _tcflush, _tcgetattr, |
| 1601 | 1412 | _tcgetpgrp, _tcgetsid, _tcsendbreak, _tcsetattr, _tcsetpgrp, |
| 1602 | 1413 | _tdelete, _telldir, _tempnam, _tfind, _thread_stack_async_pcs, |
| ... | ... | @@ -1652,21 +1463,8 @@ reexports: |
| 1652 | 1463 | tbd-version: 4 |
| 1653 | 1464 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1654 | 1465 | arm64e-macos, arm64e-maccatalyst ] |
| 1655 | uuids: | |
| 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 | |
| 1668 | 1466 | install-name: '/usr/lib/system/libsystem_collections.dylib' |
| 1669 | current-version: 1534.40.2 | |
| 1467 | current-version: 1534.100.14 | |
| 1670 | 1468 | parent-umbrella: |
| 1671 | 1469 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1672 | 1470 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -1695,21 +1493,8 @@ exports: |
| 1695 | 1493 | tbd-version: 4 |
| 1696 | 1494 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1697 | 1495 | arm64e-macos, arm64e-maccatalyst ] |
| 1698 | uuids: | |
| 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 | |
| 1711 | 1496 | install-name: '/usr/lib/system/libsystem_configuration.dylib' |
| 1712 | current-version: 1241.60.3 | |
| 1497 | current-version: 1241.100.11 | |
| 1713 | 1498 | parent-umbrella: |
| 1714 | 1499 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1715 | 1500 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -1735,19 +1520,6 @@ exports: |
| 1735 | 1520 | tbd-version: 4 |
| 1736 | 1521 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1737 | 1522 | arm64e-macos, arm64e-maccatalyst ] |
| 1738 | uuids: | |
| 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 | |
| 1751 | 1523 | install-name: '/usr/lib/system/libsystem_containermanager.dylib' |
| 1752 | 1524 | parent-umbrella: |
| 1753 | 1525 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -1792,6 +1564,7 @@ exports: |
| 1792 | 1564 | _container_create_or_lookup_app_group_paths, _container_create_or_lookup_app_group_paths_for_current_user, |
| 1793 | 1565 | _container_create_or_lookup_app_group_paths_for_platform, |
| 1794 | 1566 | _container_create_or_lookup_app_group_paths_from_entitlements, |
| 1567 | _container_create_or_lookup_app_group_paths_from_entitlements_4ls, | |
| 1795 | 1568 | _container_create_or_lookup_for_current_user, _container_create_or_lookup_for_platform, |
| 1796 | 1569 | _container_create_or_lookup_group_container_paths_for_current_user, |
| 1797 | 1570 | _container_create_or_lookup_path, _container_create_or_lookup_path_for_current_user, |
| ... | ... | @@ -1910,19 +1683,6 @@ exports: |
| 1910 | 1683 | tbd-version: 4 |
| 1911 | 1684 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1912 | 1685 | arm64e-macos, arm64e-maccatalyst ] |
| 1913 | uuids: | |
| 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 | |
| 1926 | 1686 | install-name: '/usr/lib/system/libsystem_coreservices.dylib' |
| 1927 | 1687 | current-version: 129 |
| 1928 | 1688 | parent-umbrella: |
| ... | ... | @@ -1944,19 +1704,6 @@ exports: |
| 1944 | 1704 | tbd-version: 4 |
| 1945 | 1705 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1946 | 1706 | arm64e-macos, arm64e-maccatalyst ] |
| 1947 | uuids: | |
| 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 | |
| 1960 | 1707 | install-name: '/usr/lib/system/libsystem_darwin.dylib' |
| 1961 | 1708 | parent-umbrella: |
| 1962 | 1709 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -1995,21 +1742,8 @@ exports: |
| 1995 | 1742 | tbd-version: 4 |
| 1996 | 1743 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 1997 | 1744 | arm64e-macos, arm64e-maccatalyst ] |
| 1998 | uuids: | |
| 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 | |
| 2011 | 1745 | install-name: '/usr/lib/system/libsystem_dnssd.dylib' |
| 2012 | current-version: 1790.60.25 | |
| 1746 | current-version: 1807.101.2 | |
| 2013 | 1747 | parent-umbrella: |
| 2014 | 1748 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2015 | 1749 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -2045,21 +1779,8 @@ exports: |
| 2045 | 1779 | tbd-version: 4 |
| 2046 | 1780 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2047 | 1781 | arm64e-macos, arm64e-maccatalyst ] |
| 2048 | uuids: | |
| 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 | |
| 2061 | 1782 | install-name: '/usr/lib/system/libsystem_featureflags.dylib' |
| 2062 | current-version: 71 | |
| 1783 | current-version: 74 | |
| 2063 | 1784 | parent-umbrella: |
| 2064 | 1785 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2065 | 1786 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -2072,19 +1793,6 @@ exports: |
| 2072 | 1793 | tbd-version: 4 |
| 2073 | 1794 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2074 | 1795 | arm64e-macos, arm64e-maccatalyst ] |
| 2075 | uuids: | |
| 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 | |
| 2088 | 1796 | install-name: '/usr/lib/system/libsystem_info.dylib' |
| 2089 | 1797 | parent-umbrella: |
| 2090 | 1798 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -2209,21 +1917,8 @@ exports: |
| 2209 | 1917 | tbd-version: 4 |
| 2210 | 1918 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2211 | 1919 | arm64e-macos, arm64e-maccatalyst ] |
| 2212 | uuids: | |
| 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 | |
| 2225 | 1920 | install-name: '/usr/lib/system/libsystem_kernel.dylib' |
| 2226 | current-version: 8792.61.2 | |
| 1921 | current-version: 8796.101.5 | |
| 2227 | 1922 | parent-umbrella: |
| 2228 | 1923 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2229 | 1924 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -2243,19 +1938,20 @@ exports: |
| 2243 | 1938 | ___channel_get_opt, ___channel_open, ___channel_set_opt, ___channel_sync, |
| 2244 | 1939 | ___chmod, ___chmod_extended, ___close_nocancel, ___coalition, |
| 2245 | 1940 | ___coalition_info, ___coalition_ledger, ___commpage_gettimeofday, |
| 2246 | ___connect, ___connect_nocancel, ___copyfile, ___csrctl, ___darwin_check_fd_set_overflow, | |
| 2247 | ___debug_syscall_reject, ___debug_syscall_reject_config, ___delete, | |
| 2248 | ___disable_threadsignal, ___error, ___execve, ___exit, ___fchmod, | |
| 2249 | ___fchmod_extended, ___fcntl, ___fcntl_nocancel, ___fork, | |
| 2250 | ___fs_snapshot, ___fstat64_extended, ___fstat_extended, ___fsync_nocancel, | |
| 2251 | ___get_remove_counter, ___getattrlist, ___getdirentries64, | |
| 2252 | ___gethostuuid, ___getlogin, ___getpeername, ___getpid, ___getrlimit, | |
| 2253 | ___getsgroups, ___getsockname, ___gettid, ___gettimeofday, | |
| 2254 | ___getwgroups, ___guarded_open_dprotected_np, ___guarded_open_np, | |
| 2255 | ___identitysvc, ___inc_remove_counter, ___initgroups, ___ioctl, | |
| 2256 | ___iopolicysys, ___kdebug_trace, ___kdebug_trace64, ___kdebug_trace_string, | |
| 2257 | ___kdebug_typefilter, ___kill, ___kqueue_workloop_ctl, ___lchown, | |
| 2258 | ___libkernel_init, ___libkernel_init_after_boot_tasks, ___libkernel_init_late, | |
| 1941 | ___connect, ___connect_nocancel, ___copyfile, ___crossarch_trap, | |
| 1942 | ___csrctl, ___darwin_check_fd_set_overflow, ___debug_syscall_reject, | |
| 1943 | ___debug_syscall_reject_config, ___delete, ___disable_threadsignal, | |
| 1944 | ___error, ___execve, ___exit, ___fchmod, ___fchmod_extended, | |
| 1945 | ___fcntl, ___fcntl_nocancel, ___fork, ___fs_snapshot, ___fstat64_extended, | |
| 1946 | ___fstat_extended, ___fsync_nocancel, ___get_remove_counter, | |
| 1947 | ___getattrlist, ___getdirentries64, ___gethostuuid, ___getlogin, | |
| 1948 | ___getpeername, ___getpid, ___getrlimit, ___getsgroups, ___getsockname, | |
| 1949 | ___gettid, ___gettimeofday, ___getwgroups, ___guarded_open_dprotected_np, | |
| 1950 | ___guarded_open_np, ___identitysvc, ___inc_remove_counter, | |
| 1951 | ___initgroups, ___ioctl, ___iopolicysys, ___kdebug_trace, | |
| 1952 | ___kdebug_trace64, ___kdebug_trace_string, ___kdebug_typefilter, | |
| 1953 | ___kill, ___kqueue_workloop_ctl, ___lchown, ___libkernel_init, | |
| 1954 | ___libkernel_init_after_boot_tasks, ___libkernel_init_late, | |
| 2259 | 1955 | ___libkernel_platform_init, ___libkernel_voucher_init, ___listen, |
| 2260 | 1956 | ___log_data, ___lseek, ___lstat64_extended, ___lstat_extended, |
| 2261 | 1957 | ___mac_execve, ___mac_get_fd, ___mac_get_file, ___mac_get_link, |
| ... | ... | @@ -2572,32 +2268,32 @@ exports: |
| 2572 | 2268 | _posix_spawnattr_set_uid_np, _posix_spawnattr_setarchpref_np, |
| 2573 | 2269 | _posix_spawnattr_setauditsessionport_np, _posix_spawnattr_setbinpref_np, |
| 2574 | 2270 | _posix_spawnattr_setcoalition_np, _posix_spawnattr_setcpumonitor, |
| 2575 | _posix_spawnattr_setcpumonitor_default, _posix_spawnattr_setexceptionports_np, | |
| 2576 | _posix_spawnattr_setflags, _posix_spawnattr_setjetsam_ext, | |
| 2577 | _posix_spawnattr_setmacpolicyinfo_np, _posix_spawnattr_setnosmt_np, | |
| 2578 | _posix_spawnattr_setpcontrol_np, _posix_spawnattr_setpgroup, | |
| 2579 | _posix_spawnattr_setprocesstype_np, _posix_spawnattr_setsigdefault, | |
| 2580 | _posix_spawnattr_setsigmask, _posix_spawnattr_setspecialport_np, | |
| 2581 | _pread, '_pread$NOCANCEL', _preadv, '_preadv$NOCANCEL', _proc_clear_cpulimits, | |
| 2582 | _proc_clear_delayidlesleep, _proc_clear_dirty, _proc_clear_vmpressure, | |
| 2583 | _proc_current_thread_schedinfo, _proc_denap_assertion_begin_with_msg, | |
| 2584 | _proc_denap_assertion_complete, _proc_disable_apptype, _proc_disable_cpumon, | |
| 2585 | _proc_disable_wakemon, _proc_donate_importance_boost, _proc_enable_apptype, | |
| 2586 | _proc_get_cpumon_params, _proc_get_dirty, _proc_get_wakemon_params, | |
| 2587 | _proc_importance_assertion_begin_with_msg, _proc_importance_assertion_complete, | |
| 2588 | _proc_kmsgbuf, _proc_libversion, _proc_list_dynkqueueids, | |
| 2589 | _proc_list_uptrs, _proc_listallpids, _proc_listchildpids, | |
| 2590 | _proc_listcoalitions, _proc_listpgrppids, _proc_listpids, | |
| 2591 | _proc_listpidspath, _proc_name, _proc_pid_rusage, _proc_piddynkqueueinfo, | |
| 2592 | _proc_pidfdinfo, _proc_pidfileportinfo, _proc_pidinfo, _proc_pidoriginatorinfo, | |
| 2593 | _proc_pidpath, _proc_pidpath_audittoken, _proc_regionfilename, | |
| 2594 | _proc_reset_footprint_interval, _proc_resume_cpumon, _proc_rlimit_control, | |
| 2595 | _proc_set_cpumon_defaults, _proc_set_cpumon_params, _proc_set_cpumon_params_fatal, | |
| 2596 | _proc_set_csm, _proc_set_delayidlesleep, _proc_set_dirty, | |
| 2597 | _proc_set_no_smt, _proc_set_owner_vmpressure, _proc_set_wakemon_defaults, | |
| 2598 | _proc_set_wakemon_params, _proc_setcpu_percentage, _proc_setpcontrol, | |
| 2599 | _proc_setthread_cpupercent, _proc_setthread_csm, _proc_setthread_no_smt, | |
| 2600 | _proc_suppress, _proc_terminate, _proc_terminate_all_rsr, | |
| 2271 | _posix_spawnattr_setcpumonitor_default, _posix_spawnattr_setdataless_iopolicy_np, | |
| 2272 | _posix_spawnattr_setexceptionports_np, _posix_spawnattr_setflags, | |
| 2273 | _posix_spawnattr_setjetsam_ext, _posix_spawnattr_setmacpolicyinfo_np, | |
| 2274 | _posix_spawnattr_setnosmt_np, _posix_spawnattr_setpcontrol_np, | |
| 2275 | _posix_spawnattr_setpgroup, _posix_spawnattr_setprocesstype_np, | |
| 2276 | _posix_spawnattr_setsigdefault, _posix_spawnattr_setsigmask, | |
| 2277 | _posix_spawnattr_setspecialport_np, _pread, '_pread$NOCANCEL', | |
| 2278 | _preadv, '_preadv$NOCANCEL', _proc_clear_cpulimits, _proc_clear_delayidlesleep, | |
| 2279 | _proc_clear_dirty, _proc_clear_vmpressure, _proc_current_thread_schedinfo, | |
| 2280 | _proc_denap_assertion_begin_with_msg, _proc_denap_assertion_complete, | |
| 2281 | _proc_disable_apptype, _proc_disable_cpumon, _proc_disable_wakemon, | |
| 2282 | _proc_donate_importance_boost, _proc_enable_apptype, _proc_get_cpumon_params, | |
| 2283 | _proc_get_dirty, _proc_get_wakemon_params, _proc_importance_assertion_begin_with_msg, | |
| 2284 | _proc_importance_assertion_complete, _proc_kmsgbuf, _proc_libversion, | |
| 2285 | _proc_list_dynkqueueids, _proc_list_uptrs, _proc_listallpids, | |
| 2286 | _proc_listchildpids, _proc_listcoalitions, _proc_listpgrppids, | |
| 2287 | _proc_listpids, _proc_listpidspath, _proc_name, _proc_pid_rusage, | |
| 2288 | _proc_piddynkqueueinfo, _proc_pidfdinfo, _proc_pidfileportinfo, | |
| 2289 | _proc_pidinfo, _proc_pidoriginatorinfo, _proc_pidpath, _proc_pidpath_audittoken, | |
| 2290 | _proc_regionfilename, _proc_reset_footprint_interval, _proc_resume_cpumon, | |
| 2291 | _proc_rlimit_control, _proc_set_cpumon_defaults, _proc_set_cpumon_params, | |
| 2292 | _proc_set_cpumon_params_fatal, _proc_set_csm, _proc_set_delayidlesleep, | |
| 2293 | _proc_set_dirty, _proc_set_no_smt, _proc_set_owner_vmpressure, | |
| 2294 | _proc_set_wakemon_defaults, _proc_set_wakemon_params, _proc_setcpu_percentage, | |
| 2295 | _proc_setpcontrol, _proc_setthread_cpupercent, _proc_setthread_csm, | |
| 2296 | _proc_setthread_no_smt, _proc_suppress, _proc_terminate, _proc_terminate_all_rsr, | |
| 2601 | 2297 | _proc_trace_log, _proc_track_dirty, _proc_udata_info, _proc_uuid_policy, |
| 2602 | 2298 | _processor_assign, _processor_control, _processor_exit, _processor_get_assignment, |
| 2603 | 2299 | _processor_info, _processor_set_create, _processor_set_default, |
| ... | ... | @@ -2707,25 +2403,8 @@ exports: |
| 2707 | 2403 | tbd-version: 4 |
| 2708 | 2404 | targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, |
| 2709 | 2405 | arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] |
| 2710 | uuids: | |
| 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 | |
| 2727 | 2406 | install-name: '/usr/lib/system/libsystem_m.dylib' |
| 2728 | current-version: 3226.0.1 | |
| 2407 | current-version: 3226.100.4 | |
| 2729 | 2408 | parent-umbrella: |
| 2730 | 2409 | - targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, |
| 2731 | 2410 | arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -2938,21 +2617,8 @@ exports: |
| 2938 | 2617 | tbd-version: 4 |
| 2939 | 2618 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2940 | 2619 | arm64e-macos, arm64e-maccatalyst ] |
| 2941 | uuids: | |
| 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 | |
| 2954 | 2620 | install-name: '/usr/lib/system/libsystem_malloc.dylib' |
| 2955 | current-version: 409.60.6 | |
| 2621 | current-version: 425.100.7 | |
| 2956 | 2622 | parent-umbrella: |
| 2957 | 2623 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 2958 | 2624 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -2992,7 +2658,7 @@ exports: |
| 2992 | 2658 | _malloc_zone_print, _malloc_zone_print_ptr_info, _malloc_zone_realloc, |
| 2993 | 2659 | _malloc_zone_register, _malloc_zone_statistics, _malloc_zone_unregister, |
| 2994 | 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 | 2662 | _realloc, '_reallocarray$DARWIN_EXTSN', '_reallocarrayf$DARWIN_EXTSN', |
| 2997 | 2663 | _scalable_zone_info, _scalable_zone_statistics, _set_malloc_singlethreaded, |
| 2998 | 2664 | _stack_logging_enable_logging, _szone_check_counter, _szone_check_modulo, |
| ... | ... | @@ -3002,19 +2668,6 @@ exports: |
| 3002 | 2668 | tbd-version: 4 |
| 3003 | 2669 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3004 | 2670 | arm64e-macos, arm64e-maccatalyst ] |
| 3005 | uuids: | |
| 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 | |
| 3018 | 2671 | install-name: '/usr/lib/system/libsystem_networkextension.dylib' |
| 3019 | 2672 | parent-umbrella: |
| 3020 | 2673 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -3039,9 +2692,9 @@ exports: |
| 3039 | 2692 | _NEHelperSettingsSetArray, _NEHelperSettingsSetBool, _NEHelperSettingsSetNumber, |
| 3040 | 2693 | _NEHelperVPNConfigurationExists, _NEHelperVPNSetEnabled, _g_ne_read_uuid_cache, |
| 3041 | 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, | |
| 3043 | _ne_copy_signature_info_for_pid, _ne_copy_signing_identifier_for_pid, | |
| 3044 | _ne_copy_uuid_cache, _ne_force_reset_uuid_cache, _ne_get_configuration_generation, | |
| 2695 | _ne_copy_cached_uuids_for_bundle_identifier, _ne_copy_signature_info_for_pid, | |
| 2696 | _ne_copy_signing_identifier_for_pid, _ne_copy_uuid_cache, | |
| 2697 | _ne_force_reset_uuid_cache, _ne_get_configuration_generation, | |
| 3045 | 2698 | _ne_is_sockaddr_valid, _ne_log_large_obj, _ne_log_obj, _ne_print_backtrace, |
| 3046 | 2699 | _ne_privacy_dns_netagent_id, _ne_privacy_proxy_netagent_id, |
| 3047 | 2700 | _ne_session_add_necp_drop_dest_from_dest_list, _ne_session_add_necp_drop_dest_from_path, |
| ... | ... | @@ -3069,20 +2722,20 @@ exports: |
| 3069 | 2722 | _ne_session_policy_match_get_service, _ne_session_policy_match_get_service_action, |
| 3070 | 2723 | _ne_session_policy_match_get_service_type, _ne_session_policy_match_is_drop, |
| 3071 | 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, | |
| 3073 | _ne_session_service_get_dns_service_id, _ne_session_service_get_dns_service_id_for_interface, | |
| 3074 | _ne_session_service_matches_address, _ne_session_service_matches_address_for_interface, | |
| 3075 | _ne_session_set_event_handler, _ne_session_set_socket_attributes, | |
| 3076 | _ne_session_set_socket_context_attribute, _ne_session_set_socket_tracker_attributes, | |
| 3077 | _ne_session_should_disable_nexus, _ne_session_start, _ne_session_start_on_behalf_of, | |
| 3078 | _ne_session_start_with_options, _ne_session_status_to_string, | |
| 3079 | _ne_session_stop, _ne_session_stop_all_with_plugin_type, _ne_session_stop_reason_to_string, | |
| 3080 | _ne_session_type_to_string, _ne_session_use_as_system_vpn, | |
| 3081 | _ne_session_vod_evaluate_connection_present, _ne_session_vpn_include_all_networks_configs_present, | |
| 3082 | _ne_socket_set_attribution, _ne_socket_set_domains, _ne_socket_set_is_app_initiated, | |
| 3083 | _ne_socket_set_website_attribution, _ne_tracker_build_cache, | |
| 3084 | _ne_tracker_build_trie, _ne_tracker_check_info_changed, _ne_tracker_clear_cache, | |
| 3085 | _ne_tracker_context_get_domain, _ne_tracker_context_get_domain_owner, | |
| 2725 | _ne_session_random_port_fallback, _ne_session_release, _ne_session_retain, | |
| 2726 | _ne_session_send_barrier, _ne_session_service_get_dns_service_id, | |
| 2727 | _ne_session_service_get_dns_service_id_for_interface, _ne_session_service_matches_address, | |
| 2728 | _ne_session_service_matches_address_for_interface, _ne_session_set_event_handler, | |
| 2729 | _ne_session_set_socket_attributes, _ne_session_set_socket_context_attribute, | |
| 2730 | _ne_session_set_socket_tracker_attributes, _ne_session_should_disable_nexus, | |
| 2731 | _ne_session_start, _ne_session_start_on_behalf_of, _ne_session_start_with_options, | |
| 2732 | _ne_session_status_to_string, _ne_session_stop, _ne_session_stop_all_with_plugin_type, | |
| 2733 | _ne_session_stop_reason_to_string, _ne_session_type_to_string, | |
| 2734 | _ne_session_use_as_system_vpn, _ne_session_vod_evaluate_connection_present, | |
| 2735 | _ne_session_vpn_include_all_networks_configs_present, _ne_socket_set_attribution, | |
| 2736 | _ne_socket_set_domains, _ne_socket_set_is_app_initiated, _ne_socket_set_website_attribution, | |
| 2737 | _ne_tracker_build_cache, _ne_tracker_build_trie, _ne_tracker_check_info_changed, | |
| 2738 | _ne_tracker_clear_cache, _ne_tracker_context_get_domain, _ne_tracker_context_get_domain_owner, | |
| 3086 | 2739 | _ne_tracker_context_is_from_app_list, _ne_tracker_context_is_from_web_list, |
| 3087 | 2740 | _ne_tracker_get_ddg_dictionary, _ne_tracker_lookup_app_domains, |
| 3088 | 2741 | _ne_tracker_set_test_domains, _ne_tracker_validate_domain, |
| ... | ... | @@ -3095,21 +2748,8 @@ exports: |
| 3095 | 2748 | tbd-version: 4 |
| 3096 | 2749 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3097 | 2750 | arm64e-macos, arm64e-maccatalyst ] |
| 3098 | uuids: | |
| 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 | |
| 3111 | 2751 | install-name: '/usr/lib/system/libsystem_notify.dylib' |
| 3112 | current-version: 306 | |
| 2752 | current-version: 312 | |
| 3113 | 2753 | parent-umbrella: |
| 3114 | 2754 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3115 | 2755 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3128,21 +2768,8 @@ exports: |
| 3128 | 2768 | tbd-version: 4 |
| 3129 | 2769 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3130 | 2770 | arm64e-macos, arm64e-maccatalyst ] |
| 3131 | uuids: | |
| 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 | |
| 3144 | 2771 | install-name: '/usr/lib/system/libsystem_platform.dylib' |
| 3145 | current-version: 288 | |
| 2772 | current-version: 292.100.1 | |
| 3146 | 2773 | parent-umbrella: |
| 3147 | 2774 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3148 | 2775 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3204,37 +2831,18 @@ exports: |
| 3204 | 2831 | _os_unfair_lock_unlock, _os_unfair_lock_unlock_no_tsd, _os_unfair_recursive_lock_lock_with_options, |
| 3205 | 2832 | _os_unfair_recursive_lock_owned, _os_unfair_recursive_lock_trylock, |
| 3206 | 2833 | _os_unfair_recursive_lock_tryunlock4objc, _os_unfair_recursive_lock_unlock, |
| 3207 | _os_unfair_recursive_lock_unlock_forked_child, _platform_task_attach, | |
| 3208 | _platform_task_copy_next_thread, _platform_task_detach, _platform_task_is_64_bit, | |
| 3209 | _platform_task_perform, _platform_task_resume_threads, _platform_task_suspend_threads, | |
| 3210 | _platform_task_update_threads, _platform_thread_abort_safely, | |
| 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 ] | |
| 2834 | _os_unfair_recursive_lock_unlock_forked_child, _setcontext, | |
| 2835 | _setjmp, _siglongjmp, _sigsetjmp, _spin_lock, _spin_lock_try, | |
| 2836 | _spin_unlock, _swapcontext, _sys_cache_control, _sys_dcache_flush, | |
| 2837 | _sys_icache_invalidate ] | |
| 3217 | 2838 | - targets: [ arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] |
| 3218 | 2839 | symbols: [ __ctx_done ] |
| 3219 | 2840 | --- !tapi-tbd |
| 3220 | 2841 | tbd-version: 4 |
| 3221 | 2842 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3222 | 2843 | arm64e-macos, arm64e-maccatalyst ] |
| 3223 | uuids: | |
| 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 | |
| 3236 | 2844 | install-name: '/usr/lib/system/libsystem_pthread.dylib' |
| 3237 | current-version: 514 | |
| 2845 | current-version: 514.100.2 | |
| 3238 | 2846 | parent-umbrella: |
| 3239 | 2847 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3240 | 2848 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3328,21 +2936,8 @@ exports: |
| 3328 | 2936 | tbd-version: 4 |
| 3329 | 2937 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3330 | 2938 | arm64e-macos, arm64e-maccatalyst ] |
| 3331 | uuids: | |
| 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 | |
| 3344 | 2939 | install-name: '/usr/lib/system/libsystem_sandbox.dylib' |
| 3345 | current-version: 1845.60.12 | |
| 2940 | current-version: 1846.100.185 | |
| 3346 | 2941 | parent-umbrella: |
| 3347 | 2942 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3348 | 2943 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3370,8 +2965,8 @@ exports: |
| 3370 | 2965 | _rootless_check_trusted_class, _rootless_check_trusted_fd, |
| 3371 | 2966 | _rootless_convert_to_datavault, _rootless_manifest_free, _rootless_manifest_parse, |
| 3372 | 2967 | _rootless_mkdir_datavault, _rootless_mkdir_nounlink, _rootless_mkdir_restricted, |
| 3373 | _rootless_preflight, _rootless_protected_volume, _rootless_register_trusted_storage_class, | |
| 3374 | _rootless_remove_datavault_in_favor_of_static_storage_class, | |
| 2968 | _rootless_preflight, _rootless_protected_volume, _rootless_protected_volume_fd, | |
| 2969 | _rootless_register_trusted_storage_class, _rootless_remove_datavault_in_favor_of_static_storage_class, | |
| 3375 | 2970 | _rootless_remove_restricted_in_favor_of_static_storage_class, |
| 3376 | 2971 | _rootless_restricted_environment, _rootless_suspend, _rootless_trusted_by_self_token, |
| 3377 | 2972 | _rootless_verify_trusted_by_self_token, _sandbox_builtin_query, |
| ... | ... | @@ -3415,21 +3010,8 @@ exports: |
| 3415 | 3010 | tbd-version: 4 |
| 3416 | 3011 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3417 | 3012 | arm64e-macos, arm64e-maccatalyst ] |
| 3418 | uuids: | |
| 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 | |
| 3431 | 3013 | install-name: '/usr/lib/system/libsystem_secinit.dylib' |
| 3432 | current-version: 119.40.2 | |
| 3014 | current-version: 120.100.7 | |
| 3433 | 3015 | parent-umbrella: |
| 3434 | 3016 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3435 | 3017 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3444,19 +3026,6 @@ exports: |
| 3444 | 3026 | tbd-version: 4 |
| 3445 | 3027 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3446 | 3028 | arm64e-macos, arm64e-maccatalyst ] |
| 3447 | uuids: | |
| 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 | |
| 3460 | 3029 | install-name: '/usr/lib/system/libsystem_symptoms.dylib' |
| 3461 | 3030 | parent-umbrella: |
| 3462 | 3031 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| ... | ... | @@ -3474,21 +3043,8 @@ exports: |
| 3474 | 3043 | tbd-version: 4 |
| 3475 | 3044 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3476 | 3045 | arm64e-macos, arm64e-maccatalyst ] |
| 3477 | uuids: | |
| 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 | |
| 3490 | 3046 | install-name: '/usr/lib/system/libsystem_trace.dylib' |
| 3491 | current-version: 1406.60.2 | |
| 3047 | current-version: 1431.100.13 | |
| 3492 | 3048 | parent-umbrella: |
| 3493 | 3049 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3494 | 3050 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3534,15 +3090,17 @@ exports: |
| 3534 | 3090 | _os_log_backtrace_create_from_return_address, _os_log_backtrace_destroy, |
| 3535 | 3091 | _os_log_backtrace_get_frames, _os_log_backtrace_get_length, |
| 3536 | 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, | |
| 3538 | _os_log_faults_count, _os_log_fmt_compose, _os_log_fmt_convert_trace, | |
| 3539 | _os_log_fmt_extract_pubdata, _os_log_fmt_get_plugin, _os_log_get_type, | |
| 3540 | _os_log_is_debug_enabled, _os_log_is_enabled, _os_log_pack_compose, | |
| 3541 | _os_log_pack_send, _os_log_pack_send_and_compose, _os_log_set_client_type, | |
| 3542 | _os_log_set_enabled, _os_log_set_fault_callback, _os_log_shim_enabled, | |
| 3093 | _os_log_compare_enablement, _os_log_copy_decorated_message, | |
| 3094 | _os_log_copy_message_string, _os_log_create, _os_log_errors_count, | |
| 3095 | _os_log_fault_default_callback, _os_log_faults_count, _os_log_fmt_compose, | |
| 3096 | _os_log_fmt_convert_trace, _os_log_fmt_extract_pubdata, _os_log_fmt_get_plugin, | |
| 3097 | _os_log_get_type, _os_log_is_debug_enabled, _os_log_is_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 | 3101 | _os_log_shim_legacy_logging_enabled, _os_log_shim_with_CFString, |
| 3544 | _os_log_type_enabled, _os_log_with_args, _os_signpost_enabled, | |
| 3545 | _os_signpost_id_generate, _os_signpost_id_make_with_pointer, | |
| 3102 | _os_log_type_enabled, _os_log_type_get_name, _os_log_with_args, | |
| 3103 | _os_signpost_enabled, _os_signpost_id_generate, _os_signpost_id_make_with_pointer, | |
| 3546 | 3104 | _os_signpost_set_introspection_hook_4Perf, _os_state_add_handler, |
| 3547 | 3105 | _os_state_remove_handler, _os_trace_debug_enabled, _os_trace_get_mode, |
| 3548 | 3106 | _os_trace_get_type, _os_trace_info_enabled, _os_trace_set_mode ] |
| ... | ... | @@ -3551,21 +3109,8 @@ exports: |
| 3551 | 3109 | tbd-version: 4 |
| 3552 | 3110 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3553 | 3111 | arm64e-macos, arm64e-maccatalyst ] |
| 3554 | uuids: | |
| 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 | |
| 3567 | 3112 | install-name: '/usr/lib/system/libunwind.dylib' |
| 3568 | current-version: 202.100 | |
| 3113 | current-version: 1500.26 | |
| 3569 | 3114 | parent-umbrella: |
| 3570 | 3115 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3571 | 3116 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3614,7 +3159,8 @@ exports: |
| 3614 | 3159 | __Unwind_GetLanguageSpecificData, __Unwind_GetRegionStart, |
| 3615 | 3160 | __Unwind_GetTextRelBase, __Unwind_RaiseException, __Unwind_Resume, |
| 3616 | 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 | 3164 | ___unw_remove_dynamic_fde, _unw_get_fpreg, _unw_get_proc_info, |
| 3619 | 3165 | _unw_get_proc_name, _unw_get_reg, _unw_getcontext, _unw_init_local, |
| 3620 | 3166 | _unw_is_fpreg, _unw_is_signal_frame, _unw_iterate_dwarf_unwind_cache, |
| ... | ... | @@ -3624,21 +3170,8 @@ exports: |
| 3624 | 3170 | tbd-version: 4 |
| 3625 | 3171 | targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3626 | 3172 | arm64e-macos, arm64e-maccatalyst ] |
| 3627 | uuids: | |
| 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 | |
| 3640 | 3173 | install-name: '/usr/lib/system/libxpc.dylib' |
| 3641 | current-version: 2462.60.15 | |
| 3174 | current-version: 2462.100.95 | |
| 3642 | 3175 | parent-umbrella: |
| 3643 | 3176 | - targets: [ x86_64-macos, x86_64-maccatalyst, arm64-macos, arm64-maccatalyst, |
| 3644 | 3177 | arm64e-macos, arm64e-maccatalyst ] |
| ... | ... | @@ -3685,12 +3218,13 @@ exports: |
| 3685 | 3218 | _XPC_COALITION_INFO_KEY_RESOURCE_USAGE_BLOB, __availability_version_check, |
| 3686 | 3219 | __launch_job_routine, __launch_job_routine_async, __launch_msg2, |
| 3687 | 3220 | __launch_server_test_routine, __launch_service_stats_copy_4ppse_impl, |
| 3688 | __libxpc_initializer, __spawn_via_launchd, __system_ios_support_version_copy_string_sysctl, | |
| 3689 | __system_version_copy_string_plist, __system_version_copy_string_sysctl, | |
| 3690 | __system_version_fallback, __system_version_parse_string, | |
| 3691 | __vproc_get_last_exit_status, __vproc_grab_subset, __vproc_kickstart_by_label, | |
| 3692 | __vproc_log, __vproc_log_error, __vproc_logv, __vproc_pid_is_managed, | |
| 3693 | __vproc_post_fork_ping, __vproc_send_signal_by_label, __vproc_set_global_on_demand, | |
| 3221 | __launch_service_stats_copy_impl, __libxpc_initializer, __spawn_via_launchd, | |
| 3222 | __system_ios_support_version_copy_string_sysctl, __system_version_copy_string_plist, | |
| 3223 | __system_version_copy_string_sysctl, __system_version_fallback, | |
| 3224 | __system_version_parse_string, __vproc_get_last_exit_status, | |
| 3225 | __vproc_grab_subset, __vproc_kickstart_by_label, __vproc_log, | |
| 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 | 3228 | __vproc_standby_begin, __vproc_standby_count, __vproc_standby_end, |
| 3695 | 3229 | __vproc_standby_timeout, __vproc_transaction_begin, __vproc_transaction_count, |
| 3696 | 3230 | __vproc_transaction_count_for_pid, __vproc_transaction_end, |
| ... | ... | @@ -3762,16 +3296,17 @@ exports: |
| 3762 | 3296 | _launch_perfcheck_property_endpoint_name, _launch_perfcheck_property_endpoint_needs_activation, |
| 3763 | 3297 | _launch_perfcheck_property_endpoints, _launch_remove_external_service, |
| 3764 | 3298 | _launch_service_instance_copy_uuids, _launch_service_instance_create, |
| 3765 | _launch_service_instance_remove, _launch_service_stats_disable_4ppse, | |
| 3766 | _launch_service_stats_enable_4ppse, _launch_service_stats_is_enabled_4ppse, | |
| 3767 | _launch_set_service_enabled, _launch_set_system_service_enabled, | |
| 3768 | _launch_socket_service_check_in, _launch_version_for_user_service_4coresim, | |
| 3769 | _launch_wait, _launchd_close, _launchd_fdopen, _launchd_getfd, | |
| 3770 | _launchd_msg_recv, _launchd_msg_send, _load_launchd_jobs_at_loginwindow_prompt, | |
| 3771 | _mpm_uncork_fork, _mpm_wait, _os_system_version_get_current_version, | |
| 3772 | _os_system_version_get_ios_support_version, _os_system_version_sim_get_current_host_version, | |
| 3773 | _os_transaction_copy_description, _os_transaction_create, | |
| 3774 | _os_transaction_get_description, _os_transaction_get_timestamp, | |
| 3299 | _launch_service_instance_remove, _launch_service_stats_disable, | |
| 3300 | _launch_service_stats_disable_4ppse, _launch_service_stats_enable, | |
| 3301 | _launch_service_stats_enable_4ppse, _launch_service_stats_is_enabled, | |
| 3302 | _launch_service_stats_is_enabled_4ppse, _launch_set_service_enabled, | |
| 3303 | _launch_set_system_service_enabled, _launch_socket_service_check_in, | |
| 3304 | _launch_version_for_user_service_4coresim, _launch_wait, _launchd_close, | |
| 3305 | _launchd_fdopen, _launchd_getfd, _launchd_msg_recv, _launchd_msg_send, | |
| 3306 | _load_launchd_jobs_at_loginwindow_prompt, _mpm_uncork_fork, | |
| 3307 | _mpm_wait, _os_system_version_get_current_version, _os_system_version_get_ios_support_version, | |
| 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 | 3310 | _os_transaction_needs_more_time, _place_hold_on_real_loginwindow, |
| 3776 | 3311 | _reboot2, _reboot3, _vproc_release, _vproc_retain, _vproc_standby_begin, |
| 3777 | 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 | 36 | pub const TbdV4 = struct { |
| 37 | 37 | tbd_version: u3, |
| 38 | 38 | targets: []const []const u8, |
| 39 | uuids: []const struct { | |
| 39 | uuids: ?[]const struct { | |
| 40 | 40 | target: []const u8, |
| 41 | 41 | value: []const u8, |
| 42 | 42 | }, |
src/link/tapi/Tokenizer.zig+338-223| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const Tokenizer = @This(); |
| 2 | 2 | |
| 3 | 3 | const std = @import("std"); |
| 4 | const log = std.log.scoped(.tapi); | |
| 4 | const log = std.log.scoped(.yaml); | |
| 5 | 5 | const testing = std.testing; |
| 6 | 6 | |
| 7 | 7 | buffer: []const u8, |
| ... | ... | @@ -13,29 +13,31 @@ pub const Token = struct { |
| 13 | 13 | end: usize, |
| 14 | 14 | |
| 15 | 15 | pub const Id = enum { |
| 16 | Eof, | |
| 17 | ||
| 18 | NewLine, | |
| 19 | DocStart, // --- | |
| 20 | DocEnd, // ... | |
| 21 | SeqItemInd, // - | |
| 22 | MapValueInd, // : | |
| 23 | FlowMapStart, // { | |
| 24 | FlowMapEnd, // } | |
| 25 | FlowSeqStart, // [ | |
| 26 | FlowSeqEnd, // ] | |
| 27 | ||
| 28 | Comma, | |
| 29 | Space, | |
| 30 | Tab, | |
| 31 | Comment, // # | |
| 32 | Alias, // * | |
| 33 | Anchor, // & | |
| 34 | Tag, // ! | |
| 35 | SingleQuote, // ' | |
| 36 | DoubleQuote, // " | |
| 37 | ||
| 38 | Literal, | |
| 16 | // zig fmt: off | |
| 17 | eof, | |
| 18 | ||
| 19 | new_line, | |
| 20 | doc_start, // --- | |
| 21 | doc_end, // ... | |
| 22 | seq_item_ind, // - | |
| 23 | map_value_ind, // : | |
| 24 | flow_map_start, // { | |
| 25 | flow_map_end, // } | |
| 26 | flow_seq_start, // [ | |
| 27 | flow_seq_end, // ] | |
| 28 | ||
| 29 | comma, | |
| 30 | space, | |
| 31 | tab, | |
| 32 | comment, // # | |
| 33 | alias, // * | |
| 34 | anchor, // & | |
| 35 | tag, // ! | |
| 36 | ||
| 37 | single_quoted, // '...' | |
| 38 | double_quoted, // "..." | |
| 39 | literal, | |
| 40 | // zig fmt: on | |
| 39 | 41 | }; |
| 40 | 42 | }; |
| 41 | 43 | |
| ... | ... | @@ -45,8 +47,8 @@ pub const TokenIterator = struct { |
| 45 | 47 | buffer: []const Token, |
| 46 | 48 | pos: TokenIndex = 0, |
| 47 | 49 | |
| 48 | pub fn next(self: *TokenIterator) Token { | |
| 49 | const token = self.buffer[self.pos]; | |
| 50 | pub fn next(self: *TokenIterator) ?Token { | |
| 51 | const token = self.peek() orelse return null; | |
| 50 | 52 | self.pos += 1; |
| 51 | 53 | return token; |
| 52 | 54 | } |
| ... | ... | @@ -74,180 +76,212 @@ pub const TokenIterator = struct { |
| 74 | 76 | } |
| 75 | 77 | }; |
| 76 | 78 | |
| 79 | fn 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 | ||
| 89 | fn matchesPattern(self: Tokenizer, comptime pattern: []const u8) bool { | |
| 90 | return stringMatchesPattern(pattern, self.buffer[self.index..]); | |
| 91 | } | |
| 92 | ||
| 77 | 93 | pub fn next(self: *Tokenizer) Token { |
| 78 | 94 | var result = Token{ |
| 79 | .id = .Eof, | |
| 95 | .id = .eof, | |
| 80 | 96 | .start = self.index, |
| 81 | 97 | .end = undefined, |
| 82 | 98 | }; |
| 83 | 99 | |
| 84 | var state: union(enum) { | |
| 85 | Start, | |
| 86 | NewLine, | |
| 87 | Space, | |
| 88 | Tab, | |
| 89 | Hyphen: usize, | |
| 90 | Dot: usize, | |
| 91 | Literal, | |
| 92 | } = .Start; | |
| 100 | var state: enum { | |
| 101 | start, | |
| 102 | new_line, | |
| 103 | space, | |
| 104 | tab, | |
| 105 | comment, | |
| 106 | single_quoted, | |
| 107 | double_quoted, | |
| 108 | literal, | |
| 109 | } = .start; | |
| 93 | 110 | |
| 94 | 111 | while (self.index < self.buffer.len) : (self.index += 1) { |
| 95 | 112 | const c = self.buffer[self.index]; |
| 96 | 113 | switch (state) { |
| 97 | .Start => switch (c) { | |
| 114 | .start => switch (c) { | |
| 98 | 115 | ' ' => { |
| 99 | state = .Space; | |
| 116 | state = .space; | |
| 100 | 117 | }, |
| 101 | 118 | '\t' => { |
| 102 | state = .Tab; | |
| 119 | state = .tab; | |
| 103 | 120 | }, |
| 104 | 121 | '\n' => { |
| 105 | result.id = .NewLine; | |
| 122 | result.id = .new_line; | |
| 106 | 123 | self.index += 1; |
| 107 | 124 | break; |
| 108 | 125 | }, |
| 109 | 126 | '\r' => { |
| 110 | state = .NewLine; | |
| 127 | state = .new_line; | |
| 111 | 128 | }, |
| 112 | '-' => { | |
| 113 | state = .{ .Hyphen = 1 }; | |
| 129 | ||
| 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 | '.' => { | |
| 116 | state = .{ .Dot = 1 }; | |
| 141 | ||
| 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 | 152 | self.index += 1; |
| 121 | 153 | break; |
| 122 | 154 | }, |
| 123 | 155 | '#' => { |
| 124 | result.id = .Comment; | |
| 125 | self.index += 1; | |
| 126 | break; | |
| 156 | state = .comment; | |
| 127 | 157 | }, |
| 128 | 158 | '*' => { |
| 129 | result.id = .Alias; | |
| 159 | result.id = .alias; | |
| 130 | 160 | self.index += 1; |
| 131 | 161 | break; |
| 132 | 162 | }, |
| 133 | 163 | '&' => { |
| 134 | result.id = .Anchor; | |
| 164 | result.id = .anchor; | |
| 135 | 165 | self.index += 1; |
| 136 | 166 | break; |
| 137 | 167 | }, |
| 138 | 168 | '!' => { |
| 139 | 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; | |
| 169 | result.id = .tag; | |
| 150 | 170 | self.index += 1; |
| 151 | 171 | break; |
| 152 | 172 | }, |
| 153 | 173 | '[' => { |
| 154 | result.id = .FlowSeqStart; | |
| 174 | result.id = .flow_seq_start; | |
| 155 | 175 | self.index += 1; |
| 156 | 176 | break; |
| 157 | 177 | }, |
| 158 | 178 | ']' => { |
| 159 | result.id = .FlowSeqEnd; | |
| 179 | result.id = .flow_seq_end; | |
| 160 | 180 | self.index += 1; |
| 161 | 181 | break; |
| 162 | 182 | }, |
| 163 | 183 | ':' => { |
| 164 | result.id = .MapValueInd; | |
| 184 | result.id = .map_value_ind; | |
| 165 | 185 | self.index += 1; |
| 166 | 186 | break; |
| 167 | 187 | }, |
| 168 | 188 | '{' => { |
| 169 | result.id = .FlowMapStart; | |
| 189 | result.id = .flow_map_start; | |
| 170 | 190 | self.index += 1; |
| 171 | 191 | break; |
| 172 | 192 | }, |
| 173 | 193 | '}' => { |
| 174 | result.id = .FlowMapEnd; | |
| 194 | result.id = .flow_map_end; | |
| 175 | 195 | self.index += 1; |
| 176 | 196 | break; |
| 177 | 197 | }, |
| 198 | '\'' => { | |
| 199 | state = .single_quoted; | |
| 200 | }, | |
| 201 | '"' => { | |
| 202 | state = .double_quoted; | |
| 203 | }, | |
| 178 | 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 | 219 | else => { |
| 185 | result.id = .Space; | |
| 220 | result.id = .space; | |
| 186 | 221 | break; |
| 187 | 222 | }, |
| 188 | 223 | }, |
| 189 | .Tab => switch (c) { | |
| 224 | ||
| 225 | .tab => switch (c) { | |
| 190 | 226 | '\t' => {}, |
| 191 | 227 | else => { |
| 192 | result.id = .Tab; | |
| 228 | result.id = .tab; | |
| 193 | 229 | break; |
| 194 | 230 | }, |
| 195 | 231 | }, |
| 196 | .NewLine => switch (c) { | |
| 232 | ||
| 233 | .new_line => switch (c) { | |
| 197 | 234 | '\n' => { |
| 198 | result.id = .NewLine; | |
| 235 | result.id = .new_line; | |
| 199 | 236 | self.index += 1; |
| 200 | 237 | break; |
| 201 | 238 | }, |
| 202 | 239 | else => {}, // TODO this should be an error condition |
| 203 | 240 | }, |
| 204 | .Hyphen => |*count| switch (c) { | |
| 205 | ' ' => { | |
| 206 | result.id = .SeqItemInd; | |
| 241 | ||
| 242 | .single_quoted => switch (c) { | |
| 243 | '\'' => if (!self.matchesPattern("''")) { | |
| 244 | result.id = .single_quoted; | |
| 207 | 245 | self.index += 1; |
| 208 | 246 | break; |
| 247 | } else { | |
| 248 | self.index += "''".len - 1; | |
| 209 | 249 | }, |
| 210 | '-' => { | |
| 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 | }, | |
| 250 | else => {}, | |
| 222 | 251 | }, |
| 223 | .Dot => |*count| switch (c) { | |
| 224 | '.' => { | |
| 225 | count.* += 1; | |
| 226 | 252 | |
| 227 | if (count.* == 3) { | |
| 228 | result.id = .DocEnd; | |
| 253 | .double_quoted => switch (c) { | |
| 254 | '"' => { | |
| 255 | if (stringMatchesPattern("\\", self.buffer[self.index - 1 ..])) { | |
| 256 | self.index += 1; | |
| 257 | } else { | |
| 258 | result.id = .double_quoted; | |
| 229 | 259 | self.index += 1; |
| 230 | 260 | break; |
| 231 | 261 | } |
| 232 | 262 | }, |
| 233 | else => { | |
| 234 | state = .Literal; | |
| 235 | }, | |
| 263 | else => {}, | |
| 236 | 264 | }, |
| 237 | .Literal => switch (c) { | |
| 265 | ||
| 266 | .literal => switch (c) { | |
| 238 | 267 | '\r', '\n', ' ', '\'', '"', ',', ':', ']', '}' => { |
| 239 | result.id = .Literal; | |
| 268 | result.id = .literal; | |
| 240 | 269 | break; |
| 241 | 270 | }, |
| 242 | 271 | else => { |
| 243 | result.id = .Literal; | |
| 272 | result.id = .literal; | |
| 244 | 273 | }, |
| 245 | 274 | }, |
| 246 | 275 | } |
| 247 | 276 | } |
| 248 | 277 | |
| 249 | if (state == .Literal and result.id == .Eof) { | |
| 250 | result.id = .Literal; | |
| 278 | if (self.index >= self.buffer.len) { | |
| 279 | switch (state) { | |
| 280 | .literal => { | |
| 281 | result.id = .literal; | |
| 282 | }, | |
| 283 | else => {}, | |
| 284 | } | |
| 251 | 285 | } |
| 252 | 286 | |
| 253 | 287 | result.end = self.index; |
| ... | ... | @@ -263,22 +297,24 @@ fn testExpected(source: []const u8, expected: []const Token.Id) !void { |
| 263 | 297 | .buffer = source, |
| 264 | 298 | }; |
| 265 | 299 | |
| 266 | var token_len: usize = 0; | |
| 267 | for (expected) |exp| { | |
| 268 | token_len += 1; | |
| 300 | var given = std.ArrayList(Token.Id).init(testing.allocator); | |
| 301 | defer given.deinit(); | |
| 302 | ||
| 303 | while (true) { | |
| 269 | 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 | } |
| 272 | 308 | |
| 273 | while (tokenizer.next().id != .Eof) { | |
| 274 | token_len += 1; // consume all tokens | |
| 275 | } | |
| 309 | try testing.expectEqualSlices(Token.Id, expected, given.items); | |
| 310 | } | |
| 276 | 311 | |
| 277 | try testing.expectEqual(expected.len, token_len); | |
| 312 | test { | |
| 313 | std.testing.refAllDecls(@This()); | |
| 278 | 314 | } |
| 279 | 315 | |
| 280 | 316 | test "empty doc" { |
| 281 | try testExpected("", &[_]Token.Id{.Eof}); | |
| 317 | try testExpected("", &[_]Token.Id{.eof}); | |
| 282 | 318 | } |
| 283 | 319 | |
| 284 | 320 | test "empty doc with explicit markers" { |
| ... | ... | @@ -286,7 +322,22 @@ test "empty doc with explicit markers" { |
| 286 | 322 | \\--- |
| 287 | 323 | \\... |
| 288 | 324 | , &[_]Token.Id{ |
| 289 | .DocStart, .NewLine, .DocEnd, .Eof, | |
| 325 | .doc_start, .new_line, .doc_end, .eof, | |
| 326 | }); | |
| 327 | } | |
| 328 | ||
| 329 | test "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 | } |
| 292 | 343 | |
| ... | ... | @@ -296,15 +347,15 @@ test "sequence of values" { |
| 296 | 347 | \\- 1 |
| 297 | 348 | \\- 2 |
| 298 | 349 | , &[_]Token.Id{ |
| 299 | .SeqItemInd, | |
| 300 | .Literal, | |
| 301 | .NewLine, | |
| 302 | .SeqItemInd, | |
| 303 | .Literal, | |
| 304 | .NewLine, | |
| 305 | .SeqItemInd, | |
| 306 | .Literal, | |
| 307 | .Eof, | |
| 350 | .seq_item_ind, | |
| 351 | .literal, | |
| 352 | .new_line, | |
| 353 | .seq_item_ind, | |
| 354 | .literal, | |
| 355 | .new_line, | |
| 356 | .seq_item_ind, | |
| 357 | .literal, | |
| 358 | .eof, | |
| 308 | 359 | }); |
| 309 | 360 | } |
| 310 | 361 | |
| ... | ... | @@ -313,24 +364,24 @@ test "sequence of sequences" { |
| 313 | 364 | \\- [ val1, val2] |
| 314 | 365 | \\- [val3, val4 ] |
| 315 | 366 | , &[_]Token.Id{ |
| 316 | .SeqItemInd, | |
| 317 | .FlowSeqStart, | |
| 318 | .Space, | |
| 319 | .Literal, | |
| 320 | .Comma, | |
| 321 | .Space, | |
| 322 | .Literal, | |
| 323 | .FlowSeqEnd, | |
| 324 | .NewLine, | |
| 325 | .SeqItemInd, | |
| 326 | .FlowSeqStart, | |
| 327 | .Literal, | |
| 328 | .Comma, | |
| 329 | .Space, | |
| 330 | .Literal, | |
| 331 | .Space, | |
| 332 | .FlowSeqEnd, | |
| 333 | .Eof, | |
| 367 | .seq_item_ind, | |
| 368 | .flow_seq_start, | |
| 369 | .space, | |
| 370 | .literal, | |
| 371 | .comma, | |
| 372 | .space, | |
| 373 | .literal, | |
| 374 | .flow_seq_end, | |
| 375 | .new_line, | |
| 376 | .seq_item_ind, | |
| 377 | .flow_seq_start, | |
| 378 | .literal, | |
| 379 | .comma, | |
| 380 | .space, | |
| 381 | .literal, | |
| 382 | .space, | |
| 383 | .flow_seq_end, | |
| 384 | .eof, | |
| 334 | 385 | }); |
| 335 | 386 | } |
| 336 | 387 | |
| ... | ... | @@ -339,16 +390,16 @@ test "mappings" { |
| 339 | 390 | \\key1: value1 |
| 340 | 391 | \\key2: value2 |
| 341 | 392 | , &[_]Token.Id{ |
| 342 | .Literal, | |
| 343 | .MapValueInd, | |
| 344 | .Space, | |
| 345 | .Literal, | |
| 346 | .NewLine, | |
| 347 | .Literal, | |
| 348 | .MapValueInd, | |
| 349 | .Space, | |
| 350 | .Literal, | |
| 351 | .Eof, | |
| 393 | .literal, | |
| 394 | .map_value_ind, | |
| 395 | .space, | |
| 396 | .literal, | |
| 397 | .new_line, | |
| 398 | .literal, | |
| 399 | .map_value_ind, | |
| 400 | .space, | |
| 401 | .literal, | |
| 402 | .eof, | |
| 352 | 403 | }); |
| 353 | 404 | } |
| 354 | 405 | |
| ... | ... | @@ -357,21 +408,21 @@ test "inline mapped sequence of values" { |
| 357 | 408 | \\key : [ val1, |
| 358 | 409 | \\ val2 ] |
| 359 | 410 | , &[_]Token.Id{ |
| 360 | .Literal, | |
| 361 | .Space, | |
| 362 | .MapValueInd, | |
| 363 | .Space, | |
| 364 | .FlowSeqStart, | |
| 365 | .Space, | |
| 366 | .Literal, | |
| 367 | .Comma, | |
| 368 | .Space, | |
| 369 | .NewLine, | |
| 370 | .Space, | |
| 371 | .Literal, | |
| 372 | .Space, | |
| 373 | .FlowSeqEnd, | |
| 374 | .Eof, | |
| 411 | .literal, | |
| 412 | .space, | |
| 413 | .map_value_ind, | |
| 414 | .space, | |
| 415 | .flow_seq_start, | |
| 416 | .space, | |
| 417 | .literal, | |
| 418 | .comma, | |
| 419 | .space, | |
| 420 | .new_line, | |
| 421 | .space, | |
| 422 | .literal, | |
| 423 | .space, | |
| 424 | .flow_seq_end, | |
| 425 | .eof, | |
| 375 | 426 | }); |
| 376 | 427 | } |
| 377 | 428 | |
| ... | ... | @@ -388,52 +439,50 @@ test "part of tbd" { |
| 388 | 439 | \\install-name: '/usr/lib/libSystem.B.dylib' |
| 389 | 440 | \\... |
| 390 | 441 | , &[_]Token.Id{ |
| 391 | .DocStart, | |
| 392 | .Space, | |
| 393 | .Tag, | |
| 394 | .Literal, | |
| 395 | .NewLine, | |
| 396 | .Literal, | |
| 397 | .MapValueInd, | |
| 398 | .Space, | |
| 399 | .Literal, | |
| 400 | .NewLine, | |
| 401 | .Literal, | |
| 402 | .MapValueInd, | |
| 403 | .Space, | |
| 404 | .FlowSeqStart, | |
| 405 | .Space, | |
| 406 | .Literal, | |
| 407 | .Space, | |
| 408 | .FlowSeqEnd, | |
| 409 | .NewLine, | |
| 410 | .NewLine, | |
| 411 | .Literal, | |
| 412 | .MapValueInd, | |
| 413 | .NewLine, | |
| 414 | .Space, | |
| 415 | .SeqItemInd, | |
| 416 | .Literal, | |
| 417 | .MapValueInd, | |
| 418 | .Space, | |
| 419 | .Literal, | |
| 420 | .NewLine, | |
| 421 | .Space, | |
| 422 | .Literal, | |
| 423 | .MapValueInd, | |
| 424 | .Space, | |
| 425 | .Literal, | |
| 426 | .NewLine, | |
| 427 | .NewLine, | |
| 428 | .Literal, | |
| 429 | .MapValueInd, | |
| 430 | .Space, | |
| 431 | .SingleQuote, | |
| 432 | .Literal, | |
| 433 | .SingleQuote, | |
| 434 | .NewLine, | |
| 435 | .DocEnd, | |
| 436 | .Eof, | |
| 442 | .doc_start, | |
| 443 | .space, | |
| 444 | .tag, | |
| 445 | .literal, | |
| 446 | .new_line, | |
| 447 | .literal, | |
| 448 | .map_value_ind, | |
| 449 | .space, | |
| 450 | .literal, | |
| 451 | .new_line, | |
| 452 | .literal, | |
| 453 | .map_value_ind, | |
| 454 | .space, | |
| 455 | .flow_seq_start, | |
| 456 | .space, | |
| 457 | .literal, | |
| 458 | .space, | |
| 459 | .flow_seq_end, | |
| 460 | .new_line, | |
| 461 | .new_line, | |
| 462 | .literal, | |
| 463 | .map_value_ind, | |
| 464 | .new_line, | |
| 465 | .space, | |
| 466 | .seq_item_ind, | |
| 467 | .literal, | |
| 468 | .map_value_ind, | |
| 469 | .space, | |
| 470 | .literal, | |
| 471 | .new_line, | |
| 472 | .space, | |
| 473 | .literal, | |
| 474 | .map_value_ind, | |
| 475 | .space, | |
| 476 | .literal, | |
| 477 | .new_line, | |
| 478 | .new_line, | |
| 479 | .literal, | |
| 480 | .map_value_ind, | |
| 481 | .space, | |
| 482 | .single_quoted, | |
| 483 | .new_line, | |
| 484 | .doc_end, | |
| 485 | .eof, | |
| 437 | 486 | }); |
| 438 | 487 | } |
| 439 | 488 | |
| ... | ... | @@ -443,18 +492,84 @@ test "Unindented list" { |
| 443 | 492 | \\- foo: 1 |
| 444 | 493 | \\c: 1 |
| 445 | 494 | , &[_]Token.Id{ |
| 446 | .Literal, | |
| 447 | .MapValueInd, | |
| 448 | .NewLine, | |
| 449 | .SeqItemInd, | |
| 450 | .Literal, | |
| 451 | .MapValueInd, | |
| 452 | .Space, | |
| 453 | .Literal, | |
| 454 | .NewLine, | |
| 455 | .Literal, | |
| 456 | .MapValueInd, | |
| 457 | .Space, | |
| 458 | .Literal, | |
| 495 | .literal, | |
| 496 | .map_value_ind, | |
| 497 | .new_line, | |
| 498 | .seq_item_ind, | |
| 499 | .literal, | |
| 500 | .map_value_ind, | |
| 501 | .space, | |
| 502 | .literal, | |
| 503 | .new_line, | |
| 504 | .literal, | |
| 505 | .map_value_ind, | |
| 506 | .space, | |
| 507 | .literal, | |
| 508 | .eof, | |
| 509 | }); | |
| 510 | } | |
| 511 | ||
| 512 | test "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 | ||
| 536 | test "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 | ||
| 562 | test "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 | 1 | const std = @import("std"); |
| 2 | 2 | const assert = std.debug.assert; |
| 3 | const log = std.log.scoped(.tapi); | |
| 3 | const log = std.log.scoped(.yaml); | |
| 4 | 4 | const mem = std.mem; |
| 5 | const testing = std.testing; | |
| 6 | 5 | |
| 7 | 6 | const Allocator = mem.Allocator; |
| 8 | 7 | const Tokenizer = @import("Tokenizer.zig"); |
| ... | ... | @@ -11,9 +10,9 @@ const TokenIndex = Tokenizer.TokenIndex; |
| 11 | 10 | const TokenIterator = Tokenizer.TokenIterator; |
| 12 | 11 | |
| 13 | 12 | pub const ParseError = error{ |
| 13 | InvalidEscapeSequence, | |
| 14 | 14 | MalformedYaml, |
| 15 | 15 | NestedDocuments, |
| 16 | UnexpectedTag, | |
| 17 | 16 | UnexpectedEof, |
| 18 | 17 | UnexpectedToken, |
| 19 | 18 | Unhandled, |
| ... | ... | @@ -22,6 +21,8 @@ pub const ParseError = error{ |
| 22 | 21 | pub const Node = struct { |
| 23 | 22 | tag: Tag, |
| 24 | 23 | tree: *const Tree, |
| 24 | start: TokenIndex, | |
| 25 | end: TokenIndex, | |
| 25 | 26 | |
| 26 | 27 | pub const Tag = enum { |
| 27 | 28 | doc, |
| ... | ... | @@ -61,9 +62,12 @@ pub const Node = struct { |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | pub const Doc = struct { |
| 64 | base: Node = Node{ .tag = Tag.doc, .tree = undefined }, | |
| 65 | start: ?TokenIndex = null, | |
| 66 | end: ?TokenIndex = null, | |
| 65 | base: Node = Node{ | |
| 66 | .tag = Tag.doc, | |
| 67 | .tree = undefined, | |
| 68 | .start = undefined, | |
| 69 | .end = undefined, | |
| 70 | }, | |
| 67 | 71 | directive: ?TokenIndex = null, |
| 68 | 72 | value: ?*Node = null, |
| 69 | 73 | |
| ... | ... | @@ -86,10 +90,8 @@ pub const Node = struct { |
| 86 | 90 | _ = fmt; |
| 87 | 91 | if (self.directive) |id| { |
| 88 | 92 | try std.fmt.format(writer, "{{ ", .{}); |
| 89 | const directive = self.base.tree.tokens[id]; | |
| 90 | try std.fmt.format(writer, ".directive = {s}, ", .{ | |
| 91 | self.base.tree.source[directive.start..directive.end], | |
| 92 | }); | |
| 93 | const directive = self.base.tree.getRaw(id, id); | |
| 94 | try std.fmt.format(writer, ".directive = {s}, ", .{directive}); | |
| 93 | 95 | } |
| 94 | 96 | if (self.value) |node| { |
| 95 | 97 | try std.fmt.format(writer, "{}", .{node}); |
| ... | ... | @@ -101,22 +103,27 @@ pub const Node = struct { |
| 101 | 103 | }; |
| 102 | 104 | |
| 103 | 105 | pub const Map = struct { |
| 104 | base: Node = Node{ .tag = Tag.map, .tree = undefined }, | |
| 105 | start: ?TokenIndex = null, | |
| 106 | end: ?TokenIndex = null, | |
| 106 | base: Node = Node{ | |
| 107 | .tag = Tag.map, | |
| 108 | .tree = undefined, | |
| 109 | .start = undefined, | |
| 110 | .end = undefined, | |
| 111 | }, | |
| 107 | 112 | values: std.ArrayListUnmanaged(Entry) = .{}, |
| 108 | 113 | |
| 109 | 114 | pub const base_tag: Node.Tag = .map; |
| 110 | 115 | |
| 111 | 116 | pub const Entry = struct { |
| 112 | 117 | key: TokenIndex, |
| 113 | value: *Node, | |
| 118 | value: ?*Node, | |
| 114 | 119 | }; |
| 115 | 120 | |
| 116 | 121 | pub fn deinit(self: *Map, allocator: Allocator) void { |
| 117 | 122 | for (self.values.items) |entry| { |
| 118 | entry.value.deinit(allocator); | |
| 119 | allocator.destroy(entry.value); | |
| 123 | if (entry.value) |value| { | |
| 124 | value.deinit(allocator); | |
| 125 | allocator.destroy(value); | |
| 126 | } | |
| 120 | 127 | } |
| 121 | 128 | self.values.deinit(allocator); |
| 122 | 129 | } |
| ... | ... | @@ -131,20 +138,24 @@ pub const Node = struct { |
| 131 | 138 | _ = fmt; |
| 132 | 139 | try std.fmt.format(writer, "{{ ", .{}); |
| 133 | 140 | for (self.values.items) |entry| { |
| 134 | const key = self.base.tree.tokens[entry.key]; | |
| 135 | try std.fmt.format(writer, "{s} => {}, ", .{ | |
| 136 | self.base.tree.source[key.start..key.end], | |
| 137 | entry.value, | |
| 138 | }); | |
| 141 | const key = self.base.tree.getRaw(entry.key, entry.key); | |
| 142 | if (entry.value) |value| { | |
| 143 | try std.fmt.format(writer, "{s} => {}, ", .{ key, value }); | |
| 144 | } else { | |
| 145 | try std.fmt.format(writer, "{s} => null, ", .{key}); | |
| 146 | } | |
| 139 | 147 | } |
| 140 | 148 | return std.fmt.format(writer, " }}", .{}); |
| 141 | 149 | } |
| 142 | 150 | }; |
| 143 | 151 | |
| 144 | 152 | pub const List = struct { |
| 145 | base: Node = Node{ .tag = Tag.list, .tree = undefined }, | |
| 146 | start: ?TokenIndex = null, | |
| 147 | end: ?TokenIndex = null, | |
| 153 | base: Node = Node{ | |
| 154 | .tag = Tag.list, | |
| 155 | .tree = undefined, | |
| 156 | .start = undefined, | |
| 157 | .end = undefined, | |
| 158 | }, | |
| 148 | 159 | values: std.ArrayListUnmanaged(*Node) = .{}, |
| 149 | 160 | |
| 150 | 161 | pub const base_tag: Node.Tag = .list; |
| ... | ... | @@ -174,15 +185,18 @@ pub const Node = struct { |
| 174 | 185 | }; |
| 175 | 186 | |
| 176 | 187 | pub const Value = struct { |
| 177 | base: Node = Node{ .tag = Tag.value, .tree = undefined }, | |
| 178 | start: ?TokenIndex = null, | |
| 179 | end: ?TokenIndex = null, | |
| 188 | base: Node = Node{ | |
| 189 | .tag = Tag.value, | |
| 190 | .tree = undefined, | |
| 191 | .start = undefined, | |
| 192 | .end = undefined, | |
| 193 | }, | |
| 194 | string_value: std.ArrayListUnmanaged(u8) = .{}, | |
| 180 | 195 | |
| 181 | 196 | pub const base_tag: Node.Tag = .value; |
| 182 | 197 | |
| 183 | 198 | pub fn deinit(self: *Value, allocator: Allocator) void { |
| 184 | _ = self; | |
| 185 | _ = allocator; | |
| 199 | self.string_value.deinit(allocator); | |
| 186 | 200 | } |
| 187 | 201 | |
| 188 | 202 | pub fn format( |
| ... | ... | @@ -193,11 +207,8 @@ pub const Node = struct { |
| 193 | 207 | ) !void { |
| 194 | 208 | _ = options; |
| 195 | 209 | _ = fmt; |
| 196 | const start = self.base.tree.tokens[self.start.?]; | |
| 197 | const end = self.base.tree.tokens[self.end.?]; | |
| 198 | return std.fmt.format(writer, "{s}", .{ | |
| 199 | self.base.tree.source[start.start..end.end], | |
| 200 | }); | |
| 210 | const raw = self.base.tree.getRaw(self.base.start, self.base.end); | |
| 211 | return std.fmt.format(writer, "{s}", .{raw}); | |
| 201 | 212 | } |
| 202 | 213 | }; |
| 203 | 214 | }; |
| ... | ... | @@ -233,6 +244,21 @@ pub const Tree = struct { |
| 233 | 244 | self.docs.deinit(self.allocator); |
| 234 | 245 | } |
| 235 | 246 | |
| 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 | 262 | pub fn parse(self: *Tree, source: []const u8) !void { |
| 237 | 263 | var tokenizer = Tokenizer{ .buffer = source }; |
| 238 | 264 | var tokens = std.ArrayList(Token).init(self.allocator); |
| ... | ... | @@ -252,8 +278,8 @@ pub const Tree = struct { |
| 252 | 278 | }); |
| 253 | 279 | |
| 254 | 280 | switch (token.id) { |
| 255 | .Eof => break, | |
| 256 | .NewLine => { | |
| 281 | .eof => break, | |
| 282 | .new_line => { | |
| 257 | 283 | line += 1; |
| 258 | 284 | prev_line_last_col = token.end; |
| 259 | 285 | }, |
| ... | ... | @@ -272,20 +298,20 @@ pub const Tree = struct { |
| 272 | 298 | .line_cols = &self.line_cols, |
| 273 | 299 | }; |
| 274 | 300 | |
| 275 | while (true) { | |
| 276 | if (parser.token_it.peek() == null) return; | |
| 301 | parser.eatCommentsAndSpace(&.{}); | |
| 277 | 302 | |
| 278 | const pos = parser.token_it.pos; | |
| 279 | const token = parser.token_it.next(); | |
| 303 | while (true) { | |
| 304 | parser.eatCommentsAndSpace(&.{}); | |
| 305 | const token = parser.token_it.next() orelse break; | |
| 280 | 306 | |
| 281 | log.debug("Next token: {}, {}", .{ pos, token }); | |
| 307 | log.debug("(main) next {s}@{d}", .{ @tagName(token.id), parser.token_it.pos - 1 }); | |
| 282 | 308 | |
| 283 | 309 | switch (token.id) { |
| 284 | .Space, .Comment, .NewLine => {}, | |
| 285 | .Eof => break, | |
| 310 | .eof => break, | |
| 286 | 311 | else => { |
| 287 | const doc = try parser.doc(pos); | |
| 288 | try self.docs.append(self.allocator, &doc.base); | |
| 312 | parser.token_it.seekBy(-1); | |
| 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 | 324 | token_it: *TokenIterator, |
| 299 | 325 | line_cols: *const std.AutoHashMap(TokenIndex, LineCol), |
| 300 | 326 | |
| 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 | 365 | const node = try self.allocator.create(Node.Doc); |
| 303 | 366 | errdefer self.allocator.destroy(node); |
| 304 | node.* = .{ .start = start }; | |
| 367 | node.* = .{}; | |
| 305 | 368 | node.base.tree = self.tree; |
| 369 | node.base.start = self.token_it.pos; | |
| 306 | 370 | |
| 307 | self.token_it.seekTo(start); | |
| 308 | ||
| 309 | log.debug("Doc start: {}, {}", .{ start, self.tree.tokens[start] }); | |
| 371 | log.debug("(doc) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start }); | |
| 310 | 372 | |
| 311 | const explicit_doc: bool = if (self.eatToken(.DocStart)) |_| explicit_doc: { | |
| 312 | if (self.eatToken(.Tag)) |_| { | |
| 313 | node.directive = try self.expectToken(.Literal); | |
| 373 | // Parse header | |
| 374 | const explicit_doc: bool = if (self.eatToken(.doc_start, &.{})) |doc_pos| explicit_doc: { | |
| 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 | 379 | break :explicit_doc true; |
| 317 | 380 | } else false; |
| 318 | 381 | |
| 319 | while (true) { | |
| 320 | const pos = self.token_it.pos; | |
| 321 | const token = self.token_it.next(); | |
| 322 | ||
| 323 | log.debug("Next token: {}, {}", .{ pos, token }); | |
| 382 | // Parse value | |
| 383 | node.value = try self.value(); | |
| 384 | if (node.value == null) { | |
| 385 | self.token_it.seekBy(-1); | |
| 386 | } | |
| 387 | errdefer if (node.value) |val| { | |
| 388 | val.deinit(self.allocator); | |
| 389 | self.allocator.destroy(val); | |
| 390 | }; | |
| 324 | 391 | |
| 325 | switch (token.id) { | |
| 326 | .Tag => { | |
| 327 | return error.UnexpectedTag; | |
| 328 | }, | |
| 329 | .Literal, .SingleQuote, .DoubleQuote => { | |
| 330 | _ = try self.expectToken(.MapValueInd); | |
| 331 | const map_node = try self.map(pos); | |
| 332 | node.value = &map_node.base; | |
| 333 | }, | |
| 334 | .SeqItemInd => { | |
| 335 | const list_node = try self.list(pos); | |
| 336 | node.value = &list_node.base; | |
| 337 | }, | |
| 338 | .FlowSeqStart => { | |
| 339 | const list_node = try self.list_bracketed(pos); | |
| 340 | node.value = &list_node.base; | |
| 341 | }, | |
| 342 | .DocEnd => { | |
| 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 | }, | |
| 392 | // Parse footer | |
| 393 | footer: { | |
| 394 | if (self.eatToken(.doc_end, &.{})) |pos| { | |
| 395 | if (!explicit_doc) return error.UnexpectedToken; | |
| 396 | if (self.getCol(pos) > 0) return error.MalformedYaml; | |
| 397 | node.base.end = pos; | |
| 398 | break :footer; | |
| 399 | } | |
| 400 | if (self.eatToken(.doc_start, &.{})) |pos| { | |
| 401 | if (!explicit_doc) return error.UnexpectedToken; | |
| 402 | if (self.getCol(pos) > 0) return error.MalformedYaml; | |
| 403 | self.token_it.seekBy(-1); | |
| 404 | node.base.end = pos - 1; | |
| 405 | break :footer; | |
| 406 | } | |
| 407 | if (self.eatToken(.eof, &.{})) |pos| { | |
| 408 | node.base.end = pos - 1; | |
| 409 | break :footer; | |
| 353 | 410 | } |
| 411 | return error.UnexpectedToken; | |
| 354 | 412 | } |
| 355 | 413 | |
| 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 }); | |
| 357 | 415 | |
| 358 | log.debug("Doc end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] }); | |
| 359 | ||
| 360 | return node; | |
| 416 | return &node.base; | |
| 361 | 417 | } |
| 362 | 418 | |
| 363 | fn map(self: *Parser, start: TokenIndex) ParseError!*Node.Map { | |
| 419 | fn map(self: *Parser) ParseError!*Node { | |
| 364 | 420 | const node = try self.allocator.create(Node.Map); |
| 365 | 421 | errdefer self.allocator.destroy(node); |
| 366 | node.* = .{ .start = start }; | |
| 422 | node.* = .{}; | |
| 367 | 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 | } | |
| 368 | 434 | |
| 369 | self.token_it.seekTo(start); | |
| 370 | ||
| 371 | log.debug("Map start: {}, {}", .{ start, self.tree.tokens[start] }); | |
| 435 | log.debug("(map) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start }); | |
| 372 | 436 | |
| 373 | const col = self.getCol(start); | |
| 437 | const col = self.getCol(node.base.start); | |
| 374 | 438 | |
| 375 | 439 | while (true) { |
| 376 | self.eatCommentsAndSpace(); | |
| 440 | self.eatCommentsAndSpace(&.{}); | |
| 377 | 441 | |
| 378 | // Parse key. | |
| 442 | // Parse key | |
| 379 | 443 | const key_pos = self.token_it.pos; |
| 380 | if (self.getCol(key_pos) != col) { | |
| 444 | if (self.getCol(key_pos) < col) { | |
| 381 | 445 | break; |
| 382 | 446 | } |
| 383 | 447 | |
| 384 | const key = self.token_it.next(); | |
| 448 | const key = self.token_it.next() orelse return error.UnexpectedEof; | |
| 385 | 449 | switch (key.id) { |
| 386 | .Literal => {}, | |
| 387 | else => { | |
| 450 | .literal => {}, | |
| 451 | .doc_start, .doc_end, .eof => { | |
| 388 | 452 | self.token_it.seekBy(-1); |
| 389 | 453 | break; |
| 390 | 454 | }, |
| 455 | else => { | |
| 456 | // TODO key not being a literal | |
| 457 | return error.Unhandled; | |
| 458 | }, | |
| 391 | 459 | } |
| 392 | 460 | |
| 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 }); | |
| 394 | 462 | |
| 395 | 463 | // Separator |
| 396 | _ = try self.expectToken(.MapValueInd); | |
| 397 | ||
| 398 | // Parse value. | |
| 399 | const value: *Node = value: { | |
| 400 | if (self.eatToken(.NewLine)) |_| { | |
| 401 | self.eatCommentsAndSpace(); | |
| 402 | ||
| 403 | // Explicit, complex value such as list or map. | |
| 404 | const value_pos = self.token_it.pos; | |
| 405 | const value = self.token_it.next(); | |
| 406 | switch (value.id) { | |
| 407 | .Literal, .SingleQuote, .DoubleQuote => { | |
| 408 | // Assume nested map. | |
| 409 | const map_node = try self.map(value_pos); | |
| 410 | break :value &map_node.base; | |
| 411 | }, | |
| 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 | }, | |
| 464 | _ = try self.expectToken(.map_value_ind, &.{ .new_line, .comment }); | |
| 465 | ||
| 466 | // Parse value | |
| 467 | const val = try self.value(); | |
| 468 | errdefer if (val) |v| { | |
| 469 | v.deinit(self.allocator); | |
| 470 | self.allocator.destroy(v); | |
| 471 | }; | |
| 472 | ||
| 473 | if (val) |v| { | |
| 474 | if (self.getCol(v.start) < self.getCol(key_pos)) { | |
| 475 | return error.MalformedYaml; | |
| 476 | } | |
| 477 | if (v.cast(Node.Value)) |_| { | |
| 478 | if (self.getCol(v.start) == self.getCol(key_pos)) { | |
| 479 | return error.MalformedYaml; | |
| 441 | 480 | } |
| 442 | 481 | } |
| 443 | }; | |
| 444 | log.debug("Map value: {}", .{value}); | |
| 482 | } | |
| 445 | 483 | |
| 446 | 484 | try node.values.append(self.allocator, .{ |
| 447 | 485 | .key = key_pos, |
| 448 | .value = value, | |
| 486 | .value = val, | |
| 449 | 487 | }); |
| 450 | ||
| 451 | _ = self.eatToken(.NewLine); | |
| 452 | 488 | } |
| 453 | 489 | |
| 454 | node.end = self.token_it.pos - 1; | |
| 490 | node.base.end = self.token_it.pos - 1; | |
| 455 | 491 | |
| 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 }); | |
| 457 | 493 | |
| 458 | return node; | |
| 494 | return &node.base; | |
| 459 | 495 | } |
| 460 | 496 | |
| 461 | fn list(self: *Parser, start: TokenIndex) ParseError!*Node.List { | |
| 497 | fn list(self: *Parser) ParseError!*Node { | |
| 462 | 498 | const node = try self.allocator.create(Node.List); |
| 463 | 499 | errdefer self.allocator.destroy(node); |
| 464 | node.* = .{ | |
| 465 | .start = start, | |
| 466 | }; | |
| 500 | node.* = .{}; | |
| 467 | 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 | } | |
| 468 | 510 | |
| 469 | self.token_it.seekTo(start); | |
| 470 | ||
| 471 | log.debug("List start: {}, {}", .{ start, self.tree.tokens[start] }); | |
| 472 | ||
| 473 | const col = self.getCol(start); | |
| 511 | log.debug("(list) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start }); | |
| 474 | 512 | |
| 475 | 513 | while (true) { |
| 476 | self.eatCommentsAndSpace(); | |
| 514 | self.eatCommentsAndSpace(&.{}); | |
| 477 | 515 | |
| 478 | if (self.getCol(self.token_it.pos) != col) { | |
| 479 | break; | |
| 480 | } | |
| 481 | _ = self.eatToken(.SeqItemInd) orelse { | |
| 482 | break; | |
| 483 | }; | |
| 516 | _ = self.eatToken(.seq_item_ind, &.{}) orelse break; | |
| 484 | 517 | |
| 485 | const pos = self.token_it.pos; | |
| 486 | const token = self.token_it.next(); | |
| 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); | |
| 518 | const val = (try self.value()) orelse return error.MalformedYaml; | |
| 519 | try node.values.append(self.allocator, val); | |
| 513 | 520 | } |
| 514 | 521 | |
| 515 | node.end = self.token_it.pos - 1; | |
| 522 | node.base.end = self.token_it.pos - 1; | |
| 516 | 523 | |
| 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 }); | |
| 518 | 525 | |
| 519 | return node; | |
| 526 | return &node.base; | |
| 520 | 527 | } |
| 521 | 528 | |
| 522 | fn list_bracketed(self: *Parser, start: TokenIndex) ParseError!*Node.List { | |
| 529 | fn list_bracketed(self: *Parser) ParseError!*Node { | |
| 523 | 530 | const node = try self.allocator.create(Node.List); |
| 524 | 531 | errdefer self.allocator.destroy(node); |
| 525 | node.* = .{ .start = start }; | |
| 532 | node.* = .{}; | |
| 526 | 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 | } | |
| 527 | 542 | |
| 528 | self.token_it.seekTo(start); | |
| 529 | ||
| 530 | log.debug("List start: {}, {}", .{ start, self.tree.tokens[start] }); | |
| 543 | log.debug("(list) begin {s}@{d}", .{ @tagName(self.tree.tokens[node.base.start].id), node.base.start }); | |
| 531 | 544 | |
| 532 | _ = try self.expectToken(.FlowSeqStart); | |
| 545 | _ = try self.expectToken(.flow_seq_start, &.{}); | |
| 533 | 546 | |
| 534 | 547 | while (true) { |
| 535 | _ = self.eatToken(.NewLine); | |
| 536 | self.eatCommentsAndSpace(); | |
| 548 | self.eatCommentsAndSpace(&.{.comment}); | |
| 537 | 549 | |
| 538 | const pos = self.token_it.pos; | |
| 539 | const token = self.token_it.next(); | |
| 540 | ||
| 541 | log.debug("Next token: {}, {}", .{ pos, token }); | |
| 550 | if (self.eatToken(.flow_seq_end, &.{.comment})) |pos| { | |
| 551 | node.base.end = pos; | |
| 552 | break; | |
| 553 | } | |
| 554 | _ = self.eatToken(.comma, &.{.comment}); | |
| 542 | 555 | |
| 543 | const value: *Node = value: { | |
| 544 | switch (token.id) { | |
| 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); | |
| 556 | const val = (try self.value()) orelse return error.MalformedYaml; | |
| 557 | try node.values.append(self.allocator, val); | |
| 565 | 558 | } |
| 566 | 559 | |
| 567 | node.end = self.token_it.pos - 1; | |
| 568 | ||
| 569 | log.debug("List end: {}, {}", .{ node.end.?, self.tree.tokens[node.end.?] }); | |
| 560 | log.debug("(list) end {s}@{d}", .{ @tagName(self.tree.tokens[node.base.end].id), node.base.end }); | |
| 570 | 561 | |
| 571 | return node; | |
| 562 | return &node.base; | |
| 572 | 563 | } |
| 573 | 564 | |
| 574 | fn leaf_value(self: *Parser, start: TokenIndex) ParseError!*Node.Value { | |
| 565 | fn leaf_value(self: *Parser) ParseError!*Node { | |
| 575 | 566 | const node = try self.allocator.create(Node.Value); |
| 576 | 567 | errdefer self.allocator.destroy(node); |
| 577 | node.* = .{ .start = start }; | |
| 568 | node.* = .{ .string_value = .{} }; | |
| 578 | 569 | node.base.tree = self.tree; |
| 579 | ||
| 580 | self.token_it.seekTo(start); | |
| 581 | ||
| 582 | log.debug("Leaf start: {}, {}", .{ node.start.?, self.tree.tokens[node.start.?] }); | |
| 583 | ||
| 584 | parse: { | |
| 585 | if (self.eatToken(.SingleQuote)) |_| { | |
| 586 | node.start = node.start.? + 1; | |
| 587 | while (true) { | |
| 588 | const tok = self.token_it.next(); | |
| 589 | switch (tok.id) { | |
| 590 | .SingleQuote => { | |
| 591 | node.end = self.token_it.pos - 2; | |
| 592 | break :parse; | |
| 593 | }, | |
| 594 | .NewLine => return error.UnexpectedToken, | |
| 595 | else => {}, | |
| 596 | } | |
| 597 | } | |
| 598 | } | |
| 599 | ||
| 600 | if (self.eatToken(.DoubleQuote)) |_| { | |
| 601 | node.start = node.start.? + 1; | |
| 602 | while (true) { | |
| 603 | const tok = self.token_it.next(); | |
| 604 | switch (tok.id) { | |
| 605 | .DoubleQuote => { | |
| 606 | node.end = self.token_it.pos - 2; | |
| 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 | } | |
| 570 | node.base.start = self.token_it.pos; | |
| 571 | errdefer node.string_value.deinit(self.allocator); | |
| 572 | ||
| 573 | // TODO handle multiline strings in new block scope | |
| 574 | while (self.token_it.next()) |tok| { | |
| 575 | switch (tok.id) { | |
| 576 | .single_quoted => { | |
| 577 | node.base.end = self.token_it.pos - 1; | |
| 578 | const raw = self.tree.getRaw(node.base.start, node.base.end); | |
| 579 | try self.parseSingleQuoted(node, raw); | |
| 580 | break; | |
| 581 | }, | |
| 582 | .double_quoted => { | |
| 583 | node.base.end = self.token_it.pos - 1; | |
| 584 | const raw = self.tree.getRaw(node.base.start, node.base.end); | |
| 585 | try self.parseDoubleQuoted(node, raw); | |
| 586 | break; | |
| 587 | }, | |
| 588 | .literal => {}, | |
| 589 | .space => { | |
| 590 | const trailing = self.token_it.pos - 2; | |
| 591 | self.eatCommentsAndSpace(&.{}); | |
| 592 | if (self.token_it.peek()) |peek| { | |
| 593 | if (peek.id != .literal) { | |
| 594 | node.base.end = trailing; | |
| 595 | const raw = self.tree.getRaw(node.base.start, node.base.end); | |
| 596 | try node.string_value.appendSlice(self.allocator, raw); | |
| 597 | break; | |
| 628 | 598 | } |
| 629 | }, | |
| 630 | else => { | |
| 631 | self.token_it.seekBy(-1); | |
| 632 | node.end = self.token_it.pos - 1; | |
| 633 | break; | |
| 634 | }, | |
| 635 | } | |
| 599 | } | |
| 600 | }, | |
| 601 | else => { | |
| 602 | self.token_it.seekBy(-1); | |
| 603 | node.base.end = self.token_it.pos - 1; | |
| 604 | const raw = self.tree.getRaw(node.base.start, node.base.end); | |
| 605 | try node.string_value.appendSlice(self.allocator, raw); | |
| 606 | break; | |
| 607 | }, | |
| 636 | 608 | } |
| 637 | 609 | } |
| 638 | 610 | |
| 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)}); | |
| 640 | 612 | |
| 641 | return node; | |
| 613 | return &node.base; | |
| 642 | 614 | } |
| 643 | 615 | |
| 644 | fn eatCommentsAndSpace(self: *Parser) void { | |
| 645 | while (true) { | |
| 646 | _ = self.token_it.peek() orelse return; | |
| 647 | const token = self.token_it.next(); | |
| 616 | fn eatCommentsAndSpace(self: *Parser, comptime exclusions: []const Token.Id) void { | |
| 617 | log.debug("eatCommentsAndSpace", .{}); | |
| 618 | outer: while (self.token_it.next()) |token| { | |
| 619 | log.debug(" (token '{s}')", .{@tagName(token.id)}); | |
| 648 | 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 | 629 | else => { |
| 651 | 630 | self.token_it.seekBy(-1); |
| 652 | 631 | break; |
| ... | ... | @@ -655,25 +634,24 @@ const Parser = struct { |
| 655 | 634 | } |
| 656 | 635 | } |
| 657 | 636 | |
| 658 | fn eatToken(self: *Parser, id: Token.Id) ?TokenIndex { | |
| 659 | while (true) { | |
| 660 | const pos = self.token_it.pos; | |
| 661 | _ = self.token_it.peek() orelse return null; | |
| 662 | const token = self.token_it.next(); | |
| 663 | switch (token.id) { | |
| 664 | .Comment, .Space => continue, | |
| 665 | else => |next_id| if (next_id == id) { | |
| 666 | return pos; | |
| 667 | } else { | |
| 668 | self.token_it.seekTo(pos); | |
| 669 | return null; | |
| 670 | }, | |
| 671 | } | |
| 637 | fn eatToken(self: *Parser, id: Token.Id, comptime exclusions: []const Token.Id) ?TokenIndex { | |
| 638 | log.debug("eatToken('{s}')", .{@tagName(id)}); | |
| 639 | self.eatCommentsAndSpace(exclusions); | |
| 640 | const pos = self.token_it.pos; | |
| 641 | const token = self.token_it.next() orelse return null; | |
| 642 | if (token.id == id) { | |
| 643 | log.debug(" (found at {d})", .{pos}); | |
| 644 | return pos; | |
| 645 | } else { | |
| 646 | log.debug(" (not found)", .{}); | |
| 647 | self.token_it.seekBy(-1); | |
| 648 | return null; | |
| 672 | 649 | } |
| 673 | 650 | } |
| 674 | 651 | |
| 675 | fn expectToken(self: *Parser, id: Token.Id) ParseError!TokenIndex { | |
| 676 | return self.eatToken(id) orelse error.UnexpectedToken; | |
| 652 | fn expectToken(self: *Parser, id: Token.Id, comptime exclusions: []const Token.Id) ParseError!TokenIndex { | |
| 653 | log.debug("expectToken('{s}')", .{@tagName(id)}); | |
| 654 | return self.eatToken(id, exclusions) orelse error.UnexpectedToken; | |
| 677 | 655 | } |
| 678 | 656 | |
| 679 | 657 | fn getLine(self: *Parser, index: TokenIndex) usize { |
| ... | ... | @@ -683,8 +661,85 @@ const Parser = struct { |
| 683 | 661 | fn getCol(self: *Parser, index: TokenIndex) usize { |
| 684 | 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 | }; |
| 687 | 741 | |
| 688 | 742 | test { |
| 743 | std.testing.refAllDecls(@This()); | |
| 689 | 744 | _ = @import("parse/test.zig"); |
| 690 | 745 | } |
src/link/tapi/parse/test.zig+385-179| ... | ... | @@ -21,45 +21,45 @@ test "explicit doc" { |
| 21 | 21 | try testing.expectEqual(tree.docs.items.len, 1); |
| 22 | 22 | |
| 23 | 23 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 24 | try testing.expectEqual(doc.start.?, 0); | |
| 25 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 24 | try testing.expectEqual(doc.base.start, 0); | |
| 25 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 26 | 26 | |
| 27 | 27 | const directive = tree.tokens[doc.directive.?]; |
| 28 | try testing.expectEqual(directive.id, .Literal); | |
| 29 | try testing.expect(mem.eql(u8, "tapi-tbd", tree.source[directive.start..directive.end])); | |
| 28 | try testing.expectEqual(directive.id, .literal); | |
| 29 | try testing.expectEqualStrings("tapi-tbd", tree.source[directive.start..directive.end]); | |
| 30 | 30 | |
| 31 | 31 | try testing.expect(doc.value != null); |
| 32 | 32 | try testing.expectEqual(doc.value.?.tag, .map); |
| 33 | 33 | |
| 34 | 34 | const map = doc.value.?.cast(Node.Map).?; |
| 35 | try testing.expectEqual(map.start.?, 5); | |
| 36 | try testing.expectEqual(map.end.?, 14); | |
| 35 | try testing.expectEqual(map.base.start, 5); | |
| 36 | try testing.expectEqual(map.base.end, 14); | |
| 37 | 37 | try testing.expectEqual(map.values.items.len, 2); |
| 38 | 38 | |
| 39 | 39 | { |
| 40 | 40 | const entry = map.values.items[0]; |
| 41 | 41 | |
| 42 | 42 | const key = tree.tokens[entry.key]; |
| 43 | try testing.expectEqual(key.id, .Literal); | |
| 44 | try testing.expect(mem.eql(u8, "tbd-version", tree.source[key.start..key.end])); | |
| 43 | try testing.expectEqual(key.id, .literal); | |
| 44 | try testing.expectEqualStrings("tbd-version", tree.source[key.start..key.end]); | |
| 45 | 45 | |
| 46 | const value = entry.value.cast(Node.Value).?; | |
| 47 | const value_tok = tree.tokens[value.start.?]; | |
| 48 | try testing.expectEqual(value_tok.id, .Literal); | |
| 49 | try testing.expect(mem.eql(u8, "4", tree.source[value_tok.start..value_tok.end])); | |
| 46 | const value = entry.value.?.cast(Node.Value).?; | |
| 47 | const value_tok = tree.tokens[value.base.start]; | |
| 48 | try testing.expectEqual(value_tok.id, .literal); | |
| 49 | try testing.expectEqualStrings("4", tree.source[value_tok.start..value_tok.end]); | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | { |
| 53 | 53 | const entry = map.values.items[1]; |
| 54 | 54 | |
| 55 | 55 | const key = tree.tokens[entry.key]; |
| 56 | try testing.expectEqual(key.id, .Literal); | |
| 57 | try testing.expect(mem.eql(u8, "abc-version", tree.source[key.start..key.end])); | |
| 56 | try testing.expectEqual(key.id, .literal); | |
| 57 | try testing.expectEqualStrings("abc-version", tree.source[key.start..key.end]); | |
| 58 | 58 | |
| 59 | const value = entry.value.cast(Node.Value).?; | |
| 60 | const value_tok = tree.tokens[value.start.?]; | |
| 61 | try testing.expectEqual(value_tok.id, .Literal); | |
| 62 | try testing.expect(mem.eql(u8, "5", tree.source[value_tok.start..value_tok.end])); | |
| 59 | const value = entry.value.?.cast(Node.Value).?; | |
| 60 | const value_tok = tree.tokens[value.base.start]; | |
| 61 | try testing.expectEqual(value_tok.id, .literal); | |
| 62 | try testing.expectEqualStrings("5", tree.source[value_tok.start..value_tok.end]); | |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| ... | ... | @@ -77,39 +77,31 @@ test "leaf in quotes" { |
| 77 | 77 | try testing.expectEqual(tree.docs.items.len, 1); |
| 78 | 78 | |
| 79 | 79 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 80 | try testing.expectEqual(doc.start.?, 0); | |
| 81 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 80 | try testing.expectEqual(doc.base.start, 0); | |
| 81 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 82 | 82 | try testing.expect(doc.directive == null); |
| 83 | 83 | |
| 84 | 84 | try testing.expect(doc.value != null); |
| 85 | 85 | try testing.expectEqual(doc.value.?.tag, .map); |
| 86 | 86 | |
| 87 | 87 | const map = doc.value.?.cast(Node.Map).?; |
| 88 | try testing.expectEqual(map.start.?, 0); | |
| 89 | try testing.expectEqual(map.end.?, tree.tokens.len - 2); | |
| 88 | try testing.expectEqual(map.base.start, 0); | |
| 89 | try testing.expectEqual(map.base.end, tree.tokens.len - 2); | |
| 90 | 90 | try testing.expectEqual(map.values.items.len, 3); |
| 91 | 91 | |
| 92 | 92 | { |
| 93 | 93 | const entry = map.values.items[0]; |
| 94 | 94 | |
| 95 | 95 | const key = tree.tokens[entry.key]; |
| 96 | try testing.expectEqual(key.id, .Literal); | |
| 97 | try testing.expect(mem.eql( | |
| 98 | u8, | |
| 99 | "key1", | |
| 100 | tree.source[key.start..key.end], | |
| 101 | )); | |
| 102 | ||
| 103 | const value = entry.value.cast(Node.Value).?; | |
| 104 | const start = tree.tokens[value.start.?]; | |
| 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 | )); | |
| 96 | try testing.expectEqual(key.id, .literal); | |
| 97 | try testing.expectEqualStrings("key1", tree.source[key.start..key.end]); | |
| 98 | ||
| 99 | const value = entry.value.?.cast(Node.Value).?; | |
| 100 | const start = tree.tokens[value.base.start]; | |
| 101 | const end = tree.tokens[value.base.end]; | |
| 102 | try testing.expectEqual(start.id, .literal); | |
| 103 | try testing.expectEqual(end.id, .literal); | |
| 104 | try testing.expectEqualStrings("no quotes", tree.source[start.start..end.end]); | |
| 113 | 105 | } |
| 114 | 106 | } |
| 115 | 107 | |
| ... | ... | @@ -128,70 +120,60 @@ test "nested maps" { |
| 128 | 120 | try testing.expectEqual(tree.docs.items.len, 1); |
| 129 | 121 | |
| 130 | 122 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 131 | try testing.expectEqual(doc.start.?, 0); | |
| 132 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 123 | try testing.expectEqual(doc.base.start, 0); | |
| 124 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 133 | 125 | try testing.expect(doc.directive == null); |
| 134 | 126 | |
| 135 | 127 | try testing.expect(doc.value != null); |
| 136 | 128 | try testing.expectEqual(doc.value.?.tag, .map); |
| 137 | 129 | |
| 138 | 130 | const map = doc.value.?.cast(Node.Map).?; |
| 139 | try testing.expectEqual(map.start.?, 0); | |
| 140 | try testing.expectEqual(map.end.?, tree.tokens.len - 2); | |
| 131 | try testing.expectEqual(map.base.start, 0); | |
| 132 | try testing.expectEqual(map.base.end, tree.tokens.len - 2); | |
| 141 | 133 | try testing.expectEqual(map.values.items.len, 2); |
| 142 | 134 | |
| 143 | 135 | { |
| 144 | 136 | const entry = map.values.items[0]; |
| 145 | 137 | |
| 146 | 138 | const key = tree.tokens[entry.key]; |
| 147 | try testing.expectEqual(key.id, .Literal); | |
| 148 | try testing.expect(mem.eql(u8, "key1", tree.source[key.start..key.end])); | |
| 139 | try testing.expectEqual(key.id, .literal); | |
| 140 | try testing.expectEqualStrings("key1", tree.source[key.start..key.end]); | |
| 149 | 141 | |
| 150 | const nested_map = entry.value.cast(Node.Map).?; | |
| 151 | try testing.expectEqual(nested_map.start.?, 4); | |
| 152 | try testing.expectEqual(nested_map.end.?, 16); | |
| 142 | const nested_map = entry.value.?.cast(Node.Map).?; | |
| 143 | try testing.expectEqual(nested_map.base.start, 4); | |
| 144 | try testing.expectEqual(nested_map.base.end, 16); | |
| 153 | 145 | try testing.expectEqual(nested_map.values.items.len, 2); |
| 154 | 146 | |
| 155 | 147 | { |
| 156 | 148 | const nested_entry = nested_map.values.items[0]; |
| 157 | 149 | |
| 158 | 150 | const nested_key = tree.tokens[nested_entry.key]; |
| 159 | try testing.expectEqual(nested_key.id, .Literal); | |
| 160 | try testing.expect(mem.eql( | |
| 161 | u8, | |
| 162 | "key1_1", | |
| 163 | tree.source[nested_key.start..nested_key.end], | |
| 164 | )); | |
| 165 | ||
| 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, | |
| 151 | try testing.expectEqual(nested_key.id, .literal); | |
| 152 | try testing.expectEqualStrings("key1_1", tree.source[nested_key.start..nested_key.end]); | |
| 153 | ||
| 154 | const nested_value = nested_entry.value.?.cast(Node.Value).?; | |
| 155 | const nested_value_tok = tree.tokens[nested_value.base.start]; | |
| 156 | try testing.expectEqual(nested_value_tok.id, .literal); | |
| 157 | try testing.expectEqualStrings( | |
| 171 | 158 | "value1_1", |
| 172 | 159 | tree.source[nested_value_tok.start..nested_value_tok.end], |
| 173 | )); | |
| 160 | ); | |
| 174 | 161 | } |
| 175 | 162 | |
| 176 | 163 | { |
| 177 | 164 | const nested_entry = nested_map.values.items[1]; |
| 178 | 165 | |
| 179 | 166 | const nested_key = tree.tokens[nested_entry.key]; |
| 180 | try testing.expectEqual(nested_key.id, .Literal); | |
| 181 | try testing.expect(mem.eql( | |
| 182 | u8, | |
| 183 | "key1_2", | |
| 184 | tree.source[nested_key.start..nested_key.end], | |
| 185 | )); | |
| 186 | ||
| 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, | |
| 167 | try testing.expectEqual(nested_key.id, .literal); | |
| 168 | try testing.expectEqualStrings("key1_2", tree.source[nested_key.start..nested_key.end]); | |
| 169 | ||
| 170 | const nested_value = nested_entry.value.?.cast(Node.Value).?; | |
| 171 | const nested_value_tok = tree.tokens[nested_value.base.start]; | |
| 172 | try testing.expectEqual(nested_value_tok.id, .literal); | |
| 173 | try testing.expectEqualStrings( | |
| 192 | 174 | "value1_2", |
| 193 | 175 | tree.source[nested_value_tok.start..nested_value_tok.end], |
| 194 | )); | |
| 176 | ); | |
| 195 | 177 | } |
| 196 | 178 | } |
| 197 | 179 | |
| ... | ... | @@ -199,17 +181,13 @@ test "nested maps" { |
| 199 | 181 | const entry = map.values.items[1]; |
| 200 | 182 | |
| 201 | 183 | const key = tree.tokens[entry.key]; |
| 202 | try testing.expectEqual(key.id, .Literal); | |
| 203 | try testing.expect(mem.eql(u8, "key2", tree.source[key.start..key.end])); | |
| 204 | ||
| 205 | const value = entry.value.cast(Node.Value).?; | |
| 206 | const value_tok = tree.tokens[value.start.?]; | |
| 207 | try testing.expectEqual(value_tok.id, .Literal); | |
| 208 | try testing.expect(mem.eql( | |
| 209 | u8, | |
| 210 | "value2", | |
| 211 | tree.source[value_tok.start..value_tok.end], | |
| 212 | )); | |
| 184 | try testing.expectEqual(key.id, .literal); | |
| 185 | try testing.expectEqualStrings("key2", tree.source[key.start..key.end]); | |
| 186 | ||
| 187 | const value = entry.value.?.cast(Node.Value).?; | |
| 188 | const value_tok = tree.tokens[value.base.start]; | |
| 189 | try testing.expectEqual(value_tok.id, .literal); | |
| 190 | try testing.expectEqualStrings("value2", tree.source[value_tok.start..value_tok.end]); | |
| 213 | 191 | } |
| 214 | 192 | } |
| 215 | 193 | |
| ... | ... | @@ -227,46 +205,46 @@ test "map of list of values" { |
| 227 | 205 | try testing.expectEqual(tree.docs.items.len, 1); |
| 228 | 206 | |
| 229 | 207 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 230 | try testing.expectEqual(doc.start.?, 0); | |
| 231 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 208 | try testing.expectEqual(doc.base.start, 0); | |
| 209 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 232 | 210 | |
| 233 | 211 | try testing.expect(doc.value != null); |
| 234 | 212 | try testing.expectEqual(doc.value.?.tag, .map); |
| 235 | 213 | |
| 236 | 214 | const map = doc.value.?.cast(Node.Map).?; |
| 237 | try testing.expectEqual(map.start.?, 0); | |
| 238 | try testing.expectEqual(map.end.?, tree.tokens.len - 2); | |
| 215 | try testing.expectEqual(map.base.start, 0); | |
| 216 | try testing.expectEqual(map.base.end, tree.tokens.len - 2); | |
| 239 | 217 | try testing.expectEqual(map.values.items.len, 1); |
| 240 | 218 | |
| 241 | 219 | const entry = map.values.items[0]; |
| 242 | 220 | const key = tree.tokens[entry.key]; |
| 243 | try testing.expectEqual(key.id, .Literal); | |
| 244 | try testing.expect(mem.eql(u8, "ints", tree.source[key.start..key.end])); | |
| 221 | try testing.expectEqual(key.id, .literal); | |
| 222 | try testing.expectEqualStrings("ints", tree.source[key.start..key.end]); | |
| 245 | 223 | |
| 246 | const value = entry.value.cast(Node.List).?; | |
| 247 | try testing.expectEqual(value.start.?, 4); | |
| 248 | try testing.expectEqual(value.end.?, tree.tokens.len - 2); | |
| 224 | const value = entry.value.?.cast(Node.List).?; | |
| 225 | try testing.expectEqual(value.base.start, 4); | |
| 226 | try testing.expectEqual(value.base.end, tree.tokens.len - 2); | |
| 249 | 227 | try testing.expectEqual(value.values.items.len, 3); |
| 250 | 228 | |
| 251 | 229 | { |
| 252 | 230 | const elem = value.values.items[0].cast(Node.Value).?; |
| 253 | const leaf = tree.tokens[elem.start.?]; | |
| 254 | try testing.expectEqual(leaf.id, .Literal); | |
| 255 | try testing.expect(mem.eql(u8, "0", tree.source[leaf.start..leaf.end])); | |
| 231 | const leaf = tree.tokens[elem.base.start]; | |
| 232 | try testing.expectEqual(leaf.id, .literal); | |
| 233 | try testing.expectEqualStrings("0", tree.source[leaf.start..leaf.end]); | |
| 256 | 234 | } |
| 257 | 235 | |
| 258 | 236 | { |
| 259 | 237 | const elem = value.values.items[1].cast(Node.Value).?; |
| 260 | const leaf = tree.tokens[elem.start.?]; | |
| 261 | try testing.expectEqual(leaf.id, .Literal); | |
| 262 | try testing.expect(mem.eql(u8, "1", tree.source[leaf.start..leaf.end])); | |
| 238 | const leaf = tree.tokens[elem.base.start]; | |
| 239 | try testing.expectEqual(leaf.id, .literal); | |
| 240 | try testing.expectEqualStrings("1", tree.source[leaf.start..leaf.end]); | |
| 263 | 241 | } |
| 264 | 242 | |
| 265 | 243 | { |
| 266 | 244 | const elem = value.values.items[2].cast(Node.Value).?; |
| 267 | const leaf = tree.tokens[elem.start.?]; | |
| 268 | try testing.expectEqual(leaf.id, .Literal); | |
| 269 | try testing.expect(mem.eql(u8, "2", tree.source[leaf.start..leaf.end])); | |
| 245 | const leaf = tree.tokens[elem.base.start]; | |
| 246 | try testing.expectEqual(leaf.id, .literal); | |
| 247 | try testing.expectEqualStrings("2", tree.source[leaf.start..leaf.end]); | |
| 270 | 248 | } |
| 271 | 249 | } |
| 272 | 250 | |
| ... | ... | @@ -285,64 +263,64 @@ test "map of list of maps" { |
| 285 | 263 | try testing.expectEqual(tree.docs.items.len, 1); |
| 286 | 264 | |
| 287 | 265 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 288 | try testing.expectEqual(doc.start.?, 0); | |
| 289 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 266 | try testing.expectEqual(doc.base.start, 0); | |
| 267 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 290 | 268 | |
| 291 | 269 | try testing.expect(doc.value != null); |
| 292 | 270 | try testing.expectEqual(doc.value.?.tag, .map); |
| 293 | 271 | |
| 294 | 272 | const map = doc.value.?.cast(Node.Map).?; |
| 295 | try testing.expectEqual(map.start.?, 0); | |
| 296 | try testing.expectEqual(map.end.?, tree.tokens.len - 2); | |
| 273 | try testing.expectEqual(map.base.start, 0); | |
| 274 | try testing.expectEqual(map.base.end, tree.tokens.len - 2); | |
| 297 | 275 | try testing.expectEqual(map.values.items.len, 1); |
| 298 | 276 | |
| 299 | 277 | const entry = map.values.items[0]; |
| 300 | 278 | const key = tree.tokens[entry.key]; |
| 301 | try testing.expectEqual(key.id, .Literal); | |
| 302 | try testing.expect(mem.eql(u8, "key1", tree.source[key.start..key.end])); | |
| 279 | try testing.expectEqual(key.id, .literal); | |
| 280 | try testing.expectEqualStrings("key1", tree.source[key.start..key.end]); | |
| 303 | 281 | |
| 304 | const value = entry.value.cast(Node.List).?; | |
| 305 | try testing.expectEqual(value.start.?, 3); | |
| 306 | try testing.expectEqual(value.end.?, tree.tokens.len - 2); | |
| 282 | const value = entry.value.?.cast(Node.List).?; | |
| 283 | try testing.expectEqual(value.base.start, 3); | |
| 284 | try testing.expectEqual(value.base.end, tree.tokens.len - 2); | |
| 307 | 285 | try testing.expectEqual(value.values.items.len, 3); |
| 308 | 286 | |
| 309 | 287 | { |
| 310 | 288 | const elem = value.values.items[0].cast(Node.Map).?; |
| 311 | 289 | const nested = elem.values.items[0]; |
| 312 | 290 | const nested_key = tree.tokens[nested.key]; |
| 313 | try testing.expectEqual(nested_key.id, .Literal); | |
| 314 | try testing.expect(mem.eql(u8, "key2", tree.source[nested_key.start..nested_key.end])); | |
| 291 | try testing.expectEqual(nested_key.id, .literal); | |
| 292 | try testing.expectEqualStrings("key2", tree.source[nested_key.start..nested_key.end]); | |
| 315 | 293 | |
| 316 | const nested_v = nested.value.cast(Node.Value).?; | |
| 317 | const leaf = tree.tokens[nested_v.start.?]; | |
| 318 | try testing.expectEqual(leaf.id, .Literal); | |
| 319 | try testing.expect(mem.eql(u8, "value2", tree.source[leaf.start..leaf.end])); | |
| 294 | const nested_v = nested.value.?.cast(Node.Value).?; | |
| 295 | const leaf = tree.tokens[nested_v.base.start]; | |
| 296 | try testing.expectEqual(leaf.id, .literal); | |
| 297 | try testing.expectEqualStrings("value2", tree.source[leaf.start..leaf.end]); | |
| 320 | 298 | } |
| 321 | 299 | |
| 322 | 300 | { |
| 323 | 301 | const elem = value.values.items[1].cast(Node.Map).?; |
| 324 | 302 | const nested = elem.values.items[0]; |
| 325 | 303 | const nested_key = tree.tokens[nested.key]; |
| 326 | try testing.expectEqual(nested_key.id, .Literal); | |
| 327 | try testing.expect(mem.eql(u8, "key3", tree.source[nested_key.start..nested_key.end])); | |
| 304 | try testing.expectEqual(nested_key.id, .literal); | |
| 305 | try testing.expectEqualStrings("key3", tree.source[nested_key.start..nested_key.end]); | |
| 328 | 306 | |
| 329 | const nested_v = nested.value.cast(Node.Value).?; | |
| 330 | const leaf = tree.tokens[nested_v.start.?]; | |
| 331 | try testing.expectEqual(leaf.id, .Literal); | |
| 332 | try testing.expect(mem.eql(u8, "value3", tree.source[leaf.start..leaf.end])); | |
| 307 | const nested_v = nested.value.?.cast(Node.Value).?; | |
| 308 | const leaf = tree.tokens[nested_v.base.start]; | |
| 309 | try testing.expectEqual(leaf.id, .literal); | |
| 310 | try testing.expectEqualStrings("value3", tree.source[leaf.start..leaf.end]); | |
| 333 | 311 | } |
| 334 | 312 | |
| 335 | 313 | { |
| 336 | 314 | const elem = value.values.items[2].cast(Node.Map).?; |
| 337 | 315 | const nested = elem.values.items[0]; |
| 338 | 316 | const nested_key = tree.tokens[nested.key]; |
| 339 | try testing.expectEqual(nested_key.id, .Literal); | |
| 340 | try testing.expect(mem.eql(u8, "key4", tree.source[nested_key.start..nested_key.end])); | |
| 317 | try testing.expectEqual(nested_key.id, .literal); | |
| 318 | try testing.expectEqualStrings("key4", tree.source[nested_key.start..nested_key.end]); | |
| 341 | 319 | |
| 342 | const nested_v = nested.value.cast(Node.Value).?; | |
| 343 | const leaf = tree.tokens[nested_v.start.?]; | |
| 344 | try testing.expectEqual(leaf.id, .Literal); | |
| 345 | try testing.expect(mem.eql(u8, "value4", tree.source[leaf.start..leaf.end])); | |
| 320 | const nested_v = nested.value.?.cast(Node.Value).?; | |
| 321 | const leaf = tree.tokens[nested_v.base.start]; | |
| 322 | try testing.expectEqual(leaf.id, .literal); | |
| 323 | try testing.expectEqualStrings("value4", tree.source[leaf.start..leaf.end]); | |
| 346 | 324 | } |
| 347 | 325 | } |
| 348 | 326 | |
| ... | ... | @@ -360,15 +338,15 @@ test "list of lists" { |
| 360 | 338 | try testing.expectEqual(tree.docs.items.len, 1); |
| 361 | 339 | |
| 362 | 340 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 363 | try testing.expectEqual(doc.start.?, 0); | |
| 364 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 341 | try testing.expectEqual(doc.base.start, 0); | |
| 342 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 365 | 343 | |
| 366 | 344 | try testing.expect(doc.value != null); |
| 367 | 345 | try testing.expectEqual(doc.value.?.tag, .list); |
| 368 | 346 | |
| 369 | 347 | const list = doc.value.?.cast(Node.List).?; |
| 370 | try testing.expectEqual(list.start.?, 0); | |
| 371 | try testing.expectEqual(list.end.?, tree.tokens.len - 2); | |
| 348 | try testing.expectEqual(list.base.start, 0); | |
| 349 | try testing.expectEqual(list.base.end, tree.tokens.len - 2); | |
| 372 | 350 | try testing.expectEqual(list.values.items.len, 3); |
| 373 | 351 | |
| 374 | 352 | { |
| ... | ... | @@ -379,22 +357,22 @@ test "list of lists" { |
| 379 | 357 | { |
| 380 | 358 | try testing.expectEqual(nested.values.items[0].tag, .value); |
| 381 | 359 | const value = nested.values.items[0].cast(Node.Value).?; |
| 382 | const leaf = tree.tokens[value.start.?]; | |
| 383 | try testing.expect(mem.eql(u8, "name", tree.source[leaf.start..leaf.end])); | |
| 360 | const leaf = tree.tokens[value.base.start]; | |
| 361 | try testing.expectEqualStrings("name", tree.source[leaf.start..leaf.end]); | |
| 384 | 362 | } |
| 385 | 363 | |
| 386 | 364 | { |
| 387 | 365 | try testing.expectEqual(nested.values.items[1].tag, .value); |
| 388 | 366 | const value = nested.values.items[1].cast(Node.Value).?; |
| 389 | const leaf = tree.tokens[value.start.?]; | |
| 390 | try testing.expect(mem.eql(u8, "hr", tree.source[leaf.start..leaf.end])); | |
| 367 | const leaf = tree.tokens[value.base.start]; | |
| 368 | try testing.expectEqualStrings("hr", tree.source[leaf.start..leaf.end]); | |
| 391 | 369 | } |
| 392 | 370 | |
| 393 | 371 | { |
| 394 | 372 | try testing.expectEqual(nested.values.items[2].tag, .value); |
| 395 | 373 | const value = nested.values.items[2].cast(Node.Value).?; |
| 396 | const leaf = tree.tokens[value.start.?]; | |
| 397 | try testing.expect(mem.eql(u8, "avg", tree.source[leaf.start..leaf.end])); | |
| 374 | const leaf = tree.tokens[value.base.start]; | |
| 375 | try testing.expectEqualStrings("avg", tree.source[leaf.start..leaf.end]); | |
| 398 | 376 | } |
| 399 | 377 | } |
| 400 | 378 | |
| ... | ... | @@ -406,23 +384,23 @@ test "list of lists" { |
| 406 | 384 | { |
| 407 | 385 | try testing.expectEqual(nested.values.items[0].tag, .value); |
| 408 | 386 | const value = nested.values.items[0].cast(Node.Value).?; |
| 409 | const start = tree.tokens[value.start.?]; | |
| 410 | const end = tree.tokens[value.end.?]; | |
| 411 | try testing.expect(mem.eql(u8, "Mark McGwire", tree.source[start.start..end.end])); | |
| 387 | const start = tree.tokens[value.base.start]; | |
| 388 | const end = tree.tokens[value.base.end]; | |
| 389 | try testing.expectEqualStrings("Mark McGwire", tree.source[start.start..end.end]); | |
| 412 | 390 | } |
| 413 | 391 | |
| 414 | 392 | { |
| 415 | 393 | try testing.expectEqual(nested.values.items[1].tag, .value); |
| 416 | 394 | const value = nested.values.items[1].cast(Node.Value).?; |
| 417 | const leaf = tree.tokens[value.start.?]; | |
| 418 | try testing.expect(mem.eql(u8, "65", tree.source[leaf.start..leaf.end])); | |
| 395 | const leaf = tree.tokens[value.base.start]; | |
| 396 | try testing.expectEqualStrings("65", tree.source[leaf.start..leaf.end]); | |
| 419 | 397 | } |
| 420 | 398 | |
| 421 | 399 | { |
| 422 | 400 | try testing.expectEqual(nested.values.items[2].tag, .value); |
| 423 | 401 | const value = nested.values.items[2].cast(Node.Value).?; |
| 424 | const leaf = tree.tokens[value.start.?]; | |
| 425 | try testing.expect(mem.eql(u8, "0.278", tree.source[leaf.start..leaf.end])); | |
| 402 | const leaf = tree.tokens[value.base.start]; | |
| 403 | try testing.expectEqualStrings("0.278", tree.source[leaf.start..leaf.end]); | |
| 426 | 404 | } |
| 427 | 405 | } |
| 428 | 406 | |
| ... | ... | @@ -434,23 +412,23 @@ test "list of lists" { |
| 434 | 412 | { |
| 435 | 413 | try testing.expectEqual(nested.values.items[0].tag, .value); |
| 436 | 414 | const value = nested.values.items[0].cast(Node.Value).?; |
| 437 | const start = tree.tokens[value.start.?]; | |
| 438 | const end = tree.tokens[value.end.?]; | |
| 439 | try testing.expect(mem.eql(u8, "Sammy Sosa", tree.source[start.start..end.end])); | |
| 415 | const start = tree.tokens[value.base.start]; | |
| 416 | const end = tree.tokens[value.base.end]; | |
| 417 | try testing.expectEqualStrings("Sammy Sosa", tree.source[start.start..end.end]); | |
| 440 | 418 | } |
| 441 | 419 | |
| 442 | 420 | { |
| 443 | 421 | try testing.expectEqual(nested.values.items[1].tag, .value); |
| 444 | 422 | const value = nested.values.items[1].cast(Node.Value).?; |
| 445 | const leaf = tree.tokens[value.start.?]; | |
| 446 | try testing.expect(mem.eql(u8, "63", tree.source[leaf.start..leaf.end])); | |
| 423 | const leaf = tree.tokens[value.base.start]; | |
| 424 | try testing.expectEqualStrings("63", tree.source[leaf.start..leaf.end]); | |
| 447 | 425 | } |
| 448 | 426 | |
| 449 | 427 | { |
| 450 | 428 | try testing.expectEqual(nested.values.items[2].tag, .value); |
| 451 | 429 | const value = nested.values.items[2].cast(Node.Value).?; |
| 452 | const leaf = tree.tokens[value.start.?]; | |
| 453 | try testing.expect(mem.eql(u8, "0.288", tree.source[leaf.start..leaf.end])); | |
| 430 | const leaf = tree.tokens[value.base.start]; | |
| 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 | 445 | try testing.expectEqual(tree.docs.items.len, 1); |
| 468 | 446 | |
| 469 | 447 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 470 | try testing.expectEqual(doc.start.?, 0); | |
| 471 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 448 | try testing.expectEqual(doc.base.start, 0); | |
| 449 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 472 | 450 | |
| 473 | 451 | try testing.expect(doc.value != null); |
| 474 | 452 | try testing.expectEqual(doc.value.?.tag, .list); |
| 475 | 453 | |
| 476 | 454 | const list = doc.value.?.cast(Node.List).?; |
| 477 | try testing.expectEqual(list.start.?, 0); | |
| 478 | try testing.expectEqual(list.end.?, tree.tokens.len - 2); | |
| 455 | try testing.expectEqual(list.base.start, 0); | |
| 456 | try testing.expectEqual(list.base.end, tree.tokens.len - 2); | |
| 479 | 457 | try testing.expectEqual(list.values.items.len, 3); |
| 480 | 458 | |
| 481 | 459 | { |
| 482 | 460 | try testing.expectEqual(list.values.items[0].tag, .value); |
| 483 | 461 | const value = list.values.items[0].cast(Node.Value).?; |
| 484 | const leaf = tree.tokens[value.start.?]; | |
| 485 | try testing.expect(mem.eql(u8, "name", tree.source[leaf.start..leaf.end])); | |
| 462 | const leaf = tree.tokens[value.base.start]; | |
| 463 | try testing.expectEqualStrings("name", tree.source[leaf.start..leaf.end]); | |
| 486 | 464 | } |
| 487 | 465 | |
| 488 | 466 | { |
| 489 | 467 | try testing.expectEqual(list.values.items[1].tag, .value); |
| 490 | 468 | const value = list.values.items[1].cast(Node.Value).?; |
| 491 | const leaf = tree.tokens[value.start.?]; | |
| 492 | try testing.expect(mem.eql(u8, "hr", tree.source[leaf.start..leaf.end])); | |
| 469 | const leaf = tree.tokens[value.base.start]; | |
| 470 | try testing.expectEqualStrings("hr", tree.source[leaf.start..leaf.end]); | |
| 493 | 471 | } |
| 494 | 472 | |
| 495 | 473 | { |
| 496 | 474 | try testing.expectEqual(list.values.items[2].tag, .value); |
| 497 | 475 | const value = list.values.items[2].cast(Node.Value).?; |
| 498 | const leaf = tree.tokens[value.start.?]; | |
| 499 | try testing.expect(mem.eql(u8, "avg", tree.source[leaf.start..leaf.end])); | |
| 476 | const leaf = tree.tokens[value.base.start]; | |
| 477 | try testing.expectEqualStrings("avg", tree.source[leaf.start..leaf.end]); | |
| 500 | 478 | } |
| 501 | 479 | } |
| 502 | 480 | |
| ... | ... | @@ -514,45 +492,273 @@ test "inline list as mapping value" { |
| 514 | 492 | try testing.expectEqual(tree.docs.items.len, 1); |
| 515 | 493 | |
| 516 | 494 | const doc = tree.docs.items[0].cast(Node.Doc).?; |
| 517 | try testing.expectEqual(doc.start.?, 0); | |
| 518 | try testing.expectEqual(doc.end.?, tree.tokens.len - 2); | |
| 495 | try testing.expectEqual(doc.base.start, 0); | |
| 496 | try testing.expectEqual(doc.base.end, tree.tokens.len - 2); | |
| 519 | 497 | |
| 520 | 498 | try testing.expect(doc.value != null); |
| 521 | 499 | try testing.expectEqual(doc.value.?.tag, .map); |
| 522 | 500 | |
| 523 | 501 | const map = doc.value.?.cast(Node.Map).?; |
| 524 | try testing.expectEqual(map.start.?, 0); | |
| 525 | try testing.expectEqual(map.end.?, tree.tokens.len - 2); | |
| 502 | try testing.expectEqual(map.base.start, 0); | |
| 503 | try testing.expectEqual(map.base.end, tree.tokens.len - 2); | |
| 526 | 504 | try testing.expectEqual(map.values.items.len, 1); |
| 527 | 505 | |
| 528 | 506 | const entry = map.values.items[0]; |
| 529 | 507 | const key = tree.tokens[entry.key]; |
| 530 | try testing.expectEqual(key.id, .Literal); | |
| 531 | try testing.expect(mem.eql(u8, "key", tree.source[key.start..key.end])); | |
| 508 | try testing.expectEqual(key.id, .literal); | |
| 509 | try testing.expectEqualStrings("key", tree.source[key.start..key.end]); | |
| 532 | 510 | |
| 533 | const list = entry.value.cast(Node.List).?; | |
| 534 | try testing.expectEqual(list.start.?, 4); | |
| 535 | try testing.expectEqual(list.end.?, tree.tokens.len - 2); | |
| 511 | const list = entry.value.?.cast(Node.List).?; | |
| 512 | try testing.expectEqual(list.base.start, 4); | |
| 513 | try testing.expectEqual(list.base.end, tree.tokens.len - 2); | |
| 536 | 514 | try testing.expectEqual(list.values.items.len, 3); |
| 537 | 515 | |
| 538 | 516 | { |
| 539 | 517 | try testing.expectEqual(list.values.items[0].tag, .value); |
| 540 | 518 | const value = list.values.items[0].cast(Node.Value).?; |
| 541 | const leaf = tree.tokens[value.start.?]; | |
| 542 | try testing.expect(mem.eql(u8, "name", tree.source[leaf.start..leaf.end])); | |
| 519 | const leaf = tree.tokens[value.base.start]; | |
| 520 | try testing.expectEqualStrings("name", tree.source[leaf.start..leaf.end]); | |
| 543 | 521 | } |
| 544 | 522 | |
| 545 | 523 | { |
| 546 | 524 | try testing.expectEqual(list.values.items[1].tag, .value); |
| 547 | 525 | const value = list.values.items[1].cast(Node.Value).?; |
| 548 | const leaf = tree.tokens[value.start.?]; | |
| 549 | try testing.expect(mem.eql(u8, "hr", tree.source[leaf.start..leaf.end])); | |
| 526 | const leaf = tree.tokens[value.base.start]; | |
| 527 | try testing.expectEqualStrings("hr", tree.source[leaf.start..leaf.end]); | |
| 550 | 528 | } |
| 551 | 529 | |
| 552 | 530 | { |
| 553 | 531 | try testing.expectEqual(list.values.items[2].tag, .value); |
| 554 | 532 | const value = list.values.items[2].cast(Node.Value).?; |
| 555 | const leaf = tree.tokens[value.start.?]; | |
| 556 | try testing.expect(mem.eql(u8, "avg", tree.source[leaf.start..leaf.end])); | |
| 533 | const leaf = tree.tokens[value.base.start]; | |
| 534 | try testing.expectEqualStrings("avg", tree.source[leaf.start..leaf.end]); | |
| 557 | 535 | } |
| 558 | 536 | } |
| 537 | ||
| 538 | fn parseSuccess(comptime source: []const u8) !void { | |
| 539 | var tree = Tree.init(testing.allocator); | |
| 540 | defer tree.deinit(); | |
| 541 | try tree.parse(source); | |
| 542 | } | |
| 543 | ||
| 544 | fn 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 | ||
| 550 | test "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 | ||
| 559 | test "comment between --- and ! in document start" { | |
| 560 | try parseError( | |
| 561 | \\--- # what is it? | |
| 562 | \\! | |
| 563 | , error.UnexpectedToken); | |
| 564 | } | |
| 565 | ||
| 566 | test "correct doc start with tag" { | |
| 567 | try parseSuccess( | |
| 568 | \\--- !some-tag | |
| 569 | \\ | |
| 570 | ); | |
| 571 | } | |
| 572 | ||
| 573 | test "doc close without explicit doc open" { | |
| 574 | try parseError( | |
| 575 | \\ | |
| 576 | \\ | |
| 577 | \\# something cool | |
| 578 | \\... | |
| 579 | , error.UnexpectedToken); | |
| 580 | } | |
| 581 | ||
| 582 | test "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 | ||
| 596 | test "doc with a single string is ok" { | |
| 597 | try parseSuccess( | |
| 598 | \\a string of some sort | |
| 599 | \\ | |
| 600 | ); | |
| 601 | } | |
| 602 | ||
| 603 | test "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 | ||
| 613 | test "doc with two string is bad" { | |
| 614 | try parseError( | |
| 615 | \\first | |
| 616 | \\second | |
| 617 | \\# this should fail already | |
| 618 | , error.UnexpectedToken); | |
| 619 | } | |
| 620 | ||
| 621 | test "single quote string can have new lines" { | |
| 622 | try parseSuccess( | |
| 623 | \\'what is this | |
| 624 | \\ thing?' | |
| 625 | ); | |
| 626 | } | |
| 627 | ||
| 628 | test "single quote string on one line is fine" { | |
| 629 | try parseSuccess( | |
| 630 | \\'here''s an apostrophe' | |
| 631 | ); | |
| 632 | } | |
| 633 | ||
| 634 | test "double quote string can have new lines" { | |
| 635 | try parseSuccess( | |
| 636 | \\"what is this | |
| 637 | \\ thing?" | |
| 638 | ); | |
| 639 | } | |
| 640 | ||
| 641 | test "double quote string on one line is fine" { | |
| 642 | try parseSuccess( | |
| 643 | \\"a newline\nand a\ttab" | |
| 644 | ); | |
| 645 | } | |
| 646 | ||
| 647 | test "map with key and value literals" { | |
| 648 | try parseSuccess( | |
| 649 | \\key1: val1 | |
| 650 | \\key2 : val2 | |
| 651 | ); | |
| 652 | } | |
| 653 | ||
| 654 | test "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 | ||
| 670 | test "map value indicator needs to be on the same line" { | |
| 671 | try parseError( | |
| 672 | \\a | |
| 673 | \\ : b | |
| 674 | , error.UnexpectedToken); | |
| 675 | } | |
| 676 | ||
| 677 | test "value needs to be indented" { | |
| 678 | try parseError( | |
| 679 | \\a: | |
| 680 | \\b | |
| 681 | , error.MalformedYaml); | |
| 682 | } | |
| 683 | ||
| 684 | test "comment between a key and a value is fine" { | |
| 685 | try parseSuccess( | |
| 686 | \\a: | |
| 687 | \\ # this is a value | |
| 688 | \\ b | |
| 689 | ); | |
| 690 | } | |
| 691 | ||
| 692 | test "simple list" { | |
| 693 | try parseSuccess( | |
| 694 | \\# first el | |
| 695 | \\- a | |
| 696 | \\# second el | |
| 697 | \\- b | |
| 698 | \\# third el | |
| 699 | \\- c | |
| 700 | ); | |
| 701 | } | |
| 702 | ||
| 703 | test "list indentation matters" { | |
| 704 | try parseSuccess( | |
| 705 | \\ - a | |
| 706 | \\- b | |
| 707 | ); | |
| 708 | ||
| 709 | try parseSuccess( | |
| 710 | \\- a | |
| 711 | \\ - b | |
| 712 | ); | |
| 713 | } | |
| 714 | ||
| 715 | test "unindented list is fine too" { | |
| 716 | try parseSuccess( | |
| 717 | \\a: | |
| 718 | \\- 0 | |
| 719 | \\- 1 | |
| 720 | ); | |
| 721 | } | |
| 722 | ||
| 723 | test "empty values in a map" { | |
| 724 | try parseSuccess( | |
| 725 | \\a: | |
| 726 | \\b: | |
| 727 | \\- 0 | |
| 728 | ); | |
| 729 | } | |
| 730 | ||
| 731 | test "weirdly nested map of maps of lists" { | |
| 732 | try parseSuccess( | |
| 733 | \\a: | |
| 734 | \\ b: | |
| 735 | \\ - 0 | |
| 736 | \\ - 1 | |
| 737 | ); | |
| 738 | } | |
| 739 | ||
| 740 | test "square brackets denote a list" { | |
| 741 | try parseSuccess( | |
| 742 | \\[ a, | |
| 743 | \\ b, c ] | |
| 744 | ); | |
| 745 | } | |
| 746 | ||
| 747 | test "empty list" { | |
| 748 | try parseSuccess( | |
| 749 | \\[ ] | |
| 750 | ); | |
| 751 | } | |
| 752 | ||
| 753 | test "comment within a bracketed list is an error" { | |
| 754 | try parseError( | |
| 755 | \\[ # something | |
| 756 | \\] | |
| 757 | , error.MalformedYaml); | |
| 758 | } | |
| 759 | ||
| 760 | test "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 | 2 | const assert = std.debug.assert; |
| 3 | 3 | const math = std.math; |
| 4 | 4 | const mem = std.mem; |
| 5 | const testing = std.testing; | |
| 6 | const log = std.log.scoped(.tapi); | |
| 5 | const log = std.log.scoped(.yaml); | |
| 7 | 6 | |
| 8 | 7 | const Allocator = mem.Allocator; |
| 9 | 8 | const ArenaAllocator = std.heap.ArenaAllocator; |
| ... | ... | @@ -17,22 +16,15 @@ const ParseError = parse.ParseError; |
| 17 | 16 | |
| 18 | 17 | pub const YamlError = error{ |
| 19 | 18 | UnexpectedNodeType, |
| 19 | DuplicateMapKey, | |
| 20 | 20 | OutOfMemory, |
| 21 | CannotEncodeValue, | |
| 21 | 22 | } || ParseError || std.fmt.ParseIntError; |
| 22 | 23 | |
| 23 | pub const ValueType = enum { | |
| 24 | empty, | |
| 25 | int, | |
| 26 | float, | |
| 27 | string, | |
| 28 | list, | |
| 29 | map, | |
| 30 | }; | |
| 31 | ||
| 32 | 24 | pub const List = []Value; |
| 33 | pub const Map = std.StringArrayHashMap(Value); | |
| 25 | pub const Map = std.StringHashMap(Value); | |
| 34 | 26 | |
| 35 | pub const Value = union(ValueType) { | |
| 27 | pub const Value = union(enum) { | |
| 36 | 28 | empty, |
| 37 | 29 | int: i64, |
| 38 | 30 | float: f64, |
| ... | ... | @@ -70,9 +62,7 @@ pub const Value = union(ValueType) { |
| 70 | 62 | should_inline_first_key: bool = false, |
| 71 | 63 | }; |
| 72 | 64 | |
| 73 | pub const StringifyError = std.os.WriteError; | |
| 74 | ||
| 75 | pub fn stringify(self: Value, writer: anytype, args: StringifyArgs) StringifyError!void { | |
| 65 | pub fn stringify(self: Value, writer: anytype, args: StringifyArgs) anyerror!void { | |
| 76 | 66 | switch (self) { |
| 77 | 67 | .empty => return, |
| 78 | 68 | .int => |int| return writer.print("{}", .{int}), |
| ... | ... | @@ -83,7 +73,7 @@ pub const Value = union(ValueType) { |
| 83 | 73 | if (len == 0) return; |
| 84 | 74 | |
| 85 | 75 | const first = list[0]; |
| 86 | if (first.is_compound()) { | |
| 76 | if (first.isCompound()) { | |
| 87 | 77 | for (list, 0..) |elem, i| { |
| 88 | 78 | try writer.writeByteNTimes(' ', args.indentation); |
| 89 | 79 | try writer.writeAll("- "); |
| ... | ... | @@ -108,20 +98,23 @@ pub const Value = union(ValueType) { |
| 108 | 98 | try writer.writeAll(" ]"); |
| 109 | 99 | }, |
| 110 | 100 | .map => |map| { |
| 111 | const keys = map.keys(); | |
| 112 | const len = keys.len; | |
| 101 | const len = map.count(); | |
| 113 | 102 | if (len == 0) return; |
| 114 | 103 | |
| 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 | 110 | if (!args.should_inline_first_key or i != 0) { |
| 117 | 111 | try writer.writeByteNTimes(' ', args.indentation); |
| 118 | 112 | } |
| 119 | 113 | try writer.print("{s}: ", .{key}); |
| 120 | 114 | |
| 121 | const value = map.get(key) orelse unreachable; | |
| 122 | 115 | const should_inline = blk: { |
| 123 | if (!value.is_compound()) break :blk true; | |
| 124 | if (value == .list and value.list.len > 0 and !value.list[0].is_compound()) break :blk true; | |
| 116 | if (!value.isCompound()) break :blk true; | |
| 117 | if (value == .list and value.list.len > 0 and !value.list[0].isCompound()) break :blk true; | |
| 125 | 118 | break :blk false; |
| 126 | 119 | }; |
| 127 | 120 | |
| ... | ... | @@ -137,35 +130,44 @@ pub const Value = union(ValueType) { |
| 137 | 130 | if (i < len - 1) { |
| 138 | 131 | try writer.writeByte('\n'); |
| 139 | 132 | } |
| 133 | ||
| 134 | i += 1; | |
| 140 | 135 | } |
| 141 | 136 | }, |
| 142 | 137 | } |
| 143 | 138 | } |
| 144 | 139 | |
| 145 | fn is_compound(self: Value) bool { | |
| 140 | fn isCompound(self: Value) bool { | |
| 146 | 141 | return switch (self) { |
| 147 | 142 | .list, .map => true, |
| 148 | 143 | else => false, |
| 149 | 144 | }; |
| 150 | 145 | } |
| 151 | 146 | |
| 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 | 148 | if (node.cast(Node.Doc)) |doc| { |
| 154 | 149 | const inner = doc.value orelse { |
| 155 | 150 | // empty doc |
| 156 | 151 | return Value{ .empty = {} }; |
| 157 | 152 | }; |
| 158 | return Value.fromNode(arena, tree, inner, null); | |
| 153 | return Value.fromNode(arena, tree, inner); | |
| 159 | 154 | } else if (node.cast(Node.Map)) |map| { |
| 160 | var out_map = std.StringArrayHashMap(Value).init(arena); | |
| 161 | try out_map.ensureUnusedCapacity(map.values.items.len); | |
| 155 | // TODO use ContextAdapted HashMap and do not duplicate keys, intern | |
| 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); | |
| 162 | 159 | |
| 163 | 160 | for (map.values.items) |entry| { |
| 164 | const key_tok = tree.tokens[entry.key]; | |
| 165 | const key = try arena.dupe(u8, tree.source[key_tok.start..key_tok.end]); | |
| 166 | const value = try Value.fromNode(arena, tree, entry.value, null); | |
| 167 | ||
| 168 | out_map.putAssumeCapacityNoClobber(key, value); | |
| 161 | const key = try arena.dupe(u8, tree.getRaw(entry.key, entry.key)); | |
| 162 | const gop = out_map.getOrPutAssumeCapacity(key); | |
| 163 | if (gop.found_existing) { | |
| 164 | return error.DuplicateMapKey; | |
| 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 | } |
| 170 | 172 | |
| 171 | 173 | return Value{ .map = out_map }; |
| ... | ... | @@ -173,56 +175,124 @@ pub const Value = union(ValueType) { |
| 173 | 175 | var out_list = std.ArrayList(Value).init(arena); |
| 174 | 176 | try out_list.ensureUnusedCapacity(list.values.items.len); |
| 175 | 177 | |
| 176 | if (list.values.items.len > 0) { | |
| 177 | const hint = if (list.values.items[0].cast(Node.Value)) |value| hint: { | |
| 178 | const start = tree.tokens[value.start.?]; | |
| 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 | } | |
| 178 | for (list.values.items) |elem| { | |
| 179 | const value = try Value.fromNode(arena, tree, elem); | |
| 180 | out_list.appendAssumeCapacity(value); | |
| 194 | 181 | } |
| 195 | 182 | |
| 196 | 183 | return Value{ .list = try out_list.toOwnedSlice() }; |
| 197 | 184 | } else if (node.cast(Node.Value)) |value| { |
| 198 | const start = tree.tokens[value.start.?]; | |
| 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 | } | |
| 185 | const raw = tree.getRaw(node.start, node.end); | |
| 210 | 186 | |
| 211 | 187 | try_int: { |
| 212 | 188 | // TODO infer base for int |
| 213 | 189 | const int = std.fmt.parseInt(i64, raw, 10) catch break :try_int; |
| 214 | 190 | return Value{ .int = int }; |
| 215 | 191 | } |
| 192 | ||
| 216 | 193 | try_float: { |
| 217 | 194 | const float = std.fmt.parseFloat(f64, raw) catch break :try_float; |
| 218 | 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 | 199 | } else { |
| 222 | 200 | log.err("Unexpected node type: {}", .{node.tag}); |
| 223 | 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 | }; |
| 227 | 297 | |
| 228 | 298 | pub const Yaml = struct { |
| ... | ... | @@ -234,30 +304,18 @@ pub const Yaml = struct { |
| 234 | 304 | self.arena.deinit(); |
| 235 | 305 | } |
| 236 | 306 | |
| 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 | 307 | pub fn load(allocator: Allocator, source: []const u8) !Yaml { |
| 250 | 308 | var arena = ArenaAllocator.init(allocator); |
| 251 | const arena_allocator = arena.allocator(); | |
| 309 | errdefer arena.deinit(); | |
| 252 | 310 | |
| 253 | var tree = Tree.init(arena_allocator); | |
| 311 | var tree = Tree.init(arena.allocator()); | |
| 254 | 312 | try tree.parse(source); |
| 255 | 313 | |
| 256 | var docs = std.ArrayList(Value).init(arena_allocator); | |
| 257 | try docs.ensureUnusedCapacity(tree.docs.items.len); | |
| 314 | var docs = std.ArrayList(Value).init(arena.allocator()); | |
| 315 | try docs.ensureTotalCapacityPrecise(tree.docs.items.len); | |
| 258 | 316 | |
| 259 | 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 | 319 | docs.appendAssumeCapacity(value); |
| 262 | 320 | } |
| 263 | 321 | |
| ... | ... | @@ -316,17 +374,19 @@ pub const Yaml = struct { |
| 316 | 374 | |
| 317 | 375 | fn parseValue(self: *Yaml, comptime T: type, value: Value) Error!T { |
| 318 | 376 | return switch (@typeInfo(T)) { |
| 319 | .Int => math.cast(T, try value.asInt()) orelse error.Overflow, | |
| 320 | .Float => math.lossyCast(T, try value.asFloat()), | |
| 377 | .Int => math.cast(T, try value.asInt()) orelse return error.Overflow, | |
| 378 | .Float => if (value.asFloat()) |float| { | |
| 379 | return math.lossyCast(T, float); | |
| 380 | } else |_| { | |
| 381 | return math.lossyCast(T, try value.asInt()); | |
| 382 | }, | |
| 321 | 383 | .Struct => self.parseStruct(T, try value.asMap()), |
| 322 | 384 | .Union => self.parseUnion(T, value), |
| 323 | 385 | .Array => self.parseArray(T, try value.asList()), |
| 324 | .Pointer => { | |
| 325 | if (value.asList()) |list| { | |
| 326 | return self.parsePointer(T, .{ .list = list }); | |
| 327 | } else |_| { | |
| 328 | return self.parsePointer(T, .{ .string = try value.asString() }); | |
| 329 | } | |
| 386 | .Pointer => if (value.asList()) |list| { | |
| 387 | return self.parsePointer(T, .{ .list = list }); | |
| 388 | } else |_| { | |
| 389 | return self.parsePointer(T, .{ .string = try value.asString() }); | |
| 330 | 390 | }, |
| 331 | 391 | .Void => error.TypeMismatch, |
| 332 | 392 | .Optional => unreachable, |
| ... | ... | @@ -372,7 +432,7 @@ pub const Yaml = struct { |
| 372 | 432 | } |
| 373 | 433 | |
| 374 | 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 | 436 | return error.StructFieldMissing; |
| 377 | 437 | }; |
| 378 | 438 | @field(parsed, field.name) = try self.parseValue(field.type, unwrapped); |
| ... | ... | @@ -387,8 +447,7 @@ pub const Yaml = struct { |
| 387 | 447 | |
| 388 | 448 | switch (ptr_info.size) { |
| 389 | 449 | .Slice => { |
| 390 | const child_info = @typeInfo(ptr_info.child); | |
| 391 | if (child_info == .Int and child_info.Int.bits == 8) { | |
| 450 | if (ptr_info.child == u8) { | |
| 392 | 451 | return value.asString(); |
| 393 | 452 | } |
| 394 | 453 | |
| ... | ... | @@ -413,315 +472,36 @@ pub const Yaml = struct { |
| 413 | 472 | |
| 414 | 473 | return parsed; |
| 415 | 474 | } |
| 416 | }; | |
| 417 | ||
| 418 | test { | |
| 419 | testing.refAllDecls(@This()); | |
| 420 | } | |
| 421 | ||
| 422 | test "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(); | |
| 431 | 475 | |
| 432 | try testing.expectEqual(yaml.docs.items.len, 1); | |
| 433 | ||
| 434 | const list = yaml.docs.items[0].list; | |
| 435 | try testing.expectEqual(list.len, 3); | |
| 436 | ||
| 437 | try testing.expect(mem.eql(u8, list[0].string, "a")); | |
| 438 | try testing.expect(mem.eql(u8, list[1].string, "b")); | |
| 439 | try testing.expect(mem.eql(u8, list[2].string, "c")); | |
| 440 | } | |
| 441 | ||
| 442 | test "simple list typed as array of strings" { | |
| 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 | ||
| 461 | test "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 | ||
| 480 | test "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 | ||
| 499 | test "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 | ||
| 514 | test "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 | ||
| 542 | test "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 | ||
| 561 | test "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 | ||
| 589 | test "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 | ||
| 605 | test "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 | ||
| 625 | test "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); | |
| 476 | pub fn stringify(self: Yaml, writer: anytype) !void { | |
| 477 | for (self.docs.items, 0..) |doc, i| { | |
| 478 | try writer.writeAll("---"); | |
| 479 | if (self.tree.?.getDirective(i)) |directive| { | |
| 480 | try writer.print(" !{s}", .{directive}); | |
| 481 | } | |
| 482 | try writer.writeByte('\n'); | |
| 483 | try doc.stringify(writer, .{}); | |
| 484 | try writer.writeByte('\n'); | |
| 485 | } | |
| 486 | try writer.writeAll("...\n"); | |
| 649 | 487 | } |
| 650 | } | |
| 651 | ||
| 652 | test "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 | ||
| 669 | test "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 | ||
| 697 | test "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 | } | |
| 488 | }; | |
| 704 | 489 | |
| 705 | test "nonempty yaml cannot be represented as void" { | |
| 706 | const source = | |
| 707 | \\a: b | |
| 708 | ; | |
| 490 | pub fn stringify(allocator: Allocator, input: anytype, writer: anytype) !void { | |
| 491 | var arena = ArenaAllocator.init(allocator); | |
| 492 | defer arena.deinit(); | |
| 709 | 493 | |
| 710 | var yaml = try Yaml.load(testing.allocator, source); | |
| 711 | defer yaml.deinit(); | |
| 494 | var maybe_value = try Value.encode(arena.allocator(), input); | |
| 712 | 495 | |
| 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 | } |
| 715 | 502 | |
| 716 | test "typed array size mismatch" { | |
| 717 | const source = | |
| 718 | \\- 0 | |
| 719 | \\- 0 | |
| 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)); | |
| 503 | test { | |
| 504 | std.testing.refAllDecls(Tokenizer); | |
| 505 | std.testing.refAllDecls(parse); | |
| 506 | _ = @import("yaml/test.zig"); | |
| 727 | 507 | } |
src/link/tapi/yaml/test.zig created+475| ... | ... | @@ -0,0 +1,475 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const testing = std.testing; | |
| 4 | ||
| 5 | const yaml_mod = @import("../yaml.zig"); | |
| 6 | const Yaml = yaml_mod.Yaml; | |
| 7 | ||
| 8 | test "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 | ||
| 28 | test "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 | ||
| 47 | test "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 | ||
| 63 | test "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 | ||
| 79 | test "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 | ||
| 94 | test "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 | ||
| 122 | test "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 | ||
| 141 | test "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 | ||
| 169 | test "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 | ||
| 185 | test "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 | ||
| 205 | test "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 | ||
| 222 | test "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 | ||
| 250 | test "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 | ||
| 277 | test "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 | ||
| 294 | test "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 | ||
| 322 | test "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 | ||
| 330 | test "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 | ||
| 341 | test "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 | ||
| 354 | test "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 | ||
| 377 | test "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 | ||
| 391 | test "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 | ||
| 404 | test "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 | ||
| 412 | fn 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 | ||
| 420 | test "stringify an int" { | |
| 421 | try testStringify("128", @as(u32, 128)); | |
| 422 | } | |
| 423 | ||
| 424 | test "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 | ||
| 432 | test "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 | ||
| 445 | test "stringify a struct with all optionals" { | |
| 446 | try testStringify("", struct { a: ?i64, b: ?f64 }{ .a = null, .b = null }); | |
| 447 | } | |
| 448 | ||
| 449 | test "stringify an optional" { | |
| 450 | try testStringify("", null); | |
| 451 | try testStringify("", @as(?u64, null)); | |
| 452 | } | |
| 453 | ||
| 454 | test "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 | ||
| 463 | test "stringify a string" { | |
| 464 | try testStringify("a: name", struct { a: []const u8 }{ .a = "name" }); | |
| 465 | try testStringify("name", "name"); | |
| 466 | } | |
| 467 | ||
| 468 | test "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 | } |