pubid 2.0.42 → 2.0.44
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.
- checksums.yaml +4 -4
- data/data/parg/arxiv.json +1 -0
- data/data/parg/bsi_pfs.json +1 -1
- data/data/parg/eu.json +1 -0
- data/lib/pubid/arxiv/CLAUDE.md +58 -0
- data/lib/pubid/arxiv/builder.rb +100 -0
- data/lib/pubid/arxiv/identifier.rb +111 -0
- data/lib/pubid/arxiv/identifiers/eprint.rb +20 -0
- data/lib/pubid/arxiv/identifiers.rb +9 -0
- data/lib/pubid/arxiv/parser.rb +18 -0
- data/lib/pubid/arxiv/pubid_urn_schema.rb +26 -0
- data/lib/pubid/arxiv/renderer.rb +30 -0
- data/lib/pubid/arxiv.rb +55 -0
- data/lib/pubid/bsi_pfs/adopted_base.rb +67 -14
- data/lib/pubid/bsi_pfs/builder.rb +37 -2
- data/lib/pubid/bsi_pfs/identifier.rb +9 -10
- data/lib/pubid/bsi_pfs/identifiers/adopted_european_norm.rb +21 -11
- data/lib/pubid/bsi_pfs/identifiers/adopted_international_standard.rb +21 -11
- data/lib/pubid/bsi_pfs/identifiers/consolidated_identifier.rb +25 -9
- data/lib/pubid/bsi_pfs/identifiers/draft_document.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/publicly_available_specification.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/published_document.rb +6 -6
- data/lib/pubid/bsi_pfs/identifiers/technical_specification.rb +6 -6
- data/lib/pubid/bsi_pfs/pubid_urn_schema.rb +17 -4
- data/lib/pubid/bsi_pfs/renderer.rb +18 -2
- data/lib/pubid/bsi_pfs/urn_generator.rb +31 -6
- data/lib/pubid/eu/CLAUDE.md +92 -0
- data/lib/pubid/eu/builder.rb +129 -0
- data/lib/pubid/eu/identifier.rb +117 -0
- data/lib/pubid/eu/identifiers/decision.rb +14 -0
- data/lib/pubid/eu/identifiers/directive.rb +14 -0
- data/lib/pubid/eu/identifiers/regulation.rb +14 -0
- data/lib/pubid/eu/identifiers.rb +11 -0
- data/lib/pubid/eu/parser.rb +10 -0
- data/lib/pubid/eu/pubid_urn_schema.rb +23 -0
- data/lib/pubid/eu/renderer.rb +38 -0
- data/lib/pubid/eu.rb +52 -0
- data/lib/pubid/version.rb +1 -1
- data/lib/pubid.rb +2 -0
- metadata +23 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d99cf14909f9fd7fb38dbb49af29ba7af4cc8709185b37d7ce6d93d6c7d5489
|
|
4
|
+
data.tar.gz: a07eb61ebe481ddabc1a757db4959f1e681c76ed8c58a41a2267f90b61cae11d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47f10de035fea281a9afc3644bc4163ddc28bf7b1bf1a1b5aed2d46e97bc544ad2ab0a560d513609b5228376b684517692e74f8257b24b0e581d0a520b8ad74f
|
|
7
|
+
data.tar.gz: 7615b627d44622f5e5bd247dac8fa7d46741ee537a7f5128c70bd4bbeb0bab7bf9a2954cb8abec971094e1386c1eb09f9fc768036676ed63c69a63d7b4be3b3d
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"PubidArxiv","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":8}},{"Re":{"pattern":"(?i:arXiv)"}},{"Entity":{"atom":3}},{"Str":{"pattern":":"}},{"Named":{"name":"colon","atom":2}},{"Entity":{"atom":6}},{"Str":{"pattern":" "}},{"Alternative":{"atoms":[4,5]}},{"Sequence":{"atoms":[1,7]}},{"Repetition":{"atom":0,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":21}},{"Entity":{"atom":15}},{"Entity":{"atom":13}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":12,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"yymm","atom":14}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Entity":{"atom":13}},{"Repetition":{"atom":18,"min":4,"max":5,"tag":"Repetition"}},{"Named":{"name":"number","atom":19}},{"Sequence":{"atoms":[11,16,17]}},{"Entity":{"atom":52}},{"Entity":{"atom":31}},{"Entity":{"atom":25}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Entity":{"atom":25}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[26,27]}},{"Repetition":{"atom":28,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[24,29]}},{"Named":{"name":"archive","atom":30}},{"Str":{"pattern":"."}},{"Entity":{"atom":43}},{"Entity":{"atom":37}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[35,36]}},{"Entity":{"atom":37}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[38,39]}},{"Repetition":{"atom":40,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[34,41]}},{"Named":{"name":"subject_class","atom":42}},{"Sequence":{"atoms":[32,33]}},{"Repetition":{"atom":44,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"/"}},{"Entity":{"atom":15}},{"Entity":{"atom":51}},{"Entity":{"atom":13}},{"Repetition":{"atom":49,"min":3,"max":3,"tag":"Repetition"}},{"Named":{"name":"number","atom":50}},{"Sequence":{"atoms":[23,45,46,47,48]}},{"Alternative":{"atoms":[10,22]}},{"Entity":{"atom":59}},{"Str":{"pattern":"v"}},{"Entity":{"atom":13}},{"Repetition":{"atom":56,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"version","atom":57}},{"Sequence":{"atoms":[55,58]}},{"Repetition":{"atom":54,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[9,53,60]}}],"root":61},"bindings":[{"capture":"archive","path":"archive","type":"string","card":null,"preprocess":null},{"capture":"subject_class","path":"subject_class","type":"string","card":null,"preprocess":null},{"capture":"yymm","path":"yymm","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"version","path":"version","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":[]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"arXiv:2301.00001v1","expect":{}},{"entry":"identifier","kind":"accept","input":"arxiv:0704.0001","expect":{}},{"entry":"identifier","kind":"accept","input":"arXiv hep-th/9901001v2","expect":{}},{"entry":"identifier","kind":"accept","input":"math.GT/0309136","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"2301.001","expect":{}},{"entry":"identifier","kind":"reject","input":"hep-th/99010","expect":{}},{"entry":"identifier","kind":"example","input":"arXiv:2301.00001v1","expect":{"yymm":"2301","number":"00001","version":"1"}},{"entry":"identifier","kind":"example","input":"0704.0001","expect":{"yymm":"0704","number":"0001"}},{"entry":"identifier","kind":"example","input":"hep-th/9901001","expect":{"archive":"hep-th","yymm":"9901","number":"001"}},{"entry":"identifier","kind":"example","input":"math.GT/0309136v2","expect":{"archive":"math","subject_class":"GT","yymm":"0309","number":"136","version":"2"}}],"docs":{},"source":"# arXiv e-print identifiers, per\n# https://info.arxiv.org/help/arxiv_identifier_for_services.html:\n# new form YYMM.NNNN[vN] (0704-1412) and YYMM.NNNNN[vN] (1501 onward)\n# old form archive[.SC]/YYMMNNN[vN] (9108-0703)\n# with an optional, case-insensitive \"arXiv:\" or \"arXiv \" prefix.\n# The date ranges, the month and v0 are checked by the Ruby builder.\n\ngrammar PubidArxiv version \"0.1.0\" edition 2 {\n digit = %x30-39\n lower = %x61-7A\n letter = %x41-5A / %x61-7A\n arxiv_prefix = %i\"arXiv\" (colon / space)\n yymm = (4digit) as yymm\n new_number = (4*5digit) as number\n new_id = yymm \".\" new_number\n archive = (lower *(lower / \"-\")) as archive\n subject_class = (letter *(letter / \"-\")) as subject_class\n old_number = (3digit) as number\n old_id = archive [\".\" subject_class] \"/\" yymm old_number\n version = \"v\" (1*digit) as version\n identifier = [arxiv_prefix] (new_id / old_id) [version]\n space = \" \"\n colon = \":\"\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 archive -> archive (string)\n subject_class -> subject_class (string)\n yymm -> yymm (string)\n number -> number (string)\n version -> version (string)\n }\n\n\n test {\n accept \"arXiv:2301.00001v1\"\n accept \"arxiv:0704.0001\"\n accept \"arXiv hep-th/9901001v2\"\n accept \"math.GT/0309136\"\n reject \"nonsense\"\n reject \"2301.001\"\n reject \"hep-th/99010\"\n example \"arXiv:2301.00001v1\" { yymm: \"2301\" number: \"00001\" version: \"1\" }\n example \"0704.0001\" { yymm: \"0704\" number: \"0001\" }\n example \"hep-th/9901001\" { archive: \"hep-th\" yymm: \"9901\" number: \"001\" }\n example \"math.GT/0309136v2\" { archive: \"math\" subject_class: \"GT\" yymm: \"0309\" number: \"136\" version: \"2\" }\n }\n}\n","source_hash":"c4b4676d738856a7717100c2a3a0545fa1e5a6b83fbf8b09b08dcbe1c33c4a5e","unicode_tables":"onigmo (Ruby 3.4.10)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:a7a76fd8f3dbc2635edef63cbb9451aba802e36dea8c4b616ddfdeed626834d1","checksum":"sha256:ccd0bf40ffcb0469e051ed63f14ce1786c88938ee56f12a3edd4ac45ea894512","validated":{"lint_errors":0,"lint_warnings":0,"tests_total":11,"tests_failures":0,"self_test":true},"byte_checksum":"sha256:b308269a659a039642ab933276733ecb6f71de1c3873b35ac3959dac4681c4ea"}
|
data/data/parg/bsi_pfs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.1.0","grammar":"PubidBsiPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":7}},{"Str":{"pattern":"BS"}},{"Str":{"pattern":"PAS"}},{"Str":{"pattern":"PD"}},{"Str":{"pattern":"DD"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[1,2,3,4,5]}},{"Named":{"name":"publisher","atom":6}},{"Str":{"pattern":" "}},{"Entity":{"atom":66}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"CEN"}},{"Str":{"pattern":"CLC"}},{"Str":{"pattern":"HD"}},{"Str":{"pattern":"ENV"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"CR"}},{"Str":{"pattern":"CWA"}},{"Str":{"pattern":"ISO"}},{"Str":{"pattern":"IEC"}},{"Alternative":{"atoms":[10,11,12,13,14,15,16,17,18,19]}},{"Entity":{"atom":58}},{"Entity":{"atom":42}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":23}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":25}},{"Alternative":{"atoms":[24,26]}},{"Str":{"pattern":"A"}},{"Named":{"name":"supplement_kind","atom":28}},{"Entity":{"atom":34}},{"Entity":{"atom":32}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":31,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":33}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Entity":{"atom":32}},{"Repetition":{"atom":37,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"supplements_year","atom":38}},{"Sequence":{"atoms":[35,36]}},{"Repetition":{"atom":40,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[27,29,30,41]}},{"Entity":{"atom":56}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":44}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":46}},{"Alternative":{"atoms":[45,47]}},{"Str":{"pattern":"C"}},{"Named":{"name":"supplement_kind","atom":49}},{"Entity":{"atom":34}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Sequence":{"atoms":[52,53]}},{"Repetition":{"atom":54,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[48,50,51,55]}},{"Alternative":{"atoms":[22,43]}},{"Named":{"name":"supplement","atom":57}},{"Lookahead":{"atom":21,"positive":false}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[60,61]}},{"Sequence":{"atoms":[59,62]}},{"Repetition":{"atom":63,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[20,64]}},{"Named":{"name":"adopted","atom":65}},{"Sequence":{"atoms":[0,8,9]}},{"Entity":{"atom":7}},{"Str":{"pattern":" "}},{"Entity":{"atom":76}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":71,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":73,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[72,74]}},{"Named":{"name":"number","atom":75}},{"Str":{"pattern":"-"}},{"Entity":{"atom":96}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[81,82]}},{"Alternative":{"atoms":[79,80]}},{"Repetition":{"atom":84,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[86,87]}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Alternative":{"atoms":[89,90]}},{"Repetition":{"atom":91,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[88,92]}},{"Repetition":{"atom":93,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[85,94]}},{"Named":{"name":"part","atom":95}},{"Sequence":{"atoms":[77,78]}},{"Repetition":{"atom":97,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":103}},{"Entity":{"atom":32}},{"Repetition":{"atom":101,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":102}},{"Sequence":{"atoms":[99,100]}},{"Repetition":{"atom":104,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[68,69,70,98,105]}},{"Alternative":{"atoms":[67,106]}},{"Entity":{"atom":111}},{"Entity":{"atom":58}},{"Repetition":{"atom":109,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":110}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[107,112]}}],"root":113},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"adopted","path":"adopted","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":[]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"BS 10005:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1016-107.2:1991","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1344-A1:1960","expect":{}},{"entry":"identifier","kind":"accept","input":"PD 5730","expect":{}},{"entry":"identifier","kind":"accept","input":"PAS 003:1994","expect":{}},{"entry":"identifier","kind":"accept","input":"DD 136-2:1986","expect":{}},{"entry":"identifier","kind":"accept","input":"TS 1:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1073-2:2002","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN ISO 105-B06:2020","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61851-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS ISO 8601:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS IEC 60747-8:2000","expect":{}},{"entry":"identifier","kind":"accept","input":"BS HD 60269-3","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CEN ISO/TS 12180-1:2007","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CLC/TS 50131-2-2:2004","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 60601-1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 10125:2014+A1:2016","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1005-1:2001+A1:2008","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 646:1958+A2:2013","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"BS","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 1325","expect":{}},{"entry":"identifier","kind":"reject","input":"ISO 9001:2015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2X 26:2001","expect":{}},{"entry":"identifier","kind":"reject","input":"DISC PD 0005:1995","expect":{}},{"entry":"identifier","kind":"reject","input":"BS A 103:2025","expect":{}},{"entry":"identifier","kind":"reject","input":"BSI Flex 1886 v2.0:2024-09","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7671 AMD2","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1000[9]:1971","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1580:Parts 1 and 2:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS CISPR 12:1997","expect":{}},{"entry":"identifier","kind":"reject","input":"14/30300822 DC","expect":{}},{"entry":"identifier","kind":"reject","input":"NA to BS EN 1996-1-2:2005","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7722:2006 BOOK","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 31100:2021 ExComm","expect":{}},{"entry":"identifier","kind":"reject","input":"AMD 11015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1425:Supplement No. 1:1966","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 185 Index:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2782-10:Method 1006:1978","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1902-2.3:Addendum No. 1:1976","expect":{}},{"entry":"identifier","kind":"example","input":"BS 10005:1995","expect":{"publisher":"BS","number":"10005","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS 1016-107.2:1991","expect":{"publisher":"BS","number":"1016","part":"107.2","year":"1991"}},{"entry":"identifier","kind":"example","input":"BS 1344-A1:1960","expect":{"publisher":"BS","number":"1344","part":"A1","year":"1960"}},{"entry":"identifier","kind":"example","input":"PD 5730","expect":{"publisher":"PD","number":"5730"}},{"entry":"identifier","kind":"example","input":"PAS 003:1994","expect":{"publisher":"PAS","number":"003","year":"1994"}},{"entry":"identifier","kind":"example","input":"DD 136-2:1986","expect":{"publisher":"DD","number":"136","part":"2","year":"1986"}},{"entry":"identifier","kind":"example","input":"TS 1:1995","expect":{"publisher":"TS","number":"1","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS EN 1073-2:2002","expect":{"publisher":"BS","adopted":"EN 1073-2:2002"}},{"entry":"identifier","kind":"example","input":"BS EN ISO 105-B06:2020","expect":{"publisher":"BS","adopted":"EN ISO 105-B06:2020"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61851-1:2019","expect":{"publisher":"BS","adopted":"EN IEC 61851-1:2019"}},{"entry":"identifier","kind":"example","input":"BS ISO 8601:2019","expect":{"publisher":"BS","adopted":"ISO 8601:2019"}},{"entry":"identifier","kind":"example","input":"BS IEC 60747-8:2000","expect":{"publisher":"BS","adopted":"IEC 60747-8:2000"}},{"entry":"identifier","kind":"example","input":"BS HD 60269-3","expect":{"publisher":"BS","adopted":"HD 60269-3"}},{"entry":"identifier","kind":"example","input":"DD CEN ISO/TS 12180-1:2007","expect":{"publisher":"DD","adopted":"CEN ISO/TS 12180-1:2007"}},{"entry":"identifier","kind":"example","input":"DD CLC/TS 50131-2-2:2004","expect":{"publisher":"DD","adopted":"CLC/TS 50131-2-2:2004"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 60601-1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 60601-1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 61535/AMD1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS 10125:2014+A1:2016","expect":{"publisher":"BS","number":"10125","year":"2014"}},{"entry":"identifier","kind":"example","input":"BS EN 1005-1:2001+A1:2008","expect":{"publisher":"BS","adopted":"EN 1005-1:2001"}},{"entry":"identifier","kind":"example","input":"BS 646:1958+A2:2013","expect":{"publisher":"BS","number":"646","year":"1958"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/bsi.pfs (pfs:1) sha256:acb28ac064cf70b7dcaf8ec199cd535f95c201ca348746f9124ce7d080473585\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: bsi_pfs (grammar PubidBsiPfs)\n# Regenerate: ruby scripts/pfs compile definitions/bsi.pfs --as bsi_pfs\n# Module: iso.inner v1 (sha256:7a088d2a7814...)\n# Module: iec.inner v1 (sha256:b9002f5d106b...)\n# Module: en.overlay v1 (sha256:b92ac2b27544...)\n# Module: national.prefix v1 (sha256:c7aa2f2442e8...)\n# Module: supplements.core v1 (sha256:9fa9656375c7...)\n\ngrammar PubidBsiPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n iso_space = \" \"\n iso_colon = \":\"\n iso_dash = \"-\"\n iso_year = 4*digit\n iso_part = 1*digit [\"-\" 1*digit]\n iso_number = 1*(\"0\" %x31-39) as iso_zero_lead *digit [iso_dash iso_part]\n iso_document = \"ISO\" iso_space iso_number [iso_colon iso_year]\n iec_space = \" \"\n iec_colon = \":\"\n iec_dash = \"-\"\n iec_year = 4*digit\n iec_part = 1*digit\n iec_number = ((\"6\" 4*digit / 5*digit / 1*digit)) as iec_number_core [iec_dash iec_part]\n iec_document = \"IEC\" iec_space iec_number [iec_colon iec_year]\n en_space = \" \"\n en_draft = (\"pr\" / \"Fpr\") as en_draft_kind\n en_face = [en_draft] \"EN\"\n en_adoption = en_face en_space iso_document\n supplement_number = 1*digit\n supplement_year = 4*digit\n supplement_month = 2*digit\n digit = %x30-39\n alpha = %x41-5A / %x61-7A\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n bsi_publisher = ((\"BS\" / \"PAS\" / \"PD\" / \"DD\" / \"TS\")) as publisher\n bsi_number = (1*(%x30-39) [%x41-5A]) as number\n bsi_part = (1*(digit / alpha) *((\".\" / \"-\") 1*(digit / alpha))) as part\n bsi_year = (4digit) as year\n bsi_adopted = (( ( \"EN\" / \"CEN\" / \"CLC\" / \"HD\" / \"ENV\" / \"ES\" / \"CR\" / \"CWA\" / \"ISO\" / \"IEC\" ) ( *( !(bsi_supplement) ( %x01-09 / %x0B-10FFFF ) ) ) )) as adopted\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its separator, kind face, ordinal and date\n # columns; the builder folds the run into the declared wrapper\n # classes (the slash run standalone, the plus run consolidated).\n bsi_supplement_number = (1*digit) as supplement_number\n bsi_supplements_year = (4digit) as supplements_year\n bsi_supplement_amendment = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"A\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement_corrigendum = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"C\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement = ( bsi_supplement_amendment / bsi_supplement_corrigendum ) as supplement\n bsi_supplements = (1*bsi_supplement) as supplements\n\n # Identifier rule: the canonical template first, then the\n # declared alternates (parse-in spellings; they normalize to the\n # canonical render face).\n identifier = ( bsi_publisher \" \" bsi_adopted / bsi_publisher \" \" bsi_number [\"-\" bsi_part] [\":\" bsi_year] ) [bsi_supplements]\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 publisher -> publisher (string)\n number -> number (string)\n part -> part (string)\n year -> year (string)\n adopted -> adopted (string)\n supplement -> supplements[].supplement (raw)\n }\n\n # REQUIRED examples from the definition — accepts, rejects, and\n # the capture expectations the compiler replayed at compile time.\n test {\n accept \"BS 10005:1995\"\n accept \"BS 1016-107.2:1991\"\n accept \"BS 1344-A1:1960\"\n accept \"PD 5730\"\n accept \"PAS 003:1994\"\n accept \"DD 136-2:1986\"\n accept \"TS 1:1995\"\n accept \"BS EN 1073-2:2002\"\n accept \"BS EN ISO 105-B06:2020\"\n accept \"BS EN IEC 61851-1:2019\"\n accept \"BS ISO 8601:2019\"\n accept \"BS IEC 60747-8:2000\"\n accept \"BS HD 60269-3\"\n accept \"DD CEN ISO/TS 12180-1:2007\"\n accept \"DD CLC/TS 50131-2-2:2004\"\n accept \"BS EN IEC 60601-1/FRAG1\"\n accept \"BS EN IEC 61535/AMD1/FRAG1\"\n accept \"BS 10125:2014+A1:2016\"\n accept \"BS EN 1005-1:2001+A1:2008\"\n accept \"BS 646:1958+A2:2013\"\n reject \"nonsense\"\n reject \"BS\"\n reject \"EN 1325\"\n reject \"ISO 9001:2015\"\n reject \"BS 2X 26:2001\"\n reject \"DISC PD 0005:1995\"\n reject \"BS A 103:2025\"\n reject \"BSI Flex 1886 v2.0:2024-09\"\n reject \"BS 7671 AMD2\"\n reject \"BS 1000[9]:1971\"\n reject \"BS 1580:Parts 1 and 2:1962\"\n reject \"BS CISPR 12:1997\"\n reject \"14/30300822 DC\"\n reject \"NA to BS EN 1996-1-2:2005\"\n reject \"BS 7722:2006 BOOK\"\n reject \"BS 31100:2021 ExComm\"\n reject \"AMD 11015\"\n reject \"BS 1425:Supplement No. 1:1966\"\n reject \"BS 185 Index:1962\"\n reject \"BS 2782-10:Method 1006:1978\"\n reject \"BS 1902-2.3:Addendum No. 1:1976\"\n example \"BS 10005:1995\" { publisher: \"BS\" number: \"10005\" year: \"1995\" }\n example \"BS 1016-107.2:1991\" { publisher: \"BS\" number: \"1016\" part: \"107.2\" year: \"1991\" }\n example \"BS 1344-A1:1960\" { publisher: \"BS\" number: \"1344\" part: \"A1\" year: \"1960\" }\n example \"PD 5730\" { publisher: \"PD\" number: \"5730\" }\n example \"PAS 003:1994\" { publisher: \"PAS\" number: \"003\" year: \"1994\" }\n example \"DD 136-2:1986\" { publisher: \"DD\" number: \"136\" part: \"2\" year: \"1986\" }\n example \"TS 1:1995\" { publisher: \"TS\" number: \"1\" year: \"1995\" }\n example \"BS EN 1073-2:2002\" { publisher: \"BS\" adopted: \"EN 1073-2:2002\" }\n example \"BS EN ISO 105-B06:2020\" { publisher: \"BS\" adopted: \"EN ISO 105-B06:2020\" }\n example \"BS EN IEC 61851-1:2019\" { publisher: \"BS\" adopted: \"EN IEC 61851-1:2019\" }\n example \"BS ISO 8601:2019\" { publisher: \"BS\" adopted: \"ISO 8601:2019\" }\n example \"BS IEC 60747-8:2000\" { publisher: \"BS\" adopted: \"IEC 60747-8:2000\" }\n example \"BS HD 60269-3\" { publisher: \"BS\" adopted: \"HD 60269-3\" }\n example \"DD CEN ISO/TS 12180-1:2007\" { publisher: \"DD\" adopted: \"CEN ISO/TS 12180-1:2007\" }\n example \"DD CLC/TS 50131-2-2:2004\" { publisher: \"DD\" adopted: \"CLC/TS 50131-2-2:2004\" }\n example \"BS EN IEC 60601-1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 60601-1/FRAG1\" }\n example \"BS EN IEC 61535/AMD1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 61535/AMD1/FRAG1\" }\n example \"BS 10125:2014+A1:2016\" { publisher: \"BS\" number: \"10125\" year: \"2014\" }\n example \"BS EN 1005-1:2001+A1:2008\" { publisher: \"BS\" adopted: \"EN 1005-1:2001\" }\n example \"BS 646:1958+A2:2013\" { publisher: \"BS\" number: \"646\" year: \"1958\" }\n }\n}\n","source_hash":"5a9bd671fb9193d1b1b5b8df1284fe1ecf5fdf40ea2514b5fc10d5c4da3473a3","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:ff4f7c71d1477155a9534c68abb01b36917ce6f7473818342999488a85af2eb5","checksum":"sha256:49113b4674e5a7bf6a07d413a1635d6343fe5af1697c9da7715dac3ff39de5ba","validated":{"lint_errors":0,"lint_warnings":0,"tests_total":61,"tests_failures":0,"self_test":true}}
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"PubidBsiPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":7}},{"Str":{"pattern":"BS"}},{"Str":{"pattern":"PAS"}},{"Str":{"pattern":"PD"}},{"Str":{"pattern":"DD"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[1,2,3,4,5]}},{"Named":{"name":"publisher","atom":6}},{"Str":{"pattern":" "}},{"Entity":{"atom":66}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"CEN"}},{"Str":{"pattern":"CLC"}},{"Str":{"pattern":"HD"}},{"Str":{"pattern":"ENV"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"CR"}},{"Str":{"pattern":"CWA"}},{"Str":{"pattern":"ISO"}},{"Str":{"pattern":"IEC"}},{"Alternative":{"atoms":[10,11,12,13,14,15,16,17,18,19]}},{"Entity":{"atom":58}},{"Entity":{"atom":42}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":23}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":25}},{"Alternative":{"atoms":[24,26]}},{"Str":{"pattern":"A"}},{"Named":{"name":"supplement_kind","atom":28}},{"Entity":{"atom":34}},{"Entity":{"atom":32}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":31,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":33}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Entity":{"atom":32}},{"Repetition":{"atom":37,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"supplements_year","atom":38}},{"Sequence":{"atoms":[35,36]}},{"Repetition":{"atom":40,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[27,29,30,41]}},{"Entity":{"atom":56}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":44}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":46}},{"Alternative":{"atoms":[45,47]}},{"Str":{"pattern":"C"}},{"Named":{"name":"supplement_kind","atom":49}},{"Entity":{"atom":34}},{"Str":{"pattern":":"}},{"Entity":{"atom":39}},{"Sequence":{"atoms":[52,53]}},{"Repetition":{"atom":54,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[48,50,51,55]}},{"Alternative":{"atoms":[22,43]}},{"Named":{"name":"supplement","atom":57}},{"Lookahead":{"atom":21,"positive":false}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[60,61]}},{"Sequence":{"atoms":[59,62]}},{"Repetition":{"atom":63,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[20,64]}},{"Named":{"name":"adopted","atom":65}},{"Sequence":{"atoms":[0,8,9]}},{"Entity":{"atom":7}},{"Str":{"pattern":" "}},{"Entity":{"atom":76}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":71,"min":1,"max":null,"tag":"Repetition"}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":73,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[72,74]}},{"Named":{"name":"number","atom":75}},{"Str":{"pattern":"-"}},{"Entity":{"atom":96}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[81,82]}},{"Alternative":{"atoms":[79,80]}},{"Repetition":{"atom":84,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[86,87]}},{"Entity":{"atom":32}},{"Entity":{"atom":83}},{"Alternative":{"atoms":[89,90]}},{"Repetition":{"atom":91,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[88,92]}},{"Repetition":{"atom":93,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[85,94]}},{"Named":{"name":"part","atom":95}},{"Sequence":{"atoms":[77,78]}},{"Repetition":{"atom":97,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":103}},{"Entity":{"atom":32}},{"Repetition":{"atom":101,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":102}},{"Sequence":{"atoms":[99,100]}},{"Repetition":{"atom":104,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[68,69,70,98,105]}},{"Alternative":{"atoms":[67,106]}},{"Entity":{"atom":111}},{"Entity":{"atom":58}},{"Repetition":{"atom":109,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":110}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[107,112]}}],"root":113},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"adopted","path":"adopted","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":[]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"BS 10005:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1016-107.2:1991","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 1344-A1:1960","expect":{}},{"entry":"identifier","kind":"accept","input":"PD 5730","expect":{}},{"entry":"identifier","kind":"accept","input":"PAS 003:1994","expect":{}},{"entry":"identifier","kind":"accept","input":"DD 136-2:1986","expect":{}},{"entry":"identifier","kind":"accept","input":"TS 1:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1073-2:2002","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN ISO 105-B06:2020","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61851-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS ISO 8601:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"BS IEC 60747-8:2000","expect":{}},{"entry":"identifier","kind":"accept","input":"BS HD 60269-3","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CEN ISO/TS 12180-1:2007","expect":{}},{"entry":"identifier","kind":"accept","input":"DD CLC/TS 50131-2-2:2004","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 60601-1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 10125:2014+A1:2016","expect":{}},{"entry":"identifier","kind":"accept","input":"BS EN 1005-1:2001+A1:2008","expect":{}},{"entry":"identifier","kind":"accept","input":"BS 646:1958+A2:2013","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"BS","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 1325","expect":{}},{"entry":"identifier","kind":"reject","input":"ISO 9001:2015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2X 26:2001","expect":{}},{"entry":"identifier","kind":"reject","input":"DISC PD 0005:1995","expect":{}},{"entry":"identifier","kind":"reject","input":"BS A 103:2025","expect":{}},{"entry":"identifier","kind":"reject","input":"BSI Flex 1886 v2.0:2024-09","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7671 AMD2","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1000[9]:1971","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1580:Parts 1 and 2:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS CISPR 12:1997","expect":{}},{"entry":"identifier","kind":"reject","input":"14/30300822 DC","expect":{}},{"entry":"identifier","kind":"reject","input":"NA to BS EN 1996-1-2:2005","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 7722:2006 BOOK","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 31100:2021 ExComm","expect":{}},{"entry":"identifier","kind":"reject","input":"AMD 11015","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1425:Supplement No. 1:1966","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 185 Index:1962","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 2782-10:Method 1006:1978","expect":{}},{"entry":"identifier","kind":"reject","input":"BS 1902-2.3:Addendum No. 1:1976","expect":{}},{"entry":"identifier","kind":"example","input":"BS 10005:1995","expect":{"publisher":"BS","number":"10005","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS 1016-107.2:1991","expect":{"publisher":"BS","number":"1016","part":"107.2","year":"1991"}},{"entry":"identifier","kind":"example","input":"BS 1344-A1:1960","expect":{"publisher":"BS","number":"1344","part":"A1","year":"1960"}},{"entry":"identifier","kind":"example","input":"PD 5730","expect":{"publisher":"PD","number":"5730"}},{"entry":"identifier","kind":"example","input":"PAS 003:1994","expect":{"publisher":"PAS","number":"003","year":"1994"}},{"entry":"identifier","kind":"example","input":"DD 136-2:1986","expect":{"publisher":"DD","number":"136","part":"2","year":"1986"}},{"entry":"identifier","kind":"example","input":"TS 1:1995","expect":{"publisher":"TS","number":"1","year":"1995"}},{"entry":"identifier","kind":"example","input":"BS EN 1073-2:2002","expect":{"publisher":"BS","adopted":"EN 1073-2:2002"}},{"entry":"identifier","kind":"example","input":"BS EN ISO 105-B06:2020","expect":{"publisher":"BS","adopted":"EN ISO 105-B06:2020"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61851-1:2019","expect":{"publisher":"BS","adopted":"EN IEC 61851-1:2019"}},{"entry":"identifier","kind":"example","input":"BS ISO 8601:2019","expect":{"publisher":"BS","adopted":"ISO 8601:2019"}},{"entry":"identifier","kind":"example","input":"BS IEC 60747-8:2000","expect":{"publisher":"BS","adopted":"IEC 60747-8:2000"}},{"entry":"identifier","kind":"example","input":"BS HD 60269-3","expect":{"publisher":"BS","adopted":"HD 60269-3"}},{"entry":"identifier","kind":"example","input":"DD CEN ISO/TS 12180-1:2007","expect":{"publisher":"DD","adopted":"CEN ISO/TS 12180-1:2007"}},{"entry":"identifier","kind":"example","input":"DD CLC/TS 50131-2-2:2004","expect":{"publisher":"DD","adopted":"CLC/TS 50131-2-2:2004"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 60601-1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 60601-1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS EN IEC 61535/AMD1/FRAG1","expect":{"publisher":"BS","adopted":"EN IEC 61535/AMD1/FRAG1"}},{"entry":"identifier","kind":"example","input":"BS 10125:2014+A1:2016","expect":{"publisher":"BS","number":"10125","year":"2014"}},{"entry":"identifier","kind":"example","input":"BS EN 1005-1:2001+A1:2008","expect":{"publisher":"BS","adopted":"EN 1005-1:2001"}},{"entry":"identifier","kind":"example","input":"BS 646:1958+A2:2013","expect":{"publisher":"BS","number":"646","year":"1958"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/bsi.pfs (pfs:1) sha256:e16c91365a12ffa75c8645ce69774e04f808d85d531b1c2c3c0f75f614197cf8\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: bsi_pfs (grammar PubidBsiPfs)\n# Regenerate: ruby scripts/pfs compile definitions/bsi.pfs --as bsi_pfs\n# Module: iso.inner v1 (sha256:7a088d2a7814...)\n# Module: iec.inner v1 (sha256:b9002f5d106b...)\n# Module: en.overlay v1 (sha256:b92ac2b27544...)\n# Module: national.prefix v1 (sha256:c7aa2f2442e8...)\n# Module: supplements.core v1 (sha256:9fa9656375c7...)\n\ngrammar PubidBsiPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n iso_space = \" \"\n iso_colon = \":\"\n iso_dash = \"-\"\n iso_year = 4*digit\n iso_part = 1*digit [\"-\" 1*digit]\n iso_number = 1*(\"0\" %x31-39) as iso_zero_lead *digit [iso_dash iso_part]\n iso_document = \"ISO\" iso_space iso_number [iso_colon iso_year]\n iec_space = \" \"\n iec_colon = \":\"\n iec_dash = \"-\"\n iec_year = 4*digit\n iec_part = 1*digit\n iec_number = ((\"6\" 4*digit / 5*digit / 1*digit)) as iec_number_core [iec_dash iec_part]\n iec_document = \"IEC\" iec_space iec_number [iec_colon iec_year]\n en_space = \" \"\n en_draft = (\"pr\" / \"Fpr\") as en_draft_kind\n en_face = [en_draft] \"EN\"\n en_adoption = en_face en_space iso_document\n supplement_number = 1*digit\n supplement_year = 4*digit\n supplement_month = 2*digit\n digit = %x30-39\n alpha = %x41-5A / %x61-7A\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n bsi_publisher = ((\"BS\" / \"PAS\" / \"PD\" / \"DD\" / \"TS\")) as publisher\n bsi_number = (1*(%x30-39) [%x41-5A]) as number\n bsi_part = (1*(digit / alpha) *((\".\" / \"-\") 1*(digit / alpha))) as part\n bsi_year = (4digit) as year\n bsi_adopted = (( ( \"EN\" / \"CEN\" / \"CLC\" / \"HD\" / \"ENV\" / \"ES\" / \"CR\" / \"CWA\" / \"ISO\" / \"IEC\" ) ( *( !(bsi_supplement) ( %x01-09 / %x0B-10FFFF ) ) ) )) as adopted\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its separator, kind face, ordinal and date\n # columns; the builder folds the run into the declared wrapper\n # classes (the slash run standalone, the plus run consolidated).\n bsi_supplement_number = (1*digit) as supplement_number\n bsi_supplements_year = (4digit) as supplements_year\n bsi_supplement_amendment = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"A\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement_corrigendum = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"C\" as supplement_kind bsi_supplement_number [\":\" bsi_supplements_year]\n }\n bsi_supplement = ( bsi_supplement_amendment / bsi_supplement_corrigendum ) as supplement\n bsi_supplements = (1*bsi_supplement) as supplements\n\n # Identifier rule: the canonical template first, then the\n # declared alternates (parse-in spellings; they normalize to the\n # canonical render face).\n identifier = ( bsi_publisher \" \" bsi_adopted / bsi_publisher \" \" bsi_number [\"-\" bsi_part] [\":\" bsi_year] ) [bsi_supplements]\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 publisher -> publisher (string)\n number -> number (string)\n part -> part (string)\n year -> year (string)\n adopted -> adopted (string)\n supplement -> supplements[].supplement (raw)\n }\n\n # REQUIRED examples from the definition — accepts, rejects, and\n # the capture expectations the compiler replayed at compile time.\n test {\n accept \"BS 10005:1995\"\n accept \"BS 1016-107.2:1991\"\n accept \"BS 1344-A1:1960\"\n accept \"PD 5730\"\n accept \"PAS 003:1994\"\n accept \"DD 136-2:1986\"\n accept \"TS 1:1995\"\n accept \"BS EN 1073-2:2002\"\n accept \"BS EN ISO 105-B06:2020\"\n accept \"BS EN IEC 61851-1:2019\"\n accept \"BS ISO 8601:2019\"\n accept \"BS IEC 60747-8:2000\"\n accept \"BS HD 60269-3\"\n accept \"DD CEN ISO/TS 12180-1:2007\"\n accept \"DD CLC/TS 50131-2-2:2004\"\n accept \"BS EN IEC 60601-1/FRAG1\"\n accept \"BS EN IEC 61535/AMD1/FRAG1\"\n accept \"BS 10125:2014+A1:2016\"\n accept \"BS EN 1005-1:2001+A1:2008\"\n accept \"BS 646:1958+A2:2013\"\n reject \"nonsense\"\n reject \"BS\"\n reject \"EN 1325\"\n reject \"ISO 9001:2015\"\n reject \"BS 2X 26:2001\"\n reject \"DISC PD 0005:1995\"\n reject \"BS A 103:2025\"\n reject \"BSI Flex 1886 v2.0:2024-09\"\n reject \"BS 7671 AMD2\"\n reject \"BS 1000[9]:1971\"\n reject \"BS 1580:Parts 1 and 2:1962\"\n reject \"BS CISPR 12:1997\"\n reject \"14/30300822 DC\"\n reject \"NA to BS EN 1996-1-2:2005\"\n reject \"BS 7722:2006 BOOK\"\n reject \"BS 31100:2021 ExComm\"\n reject \"AMD 11015\"\n reject \"BS 1425:Supplement No. 1:1966\"\n reject \"BS 185 Index:1962\"\n reject \"BS 2782-10:Method 1006:1978\"\n reject \"BS 1902-2.3:Addendum No. 1:1976\"\n example \"BS 10005:1995\" { publisher: \"BS\" number: \"10005\" year: \"1995\" }\n example \"BS 1016-107.2:1991\" { publisher: \"BS\" number: \"1016\" part: \"107.2\" year: \"1991\" }\n example \"BS 1344-A1:1960\" { publisher: \"BS\" number: \"1344\" part: \"A1\" year: \"1960\" }\n example \"PD 5730\" { publisher: \"PD\" number: \"5730\" }\n example \"PAS 003:1994\" { publisher: \"PAS\" number: \"003\" year: \"1994\" }\n example \"DD 136-2:1986\" { publisher: \"DD\" number: \"136\" part: \"2\" year: \"1986\" }\n example \"TS 1:1995\" { publisher: \"TS\" number: \"1\" year: \"1995\" }\n example \"BS EN 1073-2:2002\" { publisher: \"BS\" adopted: \"EN 1073-2:2002\" }\n example \"BS EN ISO 105-B06:2020\" { publisher: \"BS\" adopted: \"EN ISO 105-B06:2020\" }\n example \"BS EN IEC 61851-1:2019\" { publisher: \"BS\" adopted: \"EN IEC 61851-1:2019\" }\n example \"BS ISO 8601:2019\" { publisher: \"BS\" adopted: \"ISO 8601:2019\" }\n example \"BS IEC 60747-8:2000\" { publisher: \"BS\" adopted: \"IEC 60747-8:2000\" }\n example \"BS HD 60269-3\" { publisher: \"BS\" adopted: \"HD 60269-3\" }\n example \"DD CEN ISO/TS 12180-1:2007\" { publisher: \"DD\" adopted: \"CEN ISO/TS 12180-1:2007\" }\n example \"DD CLC/TS 50131-2-2:2004\" { publisher: \"DD\" adopted: \"CLC/TS 50131-2-2:2004\" }\n example \"BS EN IEC 60601-1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 60601-1/FRAG1\" }\n example \"BS EN IEC 61535/AMD1/FRAG1\" { publisher: \"BS\" adopted: \"EN IEC 61535/AMD1/FRAG1\" }\n example \"BS 10125:2014+A1:2016\" { publisher: \"BS\" number: \"10125\" year: \"2014\" }\n example \"BS EN 1005-1:2001+A1:2008\" { publisher: \"BS\" adopted: \"EN 1005-1:2001\" }\n example \"BS 646:1958+A2:2013\" { publisher: \"BS\" number: \"646\" year: \"1958\" }\n }\n}\n","source_hash":"83631d43804920c9ef782eee3731a411bd60bc8dd63a4e5248be6f9a87fb01cd","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:f327b757c2ee8eede07056ba3f564caa81ea3332f9913285c86ca22001c46d06","checksum":"sha256:71f1a18a597a6601bf1b454514dcda1cfa40a2cb63506976d03082730bf559ae","validated":{"lint_errors":0,"lint_warnings":0,"tests_total":61,"tests_failures":0,"self_test":true}}
|
data/data/parg/eu.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"PubidEu","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":24}},{"Str":{"pattern":"EU"}},{"Named":{"name":"prefix","atom":1}},{"Str":{"pattern":" "}},{"Entity":{"atom":9}},{"Str":{"pattern":"Regulation"}},{"Str":{"pattern":"Directive"}},{"Str":{"pattern":"Decision"}},{"Alternative":{"atoms":[5,6,7]}},{"Named":{"name":"type_word","atom":8}},{"Str":{"pattern":" No"}},{"Named":{"name":"no","atom":10}},{"Repetition":{"atom":11,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":18}},{"Entity":{"atom":16}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":15,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"first","atom":17}},{"Str":{"pattern":"/"}},{"Entity":{"atom":23}},{"Entity":{"atom":16}},{"Repetition":{"atom":21,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"second","atom":22}},{"Sequence":{"atoms":[2,3,4,12,13,14,19,20]}},{"Entity":{"atom":57}},{"Entity":{"atom":9}},{"Str":{"pattern":" ("}},{"Entity":{"atom":35}},{"Str":{"pattern":"Euratom"}},{"Str":{"pattern":"CFSP"}},{"Str":{"pattern":"EEC"}},{"Str":{"pattern":"EC"}},{"Str":{"pattern":"EU"}},{"Alternative":{"atoms":[29,30,31,32,33]}},{"Named":{"name":"family","atom":34}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[27,28,36]}},{"Repetition":{"atom":37,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" No"}},{"Named":{"name":"no","atom":39}},{"Repetition":{"atom":40,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":18}},{"Str":{"pattern":"/"}},{"Entity":{"atom":23}},{"Str":{"pattern":"/"}},{"Entity":{"atom":54}},{"Str":{"pattern":"Euratom"}},{"Str":{"pattern":"CFSP"}},{"Str":{"pattern":"EEC"}},{"Str":{"pattern":"EC"}},{"Str":{"pattern":"EU"}},{"Alternative":{"atoms":[48,49,50,51,52]}},{"Named":{"name":"family_suffix","atom":53}},{"Sequence":{"atoms":[46,47]}},{"Repetition":{"atom":55,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[26,38,41,42,43,44,45,56]}},{"Entity":{"atom":79}},{"Str":{"pattern":"CELEX"}},{"Str":{"pattern":" "}},{"Str":{"pattern":": "}},{"Str":{"pattern":":"}},{"Alternative":{"atoms":[60,61,62]}},{"Sequence":{"atoms":[59,63]}},{"Repetition":{"atom":64,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"3"}},{"Entity":{"atom":16}},{"Repetition":{"atom":67,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":68}},{"Entity":{"atom":75}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"L"}},{"Str":{"pattern":"D"}},{"Alternative":{"atoms":[71,72,73]}},{"Named":{"name":"celex_letter","atom":74}},{"Entity":{"atom":16}},{"Repetition":{"atom":76,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"number","atom":77}},{"Sequence":{"atoms":[65,66,69,70,78]}},{"Entity":{"atom":101}},{"Str":{"pattern":"http"}},{"Str":{"pattern":"s"}},{"Repetition":{"atom":82,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"://data.europa.eu/eli/"}},{"Entity":{"atom":90}},{"Str":{"pattern":"reg"}},{"Str":{"pattern":"dir"}},{"Str":{"pattern":"dec"}},{"Alternative":{"atoms":[86,87,88]}},{"Named":{"name":"eli_type","atom":89}},{"Str":{"pattern":"/"}},{"Entity":{"atom":16}},{"Repetition":{"atom":92,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":93}},{"Str":{"pattern":"/"}},{"Entity":{"atom":16}},{"Repetition":{"atom":96,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"number","atom":97}},{"Str":{"pattern":"/oj"}},{"Repetition":{"atom":99,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[81,83,84,85,91,94,95,98,100]}},{"Alternative":{"atoms":[0,25,58,80]}}],"root":102},"bindings":[{"capture":"prefix","path":"prefix","type":"string","card":null,"preprocess":null},{"capture":"type_word","path":"type_word","type":"string","card":null,"preprocess":null},{"capture":"family","path":"family","type":"string","card":null,"preprocess":null},{"capture":"family_suffix","path":"family_suffix","type":"string","card":null,"preprocess":null},{"capture":"no","path":"no","type":"string","card":null,"preprocess":null},{"capture":"first","path":"first","type":"string","card":null,"preprocess":null},{"capture":"second","path":"second","type":"string","card":null,"preprocess":null},{"capture":"celex_letter","path":"celex_letter","type":"string","card":null,"preprocess":null},{"capture":"eli_type","path":"eli_type","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"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":"EU Regulation 1227/2011","expect":{}},{"entry":"identifier","kind":"accept","input":"EU Directive 2016/680","expect":{}},{"entry":"identifier","kind":"accept","input":"Regulation (EU) No 1227/2011","expect":{}},{"entry":"identifier","kind":"accept","input":"Directive 2010/75/EU","expect":{}},{"entry":"identifier","kind":"accept","input":"CELEX 32011R1227","expect":{}},{"entry":"identifier","kind":"accept","input":"CELEX: 32011R1227","expect":{}},{"entry":"identifier","kind":"accept","input":"EU Regulation No 2015/2014","expect":{}},{"entry":"identifier","kind":"accept","input":"32016L0680","expect":{}},{"entry":"identifier","kind":"accept","input":"http://data.europa.eu/eli/reg/2011/1227/oj","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"EU Regulation 1227","expect":{}},{"entry":"identifier","kind":"example","input":"EU Regulation 1227/2011","expect":{"prefix":"EU","type_word":"Regulation","first":"1227","second":"2011"}},{"entry":"identifier","kind":"example","input":"Regulation (EU) No 1227/2011","expect":{"type_word":"Regulation","family":"EU","no":" No","first":"1227","second":"2011"}},{"entry":"identifier","kind":"example","input":"Directive 2010/75/EU","expect":{"type_word":"Directive","first":"2010","second":"75","family_suffix":"EU"}},{"entry":"identifier","kind":"example","input":"EU Regulation No 2015/2014","expect":{"prefix":"EU","type_word":"Regulation","no":" No","first":"2015","second":"2014"}},{"entry":"identifier","kind":"example","input":"CELEX 32016R0679","expect":{"year":"2016","celex_letter":"R","number":"0679"}},{"entry":"identifier","kind":"example","input":"http://data.europa.eu/eli/dir/2016/680/oj","expect":{"eli_type":"dir","year":"2016","number":"680"}}],"docs":{},"source":"# EU legal acts (Regulation / Directive / Decision), four input forms:\n# canonical EU Regulation 1227/2011, EU Directive 2016/680\n# long (OJ) Regulation (EU) No 1227/2011, Directive 2010/75/EU\n# CELEX CELEX 32011R1227, CELEX:32011R1227, 32011R1227\n# ELI http://data.europa.eu/eli/reg/2011/1227/oj\n# The canonical and long forms capture the two numbers as `first` and\n# `second`: which one is the year is not derivable from the grammar\n# (`Regulation (EC) No 2003/2003`), so the Ruby builder decides; an\n# optional `No` (also in the canonical form, where the renderer prints it\n# only to tell two readings apart) marks <number>/<year>. CELEX and ELI fix\n# the order, so they capture `year` and `number` directly. The bracketed\n# and the suffixed family are separate captures, so the builder can reject\n# a conflict (`Regulation (EU) No 1227/2011/EC`).\n\ngrammar PubidEu version \"0.1.0\" edition 2 {\n digit = %x30-39\n type_word = (\"Regulation\" / \"Directive\" / \"Decision\") as type_word\n family = (\"Euratom\" / \"CFSP\" / \"EEC\" / \"EC\" / \"EU\") as family\n family_suffix = (\"Euratom\" / \"CFSP\" / \"EEC\" / \"EC\" / \"EU\") as family_suffix\n first = (1*digit) as first\n second = (1*digit) as second\n canonical = (\"EU\") as prefix \" \" type_word [(\" No\") as no] \" \" first \"/\" second\n long = type_word [\" (\" family \")\"] [(\" No\") as no] \" \" first \"/\" second [\"/\" family_suffix]\n celex_letter = (\"R\" / \"L\" / \"D\") as celex_letter\n celex = [\"CELEX\" (\" \" / \": \" / \":\")] \"3\" (4digit) as year celex_letter (1*digit) as number\n eli_type = (\"reg\" / \"dir\" / \"dec\") as eli_type\n eli = \"http\" [\"s\"] \"://data.europa.eu/eli/\" eli_type \"/\" (4digit) as year \"/\" (1*digit) as number [\"/oj\"]\n identifier = canonical / long / celex / eli\n entry identifier: identifier\n\n bindings identifier {\n prefix -> prefix (string)\n type_word -> type_word (string)\n family -> family (string)\n family_suffix -> family_suffix (string)\n no -> no (string)\n first -> first (string)\n second -> second (string)\n celex_letter -> celex_letter (string)\n eli_type -> eli_type (string)\n year -> year (string)\n number -> number (string)\n }\n\n test {\n accept \"EU Regulation 1227/2011\"\n accept \"EU Directive 2016/680\"\n accept \"Regulation (EU) No 1227/2011\"\n accept \"Directive 2010/75/EU\"\n accept \"CELEX 32011R1227\"\n accept \"CELEX: 32011R1227\"\n accept \"EU Regulation No 2015/2014\"\n accept \"32016L0680\"\n accept \"http://data.europa.eu/eli/reg/2011/1227/oj\"\n reject \"nonsense\"\n reject \"EU Regulation 1227\"\n example \"EU Regulation 1227/2011\" { prefix: \"EU\", type_word: \"Regulation\", first: \"1227\", second: \"2011\" }\n example \"Regulation (EU) No 1227/2011\" { type_word: \"Regulation\", family: \"EU\", no: \" No\", first: \"1227\", second: \"2011\" }\n example \"Directive 2010/75/EU\" { type_word: \"Directive\", first: \"2010\", second: \"75\", family_suffix: \"EU\" }\n example \"EU Regulation No 2015/2014\" { prefix: \"EU\", type_word: \"Regulation\", no: \" No\", first: \"2015\", second: \"2014\" }\n example \"CELEX 32016R0679\" { year: \"2016\", celex_letter: \"R\", number: \"0679\" }\n example \"http://data.europa.eu/eli/dir/2016/680/oj\" { eli_type: \"dir\", year: \"2016\", number: \"680\" }\n }\n}\n","source_hash":"5adb915dde94053a07f7e50e1e24395f39e22cbed6edc0214dfb4254decb5873","unicode_tables":"onigmo (Ruby 3.4.10)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:c2fc5391cb50af1cdfff0a2eef224997807fab2f72e8dfddbd09ca9ed5a547b5","checksum":"sha256:d08ac392fbe02c098cda98fbce5c12af0ebca3a96b458d5d5f819181fa1847da","validated":{"lint_errors":0,"lint_warnings":0,"tests_total":17,"tests_failures":0,"self_test":true},"byte_checksum":"sha256:7f04183842abcd8a2a2450c0fbacb175126a92e50ff180bd489e340f999715b9"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# arXiv flavor notes
|
|
2
|
+
|
|
3
|
+
- **Origin (relaton#42)**: relaton's `Relaton::Arxiv` keys its `Db` cache with
|
|
4
|
+
`Pubid::Arxiv::Identifier`, routes by `Pubid::Arxiv.prefixes` (`["arXiv"]`)
|
|
5
|
+
and calls `GET https://export.arxiv.org/api/query?id_list=<id>` with
|
|
6
|
+
`to_s(with_publisher: false)`. Source of the forms:
|
|
7
|
+
https://info.arxiv.org/help/arxiv_identifier_for_services.html
|
|
8
|
+
- **Grammar**: `data/parg/arxiv.json`, baked from `grammars/arxiv.parg` with
|
|
9
|
+
the gem's pinned engine (`bundle exec parsanol parg compile …`). The source
|
|
10
|
+
was written here and handed to pubid-grammar to adopt byte-identical
|
|
11
|
+
(hand-off `metanorma__pubid-grammar__arxiv-grammar`); until it lands there,
|
|
12
|
+
the embedded `source` of the artifact is the only copy. Rebake from the
|
|
13
|
+
pubid-grammar copy once it exists.
|
|
14
|
+
- **The grammar checks shape, the Builder checks ranges.** The grammar takes
|
|
15
|
+
any `YYMM.NNNN[N]` and `archive[.SC]/YYMMNNN`; `Builder` rejects a month
|
|
16
|
+
outside 01–12, a 4-digit number outside 0704–1412, a 5-digit number before
|
|
17
|
+
1501, an old id outside 9108–0703, `v0` and a version with a leading zero
|
|
18
|
+
(`v01` would render `v1`, so `to_s` would not be exact). It raises
|
|
19
|
+
`ArgumentError`, which `Identifier.build_identifier` turns into
|
|
20
|
+
`Pubid::Errors::ParseError` — the ISBN shape, with the input guards kept
|
|
21
|
+
outside that rescue.
|
|
22
|
+
- **Components**: `archive`/`subject_class` (old ids only), `year` (4 digits;
|
|
23
|
+
old ids 91–99 → 19xx, else 20xx; new ids always 20xx), `month`, `number`
|
|
24
|
+
(the inherited `:string`, sequence only, leading zeros kept: `00001`,
|
|
25
|
+
`001`) and `version` (Integer, nil when absent). `root.number` is the
|
|
26
|
+
sequence number: it is never empty, but it narrows the index less than a
|
|
27
|
+
full `2301.00001` would.
|
|
28
|
+
- **Rendering**: always the canonical colon form `arXiv:<id>`, whatever
|
|
29
|
+
prefix the input used (`arxiv 2301.00001` → `arXiv:2301.00001`; the classify
|
|
30
|
+
run records these as `!input!rendered`). `with_publisher: false` is handled
|
|
31
|
+
in the renderer, not by `Renderers::PublisherStripper`, because the stripper
|
|
32
|
+
cuts only before a space, `-`, `/` or `.`, never before `:`;
|
|
33
|
+
`publisher_prefixes` is `[]` for that reason. No `publisher` component is
|
|
34
|
+
stored: the token is constant and every surface prints it.
|
|
35
|
+
- **Matching**: `subset_strict :archive, :subject_class, :year, :month,
|
|
36
|
+
:number`, so the version is the only `===` wildcard — `arXiv:2301.00001`
|
|
37
|
+
matches `…v1` and `…v2`, a new id never matches an old one, `math/…` does
|
|
38
|
+
not match `math.GT/…`, and an empty hand-built reference matches nothing.
|
|
39
|
+
`==` stays exact.
|
|
40
|
+
- **`year` is identity, not an edition.** The shared `#exclude` treats
|
|
41
|
+
`:year`/`:date` as the edition wildcard, which would turn `2301.00001`
|
|
42
|
+
into `0001.00001` and make `matches?(…, ignore: [:year])` match a paper of
|
|
43
|
+
another month. `Identifier#exclude` therefore ignores `:year`, `:date` and
|
|
44
|
+
`:month`; ignore `:version` to match across versions.
|
|
45
|
+
- **`to_urn` returns `to_pubid_urn`.** arXiv has no official namespace, and
|
|
46
|
+
the base fallback `urn:arxiv:<number>:<year>` collided (`2301.00001` and
|
|
47
|
+
`2302.00001` shared one URN).
|
|
48
|
+
- **Known, left open**: `from_hash`/`parse_urn` do not run the builder's
|
|
49
|
+
range checks (a hand-made `month: 13` renders `2313.…`); the grammar is
|
|
50
|
+
looser than the real archive list (`a/9901001` parses); a new-form id in the
|
|
51
|
+
2090s is accepted; the MR string is the bare number (ISBN's is empty);
|
|
52
|
+
annotated rendering adds a span only to a version-less new id, because the
|
|
53
|
+
number is glued to `v` or to YYMM.
|
|
54
|
+
- **Routing**: `Pubid.parse` matches prefixes case-sensitively, so it routes
|
|
55
|
+
`arXiv:…` and `arXiv …` only; `Pubid::Arxiv.parse` accepts every spelling,
|
|
56
|
+
and bare ids.
|
|
57
|
+
- **URN**: `#to_pubid_urn` only (`docs/URN-SCHEMES.adoc` `[[urn-arxiv]]`);
|
|
58
|
+
arXiv registers no official URN namespace.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Arxiv
|
|
5
|
+
# Builds a Pubid::Arxiv::Identifier from the bound parse hash.
|
|
6
|
+
#
|
|
7
|
+
# The grammar checks the shape; this class checks the rules the shape
|
|
8
|
+
# cannot express, and raises ArgumentError (which Identifier.parse turns
|
|
9
|
+
# into Pubid::Errors::ParseError):
|
|
10
|
+
#
|
|
11
|
+
# - the month is 01-12;
|
|
12
|
+
# - a 4-digit new number has a YYMM from 0704 to 1412;
|
|
13
|
+
# - a 5-digit new number has a YYMM from 1501;
|
|
14
|
+
# - an old-form id has a YYMM from 9108 to 0703;
|
|
15
|
+
# - the version is 1 or more, with no leading zero (so `to_s` is exact).
|
|
16
|
+
class Builder
|
|
17
|
+
def self.build(parsed_data)
|
|
18
|
+
new.build(parsed_data)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def build(data)
|
|
22
|
+
archive = presence(data[:archive])
|
|
23
|
+
year, month = year_month(data[:yymm].to_s, old: archive)
|
|
24
|
+
number = data[:number].to_s
|
|
25
|
+
validate_range!(year, month, number, old: archive)
|
|
26
|
+
|
|
27
|
+
Identifiers::Eprint.new(
|
|
28
|
+
archive: archive, subject_class: presence(data[:subject_class]),
|
|
29
|
+
year: year, month: month, number: number,
|
|
30
|
+
version: version(data[:version])
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
# Old-form ids run from 9108 to 0703, so 91-99 is the 1990s; a new id
|
|
37
|
+
# is always in the 2000s.
|
|
38
|
+
def year_month(yymm, old:)
|
|
39
|
+
two_digit = yymm[0, 2].to_i
|
|
40
|
+
month = yymm[2, 2].to_i
|
|
41
|
+
validate_month!(month, yymm)
|
|
42
|
+
century = old && two_digit >= 91 ? 1900 : 2000
|
|
43
|
+
[century + two_digit, month]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def validate_range!(year, month, number, old:)
|
|
47
|
+
old ? validate_old!(year, month) : validate_new!(year, month, number)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def validate_month!(month, yymm)
|
|
51
|
+
return if month.between?(1, 12)
|
|
52
|
+
|
|
53
|
+
raise ArgumentError, "month out of range in YYMM #{yymm}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def validate_old!(year, month)
|
|
57
|
+
return if ym(year, month).between?(199108, 200703)
|
|
58
|
+
|
|
59
|
+
raise ArgumentError, "an old-form id dates from 9108 to 0703"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def validate_new!(year, month, number)
|
|
63
|
+
date = ym(year, month)
|
|
64
|
+
valid = if number.length == 4
|
|
65
|
+
date.between?(200704, 201412)
|
|
66
|
+
else
|
|
67
|
+
date >= 201501
|
|
68
|
+
end
|
|
69
|
+
return if valid
|
|
70
|
+
|
|
71
|
+
raise ArgumentError,
|
|
72
|
+
"a #{number.length}-digit number does not fit YYMM " \
|
|
73
|
+
"#{format('%<y>02d%<m>02d', y: year % 100, m: month)}"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def ym(year, month)
|
|
77
|
+
(year * 100) + month
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def version(value)
|
|
81
|
+
return nil if value.nil? || value.to_s.empty?
|
|
82
|
+
|
|
83
|
+
text = value.to_s
|
|
84
|
+
if text.start_with?("0")
|
|
85
|
+
raise ArgumentError,
|
|
86
|
+
"version v#{text} is not 1 or more without a leading zero"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
text.to_i
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def presence(value)
|
|
93
|
+
text = value.to_s
|
|
94
|
+
text.empty? ? nil : text
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
Pubid::Arxiv::Builder.prepend(Pubid::Builder::AllPartsWrap)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Arxiv
|
|
5
|
+
class Identifier < ::Pubid::Identifier
|
|
6
|
+
# The archive of an old-form id (`hep-th`, `math`); nil for a new id.
|
|
7
|
+
attribute :archive, :string
|
|
8
|
+
|
|
9
|
+
# The subject class of an old-form id (`GT` in `math.GT/0309136`).
|
|
10
|
+
attribute :subject_class, :string
|
|
11
|
+
|
|
12
|
+
# The submission year (4 digits) and month, read from the id's YYMM.
|
|
13
|
+
attribute :year, :integer
|
|
14
|
+
attribute :month, :integer
|
|
15
|
+
|
|
16
|
+
# The e-print version (`v2` -> 2); nil when the id names no version.
|
|
17
|
+
attribute :version, :integer
|
|
18
|
+
|
|
19
|
+
ARXIV_TYPE_MAP = {
|
|
20
|
+
"pubid:arxiv:eprint" => "Pubid::Arxiv::Identifiers::Eprint",
|
|
21
|
+
}.freeze
|
|
22
|
+
|
|
23
|
+
key_value do
|
|
24
|
+
map "_type", to: :_type, polymorphic_map: ARXIV_TYPE_MAP
|
|
25
|
+
map "archive", to: :archive
|
|
26
|
+
map "subject_class", to: :subject_class
|
|
27
|
+
map "year", to: :year
|
|
28
|
+
map "month", to: :month
|
|
29
|
+
map "number", to: :number
|
|
30
|
+
map "version", to: :version
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# A nil archive or subject class means "this id has none", so a new id
|
|
34
|
+
# never matches an old one and `math/…` never matches `math.GT/…`. The
|
|
35
|
+
# year, month and number are always stated. The version is the only
|
|
36
|
+
# wildcard.
|
|
37
|
+
subset_strict :archive, :subject_class, :year, :month, :number
|
|
38
|
+
|
|
39
|
+
# The year and month name the paper (they are its YYMM), not an
|
|
40
|
+
# edition, so the generic year wildcard must not drop them:
|
|
41
|
+
# `matches?(other, ignore: [:year])` would otherwise match
|
|
42
|
+
# `2301.00001` with `2401.00001`.
|
|
43
|
+
IDENTITY_ATTRIBUTES = %i[year date month].freeze
|
|
44
|
+
|
|
45
|
+
def exclude(*attrs)
|
|
46
|
+
super(*(attrs - IDENTITY_ATTRIBUTES))
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# arXiv registers no official URN namespace, and the base fallback
|
|
50
|
+
# (`urn:arxiv:<number>:<year>`) maps different papers to one URN, so
|
|
51
|
+
# the official form is the lossless pubid-scheme URN.
|
|
52
|
+
def to_urn
|
|
53
|
+
to_pubid_urn
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
PUBLISHER = "arXiv"
|
|
57
|
+
|
|
58
|
+
# The four-digit YYMM the id prints.
|
|
59
|
+
def yymm
|
|
60
|
+
format("%<yy>02d%<mm>02d", yy: year.to_i % 100, mm: month.to_i)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# True for an old-form (archive) id.
|
|
64
|
+
def old_style?
|
|
65
|
+
!archive.nil?
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def to_s(**opts)
|
|
69
|
+
render(format: :human, **opts)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# The renderer prints the `arXiv:` token itself and drops it for
|
|
73
|
+
# `with_publisher: false`. The shared stripper cuts only before a space,
|
|
74
|
+
# `-`, `/` or `.`, never before a colon, so it has nothing to cut here.
|
|
75
|
+
def publisher_prefixes
|
|
76
|
+
[]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def self.parse(identifier)
|
|
80
|
+
unless identifier.is_a?(String)
|
|
81
|
+
raise Pubid::Errors::InvalidInputError,
|
|
82
|
+
Pubid::INPUT_NOT_A_STRING_MESSAGE
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if identifier.length > Pubid::MAX_INPUT_LENGTH
|
|
86
|
+
raise Pubid::Errors::InvalidInputError, Pubid::INPUT_TOO_LONG_MESSAGE
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
identifier = ::Pubid.utf8_input(identifier)
|
|
90
|
+
|
|
91
|
+
# The guards above stay OUTSIDE build_identifier, whose ArgumentError
|
|
92
|
+
# rescue would otherwise swallow them (the ISBN lesson).
|
|
93
|
+
build_identifier(identifier)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @raise [Pubid::Errors::ParseError] if the string is not an arXiv id
|
|
97
|
+
def self.build_identifier(identifier)
|
|
98
|
+
parsed = Pubid::Parg::Model.bound(:arxiv, identifier)
|
|
99
|
+
Builder.build(parsed)
|
|
100
|
+
rescue ArgumentError => e
|
|
101
|
+
# The Builder checks the date ranges, the month and the version.
|
|
102
|
+
# Surface that as a parse failure, the class a grammar rejection has.
|
|
103
|
+
raise Pubid::Errors::ParseError.new(
|
|
104
|
+
"invalid arXiv identifier '#{identifier}': #{e.message}",
|
|
105
|
+
input: identifier, flavor: "arxiv",
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
|
+
private_class_method :build_identifier
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Arxiv
|
|
5
|
+
module Identifiers
|
|
6
|
+
# An arXiv e-print, new form or old form.
|
|
7
|
+
#
|
|
8
|
+
# Examples:
|
|
9
|
+
# arXiv:2301.00001v1
|
|
10
|
+
# arXiv:0704.0001
|
|
11
|
+
# arXiv:hep-th/9901001v2
|
|
12
|
+
# arXiv:math.GT/0309136
|
|
13
|
+
class Eprint < Identifier
|
|
14
|
+
def self.type
|
|
15
|
+
{ key: :eprint, title: "arXiv e-print", short: "arXiv" }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Arxiv
|
|
5
|
+
# Grammar for arXiv identifiers. The parser of record is the baked
|
|
6
|
+
# artifact `data/parg/arxiv.json` (source: pubid-grammar
|
|
7
|
+
# `grammars/arxiv.parg`), run by Pubid::Parg::Model.bound.
|
|
8
|
+
#
|
|
9
|
+
# Accepts:
|
|
10
|
+
# [arXiv(:| )] YYMM.NNNN[vN] | YYMM.NNNNN[vN]
|
|
11
|
+
# [arXiv(:| )] archive[.SC]/YYMMNNN[vN]
|
|
12
|
+
#
|
|
13
|
+
# The prefix is case-insensitive. Date ranges, the month and the version
|
|
14
|
+
# are checked by the Builder.
|
|
15
|
+
class Parser
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Arxiv
|
|
5
|
+
# The pubid-scheme URN of arXiv (docs/URN-SCHEMES.adoc, [[urn-arxiv]]).
|
|
6
|
+
#
|
|
7
|
+
# arXiv:2301.00001v1
|
|
8
|
+
# -> urn:pubid:arxiv:eprint:2023:1:00001:v-1
|
|
9
|
+
# arXiv:math.GT/0309136
|
|
10
|
+
# -> urn:pubid:arxiv:eprint:2003:9:136:archive-math:sc-GT
|
|
11
|
+
#
|
|
12
|
+
# Every e-print has a year, a month and a number, so they are the
|
|
13
|
+
# positional core. The archive and subject class (old ids only) and the
|
|
14
|
+
# version can be absent, so they are atoms. arXiv registers no official
|
|
15
|
+
# URN namespace.
|
|
16
|
+
PubidUrnSchema = Pubid::PubidUrn.define("arxiv") do
|
|
17
|
+
atom "archive", "archive"
|
|
18
|
+
atom "subject_class", "sc"
|
|
19
|
+
atom "version", "v", kind: :int
|
|
20
|
+
|
|
21
|
+
core = [["year", :int], ["month", :int], "number"]
|
|
22
|
+
type "pubid:arxiv:eprint", "eprint", core: core
|
|
23
|
+
type "pubid:arxiv:identifier", "id", core: core
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Arxiv
|
|
5
|
+
# Human-readable renderer for arXiv ids.
|
|
6
|
+
#
|
|
7
|
+
# Prints the canonical colon form `arXiv:<id>` whatever prefix the input
|
|
8
|
+
# used, and the bare id for `with_publisher: false` — the form the arXiv
|
|
9
|
+
# API takes in `id_list`.
|
|
10
|
+
class Renderer < ::Pubid::Renderers::Base
|
|
11
|
+
def render(with_publisher: nil, **_opts)
|
|
12
|
+
bare = "#{body}#{version}"
|
|
13
|
+
with_publisher == false ? bare : "#{Identifier::PUBLISHER}:#{bare}"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def body
|
|
19
|
+
return "#{@id.yymm}.#{@id.number}" unless @id.old_style?
|
|
20
|
+
|
|
21
|
+
archive = [@id.archive, @id.subject_class].compact.join(".")
|
|
22
|
+
"#{archive}/#{@id.yymm}#{@id.number}"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def version
|
|
26
|
+
@id.version ? "v#{@id.version}" : ""
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|