@pubid/pubid 0.1.44 → 0.1.46
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/cen_cenelec/model.d.ts +5 -0
- package/dist/flavors/cen_cenelec/model.js +5 -2
- package/dist/flavors/cen_pfs/index.d.ts +151 -0
- package/dist/flavors/cen_pfs/index.js +666 -0
- package/dist/flavors/iec/grammar.js +10 -2
- package/dist/flavors/iec/index.js +33 -3
- package/dist/flavors/iec/model.js +85 -5
- package/dist/flavors/index.js +3 -0
- package/dist/pubid-urn/schemas/cen_pfs.d.ts +8 -0
- package/dist/pubid-urn/schemas/cen_pfs.js +33 -0
- package/dist/pubid-urn/schemas/index.js +2 -0
- package/package.json +1 -1
- package/vendor/parg/cen_pfs.json +1 -1
- package/vendor/parg/iec.json +1 -1
- package/vendor/parg/iso.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParseFailed, parseGrammar } from "../../grammar/engine.js";
|
|
2
2
|
import { TYPED_STAGES } from "./model.js";
|
|
3
|
-
import { Language, PubidDate } from "../../model/component.js";
|
|
3
|
+
import { Language, PubidDate, Iteration } from "../../model/component.js";
|
|
4
4
|
import { iecGrammar, preprocessIec } from "./grammar.js";
|
|
5
5
|
import { locateStage, IEC_CLASSES, } from "./model.js";
|
|
6
6
|
const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -120,6 +120,14 @@ class IecBuilder {
|
|
|
120
120
|
if (date)
|
|
121
121
|
attrs["date"] = date;
|
|
122
122
|
}
|
|
123
|
+
// The designation's dotted sub-number ("60038-2.3", "/DAM 2.3:2022" —
|
|
124
|
+
// pubid#725): the shared second_part token binds it next to the
|
|
125
|
+
// number, and every layer that carries a designation holds it as the
|
|
126
|
+
// Iteration facet — the way the ISO flavor does.
|
|
127
|
+
const stageIteration = s(tree["stage_iteration"]);
|
|
128
|
+
if (stageIteration !== undefined) {
|
|
129
|
+
attrs["stage_iteration"] = new Iteration({ string: stageIteration });
|
|
130
|
+
}
|
|
123
131
|
if (tree["undated_marker"] !== undefined)
|
|
124
132
|
attrs["date"] = new PubidDate({ undated: true });
|
|
125
133
|
const edition = s(tree["edition"]);
|
|
@@ -187,7 +195,13 @@ class IecBuilder {
|
|
|
187
195
|
tree["base"] === undefined &&
|
|
188
196
|
attrs["part"] !== undefined) {
|
|
189
197
|
const baseAttrs = {};
|
|
190
|
-
|
|
198
|
+
// The designation's dotted sub-part moves with it (pubid#725):
|
|
199
|
+
// "IEC/DCOR 60038-2.3" is base 60038-2 with stage iteration 3 —
|
|
200
|
+
// the same identity the plain on-base parse holds — not a facet of
|
|
201
|
+
// the implied supplement. Only the designation-shaped layout (a
|
|
202
|
+
// part present) carries it; a true standalone's own iteration
|
|
203
|
+
// ("IEC/AMD 1.2:2017", no part) stays where it is.
|
|
204
|
+
for (const key of ["publisher", "copublishers", "number", "part", "subpart", "date", "stage_iteration"]) {
|
|
191
205
|
if (attrs[key] !== undefined)
|
|
192
206
|
baseAttrs[key] = attrs[key];
|
|
193
207
|
}
|
|
@@ -316,6 +330,14 @@ class IecBuilder {
|
|
|
316
330
|
baseTree["edition"] = tree["edition"];
|
|
317
331
|
if (tree["languages"] !== undefined)
|
|
318
332
|
baseTree["languages"] = tree["languages"];
|
|
333
|
+
// The designation's dotted sub-number is the BASE's ("IEC/FDAM
|
|
334
|
+
// 60038-2.3" — base 60038-2, stage iteration 3; pubid#725), the same
|
|
335
|
+
// facet the plain on-base parse carries: the base builds through the
|
|
336
|
+
// ordinary single-document path, which binds it like any designation.
|
|
337
|
+
// The supplement layer keeps none — the dot moves with the
|
|
338
|
+
// designation it rode in on.
|
|
339
|
+
if (tree["stage_iteration"] !== undefined)
|
|
340
|
+
baseTree["stage_iteration"] = tree["stage_iteration"];
|
|
319
341
|
// The wrap: one amendment/corrigendum layer over the whole base;
|
|
320
342
|
// third_part's fragment notation rides the outermost layer.
|
|
321
343
|
const suppTree = {
|
|
@@ -506,10 +528,18 @@ function adjunctFields(id, plus) {
|
|
|
506
528
|
if (token === undefined)
|
|
507
529
|
return [];
|
|
508
530
|
const date = maybeOf(id, "date");
|
|
531
|
+
// The supplement's dotted sub-number rides its number slot
|
|
532
|
+
// ("amd:2.3:2022"; pubid#725): ISO's official URN keeps the facet
|
|
533
|
+
// through its version atom, and this scheme has no version slot, so
|
|
534
|
+
// the number slot carries the designation as printed. The parser
|
|
535
|
+
// rebuilds "/AMD2.3:2022" from the slot, which re-parses losslessly.
|
|
536
|
+
const iteration = maybeOf(id, "stage_iteration");
|
|
537
|
+
const number = String(maybeOf(id, "number") ?? "") +
|
|
538
|
+
(iteration !== undefined ? `.${iteration.render()}` : "");
|
|
509
539
|
return [
|
|
510
540
|
plus ? "plus" : "",
|
|
511
541
|
token,
|
|
512
|
-
|
|
542
|
+
number,
|
|
513
543
|
date !== undefined ? (date.render() ?? "") : "",
|
|
514
544
|
];
|
|
515
545
|
}
|
|
@@ -66,6 +66,29 @@ export const TYPED_STAGES = [
|
|
|
66
66
|
export function stageTokens() {
|
|
67
67
|
return TYPED_STAGES.flatMap((t) => t.tokens ?? [t.abbr]);
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* from_hash restores the runtime typed stage from the wire "stage" code
|
|
71
|
+
* (ruby from_hash): the render face rides the typed stage ("/DAM 2.3" vs
|
|
72
|
+
* "/AMD 2.3", "IEC FDIS 60038" vs "IEC 60038"), and the round-trip pins
|
|
73
|
+
* the rebuilt render. The wire carries the stage CODE (construct writes
|
|
74
|
+
* the typed stage's code for non-published stages), so the lookup is by
|
|
75
|
+
* code — the abbreviation does not round-trip it ("damd" vs "DAM").
|
|
76
|
+
* Published stages serialize no stage code; the fallback resolves the
|
|
77
|
+
* type's own published stage (ruby restores Amendment → Amd, TR → TR),
|
|
78
|
+
* so the glued published faces round-trip too.
|
|
79
|
+
*/
|
|
80
|
+
function restoreTypedStage(id, fallback) {
|
|
81
|
+
const stage = id.stage;
|
|
82
|
+
const typedStage = typeof stage === "string" && stage !== ""
|
|
83
|
+
? TYPED_STAGES.find((t) => t.code === stage)
|
|
84
|
+
: fallback?.();
|
|
85
|
+
id.typedStage = typedStage;
|
|
86
|
+
return id;
|
|
87
|
+
}
|
|
88
|
+
/** The published typed stage of a type code ("tr" -> TR, "amd" -> AMD). */
|
|
89
|
+
function publishedStageOfType(typeCode) {
|
|
90
|
+
return TYPED_STAGES.find((t) => t.typeCode === typeCode && t.stageCode === "published");
|
|
91
|
+
}
|
|
69
92
|
export function locateStage(token) {
|
|
70
93
|
const needle = token.trim();
|
|
71
94
|
return (TYPED_STAGES.find((t) => (t.tokens ?? [t.abbr]).includes(needle)) ??
|
|
@@ -106,9 +129,22 @@ const SINGLE_ATTRS = {
|
|
|
106
129
|
all_parts: { type: "boolean", default: false },
|
|
107
130
|
database: { type: "boolean", default: false },
|
|
108
131
|
};
|
|
132
|
+
// The dotted sub-number facet (pubid#725): the wire carries the flat
|
|
133
|
+
// scalar ("stage_iteration: '3'") while the runtime holds the Iteration
|
|
134
|
+
// component — the converter pair the ISO flavor declares for the same
|
|
135
|
+
// facet. Shared by the single-document table and the supplement table
|
|
136
|
+
// (the facet rides whichever layer's designation carries the dot).
|
|
137
|
+
const STAGE_ITERATION_MAPPING = {
|
|
138
|
+
wire: "stage_iteration",
|
|
139
|
+
to: "stage_iteration",
|
|
140
|
+
toWire: (m) => m["stage_iteration"]?.string,
|
|
141
|
+
fromWire: (h) => h["stage_iteration"] === undefined || h["stage_iteration"] === null
|
|
142
|
+
? undefined
|
|
143
|
+
: new Iteration({ string: String(h["stage_iteration"]) }),
|
|
144
|
+
};
|
|
109
145
|
// The Identifier-level whitelist: date flat, publisher only when it is
|
|
110
146
|
// not the IEC default, copublishers as a body list, stage only for drafts.
|
|
111
|
-
const BASE_MAPPINGS = keyValue(
|
|
147
|
+
const BASE_MAPPINGS = keyValue(STAGE_ITERATION_MAPPING, {
|
|
112
148
|
wire: "year",
|
|
113
149
|
to: "date",
|
|
114
150
|
toWire: (m) => m["date"]?.year,
|
|
@@ -198,6 +234,11 @@ function iecSingleClass(kind) {
|
|
|
198
234
|
result += this.languagePortion();
|
|
199
235
|
return result;
|
|
200
236
|
}
|
|
237
|
+
static fromHash(hash) {
|
|
238
|
+
// The single restores its type's published stage when no stage code
|
|
239
|
+
// rode the hash ("IEC TR 61095" stays "IEC TR 61095").
|
|
240
|
+
return restoreTypedStage(super.fromHash(hash), () => publishedStageOfType(kind));
|
|
241
|
+
}
|
|
201
242
|
}
|
|
202
243
|
registerType(IecSingleIdentifier);
|
|
203
244
|
return IecSingleIdentifier;
|
|
@@ -310,6 +351,11 @@ function iecTrfClass() {
|
|
|
310
351
|
result += ` ${this.trf_info}`;
|
|
311
352
|
return result;
|
|
312
353
|
}
|
|
354
|
+
static fromHash(hash) {
|
|
355
|
+
// The form restores its published stage ("IECEE TRF 60950" keeps
|
|
356
|
+
// the TRF abbreviation on the rebuilt render).
|
|
357
|
+
return restoreTypedStage(super.fromHash(hash), () => publishedStageOfType("trf"));
|
|
358
|
+
}
|
|
313
359
|
}
|
|
314
360
|
registerType(IecTestReportForm);
|
|
315
361
|
return IecTestReportForm;
|
|
@@ -329,7 +375,11 @@ function iecSupplementClass(kind) {
|
|
|
329
375
|
stage: { type: "string" },
|
|
330
376
|
synthetic_base: { type: "boolean", default: false },
|
|
331
377
|
});
|
|
332
|
-
static mappings = keyValue({ wire: "number", to: "number" },
|
|
378
|
+
static mappings = keyValue({ wire: "number", to: "number" },
|
|
379
|
+
// The supplement's own dotted sub-number ("/DAM 2.3:2022" — number
|
|
380
|
+
// 2, stage iteration 3; pubid#725): the supplement holds the same
|
|
381
|
+
// facet the ISO supplement does, and the wire carries it flat.
|
|
382
|
+
STAGE_ITERATION_MAPPING, { wire: "year", to: "date", toWire: (m) => m["date"]?.year, fromWire: yearFromWire }, { wire: "month", to: "date", toWire: (m) => m["date"]?.month, fromWire: () => undefined }, { wire: "day", to: "date", toWire: (m) => m["date"]?.day, fromWire: () => undefined }, { wire: "edition", to: "edition" }, {
|
|
333
383
|
wire: "publisher",
|
|
334
384
|
to: "publisher",
|
|
335
385
|
toWire: (m) => (m["publisher"] === "IEC" ? undefined : m["publisher"]),
|
|
@@ -363,15 +413,45 @@ function iecSupplementClass(kind) {
|
|
|
363
413
|
// The attached-supplement renderer prints the typed stage's own
|
|
364
414
|
// abbreviation, upcased (ruby renderer.rb: abbr.first.upcase) —
|
|
365
415
|
// a published Amendment renders "/AMD1", a draft stage its own
|
|
366
|
-
// token
|
|
367
|
-
//
|
|
368
|
-
|
|
416
|
+
// token plus the ballot-number separator. Draft-stage supplements
|
|
417
|
+
// carry the ballot face: stage token, SPACE, number
|
|
418
|
+
// ("60038-1/FDAM 1", "60038-1/DCOR 1.3") — the spaced citation
|
|
419
|
+
// form the stored twins carry (ruby renderer.rb
|
|
420
|
+
// ballot_number_separator, pubid#724: the published stages
|
|
421
|
+
// stage_code "published" — Amd/Cor/ISH — keep the glued
|
|
422
|
+
// corpus-dominant face, "/AMD1:2011"; the separator only rides
|
|
423
|
+
// when there is a number, so a numberless supplement renders the
|
|
424
|
+
// bare stage token on either side).
|
|
425
|
+
result += `/${(this.typedStage?.abbr ?? abbr).toUpperCase()}${this.ballotNumberSeparator()}${this.number ?? ""}`;
|
|
426
|
+
// The dotted sub-number rides the supplement's own designation,
|
|
427
|
+
// before the date ("/DAM 2.3:2022"; pubid#725) — dropping it here
|
|
428
|
+
// would silently renumber the supplement ("/DAM 2.3" printing as
|
|
429
|
+
// "/DAM 2") the way the gem's renderer used to.
|
|
430
|
+
if (this.stageIterationValue() !== undefined)
|
|
431
|
+
result += `.${this.stageIterationValue()}`;
|
|
369
432
|
if (this.date !== undefined)
|
|
370
433
|
result += `:${this.date.render()}`;
|
|
371
434
|
if (this.edition !== undefined)
|
|
372
435
|
result += ` ED${this.edition}`;
|
|
373
436
|
return result;
|
|
374
437
|
}
|
|
438
|
+
/** Ruby Renderer#ballot_number_separator: "" without a number or on
|
|
439
|
+
* a published stage (glued "/AMD1"), " " on a draft stage
|
|
440
|
+
* ("/FDAM 1" — the spaced citation form). */
|
|
441
|
+
ballotNumberSeparator() {
|
|
442
|
+
if (this.number === undefined)
|
|
443
|
+
return "";
|
|
444
|
+
if (this.typedStage?.stageCode === "published")
|
|
445
|
+
return "";
|
|
446
|
+
return " ";
|
|
447
|
+
}
|
|
448
|
+
static fromHash(hash) {
|
|
449
|
+
// The supplement restores its type's published stage when no stage
|
|
450
|
+
// code rode the hash (ruby restores Amendment -> Amd — the glued
|
|
451
|
+
// "/AMD1" face round-trips; the draft codes restore their own
|
|
452
|
+
// stage, "/FDAM 1").
|
|
453
|
+
return restoreTypedStage(super.fromHash(hash), () => locateStage(abbr));
|
|
454
|
+
}
|
|
375
455
|
}
|
|
376
456
|
registerType(IecSupplementIdentifier);
|
|
377
457
|
return IecSupplementIdentifier;
|
package/dist/flavors/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import { nistGrammarImplementation } from "./nist/index.js";
|
|
|
31
31
|
import { ccsdsGrammarImplementation } from "./ccsds/index.js";
|
|
32
32
|
import { ieeeGrammarImplementation } from "./ieee/index.js";
|
|
33
33
|
import { cenCenelecGrammarImplementation } from "./cen_cenelec/index.js";
|
|
34
|
+
import { cenPfsGrammarImplementation } from "./cen_pfs/index.js";
|
|
34
35
|
import { astmGrammarImplementation } from "./astm/index.js";
|
|
35
36
|
import { idfGrammarImplementation } from "./idf/index.js";
|
|
36
37
|
import { gostGrammarImplementation } from "./gost/index.js";
|
|
@@ -143,6 +144,8 @@ function grammarImplementationSwitch(flavor) {
|
|
|
143
144
|
return ieeeGrammarImplementation();
|
|
144
145
|
case "cen_cenelec":
|
|
145
146
|
return cenCenelecGrammarImplementation();
|
|
147
|
+
case "cen_pfs":
|
|
148
|
+
return cenPfsGrammarImplementation();
|
|
146
149
|
case "astm":
|
|
147
150
|
return astmGrammarImplementation();
|
|
148
151
|
case "idf":
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of CEN_PFS — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
export declare const cenPfsSchema: import("../schema.js").FlavorSchema;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pubid-scheme URN schema of CEN_PFS — the transcription
|
|
3
|
+
* of lib/pubid/<flavor>/pubid_urn_schema.rb (pubid#656, completed by
|
|
4
|
+
* #670; design in docs/URN-SCHEMES.adoc). GENERATED by
|
|
5
|
+
* scripts/port-urn-schemas.rb from the ruby declaration: edit the ruby
|
|
6
|
+
* schema and regenerate, never this table by hand.
|
|
7
|
+
*/
|
|
8
|
+
import { define } from "../index.js";
|
|
9
|
+
export const cenPfsSchema = define("cen_pfs", (s) => {
|
|
10
|
+
s.atom("publisher", "pub");
|
|
11
|
+
s.atom("copublishers", "co", "list");
|
|
12
|
+
s.atom("part", "part");
|
|
13
|
+
s.atom("year", "year");
|
|
14
|
+
s.atom("version", "v");
|
|
15
|
+
s.atom("stage", "stage");
|
|
16
|
+
s.atom("adopted", "adopted", "id");
|
|
17
|
+
s.atom("identifiers", "ids", "ids");
|
|
18
|
+
s.type("pubid:cencenelec:adopted-european-norm", "aen", { core: [] });
|
|
19
|
+
s.type("pubid:cencenelec:amendment", "amd", { core: [] });
|
|
20
|
+
s.type("pubid:cencenelec:cen-report", "cr", { core: [] });
|
|
21
|
+
s.type("pubid:cencenelec:cen-workshop-agreement", "cwa", { core: [] });
|
|
22
|
+
s.type("pubid:cencenelec:consolidated-identifier", "consol", { core: [] });
|
|
23
|
+
s.type("pubid:cencenelec:corrigendum", "cor", { core: [] });
|
|
24
|
+
s.type("pubid:cencenelec:european-norm", "en", { core: [] });
|
|
25
|
+
s.type("pubid:cencenelec:european-prestandard", "ep", { core: [] });
|
|
26
|
+
s.type("pubid:cencenelec:european-specification", "es", { core: [] });
|
|
27
|
+
s.type("pubid:cencenelec:fragment", "fragment", { core: [] });
|
|
28
|
+
s.type("pubid:cencenelec:guide", "guide", { core: [] });
|
|
29
|
+
s.type("pubid:cencenelec:harmonization-document", "hd", { core: [] });
|
|
30
|
+
s.type("pubid:cencenelec:identifier", "id", { core: [] });
|
|
31
|
+
s.type("pubid:cencenelec:technical-report", "tr", { core: [] });
|
|
32
|
+
s.type("pubid:cencenelec:technical-specification", "ts", { core: [] });
|
|
33
|
+
});
|
|
@@ -17,6 +17,7 @@ import { calconnectSchema } from "./calconnect.js";
|
|
|
17
17
|
import { calconnectPfsSchema } from "./calconnect_pfs.js";
|
|
18
18
|
import { ccsdsSchema } from "./ccsds.js";
|
|
19
19
|
import { cencenelecSchema } from "./cencenelec.js";
|
|
20
|
+
import { cenPfsSchema } from "./cen_pfs.js";
|
|
20
21
|
import { cieSchema } from "./cie.js";
|
|
21
22
|
import { csaSchema } from "./csa.js";
|
|
22
23
|
import { doiSchema } from "./doi.js";
|
|
@@ -66,6 +67,7 @@ export const PUBID_URN_SCHEMAS = [
|
|
|
66
67
|
calconnectPfsSchema,
|
|
67
68
|
ccsdsSchema,
|
|
68
69
|
cencenelecSchema,
|
|
70
|
+
cenPfsSchema,
|
|
69
71
|
cieSchema,
|
|
70
72
|
csaSchema,
|
|
71
73
|
doiSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubid/pubid",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
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/cen_pfs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"bindings":null,"version":"0.1.0","grammar":"PubidCenPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Str":{"pattern":"EN"}},{"Str":{"pattern":" "}},{"Entity":{"atom":8}},{"Re":{"pattern":"[\\x31-\\x39]"}},{"Entity":{"atom":5}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":4,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[3,6]}},{"Named":{"name":"number","atom":7}},{"Str":{"pattern":"-"}},{"Entity":{"atom":13}},{"Entity":{"atom":5}},{"Repetition":{"atom":11,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"part","atom":12}},{"Sequence":{"atoms":[9,10]}},{"Repetition":{"atom":14,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":20}},{"Entity":{"atom":5}},{"Repetition":{"atom":18,"min":4,"max":null,"tag":"Repetition"}},{"Named":{"name":"year","atom":19}},{"Sequence":{"atoms":[16,17]}},{"Repetition":{"atom":21,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[0,1,2,15,22]}}],"root":23},"bindings":[{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null}]}},"preprocess":{},"tables":{},"lint":{"order_warnings":[]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"EN 1325","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 12464-1:2011","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 1177:2018","expect":{}},{"entry":"identifier","kind":"reject","input":"EN","expect":{}},{"entry":"identifier","kind":"reject","input":"EN ISO 9001:2015","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"CEN/TS 12345","expect":{}},{"entry":"identifier","kind":"example","input":"EN 1325","expect":{"number":"1325"}},{"entry":"identifier","kind":"example","input":"EN 12464-1:2011","expect":{"number":"12464","part":"1","year":"2011"}},{"entry":"identifier","kind":"example","input":"EN 1177:2018","expect":{"number":"1177","year":"2018"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/cen.pfs (pfs:1) sha256:bc1edd5874f8938b5f946416a2b052d9d9b9df3d99f6c20a3d88fcab9ae1d70c\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: cen_pfs (grammar PubidCenPfs)\n# Regenerate: ruby scripts/pfs compile definitions/cen.pfs --as cen_pfs\n# Module: iso.inner v1 (sha256:7a088d2a7814...)\n# Module: en.overlay v1 (sha256:b92ac2b27544...)\n# Module: national.prefix v1 (sha256:c7aa2f2442e8...)\n# Module: supplements.core v1 (sha256:9fa9656375c7...)\n\ngrammar PubidCenPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n iso_space = \" \"\n iso_colon = \":\"\n iso_dash = \"-\"\n iso_year = 4*digit\n iso_part = 1*digit [\"-\" 1*digit]\n iso_number = 1*(\"0\" %x31-39) as iso_zero_lead *digit [iso_dash iso_part]\n iso_document = \"ISO\" iso_space iso_number [iso_colon iso_year]\n en_space = \" \"\n en_draft = (\"pr\" / \"Fpr\") as en_draft_kind\n en_face = [en_draft] \"EN\"\n en_adoption = en_face en_space iso_document\n supplement_number = 1*digit\n supplement_year = 4*digit\n supplement_month = 2*digit\n digit = %x30-39\n space = \" \"\n slash = \"/\"\n colon = \":\"\n dash = \"-\"\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n cen_cenelec_number = ((%x31-39) *digit) as number\n cen_cenelec_part = (1*digit) as part\n cen_cenelec_year = (4*digit) as year\n\n # Identifier rule: the canonical template first, then the\n # declared alternates (parse-in spellings; they normalize to the\n # canonical render face).\n identifier = \"EN\" \" \" cen_cenelec_number [\"-\" cen_cenelec_part] [\":\" cen_cenelec_year]\n entry identifier: identifier\n\n # Typed model bindings: every bound capture lands on the\n # consumer model's field of the same name.\n bindings identifier {\n number -> number (string)\n part -> part (string)\n year -> year (string)\n }\n\n # REQUIRED examples from the definition — accepts, rejects, and\n # the capture expectations the compiler replayed at compile time.\n test {\n accept \"EN 1325\"\n accept \"EN 12464-1:2011\"\n accept \"EN 1177:2018\"\n reject \"EN\"\n reject \"EN ISO 9001:2015\"\n reject \"nonsense\"\n reject \"CEN/TS 12345\"\n example \"EN 1325\" { number: \"1325\" }\n example \"EN 12464-1:2011\" { number: \"12464\" part: \"1\" year: \"2011\" }\n example \"EN 1177:2018\" { number: \"1177\" year: \"2018\" }\n }\n}\n","source_hash":"c3ec2cd6e0f6d3a00433ab59fb2c205dcdf2e1004179c79b1c6484f92d2a17e0","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.3.126","edition":2,"semantics_hash":"sha256:dac473f625b6a8eafd3486ccf837ea983ba33c436209b9e5a5a274629583947e","checksum":"sha256:23319edbdb9441f7dd52782d030efdea7b2e365935e6d92e979900199847ffbd"}
|
|
1
|
+
{"bindings":null,"version":"0.1.0","grammar":"PubidCenPfs","shape":"parsanol-tree/v2","binding_version":1,"entries":{"identifier":{"root":"identifier","grammar":{"atoms":[{"Entity":{"atom":4}},{"Str":{"pattern":"FprEN"}},{"Str":{"pattern":"prEN"}},{"Alternative":{"atoms":[1,2]}},{"Named":{"name":"stage","atom":3}},{"Str":{"pattern":" "}},{"Entity":{"atom":15}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":7,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":" "}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":10,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[9,11]}},{"Repetition":{"atom":12,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[8,13]}},{"Named":{"name":"number","atom":14}},{"Str":{"pattern":"-"}},{"Entity":{"atom":22}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Str":{"pattern":"-"}},{"Alternative":{"atoms":[18,19]}},{"Repetition":{"atom":20,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"part","atom":21}},{"Sequence":{"atoms":[16,17]}},{"Repetition":{"atom":23,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":37}},{"Str":{"pattern":" "}},{"Str":{"pattern":"V"}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":28,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":31,"min":1,"max":null,"tag":"Repetition"}},{"Str":{"pattern":"."}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":34,"min":1,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[26,27,29,30,32,33,35]}},{"Named":{"name":"version","atom":36}},{"Repetition":{"atom":25,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":44}},{"Entity":{"atom":42}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":41,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"year","atom":43}},{"Sequence":{"atoms":[39,40]}},{"Repetition":{"atom":45,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[0,5,6,24,38,46]}},{"Entity":{"atom":58}},{"Str":{"pattern":"CWA"}},{"Str":{"pattern":"HD"}},{"Str":{"pattern":"ES"}},{"Str":{"pattern":"CR"}},{"Str":{"pattern":"ENV"}},{"Str":{"pattern":"EN"}},{"Str":{"pattern":"CEN"}},{"Str":{"pattern":"CLC"}},{"Alternative":{"atoms":[49,50,51,52,53,54,55,56]}},{"Named":{"name":"publisher","atom":57}},{"Entity":{"atom":68}},{"Str":{"pattern":"/"}},{"Entity":{"atom":65}},{"Str":{"pattern":"CLC"}},{"Str":{"pattern":"ETSI"}},{"Alternative":{"atoms":[62,63]}},{"Named":{"name":"copublisher","atom":64}},{"Sequence":{"atoms":[60,61]}},{"Repetition":{"atom":66,"min":0,"max":null,"tag":"Repetition"}},{"Named":{"name":"copublishers","atom":67}},{"Repetition":{"atom":59,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":73}},{"Str":{"pattern":"Guide"}},{"Named":{"name":"guide","atom":72}},{"Str":{"pattern":" "}},{"Entity":{"atom":15}},{"Str":{"pattern":"-"}},{"Entity":{"atom":22}},{"Sequence":{"atoms":[76,77]}},{"Repetition":{"atom":78,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":44}},{"Sequence":{"atoms":[80,81]}},{"Repetition":{"atom":82,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[48,69,70,71,74,75,79,83]}},{"Entity":{"atom":58}},{"Entity":{"atom":68}},{"Repetition":{"atom":86,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":148}},{"Str":{"pattern":"ISO"}},{"Str":{"pattern":"IEC"}},{"Str":{"pattern":"CISPR"}},{"Alternative":{"atoms":[90,91,92]}},{"Entity":{"atom":138}},{"Entity":{"atom":122}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":96}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":98}},{"Alternative":{"atoms":[97,99]}},{"Str":{"pattern":"AC"}},{"Named":{"name":"supplement_kind","atom":101}},{"Entity":{"atom":106}},{"Entity":{"atom":42}},{"Repetition":{"atom":104,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplement_number","atom":105}},{"Repetition":{"atom":103,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":112}},{"Entity":{"atom":42}},{"Repetition":{"atom":110,"min":4,"max":4,"tag":"Repetition"}},{"Named":{"name":"supplements_year","atom":111}},{"Sequence":{"atoms":[108,109]}},{"Repetition":{"atom":113,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"-"}},{"Entity":{"atom":119}},{"Entity":{"atom":42}},{"Repetition":{"atom":117,"min":2,"max":2,"tag":"Repetition"}},{"Named":{"name":"supplements_month","atom":118}},{"Sequence":{"atoms":[115,116]}},{"Repetition":{"atom":120,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[100,102,107,114,121]}},{"Entity":{"atom":136}},{"Str":{"pattern":"/"}},{"Named":{"name":"supplements_slash","atom":124}},{"Str":{"pattern":"+"}},{"Named":{"name":"supplements_plus","atom":126}},{"Alternative":{"atoms":[125,127]}},{"Str":{"pattern":"A"}},{"Named":{"name":"supplement_kind","atom":129}},{"Entity":{"atom":106}},{"Str":{"pattern":":"}},{"Entity":{"atom":112}},{"Sequence":{"atoms":[132,133]}},{"Repetition":{"atom":134,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[128,130,131,135]}},{"Alternative":{"atoms":[95,123]}},{"Named":{"name":"supplement","atom":137}},{"Lookahead":{"atom":94,"positive":false}},{"Str":{"pattern":" FRAG"}},{"Lookahead":{"atom":140,"positive":false}},{"Re":{"pattern":"[\\x01-\\x09]"}},{"Re":{"pattern":"[\\x0b-\\u{10ffff}]"}},{"Alternative":{"atoms":[142,143]}},{"Sequence":{"atoms":[139,141,144]}},{"Repetition":{"atom":145,"min":0,"max":null,"tag":"Repetition"}},{"Sequence":{"atoms":[93,146]}},{"Named":{"name":"adopted","atom":147}},{"Sequence":{"atoms":[85,87,88,89]}},{"Entity":{"atom":58}},{"Entity":{"atom":68}},{"Repetition":{"atom":151,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":"/"}},{"Entity":{"atom":158}},{"Str":{"pattern":"TR"}},{"Str":{"pattern":"TS"}},{"Alternative":{"atoms":[155,156]}},{"Named":{"name":"type","atom":157}},{"Sequence":{"atoms":[153,154]}},{"Repetition":{"atom":159,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":15}},{"Str":{"pattern":"-"}},{"Entity":{"atom":22}},{"Sequence":{"atoms":[163,164]}},{"Repetition":{"atom":165,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":37}},{"Repetition":{"atom":167,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":44}},{"Sequence":{"atoms":[169,170]}},{"Repetition":{"atom":171,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[150,152,160,161,162,166,168,172]}},{"Alternative":{"atoms":[47,84,149,173]}},{"Entity":{"atom":178}},{"Entity":{"atom":138}},{"Repetition":{"atom":176,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"supplements","atom":177}},{"Str":{"pattern":" FRAG"}},{"Entity":{"atom":183}},{"Re":{"pattern":"[\\x30-\\x39]"}},{"Repetition":{"atom":181,"min":1,"max":null,"tag":"Repetition"}},{"Named":{"name":"fragment_number","atom":182}},{"Sequence":{"atoms":[179,180]}},{"Repetition":{"atom":184,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[175,185]}},{"Repetition":{"atom":186,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[174,187]}},{"Entity":{"atom":58}},{"Entity":{"atom":68}},{"Repetition":{"atom":190,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":" "}},{"Entity":{"atom":158}},{"Str":{"pattern":" "}},{"Entity":{"atom":15}},{"Str":{"pattern":"-"}},{"Entity":{"atom":22}},{"Sequence":{"atoms":[196,197]}},{"Repetition":{"atom":198,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":37}},{"Repetition":{"atom":200,"min":0,"max":1,"tag":"Maybe"}},{"Str":{"pattern":":"}},{"Entity":{"atom":44}},{"Sequence":{"atoms":[202,203]}},{"Repetition":{"atom":204,"min":0,"max":1,"tag":"Maybe"}},{"Entity":{"atom":178}},{"Str":{"pattern":" FRAG"}},{"Entity":{"atom":183}},{"Sequence":{"atoms":[207,208]}},{"Repetition":{"atom":209,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[206,210]}},{"Repetition":{"atom":211,"min":0,"max":1,"tag":"Maybe"}},{"Sequence":{"atoms":[189,191,192,193,194,195,199,201,205,212]}},{"Alternative":{"atoms":[188,213]}}],"root":214},"bindings":[{"capture":"publisher","path":"publisher","type":"string","card":null,"preprocess":null},{"capture":"copublisher","path":"copublisher","type":"string","card":null,"preprocess":null},{"capture":"copublisher","path":"copublishers[].copublisher","type":"string","card":null,"preprocess":null},{"capture":"stage","path":"stage","type":"string","card":null,"preprocess":null},{"capture":"type","path":"type","type":"string","card":null,"preprocess":null},{"capture":"guide","path":"guide","type":"string","card":null,"preprocess":null},{"capture":"number","path":"number","type":"string","card":null,"preprocess":null},{"capture":"part","path":"part","type":"string","card":null,"preprocess":null},{"capture":"version","path":"version","type":"string","card":null,"preprocess":null},{"capture":"year","path":"year","type":"string","card":null,"preprocess":null},{"capture":"adopted","path":"adopted","type":"string","card":null,"preprocess":null},{"capture":"fragment_number","path":"fragment_number","type":"string","card":null,"preprocess":null},{"capture":"supplement","path":"supplements[].supplement","type":"raw","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)"]},"default_entry":"identifier","render":{},"derive":{},"tests":[{"entry":"identifier","kind":"accept","input":"EN 1325","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 12464-1:2011","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 302 326-2 V2.2.1:2026","expect":{}},{"entry":"identifier","kind":"accept","input":"prEN 12464-1:2019","expect":{}},{"entry":"identifier","kind":"accept","input":"FprEN 50600-2-4","expect":{}},{"entry":"identifier","kind":"accept","input":"CEN/TR 12101-5:2005","expect":{}},{"entry":"identifier","kind":"accept","input":"CEN/CLC/ETSI/TR 101551:2026","expect":{}},{"entry":"identifier","kind":"accept","input":"CLC/TS 50701:2021","expect":{}},{"entry":"identifier","kind":"accept","input":"CR 10313:2000","expect":{}},{"entry":"identifier","kind":"accept","input":"CWA 14050-21:2000","expect":{}},{"entry":"identifier","kind":"accept","input":"ES 59008-6-1:1999","expect":{}},{"entry":"identifier","kind":"accept","input":"ENV 1613:1995","expect":{}},{"entry":"identifier","kind":"accept","input":"HD 1215-2:1988","expect":{}},{"entry":"identifier","kind":"accept","input":"CEN Guide 414:2017","expect":{}},{"entry":"identifier","kind":"accept","input":"CEN/CLC Guide 25:2023","expect":{}},{"entry":"identifier","kind":"accept","input":"EN ISO 12100:2010","expect":{}},{"entry":"identifier","kind":"accept","input":"HD IEC 60364-8-81","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 13250:2000/A1:2005","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 60335-1:2012/A1","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 13254:2000/AC:2003","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 61375-2-3:2015/AC:2016-11","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 285:2015+A1","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 285:2015+A1:2021","expect":{}},{"entry":"identifier","kind":"accept","input":"EN ISO 10077-1:2006+AC:2009+AC2:2009","expect":{}},{"entry":"identifier","kind":"accept","input":"EN 60038/A1 FRAG2","expect":{}},{"entry":"identifier","kind":"reject","input":"nonsense","expect":{}},{"entry":"identifier","kind":"reject","input":"ETSI EN 300 175","expect":{}},{"entry":"identifier","kind":"reject","input":"CEN/XX 100","expect":{}},{"entry":"identifier","kind":"reject","input":"HD 1215-2:198","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 300 175 V","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 1325 EXTRA","expect":{}},{"entry":"identifier","kind":"reject","input":"EN A1","expect":{}},{"entry":"identifier","kind":"reject","input":"ISO 12100:2010","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 1325:20000","expect":{}},{"entry":"identifier","kind":"reject","input":"EN /TR 100","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 13250:2000/A1:","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 13250:2000/ACX:2003","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 285:2015+A1:","expect":{}},{"entry":"identifier","kind":"reject","input":"FRAG2","expect":{}},{"entry":"identifier","kind":"reject","input":"EN 13250:2000 FRAG2","expect":{}},{"entry":"identifier","kind":"example","input":"EN 1325","expect":{"publisher":"EN","number":"1325"}},{"entry":"identifier","kind":"example","input":"EN 12464-1:2011","expect":{"publisher":"EN","number":"12464","part":"1","year":"2011"}},{"entry":"identifier","kind":"example","input":"EN 302 326-2 V2.2.1:2026","expect":{"publisher":"EN","number":"302 326","part":"2","version":" V2.2.1","year":"2026"}},{"entry":"identifier","kind":"example","input":"prEN 12464-1:2019","expect":{"stage":"prEN","number":"12464","part":"1","year":"2019"}},{"entry":"identifier","kind":"example","input":"FprEN 50600-2-4","expect":{"stage":"FprEN","number":"50600","part":"2-4"}},{"entry":"identifier","kind":"example","input":"CEN/TR 12101-5:2005","expect":{"publisher":"CEN","type":"TR","number":"12101","part":"5","year":"2005"}},{"entry":"identifier","kind":"example","input":"CEN/CLC/ETSI/TR 101551:2026","expect":{"publisher":"CEN","copublisher":"CLC","type":"TR","number":"101551","year":"2026"}},{"entry":"identifier","kind":"example","input":"CLC/TS 50701:2021","expect":{"publisher":"CLC","type":"TS","number":"50701","year":"2021"}},{"entry":"identifier","kind":"example","input":"CR 10313:2000","expect":{"publisher":"CR","number":"10313","year":"2000"}},{"entry":"identifier","kind":"example","input":"CWA 14050-21:2000","expect":{"publisher":"CWA","number":"14050","part":"21","year":"2000"}},{"entry":"identifier","kind":"example","input":"ES 59008-6-1:1999","expect":{"publisher":"ES","number":"59008","part":"6-1","year":"1999"}},{"entry":"identifier","kind":"example","input":"ENV 1613:1995","expect":{"publisher":"ENV","number":"1613","year":"1995"}},{"entry":"identifier","kind":"example","input":"HD 1215-2:1988","expect":{"publisher":"HD","number":"1215","part":"2","year":"1988"}},{"entry":"identifier","kind":"example","input":"CEN Guide 414:2017","expect":{"publisher":"CEN","guide":"Guide","number":"414","year":"2017"}},{"entry":"identifier","kind":"example","input":"CEN/CLC Guide 25:2023","expect":{"publisher":"CEN","copublisher":"CLC","guide":"Guide","number":"25","year":"2023"}},{"entry":"identifier","kind":"example","input":"EN ISO 12100:2010","expect":{"publisher":"EN","adopted":"ISO 12100:2010"}},{"entry":"identifier","kind":"example","input":"HD IEC 60364-8-81","expect":{"publisher":"HD","adopted":"IEC 60364-8-81"}},{"entry":"identifier","kind":"example","input":"EN 13250:2000/A1:2005","expect":{"publisher":"EN","number":"13250","year":"2000"}},{"entry":"identifier","kind":"example","input":"EN 60335-1:2012/A1","expect":{"publisher":"EN","number":"60335","part":"1","year":"2012"}},{"entry":"identifier","kind":"example","input":"EN 13254:2000/AC:2003","expect":{"publisher":"EN","number":"13254","year":"2000"}},{"entry":"identifier","kind":"example","input":"EN 61375-2-3:2015/AC:2016-11","expect":{"publisher":"EN","number":"61375","part":"2-3","year":"2015"}},{"entry":"identifier","kind":"example","input":"EN 285:2015+A1","expect":{"publisher":"EN","number":"285","year":"2015"}},{"entry":"identifier","kind":"example","input":"EN 285:2015+A1:2021","expect":{"publisher":"EN","number":"285","year":"2015"}},{"entry":"identifier","kind":"example","input":"EN ISO 10077-1:2006+AC:2009+AC2:2009","expect":{"publisher":"EN","adopted":"ISO 10077-1:2006"}},{"entry":"identifier","kind":"example","input":"EN 60038/A1 FRAG2","expect":{"publisher":"EN","number":"60038","fragment_number":"2"}}],"docs":{},"source":"# PFS-generated grammar — DO NOT EDIT BY HAND.\n# Source: definitions/cen.pfs (pfs:1) sha256:b8f2c00e392dbc03c1fddedad141afa7c930c5430738721b7df0ac69a371d028\n# Compiler: pubid/grammar/pfs 0.1.0\n# Flavor key: cen_pfs (grammar PubidCenPfs)\n# Regenerate: ruby scripts/pfs compile definitions/cen.pfs --as cen_pfs\n\ngrammar PubidCenPfs version \"0.1.0\" edition 2 {\n\n # Grammar fragments: named lexical terms declared under `grammar:`.\n digit = %x30-39\n\n # Fields: one capture rule per declared field; the whole pattern\n # is the capture.\n cen_cenelec_publisher = ((\"CWA\" / \"HD\" / \"ES\" / \"CR\" / \"ENV\" / \"EN\" / \"CEN\" / \"CLC\")) as publisher\n cen_cenelec_copublisher = ((\"CLC\" / \"ETSI\")) as copublisher\n cen_cenelec_copublishers = (*( \"/\" cen_cenelec_copublisher )) as copublishers\n cen_cenelec_stage = ((\"FprEN\" / \"prEN\")) as stage\n cen_cenelec_type = ((\"TR\" / \"TS\")) as type\n cen_cenelec_guide = (\"Guide\") as guide\n cen_cenelec_number = (((1*%x30-39) (*(\" \" (1*%x30-39))))) as number\n cen_cenelec_part = (1*(%x30-39 / \"-\")) as part\n cen_cenelec_version = (\" \" \"V\" (1*%x30-39) \".\" (1*%x30-39) \".\" (1*%x30-39)) as version\n cen_cenelec_year = (4digit) as year\n cen_cenelec_adopted = ((((\"ISO\" / \"IEC\" / \"CISPR\")) *((!(cen_cenelec_supplement) !(\" FRAG\") (%x01-09 / %x0B-10FFFF))))) as adopted\n cen_cenelec_fragment_number = (1*%x30-39) as fragment_number\n\n # Supplement run (compiled from the supplements declaration):\n # each item binds its separator, kind face, ordinal and date\n # columns; the builder folds the run into the declared wrapper\n # classes (the slash run standalone, the plus run consolidated).\n cen_cenelec_supplement_number = (1*digit) as supplement_number\n cen_cenelec_supplements_year = (4digit) as supplements_year\n cen_cenelec_supplements_month = (2digit) as supplements_month\n cen_cenelec_supplement_corrigendum = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"AC\" as supplement_kind [cen_cenelec_supplement_number] [\":\" cen_cenelec_supplements_year] [\"-\" cen_cenelec_supplements_month]\n }\n cen_cenelec_supplement_amendment = {\n (\"/\" as supplements_slash / \"+\" as supplements_plus)\n \"A\" as supplement_kind cen_cenelec_supplement_number [\":\" cen_cenelec_supplements_year]\n }\n cen_cenelec_supplement = ( cen_cenelec_supplement_corrigendum / cen_cenelec_supplement_amendment ) as supplement\n cen_cenelec_supplements = (1*cen_cenelec_supplement) as supplements\n\n # Identifier rule: the canonical template first, then the\n # declared alternates (parse-in spellings; they normalize to the\n # canonical render face).\n identifier = {\n ( cen_cenelec_stage \" \" cen_cenelec_number [\"-\" cen_cenelec_part] [cen_cenelec_version] [\":\" cen_cenelec_year] / cen_cenelec_publisher [cen_cenelec_copublishers] \" \" cen_cenelec_guide \" \" cen_cenelec_number [\"-\" cen_cenelec_part] [\":\" cen_cenelec_year] / cen_cenelec_publisher [cen_cenelec_copublishers] \" \" cen_cenelec_adopted / cen_cenelec_publisher [cen_cenelec_copublishers] [\"/\" cen_cenelec_type] \" \" cen_cenelec_number [\"-\" cen_cenelec_part] [cen_cenelec_version] [\":\" cen_cenelec_year] ) [cen_cenelec_supplements [\" FRAG\" cen_cenelec_fragment_number]]\n / cen_cenelec_publisher [cen_cenelec_copublishers] \" \" cen_cenelec_type \" \" cen_cenelec_number [\"-\" cen_cenelec_part] [cen_cenelec_version] [\":\" cen_cenelec_year] [cen_cenelec_supplements [\" FRAG\" cen_cenelec_fragment_number]]\n }\n entry identifier: identifier\n\n # Typed model bindings: every bound capture lands on the\n # consumer model's field of the same name.\n bindings identifier {\n publisher -> publisher (string)\n copublisher -> copublisher (string)\n copublisher -> copublishers[].copublisher (string)\n stage -> stage (string)\n type -> type (string)\n guide -> guide (string)\n number -> number (string)\n part -> part (string)\n version -> version (string)\n year -> year (string)\n adopted -> adopted (string)\n fragment_number -> fragment_number (string)\n supplement -> supplements[].supplement (raw)\n }\n\n # REQUIRED examples from the definition — accepts, rejects, and\n # the capture expectations the compiler replayed at compile time.\n test {\n accept \"EN 1325\"\n accept \"EN 12464-1:2011\"\n accept \"EN 302 326-2 V2.2.1:2026\"\n accept \"prEN 12464-1:2019\"\n accept \"FprEN 50600-2-4\"\n accept \"CEN/TR 12101-5:2005\"\n accept \"CEN/CLC/ETSI/TR 101551:2026\"\n accept \"CLC/TS 50701:2021\"\n accept \"CR 10313:2000\"\n accept \"CWA 14050-21:2000\"\n accept \"ES 59008-6-1:1999\"\n accept \"ENV 1613:1995\"\n accept \"HD 1215-2:1988\"\n accept \"CEN Guide 414:2017\"\n accept \"CEN/CLC Guide 25:2023\"\n accept \"EN ISO 12100:2010\"\n accept \"HD IEC 60364-8-81\"\n accept \"EN 13250:2000/A1:2005\"\n accept \"EN 60335-1:2012/A1\"\n accept \"EN 13254:2000/AC:2003\"\n accept \"EN 61375-2-3:2015/AC:2016-11\"\n accept \"EN 285:2015+A1\"\n accept \"EN 285:2015+A1:2021\"\n accept \"EN ISO 10077-1:2006+AC:2009+AC2:2009\"\n accept \"EN 60038/A1 FRAG2\"\n reject \"nonsense\"\n reject \"ETSI EN 300 175\"\n reject \"CEN/XX 100\"\n reject \"HD 1215-2:198\"\n reject \"EN 300 175 V\"\n reject \"EN 1325 EXTRA\"\n reject \"EN A1\"\n reject \"ISO 12100:2010\"\n reject \"EN 1325:20000\"\n reject \"EN /TR 100\"\n reject \"EN 13250:2000/A1:\"\n reject \"EN 13250:2000/ACX:2003\"\n reject \"EN 285:2015+A1:\"\n reject \"FRAG2\"\n reject \"EN 13250:2000 FRAG2\"\n example \"EN 1325\" { publisher: \"EN\" number: \"1325\" }\n example \"EN 12464-1:2011\" { publisher: \"EN\" number: \"12464\" part: \"1\" year: \"2011\" }\n example \"EN 302 326-2 V2.2.1:2026\" { publisher: \"EN\" number: \"302 326\" part: \"2\" version: \" V2.2.1\" year: \"2026\" }\n example \"prEN 12464-1:2019\" { stage: \"prEN\" number: \"12464\" part: \"1\" year: \"2019\" }\n example \"FprEN 50600-2-4\" { stage: \"FprEN\" number: \"50600\" part: \"2-4\" }\n example \"CEN/TR 12101-5:2005\" { publisher: \"CEN\" type: \"TR\" number: \"12101\" part: \"5\" year: \"2005\" }\n example \"CEN/CLC/ETSI/TR 101551:2026\" { publisher: \"CEN\" copublisher: \"CLC\" type: \"TR\" number: \"101551\" year: \"2026\" }\n example \"CLC/TS 50701:2021\" { publisher: \"CLC\" type: \"TS\" number: \"50701\" year: \"2021\" }\n example \"CR 10313:2000\" { publisher: \"CR\" number: \"10313\" year: \"2000\" }\n example \"CWA 14050-21:2000\" { publisher: \"CWA\" number: \"14050\" part: \"21\" year: \"2000\" }\n example \"ES 59008-6-1:1999\" { publisher: \"ES\" number: \"59008\" part: \"6-1\" year: \"1999\" }\n example \"ENV 1613:1995\" { publisher: \"ENV\" number: \"1613\" year: \"1995\" }\n example \"HD 1215-2:1988\" { publisher: \"HD\" number: \"1215\" part: \"2\" year: \"1988\" }\n example \"CEN Guide 414:2017\" { publisher: \"CEN\" guide: \"Guide\" number: \"414\" year: \"2017\" }\n example \"CEN/CLC Guide 25:2023\" { publisher: \"CEN\" copublisher: \"CLC\" guide: \"Guide\" number: \"25\" year: \"2023\" }\n example \"EN ISO 12100:2010\" { publisher: \"EN\" adopted: \"ISO 12100:2010\" }\n example \"HD IEC 60364-8-81\" { publisher: \"HD\" adopted: \"IEC 60364-8-81\" }\n example \"EN 13250:2000/A1:2005\" { publisher: \"EN\" number: \"13250\" year: \"2000\" }\n example \"EN 60335-1:2012/A1\" { publisher: \"EN\" number: \"60335\" part: \"1\" year: \"2012\" }\n example \"EN 13254:2000/AC:2003\" { publisher: \"EN\" number: \"13254\" year: \"2000\" }\n example \"EN 61375-2-3:2015/AC:2016-11\" { publisher: \"EN\" number: \"61375\" part: \"2-3\" year: \"2015\" }\n example \"EN 285:2015+A1\" { publisher: \"EN\" number: \"285\" year: \"2015\" }\n example \"EN 285:2015+A1:2021\" { publisher: \"EN\" number: \"285\" year: \"2015\" }\n example \"EN ISO 10077-1:2006+AC:2009+AC2:2009\" { publisher: \"EN\" adopted: \"ISO 10077-1:2006\" }\n example \"EN 60038/A1 FRAG2\" { publisher: \"EN\" number: \"60038\" fragment_number: \"2\" }\n }\n}\n","source_hash":"af689f6d48bd5f2966cfe4fe6fee924e8af80fe2075cd1b5438b9e8dea1552f5","unicode_tables":"onigmo (Ruby 3.4.8)","compiler_version":"1.3.126","edition":2,"semantics_hash":"sha256:cd693464a12fefe5a83dd7621f635ca4f4432d520ef093fb7cc6f0f4e1d89142","checksum":"sha256:4eaf33574f00f7500da255feec6b63c0deb9705711fe6025f27d625a9026d4fb"}
|