@pubid/pubid 0.1.71 → 0.1.73

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 (444) hide show
  1. package/README.md +22 -4
  2. package/artifact/corpus.json.gz +0 -0
  3. package/dist/flavors/ansi/generated/substrate.d.ts +78 -0
  4. package/dist/flavors/ansi/generated/substrate.js +105 -0
  5. package/dist/flavors/ansi/implementation.d.ts +5 -0
  6. package/dist/flavors/ansi/implementation.js +125 -0
  7. package/dist/flavors/ansi/index.js +14 -117
  8. package/dist/flavors/api/generated/substrate.d.ts +78 -0
  9. package/dist/flavors/api/generated/substrate.js +105 -0
  10. package/dist/flavors/api/grammar.worker.d.ts +6 -0
  11. package/dist/flavors/api/{grammar.js → grammar.worker.js} +60 -16
  12. package/dist/flavors/api/implementation.d.ts +11 -0
  13. package/dist/flavors/api/implementation.js +106 -0
  14. package/dist/flavors/api/index.d.ts +1 -3
  15. package/dist/flavors/api/index.js +14 -98
  16. package/dist/flavors/arxiv/generated/substrate.d.ts +75 -0
  17. package/dist/flavors/arxiv/generated/substrate.js +102 -0
  18. package/dist/flavors/arxiv/index.js +17 -11
  19. package/dist/flavors/ashrae/generated/substrate.d.ts +78 -0
  20. package/dist/flavors/ashrae/generated/substrate.js +105 -0
  21. package/dist/flavors/ashrae/grammar.worker.d.ts +6 -0
  22. package/dist/flavors/ashrae/{grammar.js → grammar.worker.js} +76 -39
  23. package/dist/flavors/ashrae/implementation.d.ts +7 -0
  24. package/dist/flavors/ashrae/implementation.js +316 -0
  25. package/dist/flavors/ashrae/index.d.ts +1 -3
  26. package/dist/flavors/ashrae/index.js +14 -304
  27. package/dist/flavors/asme/generated/substrate.d.ts +78 -0
  28. package/dist/flavors/asme/generated/substrate.js +105 -0
  29. package/dist/flavors/asme/grammar.worker.d.ts +6 -0
  30. package/dist/flavors/asme/{grammar.js → grammar.worker.js} +41 -2
  31. package/dist/flavors/asme/implementation.d.ts +7 -0
  32. package/dist/flavors/asme/implementation.js +152 -0
  33. package/dist/flavors/asme/index.d.ts +1 -3
  34. package/dist/flavors/asme/index.js +14 -136
  35. package/dist/flavors/astm/generated/substrate.d.ts +78 -0
  36. package/dist/flavors/astm/generated/substrate.js +105 -0
  37. package/dist/flavors/astm/grammar.worker.d.ts +6 -0
  38. package/dist/flavors/astm/{grammar.js → grammar.worker.js} +39 -5
  39. package/dist/flavors/astm/implementation.d.ts +6 -0
  40. package/dist/flavors/astm/implementation.js +135 -0
  41. package/dist/flavors/astm/index.js +14 -125
  42. package/dist/flavors/bipm/generated/substrate.d.ts +78 -0
  43. package/dist/flavors/bipm/generated/substrate.js +105 -0
  44. package/dist/flavors/bipm/grammar.worker.d.ts +6 -0
  45. package/dist/flavors/bipm/grammar.worker.js +180 -0
  46. package/dist/flavors/bipm/implementation.d.ts +6 -0
  47. package/dist/flavors/bipm/implementation.js +244 -0
  48. package/dist/flavors/bipm/index.d.ts +1 -28
  49. package/dist/flavors/bipm/index.js +16 -650
  50. package/dist/flavors/bipm/model.d.ts +80 -0
  51. package/dist/flavors/bipm/model.js +271 -0
  52. package/dist/flavors/bipm/worker.d.ts +2 -0
  53. package/dist/flavors/bipm/worker.js +19 -0
  54. package/dist/flavors/bsi/generated/substrate.d.ts +78 -0
  55. package/dist/flavors/bsi/generated/substrate.js +105 -0
  56. package/dist/flavors/bsi/grammar.worker.d.ts +6 -0
  57. package/dist/flavors/bsi/{grammar.js → grammar.worker.js} +36 -7
  58. package/dist/flavors/bsi/implementation.d.ts +12 -0
  59. package/dist/flavors/bsi/implementation.js +967 -0
  60. package/dist/flavors/bsi/index.d.ts +1 -3
  61. package/dist/flavors/bsi/index.js +15 -940
  62. package/dist/flavors/bsi/model.js +16 -0
  63. package/dist/flavors/bsi/worker.js +11 -4
  64. package/dist/flavors/bsi_pfs/index.d.ts +25 -0
  65. package/dist/flavors/bsi_pfs/index.js +73 -10
  66. package/dist/flavors/calconnect/generated/substrate.d.ts +75 -0
  67. package/dist/flavors/calconnect/generated/substrate.js +102 -0
  68. package/dist/flavors/calconnect/grammar.worker.d.ts +6 -0
  69. package/dist/flavors/calconnect/grammar.worker.js +60 -0
  70. package/dist/flavors/calconnect/implementation.d.ts +6 -0
  71. package/dist/flavors/calconnect/implementation.js +69 -0
  72. package/dist/flavors/calconnect/index.d.ts +1 -19
  73. package/dist/flavors/calconnect/index.js +15 -111
  74. package/dist/flavors/calconnect/model.d.ts +26 -0
  75. package/dist/flavors/calconnect/model.js +52 -0
  76. package/dist/flavors/ccsds/generated/substrate.d.ts +75 -0
  77. package/dist/flavors/ccsds/generated/substrate.js +102 -0
  78. package/dist/flavors/ccsds/implementation.d.ts +5 -0
  79. package/dist/flavors/ccsds/implementation.js +67 -0
  80. package/dist/flavors/ccsds/index.js +13 -57
  81. package/dist/flavors/cen_cenelec/generated/substrate.d.ts +78 -0
  82. package/dist/flavors/cen_cenelec/generated/substrate.js +105 -0
  83. package/dist/flavors/cen_cenelec/grammar.worker.d.ts +6 -0
  84. package/dist/flavors/cen_cenelec/{grammar.js → grammar.worker.js} +41 -13
  85. package/dist/flavors/cen_cenelec/implementation.d.ts +15 -0
  86. package/dist/flavors/cen_cenelec/implementation.js +322 -0
  87. package/dist/flavors/cen_cenelec/index.d.ts +2 -4
  88. package/dist/flavors/cen_cenelec/index.js +16 -286
  89. package/dist/flavors/cen_cenelec/model.js +16 -1
  90. package/dist/flavors/cen_cenelec/worker.js +10 -4
  91. package/dist/flavors/cen_pfs/index.d.ts +5 -0
  92. package/dist/flavors/cen_pfs/index.js +28 -2
  93. package/dist/flavors/cie/generated/substrate.d.ts +78 -0
  94. package/dist/flavors/cie/generated/substrate.js +105 -0
  95. package/dist/flavors/cie/grammar.worker.d.ts +6 -0
  96. package/dist/flavors/cie/{grammar.js → grammar.worker.js} +71 -18
  97. package/dist/flavors/cie/implementation.d.ts +9 -0
  98. package/dist/flavors/cie/implementation.js +331 -0
  99. package/dist/flavors/cie/index.js +14 -309
  100. package/dist/flavors/csa/generated/substrate.d.ts +78 -0
  101. package/dist/flavors/csa/generated/substrate.js +105 -0
  102. package/dist/flavors/csa/grammar.worker.d.ts +12 -0
  103. package/dist/flavors/csa/{grammar.js → grammar.worker.js} +143 -27
  104. package/dist/flavors/csa/implementation.d.ts +9 -0
  105. package/dist/flavors/csa/implementation.js +661 -0
  106. package/dist/flavors/csa/index.js +14 -631
  107. package/dist/flavors/csa/worker.js +10 -4
  108. package/dist/flavors/easc/generated/substrate.d.ts +75 -0
  109. package/dist/flavors/easc/generated/substrate.js +102 -0
  110. package/dist/flavors/easc/grammar.worker.d.ts +6 -0
  111. package/dist/flavors/easc/grammar.worker.js +66 -0
  112. package/dist/flavors/easc/implementation.d.ts +6 -0
  113. package/dist/flavors/easc/implementation.js +58 -0
  114. package/dist/flavors/easc/index.d.ts +1 -2
  115. package/dist/flavors/easc/index.js +15 -105
  116. package/dist/flavors/easc/model.d.ts +10 -0
  117. package/dist/flavors/easc/model.js +43 -0
  118. package/dist/flavors/ecma/generated/substrate.d.ts +75 -0
  119. package/dist/flavors/ecma/generated/substrate.js +102 -0
  120. package/dist/flavors/ecma/grammar.worker.d.ts +6 -0
  121. package/dist/flavors/ecma/grammar.worker.js +63 -0
  122. package/dist/flavors/ecma/implementation.d.ts +6 -0
  123. package/dist/flavors/ecma/implementation.js +95 -0
  124. package/dist/flavors/ecma/index.d.ts +1 -2
  125. package/dist/flavors/ecma/index.js +15 -152
  126. package/dist/flavors/ecma/model.d.ts +10 -0
  127. package/dist/flavors/ecma/model.js +61 -0
  128. package/dist/flavors/etsi/generated/substrate.d.ts +75 -0
  129. package/dist/flavors/etsi/generated/substrate.js +102 -0
  130. package/dist/flavors/etsi/grammar.worker.d.ts +6 -0
  131. package/dist/flavors/etsi/grammar.worker.js +86 -0
  132. package/dist/flavors/etsi/implementation.d.ts +6 -0
  133. package/dist/flavors/etsi/implementation.js +110 -0
  134. package/dist/flavors/etsi/index.d.ts +2 -12
  135. package/dist/flavors/etsi/index.js +16 -305
  136. package/dist/flavors/etsi/model.d.ts +37 -0
  137. package/dist/flavors/etsi/model.js +169 -0
  138. package/dist/flavors/eu/generated/substrate.d.ts +75 -0
  139. package/dist/flavors/eu/generated/substrate.js +102 -0
  140. package/dist/flavors/eu/implementation.d.ts +7 -0
  141. package/dist/flavors/eu/implementation.js +150 -0
  142. package/dist/flavors/eu/index.js +14 -141
  143. package/dist/flavors/evs/generated/substrate.d.ts +78 -0
  144. package/dist/flavors/evs/generated/substrate.js +105 -0
  145. package/dist/flavors/evs/grammar.worker.d.ts +6 -0
  146. package/dist/flavors/evs/grammar.worker.js +98 -0
  147. package/dist/flavors/evs/implementation.d.ts +7 -0
  148. package/dist/flavors/evs/implementation.js +114 -0
  149. package/dist/flavors/evs/index.d.ts +1 -1
  150. package/dist/flavors/evs/index.js +14 -89
  151. package/dist/flavors/evs/worker.js +10 -4
  152. package/dist/flavors/gb/generated/substrate.d.ts +75 -0
  153. package/dist/flavors/gb/generated/substrate.js +102 -0
  154. package/dist/flavors/gb/grammar.worker.d.ts +6 -0
  155. package/dist/flavors/gb/grammar.worker.js +73 -0
  156. package/dist/flavors/gb/implementation.d.ts +6 -0
  157. package/dist/flavors/gb/implementation.js +87 -0
  158. package/dist/flavors/gb/index.d.ts +1 -29
  159. package/dist/flavors/gb/index.js +15 -157
  160. package/dist/flavors/gb/model.d.ts +36 -0
  161. package/dist/flavors/gb/model.js +79 -0
  162. package/dist/flavors/gost/generated/substrate.d.ts +78 -0
  163. package/dist/flavors/gost/generated/substrate.js +105 -0
  164. package/dist/flavors/gost/grammar.worker.d.ts +6 -0
  165. package/dist/flavors/gost/grammar.worker.js +82 -0
  166. package/dist/flavors/gost/implementation.d.ts +7 -0
  167. package/dist/flavors/gost/implementation.js +177 -0
  168. package/dist/flavors/gost/index.js +14 -162
  169. package/dist/flavors/gost/worker.js +12 -5
  170. package/dist/flavors/iala/generated/substrate.d.ts +78 -0
  171. package/dist/flavors/iala/generated/substrate.js +105 -0
  172. package/dist/flavors/iala/grammar.worker.d.ts +6 -0
  173. package/dist/flavors/iala/grammar.worker.js +127 -0
  174. package/dist/flavors/iala/implementation.d.ts +6 -0
  175. package/dist/flavors/iala/implementation.js +250 -0
  176. package/dist/flavors/iala/index.d.ts +1 -56
  177. package/dist/flavors/iala/index.js +17 -484
  178. package/dist/flavors/iala/model.d.ts +93 -0
  179. package/dist/flavors/iala/model.js +194 -0
  180. package/dist/flavors/iana/generated/substrate.d.ts +75 -0
  181. package/dist/flavors/iana/generated/substrate.js +102 -0
  182. package/dist/flavors/iana/grammar.worker.d.ts +6 -0
  183. package/dist/flavors/iana/grammar.worker.js +51 -0
  184. package/dist/flavors/iana/implementation.d.ts +6 -0
  185. package/dist/flavors/iana/implementation.js +47 -0
  186. package/dist/flavors/iana/index.d.ts +1 -17
  187. package/dist/flavors/iana/index.js +15 -69
  188. package/dist/flavors/iana/model.d.ts +22 -0
  189. package/dist/flavors/iana/model.js +33 -0
  190. package/dist/flavors/idf/generated/substrate.d.ts +78 -0
  191. package/dist/flavors/idf/generated/substrate.js +105 -0
  192. package/dist/flavors/idf/grammar.worker.d.ts +6 -0
  193. package/dist/flavors/idf/{grammar.js → grammar.worker.js} +58 -2
  194. package/dist/flavors/idf/implementation.d.ts +6 -0
  195. package/dist/flavors/idf/implementation.js +129 -0
  196. package/dist/flavors/idf/index.js +14 -98
  197. package/dist/flavors/iec/generated/substrate.d.ts +78 -0
  198. package/dist/flavors/iec/generated/substrate.js +105 -0
  199. package/dist/flavors/iec/grammar.worker.d.ts +6 -0
  200. package/dist/flavors/iec/grammar.worker.js +231 -0
  201. package/dist/flavors/iec/implementation.d.ts +15 -0
  202. package/dist/flavors/iec/implementation.js +956 -0
  203. package/dist/flavors/iec/index.d.ts +1 -2
  204. package/dist/flavors/iec/index.js +16 -869
  205. package/dist/flavors/iec/model.js +13 -1
  206. package/dist/flavors/iec/worker.d.ts +2 -0
  207. package/dist/flavors/iec/worker.js +19 -0
  208. package/dist/flavors/ieee/generated/substrate.d.ts +78 -0
  209. package/dist/flavors/ieee/generated/substrate.js +105 -0
  210. package/dist/flavors/ieee/implementation.d.ts +4 -0
  211. package/dist/flavors/ieee/implementation.js +48 -10
  212. package/dist/flavors/ieee/index.d.ts +3 -2
  213. package/dist/flavors/ieee/index.js +30 -12
  214. package/dist/flavors/ieee/model.js +17 -4
  215. package/dist/flavors/ieee/preprocessor.js +11 -10
  216. package/dist/flavors/ieee/worker.js +33 -11
  217. package/dist/flavors/ietf/generated/substrate.d.ts +75 -0
  218. package/dist/flavors/ietf/generated/substrate.js +102 -0
  219. package/dist/flavors/ietf/grammar.worker.d.ts +6 -0
  220. package/dist/flavors/ietf/grammar.worker.js +63 -0
  221. package/dist/flavors/ietf/implementation.d.ts +6 -0
  222. package/dist/flavors/ietf/implementation.js +60 -0
  223. package/dist/flavors/ietf/index.d.ts +1 -28
  224. package/dist/flavors/ietf/index.js +15 -149
  225. package/dist/flavors/ietf/model.d.ts +47 -0
  226. package/dist/flavors/ietf/model.js +92 -0
  227. package/dist/flavors/iho/generated/substrate.d.ts +78 -0
  228. package/dist/flavors/iho/generated/substrate.js +105 -0
  229. package/dist/flavors/iho/grammar.worker.d.ts +6 -0
  230. package/dist/flavors/iho/grammar.worker.js +150 -0
  231. package/dist/flavors/iho/implementation.d.ts +6 -0
  232. package/dist/flavors/iho/implementation.js +221 -0
  233. package/dist/flavors/iho/index.d.ts +1 -2
  234. package/dist/flavors/iho/index.js +15 -619
  235. package/dist/flavors/iho/model.d.ts +11 -0
  236. package/dist/flavors/iho/model.js +315 -0
  237. package/dist/flavors/index.js +3 -0
  238. package/dist/flavors/iso/generated/substrate.d.ts +93 -0
  239. package/dist/flavors/iso/generated/substrate.js +133 -0
  240. package/dist/flavors/iso/grammar.worker.d.ts +7 -0
  241. package/dist/flavors/iso/grammar.worker.js +406 -0
  242. package/dist/flavors/iso/implementation.d.ts +4 -0
  243. package/dist/flavors/iso/implementation.js +880 -0
  244. package/dist/flavors/iso/index.js +16 -706
  245. package/dist/flavors/iso/model.js +21 -2
  246. package/dist/flavors/iso/worker.d.ts +2 -0
  247. package/dist/flavors/iso/worker.js +19 -0
  248. package/dist/flavors/itu/generated/substrate.d.ts +78 -0
  249. package/dist/flavors/itu/generated/substrate.js +105 -0
  250. package/dist/flavors/itu/grammar.worker.d.ts +6 -0
  251. package/dist/flavors/itu/grammar.worker.js +306 -0
  252. package/dist/flavors/itu/implementation.d.ts +10 -0
  253. package/dist/flavors/itu/implementation.js +285 -0
  254. package/dist/flavors/itu/index.js +15 -246
  255. package/dist/flavors/itu/worker.d.ts +2 -0
  256. package/dist/flavors/itu/worker.js +19 -0
  257. package/dist/flavors/jcgm/generated/substrate.d.ts +78 -0
  258. package/dist/flavors/jcgm/generated/substrate.js +105 -0
  259. package/dist/flavors/jcgm/grammar.worker.d.ts +6 -0
  260. package/dist/flavors/jcgm/grammar.worker.js +98 -0
  261. package/dist/flavors/jcgm/implementation.d.ts +6 -0
  262. package/dist/flavors/jcgm/implementation.js +187 -0
  263. package/dist/flavors/jcgm/index.d.ts +1 -5
  264. package/dist/flavors/jcgm/index.js +16 -364
  265. package/dist/flavors/jcgm/model.d.ts +43 -0
  266. package/dist/flavors/jcgm/model.js +168 -0
  267. package/dist/flavors/jis/generated/substrate.d.ts +78 -0
  268. package/dist/flavors/jis/generated/substrate.js +105 -0
  269. package/dist/flavors/jis/grammar.worker.d.ts +6 -0
  270. package/dist/flavors/jis/grammar.worker.js +132 -0
  271. package/dist/flavors/jis/implementation.d.ts +6 -0
  272. package/dist/flavors/jis/implementation.js +129 -0
  273. package/dist/flavors/jis/index.d.ts +0 -2
  274. package/dist/flavors/jis/index.js +15 -390
  275. package/dist/flavors/jis/model.d.ts +30 -0
  276. package/dist/flavors/jis/model.js +205 -0
  277. package/dist/flavors/jis/worker.d.ts +2 -0
  278. package/dist/flavors/jis/worker.js +19 -0
  279. package/dist/flavors/nist/generated/substrate.d.ts +78 -0
  280. package/dist/flavors/nist/generated/substrate.js +105 -0
  281. package/dist/flavors/nist/index.js +18 -11
  282. package/dist/flavors/nist/worker.js +8 -4
  283. package/dist/flavors/oasis/generated/substrate.d.ts +75 -0
  284. package/dist/flavors/oasis/generated/substrate.js +102 -0
  285. package/dist/flavors/oasis/grammar.worker.d.ts +6 -0
  286. package/dist/flavors/oasis/grammar.worker.js +50 -0
  287. package/dist/flavors/oasis/implementation.d.ts +6 -0
  288. package/dist/flavors/oasis/implementation.js +80 -0
  289. package/dist/flavors/oasis/index.d.ts +1 -21
  290. package/dist/flavors/oasis/index.js +16 -108
  291. package/dist/flavors/oasis/model.d.ts +27 -0
  292. package/dist/flavors/oasis/model.js +34 -0
  293. package/dist/flavors/ogc/generated/substrate.d.ts +75 -0
  294. package/dist/flavors/ogc/generated/substrate.js +102 -0
  295. package/dist/flavors/ogc/grammar.worker.d.ts +6 -0
  296. package/dist/flavors/ogc/grammar.worker.js +55 -0
  297. package/dist/flavors/ogc/implementation.d.ts +6 -0
  298. package/dist/flavors/ogc/implementation.js +49 -0
  299. package/dist/flavors/ogc/index.d.ts +1 -18
  300. package/dist/flavors/ogc/index.js +15 -73
  301. package/dist/flavors/ogc/model.d.ts +23 -0
  302. package/dist/flavors/ogc/model.js +32 -0
  303. package/dist/flavors/oiml/generated/substrate.d.ts +78 -0
  304. package/dist/flavors/oiml/generated/substrate.js +105 -0
  305. package/dist/flavors/oiml/grammar.worker.d.ts +6 -0
  306. package/dist/flavors/oiml/grammar.worker.js +239 -0
  307. package/dist/flavors/oiml/implementation.d.ts +2 -1
  308. package/dist/flavors/oiml/implementation.js +16 -7
  309. package/dist/flavors/oiml/index.js +15 -6
  310. package/dist/flavors/oiml/model.js +19 -19
  311. package/dist/flavors/oiml/worker.js +14 -6
  312. package/dist/flavors/omg/generated/substrate.d.ts +78 -0
  313. package/dist/flavors/omg/generated/substrate.js +105 -0
  314. package/dist/flavors/omg/grammar.worker.d.ts +6 -0
  315. package/dist/flavors/omg/grammar.worker.js +64 -0
  316. package/dist/flavors/omg/implementation.d.ts +7 -0
  317. package/dist/flavors/omg/implementation.js +33 -0
  318. package/dist/flavors/omg/index.d.ts +1 -12
  319. package/dist/flavors/omg/index.js +15 -71
  320. package/dist/flavors/omg/model.d.ts +16 -0
  321. package/dist/flavors/omg/model.js +26 -0
  322. package/dist/flavors/plateau/generated/substrate.d.ts +78 -0
  323. package/dist/flavors/plateau/generated/substrate.js +105 -0
  324. package/dist/flavors/plateau/grammar.worker.d.ts +6 -0
  325. package/dist/flavors/plateau/grammar.worker.js +78 -0
  326. package/dist/flavors/plateau/implementation.d.ts +6 -0
  327. package/dist/flavors/plateau/implementation.js +74 -0
  328. package/dist/flavors/plateau/index.d.ts +1 -2
  329. package/dist/flavors/plateau/index.js +18 -114
  330. package/dist/flavors/plateau/model.d.ts +11 -0
  331. package/dist/flavors/plateau/model.js +51 -0
  332. package/dist/flavors/register-types.d.ts +20 -19
  333. package/dist/flavors/register-types.js +44 -19
  334. package/dist/flavors/sae/generated/substrate.d.ts +75 -0
  335. package/dist/flavors/sae/generated/substrate.js +102 -0
  336. package/dist/flavors/sae/grammar.worker.d.ts +6 -0
  337. package/dist/flavors/sae/grammar.worker.js +84 -0
  338. package/dist/flavors/sae/implementation.d.ts +11 -0
  339. package/dist/flavors/sae/implementation.js +109 -0
  340. package/dist/flavors/sae/index.d.ts +3 -0
  341. package/dist/flavors/sae/index.js +19 -0
  342. package/dist/flavors/sae/model.d.ts +86 -0
  343. package/dist/flavors/sae/model.js +185 -0
  344. package/dist/flavors/tgpp/generated/substrate.d.ts +78 -0
  345. package/dist/flavors/tgpp/generated/substrate.js +105 -0
  346. package/dist/flavors/tgpp/grammar.worker.d.ts +6 -0
  347. package/dist/flavors/tgpp/grammar.worker.js +69 -0
  348. package/dist/flavors/tgpp/implementation.d.ts +8 -0
  349. package/dist/flavors/tgpp/implementation.js +56 -0
  350. package/dist/flavors/tgpp/index.d.ts +1 -2
  351. package/dist/flavors/tgpp/index.js +15 -120
  352. package/dist/flavors/tgpp/model.d.ts +13 -0
  353. package/dist/flavors/tgpp/model.js +52 -0
  354. package/dist/flavors/w3c/generated/substrate.d.ts +78 -0
  355. package/dist/flavors/w3c/generated/substrate.js +105 -0
  356. package/dist/flavors/w3c/grammar.worker.d.ts +6 -0
  357. package/dist/flavors/w3c/grammar.worker.js +55 -0
  358. package/dist/flavors/w3c/implementation.d.ts +7 -0
  359. package/dist/flavors/w3c/implementation.js +49 -0
  360. package/dist/flavors/w3c/index.d.ts +1 -12
  361. package/dist/flavors/w3c/index.js +15 -146
  362. package/dist/flavors/w3c/model.d.ts +15 -0
  363. package/dist/flavors/w3c/model.js +103 -0
  364. package/dist/flavors/wmo/generated/substrate.d.ts +78 -0
  365. package/dist/flavors/wmo/generated/substrate.js +105 -0
  366. package/dist/flavors/wmo/implementation.d.ts +5 -0
  367. package/dist/flavors/wmo/implementation.js +79 -0
  368. package/dist/flavors/wmo/index.js +14 -68
  369. package/dist/flavors/worker-registry.js +246 -68
  370. package/dist/flavors/xsf/generated/substrate.d.ts +75 -0
  371. package/dist/flavors/xsf/generated/substrate.js +102 -0
  372. package/dist/flavors/xsf/grammar.worker.d.ts +6 -0
  373. package/dist/flavors/xsf/grammar.worker.js +53 -0
  374. package/dist/flavors/xsf/implementation.d.ts +6 -0
  375. package/dist/flavors/xsf/implementation.js +34 -0
  376. package/dist/flavors/xsf/index.d.ts +1 -16
  377. package/dist/flavors/xsf/index.js +16 -63
  378. package/dist/flavors/xsf/model.d.ts +20 -0
  379. package/dist/flavors/xsf/model.js +26 -0
  380. package/dist/index.d.ts +2 -2
  381. package/dist/index.js +1 -1
  382. package/dist/lane-keys.d.ts +68 -0
  383. package/dist/lane-keys.js +113 -0
  384. package/dist/model/identifier.d.ts +13 -1
  385. package/dist/model/identifier.js +76 -13
  386. package/dist/model/relation.d.ts +36 -0
  387. package/dist/model/relation.js +93 -0
  388. package/dist/parg/artifacts/ieee.d.ts +1 -1
  389. package/dist/parg/artifacts/ieee.js +1 -1
  390. package/dist/parg/worker.d.ts +4 -2
  391. package/dist/parg/worker.js +5 -3
  392. package/dist/parse-surface.d.ts +3 -31
  393. package/dist/parse-surface.js +6 -69
  394. package/dist/pubid-urn/decoder.d.ts +8 -0
  395. package/dist/pubid-urn/decoder.js +43 -0
  396. package/dist/pubid-urn/encoder.js +31 -0
  397. package/dist/pubid-urn/schema.d.ts +1 -1
  398. package/dist/pubid-urn/schema.js +1 -1
  399. package/dist/pubid-urn/schemas/bsi.js +1 -0
  400. package/dist/pubid-urn/schemas/bsi_pfs.js +9 -7
  401. package/dist/pubid-urn/schemas/cen_pfs.js +1 -0
  402. package/dist/pubid-urn/schemas/cencenelec.js +1 -0
  403. package/dist/pubid-urn/schemas/iec.js +1 -0
  404. package/dist/pubid-urn/schemas/ieee.js +1 -0
  405. package/dist/pubid-urn/schemas/iso.js +1 -0
  406. package/package.json +1 -1
  407. package/vendor/parg/bsi_pfs.json +1 -1
  408. package/vendor/parg/calconnect_pfs.json +1 -1
  409. package/vendor/parg/cen_pfs.json +1 -1
  410. package/vendor/parg/doi_pfs.json +1 -1
  411. package/vendor/parg/etsi_pfs.json +1 -1
  412. package/vendor/parg/ieee.json +1 -1
  413. package/vendor/parg/iho.json +1 -1
  414. package/vendor/parg/plateau.json +1 -1
  415. package/dist/flavors/api/grammar.d.ts +0 -4
  416. package/dist/flavors/ashrae/grammar.d.ts +0 -2
  417. package/dist/flavors/asme/grammar.d.ts +0 -2
  418. package/dist/flavors/astm/grammar.d.ts +0 -2
  419. package/dist/flavors/bsi/grammar.d.ts +0 -4
  420. package/dist/flavors/cen_cenelec/grammar.d.ts +0 -4
  421. package/dist/flavors/cie/grammar.d.ts +0 -5
  422. package/dist/flavors/csa/grammar.d.ts +0 -6
  423. package/dist/flavors/evs/grammar.d.ts +0 -2
  424. package/dist/flavors/evs/grammar.js +0 -68
  425. package/dist/flavors/gost/grammar.d.ts +0 -2
  426. package/dist/flavors/gost/grammar.js +0 -46
  427. package/dist/flavors/idf/grammar.d.ts +0 -2
  428. package/dist/flavors/iec/grammar.d.ts +0 -3
  429. package/dist/flavors/iec/grammar.js +0 -234
  430. package/dist/flavors/ieee/grammar.d.ts +0 -2
  431. package/dist/flavors/ieee/grammar.js +0 -777
  432. package/dist/flavors/iso/grammar.d.ts +0 -7
  433. package/dist/flavors/iso/grammar.js +0 -282
  434. package/dist/flavors/itu/grammar.d.ts +0 -4
  435. package/dist/flavors/itu/grammar.js +0 -276
  436. package/dist/flavors/nist/grammar.d.ts +0 -2
  437. package/dist/flavors/nist/grammar.js +0 -342
  438. package/dist/flavors/oiml/grammar.d.ts +0 -2
  439. package/dist/flavors/oiml/grammar.js +0 -206
  440. package/vendor/parg/csv.json +0 -1
  441. package/vendor/parg/ini.json +0 -1
  442. package/vendor/parg/json.json +0 -1
  443. package/vendor/parg/lua.json +0 -1
  444. package/vendor/parg/toml.json +0 -1
