pubid 2.0.40 → 2.0.41

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/data/parg/adobe.json +1 -1
  3. data/data/parg/aiee.json +1 -1
  4. data/data/parg/amca.json +1 -1
  5. data/data/parg/ansi.json +1 -1
  6. data/data/parg/api.json +1 -1
  7. data/data/parg/ashrae.json +1 -1
  8. data/data/parg/asme.json +1 -1
  9. data/data/parg/astm.json +1 -1
  10. data/data/parg/bipm.json +1 -1
  11. data/data/parg/bsi.json +1 -1
  12. data/data/parg/bsi_pfs.json +1 -1
  13. data/data/parg/calconnect.json +1 -1
  14. data/data/parg/calconnect_pfs.json +1 -1
  15. data/data/parg/ccsds.json +1 -1
  16. data/data/parg/cen_cenelec.json +1 -1
  17. data/data/parg/cen_pfs.json +1 -1
  18. data/data/parg/cie.json +1 -1
  19. data/data/parg/csa.json +1 -1
  20. data/data/parg/doi.json +1 -1
  21. data/data/parg/doi_pfs.json +1 -1
  22. data/data/parg/easc.json +1 -1
  23. data/data/parg/ecma.json +1 -1
  24. data/data/parg/etsi.json +1 -1
  25. data/data/parg/etsi_pfs.json +1 -1
  26. data/data/parg/evs.json +1 -1
  27. data/data/parg/gb.json +1 -1
  28. data/data/parg/gost.json +1 -1
  29. data/data/parg/iala.json +1 -1
  30. data/data/parg/iana.json +1 -1
  31. data/data/parg/idf.json +1 -1
  32. data/data/parg/iec.json +1 -1
  33. data/data/parg/ieee.json +1 -1
  34. data/data/parg/ietf.json +1 -1
  35. data/data/parg/iho.json +1 -1
  36. data/data/parg/ire.json +1 -1
  37. data/data/parg/isbn.json +1 -1
  38. data/data/parg/itu.json +1 -1
  39. data/data/parg/jcgm.json +1 -1
  40. data/data/parg/jis.json +1 -1
  41. data/data/parg/nesc.json +1 -1
  42. data/data/parg/nist.json +1 -1
  43. data/data/parg/oasis.json +1 -1
  44. data/data/parg/ogc.json +1 -1
  45. data/data/parg/oiml.json +1 -1
  46. data/data/parg/omg.json +1 -1
  47. data/data/parg/parg.json +1 -1
  48. data/data/parg/plateau.json +1 -1
  49. data/data/parg/sae.json +1 -1
  50. data/data/parg/tgpp.json +1 -1
  51. data/data/parg/un.json +1 -1
  52. data/data/parg/w3c.json +1 -1
  53. data/data/parg/xsf.json +1 -1
  54. data/lib/pubid/version.rb +1 -1
  55. metadata +1 -1
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":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"}
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.5.1.0","edition":2,"semantics_hash":"sha256:3331563969700a05cf40e876fc5a90038241b917bfa44ef5d92eee64e5ec096d","checksum":"sha256:b97ee1a6c24f21d44d3ec298b0a5b627ce4f8f3f9cf1fc26b8e7f240001da446","validated":{"lint_errors":0,"lint_warnings":5,"tests_total":32,"tests_failures":0,"self_test":true}}
data/data/parg/nesc.json CHANGED
@@ -1 +1 @@
1
- {"bindings":null,"version":"0.1.0","grammar":"PubidNesc","shape":"parsanol-tree/v2","binding_version":1,"entries":{"nesc_identifier":{"root":"nesc_identifier","grammar":{"atoms":[{"Entity":{"atom":44}},{"Str":{"pattern":"Draft"}},{"Named":{"name":"nesc_draft_marker","atom":1}},{"Entity":{"atom":4}},{"Str":{"pattern":" "}},{"Entity":{"atom":14}},{"Entity":{"atom":9}},{"Str":{"pattern":"National Electrical Safety Code"}},{"Str":{"pattern":"National Electric Safety Code"}},{"Alternative":{"atoms":[7,8]}},{"Named":{"name":"nesc_full_name","atom":6}},{"Entity":{"atom":12}},{"Str":{"pattern":"NESC"}},{"Named":{"name":"nesc_abbr","atom":11}},{"Alternative":{"atoms":[10,13]}},{"Entity":{"atom":16}},{"Str":{"pattern":"(R)"}},{"Named":{"name":"registered","atom":15}},{"Repetition":{"atom":17,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":20}},{"Str":{"pattern":","}},{"Named":{"name":"comma","atom":19}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[21,22]}},{"Entity":{"atom":38}},{"Str":{"pattern":"January"}},{"Str":{"pattern":"February"}},{"Str":{"pattern":"March"}},{"Str":{"pattern":"April"}},{"Str":{"pattern":"May"}},{"Str":{"pattern":"June"}},{"Str":{"pattern":"July"}},{"Str":{"pattern":"August"}},{"Str":{"pattern":"September"}},{"Str":{"pattern":"October"}},{"Str":{"pattern":"November"}},{"Str":{"pattern":"December"}},{"Alternative":{"atoms":[25,26,27,28,29,30,31,32,33,34,35,36]}},{"Named":{"name":"month","atom":37}},{"Entity":{"atom":4}},{"Entity":{"atom":41}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":40,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":42}},{"Sequence":{"atoms":[2,3,5,18,23,24,39,43]}},{"Entity":{"atom":79}},{"Str":{"pattern":"Preprint"}},{"Named":{"name":"preprint","atom":46}},{"Entity":{"atom":4}},{"Str":{"pattern":"Proposals"}},{"Str":{"pattern":"Proposal"}},{"Alternative":{"atoms":[49,50]}},{"Entity":{"atom":4}},{"Str":{"pattern":"for"}},{"Entity":{"atom":4}},{"Str":{"pattern":"the"}},{"Entity":{"atom":4}},{"Entity":{"atom":41}},{"Repetition":{"atom":57,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":58}},{"Entity":{"atom":4}},{"Str":{"pattern":"Edition"}},{"Entity":{"atom":4}},{"Str":{"pattern":"of"}},{"Entity":{"atom":4}},{"Str":{"pattern":"the"}},{"Entity":{"atom":4}},{"Entity":{"atom":9}},{"Named":{"name":"nesc_full_name","atom":67}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":12}},{"Named":{"name":"nesc_abbr","atom":71}},{"Entity":{"atom":16}},{"Named":{"name":"registered","atom":73}},{"Repetition":{"atom":74,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[69,70,72,75,76]}},{"Repetition":{"atom":77,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[47,48,51,52,53,54,55,56,59,60,61,62,63,64,65,66,68,78]}},{"Entity":{"atom":110}},{"Entity":{"atom":9}},{"Named":{"name":"nesc_full_name","atom":81}},{"Entity":{"atom":16}},{"Named":{"name":"registered","atom":83}},{"Repetition":{"atom":84,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[82,85]}},{"Entity":{"atom":20}},{"Named":{"name":"comma","atom":87}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[88,89]}},{"Entity":{"atom":93}},{"Str":{"pattern":"C2"}},{"Named":{"name":"code","atom":92}},{"Entity":{"atom":95}},{"Str":{"pattern":"-"}},{"Named":{"name":"dash","atom":94}},{"Entity":{"atom":41}},{"Repetition":{"atom":97,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":98}},{"Entity":{"atom":4}},{"Str":{"pattern":"-"}},{"Entity":{"atom":4}},{"Entity":{"atom":107}},{"Str":{"pattern":"Handbook"}},{"Str":{"pattern":"Redline"}},{"Alternative":{"atoms":[104,105]}},{"Named":{"name":"variant","atom":106}},{"Sequence":{"atoms":[100,101,102,103]}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[86,90,91,96,99,109]}},{"Entity":{"atom":142}},{"Entity":{"atom":93}},{"Entity":{"atom":114}},{"Str":{"pattern":"."}},{"Named":{"name":"dot","atom":113}},{"Entity":{"atom":41}},{"Repetition":{"atom":116,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":117}},{"Entity":{"atom":114}},{"Named":{"name":"dot","atom":119}},{"Sequence":{"atoms":[115,118,120]}},{"Entity":{"atom":95}},{"Named":{"name":"dash","atom":122}},{"Entity":{"atom":41}},{"Repetition":{"atom":124,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":125}},{"Entity":{"atom":95}},{"Named":{"name":"dash","atom":127}},{"Sequence":{"atoms":[123,126,128]}},{"Entity":{"atom":95}},{"Named":{"name":"dash","atom":130}},{"Entity":{"atom":41}},{"Repetition":{"atom":132,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":133}},{"Entity":{"atom":136}},{"Str":{"pattern":"/"}},{"Named":{"name":"slash","atom":135}},{"Sequence":{"atoms":[131,134,137]}},{"Alternative":{"atoms":[121,129,138]}},{"Str":{"pattern":"Preprint"}},{"Named":{"name":"preprint","atom":140}},{"Sequence":{"atoms":[112,139,141]}},{"Entity":{"atom":171}},{"Entity":{"atom":93}},{"Entity":{"atom":95}},{"Named":{"name":"dash","atom":145}},{"Entity":{"atom":41}},{"Repetition":{"atom":147,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":148}},{"Entity":{"atom":20}},{"Named":{"name":"comma","atom":150}},{"Repetition":{"atom":151,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[152,153]}},{"Repetition":{"atom":154,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":9}},{"Named":{"name":"nesc_full_name","atom":156}},{"Entity":{"atom":16}},{"Named":{"name":"registered","atom":158}},{"Repetition":{"atom":159,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":12}},{"Named":{"name":"nesc_abbr","atom":163}},{"Entity":{"atom":16}},{"Named":{"name":"registered","atom":165}},{"Repetition":{"atom":166,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[161,162,164,167,168]}},{"Repetition":{"atom":169,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[144,146,149,155,157,160,170]}},{"Entity":{"atom":223}},{"Entity":{"atom":41}},{"Repetition":{"atom":173,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":174}},{"Entity":{"atom":4}},{"Entity":{"atom":9}},{"Named":{"name":"full_name","atom":177}},{"Entity":{"atom":16}},{"Named":{"name":"name_registered","atom":179}},{"Repetition":{"atom":180,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":12}},{"Named":{"name":"paren_abbr","atom":184}},{"Entity":{"atom":16}},{"Named":{"name":"paren_registered","atom":186}},{"Repetition":{"atom":187,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[182,183,185,188,189]}},{"Repetition":{"atom":190,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[178,181,191]}},{"Entity":{"atom":12}},{"Named":{"name":"abbr","atom":193}},{"Entity":{"atom":16}},{"Named":{"name":"abbr_registered","atom":195}},{"Repetition":{"atom":196,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[194,197]}},{"Alternative":{"atoms":[192,198]}},{"Entity":{"atom":4}},{"Entity":{"atom":107}},{"Sequence":{"atoms":[200,201]}},{"Repetition":{"atom":202,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":20}},{"Named":{"name":"comma","atom":204}},{"Entity":{"atom":4}},{"Entity":{"atom":220}},{"Str":{"pattern":"Premier Edition"}},{"Str":{"pattern":"Second Edition"}},{"Str":{"pattern":"Third Edition"}},{"Str":{"pattern":"Fourth Edition"}},{"Str":{"pattern":"Fifth Edition"}},{"Str":{"pattern":"Sixth Edition"}},{"Str":{"pattern":"Seventh Edition"}},{"Str":{"pattern":"Eighth Edition"}},{"Str":{"pattern":"Ninth Edition"}},{"Str":{"pattern":"Tenth Edition"}},{"Str":{"pattern":"First Edition"}},{"Alternative":{"atoms":[208,209,210,211,212,213,214,215,216,217,218]}},{"Named":{"name":"edition","atom":219}},{"Sequence":{"atoms":[205,206,207]}},{"Repetition":{"atom":221,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[175,176,199,203,222]}},{"Alternative":{"atoms":[0,45,80,111,143,172]}}],"root":224},"bindings":[{"capture":"code","path":"code","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"full_name","path":"full_name","type":"string","card":null,"preprocess":null},{"capture":"name_registered","path":"name_registered","type":"string","card":null,"preprocess":null},{"capture":"paren_abbr","path":"paren_abbr","type":"string","card":null,"preprocess":null},{"capture":"paren_registered","path":"paren_registered","type":"string","card":null,"preprocess":null},{"capture":"abbr","path":"abbr","type":"string","card":null,"preprocess":null},{"capture":"abbr_registered","path":"abbr_registered","type":"string","card":null,"preprocess":null},{"capture":"variant","path":"variant","type":"string","card":null,"preprocess":null},{"capture":"edition","path":"edition","type":"string","card":null,"preprocess":null},{"capture":"month","path":"month","type":"string","card":null,"preprocess":null},{"capture":"preprint","path":"preprint","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule nesc_full_name: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule nesc_name: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule nesc_identifier: branches 4 and 5 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"nesc_identifier","render":{},"derive":{},"tests":[{"entry":"nesc_identifier","kind":"accept","input":"C2-2023 National Electrical Safety Code","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"2023 NESC","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"National Electrical Safety Code, C2-2017","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"Draft NESC, January 2016","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"C2.2012.Preprint","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"C2-2012-Preprint","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"C2-2002/Preprint","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"Preprint Proposal for the 2017 Edition of the National Electrical Safety Code","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"Preprint Proposals for the 2022 Edition of the National Electrical Safety Code (NESC(R))","expect":{}},{"entry":"nesc_identifier","kind":"reject","input":"nonsense","expect":{}}],"docs":{},"source":"# Port of lib/pubid/ieee/nesc/parser.rb — National Electrical Safety\n# Code designations: C2-year, year-first, name-first and Draft forms\n# with (R) marks, editions and variants. Consumed by the ieee grammar\n# via `use nesc`.\n#\n# Edition-2 notes: the year body (4digit — a bounded repetition of a\n# ref) inlines at every capture site, since a capture wrapping a\n# repetition ref expands to node lists inside the capture while the\n# inlined body binds as one scalar string. The month / edition /\n# variant captures stay on their rules — pure literal alternations\n# bind as spans — and the (R)/NESC abbreviation marks capture their\n# literal tokens directly.\n\ngrammar PubidNesc version \"0.1.0\" edition 2 {\n digit = %x30-39\n space = \" \"\n comma = \",\"\n dash = \"-\"\n dot = \".\"\n slash = \"/\"\n\n c2_code = \"C2\" as code\n nesc_full_name = \"National Electrical Safety Code\" / \"National Electric Safety Code\"\n nesc_abbr = \"NESC\"\n nesc_name = nesc_full_name / nesc_abbr\n registered = \"(R)\"\n edition = {\n (\n \"Premier Edition\"\n / \"Second Edition\"\n / \"Third Edition\"\n / \"Fourth Edition\"\n / \"Fifth Edition\"\n / \"Sixth Edition\"\n / \"Seventh Edition\"\n / \"Eighth Edition\"\n / \"Ninth Edition\"\n / \"Tenth Edition\"\n / \"First Edition\"\n ) as edition\n }\n variant = {\n (\"Handbook\" / \"Redline\") as variant\n }\n month = {\n (\n \"January\"\n / \"February\"\n / \"March\"\n / \"April\"\n / \"May\"\n / \"June\"\n / \"July\"\n / \"August\"\n / \"September\"\n / \"October\"\n / \"November\"\n / \"December\"\n ) as month\n }\n\n c2_standard = {\n (c2_code) (dash) ((4digit)) as year [([comma] space)] nesc_full_name\n [registered]\n [(space \"(\" (nesc_abbr) [(registered)] \")\")]\n }\n year_first = {\n ((4digit)) as year space\n (\n ((nesc_full_name)) as full_name [(registered) as name_registered]\n [(space \"(\" (nesc_abbr) as paren_abbr [(registered) as paren_registered] \")\")]\n / ((nesc_abbr)) as abbr [(registered) as abbr_registered]\n )\n [(space (variant))]\n [((comma space edition))]\n }\n name_first = {\n ((nesc_full_name [registered])) (comma space) c2_code (dash)\n ((4digit)) as year\n [((space \"-\" space (variant)))]\n }\n draft_nesc = {\n (\"Draft\") as nesc_draft_marker space nesc_name [registered] (comma space) (month) space\n ((4digit)) as year\n }\n # Preprint is a draft STAGE of the C2 code (NESC terminology for its\n # pre-edition drafts), not a variant: dotted is the canonical spelling\n # (C2.2012.Preprint); dash (C2-2012-Preprint) and the catalogue's\n # slash tail (C2-2002/Preprint) are aliases. The verbose\n # \"Preprint Proposal(s) for the YYYY Edition of ...\" forms cite the same\n # draft by its target edition year.\n c2_preprint = {\n c2_code\n (\n (dot ((4digit)) as year dot)\n / (dash ((4digit)) as year dash)\n / (dash ((4digit)) as year slash)\n )\n ((\"Preprint\")) as preprint\n }\n preprint_proposal = {\n ((\"Preprint\")) as preprint space (\"Proposals\" / \"Proposal\") space \"for\" space\n \"the\" space ((4digit)) as year space \"Edition\" space \"of\" space \"the\" space\n nesc_full_name\n [(space \"(\" (nesc_abbr) [registered] \")\")]\n }\n nesc_identifier = draft_nesc / preprint_proposal / name_first / c2_preprint / c2_standard / year_first\n\n entry nesc_identifier: nesc_identifier\n\n bindings nesc_identifier {\n code -> code (string)\n year -> year (string)\n full_name -> full_name (string)\n name_registered -> name_registered (string)\n paren_abbr -> paren_abbr (string)\n paren_registered -> paren_registered (string)\n abbr -> abbr (string)\n abbr_registered -> abbr_registered (string)\n variant -> variant (string)\n edition -> edition (string)\n month -> month (string)\n preprint -> preprint (string)\n }\n\n test {\n accept \"C2-2023 National Electrical Safety Code\"\n accept \"2023 NESC\"\n accept \"National Electrical Safety Code, C2-2017\"\n accept \"Draft NESC, January 2016\"\n accept \"C2.2012.Preprint\"\n accept \"C2-2012-Preprint\"\n accept \"C2-2002/Preprint\"\n accept \"Preprint Proposal for the 2017 Edition of the National Electrical Safety Code\"\n accept \"Preprint Proposals for the 2022 Edition of the National Electrical Safety Code (NESC(R))\"\n reject \"nonsense\"\n }\n}\n","source_hash":"e57b2445fd3b2f73eedab7c42cb26e901a214cdc440063785dca3831c8a07704","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.3.114","edition":2,"checksum":"sha256:6c4bd90aeca680e71e85e1e265666d5ccb61df8cc9e3e674d51147f2ba93f475"}
1
+ {"bindings":null,"version":"0.1.0","grammar":"PubidNesc","shape":"parsanol-tree/v2","binding_version":1,"entries":{"nesc_identifier":{"root":"nesc_identifier","grammar":{"atoms":[{"Entity":{"atom":42}},{"Str":{"pattern":"Draft"}},{"Named":{"name":"nesc_draft_marker","atom":1}},{"Entity":{"atom":4}},{"Str":{"pattern":" "}},{"Entity":{"atom":12}},{"Entity":{"atom":9}},{"Str":{"pattern":"National Electrical Safety Code"}},{"Str":{"pattern":"National Electric Safety Code"}},{"Alternative":{"atoms":[7,8]}},{"Entity":{"atom":11}},{"Str":{"pattern":"NESC"}},{"Alternative":{"atoms":[6,10]}},{"Named":{"name":"nesc_name","atom":5}},{"Entity":{"atom":15}},{"Str":{"pattern":"(R)"}},{"Repetition":{"atom":14,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":18}},{"Str":{"pattern":","}},{"Named":{"name":"comma","atom":17}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[19,20]}},{"Entity":{"atom":36}},{"Str":{"pattern":"January"}},{"Str":{"pattern":"February"}},{"Str":{"pattern":"March"}},{"Str":{"pattern":"April"}},{"Str":{"pattern":"May"}},{"Str":{"pattern":"June"}},{"Str":{"pattern":"July"}},{"Str":{"pattern":"August"}},{"Str":{"pattern":"September"}},{"Str":{"pattern":"October"}},{"Str":{"pattern":"November"}},{"Str":{"pattern":"December"}},{"Alternative":{"atoms":[23,24,25,26,27,28,29,30,31,32,33,34]}},{"Named":{"name":"month","atom":35}},{"Entity":{"atom":4}},{"Entity":{"atom":39}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":38,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":40}},{"Sequence":{"atoms":[2,3,13,16,21,22,37,41]}},{"Entity":{"atom":74}},{"Str":{"pattern":"Preprint"}},{"Named":{"name":"preprint","atom":44}},{"Entity":{"atom":4}},{"Str":{"pattern":"Proposals"}},{"Str":{"pattern":"Proposal"}},{"Alternative":{"atoms":[47,48]}},{"Entity":{"atom":4}},{"Str":{"pattern":"for"}},{"Entity":{"atom":4}},{"Str":{"pattern":"the"}},{"Entity":{"atom":4}},{"Entity":{"atom":39}},{"Repetition":{"atom":55,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":56}},{"Entity":{"atom":4}},{"Str":{"pattern":"Edition"}},{"Entity":{"atom":4}},{"Str":{"pattern":"of"}},{"Entity":{"atom":4}},{"Str":{"pattern":"the"}},{"Entity":{"atom":4}},{"Entity":{"atom":9}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":11}},{"Entity":{"atom":15}},{"Repetition":{"atom":69,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[66,67,68,70,71]}},{"Repetition":{"atom":72,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[45,46,49,50,51,52,53,54,57,58,59,60,61,62,63,64,65,73]}},{"Entity":{"atom":103}},{"Entity":{"atom":9}},{"Entity":{"atom":15}},{"Repetition":{"atom":77,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[76,78]}},{"Entity":{"atom":18}},{"Named":{"name":"comma","atom":80}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[81,82]}},{"Entity":{"atom":86}},{"Str":{"pattern":"C2"}},{"Named":{"name":"code","atom":85}},{"Entity":{"atom":88}},{"Str":{"pattern":"-"}},{"Named":{"name":"dash","atom":87}},{"Entity":{"atom":39}},{"Repetition":{"atom":90,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":91}},{"Entity":{"atom":4}},{"Str":{"pattern":"-"}},{"Entity":{"atom":4}},{"Entity":{"atom":100}},{"Str":{"pattern":"Handbook"}},{"Str":{"pattern":"Redline"}},{"Alternative":{"atoms":[97,98]}},{"Named":{"name":"variant","atom":99}},{"Sequence":{"atoms":[93,94,95,96]}},{"Repetition":{"atom":101,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[79,83,84,89,92,102]}},{"Entity":{"atom":135}},{"Entity":{"atom":86}},{"Entity":{"atom":107}},{"Str":{"pattern":"."}},{"Named":{"name":"dot","atom":106}},{"Entity":{"atom":39}},{"Repetition":{"atom":109,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":110}},{"Entity":{"atom":107}},{"Named":{"name":"dot","atom":112}},{"Sequence":{"atoms":[108,111,113]}},{"Entity":{"atom":88}},{"Named":{"name":"dash","atom":115}},{"Entity":{"atom":39}},{"Repetition":{"atom":117,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":118}},{"Entity":{"atom":88}},{"Named":{"name":"dash","atom":120}},{"Sequence":{"atoms":[116,119,121]}},{"Entity":{"atom":88}},{"Named":{"name":"dash","atom":123}},{"Entity":{"atom":39}},{"Repetition":{"atom":125,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":126}},{"Entity":{"atom":129}},{"Str":{"pattern":"/"}},{"Named":{"name":"slash","atom":128}},{"Sequence":{"atoms":[124,127,130]}},{"Alternative":{"atoms":[114,122,131]}},{"Str":{"pattern":"Preprint"}},{"Named":{"name":"preprint","atom":133}},{"Sequence":{"atoms":[105,132,134]}},{"Entity":{"atom":160}},{"Entity":{"atom":86}},{"Entity":{"atom":88}},{"Named":{"name":"dash","atom":138}},{"Entity":{"atom":39}},{"Repetition":{"atom":140,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":141}},{"Entity":{"atom":18}},{"Named":{"name":"comma","atom":143}},{"Repetition":{"atom":144,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[145,146]}},{"Repetition":{"atom":147,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":9}},{"Entity":{"atom":15}},{"Repetition":{"atom":150,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":11}},{"Entity":{"atom":15}},{"Repetition":{"atom":155,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[152,153,154,156,157]}},{"Repetition":{"atom":158,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[137,139,142,148,149,151,159]}},{"Entity":{"atom":212}},{"Entity":{"atom":39}},{"Repetition":{"atom":162,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":163}},{"Entity":{"atom":4}},{"Entity":{"atom":9}},{"Named":{"name":"full_name","atom":166}},{"Entity":{"atom":15}},{"Named":{"name":"name_registered","atom":168}},{"Repetition":{"atom":169,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":11}},{"Named":{"name":"paren_abbr","atom":173}},{"Entity":{"atom":15}},{"Named":{"name":"paren_registered","atom":175}},{"Repetition":{"atom":176,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[171,172,174,177,178]}},{"Repetition":{"atom":179,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[167,170,180]}},{"Entity":{"atom":11}},{"Named":{"name":"abbr","atom":182}},{"Entity":{"atom":15}},{"Named":{"name":"abbr_registered","atom":184}},{"Repetition":{"atom":185,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[183,186]}},{"Alternative":{"atoms":[181,187]}},{"Entity":{"atom":4}},{"Entity":{"atom":100}},{"Sequence":{"atoms":[189,190]}},{"Repetition":{"atom":191,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":18}},{"Named":{"name":"comma","atom":193}},{"Entity":{"atom":4}},{"Entity":{"atom":209}},{"Str":{"pattern":"Premier Edition"}},{"Str":{"pattern":"Second Edition"}},{"Str":{"pattern":"Third Edition"}},{"Str":{"pattern":"Fourth Edition"}},{"Str":{"pattern":"Fifth Edition"}},{"Str":{"pattern":"Sixth Edition"}},{"Str":{"pattern":"Seventh Edition"}},{"Str":{"pattern":"Eighth Edition"}},{"Str":{"pattern":"Ninth Edition"}},{"Str":{"pattern":"Tenth Edition"}},{"Str":{"pattern":"First Edition"}},{"Alternative":{"atoms":[197,198,199,200,201,202,203,204,205,206,207]}},{"Named":{"name":"edition","atom":208}},{"Sequence":{"atoms":[194,195,196]}},{"Repetition":{"atom":210,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[164,165,188,192,211]}},{"Alternative":{"atoms":[0,43,75,104,136,161]}}],"root":213},"bindings":[{"capture":"code","path":"code","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"full_name","path":"full_name","type":"string","card":null,"preprocess":null},{"capture":"name_registered","path":"name_registered","type":"string","card":null,"preprocess":null},{"capture":"paren_abbr","path":"paren_abbr","type":"string","card":null,"preprocess":null},{"capture":"paren_registered","path":"paren_registered","type":"string","card":null,"preprocess":null},{"capture":"abbr","path":"abbr","type":"string","card":null,"preprocess":null},{"capture":"abbr_registered","path":"abbr_registered","type":"string","card":null,"preprocess":null},{"capture":"variant","path":"variant","type":"string","card":null,"preprocess":null},{"capture":"edition","path":"edition","type":"string","card":null,"preprocess":null},{"capture":"month","path":"month","type":"string","card":null,"preprocess":null},{"capture":"preprint","path":"preprint","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule nesc_full_name: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule nesc_name: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule nesc_identifier: branches 4 and 5 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"nesc_identifier","render":{},"derive":{},"tests":[{"entry":"nesc_identifier","kind":"accept","input":"C2-2023 National Electrical Safety Code","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"2023 NESC","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"National Electrical Safety Code, C2-2017","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"Draft NESC, January 2016","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"C2.2012.Preprint","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"C2-2012-Preprint","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"C2-2002/Preprint","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"Preprint Proposal for the 2017 Edition of the National Electrical Safety Code","expect":{}},{"entry":"nesc_identifier","kind":"accept","input":"Preprint Proposals for the 2022 Edition of the National Electrical Safety Code (NESC(R))","expect":{}},{"entry":"nesc_identifier","kind":"reject","input":"nonsense","expect":{}}],"docs":{},"source":"# Port of lib/pubid/ieee/nesc/parser.rb — National Electrical Safety\n# Code designations: C2-year, year-first, name-first and Draft forms\n# with (R) marks, editions and variants. Consumed by the ieee grammar\n# via `use nesc`.\n#\n# Edition-2 notes: the year body (4digit — a bounded repetition of a\n# ref) inlines at every capture site, since a capture wrapping a\n# repetition ref expands to node lists inside the capture while the\n# inlined body binds as one scalar string. The month / edition /\n# variant captures stay on their rules — pure literal alternations\n# bind as spans — and the (R)/NESC abbreviation marks capture their\n# literal tokens directly.\n\ngrammar PubidNesc version \"0.1.0\" edition 2 {\n digit = %x30-39\n space = \" \"\n comma = \",\"\n dash = \"-\"\n dot = \".\"\n slash = \"/\"\n\n c2_code = \"C2\" as code\n nesc_full_name = \"National Electrical Safety Code\" / \"National Electric Safety Code\"\n nesc_abbr = \"NESC\"\n nesc_name = nesc_full_name / nesc_abbr\n registered = \"(R)\"\n edition = {\n (\n \"Premier Edition\"\n / \"Second Edition\"\n / \"Third Edition\"\n / \"Fourth Edition\"\n / \"Fifth Edition\"\n / \"Sixth Edition\"\n / \"Seventh Edition\"\n / \"Eighth Edition\"\n / \"Ninth Edition\"\n / \"Tenth Edition\"\n / \"First Edition\"\n ) as edition\n }\n variant = {\n (\"Handbook\" / \"Redline\") as variant\n }\n month = {\n (\n \"January\"\n / \"February\"\n / \"March\"\n / \"April\"\n / \"May\"\n / \"June\"\n / \"July\"\n / \"August\"\n / \"September\"\n / \"October\"\n / \"November\"\n / \"December\"\n ) as month\n }\n\n c2_standard = {\n (c2_code) (dash) ((4digit)) as year [([comma] space)] nesc_full_name\n [registered]\n [(space \"(\" (nesc_abbr) [(registered)] \")\")]\n }\n year_first = {\n ((4digit)) as year space\n (\n ((nesc_full_name)) as full_name [(registered) as name_registered]\n [(space \"(\" (nesc_abbr) as paren_abbr [(registered) as paren_registered] \")\")]\n / ((nesc_abbr)) as abbr [(registered) as abbr_registered]\n )\n [(space (variant))]\n [((comma space edition))]\n }\n name_first = {\n ((nesc_full_name [registered])) (comma space) c2_code (dash)\n ((4digit)) as year\n [((space \"-\" space (variant)))]\n }\n draft_nesc = {\n (\"Draft\") as nesc_draft_marker space nesc_name [registered] (comma space) (month) space\n ((4digit)) as year\n }\n # Preprint is a draft STAGE of the C2 code (NESC terminology for its\n # pre-edition drafts), not a variant: dotted is the canonical spelling\n # (C2.2012.Preprint); dash (C2-2012-Preprint) and the catalogue's\n # slash tail (C2-2002/Preprint) are aliases. The verbose\n # \"Preprint Proposal(s) for the YYYY Edition of ...\" forms cite the same\n # draft by its target edition year.\n c2_preprint = {\n c2_code\n (\n (dot ((4digit)) as year dot)\n / (dash ((4digit)) as year dash)\n / (dash ((4digit)) as year slash)\n )\n ((\"Preprint\")) as preprint\n }\n preprint_proposal = {\n ((\"Preprint\")) as preprint space (\"Proposals\" / \"Proposal\") space \"for\" space\n \"the\" space ((4digit)) as year space \"Edition\" space \"of\" space \"the\" space\n nesc_full_name\n [(space \"(\" (nesc_abbr) [registered] \")\")]\n }\n nesc_identifier = draft_nesc / preprint_proposal / name_first / c2_preprint / c2_standard / year_first\n\n entry nesc_identifier: nesc_identifier\n\n bindings nesc_identifier {\n code -> code (string)\n year -> year (string)\n full_name -> full_name (string)\n name_registered -> name_registered (string)\n paren_abbr -> paren_abbr (string)\n paren_registered -> paren_registered (string)\n abbr -> abbr (string)\n abbr_registered -> abbr_registered (string)\n variant -> variant (string)\n edition -> edition (string)\n month -> month (string)\n preprint -> preprint (string)\n }\n\n test {\n accept \"C2-2023 National Electrical Safety Code\"\n accept \"2023 NESC\"\n accept \"National Electrical Safety Code, C2-2017\"\n accept \"Draft NESC, January 2016\"\n accept \"C2.2012.Preprint\"\n accept \"C2-2012-Preprint\"\n accept \"C2-2002/Preprint\"\n accept \"Preprint Proposal for the 2017 Edition of the National Electrical Safety Code\"\n accept \"Preprint Proposals for the 2022 Edition of the National Electrical Safety Code (NESC(R))\"\n reject \"nonsense\"\n }\n}\n","source_hash":"e57b2445fd3b2f73eedab7c42cb26e901a214cdc440063785dca3831c8a07704","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:e987c554334e421574446497987a8ea75dc5fe2aeb343498ce1d2cd7ae1e5ccf","checksum":"sha256:e088dcc8060b9f97651f148d75b62c701395cca86694b03dbbef427444987ab4","validated":{"lint_errors":0,"lint_warnings":3,"tests_total":10,"tests_failures":0,"self_test":true}}