@pubid/pubid 0.1.70 → 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/README.md +49 -1
- 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 +3 -4
- package/dist/flavors/bsi/index.js +16 -940
- package/dist/flavors/bsi/model.js +16 -0
- package/dist/flavors/bsi/worker.d.ts +3 -0
- package/dist/flavors/bsi/worker.js +25 -0
- 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 +4 -5
- package/dist/flavors/cen_cenelec/index.js +17 -281
- package/dist/flavors/cen_cenelec/model.js +16 -1
- package/dist/flavors/cen_cenelec/worker.d.ts +3 -0
- package/dist/flavors/cen_cenelec/worker.js +23 -0
- 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.d.ts +2 -1
- package/dist/flavors/csa/index.js +15 -633
- package/dist/flavors/csa/worker.d.ts +3 -0
- package/dist/flavors/csa/worker.js +23 -0
- 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 +2 -1
- package/dist/flavors/evs/index.js +15 -90
- package/dist/flavors/evs/worker.d.ts +3 -0
- package/dist/flavors/evs/worker.js +24 -0
- package/dist/flavors/foreign-resolver.d.ts +6 -0
- package/dist/flavors/foreign-resolver.js +9 -0
- 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.d.ts +2 -1
- package/dist/flavors/gost/index.js +15 -164
- package/dist/flavors/gost/worker.d.ts +3 -0
- package/dist/flavors/gost/worker.js +28 -0
- 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 +8 -5
- 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.d.ts +13 -0
- package/dist/flavors/worker-registry.js +298 -0
- 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
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
//! The jcgm semantic delta over the generated substrate
|
|
2
|
+
//! (pubid/pubid-grammar#158): the builder and the URN parser. The
|
|
3
|
+
//! artifact's wire is the FLAT bound map of jcgm.parg edition 2 — the
|
|
4
|
+
//! amendment/corrigendum base wrapper capture dropped (the base keeps
|
|
5
|
+
//! the canonical number/date captures on the same map and the
|
|
6
|
+
//! supplement layer captures ride as supp_number/supp_date, mirroring
|
|
7
|
+
//! the iec supp_* position-scoped convention). The delta rebuilds the
|
|
8
|
+
//! nested base the model carries from those flat captures. Pure — no
|
|
9
|
+
//! `node:*` module, no engine import — so both entries (the node barrel
|
|
10
|
+
//! over the wasm artifact runtime, the worker entry over the pure-TS
|
|
11
|
+
//! worker engine) run the same delta.
|
|
12
|
+
//!
|
|
13
|
+
//! The parse function is injected: the entry binds it to
|
|
14
|
+
//! `substrate.boundToWire(substrate.parseBound(body))` (node) or the
|
|
15
|
+
//! worker engine's equivalent (worker).
|
|
16
|
+
import { ParseFailed } from "../../grammar/engine.js";
|
|
17
|
+
import { BaseBuilder } from "../../model/builder.js";
|
|
18
|
+
import { PubidDate, Language } from "../../model/component.js";
|
|
19
|
+
import { KIND_CLASSES } from "./model.js";
|
|
20
|
+
function isObj(v) {
|
|
21
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
22
|
+
}
|
|
23
|
+
function parseLanguages(value) {
|
|
24
|
+
const raw = String(value);
|
|
25
|
+
return raw.split("/").map((code) => {
|
|
26
|
+
const original = code.trim();
|
|
27
|
+
const mapped = Language.CHAR_MAP[original] ?? original.toLowerCase();
|
|
28
|
+
return new Language({ code: mapped, originalCode: original });
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function buildDate(value) {
|
|
32
|
+
if (value === undefined || value === null)
|
|
33
|
+
return undefined;
|
|
34
|
+
const dateStr = String(value);
|
|
35
|
+
const parts = dateStr.split("-");
|
|
36
|
+
return new PubidDate({ year: parts[0], month: parts[1], day: parts[2] });
|
|
37
|
+
}
|
|
38
|
+
/** The base fields the flat map carries at the top level: the
|
|
39
|
+
* amendment/corrigendum's own number/date ride the supp_* captures, so
|
|
40
|
+
* the base reads the canonical captures (jcgm.parg edition 2). */
|
|
41
|
+
function baseFields(data) {
|
|
42
|
+
const base = {};
|
|
43
|
+
if (data["publisher"] !== undefined)
|
|
44
|
+
base["publisher"] = data["publisher"];
|
|
45
|
+
if (data["gum_number"] !== undefined)
|
|
46
|
+
base["gum_number"] = data["gum_number"];
|
|
47
|
+
else if (data["number"] !== undefined)
|
|
48
|
+
base["number"] = data["number"];
|
|
49
|
+
if (data["date"] !== undefined)
|
|
50
|
+
base["date"] = data["date"];
|
|
51
|
+
if (data["languages"] !== undefined)
|
|
52
|
+
base["languages"] = data["languages"];
|
|
53
|
+
return base;
|
|
54
|
+
}
|
|
55
|
+
class JcgmBuilder extends BaseBuilder {
|
|
56
|
+
defaultIdentifierClass() {
|
|
57
|
+
return KIND_CLASSES["guide"];
|
|
58
|
+
}
|
|
59
|
+
selectClass(data) {
|
|
60
|
+
const typeWithStage = data["type_with_stage"] === undefined || data["type_with_stage"] === null
|
|
61
|
+
? undefined
|
|
62
|
+
: String(data["type_with_stage"]);
|
|
63
|
+
if (typeWithStage === "Meeting")
|
|
64
|
+
return KIND_CLASSES["meeting"];
|
|
65
|
+
if (typeWithStage === "Amd")
|
|
66
|
+
return KIND_CLASSES["amendment"];
|
|
67
|
+
if (typeWithStage === "Cor" || typeWithStage === "Corrigendum") {
|
|
68
|
+
return KIND_CLASSES["corrigendum"];
|
|
69
|
+
}
|
|
70
|
+
if (data["gum_number"] !== undefined)
|
|
71
|
+
return KIND_CLASSES["gum-guide"];
|
|
72
|
+
return KIND_CLASSES["guide"];
|
|
73
|
+
}
|
|
74
|
+
build(data) {
|
|
75
|
+
const flat = Array.isArray(data) ? Object.assign({}, ...data) : data;
|
|
76
|
+
const klass = this.selectClass(flat);
|
|
77
|
+
const attrs = {};
|
|
78
|
+
if (flat["type_with_stage"] === "Amd" || flat["type_with_stage"] === "Cor" ||
|
|
79
|
+
flat["type_with_stage"] === "Corrigendum") {
|
|
80
|
+
// The supplement's base: the flat map's canonical captures
|
|
81
|
+
// (number/date/languages), rebuilt as the nested identifier.
|
|
82
|
+
attrs["base"] = this.build(baseFields(flat));
|
|
83
|
+
if (flat["supp_number"] !== undefined)
|
|
84
|
+
attrs["number"] = String(flat["supp_number"]);
|
|
85
|
+
if (flat["supp_date"] !== undefined) {
|
|
86
|
+
const date = buildDate(flat["supp_date"]);
|
|
87
|
+
if (date)
|
|
88
|
+
attrs["date"] = date;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
if (flat["gum_number"] !== undefined)
|
|
93
|
+
attrs["number"] = String(flat["gum_number"]);
|
|
94
|
+
else if (flat["number"] !== undefined)
|
|
95
|
+
attrs["number"] = String(flat["number"]);
|
|
96
|
+
if (flat["date"] !== undefined) {
|
|
97
|
+
const date = buildDate(flat["date"]);
|
|
98
|
+
if (date)
|
|
99
|
+
attrs["date"] = date;
|
|
100
|
+
}
|
|
101
|
+
if (flat["languages"] !== undefined)
|
|
102
|
+
attrs["languages"] = parseLanguages(flat["languages"]);
|
|
103
|
+
}
|
|
104
|
+
return new klass(attrs);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// lib/pubid/jcgm/urn_parser.rb build_document: Guide vs GumGuide by the
|
|
108
|
+
// "gum." number prefix; the year and language segments are matched by
|
|
109
|
+
// pattern, not position.
|
|
110
|
+
function buildUrnDocument(parts) {
|
|
111
|
+
const number = parts[0];
|
|
112
|
+
if (number === undefined || number === "") {
|
|
113
|
+
throw new Error("JCGM URN has no document number");
|
|
114
|
+
}
|
|
115
|
+
const gum = number.startsWith("gum.");
|
|
116
|
+
const rest = parts.slice(1);
|
|
117
|
+
const year = rest.find((seg) => /^(19|20)\d{2}$/.test(seg));
|
|
118
|
+
const langSegment = rest.find((seg) => /^[a-z]{2}(,[a-z]{2})*$/.test(seg));
|
|
119
|
+
const langLetters = {
|
|
120
|
+
ru: "R", fr: "F", en: "E", ar: "A", es: "S", de: "D",
|
|
121
|
+
};
|
|
122
|
+
const languages = langSegment
|
|
123
|
+
? langSegment.split(",").map((code) => new Language({ code, originalCode: langLetters[code] ?? code }))
|
|
124
|
+
: [];
|
|
125
|
+
const cls = gum ? KIND_CLASSES["gum-guide"] : KIND_CLASSES.guide;
|
|
126
|
+
const cleanNumber = gum ? number.slice("gum.".length) : number;
|
|
127
|
+
return new cls({
|
|
128
|
+
number: cleanNumber,
|
|
129
|
+
date: year ? new PubidDate({ year }) : undefined,
|
|
130
|
+
languages,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// nil for an absent year; a component for a well-formed 19xx/20xx year;
|
|
134
|
+
// anything else rejects (no re-parse validates it any more).
|
|
135
|
+
function urnDate(segment) {
|
|
136
|
+
if (segment === undefined || segment === "")
|
|
137
|
+
return undefined;
|
|
138
|
+
if (!/^(19|20)\d{2}$/.test(segment)) {
|
|
139
|
+
throw new Error(`Invalid year in JCGM URN: ${JSON.stringify(segment)}`);
|
|
140
|
+
}
|
|
141
|
+
return new PubidDate({ year: segment });
|
|
142
|
+
}
|
|
143
|
+
// "011" reads back as "11" (Identifiers::Meeting.ordinal normalization).
|
|
144
|
+
function toMeetingNumber(segment) {
|
|
145
|
+
return String(Number(segment));
|
|
146
|
+
}
|
|
147
|
+
/** The bound → wire lane is injected so the node entry (the generated
|
|
148
|
+
* substrate over the wasm artifact runtime) and the worker entry (the
|
|
149
|
+
* pure-TS worker engine) share this delta byte for byte. */
|
|
150
|
+
export function makeJcgmGrammarImplementation(parseWire) {
|
|
151
|
+
const builder = new JcgmBuilder();
|
|
152
|
+
return {
|
|
153
|
+
// Inverse of JcgmUrnGenerator (lib/pubid/jcgm/urn_parser.rb): rebuild
|
|
154
|
+
// identifiers DIRECTLY from the URN segments — re-parsing through the
|
|
155
|
+
// grammar flattened segments and lost languages/supplements.
|
|
156
|
+
parseUrn(urn) {
|
|
157
|
+
const parts = urn.replace(/^urn:jcgm:/, "").split(":");
|
|
158
|
+
if (parts[0] === "meeting") {
|
|
159
|
+
const number = toMeetingNumber(parts[1]);
|
|
160
|
+
const date = urnDate(parts[2]);
|
|
161
|
+
return new (KIND_CLASSES.meeting)({ number, date });
|
|
162
|
+
}
|
|
163
|
+
const markerAt = parts.findIndex((seg) => seg === "corrigendum" || seg === "amendment");
|
|
164
|
+
if (markerAt === -1) {
|
|
165
|
+
return buildUrnDocument(parts);
|
|
166
|
+
}
|
|
167
|
+
const kind = (parts[markerAt] === "amendment" ? "amendment" : "corrigendum");
|
|
168
|
+
const base = buildUrnDocument(parts.slice(0, markerAt));
|
|
169
|
+
const tail = parts.slice(markerAt + 1);
|
|
170
|
+
const number = tail[0] === undefined || tail[0] === "" ? undefined : tail[0];
|
|
171
|
+
const date = urnDate(tail[1]);
|
|
172
|
+
return new (KIND_CLASSES[kind])({ base, number, date });
|
|
173
|
+
},
|
|
174
|
+
parse(input) {
|
|
175
|
+
let tree;
|
|
176
|
+
try {
|
|
177
|
+
tree = parseWire(input);
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
if (err instanceof ParseFailed)
|
|
181
|
+
throw err;
|
|
182
|
+
throw new ParseFailed("JCGM: the artifact rejected the input", 0);
|
|
183
|
+
}
|
|
184
|
+
return builder.build(tree);
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { Grammar } from "../../grammar/engine.js";
|
|
2
|
-
import type { Tree, TreeObject } from "../../grammar/engine.js";
|
|
3
1
|
import type { FlavorImplementation } from "../../conformance/implementation.js";
|
|
4
|
-
export
|
|
5
|
-
declare function isObj(v: Tree): v is TreeObject;
|
|
2
|
+
export * from "./model.js";
|
|
6
3
|
export declare function jcgmGrammarImplementation(): FlavorImplementation;
|
|
7
|
-
export { isObj };
|
|
@@ -1,366 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function buildRules() {
|
|
17
|
-
const rules = {};
|
|
18
|
-
const rule = (name, build) => {
|
|
19
|
-
rules[name] = build();
|
|
20
|
-
};
|
|
21
|
-
const space = str(" ");
|
|
22
|
-
const digits = match("[0-9]").repeat(1, Infinity);
|
|
23
|
-
// CommonParseRules year_digits: 19xx/20xx not followed by a digit.
|
|
24
|
-
const yearDigits = str("19").or(str("20")).then(match("\\d").repeat(2, 2), digits.absent());
|
|
25
|
-
const monthDigits = match("[0-9]").repeat(2, 2);
|
|
26
|
-
const dayDigits = match("[0-9]").repeat(2, 2);
|
|
27
|
-
const fullDate = yearDigits.then(str("-"), monthDigits, str("-"), dayDigits).as("date");
|
|
28
|
-
const datePortion = str(":").then(fullDate.or(yearDigits.as("date")));
|
|
29
|
-
rule("publisher", () => str("JCGM").as("publisher"));
|
|
30
|
-
rule("number_portion", () => str("GUM-").then(digits.as("gum_number")).or(digits.as("number")));
|
|
31
|
-
rule("language_portion", () => str("(")
|
|
32
|
-
.then((str("E/F").or(str("F/E")).or(match("[A-Z]"))).as("languages"), str(")")));
|
|
33
|
-
rule("base", () => rules["publisher"]
|
|
34
|
-
.then(space, rules["number_portion"])
|
|
35
|
-
.then(datePortion.maybe())
|
|
36
|
-
.then(rules["language_portion"].maybe()));
|
|
37
|
-
rule("ordinal_suffix", () => str("st").or(str("nd"), str("rd"), str("th")));
|
|
38
|
-
rule("meeting_identifier", () => rules["publisher"]
|
|
39
|
-
.then(space, digits.as("number"), rules["ordinal_suffix"])
|
|
40
|
-
.then(space, str("Meeting").as("type_with_stage"))
|
|
41
|
-
.then(space.then(str("("), yearDigits.as("date"), str(")")).maybe()));
|
|
42
|
-
rule("corrigendum_identifier", () => rules["base"].as("base").then(space, str("Corrigendum").as("type_with_stage")));
|
|
43
|
-
rule("numbered_corrigendum_identifier", () => rules["base"]
|
|
44
|
-
.as("base")
|
|
45
|
-
.then(str("/"), str("Cor").as("type_with_stage"))
|
|
46
|
-
.then(supplementSeparator(), digits.as("number"))
|
|
47
|
-
.then(datePortion.maybe()));
|
|
48
|
-
rule("amendment_identifier", () => rules["base"]
|
|
49
|
-
.as("base")
|
|
50
|
-
.then(str("/"), str("Amd").as("type_with_stage"))
|
|
51
|
-
.then(supplementSeparator(), digits.as("number"))
|
|
52
|
-
.then(datePortion.maybe()));
|
|
53
|
-
rule("named_number", () => (str("GUM").or(str("VIM").then(str("-").then(digits).maybe()))).as("number"));
|
|
54
|
-
// "Amd 1" and the dotted "Amd.1:2026" BIPM prints are both accepted on
|
|
55
|
-
// input; rendering stays "Amd 1" (the gem's jcgm parser, pubid#574).
|
|
56
|
-
function supplementSeparator() {
|
|
57
|
-
return space.or(str(".").then(space.maybe()));
|
|
58
|
-
}
|
|
59
|
-
rule("named_guide_identifier", () => rules["publisher"].then(space, rules["named_number"]));
|
|
60
|
-
rule("identifier", () => rules["meeting_identifier"]
|
|
61
|
-
.or(rules["amendment_identifier"])
|
|
62
|
-
.or(rules["corrigendum_identifier"])
|
|
63
|
-
.or(rules["numbered_corrigendum_identifier"])
|
|
64
|
-
.or(rules["base"])
|
|
65
|
-
.or(rules["named_guide_identifier"]));
|
|
66
|
-
rule("root", () => rules["identifier"]);
|
|
67
|
-
return rules;
|
|
68
|
-
}
|
|
69
|
-
export const jcgmGrammar = { rules: buildRules(), root: "root" };
|
|
70
|
-
const JCGM_ATTRS = {
|
|
71
|
-
number: { type: "string" },
|
|
72
|
-
part: { type: "string" },
|
|
73
|
-
subpart: { type: "string" },
|
|
74
|
-
date: { type: PubidDate },
|
|
75
|
-
languages: { type: Language, collection: true, initializeEmpty: true },
|
|
76
|
-
};
|
|
77
|
-
// The calconnect-style converter trio: the date serializes FLAT as
|
|
78
|
-
// year/month/day.
|
|
79
|
-
const DATE_MAPPINGS = keyValue({
|
|
80
|
-
wire: "year",
|
|
81
|
-
to: "date",
|
|
82
|
-
toWire: (m) => m["date"]?.year,
|
|
83
|
-
fromWire: (h) => h["year"] === undefined || h["year"] === null
|
|
84
|
-
? undefined
|
|
85
|
-
: new PubidDate({
|
|
86
|
-
year: String(h["year"]),
|
|
87
|
-
month: h["month"],
|
|
88
|
-
day: h["day"],
|
|
89
|
-
}),
|
|
90
|
-
}, { wire: "month", to: "date", toWire: (m) => m["date"]?.month, fromWire: () => undefined }, { wire: "day", to: "date", toWire: (m) => m["date"]?.day, fromWire: () => undefined });
|
|
91
|
-
class JcgmIdentifier extends BaseIdentifier {
|
|
92
|
-
/** generate_base_urn shape: urn:jcgm:<number>[:part...]:date... */
|
|
93
|
-
baseUrnParts() {
|
|
94
|
-
const parts = ["urn", "jcgm"];
|
|
95
|
-
if (this.number !== undefined)
|
|
96
|
-
parts.push(this.number);
|
|
97
|
-
if (this.part !== undefined)
|
|
98
|
-
parts.push(`-${this.part}`);
|
|
99
|
-
if (this.subpart !== undefined)
|
|
100
|
-
parts.push(`-${this.subpart}`);
|
|
101
|
-
const rendered = this.date?.render("urn");
|
|
102
|
-
if (rendered !== undefined && rendered !== "")
|
|
103
|
-
parts.push(rendered);
|
|
104
|
-
return parts;
|
|
105
|
-
}
|
|
106
|
-
/** The date as printed (PubidDate#to_s): "2008" / "2022-11-28". */
|
|
107
|
-
dateToS() {
|
|
108
|
-
return this.date?.render() ?? "";
|
|
109
|
-
}
|
|
110
|
-
languagePortion() {
|
|
111
|
-
return this.languages.length === 0
|
|
112
|
-
? ""
|
|
113
|
-
: `(${this.languages.map((l) => l.originalCode ?? l.code).join("/")})`;
|
|
114
|
-
}
|
|
115
|
-
/** English ordinal suffix computed from the number (11st, 12nd, 13rd…). */
|
|
116
|
-
ordinalSuffix() {
|
|
117
|
-
if (this.number === undefined)
|
|
118
|
-
return "th";
|
|
119
|
-
const mod = Number(this.number) % 10;
|
|
120
|
-
return mod === 1 ? "st" : mod === 2 ? "nd" : mod === 3 ? "rd" : "th";
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
function jcgmClass(kind, attrs, mappings) {
|
|
124
|
-
class JcgmKindIdentifier extends JcgmIdentifier {
|
|
125
|
-
static polymorphicName = `pubid:jcgm:${kind}`;
|
|
126
|
-
static attributes = extendAttributes(BaseIdentifier, attrs);
|
|
127
|
-
static mappings = mappings;
|
|
128
|
-
render() {
|
|
129
|
-
const id = this;
|
|
130
|
-
switch (kind) {
|
|
131
|
-
case "meeting": {
|
|
132
|
-
const base = `JCGM ${id.number}${this.ordinalSuffix()} Meeting`;
|
|
133
|
-
const year = id.date?.year;
|
|
134
|
-
return year === undefined ? base : `${base} (${year})`;
|
|
135
|
-
}
|
|
136
|
-
case "amendment": {
|
|
137
|
-
let result = `${id.base?.render() ?? ""}/Amd`;
|
|
138
|
-
if (id.number !== undefined)
|
|
139
|
-
result += ` ${id.number}`;
|
|
140
|
-
const d = this.dateToS();
|
|
141
|
-
if (d !== "")
|
|
142
|
-
result += `:${d}`;
|
|
143
|
-
return result;
|
|
144
|
-
}
|
|
145
|
-
case "corrigendum": {
|
|
146
|
-
if (id.number !== undefined) {
|
|
147
|
-
const d = this.dateToS();
|
|
148
|
-
return `${id.base?.render() ?? ""}/Cor ${id.number}${d === "" ? "" : `:${d}`}`;
|
|
149
|
-
}
|
|
150
|
-
return `${id.base?.render() ?? ""} Corrigendum`;
|
|
151
|
-
}
|
|
152
|
-
case "gum-guide": {
|
|
153
|
-
let result = `JCGM GUM-${id.number}`;
|
|
154
|
-
const d = this.dateToS();
|
|
155
|
-
if (d !== "")
|
|
156
|
-
result += `:${d}`;
|
|
157
|
-
result += this.languagePortion();
|
|
158
|
-
return result;
|
|
159
|
-
}
|
|
160
|
-
default: {
|
|
161
|
-
let result = "JCGM";
|
|
162
|
-
let portion = id.number ?? "";
|
|
163
|
-
const d = this.dateToS();
|
|
164
|
-
if (portion !== "" && d !== "")
|
|
165
|
-
portion += `:${d}`;
|
|
166
|
-
if (portion !== "")
|
|
167
|
-
result += ` ${portion}`;
|
|
168
|
-
result += this.languagePortion();
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
registerType(JcgmKindIdentifier);
|
|
175
|
-
return JcgmKindIdentifier;
|
|
176
|
-
}
|
|
177
|
-
const KIND_CLASSES = {
|
|
178
|
-
guide: jcgmClass("guide", JCGM_ATTRS, keyValue({ wire: "number", to: "number" }, { wire: "part", to: "part" }, { wire: "subpart", to: "subpart" }, ...DATE_MAPPINGS, { wire: "languages", to: "languages" })),
|
|
179
|
-
"gum-guide": jcgmClass("gum-guide", JCGM_ATTRS, keyValue({ wire: "number", to: "number" }, { wire: "part", to: "part" }, { wire: "subpart", to: "subpart" }, ...DATE_MAPPINGS, { wire: "languages", to: "languages" })),
|
|
180
|
-
meeting: jcgmClass("meeting", JCGM_ATTRS, keyValue({ wire: "number", to: "number" }, ...DATE_MAPPINGS)),
|
|
181
|
-
amendment: jcgmClass("amendment", { ...JCGM_ATTRS, base: { type: undefined } }, keyValue({ wire: "number", to: "number" }, ...DATE_MAPPINGS, { wire: "base", to: "base" })),
|
|
182
|
-
corrigendum: jcgmClass("corrigendum", { ...JCGM_ATTRS, base: { type: undefined } }, keyValue({ wire: "number", to: "number" }, ...DATE_MAPPINGS, { wire: "base", to: "base" })),
|
|
183
|
-
};
|
|
184
|
-
// base attr needs the abstract self-type for polymorphic coercion.
|
|
185
|
-
KIND_CLASSES["amendment"].attributes["base"] = { type: JcgmIdentifier };
|
|
186
|
-
KIND_CLASSES["corrigendum"].attributes["base"] = { type: JcgmIdentifier };
|
|
187
|
-
class JcgmUrnGenerator extends BaseUrnGenerator {
|
|
188
|
-
generate() {
|
|
189
|
-
const kind = this.identifier.constructor.polymorphicName.slice("pubid:jcgm:".length);
|
|
190
|
-
if (kind === "meeting") {
|
|
191
|
-
const parts = ["urn", "jcgm", "meeting"];
|
|
192
|
-
if (this.identifier.number)
|
|
193
|
-
parts.push(this.identifier.number);
|
|
194
|
-
const year = this.identifier.date?.year;
|
|
195
|
-
if (year !== undefined)
|
|
196
|
-
parts.push(year);
|
|
197
|
-
return parts.join(":");
|
|
198
|
-
}
|
|
199
|
-
if (kind === "amendment" || kind === "corrigendum") {
|
|
200
|
-
const base = this.identifier.base;
|
|
201
|
-
if (!base)
|
|
202
|
-
return "urn:jcgm:unknown";
|
|
203
|
-
const parts = [...base.baseUrnParts()];
|
|
204
|
-
parts.push(kind);
|
|
205
|
-
if (this.identifier.number)
|
|
206
|
-
parts.push(this.identifier.number);
|
|
207
|
-
const rendered = this.identifier.date?.render("urn");
|
|
208
|
-
if (rendered !== undefined && rendered !== "")
|
|
209
|
-
parts.push(rendered);
|
|
210
|
-
return parts.join(":");
|
|
211
|
-
}
|
|
212
|
-
// generate_base_urn: GUM guides carry the "gum.N" number form;
|
|
213
|
-
// guide/gum_guide type codes are implied and never appended.
|
|
214
|
-
if (kind === "gum-guide" && this.identifier.number !== undefined) {
|
|
215
|
-
const parts = ["urn", "jcgm", `gum.${this.identifier.number}`];
|
|
216
|
-
const rendered = this.identifier.date?.render("urn");
|
|
217
|
-
if (rendered !== undefined && rendered !== "")
|
|
218
|
-
parts.push(rendered);
|
|
219
|
-
if (this.identifier.languages.length > 0) {
|
|
220
|
-
parts.push(this.identifier.languages.map((l) => l.code).join(","));
|
|
221
|
-
}
|
|
222
|
-
return parts.join(":");
|
|
223
|
-
}
|
|
224
|
-
const parts = [...this.identifier.baseUrnParts()];
|
|
225
|
-
if (this.identifier.languages.length > 0) {
|
|
226
|
-
parts.push(this.identifier.languages.map((l) => l.code).join(","));
|
|
227
|
-
}
|
|
228
|
-
return parts.join(":");
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
for (const klass of Object.values(KIND_CLASSES)) {
|
|
232
|
-
klass.urnGenerator = JcgmUrnGenerator;
|
|
233
|
-
}
|
|
234
|
-
function isObj(v) {
|
|
235
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
236
|
-
}
|
|
237
|
-
function parseLanguages(value) {
|
|
238
|
-
const raw = String(value);
|
|
239
|
-
return raw.split("/").map((code) => {
|
|
240
|
-
const original = code.trim();
|
|
241
|
-
const mapped = Language.CHAR_MAP[original] ?? original.toLowerCase();
|
|
242
|
-
return new Language({ code: mapped, originalCode: original });
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
function buildDate(value) {
|
|
246
|
-
if (value === undefined || value === null)
|
|
247
|
-
return undefined;
|
|
248
|
-
const dateStr = String(value);
|
|
249
|
-
const parts = dateStr.split("-");
|
|
250
|
-
return new PubidDate({ year: parts[0], month: parts[1], day: parts[2] });
|
|
251
|
-
}
|
|
252
|
-
class JcgmBuilder extends BaseBuilder {
|
|
253
|
-
defaultIdentifierClass() {
|
|
254
|
-
return KIND_CLASSES["guide"];
|
|
255
|
-
}
|
|
256
|
-
selectClass(data) {
|
|
257
|
-
const hasBase = data["base"] !== undefined;
|
|
258
|
-
const typeWithStage = data["type_with_stage"] === undefined || data["type_with_stage"] === null
|
|
259
|
-
? undefined
|
|
260
|
-
: String(data["type_with_stage"]);
|
|
261
|
-
if (hasBase) {
|
|
262
|
-
if (typeWithStage === undefined)
|
|
263
|
-
return KIND_CLASSES["amendment"];
|
|
264
|
-
return typeWithStage === "Amd" ? KIND_CLASSES["amendment"] : KIND_CLASSES["corrigendum"];
|
|
265
|
-
}
|
|
266
|
-
if (data["gum_number"] !== undefined)
|
|
267
|
-
return KIND_CLASSES["gum-guide"];
|
|
268
|
-
if (typeWithStage === "Meeting")
|
|
269
|
-
return KIND_CLASSES["meeting"];
|
|
270
|
-
return KIND_CLASSES["guide"];
|
|
271
|
-
}
|
|
272
|
-
build(data) {
|
|
273
|
-
const flat = Array.isArray(data) ? Object.assign({}, ...data) : data;
|
|
274
|
-
const klass = this.selectClass(flat);
|
|
275
|
-
const attrs = {};
|
|
276
|
-
if (flat["base"] !== undefined) {
|
|
277
|
-
attrs["base"] = this.build(flat["base"]);
|
|
278
|
-
}
|
|
279
|
-
if (flat["gum_number"] !== undefined)
|
|
280
|
-
attrs["number"] = String(flat["gum_number"]);
|
|
281
|
-
else if (flat["number"] !== undefined)
|
|
282
|
-
attrs["number"] = String(flat["number"]);
|
|
283
|
-
if (flat["date"] !== undefined) {
|
|
284
|
-
const date = buildDate(flat["date"]);
|
|
285
|
-
if (date)
|
|
286
|
-
attrs["date"] = date;
|
|
287
|
-
}
|
|
288
|
-
if (flat["languages"] !== undefined)
|
|
289
|
-
attrs["languages"] = parseLanguages(flat["languages"]);
|
|
290
|
-
return new klass(attrs);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
1
|
+
//! The jcgm node entry: the parse lane is the GENERATED substrate
|
|
2
|
+
//! (pubid/pubid-grammar#158) driving the wasm artifact runtime — the
|
|
3
|
+
//! baked jcgm.json is the only parsing input. The hand grammar.ts
|
|
4
|
+
//! re-transcription retired from this lane. The semantic delta (the
|
|
5
|
+
//! builder over the flat supplement captures + the URN parser) lives in
|
|
6
|
+
//! implementation.ts, shared byte for byte with the worker entry.
|
|
7
|
+
import { PubidRuntime } from "../../parg/runtime.js";
|
|
8
|
+
import * as substrate from "./generated/substrate.js";
|
|
9
|
+
import { makeJcgmGrammarImplementation } from "./implementation.js";
|
|
10
|
+
export * from "./model.js";
|
|
11
|
+
// The generated substrate drives the wasm artifact runtime — registered
|
|
12
|
+
// once at module init. Node-only (the runtime walks to the artifacts
|
|
13
|
+
// through node:fs); the worker entry registers the pure-TS worker
|
|
14
|
+
// engine instead.
|
|
15
|
+
substrate.registerRuntime(() => PubidRuntime.load(substrate.FLAVOR, substrate.ENTRY));
|
|
293
16
|
export function jcgmGrammarImplementation() {
|
|
294
|
-
|
|
295
|
-
return {
|
|
296
|
-
// Inverse of JcgmUrnGenerator (lib/pubid/jcgm/urn_parser.rb): rebuild
|
|
297
|
-
// identifiers DIRECTLY from the URN segments — re-parsing through the
|
|
298
|
-
// grammar flattened segments and lost languages/supplements.
|
|
299
|
-
parseUrn(urn) {
|
|
300
|
-
const parts = urn.replace(/^urn:jcgm:/, "").split(":");
|
|
301
|
-
if (parts[0] === "meeting") {
|
|
302
|
-
const number = toMeetingNumber(parts[1]);
|
|
303
|
-
const date = urnDate(parts[2]);
|
|
304
|
-
return new (KIND_CLASSES.meeting)({ number, date });
|
|
305
|
-
}
|
|
306
|
-
const markerAt = parts.findIndex((seg) => seg === "corrigendum" || seg === "amendment");
|
|
307
|
-
if (markerAt === -1) {
|
|
308
|
-
return buildUrnDocument(parts);
|
|
309
|
-
}
|
|
310
|
-
const kind = (parts[markerAt] === "amendment" ? "amendment" : "corrigendum");
|
|
311
|
-
const base = buildUrnDocument(parts.slice(0, markerAt));
|
|
312
|
-
const tail = parts.slice(markerAt + 1);
|
|
313
|
-
const number = tail[0] === undefined || tail[0] === "" ? undefined : tail[0];
|
|
314
|
-
const date = urnDate(tail[1]);
|
|
315
|
-
return new (KIND_CLASSES[kind])({ base, number, date });
|
|
316
|
-
},
|
|
317
|
-
parse(input) {
|
|
318
|
-
const tree = parseGrammar(jcgmGrammar, input);
|
|
319
|
-
if (typeof tree !== "object" || tree === null || Array.isArray(tree)) {
|
|
320
|
-
throw new ParseFailed("JCGM: unexpected parse tree", 0);
|
|
321
|
-
}
|
|
322
|
-
return builder.build(tree);
|
|
323
|
-
},
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
// lib/pubid/jcgm/urn_parser.rb build_document: Guide vs GumGuide by the
|
|
327
|
-
// "gum." number prefix; the year and language segments are matched by
|
|
328
|
-
// pattern, not position.
|
|
329
|
-
function buildUrnDocument(parts) {
|
|
330
|
-
const number = parts[0];
|
|
331
|
-
if (number === undefined || number === "") {
|
|
332
|
-
throw new Error("JCGM URN has no document number");
|
|
333
|
-
}
|
|
334
|
-
const gum = number.startsWith("gum.");
|
|
335
|
-
const rest = parts.slice(1);
|
|
336
|
-
const year = rest.find((seg) => /^(19|20)\d{2}$/.test(seg));
|
|
337
|
-
const langSegment = rest.find((seg) => /^[a-z]{2}(,[a-z]{2})*$/.test(seg));
|
|
338
|
-
const langLetters = {
|
|
339
|
-
ru: "R", fr: "F", en: "E", ar: "A", es: "S", de: "D",
|
|
340
|
-
};
|
|
341
|
-
const languages = langSegment
|
|
342
|
-
? langSegment.split(",").map((code) => new Language({ code, originalCode: langLetters[code] ?? code }))
|
|
343
|
-
: [];
|
|
344
|
-
const cls = gum ? KIND_CLASSES["gum-guide"] : KIND_CLASSES.guide;
|
|
345
|
-
const cleanNumber = gum ? number.slice("gum.".length) : number;
|
|
346
|
-
return new cls({
|
|
347
|
-
number: cleanNumber,
|
|
348
|
-
date: year ? new PubidDate({ year }) : undefined,
|
|
349
|
-
languages,
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
// nil for an absent year; a component for a well-formed 19xx/20xx year;
|
|
353
|
-
// anything else rejects (no re-parse validates it any more).
|
|
354
|
-
function urnDate(segment) {
|
|
355
|
-
if (segment === undefined || segment === "")
|
|
356
|
-
return undefined;
|
|
357
|
-
if (!/^(19|20)\d{2}$/.test(segment)) {
|
|
358
|
-
throw new Error(`Invalid year in JCGM URN: ${JSON.stringify(segment)}`);
|
|
359
|
-
}
|
|
360
|
-
return new PubidDate({ year: segment });
|
|
361
|
-
}
|
|
362
|
-
// "011" reads back as "11" (Identifiers::Meeting.ordinal normalization).
|
|
363
|
-
function toMeetingNumber(segment) {
|
|
364
|
-
return String(Number(segment));
|
|
17
|
+
return makeJcgmGrammarImplementation((body) => substrate.boundToWire(substrate.parseBound(body)));
|
|
365
18
|
}
|
|
366
|
-
export { isObj };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseIdentifier } from "../../model/identifier.js";
|
|
2
|
+
import type { IdentifierStatic } from "../../model/identifier.js";
|
|
3
|
+
import { BaseUrnGenerator } from "../../model/urn-generator.js";
|
|
4
|
+
import { PubidDate, Language } from "../../model/component.js";
|
|
5
|
+
/**
|
|
6
|
+
* The jcgm model — moved verbatim from the former hand entry (the
|
|
7
|
+
* builder mirrors Pubid::Jcgm; five concrete classes: guide, gum-guide,
|
|
8
|
+
* meeting, amendment, corrigendum; the date serializes FLAT as
|
|
9
|
+
* year/month/day through the converter mapping trio (Ruby's year_to_kv
|
|
10
|
+
* pattern); the ordinal suffix ("11st") is computed from the number at
|
|
11
|
+
* render time; supplements hold a nested base. The typed_stage is
|
|
12
|
+
* runtime-derived from the class (never serialized).
|
|
13
|
+
*/
|
|
14
|
+
export type JcgmKind = "guide" | "gum-guide" | "meeting" | "amendment" | "corrigendum";
|
|
15
|
+
export interface AttributeTableLike {
|
|
16
|
+
[key: string]: {
|
|
17
|
+
type: unknown;
|
|
18
|
+
default?: unknown;
|
|
19
|
+
collection?: boolean;
|
|
20
|
+
initializeEmpty?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const JCGM_ATTRS: AttributeTableLike;
|
|
24
|
+
export declare const DATE_MAPPINGS: import("../../model/attribute.js").FieldMapping[];
|
|
25
|
+
export declare abstract class JcgmIdentifier extends BaseIdentifier {
|
|
26
|
+
readonly number: string | undefined;
|
|
27
|
+
readonly part: string | undefined;
|
|
28
|
+
readonly subpart: string | undefined;
|
|
29
|
+
readonly date: PubidDate | undefined;
|
|
30
|
+
readonly languages: Language[];
|
|
31
|
+
readonly base: JcgmIdentifier | undefined;
|
|
32
|
+
/** generate_base_urn shape: urn:jcgm:<number>[:part...]:date... */
|
|
33
|
+
baseUrnParts(): string[];
|
|
34
|
+
/** The date as printed (PubidDate#to_s): "2008" / "2022-11-28". */
|
|
35
|
+
protected dateToS(): string;
|
|
36
|
+
protected languagePortion(): string;
|
|
37
|
+
/** English ordinal suffix computed from the number (11st, 12nd, 13rd…). */
|
|
38
|
+
protected ordinalSuffix(): string;
|
|
39
|
+
}
|
|
40
|
+
export declare const KIND_CLASSES: Record<JcgmKind, IdentifierStatic>;
|
|
41
|
+
export declare class JcgmUrnGenerator extends BaseUrnGenerator<JcgmIdentifier> {
|
|
42
|
+
generate(): string;
|
|
43
|
+
}
|