@pubid/pubid 0.1.71 → 0.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -4
- package/artifact/corpus.json.gz +0 -0
- package/dist/flavors/ansi/generated/substrate.d.ts +78 -0
- package/dist/flavors/ansi/generated/substrate.js +105 -0
- package/dist/flavors/ansi/implementation.d.ts +5 -0
- package/dist/flavors/ansi/implementation.js +125 -0
- package/dist/flavors/ansi/index.js +14 -117
- package/dist/flavors/api/generated/substrate.d.ts +78 -0
- package/dist/flavors/api/generated/substrate.js +105 -0
- package/dist/flavors/api/grammar.worker.d.ts +6 -0
- package/dist/flavors/api/{grammar.js → grammar.worker.js} +60 -16
- package/dist/flavors/api/implementation.d.ts +11 -0
- package/dist/flavors/api/implementation.js +106 -0
- package/dist/flavors/api/index.d.ts +1 -3
- package/dist/flavors/api/index.js +14 -98
- package/dist/flavors/arxiv/generated/substrate.d.ts +75 -0
- package/dist/flavors/arxiv/generated/substrate.js +102 -0
- package/dist/flavors/arxiv/index.js +17 -11
- package/dist/flavors/ashrae/generated/substrate.d.ts +78 -0
- package/dist/flavors/ashrae/generated/substrate.js +105 -0
- package/dist/flavors/ashrae/grammar.worker.d.ts +6 -0
- package/dist/flavors/ashrae/{grammar.js → grammar.worker.js} +76 -39
- package/dist/flavors/ashrae/implementation.d.ts +7 -0
- package/dist/flavors/ashrae/implementation.js +316 -0
- package/dist/flavors/ashrae/index.d.ts +1 -3
- package/dist/flavors/ashrae/index.js +14 -304
- package/dist/flavors/asme/generated/substrate.d.ts +78 -0
- package/dist/flavors/asme/generated/substrate.js +105 -0
- package/dist/flavors/asme/grammar.worker.d.ts +6 -0
- package/dist/flavors/asme/{grammar.js → grammar.worker.js} +41 -2
- package/dist/flavors/asme/implementation.d.ts +7 -0
- package/dist/flavors/asme/implementation.js +152 -0
- package/dist/flavors/asme/index.d.ts +1 -3
- package/dist/flavors/asme/index.js +14 -136
- package/dist/flavors/astm/generated/substrate.d.ts +78 -0
- package/dist/flavors/astm/generated/substrate.js +105 -0
- package/dist/flavors/astm/grammar.worker.d.ts +6 -0
- package/dist/flavors/astm/{grammar.js → grammar.worker.js} +39 -5
- package/dist/flavors/astm/implementation.d.ts +6 -0
- package/dist/flavors/astm/implementation.js +135 -0
- package/dist/flavors/astm/index.js +14 -125
- package/dist/flavors/bipm/generated/substrate.d.ts +78 -0
- package/dist/flavors/bipm/generated/substrate.js +105 -0
- package/dist/flavors/bipm/grammar.worker.d.ts +6 -0
- package/dist/flavors/bipm/grammar.worker.js +180 -0
- package/dist/flavors/bipm/implementation.d.ts +6 -0
- package/dist/flavors/bipm/implementation.js +244 -0
- package/dist/flavors/bipm/index.d.ts +1 -28
- package/dist/flavors/bipm/index.js +16 -650
- package/dist/flavors/bipm/model.d.ts +80 -0
- package/dist/flavors/bipm/model.js +271 -0
- package/dist/flavors/bipm/worker.d.ts +2 -0
- package/dist/flavors/bipm/worker.js +19 -0
- package/dist/flavors/bsi/generated/substrate.d.ts +78 -0
- package/dist/flavors/bsi/generated/substrate.js +105 -0
- package/dist/flavors/bsi/grammar.worker.d.ts +6 -0
- package/dist/flavors/bsi/{grammar.js → grammar.worker.js} +36 -7
- package/dist/flavors/bsi/implementation.d.ts +12 -0
- package/dist/flavors/bsi/implementation.js +967 -0
- package/dist/flavors/bsi/index.d.ts +1 -3
- package/dist/flavors/bsi/index.js +15 -940
- package/dist/flavors/bsi/model.js +16 -0
- package/dist/flavors/bsi/worker.js +11 -4
- package/dist/flavors/bsi_pfs/index.d.ts +25 -0
- package/dist/flavors/bsi_pfs/index.js +73 -10
- package/dist/flavors/calconnect/generated/substrate.d.ts +75 -0
- package/dist/flavors/calconnect/generated/substrate.js +102 -0
- package/dist/flavors/calconnect/grammar.worker.d.ts +6 -0
- package/dist/flavors/calconnect/grammar.worker.js +60 -0
- package/dist/flavors/calconnect/implementation.d.ts +6 -0
- package/dist/flavors/calconnect/implementation.js +69 -0
- package/dist/flavors/calconnect/index.d.ts +1 -19
- package/dist/flavors/calconnect/index.js +15 -111
- package/dist/flavors/calconnect/model.d.ts +26 -0
- package/dist/flavors/calconnect/model.js +52 -0
- package/dist/flavors/ccsds/generated/substrate.d.ts +75 -0
- package/dist/flavors/ccsds/generated/substrate.js +102 -0
- package/dist/flavors/ccsds/implementation.d.ts +5 -0
- package/dist/flavors/ccsds/implementation.js +67 -0
- package/dist/flavors/ccsds/index.js +13 -57
- package/dist/flavors/cen_cenelec/generated/substrate.d.ts +78 -0
- package/dist/flavors/cen_cenelec/generated/substrate.js +105 -0
- package/dist/flavors/cen_cenelec/grammar.worker.d.ts +6 -0
- package/dist/flavors/cen_cenelec/{grammar.js → grammar.worker.js} +41 -13
- package/dist/flavors/cen_cenelec/implementation.d.ts +15 -0
- package/dist/flavors/cen_cenelec/implementation.js +322 -0
- package/dist/flavors/cen_cenelec/index.d.ts +2 -4
- package/dist/flavors/cen_cenelec/index.js +16 -286
- package/dist/flavors/cen_cenelec/model.js +16 -1
- package/dist/flavors/cen_cenelec/worker.js +10 -4
- package/dist/flavors/cen_pfs/index.d.ts +5 -0
- package/dist/flavors/cen_pfs/index.js +28 -2
- package/dist/flavors/cie/generated/substrate.d.ts +78 -0
- package/dist/flavors/cie/generated/substrate.js +105 -0
- package/dist/flavors/cie/grammar.worker.d.ts +6 -0
- package/dist/flavors/cie/{grammar.js → grammar.worker.js} +71 -18
- package/dist/flavors/cie/implementation.d.ts +9 -0
- package/dist/flavors/cie/implementation.js +331 -0
- package/dist/flavors/cie/index.js +14 -309
- package/dist/flavors/csa/generated/substrate.d.ts +78 -0
- package/dist/flavors/csa/generated/substrate.js +105 -0
- package/dist/flavors/csa/grammar.worker.d.ts +12 -0
- package/dist/flavors/csa/{grammar.js → grammar.worker.js} +143 -27
- package/dist/flavors/csa/implementation.d.ts +9 -0
- package/dist/flavors/csa/implementation.js +661 -0
- package/dist/flavors/csa/index.js +14 -631
- package/dist/flavors/csa/worker.js +10 -4
- package/dist/flavors/easc/generated/substrate.d.ts +75 -0
- package/dist/flavors/easc/generated/substrate.js +102 -0
- package/dist/flavors/easc/grammar.worker.d.ts +6 -0
- package/dist/flavors/easc/grammar.worker.js +66 -0
- package/dist/flavors/easc/implementation.d.ts +6 -0
- package/dist/flavors/easc/implementation.js +58 -0
- package/dist/flavors/easc/index.d.ts +1 -2
- package/dist/flavors/easc/index.js +15 -105
- package/dist/flavors/easc/model.d.ts +10 -0
- package/dist/flavors/easc/model.js +43 -0
- package/dist/flavors/ecma/generated/substrate.d.ts +75 -0
- package/dist/flavors/ecma/generated/substrate.js +102 -0
- package/dist/flavors/ecma/grammar.worker.d.ts +6 -0
- package/dist/flavors/ecma/grammar.worker.js +63 -0
- package/dist/flavors/ecma/implementation.d.ts +6 -0
- package/dist/flavors/ecma/implementation.js +95 -0
- package/dist/flavors/ecma/index.d.ts +1 -2
- package/dist/flavors/ecma/index.js +15 -152
- package/dist/flavors/ecma/model.d.ts +10 -0
- package/dist/flavors/ecma/model.js +61 -0
- package/dist/flavors/etsi/generated/substrate.d.ts +75 -0
- package/dist/flavors/etsi/generated/substrate.js +102 -0
- package/dist/flavors/etsi/grammar.worker.d.ts +6 -0
- package/dist/flavors/etsi/grammar.worker.js +86 -0
- package/dist/flavors/etsi/implementation.d.ts +6 -0
- package/dist/flavors/etsi/implementation.js +110 -0
- package/dist/flavors/etsi/index.d.ts +2 -12
- package/dist/flavors/etsi/index.js +16 -305
- package/dist/flavors/etsi/model.d.ts +37 -0
- package/dist/flavors/etsi/model.js +169 -0
- package/dist/flavors/eu/generated/substrate.d.ts +75 -0
- package/dist/flavors/eu/generated/substrate.js +102 -0
- package/dist/flavors/eu/implementation.d.ts +7 -0
- package/dist/flavors/eu/implementation.js +150 -0
- package/dist/flavors/eu/index.js +14 -141
- package/dist/flavors/evs/generated/substrate.d.ts +78 -0
- package/dist/flavors/evs/generated/substrate.js +105 -0
- package/dist/flavors/evs/grammar.worker.d.ts +6 -0
- package/dist/flavors/evs/grammar.worker.js +98 -0
- package/dist/flavors/evs/implementation.d.ts +7 -0
- package/dist/flavors/evs/implementation.js +114 -0
- package/dist/flavors/evs/index.d.ts +1 -1
- package/dist/flavors/evs/index.js +14 -89
- package/dist/flavors/evs/worker.js +10 -4
- package/dist/flavors/gb/generated/substrate.d.ts +75 -0
- package/dist/flavors/gb/generated/substrate.js +102 -0
- package/dist/flavors/gb/grammar.worker.d.ts +6 -0
- package/dist/flavors/gb/grammar.worker.js +73 -0
- package/dist/flavors/gb/implementation.d.ts +6 -0
- package/dist/flavors/gb/implementation.js +87 -0
- package/dist/flavors/gb/index.d.ts +1 -29
- package/dist/flavors/gb/index.js +15 -157
- package/dist/flavors/gb/model.d.ts +36 -0
- package/dist/flavors/gb/model.js +79 -0
- package/dist/flavors/gost/generated/substrate.d.ts +78 -0
- package/dist/flavors/gost/generated/substrate.js +105 -0
- package/dist/flavors/gost/grammar.worker.d.ts +6 -0
- package/dist/flavors/gost/grammar.worker.js +82 -0
- package/dist/flavors/gost/implementation.d.ts +7 -0
- package/dist/flavors/gost/implementation.js +177 -0
- package/dist/flavors/gost/index.js +14 -162
- package/dist/flavors/gost/worker.js +12 -5
- package/dist/flavors/iala/generated/substrate.d.ts +78 -0
- package/dist/flavors/iala/generated/substrate.js +105 -0
- package/dist/flavors/iala/grammar.worker.d.ts +6 -0
- package/dist/flavors/iala/grammar.worker.js +127 -0
- package/dist/flavors/iala/implementation.d.ts +6 -0
- package/dist/flavors/iala/implementation.js +250 -0
- package/dist/flavors/iala/index.d.ts +1 -56
- package/dist/flavors/iala/index.js +17 -484
- package/dist/flavors/iala/model.d.ts +93 -0
- package/dist/flavors/iala/model.js +194 -0
- package/dist/flavors/iana/generated/substrate.d.ts +75 -0
- package/dist/flavors/iana/generated/substrate.js +102 -0
- package/dist/flavors/iana/grammar.worker.d.ts +6 -0
- package/dist/flavors/iana/grammar.worker.js +51 -0
- package/dist/flavors/iana/implementation.d.ts +6 -0
- package/dist/flavors/iana/implementation.js +47 -0
- package/dist/flavors/iana/index.d.ts +1 -17
- package/dist/flavors/iana/index.js +15 -69
- package/dist/flavors/iana/model.d.ts +22 -0
- package/dist/flavors/iana/model.js +33 -0
- package/dist/flavors/idf/generated/substrate.d.ts +78 -0
- package/dist/flavors/idf/generated/substrate.js +105 -0
- package/dist/flavors/idf/grammar.worker.d.ts +6 -0
- package/dist/flavors/idf/{grammar.js → grammar.worker.js} +58 -2
- package/dist/flavors/idf/implementation.d.ts +6 -0
- package/dist/flavors/idf/implementation.js +129 -0
- package/dist/flavors/idf/index.js +14 -98
- package/dist/flavors/iec/generated/substrate.d.ts +78 -0
- package/dist/flavors/iec/generated/substrate.js +105 -0
- package/dist/flavors/iec/grammar.worker.d.ts +6 -0
- package/dist/flavors/iec/grammar.worker.js +231 -0
- package/dist/flavors/iec/implementation.d.ts +15 -0
- package/dist/flavors/iec/implementation.js +956 -0
- package/dist/flavors/iec/index.d.ts +1 -2
- package/dist/flavors/iec/index.js +16 -869
- package/dist/flavors/iec/model.js +13 -1
- package/dist/flavors/iec/worker.d.ts +2 -0
- package/dist/flavors/iec/worker.js +19 -0
- package/dist/flavors/ieee/generated/substrate.d.ts +78 -0
- package/dist/flavors/ieee/generated/substrate.js +105 -0
- package/dist/flavors/ieee/implementation.d.ts +4 -0
- package/dist/flavors/ieee/implementation.js +48 -10
- package/dist/flavors/ieee/index.d.ts +3 -2
- package/dist/flavors/ieee/index.js +30 -12
- package/dist/flavors/ieee/model.js +17 -4
- package/dist/flavors/ieee/preprocessor.js +11 -10
- package/dist/flavors/ieee/worker.js +33 -11
- package/dist/flavors/ietf/generated/substrate.d.ts +75 -0
- package/dist/flavors/ietf/generated/substrate.js +102 -0
- package/dist/flavors/ietf/grammar.worker.d.ts +6 -0
- package/dist/flavors/ietf/grammar.worker.js +63 -0
- package/dist/flavors/ietf/implementation.d.ts +6 -0
- package/dist/flavors/ietf/implementation.js +60 -0
- package/dist/flavors/ietf/index.d.ts +1 -28
- package/dist/flavors/ietf/index.js +15 -149
- package/dist/flavors/ietf/model.d.ts +47 -0
- package/dist/flavors/ietf/model.js +92 -0
- package/dist/flavors/iho/generated/substrate.d.ts +78 -0
- package/dist/flavors/iho/generated/substrate.js +105 -0
- package/dist/flavors/iho/grammar.worker.d.ts +6 -0
- package/dist/flavors/iho/grammar.worker.js +150 -0
- package/dist/flavors/iho/implementation.d.ts +6 -0
- package/dist/flavors/iho/implementation.js +221 -0
- package/dist/flavors/iho/index.d.ts +1 -2
- package/dist/flavors/iho/index.js +15 -619
- package/dist/flavors/iho/model.d.ts +11 -0
- package/dist/flavors/iho/model.js +315 -0
- package/dist/flavors/index.js +3 -0
- package/dist/flavors/iso/generated/substrate.d.ts +93 -0
- package/dist/flavors/iso/generated/substrate.js +133 -0
- package/dist/flavors/iso/grammar.worker.d.ts +7 -0
- package/dist/flavors/iso/grammar.worker.js +406 -0
- package/dist/flavors/iso/implementation.d.ts +4 -0
- package/dist/flavors/iso/implementation.js +880 -0
- package/dist/flavors/iso/index.js +16 -706
- package/dist/flavors/iso/model.js +21 -2
- package/dist/flavors/iso/worker.d.ts +2 -0
- package/dist/flavors/iso/worker.js +19 -0
- package/dist/flavors/itu/generated/substrate.d.ts +78 -0
- package/dist/flavors/itu/generated/substrate.js +105 -0
- package/dist/flavors/itu/grammar.worker.d.ts +6 -0
- package/dist/flavors/itu/grammar.worker.js +306 -0
- package/dist/flavors/itu/implementation.d.ts +10 -0
- package/dist/flavors/itu/implementation.js +285 -0
- package/dist/flavors/itu/index.js +15 -246
- package/dist/flavors/itu/worker.d.ts +2 -0
- package/dist/flavors/itu/worker.js +19 -0
- package/dist/flavors/jcgm/generated/substrate.d.ts +78 -0
- package/dist/flavors/jcgm/generated/substrate.js +105 -0
- package/dist/flavors/jcgm/grammar.worker.d.ts +6 -0
- package/dist/flavors/jcgm/grammar.worker.js +98 -0
- package/dist/flavors/jcgm/implementation.d.ts +6 -0
- package/dist/flavors/jcgm/implementation.js +187 -0
- package/dist/flavors/jcgm/index.d.ts +1 -5
- package/dist/flavors/jcgm/index.js +16 -364
- package/dist/flavors/jcgm/model.d.ts +43 -0
- package/dist/flavors/jcgm/model.js +168 -0
- package/dist/flavors/jis/generated/substrate.d.ts +78 -0
- package/dist/flavors/jis/generated/substrate.js +105 -0
- package/dist/flavors/jis/grammar.worker.d.ts +6 -0
- package/dist/flavors/jis/grammar.worker.js +132 -0
- package/dist/flavors/jis/implementation.d.ts +6 -0
- package/dist/flavors/jis/implementation.js +129 -0
- package/dist/flavors/jis/index.d.ts +0 -2
- package/dist/flavors/jis/index.js +15 -390
- package/dist/flavors/jis/model.d.ts +30 -0
- package/dist/flavors/jis/model.js +205 -0
- package/dist/flavors/jis/worker.d.ts +2 -0
- package/dist/flavors/jis/worker.js +19 -0
- package/dist/flavors/nist/generated/substrate.d.ts +78 -0
- package/dist/flavors/nist/generated/substrate.js +105 -0
- package/dist/flavors/nist/index.js +18 -11
- package/dist/flavors/nist/worker.js +8 -4
- package/dist/flavors/oasis/generated/substrate.d.ts +75 -0
- package/dist/flavors/oasis/generated/substrate.js +102 -0
- package/dist/flavors/oasis/grammar.worker.d.ts +6 -0
- package/dist/flavors/oasis/grammar.worker.js +50 -0
- package/dist/flavors/oasis/implementation.d.ts +6 -0
- package/dist/flavors/oasis/implementation.js +80 -0
- package/dist/flavors/oasis/index.d.ts +1 -21
- package/dist/flavors/oasis/index.js +16 -108
- package/dist/flavors/oasis/model.d.ts +27 -0
- package/dist/flavors/oasis/model.js +34 -0
- package/dist/flavors/ogc/generated/substrate.d.ts +75 -0
- package/dist/flavors/ogc/generated/substrate.js +102 -0
- package/dist/flavors/ogc/grammar.worker.d.ts +6 -0
- package/dist/flavors/ogc/grammar.worker.js +55 -0
- package/dist/flavors/ogc/implementation.d.ts +6 -0
- package/dist/flavors/ogc/implementation.js +49 -0
- package/dist/flavors/ogc/index.d.ts +1 -18
- package/dist/flavors/ogc/index.js +15 -73
- package/dist/flavors/ogc/model.d.ts +23 -0
- package/dist/flavors/ogc/model.js +32 -0
- package/dist/flavors/oiml/generated/substrate.d.ts +78 -0
- package/dist/flavors/oiml/generated/substrate.js +105 -0
- package/dist/flavors/oiml/grammar.worker.d.ts +6 -0
- package/dist/flavors/oiml/grammar.worker.js +239 -0
- package/dist/flavors/oiml/implementation.d.ts +2 -1
- package/dist/flavors/oiml/implementation.js +16 -7
- package/dist/flavors/oiml/index.js +15 -6
- package/dist/flavors/oiml/model.js +19 -19
- package/dist/flavors/oiml/worker.js +14 -6
- package/dist/flavors/omg/generated/substrate.d.ts +78 -0
- package/dist/flavors/omg/generated/substrate.js +105 -0
- package/dist/flavors/omg/grammar.worker.d.ts +6 -0
- package/dist/flavors/omg/grammar.worker.js +64 -0
- package/dist/flavors/omg/implementation.d.ts +7 -0
- package/dist/flavors/omg/implementation.js +33 -0
- package/dist/flavors/omg/index.d.ts +1 -12
- package/dist/flavors/omg/index.js +15 -71
- package/dist/flavors/omg/model.d.ts +16 -0
- package/dist/flavors/omg/model.js +26 -0
- package/dist/flavors/plateau/generated/substrate.d.ts +78 -0
- package/dist/flavors/plateau/generated/substrate.js +105 -0
- package/dist/flavors/plateau/grammar.worker.d.ts +6 -0
- package/dist/flavors/plateau/grammar.worker.js +78 -0
- package/dist/flavors/plateau/implementation.d.ts +6 -0
- package/dist/flavors/plateau/implementation.js +74 -0
- package/dist/flavors/plateau/index.d.ts +1 -2
- package/dist/flavors/plateau/index.js +18 -114
- package/dist/flavors/plateau/model.d.ts +11 -0
- package/dist/flavors/plateau/model.js +51 -0
- package/dist/flavors/register-types.d.ts +20 -19
- package/dist/flavors/register-types.js +44 -19
- package/dist/flavors/sae/generated/substrate.d.ts +75 -0
- package/dist/flavors/sae/generated/substrate.js +102 -0
- package/dist/flavors/sae/grammar.worker.d.ts +6 -0
- package/dist/flavors/sae/grammar.worker.js +84 -0
- package/dist/flavors/sae/implementation.d.ts +11 -0
- package/dist/flavors/sae/implementation.js +109 -0
- package/dist/flavors/sae/index.d.ts +3 -0
- package/dist/flavors/sae/index.js +19 -0
- package/dist/flavors/sae/model.d.ts +86 -0
- package/dist/flavors/sae/model.js +185 -0
- package/dist/flavors/tgpp/generated/substrate.d.ts +78 -0
- package/dist/flavors/tgpp/generated/substrate.js +105 -0
- package/dist/flavors/tgpp/grammar.worker.d.ts +6 -0
- package/dist/flavors/tgpp/grammar.worker.js +69 -0
- package/dist/flavors/tgpp/implementation.d.ts +8 -0
- package/dist/flavors/tgpp/implementation.js +56 -0
- package/dist/flavors/tgpp/index.d.ts +1 -2
- package/dist/flavors/tgpp/index.js +15 -120
- package/dist/flavors/tgpp/model.d.ts +13 -0
- package/dist/flavors/tgpp/model.js +52 -0
- package/dist/flavors/w3c/generated/substrate.d.ts +78 -0
- package/dist/flavors/w3c/generated/substrate.js +105 -0
- package/dist/flavors/w3c/grammar.worker.d.ts +6 -0
- package/dist/flavors/w3c/grammar.worker.js +55 -0
- package/dist/flavors/w3c/implementation.d.ts +7 -0
- package/dist/flavors/w3c/implementation.js +49 -0
- package/dist/flavors/w3c/index.d.ts +1 -12
- package/dist/flavors/w3c/index.js +15 -146
- package/dist/flavors/w3c/model.d.ts +15 -0
- package/dist/flavors/w3c/model.js +103 -0
- package/dist/flavors/wmo/generated/substrate.d.ts +78 -0
- package/dist/flavors/wmo/generated/substrate.js +105 -0
- package/dist/flavors/wmo/implementation.d.ts +5 -0
- package/dist/flavors/wmo/implementation.js +79 -0
- package/dist/flavors/wmo/index.js +14 -68
- package/dist/flavors/worker-registry.js +246 -68
- package/dist/flavors/xsf/generated/substrate.d.ts +75 -0
- package/dist/flavors/xsf/generated/substrate.js +102 -0
- package/dist/flavors/xsf/grammar.worker.d.ts +6 -0
- package/dist/flavors/xsf/grammar.worker.js +53 -0
- package/dist/flavors/xsf/implementation.d.ts +6 -0
- package/dist/flavors/xsf/implementation.js +34 -0
- package/dist/flavors/xsf/index.d.ts +1 -16
- package/dist/flavors/xsf/index.js +16 -63
- package/dist/flavors/xsf/model.d.ts +20 -0
- package/dist/flavors/xsf/model.js +26 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/lane-keys.d.ts +68 -0
- package/dist/lane-keys.js +113 -0
- package/dist/model/identifier.d.ts +13 -1
- package/dist/model/identifier.js +76 -13
- package/dist/model/relation.d.ts +36 -0
- package/dist/model/relation.js +93 -0
- package/dist/parg/artifacts/ieee.d.ts +1 -1
- package/dist/parg/artifacts/ieee.js +1 -1
- package/dist/parg/worker.d.ts +4 -2
- package/dist/parg/worker.js +5 -3
- package/dist/parse-surface.d.ts +3 -31
- package/dist/parse-surface.js +6 -69
- package/dist/pubid-urn/decoder.d.ts +8 -0
- package/dist/pubid-urn/decoder.js +43 -0
- package/dist/pubid-urn/encoder.js +31 -0
- package/dist/pubid-urn/schema.d.ts +1 -1
- package/dist/pubid-urn/schema.js +1 -1
- package/dist/pubid-urn/schemas/bsi.js +1 -0
- package/dist/pubid-urn/schemas/bsi_pfs.js +9 -7
- package/dist/pubid-urn/schemas/cen_pfs.js +1 -0
- package/dist/pubid-urn/schemas/cencenelec.js +1 -0
- package/dist/pubid-urn/schemas/iec.js +1 -0
- package/dist/pubid-urn/schemas/ieee.js +1 -0
- package/dist/pubid-urn/schemas/iso.js +1 -0
- package/package.json +1 -1
- package/vendor/parg/bsi_pfs.json +1 -1
- package/vendor/parg/calconnect_pfs.json +1 -1
- package/vendor/parg/cen_pfs.json +1 -1
- package/vendor/parg/doi_pfs.json +1 -1
- package/vendor/parg/etsi_pfs.json +1 -1
- package/vendor/parg/ieee.json +1 -1
- package/vendor/parg/iho.json +1 -1
- package/vendor/parg/plateau.json +1 -1
- package/dist/flavors/api/grammar.d.ts +0 -4
- package/dist/flavors/ashrae/grammar.d.ts +0 -2
- package/dist/flavors/asme/grammar.d.ts +0 -2
- package/dist/flavors/astm/grammar.d.ts +0 -2
- package/dist/flavors/bsi/grammar.d.ts +0 -4
- package/dist/flavors/cen_cenelec/grammar.d.ts +0 -4
- package/dist/flavors/cie/grammar.d.ts +0 -5
- package/dist/flavors/csa/grammar.d.ts +0 -6
- package/dist/flavors/evs/grammar.d.ts +0 -2
- package/dist/flavors/evs/grammar.js +0 -68
- package/dist/flavors/gost/grammar.d.ts +0 -2
- package/dist/flavors/gost/grammar.js +0 -46
- package/dist/flavors/idf/grammar.d.ts +0 -2
- package/dist/flavors/iec/grammar.d.ts +0 -3
- package/dist/flavors/iec/grammar.js +0 -234
- package/dist/flavors/ieee/grammar.d.ts +0 -2
- package/dist/flavors/ieee/grammar.js +0 -777
- package/dist/flavors/iso/grammar.d.ts +0 -7
- package/dist/flavors/iso/grammar.js +0 -282
- package/dist/flavors/itu/grammar.d.ts +0 -4
- package/dist/flavors/itu/grammar.js +0 -276
- package/dist/flavors/nist/grammar.d.ts +0 -2
- package/dist/flavors/nist/grammar.js +0 -342
- package/dist/flavors/oiml/grammar.d.ts +0 -2
- package/dist/flavors/oiml/grammar.js +0 -206
- package/vendor/parg/csv.json +0 -1
- package/vendor/parg/ini.json +0 -1
- package/vendor/parg/json.json +0 -1
- package/vendor/parg/lua.json +0 -1
- package/vendor/parg/toml.json +0 -1
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
//! The csa semantic delta over the generated substrate
|
|
2
|
+
//! (pubid/pubid-grammar#158): the builder dispatch plus the
|
|
3
|
+
//! Identifier.parse pre-parse layer (CAN/, CAN3-, CSA-adoption, and
|
|
4
|
+
//! PACKAGE wrappers; the parser's normalization + prefix injection).
|
|
5
|
+
//! Pure — no `node:*` module, no engine import — so both entries (the
|
|
6
|
+
//! node barrel over the wasm artifact runtime, the worker entry over
|
|
7
|
+
//! the pure-TS worker engine) run the same delta.
|
|
8
|
+
//!
|
|
9
|
+
//! The parse function is injected: the entry binds it to
|
|
10
|
+
//! `substrate.boundToWire(substrate.parseBound(body))` (node) or the
|
|
11
|
+
//! worker engine's equivalent (worker), both producing the artifact's
|
|
12
|
+
//! declared wire. The artifact spells has_publisher / colon_format /
|
|
13
|
+
//! dash_format as the real tokens ("CSA " / ":" / "-") and carries the
|
|
14
|
+
//! combined/bundled parts in the position-indexed csa_code_part[] group
|
|
15
|
+
//! (csa.parg edition 2) where the hand grammar nested
|
|
16
|
+
//! first/second/third — the dispatch reads plus_separator /
|
|
17
|
+
//! comma_separator / csa_code_part and each part strips its part_
|
|
18
|
+
//! prefix before buildSingle, mirroring the reference builder.
|
|
19
|
+
import { normalizeCsa, csaPublisherPrefix } from "./grammar.worker.js";
|
|
20
|
+
import { BundledClass, CanadianAdoptedClass, CecClass, CombinedClass, CsaAdoptedClass, CsaSingleIdentifier, PackageClass, SeriesClass, StandardClass, } from "./model.js";
|
|
21
|
+
const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
22
|
+
const strv = (v) => {
|
|
23
|
+
if (v === undefined || v === null)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (Array.isArray(v)) {
|
|
26
|
+
const flat = v.flat(10);
|
|
27
|
+
const joined = flat.map(String).join("");
|
|
28
|
+
return joined.length > 0 ? joined : undefined;
|
|
29
|
+
}
|
|
30
|
+
const s = String(v).trim();
|
|
31
|
+
return s.length > 0 ? s : undefined;
|
|
32
|
+
};
|
|
33
|
+
function flatten(data) {
|
|
34
|
+
return Array.isArray(data) ? Object.assign({}, ...data) : data;
|
|
35
|
+
}
|
|
36
|
+
const ctor = (klass) => klass;
|
|
37
|
+
function tryForeign(flavor, raw, resolveForeign) {
|
|
38
|
+
const impl = resolveForeign(flavor);
|
|
39
|
+
if (impl === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
try {
|
|
42
|
+
return impl.parse(raw);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// --- Single identifiers (builder.rb build_single + friends) ---------------------------
|
|
49
|
+
function expandYear(yearStr, prefix) {
|
|
50
|
+
if (yearStr.length === 2) {
|
|
51
|
+
if (prefix === "M")
|
|
52
|
+
return `19${yearStr}`;
|
|
53
|
+
return Number(yearStr) < 50 ? `20${yearStr}` : `19${yearStr}`;
|
|
54
|
+
}
|
|
55
|
+
return yearStr;
|
|
56
|
+
}
|
|
57
|
+
function setReaffirmation(target, data) {
|
|
58
|
+
const self = target;
|
|
59
|
+
if (data["reaffirmation_4digit"] !== undefined) {
|
|
60
|
+
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
61
|
+
self["original_reaffirmation_4digit"] = true;
|
|
62
|
+
}
|
|
63
|
+
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
64
|
+
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
65
|
+
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
66
|
+
self["original_reaffirmation_4digit"] = false;
|
|
67
|
+
}
|
|
68
|
+
else if (data["reaffirmation"] !== undefined) {
|
|
69
|
+
const raw = data["reaffirmation"];
|
|
70
|
+
self["reaffirmation"] = isObj(raw)
|
|
71
|
+
? strv(raw["year"])
|
|
72
|
+
: strv(raw);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function selectSingleClass(data) {
|
|
76
|
+
if (data["no_notation"] !== undefined && data["no_number"] !== undefined)
|
|
77
|
+
return CecClass;
|
|
78
|
+
if (data["series_type"] !== undefined)
|
|
79
|
+
return SeriesClass;
|
|
80
|
+
if (data["series"] !== undefined && strv(data["series"]) === "SERIES")
|
|
81
|
+
return SeriesClass;
|
|
82
|
+
return StandardClass;
|
|
83
|
+
}
|
|
84
|
+
function buildSingle(dataIn) {
|
|
85
|
+
const data = dataIn;
|
|
86
|
+
const identifier = new (ctor(selectSingleClass(data)))();
|
|
87
|
+
const self = identifier;
|
|
88
|
+
if (data["publisher_prefix"] !== undefined) {
|
|
89
|
+
self["publisher_prefix"] = strv(data["publisher_prefix"]);
|
|
90
|
+
}
|
|
91
|
+
else if (data["code"] !== undefined) {
|
|
92
|
+
self["code_only"] = true;
|
|
93
|
+
}
|
|
94
|
+
if (data["has_publisher"] !== undefined)
|
|
95
|
+
self["has_publisher"] = true;
|
|
96
|
+
if (data["code"] !== undefined && !(identifier instanceof CecClass)) {
|
|
97
|
+
const codeValue = strv(data["code"]) ?? "";
|
|
98
|
+
const m = !data["year"] ? /^(.+)-(\d{2})$/.exec(codeValue) : null;
|
|
99
|
+
if (m !== null) {
|
|
100
|
+
self["number"] = m[1];
|
|
101
|
+
self["year"] = `20${m[2]}`;
|
|
102
|
+
self["year_format"] = "dash";
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
self["number"] = codeValue;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (identifier instanceof CecClass) {
|
|
109
|
+
if (data["code"] !== undefined && self["cec_part"] === undefined) {
|
|
110
|
+
self["cec_part"] = strv(data["code"]);
|
|
111
|
+
}
|
|
112
|
+
if (data["no_number"] !== undefined) {
|
|
113
|
+
self["no_number"] = strv(data["no_number"]);
|
|
114
|
+
}
|
|
115
|
+
if (self["cec_part"] !== undefined && self["no_number"] !== undefined) {
|
|
116
|
+
self["number"] = `${self["cec_part"]}-${self["no_number"]}`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (data["series_prefix"] !== undefined)
|
|
120
|
+
self["series_prefix"] = strv(data["series_prefix"]);
|
|
121
|
+
if (data["series"] !== undefined)
|
|
122
|
+
self["series"] = true;
|
|
123
|
+
const yearFormat = data["dash_format"] !== undefined
|
|
124
|
+
? "dash"
|
|
125
|
+
: "colon";
|
|
126
|
+
if (data["year"] !== undefined && self["year"] === undefined) {
|
|
127
|
+
const yearStr = strv(data["year"]) ?? "";
|
|
128
|
+
self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
|
|
129
|
+
if (yearStr.length === 4)
|
|
130
|
+
self["original_year_4digit"] = true;
|
|
131
|
+
self["year_format"] = yearFormat;
|
|
132
|
+
}
|
|
133
|
+
if (data["year_prefix"] !== undefined) {
|
|
134
|
+
self["year_prefix"] = strv(data["year_prefix"]);
|
|
135
|
+
if (strv(data["year_prefix"]) === "F")
|
|
136
|
+
self["french"] = true;
|
|
137
|
+
}
|
|
138
|
+
if (data["french"] !== undefined)
|
|
139
|
+
self["french"] = true;
|
|
140
|
+
setReaffirmation(identifier, data);
|
|
141
|
+
if (data["package_portion"] !== undefined) {
|
|
142
|
+
self["package"] = strv(data["package_portion"]);
|
|
143
|
+
}
|
|
144
|
+
return identifier;
|
|
145
|
+
}
|
|
146
|
+
function buildSeries(dataIn) {
|
|
147
|
+
const data = dataIn;
|
|
148
|
+
const series = new (ctor(SeriesClass))();
|
|
149
|
+
const self = series;
|
|
150
|
+
self["series"] = true;
|
|
151
|
+
if (data["publisher_prefix"] !== undefined)
|
|
152
|
+
self["publisher_prefix"] = strv(data["publisher_prefix"]);
|
|
153
|
+
if (data["series_prefix"] !== undefined)
|
|
154
|
+
self["series_prefix"] = strv(data["series_prefix"]);
|
|
155
|
+
if (data["code"] !== undefined)
|
|
156
|
+
self["number"] = strv(data["code"]);
|
|
157
|
+
if (data["year"] !== undefined) {
|
|
158
|
+
const yearStr = strv(data["year"]) ?? "";
|
|
159
|
+
self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
|
|
160
|
+
if (yearStr.length === 4)
|
|
161
|
+
self["original_year_4digit"] = true;
|
|
162
|
+
self["year_format"] = data["dash_format"] !== undefined ? "dash" : "colon";
|
|
163
|
+
}
|
|
164
|
+
if (data["year_prefix"] !== undefined)
|
|
165
|
+
self["year_prefix"] = strv(data["year_prefix"]);
|
|
166
|
+
setReaffirmation(series, data);
|
|
167
|
+
return series;
|
|
168
|
+
}
|
|
169
|
+
function buildCec(dataIn) {
|
|
170
|
+
const data = dataIn;
|
|
171
|
+
const cec = new (ctor(CecClass))();
|
|
172
|
+
const self = cec;
|
|
173
|
+
if (data["publisher_prefix"] !== undefined)
|
|
174
|
+
self["publisher_prefix"] = strv(data["publisher_prefix"]);
|
|
175
|
+
if (data["cec_part"] !== undefined)
|
|
176
|
+
self["cec_part"] = strv(data["cec_part"]);
|
|
177
|
+
if (data["no_number"] !== undefined)
|
|
178
|
+
self["no_number"] = strv(data["no_number"]);
|
|
179
|
+
if (self["cec_part"] !== undefined && self["no_number"] !== undefined) {
|
|
180
|
+
self["number"] = `${self["cec_part"]}-${self["no_number"]}`;
|
|
181
|
+
}
|
|
182
|
+
if (data["year"] !== undefined) {
|
|
183
|
+
const yearStr = strv(data["year"]) ?? "";
|
|
184
|
+
self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
|
|
185
|
+
if (yearStr.length === 4)
|
|
186
|
+
self["original_year_4digit"] = true;
|
|
187
|
+
self["year_format"] = data["dash_format"] !== undefined ? "dash" : "colon";
|
|
188
|
+
}
|
|
189
|
+
if (data["year_prefix"] !== undefined) {
|
|
190
|
+
self["year_prefix"] = strv(data["year_prefix"]);
|
|
191
|
+
if (strv(data["year_prefix"]) === "F")
|
|
192
|
+
self["french"] = true;
|
|
193
|
+
}
|
|
194
|
+
if (data["french"] !== undefined)
|
|
195
|
+
self["french"] = true;
|
|
196
|
+
setReaffirmation(cec, data);
|
|
197
|
+
return cec;
|
|
198
|
+
}
|
|
199
|
+
// --- The combined/bundled part group (the artifact wire) ------------------
|
|
200
|
+
/** Strips the part_-prefix the combined/bundled array group carries,
|
|
201
|
+
* leaving the plain field names buildSingle reads (builder.rb
|
|
202
|
+
* strip_part_prefix). */
|
|
203
|
+
function stripPartPrefix(part) {
|
|
204
|
+
const out = {};
|
|
205
|
+
for (const [key, value] of Object.entries(part)) {
|
|
206
|
+
out[key.startsWith("part_") ? key.slice("part_".length) : key] = value;
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
}
|
|
210
|
+
function combinedReaffirmation(self, data) {
|
|
211
|
+
if (data["reaffirmation_4digit"] !== undefined) {
|
|
212
|
+
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
213
|
+
self["original_reaffirmation_4digit"] = true;
|
|
214
|
+
}
|
|
215
|
+
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
216
|
+
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
217
|
+
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
218
|
+
self["original_reaffirmation_4digit"] = false;
|
|
219
|
+
}
|
|
220
|
+
else if (data["reaffirmation"] !== undefined) {
|
|
221
|
+
self["reaffirmation"] = strv(data["reaffirmation"]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function partArray(data) {
|
|
225
|
+
const parts = data["csa_code_part"];
|
|
226
|
+
return Array.isArray(parts)
|
|
227
|
+
? parts.filter((p) => isObj(p))
|
|
228
|
+
: [];
|
|
229
|
+
}
|
|
230
|
+
function buildBundled(data) {
|
|
231
|
+
const parts = partArray(data);
|
|
232
|
+
const self = {
|
|
233
|
+
base: buildSingle(stripPartPrefix(parts[0] ?? {})),
|
|
234
|
+
bundled_with: parts.slice(1).map((p) => buildSingle(stripPartPrefix(p))),
|
|
235
|
+
};
|
|
236
|
+
combinedReaffirmation(self, data);
|
|
237
|
+
return new (ctor(BundledClass))(self);
|
|
238
|
+
}
|
|
239
|
+
function buildCombinedFromParts(data) {
|
|
240
|
+
const parts = partArray(data).map((p) => ({ ...p }));
|
|
241
|
+
// SERIES and series_prefix bind as top-level scalars: the capture
|
|
242
|
+
// only fires in the parts that carry the keyword, and array bindings
|
|
243
|
+
// pair occurrences by index, so a sparse capture would land on the
|
|
244
|
+
// wrong part. The keyword qualifies the designation it follows — the
|
|
245
|
+
// last part in every combined form (builder.rb build_combined).
|
|
246
|
+
if (data["part_series"] !== undefined) {
|
|
247
|
+
const last = parts[parts.length - 1];
|
|
248
|
+
if (last !== undefined) {
|
|
249
|
+
last["part_series"] = data["part_series"];
|
|
250
|
+
if (data["part_series_prefix"] !== undefined) {
|
|
251
|
+
last["part_series_prefix"] = data["part_series_prefix"];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const self = {
|
|
256
|
+
identifiers: parts.map((p) => buildSingle(stripPartPrefix(p))),
|
|
257
|
+
separator: data["comma_separator"] !== undefined ? ", " : "/",
|
|
258
|
+
};
|
|
259
|
+
combinedReaffirmation(self, data);
|
|
260
|
+
if (data["package_portion"] !== undefined) {
|
|
261
|
+
self["package"] = strv(data["package_portion"]);
|
|
262
|
+
}
|
|
263
|
+
return new (ctor(CombinedClass))(self);
|
|
264
|
+
}
|
|
265
|
+
// --- The builder dispatch ---------------------------------------------------------------
|
|
266
|
+
function buildTree(parsed, resolveForeign) {
|
|
267
|
+
const data = parsed;
|
|
268
|
+
if (data["publisher_prefix"] !== undefined
|
|
269
|
+
&& ["CAN/CSA-", "CAN3-"].includes(strv(data["publisher_prefix"]) ?? "")) {
|
|
270
|
+
return buildCanadianAdopted(data);
|
|
271
|
+
}
|
|
272
|
+
if ("adoption_number" in data)
|
|
273
|
+
return buildAdoption(data, resolveForeign);
|
|
274
|
+
if ("series_type" in data)
|
|
275
|
+
return buildSeries(parsed);
|
|
276
|
+
if ("cec_part" in data)
|
|
277
|
+
return buildCec(parsed);
|
|
278
|
+
if ("package_portion" in data)
|
|
279
|
+
return buildPackage(parsed);
|
|
280
|
+
if ("plus_separator" in data)
|
|
281
|
+
return buildBundled(data);
|
|
282
|
+
if (data["csa_code_part"] !== undefined)
|
|
283
|
+
return buildCombinedFromParts(data);
|
|
284
|
+
return buildSingle(parsed);
|
|
285
|
+
}
|
|
286
|
+
function buildPackage(data) {
|
|
287
|
+
const baseData = { ...data };
|
|
288
|
+
delete baseData["package_portion"];
|
|
289
|
+
return new (ctor(PackageClass))({
|
|
290
|
+
base: buildSingle(baseData),
|
|
291
|
+
...(data["package_portion"] !== undefined
|
|
292
|
+
? { package_materials: strv(data["package_portion"]) }
|
|
293
|
+
: {}),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function parseAdoptionBase(adoptionOrg, baseStr, resolveForeign) {
|
|
297
|
+
if (adoptionOrg.startsWith("ISO") || adoptionOrg.startsWith("CEI")) {
|
|
298
|
+
return tryForeign("iso", baseStr, resolveForeign);
|
|
299
|
+
}
|
|
300
|
+
if (adoptionOrg.startsWith("IEC")) {
|
|
301
|
+
return tryForeign("iec", baseStr, resolveForeign);
|
|
302
|
+
}
|
|
303
|
+
return tryForeign("iso", baseStr, resolveForeign) ?? tryForeign("iec", baseStr, resolveForeign);
|
|
304
|
+
}
|
|
305
|
+
function buildAdoption(data, resolveForeign) {
|
|
306
|
+
let adoptionOrg = strv(data["adoption_org"]) ?? "";
|
|
307
|
+
const adoptionNumber = strv(data["adoption_number"]) ?? "";
|
|
308
|
+
const adoptionYear = strv(data["adoption_year"]) ?? "";
|
|
309
|
+
if (data["iso_type"] !== undefined)
|
|
310
|
+
adoptionOrg += ` ${strv(data["iso_type"])}`;
|
|
311
|
+
const yearSep = strv(data["adoption_year_sep"]) ?? ":";
|
|
312
|
+
const wrappedYear = adoptionYear.length === 2 ? `20${adoptionYear}` : adoptionYear;
|
|
313
|
+
let base;
|
|
314
|
+
if (data["adoption_amendment"] !== undefined) {
|
|
315
|
+
const baseStr = `${adoptionOrg} ${adoptionNumber}${yearSep}${wrappedYear}`;
|
|
316
|
+
const amendmentYear = strv(data["adoption_amendment_year"]) ?? "";
|
|
317
|
+
const wrappedAmendmentYear = amendmentYear.length === 2 ? `20${amendmentYear}` : amendmentYear;
|
|
318
|
+
const amendmentStr = `${baseStr}/Amd ${strv(data["adoption_amendment"])}:${wrappedAmendmentYear}`;
|
|
319
|
+
base = parseAdoptionBase(adoptionOrg, amendmentStr, resolveForeign);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
let wrappedIdStr = `${adoptionOrg} ${adoptionNumber}${yearSep}${wrappedYear}`;
|
|
323
|
+
if (adoptionOrg === "CEI/IEC") {
|
|
324
|
+
wrappedIdStr = wrappedIdStr.replace("CEI/IEC", "IEC");
|
|
325
|
+
}
|
|
326
|
+
base = parseAdoptionBase(adoptionOrg, wrappedIdStr, resolveForeign);
|
|
327
|
+
}
|
|
328
|
+
const self = { base };
|
|
329
|
+
if (data["reaffirmation_4digit"] !== undefined) {
|
|
330
|
+
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
331
|
+
}
|
|
332
|
+
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
333
|
+
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
334
|
+
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
335
|
+
}
|
|
336
|
+
else if (data["reaffirmation"] !== undefined) {
|
|
337
|
+
const raw = data["reaffirmation"];
|
|
338
|
+
self["reaffirmation"] = isObj(raw) ? strv(raw["year"]) : strv(raw);
|
|
339
|
+
}
|
|
340
|
+
return new (ctor(CsaAdoptedClass))(self);
|
|
341
|
+
}
|
|
342
|
+
function buildCanadianAdopted(data) {
|
|
343
|
+
const originalPrefix = strv(data["publisher_prefix"]);
|
|
344
|
+
const wrappedData = { ...data };
|
|
345
|
+
delete wrappedData["publisher_prefix"];
|
|
346
|
+
let base;
|
|
347
|
+
if ("series_type" in wrappedData) {
|
|
348
|
+
base = buildSeries(wrappedData);
|
|
349
|
+
if (originalPrefix !== undefined) {
|
|
350
|
+
base["publisher_prefix"] = originalPrefix;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else if ("cec_part" in wrappedData) {
|
|
354
|
+
base = buildCec(wrappedData);
|
|
355
|
+
if (originalPrefix !== undefined) {
|
|
356
|
+
base["publisher_prefix"] = originalPrefix;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
base = buildSingle(wrappedData);
|
|
361
|
+
if (originalPrefix !== undefined) {
|
|
362
|
+
base["publisher_prefix"] = originalPrefix;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const self = { base };
|
|
366
|
+
if (data["reaffirmation_4digit"] !== undefined) {
|
|
367
|
+
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
368
|
+
}
|
|
369
|
+
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
370
|
+
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
371
|
+
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
372
|
+
}
|
|
373
|
+
return new (ctor(CanadianAdoptedClass))(self);
|
|
374
|
+
}
|
|
375
|
+
// --- The prefix injection (parser.rb inject_publisher_prefix) ------------
|
|
376
|
+
/** The artifact-wire injection: the combined/bundled parts take the
|
|
377
|
+
* prefix per position — the first part always, later ones only when
|
|
378
|
+
* they spell their own publisher token, unless the comma form repeats
|
|
379
|
+
* it — and plain hashes take it at the top level. */
|
|
380
|
+
function injectPublisherPrefix(hash, prefix) {
|
|
381
|
+
const parts = partArray(hash);
|
|
382
|
+
if (parts.length > 0) {
|
|
383
|
+
parts.forEach((part, index) => {
|
|
384
|
+
if (index > 0 && part["part_has_publisher"] === undefined
|
|
385
|
+
&& hash["comma_separator"] === undefined) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
part["publisher_prefix"] = prefix;
|
|
389
|
+
});
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
hash["publisher_prefix"] = prefix;
|
|
393
|
+
}
|
|
394
|
+
function setPublisherPrefix(obj, prefix) {
|
|
395
|
+
const self = obj;
|
|
396
|
+
self["publisher_prefix"] = prefix;
|
|
397
|
+
const combined = self["identifiers"];
|
|
398
|
+
if (combined !== undefined) {
|
|
399
|
+
combined.forEach((part, index) => {
|
|
400
|
+
const partSelf = part;
|
|
401
|
+
if (index > 0 && partSelf["has_publisher"] !== true)
|
|
402
|
+
return;
|
|
403
|
+
partSelf["publisher_prefix"] = prefix;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
const base = self["base"];
|
|
407
|
+
if (base !== undefined && combined === undefined) {
|
|
408
|
+
setPublisherPrefix(base, prefix);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function extractReaffirmation(wrappedInput) {
|
|
412
|
+
const m = /\(R(\d{2,4})\)/.exec(wrappedInput);
|
|
413
|
+
if (m === null)
|
|
414
|
+
return { year: undefined, was4digit: false, rest: wrappedInput };
|
|
415
|
+
let year = m[1];
|
|
416
|
+
const was4digit = year.length === 4;
|
|
417
|
+
if (year.length === 2) {
|
|
418
|
+
year = Number(year) < 50 ? `20${year}` : `19${year}`;
|
|
419
|
+
}
|
|
420
|
+
const rest = wrappedInput.replace(/\s*\(R\d{2,4}\)/, "");
|
|
421
|
+
return { year, was4digit, rest };
|
|
422
|
+
}
|
|
423
|
+
function parseExternalStandard(input, resolveForeign) {
|
|
424
|
+
if (/^(ISO\/IEC|ISO|IEC|CEI|CEI\/IEC)\s/.test(input)) {
|
|
425
|
+
return tryForeign("iso", input.replace(/^CEI\/IEC/, "IEC"), resolveForeign);
|
|
426
|
+
}
|
|
427
|
+
// The catalogue also prints the IWA designation without the ISO
|
|
428
|
+
// keyword ("CAN/CSA-IWA 18:17" beside "CAN/CSA-ISO IWA 18:17"); the
|
|
429
|
+
// ISO parser wants the ISO/ prefix.
|
|
430
|
+
if (/^IWA\s/.test(input)) {
|
|
431
|
+
return tryForeign("iso", input.replace(/^IWA\s/, "ISO/IWA "), resolveForeign);
|
|
432
|
+
}
|
|
433
|
+
if (/^CISPR\s/.test(input)) {
|
|
434
|
+
return tryForeign("iec", input, resolveForeign);
|
|
435
|
+
}
|
|
436
|
+
return undefined;
|
|
437
|
+
}
|
|
438
|
+
// --- Identifier.parse (identifier.rb) ------------------------------------------------------
|
|
439
|
+
/** The bound → wire lane is injected so the node entry (the generated
|
|
440
|
+
* substrate over the wasm artifact runtime) and the worker entry (the
|
|
441
|
+
* pure-TS worker engine) share this delta byte for byte — and so every
|
|
442
|
+
* implementation instance carries its own pre-parse layer, with no
|
|
443
|
+
* module-scope wire slot. */
|
|
444
|
+
export function makeCsaGrammarImplementation(parseWire, resolveForeign) {
|
|
445
|
+
function parseTree(input) {
|
|
446
|
+
const normalized = normalizeCsa(input);
|
|
447
|
+
const prefix = csaPublisherPrefix(normalized);
|
|
448
|
+
const hash = flatten(parseWire(normalized));
|
|
449
|
+
if (prefix !== undefined)
|
|
450
|
+
injectPublisherPrefix(hash, prefix);
|
|
451
|
+
return hash;
|
|
452
|
+
}
|
|
453
|
+
function tryParse(input, resolver) {
|
|
454
|
+
try {
|
|
455
|
+
return parseCsa(input, resolver);
|
|
456
|
+
}
|
|
457
|
+
catch {
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function parseCsa(input, resolver) {
|
|
462
|
+
if (input.startsWith("#")) {
|
|
463
|
+
throw new Error(`Not a CSA identifier (comment): ${input}`);
|
|
464
|
+
}
|
|
465
|
+
if (/^CSA (Communities|Group|Learning|OnDemand|Update)/.test(input)) {
|
|
466
|
+
throw new Error(`Not a CSA standard: ${input}`);
|
|
467
|
+
}
|
|
468
|
+
input = input.replaceAll("CEI/IEC", "IEC").replaceAll(/\bCEI\b/g, "IEC");
|
|
469
|
+
// CAN/ wrapper (Canadian adoption).
|
|
470
|
+
if (input.startsWith("CAN/")) {
|
|
471
|
+
const wrappedInput0 = input.replace(/^CAN\//, "");
|
|
472
|
+
if (wrappedInput0.includes("+")
|
|
473
|
+
|| (wrappedInput0.includes("/") && /\s+CSA-/.test(wrappedInput0))
|
|
474
|
+
|| (wrappedInput0.includes("/") && (wrappedInput0.match(/CSA-/g) ?? []).length > 1)) {
|
|
475
|
+
let normalized = wrappedInput0.replace(/^CSA-/, "CSA ");
|
|
476
|
+
normalized = normalized.replaceAll("CAN/CSA-", "CSA ").replaceAll("CAN3-", "CSA ");
|
|
477
|
+
normalized = normalized.replaceAll(/\s+/g, " ").trim();
|
|
478
|
+
const result = buildTree(parseTree(normalized), resolver);
|
|
479
|
+
setPublisherPrefix(result, "CAN/CSA-");
|
|
480
|
+
const rMatch = /\(R(\d{4})\)/.exec(wrappedInput0);
|
|
481
|
+
if (rMatch !== null) {
|
|
482
|
+
result["reaffirmation"] = rMatch[1];
|
|
483
|
+
}
|
|
484
|
+
return result;
|
|
485
|
+
}
|
|
486
|
+
const { year: reaffirmYear, was4digit, rest: stripped } = extractReaffirmation(wrappedInput0);
|
|
487
|
+
const originalPrefix = stripped.startsWith("CSA-")
|
|
488
|
+
? "CSA-"
|
|
489
|
+
: stripped.startsWith("CSA ")
|
|
490
|
+
? "CSA"
|
|
491
|
+
: undefined;
|
|
492
|
+
const normalized = stripped.replace(/^CSA-/, "CSA ");
|
|
493
|
+
const base = parseCsa(normalized, resolver);
|
|
494
|
+
const baseSelf = base;
|
|
495
|
+
// Only the single-document types and CsaAdopted declare
|
|
496
|
+
// publisher_prefix; the containers (Combined/Bundled/Package) keep
|
|
497
|
+
// what the recursive parse already injected.
|
|
498
|
+
if (base instanceof CsaSingleIdentifier || base instanceof CsaAdoptedClass) {
|
|
499
|
+
if (base instanceof SeriesClass) {
|
|
500
|
+
baseSelf["publisher_prefix"] = "CAN/CSA-";
|
|
501
|
+
}
|
|
502
|
+
else if (originalPrefix !== undefined) {
|
|
503
|
+
baseSelf["publisher_prefix"] = originalPrefix;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
if (reaffirmYear !== undefined) {
|
|
507
|
+
baseSelf["reaffirmation"] = reaffirmYear;
|
|
508
|
+
baseSelf["original_reaffirmation_4digit"] = was4digit;
|
|
509
|
+
}
|
|
510
|
+
return new (ctor(CanadianAdoptedClass))({
|
|
511
|
+
base,
|
|
512
|
+
...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
// CAN3- wrapper (historical).
|
|
516
|
+
if (input.startsWith("CAN3-")) {
|
|
517
|
+
const wrapped0 = input.replace(/^CAN3-/, "CSA ");
|
|
518
|
+
const hasDashYear = /-\d{2}\b/.test(wrapped0);
|
|
519
|
+
const { year: reaffirmYear, was4digit, rest: stripped } = extractReaffirmation(wrapped0);
|
|
520
|
+
const base = parseCsa(stripped, resolver);
|
|
521
|
+
const baseSelf = base;
|
|
522
|
+
if (hasDashYear) {
|
|
523
|
+
baseSelf["year_format"] = "dash";
|
|
524
|
+
baseSelf["original_year_4digit"] = false;
|
|
525
|
+
}
|
|
526
|
+
if (base instanceof SeriesClass) {
|
|
527
|
+
baseSelf["publisher_prefix"] = "CAN3-";
|
|
528
|
+
if (reaffirmYear !== undefined) {
|
|
529
|
+
baseSelf["reaffirmation"] = reaffirmYear;
|
|
530
|
+
baseSelf["original_reaffirmation_4digit"] = was4digit;
|
|
531
|
+
}
|
|
532
|
+
return base;
|
|
533
|
+
}
|
|
534
|
+
baseSelf["publisher_prefix"] = "CAN3-";
|
|
535
|
+
if (reaffirmYear !== undefined) {
|
|
536
|
+
baseSelf["reaffirmation"] = reaffirmYear;
|
|
537
|
+
baseSelf["original_reaffirmation_4digit"] = was4digit;
|
|
538
|
+
}
|
|
539
|
+
return new (ctor(CanadianAdoptedClass))({
|
|
540
|
+
base,
|
|
541
|
+
...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
// CSA adoption of international standards. The catalogue also drops
|
|
545
|
+
// the ISO keyword from the IWA designation ("CSA IWA 18:17").
|
|
546
|
+
if (/^CSA (ISO\/IEC|CEI\/IEC|CISPR|IEC|CEI|ISO|IWA)\s/.test(input)) {
|
|
547
|
+
let wrapped = input.replace(/^CSA\s+/, "");
|
|
548
|
+
const { year: reaffirmYear, rest: stripped } = extractReaffirmation(wrapped);
|
|
549
|
+
wrapped = stripped;
|
|
550
|
+
const shortYear = /:(\d{2})\b/.exec(wrapped);
|
|
551
|
+
if (shortYear !== null) {
|
|
552
|
+
const two = shortYear[1];
|
|
553
|
+
const full = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
554
|
+
wrapped = wrapped.replace(new RegExp(`:${two}\\b`), `:${full}`);
|
|
555
|
+
}
|
|
556
|
+
wrapped = wrapped.replace(/\/A(\d+)([:/-])(\d{2,4})\b/g, (_m, num, sep, year) => {
|
|
557
|
+
const full = year.length === 2
|
|
558
|
+
? (Number(year) < 50 ? `20${year}` : `19${year}`)
|
|
559
|
+
: year;
|
|
560
|
+
return `/Amd ${num}${sep}${full}`;
|
|
561
|
+
});
|
|
562
|
+
const base = parseExternalStandard(wrapped, resolver);
|
|
563
|
+
if (base === undefined) {
|
|
564
|
+
throw new Error(`Unparseable adopted standard: ${input}`);
|
|
565
|
+
}
|
|
566
|
+
return new (ctor(CsaAdoptedClass))({
|
|
567
|
+
base,
|
|
568
|
+
...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
// Package identifiers.
|
|
572
|
+
if (/\sPACKAGE\b/i.test(input)) {
|
|
573
|
+
let baseInput;
|
|
574
|
+
let packageMaterials;
|
|
575
|
+
let materialsAfter = true;
|
|
576
|
+
const after = /\sPACKAGE\s+[A-Z]/i.exec(input);
|
|
577
|
+
const yearThen = /:(\d{2,4})(\s+[^P]+)\s+PACKAGE/i.exec(input);
|
|
578
|
+
if (after !== null) {
|
|
579
|
+
const idx = input.search(/\s+PACKAGE\s+/i);
|
|
580
|
+
baseInput = input.slice(0, idx).trim();
|
|
581
|
+
packageMaterials = input.slice(input.indexOf("PACKAGE", idx) + "PACKAGE".length).trim() === ""
|
|
582
|
+
? ""
|
|
583
|
+
: input.slice(idx).replace(/^\s+PACKAGE\s+/i, "").trim();
|
|
584
|
+
materialsAfter = true;
|
|
585
|
+
}
|
|
586
|
+
else if (yearThen !== null) {
|
|
587
|
+
const yearMatch = /:\d{2,4}/.exec(input);
|
|
588
|
+
if (yearMatch !== null) {
|
|
589
|
+
if (/,\s+CSA/.test(input)) {
|
|
590
|
+
const combinedMatch = /^(.+?)(\s+&[^P]+)\s+PACKAGE$/i.exec(input);
|
|
591
|
+
if (combinedMatch !== null) {
|
|
592
|
+
baseInput = combinedMatch[1].trim();
|
|
593
|
+
packageMaterials = `${combinedMatch[2].trim()} Package`;
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
baseInput = input.slice(0, yearMatch.index + yearMatch[0].length);
|
|
597
|
+
packageMaterials = input.slice(yearMatch.index + yearMatch[0].length).trim();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
baseInput = input.slice(0, yearMatch.index + yearMatch[0].length).trim();
|
|
602
|
+
packageMaterials = input.slice(yearMatch.index + yearMatch[0].length).trim();
|
|
603
|
+
}
|
|
604
|
+
materialsAfter = false;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
const trailing = /^(.+?)\s+PACKAGE\s*$/i.exec(input);
|
|
609
|
+
if (trailing !== null) {
|
|
610
|
+
baseInput = trailing[1].trim();
|
|
611
|
+
packageMaterials = "";
|
|
612
|
+
materialsAfter = true;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (baseInput === undefined || baseInput === "") {
|
|
616
|
+
// Fallback: parse incrementally.
|
|
617
|
+
const tokens = input.split(/\s+/);
|
|
618
|
+
let acc = "";
|
|
619
|
+
for (const token of tokens) {
|
|
620
|
+
if (/^PACKAGE$/i.test(token))
|
|
621
|
+
break;
|
|
622
|
+
const testInput = acc === "" ? token : `${acc} ${token}`;
|
|
623
|
+
if (tryParse(testInput, resolver) === undefined)
|
|
624
|
+
break;
|
|
625
|
+
acc = testInput;
|
|
626
|
+
}
|
|
627
|
+
baseInput = acc;
|
|
628
|
+
if (baseInput !== "" && baseInput.length < input.length) {
|
|
629
|
+
const materialsInput = input.slice(baseInput.length).trim();
|
|
630
|
+
packageMaterials = materialsInput.replace(/\s+PACKAGE\s*$/i, "").trim();
|
|
631
|
+
materialsAfter = packageMaterials !== "";
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
if (baseInput === undefined || baseInput === "") {
|
|
635
|
+
throw new Error(`Unparseable package base: ${input}`);
|
|
636
|
+
}
|
|
637
|
+
const base = parseCsa(baseInput, resolver);
|
|
638
|
+
return new (ctor(PackageClass))({
|
|
639
|
+
base,
|
|
640
|
+
package_keyword: "PACKAGE",
|
|
641
|
+
...(packageMaterials !== undefined && packageMaterials !== ""
|
|
642
|
+
? { package_materials: packageMaterials }
|
|
643
|
+
: {}),
|
|
644
|
+
materials_after_keyword: materialsAfter,
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
// Plain path with parser-level normalization and prefix injection.
|
|
648
|
+
const hasDashYear = /-\d{2}\b/.test(input);
|
|
649
|
+
const result = buildTree(parseTree(input), resolver);
|
|
650
|
+
const self = result;
|
|
651
|
+
if (hasDashYear && self["year_format"] === undefined) {
|
|
652
|
+
self["year_format"] = "dash";
|
|
653
|
+
}
|
|
654
|
+
return result;
|
|
655
|
+
}
|
|
656
|
+
return {
|
|
657
|
+
parse(input) {
|
|
658
|
+
return parseCsa(input, resolveForeign);
|
|
659
|
+
},
|
|
660
|
+
};
|
|
661
|
+
}
|