@pubid/pubid 0.1.71 → 0.1.72
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/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 +3 -0
- package/dist/flavors/ieee/preprocessor.js +10 -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/model/identifier.d.ts +13 -1
- package/dist/model/identifier.js +71 -9
- 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.js +4 -2
- 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
|
@@ -1,633 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const flat = v.flat(10);
|
|
15
|
-
const joined = flat.map(String).join("");
|
|
16
|
-
return joined.length > 0 ? joined : undefined;
|
|
17
|
-
}
|
|
18
|
-
const s = String(v).trim();
|
|
19
|
-
return s.length > 0 ? s : undefined;
|
|
20
|
-
};
|
|
21
|
-
function flatten(data) {
|
|
22
|
-
return Array.isArray(data) ? Object.assign({}, ...data) : data;
|
|
23
|
-
}
|
|
24
|
-
const ctor = (klass) => klass;
|
|
25
|
-
function tryForeign(flavor, raw, resolveForeign) {
|
|
26
|
-
const impl = resolveForeign(flavor);
|
|
27
|
-
if (impl === undefined)
|
|
28
|
-
return undefined;
|
|
29
|
-
try {
|
|
30
|
-
return impl.parse(raw);
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
// --- Single identifiers (builder.rb build_single + friends) ---------------------------
|
|
37
|
-
function expandYear(yearStr, prefix) {
|
|
38
|
-
if (yearStr.length === 2) {
|
|
39
|
-
if (prefix === "M")
|
|
40
|
-
return `19${yearStr}`;
|
|
41
|
-
return Number(yearStr) < 50 ? `20${yearStr}` : `19${yearStr}`;
|
|
42
|
-
}
|
|
43
|
-
return yearStr;
|
|
44
|
-
}
|
|
45
|
-
function setReaffirmation(target, data) {
|
|
46
|
-
const self = target;
|
|
47
|
-
if (data["reaffirmation_4digit"] !== undefined) {
|
|
48
|
-
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
49
|
-
self["original_reaffirmation_4digit"] = true;
|
|
50
|
-
}
|
|
51
|
-
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
52
|
-
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
53
|
-
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
54
|
-
self["original_reaffirmation_4digit"] = false;
|
|
55
|
-
}
|
|
56
|
-
else if (data["reaffirmation"] !== undefined) {
|
|
57
|
-
const raw = data["reaffirmation"];
|
|
58
|
-
self["reaffirmation"] = isObj(raw)
|
|
59
|
-
? strv(raw["year"])
|
|
60
|
-
: strv(raw);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function selectSingleClass(data) {
|
|
64
|
-
if (data["no_notation"] !== undefined && data["no_number"] !== undefined)
|
|
65
|
-
return CecClass;
|
|
66
|
-
if (data["series_type"] !== undefined)
|
|
67
|
-
return SeriesClass;
|
|
68
|
-
if (data["series"] !== undefined && strv(data["series"]) === "SERIES")
|
|
69
|
-
return SeriesClass;
|
|
70
|
-
return StandardClass;
|
|
71
|
-
}
|
|
72
|
-
function buildSingle(dataIn) {
|
|
73
|
-
const data = dataIn;
|
|
74
|
-
const identifier = new (ctor(selectSingleClass(data)))();
|
|
75
|
-
const self = identifier;
|
|
76
|
-
if (data["publisher_prefix"] !== undefined) {
|
|
77
|
-
self["publisher_prefix"] = strv(data["publisher_prefix"]);
|
|
78
|
-
}
|
|
79
|
-
else if (data["code"] !== undefined) {
|
|
80
|
-
self["code_only"] = true;
|
|
81
|
-
}
|
|
82
|
-
if (data["has_publisher"] !== undefined)
|
|
83
|
-
self["has_publisher"] = true;
|
|
84
|
-
if (data["code"] !== undefined && !(identifier instanceof CecClass)) {
|
|
85
|
-
const codeValue = strv(data["code"]) ?? "";
|
|
86
|
-
const m = !data["year"] ? /^(.+)-(\d{2})$/.exec(codeValue) : null;
|
|
87
|
-
if (m !== null) {
|
|
88
|
-
self["number"] = m[1];
|
|
89
|
-
self["year"] = `20${m[2]}`;
|
|
90
|
-
self["year_format"] = "dash";
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
self["number"] = codeValue;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (identifier instanceof CecClass) {
|
|
97
|
-
if (data["code"] !== undefined && self["cec_part"] === undefined) {
|
|
98
|
-
self["cec_part"] = strv(data["code"]);
|
|
99
|
-
}
|
|
100
|
-
if (data["no_number"] !== undefined) {
|
|
101
|
-
self["no_number"] = strv(data["no_number"]);
|
|
102
|
-
}
|
|
103
|
-
if (self["cec_part"] !== undefined && self["no_number"] !== undefined) {
|
|
104
|
-
self["number"] = `${self["cec_part"]}-${self["no_number"]}`;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (data["series_prefix"] !== undefined)
|
|
108
|
-
self["series_prefix"] = strv(data["series_prefix"]);
|
|
109
|
-
if (data["series"] !== undefined)
|
|
110
|
-
self["series"] = true;
|
|
111
|
-
const yearFormat = data["dash_format"] !== undefined
|
|
112
|
-
? "dash"
|
|
113
|
-
: "colon";
|
|
114
|
-
if (data["year"] !== undefined && self["year"] === undefined) {
|
|
115
|
-
const yearStr = strv(data["year"]) ?? "";
|
|
116
|
-
self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
|
|
117
|
-
if (yearStr.length === 4)
|
|
118
|
-
self["original_year_4digit"] = true;
|
|
119
|
-
self["year_format"] = yearFormat;
|
|
120
|
-
}
|
|
121
|
-
if (data["year_prefix"] !== undefined) {
|
|
122
|
-
self["year_prefix"] = strv(data["year_prefix"]);
|
|
123
|
-
if (strv(data["year_prefix"]) === "F")
|
|
124
|
-
self["french"] = true;
|
|
125
|
-
}
|
|
126
|
-
if (data["french"] !== undefined)
|
|
127
|
-
self["french"] = true;
|
|
128
|
-
setReaffirmation(identifier, data);
|
|
129
|
-
if (data["package_portion"] !== undefined) {
|
|
130
|
-
self["package"] = strv(data["package_portion"]);
|
|
131
|
-
}
|
|
132
|
-
return identifier;
|
|
133
|
-
}
|
|
134
|
-
function buildSeries(dataIn) {
|
|
135
|
-
const data = dataIn;
|
|
136
|
-
const series = new (ctor(SeriesClass))();
|
|
137
|
-
const self = series;
|
|
138
|
-
self["series"] = true;
|
|
139
|
-
if (data["publisher_prefix"] !== undefined)
|
|
140
|
-
self["publisher_prefix"] = strv(data["publisher_prefix"]);
|
|
141
|
-
if (data["series_prefix"] !== undefined)
|
|
142
|
-
self["series_prefix"] = strv(data["series_prefix"]);
|
|
143
|
-
if (data["code"] !== undefined)
|
|
144
|
-
self["number"] = strv(data["code"]);
|
|
145
|
-
if (data["year"] !== undefined) {
|
|
146
|
-
const yearStr = strv(data["year"]) ?? "";
|
|
147
|
-
self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
|
|
148
|
-
if (yearStr.length === 4)
|
|
149
|
-
self["original_year_4digit"] = true;
|
|
150
|
-
self["year_format"] = data["dash_format"] !== undefined ? "dash" : "colon";
|
|
151
|
-
}
|
|
152
|
-
if (data["year_prefix"] !== undefined)
|
|
153
|
-
self["year_prefix"] = strv(data["year_prefix"]);
|
|
154
|
-
setReaffirmation(series, data);
|
|
155
|
-
return series;
|
|
156
|
-
}
|
|
157
|
-
function buildCec(dataIn) {
|
|
158
|
-
const data = dataIn;
|
|
159
|
-
const cec = new (ctor(CecClass))();
|
|
160
|
-
const self = cec;
|
|
161
|
-
if (data["publisher_prefix"] !== undefined)
|
|
162
|
-
self["publisher_prefix"] = strv(data["publisher_prefix"]);
|
|
163
|
-
if (data["cec_part"] !== undefined)
|
|
164
|
-
self["cec_part"] = strv(data["cec_part"]);
|
|
165
|
-
if (data["no_number"] !== undefined)
|
|
166
|
-
self["no_number"] = strv(data["no_number"]);
|
|
167
|
-
if (self["cec_part"] !== undefined && self["no_number"] !== undefined) {
|
|
168
|
-
self["number"] = `${self["cec_part"]}-${self["no_number"]}`;
|
|
169
|
-
}
|
|
170
|
-
if (data["year"] !== undefined) {
|
|
171
|
-
const yearStr = strv(data["year"]) ?? "";
|
|
172
|
-
self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
|
|
173
|
-
if (yearStr.length === 4)
|
|
174
|
-
self["original_year_4digit"] = true;
|
|
175
|
-
self["year_format"] = data["dash_format"] !== undefined ? "dash" : "colon";
|
|
176
|
-
}
|
|
177
|
-
if (data["year_prefix"] !== undefined) {
|
|
178
|
-
self["year_prefix"] = strv(data["year_prefix"]);
|
|
179
|
-
if (strv(data["year_prefix"]) === "F")
|
|
180
|
-
self["french"] = true;
|
|
181
|
-
}
|
|
182
|
-
if (data["french"] !== undefined)
|
|
183
|
-
self["french"] = true;
|
|
184
|
-
setReaffirmation(cec, data);
|
|
185
|
-
return cec;
|
|
186
|
-
}
|
|
187
|
-
// --- The builder dispatch ---------------------------------------------------------------
|
|
188
|
-
function buildTree(parsed, resolveForeign) {
|
|
189
|
-
const data = parsed;
|
|
190
|
-
if (data["publisher_prefix"] !== undefined
|
|
191
|
-
&& ["CAN/CSA-", "CAN3-"].includes(strv(data["publisher_prefix"]) ?? "")) {
|
|
192
|
-
return buildCanadianAdopted(data);
|
|
193
|
-
}
|
|
194
|
-
if ("adoption_number" in data)
|
|
195
|
-
return buildAdoption(data, resolveForeign);
|
|
196
|
-
if ("series_type" in data)
|
|
197
|
-
return buildSeries(parsed);
|
|
198
|
-
if ("cec_part" in data)
|
|
199
|
-
return buildCec(parsed);
|
|
200
|
-
if ("package_portion" in data)
|
|
201
|
-
return buildPackage(parsed);
|
|
202
|
-
if ("bundled_first" in data)
|
|
203
|
-
return buildBundled(data);
|
|
204
|
-
if (data["first"] !== undefined && data["second"] !== undefined)
|
|
205
|
-
return buildCombined(data);
|
|
206
|
-
return buildSingle(parsed);
|
|
207
|
-
}
|
|
208
|
-
function buildPackage(data) {
|
|
209
|
-
const baseData = { ...data };
|
|
210
|
-
delete baseData["package_portion"];
|
|
211
|
-
return new (ctor(PackageClass))({
|
|
212
|
-
base: buildSingle(baseData),
|
|
213
|
-
...(data["package_portion"] !== undefined
|
|
214
|
-
? { package_materials: strv(data["package_portion"]) }
|
|
215
|
-
: {}),
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
function parseAdoptionBase(adoptionOrg, baseStr, resolveForeign) {
|
|
219
|
-
if (adoptionOrg.startsWith("ISO") || adoptionOrg.startsWith("CEI")) {
|
|
220
|
-
return tryForeign("iso", baseStr, resolveForeign);
|
|
221
|
-
}
|
|
222
|
-
if (adoptionOrg.startsWith("IEC")) {
|
|
223
|
-
return tryForeign("iec", baseStr, resolveForeign);
|
|
224
|
-
}
|
|
225
|
-
return tryForeign("iso", baseStr, resolveForeign) ?? tryForeign("iec", baseStr, resolveForeign);
|
|
226
|
-
}
|
|
227
|
-
function buildAdoption(data, resolveForeign) {
|
|
228
|
-
let adoptionOrg = strv(data["adoption_org"]) ?? "";
|
|
229
|
-
const adoptionNumber = strv(data["adoption_number"]) ?? "";
|
|
230
|
-
const adoptionYear = strv(data["adoption_year"]) ?? "";
|
|
231
|
-
if (data["iso_type"] !== undefined)
|
|
232
|
-
adoptionOrg += ` ${strv(data["iso_type"])}`;
|
|
233
|
-
const yearSep = strv(data["adoption_year_sep"]) ?? ":";
|
|
234
|
-
const wrappedYear = adoptionYear.length === 2 ? `20${adoptionYear}` : adoptionYear;
|
|
235
|
-
let base;
|
|
236
|
-
if (data["adoption_amendment"] !== undefined) {
|
|
237
|
-
const baseStr = `${adoptionOrg} ${adoptionNumber}${yearSep}${wrappedYear}`;
|
|
238
|
-
const amendmentYear = strv(data["adoption_amendment_year"]) ?? "";
|
|
239
|
-
const wrappedAmendmentYear = amendmentYear.length === 2 ? `20${amendmentYear}` : amendmentYear;
|
|
240
|
-
const amendmentStr = `${baseStr}/Amd ${strv(data["adoption_amendment"])}:${wrappedAmendmentYear}`;
|
|
241
|
-
base = parseAdoptionBase(adoptionOrg, amendmentStr, resolveForeign);
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
let wrappedIdStr = `${adoptionOrg} ${adoptionNumber}${yearSep}${wrappedYear}`;
|
|
245
|
-
if (adoptionOrg === "CEI/IEC") {
|
|
246
|
-
wrappedIdStr = wrappedIdStr.replace("CEI/IEC", "IEC");
|
|
247
|
-
}
|
|
248
|
-
base = parseAdoptionBase(adoptionOrg, wrappedIdStr, resolveForeign);
|
|
249
|
-
}
|
|
250
|
-
const self = { base };
|
|
251
|
-
if (data["reaffirmation_4digit"] !== undefined) {
|
|
252
|
-
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
253
|
-
}
|
|
254
|
-
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
255
|
-
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
256
|
-
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
257
|
-
}
|
|
258
|
-
else if (data["reaffirmation"] !== undefined) {
|
|
259
|
-
const raw = data["reaffirmation"];
|
|
260
|
-
self["reaffirmation"] = isObj(raw) ? strv(raw["year"]) : strv(raw);
|
|
261
|
-
}
|
|
262
|
-
return new (ctor(CsaAdoptedClass))(self);
|
|
263
|
-
}
|
|
264
|
-
function buildCanadianAdopted(data) {
|
|
265
|
-
const originalPrefix = strv(data["publisher_prefix"]);
|
|
266
|
-
const wrappedData = { ...data };
|
|
267
|
-
delete wrappedData["publisher_prefix"];
|
|
268
|
-
let base;
|
|
269
|
-
if ("series_type" in wrappedData) {
|
|
270
|
-
base = buildSeries(wrappedData);
|
|
271
|
-
if (originalPrefix !== undefined) {
|
|
272
|
-
base["publisher_prefix"] = originalPrefix;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
else if ("cec_part" in wrappedData) {
|
|
276
|
-
base = buildCec(wrappedData);
|
|
277
|
-
if (originalPrefix !== undefined) {
|
|
278
|
-
base["publisher_prefix"] = originalPrefix;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
base = buildSingle(wrappedData);
|
|
283
|
-
if (originalPrefix !== undefined) {
|
|
284
|
-
base["publisher_prefix"] = originalPrefix;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
const self = { base };
|
|
288
|
-
if (data["reaffirmation_4digit"] !== undefined) {
|
|
289
|
-
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
290
|
-
}
|
|
291
|
-
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
292
|
-
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
293
|
-
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
294
|
-
}
|
|
295
|
-
return new (ctor(CanadianAdoptedClass))(self);
|
|
296
|
-
}
|
|
297
|
-
function buildBundled(data) {
|
|
298
|
-
const base = buildSingle(flatten(data["base"]));
|
|
299
|
-
const portions = [flatten(data["bundled_first"])];
|
|
300
|
-
const rest = data["bundled_rest"];
|
|
301
|
-
if (rest !== undefined && (!Array.isArray(rest) || rest.length > 0)) {
|
|
302
|
-
const restArr = (Array.isArray(rest)
|
|
303
|
-
? rest.flat(10)
|
|
304
|
-
: [rest])
|
|
305
|
-
.filter((x) => isObj(x));
|
|
306
|
-
for (const portion of restArr) {
|
|
307
|
-
portions.push(flatten(portion));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
const self = {
|
|
311
|
-
base,
|
|
312
|
-
bundled_with: portions.map((p) => buildSingle(p)),
|
|
313
|
-
};
|
|
314
|
-
if (data["reaffirmation_4digit"] !== undefined) {
|
|
315
|
-
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
316
|
-
self["original_reaffirmation_4digit"] = true;
|
|
317
|
-
}
|
|
318
|
-
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
319
|
-
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
320
|
-
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
321
|
-
}
|
|
322
|
-
return new (ctor(BundledClass))(self);
|
|
323
|
-
}
|
|
324
|
-
function buildCombined(data) {
|
|
325
|
-
const parts = ["first", "second", "third"]
|
|
326
|
-
.map((key) => data[key])
|
|
327
|
-
.filter((v) => v !== undefined)
|
|
328
|
-
.map((v) => buildSingle(flatten(v)));
|
|
329
|
-
const self = {
|
|
330
|
-
identifiers: parts,
|
|
331
|
-
separator: data["comma_separator"] !== undefined ? ", " : "/",
|
|
332
|
-
};
|
|
333
|
-
if (data["reaffirmation_4digit"] !== undefined) {
|
|
334
|
-
self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
|
|
335
|
-
self["original_reaffirmation_4digit"] = true;
|
|
336
|
-
}
|
|
337
|
-
else if (data["reaffirmation_2digit"] !== undefined) {
|
|
338
|
-
const two = strv(data["reaffirmation_2digit"]) ?? "";
|
|
339
|
-
self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
340
|
-
}
|
|
341
|
-
else if (data["reaffirmation"] !== undefined) {
|
|
342
|
-
self["reaffirmation"] = strv(data["reaffirmation"]);
|
|
343
|
-
}
|
|
344
|
-
if (data["package_portion"] !== undefined) {
|
|
345
|
-
self["package"] = strv(data["package_portion"]);
|
|
346
|
-
}
|
|
347
|
-
return new (ctor(CombinedClass))(self);
|
|
348
|
-
}
|
|
349
|
-
// --- The parser entry (parser.rb parse + prefix injection) -------------------------------
|
|
350
|
-
function injectPublisherPrefix(hash, prefix) {
|
|
351
|
-
const first = hash["first"];
|
|
352
|
-
if (isObj(first))
|
|
353
|
-
first["publisher_prefix"] = prefix;
|
|
354
|
-
const second = hash["second"];
|
|
355
|
-
if (isObj(second)
|
|
356
|
-
&& (hash["comma_separator"] !== undefined || second["has_publisher"] !== undefined)) {
|
|
357
|
-
second["publisher_prefix"] = prefix;
|
|
358
|
-
}
|
|
359
|
-
const third = hash["third"];
|
|
360
|
-
if (isObj(third) && third["has_publisher"] !== undefined) {
|
|
361
|
-
third["publisher_prefix"] = prefix;
|
|
362
|
-
}
|
|
363
|
-
const base = hash["base"];
|
|
364
|
-
if (isObj(base))
|
|
365
|
-
injectPublisherPrefix(base, prefix);
|
|
366
|
-
if (hash["first"] === undefined && hash["base"] === undefined && hash["bundled_first"] === undefined) {
|
|
367
|
-
hash["publisher_prefix"] = prefix;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
function parseTree(input) {
|
|
371
|
-
const normalized = normalizeCsa(input);
|
|
372
|
-
const prefix = csaPublisherPrefix(normalized);
|
|
373
|
-
const tree = parseGrammar(csaGrammar, normalized);
|
|
374
|
-
const hash = flatten(tree);
|
|
375
|
-
if (prefix !== undefined)
|
|
376
|
-
injectPublisherPrefix(hash, prefix);
|
|
377
|
-
return hash;
|
|
378
|
-
}
|
|
379
|
-
// --- Identifier.parse (identifier.rb) ------------------------------------------------------
|
|
380
|
-
function tryParse(input, resolveForeign) {
|
|
381
|
-
try {
|
|
382
|
-
return parseCsa(input, resolveForeign);
|
|
383
|
-
}
|
|
384
|
-
catch {
|
|
385
|
-
return undefined;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
function extractReaffirmation(wrappedInput) {
|
|
389
|
-
const m = /\(R(\d{2,4})\)/.exec(wrappedInput);
|
|
390
|
-
if (m === null)
|
|
391
|
-
return { year: undefined, was4digit: false, rest: wrappedInput };
|
|
392
|
-
let year = m[1];
|
|
393
|
-
const was4digit = year.length === 4;
|
|
394
|
-
if (year.length === 2) {
|
|
395
|
-
year = Number(year) < 50 ? `20${year}` : `19${year}`;
|
|
396
|
-
}
|
|
397
|
-
const rest = wrappedInput.replace(/\s*\(R\d{2,4}\)/, "");
|
|
398
|
-
return { year, was4digit, rest };
|
|
399
|
-
}
|
|
400
|
-
function setPublisherPrefix(obj, prefix) {
|
|
401
|
-
const self = obj;
|
|
402
|
-
self["publisher_prefix"] = prefix;
|
|
403
|
-
const combined = self["identifiers"];
|
|
404
|
-
if (combined !== undefined) {
|
|
405
|
-
combined.forEach((part, index) => {
|
|
406
|
-
const partSelf = part;
|
|
407
|
-
if (index > 0 && partSelf["has_publisher"] !== true)
|
|
408
|
-
return;
|
|
409
|
-
partSelf["publisher_prefix"] = prefix;
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
const base = self["base"];
|
|
413
|
-
if (base !== undefined && combined === undefined) {
|
|
414
|
-
setPublisherPrefix(base, prefix);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
function parseExternalStandard(input, resolveForeign) {
|
|
418
|
-
if (/^(ISO\/IEC|ISO|IEC|CEI|CEI\/IEC)\s/.test(input)) {
|
|
419
|
-
return tryForeign("iso", input.replace(/^CEI\/IEC/, "IEC"), resolveForeign);
|
|
420
|
-
}
|
|
421
|
-
// The catalogue also prints the IWA designation without the ISO
|
|
422
|
-
// keyword ("CAN/CSA-IWA 18:17" beside "CAN/CSA-ISO IWA 18:17"); the
|
|
423
|
-
// ISO parser wants the ISO/ prefix.
|
|
424
|
-
if (/^IWA\s/.test(input)) {
|
|
425
|
-
return tryForeign("iso", input.replace(/^IWA\s/, "ISO/IWA "), resolveForeign);
|
|
426
|
-
}
|
|
427
|
-
if (/^CISPR\s/.test(input)) {
|
|
428
|
-
return tryForeign("iec", input, resolveForeign);
|
|
429
|
-
}
|
|
430
|
-
return undefined;
|
|
431
|
-
}
|
|
432
|
-
function parseCsa(input, resolveForeign) {
|
|
433
|
-
if (input.startsWith("#")) {
|
|
434
|
-
throw new Error(`Not a CSA identifier (comment): ${input}`);
|
|
435
|
-
}
|
|
436
|
-
if (/^CSA (Communities|Group|Learning|OnDemand|Update)/.test(input)) {
|
|
437
|
-
throw new Error(`Not a CSA standard: ${input}`);
|
|
438
|
-
}
|
|
439
|
-
input = input.replaceAll("CEI/IEC", "IEC").replaceAll(/\bCEI\b/g, "IEC");
|
|
440
|
-
// CAN/ wrapper (Canadian adoption).
|
|
441
|
-
if (input.startsWith("CAN/")) {
|
|
442
|
-
const wrappedInput0 = input.replace(/^CAN\//, "");
|
|
443
|
-
if (wrappedInput0.includes("+")
|
|
444
|
-
|| (wrappedInput0.includes("/") && /\s+CSA-/.test(wrappedInput0))
|
|
445
|
-
|| (wrappedInput0.includes("/") && (wrappedInput0.match(/CSA-/g) ?? []).length > 1)) {
|
|
446
|
-
let normalized = wrappedInput0.replace(/^CSA-/, "CSA ");
|
|
447
|
-
normalized = normalized.replaceAll("CAN/CSA-", "CSA ").replaceAll("CAN3-", "CSA ");
|
|
448
|
-
normalized = normalized.replaceAll(/\s+/g, " ").trim();
|
|
449
|
-
const result = buildTree(parseTree(normalized), resolveForeign);
|
|
450
|
-
setPublisherPrefix(result, "CAN/CSA-");
|
|
451
|
-
const rMatch = /\(R(\d{4})\)/.exec(wrappedInput0);
|
|
452
|
-
if (rMatch !== null) {
|
|
453
|
-
result["reaffirmation"] = rMatch[1];
|
|
454
|
-
}
|
|
455
|
-
return result;
|
|
456
|
-
}
|
|
457
|
-
const { year: reaffirmYear, was4digit, rest: stripped } = extractReaffirmation(wrappedInput0);
|
|
458
|
-
const originalPrefix = stripped.startsWith("CSA-")
|
|
459
|
-
? "CSA-"
|
|
460
|
-
: stripped.startsWith("CSA ")
|
|
461
|
-
? "CSA"
|
|
462
|
-
: undefined;
|
|
463
|
-
const normalized = stripped.replace(/^CSA-/, "CSA ");
|
|
464
|
-
const base = parseCsa(normalized, resolveForeign);
|
|
465
|
-
const baseSelf = base;
|
|
466
|
-
// Only the single-document types and CsaAdopted declare
|
|
467
|
-
// publisher_prefix; the containers (Combined/Bundled/Package) keep
|
|
468
|
-
// what the recursive parse already injected.
|
|
469
|
-
if (base instanceof CsaSingleIdentifier || base instanceof CsaAdoptedClass) {
|
|
470
|
-
if (base instanceof SeriesClass) {
|
|
471
|
-
baseSelf["publisher_prefix"] = "CAN/CSA-";
|
|
472
|
-
}
|
|
473
|
-
else if (originalPrefix !== undefined) {
|
|
474
|
-
baseSelf["publisher_prefix"] = originalPrefix;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (reaffirmYear !== undefined) {
|
|
478
|
-
baseSelf["reaffirmation"] = reaffirmYear;
|
|
479
|
-
baseSelf["original_reaffirmation_4digit"] = was4digit;
|
|
480
|
-
}
|
|
481
|
-
return new (ctor(CanadianAdoptedClass))({
|
|
482
|
-
base,
|
|
483
|
-
...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
// CAN3- wrapper (historical).
|
|
487
|
-
if (input.startsWith("CAN3-")) {
|
|
488
|
-
const wrapped0 = input.replace(/^CAN3-/, "CSA ");
|
|
489
|
-
const hasDashYear = /-\d{2}\b/.test(wrapped0);
|
|
490
|
-
const { year: reaffirmYear, was4digit, rest: stripped } = extractReaffirmation(wrapped0);
|
|
491
|
-
const base = parseCsa(stripped, resolveForeign);
|
|
492
|
-
const baseSelf = base;
|
|
493
|
-
if (hasDashYear) {
|
|
494
|
-
baseSelf["year_format"] = "dash";
|
|
495
|
-
baseSelf["original_year_4digit"] = false;
|
|
496
|
-
}
|
|
497
|
-
if (base instanceof SeriesClass) {
|
|
498
|
-
baseSelf["publisher_prefix"] = "CAN3-";
|
|
499
|
-
if (reaffirmYear !== undefined) {
|
|
500
|
-
baseSelf["reaffirmation"] = reaffirmYear;
|
|
501
|
-
baseSelf["original_reaffirmation_4digit"] = was4digit;
|
|
502
|
-
}
|
|
503
|
-
return base;
|
|
504
|
-
}
|
|
505
|
-
baseSelf["publisher_prefix"] = "CAN3-";
|
|
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
|
-
// CSA adoption of international standards. The catalogue also drops
|
|
516
|
-
// the ISO keyword from the IWA designation ("CSA IWA 18:17").
|
|
517
|
-
if (/^CSA (ISO\/IEC|CEI\/IEC|CISPR|IEC|CEI|ISO|IWA)\s/.test(input)) {
|
|
518
|
-
let wrapped = input.replace(/^CSA\s+/, "");
|
|
519
|
-
const { year: reaffirmYear, rest: stripped } = extractReaffirmation(wrapped);
|
|
520
|
-
wrapped = stripped;
|
|
521
|
-
const shortYear = /:(\d{2})\b/.exec(wrapped);
|
|
522
|
-
if (shortYear !== null) {
|
|
523
|
-
const two = shortYear[1];
|
|
524
|
-
const full = Number(two) < 50 ? `20${two}` : `19${two}`;
|
|
525
|
-
wrapped = wrapped.replace(new RegExp(`:${two}\\b`), `:${full}`);
|
|
526
|
-
}
|
|
527
|
-
wrapped = wrapped.replace(/\/A(\d+)([:/-])(\d{2,4})\b/g, (_m, num, sep, year) => {
|
|
528
|
-
const full = year.length === 2
|
|
529
|
-
? (Number(year) < 50 ? `20${year}` : `19${year}`)
|
|
530
|
-
: year;
|
|
531
|
-
return `/Amd ${num}${sep}${full}`;
|
|
532
|
-
});
|
|
533
|
-
const base = parseExternalStandard(wrapped, resolveForeign);
|
|
534
|
-
if (base === undefined) {
|
|
535
|
-
throw new Error(`Unparseable adopted standard: ${input}`);
|
|
536
|
-
}
|
|
537
|
-
return new (ctor(CsaAdoptedClass))({
|
|
538
|
-
base,
|
|
539
|
-
...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
// Package identifiers.
|
|
543
|
-
if (/\sPACKAGE\b/i.test(input)) {
|
|
544
|
-
let baseInput;
|
|
545
|
-
let packageMaterials;
|
|
546
|
-
let materialsAfter = true;
|
|
547
|
-
const after = /\sPACKAGE\s+[A-Z]/i.exec(input);
|
|
548
|
-
const yearThen = /:(\d{2,4})(\s+[^P]+)\s+PACKAGE/i.exec(input);
|
|
549
|
-
if (after !== null) {
|
|
550
|
-
const idx = input.search(/\s+PACKAGE\s+/i);
|
|
551
|
-
baseInput = input.slice(0, idx).trim();
|
|
552
|
-
packageMaterials = input.slice(input.indexOf("PACKAGE", idx) + "PACKAGE".length).trim() === ""
|
|
553
|
-
? ""
|
|
554
|
-
: input.slice(idx).replace(/^\s+PACKAGE\s+/i, "").trim();
|
|
555
|
-
materialsAfter = true;
|
|
556
|
-
}
|
|
557
|
-
else if (yearThen !== null) {
|
|
558
|
-
const yearMatch = /:\d{2,4}/.exec(input);
|
|
559
|
-
if (yearMatch !== null) {
|
|
560
|
-
if (/,\s+CSA/.test(input)) {
|
|
561
|
-
const combinedMatch = /^(.+?)(\s+&[^P]+)\s+PACKAGE$/i.exec(input);
|
|
562
|
-
if (combinedMatch !== null) {
|
|
563
|
-
baseInput = combinedMatch[1].trim();
|
|
564
|
-
packageMaterials = `${combinedMatch[2].trim()} Package`;
|
|
565
|
-
}
|
|
566
|
-
else {
|
|
567
|
-
baseInput = input.slice(0, yearMatch.index + yearMatch[0].length);
|
|
568
|
-
packageMaterials = input.slice(yearMatch.index + yearMatch[0].length).trim();
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
else {
|
|
572
|
-
baseInput = input.slice(0, yearMatch.index + yearMatch[0].length).trim();
|
|
573
|
-
packageMaterials = input.slice(yearMatch.index + yearMatch[0].length).trim();
|
|
574
|
-
}
|
|
575
|
-
materialsAfter = false;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
else {
|
|
579
|
-
const trailing = /^(.+?)\s+PACKAGE\s*$/i.exec(input);
|
|
580
|
-
if (trailing !== null) {
|
|
581
|
-
baseInput = trailing[1].trim();
|
|
582
|
-
packageMaterials = "";
|
|
583
|
-
materialsAfter = true;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
if (baseInput === undefined || baseInput === "") {
|
|
587
|
-
// Fallback: parse incrementally.
|
|
588
|
-
const tokens = input.split(/\s+/);
|
|
589
|
-
let acc = "";
|
|
590
|
-
for (const token of tokens) {
|
|
591
|
-
if (/^PACKAGE$/i.test(token))
|
|
592
|
-
break;
|
|
593
|
-
const testInput = acc === "" ? token : `${acc} ${token}`;
|
|
594
|
-
if (tryParse(testInput, resolveForeign) === undefined)
|
|
595
|
-
break;
|
|
596
|
-
acc = testInput;
|
|
597
|
-
}
|
|
598
|
-
baseInput = acc;
|
|
599
|
-
if (baseInput !== "" && baseInput.length < input.length) {
|
|
600
|
-
const materialsInput = input.slice(baseInput.length).trim();
|
|
601
|
-
packageMaterials = materialsInput.replace(/\s+PACKAGE\s*$/i, "").trim();
|
|
602
|
-
materialsAfter = packageMaterials !== "";
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
if (baseInput === undefined || baseInput === "") {
|
|
606
|
-
throw new Error(`Unparseable package base: ${input}`);
|
|
607
|
-
}
|
|
608
|
-
const base = parseCsa(baseInput, resolveForeign);
|
|
609
|
-
return new (ctor(PackageClass))({
|
|
610
|
-
base,
|
|
611
|
-
package_keyword: "PACKAGE",
|
|
612
|
-
...(packageMaterials !== undefined && packageMaterials !== ""
|
|
613
|
-
? { package_materials: packageMaterials }
|
|
614
|
-
: {}),
|
|
615
|
-
materials_after_keyword: materialsAfter,
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
// Plain path with parser-level normalization and prefix injection.
|
|
619
|
-
const hasDashYear = /-\d{2}\b/.test(input);
|
|
620
|
-
const result = buildTree(parseTree(input), resolveForeign);
|
|
621
|
-
const self = result;
|
|
622
|
-
if (hasDashYear && self["year_format"] === undefined) {
|
|
623
|
-
self["year_format"] = "dash";
|
|
624
|
-
}
|
|
625
|
-
return result;
|
|
626
|
-
}
|
|
1
|
+
//! The csa node entry: the parse lane is the GENERATED substrate
|
|
2
|
+
//! (pubid/pubid-grammar#158) driving the wasm artifact runtime — the
|
|
3
|
+
//! baked csa.json is the only parsing input. The hand grammar.ts
|
|
4
|
+
//! re-transcription retired from this lane. The semantic delta lives in
|
|
5
|
+
//! implementation.ts, shared byte for byte with the worker entry.
|
|
6
|
+
import { PubidRuntime } from "../../parg/runtime.js";
|
|
7
|
+
import * as substrate from "./generated/substrate.js";
|
|
8
|
+
import { makeCsaGrammarImplementation } from "./implementation.js";
|
|
9
|
+
// The generated substrate drives the wasm artifact runtime — registered
|
|
10
|
+
// once at module init. Node-only (the runtime walks to the artifacts
|
|
11
|
+
// through node:fs); the worker entry registers the pure-TS worker
|
|
12
|
+
// engine instead.
|
|
13
|
+
substrate.registerRuntime(() => PubidRuntime.load(substrate.FLAVOR, substrate.ENTRY));
|
|
627
14
|
export function csaGrammarImplementation(resolveForeign) {
|
|
628
|
-
return
|
|
629
|
-
parse(input) {
|
|
630
|
-
return parseCsa(input, resolveForeign);
|
|
631
|
-
},
|
|
632
|
-
};
|
|
15
|
+
return makeCsaGrammarImplementation((body) => substrate.boundToWire(substrate.parseBound(body)), resolveForeign);
|
|
633
16
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
//! implementation the node entry runs, with the adopted ISO/IEC
|
|
3
3
|
//! resolution wired to the worker-safe registry instead of the node
|
|
4
4
|
//! barrel. No `node:*` module appears in this graph and no wasm loads
|
|
5
|
-
//! — the
|
|
6
|
-
//! synchronous.
|
|
5
|
+
//! — the pure-TS worker engine registers as the substrate runtime, so
|
|
6
|
+
//! the entry is synchronous (pubid/pubid-grammar#158).
|
|
7
7
|
//!
|
|
8
8
|
//! import { csaWorkerGrammarImplementation } from "@pubid/pubid/dist/flavors/csa/worker.js";
|
|
9
9
|
//! const csa = csaWorkerGrammarImplementation();
|
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
//!
|
|
12
12
|
//! Pass a resolver to widen or narrow the foreign set.
|
|
13
13
|
import { workerForeignResolver } from "../worker-registry.js";
|
|
14
|
-
import
|
|
14
|
+
import * as substrate from "./generated/substrate.js";
|
|
15
|
+
import { csaWorkerRuntime } from "./grammar.worker.js";
|
|
16
|
+
import { makeCsaGrammarImplementation } from "./implementation.js";
|
|
17
|
+
// Register a fresh substrate runtime per implementation request — the
|
|
18
|
+
// worker entry must stay reentrant (no module-scope engine pin in the
|
|
19
|
+
// worker graph, where another flavor may register its own).
|
|
15
20
|
export function csaWorkerGrammarImplementation(foreign) {
|
|
16
|
-
|
|
21
|
+
substrate.registerRuntime(csaWorkerRuntime);
|
|
22
|
+
return makeCsaGrammarImplementation((body) => substrate.boundToWire(substrate.parseBound(body)), foreign ?? workerForeignResolver());
|
|
17
23
|
}
|