@pubid/pubid 0.1.62 → 0.1.63
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
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";
|
|
@@ -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
|
@@ -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.63",
|
|
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}}
|