@pubid/pubid 0.1.62 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifact/corpus.json.gz +0 -0
- package/dist/flavors/iala/index.d.ts +26 -0
- package/dist/flavors/iala/index.js +183 -20
- package/dist/flavors/iho/index.js +26 -26
- package/dist/pubid-urn/decoder.d.ts +5 -0
- package/dist/pubid-urn/decoder.js +30 -1
- package/dist/pubid-urn/schemas/iala.js +1 -0
- package/dist/pubid-urn/schemas/iho.js +1 -1
- package/dist/urn/parsers.js +11 -9
- package/package.json +1 -1
- package/vendor/parg/iala.json +1 -1
- package/vendor/parg/iho.json +1 -1
package/artifact/corpus.json.gz
CHANGED
|
Binary file
|
|
@@ -16,6 +16,7 @@ export declare class IalaIdentifier extends BaseIdentifier {
|
|
|
16
16
|
}
|
|
17
17
|
declare class IalaUrnGenerator extends BaseUrnGenerator<IalaIdentifier> {
|
|
18
18
|
generate(): string;
|
|
19
|
+
private baseCode;
|
|
19
20
|
}
|
|
20
21
|
export declare class IalaAnnex extends IalaIdentifier {
|
|
21
22
|
static polymorphicName: string;
|
|
@@ -28,5 +29,30 @@ export declare class IalaAnnex extends IalaIdentifier {
|
|
|
28
29
|
typeLetter(): string | undefined;
|
|
29
30
|
render(): string;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* The S-100-family product specification — the IHO-granted S-201..S-299
|
|
34
|
+
* range (pubid#777). The hyphenated code face is rendered by the
|
|
35
|
+
* renderer/URN generator directly; there is no type letter (an "S"
|
|
36
|
+
* short would collide with Standard's). The canonical face is bare —
|
|
37
|
+
* the designation carries no publisher token (the WMO S-100 rule).
|
|
38
|
+
*/
|
|
39
|
+
export declare class IalaProductSpecification extends IalaIdentifier {
|
|
40
|
+
static polymorphicName: string;
|
|
41
|
+
static urnGenerator: typeof IalaUrnGenerator;
|
|
42
|
+
typeLetter(): string | undefined;
|
|
43
|
+
render(): string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The codeless slug publication (gem #772): iala.int reports and
|
|
47
|
+
* proceedings with no code, named by their product-URL slug. The slug
|
|
48
|
+
* is held in the inherited `number` attribute — the index key — and no
|
|
49
|
+
* padding applies. There is no type letter: "IALA <slug>".
|
|
50
|
+
*/
|
|
51
|
+
export declare class IalaPublication extends IalaIdentifier {
|
|
52
|
+
static polymorphicName: string;
|
|
53
|
+
static urnGenerator: typeof IalaUrnGenerator;
|
|
54
|
+
typeLetter(): string | undefined;
|
|
55
|
+
toUrn(): string;
|
|
56
|
+
}
|
|
31
57
|
export declare function ialaGrammarImplementation(): FlavorImplementation;
|
|
32
58
|
export {};
|
|
@@ -4,13 +4,34 @@ import { BaseIdentifier, registerType } from "../../model/identifier.js";
|
|
|
4
4
|
import { extendAttributes, keyValue } from "../../model/attribute.js";
|
|
5
5
|
import { BaseUrnGenerator } from "../../model/urn-generator.js";
|
|
6
6
|
/**
|
|
7
|
-
* 1:1 port of lib/pubid/iala/ —
|
|
7
|
+
* 1:1 port of lib/pubid/iala/ — 880 corpus rows. Typed prefixes
|
|
8
8
|
* (S/R/G/M/C/GA/L/X/P plus the legacy A session letter, which routes to
|
|
9
9
|
* GeneralAssembly — there is no Advice type, pubid#734), class-driven
|
|
10
10
|
* zero-padding (4 for S/R/G/M/C, 2+2 dotted for GA, verbatim for the
|
|
11
11
|
* rest), "Ed 2.0" and ":ed2.0" edition forms, (F) languages, and Annex
|
|
12
12
|
* wrappers. URN is the MRN form:
|
|
13
13
|
* urn:mrn:iala:pub:<lower-code>[:ed<n>][:<lang>].
|
|
14
|
+
*
|
|
15
|
+
* The S-100-family product specifications (pubid#777, grammar#146): the
|
|
16
|
+
* IHO-granted S-201..S-299 range hyphenated ("S-201"), the dotted x.y.z
|
|
17
|
+
* edition on the BARE designation face ("S-201 2.0.0", iala.int's own
|
|
18
|
+
* citation form) with "Ed 2.0.0" and the compact ":ed2.0.0" as
|
|
19
|
+
* normalizing aliases; the hundreds digit is fixed to 2 by the grant and
|
|
20
|
+
* S-200 is excluded, so WMO's S-4xx and IHO's S-1xx never parse here.
|
|
21
|
+
* The annex wrapper rides the same class (the S-201 package's
|
|
22
|
+
* sub-numbered letters "ANNEX B2" widen the shared letter rule to an
|
|
23
|
+
* optional trailing digit); the annex edition face follows the base's
|
|
24
|
+
* family (bare for S-100, "Ed" for the legacy series).
|
|
25
|
+
*
|
|
26
|
+
* The codeless slug publications (gem #772, relaton#604): iala.int
|
|
27
|
+
* reports/proceedings with no code, named by their product-URL slug
|
|
28
|
+
* ("IALA arctic-seminar-report (E)"). The slug is two or more
|
|
29
|
+
* hyphen-joined [a-z0-9] runs whose FIRST run must not look like a code
|
|
30
|
+
* (0-2 letters then digits), so a lower-case or letterless typo of a
|
|
31
|
+
* typed code ("IALA s1070", "IALA 1070 Ed 2.0") still fails; the
|
|
32
|
+
* "IALA " prefix is mandatory for a slug (optional for a typed code).
|
|
33
|
+
* The slug is `number` — the index key — and the type has no MRN URN
|
|
34
|
+
* (the gem's Publication#to_urn → nil).
|
|
14
35
|
*/
|
|
15
36
|
function buildRules() {
|
|
16
37
|
const rules = {};
|
|
@@ -44,15 +65,52 @@ function buildRules() {
|
|
|
44
65
|
.as("language_group"));
|
|
45
66
|
rule("publisher", () => str("IALA").then(space).maybe());
|
|
46
67
|
// The letter's absent-lowercase guard keeps "Ed 1"'s E from being
|
|
47
|
-
// mis-captured as an annex letter.
|
|
68
|
+
// mis-captured as an annex letter. The letter takes an optional
|
|
69
|
+
// trailing digit (the S-201 package's sub-numbered annexes "Annex B2"
|
|
70
|
+
// / "Annex D1"), grammar#146.
|
|
71
|
+
const annexLetter = () => space
|
|
72
|
+
.then(match("[A-Z]").then(match("[0-9]").maybe()).as("annex_letter"), match("[a-z]").absent())
|
|
73
|
+
.maybe();
|
|
48
74
|
rule("annex_identifier", () => rules["publisher"]
|
|
49
75
|
.then(rules["type_letter"], rules["number_with_dots"], rules["subpart"].maybe())
|
|
50
76
|
.as("base")
|
|
51
|
-
.then(space, str("Annex").or(str("ANNEX")).as("annex_marker"),
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
.then(space, str("Annex").or(str("ANNEX")).as("annex_marker"), annexLetter(), rules["edition"].maybe(), rules["language"].maybe()));
|
|
78
|
+
rule("plain_identifier", () => rules["publisher"]
|
|
79
|
+
.then(rules["code"], rules["edition"].maybe(), rules["language"].maybe()));
|
|
80
|
+
// The S-100-family code: the hyphenated grant ("S-201"), the hundreds
|
|
81
|
+
// digit fixed to 2 and exactly "200" excluded ("spans from S-201"),
|
|
82
|
+
// so WMO's S-4xx and IHO's S-1xx never parse here.
|
|
83
|
+
rule("s100_number", () => str("200")
|
|
84
|
+
.absent()
|
|
85
|
+
.then(str("2").then(match("[0-9]"), match("[0-9]")))
|
|
86
|
+
.as("s100_number"));
|
|
87
|
+
// The lower-case code spelling ("IALA s-201", the site-URL shape)
|
|
88
|
+
// binds the typed form, never the codeless slug.
|
|
89
|
+
rule("s100_code", () => str("S").or(str("s")).then(dash, rules["s100_number"]));
|
|
90
|
+
// The bare dotted edition is canonical; "Ed 2.0.0" is the alias.
|
|
91
|
+
rule("s100_edition", () => space.then(str("Ed").then(space).maybe(), editionValue()).as("edition"));
|
|
92
|
+
rule("s100_annex_identifier", () => rules["publisher"]
|
|
93
|
+
.then(rules["s100_code"])
|
|
94
|
+
.then(space, str("Annex").or(str("ANNEX")).as("annex_marker"), annexLetter(), rules["edition"].or(rules["s100_edition"]).maybe(), rules["language"].maybe()));
|
|
95
|
+
rule("s100_identifier", () => rules["publisher"]
|
|
96
|
+
.then(rules["s100_code"])
|
|
97
|
+
.then(rules["edition"].or(rules["s100_edition"]).maybe(), rules["language"].maybe()));
|
|
98
|
+
// The codeless slug (gem #772): two or more hyphen-joined [a-z0-9]
|
|
99
|
+
// runs, the first run NOT code-like (0-2 letters then digits — "s1070",
|
|
100
|
+
// "ga01", "1070"), so a typed-code typo still fails. Last alternative:
|
|
101
|
+
// every typed code keeps priority, and the mandatory "IALA " prefix
|
|
102
|
+
// keeps any lower-case word from parsing.
|
|
103
|
+
rule("slug_segment", () => match("[a-z0-9]").repeat(1, Infinity));
|
|
104
|
+
rule("slug_code_like", () => match("[a-z]")
|
|
105
|
+
.repeat(0, 2)
|
|
106
|
+
.then(match("[0-9]").repeat(1, Infinity), match("[a-z0-9]").absent()));
|
|
107
|
+
rule("slug", () => rules["slug_code_like"]
|
|
108
|
+
.absent()
|
|
109
|
+
.then(rules["slug_segment"], dash.then(rules["slug_segment"]).repeat(1, Infinity))
|
|
110
|
+
.as("slug"));
|
|
111
|
+
rule("slug_identifier", () => str("IALA ")
|
|
112
|
+
.then(rules["slug"], rules["edition_human"].maybe(), rules["language"].maybe()));
|
|
113
|
+
rule("identifier", () => rules["annex_identifier"].or(rules["plain_identifier"], rules["s100_annex_identifier"], rules["s100_identifier"], rules["slug_identifier"]));
|
|
56
114
|
rule("root", () => rules["identifier"]);
|
|
57
115
|
return rules;
|
|
58
116
|
}
|
|
@@ -83,22 +141,28 @@ export class IalaIdentifier extends BaseIdentifier {
|
|
|
83
141
|
class IalaUrnGenerator extends BaseUrnGenerator {
|
|
84
142
|
generate() {
|
|
85
143
|
const id = this.identifier;
|
|
144
|
+
const parts = ["urn:mrn:iala:pub"];
|
|
86
145
|
if (id instanceof IalaAnnex) {
|
|
87
|
-
|
|
146
|
+
parts.push(this.baseCode(id.base));
|
|
88
147
|
parts.push(id.letter !== undefined ? `annex-${id.letter.toLowerCase()}` : "annex");
|
|
89
|
-
if (id.edition !== undefined)
|
|
90
|
-
parts.push(`ed${id.edition}`);
|
|
91
|
-
if (id.language !== undefined)
|
|
92
|
-
parts.push(id.language.toLowerCase());
|
|
93
|
-
return parts.join(":");
|
|
94
148
|
}
|
|
95
|
-
|
|
149
|
+
else {
|
|
150
|
+
parts.push(this.baseCode(id));
|
|
151
|
+
}
|
|
96
152
|
if (id.edition !== undefined)
|
|
97
153
|
parts.push(`ed${id.edition}`);
|
|
98
154
|
if (id.language !== undefined)
|
|
99
155
|
parts.push(id.language.toLowerCase());
|
|
100
156
|
return parts.join(":");
|
|
101
157
|
}
|
|
158
|
+
// The lowercase document identifier in IALA's managed namespace
|
|
159
|
+
// (G1143 §5.1.3): the legacy series codes join letter and number
|
|
160
|
+
// ("s1070"), the S-100-family codes hyphenate ("s-201").
|
|
161
|
+
baseCode(base) {
|
|
162
|
+
if (base instanceof IalaProductSpecification)
|
|
163
|
+
return `s-${base.number}`;
|
|
164
|
+
return `${base.typeLetter()?.toLowerCase()}${base.number}`;
|
|
165
|
+
}
|
|
102
166
|
}
|
|
103
167
|
const IALA_TYPES = [
|
|
104
168
|
{ kind: "standard", letter: "S", numberWidth: 4 },
|
|
@@ -159,17 +223,66 @@ export class IalaAnnex extends IalaIdentifier {
|
|
|
159
223
|
return undefined;
|
|
160
224
|
}
|
|
161
225
|
render() {
|
|
162
|
-
|
|
226
|
+
const baseStr = this.base?.toHuman() ?? "";
|
|
227
|
+
const s100Base = this.base instanceof IalaProductSpecification;
|
|
228
|
+
let rendered = `${baseStr} ${this.annex_form ?? ""}`;
|
|
163
229
|
if (this.letter !== undefined)
|
|
164
230
|
rendered += ` ${this.letter}`;
|
|
165
|
-
if (this.edition !== undefined)
|
|
166
|
-
|
|
231
|
+
if (this.edition !== undefined) {
|
|
232
|
+
// The edition face follows the base's family: bare for an
|
|
233
|
+
// S-100-family base ("S-201 Annex A 1.0.0"), "Ed" for the legacy
|
|
234
|
+
// series ("G1128 ANNEX A Ed 1.6").
|
|
235
|
+
rendered += s100Base ? ` ${this.edition}` : ` Ed ${this.edition}`;
|
|
236
|
+
}
|
|
167
237
|
if (this.language !== undefined)
|
|
168
238
|
rendered += ` (${this.language})`;
|
|
169
239
|
return rendered;
|
|
170
240
|
}
|
|
171
241
|
}
|
|
172
242
|
registerType(IalaAnnex);
|
|
243
|
+
/**
|
|
244
|
+
* The S-100-family product specification — the IHO-granted S-201..S-299
|
|
245
|
+
* range (pubid#777). The hyphenated code face is rendered by the
|
|
246
|
+
* renderer/URN generator directly; there is no type letter (an "S"
|
|
247
|
+
* short would collide with Standard's). The canonical face is bare —
|
|
248
|
+
* the designation carries no publisher token (the WMO S-100 rule).
|
|
249
|
+
*/
|
|
250
|
+
export class IalaProductSpecification extends IalaIdentifier {
|
|
251
|
+
static polymorphicName = "pubid:iala:product-specification";
|
|
252
|
+
static urnGenerator = IalaUrnGenerator;
|
|
253
|
+
typeLetter() {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
render() {
|
|
257
|
+
let rendered = `S-${this.number ?? ""}`;
|
|
258
|
+
if (this.edition !== undefined)
|
|
259
|
+
rendered += ` ${this.edition}`;
|
|
260
|
+
if (this.language !== undefined)
|
|
261
|
+
rendered += ` (${this.language})`;
|
|
262
|
+
return rendered;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
registerType(IalaProductSpecification);
|
|
266
|
+
/**
|
|
267
|
+
* The codeless slug publication (gem #772): iala.int reports and
|
|
268
|
+
* proceedings with no code, named by their product-URL slug. The slug
|
|
269
|
+
* is held in the inherited `number` attribute — the index key — and no
|
|
270
|
+
* padding applies. There is no type letter: "IALA <slug>".
|
|
271
|
+
*/
|
|
272
|
+
export class IalaPublication extends IalaIdentifier {
|
|
273
|
+
static polymorphicName = "pubid:iala:publication";
|
|
274
|
+
static urnGenerator = IalaUrnGenerator;
|
|
275
|
+
typeLetter() {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
// IALA assigns no MRN to a codeless publication, so it has no
|
|
279
|
+
// official URN (the gem's Publication#to_urn → nil); to_pubid_urn
|
|
280
|
+
// still names it.
|
|
281
|
+
toUrn() {
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
registerType(IalaPublication);
|
|
173
286
|
// ---------------------------------------------------------------------------
|
|
174
287
|
// Builder
|
|
175
288
|
// ---------------------------------------------------------------------------
|
|
@@ -220,6 +333,10 @@ class IalaBuilder {
|
|
|
220
333
|
const hash = flatten(data);
|
|
221
334
|
if (hash["annex_marker"] !== undefined)
|
|
222
335
|
return this.buildAnnex(hash);
|
|
336
|
+
if (hash["s100_number"] !== undefined)
|
|
337
|
+
return this.buildProductSpec(hash);
|
|
338
|
+
if (hash["slug"] !== undefined)
|
|
339
|
+
return this.buildPublication(hash);
|
|
223
340
|
return this.buildFlat(hash);
|
|
224
341
|
}
|
|
225
342
|
buildFlat(hash) {
|
|
@@ -242,9 +359,51 @@ class IalaBuilder {
|
|
|
242
359
|
attrs["language"] = language;
|
|
243
360
|
return new klass(attrs);
|
|
244
361
|
}
|
|
362
|
+
// The S-100-family product specification: the s100_number capture
|
|
363
|
+
// (the digits after "S-", e.g. "201") is the whole identity; the
|
|
364
|
+
// hyphen and the S are the code face the renderer and the URN
|
|
365
|
+
// generator add. The edition is the S-100 dotted x.y.z, verbatim.
|
|
366
|
+
buildProductSpec(hash) {
|
|
367
|
+
const attrs = {};
|
|
368
|
+
const number = s(hash["s100_number"]);
|
|
369
|
+
if (number !== undefined)
|
|
370
|
+
attrs["number"] = number;
|
|
371
|
+
const editionHash = isObj(hash["edition"]) ? flatten(hash["edition"]) : undefined;
|
|
372
|
+
const edition = editionHash !== undefined ? s(editionHash["edition_value"]) : undefined;
|
|
373
|
+
if (edition !== undefined)
|
|
374
|
+
attrs["edition"] = edition;
|
|
375
|
+
const languageHash = isObj(hash["language_group"]) ? flatten(hash["language_group"]) : undefined;
|
|
376
|
+
const language = languageHash !== undefined ? s(languageHash["language"])?.toUpperCase() : undefined;
|
|
377
|
+
if (language !== undefined)
|
|
378
|
+
attrs["language"] = language;
|
|
379
|
+
return new IalaProductSpecification(attrs);
|
|
380
|
+
}
|
|
381
|
+
// The codeless publication: the slug is its whole identity and goes
|
|
382
|
+
// into `number`, verbatim (no padding applies).
|
|
383
|
+
buildPublication(hash) {
|
|
384
|
+
const attrs = {};
|
|
385
|
+
const number = s(hash["slug"]);
|
|
386
|
+
if (number !== undefined)
|
|
387
|
+
attrs["number"] = number;
|
|
388
|
+
const editionHash = isObj(hash["edition"]) ? flatten(hash["edition"]) : undefined;
|
|
389
|
+
const edition = editionHash !== undefined ? s(editionHash["edition_value"]) : undefined;
|
|
390
|
+
if (edition !== undefined)
|
|
391
|
+
attrs["edition"] = edition;
|
|
392
|
+
const languageHash = isObj(hash["language_group"]) ? flatten(hash["language_group"]) : undefined;
|
|
393
|
+
const language = languageHash !== undefined ? s(languageHash["language"])?.toUpperCase() : undefined;
|
|
394
|
+
if (language !== undefined)
|
|
395
|
+
attrs["language"] = language;
|
|
396
|
+
return new IalaPublication(attrs);
|
|
397
|
+
}
|
|
245
398
|
buildAnnex(hash) {
|
|
246
|
-
|
|
247
|
-
|
|
399
|
+
// The S-100 annex stays flat (the grammar's base composite is
|
|
400
|
+
// unbound there — the s100_number capture is the only occurrence of
|
|
401
|
+
// its name on the annex path); the legacy annex nests its base
|
|
402
|
+
// composite under "base".
|
|
403
|
+
const s100Number = s(hash["s100_number"]);
|
|
404
|
+
const base = s100Number !== undefined
|
|
405
|
+
? new IalaProductSpecification({ number: s100Number })
|
|
406
|
+
: this.buildFlat(flatten(hash["base"]));
|
|
248
407
|
const attrs = {
|
|
249
408
|
base,
|
|
250
409
|
annex_form: s(hash["annex_marker"]),
|
|
@@ -291,7 +450,11 @@ export function ialaGrammarImplementation() {
|
|
|
291
450
|
let annexForm;
|
|
292
451
|
let annexLetter;
|
|
293
452
|
for (const seg of parts.slice(1)) {
|
|
294
|
-
|
|
453
|
+
// The letter carries the sub-numbered S-100 annex letters
|
|
454
|
+
// ("annex-b2"); the generator emits "annex" (bare) for the
|
|
455
|
+
// Annex-without-letter form and "annex-X" for the uppercase
|
|
456
|
+
// ANNEX form — mirror it so the round-trip is exact.
|
|
457
|
+
const annexMatch = /^annex(-([a-z]\d?))?$/i.exec(seg);
|
|
295
458
|
if (annexMatch !== null) {
|
|
296
459
|
annexLetter = annexMatch[2]?.toUpperCase();
|
|
297
460
|
annexForm = annexLetter !== undefined ? "ANNEX" : "Annex";
|
|
@@ -26,7 +26,7 @@ function buildRules() {
|
|
|
26
26
|
rule("series", () => seriesLetter.as("type"));
|
|
27
27
|
// The colon member captures SEPARATELY ("S-158:102" → number "158" +
|
|
28
28
|
// colon_suffix "102"): the builder re-keys the S-158 member into
|
|
29
|
-
//
|
|
29
|
+
// product and re-glues every other series' member into the number
|
|
30
30
|
// (the C-16:2 opaque face, pubid#637).
|
|
31
31
|
rule("number_suffix", () => str(":").then(digits.as("colon_suffix")));
|
|
32
32
|
rule("number", () => digits.as("number").then(rules["number_suffix"].maybe()));
|
|
@@ -128,7 +128,7 @@ function padEditionShorthand(value) {
|
|
|
128
128
|
* Builder.normalize_checks_alias, pubid#774). A hash carrying the
|
|
129
129
|
* draft-era part model on the standard family — a series reference
|
|
130
130
|
* ("S-102") or the bare member number ("102") riding number 158 with
|
|
131
|
-
* no
|
|
131
|
+
* no product — rebinding onto product; the edition/year that
|
|
132
132
|
* followed the part face are the BASE ones. Pure function: returns the
|
|
133
133
|
* hash untouched when it carries no draft-era part face, a normalized
|
|
134
134
|
* copy otherwise. The face is not restored (the canonical colon form).
|
|
@@ -139,7 +139,7 @@ function normalizeChecksAlias(data) {
|
|
|
139
139
|
const typeKey = data["_type"];
|
|
140
140
|
if (typeof part !== "string" ||
|
|
141
141
|
number !== "158" ||
|
|
142
|
-
data["
|
|
142
|
+
data["product"] !== undefined ||
|
|
143
143
|
(typeKey !== undefined && !String(typeKey).endsWith("standard"))) {
|
|
144
144
|
return data;
|
|
145
145
|
}
|
|
@@ -156,7 +156,7 @@ function normalizeChecksAlias(data) {
|
|
|
156
156
|
delete out["part"];
|
|
157
157
|
delete out["part_edition"];
|
|
158
158
|
delete out["part_year"];
|
|
159
|
-
out["
|
|
159
|
+
out["product"] = digits;
|
|
160
160
|
if (out["edition"] === undefined && edition !== undefined)
|
|
161
161
|
out["edition"] = edition;
|
|
162
162
|
if (out["year"] === undefined && year !== undefined)
|
|
@@ -170,7 +170,7 @@ function ihoClass(kind) {
|
|
|
170
170
|
/** The deserialization path applies the same S-158 alias unification
|
|
171
171
|
* the parse path applies (the gem's Builder.normalize_checks_alias):
|
|
172
172
|
* a stored row or a legacy URN carrying the draft-era part model
|
|
173
|
-
* (part: "S-102", part_edition: "0.2.0") decodes to the
|
|
173
|
+
* (part: "S-102", part_edition: "0.2.0") decodes to the product
|
|
174
174
|
* identity, so no construction path yields the two-identity disease
|
|
175
175
|
* of issue #775. The spelling face is NOT restored — a deserialized
|
|
176
176
|
* identifier renders the canonical colon designator. */
|
|
@@ -183,8 +183,8 @@ function ihoClass(kind) {
|
|
|
183
183
|
// whose validation checks this publication specifies. The colon
|
|
184
184
|
// designator form "S-158:102" is the primary face; the legacy
|
|
185
185
|
// draft-era part spellings bind the SAME identity.
|
|
186
|
-
|
|
187
|
-
// The face the input spelled
|
|
186
|
+
product: { type: "string" },
|
|
187
|
+
// The face the input spelled product with: undefined = the
|
|
188
188
|
// primary colon face ("S-158:102"), otherwise the draft-era part
|
|
189
189
|
// value as written ("S-102" of "Part S-102"/"S-158-S-102", "102"
|
|
190
190
|
// of "Part 102") — it prints in the Part slot verbatim.
|
|
@@ -192,7 +192,7 @@ function ihoClass(kind) {
|
|
|
192
192
|
// serializes, and equality skips it — render keeps the input
|
|
193
193
|
// spelling, equality/URN use the canonical shape. URN
|
|
194
194
|
// deserialization restores no face (the canonical colon form).
|
|
195
|
-
|
|
195
|
+
product_face: { type: "string", equalityIgnored: true },
|
|
196
196
|
part: { type: "string" },
|
|
197
197
|
part_edition: { type: "string" },
|
|
198
198
|
part_year: { type: "string" },
|
|
@@ -220,15 +220,15 @@ function ihoClass(kind) {
|
|
|
220
220
|
spec_sub: { type: "string" },
|
|
221
221
|
spec_variant: { type: "string" },
|
|
222
222
|
});
|
|
223
|
-
static mappings = keyValue({ wire: "number", to: "number" }, { wire: "
|
|
223
|
+
static mappings = keyValue({ wire: "number", to: "number" }, { wire: "product", to: "product" }, { wire: "part", to: "part" }, { wire: "part_edition", to: "part_edition" }, { wire: "part_year", to: "part_year" }, { wire: "annex", to: "annex" }, { wire: "annex_edition", to: "annex_edition" }, { wire: "annex_year", to: "annex_year" }, { wire: "appendix", to: "appendix" }, { wire: "appendix_subnumber", to: "appendix_subnumber" }, { wire: "appendix_edition", to: "appendix_edition" }, { wire: "appendix_year", to: "appendix_year" }, { wire: "supplement", to: "supplement" }, { wire: "supplement_edition", to: "supplement_edition" }, { wire: "supplement_year", to: "supplement_year" }, { wire: "edition", to: "edition" }, { wire: "year", to: "year" }, { wire: "volume", to: "volume" }, { wire: "volume_edition", to: "volume_edition" }, { wire: "volume_year", to: "volume_year" }, { wire: "issue", to: "issue" }, { wire: "spec", to: "spec" }, { wire: "spec_sub", to: "spec_sub" }, { wire: "spec_variant", to: "spec_variant" });
|
|
224
224
|
render() {
|
|
225
225
|
let result = `IHO ${letter}-${this.number}`;
|
|
226
|
-
// The S-158
|
|
226
|
+
// The S-158 product face: the primary colon form rides the code
|
|
227
227
|
// ("S-158:102"); the draft-era part face keeps its spelling and
|
|
228
228
|
// prints in the Part slot — after the edition ("S-158 0.2.0
|
|
229
229
|
// Part S-102"). The compact face renders expanded (the S-5A law).
|
|
230
|
-
if (this.
|
|
231
|
-
result += `:${this.
|
|
230
|
+
if (this.product !== undefined && this.product_face === undefined) {
|
|
231
|
+
result += `:${this.product}`;
|
|
232
232
|
}
|
|
233
233
|
if (this.edition !== undefined)
|
|
234
234
|
result += ` ${this.edition}`;
|
|
@@ -249,10 +249,10 @@ function ihoClass(kind) {
|
|
|
249
249
|
if (this.spec_variant !== undefined)
|
|
250
250
|
result += `(${this.spec_variant})`;
|
|
251
251
|
}
|
|
252
|
-
else if (this.
|
|
252
|
+
else if (this.product_face !== undefined) {
|
|
253
253
|
// The draft-era member face prints in the Part slot, the part
|
|
254
254
|
// value as written ("Part S-102", "Part 102").
|
|
255
|
-
result += ` Part ${this.
|
|
255
|
+
result += ` Part ${this.product_face}`;
|
|
256
256
|
}
|
|
257
257
|
else if (this.part !== undefined) {
|
|
258
258
|
result += ` Part ${this.part}`;
|
|
@@ -373,8 +373,8 @@ function ihoClass(kind) {
|
|
|
373
373
|
* position. */
|
|
374
374
|
mrnName(id) {
|
|
375
375
|
let name = `${letter.toLowerCase()}${id.number}`;
|
|
376
|
-
if (id.
|
|
377
|
-
name += `-${id.
|
|
376
|
+
if (id.product !== undefined)
|
|
377
|
+
name += `-${id.product}`;
|
|
378
378
|
return name;
|
|
379
379
|
}
|
|
380
380
|
/** The legacy positional form (the B/C emission today; the shape
|
|
@@ -456,7 +456,7 @@ class IhoBuilder extends BaseBuilder {
|
|
|
456
456
|
static S4_NUMBER = "4";
|
|
457
457
|
// The S-158 framework publication: its series members (the colon
|
|
458
458
|
// designator and the series-reference part faces) re-key into
|
|
459
|
-
//
|
|
459
|
+
// product (pubid#774).
|
|
460
460
|
static S158_NUMBER = "158";
|
|
461
461
|
// The two publication modes are mutually exclusive (the gem's
|
|
462
462
|
// assert_edition_mode!): a base edition and any component edition
|
|
@@ -507,12 +507,12 @@ class IhoBuilder extends BaseBuilder {
|
|
|
507
507
|
}
|
|
508
508
|
// The S-158 family re-key (pubid#774, the gem's Builder). The colon
|
|
509
509
|
// designator "S-158:<NNN>" is the PRIMARY face: number stays 158,
|
|
510
|
-
// the member binds
|
|
510
|
+
// the member binds product. The member designator is the S-158
|
|
511
511
|
// series device — a colon form on any other anchor rejects
|
|
512
512
|
// ("S-44:5", "C-16:2"). A draft-era part face on the S-158 family —
|
|
513
513
|
// a series reference ("Part S-102"), the compact face
|
|
514
514
|
// ("S-158-S-102") or the bare member number ("Part 102") — rebinds
|
|
515
|
-
// onto
|
|
515
|
+
// onto product while product is UNBOUND (a bound member keeps
|
|
516
516
|
// a genuine part: "S-158:100 Part 2"); a lettered or compound part
|
|
517
517
|
// value ("Part A", "Part 4a") never rebinds. The edition/year that
|
|
518
518
|
// follow the draft-era part face are the BASE ones (the pubid#775
|
|
@@ -525,24 +525,24 @@ class IhoBuilder extends BaseBuilder {
|
|
|
525
525
|
if (colonSuffix !== undefined) {
|
|
526
526
|
const type = flat["type"];
|
|
527
527
|
if (flat["number"] === IhoBuilder.S158_NUMBER && (type === undefined || type === "S")) {
|
|
528
|
-
if (flat["
|
|
529
|
-
throw new ParseFailed(`IHO:
|
|
528
|
+
if (flat["product"] !== undefined && flat["product"] !== colonSuffix) {
|
|
529
|
+
throw new ParseFailed(`IHO: product ${String(flat["product"])} conflicts with the colon member ${String(colonSuffix)}`, 0);
|
|
530
530
|
}
|
|
531
|
-
flat["
|
|
531
|
+
flat["product"] = colonSuffix;
|
|
532
532
|
}
|
|
533
533
|
else {
|
|
534
|
-
throw new ParseFailed(`IHO: the
|
|
534
|
+
throw new ParseFailed(`IHO: the product member designator is the S-158 series device: ${String(type ?? "S")}-${String(flat["number"])}:${String(colonSuffix)} cannot carry it`, 0);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
if (flat["number"] === IhoBuilder.S158_NUMBER &&
|
|
538
|
-
flat["
|
|
538
|
+
flat["product"] === undefined &&
|
|
539
539
|
typeof flat["part"] === "string") {
|
|
540
540
|
const partValue = flat["part"];
|
|
541
541
|
const seriesRef = /^([SPMBC])-(\d+)$/.exec(partValue);
|
|
542
542
|
const digits = seriesRef !== null ? seriesRef[2] : /^\d+$/.test(partValue) ? partValue : undefined;
|
|
543
543
|
if (digits !== undefined) {
|
|
544
|
-
flat["
|
|
545
|
-
flat["
|
|
544
|
+
flat["product"] = digits;
|
|
545
|
+
flat["product_face"] = partValue;
|
|
546
546
|
delete flat["part"];
|
|
547
547
|
const edition = flat["part_edition"];
|
|
548
548
|
const year = flat["part_year"];
|
|
@@ -15,6 +15,11 @@ export declare class Decoder {
|
|
|
15
15
|
private decodeCore;
|
|
16
16
|
private coreValue;
|
|
17
17
|
private decodeAtoms;
|
|
18
|
+
/** The atom slot a token decodes to: the schema's own prefixes first,
|
|
19
|
+
* then the flavor's legacy spellings (decode-only; see
|
|
20
|
+
* LEGACY_ATOM_PREFIXES). Out-of-order and repeat checks run on the
|
|
21
|
+
* canonical position, so a legacy spelling obeys the same slot law. */
|
|
22
|
+
private atomPosition;
|
|
18
23
|
private atomValue;
|
|
19
24
|
/** The value of a :string, :bool or list atom, or of a facet. */
|
|
20
25
|
private slotValue;
|
|
@@ -13,6 +13,19 @@ import { flavorSchema, splitToken, splitTop, structural } from "./index.js";
|
|
|
13
13
|
const FACET = /^(\d+)\.([a-z0-9]+)-(.*)/;
|
|
14
14
|
const INTEGER = /^-?[0-9]+$/;
|
|
15
15
|
const NULL = "~";
|
|
16
|
+
/**
|
|
17
|
+
* Legacy atom spellings, decode-only (never emitted): the flavor =>
|
|
18
|
+
* {legacy prefix => canonical prefix} table behind the renamed atoms.
|
|
19
|
+
* The iho S-158 member atom rode `checks-<NNN>` before the facet
|
|
20
|
+
* renamed to `product` (gem #783) — the 0.1.x line and gem 2.0.54 and
|
|
21
|
+
* earlier emitted it, so those URNs stay decodable here; the gem's own
|
|
22
|
+
* legacy-decode stance ("decodable, never emitted",
|
|
23
|
+
* urn_parser.rb). Lives OUTSIDE the generated schema tables (they
|
|
24
|
+
* carry the canonical prefixes only, per the regeneration flow).
|
|
25
|
+
*/
|
|
26
|
+
const LEGACY_ATOM_PREFIXES = {
|
|
27
|
+
iho: { checks: "product" },
|
|
28
|
+
};
|
|
16
29
|
export class Decoder {
|
|
17
30
|
body;
|
|
18
31
|
constructor(body) {
|
|
@@ -89,7 +102,7 @@ export class Decoder {
|
|
|
89
102
|
let i = index;
|
|
90
103
|
while (i < tokens.length) {
|
|
91
104
|
const token = tokens[i];
|
|
92
|
-
const position =
|
|
105
|
+
const position = this.atomPosition(schema, token);
|
|
93
106
|
if (position === undefined)
|
|
94
107
|
break;
|
|
95
108
|
if (position <= last) {
|
|
@@ -104,6 +117,22 @@ export class Decoder {
|
|
|
104
117
|
}
|
|
105
118
|
return i;
|
|
106
119
|
}
|
|
120
|
+
/** The atom slot a token decodes to: the schema's own prefixes first,
|
|
121
|
+
* then the flavor's legacy spellings (decode-only; see
|
|
122
|
+
* LEGACY_ATOM_PREFIXES). Out-of-order and repeat checks run on the
|
|
123
|
+
* canonical position, so a legacy spelling obeys the same slot law. */
|
|
124
|
+
atomPosition(schema, token) {
|
|
125
|
+
const position = schema.atomPosition(token);
|
|
126
|
+
if (position !== undefined)
|
|
127
|
+
return position;
|
|
128
|
+
const m = /^([a-z0-9]+)-/.exec(token);
|
|
129
|
+
if (m === null)
|
|
130
|
+
return undefined;
|
|
131
|
+
const legacy = LEGACY_ATOM_PREFIXES[schema.flavor]?.[m[1]];
|
|
132
|
+
if (legacy === undefined)
|
|
133
|
+
return undefined;
|
|
134
|
+
return schema.atomPosition(`${legacy}${token.slice(m[1].length)}`);
|
|
135
|
+
}
|
|
107
136
|
atomValue(raw, atom) {
|
|
108
137
|
if (atom.kind === "int")
|
|
109
138
|
return this.integer(raw);
|
|
@@ -18,6 +18,7 @@ export const ialaSchema = define("iala", (s) => {
|
|
|
18
18
|
s.type("pubid:iala:letter", "letter");
|
|
19
19
|
s.type("pubid:iala:manual", "manual");
|
|
20
20
|
s.type("pubid:iala:model-course", "mc");
|
|
21
|
+
s.type("pubid:iala:product-specification", "ps");
|
|
21
22
|
s.type("pubid:iala:publication", "pub");
|
|
22
23
|
s.type("pubid:iala:recommendation", "rec");
|
|
23
24
|
s.type("pubid:iala:report", "rpt");
|
package/dist/urn/parsers.js
CHANGED
|
@@ -154,8 +154,8 @@ function ihoConsumeSegments(attrs, segments, body) {
|
|
|
154
154
|
* before the part, the citation replacing the Part face). */
|
|
155
155
|
function ihoCanonicalText(typeLetter, attrs) {
|
|
156
156
|
let text = `IHO ${typeLetter}-${attrs["number"] ?? ""}`;
|
|
157
|
-
if (attrs["
|
|
158
|
-
text += `:${attrs["
|
|
157
|
+
if (attrs["product"] !== undefined)
|
|
158
|
+
text += `:${attrs["product"]}`;
|
|
159
159
|
if (attrs["edition"] !== undefined)
|
|
160
160
|
text += ` ${attrs["edition"]}`;
|
|
161
161
|
if (attrs["supplement"] !== undefined) {
|
|
@@ -211,11 +211,11 @@ function ihoCanonicalText(typeLetter, attrs) {
|
|
|
211
211
|
return text;
|
|
212
212
|
}
|
|
213
213
|
/** The S-158 family rebind on the decode path: a draft-era part face
|
|
214
|
-
* riding number 158 rebinds onto
|
|
214
|
+
* riding number 158 rebinds onto product and the spelling face
|
|
215
215
|
* drops (the decoded identifier renders the primary colon
|
|
216
216
|
* designator). */
|
|
217
217
|
function ihoRebindChecks(typeLetter, attrs) {
|
|
218
|
-
if (typeLetter !== "S" || attrs["number"] !== "158" || attrs["
|
|
218
|
+
if (typeLetter !== "S" || attrs["number"] !== "158" || attrs["product"] !== undefined) {
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
const part = attrs["part"];
|
|
@@ -236,7 +236,7 @@ function ihoRebindChecks(typeLetter, attrs) {
|
|
|
236
236
|
}
|
|
237
237
|
delete attrs["part_edition"];
|
|
238
238
|
delete attrs["part_year"];
|
|
239
|
-
attrs["
|
|
239
|
+
attrs["product"] = digits;
|
|
240
240
|
}
|
|
241
241
|
/** The MRN guidance decode: type token, name (number + optional S-158
|
|
242
242
|
* member), the bare dotted edition, then the shared marker machinery. */
|
|
@@ -254,7 +254,7 @@ function ihoMrnText(body) {
|
|
|
254
254
|
}
|
|
255
255
|
const attrs = { number: nameMatch[2] };
|
|
256
256
|
if (nameMatch[3] !== undefined)
|
|
257
|
-
attrs["
|
|
257
|
+
attrs["product"] = nameMatch[3];
|
|
258
258
|
if (segments[0] !== undefined && IHO_DOTTED.test(segments[0])) {
|
|
259
259
|
attrs["edition"] = segments.shift();
|
|
260
260
|
}
|
|
@@ -263,7 +263,7 @@ function ihoMrnText(body) {
|
|
|
263
263
|
return ihoCanonicalText(letter, attrs);
|
|
264
264
|
}
|
|
265
265
|
/** The legacy positional decode: the type letter, the docnumber, a
|
|
266
|
-
* further bare digit segment binding the S-158 member (
|
|
266
|
+
* further bare digit segment binding the S-158 member (product —
|
|
267
267
|
* "urn:iho:s:158:100"; another anchor rejects through the builder),
|
|
268
268
|
* then the shared marker machinery. */
|
|
269
269
|
function ihoLegacyText(body) {
|
|
@@ -278,7 +278,7 @@ function ihoLegacyText(body) {
|
|
|
278
278
|
}
|
|
279
279
|
const attrs = { number };
|
|
280
280
|
if (segments[0] !== undefined && /^\d+$/.test(segments[0])) {
|
|
281
|
-
attrs["
|
|
281
|
+
attrs["product"] = segments.shift();
|
|
282
282
|
}
|
|
283
283
|
ihoConsumeSegments(attrs, segments, body);
|
|
284
284
|
ihoRebindChecks(typeToken.toUpperCase(), attrs);
|
|
@@ -675,7 +675,9 @@ export const URN_PARSERS = {
|
|
|
675
675
|
let edition;
|
|
676
676
|
let language;
|
|
677
677
|
for (const seg of parts) {
|
|
678
|
-
|
|
678
|
+
// The letter carries the sub-numbered S-100 annex letters
|
|
679
|
+
// ("annex-b2"), grammar#146.
|
|
680
|
+
const annexMatch = seg.match(/^annex(-([a-z]\d?))?$/i);
|
|
679
681
|
if (annexMatch) {
|
|
680
682
|
annexLetter = annexMatch[2]?.toUpperCase();
|
|
681
683
|
annexForm = annexLetter ? "ANNEX" : "Annex";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.64",
|
|
4
4
|
"description": "TypeScript PubID identifiers: resolution, normalization and canonical hashes for every identifier in the pubid-testsuite corpus (41 standards bodies), with a conformance runner mirroring the Ruby reference",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/vendor/parg/iala.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.1.0","grammar":"PubidIala","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":102}},{"Entity":{"atom":3}},{"Str":{"pattern":"IALA "}},{"Repetition":{"atom":2,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":16}},{"Str":{"pattern":"GA"}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"G"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"C"}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"L"}},{"Str":{"pattern":"X"}},{"Str":{"pattern":"P"}},{"Alternative":{"atoms":[5,6,7,8,9,10,11,12,13,14]}},{"Named":{"name":"type_letter","atom":15}},{"Entity":{"atom":32}},{"Entity":{"atom":22}},{"Entity":{"atom":20}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":19,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"doc_number","atom":21}},{"Entity":{"atom":29}},{"Entity":{"atom":25}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Repetition":{"atom":26,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"dotted_segment","atom":27}},{"Sequence":{"atoms":[24,28]}},{"Repetition":{"atom":23,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"doc_number_dots","atom":30}},{"Sequence":{"atoms":[18,31]}},{"Entity":{"atom":42}},{"Entity":{"atom":40}},{"Entity":{"atom":36}},{"Str":{"pattern":"-"}},{"Entity":{"atom":20}},{"Repetition":{"atom":37,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"subpart_number","atom":38}},{"Sequence":{"atoms":[35,39]}},{"Repetition":{"atom":34,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"subpart","atom":41}},{"Repetition":{"atom":33,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[1,4,17,43]}},{"Named":{"name":"base","atom":44}},{"Entity":{"atom":47}},{"Str":{"pattern":" "}},{"Str":{"pattern":"Annex"}},{"Str":{"pattern":"ANNEX"}},{"Alternative":{"atoms":[48,49]}},{"Named":{"name":"annex_marker","atom":50}},{"Entity":{"atom":47}},{"Entity":{"atom":54}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Named":{"name":"annex_letter","atom":53}},{"Entity":{"atom":57}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Lookahead":{"atom":56,"positive":false}},{"Sequence":{"atoms":[52,55,58]}},{"Repetition":{"atom":59,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":76}},{"Entity":{"atom":47}},{"Str":{"pattern":"Ed"}},{"Entity":{"atom":47}},{"Entity":{"atom":74}},{"Entity":{"atom":20}},{"Repetition":{"atom":66,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":25}},{"Entity":{"atom":20}},{"Repetition":{"atom":69,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[68,70]}},{"Repetition":{"atom":71,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[67,72]}},{"Named":{"name":"edition_value","atom":73}},{"Sequence":{"atoms":[62,63,64,65]}},{"Named":{"name":"edition","atom":75}},{"Entity":{"atom":83}},{"Entity":{"atom":79}},{"Str":{"pattern":":"}},{"Str":{"pattern":"ed"}},{"Entity":{"atom":74}},{"Sequence":{"atoms":[78,80,81]}},{"Named":{"name":"edition","atom":82}},{"Alternative":{"atoms":[61,77]}},{"Repetition":{"atom":84,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":100}},{"Entity":{"atom":47}},{"Repetition":{"atom":87,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"("}},{"Str":{"pattern":"E"}},{"Str":{"pattern":"F"}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"C"}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"R"}},{"Alternative":{"atoms":[90,91,92,93,94,95]}},{"Named":{"name":"language","atom":96}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[88,89,97,98]}},{"Named":{"name":"language_group","atom":99}},{"Repetition":{"atom":86,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[45,46,51,60,85,101]}},{"Entity":{"atom":117}},{"Entity":{"atom":3}},{"Entity":{"atom":110}},{"Entity":{"atom":16}},{"Entity":{"atom":32}},{"Entity":{"atom":42}},{"Repetition":{"atom":108,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[106,107,109]}},{"Entity":{"atom":76}},{"Entity":{"atom":83}},{"Alternative":{"atoms":[111,112]}},{"Repetition":{"atom":113,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":100}},{"Repetition":{"atom":115,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[104,105,114,116]}},{"Entity":{"atom":147}},{"Str":{"pattern":"IALA "}},{"Entity":{"atom":142}},{"Entity":{"atom":130}},{"Entity":{"atom":57}},{"Repetition":{"atom":122,"min":0,"max":2,"tag":"Repetition"}},{"Entity":{"atom":20}},{"Repetition":{"atom":124,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":57}},{"Entity":{"atom":20}},{"Alternative":{"atoms":[126,127]}},{"Lookahead":{"atom":128,"positive":false}},{"Sequence":{"atoms":[123,125,129]}},{"Lookahead":{"atom":121,"positive":false}},{"Entity":{"atom":136}},{"Entity":{"atom":57}},{"Entity":{"atom":20}},{"Alternative":{"atoms":[133,134]}},{"Repetition":{"atom":135,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":36}},{"Entity":{"atom":136}},{"Sequence":{"atoms":[137,138]}},{"Repetition":{"atom":139,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[131,132,140]}},{"Named":{"name":"slug","atom":141}},{"Entity":{"atom":76}},{"Repetition":{"atom":143,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":100}},{"Repetition":{"atom":145,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[119,120,144,146]}},{"Alternative":{"atoms":[0,103,118]}}],"root":148},"bindings":[{"capture":"type_letter","path":"type_letter","type":"string","card":null,"preprocess":null},{"capture":"doc_number","path":"doc_number","type":"string","card":null,"preprocess":null},{"capture":"dotted_segment","path":"doc_number_dots[].dotted_segment","type":"string","card":null,"preprocess":null},{"capture":"subpart_number","path":"subpart[].subpart_number","type":"string","card":null,"preprocess":null},{"capture":"edition_value","path":"edition_value","type":"string","card":null,"preprocess":null},{"capture":"language","path":"language","type":"string","card":null,"preprocess":null},{"capture":"annex_marker","path":"annex_marker","type":"string","card":null,"preprocess":null},{"capture":"annex_letter","path":"annex_letter","type":"string","card":null,"preprocess":null},{"capture":"slug","path":"slug","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule identifier: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"G1040","expect":{}},{"entry":"identifier","kind":"accept","input":"GA1040","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S1070 Ed 2.0","expect":{}},{"entry":"identifier","kind":"accept","input":"R1016:ed2.0(F)","expect":{}},{"entry":"identifier","kind":"accept","input":"C0103-1 Ed 3.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA L2.1.11 Ed 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA G1128 Annex A Ed 1.6","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA G1045 Annex Ed 1","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA A12-01 (E)","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA arctic-seminar-report","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA 13th-vts-symposium-report (E)","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA iala-style-guide Ed 1.0 (E)","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"arctic-seminar-report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA Arctic-Seminar-Report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA -arctic-seminar-report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic seminar report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic-","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic--report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA s1070","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA c0103-1","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA 1070 Ed 2.0","expect":{}},{"entry":"identifier","kind":"example","input":"G1040","expect":{"type_letter":"G","doc_number":"1040"}},{"entry":"identifier","kind":"example","input":"GA01.01","expect":{"type_letter":"GA","doc_number":"01","doc_number_dots":[{"dotted_segment":"01"}]}},{"entry":"identifier","kind":"example","input":"C0103-1","expect":{"type_letter":"C","doc_number":"0103","subpart":[{"subpart_number":"1"}]}},{"entry":"identifier","kind":"example","input":"IALA S1070 Ed 2.0","expect":{"type_letter":"S","doc_number":"1070","edition_value":"2.0"}},{"entry":"identifier","kind":"example","input":"IALA G1128 Annex A Ed 1.6","expect":{"type_letter":"G","doc_number":"1128","annex_marker":"Annex","annex_letter":"A","edition_value":"1.6"}},{"entry":"identifier","kind":"example","input":"IALA arctic-seminar-report (E)","expect":{"slug":"arctic-seminar-report","language":"E"}},{"entry":"identifier","kind":"example","input":"IALA iala-world-wide-radio-navigation-plan Ed 2","expect":{"slug":"iala-world-wide-radio-navigation-plan","edition_value":"2"}}],"docs":{},"source":"# Port of lib/pubid/iala/parser.rb: [IALA ]<type><number>[.dots][-subs]\n# [ Ed X.Y | :edX.Y] [(L)], plus the Annex-to-base form. The annex\n# letter guard (!lower) keeps \"Ed 1\" from mis-capturing.\n#\n# Edition-2 conversion with typed model bindings. Deviations from the\n# v1 tree:\n# - the dotted continuation and the dash subpart repeat capture-bearing\n# rule refs (the itu `parts` shape): a repetition over a capture-less\n# unit harvested as a bare span binds differently per engine, so the\n# bindings read the inner captures through the array paths\n# `doc_number_dots[].dotted_segment` and `subpart[].subpart_number`.\n# The dotted segment gains its own capture (`dotted_segment`); the\n# subpart keeps its `subpart_number` capture, hoisted out of the\n# inline repetition into a rule ref of its own.\n# - the annex base composite stays unbound. Every capture inside it\n# (type_letter, doc_number, …) is the only occurrence of its name on\n# the annex path, so the binding harvest hoists it to the top level:\n# the builder reads one flat map for the plain and the annex form\n# alike and dispatches on :annex_marker. edition_value and language\n# hoist out of their edition/language_group composites the same way.\n#\n# The codeless (slug) form: iala.int lists some publications (reports\n# and proceedings, the style guide, history books, radio plans) with no\n# code, and relaton gives them the product-URL slug as docid, e.g.\n# \"IALA arctic-seminar-report (E)\". slug_identifier is the last\n# alternative, so every typed code keeps priority; a typed code starts\n# upper-case and a slug lower-case or with a digit, so the two never\n# overlap. The \"IALA \" prefix is mandatory here (it is optional for a\n# typed code): without it any lower-case word would parse. The slug has\n# no space, so it never takes the trailing \" Ed <edition>\" or \" (<L>)\".\n# A slug is two or more hyphen-joined [a-z0-9] runs (every corpus slug\n# is), and its first run must not look like a code (0-2 letters and\n# digits: \"s1070\", \"ga01\", \"1070\"), so a lower-case or letterless typo\n# of a typed code (\"IALA s1070\", \"IALA c0103-1\", \"IALA 1070 Ed 2.0\")\n# still fails instead of parsing as a codeless publication.\n\ngrammar PubidIala version \"0.1.0\" edition 2 {\n type_letter = (\"GA\" / \"S\" / \"R\" / \"G\" / \"M\" / \"C\" / \"A\" / \"L\" / \"X\" / \"P\") as type_letter\n doc_number = (1*digit) as doc_number\n dotted_number = dot (1*digit) as dotted_segment\n number_with_dots = doc_number (*dotted_number) as doc_number_dots\n subpart_number = dash (1*digit) as subpart_number\n subpart = (1*subpart_number) as subpart\n code = type_letter number_with_dots [subpart]\n edition_value = (1*digit *(dot 1*digit)) as edition_value\n edition_human = (space \"Ed\" space edition_value) as edition\n edition_compact = (colon \"ed\" edition_value) as edition\n language_group = ([space] \"(\" (\"E\" / \"F\" / \"S\" / \"C\" / \"A\" / \"R\") as language \")\") as language_group\n annex_identifier = {\n ((publisher type_letter number_with_dots [subpart]) as base)\n space\n (\"Annex\" / \"ANNEX\") as annex_marker\n [ (space upper as annex_letter !lower) ]\n [edition_human / edition_compact]\n [language_group]\n }\n plain_identifier = {\n publisher code [edition_human / edition_compact] [language_group]\n }\n slug_segment = 1*(lower / digit)\n slug_code_like = *2lower 1*digit !(lower / digit)\n slug = (!slug_code_like slug_segment 1*(dash slug_segment)) as slug\n slug_identifier = {\n \"IALA \" slug [edition_human] [language_group]\n }\n identifier = {\n annex_identifier\n / plain_identifier\n / slug_identifier\n }\n publisher = [\"IALA \"]\n upper = %x41-5A\n lower = %x61-7A\n digit = %x30-39\n dash = \"-\"\n colon = \":\"\n dot = \".\"\n space = \" \"\n entry identifier: identifier\n\n bindings identifier {\n type_letter -> type_letter (string)\n doc_number -> doc_number (string)\n dotted_segment -> doc_number_dots[].dotted_segment (string)\n subpart_number -> subpart[].subpart_number (string)\n edition_value -> edition_value (string)\n language -> language (string)\n annex_marker -> annex_marker (string)\n annex_letter -> annex_letter (string)\n slug -> slug (string)\n }\n\n test {\n accept \"G1040\"\n accept \"GA1040\"\n accept \"IALA S1070 Ed 2.0\"\n accept \"R1016:ed2.0(F)\"\n accept \"C0103-1 Ed 3.0\"\n accept \"IALA L2.1.11 Ed 2\"\n accept \"IALA G1128 Annex A Ed 1.6\"\n accept \"IALA G1045 Annex Ed 1\"\n accept \"IALA A12-01 (E)\"\n accept \"IALA arctic-seminar-report\"\n accept \"IALA 13th-vts-symposium-report (E)\"\n accept \"IALA iala-style-guide Ed 1.0 (E)\"\n reject \"nonsense\"\n reject \"arctic-seminar-report\"\n reject \"IALA Arctic-Seminar-Report\"\n reject \"IALA -arctic-seminar-report\"\n reject \"IALA arctic seminar report\"\n reject \"IALA arctic\"\n reject \"IALA arctic-\"\n reject \"IALA arctic--report\"\n reject \"IALA s1070\"\n reject \"IALA c0103-1\"\n reject \"IALA 1070 Ed 2.0\"\n example \"G1040\" { type_letter: \"G\", doc_number: \"1040\" }\n example \"GA01.01\" {\n type_letter: \"GA\",\n doc_number: \"01\",\n doc_number_dots: [ { dotted_segment: \"01\" } ],\n }\n example \"C0103-1\" {\n type_letter: \"C\",\n doc_number: \"0103\",\n subpart: [ { subpart_number: \"1\" } ],\n }\n example \"IALA S1070 Ed 2.0\" {\n type_letter: \"S\",\n doc_number: \"1070\",\n edition_value: \"2.0\",\n }\n example \"IALA G1128 Annex A Ed 1.6\" {\n type_letter: \"G\",\n doc_number: \"1128\",\n annex_marker: \"Annex\",\n annex_letter: \"A\",\n edition_value: \"1.6\",\n }\n example \"IALA arctic-seminar-report (E)\" {\n slug: \"arctic-seminar-report\",\n language: \"E\",\n }\n example \"IALA iala-world-wide-radio-navigation-plan Ed 2\" {\n slug: \"iala-world-wide-radio-navigation-plan\",\n edition_value: \"2\",\n }\n }\n}\n","source_hash":"ab620b92df8199a8ed6a1e34e270748e97596744c2fab91f27ee82c8add38825","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:35c2500510eb2381f7b589169862d6bca767259d9d75b349e0268eb318d70983","checksum":"sha256:000246eed8518ec3eebf2e2aab2fb113141bcbb18721f339511026067b805936","validated":{"lint_errors":0,"lint_warnings":3,"tests_total":30,"tests_failures":0,"self_test":true}}
|
|
1
|
+
{"bindings":null,"version":"0.2.0","grammar":"PubidIala","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":105}},{"Entity":{"atom":3}},{"Str":{"pattern":"IALA "}},{"Repetition":{"atom":2,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":16}},{"Str":{"pattern":"GA"}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"R"}},{"Str":{"pattern":"G"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"C"}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"L"}},{"Str":{"pattern":"X"}},{"Str":{"pattern":"P"}},{"Alternative":{"atoms":[5,6,7,8,9,10,11,12,13,14]}},{"Named":{"name":"type_letter","atom":15}},{"Entity":{"atom":32}},{"Entity":{"atom":22}},{"Entity":{"atom":20}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":19,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"doc_number","atom":21}},{"Entity":{"atom":29}},{"Entity":{"atom":25}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Repetition":{"atom":26,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"dotted_segment","atom":27}},{"Sequence":{"atoms":[24,28]}},{"Repetition":{"atom":23,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"doc_number_dots","atom":30}},{"Sequence":{"atoms":[18,31]}},{"Entity":{"atom":42}},{"Entity":{"atom":40}},{"Entity":{"atom":36}},{"Str":{"pattern":"-"}},{"Entity":{"atom":20}},{"Repetition":{"atom":37,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"subpart_number","atom":38}},{"Sequence":{"atoms":[35,39]}},{"Repetition":{"atom":34,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"subpart","atom":41}},{"Repetition":{"atom":33,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[1,4,17,43]}},{"Named":{"name":"base","atom":44}},{"Entity":{"atom":47}},{"Str":{"pattern":" "}},{"Str":{"pattern":"Annex"}},{"Str":{"pattern":"ANNEX"}},{"Alternative":{"atoms":[48,49]}},{"Named":{"name":"annex_marker","atom":50}},{"Entity":{"atom":47}},{"Entity":{"atom":54}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Entity":{"atom":20}},{"Repetition":{"atom":55,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[53,56]}},{"Named":{"name":"annex_letter","atom":57}},{"Entity":{"atom":60}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Lookahead":{"atom":59,"positive":false}},{"Sequence":{"atoms":[52,58,61]}},{"Repetition":{"atom":62,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":79}},{"Entity":{"atom":47}},{"Str":{"pattern":"Ed"}},{"Entity":{"atom":47}},{"Entity":{"atom":77}},{"Entity":{"atom":20}},{"Repetition":{"atom":69,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":25}},{"Entity":{"atom":20}},{"Repetition":{"atom":72,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[71,73]}},{"Repetition":{"atom":74,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[70,75]}},{"Named":{"name":"edition_value","atom":76}},{"Sequence":{"atoms":[65,66,67,68]}},{"Named":{"name":"edition","atom":78}},{"Entity":{"atom":86}},{"Entity":{"atom":82}},{"Str":{"pattern":":"}},{"Str":{"pattern":"ed"}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[81,83,84]}},{"Named":{"name":"edition","atom":85}},{"Alternative":{"atoms":[64,80]}},{"Repetition":{"atom":87,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":103}},{"Entity":{"atom":47}},{"Repetition":{"atom":90,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"("}},{"Str":{"pattern":"E"}},{"Str":{"pattern":"F"}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"C"}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"R"}},{"Alternative":{"atoms":[93,94,95,96,97,98]}},{"Named":{"name":"language","atom":99}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[91,92,100,101]}},{"Named":{"name":"language_group","atom":102}},{"Repetition":{"atom":89,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[45,46,51,63,88,104]}},{"Entity":{"atom":120}},{"Entity":{"atom":3}},{"Entity":{"atom":113}},{"Entity":{"atom":16}},{"Entity":{"atom":32}},{"Entity":{"atom":42}},{"Repetition":{"atom":111,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[109,110,112]}},{"Entity":{"atom":79}},{"Entity":{"atom":86}},{"Alternative":{"atoms":[114,115]}},{"Repetition":{"atom":116,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":103}},{"Repetition":{"atom":118,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[107,108,117,119]}},{"Entity":{"atom":168}},{"Entity":{"atom":3}},{"Entity":{"atom":137}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"s"}},{"Alternative":{"atoms":[124,125]}},{"Entity":{"atom":36}},{"Entity":{"atom":136}},{"Str":{"pattern":"200"}},{"Lookahead":{"atom":129,"positive":false}},{"Str":{"pattern":"2"}},{"Entity":{"atom":20}},{"Entity":{"atom":20}},{"Sequence":{"atoms":[131,132,133]}},{"Sequence":{"atoms":[130,134]}},{"Named":{"name":"s100_number","atom":135}},{"Sequence":{"atoms":[126,127,128]}},{"Entity":{"atom":47}},{"Str":{"pattern":"Annex"}},{"Str":{"pattern":"ANNEX"}},{"Alternative":{"atoms":[139,140]}},{"Named":{"name":"annex_marker","atom":141}},{"Entity":{"atom":47}},{"Entity":{"atom":54}},{"Entity":{"atom":20}},{"Repetition":{"atom":145,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[144,146]}},{"Named":{"name":"annex_letter","atom":147}},{"Entity":{"atom":60}},{"Lookahead":{"atom":149,"positive":false}},{"Sequence":{"atoms":[143,148,150]}},{"Repetition":{"atom":151,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":79}},{"Entity":{"atom":86}},{"Entity":{"atom":163}},{"Entity":{"atom":47}},{"Str":{"pattern":"Ed"}},{"Entity":{"atom":47}},{"Sequence":{"atoms":[157,158]}},{"Repetition":{"atom":159,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":77}},{"Sequence":{"atoms":[156,160,161]}},{"Named":{"name":"edition","atom":162}},{"Alternative":{"atoms":[153,154,155]}},{"Repetition":{"atom":164,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":103}},{"Repetition":{"atom":166,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[122,123,138,142,152,165,167]}},{"Entity":{"atom":179}},{"Entity":{"atom":3}},{"Entity":{"atom":137}},{"Entity":{"atom":79}},{"Entity":{"atom":86}},{"Entity":{"atom":163}},{"Alternative":{"atoms":[172,173,174]}},{"Repetition":{"atom":175,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":103}},{"Repetition":{"atom":177,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[170,171,176,178]}},{"Entity":{"atom":209}},{"Str":{"pattern":"IALA "}},{"Entity":{"atom":204}},{"Entity":{"atom":192}},{"Entity":{"atom":60}},{"Repetition":{"atom":184,"min":0,"max":2,"tag":"Repetition"}},{"Entity":{"atom":20}},{"Repetition":{"atom":186,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":60}},{"Entity":{"atom":20}},{"Alternative":{"atoms":[188,189]}},{"Lookahead":{"atom":190,"positive":false}},{"Sequence":{"atoms":[185,187,191]}},{"Lookahead":{"atom":183,"positive":false}},{"Entity":{"atom":198}},{"Entity":{"atom":60}},{"Entity":{"atom":20}},{"Alternative":{"atoms":[195,196]}},{"Repetition":{"atom":197,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":36}},{"Entity":{"atom":198}},{"Sequence":{"atoms":[199,200]}},{"Repetition":{"atom":201,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[193,194,202]}},{"Named":{"name":"slug","atom":203}},{"Entity":{"atom":79}},{"Repetition":{"atom":205,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":103}},{"Repetition":{"atom":207,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[181,182,206,208]}},{"Alternative":{"atoms":[0,106,121,169,180]}}],"root":210},"bindings":[{"capture":"type_letter","path":"type_letter","type":"string","card":null,"preprocess":null},{"capture":"doc_number","path":"doc_number","type":"string","card":null,"preprocess":null},{"capture":"dotted_segment","path":"doc_number_dots[].dotted_segment","type":"string","card":null,"preprocess":null},{"capture":"subpart_number","path":"subpart[].subpart_number","type":"string","card":null,"preprocess":null},{"capture":"s100_number","path":"s100_number","type":"string","card":null,"preprocess":null},{"capture":"edition_value","path":"edition_value","type":"string","card":null,"preprocess":null},{"capture":"language","path":"language","type":"string","card":null,"preprocess":null},{"capture":"annex_marker","path":"annex_marker","type":"string","card":null,"preprocess":null},{"capture":"annex_letter","path":"annex_letter","type":"string","card":null,"preprocess":null},{"capture":"slug","path":"slug","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule identifier: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 1 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 1 and 4 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 1 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 2 and 3 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 2 and 4 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 2 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 3 and 4 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 3 and 5 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier: branches 4 and 5 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"G1040","expect":{}},{"entry":"identifier","kind":"accept","input":"GA1040","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S1070 Ed 2.0","expect":{}},{"entry":"identifier","kind":"accept","input":"R1016:ed2.0(F)","expect":{}},{"entry":"identifier","kind":"accept","input":"C0103-1 Ed 3.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA L2.1.11 Ed 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA G1128 Annex A Ed 1.6","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA G1045 Annex Ed 1","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA A12-01 (E)","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA arctic-seminar-report","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA 13th-vts-symposium-report (E)","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA iala-style-guide Ed 1.0 (E)","expect":{}},{"entry":"identifier","kind":"accept","input":"S-201 2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-201 2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-201 Ed 2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-201:ed2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-201","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA s-201 2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-201 ANNEX B2","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-201 Annex A 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IALA S-230 1.0.0 (E)","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"arctic-seminar-report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA Arctic-Seminar-Report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA -arctic-seminar-report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic seminar report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic-","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA arctic--report","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA s1070","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA c0103-1","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA 1070 Ed 2.0","expect":{}},{"entry":"identifier","kind":"reject","input":"S-411 1.2.1","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA S-411 1.2.1","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA S-200 1.0.0","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA S-30 2.0","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA S-2011 2.0.0","expect":{}},{"entry":"identifier","kind":"reject","input":"IALA S-201 Ed","expect":{}},{"entry":"identifier","kind":"example","input":"G1040","expect":{"type_letter":"G","doc_number":"1040"}},{"entry":"identifier","kind":"example","input":"GA01.01","expect":{"type_letter":"GA","doc_number":"01","doc_number_dots":[{"dotted_segment":"01"}]}},{"entry":"identifier","kind":"example","input":"C0103-1","expect":{"type_letter":"C","doc_number":"0103","subpart":[{"subpart_number":"1"}]}},{"entry":"identifier","kind":"example","input":"IALA S1070 Ed 2.0","expect":{"type_letter":"S","doc_number":"1070","edition_value":"2.0"}},{"entry":"identifier","kind":"example","input":"IALA G1128 Annex A Ed 1.6","expect":{"type_letter":"G","doc_number":"1128","annex_marker":"Annex","annex_letter":"A","edition_value":"1.6"}},{"entry":"identifier","kind":"example","input":"IALA arctic-seminar-report (E)","expect":{"slug":"arctic-seminar-report","language":"E"}},{"entry":"identifier","kind":"example","input":"IALA S-201 2.0.0","expect":{"s100_number":"201","edition_value":"2.0.0"}},{"entry":"identifier","kind":"example","input":"IALA S-201 ANNEX B2","expect":{"s100_number":"201","annex_marker":"ANNEX","annex_letter":"B2"}},{"entry":"identifier","kind":"example","input":"IALA iala-world-wide-radio-navigation-plan Ed 2","expect":{"slug":"iala-world-wide-radio-navigation-plan","edition_value":"2"}}],"docs":{},"source":"# Port of lib/pubid/iala/parser.rb: [IALA ]<type><number>[.dots][-subs]\n# [ Ed X.Y | :edX.Y] [(L)], plus the Annex-to-base form. The annex\n# letter guard (!lower) keeps \"Ed 1\" from mis-capturing.\n#\n# The S-100-family product specifications (the IHO-granted S-201..S-299\n# range, iala.int/technical/data-modelling/iala-s-200-development-status):\n# the hyphenated lexical form \"S-201\" with the S-100 dotted x.y.z\n# edition on the BARE face (\"IALA S-201 2.0.0\", the site's own citation\n# form); \"Ed 2.0.0\" and the compact \":ed2.0.0\" parse as normalizing\n# aliases. The hundreds digit is fixed to 2 by the grant, so WMO's and\n# IHO's own S-series (\"S-411 1.2.1\") never parse here. The alternative\n# sits above slug_identifier so the lower-case spelling (\"IALA s-201\")\n# binds the typed form instead of the codeless slug. The S-100 annex\n# wrapper takes the sub-numbered annex letters the package attests\n# (\"Annex A\", \"ANNEX B2\", \"Annex D1\"), which widens the shared annex\n# letter rule to an optional digit for the legacy series as well.\n#\n# Edition-2 conversion with typed model bindings. Deviations from the\n# v1 tree:\n# - the dotted continuation and the dash subpart repeat capture-bearing\n# rule refs (the itu `parts` shape): a repetition over a capture-less\n# unit harvested as a bare span binds differently per engine, so the\n# bindings read the inner captures through the array paths\n# `doc_number_dots[].dotted_segment` and `subpart[].subpart_number`.\n# The dotted segment gains its own capture (`dotted_segment`); the\n# subpart keeps its `subpart_number` capture, hoisted out of the\n# inline repetition into a rule ref of its own.\n# - the annex base composite stays unbound. Every capture inside it\n# (type_letter, doc_number, …) is the only occurrence of its name on\n# the annex path, so the binding harvest hoists it to the top level:\n# the builder reads one flat map for the plain and the annex form\n# alike and dispatches on :annex_marker. edition_value and language\n# hoist out of their edition/language_group composites the same way.\n#\n# The codeless (slug) form: iala.int lists some publications (reports\n# and proceedings, the style guide, history books, radio plans) with no\n# code, and relaton gives them the product-URL slug as docid, e.g.\n# \"IALA arctic-seminar-report (E)\". slug_identifier is the last\n# alternative, so every typed code keeps priority; a typed code starts\n# upper-case and a slug lower-case or with a digit, so the two never\n# overlap. The \"IALA \" prefix is mandatory here (it is optional for a\n# typed code): without it any lower-case word would parse. The slug has\n# no space, so it never takes the trailing \" Ed <edition>\" or \" (<L>)\".\n# A slug is two or more hyphen-joined [a-z0-9] runs (every corpus slug\n# is), and its first run must not look like a code (0-2 letters and\n# digits: \"s1070\", \"ga01\", \"1070\"), so a lower-case or letterless typo\n# of a typed code (\"IALA s1070\", \"IALA c0103-1\", \"IALA 1070 Ed 2.0\")\n# still fails instead of parsing as a codeless publication.\n\ngrammar PubidIala version \"0.2.0\" edition 2 {\n type_letter = (\"GA\" / \"S\" / \"R\" / \"G\" / \"M\" / \"C\" / \"A\" / \"L\" / \"X\" / \"P\") as type_letter\n doc_number = (1*digit) as doc_number\n dotted_number = dot (1*digit) as dotted_segment\n number_with_dots = doc_number (*dotted_number) as doc_number_dots\n subpart_number = dash (1*digit) as subpart_number\n subpart = (1*subpart_number) as subpart\n code = type_letter number_with_dots [subpart]\n s100_number = (!\"200\" (\"2\" digit digit)) as s100_number\n s100_code = ((\"S\" / \"s\") dash s100_number)\n edition_value = (1*digit *(dot 1*digit)) as edition_value\n edition_human = (space \"Ed\" space edition_value) as edition\n edition_compact = (colon \"ed\" edition_value) as edition\n s100_edition = (space [\"Ed\" space] edition_value) as edition\n language_group = ([space] \"(\" (\"E\" / \"F\" / \"S\" / \"C\" / \"A\" / \"R\") as language \")\") as language_group\n annex_identifier = {\n ((publisher type_letter number_with_dots [subpart]) as base)\n space\n (\"Annex\" / \"ANNEX\") as annex_marker\n [ (space (upper [digit]) as annex_letter !lower) ]\n [edition_human / edition_compact]\n [language_group]\n }\n plain_identifier = {\n publisher code [edition_human / edition_compact] [language_group]\n }\n s100_annex_identifier = {\n publisher s100_code\n space\n (\"Annex\" / \"ANNEX\") as annex_marker\n [ (space (upper [digit]) as annex_letter !lower) ]\n [edition_human / edition_compact / s100_edition]\n [language_group]\n }\n s100_identifier = {\n publisher s100_code\n [edition_human / edition_compact / s100_edition]\n [language_group]\n }\n slug_segment = 1*(lower / digit)\n slug_code_like = *2lower 1*digit !(lower / digit)\n slug = (!slug_code_like slug_segment 1*(dash slug_segment)) as slug\n slug_identifier = {\n \"IALA \" slug [edition_human] [language_group]\n }\n identifier = {\n annex_identifier\n / plain_identifier\n / s100_annex_identifier\n / s100_identifier\n / slug_identifier\n }\n publisher = [\"IALA \"]\n upper = %x41-5A\n lower = %x61-7A\n digit = %x30-39\n dash = \"-\"\n colon = \":\"\n dot = \".\"\n space = \" \"\n entry identifier: identifier\n\n bindings identifier {\n type_letter -> type_letter (string)\n doc_number -> doc_number (string)\n dotted_segment -> doc_number_dots[].dotted_segment (string)\n subpart_number -> subpart[].subpart_number (string)\n s100_number -> s100_number (string)\n edition_value -> edition_value (string)\n language -> language (string)\n annex_marker -> annex_marker (string)\n annex_letter -> annex_letter (string)\n slug -> slug (string)\n }\n\n test {\n accept \"G1040\"\n accept \"GA1040\"\n accept \"IALA S1070 Ed 2.0\"\n accept \"R1016:ed2.0(F)\"\n accept \"C0103-1 Ed 3.0\"\n accept \"IALA L2.1.11 Ed 2\"\n accept \"IALA G1128 Annex A Ed 1.6\"\n accept \"IALA G1045 Annex Ed 1\"\n accept \"IALA A12-01 (E)\"\n accept \"IALA arctic-seminar-report\"\n accept \"IALA 13th-vts-symposium-report (E)\"\n accept \"IALA iala-style-guide Ed 1.0 (E)\"\n accept \"S-201 2.0.0\"\n accept \"IALA S-201 2.0.0\"\n accept \"IALA S-201 Ed 2.0.0\"\n accept \"IALA S-201:ed2.0.0\"\n accept \"IALA S-201\"\n accept \"IALA s-201 2.0.0\"\n accept \"IALA S-201 ANNEX B2\"\n accept \"IALA S-201 Annex A 1.0.0\"\n accept \"IALA S-230 1.0.0 (E)\"\n reject \"nonsense\"\n reject \"arctic-seminar-report\"\n reject \"IALA Arctic-Seminar-Report\"\n reject \"IALA -arctic-seminar-report\"\n reject \"IALA arctic seminar report\"\n reject \"IALA arctic\"\n reject \"IALA arctic-\"\n reject \"IALA arctic--report\"\n reject \"IALA s1070\"\n reject \"IALA c0103-1\"\n reject \"IALA 1070 Ed 2.0\"\n reject \"S-411 1.2.1\"\n reject \"IALA S-411 1.2.1\"\n reject \"IALA S-200 1.0.0\"\n reject \"IALA S-30 2.0\"\n reject \"IALA S-2011 2.0.0\"\n reject \"IALA S-201 Ed\"\n example \"G1040\" { type_letter: \"G\", doc_number: \"1040\" }\n example \"GA01.01\" {\n type_letter: \"GA\",\n doc_number: \"01\",\n doc_number_dots: [ { dotted_segment: \"01\" } ],\n }\n example \"C0103-1\" {\n type_letter: \"C\",\n doc_number: \"0103\",\n subpart: [ { subpart_number: \"1\" } ],\n }\n example \"IALA S1070 Ed 2.0\" {\n type_letter: \"S\",\n doc_number: \"1070\",\n edition_value: \"2.0\",\n }\n example \"IALA G1128 Annex A Ed 1.6\" {\n type_letter: \"G\",\n doc_number: \"1128\",\n annex_marker: \"Annex\",\n annex_letter: \"A\",\n edition_value: \"1.6\",\n }\n example \"IALA arctic-seminar-report (E)\" {\n slug: \"arctic-seminar-report\",\n language: \"E\",\n }\n example \"IALA S-201 2.0.0\" {\n s100_number: \"201\",\n edition_value: \"2.0.0\",\n }\n example \"IALA S-201 ANNEX B2\" {\n s100_number: \"201\",\n annex_marker: \"ANNEX\",\n annex_letter: \"B2\",\n }\n example \"IALA iala-world-wide-radio-navigation-plan Ed 2\" {\n slug: \"iala-world-wide-radio-navigation-plan\",\n edition_value: \"2\",\n }\n }\n}\n","source_hash":"4bc93bf63b1692f346ce1cb273eff7adc50fc36a2d9c9904cda4e5457dacbae1","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:f21ad5b10665dcb1c4cc0d266e9b20359baab33900b2422a87c9ab0ace3c80eb","checksum":"sha256:c6e3329aa3e2bba2504bededcc333568c5672898e614099111dc72e5747b5d80","validated":{"lint_errors":0,"lint_warnings":10,"tests_total":47,"tests_failures":0,"self_test":true}}
|
package/vendor/parg/iho.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.4.0","grammar":"PubidIho","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier_entry","grammar":{"atoms":[{"Entity":{"atom":41}},{"Str":{"pattern":"IHO"}},{"Entity":{"atom":3}},{"Str":{"pattern":" "}},{"Sequence":{"atoms":[1,2]}},{"Repetition":{"atom":4,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"B"}},{"Named":{"name":"spec_part","atom":6}},{"Entity":{"atom":9}},{"Str":{"pattern":"-"}},{"Entity":{"atom":23}},{"Entity":{"atom":22}},{"Str":{"pattern":"1"}},{"Str":{"pattern":"2"}},{"Str":{"pattern":"3"}},{"Str":{"pattern":"4"}},{"Str":{"pattern":"5"}},{"Str":{"pattern":"6"}},{"Alternative":{"atoms":[12,13,14,15,16,17]}},{"Entity":{"atom":20}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Entity":{"atom":20}},{"Sequence":{"atoms":[18,19,21]}},{"Named":{"name":"spec","atom":11}},{"Entity":{"atom":30}},{"Entity":{"atom":26}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Repetition":{"atom":27,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"spec_sub","atom":28}},{"Sequence":{"atoms":[25,29]}},{"Repetition":{"atom":24,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":39}},{"Str":{"pattern":"("}},{"Entity":{"atom":35}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":34,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"spec_variant","atom":36}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[33,37,38]}},{"Repetition":{"atom":32,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[5,7,8,10,31,40]}},{"Entity":{"atom":435}},{"Str":{"pattern":"IHO"}},{"Entity":{"atom":3}},{"Sequence":{"atoms":[43,44]}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":54}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"P"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[48,49,50,51,52]}},{"Named":{"name":"type","atom":53}},{"Entity":{"atom":9}},{"Entity":{"atom":59}},{"Entity":{"atom":20}},{"Repetition":{"atom":57,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"number","atom":58}},{"Entity":{"atom":65}},{"Str":{"pattern":":"}},{"Entity":{"atom":20}},{"Repetition":{"atom":62,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"checks_for","atom":63}},{"Sequence":{"atoms":[61,64]}},{"Repetition":{"atom":60,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":92}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"P"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[69,70,71,72,73]}},{"Entity":{"atom":9}},{"Entity":{"atom":20}},{"Repetition":{"atom":76,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[74,75,77]}},{"Entity":{"atom":20}},{"Repetition":{"atom":79,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":85}},{"Entity":{"atom":35}},{"Entity":{"atom":84}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[82,83]}},{"Repetition":{"atom":81,"min":0,"max":null,"tag":"Repetition"}},{"Repetition":{"atom":86,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[80,87]}},{"Entity":{"atom":35}},{"Alternative":{"atoms":[78,88,89]}},{"Named":{"name":"part","atom":90}},{"Sequence":{"atoms":[68,91]}},{"Repetition":{"atom":67,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":96}},{"Entity":{"atom":35}},{"Named":{"name":"part","atom":95}},{"Repetition":{"atom":94,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":132}},{"Str":{"pattern":"/"}},{"Entity":{"atom":20}},{"Repetition":{"atom":100,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"volume","atom":101}},{"Entity":{"atom":130}},{"Entity":{"atom":116}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":106,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":109,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":112,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[107,108,110,111,113]}},{"Named":{"name":"volume_edition","atom":114}},{"Sequence":{"atoms":[105,115]}},{"Entity":{"atom":128}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[120,121]}},{"Entity":{"atom":20}},{"Repetition":{"atom":123,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[122,124]}},{"Named":{"name":"volume_year","atom":125}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[118,119,126,127]}},{"Repetition":{"atom":117,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[104,129]}},{"Repetition":{"atom":103,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[99,102,131]}},{"Repetition":{"atom":98,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":175}},{"Entity":{"atom":147}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":137,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":140,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":143,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[138,139,141,142,144]}},{"Named":{"name":"edition","atom":145}},{"Sequence":{"atoms":[136,146]}},{"Entity":{"atom":160}},{"Entity":{"atom":3}},{"Str":{"pattern":"v"}},{"Entity":{"atom":20}},{"Repetition":{"atom":151,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Repetition":{"atom":154,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[153,155]}},{"Repetition":{"atom":156,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[152,157]}},{"Named":{"name":"edition_shorthand","atom":158}},{"Sequence":{"atoms":[149,150,159]}},{"Alternative":{"atoms":[135,148]}},{"Entity":{"atom":173}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[165,166]}},{"Entity":{"atom":20}},{"Repetition":{"atom":168,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[167,169]}},{"Named":{"name":"year","atom":170}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[163,164,171,172]}},{"Repetition":{"atom":162,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[161,174]}},{"Repetition":{"atom":134,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":215}},{"Entity":{"atom":3}},{"Str":{"pattern":"Suppl"}},{"Str":{"pattern":"Sup"}},{"Alternative":{"atoms":[179,180]}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":183,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement","atom":184}},{"Entity":{"atom":213}},{"Entity":{"atom":199}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":189,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":192,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":195,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[190,191,193,194,196]}},{"Named":{"name":"supplement_edition","atom":197}},{"Sequence":{"atoms":[188,198]}},{"Entity":{"atom":211}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[203,204]}},{"Entity":{"atom":20}},{"Repetition":{"atom":206,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[205,207]}},{"Named":{"name":"supplement_year","atom":208}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[201,202,209,210]}},{"Repetition":{"atom":200,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[187,212]}},{"Repetition":{"atom":186,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[178,181,182,185,214]}},{"Repetition":{"atom":177,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":297}},{"Entity":{"atom":3}},{"Str":{"pattern":"Part"}},{"Entity":{"atom":3}},{"Entity":{"atom":241}},{"Entity":{"atom":232}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"P"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[223,224,225,226,227]}},{"Entity":{"atom":9}},{"Entity":{"atom":20}},{"Repetition":{"atom":230,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[228,229,231]}},{"Entity":{"atom":20}},{"Repetition":{"atom":233,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":85}},{"Repetition":{"atom":235,"min":0,"max":null,"tag":"Repetition"}},{"Repetition":{"atom":236,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[234,237]}},{"Entity":{"atom":35}},{"Alternative":{"atoms":[222,238,239]}},{"Named":{"name":"part","atom":240}},{"Entity":{"atom":269}},{"Entity":{"atom":255}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":245,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":248,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":251,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[246,247,249,250,252]}},{"Named":{"name":"part_edition","atom":253}},{"Sequence":{"atoms":[244,254]}},{"Entity":{"atom":267}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[259,260]}},{"Entity":{"atom":20}},{"Repetition":{"atom":262,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[261,263]}},{"Named":{"name":"part_year","atom":264}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[257,258,265,266]}},{"Repetition":{"atom":256,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[243,268]}},{"Repetition":{"atom":242,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":295}},{"Str":{"pattern":","}},{"Entity":{"atom":3}},{"Str":{"pattern":"Section"}},{"Entity":{"atom":3}},{"Entity":{"atom":22}},{"Named":{"name":"spec_section","atom":276}},{"Str":{"pattern":","}},{"Entity":{"atom":3}},{"Entity":{"atom":292}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[281,282,283]}},{"Named":{"name":"spec_part","atom":284}},{"Entity":{"atom":9}},{"Entity":{"atom":23}},{"Entity":{"atom":30}},{"Repetition":{"atom":288,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":39}},{"Repetition":{"atom":290,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[285,286,287,289,291]}},{"Sequence":{"atoms":[278,279,280]}},{"Repetition":{"atom":293,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[272,273,274,275,277,294]}},{"Repetition":{"atom":271,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[218,219,220,221,270,296]}},{"Repetition":{"atom":217,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":302}},{"Entity":{"atom":3}},{"Entity":{"atom":292}},{"Sequence":{"atoms":[300,301]}},{"Repetition":{"atom":299,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":339}},{"Entity":{"atom":3}},{"Str":{"pattern":"Annex"}},{"Entity":{"atom":3}},{"Entity":{"atom":35}},{"Named":{"name":"annex","atom":308}},{"Entity":{"atom":337}},{"Entity":{"atom":323}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":313,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":316,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":319,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[314,315,317,318,320]}},{"Named":{"name":"annex_edition","atom":321}},{"Sequence":{"atoms":[312,322]}},{"Entity":{"atom":335}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[327,328]}},{"Entity":{"atom":20}},{"Repetition":{"atom":330,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[329,331]}},{"Named":{"name":"annex_year","atom":332}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[325,326,333,334]}},{"Repetition":{"atom":324,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[311,336]}},{"Repetition":{"atom":310,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[305,306,307,309,338]}},{"Repetition":{"atom":304,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":390}},{"Entity":{"atom":3}},{"Str":{"pattern":"Appendix"}},{"Str":{"pattern":"App"}},{"Str":{"pattern":"Ap."}},{"Alternative":{"atoms":[343,344,345]}},{"Entity":{"atom":3}},{"Entity":{"atom":353}},{"Entity":{"atom":35}},{"Entity":{"atom":20}},{"Repetition":{"atom":350,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[349,351]}},{"Named":{"name":"appendix","atom":352}},{"Entity":{"atom":359}},{"Entity":{"atom":9}},{"Entity":{"atom":20}},{"Repetition":{"atom":356,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"appendix_subnumber","atom":357}},{"Sequence":{"atoms":[355,358]}},{"Repetition":{"atom":354,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":388}},{"Entity":{"atom":374}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":364,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":367,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":370,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[365,366,368,369,371]}},{"Named":{"name":"appendix_edition","atom":372}},{"Sequence":{"atoms":[363,373]}},{"Entity":{"atom":386}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[378,379]}},{"Entity":{"atom":20}},{"Repetition":{"atom":381,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[380,382]}},{"Named":{"name":"appendix_year","atom":383}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[376,377,384,385]}},{"Repetition":{"atom":375,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[362,387]}},{"Repetition":{"atom":361,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[342,346,347,348,360,389]}},{"Repetition":{"atom":341,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":431}},{"Entity":{"atom":417}},{"Entity":{"atom":3}},{"Str":{"pattern":"Vol."}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":397,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"volume","atom":398}},{"Entity":{"atom":415}},{"Entity":{"atom":3}},{"Str":{"pattern":"Issue"}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":404,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"issue","atom":405}},{"Sequence":{"atoms":[401,402,403,406]}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Entity":{"atom":20}},{"Repetition":{"atom":410,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"issue","atom":411}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[408,409,412,413]}},{"Alternative":{"atoms":[407,414]}},{"Repetition":{"atom":400,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[394,395,396,399,416]}},{"Entity":{"atom":427}},{"Entity":{"atom":3}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[420,421]}},{"Entity":{"atom":20}},{"Repetition":{"atom":423,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[422,424]}},{"Named":{"name":"volume","atom":425}},{"Sequence":{"atoms":[419,426]}},{"Alternative":{"atoms":[393,418]}},{"Entity":{"atom":130}},{"Repetition":{"atom":429,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[428,430]}},{"Repetition":{"atom":392,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":173}},{"Repetition":{"atom":433,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[46,47,55,56,66,93,97,133,176,216,298,303,340,391,432,434]}},{"Alternative":{"atoms":[0,42]}}],"root":436},"bindings":[{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"checks_for","path":"checks_for","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"part_edition","path":"part_edition","type":"string","card":null,"preprocess":null},{"capture":"part_year","path":"part_year","type":"string","card":null,"preprocess":null},{"capture":"annex","path":"annex","type":"string","card":null,"preprocess":null},{"capture":"annex_edition","path":"annex_edition","type":"string","card":null,"preprocess":null},{"capture":"annex_year","path":"annex_year","type":"string","card":null,"preprocess":null},{"capture":"appendix","path":"appendix","type":"string","card":null,"preprocess":null},{"capture":"appendix_subnumber","path":"appendix_subnumber","type":"string","card":null,"preprocess":null},{"capture":"appendix_edition","path":"appendix_edition","type":"string","card":null,"preprocess":null},{"capture":"appendix_year","path":"appendix_year","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplement","type":"string","card":null,"preprocess":null},{"capture":"supplement_edition","path":"supplement_edition","type":"string","card":null,"preprocess":null},{"capture":"supplement_year","path":"supplement_year","type":"string","card":null,"preprocess":null},{"capture":"edition","path":"edition","type":"string","card":null,"preprocess":null},{"capture":"edition_shorthand","path":"edition_shorthand","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"volume","path":"volume","type":"string","card":null,"preprocess":null},{"capture":"volume_edition","path":"volume_edition","type":"string","card":null,"preprocess":null},{"capture":"volume_year","path":"volume_year","type":"string","card":null,"preprocess":null},{"capture":"issue","path":"issue","type":"string","card":null,"preprocess":null},{"capture":"spec","path":"spec","type":"string","card":null,"preprocess":null},{"capture":"spec_sub","path":"spec_sub","type":"string","card":null,"preprocess":null},{"capture":"spec_variant","path":"spec_variant","type":"string","card":null,"preprocess":null},{"capture":"spec_part","path":"spec_part","type":"string","card":null,"preprocess":null},{"capture":"spec_section","path":"spec_section","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule volume_issue: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier_entry: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"S-5","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5 Appendix 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO B-12 3.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-5 2024","expect":{}},{"entry":"identifier","kind":"accept","input":"P-5 2024","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-5 Vol. 2024","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-5/2024","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO B-7 Vol. 2023","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1 Vol. 30","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1 Vol. 30 (2)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1 Vol. 30 Issue 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1/21","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1/21 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 5.0.0 Part 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-98 1.0.0 Part A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-65 1.1.0 Annex A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-122 1.0.0 Appendix D-2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-52 4.0.0 Appendix 1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO M-2 Sup 1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO M-2 Suppl 6","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-66 2.0.0 Sup 4","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5-B","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100-1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100-1 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-6-3 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5A 1.0.2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5 1.0.2 Part A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 5.0.0 Part 2 (2024)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 v5.1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 v1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 1.0.0 (2024) Part A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-53 Ap. 1 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-98 Part A 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:100 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:100 Part 2 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:102","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:102 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:128","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-1001","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158 Part S-102 0.2.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158-S-102 0.2.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158 Part 102","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-6 1.0.0 Vol. 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-6 Vol. 2 1.0.1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-98 1.0.0 Annex A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 5.0.0 Sup 1 2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 4.10.0 B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-122.1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-521(I)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-351.1(I)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-400","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-170","expect":{}},{"entry":"identifier","kind":"accept","input":"B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"B-122.1","expect":{}},{"entry":"identifier","kind":"accept","input":"B-521(I)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 Part B, Section 400","expect":{}},{"entry":"identifier","kind":"accept","input":"S-4 Part B, Section 400","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 Part B, Section 400, B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"B-12","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-4 B-4","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-4 B-40","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-4 B-800","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO B-12 3.0","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO P-5 1850","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-158:","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-158:abc","expect":{}}],"docs":{},"source":"# Port of lib/pubid/iho/parser.rb — IHO identifiers: letter series\n# (S/P/M/B/C), a number with the optional S-158 series-member designator,\n# and the full component tail (edition, supplement, part, annex, appendix\n# + subnumber, volume, issue, year qualifier).\n#\n# == Component model (owner rulings, 2026-11-03; the S-158 series model,\n# issue #774, 2026-11-25)\n#\n# Every component below is a first-class semantic component: its own\n# named capture, its own typed binding, independently addressable in\n# the model, URN-encodable and matchable — never a regex/string suffix.\n#\n# component face capture binding type\n# edition x.y.z (bare) edition string\n# edition v1 / v5.1 (alias) edition_shorthand string (parse-only;\n# the builder pads to\n# x.y.0 — official IHO\n# edition is dotted\n# x.y.z WITHOUT a year)\n# checks_for S-158:102 checks_for string (the S-158\n# series member: the\n# S-100 product number\n# whose validation\n# checks the member\n# specifies; the colon\n# form is the PRIMARY\n# designator since\n# S-158 Ed 1.0.0)\n# supplement Sup N (Suppl N) supplement string\n# part Part X part string (letter,\n# number, or compound\n# \"4a\"; on the S-158\n# family a digit or\n# SERIES-REFERENCE\n# value is the draft-era\n# checks spelling and\n# REBINDS to checks_for)\n# part -X / -S-102 (short) part string (hyphenated;\n# same S-158 rebind)\n# annex Annex A annex string\n# appendix Appendix B appendix string\n# appendix Appendix D-2 appendix_subnumber string (the -2)\n# volume Vol. N volume string\n# volume /N (short) volume string (the slash\n# chain, P-1/21 or\n# P-5/2020)\n# volume N (bare, legacy) volume string (the yearbook\n# year IS a volume —\n# one serial-locator\n# component)\n# issue (N) / Issue N issue string\n# year (2024) year string (the with-year\n# qualifier on\n# standards; NOT a\n# serial locator)\n#\n# == Component-edition duality (owner ruling: \"this can happen with any\n# independently publishable artifacts\")\n#\n# Supplement, part, annex, appendix and volume can be published on\n# their own publication cycle, so EACH carries an optional\n# `<kind>_edition` (+ `<kind>_year` qualifier) of its own, mutually\n# exclusive with the base edition context:\n#\n# within-edition: IHO P-6 1.0.0 Vol. 2 (the volume rides\n# the base's edition)\n# separately-published: IHO P-6 Vol. 2 1.0.1 (the volume carries\n# IHO S-98 Part A 1.0.0 its own edition;\n# IHO S-158 Part S-102 0.2.0 the base is\n# cited edition-less)\n#\n# In the URN the ed- segment attaches to the node it follows, so the\n# same positional slot records both modes.\n#\n# == The S-158 series model (issue #774; S-158 Ed 1.0.0 clause 2.1)\n#\n# S-158 \"Validation Checks — Introduction and Structure\" is a framework\n# publication defining a SERIES of separate publications, each a\n# publication of its own with its own edition stream: S-158:100 (generic\n# checks), S-158:1xx (one product-specific check specification per S-100\n# product; :101 = S-101 ENC, :102 = S-102 Bathymetric Surface),\n# S-158:98 (interoperability) and S-158:128 (catalogue). `:NNN` is the\n# official IHO product number whose checks the member specifies — NOT a\n# part and NOT a \"profile\".\n#\n# The colon form is the PRIMARY designator since Ed 1.0.0:\n# `S-158:102 [edition]` binds number=158 and checks_for=102 as two\n# typed components. The draft-era spellings are NON-NORMALIZED ALIASES\n# of the same identity (facets-spelling-only: each spelling keeps its\n# render, equality/URN use the canonical shape):\n#\n# S-158 Part S-102 the expanded draft-era part face (the builder\n# rebinds the part value onto checks_for and the\n# edition that follows it onto the BASE edition —\n# the parted- mis-bind of issue #775)\n# S-158-S-102 the compact hyphenated face (same rebind)\n# S-158 Part 102 the bare-number draft-era part face\n#\n# A series-reference-shaped part face rebinds only while checks_for is\n# UNBOUND: `S-158:100 Part 2` keeps a genuine part on the member\n# publication. A lettered part face on S-158 is unattested and stays a\n# plain part. The colon form on any other anchor (S-44:5) is rejected\n# by the builder: the member designator is the S-158 series device.\n#\n# The part has a COMPACT face, hyphenated onto the code — `IHO S-5-B`\n# (lettered part), `IHO S-100-1` (numbered part) — which both parses\n# and renders; the canonical expanded face stays `IHO S-100 x.y.z\n# Part 1`. Gluing a part onto the code without a separator (S-5A) is\n# DISALLOWED as a form: it cannot extend to numbered parts without\n# ambiguity (S-1001 = series 1001 vs series 100 part 1). The four\n# lettered bases the corpus records (S-5A, S-5B, S-8A, S-8B) are LEGACY\n# data spellings: they still parse as aliases (S-5A == S-5 Part A) but\n# are never rendered; the owner rules later whether to reject them\n# outright.\n#\n# Two main syntaxes per the owner ruling: `IHO S-100 1.0.0` (dated =\n# edition-specific) and `IHO S-100` (undated = edition-non-specific).\n# A year beside an edition is the with-year variant qualifier\n# (`IHO S-100 1.0.0 Part X (2024)`), never a year-keyed docidentifier —\n# year-keyed docidentifiers for edition-keyed products are wrong. The\n# continuously-updated series have ONE serial locator, the volume:\n# P-1 and P-6 are volume-keyed (`IHO P-1 Vol. 30 (1)`), and the\n# yearbook year IS a volume (`IHO P-5 Vol. 2020`) — the bare year\n# (`IHO P-5 2020`) and all year-faced forms are parse-only legacy\n# aliases that bind into the volume component, never rendered.\n#\n# Aliases: \"Suppl\" (canonical face Sup, the M-2 spelling — why abbreviate\n# by two letters when Annex and Appendix stay full-length), \"App\"/\"Ap.\"\n# (canonical face Appendix), the hyphenated compact part face (S-5-B ==\n# S-5 Part B, S-100-1 == S-100 Part 1), the legacy glued lettered bases\n# (S-5A, parse-only), \"S-100 v1..v5.1\" (edition shorthand), \"Issue N\"\n# (canonical (N)), the bare year (canonical Vol. N).\n#\n# == URN emission — the IHO MRN guidance (owner adoption, 2026-11-25)\n#\n# The flavor emits the IHO MRN guidance form (S-100WG4, \"MRN Guidelines\n# for IHO\") for the series the guidance gives a publication type:\n#\n# urn:mrn:iho:pub:<type>:<name>[:<edition>][:<trailing atoms>...]\n# <type> spec (S series) | per (P series) | reg (M series)\n# <name> sNNN — the lowercase series letter + number (the guidance's\n# own \"s57\"/\"s98\" name form; the dotted edition is the\n# canonical 4th segment, per IHO's printed S-98 metadata\n# urn:mrn:iho:pub:spec:s98:1.0.0)\n# <edition> the bare dotted x.y.z — NOT ed-prefixed\n#\n# The S-158 member joins the name segment hyphenated — the fleet\n# extension of the guidance for compound publication numbers — so the\n# edition stays in its canonical 4th position:\n#\n# S-158 1.0.0 -> urn:mrn:iho:pub:spec:s158:1.0.0\n# S-158:102 1.0.0 -> urn:mrn:iho:pub:spec:s158-102:1.0.0\n#\n# The trailing atoms carry the components the guidance's tail slots do\n# not model, in the containment order below, lowercase marker tokens,\n# RFC 3986-safe, values case-preserved (identity law: part-A and part-a\n# are distinct documents); a component's own edition rides as ed- right\n# after it (the duality law), the Appendix subnumber hyphen-joins its\n# appendix (appendix-D-2):\n#\n# [:year-<yyyy>][:sup-<n>[:ed-<x.y.z>][:year-<yyyy>]]\n# [:part-<X>[...]][:spec-<n>[:specsub-<n>][:specvar-<X>]]\n# [:annex-<A>[...]][:appendix-<B>[-<sub>][...]]\n# [:vol-<n>[:issue-<n>][...]]\n#\n# The guidance's bare correction/clarification slots (the s57:3:1 form)\n# are not modeled faces and reject. The B (Bibliographic) and C\n# (Circular Letter) series have no guidance publication type code —\n# until IHO assigns one they keep the legacy positional emission below.\n#\n# == Legacy positional segment grammar (decode-only for S/P/M, the\n# emission of the B/C series)\n#\n# The URN mirrors the containment tree, one semantic atom per segment:\n# Part contains Annexes; Annex contains Appendices; a D-2 subnumber is\n# a child atom of Appendix D. No key.value concatenations — every\n# non-number component is a marker-prefixed segment whose marker is the\n# lowercased human-face token (edition follows ISO's ed- precedent).\n# An S-4 specification is a child of its Part (the citation letter rides\n# the part- atom), with the dotted sub and the parenthesized variant as\n# its own children:\n#\n# urn:iho:<type>:<number>[:ed-<x.y.z>][:year-<yyyy>]\n# [:sup-<n>[:ed-<x.y.z>][:year-<yyyy>]]\n# [:part-<X>[:ed-<x.y.z>][:year-<yyyy>]]\n# [:spec-<n>[:specsub-<n>][:specvar-<X>]]\n# [:annex-<A>[...]]\n# [:appendix-<B>[:<sub>][...]]\n# [:vol-<n>[:issue-<n>][...]]\n# [:year-<yyyy>]\n#\n# position segment value vocabulary containment\n# -------- --------------- -------------------------- ------------------\n# 1 <type> s / p / m / b / c namespace root\n# 2 <number> digits + : suffix; may document code\n# span bare segments until\n# the first marker\n# 3 ed-<x.y.z> dotted a.b.c edition qualifier;\n# 4 year-<yyyy> 19xx/20xx ATTACHES TO THE\n# NODE IT FOLLOWS: the\n# base (no component\n# before it) or the\n# component whose\n# segment precedes\n# 5 sup-<n> 1*digit wraps the base\n# 6 part-<X> letter (case kept), contains annexes\n# digits [*letter], or a and S-4 specs\n# series reference\n# [SPMBC]-<digits>\n# 7 spec-<n> [1-6]dd, only under an child of part (the\n# S-4 anchor (s:4) S-4 leaf; the\n# section is the\n# hundreds digit,\n# derivable, never\n# emitted)\n# 8 specsub-<n> 1*digit, only after spec- child of spec\n# 9 specvar-<X> upper letters, after child of spec\n# spec- or specsub-\n# 10 annex-<A> upper letter (case kept) contains appendices\n# 11 appendix-<B> upper letter or digits contains subnumber\n# 12 <sub> 1*digit, BARE, only child of appendix\n# directly after appendix-\n# 13 vol-<n> 1*digit (incl. yearbook contains issue\n# years, Vol. 2020)\n# 14 issue-<n> 1*digit, only after vol- child of volume\n#\n# The number occupies every leading bare segment up to the first\n# marker, so a colon number (S-158:100) round-trips without escaping;\n# after the markers the only bare segment allowed is the appendix\n# subnumber in its own slot. Both the year qualifier and the volume are\n# marker-tagged so neither can collide with a colon-number segment (the\n# #637 hazard, kept under the positional scheme). Letters are\n# case-preserved: part-A and part-a are distinct documents.\n#\n# Legacy 2.0.x spellings remain decodable but are never emitted: the\n# bare a.b.c segment (edition), the dotted keys part./annex./suppl./\n# ap./appendix./vol./issue. and the single-letter y. year tag (whose\n# value decodes into the volume — the serial-locator unification).\n#\n# == S-4 loose-leaf sections and specifications (issue #691; owner\n# rulings of 2026-11-11)\n#\n# The S-4 loose-leaf publication cites its regulations/specifications as\n# <letter>-<hundreds><seq>: B-401 is Part B, Section 400, item 01. ONE\n# component, not two tiers: the spec number IS the leaf; the SECTION is\n# the hundreds digit, DERIVED (never stored, never emitted). The `00`\n# slot (B-400) IS the section-level citation, so \"S-4 Part B, Section\n# 400\" and \"IHO S-4 B-400\" are one identity, two spellings.\n#\n# capture example role\n# spec B-401 -> \"401\" the leaf number (3 digits,\n# hundreds 1-6: sections 100-600)\n# spec_sub B-122.1 -> \"1\" the dotted sub\n# spec_variant B-521(I) -> \"I\" the parenthesized variant\n# spec_part B-401 -> \"B\" the citation letter (the builder\n# binds it into `part`; a Part-rule\n# capture must agree)\n# spec_section \", Section 400\" -> \"400\" the long form's spelled\n# section (becomes `spec` alone;\n# checked against a citation)\n#\n# Faces: canonical compact \"IHO S-4 B-401\" (dated: \"IHO S-4 4.10.0\n# B-401\"); long \"S-4 Part B, Section 400\" (a normalizing parse; also\n# takes a trailing citation: \"S-4 Part B, Section 400, B-401\", where the\n# spelled section only cross-checks the citation's derived section); bare\n# \"B-401\" (implicit S-4 anchor; B only — bare C-x stays the Circular\n# Letter series). The builder binds the anchor: a citation requires the\n# S-4 anchor (or synthesizes it for the bare form).\n#\n# Reserved numbers (\"NOT CURRENTLY USED\" in the S-4 contents — B-170,\n# B-230, B-305, B-323 in Ed 4.9.0 and 4.10.0) parse and resolve AS\n# RESERVED, never invalid; the edition-keyed registry lives in the pubid\n# gem (data/iho/s4-reserved-specs.yaml).\n#\n# URN atoms: part-<letter>:spec-<n>[:specsub-<n>][:specvar-<X>] — the\n# section is NOT emitted (derivable); the citation letter rides the\n# existing part- atom (case preserved: part-B).\n#\n# Edition 2: ruby#400's capture-flatten keeps text captures over\n# reference-built rules as the matched text, so the v2 tree is the v1\n# tree plus named leaves for non-captured structure.\n\ngrammar PubidIho version \"0.4.0\" edition 2 {\n digit = %x30-39\n upper = %x41-5A\n lower = %x61-7A\n letter = upper / lower\n space = \" \"\n dash = \"-\"\n dot = \".\"\n\n series = (\"S\" / \"P\" / \"M\" / \"B\" / \"C\") as type\n number = (1*digit) as number\n # The S-158 series-member designator (issue #774): the colon form\n # \"S-158:102\" binds the member number as its own typed component\n # (the S-100 product number whose checks the member specifies),\n # never a glued number suffix. The builder restricts the designator\n # to the S-158 anchor (S-44:5 rejects).\n checks_for = \":\" (1*digit) as checks_for\n # The compact part face, hyphenated onto the code: S-5-B (lettered),\n # S-100-1 (numbered) and the draft-era S-158-S-102 (series reference,\n # rebound to checks_for by the builder) — the dash replaces the old\n # bare-glued suffix, so a number like S-1001 stays a whole number\n # (the dash is what makes the part unambiguous). The dash is an\n # inlined literal: a named dash ref here collides with the sequence's\n # own dash node in the edition-2 tree.\n compact_part = \"-\" (((\"S\" / \"P\" / \"M\" / \"B\" / \"C\") dash (1*digit)) / (1*digit [*letter]) / upper) as part\n # LEGACY glued lettered bases (S-5A, S-5B, S-8A, S-8B in the corpus):\n # parse-only aliases, never rendered. Kept because the records exist;\n # the owner rules later whether to reject them.\n glued = upper as part\n\n # The official edition is the dotted x.y.z; \"v1\"/\"v5.1\" is the S-100\n # shorthand (parse-only, the builder pads to x.y.0).\n edition = space (1*digit dot 1*digit dot 1*digit) as edition\n v_edition = space \"v\" ((1*digit) [\".\" (1*digit)]) as edition_shorthand\n # The with-year qualifier on standards: a parenthesized year beside an\n # edition. This is the ONLY base-level year capture — periodical\n # years are volumes (the serial-locator unification).\n year_qualifier = space \"(\" ((\"19\" / \"20\") 2*digit) as year \")\"\n\n # The series-reference part value: a check standard applied to\n # another IHO series (S-158 checks S-102). Ordered FIRST so \"Part\n # S-102\" takes the series-reference branch, not the lone letter.\n part_series_ref = ((\"S\" / \"P\" / \"M\" / \"B\" / \"C\") dash (1*digit))\n part_value = (part_series_ref / (1*digit [*letter]) / upper) as part\n\n # Component-edition duality: each independently-publishable component\n # may carry its own edition (+ year qualifier), mutually exclusive\n # with the base edition context. The captures are position-scoped\n # (<kind>_edition / <kind>_year) so the model knows which component\n # the edition belongs to and the URN attaches ed- to the node it\n # follows.\n part = space \"Part\" space part_value [part_dated] [part_section_tail]\n part_dated = {\n part_edition_rule\n [part_year_rule]\n }\n part_edition_rule = space (1*digit dot 1*digit dot 1*digit) as part_edition\n part_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as part_year \")\"\n\n # --- S-4 loose-leaf sections and specifications (see the header) ---\n # The spec number's vocabulary: the S-4 sections run 100-600 (Part C\n # 100-500), so the leaf number is 3 digits with hundreds digit 1-6 —\n # the same shape the bare citation branch leans on to keep the B\n # Bibliographic series (B-1..B-13 style) distinct from B-4xx specs.\n spec_shape = (\"1\" / \"2\" / \"3\" / \"4\" / \"5\" / \"6\") digit digit\n spec_number = spec_shape as spec\n spec_subnumber = dot (1*digit) as spec_sub\n spec_variant = \"(\" (1*upper) as spec_variant \")\"\n # The citation letter is the spec's part (A/B/C); the builder binds it\n # into `part` and rejects a conflicting Part-rule capture.\n spec_citation_body = (\"A\" / \"B\" / \"C\") as spec_part dash spec_number [spec_subnumber] [spec_variant]\n # The compact anchor form: the citation follows the code after one\n # space (\"IHO S-4 B-401\").\n spec_citation = space spec_citation_body\n # The spelled section long form: \"Part B, Section 400\" — the spelled\n # number becomes the spec (the section-level citation), and a trailing\n # citation (\", Section 400, B-401\") makes it a cross-check only. The\n # commas are inlined literals: named comma refs collide as duplicate\n # edition-2 tree nodes under the entry's alternation (the same node\n # collision the compact_part dash-ref comment documents).\n part_section_tail = {\n \",\" space \"Section\" space (spec_shape as spec_section)\n [\",\" space spec_citation_body]\n }\n\n # The bare citation branch (the entry's FIRST alternative): \"B-401\" /\n # \"IHO B-401\" — implicit S-4 anchor (the builder synthesizes series S\n # number 4). B only: bare C-x stays the Circular Letter series, and the\n # 3-digit [1-6]xx shape keeps the B Bibliographic series (B-12) on the\n # main branch.\n bare_spec_citation = [(\"IHO\" space)] (\"B\" as spec_part) dash spec_number [spec_subnumber] [spec_variant]\n\n supplement = space (\"Suppl\" / \"Sup\") space (1*digit) as supplement [supplement_dated]\n supplement_dated = {\n supplement_edition_rule\n [supplement_year_rule]\n }\n supplement_edition_rule = space (1*digit dot 1*digit dot 1*digit) as supplement_edition\n supplement_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as supplement_year \")\"\n\n annex = space \"Annex\" space upper as annex [annex_dated]\n annex_dated = {\n annex_edition_rule\n [annex_year_rule]\n }\n annex_edition_rule = space (1*digit dot 1*digit dot 1*digit) as annex_edition\n annex_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as annex_year \")\"\n\n appendix_value = (upper / (1*digit)) as appendix\n appendix_subnumber = dash (1*digit) as appendix_subnumber\n appendix = space (\"Appendix\" / \"App\" / \"Ap.\") space appendix_value [appendix_subnumber] [appendix_dated]\n appendix_dated = {\n appendix_edition_rule\n [appendix_year_rule]\n }\n appendix_edition_rule = space (1*digit dot 1*digit dot 1*digit) as appendix_edition\n appendix_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as appendix_year \")\"\n\n volume = space \"Vol.\" space (1*digit) as volume [volume_issue]\n volume_issue = (space \"Issue\" space (1*digit) as issue) / (space \"(\" (1*digit) as issue \")\")\n # The volume's short face — the slash chain (\"IHO P-1/21\",\n # \"IHO P-5/2020\"). The slash no longer joins the number.\n volume_short = \"/\" ((1*digit) as volume) [volume_dated]\n # LEGACY bare year (\"IHO P-5 2024\"): the yearbook year IS a volume,\n # so a bare year binds INTO the volume component. Parse-only alias;\n # the canonical print is \"Vol. N\".\n volume_bare_year = space ((\"19\" / \"20\") 2*digit) as volume\n # The volume's own edition (+ year), shared by the Vol. and slash\n # forms.\n volume_dated = {\n volume_edition_rule\n [volume_year_rule]\n }\n volume_edition_rule = space (1*digit dot 1*digit dot 1*digit) as volume_edition\n volume_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as volume_year \")\"\n\n # The edition slot accepts the dotted form or the v-shorthand; the\n # with-year qualifier may sit right after it.\n dated = {\n (edition / v_edition)\n [year_qualifier]\n }\n\n # The serial tail picks exactly one discriminator: the long volume\n # (with its optional issue) or the legacy bare year — both bind the\n # volume component, and both may carry the volume's own edition.\n serial = {\n (volume / volume_bare_year)\n [volume_dated]\n }\n\n identifier = {\n [(\"IHO\" space)]\n series\n dash\n number\n [checks_for]\n [compact_part]\n [glued]\n [volume_short]\n [dated]\n [supplement]\n [part]\n [spec_citation]\n [annex]\n [appendix]\n [serial]\n [year_qualifier]\n }\n\n # The entry dispatches the bare citation branch first (PEG order): a\n # bare \"B-401\"-shaped input takes the S-4 branch, everything else the\n # main identifier.\n identifier_entry = {\n bare_spec_citation / identifier\n }\n\n entry identifier: identifier_entry\n\n test {\n accept \"S-5\"\n accept \"IHO S-5 Appendix 2\"\n accept \"IHO B-12 3.0.0\"\n accept \"IHO P-5 2024\"\n accept \"P-5 2024\"\n accept \"IHO P-5 Vol. 2024\"\n accept \"IHO P-5/2024\"\n accept \"IHO B-7 Vol. 2023\"\n accept \"IHO P-1 Vol. 30\"\n accept \"IHO P-1 Vol. 30 (2)\"\n accept \"IHO P-1 Vol. 30 Issue 2\"\n accept \"IHO P-1/21\"\n accept \"IHO P-1/21 1.0.0\"\n accept \"IHO S-100 5.0.0 Part 2\"\n accept \"IHO S-98 1.0.0 Part A\"\n accept \"IHO S-65 1.1.0 Annex A\"\n accept \"IHO S-122 1.0.0 Appendix D-2\"\n accept \"IHO S-52 4.0.0 Appendix 1\"\n accept \"IHO M-2 Sup 1\"\n accept \"IHO M-2 Suppl 6\"\n accept \"IHO S-66 2.0.0 Sup 4\"\n accept \"IHO S-5-B\"\n accept \"IHO S-100-1\"\n accept \"IHO S-100-1 1.0.0\"\n accept \"IHO P-6-3 1.0.0\"\n accept \"IHO S-5A\"\n accept \"IHO S-5A 1.0.2\"\n accept \"IHO S-5 1.0.2 Part A\"\n accept \"IHO S-100 5.0.0 Part 2 (2024)\"\n accept \"IHO S-100 v5.1\"\n accept \"IHO S-100 v1\"\n accept \"IHO S-100 1.0.0 (2024) Part A\"\n accept \"IHO S-53 Ap. 1 1.0.0\"\n accept \"IHO S-98 Part A 1.0.0\"\n # --- the S-158 series model (issue #774) ---\n accept \"IHO S-158:100 1.0.0\"\n accept \"IHO S-158:100 Part 2 1.0.0\"\n accept \"IHO S-158:102\"\n accept \"IHO S-158:102 1.0.0\"\n accept \"IHO S-158:128\"\n accept \"IHO S-1001\"\n accept \"IHO S-158 Part S-102 0.2.0\"\n accept \"IHO S-158-S-102 0.2.0\"\n accept \"IHO S-158 Part 102\"\n accept \"IHO P-6 1.0.0 Vol. 2\"\n accept \"IHO P-6 Vol. 2 1.0.1\"\n accept \"IHO S-98 1.0.0 Annex A\"\n accept \"IHO S-100 5.0.0 Sup 1 2.0.0\"\n # --- S-4 loose-leaf sections and specifications ---\n accept \"IHO S-4 B-401\"\n accept \"IHO S-4 4.10.0 B-401\"\n accept \"IHO S-4 B-122.1\"\n accept \"IHO S-4 B-521(I)\"\n accept \"IHO S-4 B-351.1(I)\"\n accept \"IHO S-4 B-400\"\n accept \"IHO S-4 B-170\"\n accept \"B-401\"\n accept \"IHO B-401\"\n accept \"B-122.1\"\n accept \"B-521(I)\"\n accept \"IHO S-4 Part B, Section 400\"\n accept \"S-4 Part B, Section 400\"\n accept \"IHO S-4 Part B, Section 400, B-401\"\n accept \"B-12\"\n reject \"IHO S-4 B-4\"\n reject \"IHO S-4 B-40\"\n reject \"IHO S-4 B-800\"\n reject \"nonsense\"\n reject \"IHO B-12 3.0\"\n reject \"IHO P-5 1850\"\n # --- the S-158 series model: malformed colon forms (issue #774) ---\n reject \"IHO S-158:\"\n reject \"IHO S-158:abc\"\n }\n\n bindings identifier_entry {\n type -> type (string)\n number -> number (string)\n checks_for -> checks_for (string)\n part -> part (string)\n part_edition -> part_edition (string)\n part_year -> part_year (string)\n annex -> annex (string)\n annex_edition -> annex_edition (string)\n annex_year -> annex_year (string)\n appendix -> appendix (string)\n appendix_subnumber -> appendix_subnumber (string)\n appendix_edition -> appendix_edition (string)\n appendix_year -> appendix_year (string)\n supplement -> supplement (string)\n supplement_edition -> supplement_edition (string)\n supplement_year -> supplement_year (string)\n edition -> edition (string)\n edition_shorthand -> edition_shorthand (string)\n year -> year (string)\n volume -> volume (string)\n volume_edition -> volume_edition (string)\n volume_year -> volume_year (string)\n issue -> issue (string)\n spec -> spec (string)\n spec_sub -> spec_sub (string)\n spec_variant -> spec_variant (string)\n spec_part -> spec_part (string)\n spec_section -> spec_section (string)\n }\n}\n","source_hash":"ae72a083d5ea5c0f155299c4434c1f5521f512248af933d94c22a40327578d93","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:db48ba21f6f00ce9c461e0adf2db9e66c32c91ac0779c6873ddff4a5dbdaf849","checksum":"sha256:c19bb91a9caaa993ab974a597b7dadf7742fa33ad3f79158edee07bc2c2fd312","validated":{"lint_errors":0,"lint_warnings":2,"tests_total":70,"tests_failures":0,"self_test":true}}
|
|
1
|
+
{"bindings":null,"version":"0.4.0","grammar":"PubidIho","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier_entry","grammar":{"atoms":[{"Entity":{"atom":41}},{"Str":{"pattern":"IHO"}},{"Entity":{"atom":3}},{"Str":{"pattern":" "}},{"Sequence":{"atoms":[1,2]}},{"Repetition":{"atom":4,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"B"}},{"Named":{"name":"spec_part","atom":6}},{"Entity":{"atom":9}},{"Str":{"pattern":"-"}},{"Entity":{"atom":23}},{"Entity":{"atom":22}},{"Str":{"pattern":"1"}},{"Str":{"pattern":"2"}},{"Str":{"pattern":"3"}},{"Str":{"pattern":"4"}},{"Str":{"pattern":"5"}},{"Str":{"pattern":"6"}},{"Alternative":{"atoms":[12,13,14,15,16,17]}},{"Entity":{"atom":20}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Entity":{"atom":20}},{"Sequence":{"atoms":[18,19,21]}},{"Named":{"name":"spec","atom":11}},{"Entity":{"atom":30}},{"Entity":{"atom":26}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Repetition":{"atom":27,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"spec_sub","atom":28}},{"Sequence":{"atoms":[25,29]}},{"Repetition":{"atom":24,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":39}},{"Str":{"pattern":"("}},{"Entity":{"atom":35}},{"Re":{"pattern":"[\\x41-\\x5a]"}},{"Repetition":{"atom":34,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"spec_variant","atom":36}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[33,37,38]}},{"Repetition":{"atom":32,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[5,7,8,10,31,40]}},{"Entity":{"atom":435}},{"Str":{"pattern":"IHO"}},{"Entity":{"atom":3}},{"Sequence":{"atoms":[43,44]}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":54}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"P"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[48,49,50,51,52]}},{"Named":{"name":"type","atom":53}},{"Entity":{"atom":9}},{"Entity":{"atom":59}},{"Entity":{"atom":20}},{"Repetition":{"atom":57,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"number","atom":58}},{"Entity":{"atom":65}},{"Str":{"pattern":":"}},{"Entity":{"atom":20}},{"Repetition":{"atom":62,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"product","atom":63}},{"Sequence":{"atoms":[61,64]}},{"Repetition":{"atom":60,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":92}},{"Str":{"pattern":"-"}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"P"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[69,70,71,72,73]}},{"Entity":{"atom":9}},{"Entity":{"atom":20}},{"Repetition":{"atom":76,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[74,75,77]}},{"Entity":{"atom":20}},{"Repetition":{"atom":79,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":85}},{"Entity":{"atom":35}},{"Entity":{"atom":84}},{"Re":{"pattern":"[\\x61-\\x7a]"}},{"Alternative":{"atoms":[82,83]}},{"Repetition":{"atom":81,"min":0,"max":null,"tag":"Repetition"}},{"Repetition":{"atom":86,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[80,87]}},{"Entity":{"atom":35}},{"Alternative":{"atoms":[78,88,89]}},{"Named":{"name":"part","atom":90}},{"Sequence":{"atoms":[68,91]}},{"Repetition":{"atom":67,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":96}},{"Entity":{"atom":35}},{"Named":{"name":"part","atom":95}},{"Repetition":{"atom":94,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":132}},{"Str":{"pattern":"/"}},{"Entity":{"atom":20}},{"Repetition":{"atom":100,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"volume","atom":101}},{"Entity":{"atom":130}},{"Entity":{"atom":116}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":106,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":109,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":112,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[107,108,110,111,113]}},{"Named":{"name":"volume_edition","atom":114}},{"Sequence":{"atoms":[105,115]}},{"Entity":{"atom":128}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[120,121]}},{"Entity":{"atom":20}},{"Repetition":{"atom":123,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[122,124]}},{"Named":{"name":"volume_year","atom":125}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[118,119,126,127]}},{"Repetition":{"atom":117,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[104,129]}},{"Repetition":{"atom":103,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[99,102,131]}},{"Repetition":{"atom":98,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":175}},{"Entity":{"atom":147}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":137,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":140,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":143,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[138,139,141,142,144]}},{"Named":{"name":"edition","atom":145}},{"Sequence":{"atoms":[136,146]}},{"Entity":{"atom":160}},{"Entity":{"atom":3}},{"Str":{"pattern":"v"}},{"Entity":{"atom":20}},{"Repetition":{"atom":151,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Entity":{"atom":20}},{"Repetition":{"atom":154,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[153,155]}},{"Repetition":{"atom":156,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[152,157]}},{"Named":{"name":"edition_shorthand","atom":158}},{"Sequence":{"atoms":[149,150,159]}},{"Alternative":{"atoms":[135,148]}},{"Entity":{"atom":173}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[165,166]}},{"Entity":{"atom":20}},{"Repetition":{"atom":168,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[167,169]}},{"Named":{"name":"year","atom":170}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[163,164,171,172]}},{"Repetition":{"atom":162,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[161,174]}},{"Repetition":{"atom":134,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":215}},{"Entity":{"atom":3}},{"Str":{"pattern":"Suppl"}},{"Str":{"pattern":"Sup"}},{"Alternative":{"atoms":[179,180]}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":183,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement","atom":184}},{"Entity":{"atom":213}},{"Entity":{"atom":199}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":189,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":192,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":195,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[190,191,193,194,196]}},{"Named":{"name":"supplement_edition","atom":197}},{"Sequence":{"atoms":[188,198]}},{"Entity":{"atom":211}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[203,204]}},{"Entity":{"atom":20}},{"Repetition":{"atom":206,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[205,207]}},{"Named":{"name":"supplement_year","atom":208}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[201,202,209,210]}},{"Repetition":{"atom":200,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[187,212]}},{"Repetition":{"atom":186,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[178,181,182,185,214]}},{"Repetition":{"atom":177,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":297}},{"Entity":{"atom":3}},{"Str":{"pattern":"Part"}},{"Entity":{"atom":3}},{"Entity":{"atom":241}},{"Entity":{"atom":232}},{"Str":{"pattern":"S"}},{"Str":{"pattern":"P"}},{"Str":{"pattern":"M"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[223,224,225,226,227]}},{"Entity":{"atom":9}},{"Entity":{"atom":20}},{"Repetition":{"atom":230,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[228,229,231]}},{"Entity":{"atom":20}},{"Repetition":{"atom":233,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":85}},{"Repetition":{"atom":235,"min":0,"max":null,"tag":"Repetition"}},{"Repetition":{"atom":236,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[234,237]}},{"Entity":{"atom":35}},{"Alternative":{"atoms":[222,238,239]}},{"Named":{"name":"part","atom":240}},{"Entity":{"atom":269}},{"Entity":{"atom":255}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":245,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":248,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":251,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[246,247,249,250,252]}},{"Named":{"name":"part_edition","atom":253}},{"Sequence":{"atoms":[244,254]}},{"Entity":{"atom":267}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[259,260]}},{"Entity":{"atom":20}},{"Repetition":{"atom":262,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[261,263]}},{"Named":{"name":"part_year","atom":264}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[257,258,265,266]}},{"Repetition":{"atom":256,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[243,268]}},{"Repetition":{"atom":242,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":295}},{"Str":{"pattern":","}},{"Entity":{"atom":3}},{"Str":{"pattern":"Section"}},{"Entity":{"atom":3}},{"Entity":{"atom":22}},{"Named":{"name":"spec_section","atom":276}},{"Str":{"pattern":","}},{"Entity":{"atom":3}},{"Entity":{"atom":292}},{"Str":{"pattern":"A"}},{"Str":{"pattern":"B"}},{"Str":{"pattern":"C"}},{"Alternative":{"atoms":[281,282,283]}},{"Named":{"name":"spec_part","atom":284}},{"Entity":{"atom":9}},{"Entity":{"atom":23}},{"Entity":{"atom":30}},{"Repetition":{"atom":288,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":39}},{"Repetition":{"atom":290,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[285,286,287,289,291]}},{"Sequence":{"atoms":[278,279,280]}},{"Repetition":{"atom":293,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[272,273,274,275,277,294]}},{"Repetition":{"atom":271,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[218,219,220,221,270,296]}},{"Repetition":{"atom":217,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":302}},{"Entity":{"atom":3}},{"Entity":{"atom":292}},{"Sequence":{"atoms":[300,301]}},{"Repetition":{"atom":299,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":339}},{"Entity":{"atom":3}},{"Str":{"pattern":"Annex"}},{"Entity":{"atom":3}},{"Entity":{"atom":35}},{"Named":{"name":"annex","atom":308}},{"Entity":{"atom":337}},{"Entity":{"atom":323}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":313,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":316,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":319,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[314,315,317,318,320]}},{"Named":{"name":"annex_edition","atom":321}},{"Sequence":{"atoms":[312,322]}},{"Entity":{"atom":335}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[327,328]}},{"Entity":{"atom":20}},{"Repetition":{"atom":330,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[329,331]}},{"Named":{"name":"annex_year","atom":332}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[325,326,333,334]}},{"Repetition":{"atom":324,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[311,336]}},{"Repetition":{"atom":310,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[305,306,307,309,338]}},{"Repetition":{"atom":304,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":390}},{"Entity":{"atom":3}},{"Str":{"pattern":"Appendix"}},{"Str":{"pattern":"App"}},{"Str":{"pattern":"Ap."}},{"Alternative":{"atoms":[343,344,345]}},{"Entity":{"atom":3}},{"Entity":{"atom":353}},{"Entity":{"atom":35}},{"Entity":{"atom":20}},{"Repetition":{"atom":350,"min":1,"max":null,"tag":"Repetition"}},{"Alternative":{"atoms":[349,351]}},{"Named":{"name":"appendix","atom":352}},{"Entity":{"atom":359}},{"Entity":{"atom":9}},{"Entity":{"atom":20}},{"Repetition":{"atom":356,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"appendix_subnumber","atom":357}},{"Sequence":{"atoms":[355,358]}},{"Repetition":{"atom":354,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":388}},{"Entity":{"atom":374}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":364,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":367,"min":1,"max":null,"tag":"Repetition"}},{"Entity":{"atom":26}},{"Entity":{"atom":20}},{"Repetition":{"atom":370,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[365,366,368,369,371]}},{"Named":{"name":"appendix_edition","atom":372}},{"Sequence":{"atoms":[363,373]}},{"Entity":{"atom":386}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[378,379]}},{"Entity":{"atom":20}},{"Repetition":{"atom":381,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[380,382]}},{"Named":{"name":"appendix_year","atom":383}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[376,377,384,385]}},{"Repetition":{"atom":375,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[362,387]}},{"Repetition":{"atom":361,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[342,346,347,348,360,389]}},{"Repetition":{"atom":341,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":431}},{"Entity":{"atom":417}},{"Entity":{"atom":3}},{"Str":{"pattern":"Vol."}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":397,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"volume","atom":398}},{"Entity":{"atom":415}},{"Entity":{"atom":3}},{"Str":{"pattern":"Issue"}},{"Entity":{"atom":3}},{"Entity":{"atom":20}},{"Repetition":{"atom":404,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"issue","atom":405}},{"Sequence":{"atoms":[401,402,403,406]}},{"Entity":{"atom":3}},{"Str":{"pattern":"("}},{"Entity":{"atom":20}},{"Repetition":{"atom":410,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"issue","atom":411}},{"Str":{"pattern":")"}},{"Sequence":{"atoms":[408,409,412,413]}},{"Alternative":{"atoms":[407,414]}},{"Repetition":{"atom":400,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[394,395,396,399,416]}},{"Entity":{"atom":427}},{"Entity":{"atom":3}},{"Str":{"pattern":"19"}},{"Str":{"pattern":"20"}},{"Alternative":{"atoms":[420,421]}},{"Entity":{"atom":20}},{"Repetition":{"atom":423,"min":2,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[422,424]}},{"Named":{"name":"volume","atom":425}},{"Sequence":{"atoms":[419,426]}},{"Alternative":{"atoms":[393,418]}},{"Entity":{"atom":130}},{"Repetition":{"atom":429,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[428,430]}},{"Repetition":{"atom":392,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":173}},{"Repetition":{"atom":433,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[46,47,55,56,66,93,97,133,176,216,298,303,340,391,432,434]}},{"Alternative":{"atoms":[0,42]}}],"root":436},"bindings":[{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"product","path":"product","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"part_edition","path":"part_edition","type":"string","card":null,"preprocess":null},{"capture":"part_year","path":"part_year","type":"string","card":null,"preprocess":null},{"capture":"annex","path":"annex","type":"string","card":null,"preprocess":null},{"capture":"annex_edition","path":"annex_edition","type":"string","card":null,"preprocess":null},{"capture":"annex_year","path":"annex_year","type":"string","card":null,"preprocess":null},{"capture":"appendix","path":"appendix","type":"string","card":null,"preprocess":null},{"capture":"appendix_subnumber","path":"appendix_subnumber","type":"string","card":null,"preprocess":null},{"capture":"appendix_edition","path":"appendix_edition","type":"string","card":null,"preprocess":null},{"capture":"appendix_year","path":"appendix_year","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplement","type":"string","card":null,"preprocess":null},{"capture":"supplement_edition","path":"supplement_edition","type":"string","card":null,"preprocess":null},{"capture":"supplement_year","path":"supplement_year","type":"string","card":null,"preprocess":null},{"capture":"edition","path":"edition","type":"string","card":null,"preprocess":null},{"capture":"edition_shorthand","path":"edition_shorthand","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"volume","path":"volume","type":"string","card":null,"preprocess":null},{"capture":"volume_edition","path":"volume_edition","type":"string","card":null,"preprocess":null},{"capture":"volume_year","path":"volume_year","type":"string","card":null,"preprocess":null},{"capture":"issue","path":"issue","type":"string","card":null,"preprocess":null},{"capture":"spec","path":"spec","type":"string","card":null,"preprocess":null},{"capture":"spec_sub","path":"spec_sub","type":"string","card":null,"preprocess":null},{"capture":"spec_variant","path":"spec_variant","type":"string","card":null,"preprocess":null},{"capture":"spec_part","path":"spec_part","type":"string","card":null,"preprocess":null},{"capture":"spec_section","path":"spec_section","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":["rule volume_issue: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)","rule identifier_entry: branches 1 and 2 are order-dependent (shared first bytes; ordered choice is decisive)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"S-5","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5 Appendix 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO B-12 3.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-5 2024","expect":{}},{"entry":"identifier","kind":"accept","input":"P-5 2024","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-5 Vol. 2024","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-5/2024","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO B-7 Vol. 2023","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1 Vol. 30","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1 Vol. 30 (2)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1 Vol. 30 Issue 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1/21","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-1/21 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 5.0.0 Part 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-98 1.0.0 Part A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-65 1.1.0 Annex A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-122 1.0.0 Appendix D-2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-52 4.0.0 Appendix 1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO M-2 Sup 1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO M-2 Suppl 6","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-66 2.0.0 Sup 4","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5-B","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100-1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100-1 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-6-3 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5A 1.0.2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-5 1.0.2 Part A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 5.0.0 Part 2 (2024)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 v5.1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 v1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 1.0.0 (2024) Part A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-53 Ap. 1 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-98 Part A 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:100 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:100 Part 2 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:102","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:102 1.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158:128","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-1001","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158 Part S-102 0.2.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158-S-102 0.2.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-158 Part 102","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-6 1.0.0 Vol. 2","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO P-6 Vol. 2 1.0.1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-98 1.0.0 Annex A","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-100 5.0.0 Sup 1 2.0.0","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 4.10.0 B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-122.1","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-521(I)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-351.1(I)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-400","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 B-170","expect":{}},{"entry":"identifier","kind":"accept","input":"B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"B-122.1","expect":{}},{"entry":"identifier","kind":"accept","input":"B-521(I)","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 Part B, Section 400","expect":{}},{"entry":"identifier","kind":"accept","input":"S-4 Part B, Section 400","expect":{}},{"entry":"identifier","kind":"accept","input":"IHO S-4 Part B, Section 400, B-401","expect":{}},{"entry":"identifier","kind":"accept","input":"B-12","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-4 B-4","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-4 B-40","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-4 B-800","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO B-12 3.0","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO P-5 1850","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-158:","expect":{}},{"entry":"identifier","kind":"reject","input":"IHO S-158:abc","expect":{}}],"docs":{},"source":"# Port of lib/pubid/iho/parser.rb — IHO identifiers: letter series\n# (S/P/M/B/C), a number with the optional S-158 series-member designator,\n# and the full component tail (edition, supplement, part, annex, appendix\n# + subnumber, volume, issue, year qualifier).\n#\n# == Component model (owner rulings, 2026-11-03; the S-158 series model,\n# issue #774, 2026-11-25)\n#\n# Every component below is a first-class semantic component: its own\n# named capture, its own typed binding, independently addressable in\n# the model, URN-encodable and matchable — never a regex/string suffix.\n#\n# component face capture binding type\n# edition x.y.z (bare) edition string\n# edition v1 / v5.1 (alias) edition_shorthand string (parse-only;\n# the builder pads to\n# x.y.0 — official IHO\n# edition is dotted\n# x.y.z WITHOUT a year)\n# product S-158:102 product string (the S-158\n# series member: the\n# S-100 product number\n# whose validation\n# checks the member\n# specifies; the colon\n# form is the PRIMARY\n# designator since\n# S-158 Ed 1.0.0)\n# supplement Sup N (Suppl N) supplement string\n# part Part X part string (letter,\n# number, or compound\n# \"4a\"; on the S-158\n# family a digit or\n# SERIES-REFERENCE\n# value is the draft-era\n# checks spelling and\n# REBINDS to product)\n# part -X / -S-102 (short) part string (hyphenated;\n# same S-158 rebind)\n# annex Annex A annex string\n# appendix Appendix B appendix string\n# appendix Appendix D-2 appendix_subnumber string (the -2)\n# volume Vol. N volume string\n# volume /N (short) volume string (the slash\n# chain, P-1/21 or\n# P-5/2020)\n# volume N (bare, legacy) volume string (the yearbook\n# year IS a volume —\n# one serial-locator\n# component)\n# issue (N) / Issue N issue string\n# year (2024) year string (the with-year\n# qualifier on\n# standards; NOT a\n# serial locator)\n#\n# == Component-edition duality (owner ruling: \"this can happen with any\n# independently publishable artifacts\")\n#\n# Supplement, part, annex, appendix and volume can be published on\n# their own publication cycle, so EACH carries an optional\n# `<kind>_edition` (+ `<kind>_year` qualifier) of its own, mutually\n# exclusive with the base edition context:\n#\n# within-edition: IHO P-6 1.0.0 Vol. 2 (the volume rides\n# the base's edition)\n# separately-published: IHO P-6 Vol. 2 1.0.1 (the volume carries\n# IHO S-98 Part A 1.0.0 its own edition;\n# IHO S-158 Part S-102 0.2.0 the base is\n# cited edition-less)\n#\n# In the URN the ed- segment attaches to the node it follows, so the\n# same positional slot records both modes.\n#\n# == The S-158 series model (issue #774; S-158 Ed 1.0.0 clause 2.1)\n#\n# S-158 \"Validation Checks — Introduction and Structure\" is a framework\n# publication defining a SERIES of separate publications, each a\n# publication of its own with its own edition stream: S-158:100 (generic\n# checks), S-158:1xx (one product-specific check specification per S-100\n# product; :101 = S-101 ENC, :102 = S-102 Bathymetric Surface),\n# S-158:98 (interoperability) and S-158:128 (catalogue). `:NNN` is the\n# official IHO product number whose checks the member specifies — NOT a\n# part and NOT a \"profile\".\n#\n# The colon form is the PRIMARY designator since Ed 1.0.0:\n# `S-158:102 [edition]` binds number=158 and product=102 as two\n# typed components. The draft-era spellings are NON-NORMALIZED ALIASES\n# of the same identity (facets-spelling-only: each spelling keeps its\n# render, equality/URN use the canonical shape):\n#\n# S-158 Part S-102 the expanded draft-era part face (the builder\n# rebinds the part value onto product and the\n# edition that follows it onto the BASE edition —\n# the parted- mis-bind of issue #775)\n# S-158-S-102 the compact hyphenated face (same rebind)\n# S-158 Part 102 the bare-number draft-era part face\n#\n# A series-reference-shaped part face rebinds only while product is\n# UNBOUND: `S-158:100 Part 2` keeps a genuine part on the member\n# publication. A lettered part face on S-158 is unattested and stays a\n# plain part. The colon form on any other anchor (S-44:5) is rejected\n# by the builder: the member designator is the S-158 series device.\n#\n# The part has a COMPACT face, hyphenated onto the code — `IHO S-5-B`\n# (lettered part), `IHO S-100-1` (numbered part) — which both parses\n# and renders; the canonical expanded face stays `IHO S-100 x.y.z\n# Part 1`. Gluing a part onto the code without a separator (S-5A) is\n# DISALLOWED as a form: it cannot extend to numbered parts without\n# ambiguity (S-1001 = series 1001 vs series 100 part 1). The four\n# lettered bases the corpus records (S-5A, S-5B, S-8A, S-8B) are LEGACY\n# data spellings: they still parse as aliases (S-5A == S-5 Part A) but\n# are never rendered; the owner rules later whether to reject them\n# outright.\n#\n# Two main syntaxes per the owner ruling: `IHO S-100 1.0.0` (dated =\n# edition-specific) and `IHO S-100` (undated = edition-non-specific).\n# A year beside an edition is the with-year variant qualifier\n# (`IHO S-100 1.0.0 Part X (2024)`), never a year-keyed docidentifier —\n# year-keyed docidentifiers for edition-keyed products are wrong. The\n# continuously-updated series have ONE serial locator, the volume:\n# P-1 and P-6 are volume-keyed (`IHO P-1 Vol. 30 (1)`), and the\n# yearbook year IS a volume (`IHO P-5 Vol. 2020`) — the bare year\n# (`IHO P-5 2020`) and all year-faced forms are parse-only legacy\n# aliases that bind into the volume component, never rendered.\n#\n# Aliases: \"Suppl\" (canonical face Sup, the M-2 spelling — why abbreviate\n# by two letters when Annex and Appendix stay full-length), \"App\"/\"Ap.\"\n# (canonical face Appendix), the hyphenated compact part face (S-5-B ==\n# S-5 Part B, S-100-1 == S-100 Part 1), the legacy glued lettered bases\n# (S-5A, parse-only), \"S-100 v1..v5.1\" (edition shorthand), \"Issue N\"\n# (canonical (N)), the bare year (canonical Vol. N).\n#\n# == URN emission — the IHO MRN guidance (owner adoption, 2026-11-25)\n#\n# The flavor emits the IHO MRN guidance form (S-100WG4, \"MRN Guidelines\n# for IHO\") for the series the guidance gives a publication type:\n#\n# urn:mrn:iho:pub:<type>:<name>[:<edition>][:<trailing atoms>...]\n# <type> spec (S series) | per (P series) | reg (M series)\n# <name> sNNN — the lowercase series letter + number (the guidance's\n# own \"s57\"/\"s98\" name form; the dotted edition is the\n# canonical 4th segment, per IHO's printed S-98 metadata\n# urn:mrn:iho:pub:spec:s98:1.0.0)\n# <edition> the bare dotted x.y.z — NOT ed-prefixed\n#\n# The S-158 member joins the name segment hyphenated — the fleet\n# extension of the guidance for compound publication numbers — so the\n# edition stays in its canonical 4th position:\n#\n# S-158 1.0.0 -> urn:mrn:iho:pub:spec:s158:1.0.0\n# S-158:102 1.0.0 -> urn:mrn:iho:pub:spec:s158-102:1.0.0\n#\n# The trailing atoms carry the components the guidance's tail slots do\n# not model, in the containment order below, lowercase marker tokens,\n# RFC 3986-safe, values case-preserved (identity law: part-A and part-a\n# are distinct documents); a component's own edition rides as ed- right\n# after it (the duality law), the Appendix subnumber hyphen-joins its\n# appendix (appendix-D-2):\n#\n# [:year-<yyyy>][:sup-<n>[:ed-<x.y.z>][:year-<yyyy>]]\n# [:part-<X>[...]][:spec-<n>[:specsub-<n>][:specvar-<X>]]\n# [:annex-<A>[...]][:appendix-<B>[-<sub>][...]]\n# [:vol-<n>[:issue-<n>][...]]\n#\n# The guidance's bare correction/clarification slots (the s57:3:1 form)\n# are not modeled faces and reject. The B (Bibliographic) and C\n# (Circular Letter) series have no guidance publication type code —\n# until IHO assigns one they keep the legacy positional emission below.\n#\n# == Legacy positional segment grammar (decode-only for S/P/M, the\n# emission of the B/C series)\n#\n# The URN mirrors the containment tree, one semantic atom per segment:\n# Part contains Annexes; Annex contains Appendices; a D-2 subnumber is\n# a child atom of Appendix D. No key.value concatenations — every\n# non-number component is a marker-prefixed segment whose marker is the\n# lowercased human-face token (edition follows ISO's ed- precedent).\n# An S-4 specification is a child of its Part (the citation letter rides\n# the part- atom), with the dotted sub and the parenthesized variant as\n# its own children:\n#\n# urn:iho:<type>:<number>[:ed-<x.y.z>][:year-<yyyy>]\n# [:sup-<n>[:ed-<x.y.z>][:year-<yyyy>]]\n# [:part-<X>[:ed-<x.y.z>][:year-<yyyy>]]\n# [:spec-<n>[:specsub-<n>][:specvar-<X>]]\n# [:annex-<A>[...]]\n# [:appendix-<B>[:<sub>][...]]\n# [:vol-<n>[:issue-<n>][...]]\n# [:year-<yyyy>]\n#\n# position segment value vocabulary containment\n# -------- --------------- -------------------------- ------------------\n# 1 <type> s / p / m / b / c namespace root\n# 2 <number> digits + : suffix; may document code\n# span bare segments until\n# the first marker\n# 3 ed-<x.y.z> dotted a.b.c edition qualifier;\n# 4 year-<yyyy> 19xx/20xx ATTACHES TO THE\n# NODE IT FOLLOWS: the\n# base (no component\n# before it) or the\n# component whose\n# segment precedes\n# 5 sup-<n> 1*digit wraps the base\n# 6 part-<X> letter (case kept), contains annexes\n# digits [*letter], or a and S-4 specs\n# series reference\n# [SPMBC]-<digits>\n# 7 spec-<n> [1-6]dd, only under an child of part (the\n# S-4 anchor (s:4) S-4 leaf; the\n# section is the\n# hundreds digit,\n# derivable, never\n# emitted)\n# 8 specsub-<n> 1*digit, only after spec- child of spec\n# 9 specvar-<X> upper letters, after child of spec\n# spec- or specsub-\n# 10 annex-<A> upper letter (case kept) contains appendices\n# 11 appendix-<B> upper letter or digits contains subnumber\n# 12 <sub> 1*digit, BARE, only child of appendix\n# directly after appendix-\n# 13 vol-<n> 1*digit (incl. yearbook contains issue\n# years, Vol. 2020)\n# 14 issue-<n> 1*digit, only after vol- child of volume\n#\n# The number occupies every leading bare segment up to the first\n# marker, so a colon number (S-158:100) round-trips without escaping;\n# after the markers the only bare segment allowed is the appendix\n# subnumber in its own slot. Both the year qualifier and the volume are\n# marker-tagged so neither can collide with a colon-number segment (the\n# #637 hazard, kept under the positional scheme). Letters are\n# case-preserved: part-A and part-a are distinct documents.\n#\n# Legacy 2.0.x spellings remain decodable but are never emitted: the\n# bare a.b.c segment (edition), the dotted keys part./annex./suppl./\n# ap./appendix./vol./issue. and the single-letter y. year tag (whose\n# value decodes into the volume — the serial-locator unification).\n#\n# == S-4 loose-leaf sections and specifications (issue #691; owner\n# rulings of 2026-11-11)\n#\n# The S-4 loose-leaf publication cites its regulations/specifications as\n# <letter>-<hundreds><seq>: B-401 is Part B, Section 400, item 01. ONE\n# component, not two tiers: the spec number IS the leaf; the SECTION is\n# the hundreds digit, DERIVED (never stored, never emitted). The `00`\n# slot (B-400) IS the section-level citation, so \"S-4 Part B, Section\n# 400\" and \"IHO S-4 B-400\" are one identity, two spellings.\n#\n# capture example role\n# spec B-401 -> \"401\" the leaf number (3 digits,\n# hundreds 1-6: sections 100-600)\n# spec_sub B-122.1 -> \"1\" the dotted sub\n# spec_variant B-521(I) -> \"I\" the parenthesized variant\n# spec_part B-401 -> \"B\" the citation letter (the builder\n# binds it into `part`; a Part-rule\n# capture must agree)\n# spec_section \", Section 400\" -> \"400\" the long form's spelled\n# section (becomes `spec` alone;\n# checked against a citation)\n#\n# Faces: canonical compact \"IHO S-4 B-401\" (dated: \"IHO S-4 4.10.0\n# B-401\"); long \"S-4 Part B, Section 400\" (a normalizing parse; also\n# takes a trailing citation: \"S-4 Part B, Section 400, B-401\", where the\n# spelled section only cross-checks the citation's derived section); bare\n# \"B-401\" (implicit S-4 anchor; B only — bare C-x stays the Circular\n# Letter series). The builder binds the anchor: a citation requires the\n# S-4 anchor (or synthesizes it for the bare form).\n#\n# Reserved numbers (\"NOT CURRENTLY USED\" in the S-4 contents — B-170,\n# B-230, B-305, B-323 in Ed 4.9.0 and 4.10.0) parse and resolve AS\n# RESERVED, never invalid; the edition-keyed registry lives in the pubid\n# gem (data/iho/s4-reserved-specs.yaml).\n#\n# URN atoms: part-<letter>:spec-<n>[:specsub-<n>][:specvar-<X>] — the\n# section is NOT emitted (derivable); the citation letter rides the\n# existing part- atom (case preserved: part-B).\n#\n# Edition 2: ruby#400's capture-flatten keeps text captures over\n# reference-built rules as the matched text, so the v2 tree is the v1\n# tree plus named leaves for non-captured structure.\n\ngrammar PubidIho version \"0.4.0\" edition 2 {\n digit = %x30-39\n upper = %x41-5A\n lower = %x61-7A\n letter = upper / lower\n space = \" \"\n dash = \"-\"\n dot = \".\"\n\n series = (\"S\" / \"P\" / \"M\" / \"B\" / \"C\") as type\n number = (1*digit) as number\n # The S-158 series-member designator (issue #774): the colon form\n # \"S-158:102\" binds the member number as its own typed component\n # (the S-100 product number whose checks the member specifies),\n # never a glued number suffix. The builder restricts the designator\n # to the S-158 anchor (S-44:5 rejects).\n product = \":\" (1*digit) as product\n # The compact part face, hyphenated onto the code: S-5-B (lettered),\n # S-100-1 (numbered) and the draft-era S-158-S-102 (series reference,\n # rebound to product by the builder) — the dash replaces the old\n # bare-glued suffix, so a number like S-1001 stays a whole number\n # (the dash is what makes the part unambiguous). The dash is an\n # inlined literal: a named dash ref here collides with the sequence's\n # own dash node in the edition-2 tree.\n compact_part = \"-\" (((\"S\" / \"P\" / \"M\" / \"B\" / \"C\") dash (1*digit)) / (1*digit [*letter]) / upper) as part\n # LEGACY glued lettered bases (S-5A, S-5B, S-8A, S-8B in the corpus):\n # parse-only aliases, never rendered. Kept because the records exist;\n # the owner rules later whether to reject them.\n glued = upper as part\n\n # The official edition is the dotted x.y.z; \"v1\"/\"v5.1\" is the S-100\n # shorthand (parse-only, the builder pads to x.y.0).\n edition = space (1*digit dot 1*digit dot 1*digit) as edition\n v_edition = space \"v\" ((1*digit) [\".\" (1*digit)]) as edition_shorthand\n # The with-year qualifier on standards: a parenthesized year beside an\n # edition. This is the ONLY base-level year capture — periodical\n # years are volumes (the serial-locator unification).\n year_qualifier = space \"(\" ((\"19\" / \"20\") 2*digit) as year \")\"\n\n # The series-reference part value: a check standard applied to\n # another IHO series (S-158 checks S-102). Ordered FIRST so \"Part\n # S-102\" takes the series-reference branch, not the lone letter.\n part_series_ref = ((\"S\" / \"P\" / \"M\" / \"B\" / \"C\") dash (1*digit))\n part_value = (part_series_ref / (1*digit [*letter]) / upper) as part\n\n # Component-edition duality: each independently-publishable component\n # may carry its own edition (+ year qualifier), mutually exclusive\n # with the base edition context. The captures are position-scoped\n # (<kind>_edition / <kind>_year) so the model knows which component\n # the edition belongs to and the URN attaches ed- to the node it\n # follows.\n part = space \"Part\" space part_value [part_dated] [part_section_tail]\n part_dated = {\n part_edition_rule\n [part_year_rule]\n }\n part_edition_rule = space (1*digit dot 1*digit dot 1*digit) as part_edition\n part_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as part_year \")\"\n\n # --- S-4 loose-leaf sections and specifications (see the header) ---\n # The spec number's vocabulary: the S-4 sections run 100-600 (Part C\n # 100-500), so the leaf number is 3 digits with hundreds digit 1-6 —\n # the same shape the bare citation branch leans on to keep the B\n # Bibliographic series (B-1..B-13 style) distinct from B-4xx specs.\n spec_shape = (\"1\" / \"2\" / \"3\" / \"4\" / \"5\" / \"6\") digit digit\n spec_number = spec_shape as spec\n spec_subnumber = dot (1*digit) as spec_sub\n spec_variant = \"(\" (1*upper) as spec_variant \")\"\n # The citation letter is the spec's part (A/B/C); the builder binds it\n # into `part` and rejects a conflicting Part-rule capture.\n spec_citation_body = (\"A\" / \"B\" / \"C\") as spec_part dash spec_number [spec_subnumber] [spec_variant]\n # The compact anchor form: the citation follows the code after one\n # space (\"IHO S-4 B-401\").\n spec_citation = space spec_citation_body\n # The spelled section long form: \"Part B, Section 400\" — the spelled\n # number becomes the spec (the section-level citation), and a trailing\n # citation (\", Section 400, B-401\") makes it a cross-check only. The\n # commas are inlined literals: named comma refs collide as duplicate\n # edition-2 tree nodes under the entry's alternation (the same node\n # collision the compact_part dash-ref comment documents).\n part_section_tail = {\n \",\" space \"Section\" space (spec_shape as spec_section)\n [\",\" space spec_citation_body]\n }\n\n # The bare citation branch (the entry's FIRST alternative): \"B-401\" /\n # \"IHO B-401\" — implicit S-4 anchor (the builder synthesizes series S\n # number 4). B only: bare C-x stays the Circular Letter series, and the\n # 3-digit [1-6]xx shape keeps the B Bibliographic series (B-12) on the\n # main branch.\n bare_spec_citation = [(\"IHO\" space)] (\"B\" as spec_part) dash spec_number [spec_subnumber] [spec_variant]\n\n supplement = space (\"Suppl\" / \"Sup\") space (1*digit) as supplement [supplement_dated]\n supplement_dated = {\n supplement_edition_rule\n [supplement_year_rule]\n }\n supplement_edition_rule = space (1*digit dot 1*digit dot 1*digit) as supplement_edition\n supplement_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as supplement_year \")\"\n\n annex = space \"Annex\" space upper as annex [annex_dated]\n annex_dated = {\n annex_edition_rule\n [annex_year_rule]\n }\n annex_edition_rule = space (1*digit dot 1*digit dot 1*digit) as annex_edition\n annex_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as annex_year \")\"\n\n appendix_value = (upper / (1*digit)) as appendix\n appendix_subnumber = dash (1*digit) as appendix_subnumber\n appendix = space (\"Appendix\" / \"App\" / \"Ap.\") space appendix_value [appendix_subnumber] [appendix_dated]\n appendix_dated = {\n appendix_edition_rule\n [appendix_year_rule]\n }\n appendix_edition_rule = space (1*digit dot 1*digit dot 1*digit) as appendix_edition\n appendix_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as appendix_year \")\"\n\n volume = space \"Vol.\" space (1*digit) as volume [volume_issue]\n volume_issue = (space \"Issue\" space (1*digit) as issue) / (space \"(\" (1*digit) as issue \")\")\n # The volume's short face — the slash chain (\"IHO P-1/21\",\n # \"IHO P-5/2020\"). The slash no longer joins the number.\n volume_short = \"/\" ((1*digit) as volume) [volume_dated]\n # LEGACY bare year (\"IHO P-5 2024\"): the yearbook year IS a volume,\n # so a bare year binds INTO the volume component. Parse-only alias;\n # the canonical print is \"Vol. N\".\n volume_bare_year = space ((\"19\" / \"20\") 2*digit) as volume\n # The volume's own edition (+ year), shared by the Vol. and slash\n # forms.\n volume_dated = {\n volume_edition_rule\n [volume_year_rule]\n }\n volume_edition_rule = space (1*digit dot 1*digit dot 1*digit) as volume_edition\n volume_year_rule = space \"(\" ((\"19\" / \"20\") 2*digit) as volume_year \")\"\n\n # The edition slot accepts the dotted form or the v-shorthand; the\n # with-year qualifier may sit right after it.\n dated = {\n (edition / v_edition)\n [year_qualifier]\n }\n\n # The serial tail picks exactly one discriminator: the long volume\n # (with its optional issue) or the legacy bare year — both bind the\n # volume component, and both may carry the volume's own edition.\n serial = {\n (volume / volume_bare_year)\n [volume_dated]\n }\n\n identifier = {\n [(\"IHO\" space)]\n series\n dash\n number\n [product]\n [compact_part]\n [glued]\n [volume_short]\n [dated]\n [supplement]\n [part]\n [spec_citation]\n [annex]\n [appendix]\n [serial]\n [year_qualifier]\n }\n\n # The entry dispatches the bare citation branch first (PEG order): a\n # bare \"B-401\"-shaped input takes the S-4 branch, everything else the\n # main identifier.\n identifier_entry = {\n bare_spec_citation / identifier\n }\n\n entry identifier: identifier_entry\n\n test {\n accept \"S-5\"\n accept \"IHO S-5 Appendix 2\"\n accept \"IHO B-12 3.0.0\"\n accept \"IHO P-5 2024\"\n accept \"P-5 2024\"\n accept \"IHO P-5 Vol. 2024\"\n accept \"IHO P-5/2024\"\n accept \"IHO B-7 Vol. 2023\"\n accept \"IHO P-1 Vol. 30\"\n accept \"IHO P-1 Vol. 30 (2)\"\n accept \"IHO P-1 Vol. 30 Issue 2\"\n accept \"IHO P-1/21\"\n accept \"IHO P-1/21 1.0.0\"\n accept \"IHO S-100 5.0.0 Part 2\"\n accept \"IHO S-98 1.0.0 Part A\"\n accept \"IHO S-65 1.1.0 Annex A\"\n accept \"IHO S-122 1.0.0 Appendix D-2\"\n accept \"IHO S-52 4.0.0 Appendix 1\"\n accept \"IHO M-2 Sup 1\"\n accept \"IHO M-2 Suppl 6\"\n accept \"IHO S-66 2.0.0 Sup 4\"\n accept \"IHO S-5-B\"\n accept \"IHO S-100-1\"\n accept \"IHO S-100-1 1.0.0\"\n accept \"IHO P-6-3 1.0.0\"\n accept \"IHO S-5A\"\n accept \"IHO S-5A 1.0.2\"\n accept \"IHO S-5 1.0.2 Part A\"\n accept \"IHO S-100 5.0.0 Part 2 (2024)\"\n accept \"IHO S-100 v5.1\"\n accept \"IHO S-100 v1\"\n accept \"IHO S-100 1.0.0 (2024) Part A\"\n accept \"IHO S-53 Ap. 1 1.0.0\"\n accept \"IHO S-98 Part A 1.0.0\"\n # --- the S-158 series model (issue #774) ---\n accept \"IHO S-158:100 1.0.0\"\n accept \"IHO S-158:100 Part 2 1.0.0\"\n accept \"IHO S-158:102\"\n accept \"IHO S-158:102 1.0.0\"\n accept \"IHO S-158:128\"\n accept \"IHO S-1001\"\n accept \"IHO S-158 Part S-102 0.2.0\"\n accept \"IHO S-158-S-102 0.2.0\"\n accept \"IHO S-158 Part 102\"\n accept \"IHO P-6 1.0.0 Vol. 2\"\n accept \"IHO P-6 Vol. 2 1.0.1\"\n accept \"IHO S-98 1.0.0 Annex A\"\n accept \"IHO S-100 5.0.0 Sup 1 2.0.0\"\n # --- S-4 loose-leaf sections and specifications ---\n accept \"IHO S-4 B-401\"\n accept \"IHO S-4 4.10.0 B-401\"\n accept \"IHO S-4 B-122.1\"\n accept \"IHO S-4 B-521(I)\"\n accept \"IHO S-4 B-351.1(I)\"\n accept \"IHO S-4 B-400\"\n accept \"IHO S-4 B-170\"\n accept \"B-401\"\n accept \"IHO B-401\"\n accept \"B-122.1\"\n accept \"B-521(I)\"\n accept \"IHO S-4 Part B, Section 400\"\n accept \"S-4 Part B, Section 400\"\n accept \"IHO S-4 Part B, Section 400, B-401\"\n accept \"B-12\"\n reject \"IHO S-4 B-4\"\n reject \"IHO S-4 B-40\"\n reject \"IHO S-4 B-800\"\n reject \"nonsense\"\n reject \"IHO B-12 3.0\"\n reject \"IHO P-5 1850\"\n # --- the S-158 series model: malformed colon forms (issue #774) ---\n reject \"IHO S-158:\"\n reject \"IHO S-158:abc\"\n }\n\n bindings identifier_entry {\n type -> type (string)\n number -> number (string)\n product -> product (string)\n part -> part (string)\n part_edition -> part_edition (string)\n part_year -> part_year (string)\n annex -> annex (string)\n annex_edition -> annex_edition (string)\n annex_year -> annex_year (string)\n appendix -> appendix (string)\n appendix_subnumber -> appendix_subnumber (string)\n appendix_edition -> appendix_edition (string)\n appendix_year -> appendix_year (string)\n supplement -> supplement (string)\n supplement_edition -> supplement_edition (string)\n supplement_year -> supplement_year (string)\n edition -> edition (string)\n edition_shorthand -> edition_shorthand (string)\n year -> year (string)\n volume -> volume (string)\n volume_edition -> volume_edition (string)\n volume_year -> volume_year (string)\n issue -> issue (string)\n spec -> spec (string)\n spec_sub -> spec_sub (string)\n spec_variant -> spec_variant (string)\n spec_part -> spec_part (string)\n spec_section -> spec_section (string)\n }\n}\n","source_hash":"ff65166e433bd5bdb0202718a53c14147e3e6fff86c21d875d31854a191e72cd","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.5.1.0","edition":2,"semantics_hash":"sha256:76ee4c58c742e031e630bb3f75c71ae2b81f0a350db2447905dc756332b897bc","checksum":"sha256:6402bd28570b3fe24136d0a1eac7eb1635faf4958ee68dd13fa022808f9675a5","validated":{"lint_errors":0,"lint_warnings":2,"tests_total":70,"tests_failures":0,"self_test":true}}
|