pubid 2.0.38 → 2.0.40
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/jis.json +1 -1
- data/lib/pubid/jis/CLAUDE.md +43 -3
- data/lib/pubid/jis/builder.rb +5 -2
- data/lib/pubid/jis/identifiers/amendment.rb +2 -1
- data/lib/pubid/jis/identifiers/corrigendum.rb +3 -1
- data/lib/pubid/jis/supplement_identifier.rb +15 -0
- data/lib/pubid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b8942b2fc7acbb38fda21b7b3f61cad12dab987223ad5423390561443d0d563
|
|
4
|
+
data.tar.gz: 14618fd5e083f6e89a520333350e1fb9d9112534f71381369211e69ce877316b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ec505571030274e620d2fae19f265cc4b46116a63c2294c7138a20dcdb490ab7784d9c2a1380959a156d79e29b385efbe97dfecc0457439880a19273dd4cb58
|
|
7
|
+
data.tar.gz: 3b42921d5d1747102e15a88f35f514a06a195f03ba4465f92dba2f96dbc9f788e541add509be7ed053ca6474ebc568e8cb552c9ada5384017e4b829a301690c9
|
data/data/parg/jis.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.1.0","grammar":"PubidJis","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":144}},{"Str":{"pattern":"WES"}},{"Named":{"name":"wes","atom":1}},{"Entity":{"atom":6}},{"Str":{"pattern":" "}},{"Str":{"pattern":" "}},{"Alternative":{"atoms":[4,5]}},{"Entity":{"atom":11}},{"Entity":{"atom":9}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":8,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"number","atom":10}},{"Entity":{"atom":24}},{"Entity":{"atom":22}},{"Entity":{"atom":18}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"ー"}},{"Alternative":{"atoms":[15,16]}},{"Named":{"name":"dash","atom":17}},{"Entity":{"atom":9}},{"Repetition":{"atom":19,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"part","atom":20}},{"Sequence":{"atoms":[14,21]}},{"Repetition":{"atom":13,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"parts","atom":23}},{"Entity":{"atom":40}},{"Entity":{"atom":29}},{"Str":{"pattern":":"}},{"Str":{"pattern":":"}},{"Alternative":{"atoms":[27,28]}},{"Entity":{"atom":9}},{"Repetition":{"atom":30,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"year","atom":31}},{"Entity":{"atom":38}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"R"}},{"Repetition":{"atom":35,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[34,36]}},{"Named":{"name":"reaffirmed","atom":37}},{"Repetition":{"atom":33,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[26,32,39]}},{"Repetition":{"atom":25,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":53}},{"Str":{"pattern":"("}},{"Str":{"pattern":"("}},{"Alternative":{"atoms":[43,44]}},{"Str":{"pattern":"E"}},{"Str":{"pattern":"J"}},{"Alternative":{"atoms":[46,47]}},{"Named":{"name":"language","atom":48}},{"Str":{"pattern":")"}},{"Str":{"pattern":")"}},{"Alternative":{"atoms":[50,51]}},{"Sequence":{"atoms":[45,49,52]}},{"Repetition":{"atom":42,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":65}},{"Str":{"pattern":"("}},{"Str":{"pattern":"規格群"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[56,57,58]}},{"Str":{"pattern":"("}},{"Str":{"pattern":"規格群"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[60,61,62]}},{"Alternative":{"atoms":[59,63]}},{"Named":{"name":"all_parts","atom":64}},{"Repetition":{"atom":55,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":127}},{"Entity":{"atom":89}},{"Entity":{"atom":70}},{"Str":{"pattern":"/"}},{"Str":{"pattern":"AMENDMENT"}},{"Str":{"pattern":"AMD"}},{"Alternative":{"atoms":[71,72]}},{"Named":{"name":"amd_type","atom":73}},{"Entity":{"atom":6}},{"Entity":{"atom":9}},{"Repetition":{"atom":76,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"amd_number","atom":77}},{"Entity":{"atom":29}},{"Entity":{"atom":9}},{"Repetition":{"atom":80,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"amd_year","atom":81}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"R"}},{"Repetition":{"atom":84,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[83,85]}},{"Repetition":{"atom":86,"min":0,"max":1,"tag":"Maybe"}},{"Named":{"name":"amd_reaffirmed","atom":87}},{"Sequence":{"atoms":[69,74,75,78,79,82,88]}},{"Named":{"name":"amendment","atom":68}},{"Entity":{"atom":103}},{"Entity":{"atom":70}},{"Str":{"pattern":"EXPLANATION"}},{"Str":{"pattern":"EXPL"}},{"Alternative":{"atoms":[93,94]}},{"Named":{"name":"expl_type","atom":95}},{"Entity":{"atom":6}},{"Entity":{"atom":9}},{"Repetition":{"atom":98,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"expl_number","atom":99}},{"Sequence":{"atoms":[97,100]}},{"Repetition":{"atom":101,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[92,96,102]}},{"Named":{"name":"explanation","atom":91}},{"Entity":{"atom":125}},{"Entity":{"atom":70}},{"Str":{"pattern":"CORRIGENDUM"}},{"Str":{"pattern":"CORR"}},{"Alternative":{"atoms":[107,108]}},{"Named":{"name":"corr_type","atom":109}},{"Entity":{"atom":6}},{"Entity":{"atom":9}},{"Repetition":{"atom":112,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"corr_number","atom":113}},{"Entity":{"atom":29}},{"Entity":{"atom":9}},{"Repetition":{"atom":116,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"corr_year","atom":117}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"R"}},{"Repetition":{"atom":120,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[119,121]}},{"Repetition":{"atom":122,"min":0,"max":1,"tag":"Maybe"}},{"Named":{"name":"corr_reaffirmed","atom":123}},{"Sequence":{"atoms":[106,110,111,114,115,118,124]}},{"Named":{"name":"corrigendum","atom":105}},{"Alternative":{"atoms":[90,104,126]}},{"Repetition":{"atom":67,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":142}},{"Entity":{"atom":6}},{"Str":{"pattern":"SYMBOL"}},{"Named":{"name":"symbol_present","atom":131}},{"Entity":{"atom":6}},{"Entity":{"atom":137}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[135,136]}},{"Repetition":{"atom":134,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"symbol_value","atom":138}},{"Sequence":{"atoms":[133,139]}},{"Repetition":{"atom":140,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[130,132,141]}},{"Repetition":{"atom":129,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[2,3,7,12,41,54,66,128,143]}},{"Entity":{"atom":182}},{"Str":{"pattern":"JIS"}},{"Entity":{"atom":6}},{"Entity":{"atom":70}},{"Alternative":{"atoms":[147,148]}},{"Repetition":{"atom":149,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[146,150]}},{"Repetition":{"atom":151,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":161}},{"Str":{"pattern":"TR"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[154,155]}},{"Named":{"name":"type","atom":156}},{"Entity":{"atom":6}},{"Entity":{"atom":70}},{"Alternative":{"atoms":[158,159]}},{"Sequence":{"atoms":[157,160]}},{"Repetition":{"atom":153,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":6}},{"Repetition":{"atom":163,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":167}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Named":{"name":"series","atom":166}},{"Entity":{"atom":6}},{"Repetition":{"atom":168,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":11}},{"Entity":{"atom":24}},{"Entity":{"atom":40}},{"Repetition":{"atom":172,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":53}},{"Repetition":{"atom":174,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":65}},{"Repetition":{"atom":176,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":127}},{"Repetition":{"atom":178,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":142}},{"Repetition":{"atom":180,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[152,162,164,165,169,170,171,173,175,177,179,181]}},{"Alternative":{"atoms":[0,145]}}],"root":183},"bindings":[{"capture":"wes","path":"wes","type":"string","card":null,"preprocess":null},{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"series","path":"series","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"parts[].part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"reaffirmed","path":"reaffirmed","type":"string","card":null,"preprocess":null},{"capture":"language","path":"language","type":"string","card":null,"preprocess":null},{"capture":"all_parts","path":"all_parts","type":"string","card":null,"preprocess":null},{"capture":"amd_type","path":"amd_type","type":"string","card":null,"preprocess":null},{"capture":"amd_number","path":"amd_number","type":"string","card":null,"preprocess":null},{"capture":"amd_year","path":"amd_year","type":"string","card":null,"preprocess":null},{"capture":"amd_reaffirmed","path":"amd_reaffirmed","type":"string","card":null,"preprocess":null},{"capture":"expl_type","path":"expl_type","type":"string","card":null,"preprocess":null},{"capture":"expl_number","path":"expl_number","type":"string","card":null,"preprocess":null},{"capture":"corr_type","path":"corr_type","type":"string","card":null,"preprocess":null},{"capture":"corr_number","path":"corr_number","type":"string","card":null,"preprocess":null},{"capture":"corr_year","path":"corr_year","type":"string","card":null,"preprocess":null},{"capture":"corr_reaffirmed","path":"corr_reaffirmed","type":"string","card":null,"preprocess":null},{"capture":"symbol_present","path":"symbol_present","type":"string","card":null,"preprocess":null},{"capture":"symbol_value","path":"symbol_value","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule supplement: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule supplement: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule supplement: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule symbol_value_char: branches 1 and 2 are order-dependent (first set not statically known)","rule identifier: 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":"JIS B 0001","expect":{}},{"entry":"identifier","kind":"accept","input":"JIS X 0208:1997","expect":{}},{"entry":"identifier","kind":"accept","input":"WES 7700-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"WES 7301:2020R","expect":{}},{"entry":"identifier","kind":"reject","input":"JIS WES 7700","expect":{}},{"entry":"identifier","kind":"reject","input":"WES X 7700","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"example","input":"WES 7700-1:2019","expect":{"wes":"WES","number":"7700","year":"2019"}},{"entry":"identifier","kind":"example","input":"WES 7301:2020R","expect":{"wes":"WES","number":"7301","year":"2020","reaffirmed":"R"}},{"entry":"identifier","kind":"example","input":"JIS X 0208:1997","expect":{"series":"X","number":"0208","year":"1997"}},{"entry":"identifier","kind":"example","input":"WES 7700:2019/AMD 1:2020R","expect":{"wes":"WES","number":"7700","amd_type":"AMD","amd_number":"1","amd_year":"2020","amd_reaffirmed":"R"}},{"entry":"identifier","kind":"example","input":"JIS X 0208:1997R","expect":{"series":"X","year":"1997","reaffirmed":"R"}},{"entry":"identifier","kind":"example","input":"JIS X 0208:1997RR","expect":{"series":"X","year":"1997","reaffirmed":"RR"}}],"docs":{},"source":"# Port of lib/pubid/jis/parser.rb — JIS identifiers with the Japanese\n# full-width separator tolerance (ー : ()), TR/TS prefixes, parts,\n# reaffirmed years, (E)/(J) language codes, 規格群 all-parts, AMD/EXPL/\n# CORR supplements, and the SYMBOL clause. WES (Japan Welding Engineering\n# Society) ids share the JIS tail but carry no series letter or JIS prefix.\n\ngrammar PubidJis version \"0.1.0\" edition 2 {\n dash = (\"-\" / \"ー\") as dash\n space = (\" \" / \" \")\n colon = (\":\" / \":\")\n type_prefix = (\"TR\" / \"TS\") as type (space / slash)\n series = %x41-5A as series\n number = (1*digit) as number\n part = dash (1*digit) as part\n parts = (*part) as parts\n reaffirmed = \"R\" (*\"R\")\n year = colon (1*digit) as year [reaffirmed_rule]\n language = (\"(\" / \"(\") (\"E\" / \"J\") as language (\")\" / \")\")\n all_parts = ((\"(\" \"規格群\" \")\") / (\"(\" \"規格群\" \")\")) as all_parts\n amendment = {\n slash (\"AMENDMENT\" / \"AMD\") as amd_type\n space\n (1*digit) as amd_number\n colon (1*digit) as amd_year\n ([\"R\" (*\"R\")]) as amd_reaffirmed\n }\n explanation = {\n slash (\"EXPLANATION\" / \"EXPL\") as expl_type\n ([space (1*digit) as expl_number])\n }\n corrigendum = {\n slash (\"CORRIGENDUM\" / \"CORR\") as corr_type\n space\n (1*digit) as corr_number\n colon (1*digit) as corr_year\n ([\"R\" (*\"R\")]) as corr_reaffirmed\n }\n supplement = {\n (amendment as amendment)\n / (explanation as explanation)\n / (corrigendum as corrigendum)\n }\n symbol_value_char = %x01-09 / %x0B-10FFFF\n symbol_clause = {\n space \"SYMBOL\" as symbol_present\n ([space (1*symbol_value_char) as symbol_value])\n }\n wes_identifier = {\n \"WES\" as wes\n space\n number\n parts\n [year]\n [language]\n [all_parts]\n [supplement]\n [symbol_clause]\n }\n jis_identifier = {\n [\"JIS\" [(space / slash)]]\n [type_prefix]\n [space]\n series\n [space]\n number\n parts\n [year]\n [language]\n [all_parts]\n [supplement]\n [symbol_clause]\n }\n identifier = wes_identifier / jis_identifier\n upper = %x41-5A\n digit = %x30-39\n slash = \"/\"\n reaffirmed_rule = (\"R\" (*\"R\")) as reaffirmed\n entry identifier: identifier\n\n # Typed model bindings: bound captures land on the consumer\n # builder's fields of the same name; repeated parts collect under\n # parts[].part.\n bindings identifier {\n wes -> wes (string)\n type -> type (string)\n series -> series (string)\n number -> number (string)\n part -> parts[].part (string)\n year -> year (string)\n reaffirmed -> reaffirmed (string)\n language -> language (string)\n all_parts -> all_parts (string)\n amd_type -> amd_type (string)\n amd_number -> amd_number (string)\n amd_year -> amd_year (string)\n amd_reaffirmed -> amd_reaffirmed (string)\n expl_type -> expl_type (string)\n expl_number -> expl_number (string)\n corr_type -> corr_type (string)\n corr_number -> corr_number (string)\n corr_year -> corr_year (string)\n corr_reaffirmed -> corr_reaffirmed (string)\n symbol_present -> symbol_present (string)\n symbol_value -> symbol_value (string)\n }\n\n test {\n accept \"JIS B 0001\"\n accept \"JIS X 0208:1997\"\n accept \"WES 7700-1:2019\"\n accept \"WES 7301:2020R\"\n reject \"JIS WES 7700\"\n reject \"WES X 7700\"\n reject \"nonsense\"\n example \"WES 7700-1:2019\" { wes: \"WES\", number: \"7700\", year: \"2019\" }\n example \"WES 7301:2020R\" { wes: \"WES\", number: \"7301\", year: \"2020\", reaffirmed: \"R\" }\n example \"JIS X 0208:1997\" { series: \"X\", number: \"0208\", year: \"1997\" }\n example \"WES 7700:2019/AMD 1:2020R\" { wes: \"WES\", number: \"7700\", amd_type: \"AMD\", amd_number: \"1\", amd_year: \"2020\", amd_reaffirmed: \"R\" }\n example \"JIS X 0208:1997R\" { series: \"X\", year: \"1997\", reaffirmed: \"R\" }\n example \"JIS X 0208:1997RR\" { series: \"X\", year: \"1997\", reaffirmed: \"RR\" }\n }\n}\n","source_hash":"bb68f75e3e1d9b7e79613bd6cff60ccd77f6e2e68ace2569a2fbc968543b1f3d","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.3.121","edition":2,"semantics_hash":"sha256:b16cf5d2687fef91bb0c21ce6b417cf9d9dfcf9aec0280169acb246f48d6b22b","checksum":"sha256:156eb10c6a7638055e3ca2556c6bf62ecca6521b432c828269cdcbab080c44be"}
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"PubidJis","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":169}},{"Str":{"pattern":"WES"}},{"Named":{"name":"wes","atom":1}},{"Entity":{"atom":6}},{"Str":{"pattern":" "}},{"Str":{"pattern":" "}},{"Alternative":{"atoms":[4,5]}},{"Str":{"pattern":"TR"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[7,8]}},{"Named":{"name":"wes_type","atom":9}},{"Entity":{"atom":6}},{"Sequence":{"atoms":[10,11]}},{"Repetition":{"atom":12,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":18}},{"Entity":{"atom":16}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":15,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"number","atom":17}},{"Entity":{"atom":31}},{"Entity":{"atom":29}},{"Entity":{"atom":25}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"ー"}},{"Alternative":{"atoms":[22,23]}},{"Named":{"name":"dash","atom":24}},{"Entity":{"atom":16}},{"Repetition":{"atom":26,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"part","atom":27}},{"Sequence":{"atoms":[21,28]}},{"Repetition":{"atom":20,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"parts","atom":30}},{"Str":{"pattern":"("}},{"Str":{"pattern":"("}},{"Alternative":{"atoms":[32,33]}},{"Str":{"pattern":"E"}},{"Str":{"pattern":"J"}},{"Alternative":{"atoms":[35,36]}},{"Named":{"name":"wes_language","atom":37}},{"Str":{"pattern":")"}},{"Str":{"pattern":")"}},{"Alternative":{"atoms":[39,40]}},{"Entity":{"atom":45}},{"Str":{"pattern":":"}},{"Str":{"pattern":":"}},{"Alternative":{"atoms":[43,44]}},{"Lookahead":{"atom":42,"positive":true}},{"Sequence":{"atoms":[34,38,41,46]}},{"Repetition":{"atom":47,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":61}},{"Entity":{"atom":45}},{"Entity":{"atom":16}},{"Repetition":{"atom":51,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"year","atom":52}},{"Entity":{"atom":59}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"R"}},{"Repetition":{"atom":56,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[55,57]}},{"Named":{"name":"reaffirmed","atom":58}},{"Repetition":{"atom":54,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[50,53,60]}},{"Repetition":{"atom":49,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":74}},{"Str":{"pattern":"("}},{"Str":{"pattern":"("}},{"Alternative":{"atoms":[64,65]}},{"Str":{"pattern":"E"}},{"Str":{"pattern":"J"}},{"Alternative":{"atoms":[67,68]}},{"Named":{"name":"language","atom":69}},{"Str":{"pattern":")"}},{"Str":{"pattern":")"}},{"Alternative":{"atoms":[71,72]}},{"Sequence":{"atoms":[66,70,73]}},{"Repetition":{"atom":63,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":86}},{"Str":{"pattern":"("}},{"Str":{"pattern":"規格群"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[77,78,79]}},{"Str":{"pattern":"("}},{"Str":{"pattern":"規格群"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[81,82,83]}},{"Alternative":{"atoms":[80,84]}},{"Named":{"name":"all_parts","atom":85}},{"Repetition":{"atom":76,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":152}},{"Entity":{"atom":112}},{"Entity":{"atom":91}},{"Str":{"pattern":"/"}},{"Str":{"pattern":"AMENDMENT"}},{"Str":{"pattern":"AMD"}},{"Alternative":{"atoms":[92,93]}},{"Named":{"name":"amd_type","atom":94}},{"Entity":{"atom":6}},{"Entity":{"atom":16}},{"Repetition":{"atom":97,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"amd_number","atom":98}},{"Entity":{"atom":45}},{"Entity":{"atom":16}},{"Repetition":{"atom":101,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"amd_year","atom":102}},{"Sequence":{"atoms":[100,103]}},{"Repetition":{"atom":104,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"R"}},{"Repetition":{"atom":107,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[106,108]}},{"Named":{"name":"amd_reaffirmed","atom":109}},{"Repetition":{"atom":110,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[90,95,96,99,105,111]}},{"Named":{"name":"amendment","atom":89}},{"Entity":{"atom":126}},{"Entity":{"atom":91}},{"Str":{"pattern":"EXPLANATION"}},{"Str":{"pattern":"EXPL"}},{"Alternative":{"atoms":[116,117]}},{"Named":{"name":"expl_type","atom":118}},{"Entity":{"atom":6}},{"Entity":{"atom":16}},{"Repetition":{"atom":121,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"expl_number","atom":122}},{"Sequence":{"atoms":[120,123]}},{"Repetition":{"atom":124,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[115,119,125]}},{"Named":{"name":"explanation","atom":114}},{"Entity":{"atom":150}},{"Entity":{"atom":91}},{"Str":{"pattern":"CORRIGENDUM"}},{"Str":{"pattern":"CORR"}},{"Alternative":{"atoms":[130,131]}},{"Named":{"name":"corr_type","atom":132}},{"Entity":{"atom":6}},{"Entity":{"atom":16}},{"Repetition":{"atom":135,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"corr_number","atom":136}},{"Entity":{"atom":45}},{"Entity":{"atom":16}},{"Repetition":{"atom":139,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"corr_year","atom":140}},{"Sequence":{"atoms":[138,141]}},{"Repetition":{"atom":142,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"R"}},{"Repetition":{"atom":145,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[144,146]}},{"Named":{"name":"corr_reaffirmed","atom":147}},{"Repetition":{"atom":148,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[129,133,134,137,143,149]}},{"Named":{"name":"corrigendum","atom":128}},{"Alternative":{"atoms":[113,127,151]}},{"Repetition":{"atom":88,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":167}},{"Entity":{"atom":6}},{"Str":{"pattern":"SYMBOL"}},{"Named":{"name":"symbol_present","atom":156}},{"Entity":{"atom":6}},{"Entity":{"atom":162}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[160,161]}},{"Repetition":{"atom":159,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"symbol_value","atom":163}},{"Sequence":{"atoms":[158,164]}},{"Repetition":{"atom":165,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[155,157,166]}},{"Repetition":{"atom":154,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[2,3,13,14,19,48,62,75,87,153,168]}},{"Entity":{"atom":207}},{"Str":{"pattern":"JIS"}},{"Entity":{"atom":6}},{"Entity":{"atom":91}},{"Alternative":{"atoms":[172,173]}},{"Repetition":{"atom":174,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[171,175]}},{"Repetition":{"atom":176,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":186}},{"Str":{"pattern":"TR"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[179,180]}},{"Named":{"name":"type","atom":181}},{"Entity":{"atom":6}},{"Entity":{"atom":91}},{"Alternative":{"atoms":[183,184]}},{"Sequence":{"atoms":[182,185]}},{"Repetition":{"atom":178,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":6}},{"Repetition":{"atom":188,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":192}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Named":{"name":"series","atom":191}},{"Entity":{"atom":6}},{"Repetition":{"atom":193,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":18}},{"Entity":{"atom":31}},{"Entity":{"atom":61}},{"Repetition":{"atom":197,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":74}},{"Repetition":{"atom":199,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":86}},{"Repetition":{"atom":201,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":152}},{"Repetition":{"atom":203,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":167}},{"Repetition":{"atom":205,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[177,187,189,190,194,195,196,198,200,202,204,206]}},{"Alternative":{"atoms":[0,170]}}],"root":208},"bindings":[{"capture":"wes","path":"wes","type":"string","card":null,"preprocess":null},{"capture":"wes_type","path":"wes_type","type":"string","card":null,"preprocess":null},{"capture":"wes_language","path":"wes_language","type":"string","card":null,"preprocess":null},{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"series","path":"series","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"parts[].part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"reaffirmed","path":"reaffirmed","type":"string","card":null,"preprocess":null},{"capture":"language","path":"language","type":"string","card":null,"preprocess":null},{"capture":"all_parts","path":"all_parts","type":"string","card":null,"preprocess":null},{"capture":"amd_type","path":"amd_type","type":"string","card":null,"preprocess":null},{"capture":"amd_number","path":"amd_number","type":"string","card":null,"preprocess":null},{"capture":"amd_year","path":"amd_year","type":"string","card":null,"preprocess":null},{"capture":"amd_reaffirmed","path":"amd_reaffirmed","type":"string","card":null,"preprocess":null},{"capture":"expl_type","path":"expl_type","type":"string","card":null,"preprocess":null},{"capture":"expl_number","path":"expl_number","type":"string","card":null,"preprocess":null},{"capture":"corr_type","path":"corr_type","type":"string","card":null,"preprocess":null},{"capture":"corr_number","path":"corr_number","type":"string","card":null,"preprocess":null},{"capture":"corr_year","path":"corr_year","type":"string","card":null,"preprocess":null},{"capture":"corr_reaffirmed","path":"corr_reaffirmed","type":"string","card":null,"preprocess":null},{"capture":"symbol_present","path":"symbol_present","type":"string","card":null,"preprocess":null},{"capture":"symbol_value","path":"symbol_value","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule supplement: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule supplement: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule supplement: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule symbol_value_char: branches 1 and 2 are order-dependent (first set not statically known)","rule identifier: 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":"JIS B 0001","expect":{}},{"entry":"identifier","kind":"accept","input":"JIS X 0208:1997","expect":{}},{"entry":"identifier","kind":"accept","input":"WES 7700-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"WES 7301:2020R","expect":{}},{"entry":"identifier","kind":"reject","input":"JIS WES 7700","expect":{}},{"entry":"identifier","kind":"reject","input":"WES X 7700","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"example","input":"WES 7700-1:2019","expect":{"wes":"WES","number":"7700","year":"2019"}},{"entry":"identifier","kind":"example","input":"WES 7301:2020R","expect":{"wes":"WES","number":"7301","year":"2020","reaffirmed":"R"}},{"entry":"identifier","kind":"example","input":"JIS X 0208:1997","expect":{"series":"X","number":"0208","year":"1997"}},{"entry":"identifier","kind":"example","input":"WES 7700:2019/AMD 1:2020R","expect":{"wes":"WES","number":"7700","amd_type":"AMD","amd_number":"1","amd_year":"2020","amd_reaffirmed":"R"}},{"entry":"identifier","kind":"example","input":"JIS X 0208:1997R","expect":{"series":"X","year":"1997","reaffirmed":"R"}},{"entry":"identifier","kind":"example","input":"JIS X 0208:1997RR","expect":{"series":"X","year":"1997","reaffirmed":"RR"}},{"entry":"identifier","kind":"example","input":"WES 1112(E):2022","expect":{"wes":"WES","number":"1112","wes_language":"E","year":"2022"}},{"entry":"identifier","kind":"example","input":"WES TR 2032:2024","expect":{"wes":"WES","wes_type":"TR","number":"2032","year":"2024"}},{"entry":"identifier","kind":"example","input":"WES TS 2816(E):2015","expect":{"wes":"WES","wes_type":"TS","number":"2816","wes_language":"E","year":"2015"}},{"entry":"identifier","kind":"example","input":"WES TS 2816:2015","expect":{"wes":"WES","wes_type":"TS","number":"2816","year":"2015"}},{"entry":"identifier","kind":"example","input":"WES 3003(E):1995/AMENDMENT 1:2025","expect":{"wes_language":"E","year":"1995","amd_type":"AMENDMENT","amd_number":"1","amd_year":"2025"}},{"entry":"identifier","kind":"example","input":"WES 1112:2022(E)","expect":{"language":"E","year":"2022"}},{"entry":"identifier","kind":"example","input":"WES 1112(E)","expect":{"wes":"WES","number":"1112","language":"E"}},{"entry":"identifier","kind":"example","input":"JIS A 0001:1999/AMD 1:2000","expect":{"series":"A","number":"0001","year":"1999","amd_type":"AMD","amd_number":"1","amd_year":"2000"}},{"entry":"identifier","kind":"example","input":"JIS G 0558/AMD 1","expect":{"series":"G","number":"0558","amd_type":"AMD","amd_number":"1"}},{"entry":"identifier","kind":"example","input":"JIS B 3700-11:1996/CORRIGENDUM 1","expect":{"series":"B","number":"3700","year":"1996","corr_type":"CORRIGENDUM","corr_number":"1"}},{"entry":"identifier","kind":"example","input":"JIS B 3700-11:1996/CORRIGENDUM 1:2002","expect":{"series":"B","number":"3700","year":"1996","corr_type":"CORRIGENDUM","corr_number":"1","corr_year":"2002"}},{"entry":"identifier","kind":"reject","input":"JIS X 0208(E):1997","expect":{}},{"entry":"identifier","kind":"reject","input":"TR WES 2032","expect":{}},{"entry":"identifier","kind":"reject","input":"JIS TR WES 2032","expect":{}},{"entry":"identifier","kind":"reject","input":"WES TX 2032:2024","expect":{}},{"entry":"identifier","kind":"reject","input":"WES TR X 2032","expect":{}},{"entry":"identifier","kind":"reject","input":"JIS G 0558/AMD 1:","expect":{}},{"entry":"identifier","kind":"example","input":"WES TR 2032:2024","expect":{"wes":"WES","wes_type":"TR","number":"2032","year":"2024"}},{"entry":"identifier","kind":"example","input":"WES 1112(E):2022","expect":{"wes":"WES","number":"1112","wes_language":"E","year":"2022"}}],"docs":{},"source":"# Port of lib/pubid/jis/parser.rb — JIS identifiers with the Japanese\n# full-width separator tolerance (ー : ()), TR/TS prefixes, parts,\n# reaffirmed years, (E)/(J) language codes, 規格群 all-parts, AMD/EXPL/\n# CORR supplements, and the SYMBOL clause. WES (Japan Welding Engineering\n# Society) ids share the JIS tail but carry no series letter or JIS prefix.\n# A WES id can carry a TR/TS type after the root (`WES TR 2032:2024`) and\n# a language before the year (`WES 1112(E):2022`, bound as wes_language).\n\ngrammar PubidJis version \"0.1.0\" edition 2 {\n dash = (\"-\" / \"ー\") as dash\n space = (\" \" / \" \")\n colon = (\":\" / \":\")\n type_prefix = (\"TR\" / \"TS\") as type (space / slash)\n series = %x41-5A as series\n number = (1*digit) as number\n part = dash (1*digit) as part\n parts = (*part) as parts\n year = colon (1*digit) as year [reaffirmed_rule]\n language = (\"(\" / \"(\") (\"E\" / \"J\") as language (\")\" / \")\")\n all_parts = ((\"(\" \"規格群\" \")\") / (\"(\" \"規格群\" \")\")) as all_parts\n # A supplement's `:year[R]` tail is optional as ONE unit (colon and digits\n # together, as the base `year` rule is): a yearless amendment prints and\n # parses as \"…/AMD 1\", and a dangling colon with no year after it stays\n # rejected — the renderer never emits it (pubid#745).\n amendment = {\n slash (\"AMENDMENT\" / \"AMD\") as amd_type\n space\n (1*digit) as amd_number\n [(colon (1*digit) as amd_year)]\n [(\"R\" (*\"R\")) as amd_reaffirmed]\n }\n explanation = {\n slash (\"EXPLANATION\" / \"EXPL\") as expl_type\n ([space (1*digit) as expl_number])\n }\n corrigendum = {\n slash (\"CORRIGENDUM\" / \"CORR\") as corr_type\n space\n (1*digit) as corr_number\n [(colon (1*digit) as corr_year)]\n [(\"R\" (*\"R\")) as corr_reaffirmed]\n }\n supplement = {\n (amendment as amendment)\n / (explanation as explanation)\n / (corrigendum as corrigendum)\n }\n symbol_value_char = %x01-09 / %x0B-10FFFF\n symbol_clause = {\n space \"SYMBOL\" as symbol_present\n ([space (1*symbol_value_char) as symbol_value])\n }\n wes_identifier = {\n \"WES\" as wes\n space\n [(\"TR\" / \"TS\") as wes_type space]\n number\n parts\n [(\"(\" / \"(\") (\"E\" / \"J\") as wes_language (\")\" / \")\") &colon]\n [year]\n [language]\n [all_parts]\n [supplement]\n [symbol_clause]\n }\n jis_identifier = {\n [\"JIS\" [(space / slash)]]\n [type_prefix]\n [space]\n series\n [space]\n number\n parts\n [year]\n [language]\n [all_parts]\n [supplement]\n [symbol_clause]\n }\n identifier = wes_identifier / jis_identifier\n upper = %x41-5A\n digit = %x30-39\n slash = \"/\"\n reaffirmed_rule = (\"R\" (*\"R\")) as reaffirmed\n entry identifier: identifier\n\n # Typed model bindings: bound captures land on the consumer\n # builder's fields of the same name; repeated parts collect under\n # parts[].part.\n bindings identifier {\n wes -> wes (string)\n wes_type -> wes_type (string)\n wes_language -> wes_language (string)\n type -> type (string)\n series -> series (string)\n number -> number (string)\n part -> parts[].part (string)\n year -> year (string)\n reaffirmed -> reaffirmed (string)\n language -> language (string)\n all_parts -> all_parts (string)\n amd_type -> amd_type (string)\n amd_number -> amd_number (string)\n amd_year -> amd_year (string)\n amd_reaffirmed -> amd_reaffirmed (string)\n expl_type -> expl_type (string)\n expl_number -> expl_number (string)\n corr_type -> corr_type (string)\n corr_number -> corr_number (string)\n corr_year -> corr_year (string)\n corr_reaffirmed -> corr_reaffirmed (string)\n symbol_present -> symbol_present (string)\n symbol_value -> symbol_value (string)\n }\n\n test {\n accept \"JIS B 0001\"\n accept \"JIS X 0208:1997\"\n accept \"WES 7700-1:2019\"\n accept \"WES 7301:2020R\"\n reject \"JIS WES 7700\"\n reject \"WES X 7700\"\n reject \"nonsense\"\n example \"WES 7700-1:2019\" { wes: \"WES\", number: \"7700\", year: \"2019\" }\n example \"WES 7301:2020R\" { wes: \"WES\", number: \"7301\", year: \"2020\", reaffirmed: \"R\" }\n example \"JIS X 0208:1997\" { series: \"X\", number: \"0208\", year: \"1997\" }\n example \"WES 7700:2019/AMD 1:2020R\" { wes: \"WES\", number: \"7700\", amd_type: \"AMD\", amd_number: \"1\", amd_year: \"2020\", amd_reaffirmed: \"R\" }\n example \"JIS X 0208:1997R\" { series: \"X\", year: \"1997\", reaffirmed: \"R\" }\n example \"JIS X 0208:1997RR\" { series: \"X\", year: \"1997\", reaffirmed: \"RR\" }\n example \"WES 1112(E):2022\" { wes: \"WES\", number: \"1112\", wes_language: \"E\", year: \"2022\" }\n example \"WES TR 2032:2024\" { wes: \"WES\", wes_type: \"TR\", number: \"2032\", year: \"2024\" }\n example \"WES TS 2816(E):2015\" { wes: \"WES\", wes_type: \"TS\", number: \"2816\", wes_language: \"E\", year: \"2015\" }\n example \"WES TS 2816:2015\" { wes: \"WES\", wes_type: \"TS\", number: \"2816\", year: \"2015\" }\n example \"WES 3003(E):1995/AMENDMENT 1:2025\" { wes_language: \"E\", year: \"1995\", amd_type: \"AMENDMENT\", amd_number: \"1\", amd_year: \"2025\" }\n example \"WES 1112:2022(E)\" { language: \"E\", year: \"2022\" }\n example \"WES 1112(E)\" { wes: \"WES\", number: \"1112\", language: \"E\" }\n example \"JIS A 0001:1999/AMD 1:2000\" { series: \"A\", number: \"0001\", year: \"1999\", amd_type: \"AMD\", amd_number: \"1\", amd_year: \"2000\" }\n example \"JIS G 0558/AMD 1\" { series: \"G\", number: \"0558\", amd_type: \"AMD\", amd_number: \"1\" }\n example \"JIS B 3700-11:1996/CORRIGENDUM 1\" { series: \"B\", number: \"3700\", year: \"1996\", corr_type: \"CORRIGENDUM\", corr_number: \"1\" }\n example \"JIS B 3700-11:1996/CORRIGENDUM 1:2002\" { series: \"B\", number: \"3700\", year: \"1996\", corr_type: \"CORRIGENDUM\", corr_number: \"1\", corr_year: \"2002\" }\n reject \"JIS X 0208(E):1997\"\n reject \"TR WES 2032\"\n reject \"JIS TR WES 2032\"\n reject \"WES TX 2032:2024\"\n reject \"WES TR X 2032\"\n reject \"JIS G 0558/AMD 1:\"\n example \"WES TR 2032:2024\" { wes: \"WES\", wes_type: \"TR\", number: \"2032\", year: \"2024\" }\n example \"WES 1112(E):2022\" { wes: \"WES\", number: \"1112\", wes_language: \"E\", year: \"2022\" }\n }\n}\n","source_hash":"1983ff0aabd2b969cf75a7b97426d89bce448ab890109299e6d4539b938c6075","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.3.126","edition":2,"semantics_hash":"sha256:3331563969700a05cf40e876fc5a90038241b917bfa44ef5d92eee64e5ec096d","checksum":"sha256:779e2b2efa4fb691877397b5dccad7da6e02f552b4fc8bc710de37888a953f1e"}
|
data/lib/pubid/jis/CLAUDE.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# JIS flavor notes
|
|
2
2
|
|
|
3
|
+
## Yearless supplements print no colon (pubid#745)
|
|
4
|
+
|
|
5
|
+
- A supplement whose year is nil renders `…/AMD 1`, **not** `…/AMD 1:` —
|
|
6
|
+
the dangling colon was a form pubid's own grammar rejected, so the
|
|
7
|
+
year-omitted render of a parsed amendment could not re-parse (the class
|
|
8
|
+
relaton's JIS corpus fuzz kept harvesting; all 938 attested amendment
|
|
9
|
+
rows in relaton-data-jis carry a year, the yearless space is
|
|
10
|
+
fuzzer-only).
|
|
11
|
+
- **The grammar owns the shape**: the amendment/corrigendum tail is
|
|
12
|
+
`[(colon (1*digit) as amd_year)]` — colon and digits as ONE optional
|
|
13
|
+
unit, mirroring the base `[year]` rule. The bare trailing colon
|
|
14
|
+
(`…/AMD 1:`, full-width included) stays rejected, exactly as the base
|
|
15
|
+
face rejects `JIS G 0558:`. The reaffirmed run binds independently of
|
|
16
|
+
the year, so yearless `…/AMD 1R` reads.
|
|
17
|
+
- **`SupplementIdentifier#year_tail`** is the shared tail helper:
|
|
18
|
+
`":#{year_with_reaffirmation}"` when the year exists, a bare `"R"` for
|
|
19
|
+
a yearless reaffirmation, `""` otherwise. `Amendment`/`Corrigendum`
|
|
20
|
+
interpolate it after their notation. `Explanation` never prints a year
|
|
21
|
+
and is untouched.
|
|
22
|
+
- **The builder nil-safes the optional capture** (`data[:amd_year]&.to_i`,
|
|
23
|
+
not `.to_i`): with the year optional, a plain `.to_i` would fabricate
|
|
24
|
+
`year: 0` — a phantom year in the hash and a `…/AMD 1:0` render.
|
|
25
|
+
- The fuzz operation round-trips: `exclude(:year)` on a parsed yearful
|
|
26
|
+
amendment renders `…/AMD 1` and re-parses equal. Yearful faces are
|
|
27
|
+
byte-identical to the pre-#745 renders. Locked by
|
|
28
|
+
`spec/pubid/jis/yearless_supplement_spec.rb`.
|
|
29
|
+
|
|
3
30
|
## WES lives in the JIS flavor (relaton-jis#18)
|
|
4
31
|
|
|
5
32
|
- WES (Japan Welding Engineering Society) ids — `WES 7700-1:2019`,
|
|
@@ -13,10 +40,23 @@
|
|
|
13
40
|
`wes` capture, which the builder keys on. `JIS WES 7700` and `WES X 7700`
|
|
14
41
|
are rejected: the JIS prefix and a series letter belong only to JIS.
|
|
15
42
|
- **The artifact is vendored, not baked here.** `data/parg/jis.json` is a
|
|
16
|
-
verbatim copy of pubid/pubid-grammar `artifacts/jis.json` (
|
|
17
|
-
parsanol **1.3.
|
|
43
|
+
verbatim copy of pubid/pubid-grammar `artifacts/jis.json` (branch
|
|
44
|
+
`jis/745-yearless-amendment` `84e7804`, parsanol **1.3.126** under Ruby
|
|
45
|
+
**3.4.8** — the CI toolchain; the checksum covers the
|
|
46
|
+
`unicode_tables` stamp, so a bake under a different Ruby moves it).
|
|
47
|
+
Change the grammar there and copy the artifact back;
|
|
18
48
|
`spec/pubid/jis/parg_reaffirmed_spec.rb` pins its `source_hash`, so a local
|
|
19
|
-
rebake fails that spec.
|
|
49
|
+
rebake fails that spec. pubid-grammar CI regenerates the contracts at
|
|
50
|
+
parsanol 1.3.126 (`PARSANOL_VERSION` in its workflow), so a bake at the
|
|
51
|
+
runtime line (1.5.1.0) would fail its `contracts:check` — bake with the
|
|
52
|
+
CI pair and verify the stamp in-process (`scripts/bake-one.rb jis
|
|
53
|
+
1.3.126` forces it; `scripts/regen-contracts.rb` does NOT pin, set
|
|
54
|
+
`PARSANOL_RUBY` to the 1.3.126 gem's directory or it loads the newest
|
|
55
|
+
installed gem silently). The vendored artifact is now ahead of the old
|
|
56
|
+
1.3.121 bake: it also carries the grammar-side WES `TR`/`TS`/
|
|
57
|
+
`(E)`-before-year bindings (pubid-grammar `3d91384`), which the
|
|
58
|
+
`Parser.ingest` shim below masks — **deleting the shim is still open**
|
|
59
|
+
(behavior is identical on both paths; the specs cover it).
|
|
20
60
|
- **`reaffirmed` binds the whole run of R's** (`":1997R"` → `"R"`, `":1997RR"`
|
|
21
61
|
→ `"RR"`; same for `amd_reaffirmed`/`corr_reaffirmed`). The builder reads
|
|
22
62
|
each only for truth (`true if data[:reaffirmed]`), so `RR` renders as `R`.
|
data/lib/pubid/jis/builder.rb
CHANGED
|
@@ -98,7 +98,9 @@ module Pubid
|
|
|
98
98
|
Identifiers::Amendment.new(
|
|
99
99
|
base: base,
|
|
100
100
|
number: data[:amd_number].to_i,
|
|
101
|
-
year
|
|
101
|
+
# The year is optional in the grammar (pubid#745); a yearless
|
|
102
|
+
# amendment keeps year nil, never a fabricated 0.
|
|
103
|
+
year: data[:amd_year]&.to_i,
|
|
102
104
|
reaffirmed: (true if data[:amd_reaffirmed]),
|
|
103
105
|
)
|
|
104
106
|
end
|
|
@@ -119,7 +121,8 @@ module Pubid
|
|
|
119
121
|
Identifiers::Corrigendum.new(
|
|
120
122
|
base: base,
|
|
121
123
|
number: data[:corr_number].to_i,
|
|
122
|
-
year
|
|
124
|
+
# Optional year, as the amendment (pubid#745).
|
|
125
|
+
year: data[:corr_year]&.to_i,
|
|
123
126
|
reaffirmed: (true if data[:corr_reaffirmed]),
|
|
124
127
|
)
|
|
125
128
|
end
|
|
@@ -6,9 +6,10 @@ module Pubid
|
|
|
6
6
|
# Amendment identifier type
|
|
7
7
|
# Format: {base}/AMD {number}:{year}
|
|
8
8
|
# Example: JIS A 0001:1999/AMD 1:2000
|
|
9
|
+
# A yearless amendment prints no colon: {base}/AMD {number} (pubid#745).
|
|
9
10
|
class Amendment < SupplementIdentifier
|
|
10
11
|
def supplement_notation
|
|
11
|
-
"AMD #{number}
|
|
12
|
+
"AMD #{number}#{year_tail}"
|
|
12
13
|
end
|
|
13
14
|
end
|
|
14
15
|
end
|
|
@@ -6,9 +6,11 @@ module Pubid
|
|
|
6
6
|
# Corrigendum identifier type
|
|
7
7
|
# Format: {base}/CORRIGENDUM {number}:{year}
|
|
8
8
|
# Example: JIS B 3700-11:1996/CORRIGENDUM 1:2002
|
|
9
|
+
# A yearless corrigendum prints no colon:
|
|
10
|
+
# {base}/CORRIGENDUM {number} (pubid#745).
|
|
9
11
|
class Corrigendum < SupplementIdentifier
|
|
10
12
|
def supplement_notation
|
|
11
|
-
"CORRIGENDUM #{number}
|
|
13
|
+
"CORRIGENDUM #{number}#{year_tail}"
|
|
12
14
|
end
|
|
13
15
|
end
|
|
14
16
|
end
|
|
@@ -37,6 +37,21 @@ module Pubid
|
|
|
37
37
|
raise NotImplementedError, "Subclass must implement supplement_notation"
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# The ":year[R]" tail a supplement prints after its notation, or the
|
|
41
|
+
# bare "R" when it reaffirms without a year. A supplement with no
|
|
42
|
+
# year prints NO colon at all ("…/AMD 1", pubid#745) — a dangling
|
|
43
|
+
# ":" is a form the grammar rejects, and the renderer and the
|
|
44
|
+
# grammar must agree.
|
|
45
|
+
def year_tail
|
|
46
|
+
if year
|
|
47
|
+
":#{year_with_reaffirmation}"
|
|
48
|
+
elsif reaffirmed?
|
|
49
|
+
"R"
|
|
50
|
+
else
|
|
51
|
+
""
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
40
55
|
def ==(other)
|
|
41
56
|
return false unless other.instance_of?(self.class)
|
|
42
57
|
|
data/lib/pubid/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pubid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.40
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -1225,7 +1225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1225
1225
|
- !ruby/object:Gem::Version
|
|
1226
1226
|
version: '0'
|
|
1227
1227
|
requirements: []
|
|
1228
|
-
rubygems_version: 4.0.
|
|
1228
|
+
rubygems_version: 4.0.20
|
|
1229
1229
|
specification_version: 4
|
|
1230
1230
|
summary: The international publication identifier (PubID) library for Ruby.
|
|
1231
1231
|
test_files: []
|