@pubid/pubid 0.1.3 → 0.1.4

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 (183) hide show
  1. package/artifact/corpus.json.gz +0 -0
  2. package/dist/conformance/cli.js +5 -1
  3. package/dist/flavors/amca/grammar.d.ts +4 -0
  4. package/dist/flavors/amca/grammar.js +87 -0
  5. package/dist/flavors/amca/index.d.ts +4 -0
  6. package/dist/flavors/amca/index.js +76 -0
  7. package/dist/flavors/amca/model.d.ts +29 -0
  8. package/dist/flavors/amca/model.js +146 -0
  9. package/dist/flavors/ansi/index.d.ts +24 -0
  10. package/dist/flavors/ansi/index.js +147 -0
  11. package/dist/flavors/api/grammar.d.ts +4 -0
  12. package/dist/flavors/api/grammar.js +79 -0
  13. package/dist/flavors/api/index.d.ts +4 -0
  14. package/dist/flavors/api/index.js +71 -0
  15. package/dist/flavors/api/model.d.ts +27 -0
  16. package/dist/flavors/api/model.js +114 -0
  17. package/dist/flavors/ashrae/grammar.d.ts +2 -0
  18. package/dist/flavors/ashrae/grammar.js +667 -0
  19. package/dist/flavors/ashrae/index.d.ts +4 -0
  20. package/dist/flavors/ashrae/index.js +306 -0
  21. package/dist/flavors/ashrae/model.d.ts +87 -0
  22. package/dist/flavors/ashrae/model.js +335 -0
  23. package/dist/flavors/ashrae/preprocessor.d.ts +7 -0
  24. package/dist/flavors/ashrae/preprocessor.js +44 -0
  25. package/dist/flavors/asme/grammar.d.ts +2 -0
  26. package/dist/flavors/asme/grammar.js +200 -0
  27. package/dist/flavors/asme/index.d.ts +4 -0
  28. package/dist/flavors/asme/index.js +138 -0
  29. package/dist/flavors/asme/model.d.ts +34 -0
  30. package/dist/flavors/asme/model.js +123 -0
  31. package/dist/flavors/astm/grammar.d.ts +2 -0
  32. package/dist/flavors/astm/grammar.js +110 -0
  33. package/dist/flavors/astm/index.d.ts +2 -0
  34. package/dist/flavors/astm/index.js +127 -0
  35. package/dist/flavors/astm/model.d.ts +42 -0
  36. package/dist/flavors/astm/model.js +263 -0
  37. package/dist/flavors/bipm/index.d.ts +30 -0
  38. package/dist/flavors/bipm/index.js +434 -0
  39. package/dist/flavors/bsi/grammar.d.ts +4 -0
  40. package/dist/flavors/bsi/grammar.js +535 -0
  41. package/dist/flavors/bsi/index.d.ts +4 -0
  42. package/dist/flavors/bsi/index.js +941 -0
  43. package/dist/flavors/bsi/model.d.ts +127 -0
  44. package/dist/flavors/bsi/model.js +863 -0
  45. package/dist/flavors/calconnect/index.d.ts +21 -0
  46. package/dist/flavors/calconnect/index.js +113 -0
  47. package/dist/flavors/cen_cenelec/grammar.d.ts +4 -0
  48. package/dist/flavors/cen_cenelec/grammar.js +107 -0
  49. package/dist/flavors/cen_cenelec/index.d.ts +5 -0
  50. package/dist/flavors/cen_cenelec/index.js +263 -0
  51. package/dist/flavors/cen_cenelec/model.d.ts +45 -0
  52. package/dist/flavors/cen_cenelec/model.js +490 -0
  53. package/dist/flavors/cie/grammar.d.ts +5 -0
  54. package/dist/flavors/cie/grammar.js +127 -0
  55. package/dist/flavors/cie/index.d.ts +2 -0
  56. package/dist/flavors/cie/index.js +311 -0
  57. package/dist/flavors/cie/model.d.ts +122 -0
  58. package/dist/flavors/cie/model.js +464 -0
  59. package/dist/flavors/csa/grammar.d.ts +6 -0
  60. package/dist/flavors/csa/grammar.js +239 -0
  61. package/dist/flavors/csa/index.d.ts +2 -0
  62. package/dist/flavors/csa/index.js +634 -0
  63. package/dist/flavors/csa/model.d.ts +33 -0
  64. package/dist/flavors/csa/model.js +505 -0
  65. package/dist/flavors/doi/index.d.ts +13 -0
  66. package/dist/flavors/doi/index.js +65 -0
  67. package/dist/flavors/easc/index.d.ts +4 -0
  68. package/dist/flavors/easc/index.js +107 -0
  69. package/dist/flavors/ecma/index.d.ts +4 -0
  70. package/dist/flavors/ecma/index.js +117 -0
  71. package/dist/flavors/etsi/index.d.ts +14 -0
  72. package/dist/flavors/etsi/index.js +307 -0
  73. package/dist/flavors/evs/grammar.d.ts +2 -0
  74. package/dist/flavors/evs/grammar.js +22 -0
  75. package/dist/flavors/evs/index.d.ts +2 -0
  76. package/dist/flavors/evs/index.js +24 -0
  77. package/dist/flavors/evs/model.d.ts +19 -0
  78. package/dist/flavors/evs/model.js +36 -0
  79. package/dist/flavors/gb/index.d.ts +24 -0
  80. package/dist/flavors/gb/index.js +111 -0
  81. package/dist/flavors/gost/grammar.d.ts +2 -0
  82. package/dist/flavors/gost/grammar.js +46 -0
  83. package/dist/flavors/gost/index.d.ts +2 -0
  84. package/dist/flavors/gost/index.js +165 -0
  85. package/dist/flavors/gost/model.d.ts +61 -0
  86. package/dist/flavors/gost/model.js +147 -0
  87. package/dist/flavors/gost/prefix_routes.d.ts +15 -0
  88. package/dist/flavors/gost/prefix_routes.js +192 -0
  89. package/dist/flavors/iala/index.d.ts +32 -0
  90. package/dist/flavors/iala/index.js +300 -0
  91. package/dist/flavors/iana/index.d.ts +19 -0
  92. package/dist/flavors/iana/index.js +71 -0
  93. package/dist/flavors/idf/grammar.d.ts +2 -0
  94. package/dist/flavors/idf/grammar.js +71 -0
  95. package/dist/flavors/idf/index.d.ts +2 -0
  96. package/dist/flavors/idf/index.js +100 -0
  97. package/dist/flavors/idf/model.d.ts +54 -0
  98. package/dist/flavors/idf/model.js +359 -0
  99. package/dist/flavors/iec/grammar.d.ts +3 -0
  100. package/dist/flavors/iec/grammar.js +187 -0
  101. package/dist/flavors/iec/index.d.ts +4 -0
  102. package/dist/flavors/iec/index.js +507 -0
  103. package/dist/flavors/iec/model.d.ts +54 -0
  104. package/dist/flavors/iec/model.js +437 -0
  105. package/dist/flavors/ieee/grammar.d.ts +2 -0
  106. package/dist/flavors/ieee/grammar.js +626 -0
  107. package/dist/flavors/ieee/index.d.ts +3 -0
  108. package/dist/flavors/ieee/index.js +1186 -0
  109. package/dist/flavors/ieee/model.d.ts +142 -0
  110. package/dist/flavors/ieee/model.js +1148 -0
  111. package/dist/flavors/ieee/preprocessor.d.ts +8 -0
  112. package/dist/flavors/ieee/preprocessor.js +410 -0
  113. package/dist/flavors/ieee/update_codes.d.ts +8 -0
  114. package/dist/flavors/ieee/update_codes.js +191 -0
  115. package/dist/flavors/ietf/index.d.ts +30 -0
  116. package/dist/flavors/ietf/index.js +151 -0
  117. package/dist/flavors/iho/index.d.ts +4 -0
  118. package/dist/flavors/iho/index.js +126 -0
  119. package/dist/flavors/index.d.ts +9 -0
  120. package/dist/flavors/index.js +136 -0
  121. package/dist/flavors/isbn/index.d.ts +13 -0
  122. package/dist/flavors/isbn/index.js +97 -0
  123. package/dist/flavors/iso/grammar.d.ts +2 -0
  124. package/dist/flavors/iso/grammar.js +207 -0
  125. package/dist/flavors/iso/index.d.ts +2 -0
  126. package/dist/flavors/iso/index.js +343 -0
  127. package/dist/flavors/iso/model.d.ts +159 -0
  128. package/dist/flavors/iso/model.js +802 -0
  129. package/dist/flavors/iso/stages.generated.d.ts +13 -0
  130. package/dist/flavors/iso/stages.generated.js +391 -0
  131. package/dist/flavors/itu/grammar.d.ts +4 -0
  132. package/dist/flavors/itu/grammar.js +205 -0
  133. package/dist/flavors/itu/index.d.ts +2 -0
  134. package/dist/flavors/itu/index.js +224 -0
  135. package/dist/flavors/itu/model.d.ts +184 -0
  136. package/dist/flavors/itu/model.js +599 -0
  137. package/dist/flavors/jcgm/index.d.ts +7 -0
  138. package/dist/flavors/jcgm/index.js +300 -0
  139. package/dist/flavors/jis/index.d.ts +4 -0
  140. package/dist/flavors/jis/index.js +267 -0
  141. package/dist/flavors/nist/grammar.d.ts +2 -0
  142. package/dist/flavors/nist/grammar.js +287 -0
  143. package/dist/flavors/nist/index.d.ts +2 -0
  144. package/dist/flavors/nist/index.js +1244 -0
  145. package/dist/flavors/nist/model.d.ts +155 -0
  146. package/dist/flavors/nist/model.js +823 -0
  147. package/dist/flavors/nist/preprocessor.d.ts +11 -0
  148. package/dist/flavors/nist/preprocessor.js +281 -0
  149. package/dist/flavors/oasis/index.d.ts +23 -0
  150. package/dist/flavors/oasis/index.js +110 -0
  151. package/dist/flavors/ogc/index.d.ts +20 -0
  152. package/dist/flavors/ogc/index.js +75 -0
  153. package/dist/flavors/oiml/grammar.d.ts +2 -0
  154. package/dist/flavors/oiml/grammar.js +180 -0
  155. package/dist/flavors/oiml/implementation.d.ts +9 -0
  156. package/dist/flavors/oiml/implementation.js +16 -0
  157. package/dist/flavors/oiml/model.d.ts +4 -0
  158. package/dist/flavors/oiml/model.js +462 -0
  159. package/dist/flavors/omg/index.d.ts +14 -0
  160. package/dist/flavors/omg/index.js +73 -0
  161. package/dist/flavors/plateau/index.d.ts +4 -0
  162. package/dist/flavors/plateau/index.js +97 -0
  163. package/dist/flavors/tgpp/index.d.ts +4 -0
  164. package/dist/flavors/tgpp/index.js +122 -0
  165. package/dist/flavors/un/index.d.ts +13 -0
  166. package/dist/flavors/un/index.js +90 -0
  167. package/dist/flavors/w3c/index.d.ts +14 -0
  168. package/dist/flavors/w3c/index.js +148 -0
  169. package/dist/flavors/xsf/index.d.ts +18 -0
  170. package/dist/flavors/xsf/index.js +65 -0
  171. package/dist/grammar/engine.d.ts +78 -0
  172. package/dist/grammar/engine.js +351 -0
  173. package/dist/model/attribute.d.ts +54 -0
  174. package/dist/model/attribute.js +53 -0
  175. package/dist/model/builder.d.ts +39 -0
  176. package/dist/model/builder.js +124 -0
  177. package/dist/model/component.d.ts +70 -0
  178. package/dist/model/component.js +170 -0
  179. package/dist/model/identifier.d.ts +83 -0
  180. package/dist/model/identifier.js +270 -0
  181. package/dist/model/urn-generator.d.ts +27 -0
  182. package/dist/model/urn-generator.js +91 -0
  183. package/package.json +1 -1
