@pubid/pubid 0.1.72 → 0.1.74
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 +55 -4
- package/artifact/corpus.json.gz +0 -0
- package/dist/flavors/api/worker.d.ts +3 -0
- package/dist/flavors/api/worker.js +23 -0
- package/dist/flavors/ashrae/worker.d.ts +3 -0
- package/dist/flavors/ashrae/worker.js +23 -0
- package/dist/flavors/asme/worker.d.ts +3 -0
- package/dist/flavors/asme/worker.js +23 -0
- package/dist/flavors/astm/worker.d.ts +3 -0
- package/dist/flavors/astm/worker.js +23 -0
- package/dist/flavors/calconnect/worker.d.ts +3 -0
- package/dist/flavors/calconnect/worker.js +23 -0
- package/dist/flavors/cie/worker.d.ts +3 -0
- package/dist/flavors/cie/worker.js +23 -0
- package/dist/flavors/easc/worker.d.ts +3 -0
- package/dist/flavors/easc/worker.js +23 -0
- package/dist/flavors/ecma/worker.d.ts +3 -0
- package/dist/flavors/ecma/worker.js +23 -0
- package/dist/flavors/etsi/worker.d.ts +3 -0
- package/dist/flavors/etsi/worker.js +23 -0
- package/dist/flavors/gb/worker.d.ts +3 -0
- package/dist/flavors/gb/worker.js +23 -0
- package/dist/flavors/iala/worker.d.ts +3 -0
- package/dist/flavors/iala/worker.js +23 -0
- package/dist/flavors/iana/worker.d.ts +3 -0
- package/dist/flavors/iana/worker.js +23 -0
- package/dist/flavors/idf/worker.d.ts +3 -0
- package/dist/flavors/idf/worker.js +23 -0
- package/dist/flavors/ieee/model.js +14 -4
- package/dist/flavors/ieee/preprocessor.js +1 -0
- package/dist/flavors/ietf/worker.d.ts +3 -0
- package/dist/flavors/ietf/worker.js +23 -0
- package/dist/flavors/iho/worker.d.ts +3 -0
- package/dist/flavors/iho/worker.js +23 -0
- package/dist/flavors/jcgm/worker.d.ts +3 -0
- package/dist/flavors/jcgm/worker.js +23 -0
- package/dist/flavors/oasis/worker.d.ts +3 -0
- package/dist/flavors/oasis/worker.js +23 -0
- package/dist/flavors/ogc/worker.d.ts +3 -0
- package/dist/flavors/ogc/worker.js +23 -0
- package/dist/flavors/omg/worker.d.ts +3 -0
- package/dist/flavors/omg/worker.js +23 -0
- package/dist/flavors/plateau/worker.d.ts +3 -0
- package/dist/flavors/plateau/worker.js +23 -0
- package/dist/flavors/sae/worker.d.ts +3 -0
- package/dist/flavors/sae/worker.js +23 -0
- package/dist/flavors/tgpp/worker.d.ts +3 -0
- package/dist/flavors/tgpp/worker.js +23 -0
- package/dist/flavors/w3c/worker.d.ts +3 -0
- package/dist/flavors/w3c/worker.js +23 -0
- package/dist/flavors/xsf/worker.d.ts +3 -0
- package/dist/flavors/xsf/worker.js +23 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/lane-keys.d.ts +68 -0
- package/dist/lane-keys.js +113 -0
- package/dist/model/identifier.js +5 -4
- package/dist/parg/artifacts/api.d.ts +2 -0
- package/dist/parg/artifacts/api.js +5 -0
- package/dist/parg/artifacts/ashrae.d.ts +2 -0
- package/dist/parg/artifacts/ashrae.js +5 -0
- package/dist/parg/artifacts/asme.d.ts +2 -0
- package/dist/parg/artifacts/asme.js +5 -0
- package/dist/parg/artifacts/astm.d.ts +2 -0
- package/dist/parg/artifacts/astm.js +5 -0
- package/dist/parg/artifacts/calconnect.d.ts +2 -0
- package/dist/parg/artifacts/calconnect.js +5 -0
- package/dist/parg/artifacts/cie.d.ts +2 -0
- package/dist/parg/artifacts/cie.js +5 -0
- package/dist/parg/artifacts/easc.d.ts +2 -0
- package/dist/parg/artifacts/easc.js +5 -0
- package/dist/parg/artifacts/ecma.d.ts +2 -0
- package/dist/parg/artifacts/ecma.js +5 -0
- package/dist/parg/artifacts/etsi.d.ts +2 -0
- package/dist/parg/artifacts/etsi.js +5 -0
- package/dist/parg/artifacts/gb.d.ts +2 -0
- package/dist/parg/artifacts/gb.js +5 -0
- package/dist/parg/artifacts/iala.d.ts +2 -0
- package/dist/parg/artifacts/iala.js +5 -0
- package/dist/parg/artifacts/iana.d.ts +2 -0
- package/dist/parg/artifacts/iana.js +5 -0
- package/dist/parg/artifacts/idf.d.ts +2 -0
- package/dist/parg/artifacts/idf.js +5 -0
- package/dist/parg/artifacts/ietf.d.ts +2 -0
- package/dist/parg/artifacts/ietf.js +5 -0
- package/dist/parg/artifacts/iho.d.ts +2 -0
- package/dist/parg/artifacts/iho.js +5 -0
- package/dist/parg/artifacts/jcgm.d.ts +2 -0
- package/dist/parg/artifacts/jcgm.js +5 -0
- package/dist/parg/artifacts/oasis.d.ts +2 -0
- package/dist/parg/artifacts/oasis.js +5 -0
- package/dist/parg/artifacts/ogc.d.ts +2 -0
- package/dist/parg/artifacts/ogc.js +5 -0
- package/dist/parg/artifacts/omg.d.ts +2 -0
- package/dist/parg/artifacts/omg.js +5 -0
- package/dist/parg/artifacts/plateau.d.ts +2 -0
- package/dist/parg/artifacts/plateau.js +5 -0
- package/dist/parg/artifacts/sae.d.ts +2 -0
- package/dist/parg/artifacts/sae.js +5 -0
- package/dist/parg/artifacts/tgpp.d.ts +2 -0
- package/dist/parg/artifacts/tgpp.js +5 -0
- package/dist/parg/artifacts/w3c.d.ts +2 -0
- package/dist/parg/artifacts/w3c.js +5 -0
- package/dist/parg/artifacts/xsf.d.ts +2 -0
- package/dist/parg/artifacts/xsf.js +5 -0
- package/dist/parg/worker-engine.d.ts +12 -0
- package/dist/parg/worker-engine.js +32 -0
- package/dist/parg/worker.d.ts +3 -5
- package/dist/parg/worker.js +3 -9
- package/dist/parse-surface.d.ts +3 -31
- package/dist/parse-surface.js +2 -67
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidOmg\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"OMG\"}},{\"Entity\":{\"atom\":2}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":24}},{\"Entity\":{\"atom\":7}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Alternative\":{\"atoms\":[5,6]}},{\"Entity\":{\"atom\":13}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Re\":{\"pattern\":\"[+]\"}},{\"Alternative\":{\"atoms\":[9,10,11,12]}},{\"Repetition\":{\"atom\":8,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":18}},{\"Re\":{\"pattern\":\"[\\\\-]\"}},{\"Re\":{\"pattern\":\"[/]\"}},{\"Alternative\":{\"atoms\":[16,17]}},{\"Entity\":{\"atom\":13}},{\"Repetition\":{\"atom\":19,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[15,20]}},{\"Repetition\":{\"atom\":21,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[4,14,22]}},{\"Named\":{\"name\":\"acronym\",\"atom\":23}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":62}},{\"Entity\":{\"atom\":28}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":27,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":31}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":28}},{\"Repetition\":{\"atom\":32,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[30,33]}},{\"Repetition\":{\"atom\":34,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\" beta\"}},{\"Entity\":{\"atom\":41}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Alternative\":{\"atoms\":[38,39,40]}},{\"Lookahead\":{\"atom\":37,\"positive\":false}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":28}},{\"Repetition\":{\"atom\":44,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":41}},{\"Lookahead\":{\"atom\":46,\"positive\":false}},{\"Sequence\":{\"atoms\":[43,45,47]}},{\"Repetition\":{\"atom\":48,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[36,42,49]}},{\"Entity\":{\"atom\":2}},{\"Str\":{\"pattern\":\"Beta\"}},{\"Entity\":{\"atom\":28}},{\"Repetition\":{\"atom\":53,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Repetition\":{\"atom\":54,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":41}},{\"Lookahead\":{\"atom\":56,\"positive\":false}},{\"Sequence\":{\"atoms\":[51,52,55,57]}},{\"Alternative\":{\"atoms\":[50,58]}},{\"Repetition\":{\"atom\":59,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[29,35,60]}},{\"Named\":{\"name\":\"version\",\"atom\":61}},{\"Entity\":{\"atom\":68}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":66}},{\"Str\":{\"pattern\":\"/\"}},{\"Named\":{\"name\":\"slash\",\"atom\":65}},{\"Alternative\":{\"atoms\":[64,67]}},{\"Entity\":{\"atom\":72}},{\"Entity\":{\"atom\":41}},{\"Repetition\":{\"atom\":70,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"part\",\"atom\":71}},{\"Sequence\":{\"atoms\":[63,69]}},{\"Repetition\":{\"atom\":73,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[25,26,74]}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":72}},{\"Sequence\":{\"atoms\":[76,77]}},{\"Alternative\":{\"atoms\":[75,78]}},{\"Repetition\":{\"atom\":79,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[0,1,3,80]}}],\"root\":81},\"bindings\":[{\"capture\":\"acronym\",\"path\":\"acronym\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"version\",\"path\":\"version\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part\",\"path\":\"part\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule beta: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"OMG IDL 4.2\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"OMG UML 2.5.1\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/omg/parser.rb: OMG <acronym>[ <version>[<sep><part>]]\\n# with the beta-label word-boundary guards (a bare \\\"beta\\\" must not be\\n# swallowed by the part rule). The GLUED CATALOGUE label (\\\"Beta1\\\" --\\n# capitalized, the /spec/ALMAS/1.5/Beta1 URL segment) classifies into\\n# the version (the 2026-10-19 pubid#548 ruling); the LOWERCASE glued\\n# form (\\\"beta2\\\") stays a document part (the DDS ruling, spec-pinned). A\\n# /spec/ALMAS/1.5/Beta1 URL segment) classifies into the version (the\\n# 2026-10-19 pubid#548 ruling); a Beta-prefixed part without digits\\n# (\\\"BetaWave\\\") still lexes as the part \u2014 the boundary guard keeps it.\\n grammar PubidOmg version \\\"0.1.0\\\" edition 2 {\\n digit = %x30-39\\n acronym_char = %x41-5A / %x61-7A / %x30-39 / %x2B\\n acronym_join = %x2D / %x2F\\n acronym = (letter 1*acronym_char *(acronym_join 1*acronym_char)) as acronym\\n word_boundary = !alnum_char\\n beta = (\\\" beta\\\" !alnum_char ([space 1*digit !alnum_char]) / (space \\\"Beta\\\" [1*digit] !alnum_char))\\n version = (1*digit *(dot 1*digit) [(\\\" beta\\\" !alnum_char ([space 1*digit !alnum_char]) / (space \\\"Beta\\\" [1*digit] !alnum_char))]) as version\\n part_separator = space / slash\\n part = (1*alnum_char) as part\\n identifier = \\\"OMG\\\" space acronym [((space version [part_separator part]) / (space part))]\\n alnum_char = %x41-5A / %x61-7A / %x30-39\\n letter = %x41-5A / %x61-7A\\n dot = \\\".\\\"\\n slash = \\\"/\\\"\\n space = \\\" \\\"\\n entry identifier: identifier\\n\\n bindings identifier {\\n acronym -> acronym (string)\\n version -> version (string)\\n part -> part (string)\\n }\\n\\n\\n test {\\n accept \\\"OMG IDL 4.2\\\"\\n accept \\\"OMG UML 2.5.1\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"52d7a874221297d0f1ad18a19ef557046f62d2bed13cc27884080dbf5fb7fa97\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:27ca8d41fa5df4971f42a131d86ef72731fcb382b206a91c5eb9909783cd791e\",\"checksum\":\"sha256:1023acc0142c707dd89abc7f9c211c7a69e73a26911156dbde42e24ce8b628d6\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":1,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//! GENERATED FILE — do not edit. The checksummed PARG artifact for
|
|
2
|
+
//! the omg grammar, bundled as a module string so the worker
|
|
3
|
+
//! entries can construct the runtime without node:fs
|
|
4
|
+
//! (pubid/pubid-ts#232). Regenerate with `npm run artifact:emit`.
|
|
5
|
+
export default "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidOmg\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"OMG\"}},{\"Entity\":{\"atom\":2}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":24}},{\"Entity\":{\"atom\":7}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Alternative\":{\"atoms\":[5,6]}},{\"Entity\":{\"atom\":13}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Re\":{\"pattern\":\"[+]\"}},{\"Alternative\":{\"atoms\":[9,10,11,12]}},{\"Repetition\":{\"atom\":8,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":18}},{\"Re\":{\"pattern\":\"[\\\\-]\"}},{\"Re\":{\"pattern\":\"[/]\"}},{\"Alternative\":{\"atoms\":[16,17]}},{\"Entity\":{\"atom\":13}},{\"Repetition\":{\"atom\":19,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[15,20]}},{\"Repetition\":{\"atom\":21,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[4,14,22]}},{\"Named\":{\"name\":\"acronym\",\"atom\":23}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":62}},{\"Entity\":{\"atom\":28}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":27,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":31}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":28}},{\"Repetition\":{\"atom\":32,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[30,33]}},{\"Repetition\":{\"atom\":34,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\" beta\"}},{\"Entity\":{\"atom\":41}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Alternative\":{\"atoms\":[38,39,40]}},{\"Lookahead\":{\"atom\":37,\"positive\":false}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":28}},{\"Repetition\":{\"atom\":44,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":41}},{\"Lookahead\":{\"atom\":46,\"positive\":false}},{\"Sequence\":{\"atoms\":[43,45,47]}},{\"Repetition\":{\"atom\":48,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[36,42,49]}},{\"Entity\":{\"atom\":2}},{\"Str\":{\"pattern\":\"Beta\"}},{\"Entity\":{\"atom\":28}},{\"Repetition\":{\"atom\":53,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Repetition\":{\"atom\":54,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":41}},{\"Lookahead\":{\"atom\":56,\"positive\":false}},{\"Sequence\":{\"atoms\":[51,52,55,57]}},{\"Alternative\":{\"atoms\":[50,58]}},{\"Repetition\":{\"atom\":59,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[29,35,60]}},{\"Named\":{\"name\":\"version\",\"atom\":61}},{\"Entity\":{\"atom\":68}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":66}},{\"Str\":{\"pattern\":\"/\"}},{\"Named\":{\"name\":\"slash\",\"atom\":65}},{\"Alternative\":{\"atoms\":[64,67]}},{\"Entity\":{\"atom\":72}},{\"Entity\":{\"atom\":41}},{\"Repetition\":{\"atom\":70,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"part\",\"atom\":71}},{\"Sequence\":{\"atoms\":[63,69]}},{\"Repetition\":{\"atom\":73,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[25,26,74]}},{\"Entity\":{\"atom\":2}},{\"Entity\":{\"atom\":72}},{\"Sequence\":{\"atoms\":[76,77]}},{\"Alternative\":{\"atoms\":[75,78]}},{\"Repetition\":{\"atom\":79,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[0,1,3,80]}}],\"root\":81},\"bindings\":[{\"capture\":\"acronym\",\"path\":\"acronym\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"version\",\"path\":\"version\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part\",\"path\":\"part\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule beta: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"OMG IDL 4.2\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"OMG UML 2.5.1\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/omg/parser.rb: OMG <acronym>[ <version>[<sep><part>]]\\n# with the beta-label word-boundary guards (a bare \\\"beta\\\" must not be\\n# swallowed by the part rule). The GLUED CATALOGUE label (\\\"Beta1\\\" --\\n# capitalized, the /spec/ALMAS/1.5/Beta1 URL segment) classifies into\\n# the version (the 2026-10-19 pubid#548 ruling); the LOWERCASE glued\\n# form (\\\"beta2\\\") stays a document part (the DDS ruling, spec-pinned). A\\n# /spec/ALMAS/1.5/Beta1 URL segment) classifies into the version (the\\n# 2026-10-19 pubid#548 ruling); a Beta-prefixed part without digits\\n# (\\\"BetaWave\\\") still lexes as the part — the boundary guard keeps it.\\n grammar PubidOmg version \\\"0.1.0\\\" edition 2 {\\n digit = %x30-39\\n acronym_char = %x41-5A / %x61-7A / %x30-39 / %x2B\\n acronym_join = %x2D / %x2F\\n acronym = (letter 1*acronym_char *(acronym_join 1*acronym_char)) as acronym\\n word_boundary = !alnum_char\\n beta = (\\\" beta\\\" !alnum_char ([space 1*digit !alnum_char]) / (space \\\"Beta\\\" [1*digit] !alnum_char))\\n version = (1*digit *(dot 1*digit) [(\\\" beta\\\" !alnum_char ([space 1*digit !alnum_char]) / (space \\\"Beta\\\" [1*digit] !alnum_char))]) as version\\n part_separator = space / slash\\n part = (1*alnum_char) as part\\n identifier = \\\"OMG\\\" space acronym [((space version [part_separator part]) / (space part))]\\n alnum_char = %x41-5A / %x61-7A / %x30-39\\n letter = %x41-5A / %x61-7A\\n dot = \\\".\\\"\\n slash = \\\"/\\\"\\n space = \\\" \\\"\\n entry identifier: identifier\\n\\n bindings identifier {\\n acronym -> acronym (string)\\n version -> version (string)\\n part -> part (string)\\n }\\n\\n\\n test {\\n accept \\\"OMG IDL 4.2\\\"\\n accept \\\"OMG UML 2.5.1\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"52d7a874221297d0f1ad18a19ef557046f62d2bed13cc27884080dbf5fb7fa97\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:27ca8d41fa5df4971f42a131d86ef72731fcb382b206a91c5eb9909783cd791e\",\"checksum\":\"sha256:1023acc0142c707dd89abc7f9c211c7a69e73a26911156dbde42e24ce8b628d6\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":1,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidPlateau\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Entity\":{\"atom\":86}},{\"Entity\":{\"atom\":66}},{\"Str\":{\"pattern\":\"PLATEAU\"}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\"Handbook\"}},{\"Str\":{\"pattern\":\"Technical Report\"}},{\"Alternative\":{\"atoms\":[5,6]}},{\"Named\":{\"name\":\"type\",\"atom\":7}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":15}},{\"Str\":{\"pattern\":\"#\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":12,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"number\",\"atom\":13}},{\"Sequence\":{\"atoms\":[11,14]}},{\"Entity\":{\"atom\":23}},{\"Str\":{\"pattern\":\"-\"}},{\"Str\":{\"pattern\":\"_\"}},{\"Alternative\":{\"atoms\":[17,18]}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":20,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"annex\",\"atom\":21}},{\"Sequence\":{\"atoms\":[19,22]}},{\"Repetition\":{\"atom\":16,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":47}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":37}},{\"Str\":{\"pattern\":\"\u7B2C\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":29,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":32,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[30,31,33]}},{\"Named\":{\"name\":\"edition\",\"atom\":34}},{\"Str\":{\"pattern\":\"\u7248\"}},{\"Sequence\":{\"atoms\":[28,35,36]}},{\"Entity\":{\"atom\":45}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":39,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":42,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[40,41,43]}},{\"Named\":{\"name\":\"edition\",\"atom\":44}},{\"Alternative\":{\"atoms\":[27,38]}},{\"Sequence\":{\"atoms\":[26,46]}},{\"Entity\":{\"atom\":62}},{\"Entity\":{\"atom\":52}},{\"Str\":{\"pattern\":\" \"}},{\"Re\":{\"pattern\":\"[\\\\u3000]\"}},{\"Alternative\":{\"atoms\":[50,51]}},{\"Str\":{\"pattern\":\"\u672C\u7DE8\"}},{\"Str\":{\"pattern\":\"\uFF0B\"}},{\"Str\":{\"pattern\":\"+\"}},{\"Alternative\":{\"atoms\":[54,55]}},{\"Str\":{\"pattern\":\"\u4ED8\u9332\"}},{\"Sequence\":{\"atoms\":[56,57]}},{\"Repetition\":{\"atom\":58,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[53,59]}},{\"Named\":{\"name\":\"volume\",\"atom\":60}},{\"Sequence\":{\"atoms\":[49,61]}},{\"Repetition\":{\"atom\":48,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[25,63]}},{\"Repetition\":{\"atom\":64,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[2,3,4,9,10,24,65]}},{\"Entity\":{\"atom\":75}},{\"Str\":{\"pattern\":\"PLATEAU\"}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":15}},{\"Entity\":{\"atom\":23}},{\"Repetition\":{\"atom\":73,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[68,69,70,71,72,74]}},{\"Alternative\":{\"atoms\":[1,67]}},{\"Named\":{\"name\":\"base\",\"atom\":76}},{\"Entity\":{\"atom\":85}},{\"Str\":{\"pattern\":\" \"}},{\"Str\":{\"pattern\":\"Annex\"}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":84}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Named\":{\"name\":\"annex_letter\",\"atom\":83}},{\"Sequence\":{\"atoms\":[79,80,81,82]}},{\"Sequence\":{\"atoms\":[77,78]}},{\"Entity\":{\"atom\":66}},{\"Entity\":{\"atom\":75}},{\"Alternative\":{\"atoms\":[0,87,88]}}],\"root\":89},\"bindings\":[{\"capture\":\"base\",\"path\":\"base\",\"type\":\"raw\",\"card\":null,\"preprocess\":null},{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"annex\",\"path\":\"annex\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"edition\",\"path\":\"edition\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"volume\",\"path\":\"volume\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"annex_letter\",\"path\":\"annex_letter\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule identifier: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)\",\"rule identifier: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)\",\"rule identifier: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #3\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Technical Report #1\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #00 \u7B2C5.0\u7248 \u672C\u7DE8\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #00 \u7B2C5.0\u7248\u3000\u672C\u7DE8\uFF0B\u4ED8\u9332\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #00 \u7B2C5.0\u7248 \u672C\u7DE8+\u4ED8\u9332\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/plateau/parser.rb: PLATEAU Handbook/Technical Report\\n# #NN[-annex][ edition], plus Annex supplements. Japanese canonical\\n# edition (\u7B2CX.Y\u7248) and legacy Latin X.Y both capture the same atom.\\n#\\n# Edition 2: every reference inside a captured body is inlined to raw\\n# terms (a rule reference materializes as a named node in the edition-2\\n# tree, so only a raw capture binds a scalar span). The base wrapper\\n# keeps the v1 tree shape and the bindings name the scalar leaves.\\n\\ngrammar PubidPlateau version \\\"0.1.0\\\" edition 2 {\\n doc_type = (\\\"Handbook\\\" / \\\"Technical Report\\\") as type\\n number = \\\"#\\\" (1*%x30-39) as number\\n annex = (\\\"-\\\" / \\\"_\\\") (1*%x30-39) as annex\\n edition_part = \\\"\u7B2C\\\" (1*%x30-39 \\\".\\\" 1*%x30-39) as edition \\\"\u7248\\\"\\n edition_latin = (1*%x30-39 \\\".\\\" 1*%x30-39) as edition\\n edition = \\\" \\\" (edition_part / edition_latin)\\n # MLIT's volume label after the edition: \u672C\u7DE8 (main volume) or \u672C\u7DE8\uFF0B\u4ED8\u9332\\n # (main volume with appendix). ASCII or full-width (U+3000) space; ASCII\\n # \\\"+\\\" or full-width \\\"\uFF0B\\\" (U+FF0B), which the builder normalizes to \\\"\uFF0B\\\".\\n volume_sep = \\\" \\\" / %x3000\\n volume = volume_sep (\\\"\u672C\u7DE8\\\" [(\\\"\uFF0B\\\" / \\\"+\\\") \\\"\u4ED8\u9332\\\"]) as volume\\n annex_letter = (%x41-5A) as annex_letter\\n annex_supplement = \\\" \\\" \\\"Annex\\\" \\\" \\\" annex_letter\\n handbook = \\\"PLATEAU\\\" \\\" \\\" doc_type \\\" \\\" number [annex] [edition [volume]]\\n technical_report = \\\"PLATEAU\\\" \\\" \\\" doc_type \\\" \\\" number [annex]\\n annex_identifier = (handbook / technical_report) as base annex_supplement\\n identifier = annex_identifier / handbook / technical_report\\n\\n entry identifier: identifier\\n\\n test {\\n accept \\\"PLATEAU Handbook #3\\\"\\n accept \\\"PLATEAU Technical Report #1\\\"\\n accept \\\"PLATEAU Handbook #00 \u7B2C5.0\u7248 \u672C\u7DE8\\\"\\n accept \\\"PLATEAU Handbook #00 \u7B2C5.0\u7248\u3000\u672C\u7DE8\uFF0B\u4ED8\u9332\\\"\\n accept \\\"PLATEAU Handbook #00 \u7B2C5.0\u7248 \u672C\u7DE8+\u4ED8\u9332\\\"\\n reject \\\"nonsense\\\"\\n }\\n\\n bindings identifier {\\n # The builder dispatches on base && annex_letter and RE-parses the base\\n # subtree recursively (build_annex calls build(parsed[:base])), so base\\n # binds uncast \u2014 the nested {type, number, annex, edition} hash.\\n base -> base (raw)\\n type -> type (string)\\n number -> number (string)\\n annex -> annex (string)\\n edition -> edition (string)\\n volume -> volume (string)\\n annex_letter -> annex_letter (string)\\n }\\n}\\n\",\"source_hash\":\"f5a43fb4d638687462490f2b05b635501ac21375c917b10e28f2cad554985476\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:5cf49740f186cc3edd553ebd36c5a1d2a57e7a9825b849788198d85450b6c3a5\",\"checksum\":\"sha256:a638141b74d2589900cda62938241d48195f2bd2af3dc1aad40e0900a5c4feb3\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":3,\"tests_total\":6,\"tests_failures\":0,\"self_test\":true}}";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//! GENERATED FILE — do not edit. The checksummed PARG artifact for
|
|
2
|
+
//! the plateau grammar, bundled as a module string so the worker
|
|
3
|
+
//! entries can construct the runtime without node:fs
|
|
4
|
+
//! (pubid/pubid-ts#232). Regenerate with `npm run artifact:emit`.
|
|
5
|
+
export default "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidPlateau\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Entity\":{\"atom\":86}},{\"Entity\":{\"atom\":66}},{\"Str\":{\"pattern\":\"PLATEAU\"}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\"Handbook\"}},{\"Str\":{\"pattern\":\"Technical Report\"}},{\"Alternative\":{\"atoms\":[5,6]}},{\"Named\":{\"name\":\"type\",\"atom\":7}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":15}},{\"Str\":{\"pattern\":\"#\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":12,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"number\",\"atom\":13}},{\"Sequence\":{\"atoms\":[11,14]}},{\"Entity\":{\"atom\":23}},{\"Str\":{\"pattern\":\"-\"}},{\"Str\":{\"pattern\":\"_\"}},{\"Alternative\":{\"atoms\":[17,18]}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":20,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"annex\",\"atom\":21}},{\"Sequence\":{\"atoms\":[19,22]}},{\"Repetition\":{\"atom\":16,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":47}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":37}},{\"Str\":{\"pattern\":\"第\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":29,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":32,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[30,31,33]}},{\"Named\":{\"name\":\"edition\",\"atom\":34}},{\"Str\":{\"pattern\":\"版\"}},{\"Sequence\":{\"atoms\":[28,35,36]}},{\"Entity\":{\"atom\":45}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":39,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":42,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[40,41,43]}},{\"Named\":{\"name\":\"edition\",\"atom\":44}},{\"Alternative\":{\"atoms\":[27,38]}},{\"Sequence\":{\"atoms\":[26,46]}},{\"Entity\":{\"atom\":62}},{\"Entity\":{\"atom\":52}},{\"Str\":{\"pattern\":\" \"}},{\"Re\":{\"pattern\":\"[\\\\u3000]\"}},{\"Alternative\":{\"atoms\":[50,51]}},{\"Str\":{\"pattern\":\"本編\"}},{\"Str\":{\"pattern\":\"+\"}},{\"Str\":{\"pattern\":\"+\"}},{\"Alternative\":{\"atoms\":[54,55]}},{\"Str\":{\"pattern\":\"付録\"}},{\"Sequence\":{\"atoms\":[56,57]}},{\"Repetition\":{\"atom\":58,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[53,59]}},{\"Named\":{\"name\":\"volume\",\"atom\":60}},{\"Sequence\":{\"atoms\":[49,61]}},{\"Repetition\":{\"atom\":48,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[25,63]}},{\"Repetition\":{\"atom\":64,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[2,3,4,9,10,24,65]}},{\"Entity\":{\"atom\":75}},{\"Str\":{\"pattern\":\"PLATEAU\"}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":15}},{\"Entity\":{\"atom\":23}},{\"Repetition\":{\"atom\":73,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[68,69,70,71,72,74]}},{\"Alternative\":{\"atoms\":[1,67]}},{\"Named\":{\"name\":\"base\",\"atom\":76}},{\"Entity\":{\"atom\":85}},{\"Str\":{\"pattern\":\" \"}},{\"Str\":{\"pattern\":\"Annex\"}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":84}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Named\":{\"name\":\"annex_letter\",\"atom\":83}},{\"Sequence\":{\"atoms\":[79,80,81,82]}},{\"Sequence\":{\"atoms\":[77,78]}},{\"Entity\":{\"atom\":66}},{\"Entity\":{\"atom\":75}},{\"Alternative\":{\"atoms\":[0,87,88]}}],\"root\":89},\"bindings\":[{\"capture\":\"base\",\"path\":\"base\",\"type\":\"raw\",\"card\":null,\"preprocess\":null},{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"annex\",\"path\":\"annex\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"edition\",\"path\":\"edition\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"volume\",\"path\":\"volume\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"annex_letter\",\"path\":\"annex_letter\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule identifier: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)\",\"rule identifier: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)\",\"rule identifier: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #3\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Technical Report #1\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #00 第5.0版 本編\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #00 第5.0版 本編+付録\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"PLATEAU Handbook #00 第5.0版 本編+付録\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/plateau/parser.rb: PLATEAU Handbook/Technical Report\\n# #NN[-annex][ edition], plus Annex supplements. Japanese canonical\\n# edition (第X.Y版) and legacy Latin X.Y both capture the same atom.\\n#\\n# Edition 2: every reference inside a captured body is inlined to raw\\n# terms (a rule reference materializes as a named node in the edition-2\\n# tree, so only a raw capture binds a scalar span). The base wrapper\\n# keeps the v1 tree shape and the bindings name the scalar leaves.\\n\\ngrammar PubidPlateau version \\\"0.1.0\\\" edition 2 {\\n doc_type = (\\\"Handbook\\\" / \\\"Technical Report\\\") as type\\n number = \\\"#\\\" (1*%x30-39) as number\\n annex = (\\\"-\\\" / \\\"_\\\") (1*%x30-39) as annex\\n edition_part = \\\"第\\\" (1*%x30-39 \\\".\\\" 1*%x30-39) as edition \\\"版\\\"\\n edition_latin = (1*%x30-39 \\\".\\\" 1*%x30-39) as edition\\n edition = \\\" \\\" (edition_part / edition_latin)\\n # MLIT's volume label after the edition: 本編 (main volume) or 本編+付録\\n # (main volume with appendix). ASCII or full-width (U+3000) space; ASCII\\n # \\\"+\\\" or full-width \\\"+\\\" (U+FF0B), which the builder normalizes to \\\"+\\\".\\n volume_sep = \\\" \\\" / %x3000\\n volume = volume_sep (\\\"本編\\\" [(\\\"+\\\" / \\\"+\\\") \\\"付録\\\"]) as volume\\n annex_letter = (%x41-5A) as annex_letter\\n annex_supplement = \\\" \\\" \\\"Annex\\\" \\\" \\\" annex_letter\\n handbook = \\\"PLATEAU\\\" \\\" \\\" doc_type \\\" \\\" number [annex] [edition [volume]]\\n technical_report = \\\"PLATEAU\\\" \\\" \\\" doc_type \\\" \\\" number [annex]\\n annex_identifier = (handbook / technical_report) as base annex_supplement\\n identifier = annex_identifier / handbook / technical_report\\n\\n entry identifier: identifier\\n\\n test {\\n accept \\\"PLATEAU Handbook #3\\\"\\n accept \\\"PLATEAU Technical Report #1\\\"\\n accept \\\"PLATEAU Handbook #00 第5.0版 本編\\\"\\n accept \\\"PLATEAU Handbook #00 第5.0版 本編+付録\\\"\\n accept \\\"PLATEAU Handbook #00 第5.0版 本編+付録\\\"\\n reject \\\"nonsense\\\"\\n }\\n\\n bindings identifier {\\n # The builder dispatches on base && annex_letter and RE-parses the base\\n # subtree recursively (build_annex calls build(parsed[:base])), so base\\n # binds uncast — the nested {type, number, annex, edition} hash.\\n base -> base (raw)\\n type -> type (string)\\n number -> number (string)\\n annex -> annex (string)\\n edition -> edition (string)\\n volume -> volume (string)\\n annex_letter -> annex_letter (string)\\n }\\n}\\n\",\"source_hash\":\"f5a43fb4d638687462490f2b05b635501ac21375c917b10e28f2cad554985476\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:5cf49740f186cc3edd553ebd36c5a1d2a57e7a9825b849788198d85450b6c3a5\",\"checksum\":\"sha256:a638141b74d2589900cda62938241d48195f2bd2af3dc1aad40e0900a5c4feb3\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":3,\"tests_total\":6,\"tests_failures\":0,\"self_test\":true}}";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "{\"bindings\":null,\"version\":\"0.2.0\",\"grammar\":\"PubidSae\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"SAE\"}},{\"Named\":{\"name\":\"publisher\",\"atom\":0}},{\"Entity\":{\"atom\":3}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":86}},{\"Str\":{\"pattern\":\"AMS-QQ-A\"}},{\"Str\":{\"pattern\":\"AMS-QQ-C\"}},{\"Str\":{\"pattern\":\"AMS-QQ-N\"}},{\"Str\":{\"pattern\":\"AMS-QQ-P\"}},{\"Str\":{\"pattern\":\"AMS-QQ-S\"}},{\"Str\":{\"pattern\":\"AMS-QQ-W\"}},{\"Str\":{\"pattern\":\"AMS-WW-T\"}},{\"Str\":{\"pattern\":\"GEIA-STD\"}},{\"Str\":{\"pattern\":\"AMS-DTL\"}},{\"Str\":{\"pattern\":\"AMS-PRF\"}},{\"Str\":{\"pattern\":\"AMS-STD\"}},{\"Str\":{\"pattern\":\"EIA-STD\"}},{\"Str\":{\"pattern\":\"GEIA-HB\"}},{\"Str\":{\"pattern\":\"GEIA-OP\"}},{\"Str\":{\"pattern\":\"GEIA-TB\"}},{\"Str\":{\"pattern\":\"GEIASTD\"}},{\"Str\":{\"pattern\":\"AMSDTL\"}},{\"Str\":{\"pattern\":\"AMSPRF\"}},{\"Str\":{\"pattern\":\"AMSQQA\"}},{\"Str\":{\"pattern\":\"AMSQQC\"}},{\"Str\":{\"pattern\":\"AMSQQN\"}},{\"Str\":{\"pattern\":\"AMSQQP\"}},{\"Str\":{\"pattern\":\"AMSQQS\"}},{\"Str\":{\"pattern\":\"AMSQQW\"}},{\"Str\":{\"pattern\":\"AMSSTD\"}},{\"Str\":{\"pattern\":\"AMSWWT\"}},{\"Str\":{\"pattern\":\"EIA-IS\"}},{\"Str\":{\"pattern\":\"EIASTD\"}},{\"Str\":{\"pattern\":\"GEIAHB\"}},{\"Str\":{\"pattern\":\"GEIAOP\"}},{\"Str\":{\"pattern\":\"GEIATB\"}},{\"Str\":{\"pattern\":\"AMS-A\"}},{\"Str\":{\"pattern\":\"AMS-B\"}},{\"Str\":{\"pattern\":\"AMS-C\"}},{\"Str\":{\"pattern\":\"AMS-D\"}},{\"Str\":{\"pattern\":\"AMS-F\"}},{\"Str\":{\"pattern\":\"AMS-G\"}},{\"Str\":{\"pattern\":\"AMS-H\"}},{\"Str\":{\"pattern\":\"AMS-I\"}},{\"Str\":{\"pattern\":\"AMS-L\"}},{\"Str\":{\"pattern\":\"AMS-M\"}},{\"Str\":{\"pattern\":\"AMS-P\"}},{\"Str\":{\"pattern\":\"AMS-R\"}},{\"Str\":{\"pattern\":\"AMS-S\"}},{\"Str\":{\"pattern\":\"AMS-T\"}},{\"Str\":{\"pattern\":\"AMS-W\"}},{\"Str\":{\"pattern\":\"EIAIS\"}},{\"Str\":{\"pattern\":\"USCAR\"}},{\"Str\":{\"pattern\":\"AMSA\"}},{\"Str\":{\"pattern\":\"AMSB\"}},{\"Str\":{\"pattern\":\"AMSC\"}},{\"Str\":{\"pattern\":\"AMSD\"}},{\"Str\":{\"pattern\":\"AMSF\"}},{\"Str\":{\"pattern\":\"AMSG\"}},{\"Str\":{\"pattern\":\"AMSH\"}},{\"Str\":{\"pattern\":\"AMSI\"}},{\"Str\":{\"pattern\":\"AMSL\"}},{\"Str\":{\"pattern\":\"AMSM\"}},{\"Str\":{\"pattern\":\"AMSP\"}},{\"Str\":{\"pattern\":\"AMSR\"}},{\"Str\":{\"pattern\":\"AMSS\"}},{\"Str\":{\"pattern\":\"AMST\"}},{\"Str\":{\"pattern\":\"AMSW\"}},{\"Str\":{\"pattern\":\"GEIA\"}},{\"Str\":{\"pattern\":\"AIR\"}},{\"Str\":{\"pattern\":\"AMS\"}},{\"Str\":{\"pattern\":\"ARD\"}},{\"Str\":{\"pattern\":\"ARP\"}},{\"Str\":{\"pattern\":\"CMB\"}},{\"Str\":{\"pattern\":\"CRP\"}},{\"Str\":{\"pattern\":\"EIA\"}},{\"Str\":{\"pattern\":\"MAM\"}},{\"Str\":{\"pattern\":\"MAP\"}},{\"Str\":{\"pattern\":\"SSB\"}},{\"Str\":{\"pattern\":\"TSB\"}},{\"Str\":{\"pattern\":\"AS\"}},{\"Str\":{\"pattern\":\"JA\"}},{\"Str\":{\"pattern\":\"MA\"}},{\"Str\":{\"pattern\":\"MS\"}},{\"Str\":{\"pattern\":\"J\"}},{\"Alternative\":{\"atoms\":[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84]}},{\"Named\":{\"name\":\"type\",\"atom\":85}},{\"Entity\":{\"atom\":90}},{\"Entity\":{\"atom\":3}},{\"Str\":{\"pattern\":\"-\"}},{\"Alternative\":{\"atoms\":[88,89]}},{\"Named\":{\"name\":\"type_sep\",\"atom\":87}},{\"Repetition\":{\"atom\":91,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":97}},{\"Entity\":{\"atom\":95}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":94,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"number\",\"atom\":96}},{\"Entity\":{\"atom\":107}},{\"Str\":{\"pattern\":\"-\"}},{\"Str\":{\"pattern\":\"_\"}},{\"Alternative\":{\"atoms\":[99,100]}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":102,\"min\":1,\"max\":3,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"dash\",\"atom\":103}},{\"Entity\":{\"atom\":95}},{\"Lookahead\":{\"atom\":105,\"positive\":false}},{\"Sequence\":{\"atoms\":[101,104,106]}},{\"Repetition\":{\"atom\":98,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":113}},{\"Entity\":{\"atom\":111}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Repetition\":{\"atom\":110,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"tail\",\"atom\":112}},{\"Repetition\":{\"atom\":109,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":130}},{\"Str\":{\"pattern\":\"/\"}},{\"Entity\":{\"atom\":111}},{\"Repetition\":{\"atom\":117,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":119,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[118,120]}},{\"Entity\":{\"atom\":111}},{\"Repetition\":{\"atom\":122,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Alternative\":{\"atoms\":[121,123]}},{\"Named\":{\"name\":\"part\",\"atom\":124}},{\"Entity\":{\"atom\":111}},{\"Repetition\":{\"atom\":126,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"part_tail\",\"atom\":127}},{\"Repetition\":{\"atom\":128,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[116,125,129]}},{\"Repetition\":{\"atom\":115,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":137}},{\"Str\":{\"pattern\":\"_A\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":134,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"amendment\",\"atom\":135}},{\"Sequence\":{\"atoms\":[133,136]}},{\"Repetition\":{\"atom\":132,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":153}},{\"Str\":{\"pattern\":\":\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":141,\"min\":4,\"max\":4,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"year\",\"atom\":142}},{\"Sequence\":{\"atoms\":[140,143]}},{\"Str\":{\"pattern\":\"_\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":146,\"min\":4,\"max\":4,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"year\",\"atom\":147}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":149,\"min\":2,\"max\":2,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"month\",\"atom\":150}},{\"Sequence\":{\"atoms\":[145,148,151]}},{\"Alternative\":{\"atoms\":[144,152]}},{\"Repetition\":{\"atom\":139,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[1,2,4,92,93,108,114,131,138,154]}}],\"root\":155},\"bindings\":[{\"capture\":\"publisher\",\"path\":\"publisher\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"dash\",\"path\":\"dash\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"tail\",\"path\":\"tail\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part\",\"path\":\"part\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part_tail\",\"path\":\"part_tail\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"amendment\",\"path\":\"amendment\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"year\",\"path\":\"year\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"month\",\"path\":\"month\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE J1939\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE J 3016\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE AMS2430\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE ARP4754A:2010\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE AMS-QQ-A-250/4B\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE AMSQQA250/4B\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"SAE J3016_2021\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"SAE XYZ1\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE J3016_202104\",\"expect\":{\"type\":\"J\",\"number\":\"3016\",\"year\":\"2021\",\"month\":\"04\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AMS4121J\",\"expect\":{\"type\":\"AMS\",\"number\":\"4121\",\"tail\":\"J\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AS22520/45A\",\"expect\":{\"type\":\"AS\",\"number\":\"22520\",\"part\":\"45\",\"part_tail\":\"A\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AMS5622/H1025\",\"expect\":{\"type\":\"AMS\",\"number\":\"5622\",\"part\":\"H1025\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE J2945/AS\",\"expect\":{\"type\":\"J\",\"number\":\"2945\",\"part\":\"AS\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE J1939-71:2020\",\"expect\":{\"type\":\"J\",\"number\":\"1939\",\"dash\":\"71\",\"year\":\"2020\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE EIA649_1A\",\"expect\":{\"type\":\"EIA\",\"number\":\"649\",\"dash\":\"1\",\"tail\":\"A\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AS5259/7A_A1\",\"expect\":{\"type\":\"AS\",\"number\":\"5259\",\"part\":\"7\",\"part_tail\":\"A\",\"amendment\":\"1\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AMSSTD595\",\"expect\":{\"type\":\"AMSSTD\",\"number\":\"595\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE GEIA-STD-0001\",\"expect\":{\"type\":\"GEIA-STD\",\"number\":\"0001\"}}],\"docs\":{},\"source\":\"# SAE identifiers, in SAE's printed form and in the hyphen-free form of its\\n# Crossref DOI suffixes (10.4271/<code>):\\n#\\n# SAE <type>[ |-]<number>[-<dash>][<tail>][/<part>[<part_tail>]][_A<n>][:yyyy|_yyyymm]\\n#\\n# The grammar only segments. What a letter tail means (a revision, the\\n# metric M of a J report, a digital-annex DA) and which spelling of the type\\n# is printed is decided by pubid's lib/pubid/sae/builder.rb, which owns the\\n# type table (Pubid::Sae::Components::Type::TYPES). The doc_type\\n# alternatives are that table's keys plus their hyphen-free spellings,\\n# longest first: PEG commits to the first alternative that matches, so\\n# \\\"AMS\\\" must come after every \\\"AMS...\\\" family.\\n\\ngrammar PubidSae version \\\"0.2.0\\\" edition 2 {\\n doc_type = (\\\"AMS-QQ-A\\\" / \\\"AMS-QQ-C\\\" / \\\"AMS-QQ-N\\\" / \\\"AMS-QQ-P\\\" / \\\"AMS-QQ-S\\\" / \\\"AMS-QQ-W\\\" / \\\"AMS-WW-T\\\" / \\\"GEIA-STD\\\" / \\\"AMS-DTL\\\" / \\\"AMS-PRF\\\" / \\\"AMS-STD\\\" / \\\"EIA-STD\\\" / \\\"GEIA-HB\\\" / \\\"GEIA-OP\\\" / \\\"GEIA-TB\\\" / \\\"GEIASTD\\\" / \\\"AMSDTL\\\" / \\\"AMSPRF\\\" / \\\"AMSQQA\\\" / \\\"AMSQQC\\\" / \\\"AMSQQN\\\" / \\\"AMSQQP\\\" / \\\"AMSQQS\\\" / \\\"AMSQQW\\\" / \\\"AMSSTD\\\" / \\\"AMSWWT\\\" / \\\"EIA-IS\\\" / \\\"EIASTD\\\" / \\\"GEIAHB\\\" / \\\"GEIAOP\\\" / \\\"GEIATB\\\" / \\\"AMS-A\\\" / \\\"AMS-B\\\" / \\\"AMS-C\\\" / \\\"AMS-D\\\" / \\\"AMS-F\\\" / \\\"AMS-G\\\" / \\\"AMS-H\\\" / \\\"AMS-I\\\" / \\\"AMS-L\\\" / \\\"AMS-M\\\" / \\\"AMS-P\\\" / \\\"AMS-R\\\" / \\\"AMS-S\\\" / \\\"AMS-T\\\" / \\\"AMS-W\\\" / \\\"EIAIS\\\" / \\\"USCAR\\\" / \\\"AMSA\\\" / \\\"AMSB\\\" / \\\"AMSC\\\" / \\\"AMSD\\\" / \\\"AMSF\\\" / \\\"AMSG\\\" / \\\"AMSH\\\" / \\\"AMSI\\\" / \\\"AMSL\\\" / \\\"AMSM\\\" / \\\"AMSP\\\" / \\\"AMSR\\\" / \\\"AMSS\\\" / \\\"AMST\\\" / \\\"AMSW\\\" / \\\"GEIA\\\" / \\\"AIR\\\" / \\\"AMS\\\" / \\\"ARD\\\" / \\\"ARP\\\" / \\\"CMB\\\" / \\\"CRP\\\" / \\\"EIA\\\" / \\\"MAM\\\" / \\\"MAP\\\" / \\\"SSB\\\" / \\\"TSB\\\" / \\\"AS\\\" / \\\"JA\\\" / \\\"MA\\\" / \\\"MS\\\" / \\\"J\\\") as type\\n type_sep = space / \\\"-\\\"\\n number = (1*digit) as number\\n # A dash number: J1939-71, EIA649-2, and the DOI's EIA649_1. At most three\\n # digits and no digit after, so \\\"_202104\\\" stays a date.\\n dash = (\\\"-\\\" / \\\"_\\\") (1*3digit) as dash !digit\\n tail = (1*letter) as tail\\n part = \\\"/\\\" ((*letter 1*digit) / 1*letter) as part [(1*letter) as part_tail]\\n amendment = \\\"_A\\\" (1*digit) as amendment\\n date = (\\\":\\\" (4digit) as year) / (\\\"_\\\" (4digit) as year (2digit) as month)\\n identifier = \\\"SAE\\\" as publisher space doc_type [type_sep] number [dash] [tail] [part] [amendment] [date]\\n letter = %x41-5A\\n digit = %x30-39\\n space = \\\" \\\"\\n entry identifier: identifier\\n\\n bindings identifier {\\n publisher -> publisher (string)\\n type -> type (string)\\n number -> number (string)\\n dash -> dash (string)\\n tail -> tail (string)\\n part -> part (string)\\n part_tail -> part_tail (string)\\n amendment -> amendment (string)\\n year -> year (string)\\n month -> month (string)\\n }\\n\\n test {\\n accept \\\"SAE J1939\\\"\\n accept \\\"SAE J 3016\\\"\\n accept \\\"SAE AMS2430\\\"\\n accept \\\"SAE ARP4754A:2010\\\"\\n accept \\\"SAE AMS-QQ-A-250/4B\\\"\\n accept \\\"SAE AMSQQA250/4B\\\"\\n reject \\\"nonsense\\\"\\n reject \\\"SAE J3016_2021\\\"\\n reject \\\"SAE XYZ1\\\"\\n example \\\"SAE J3016_202104\\\" { type: \\\"J\\\", number: \\\"3016\\\", year: \\\"2021\\\", month: \\\"04\\\" }\\n example \\\"SAE AMS4121J\\\" { type: \\\"AMS\\\", number: \\\"4121\\\", tail: \\\"J\\\" }\\n example \\\"SAE AS22520/45A\\\" { type: \\\"AS\\\", number: \\\"22520\\\", part: \\\"45\\\", part_tail: \\\"A\\\" }\\n example \\\"SAE AMS5622/H1025\\\" { type: \\\"AMS\\\", number: \\\"5622\\\", part: \\\"H1025\\\" }\\n example \\\"SAE J2945/AS\\\" { type: \\\"J\\\", number: \\\"2945\\\", part: \\\"AS\\\" }\\n example \\\"SAE J1939-71:2020\\\" { type: \\\"J\\\", number: \\\"1939\\\", dash: \\\"71\\\", year: \\\"2020\\\" }\\n example \\\"SAE EIA649_1A\\\" { type: \\\"EIA\\\", number: \\\"649\\\", dash: \\\"1\\\", tail: \\\"A\\\" }\\n example \\\"SAE AS5259/7A_A1\\\" { type: \\\"AS\\\", number: \\\"5259\\\", part: \\\"7\\\", part_tail: \\\"A\\\", amendment: \\\"1\\\" }\\n example \\\"SAE AMSSTD595\\\" { type: \\\"AMSSTD\\\", number: \\\"595\\\" }\\n example \\\"SAE GEIA-STD-0001\\\" { type: \\\"GEIA-STD\\\", number: \\\"0001\\\" }\\n }\\n}\\n\",\"source_hash\":\"204b7183faedf1026e76016e92d3e9904d81930ed04d7a9d54849ac78f1ad6e7\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:58d95b3087380a9ddb6598898095eac06e5cf639bc63d699c0db8d51c88c15f0\",\"checksum\":\"sha256:c95d86491dfe2414e3f1883359984b4aeaec44656b98ed7fe7fbbe31b2e3dd8a\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":0,\"tests_total\":19,\"tests_failures\":0,\"self_test\":true}}";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//! GENERATED FILE — do not edit. The checksummed PARG artifact for
|
|
2
|
+
//! the sae grammar, bundled as a module string so the worker
|
|
3
|
+
//! entries can construct the runtime without node:fs
|
|
4
|
+
//! (pubid/pubid-ts#232). Regenerate with `npm run artifact:emit`.
|
|
5
|
+
export default "{\"bindings\":null,\"version\":\"0.2.0\",\"grammar\":\"PubidSae\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"SAE\"}},{\"Named\":{\"name\":\"publisher\",\"atom\":0}},{\"Entity\":{\"atom\":3}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":86}},{\"Str\":{\"pattern\":\"AMS-QQ-A\"}},{\"Str\":{\"pattern\":\"AMS-QQ-C\"}},{\"Str\":{\"pattern\":\"AMS-QQ-N\"}},{\"Str\":{\"pattern\":\"AMS-QQ-P\"}},{\"Str\":{\"pattern\":\"AMS-QQ-S\"}},{\"Str\":{\"pattern\":\"AMS-QQ-W\"}},{\"Str\":{\"pattern\":\"AMS-WW-T\"}},{\"Str\":{\"pattern\":\"GEIA-STD\"}},{\"Str\":{\"pattern\":\"AMS-DTL\"}},{\"Str\":{\"pattern\":\"AMS-PRF\"}},{\"Str\":{\"pattern\":\"AMS-STD\"}},{\"Str\":{\"pattern\":\"EIA-STD\"}},{\"Str\":{\"pattern\":\"GEIA-HB\"}},{\"Str\":{\"pattern\":\"GEIA-OP\"}},{\"Str\":{\"pattern\":\"GEIA-TB\"}},{\"Str\":{\"pattern\":\"GEIASTD\"}},{\"Str\":{\"pattern\":\"AMSDTL\"}},{\"Str\":{\"pattern\":\"AMSPRF\"}},{\"Str\":{\"pattern\":\"AMSQQA\"}},{\"Str\":{\"pattern\":\"AMSQQC\"}},{\"Str\":{\"pattern\":\"AMSQQN\"}},{\"Str\":{\"pattern\":\"AMSQQP\"}},{\"Str\":{\"pattern\":\"AMSQQS\"}},{\"Str\":{\"pattern\":\"AMSQQW\"}},{\"Str\":{\"pattern\":\"AMSSTD\"}},{\"Str\":{\"pattern\":\"AMSWWT\"}},{\"Str\":{\"pattern\":\"EIA-IS\"}},{\"Str\":{\"pattern\":\"EIASTD\"}},{\"Str\":{\"pattern\":\"GEIAHB\"}},{\"Str\":{\"pattern\":\"GEIAOP\"}},{\"Str\":{\"pattern\":\"GEIATB\"}},{\"Str\":{\"pattern\":\"AMS-A\"}},{\"Str\":{\"pattern\":\"AMS-B\"}},{\"Str\":{\"pattern\":\"AMS-C\"}},{\"Str\":{\"pattern\":\"AMS-D\"}},{\"Str\":{\"pattern\":\"AMS-F\"}},{\"Str\":{\"pattern\":\"AMS-G\"}},{\"Str\":{\"pattern\":\"AMS-H\"}},{\"Str\":{\"pattern\":\"AMS-I\"}},{\"Str\":{\"pattern\":\"AMS-L\"}},{\"Str\":{\"pattern\":\"AMS-M\"}},{\"Str\":{\"pattern\":\"AMS-P\"}},{\"Str\":{\"pattern\":\"AMS-R\"}},{\"Str\":{\"pattern\":\"AMS-S\"}},{\"Str\":{\"pattern\":\"AMS-T\"}},{\"Str\":{\"pattern\":\"AMS-W\"}},{\"Str\":{\"pattern\":\"EIAIS\"}},{\"Str\":{\"pattern\":\"USCAR\"}},{\"Str\":{\"pattern\":\"AMSA\"}},{\"Str\":{\"pattern\":\"AMSB\"}},{\"Str\":{\"pattern\":\"AMSC\"}},{\"Str\":{\"pattern\":\"AMSD\"}},{\"Str\":{\"pattern\":\"AMSF\"}},{\"Str\":{\"pattern\":\"AMSG\"}},{\"Str\":{\"pattern\":\"AMSH\"}},{\"Str\":{\"pattern\":\"AMSI\"}},{\"Str\":{\"pattern\":\"AMSL\"}},{\"Str\":{\"pattern\":\"AMSM\"}},{\"Str\":{\"pattern\":\"AMSP\"}},{\"Str\":{\"pattern\":\"AMSR\"}},{\"Str\":{\"pattern\":\"AMSS\"}},{\"Str\":{\"pattern\":\"AMST\"}},{\"Str\":{\"pattern\":\"AMSW\"}},{\"Str\":{\"pattern\":\"GEIA\"}},{\"Str\":{\"pattern\":\"AIR\"}},{\"Str\":{\"pattern\":\"AMS\"}},{\"Str\":{\"pattern\":\"ARD\"}},{\"Str\":{\"pattern\":\"ARP\"}},{\"Str\":{\"pattern\":\"CMB\"}},{\"Str\":{\"pattern\":\"CRP\"}},{\"Str\":{\"pattern\":\"EIA\"}},{\"Str\":{\"pattern\":\"MAM\"}},{\"Str\":{\"pattern\":\"MAP\"}},{\"Str\":{\"pattern\":\"SSB\"}},{\"Str\":{\"pattern\":\"TSB\"}},{\"Str\":{\"pattern\":\"AS\"}},{\"Str\":{\"pattern\":\"JA\"}},{\"Str\":{\"pattern\":\"MA\"}},{\"Str\":{\"pattern\":\"MS\"}},{\"Str\":{\"pattern\":\"J\"}},{\"Alternative\":{\"atoms\":[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84]}},{\"Named\":{\"name\":\"type\",\"atom\":85}},{\"Entity\":{\"atom\":90}},{\"Entity\":{\"atom\":3}},{\"Str\":{\"pattern\":\"-\"}},{\"Alternative\":{\"atoms\":[88,89]}},{\"Named\":{\"name\":\"type_sep\",\"atom\":87}},{\"Repetition\":{\"atom\":91,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":97}},{\"Entity\":{\"atom\":95}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":94,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"number\",\"atom\":96}},{\"Entity\":{\"atom\":107}},{\"Str\":{\"pattern\":\"-\"}},{\"Str\":{\"pattern\":\"_\"}},{\"Alternative\":{\"atoms\":[99,100]}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":102,\"min\":1,\"max\":3,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"dash\",\"atom\":103}},{\"Entity\":{\"atom\":95}},{\"Lookahead\":{\"atom\":105,\"positive\":false}},{\"Sequence\":{\"atoms\":[101,104,106]}},{\"Repetition\":{\"atom\":98,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":113}},{\"Entity\":{\"atom\":111}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Repetition\":{\"atom\":110,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"tail\",\"atom\":112}},{\"Repetition\":{\"atom\":109,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":130}},{\"Str\":{\"pattern\":\"/\"}},{\"Entity\":{\"atom\":111}},{\"Repetition\":{\"atom\":117,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":119,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[118,120]}},{\"Entity\":{\"atom\":111}},{\"Repetition\":{\"atom\":122,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Alternative\":{\"atoms\":[121,123]}},{\"Named\":{\"name\":\"part\",\"atom\":124}},{\"Entity\":{\"atom\":111}},{\"Repetition\":{\"atom\":126,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"part_tail\",\"atom\":127}},{\"Repetition\":{\"atom\":128,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[116,125,129]}},{\"Repetition\":{\"atom\":115,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":137}},{\"Str\":{\"pattern\":\"_A\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":134,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"amendment\",\"atom\":135}},{\"Sequence\":{\"atoms\":[133,136]}},{\"Repetition\":{\"atom\":132,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":153}},{\"Str\":{\"pattern\":\":\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":141,\"min\":4,\"max\":4,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"year\",\"atom\":142}},{\"Sequence\":{\"atoms\":[140,143]}},{\"Str\":{\"pattern\":\"_\"}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":146,\"min\":4,\"max\":4,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"year\",\"atom\":147}},{\"Entity\":{\"atom\":95}},{\"Repetition\":{\"atom\":149,\"min\":2,\"max\":2,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"month\",\"atom\":150}},{\"Sequence\":{\"atoms\":[145,148,151]}},{\"Alternative\":{\"atoms\":[144,152]}},{\"Repetition\":{\"atom\":139,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[1,2,4,92,93,108,114,131,138,154]}}],\"root\":155},\"bindings\":[{\"capture\":\"publisher\",\"path\":\"publisher\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"dash\",\"path\":\"dash\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"tail\",\"path\":\"tail\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part\",\"path\":\"part\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part_tail\",\"path\":\"part_tail\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"amendment\",\"path\":\"amendment\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"year\",\"path\":\"year\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"month\",\"path\":\"month\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE J1939\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE J 3016\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE AMS2430\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE ARP4754A:2010\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE AMS-QQ-A-250/4B\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"SAE AMSQQA250/4B\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"SAE J3016_2021\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"SAE XYZ1\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE J3016_202104\",\"expect\":{\"type\":\"J\",\"number\":\"3016\",\"year\":\"2021\",\"month\":\"04\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AMS4121J\",\"expect\":{\"type\":\"AMS\",\"number\":\"4121\",\"tail\":\"J\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AS22520/45A\",\"expect\":{\"type\":\"AS\",\"number\":\"22520\",\"part\":\"45\",\"part_tail\":\"A\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AMS5622/H1025\",\"expect\":{\"type\":\"AMS\",\"number\":\"5622\",\"part\":\"H1025\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE J2945/AS\",\"expect\":{\"type\":\"J\",\"number\":\"2945\",\"part\":\"AS\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE J1939-71:2020\",\"expect\":{\"type\":\"J\",\"number\":\"1939\",\"dash\":\"71\",\"year\":\"2020\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE EIA649_1A\",\"expect\":{\"type\":\"EIA\",\"number\":\"649\",\"dash\":\"1\",\"tail\":\"A\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AS5259/7A_A1\",\"expect\":{\"type\":\"AS\",\"number\":\"5259\",\"part\":\"7\",\"part_tail\":\"A\",\"amendment\":\"1\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE AMSSTD595\",\"expect\":{\"type\":\"AMSSTD\",\"number\":\"595\"}},{\"entry\":\"identifier\",\"kind\":\"example\",\"input\":\"SAE GEIA-STD-0001\",\"expect\":{\"type\":\"GEIA-STD\",\"number\":\"0001\"}}],\"docs\":{},\"source\":\"# SAE identifiers, in SAE's printed form and in the hyphen-free form of its\\n# Crossref DOI suffixes (10.4271/<code>):\\n#\\n# SAE <type>[ |-]<number>[-<dash>][<tail>][/<part>[<part_tail>]][_A<n>][:yyyy|_yyyymm]\\n#\\n# The grammar only segments. What a letter tail means (a revision, the\\n# metric M of a J report, a digital-annex DA) and which spelling of the type\\n# is printed is decided by pubid's lib/pubid/sae/builder.rb, which owns the\\n# type table (Pubid::Sae::Components::Type::TYPES). The doc_type\\n# alternatives are that table's keys plus their hyphen-free spellings,\\n# longest first: PEG commits to the first alternative that matches, so\\n# \\\"AMS\\\" must come after every \\\"AMS...\\\" family.\\n\\ngrammar PubidSae version \\\"0.2.0\\\" edition 2 {\\n doc_type = (\\\"AMS-QQ-A\\\" / \\\"AMS-QQ-C\\\" / \\\"AMS-QQ-N\\\" / \\\"AMS-QQ-P\\\" / \\\"AMS-QQ-S\\\" / \\\"AMS-QQ-W\\\" / \\\"AMS-WW-T\\\" / \\\"GEIA-STD\\\" / \\\"AMS-DTL\\\" / \\\"AMS-PRF\\\" / \\\"AMS-STD\\\" / \\\"EIA-STD\\\" / \\\"GEIA-HB\\\" / \\\"GEIA-OP\\\" / \\\"GEIA-TB\\\" / \\\"GEIASTD\\\" / \\\"AMSDTL\\\" / \\\"AMSPRF\\\" / \\\"AMSQQA\\\" / \\\"AMSQQC\\\" / \\\"AMSQQN\\\" / \\\"AMSQQP\\\" / \\\"AMSQQS\\\" / \\\"AMSQQW\\\" / \\\"AMSSTD\\\" / \\\"AMSWWT\\\" / \\\"EIA-IS\\\" / \\\"EIASTD\\\" / \\\"GEIAHB\\\" / \\\"GEIAOP\\\" / \\\"GEIATB\\\" / \\\"AMS-A\\\" / \\\"AMS-B\\\" / \\\"AMS-C\\\" / \\\"AMS-D\\\" / \\\"AMS-F\\\" / \\\"AMS-G\\\" / \\\"AMS-H\\\" / \\\"AMS-I\\\" / \\\"AMS-L\\\" / \\\"AMS-M\\\" / \\\"AMS-P\\\" / \\\"AMS-R\\\" / \\\"AMS-S\\\" / \\\"AMS-T\\\" / \\\"AMS-W\\\" / \\\"EIAIS\\\" / \\\"USCAR\\\" / \\\"AMSA\\\" / \\\"AMSB\\\" / \\\"AMSC\\\" / \\\"AMSD\\\" / \\\"AMSF\\\" / \\\"AMSG\\\" / \\\"AMSH\\\" / \\\"AMSI\\\" / \\\"AMSL\\\" / \\\"AMSM\\\" / \\\"AMSP\\\" / \\\"AMSR\\\" / \\\"AMSS\\\" / \\\"AMST\\\" / \\\"AMSW\\\" / \\\"GEIA\\\" / \\\"AIR\\\" / \\\"AMS\\\" / \\\"ARD\\\" / \\\"ARP\\\" / \\\"CMB\\\" / \\\"CRP\\\" / \\\"EIA\\\" / \\\"MAM\\\" / \\\"MAP\\\" / \\\"SSB\\\" / \\\"TSB\\\" / \\\"AS\\\" / \\\"JA\\\" / \\\"MA\\\" / \\\"MS\\\" / \\\"J\\\") as type\\n type_sep = space / \\\"-\\\"\\n number = (1*digit) as number\\n # A dash number: J1939-71, EIA649-2, and the DOI's EIA649_1. At most three\\n # digits and no digit after, so \\\"_202104\\\" stays a date.\\n dash = (\\\"-\\\" / \\\"_\\\") (1*3digit) as dash !digit\\n tail = (1*letter) as tail\\n part = \\\"/\\\" ((*letter 1*digit) / 1*letter) as part [(1*letter) as part_tail]\\n amendment = \\\"_A\\\" (1*digit) as amendment\\n date = (\\\":\\\" (4digit) as year) / (\\\"_\\\" (4digit) as year (2digit) as month)\\n identifier = \\\"SAE\\\" as publisher space doc_type [type_sep] number [dash] [tail] [part] [amendment] [date]\\n letter = %x41-5A\\n digit = %x30-39\\n space = \\\" \\\"\\n entry identifier: identifier\\n\\n bindings identifier {\\n publisher -> publisher (string)\\n type -> type (string)\\n number -> number (string)\\n dash -> dash (string)\\n tail -> tail (string)\\n part -> part (string)\\n part_tail -> part_tail (string)\\n amendment -> amendment (string)\\n year -> year (string)\\n month -> month (string)\\n }\\n\\n test {\\n accept \\\"SAE J1939\\\"\\n accept \\\"SAE J 3016\\\"\\n accept \\\"SAE AMS2430\\\"\\n accept \\\"SAE ARP4754A:2010\\\"\\n accept \\\"SAE AMS-QQ-A-250/4B\\\"\\n accept \\\"SAE AMSQQA250/4B\\\"\\n reject \\\"nonsense\\\"\\n reject \\\"SAE J3016_2021\\\"\\n reject \\\"SAE XYZ1\\\"\\n example \\\"SAE J3016_202104\\\" { type: \\\"J\\\", number: \\\"3016\\\", year: \\\"2021\\\", month: \\\"04\\\" }\\n example \\\"SAE AMS4121J\\\" { type: \\\"AMS\\\", number: \\\"4121\\\", tail: \\\"J\\\" }\\n example \\\"SAE AS22520/45A\\\" { type: \\\"AS\\\", number: \\\"22520\\\", part: \\\"45\\\", part_tail: \\\"A\\\" }\\n example \\\"SAE AMS5622/H1025\\\" { type: \\\"AMS\\\", number: \\\"5622\\\", part: \\\"H1025\\\" }\\n example \\\"SAE J2945/AS\\\" { type: \\\"J\\\", number: \\\"2945\\\", part: \\\"AS\\\" }\\n example \\\"SAE J1939-71:2020\\\" { type: \\\"J\\\", number: \\\"1939\\\", dash: \\\"71\\\", year: \\\"2020\\\" }\\n example \\\"SAE EIA649_1A\\\" { type: \\\"EIA\\\", number: \\\"649\\\", dash: \\\"1\\\", tail: \\\"A\\\" }\\n example \\\"SAE AS5259/7A_A1\\\" { type: \\\"AS\\\", number: \\\"5259\\\", part: \\\"7\\\", part_tail: \\\"A\\\", amendment: \\\"1\\\" }\\n example \\\"SAE AMSSTD595\\\" { type: \\\"AMSSTD\\\", number: \\\"595\\\" }\\n example \\\"SAE GEIA-STD-0001\\\" { type: \\\"GEIA-STD\\\", number: \\\"0001\\\" }\\n }\\n}\\n\",\"source_hash\":\"204b7183faedf1026e76016e92d3e9904d81930ed04d7a9d54849ac78f1ad6e7\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:58d95b3087380a9ddb6598898095eac06e5cf639bc63d699c0db8d51c88c15f0\",\"checksum\":\"sha256:c95d86491dfe2414e3f1883359984b4aeaec44656b98ed7fe7fbbe31b2e3dd8a\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":0,\"tests_total\":19,\"tests_failures\":0,\"self_test\":true}}";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidTgpp\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"3GPP \"}},{\"Repetition\":{\"atom\":0,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":6}},{\"Str\":{\"pattern\":\"TR\"}},{\"Str\":{\"pattern\":\"TS\"}},{\"Alternative\":{\"atoms\":[3,4]}},{\"Named\":{\"name\":\"type\",\"atom\":5}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":17}},{\"Entity\":{\"atom\":11}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":10,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":14,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[12,13,15]}},{\"Named\":{\"name\":\"number\",\"atom\":16}},{\"Entity\":{\"atom\":24}},{\"Entity\":{\"atom\":22}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Alternative\":{\"atoms\":[20,21]}},{\"Repetition\":{\"atom\":19,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"suffix\",\"atom\":23}},{\"Repetition\":{\"atom\":18,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":34}},{\"Entity\":{\"atom\":32}},{\"Str\":{\"pattern\":\"-\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":29,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"part\",\"atom\":30}},{\"Sequence\":{\"atoms\":[28,31]}},{\"Repetition\":{\"atom\":27,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"parts\",\"atom\":33}},{\"Entity\":{\"atom\":36}},{\"Str\":{\"pattern\":\":\"}},{\"Named\":{\"name\":\"colon\",\"atom\":35}},{\"Entity\":{\"atom\":61}},{\"Entity\":{\"atom\":48}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":40,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":43,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":46,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[41,42,44,45,47]}},{\"Entity\":{\"atom\":50}},{\"Re\":{\"pattern\":\"[\\\\x01-\\\\u{10ffff}]\"}},{\"Lookahead\":{\"atom\":49,\"positive\":false}},{\"Sequence\":{\"atoms\":[39,51]}},{\"Lookahead\":{\"atom\":52,\"positive\":false}},{\"Entity\":{\"atom\":58}},{\"Re\":{\"pattern\":\"[\\\\x01-\\\\x2e]\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Re\":{\"pattern\":\"[\\\\x3b-\\\\u{10ffff}]\"}},{\"Alternative\":{\"atoms\":[55,56,57]}},{\"Repetition\":{\"atom\":54,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"release\",\"atom\":59}},{\"Sequence\":{\"atoms\":[53,60]}},{\"Sequence\":{\"atoms\":[37,38]}},{\"Repetition\":{\"atom\":62,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":65}},{\"Str\":{\"pattern\":\"/\"}},{\"Named\":{\"name\":\"slash\",\"atom\":64}},{\"Entity\":{\"atom\":77}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":68,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":71,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":74,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[69,70,72,73,75]}},{\"Named\":{\"name\":\"version\",\"atom\":76}},{\"Sequence\":{\"atoms\":[66,67]}},{\"Repetition\":{\"atom\":78,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[1,2,7,9,25,26,63,79]}}],\"root\":80},\"bindings\":[{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"suffix\",\"path\":\"suffix\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part\",\"path\":\"parts[].part\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"release\",\"path\":\"release\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"version\",\"path\":\"version\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule release_char: branches 1 and 3 are order-dependent (first set not statically known)\",\"rule release_char: branches 2 and 3 are order-dependent (first set not statically known)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"3GPP TS 21.101\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"TS 25.999\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/tgpp/parser.rb:\\n# [3GPP ]<TR|TS> <NN.NNN>[suffix][-part\u2026][:<release>][/<version>]\\n# The release excludes \\\"/\\\" and \\\":\\\" (match[\\\"^/:\\\"]), byte-wise here; the\\n# mistyped-version guard (!version\u2026!any) is ported literally.\\n\\ngrammar PubidTgpp version \\\"0.1.0\\\" edition 2 {\\n release_char = %x01-2E / %x30-39 / %x3B-10FFFF\\n any_char = %x01-10FFFF\\n type = (\\\"TR\\\" / \\\"TS\\\") as type\\n number = (1*digit \\\".\\\" 1*digit) as number\\n suffix = (1*letter) as suffix\\n part = \\\"-\\\" (1*digit) as part\\n parts = (*part) as parts\\n version_core = 1*digit \\\".\\\" 1*digit \\\".\\\" 1*digit\\n release = !(version_core !any_char) (1*release_char) as release\\n version = (1*digit \\\".\\\" 1*digit \\\".\\\" 1*digit) as version\\n identifier = [\\\"3GPP \\\"] type space number [suffix] parts [(colon release)] [(slash version)]\\n letter = %x41-5A / %x61-7A\\n digit = %x30-39\\n space = \\\" \\\"\\n colon = \\\":\\\"\\n slash = \\\"/\\\"\\n entry identifier: identifier\\n\\n bindings identifier {\\n type -> type (string)\\n number -> number (string)\\n suffix -> suffix (string)\\n part -> parts[].part (string)\\n release -> release (string)\\n version -> version (string)\\n }\\n\\n\\n test {\\n accept \\\"3GPP TS 21.101\\\"\\n accept \\\"TS 25.999\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"8208f08be56685a980b7c3adeb2a58d64b962c148028fe676b3e00eede72f13a\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:0872eb8c229761d41f3a1a0d1fe97303d0bd20b308f8a2c9f87538914a77a056\",\"checksum\":\"sha256:e873d1984e52e0e97492c2234ce34ae6a384ed8cf20bd7141d9e3a53f3946c7f\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":2,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//! GENERATED FILE — do not edit. The checksummed PARG artifact for
|
|
2
|
+
//! the tgpp grammar, bundled as a module string so the worker
|
|
3
|
+
//! entries can construct the runtime without node:fs
|
|
4
|
+
//! (pubid/pubid-ts#232). Regenerate with `npm run artifact:emit`.
|
|
5
|
+
export default "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidTgpp\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"3GPP \"}},{\"Repetition\":{\"atom\":0,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":6}},{\"Str\":{\"pattern\":\"TR\"}},{\"Str\":{\"pattern\":\"TS\"}},{\"Alternative\":{\"atoms\":[3,4]}},{\"Named\":{\"name\":\"type\",\"atom\":5}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\" \"}},{\"Entity\":{\"atom\":17}},{\"Entity\":{\"atom\":11}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":10,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":14,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[12,13,15]}},{\"Named\":{\"name\":\"number\",\"atom\":16}},{\"Entity\":{\"atom\":24}},{\"Entity\":{\"atom\":22}},{\"Re\":{\"pattern\":\"[\\\\x41-\\\\x5a]\"}},{\"Re\":{\"pattern\":\"[\\\\x61-\\\\x7a]\"}},{\"Alternative\":{\"atoms\":[20,21]}},{\"Repetition\":{\"atom\":19,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"suffix\",\"atom\":23}},{\"Repetition\":{\"atom\":18,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":34}},{\"Entity\":{\"atom\":32}},{\"Str\":{\"pattern\":\"-\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":29,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"part\",\"atom\":30}},{\"Sequence\":{\"atoms\":[28,31]}},{\"Repetition\":{\"atom\":27,\"min\":0,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"parts\",\"atom\":33}},{\"Entity\":{\"atom\":36}},{\"Str\":{\"pattern\":\":\"}},{\"Named\":{\"name\":\"colon\",\"atom\":35}},{\"Entity\":{\"atom\":61}},{\"Entity\":{\"atom\":48}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":40,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":43,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":46,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[41,42,44,45,47]}},{\"Entity\":{\"atom\":50}},{\"Re\":{\"pattern\":\"[\\\\x01-\\\\u{10ffff}]\"}},{\"Lookahead\":{\"atom\":49,\"positive\":false}},{\"Sequence\":{\"atoms\":[39,51]}},{\"Lookahead\":{\"atom\":52,\"positive\":false}},{\"Entity\":{\"atom\":58}},{\"Re\":{\"pattern\":\"[\\\\x01-\\\\x2e]\"}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Re\":{\"pattern\":\"[\\\\x3b-\\\\u{10ffff}]\"}},{\"Alternative\":{\"atoms\":[55,56,57]}},{\"Repetition\":{\"atom\":54,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"release\",\"atom\":59}},{\"Sequence\":{\"atoms\":[53,60]}},{\"Sequence\":{\"atoms\":[37,38]}},{\"Repetition\":{\"atom\":62,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":65}},{\"Str\":{\"pattern\":\"/\"}},{\"Named\":{\"name\":\"slash\",\"atom\":64}},{\"Entity\":{\"atom\":77}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":68,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":71,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Str\":{\"pattern\":\".\"}},{\"Entity\":{\"atom\":11}},{\"Repetition\":{\"atom\":74,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Sequence\":{\"atoms\":[69,70,72,73,75]}},{\"Named\":{\"name\":\"version\",\"atom\":76}},{\"Sequence\":{\"atoms\":[66,67]}},{\"Repetition\":{\"atom\":78,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Sequence\":{\"atoms\":[1,2,7,9,25,26,63,79]}}],\"root\":80},\"bindings\":[{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"suffix\",\"path\":\"suffix\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"part\",\"path\":\"parts[].part\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"release\",\"path\":\"release\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"version\",\"path\":\"version\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule release_char: branches 1 and 3 are order-dependent (first set not statically known)\",\"rule release_char: branches 2 and 3 are order-dependent (first set not statically known)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"3GPP TS 21.101\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"TS 25.999\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/tgpp/parser.rb:\\n# [3GPP ]<TR|TS> <NN.NNN>[suffix][-part…][:<release>][/<version>]\\n# The release excludes \\\"/\\\" and \\\":\\\" (match[\\\"^/:\\\"]), byte-wise here; the\\n# mistyped-version guard (!version…!any) is ported literally.\\n\\ngrammar PubidTgpp version \\\"0.1.0\\\" edition 2 {\\n release_char = %x01-2E / %x30-39 / %x3B-10FFFF\\n any_char = %x01-10FFFF\\n type = (\\\"TR\\\" / \\\"TS\\\") as type\\n number = (1*digit \\\".\\\" 1*digit) as number\\n suffix = (1*letter) as suffix\\n part = \\\"-\\\" (1*digit) as part\\n parts = (*part) as parts\\n version_core = 1*digit \\\".\\\" 1*digit \\\".\\\" 1*digit\\n release = !(version_core !any_char) (1*release_char) as release\\n version = (1*digit \\\".\\\" 1*digit \\\".\\\" 1*digit) as version\\n identifier = [\\\"3GPP \\\"] type space number [suffix] parts [(colon release)] [(slash version)]\\n letter = %x41-5A / %x61-7A\\n digit = %x30-39\\n space = \\\" \\\"\\n colon = \\\":\\\"\\n slash = \\\"/\\\"\\n entry identifier: identifier\\n\\n bindings identifier {\\n type -> type (string)\\n number -> number (string)\\n suffix -> suffix (string)\\n part -> parts[].part (string)\\n release -> release (string)\\n version -> version (string)\\n }\\n\\n\\n test {\\n accept \\\"3GPP TS 21.101\\\"\\n accept \\\"TS 25.999\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"8208f08be56685a980b7c3adeb2a58d64b962c148028fe676b3e00eede72f13a\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:0872eb8c229761d41f3a1a0d1fe97303d0bd20b308f8a2c9f87538914a77a056\",\"checksum\":\"sha256:e873d1984e52e0e97492c2234ce34ae6a384ed8cf20bd7141d9e3a53f3946c7f\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":2,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidW3c\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"W3C \"}},{\"Entity\":{\"atom\":16}},{\"Entity\":{\"atom\":13}},{\"Str\":{\"pattern\":\"DNOTE\"}},{\"Str\":{\"pattern\":\"NOTE\"}},{\"Str\":{\"pattern\":\"WD\"}},{\"Str\":{\"pattern\":\"CRD\"}},{\"Str\":{\"pattern\":\"CR\"}},{\"Str\":{\"pattern\":\"REC\"}},{\"Str\":{\"pattern\":\"PER\"}},{\"Str\":{\"pattern\":\"PR\"}},{\"Str\":{\"pattern\":\"SPSD\"}},{\"Str\":{\"pattern\":\"OBSL\"}},{\"Alternative\":{\"atoms\":[3,4,5,6,7,8,9,10,11,12]}},{\"Named\":{\"name\":\"type\",\"atom\":2}},{\"Str\":{\"pattern\":\"-\"}},{\"Sequence\":{\"atoms\":[14,15]}},{\"Repetition\":{\"atom\":1,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":22}},{\"Entity\":{\"atom\":20}},{\"Re\":{\"pattern\":\"[\\\\x01-\\\\u{10ffff}]\"}},{\"Repetition\":{\"atom\":19,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"rest\",\"atom\":21}},{\"Sequence\":{\"atoms\":[0,17,18]}}],\"root\":23},\"bindings\":[{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"rest\",\"path\":\"rest\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule type_token: branches 4 and 5 are order-dependent (shared first bytes; ordered choice is decisive)\",\"rule type_token: branches 7 and 8 are order-dependent (shared first bytes; ordered choice is decisive)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"W3C REC-html40-19981224\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"W3C NOTE-datetime-19980827\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/w3c/parser.rb: split off the leading maturity token;\\n# code/date boundary is builder-side by design. Token order matters for\\n# shared prefixes (CRD before CR, PER before PR, DNOTE before NOTE).\\n\\ngrammar PubidW3c version \\\"0.1.0\\\" edition 2 {\\n any_char = %x01-10FFFF\\n type_token = \\\"DNOTE\\\" / \\\"NOTE\\\" / \\\"WD\\\" / \\\"CRD\\\" / \\\"CR\\\" / \\\"REC\\\" / \\\"PER\\\" / \\\"PR\\\" / \\\"SPSD\\\" / \\\"OBSL\\\"\\n type_part = type_token as type \\\"-\\\"\\n rest = (1*any_char) as rest\\n identifier = \\\"W3C \\\" [type_part] rest\\n entry identifier: identifier\\n\\n # Typed model bindings: every bound capture lands on the\\n # consumer model's field of the same name.\\n bindings identifier {\\n type -> type (string)\\n rest -> rest (string)\\n }\\n\\n\\n test {\\n accept \\\"W3C REC-html40-19981224\\\"\\n accept \\\"W3C NOTE-datetime-19980827\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"f1c99f42c7492c18f63f735ee29f07b25aa24442d6d899308a7af8350b83a2d9\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:e2003ff7b364326dadae2a922ee086cbdf4059549aa37c54d2d815a678c72532\",\"checksum\":\"sha256:585dfbb8c76117e749c091db764a0f63621f8530b70271107ec857eda64e3ee6\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":2,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//! GENERATED FILE — do not edit. The checksummed PARG artifact for
|
|
2
|
+
//! the w3c grammar, bundled as a module string so the worker
|
|
3
|
+
//! entries can construct the runtime without node:fs
|
|
4
|
+
//! (pubid/pubid-ts#232). Regenerate with `npm run artifact:emit`.
|
|
5
|
+
export default "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidW3c\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"W3C \"}},{\"Entity\":{\"atom\":16}},{\"Entity\":{\"atom\":13}},{\"Str\":{\"pattern\":\"DNOTE\"}},{\"Str\":{\"pattern\":\"NOTE\"}},{\"Str\":{\"pattern\":\"WD\"}},{\"Str\":{\"pattern\":\"CRD\"}},{\"Str\":{\"pattern\":\"CR\"}},{\"Str\":{\"pattern\":\"REC\"}},{\"Str\":{\"pattern\":\"PER\"}},{\"Str\":{\"pattern\":\"PR\"}},{\"Str\":{\"pattern\":\"SPSD\"}},{\"Str\":{\"pattern\":\"OBSL\"}},{\"Alternative\":{\"atoms\":[3,4,5,6,7,8,9,10,11,12]}},{\"Named\":{\"name\":\"type\",\"atom\":2}},{\"Str\":{\"pattern\":\"-\"}},{\"Sequence\":{\"atoms\":[14,15]}},{\"Repetition\":{\"atom\":1,\"min\":0,\"max\":1,\"tag\":\"Maybe\"}},{\"Entity\":{\"atom\":22}},{\"Entity\":{\"atom\":20}},{\"Re\":{\"pattern\":\"[\\\\x01-\\\\u{10ffff}]\"}},{\"Repetition\":{\"atom\":19,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Named\":{\"name\":\"rest\",\"atom\":21}},{\"Sequence\":{\"atoms\":[0,17,18]}}],\"root\":23},\"bindings\":[{\"capture\":\"type\",\"path\":\"type\",\"type\":\"string\",\"card\":null,\"preprocess\":null},{\"capture\":\"rest\",\"path\":\"rest\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[\"rule type_token: branches 4 and 5 are order-dependent (shared first bytes; ordered choice is decisive)\",\"rule type_token: branches 7 and 8 are order-dependent (shared first bytes; ordered choice is decisive)\"]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"W3C REC-html40-19981224\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"W3C NOTE-datetime-19980827\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/w3c/parser.rb: split off the leading maturity token;\\n# code/date boundary is builder-side by design. Token order matters for\\n# shared prefixes (CRD before CR, PER before PR, DNOTE before NOTE).\\n\\ngrammar PubidW3c version \\\"0.1.0\\\" edition 2 {\\n any_char = %x01-10FFFF\\n type_token = \\\"DNOTE\\\" / \\\"NOTE\\\" / \\\"WD\\\" / \\\"CRD\\\" / \\\"CR\\\" / \\\"REC\\\" / \\\"PER\\\" / \\\"PR\\\" / \\\"SPSD\\\" / \\\"OBSL\\\"\\n type_part = type_token as type \\\"-\\\"\\n rest = (1*any_char) as rest\\n identifier = \\\"W3C \\\" [type_part] rest\\n entry identifier: identifier\\n\\n # Typed model bindings: every bound capture lands on the\\n # consumer model's field of the same name.\\n bindings identifier {\\n type -> type (string)\\n rest -> rest (string)\\n }\\n\\n\\n test {\\n accept \\\"W3C REC-html40-19981224\\\"\\n accept \\\"W3C NOTE-datetime-19980827\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"f1c99f42c7492c18f63f735ee29f07b25aa24442d6d899308a7af8350b83a2d9\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:e2003ff7b364326dadae2a922ee086cbdf4059549aa37c54d2d815a678c72532\",\"checksum\":\"sha256:585dfbb8c76117e749c091db764a0f63621f8530b70271107ec857eda64e3ee6\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":2,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidXsf\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"XEP \"}},{\"Entity\":{\"atom\":10}},{\"Entity\":{\"atom\":3}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":2,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\"README\"}},{\"Str\":{\"pattern\":\"xxxx\"}},{\"Alternative\":{\"atoms\":[6,7]}},{\"Alternative\":{\"atoms\":[4,5]}},{\"Named\":{\"name\":\"number\",\"atom\":9}},{\"Sequence\":{\"atoms\":[0,1]}}],\"root\":11},\"bindings\":[{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"XEP 0001\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"XEP README\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/xsf/parser.rb: \\\"XEP NNNN\\\" plus the two named\\n# documents (README, xxxx) in SPECIAL_NUMBERS.\\n grammar PubidXsf version \\\"0.1.0\\\" edition 2 {\\n digit = %x30-39\\n special_number = \\\"README\\\" / \\\"xxxx\\\"\\n number = (1*digit / special_number) as number\\n identifier = \\\"XEP \\\" number\\n entry identifier: identifier\\n\\n # Typed model bindings: every bound capture lands on the\\n # consumer model's field of the same name.\\n bindings identifier {\\n number -> number (string)\\n }\\n\\n\\n test {\\n accept \\\"XEP 0001\\\"\\n accept \\\"XEP README\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"fdfa1a7c14e4430d5237cf1995240003797173c202dc8574d8c98c7f48f576d2\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:6259b92c7e2c8af77e96d2dce2d051ed41bf56fd46f332a636392b5b385291c7\",\"checksum\":\"sha256:f85bf1b74f8126db0ce2785fced982e967a25ed7f2def3fd47734e10efb8ccaf\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":0,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//! GENERATED FILE — do not edit. The checksummed PARG artifact for
|
|
2
|
+
//! the xsf grammar, bundled as a module string so the worker
|
|
3
|
+
//! entries can construct the runtime without node:fs
|
|
4
|
+
//! (pubid/pubid-ts#232). Regenerate with `npm run artifact:emit`.
|
|
5
|
+
export default "{\"bindings\":null,\"version\":\"0.1.0\",\"grammar\":\"PubidXsf\",\"shape\":\"parsanol-tree/v2\",\"binding_version\":1,\"entries\":{\"identifier\":{\"root\":\"identifier\",\"grammar\":{\"atoms\":[{\"Str\":{\"pattern\":\"XEP \"}},{\"Entity\":{\"atom\":10}},{\"Entity\":{\"atom\":3}},{\"Re\":{\"pattern\":\"[\\\\x30-\\\\x39]\"}},{\"Repetition\":{\"atom\":2,\"min\":1,\"max\":null,\"tag\":\"Repetition\"}},{\"Entity\":{\"atom\":8}},{\"Str\":{\"pattern\":\"README\"}},{\"Str\":{\"pattern\":\"xxxx\"}},{\"Alternative\":{\"atoms\":[6,7]}},{\"Alternative\":{\"atoms\":[4,5]}},{\"Named\":{\"name\":\"number\",\"atom\":9}},{\"Sequence\":{\"atoms\":[0,1]}}],\"root\":11},\"bindings\":[{\"capture\":\"number\",\"path\":\"number\",\"type\":\"string\",\"card\":null,\"preprocess\":null}]}},\"preprocess\":{},\"tables\":{},\"lint\":{\"order_warnings\":[]},\"default_entry\":\"identifier\",\"render\":{},\"derive\":{},\"tests\":[{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"XEP 0001\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"accept\",\"input\":\"XEP README\",\"expect\":{}},{\"entry\":\"identifier\",\"kind\":\"reject\",\"input\":\"nonsense\",\"expect\":{}}],\"docs\":{},\"source\":\"# Port of lib/pubid/xsf/parser.rb: \\\"XEP NNNN\\\" plus the two named\\n# documents (README, xxxx) in SPECIAL_NUMBERS.\\n grammar PubidXsf version \\\"0.1.0\\\" edition 2 {\\n digit = %x30-39\\n special_number = \\\"README\\\" / \\\"xxxx\\\"\\n number = (1*digit / special_number) as number\\n identifier = \\\"XEP \\\" number\\n entry identifier: identifier\\n\\n # Typed model bindings: every bound capture lands on the\\n # consumer model's field of the same name.\\n bindings identifier {\\n number -> number (string)\\n }\\n\\n\\n test {\\n accept \\\"XEP 0001\\\"\\n accept \\\"XEP README\\\"\\n reject \\\"nonsense\\\"\\n }\\n}\\n\",\"source_hash\":\"fdfa1a7c14e4430d5237cf1995240003797173c202dc8574d8c98c7f48f576d2\",\"unicode_tables\":\"onigmo (Ruby 3.4.8)\",\"compiler_version\":\"1.5.1.0\",\"edition\":2,\"semantics_hash\":\"sha256:6259b92c7e2c8af77e96d2dce2d051ed41bf56fd46f332a636392b5b385291c7\",\"checksum\":\"sha256:f85bf1b74f8126db0ce2785fced982e967a25ed7f2def3fd47734e10efb8ccaf\",\"validated\":{\"lint_errors\":0,\"lint_warnings\":0,\"tests_total\":3,\"tests_failures\":0,\"self_test\":true}}";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { initialize, PargRuntime } from "parsanol/browser";
|
|
2
|
+
export type WorkerWasmInput = Parameters<typeof initialize>[0];
|
|
3
|
+
/** Initialize the browser engine once per isolate (the lazy ~2.7 MB wasm).
|
|
4
|
+
* A failed init is not kept, so a later call can retry with other wasm. */
|
|
5
|
+
export declare function initWorkerEngine(wasm?: WorkerWasmInput): Promise<void>;
|
|
6
|
+
/** The runtime over one bundled artifact on the browser engine. */
|
|
7
|
+
export declare function workerArtifactRuntime(artifact: string, wasm?: WorkerWasmInput, entry?: string): Promise<PargRuntime>;
|
|
8
|
+
/** Parse and bind through the given runtime, with the generated
|
|
9
|
+
* substrate's reject contract. The worker entries call this instead of
|
|
10
|
+
* the substrate's `parseBound`, whose runtime is cached on first use:
|
|
11
|
+
* a runtime registered before this entry would otherwise answer for it. */
|
|
12
|
+
export declare function parseBoundWith(runtime: PargRuntime, flavor: string, input: string): Record<string, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//! The artifact-free half of the worker-side PARG engine: parsanol's
|
|
2
|
+
//! browser build, initialized once per isolate, and the runtime over
|
|
3
|
+
//! one bundled artifact string. It imports no artifact, so each worker
|
|
4
|
+
//! entry bundles only its own (relaton-api-js#188). The wasm loads
|
|
5
|
+
//! lazily on the first runtime request.
|
|
6
|
+
import { initialize, PargRuntime } from "parsanol/browser";
|
|
7
|
+
let enginePromise;
|
|
8
|
+
/** Initialize the browser engine once per isolate (the lazy ~2.7 MB wasm).
|
|
9
|
+
* A failed init is not kept, so a later call can retry with other wasm. */
|
|
10
|
+
export function initWorkerEngine(wasm) {
|
|
11
|
+
enginePromise ??= initialize(wasm).catch((error) => {
|
|
12
|
+
enginePromise = undefined;
|
|
13
|
+
throw error;
|
|
14
|
+
});
|
|
15
|
+
return enginePromise;
|
|
16
|
+
}
|
|
17
|
+
/** The runtime over one bundled artifact on the browser engine. */
|
|
18
|
+
export async function workerArtifactRuntime(artifact, wasm, entry) {
|
|
19
|
+
await initWorkerEngine(wasm);
|
|
20
|
+
return new PargRuntime(artifact, entry);
|
|
21
|
+
}
|
|
22
|
+
/** Parse and bind through the given runtime, with the generated
|
|
23
|
+
* substrate's reject contract. The worker entries call this instead of
|
|
24
|
+
* the substrate's `parseBound`, whose runtime is cached on first use:
|
|
25
|
+
* a runtime registered before this entry would otherwise answer for it. */
|
|
26
|
+
export function parseBoundWith(runtime, flavor, input) {
|
|
27
|
+
const bound = runtime.parseAndBind(input);
|
|
28
|
+
if (bound === null || bound === undefined) {
|
|
29
|
+
throw new Error(`${flavor}: cannot parse ${JSON.stringify(input)}`);
|
|
30
|
+
}
|
|
31
|
+
return bound;
|
|
32
|
+
}
|
package/dist/parg/worker.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { PargRuntime } from "parsanol/browser";
|
|
2
|
+
import { type WorkerWasmInput } from "./worker-engine.js";
|
|
3
|
+
export { initWorkerEngine, type WorkerWasmInput } from "./worker-engine.js";
|
|
3
4
|
declare const bundledArtifacts: Record<string, string>;
|
|
4
5
|
export type WorkerPargGrammar = keyof typeof bundledArtifacts;
|
|
5
|
-
/** Initialize the browser engine once per isolate (the lazy ~2.4 MB wasm). */
|
|
6
|
-
export declare function initWorkerEngine(wasm?: WorkerWasmInput): Promise<void>;
|
|
7
6
|
/** The artifact-backed runtime for one grammar over the browser engine;
|
|
8
7
|
* a named entry (the artifact's non-default roots) loads through the
|
|
9
8
|
* same bundled payload. */
|
|
10
9
|
export declare function workerPargRuntime(grammar: WorkerPargGrammar, wasm?: WorkerWasmInput, entry?: string): Promise<PargRuntime>;
|
|
11
|
-
export {};
|
package/dist/parg/worker.js
CHANGED
|
@@ -8,27 +8,21 @@
|
|
|
8
8
|
//! bundler contract (the glue resolves `parsanol_bg.wasm` beside
|
|
9
9
|
//! itself); Workers bundles pass a CompiledWasm module or a URL
|
|
10
10
|
//! instead via the `wasm` argument.
|
|
11
|
-
import { initialize, PargRuntime } from "parsanol/browser";
|
|
12
11
|
import nistArtifact from "./artifacts/nist.js";
|
|
13
12
|
import ieeeArtifact from "./artifacts/ieee.js";
|
|
13
|
+
import { workerArtifactRuntime } from "./worker-engine.js";
|
|
14
|
+
export { initWorkerEngine } from "./worker-engine.js";
|
|
14
15
|
const bundledArtifacts = {
|
|
15
16
|
nist: nistArtifact,
|
|
16
17
|
ieee: ieeeArtifact,
|
|
17
18
|
};
|
|
18
|
-
let enginePromise;
|
|
19
|
-
/** Initialize the browser engine once per isolate (the lazy ~2.4 MB wasm). */
|
|
20
|
-
export function initWorkerEngine(wasm) {
|
|
21
|
-
enginePromise ??= initialize(wasm);
|
|
22
|
-
return enginePromise;
|
|
23
|
-
}
|
|
24
19
|
/** The artifact-backed runtime for one grammar over the browser engine;
|
|
25
20
|
* a named entry (the artifact's non-default roots) loads through the
|
|
26
21
|
* same bundled payload. */
|
|
27
22
|
export async function workerPargRuntime(grammar, wasm, entry) {
|
|
28
|
-
await initWorkerEngine(wasm);
|
|
29
23
|
const artifact = bundledArtifacts[grammar];
|
|
30
24
|
if (artifact === undefined) {
|
|
31
25
|
throw new Error(`no bundled PARG artifact for "${grammar}" (worker graph, pubid-ts#232)`);
|
|
32
26
|
}
|
|
33
|
-
return
|
|
27
|
+
return workerArtifactRuntime(artifact, wasm, entry);
|
|
34
28
|
}
|
package/dist/parse-surface.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { type LaneKeys } from "./lane-keys.js";
|
|
2
|
+
export { norm, undatedNorm, allPartsNorm, structuralPart, laneKeysFrom, laneKeysOf, } from "./lane-keys.js";
|
|
3
|
+
export type { LaneKeys, LaneKeySource } from "./lane-keys.js";
|
|
1
4
|
/** The failure class of the parse surface: every rejected input and
|
|
2
5
|
* unknown flavor raises this (wrapped engine errors ride as `cause`). */
|
|
3
6
|
export declare class ParseError extends Error {
|
|
@@ -11,18 +14,6 @@ export declare class ParseError extends Error {
|
|
|
11
14
|
cause?: unknown;
|
|
12
15
|
});
|
|
13
16
|
}
|
|
14
|
-
/** The lane keys of one identifier: the lookup lanes the corpus and the
|
|
15
|
-
* consumers index by. */
|
|
16
|
-
export interface LaneKeys {
|
|
17
|
-
/** The dated lane: the normalized canonical (uppercased, de-spaced). */
|
|
18
|
-
dated: string;
|
|
19
|
-
/** The undated lane: every colon-year not followed by a dash is gone
|
|
20
|
-
* (base and supplement alike — one rule, no per-flavor casing). */
|
|
21
|
-
undated: string;
|
|
22
|
-
/** The all-parts lane: the parsed part stripped from the undated lane.
|
|
23
|
-
* Structural only — an unparsed trailing "-N" is never a part. */
|
|
24
|
-
all_parts: string;
|
|
25
|
-
}
|
|
26
17
|
/** One successful parse: the structured components, the canonical render
|
|
27
18
|
* and the lane keys, per the export contract of pubid-ts#226. */
|
|
28
19
|
export interface ParseResult {
|
|
@@ -45,25 +36,6 @@ export interface ParseResult {
|
|
|
45
36
|
/** The dated / undated / all_parts lane keys. */
|
|
46
37
|
keys: LaneKeys;
|
|
47
38
|
}
|
|
48
|
-
/**
|
|
49
|
-
* The dated lane: the canonical render uppercased and de-spaced. Ruby's
|
|
50
|
-
* `canonical.upcase.delete(" ")` — exactly the space character is
|
|
51
|
-
* deleted, not every whitespace run.
|
|
52
|
-
*/
|
|
53
|
-
export declare function norm(canonical: string): string;
|
|
54
|
-
/**
|
|
55
|
-
* The undated lane from a norm key: every `:?`-year not followed by a
|
|
56
|
-
* dash is stripped — globally, base and supplement years alike. Ruby's
|
|
57
|
-
* `gsub(/:?(?:19|20)\d{2}(?=[^-]*$)/, "")` verbatim.
|
|
58
|
-
*/
|
|
59
|
-
export declare function undatedNorm(normKey: string): string;
|
|
60
|
-
/**
|
|
61
|
-
* The all-parts lane from an undated key: the FIRST `-<part>` not
|
|
62
|
-
* followed by a dash is stripped. Ruby's
|
|
63
|
-
* `sub(/-#{Regexp.escape(part)}(?=[^-]*$)/, "")` — only a structurally
|
|
64
|
-
* parsed part is ever stripped; a blank part strips nothing.
|
|
65
|
-
*/
|
|
66
|
-
export declare function allPartsNorm(undated: string, part?: string): string;
|
|
67
39
|
/**
|
|
68
40
|
* Parse one identifier: the structured components per parse, the
|
|
69
41
|
* canonical render, the URN and the lane keys in one result. Rejections
|
package/dist/parse-surface.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { grammarImplementation } from "./flavors/index.js";
|
|
2
2
|
import { corpusModeImplementation } from "./implementations/corpus-mode.js";
|
|
3
3
|
import { loadBundledCorpus } from "./corpus/artifact.js";
|
|
4
|
+
import { laneKeysFrom, structuralPart } from "./lane-keys.js";
|
|
5
|
+
export { norm, undatedNorm, allPartsNorm, structuralPart, laneKeysFrom, laneKeysOf, } from "./lane-keys.js";
|
|
4
6
|
/** The failure class of the parse surface: every rejected input and
|
|
5
7
|
* unknown flavor raises this (wrapped engine errors ride as `cause`). */
|
|
6
8
|
export class ParseError extends Error {
|
|
@@ -40,73 +42,6 @@ function implementationFor(flavor) {
|
|
|
40
42
|
return corpus;
|
|
41
43
|
throw new ParseError(`unknown flavor: ${flavor}`, { input: "", flavor });
|
|
42
44
|
}
|
|
43
|
-
/** Ruby Regexp.escape, for the all-parts strip of an arbitrary part. */
|
|
44
|
-
function escapeRegExp(text) {
|
|
45
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* The dated lane: the canonical render uppercased and de-spaced. Ruby's
|
|
49
|
-
* `canonical.upcase.delete(" ")` — exactly the space character is
|
|
50
|
-
* deleted, not every whitespace run.
|
|
51
|
-
*/
|
|
52
|
-
export function norm(canonical) {
|
|
53
|
-
return canonical.toUpperCase().replaceAll(" ", "");
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* The undated lane from a norm key: every `:?`-year not followed by a
|
|
57
|
-
* dash is stripped — globally, base and supplement years alike. Ruby's
|
|
58
|
-
* `gsub(/:?(?:19|20)\d{2}(?=[^-]*$)/, "")` verbatim.
|
|
59
|
-
*/
|
|
60
|
-
export function undatedNorm(normKey) {
|
|
61
|
-
return normKey.replace(/:?(?:19|20)\d{2}(?=[^-]*$)/g, "");
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* The all-parts lane from an undated key: the FIRST `-<part>` not
|
|
65
|
-
* followed by a dash is stripped. Ruby's
|
|
66
|
-
* `sub(/-#{Regexp.escape(part)}(?=[^-]*$)/, "")` — only a structurally
|
|
67
|
-
* parsed part is ever stripped; a blank part strips nothing.
|
|
68
|
-
*/
|
|
69
|
-
export function allPartsNorm(undated, part) {
|
|
70
|
-
if (part === undefined || part === "")
|
|
71
|
-
return undated;
|
|
72
|
-
return undated.replace(new RegExp(`-${escapeRegExp(part)}(?=[^-]*$)`), "");
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* The structural part of a canonical component record: the identifier's
|
|
76
|
-
* own `part` facet, else the base's (Ruby's `id.part || id.base&.part`).
|
|
77
|
-
* A part facet is either a string or a typed record carrying `value`
|
|
78
|
-
* (the NIST lettered parts); anything else is no part.
|
|
79
|
-
*/
|
|
80
|
-
function structuralPart(components) {
|
|
81
|
-
const base = components["base"];
|
|
82
|
-
const raw = components["part"] !== undefined && components["part"] !== null
|
|
83
|
-
? components["part"]
|
|
84
|
-
: base !== undefined && base !== null && typeof base === "object"
|
|
85
|
-
? base["part"]
|
|
86
|
-
: undefined;
|
|
87
|
-
if (typeof raw === "string")
|
|
88
|
-
return raw;
|
|
89
|
-
if (raw !== undefined && raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
|
|
90
|
-
const value = raw["value"];
|
|
91
|
-
if (typeof value === "string")
|
|
92
|
-
return value;
|
|
93
|
-
if (typeof value === "number")
|
|
94
|
-
return String(value);
|
|
95
|
-
}
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
/** The lane keys for an already-canonical record: norm from the render,
|
|
99
|
-
* undated from the norm, all_parts from the parsed part — the corpus
|
|
100
|
-
* lane derivations, nothing guessed. */
|
|
101
|
-
function laneKeysFrom(canonical, components) {
|
|
102
|
-
const dated = norm(canonical);
|
|
103
|
-
const undated = undatedNorm(dated);
|
|
104
|
-
return {
|
|
105
|
-
dated,
|
|
106
|
-
undated,
|
|
107
|
-
all_parts: allPartsNorm(undated, structuralPart(components)),
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
45
|
/** The year facet of a component record, string-normalized. */
|
|
111
46
|
function structuralYear(components) {
|
|
112
47
|
const year = components["year"];
|