@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,13 @@
1
+ export interface IsoTypedStage {
2
+ /** Owning identifier type key (is, tr, ts, amd, ...). */
3
+ typeKey: string;
4
+ code: string;
5
+ stageCode: string;
6
+ typeCode: string;
7
+ abbr: string[];
8
+ shortAbbr?: string | undefined;
9
+ longAbbr?: string | undefined;
10
+ harmonized?: string[] | undefined;
11
+ }
12
+ /** All 129 typed stages dumped from Pubid::Iso.identifier_types (see model.ts). */
13
+ export declare const ISO_TYPED_STAGES: IsoTypedStage[];
@@ -0,0 +1,391 @@
1
+ const TS = (typeKey, fields) => ({ typeKey, ...fields });
2
+ /** All 129 typed stages dumped from Pubid::Iso.identifier_types (see model.ts). */
3
+ export const ISO_TYPED_STAGES = [
4
+ TS("amd", {
5
+ code: "pwi_amd", stageCode: "proposal", typeCode: "amd", abbr: ["PWI Amd"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
6
+ }),
7
+ TS("amd", {
8
+ code: "np_amd", stageCode: "proposal", typeCode: "amd", abbr: ["NP Amd"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
9
+ }),
10
+ TS("amd", {
11
+ code: "awi_amd", stageCode: "preliminary", typeCode: "amd", abbr: ["AWI Amd"], harmonized: ["10.99", "20.00"]
12
+ }),
13
+ TS("amd", {
14
+ code: "wd_amd", stageCode: "working_draft", typeCode: "amd", abbr: ["WD Amd"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
15
+ }),
16
+ TS("amd", {
17
+ code: "committee_draft_amd", stageCode: "cd", typeCode: "amd", abbr: ["CD Amd"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
18
+ }),
19
+ TS("amd", {
20
+ code: "pdam", stageCode: "cd", typeCode: "amd", abbr: ["PDAM"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
21
+ }),
22
+ TS("amd", {
23
+ code: "damd", stageCode: "damd", typeCode: "amd", abbr: ["DAM", "DAmd"], shortAbbr: "DAM", harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
24
+ }),
25
+ TS("amd", {
26
+ code: "fdamd", stageCode: "fdamd", typeCode: "amd", abbr: ["FDAM", "FDAmd"], shortAbbr: "FDAM", harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
27
+ }),
28
+ TS("amd", {
29
+ code: "fpdam", stageCode: "fdamd", typeCode: "amd", abbr: ["FPDAM"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
30
+ }),
31
+ TS("amd", {
32
+ code: "prf_amd", stageCode: "prf", typeCode: "amd", abbr: ["PRF Amd"], harmonized: ["50.00"]
33
+ }),
34
+ TS("amd", {
35
+ code: "published", stageCode: "published", typeCode: "amd", abbr: ["Amd", "AMD", "Amd."], shortAbbr: "AMD", longAbbr: "Amd", harmonized: ["60.00", "60.60"]
36
+ }),
37
+ TS("cor", {
38
+ code: "pwi_cor", stageCode: "proposal", typeCode: "cor", abbr: ["PWI Cor"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
39
+ }),
40
+ TS("cor", {
41
+ code: "npcor", stageCode: "proposal", typeCode: "cor", abbr: ["NP Cor"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
42
+ }),
43
+ TS("cor", {
44
+ code: "awicor", stageCode: "preliminary", typeCode: "cor", abbr: ["AWI Cor"], harmonized: ["10.99", "20.00"]
45
+ }),
46
+ TS("cor", {
47
+ code: "wdcor", stageCode: "working_draft", typeCode: "cor", abbr: ["WD Cor"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
48
+ }),
49
+ TS("cor", {
50
+ code: "cdcor", stageCode: "cd", typeCode: "cor", abbr: ["CD Cor", "pDCOR"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
51
+ }),
52
+ TS("cor", {
53
+ code: "dcor", stageCode: "dcor", typeCode: "cor", abbr: ["DCor", "DCOR", "DIS Cor"], shortAbbr: "DCOR", longAbbr: "DCor", harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
54
+ }),
55
+ TS("cor", {
56
+ code: "fdcor", stageCode: "fdcor", typeCode: "cor", abbr: ["FDCor", "FDCOR", "FCOR", "FDIS Cor"], shortAbbr: "FDCOR", longAbbr: "FDCor", harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
57
+ }),
58
+ TS("cor", {
59
+ code: "prfcor", stageCode: "prf", typeCode: "cor", abbr: ["PRF Cor"], harmonized: ["50.00"]
60
+ }),
61
+ TS("cor", {
62
+ code: "pubcor", stageCode: "published", typeCode: "cor", abbr: ["Cor", "COR", "Cor."], shortAbbr: "COR", longAbbr: "Cor", harmonized: ["60.00", "60.60"]
63
+ }),
64
+ TS("dir", {
65
+ code: "pubguide", stageCode: "published", typeCode: "dir", abbr: ["DIR", "Directives Part", "Directives, Part", "Directives,", "Directives"], shortAbbr: "DIR", longAbbr: "Directives, Part", harmonized: ["60.00", "60.60"]
66
+ }),
67
+ TS("dir-sup", {
68
+ code: "pubdirsup", stageCode: "published", typeCode: "dir-sup", abbr: ["DIR SUP", "SUP", "Supplement"], harmonized: ["60.00", "60.60"]
69
+ }),
70
+ TS("ext", {
71
+ code: "pubext", stageCode: "published", typeCode: "ext", abbr: ["Ext"], harmonized: ["60.00", "60.60"]
72
+ }),
73
+ TS("guide", {
74
+ code: "pwiis", stageCode: "pwi", typeCode: "guide", abbr: ["PWI Guide"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
75
+ }),
76
+ TS("guide", {
77
+ code: "npguide", stageCode: "np", typeCode: "guide", abbr: ["NP Guide", "NP GUIDE"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98", "10.99"]
78
+ }),
79
+ TS("guide", {
80
+ code: "awiguide", stageCode: "awi", typeCode: "guide", abbr: ["AWI Guide", "AWI GUIDE"], harmonized: ["10.99", "20.00"]
81
+ }),
82
+ TS("guide", {
83
+ code: "wdguide", stageCode: "wd", typeCode: "guide", abbr: ["WD Guide", "WD GUIDE"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
84
+ }),
85
+ TS("guide", {
86
+ code: "cdguide", stageCode: "cd", typeCode: "guide", abbr: ["CD Guide", "CD GUIDE"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
87
+ }),
88
+ TS("guide", {
89
+ code: "dguide", stageCode: "dguide", typeCode: "guide", abbr: ["DGuide", "DGUIDE"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
90
+ }),
91
+ TS("guide", {
92
+ code: "fdguide", stageCode: "fdguide", typeCode: "guide", abbr: ["FDGuide", "FD Guide", "FD GUIDE"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
93
+ }),
94
+ TS("guide", {
95
+ code: "prfguide", stageCode: "prf", typeCode: "guide", abbr: ["PRF Guide", "PRF GUIDE"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
96
+ }),
97
+ TS("guide", {
98
+ code: "pubguide", stageCode: "published", typeCode: "guide", abbr: ["Guide", "GUIDE"], harmonized: ["60.00", "60.60"]
99
+ }),
100
+ TS("is", {
101
+ code: "isdp", stageCode: "dp", typeCode: "is", abbr: ["DP"]
102
+ }),
103
+ TS("is", {
104
+ code: "pwiis", stageCode: "pwi", typeCode: "is", abbr: ["PWI"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
105
+ }),
106
+ TS("is", {
107
+ code: "isnp", stageCode: "np", typeCode: "is", abbr: ["NP", "NWIP"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
108
+ }),
109
+ TS("is", {
110
+ code: "awiis", stageCode: "awi", typeCode: "is", abbr: ["AWI"], harmonized: ["10.99", "20.00"]
111
+ }),
112
+ TS("is", {
113
+ code: "wdis", stageCode: "wd", typeCode: "is", abbr: ["WD"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
114
+ }),
115
+ TS("is", {
116
+ code: "wds", stageCode: "wds", typeCode: "is", abbr: ["WDS"], harmonized: ["20.20", "20.60"]
117
+ }),
118
+ TS("is", {
119
+ code: "pcdis", stageCode: "pcd", typeCode: "is", abbr: ["preCD", "PreCD"], harmonized: ["29.00", "29.20", "29.60", "29.92", "29.93", "29.98", "29.99"]
120
+ }),
121
+ TS("is", {
122
+ code: "cdis", stageCode: "cd", typeCode: "is", abbr: ["CD"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
123
+ }),
124
+ TS("is", {
125
+ code: "dis", stageCode: "dis", typeCode: "is", abbr: ["DIS", "FPD"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
126
+ }),
127
+ TS("is", {
128
+ code: "fcdis", stageCode: "fcd", typeCode: "is", abbr: ["FCD"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
129
+ }),
130
+ TS("is", {
131
+ code: "fdis", stageCode: "fdis", typeCode: "is", abbr: ["FDIS"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
132
+ }),
133
+ TS("is", {
134
+ code: "prfis", stageCode: "prf", typeCode: "is", abbr: ["PRF", "Fpr"], harmonized: ["60.00"]
135
+ }),
136
+ TS("is", {
137
+ code: "is", stageCode: "published", typeCode: "is", abbr: ["", "IS"], harmonized: ["60.00", "60.60"]
138
+ }),
139
+ TS("is", {
140
+ code: "wdr", stageCode: "wdr", typeCode: "is", abbr: ["WDR"], harmonized: ["90.92"]
141
+ }),
142
+ TS("is", {
143
+ code: "wda", stageCode: "wda", typeCode: "is", abbr: ["WDA"], harmonized: ["90.93"]
144
+ }),
145
+ TS("is", {
146
+ code: "wdar", stageCode: "wdar", typeCode: "is", abbr: ["WDAR"], harmonized: ["95.99"]
147
+ }),
148
+ TS("isp", {
149
+ code: "pwiisp", stageCode: "pwi", typeCode: "isp", abbr: ["PWI ISP"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
150
+ }),
151
+ TS("isp", {
152
+ code: "npisp", stageCode: "np", typeCode: "isp", abbr: ["NP ISP"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
153
+ }),
154
+ TS("isp", {
155
+ code: "awiisp", stageCode: "awi", typeCode: "isp", abbr: ["AWI ISP"], harmonized: ["10.99", "20.00"]
156
+ }),
157
+ TS("isp", {
158
+ code: "wdisp", stageCode: "wd", typeCode: "isp", abbr: ["WD ISP"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
159
+ }),
160
+ TS("isp", {
161
+ code: "cdisp", stageCode: "cd", typeCode: "isp", abbr: ["CD ISP"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
162
+ }),
163
+ TS("isp", {
164
+ code: "disp", stageCode: "disp", typeCode: "isp", abbr: ["DISP", "DIS ISP"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
165
+ }),
166
+ TS("isp", {
167
+ code: "fdisp", stageCode: "fdis", typeCode: "isp", abbr: ["FDISP", "FDIS ISP"], harmonized: ["50.00", "50.20", "50.60", "50.92"]
168
+ }),
169
+ TS("isp", {
170
+ code: "prfisp", stageCode: "prf", typeCode: "isp", abbr: ["PRF ISP"], harmonized: ["60.00"]
171
+ }),
172
+ TS("isp", {
173
+ code: "isp", stageCode: "published", typeCode: "isp", abbr: ["ISP"], harmonized: ["60.00", "60.60"]
174
+ }),
175
+ TS("iwa", {
176
+ code: "pwiiwa", stageCode: "pwi", typeCode: "iwa", abbr: ["PWI IWA"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
177
+ }),
178
+ TS("iwa", {
179
+ code: "npiwa", stageCode: "np", typeCode: "iwa", abbr: ["NP IWA"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
180
+ }),
181
+ TS("iwa", {
182
+ code: "awiiwa", stageCode: "awi", typeCode: "iwa", abbr: ["AWI IWA"], harmonized: ["10.99", "20.00"]
183
+ }),
184
+ TS("iwa", {
185
+ code: "wdiwa", stageCode: "wd", typeCode: "iwa", abbr: ["WD IWA"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
186
+ }),
187
+ TS("iwa", {
188
+ code: "cdiwa", stageCode: "cd", typeCode: "iwa", abbr: ["CD IWA"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
189
+ }),
190
+ TS("iwa", {
191
+ code: "diwa", stageCode: "diwa", typeCode: "iwa", abbr: ["DIWA"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
192
+ }),
193
+ TS("iwa", {
194
+ code: "prfiwa", stageCode: "prf", typeCode: "iwa", abbr: ["PRF IWA"], harmonized: ["50.00"]
195
+ }),
196
+ TS("iwa", {
197
+ code: "iwa", stageCode: "published", typeCode: "iwa", abbr: ["IWA"], harmonized: ["60.00", "60.60"]
198
+ }),
199
+ TS("pas", {
200
+ code: "pwipas", stageCode: "pwi", typeCode: "pas", abbr: ["PWI PAS"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
201
+ }),
202
+ TS("pas", {
203
+ code: "nppas", stageCode: "np", typeCode: "pas", abbr: ["NP PAS"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
204
+ }),
205
+ TS("pas", {
206
+ code: "awipas", stageCode: "awi", typeCode: "pas", abbr: ["AWI PAS"], harmonized: ["10.99", "20.00"]
207
+ }),
208
+ TS("pas", {
209
+ code: "wdpas", stageCode: "wd", typeCode: "pas", abbr: ["WD PAS"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
210
+ }),
211
+ TS("pas", {
212
+ code: "cdpas", stageCode: "cd", typeCode: "pas", abbr: ["CD PAS"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
213
+ }),
214
+ TS("pas", {
215
+ code: "dpas", stageCode: "dpas", typeCode: "pas", abbr: ["DPAS"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
216
+ }),
217
+ TS("pas", {
218
+ code: "fdpas", stageCode: "final_draft", typeCode: "pas", abbr: ["FDPAS"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
219
+ }),
220
+ TS("pas", {
221
+ code: "prfpas", stageCode: "prf", typeCode: "pas", abbr: ["PRF PAS"], harmonized: ["60.00"]
222
+ }),
223
+ TS("pas", {
224
+ code: "pas", stageCode: "published", typeCode: "pas", abbr: ["PAS"], harmonized: ["60.00", "60.60"]
225
+ }),
226
+ TS("rec", {
227
+ code: "dp", stageCode: "np", typeCode: "rec", abbr: ["DP"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99", "10.00", "10.20", "10.60", "10.92", "10.93", "10.98", "10.99", "20.00", "20.20", "20.60", "20.92", "20.93", "20.98", "20.99", "30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99", "40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
228
+ }),
229
+ TS("rec", {
230
+ code: "rec", stageCode: "published", typeCode: "rec", abbr: ["R"], harmonized: ["60.00", "60.60"]
231
+ }),
232
+ TS("tr", {
233
+ code: "pwitr", stageCode: "pwi", typeCode: "tr", abbr: ["PWI TR"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
234
+ }),
235
+ TS("tr", {
236
+ code: "nptr", stageCode: "np", typeCode: "tr", abbr: ["NP TR"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
237
+ }),
238
+ TS("tr", {
239
+ code: "awitr", stageCode: "awi", typeCode: "tr", abbr: ["AWI TR"], harmonized: ["10.99", "20.00"]
240
+ }),
241
+ TS("tr", {
242
+ code: "wdtr", stageCode: "wd", typeCode: "tr", abbr: ["WD TR"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
243
+ }),
244
+ TS("tr", {
245
+ code: "cdtr", stageCode: "cd", typeCode: "tr", abbr: ["CD TR"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
246
+ }),
247
+ TS("tr", {
248
+ code: "pdtr", stageCode: "cd", typeCode: "tr", abbr: ["PDTR"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
249
+ }),
250
+ TS("tr", {
251
+ code: "dtr", stageCode: "draft", typeCode: "tr", abbr: ["DTR", "DIS TR"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
252
+ }),
253
+ TS("tr", {
254
+ code: "fdtr", stageCode: "final_draft", typeCode: "tr", abbr: ["FDTR", "FDIS TR"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
255
+ }),
256
+ TS("tr", {
257
+ code: "prftr", stageCode: "prf", typeCode: "tr", abbr: ["PRF TR"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
258
+ }),
259
+ TS("tr", {
260
+ code: "pubtr", stageCode: "published", typeCode: "tr", abbr: ["TR"], harmonized: ["60.00", "60.60"]
261
+ }),
262
+ TS("ts", {
263
+ code: "pwits", stageCode: "pwi", typeCode: "ts", abbr: ["PWI TS"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
264
+ }),
265
+ TS("ts", {
266
+ code: "npts", stageCode: "np", typeCode: "ts", abbr: ["NP TS"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
267
+ }),
268
+ TS("ts", {
269
+ code: "awits", stageCode: "awi", typeCode: "ts", abbr: ["AWI TS"], harmonized: ["10.99", "20.00"]
270
+ }),
271
+ TS("ts", {
272
+ code: "wdts", stageCode: "wd", typeCode: "ts", abbr: ["WD TS"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
273
+ }),
274
+ TS("ts", {
275
+ code: "cdts", stageCode: "cd", typeCode: "ts", abbr: ["CDTS", "CD TS"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
276
+ }),
277
+ TS("ts", {
278
+ code: "pdts", stageCode: "cd", typeCode: "ts", abbr: ["PDTS"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
279
+ }),
280
+ TS("ts", {
281
+ code: "dts", stageCode: "dts", typeCode: "ts", abbr: ["DTS"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
282
+ }),
283
+ TS("ts", {
284
+ code: "fdts", stageCode: "fdts", typeCode: "ts", abbr: ["FDTS"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
285
+ }),
286
+ TS("ts", {
287
+ code: "prfts", stageCode: "prf", typeCode: "ts", abbr: ["PRF TS"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
288
+ }),
289
+ TS("ts", {
290
+ code: "pubts", stageCode: "published", typeCode: "ts", abbr: ["TS"], harmonized: ["60.00", "60.60"]
291
+ }),
292
+ TS("data", {
293
+ code: "npdata", stageCode: "np", typeCode: "data", abbr: ["NP DATA"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
294
+ }),
295
+ TS("data", {
296
+ code: "awidata", stageCode: "awi", typeCode: "data", abbr: ["AWI DATA"], harmonized: ["10.99", "20.00"]
297
+ }),
298
+ TS("data", {
299
+ code: "wddata", stageCode: "wd", typeCode: "data", abbr: ["WD DATA"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
300
+ }),
301
+ TS("data", {
302
+ code: "cddata", stageCode: "cd", typeCode: "data", abbr: ["CD DATA"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
303
+ }),
304
+ TS("data", {
305
+ code: "ddata", stageCode: "ddata", typeCode: "data", abbr: ["D DATA"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
306
+ }),
307
+ TS("data", {
308
+ code: "prfdata", stageCode: "prf", typeCode: "data", abbr: ["PRF DATA"], harmonized: ["60.00"]
309
+ }),
310
+ TS("data", {
311
+ code: "pubdata", stageCode: "published", typeCode: "data", abbr: ["DATA"], harmonized: ["60.00", "60.60"]
312
+ }),
313
+ TS("suppl", {
314
+ code: "pwisuppl", stageCode: "pwi", typeCode: "suppl", abbr: ["PWI Suppl"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
315
+ }),
316
+ TS("suppl", {
317
+ code: "npsuppl", stageCode: "np", typeCode: "suppl", abbr: ["NP Suppl"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
318
+ }),
319
+ TS("suppl", {
320
+ code: "awisuppl", stageCode: "awi", typeCode: "suppl", abbr: ["AWI Suppl"], harmonized: ["10.99", "20.00"]
321
+ }),
322
+ TS("suppl", {
323
+ code: "wdsuppl", stageCode: "wd", typeCode: "suppl", abbr: ["WD Suppl"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
324
+ }),
325
+ TS("suppl", {
326
+ code: "cdsuppl", stageCode: "cd", typeCode: "suppl", abbr: ["CD Suppl"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
327
+ }),
328
+ TS("suppl", {
329
+ code: "dsuppl", stageCode: "dsuppl", typeCode: "suppl", abbr: ["DSuppl", "DIS Suppl"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
330
+ }),
331
+ TS("suppl", {
332
+ code: "fdsuppl", stageCode: "fdsuppl", typeCode: "suppl", abbr: ["FDSuppl", "FDIS Suppl"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
333
+ }),
334
+ TS("suppl", {
335
+ code: "prfsuppl", stageCode: "prf", typeCode: "suppl", abbr: ["PRF Suppl"], harmonized: ["50.00"]
336
+ }),
337
+ TS("suppl", {
338
+ code: "pubsuppl", stageCode: "published", typeCode: "suppl", abbr: ["Suppl", "Suppl."], harmonized: ["60.00", "60.60"]
339
+ }),
340
+ TS("tta", {
341
+ code: "pwitta", stageCode: "pwi", typeCode: "tta", abbr: ["PWI TTA"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
342
+ }),
343
+ TS("tta", {
344
+ code: "nptta", stageCode: "np", typeCode: "tta", abbr: ["NP TTA"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
345
+ }),
346
+ TS("tta", {
347
+ code: "awitta", stageCode: "awi", typeCode: "tta", abbr: ["AWI TTA"], harmonized: ["10.99", "20.00"]
348
+ }),
349
+ TS("tta", {
350
+ code: "wdtta", stageCode: "wd", typeCode: "tta", abbr: ["WD TTA"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
351
+ }),
352
+ TS("tta", {
353
+ code: "cdtta", stageCode: "cd", typeCode: "tta", abbr: ["CD TTA"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
354
+ }),
355
+ TS("tta", {
356
+ code: "dtta", stageCode: "draft", typeCode: "tta", abbr: ["DTTA"], harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
357
+ }),
358
+ TS("tta", {
359
+ code: "fdtta", stageCode: "final_draft", typeCode: "tta", abbr: ["FDTTA"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
360
+ }),
361
+ TS("tta", {
362
+ code: "prftta", stageCode: "prf", typeCode: "tta", abbr: ["PRF TTA"], harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
363
+ }),
364
+ TS("tta", {
365
+ code: "pubtta", stageCode: "published", typeCode: "tta", abbr: ["TTA"], harmonized: ["60.00", "60.60"]
366
+ }),
367
+ TS("add", {
368
+ code: "pwi_add", stageCode: "proposal", typeCode: "add", abbr: ["PWI Add"], harmonized: ["00.00", "00.20", "00.60", "00.92", "00.93", "00.98", "00.99"]
369
+ }),
370
+ TS("add", {
371
+ code: "np_add", stageCode: "proposal", typeCode: "add", abbr: ["NP Add"], harmonized: ["10.00", "10.20", "10.60", "10.92", "10.93", "10.98"]
372
+ }),
373
+ TS("add", {
374
+ code: "awi_add", stageCode: "preliminary", typeCode: "add", abbr: ["AWI Add"], harmonized: ["10.99", "20.00"]
375
+ }),
376
+ TS("add", {
377
+ code: "wd_add", stageCode: "working_draft", typeCode: "add", abbr: ["WD Add"], harmonized: ["20.20", "20.60", "20.92", "20.93", "20.98", "20.99"]
378
+ }),
379
+ TS("add", {
380
+ code: "committee_draft_add", stageCode: "cd", typeCode: "add", abbr: ["CD Add"], harmonized: ["30.00", "30.20", "30.60", "30.92", "30.93", "30.98", "30.99"]
381
+ }),
382
+ TS("add", {
383
+ code: "dad", stageCode: "dad", typeCode: "add", abbr: ["DAD", "DAdd", "D ADD", "Dad", "DIS Add"], shortAbbr: "DAD", harmonized: ["40.00", "40.20", "40.60", "40.92", "40.93", "40.98", "40.99"]
384
+ }),
385
+ TS("add", {
386
+ code: "fdad", stageCode: "fdad", typeCode: "add", abbr: ["FDAD", "FDAdd", "FD ADD", "FDad", "FDIS Add"], shortAbbr: "FDAD", harmonized: ["50.00", "50.20", "50.60", "50.92", "50.98", "50.99"]
387
+ }),
388
+ TS("add", {
389
+ code: "published", stageCode: "published", typeCode: "add", abbr: ["Add", "ADD", "Add.", "Addendum"], shortAbbr: "ADD", longAbbr: "Add", harmonized: ["60.00", "60.60"]
390
+ }),
391
+ ];
@@ -0,0 +1,4 @@
1
+ import { Grammar } from "../../grammar/engine.js";
2
+ /** ITU's listings carry doubled spaces; whitespace is never significant. */
3
+ export declare function normalizeWhitespaceItu(input: string): string;
4
+ export declare const ituGrammar: Grammar;
@@ -0,0 +1,205 @@
1
+ import { match, str } from "../../grammar/engine.js";
2
+ /**
3
+ * Port of lib/pubid/itu/parser.rb — the ITU grammar, 1:1 in dependency
4
+ * order. Load-bearing orderings (PEG ordered choice never re-enters a
5
+ * succeeded alternative, so neighbour order in `identifier` is pinned
6
+ * by the Ruby comments):
7
+ * annex_to | special_publication | supplement | annex | appendix |
8
+ * report | handbook | numeric_question | letter_question | with_series |
9
+ * contribution | series_code | without_series
10
+ * and supplement chains precede supplement_with_base (which would
11
+ * otherwise strand "/Technical Cor. 1" trailing input).
12
+ */
13
+ function buildRules() {
14
+ const rules = {};
15
+ const rule = (name, build) => {
16
+ rules[name] = build();
17
+ };
18
+ const digit = match("[0-9]");
19
+ const digits = digit.repeat(1, Infinity);
20
+ const letter = match("[A-Z]");
21
+ const space = str(" ");
22
+ const dash = str("-");
23
+ const dot = str(".");
24
+ // ITU prefix — the optional "Recommendation " long form (issues #233/#234).
25
+ rule("itu_prefix", () => str("Recommendation ")
26
+ .then(str("ITU"), dash.or(space))
27
+ .or(str("ITU").then(dash.or(space))));
28
+ rule("sector", () => str("R").or(str("T"), str("D")).as("sector"));
29
+ // Study groups (SG1, SG12) or 1-3 letter series (BO, V, X).
30
+ rule("series", () => str("SG")
31
+ .then(digits)
32
+ .or(letter.repeat(1, 3))
33
+ .as("series"));
34
+ // A numeric series GROUP ("E-100", "G-100") — exactly one leading
35
+ // letter, or it would shadow series-code documents (EMC-5, IMPL-8).
36
+ rule("series_group", () => letter.then(digits.maybe(), dash, digits).as("series"));
37
+ rule("series_word", () => space.then(str("series").as("series_word")));
38
+ rule("number", () => digits.as("number"));
39
+ rule("subseries", () => dot.then(digits.as("subseries")));
40
+ // "quarter" is a real ITU misspelling kept verbatim so the two
41
+ // records stay distinct from their "quater" siblings.
42
+ const seriesSuffixWord = () => str("bis").or(str("ter"), str("quater"), str("quarter"));
43
+ // Glued edition suffix ("X.50bis", "V.8bis").
44
+ rule("series_suffix", () => seriesSuffixWord().as("series_suffix"));
45
+ // The spaced form ("E.250 bis") — the captured space IS the marker
46
+ // that sets series_suffix_spaced.
47
+ rule("series_suffix_spaced", () => space.as("series_suffix_spaced").then(seriesSuffixWord().as("series_suffix")));
48
+ // A single trailing variant letter ("D.200 R", glued "D.502R",
49
+ // lowercase "I.256.2a"). The A-R cap excludes "S" of " Suppl." and
50
+ // "V" of " V2"; the absent-guard stops it eating "Amd."/"Annex"/"Cor.".
51
+ rule("qualifier_letter", () => match("[A-R]")
52
+ .or(match("[a-r]"))
53
+ .as("qualifier")
54
+ .then(match("[A-Za-z0-9]").absent()));
55
+ rule("qualifier_glued", () => rules["qualifier_letter"]);
56
+ rule("qualifier_spaced", () => space.as("qualifier_spaced").then(rules["qualifier_letter"]));
57
+ // Print-form suffixes spliced after code, before combined_suffixes.
58
+ rule("code_suffixes", () => rules["series_suffix_spaced"]
59
+ .maybe()
60
+ .then(rules["qualifier_spaced"].maybe()));
61
+ rule("attachment", () => space.then(str("attachment").as("attachment")));
62
+ // "ITU-T Q.120-Q.139 (11/1988)" — one document covering a range.
63
+ rule("range_end", () => dash.then(letter.repeat(1, 3).then(dot, digits).as("range_end")));
64
+ rule("part", () => dash.then(digits.as("part")));
65
+ rule("parts", () => rules["part"].repeat(0, Infinity).as("parts"));
66
+ // Imp code first: the standard code needs digits, which "Imp712" lacks.
67
+ rule("imp_code", () => str("Imp")
68
+ .as("imp_marker")
69
+ .then(digits.or(letter.repeat(1, 3)).as("number"), rules["subseries"].maybe(), rules["parts"]));
70
+ rule("standard_code", () => rules["number"]
71
+ .then(rules["series_suffix"].maybe(), rules["subseries"].maybe(), rules["parts"], rules["qualifier_glued"].maybe()));
72
+ rule("code", () => rules["imp_code"].or(rules["standard_code"]));
73
+ rule("date_part", () => space.then(str("("), digits.as("month").then(str("/")).maybe(), digit.repeat(4, 4).as("year"), str(")")));
74
+ // "(V14)" plus the bare spellings "V2", "v10", "v.1" — all
75
+ // normalise to the parenthesised form on render.
76
+ rule("version_part", () => space.then(str("(V")
77
+ .then(digits.as("version"), str(")"))
78
+ .or(str("V")
79
+ .or(str("v"))
80
+ .then(dot.maybe(), digits.as("version")))));
81
+ rule("language", () => dash.then(match("[EFASCR]").as("language")));
82
+ // "/Y.1351" joint designations, repeatable for triples. Each
83
+ // designation carries its own print-form suffixes ("D.81/F.80 bis").
84
+ rule("combined_designation", () => str("/").then(rules["series"]
85
+ .then(dot, digits.as("number"), rules["subseries"].maybe(), rules["parts"], rules["qualifier_glued"].maybe(), rules["series_suffix_spaced"].maybe(), rules["qualifier_spaced"].maybe())
86
+ .as("designation")));
87
+ rule("combined_suffixes", () => rules["combined_designation"].repeat(1, Infinity).as("combined"));
88
+ // "Technical" is bound to the Cor. branch alone — offered at the
89
+ // head it would be silently dropped on "Technical Err. 1" and
90
+ // collapse that onto another document.
91
+ rule("technical_marker", () => str("Technical").as("technical").then(space));
92
+ rule("supplement_type", () => str("Suppl.")
93
+ .or(str("Suppl"), str("Amd."), str("Amd"), str("Add."), str("Add"), str("Err."), str("Err"))
94
+ .as("supplement_type")
95
+ .or(rules["technical_marker"]
96
+ .maybe()
97
+ .then(str("Cor.").or(str("Cor")).as("supplement_type"))));
98
+ // The captured space marks the SPACED ordinal; its absence is the
99
+ // glued flag. The ordinal itself may be dotted ("M Suppl. 1.1").
100
+ rule("supplement_number", () => space
101
+ .as("supplement_space")
102
+ .maybe()
103
+ .then(digits.then(dot.then(digits).repeat(0, Infinity)).as("supplement_number")));
104
+ rule("supplement_date", () => space.then(str("("), digits.as("supplement_month").then(str("/")).maybe(), digit.repeat(4, 4).as("supplement_year"), str(")")));
105
+ rule("base_with_series", () => rules["itu_prefix"]
106
+ .then(rules["sector"], space, rules["series"], dot, rules["code"], rules["range_end"].maybe(), rules["code_suffixes"], rules["combined_suffixes"].maybe(), rules["series_word"].maybe(), rules["attachment"].maybe(), rules["version_part"].maybe(), rules["date_part"].maybe()));
107
+ rule("base_without_series", () => rules["itu_prefix"]
108
+ .then(rules["sector"], space, rules["code"], rules["code_suffixes"], rules["attachment"].maybe(), rules["version_part"].maybe(), rules["date_part"].maybe()));
109
+ // Series-code documents ("EMC-5", "SEC-QKD"): 2+ letter mnemonic,
110
+ // dash-joined number. The OB guard keeps "ITU-T OB-1" a clean parse
111
+ // failure rather than an escaped ArgumentError.
112
+ rule("series_code_body", () => str("OB")
113
+ .then(dash)
114
+ .absent()
115
+ .then(letter.repeat(2, Infinity).as("series"), dash.as("series_dash"), digits.or(letter.repeat(1, Infinity)).as("number"), rules["parts"]));
116
+ // "ITU-R SG17-C1000" (pubid#340) — the "-C" marker distinguishes it.
117
+ rule("contribution", () => rules["itu_prefix"]
118
+ .then(rules["sector"], space, rules["series"], str("-C").as("contribution_marker"), rules["number"], rules["parts"], rules["language"].maybe()));
119
+ rule("base_series_code", () => rules["itu_prefix"]
120
+ .then(rules["sector"], space, rules["series_code_body"], rules["version_part"].maybe(), rules["date_part"].maybe()));
121
+ rule("series_code_identifier", () => rules["base_series_code"].then(rules["language"].maybe()));
122
+ rule("report_word", () => str("Report").as("report_marker"));
123
+ // No combined_suffixes: a joint Report would silently drop the
124
+ // marker in the combined branch; a clean failure is better. The OB
125
+ // guard mirrors series_code_body's.
126
+ rule("report_body", () => str("OB")
127
+ .then(dot)
128
+ .absent()
129
+ .then(rules["series"].then(dot).maybe(), rules["code"], rules["range_end"].maybe(), rules["code_suffixes"], rules["series_word"].maybe(), rules["attachment"].maybe(), rules["version_part"].maybe(), rules["date_part"].maybe()));
130
+ rule("base_report", () => rules["report_word"]
131
+ .then(space, rules["itu_prefix"], rules["sector"], space, rules["report_body"])
132
+ .or(rules["itu_prefix"].then(rules["sector"], space, rules["report_word"], space, rules["report_body"])));
133
+ rule("report_identifier", () => rules["base_report"].then(rules["language"].maybe()));
134
+ rule("base", () => rules["base_report"].or(rules["base_with_series"], rules["base_without_series"], rules["base_series_code"]));
135
+ // Annex label: one letter, optional number and/or "+" ("F3", "C+").
136
+ rule("annex_label", () => letter.then(digits.maybe(), str("+").maybe()));
137
+ rule("annex_body", () => rules["base"]
138
+ .as("base")
139
+ .then(space, str("Annex"), space, rules["annex_label"].as("annex_number"), rules["date_part"].maybe()));
140
+ rule("annex_identifier", () => rules["annex_body"].then(rules["language"].maybe()));
141
+ rule("roman", () => match("[IVX]").repeat(1, Infinity));
142
+ rule("appendix_material", () => space.then(str("test vectors").or(str("Software")).as("appendix_material")));
143
+ rule("appendix_body", () => rules["base"]
144
+ .as("base")
145
+ .then(space, str("App."), space.maybe(), rules["roman"].as("appendix_number"), rules["appendix_material"].maybe(), rules["date_part"].maybe()));
146
+ rule("appendix_identifier", () => rules["appendix_body"].then(rules["language"].maybe()));
147
+ rule("supplement_with_base", () => rules["annex_body"]
148
+ .as("base")
149
+ .or(rules["appendix_body"].as("base"), rules["base"].as("base"))
150
+ .then(space, rules["supplement_type"], rules["supplement_number"], rules["supplement_date"].maybe(), rules["language"].maybe()));
151
+ // series_group FIRST: the greedy 1-3 letter series would take the
152
+ // "E" of "E-100" and strand the required space.
153
+ rule("supplement_series_only", () => rules["itu_prefix"]
154
+ .then(rules["sector"], space, rules["series_group"].or(rules["series"]), rules["series_word"].maybe(), space, rules["supplement_type"], rules["supplement_number"], rules["supplement_date"].maybe(), rules["language"].maybe()));
155
+ // A supplement whose base is itself a supplement (Err. on Amd.).
156
+ rule("chained_supplement", () => rules["supplement_with_base"]
157
+ .or(rules["supplement_series_only"])
158
+ .as("base")
159
+ .then(space, rules["supplement_type"], rules["supplement_number"], rules["supplement_date"].maybe(), rules["language"].maybe()));
160
+ // "Amd. 1/Technical Cor. 1" — one Technical Corrigendum against an
161
+ // Amendment, sharing the trailing date. The "/" marker round-trips.
162
+ rule("slash_chained_supplement", () => rules["supplement_with_base"]
163
+ .as("base")
164
+ .then(str("/").as("supplement_slash"), rules["supplement_type"], rules["supplement_number"], rules["supplement_date"].maybe(), rules["language"].maybe()));
165
+ rule("supplement_identifier", () => rules["chained_supplement"]
166
+ .or(rules["slash_chained_supplement"], rules["supplement_with_base"], rules["supplement_series_only"]));
167
+ rule("with_series", () => rules["itu_prefix"]
168
+ .then(rules["sector"], space, rules["series"], dot, rules["code"], rules["range_end"].maybe(), rules["code_suffixes"], rules["combined_suffixes"].maybe(), rules["series_word"].maybe(), rules["attachment"].maybe(), rules["version_part"].maybe(), rules["date_part"].maybe(), rules["language"].maybe()));
169
+ rule("without_series", () => rules["itu_prefix"]
170
+ .then(rules["sector"], space, rules["code"], rules["code_suffixes"], rules["attachment"].maybe(), rules["version_part"].maybe(), rules["date_part"].maybe(), rules["language"].maybe()));
171
+ rule("ob_series", () => str("OB").as("series"));
172
+ rule("ob_dot_body", () => dot.then(rules["number"]));
173
+ rule("ob_no_body", () => space.then(str("No."), space, rules["number"]));
174
+ rule("ob_with_sector", () => rules["itu_prefix"]
175
+ .then(rules["sector"].then(space).maybe(), rules["ob_series"], rules["ob_dot_body"].or(rules["ob_no_body"]), rules["date_part"].maybe(), rules["language"].maybe()));
176
+ rule("ob_long_form", () => rules["itu_prefix"]
177
+ .then(rules["sector"].then(space).maybe(), str("Operational Bulletin").as("_op_bull"), space, str("No."), space, rules["number"], rules["date_part"].maybe(), rules["language"].maybe()));
178
+ rule("special_publication", () => rules["ob_with_sector"].or(rules["ob_long_form"]));
179
+ rule("annex_to_identifier", () => str("Annex to").then(space, rules["special_publication"].as("annex_to")));
180
+ rule("handbook", () => rules["itu_prefix"]
181
+ .then(rules["sector"], space, rules["number"], dot, str("HDB").as("handbook_marker"), rules["date_part"].maybe()));
182
+ rule("numeric_question", () => rules["itu_prefix"]
183
+ .then(rules["sector"], space, rules["number"], rules["parts"], str("/"), digits.as("study_group"), str(":").as("question_colon").maybe()));
184
+ rule("question_tail", () => rules["number"]
185
+ .then(str("/BL").as("has_bl").maybe(), str("/"), digits.as("study_group")));
186
+ rule("letter_question", () => rules["itu_prefix"]
187
+ .then(rules["sector"], space, rules["series"], dot, str("[")
188
+ .as("bracketed")
189
+ .then(rules["question_tail"], str("]"))
190
+ .or(rules["question_tail"]), str(":").as("question_colon").maybe()));
191
+ rule("common_text_twin", () => space
192
+ .then(str("|"), space, match("[^|]").repeat(1, Infinity))
193
+ .as("common_text_twin"));
194
+ rule("identifier", () => rules["annex_to_identifier"]
195
+ .or(rules["special_publication"], rules["supplement_identifier"], rules["annex_identifier"], rules["appendix_identifier"], rules["report_identifier"], rules["handbook"], rules["numeric_question"], rules["letter_question"], rules["with_series"], rules["contribution"], rules["series_code_identifier"], rules["without_series"]));
196
+ rule("root", () => rules["identifier"]
197
+ .then(rules["common_text_twin"])
198
+ .or(rules["identifier"]));
199
+ return rules;
200
+ }
201
+ /** ITU's listings carry doubled spaces; whitespace is never significant. */
202
+ export function normalizeWhitespaceItu(input) {
203
+ return input.replace(/\s+/g, " ").trim();
204
+ }
205
+ export const ituGrammar = { rules: buildRules(), root: "root" };