@pubid/pubid 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifact/corpus.json.gz +0 -0
- package/dist/flavors/iec/index.js +12 -5
- package/dist/flavors/ieee/index.js +321 -113
- package/dist/flavors/ieee/model.d.ts +18 -0
- package/dist/flavors/ieee/model.js +62 -8
- package/dist/flavors/ieee/preprocessor.js +3 -0
- package/dist/flavors/ieee/update_codes.js +1 -1
- package/dist/flavors/iho/index.js +198 -35
- package/dist/flavors/jis/index.js +74 -2
- package/dist/flavors/nist/grammar.js +44 -16
- package/dist/flavors/nist/index.js +17 -2
- package/dist/urn/parsers.js +57 -20
- package/package.json +2 -2
- package/vendor/parg/adobe.json +1 -1
- package/vendor/parg/aiee.json +1 -1
- package/vendor/parg/amca.json +1 -1
- package/vendor/parg/ansi.json +1 -1
- package/vendor/parg/api.json +1 -1
- package/vendor/parg/ashrae.json +1 -1
- package/vendor/parg/asme.json +1 -1
- package/vendor/parg/astm.json +1 -1
- package/vendor/parg/bipm.json +1 -1
- package/vendor/parg/bsi.json +1 -1
- package/vendor/parg/calconnect.json +1 -1
- package/vendor/parg/ccsds.json +1 -1
- package/vendor/parg/cen_cenelec.json +1 -1
- package/vendor/parg/cie.json +1 -1
- package/vendor/parg/csa.json +1 -1
- package/vendor/parg/doi.json +1 -1
- package/vendor/parg/easc.json +1 -1
- package/vendor/parg/ecma.json +1 -1
- package/vendor/parg/etsi.json +1 -1
- package/vendor/parg/evs.json +1 -1
- package/vendor/parg/gb.json +1 -1
- package/vendor/parg/gost.json +1 -1
- package/vendor/parg/iala.json +1 -1
- package/vendor/parg/iana.json +1 -1
- package/vendor/parg/idf.json +1 -1
- package/vendor/parg/iec.json +1 -1
- package/vendor/parg/ieee.json +1 -29571
- package/vendor/parg/ietf.json +1 -1
- package/vendor/parg/iho.json +1 -0
- package/vendor/parg/ire.json +1 -1
- package/vendor/parg/isbn.json +1 -1
- package/vendor/parg/iso.json +1 -8510
- package/vendor/parg/itu.json +1 -1
- package/vendor/parg/jcgm.json +1 -1
- package/vendor/parg/jis.json +1 -1
- package/vendor/parg/nesc.json +1 -1
- package/vendor/parg/nist.json +1 -9588
- package/vendor/parg/oasis.json +1 -1
- package/vendor/parg/ogc.json +1 -1
- package/vendor/parg/oiml.json +1 -1
- package/vendor/parg/omg.json +1 -1
- package/vendor/parg/parg.json +1 -1
- package/vendor/parg/plateau.json +1 -1
- package/vendor/parg/sae.json +1 -1
- package/vendor/parg/tgpp.json +1 -1
- package/vendor/parg/un.json +1 -1
- package/vendor/parg/w3c.json +1 -1
- package/vendor/parg/xsf.json +1 -1
package/vendor/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":40}},{"Str":{"pattern":"Draft"}},{"Named":{"name":"draft","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]}},{"Entity":{"atom":14}},{"Str":{"pattern":"(R)"}},{"Repetition":{"atom":13,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":17}},{"Str":{"pattern":","}},{"Entity":{"atom":4}},{"Entity":{"atom":33}},{"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":[20,21,22,23,24,25,26,27,28,29,30,31]}},{"Named":{"name":"month","atom":32}},{"Entity":{"atom":4}},{"Entity":{"atom":38}},{"Entity":{"atom":37}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":36,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":35}},{"Sequence":{"atoms":[2,3,5,15,16,18,19,34,39]}},{"Entity":{"atom":71}},{"Str":{"pattern":"Preprint"}},{"Named":{"name":"preprint","atom":42}},{"Entity":{"atom":4}},{"Str":{"pattern":"Proposals"}},{"Str":{"pattern":"Proposal"}},{"Alternative":{"atoms":[45,46]}},{"Entity":{"atom":4}},{"Str":{"pattern":"for"}},{"Entity":{"atom":4}},{"Str":{"pattern":"the"}},{"Entity":{"atom":4}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":53}},{"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":14}},{"Repetition":{"atom":66,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[63,64,65,67,68]}},{"Repetition":{"atom":69,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[43,44,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,70]}},{"Entity":{"atom":96}},{"Entity":{"atom":9}},{"Entity":{"atom":14}},{"Repetition":{"atom":74,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[73,75]}},{"Entity":{"atom":17}},{"Entity":{"atom":4}},{"Entity":{"atom":81}},{"Str":{"pattern":"C2"}},{"Named":{"name":"code","atom":80}},{"Entity":{"atom":83}},{"Str":{"pattern":"-"}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":84}},{"Entity":{"atom":4}},{"Str":{"pattern":"-"}},{"Entity":{"atom":4}},{"Entity":{"atom":93}},{"Str":{"pattern":"Handbook"}},{"Str":{"pattern":"Redline"}},{"Alternative":{"atoms":[90,91]}},{"Named":{"name":"variant","atom":92}},{"Sequence":{"atoms":[86,87,88,89]}},{"Repetition":{"atom":94,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[76,77,78,79,82,85,95]}},{"Entity":{"atom":119}},{"Entity":{"atom":81}},{"Entity":{"atom":100}},{"Str":{"pattern":"."}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":101}},{"Entity":{"atom":100}},{"Sequence":{"atoms":[99,102,103]}},{"Entity":{"atom":83}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":106}},{"Entity":{"atom":83}},{"Sequence":{"atoms":[105,107,108]}},{"Entity":{"atom":83}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":111}},{"Entity":{"atom":114}},{"Str":{"pattern":"/"}},{"Sequence":{"atoms":[110,112,113]}},{"Alternative":{"atoms":[104,109,115]}},{"Str":{"pattern":"Preprint"}},{"Named":{"name":"preprint","atom":117}},{"Sequence":{"atoms":[98,116,118]}},{"Entity":{"atom":141}},{"Entity":{"atom":81}},{"Entity":{"atom":83}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":123}},{"Entity":{"atom":17}},{"Repetition":{"atom":125,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Sequence":{"atoms":[126,127]}},{"Repetition":{"atom":128,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":9}},{"Entity":{"atom":14}},{"Repetition":{"atom":131,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":11}},{"Entity":{"atom":14}},{"Repetition":{"atom":136,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[133,134,135,137,138]}},{"Repetition":{"atom":139,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[121,122,124,129,130,132,140]}},{"Entity":{"atom":191}},{"Entity":{"atom":38}},{"Named":{"name":"year","atom":143}},{"Entity":{"atom":4}},{"Entity":{"atom":9}},{"Named":{"name":"full_name","atom":146}},{"Entity":{"atom":14}},{"Named":{"name":"name_registered","atom":148}},{"Repetition":{"atom":149,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":4}},{"Str":{"pattern":"("}},{"Entity":{"atom":11}},{"Named":{"name":"paren_abbr","atom":153}},{"Entity":{"atom":14}},{"Named":{"name":"paren_registered","atom":155}},{"Repetition":{"atom":156,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[151,152,154,157,158]}},{"Repetition":{"atom":159,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[147,150,160]}},{"Entity":{"atom":11}},{"Named":{"name":"abbr","atom":162}},{"Entity":{"atom":14}},{"Named":{"name":"abbr_registered","atom":164}},{"Repetition":{"atom":165,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[163,166]}},{"Alternative":{"atoms":[161,167]}},{"Entity":{"atom":4}},{"Entity":{"atom":93}},{"Sequence":{"atoms":[169,170]}},{"Repetition":{"atom":171,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":17}},{"Entity":{"atom":4}},{"Entity":{"atom":188}},{"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":[176,177,178,179,180,181,182,183,184,185,186]}},{"Named":{"name":"edition","atom":187}},{"Sequence":{"atoms":[173,174,175]}},{"Repetition":{"atom":189,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[144,145,168,172,190]}},{"Alternative":{"atoms":[0,41,72,97,120,142]}}],"root":192},"bindings":[]}},"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\ngrammar PubidNesc version \"0.1.0\" {\n digit = %x30-39\n digits = 1*digit\n space = \" \"\n comma = \",\"\n dash = \"-\"\n dot = \".\"\n slash = \"/\"\n\n year = 4digit\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 = (\"Premier Edition\" / \"Second Edition\" / \"Third Edition\" / \"Fourth Edition\" / \"Fifth Edition\" / \"Sixth Edition\" / \"Seventh Edition\" / \"Eighth Edition\" / \"Ninth Edition\" / \"Tenth Edition\" / \"First Edition\") as edition\n variant = (\"Handbook\" / \"Redline\") as variant\n month = (\"January\" / \"February\" / \"March\" / \"April\" / \"May\" / \"June\" / \"July\" / \"August\" / \"September\" / \"October\" / \"November\" / \"December\") as month\n\n c2_standard = (c2_code dash (year) as year [([comma] space)] nesc_full_name [registered] [(space \"(\" nesc_abbr [registered] \")\")])\n year_first = ((year) as year) space (((nesc_full_name) as full_name [(registered) as name_registered] [(space \"(\" (nesc_abbr) as paren_abbr [(registered) as paren_registered] \")\")]) / (((nesc_abbr) as abbr [(registered) as abbr_registered]))) [(space variant)] [(comma space edition)]\n name_first = ((nesc_full_name [registered]) comma space c2_code dash (year) as year [(space \"-\" space variant)])\n draft_nesc = ((\"Draft\") as draft space nesc_name [registered] comma space (month) space (year) as year)\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 = (c2_code ((dot (year) as year dot) / (dash (year) as year dash) / (dash (year) as year slash)) (\"Preprint\") as preprint)\n preprint_proposal = ((\"Preprint\") as preprint space (\"Proposals\" / \"Proposal\") space \"for\" space \"the\" space (year) as year space \"Edition\" space \"of\" space \"the\" space nesc_full_name [(space \"(\" nesc_abbr [registered] \")\")])\n nesc_identifier = draft_nesc / preprint_proposal / name_first / c2_preprint / c2_standard / year_first\n\n entry nesc_identifier: nesc_identifier\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":"58ac46d819ea5536c482a64421d5b5fa91ce8d101c43e1d90a3faadf5b20b885","compiler_version":"1.3.93","checksum":"sha256:8daf92e631f01e17e6b5b1225281202ca69277d178e8ab92505a5b4a2567e13d"}
|
|
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.3.121","edition":2,"semantics_hash":"sha256:e987c554334e421574446497987a8ea75dc5fe2aeb343498ce1d2cd7ae1e5ccf","checksum":"sha256:d3c11dec5b18781d6f73ace9c3ddc12bc94072de90ea1762a927b4d18d215771"}
|