@@ -0,0 +1,187 @@
1
+ import { match, str } from "../../grammar/engine.js";
2
+ import { stageTokens } from "./model.js";
3
+ /**
4
+ * Port of lib/pubid/iec/ on the unified model — 12,334 corpus rows
5
+ * across 16 identifier types. The distinctive traits, all pinned against
6
+ * the Ruby reference:
7
+ * - typed stages: an abbreviation table (abbr -> {code, stageCode,
8
+ * typeCode}); "stage" serializes only the non-published stage CODE;
9
+ * type is derived from the stage's type_code.
10
+ * - positional URN: urn:iec:std:{authority}:{number-part-subpart}:{date}:
11
+ * {type[-stage]}:{deliverable|edition}:{language}[:adjuncts], with EMPTY
12
+ * segments kept (only a bare published "ser" series drops the language
13
+ * slot). Supplements contribute "plus"/token/number/date adjuncts.
14
+ * - supplements copy year/publisher/copublishers to their own hash level
15
+ * (Ruby delegates those reads to the base when unset; the wire shape
16
+ * equals copying base.publisher when it is not the IEC default).
17
+ */
18
+ function buildRules() {
19
+ const rules = {};
20
+ const rule = (name, build) => {
21
+ rules[name] = build();
22
+ };
23
+ const space = str(" ");
24
+ const spaceQ = space.maybe();
25
+ const dash = str("-").or(str("‑")).or(str("‐"));
26
+ const digits = match("[0-9]").repeat(1, Infinity);
27
+ const yearDigits = match("[0-9]").repeat(4, 4);
28
+ const monthDigits = match("[0-9]").repeat(2, 2);
29
+ const dayDigits = match("[0-9]").repeat(2, 2);
30
+ const alnumWD = match("[A-Za-z0-9]").repeat(1, Infinity);
31
+ // --- publishers ---
32
+ const PUBLISHERS = ["IECQ OD", "IECQ CS", "IEC CAB", "IEC CA", "IECRE", "CISPR", "IECEE", "IECEx", "IECQ", "IEC", "ISO"];
33
+ const ORGS = ["IEC", "ISO", "IEEE", "CIW", "SAE", "CIE", "ASME", "ASTM", "OECD", "HL7", "CEI", "UNDP"];
34
+ rule("prefix_sole_publisher", () => PUBLISHERS.reduce((acc, p) => acc.or(str(p)), str(PUBLISHERS[0])).as("publisher"));
35
+ rule("copublishers", () => str("/")
36
+ .then(spaceQ, ORGS.reduce((acc, o) => acc.or(str(o)), str(ORGS[0])).as("copublisher"))
37
+ .repeat(0, Infinity)
38
+ .as("copublishers"));
39
+ rule("prefix_with_copublishers", () => rules["prefix_sole_publisher"].then(spaceQ).then(rules["copublishers"].maybe()));
40
+ // --- numbers ---
41
+ rule("number", () =>
42
+ // DIR / VIM / SYMBOL / IECEx version / IECEE letter forms / digit runs
43
+ (str("DIR").then((space.then(match("[A-Z0-9]").repeat(1, Infinity))).repeat(0, Infinity)))
44
+ .or(str("VIM"))
45
+ .or(str("SYMBOL"))
46
+ .or(match("[0-9]").repeat(1, 6)
47
+ .then(str("v"), match("[0-9]").repeat(1, Infinity), match("[a-zA-Z]").repeat(0, Infinity), str("_").then(match("[a-zA-Z]").repeat(0, Infinity)).maybe()))
48
+ .or(
49
+ // The dash stays for part_and_subpart: "AD-001" -> number "AD",
50
+ // part "001" (the corpus-recorded split).
51
+ match("[A-Z]").repeat(2, 4).then(match("[A-Z0-9]").repeat(0, Infinity)))
52
+ .or(
53
+ // TRF comma-list numbers: "60950,60065A" is ONE number.
54
+ match("[0-9]").repeat(1, 6)
55
+ .then((str(",").then(match("[0-9]").repeat(1, 6))).repeat(0, Infinity))
56
+ .then(match("[a-zA-Z]").then(str("_").then(match("[a-zA-Z]").repeat(0, Infinity)).maybe()).maybe()))
57
+ .as("number"));
58
+ rule("part_and_subpart", () => (dash.or(str(",")))
59
+ .then(spaceQ)
60
+ .then(match("[\\w&_,]").repeat(1, Infinity).as("part"))
61
+ .then((dash.or(str(",")))
62
+ .then(spaceQ)
63
+ .then(match("[\\w&_,]").repeat(1, Infinity)
64
+ .then((dash.or(str(","))).then(match("[\\w&_,]").repeat(1, Infinity)).repeat(0, Infinity))
65
+ .as("subpart"))
66
+ .maybe()));
67
+ rule("number_with_part", () => rules["number"].then(rules["part_and_subpart"].maybe()).as("number_with_part"));
68
+ // --- date ---
69
+ rule("date", () => str(":").or(dash).then((str("--").or(str("—"))).as("undated_marker")
70
+ .or(yearDigits
71
+ .then(str("-").then(monthDigits).maybe())
72
+ .then(str("-").then(dayDigits).maybe())
73
+ .as("date"))));
74
+ // --- edition / iteration / languages / all parts ---
75
+ rule("edition", () => str("Edition").or(str("Ed."), str("ED"), str("Ed"))
76
+ .then(spaceQ)
77
+ .then(digits.then(str(".").then(digits).maybe()).maybe().as("edition")));
78
+ rule("stage_iteration", () => str(".").then(match("[0-9]").as("stage_iteration")));
79
+ rule("language", () => str("(").then((match("[a-z]").repeat(1, Infinity).then(str(",").maybe())
80
+ .or(match("[EFARDS]").then(str("/").maybe()))).repeat(1, Infinity).as("languages"), str(")")));
81
+ rule("all_parts", () => space.then(str("(all parts)")).as("all_parts"));
82
+ // --- typed stage token ---
83
+ const stageAbbrs = stageTokens().sort((a, b) => b.length - a.length);
84
+ rule("type_with_stage", () => stageAbbrs.reduce((acc, a) => acc.or(str(a)), str(stageAbbrs[0])).as("type_with_stage")
85
+ .then(match("[0-9]").as("stage_iteration").then(space).maybe()));
86
+ // --- supplements ---
87
+ const SUPP_ABBRS = [
88
+ "PRF Amd", "PWI Amd", "NP Amd", "ANW Amd", "WD Amd",
89
+ "PRF Cor", "PWI Cor", "NP Cor", "ANW Cor", "WD Cor", "CDCor", "WDCor",
90
+ "CDAM", "DAM", "FDAM", "DCOR", "FDCOR", "AMD", "Amd", "COR", "Cor", "ISH", "Ish",
91
+ ];
92
+ rule("supplement_type_with_stage", () => SUPP_ABBRS.reduce((acc, a) => acc.or(str(a)), str(SUPP_ABBRS[0]))
93
+ .or(str("FRAG"))
94
+ .as("type_with_stage"));
95
+ // --- sheets / fragments / VAP / database / consolidated ---
96
+ rule("sheet_notation", () => str("/").then(match("[0-9]").repeat(1, Infinity).as("sheet_number"), str(":"), yearDigits.as("sheet_year")));
97
+ rule("sheet_notation_no_year", () => str("/").then(match("[0-9]").repeat(1, Infinity).as("sheet_number")));
98
+ rule("fragment_notation", () => str("/").then((str("FRAGC").or(str("FRAG"))).as("fragment_type"), match("[0-9]").repeat(1, Infinity).as("fragment_number")));
99
+ const VAP_CODES = ["CSV", "CMV", "RLV", "SER", "EXV", "PAC", "PRV"];
100
+ rule("vap_code", () => VAP_CODES.reduce((acc, v) => acc.or(str(v)), str(VAP_CODES[0])));
101
+ rule("vap_suffix", () => space.then(rules["vap_code"].then(str("-").then(rules["vap_code"]).repeat(0, Infinity)).as("vap_suffix")));
102
+ rule("database_suffix", () => space.then(str("DB")).as("database"));
103
+ rule("consolidated_supplement", () => str("+").then((str("AMD").or(str("COR"))).as("supplement_type"), match("[0-9]").repeat(1, Infinity).as("supplement_number"), (str(":").then(yearDigits.as("supplement_year"))).maybe()));
104
+ rule("consolidated_supplements", () => rules["consolidated_supplement"].repeat(1, Infinity).as("consolidated_supplements"));
105
+ // --- second/third part ---
106
+ rule("trf_org_number", () => str("CISPR").then(space).as("trf_org").then(rules["number_with_part"]));
107
+ rule("second_part", () => (rules["trf_org_number"].or(rules["number_with_part"]))
108
+ .then(rules["stage_iteration"].maybe())
109
+ .then((spaceQ.then(rules["date"])).maybe())
110
+ .then(rules["consolidated_supplements"].maybe())
111
+ .then(rules["vap_suffix"].or(rules["database_suffix"]).maybe()));
112
+ rule("third_part_edition", () => spaceQ.then(rules["edition"]).maybe());
113
+ rule("third_part", () => rules["third_part_edition"]
114
+ .then(rules["language"].maybe())
115
+ .then(rules["fragment_notation"].maybe())
116
+ .then(rules["all_parts"].maybe()));
117
+ // --- working programme / working document / technical group ---
118
+ rule("wp_number", () => (match("[A-Za-z0-9]").repeat(1, Infinity).then(dash.then(match("[0-9]").repeat(1, Infinity)).repeat(0, Infinity))).as("wp_raw").or(rules["number_with_part"]));
119
+ rule("wp_type", () => (str("TR").or(str("TS"), str("SRD"))).then(space).maybe().as("wp_type"));
120
+ rule("working_programme", () => (str("PWI").or(str("PNW"))).as("wp_stage")
121
+ .then(space)
122
+ .then(rules["wp_type"])
123
+ .then(rules["wp_number"])
124
+ .then(space.then(rules["edition"]).maybe()));
125
+ rule("working_document", () => (str("JTC1-SC").then(match("[0-9]").repeat(1, Infinity))
126
+ .or(match("[A-Z]").repeat(1, Infinity).then(str("/"), match("[A-Z]").repeat(1, Infinity)))
127
+ .or(alnumWD)).as("technical_committee")
128
+ .then(str("/"), alnumWD.as("wd_number"))
129
+ .then(str("(").then(match("[A-Z]").as("wd_language"), str(")")).maybe())
130
+ .then(str("/").then(match("[A-Z]").repeat(1, Infinity).as("wd_stage")).maybe()));
131
+ rule("tc_body", () => str("CISPR")
132
+ .or(str("CIS").then(str("/"), match("[A-Z]")))
133
+ .or((str("JTC").or(str("JPC"), str("TC"), str("SC"), str("PC")))
134
+ .then(space, digits, match("[A-Z]").maybe())));
135
+ rule("sc_body", () => str("SC").then(space, digits, match("[A-Z]").maybe()));
136
+ rule("technical_group", () => rules["prefix_sole_publisher"].then(spaceQ).then(rules["copublishers"].maybe())
137
+ .then(space, rules["tc_body"].as("technical_committee"))
138
+ .then(str("/").then(spaceQ, rules["sc_body"]).as("subcommittee").maybe())
139
+ .or(rules["tc_body"].as("technical_committee")
140
+ .then(str("/").then(spaceQ, rules["sc_body"]).as("subcommittee").maybe())));
141
+ // --- the main single-document spine ---
142
+ rule("guide_prefix", () => str("Guide").or(str("GUIDE")));
143
+ rule("identifier_copublishers_no_third", () => rules["guide_prefix"].as("type_with_stage_fr").then(space).maybe()
144
+ .then(rules["prefix_with_copublishers"].maybe())
145
+ .then(spaceQ, str("/").maybe())
146
+ .then(rules["type_with_stage"].maybe())
147
+ .then(space.maybe())
148
+ .then(rules["second_part"])
149
+ .then(rules["third_part_edition"]));
150
+ rule("identifier_copublishers", () => rules["identifier_copublishers_no_third"].then(rules["third_part"]));
151
+ rule("sheet_identifier", () => rules["identifier_copublishers_no_third"].as("base")
152
+ .then(rules["sheet_notation"].or(rules["sheet_notation_no_year"])));
153
+ rule("sheet_supplement_identifier", () => rules["identifier_copublishers_no_third"].as("base")
154
+ .then(rules["sheet_notation"])
155
+ .then(str("/"), rules["supplement_type_with_stage"])
156
+ .then(spaceQ, rules["second_part"], rules["third_part"]));
157
+ rule("supplement_identifier_no_third", () => rules["identifier_copublishers_no_third"].as("base")
158
+ .then(str("/"), rules["supplement_type_with_stage"])
159
+ .then(spaceQ, rules["second_part"]));
160
+ rule("supplement_identifier", () => rules["supplement_identifier_no_third"].then(rules["third_part"]));
161
+ rule("supplement_supplement_identifier", () => rules["supplement_identifier_no_third"].as("base")
162
+ .then(str("/"), rules["supplement_type_with_stage"])
163
+ .then(spaceQ, rules["second_part"], rules["third_part"]));
164
+ rule("standalone_supplement", () => rules["prefix_with_copublishers"]
165
+ .then(str("/"), rules["supplement_type_with_stage"])
166
+ .then(space, rules["second_part"], rules["third_part"]));
167
+ rule("identifier", () => rules["working_programme"]
168
+ .or(rules["technical_group"])
169
+ .or(rules["working_document"])
170
+ .or(rules["sheet_supplement_identifier"])
171
+ .or(rules["sheet_identifier"])
172
+ .or(rules["supplement_supplement_identifier"])
173
+ .or(rules["standalone_supplement"])
174
+ .or(rules["supplement_identifier"])
175
+ .or(rules["identifier_copublishers"]));
176
+ rule("root", () => rules["identifier"]);
177
+ return rules;
178
+ }
179
+ // The parse preprocessor (Ruby Parser.parse): tab and ", Ed." normalization
180
+ // plus the IEV shorthand expansion.
181
+ export function preprocessIec(input) {
182
+ return input
183
+ .replaceAll("\t", " ")
184
+ .replace(/,\s+Ed\./, " Ed.")
185
+ .replace(/^IEV(?=$|[\s-])/, "IEC 60050");
186
+ }
187
+ export const iecGrammar = { rules: buildRules(), root: "root" };
@@ -0,0 +1,4 @@
1
+ import type { FlavorImplementation } from "../../conformance/implementation.js";
2
+ import { BaseIdentifier } from "../../model/identifier.js";
3
+ export declare function iecToUrn(identifier: BaseIdentifier): string;
4
+ export declare function iecGrammarImplementation(): FlavorImplementation;