@@ -0,0 +1,661 @@
1
+ //! The csa semantic delta over the generated substrate
2
+ //! (pubid/pubid-grammar#158): the builder dispatch plus the
3
+ //! Identifier.parse pre-parse layer (CAN/, CAN3-, CSA-adoption, and
4
+ //! PACKAGE wrappers; the parser's normalization + prefix injection).
5
+ //! Pure — no `node:*` module, no engine import — so both entries (the
6
+ //! node barrel over the wasm artifact runtime, the worker entry over
7
+ //! the pure-TS worker engine) run the same delta.
8
+ //!
9
+ //! The parse function is injected: the entry binds it to
10
+ //! `substrate.boundToWire(substrate.parseBound(body))` (node) or the
11
+ //! worker engine's equivalent (worker), both producing the artifact's
12
+ //! declared wire. The artifact spells has_publisher / colon_format /
13
+ //! dash_format as the real tokens ("CSA " / ":" / "-") and carries the
14
+ //! combined/bundled parts in the position-indexed csa_code_part[] group
15
+ //! (csa.parg edition 2) where the hand grammar nested
16
+ //! first/second/third — the dispatch reads plus_separator /
17
+ //! comma_separator / csa_code_part and each part strips its part_
18
+ //! prefix before buildSingle, mirroring the reference builder.
19
+ import { normalizeCsa, csaPublisherPrefix } from "./grammar.worker.js";
20
+ import { BundledClass, CanadianAdoptedClass, CecClass, CombinedClass, CsaAdoptedClass, CsaSingleIdentifier, PackageClass, SeriesClass, StandardClass, } from "./model.js";
21
+ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
22
+ const strv = (v) => {
23
+ if (v === undefined || v === null)
24
+ return undefined;
25
+ if (Array.isArray(v)) {
26
+ const flat = v.flat(10);
27
+ const joined = flat.map(String).join("");
28
+ return joined.length > 0 ? joined : undefined;
29
+ }
30
+ const s = String(v).trim();
31
+ return s.length > 0 ? s : undefined;
32
+ };
33
+ function flatten(data) {
34
+ return Array.isArray(data) ? Object.assign({}, ...data) : data;
35
+ }
36
+ const ctor = (klass) => klass;
37
+ function tryForeign(flavor, raw, resolveForeign) {
38
+ const impl = resolveForeign(flavor);
39
+ if (impl === undefined)
40
+ return undefined;
41
+ try {
42
+ return impl.parse(raw);
43
+ }
44
+ catch {
45
+ return undefined;
46
+ }
47
+ }
48
+ // --- Single identifiers (builder.rb build_single + friends) ---------------------------
49
+ function expandYear(yearStr, prefix) {
50
+ if (yearStr.length === 2) {
51
+ if (prefix === "M")
52
+ return `19${yearStr}`;
53
+ return Number(yearStr) < 50 ? `20${yearStr}` : `19${yearStr}`;
54
+ }
55
+ return yearStr;
56
+ }
57
+ function setReaffirmation(target, data) {
58
+ const self = target;
59
+ if (data["reaffirmation_4digit"] !== undefined) {
60
+ self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
61
+ self["original_reaffirmation_4digit"] = true;
62
+ }
63
+ else if (data["reaffirmation_2digit"] !== undefined) {
64
+ const two = strv(data["reaffirmation_2digit"]) ?? "";
65
+ self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
66
+ self["original_reaffirmation_4digit"] = false;
67
+ }
68
+ else if (data["reaffirmation"] !== undefined) {
69
+ const raw = data["reaffirmation"];
70
+ self["reaffirmation"] = isObj(raw)
71
+ ? strv(raw["year"])
72
+ : strv(raw);
73
+ }
74
+ }
75
+ function selectSingleClass(data) {
76
+ if (data["no_notation"] !== undefined && data["no_number"] !== undefined)
77
+ return CecClass;
78
+ if (data["series_type"] !== undefined)
79
+ return SeriesClass;
80
+ if (data["series"] !== undefined && strv(data["series"]) === "SERIES")
81
+ return SeriesClass;
82
+ return StandardClass;
83
+ }
84
+ function buildSingle(dataIn) {
85
+ const data = dataIn;
86
+ const identifier = new (ctor(selectSingleClass(data)))();
87
+ const self = identifier;
88
+ if (data["publisher_prefix"] !== undefined) {
89
+ self["publisher_prefix"] = strv(data["publisher_prefix"]);
90
+ }
91
+ else if (data["code"] !== undefined) {
92
+ self["code_only"] = true;
93
+ }
94
+ if (data["has_publisher"] !== undefined)
95
+ self["has_publisher"] = true;
96
+ if (data["code"] !== undefined && !(identifier instanceof CecClass)) {
97
+ const codeValue = strv(data["code"]) ?? "";
98
+ const m = !data["year"] ? /^(.+)-(\d{2})$/.exec(codeValue) : null;
99
+ if (m !== null) {
100
+ self["number"] = m[1];
101
+ self["year"] = `20${m[2]}`;
102
+ self["year_format"] = "dash";
103
+ }
104
+ else {
105
+ self["number"] = codeValue;
106
+ }
107
+ }
108
+ if (identifier instanceof CecClass) {
109
+ if (data["code"] !== undefined && self["cec_part"] === undefined) {
110
+ self["cec_part"] = strv(data["code"]);
111
+ }
112
+ if (data["no_number"] !== undefined) {
113
+ self["no_number"] = strv(data["no_number"]);
114
+ }
115
+ if (self["cec_part"] !== undefined && self["no_number"] !== undefined) {
116
+ self["number"] = `${self["cec_part"]}-${self["no_number"]}`;
117
+ }
118
+ }
119
+ if (data["series_prefix"] !== undefined)
120
+ self["series_prefix"] = strv(data["series_prefix"]);
121
+ if (data["series"] !== undefined)
122
+ self["series"] = true;
123
+ const yearFormat = data["dash_format"] !== undefined
124
+ ? "dash"
125
+ : "colon";
126
+ if (data["year"] !== undefined && self["year"] === undefined) {
127
+ const yearStr = strv(data["year"]) ?? "";
128
+ self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
129
+ if (yearStr.length === 4)
130
+ self["original_year_4digit"] = true;
131
+ self["year_format"] = yearFormat;
132
+ }
133
+ if (data["year_prefix"] !== undefined) {
134
+ self["year_prefix"] = strv(data["year_prefix"]);
135
+ if (strv(data["year_prefix"]) === "F")
136
+ self["french"] = true;
137
+ }
138
+ if (data["french"] !== undefined)
139
+ self["french"] = true;
140
+ setReaffirmation(identifier, data);
141
+ if (data["package_portion"] !== undefined) {
142
+ self["package"] = strv(data["package_portion"]);
143
+ }
144
+ return identifier;
145
+ }
146
+ function buildSeries(dataIn) {
147
+ const data = dataIn;
148
+ const series = new (ctor(SeriesClass))();
149
+ const self = series;
150
+ self["series"] = true;
151
+ if (data["publisher_prefix"] !== undefined)
152
+ self["publisher_prefix"] = strv(data["publisher_prefix"]);
153
+ if (data["series_prefix"] !== undefined)
154
+ self["series_prefix"] = strv(data["series_prefix"]);
155
+ if (data["code"] !== undefined)
156
+ self["number"] = strv(data["code"]);
157
+ if (data["year"] !== undefined) {
158
+ const yearStr = strv(data["year"]) ?? "";
159
+ self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
160
+ if (yearStr.length === 4)
161
+ self["original_year_4digit"] = true;
162
+ self["year_format"] = data["dash_format"] !== undefined ? "dash" : "colon";
163
+ }
164
+ if (data["year_prefix"] !== undefined)
165
+ self["year_prefix"] = strv(data["year_prefix"]);
166
+ setReaffirmation(series, data);
167
+ return series;
168
+ }
169
+ function buildCec(dataIn) {
170
+ const data = dataIn;
171
+ const cec = new (ctor(CecClass))();
172
+ const self = cec;
173
+ if (data["publisher_prefix"] !== undefined)
174
+ self["publisher_prefix"] = strv(data["publisher_prefix"]);
175
+ if (data["cec_part"] !== undefined)
176
+ self["cec_part"] = strv(data["cec_part"]);
177
+ if (data["no_number"] !== undefined)
178
+ self["no_number"] = strv(data["no_number"]);
179
+ if (self["cec_part"] !== undefined && self["no_number"] !== undefined) {
180
+ self["number"] = `${self["cec_part"]}-${self["no_number"]}`;
181
+ }
182
+ if (data["year"] !== undefined) {
183
+ const yearStr = strv(data["year"]) ?? "";
184
+ self["year"] = expandYear(yearStr, strv(data["year_prefix"]));
185
+ if (yearStr.length === 4)
186
+ self["original_year_4digit"] = true;
187
+ self["year_format"] = data["dash_format"] !== undefined ? "dash" : "colon";
188
+ }
189
+ if (data["year_prefix"] !== undefined) {
190
+ self["year_prefix"] = strv(data["year_prefix"]);
191
+ if (strv(data["year_prefix"]) === "F")
192
+ self["french"] = true;
193
+ }
194
+ if (data["french"] !== undefined)
195
+ self["french"] = true;
196
+ setReaffirmation(cec, data);
197
+ return cec;
198
+ }
199
+ // --- The combined/bundled part group (the artifact wire) ------------------
200
+ /** Strips the part_-prefix the combined/bundled array group carries,
201
+ * leaving the plain field names buildSingle reads (builder.rb
202
+ * strip_part_prefix). */
203
+ function stripPartPrefix(part) {
204
+ const out = {};
205
+ for (const [key, value] of Object.entries(part)) {
206
+ out[key.startsWith("part_") ? key.slice("part_".length) : key] = value;
207
+ }
208
+ return out;
209
+ }
210
+ function combinedReaffirmation(self, data) {
211
+ if (data["reaffirmation_4digit"] !== undefined) {
212
+ self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
213
+ self["original_reaffirmation_4digit"] = true;
214
+ }
215
+ else if (data["reaffirmation_2digit"] !== undefined) {
216
+ const two = strv(data["reaffirmation_2digit"]) ?? "";
217
+ self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
218
+ self["original_reaffirmation_4digit"] = false;
219
+ }
220
+ else if (data["reaffirmation"] !== undefined) {
221
+ self["reaffirmation"] = strv(data["reaffirmation"]);
222
+ }
223
+ }
224
+ function partArray(data) {
225
+ const parts = data["csa_code_part"];
226
+ return Array.isArray(parts)
227
+ ? parts.filter((p) => isObj(p))
228
+ : [];
229
+ }
230
+ function buildBundled(data) {
231
+ const parts = partArray(data);
232
+ const self = {
233
+ base: buildSingle(stripPartPrefix(parts[0] ?? {})),
234
+ bundled_with: parts.slice(1).map((p) => buildSingle(stripPartPrefix(p))),
235
+ };
236
+ combinedReaffirmation(self, data);
237
+ return new (ctor(BundledClass))(self);
238
+ }
239
+ function buildCombinedFromParts(data) {
240
+ const parts = partArray(data).map((p) => ({ ...p }));
241
+ // SERIES and series_prefix bind as top-level scalars: the capture
242
+ // only fires in the parts that carry the keyword, and array bindings
243
+ // pair occurrences by index, so a sparse capture would land on the
244
+ // wrong part. The keyword qualifies the designation it follows — the
245
+ // last part in every combined form (builder.rb build_combined).
246
+ if (data["part_series"] !== undefined) {
247
+ const last = parts[parts.length - 1];
248
+ if (last !== undefined) {
249
+ last["part_series"] = data["part_series"];
250
+ if (data["part_series_prefix"] !== undefined) {
251
+ last["part_series_prefix"] = data["part_series_prefix"];
252
+ }
253
+ }
254
+ }
255
+ const self = {
256
+ identifiers: parts.map((p) => buildSingle(stripPartPrefix(p))),
257
+ separator: data["comma_separator"] !== undefined ? ", " : "/",
258
+ };
259
+ combinedReaffirmation(self, data);
260
+ if (data["package_portion"] !== undefined) {
261
+ self["package"] = strv(data["package_portion"]);
262
+ }
263
+ return new (ctor(CombinedClass))(self);
264
+ }
265
+ // --- The builder dispatch ---------------------------------------------------------------
266
+ function buildTree(parsed, resolveForeign) {
267
+ const data = parsed;
268
+ if (data["publisher_prefix"] !== undefined
269
+ && ["CAN/CSA-", "CAN3-"].includes(strv(data["publisher_prefix"]) ?? "")) {
270
+ return buildCanadianAdopted(data);
271
+ }
272
+ if ("adoption_number" in data)
273
+ return buildAdoption(data, resolveForeign);
274
+ if ("series_type" in data)
275
+ return buildSeries(parsed);
276
+ if ("cec_part" in data)
277
+ return buildCec(parsed);
278
+ if ("package_portion" in data)
279
+ return buildPackage(parsed);
280
+ if ("plus_separator" in data)
281
+ return buildBundled(data);
282
+ if (data["csa_code_part"] !== undefined)
283
+ return buildCombinedFromParts(data);
284
+ return buildSingle(parsed);
285
+ }
286
+ function buildPackage(data) {
287
+ const baseData = { ...data };
288
+ delete baseData["package_portion"];
289
+ return new (ctor(PackageClass))({
290
+ base: buildSingle(baseData),
291
+ ...(data["package_portion"] !== undefined
292
+ ? { package_materials: strv(data["package_portion"]) }
293
+ : {}),
294
+ });
295
+ }
296
+ function parseAdoptionBase(adoptionOrg, baseStr, resolveForeign) {
297
+ if (adoptionOrg.startsWith("ISO") || adoptionOrg.startsWith("CEI")) {
298
+ return tryForeign("iso", baseStr, resolveForeign);
299
+ }
300
+ if (adoptionOrg.startsWith("IEC")) {
301
+ return tryForeign("iec", baseStr, resolveForeign);
302
+ }
303
+ return tryForeign("iso", baseStr, resolveForeign) ?? tryForeign("iec", baseStr, resolveForeign);
304
+ }
305
+ function buildAdoption(data, resolveForeign) {
306
+ let adoptionOrg = strv(data["adoption_org"]) ?? "";
307
+ const adoptionNumber = strv(data["adoption_number"]) ?? "";
308
+ const adoptionYear = strv(data["adoption_year"]) ?? "";
309
+ if (data["iso_type"] !== undefined)
310
+ adoptionOrg += ` ${strv(data["iso_type"])}`;
311
+ const yearSep = strv(data["adoption_year_sep"]) ?? ":";
312
+ const wrappedYear = adoptionYear.length === 2 ? `20${adoptionYear}` : adoptionYear;
313
+ let base;
314
+ if (data["adoption_amendment"] !== undefined) {
315
+ const baseStr = `${adoptionOrg} ${adoptionNumber}${yearSep}${wrappedYear}`;
316
+ const amendmentYear = strv(data["adoption_amendment_year"]) ?? "";
317
+ const wrappedAmendmentYear = amendmentYear.length === 2 ? `20${amendmentYear}` : amendmentYear;
318
+ const amendmentStr = `${baseStr}/Amd ${strv(data["adoption_amendment"])}:${wrappedAmendmentYear}`;
319
+ base = parseAdoptionBase(adoptionOrg, amendmentStr, resolveForeign);
320
+ }
321
+ else {
322
+ let wrappedIdStr = `${adoptionOrg} ${adoptionNumber}${yearSep}${wrappedYear}`;
323
+ if (adoptionOrg === "CEI/IEC") {
324
+ wrappedIdStr = wrappedIdStr.replace("CEI/IEC", "IEC");
325
+ }
326
+ base = parseAdoptionBase(adoptionOrg, wrappedIdStr, resolveForeign);
327
+ }
328
+ const self = { base };
329
+ if (data["reaffirmation_4digit"] !== undefined) {
330
+ self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
331
+ }
332
+ else if (data["reaffirmation_2digit"] !== undefined) {
333
+ const two = strv(data["reaffirmation_2digit"]) ?? "";
334
+ self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
335
+ }
336
+ else if (data["reaffirmation"] !== undefined) {
337
+ const raw = data["reaffirmation"];
338
+ self["reaffirmation"] = isObj(raw) ? strv(raw["year"]) : strv(raw);
339
+ }
340
+ return new (ctor(CsaAdoptedClass))(self);
341
+ }
342
+ function buildCanadianAdopted(data) {
343
+ const originalPrefix = strv(data["publisher_prefix"]);
344
+ const wrappedData = { ...data };
345
+ delete wrappedData["publisher_prefix"];
346
+ let base;
347
+ if ("series_type" in wrappedData) {
348
+ base = buildSeries(wrappedData);
349
+ if (originalPrefix !== undefined) {
350
+ base["publisher_prefix"] = originalPrefix;
351
+ }
352
+ }
353
+ else if ("cec_part" in wrappedData) {
354
+ base = buildCec(wrappedData);
355
+ if (originalPrefix !== undefined) {
356
+ base["publisher_prefix"] = originalPrefix;
357
+ }
358
+ }
359
+ else {
360
+ base = buildSingle(wrappedData);
361
+ if (originalPrefix !== undefined) {
362
+ base["publisher_prefix"] = originalPrefix;
363
+ }
364
+ }
365
+ const self = { base };
366
+ if (data["reaffirmation_4digit"] !== undefined) {
367
+ self["reaffirmation"] = strv(data["reaffirmation_4digit"]);
368
+ }
369
+ else if (data["reaffirmation_2digit"] !== undefined) {
370
+ const two = strv(data["reaffirmation_2digit"]) ?? "";
371
+ self["reaffirmation"] = Number(two) < 50 ? `20${two}` : `19${two}`;
372
+ }
373
+ return new (ctor(CanadianAdoptedClass))(self);
374
+ }
375
+ // --- The prefix injection (parser.rb inject_publisher_prefix) ------------
376
+ /** The artifact-wire injection: the combined/bundled parts take the
377
+ * prefix per position — the first part always, later ones only when
378
+ * they spell their own publisher token, unless the comma form repeats
379
+ * it — and plain hashes take it at the top level. */
380
+ function injectPublisherPrefix(hash, prefix) {
381
+ const parts = partArray(hash);
382
+ if (parts.length > 0) {
383
+ parts.forEach((part, index) => {
384
+ if (index > 0 && part["part_has_publisher"] === undefined
385
+ && hash["comma_separator"] === undefined) {
386
+ return;
387
+ }
388
+ part["publisher_prefix"] = prefix;
389
+ });
390
+ return;
391
+ }
392
+ hash["publisher_prefix"] = prefix;
393
+ }
394
+ function setPublisherPrefix(obj, prefix) {
395
+ const self = obj;
396
+ self["publisher_prefix"] = prefix;
397
+ const combined = self["identifiers"];
398
+ if (combined !== undefined) {
399
+ combined.forEach((part, index) => {
400
+ const partSelf = part;
401
+ if (index > 0 && partSelf["has_publisher"] !== true)
402
+ return;
403
+ partSelf["publisher_prefix"] = prefix;
404
+ });
405
+ }
406
+ const base = self["base"];
407
+ if (base !== undefined && combined === undefined) {
408
+ setPublisherPrefix(base, prefix);
409
+ }
410
+ }
411
+ function extractReaffirmation(wrappedInput) {
412
+ const m = /\(R(\d{2,4})\)/.exec(wrappedInput);
413
+ if (m === null)
414
+ return { year: undefined, was4digit: false, rest: wrappedInput };
415
+ let year = m[1];
416
+ const was4digit = year.length === 4;
417
+ if (year.length === 2) {
418
+ year = Number(year) < 50 ? `20${year}` : `19${year}`;
419
+ }
420
+ const rest = wrappedInput.replace(/\s*\(R\d{2,4}\)/, "");
421
+ return { year, was4digit, rest };
422
+ }
423
+ function parseExternalStandard(input, resolveForeign) {
424
+ if (/^(ISO\/IEC|ISO|IEC|CEI|CEI\/IEC)\s/.test(input)) {
425
+ return tryForeign("iso", input.replace(/^CEI\/IEC/, "IEC"), resolveForeign);
426
+ }
427
+ // The catalogue also prints the IWA designation without the ISO
428
+ // keyword ("CAN/CSA-IWA 18:17" beside "CAN/CSA-ISO IWA 18:17"); the
429
+ // ISO parser wants the ISO/ prefix.
430
+ if (/^IWA\s/.test(input)) {
431
+ return tryForeign("iso", input.replace(/^IWA\s/, "ISO/IWA "), resolveForeign);
432
+ }
433
+ if (/^CISPR\s/.test(input)) {
434
+ return tryForeign("iec", input, resolveForeign);
435
+ }
436
+ return undefined;
437
+ }
438
+ // --- Identifier.parse (identifier.rb) ------------------------------------------------------
439
+ /** The bound → wire lane is injected so the node entry (the generated
440
+ * substrate over the wasm artifact runtime) and the worker entry (the
441
+ * pure-TS worker engine) share this delta byte for byte — and so every
442
+ * implementation instance carries its own pre-parse layer, with no
443
+ * module-scope wire slot. */
444
+ export function makeCsaGrammarImplementation(parseWire, resolveForeign) {
445
+ function parseTree(input) {
446
+ const normalized = normalizeCsa(input);
447
+ const prefix = csaPublisherPrefix(normalized);
448
+ const hash = flatten(parseWire(normalized));
449
+ if (prefix !== undefined)
450
+ injectPublisherPrefix(hash, prefix);
451
+ return hash;
452
+ }
453
+ function tryParse(input, resolver) {
454
+ try {
455
+ return parseCsa(input, resolver);
456
+ }
457
+ catch {
458
+ return undefined;
459
+ }
460
+ }
461
+ function parseCsa(input, resolver) {
462
+ if (input.startsWith("#")) {
463
+ throw new Error(`Not a CSA identifier (comment): ${input}`);
464
+ }
465
+ if (/^CSA (Communities|Group|Learning|OnDemand|Update)/.test(input)) {
466
+ throw new Error(`Not a CSA standard: ${input}`);
467
+ }
468
+ input = input.replaceAll("CEI/IEC", "IEC").replaceAll(/\bCEI\b/g, "IEC");
469
+ // CAN/ wrapper (Canadian adoption).
470
+ if (input.startsWith("CAN/")) {
471
+ const wrappedInput0 = input.replace(/^CAN\//, "");
472
+ if (wrappedInput0.includes("+")
473
+ || (wrappedInput0.includes("/") && /\s+CSA-/.test(wrappedInput0))
474
+ || (wrappedInput0.includes("/") && (wrappedInput0.match(/CSA-/g) ?? []).length > 1)) {
475
+ let normalized = wrappedInput0.replace(/^CSA-/, "CSA ");
476
+ normalized = normalized.replaceAll("CAN/CSA-", "CSA ").replaceAll("CAN3-", "CSA ");
477
+ normalized = normalized.replaceAll(/\s+/g, " ").trim();
478
+ const result = buildTree(parseTree(normalized), resolver);
479
+ setPublisherPrefix(result, "CAN/CSA-");
480
+ const rMatch = /\(R(\d{4})\)/.exec(wrappedInput0);
481
+ if (rMatch !== null) {
482
+ result["reaffirmation"] = rMatch[1];
483
+ }
484
+ return result;
485
+ }
486
+ const { year: reaffirmYear, was4digit, rest: stripped } = extractReaffirmation(wrappedInput0);
487
+ const originalPrefix = stripped.startsWith("CSA-")
488
+ ? "CSA-"
489
+ : stripped.startsWith("CSA ")
490
+ ? "CSA"
491
+ : undefined;
492
+ const normalized = stripped.replace(/^CSA-/, "CSA ");
493
+ const base = parseCsa(normalized, resolver);
494
+ const baseSelf = base;
495
+ // Only the single-document types and CsaAdopted declare
496
+ // publisher_prefix; the containers (Combined/Bundled/Package) keep
497
+ // what the recursive parse already injected.
498
+ if (base instanceof CsaSingleIdentifier || base instanceof CsaAdoptedClass) {
499
+ if (base instanceof SeriesClass) {
500
+ baseSelf["publisher_prefix"] = "CAN/CSA-";
501
+ }
502
+ else if (originalPrefix !== undefined) {
503
+ baseSelf["publisher_prefix"] = originalPrefix;
504
+ }
505
+ }
506
+ if (reaffirmYear !== undefined) {
507
+ baseSelf["reaffirmation"] = reaffirmYear;
508
+ baseSelf["original_reaffirmation_4digit"] = was4digit;
509
+ }
510
+ return new (ctor(CanadianAdoptedClass))({
511
+ base,
512
+ ...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
513
+ });
514
+ }
515
+ // CAN3- wrapper (historical).
516
+ if (input.startsWith("CAN3-")) {
517
+ const wrapped0 = input.replace(/^CAN3-/, "CSA ");
518
+ const hasDashYear = /-\d{2}\b/.test(wrapped0);
519
+ const { year: reaffirmYear, was4digit, rest: stripped } = extractReaffirmation(wrapped0);
520
+ const base = parseCsa(stripped, resolver);
521
+ const baseSelf = base;
522
+ if (hasDashYear) {
523
+ baseSelf["year_format"] = "dash";
524
+ baseSelf["original_year_4digit"] = false;
525
+ }
526
+ if (base instanceof SeriesClass) {
527
+ baseSelf["publisher_prefix"] = "CAN3-";
528
+ if (reaffirmYear !== undefined) {
529
+ baseSelf["reaffirmation"] = reaffirmYear;
530
+ baseSelf["original_reaffirmation_4digit"] = was4digit;
531
+ }
532
+ return base;
533
+ }
534
+ baseSelf["publisher_prefix"] = "CAN3-";
535
+ if (reaffirmYear !== undefined) {
536
+ baseSelf["reaffirmation"] = reaffirmYear;
537
+ baseSelf["original_reaffirmation_4digit"] = was4digit;
538
+ }
539
+ return new (ctor(CanadianAdoptedClass))({
540
+ base,
541
+ ...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
542
+ });
543
+ }
544
+ // CSA adoption of international standards. The catalogue also drops
545
+ // the ISO keyword from the IWA designation ("CSA IWA 18:17").
546
+ if (/^CSA (ISO\/IEC|CEI\/IEC|CISPR|IEC|CEI|ISO|IWA)\s/.test(input)) {
547
+ let wrapped = input.replace(/^CSA\s+/, "");
548
+ const { year: reaffirmYear, rest: stripped } = extractReaffirmation(wrapped);
549
+ wrapped = stripped;
550
+ const shortYear = /:(\d{2})\b/.exec(wrapped);
551
+ if (shortYear !== null) {
552
+ const two = shortYear[1];
553
+ const full = Number(two) < 50 ? `20${two}` : `19${two}`;
554
+ wrapped = wrapped.replace(new RegExp(`:${two}\\b`), `:${full}`);
555
+ }
556
+ wrapped = wrapped.replace(/\/A(\d+)([:/-])(\d{2,4})\b/g, (_m, num, sep, year) => {
557
+ const full = year.length === 2
558
+ ? (Number(year) < 50 ? `20${year}` : `19${year}`)
559
+ : year;
560
+ return `/Amd ${num}${sep}${full}`;
561
+ });
562
+ const base = parseExternalStandard(wrapped, resolver);
563
+ if (base === undefined) {
564
+ throw new Error(`Unparseable adopted standard: ${input}`);
565
+ }
566
+ return new (ctor(CsaAdoptedClass))({
567
+ base,
568
+ ...(reaffirmYear !== undefined ? { reaffirmation: reaffirmYear } : {}),
569
+ });
570
+ }
571
+ // Package identifiers.
572
+ if (/\sPACKAGE\b/i.test(input)) {
573
+ let baseInput;
574
+ let packageMaterials;
575
+ let materialsAfter = true;
576
+ const after = /\sPACKAGE\s+[A-Z]/i.exec(input);
577
+ const yearThen = /:(\d{2,4})(\s+[^P]+)\s+PACKAGE/i.exec(input);
578
+ if (after !== null) {
579
+ const idx = input.search(/\s+PACKAGE\s+/i);
580
+ baseInput = input.slice(0, idx).trim();
581
+ packageMaterials = input.slice(input.indexOf("PACKAGE", idx) + "PACKAGE".length).trim() === ""
582
+ ? ""
583
+ : input.slice(idx).replace(/^\s+PACKAGE\s+/i, "").trim();
584
+ materialsAfter = true;
585
+ }
586
+ else if (yearThen !== null) {
587
+ const yearMatch = /:\d{2,4}/.exec(input);
588
+ if (yearMatch !== null) {
589
+ if (/,\s+CSA/.test(input)) {
590
+ const combinedMatch = /^(.+?)(\s+&[^P]+)\s+PACKAGE$/i.exec(input);
591
+ if (combinedMatch !== null) {
592
+ baseInput = combinedMatch[1].trim();
593
+ packageMaterials = `${combinedMatch[2].trim()} Package`;
594
+ }
595
+ else {
596
+ baseInput = input.slice(0, yearMatch.index + yearMatch[0].length);
597
+ packageMaterials = input.slice(yearMatch.index + yearMatch[0].length).trim();
598
+ }
599
+ }
600
+ else {
601
+ baseInput = input.slice(0, yearMatch.index + yearMatch[0].length).trim();
602
+ packageMaterials = input.slice(yearMatch.index + yearMatch[0].length).trim();
603
+ }
604
+ materialsAfter = false;
605
+ }
606
+ }
607
+ else {
608
+ const trailing = /^(.+?)\s+PACKAGE\s*$/i.exec(input);
609
+ if (trailing !== null) {
610
+ baseInput = trailing[1].trim();
611
+ packageMaterials = "";
612
+ materialsAfter = true;
613
+ }
614
+ }
615
+ if (baseInput === undefined || baseInput === "") {
616
+ // Fallback: parse incrementally.
617
+ const tokens = input.split(/\s+/);
618
+ let acc = "";
619
+ for (const token of tokens) {
620
+ if (/^PACKAGE$/i.test(token))
621
+ break;
622
+ const testInput = acc === "" ? token : `${acc} ${token}`;
623
+ if (tryParse(testInput, resolver) === undefined)
624
+ break;
625
+ acc = testInput;
626
+ }
627
+ baseInput = acc;
628
+ if (baseInput !== "" && baseInput.length < input.length) {
629
+ const materialsInput = input.slice(baseInput.length).trim();
630
+ packageMaterials = materialsInput.replace(/\s+PACKAGE\s*$/i, "").trim();
631
+ materialsAfter = packageMaterials !== "";
632
+ }
633
+ }
634
+ if (baseInput === undefined || baseInput === "") {
635
+ throw new Error(`Unparseable package base: ${input}`);
636
+ }
637
+ const base = parseCsa(baseInput, resolver);
638
+ return new (ctor(PackageClass))({
639
+ base,
640
+ package_keyword: "PACKAGE",
641
+ ...(packageMaterials !== undefined && packageMaterials !== ""
642
+ ? { package_materials: packageMaterials }
643
+ : {}),
644
+ materials_after_keyword: materialsAfter,
645
+ });
646
+ }
647
+ // Plain path with parser-level normalization and prefix injection.
648
+ const hasDashYear = /-\d{2}\b/.test(input);
649
+ const result = buildTree(parseTree(input), resolver);
650
+ const self = result;
651
+ if (hasDashYear && self["year_format"] === undefined) {
652
+ self["year_format"] = "dash";
653
+ }
654
+ return result;
655
+ }
656
+ return {
657
+ parse(input) {
658
+ return parseCsa(input, resolveForeign);
659
+ },
660
+ };
661
+ }