@pubid/pubid 0.1.3 → 0.1.5
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/conformance/cli.js +5 -1
- package/dist/flavors/amca/grammar.d.ts +4 -0
- package/dist/flavors/amca/grammar.js +87 -0
- package/dist/flavors/amca/index.d.ts +4 -0
- package/dist/flavors/amca/index.js +76 -0
- package/dist/flavors/amca/model.d.ts +29 -0
- package/dist/flavors/amca/model.js +146 -0
- package/dist/flavors/ansi/index.d.ts +24 -0
- package/dist/flavors/ansi/index.js +147 -0
- package/dist/flavors/api/grammar.d.ts +4 -0
- package/dist/flavors/api/grammar.js +79 -0
- package/dist/flavors/api/index.d.ts +4 -0
- package/dist/flavors/api/index.js +71 -0
- package/dist/flavors/api/model.d.ts +27 -0
- package/dist/flavors/api/model.js +114 -0
- package/dist/flavors/ashrae/grammar.d.ts +2 -0
- package/dist/flavors/ashrae/grammar.js +667 -0
- package/dist/flavors/ashrae/index.d.ts +4 -0
- package/dist/flavors/ashrae/index.js +306 -0
- package/dist/flavors/ashrae/model.d.ts +87 -0
- package/dist/flavors/ashrae/model.js +335 -0
- package/dist/flavors/ashrae/preprocessor.d.ts +7 -0
- package/dist/flavors/ashrae/preprocessor.js +44 -0
- package/dist/flavors/asme/grammar.d.ts +2 -0
- package/dist/flavors/asme/grammar.js +200 -0
- package/dist/flavors/asme/index.d.ts +4 -0
- package/dist/flavors/asme/index.js +138 -0
- package/dist/flavors/asme/model.d.ts +34 -0
- package/dist/flavors/asme/model.js +123 -0
- package/dist/flavors/astm/grammar.d.ts +2 -0
- package/dist/flavors/astm/grammar.js +110 -0
- package/dist/flavors/astm/index.d.ts +2 -0
- package/dist/flavors/astm/index.js +127 -0
- package/dist/flavors/astm/model.d.ts +42 -0
- package/dist/flavors/astm/model.js +263 -0
- package/dist/flavors/bipm/index.d.ts +30 -0
- package/dist/flavors/bipm/index.js +434 -0
- package/dist/flavors/bsi/grammar.d.ts +4 -0
- package/dist/flavors/bsi/grammar.js +535 -0
- package/dist/flavors/bsi/index.d.ts +4 -0
- package/dist/flavors/bsi/index.js +941 -0
- package/dist/flavors/bsi/model.d.ts +127 -0
- package/dist/flavors/bsi/model.js +863 -0
- package/dist/flavors/calconnect/index.d.ts +21 -0
- package/dist/flavors/calconnect/index.js +113 -0
- package/dist/flavors/cen_cenelec/grammar.d.ts +4 -0
- package/dist/flavors/cen_cenelec/grammar.js +107 -0
- package/dist/flavors/cen_cenelec/index.d.ts +5 -0
- package/dist/flavors/cen_cenelec/index.js +263 -0
- package/dist/flavors/cen_cenelec/model.d.ts +45 -0
- package/dist/flavors/cen_cenelec/model.js +490 -0
- package/dist/flavors/cie/grammar.d.ts +5 -0
- package/dist/flavors/cie/grammar.js +127 -0
- package/dist/flavors/cie/index.d.ts +2 -0
- package/dist/flavors/cie/index.js +311 -0
- package/dist/flavors/cie/model.d.ts +122 -0
- package/dist/flavors/cie/model.js +464 -0
- package/dist/flavors/csa/grammar.d.ts +6 -0
- package/dist/flavors/csa/grammar.js +239 -0
- package/dist/flavors/csa/index.d.ts +2 -0
- package/dist/flavors/csa/index.js +634 -0
- package/dist/flavors/csa/model.d.ts +33 -0
- package/dist/flavors/csa/model.js +505 -0
- package/dist/flavors/doi/index.d.ts +13 -0
- package/dist/flavors/doi/index.js +65 -0
- package/dist/flavors/easc/index.d.ts +4 -0
- package/dist/flavors/easc/index.js +107 -0
- package/dist/flavors/ecma/index.d.ts +4 -0
- package/dist/flavors/ecma/index.js +117 -0
- package/dist/flavors/etsi/index.d.ts +14 -0
- package/dist/flavors/etsi/index.js +307 -0
- package/dist/flavors/evs/grammar.d.ts +2 -0
- package/dist/flavors/evs/grammar.js +22 -0
- package/dist/flavors/evs/index.d.ts +2 -0
- package/dist/flavors/evs/index.js +24 -0
- package/dist/flavors/evs/model.d.ts +19 -0
- package/dist/flavors/evs/model.js +36 -0
- package/dist/flavors/gb/index.d.ts +31 -0
- package/dist/flavors/gb/index.js +159 -0
- package/dist/flavors/gost/grammar.d.ts +2 -0
- package/dist/flavors/gost/grammar.js +46 -0
- package/dist/flavors/gost/index.d.ts +2 -0
- package/dist/flavors/gost/index.js +165 -0
- package/dist/flavors/gost/model.d.ts +61 -0
- package/dist/flavors/gost/model.js +147 -0
- package/dist/flavors/gost/prefix_routes.d.ts +15 -0
- package/dist/flavors/gost/prefix_routes.js +192 -0
- package/dist/flavors/iala/index.d.ts +32 -0
- package/dist/flavors/iala/index.js +300 -0
- package/dist/flavors/iana/index.d.ts +19 -0
- package/dist/flavors/iana/index.js +71 -0
- package/dist/flavors/idf/grammar.d.ts +2 -0
- package/dist/flavors/idf/grammar.js +71 -0
- package/dist/flavors/idf/index.d.ts +2 -0
- package/dist/flavors/idf/index.js +100 -0
- package/dist/flavors/idf/model.d.ts +54 -0
- package/dist/flavors/idf/model.js +359 -0
- package/dist/flavors/iec/grammar.d.ts +3 -0
- package/dist/flavors/iec/grammar.js +187 -0
- package/dist/flavors/iec/index.d.ts +4 -0
- package/dist/flavors/iec/index.js +507 -0
- package/dist/flavors/iec/model.d.ts +54 -0
- package/dist/flavors/iec/model.js +437 -0
- package/dist/flavors/ieee/grammar.d.ts +2 -0
- package/dist/flavors/ieee/grammar.js +697 -0
- package/dist/flavors/ieee/index.d.ts +3 -0
- package/dist/flavors/ieee/index.js +1258 -0
- package/dist/flavors/ieee/model.d.ts +144 -0
- package/dist/flavors/ieee/model.js +1237 -0
- package/dist/flavors/ieee/preprocessor.d.ts +8 -0
- package/dist/flavors/ieee/preprocessor.js +410 -0
- package/dist/flavors/ieee/update_codes.d.ts +8 -0
- package/dist/flavors/ieee/update_codes.js +197 -0
- package/dist/flavors/ietf/index.d.ts +30 -0
- package/dist/flavors/ietf/index.js +151 -0
- package/dist/flavors/iho/index.d.ts +4 -0
- package/dist/flavors/iho/index.js +126 -0
- package/dist/flavors/index.d.ts +9 -0
- package/dist/flavors/index.js +136 -0
- package/dist/flavors/isbn/index.d.ts +13 -0
- package/dist/flavors/isbn/index.js +97 -0
- package/dist/flavors/iso/grammar.d.ts +2 -0
- package/dist/flavors/iso/grammar.js +207 -0
- package/dist/flavors/iso/index.d.ts +2 -0
- package/dist/flavors/iso/index.js +343 -0
- package/dist/flavors/iso/model.d.ts +159 -0
- package/dist/flavors/iso/model.js +802 -0
- package/dist/flavors/iso/stages.generated.d.ts +13 -0
- package/dist/flavors/iso/stages.generated.js +391 -0
- package/dist/flavors/itu/grammar.d.ts +4 -0
- package/dist/flavors/itu/grammar.js +205 -0
- package/dist/flavors/itu/index.d.ts +2 -0
- package/dist/flavors/itu/index.js +224 -0
- package/dist/flavors/itu/model.d.ts +184 -0
- package/dist/flavors/itu/model.js +599 -0
- package/dist/flavors/jcgm/index.d.ts +7 -0
- package/dist/flavors/jcgm/index.js +300 -0
- package/dist/flavors/jis/index.d.ts +4 -0
- package/dist/flavors/jis/index.js +267 -0
- package/dist/flavors/nist/grammar.d.ts +2 -0
- package/dist/flavors/nist/grammar.js +287 -0
- package/dist/flavors/nist/index.d.ts +2 -0
- package/dist/flavors/nist/index.js +1244 -0
- package/dist/flavors/nist/model.d.ts +155 -0
- package/dist/flavors/nist/model.js +823 -0
- package/dist/flavors/nist/preprocessor.d.ts +11 -0
- package/dist/flavors/nist/preprocessor.js +281 -0
- package/dist/flavors/oasis/index.d.ts +23 -0
- package/dist/flavors/oasis/index.js +110 -0
- package/dist/flavors/ogc/index.d.ts +20 -0
- package/dist/flavors/ogc/index.js +75 -0
- package/dist/flavors/oiml/grammar.d.ts +2 -0
- package/dist/flavors/oiml/grammar.js +206 -0
- package/dist/flavors/oiml/implementation.d.ts +9 -0
- package/dist/flavors/oiml/implementation.js +45 -0
- package/dist/flavors/oiml/model.d.ts +23 -0
- package/dist/flavors/oiml/model.js +592 -0
- package/dist/flavors/omg/index.d.ts +14 -0
- package/dist/flavors/omg/index.js +73 -0
- package/dist/flavors/plateau/index.d.ts +4 -0
- package/dist/flavors/plateau/index.js +97 -0
- package/dist/flavors/tgpp/index.d.ts +4 -0
- package/dist/flavors/tgpp/index.js +122 -0
- package/dist/flavors/un/index.d.ts +13 -0
- package/dist/flavors/un/index.js +90 -0
- package/dist/flavors/w3c/index.d.ts +14 -0
- package/dist/flavors/w3c/index.js +148 -0
- package/dist/flavors/xsf/index.d.ts +18 -0
- package/dist/flavors/xsf/index.js +65 -0
- package/dist/grammar/engine.d.ts +78 -0
- package/dist/grammar/engine.js +351 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/model/attribute.d.ts +54 -0
- package/dist/model/attribute.js +53 -0
- package/dist/model/builder.d.ts +39 -0
- package/dist/model/builder.js +124 -0
- package/dist/model/component.d.ts +70 -0
- package/dist/model/component.js +170 -0
- package/dist/model/identifier.d.ts +84 -0
- package/dist/model/identifier.js +270 -0
- package/dist/model/urn-generator.d.ts +27 -0
- package/dist/model/urn-generator.js +91 -0
- package/package.json +1 -1
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
import { match, ref, str } from "../../grammar/engine.js";
|
|
2
|
+
/**
|
|
3
|
+
* Port of lib/pubid/ashrae/parser.rb — 1:1. Root: identifier.
|
|
4
|
+
*
|
|
5
|
+
* Branch order matters (alternative retry semantics): errata,
|
|
6
|
+
* interpretation (dead branch — never .as-wrapped, per the gem),
|
|
7
|
+
* combined addenda, year-first addenda package, addenda package,
|
|
8
|
+
* addendum, standalone copublisher, copublished with/without type,
|
|
9
|
+
* plain ASHRAE.
|
|
10
|
+
*/
|
|
11
|
+
function buildRules() {
|
|
12
|
+
const rules = {};
|
|
13
|
+
const rule = (name, build) => {
|
|
14
|
+
rules[name] = build();
|
|
15
|
+
};
|
|
16
|
+
// "ANSI/ASHRAE" + up to 10 extra "/XXX" copublisher segments.
|
|
17
|
+
const copublisherToken = () => str("ANSI")
|
|
18
|
+
.then(ref(rules, "slash"))
|
|
19
|
+
.then(str("ASHRAE"))
|
|
20
|
+
.then(ref(rules, "slash").then(ref(rules, "letter").repeat(3, 10)).repeat(0, 10));
|
|
21
|
+
rule("space", () => str(" "));
|
|
22
|
+
rule("dash", () => str("-"));
|
|
23
|
+
rule("dot", () => str("."));
|
|
24
|
+
rule("slash", () => str("/"));
|
|
25
|
+
rule("lparen", () => str("("));
|
|
26
|
+
rule("rparen", () => str(")"));
|
|
27
|
+
rule("comma", () => str(","));
|
|
28
|
+
rule("colon", () => str(":"));
|
|
29
|
+
rule("digit", () => match("[0-9]"));
|
|
30
|
+
rule("digits", () => ref(rules, "digit").repeat(1, Infinity));
|
|
31
|
+
rule("letter", () => match("[A-Za-z]"));
|
|
32
|
+
rule("year_digits", () => str("19").or(str("20")).then(ref(rules, "digit").repeat(2, 2)));
|
|
33
|
+
rule("reaffirmation_year", () => ref(rules, "year_digits").or(ref(rules, "digit").repeat(2, 2)));
|
|
34
|
+
rule("publisher", () => str("ASHRAE"));
|
|
35
|
+
rule("type", () => str("Guideline").or(str("Standard")));
|
|
36
|
+
rule("code", () => ref(rules, "digits")
|
|
37
|
+
.then(ref(rules, "dot").then(ref(rules, "digits")).repeat(0, 2))
|
|
38
|
+
.then(ref(rules, "letter")
|
|
39
|
+
.then(ref(rules, "comma").then(ref(rules, "letter")).repeat(0, 10))
|
|
40
|
+
.maybe())
|
|
41
|
+
.as("code"));
|
|
42
|
+
rule("code_with_year", () => ref(rules, "digits")
|
|
43
|
+
.then(ref(rules, "dot").then(ref(rules, "digits")).repeat(0, 2))
|
|
44
|
+
.then(ref(rules, "letter")
|
|
45
|
+
.then(ref(rules, "comma").then(ref(rules, "letter")).repeat(0, 10))
|
|
46
|
+
.maybe())
|
|
47
|
+
.as("code")
|
|
48
|
+
.then(ref(rules, "space").maybe().maybe())
|
|
49
|
+
.then(ref(rules, "dash"))
|
|
50
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
51
|
+
.as("code_with_year"));
|
|
52
|
+
rule("suffix", () => str("R").or(str("P")).as("suffix"));
|
|
53
|
+
rule("additional_copublisher", () => ref(rules, "slash")
|
|
54
|
+
.then(ref(rules, "letter").repeat(4, 10)
|
|
55
|
+
.then(ref(rules, "space"))
|
|
56
|
+
.then(ref(rules, "digits")
|
|
57
|
+
.then(ref(rules, "dash").then(ref(rules, "digits")).maybe())
|
|
58
|
+
.maybe())
|
|
59
|
+
.as("additional_copublisher"))
|
|
60
|
+
.or(ref(rules, "lparen")
|
|
61
|
+
.then(str("ANSI")
|
|
62
|
+
.then(ref(rules, "slash"))
|
|
63
|
+
.then(ref(rules, "letter").repeat(2, 10)
|
|
64
|
+
.then(ref(rules, "slash").then(ref(rules, "letter").repeat(2, 10)).repeat(0, 2)))
|
|
65
|
+
.as("additional_copublisher"))
|
|
66
|
+
.then(ref(rules, "space")
|
|
67
|
+
.then(ref(rules, "digits")
|
|
68
|
+
.then(ref(rules, "dash").then(ref(rules, "digits")).maybe())
|
|
69
|
+
.maybe())
|
|
70
|
+
.maybe())
|
|
71
|
+
.then(ref(rules, "rparen"))));
|
|
72
|
+
rule("optional_suffix", () => ref(rules, "space").maybe()
|
|
73
|
+
.then(ref(rules, "lparen"))
|
|
74
|
+
.then(str("PDF").or(ref(rules, "letter").repeat(1, 20).then(ref(rules, "space")
|
|
75
|
+
.or(ref(rules, "digit"))
|
|
76
|
+
.or(ref(rules, "comma"))
|
|
77
|
+
.or(ref(rules, "dash"))
|
|
78
|
+
.or(ref(rules, "dot"))
|
|
79
|
+
.or(ref(rules, "letter"))
|
|
80
|
+
.or(str("–"))
|
|
81
|
+
.repeat(0, 500))))
|
|
82
|
+
.then(ref(rules, "rparen")));
|
|
83
|
+
rule("reaffirmed", () => ref(rules, "space").maybe()
|
|
84
|
+
.then(ref(rules, "lparen"))
|
|
85
|
+
.then(str("RA"))
|
|
86
|
+
.then(ref(rules, "space").maybe())
|
|
87
|
+
.then(ref(rules, "reaffirmation_year").as("reaffirmed"))
|
|
88
|
+
.then(ref(rules, "rparen"))
|
|
89
|
+
.or(ref(rules, "space").maybe()
|
|
90
|
+
.then(ref(rules, "lparen"))
|
|
91
|
+
.then(str("RA"))
|
|
92
|
+
.then(ref(rules, "dash"))
|
|
93
|
+
.then(ref(rules, "reaffirmation_year").as("reaffirmed"))
|
|
94
|
+
.then(ref(rules, "rparen")))
|
|
95
|
+
.or(ref(rules, "space")
|
|
96
|
+
.then(str("RA"))
|
|
97
|
+
.then(ref(rules, "space"))
|
|
98
|
+
.then(ref(rules, "reaffirmation_year").as("reaffirmed")))
|
|
99
|
+
.or(ref(rules, "space")
|
|
100
|
+
.then(str("RA"))
|
|
101
|
+
.then(ref(rules, "dash"))
|
|
102
|
+
.then(ref(rules, "reaffirmation_year").as("reaffirmed"))));
|
|
103
|
+
rule("addendum_code", () => ref(rules, "digits").maybe()
|
|
104
|
+
.then(ref(rules, "letter").repeat(1, 3))
|
|
105
|
+
.as("addendum_code"));
|
|
106
|
+
rule("month_name", () => str("January").or(str("February")).or(str("March")).or(str("April"))
|
|
107
|
+
.or(str("May")).or(str("June")).or(str("July")).or(str("August"))
|
|
108
|
+
.or(str("September")).or(str("October")).or(str("November"))
|
|
109
|
+
.or(str("December")));
|
|
110
|
+
rule("errata_date", () => ref(rules, "space").maybe()
|
|
111
|
+
.then(ref(rules, "lparen"))
|
|
112
|
+
.then(ref(rules, "month_name").as("month"))
|
|
113
|
+
.then(ref(rules, "space"))
|
|
114
|
+
.then(ref(rules, "digit").repeat(1, 2).as("day"))
|
|
115
|
+
.then(ref(rules, "comma").maybe())
|
|
116
|
+
.then(ref(rules, "space").or(ref(rules, "comma").maybe()))
|
|
117
|
+
.then(ref(rules, "year_digits").as("errata_year"))
|
|
118
|
+
.then(ref(rules, "rparen"))
|
|
119
|
+
.as("errata_date")
|
|
120
|
+
.or(ref(rules, "space").maybe()
|
|
121
|
+
.then(ref(rules, "lparen"))
|
|
122
|
+
.then(ref(rules, "month_name").as("month"))
|
|
123
|
+
.then(ref(rules, "space"))
|
|
124
|
+
.then(ref(rules, "digit").repeat(1, 2).as("day"))
|
|
125
|
+
.then(ref(rules, "rparen"))
|
|
126
|
+
.as("errata_date"))
|
|
127
|
+
.or(ref(rules, "space").maybe()
|
|
128
|
+
.then(ref(rules, "lparen"))
|
|
129
|
+
.then(ref(rules, "digit").repeat(1, 2)
|
|
130
|
+
.then(ref(rules, "dash"))
|
|
131
|
+
.then(ref(rules, "digit").repeat(1, 2))
|
|
132
|
+
.then(ref(rules, "dash"))
|
|
133
|
+
.then(ref(rules, "space").maybe())
|
|
134
|
+
.then(ref(rules, "year_digits"))
|
|
135
|
+
.as("numeric_date"))
|
|
136
|
+
.then(ref(rules, "rparen"))
|
|
137
|
+
.as("errata_date")));
|
|
138
|
+
rule("errata_suffix", () => ref(rules, "space")
|
|
139
|
+
.then(ref(rules, "dash").or(str("–")))
|
|
140
|
+
.then(ref(rules, "space"))
|
|
141
|
+
.then(ref(rules, "letter").then(ref(rules, "space")
|
|
142
|
+
.or(ref(rules, "letter"))
|
|
143
|
+
.or(ref(rules, "digit"))
|
|
144
|
+
.or(ref(rules, "comma"))
|
|
145
|
+
.repeat(0, 50)))
|
|
146
|
+
.repeat(0, 3));
|
|
147
|
+
rule("errata_date_and_suffix", () => ref(rules, "errata_suffix").then(ref(rules, "errata_date"))
|
|
148
|
+
.or(ref(rules, "errata_date").then(ref(rules, "errata_suffix")))
|
|
149
|
+
.or(ref(rules, "errata_date"))
|
|
150
|
+
.or(ref(rules, "errata_suffix")));
|
|
151
|
+
rule("errata_suffix_on_addendum", () => ref(rules, "space")
|
|
152
|
+
.then(str("Errata").as("errata_keyword"))
|
|
153
|
+
.then(ref(rules, "space")
|
|
154
|
+
.then(ref(rules, "lparen"))
|
|
155
|
+
.then(ref(rules, "month_name"))
|
|
156
|
+
.then(ref(rules, "space"))
|
|
157
|
+
.then(ref(rules, "digit").repeat(1, 2))
|
|
158
|
+
.then(ref(rules, "comma").maybe())
|
|
159
|
+
.then(ref(rules, "space").or(ref(rules, "comma").maybe()))
|
|
160
|
+
.then(ref(rules, "year_digits"))
|
|
161
|
+
.then(ref(rules, "rparen"))
|
|
162
|
+
.or(ref(rules, "space")
|
|
163
|
+
.then(ref(rules, "lparen"))
|
|
164
|
+
.then(ref(rules, "month_name"))
|
|
165
|
+
.then(ref(rules, "space"))
|
|
166
|
+
.then(ref(rules, "digit").repeat(1, 2))
|
|
167
|
+
.then(ref(rules, "rparen")))
|
|
168
|
+
.or(ref(rules, "space")
|
|
169
|
+
.then(ref(rules, "lparen"))
|
|
170
|
+
.then(ref(rules, "digit").repeat(1, 2))
|
|
171
|
+
.then(ref(rules, "dash"))
|
|
172
|
+
.then(ref(rules, "digit").repeat(1, 2))
|
|
173
|
+
.then(ref(rules, "dash"))
|
|
174
|
+
.then(ref(rules, "space").maybe())
|
|
175
|
+
.then(ref(rules, "year_digits"))
|
|
176
|
+
.then(ref(rules, "rparen")))
|
|
177
|
+
.or(str(""))));
|
|
178
|
+
// The errata rule allows "ANSI-ASHRAE" (dash) as well as the slash
|
|
179
|
+
// forms.
|
|
180
|
+
const errataCopublisher = () => str("ANSI").then(ref(rules, "dash")).then(str("ASHRAE"))
|
|
181
|
+
.or(copublisherToken());
|
|
182
|
+
const errataBaseWithType = () => errataCopublisher().as("copublisher")
|
|
183
|
+
.then(ref(rules, "space"))
|
|
184
|
+
.then(ref(rules, "type").as("type"))
|
|
185
|
+
.then(ref(rules, "space"))
|
|
186
|
+
.then(ref(rules, "code"))
|
|
187
|
+
.then(ref(rules, "space").maybe().maybe()
|
|
188
|
+
.then(ref(rules, "dash"))
|
|
189
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
190
|
+
.maybe())
|
|
191
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
192
|
+
.then(ref(rules, "suffix").maybe())
|
|
193
|
+
.then(ref(rules, "reaffirmed").maybe());
|
|
194
|
+
const errataTail = () => ref(rules, "space")
|
|
195
|
+
.then(str("Errata").as("errata_keyword"))
|
|
196
|
+
.then(ref(rules, "errata_date_and_suffix").maybe())
|
|
197
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2).as("optional_suffixes"));
|
|
198
|
+
rule("errata_identifier", () => errataBaseWithType().as("base")
|
|
199
|
+
.then(errataTail())
|
|
200
|
+
.or(errataCopublisher().as("copublisher")
|
|
201
|
+
.then(ref(rules, "space"))
|
|
202
|
+
.then(ref(rules, "code_with_year"))
|
|
203
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
204
|
+
.then(ref(rules, "suffix").maybe())
|
|
205
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
206
|
+
.as("base")
|
|
207
|
+
.then(errataTail()))
|
|
208
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
209
|
+
.then(ref(rules, "space"))
|
|
210
|
+
.then(ref(rules, "type").as("type"))
|
|
211
|
+
.then(ref(rules, "space"))
|
|
212
|
+
.then(ref(rules, "code"))
|
|
213
|
+
.then(ref(rules, "space").maybe().maybe()
|
|
214
|
+
.then(ref(rules, "dash"))
|
|
215
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
216
|
+
.maybe())
|
|
217
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
218
|
+
.then(ref(rules, "suffix").maybe())
|
|
219
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
220
|
+
.as("base")
|
|
221
|
+
.then(errataTail())));
|
|
222
|
+
rule("interpretation_identifier", () => str("Interpretations")
|
|
223
|
+
.then(ref(rules, "space"))
|
|
224
|
+
.then(str("for"))
|
|
225
|
+
.then(ref(rules, "space"))
|
|
226
|
+
.then(ref(rules, "type").as("type")
|
|
227
|
+
.then(ref(rules, "space"))
|
|
228
|
+
.then(ref(rules, "code"))
|
|
229
|
+
.then(ref(rules, "dash").then(ref(rules, "year_digits").as("year")).maybe())
|
|
230
|
+
.as("base")));
|
|
231
|
+
const addendaCodeList = (maxExtra, maxRepeat) => ref(rules, "comma").then(ref(rules, "space")).then(str("and")).then(ref(rules, "space"))
|
|
232
|
+
.then(ref(rules, "addendum_code"))
|
|
233
|
+
.or(ref(rules, "space").then(str("and")).then(ref(rules, "space"))
|
|
234
|
+
.then(ref(rules, "addendum_code")))
|
|
235
|
+
.or(ref(rules, "comma").then(ref(rules, "space"))
|
|
236
|
+
.then(ref(rules, "addendum_code")).repeat(1, maxExtra))
|
|
237
|
+
.or(ref(rules, "comma").then(ref(rules, "addendum_code")).repeat(1, maxExtra))
|
|
238
|
+
.repeat(0, maxRepeat);
|
|
239
|
+
const toFor = () => str("to").or(str("for")).then(ref(rules, "space"));
|
|
240
|
+
const optionalCopublisherSpace = () => copublisherToken().as("copublisher")
|
|
241
|
+
.then(ref(rules, "space"))
|
|
242
|
+
.maybe();
|
|
243
|
+
const codeYearMaybe = () => ref(rules, "dash").then(ref(rules, "year_digits").as("year")).maybe();
|
|
244
|
+
rule("combined_addenda_identifier", () => ref(rules, "publisher").as("publisher")
|
|
245
|
+
.then(ref(rules, "space"))
|
|
246
|
+
.then(str("Addenda"))
|
|
247
|
+
.then(ref(rules, "space"))
|
|
248
|
+
.then(ref(rules, "addendum_code"))
|
|
249
|
+
.then(addendaCodeList(20, 50).as("additional_codes"))
|
|
250
|
+
.then(ref(rules, "space"))
|
|
251
|
+
.then(toFor())
|
|
252
|
+
.then(optionalCopublisherSpace())
|
|
253
|
+
.then(ref(rules, "type").as("type"))
|
|
254
|
+
.then(ref(rules, "space"))
|
|
255
|
+
.then(ref(rules, "code"))
|
|
256
|
+
.then(codeYearMaybe())
|
|
257
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
258
|
+
.then(ref(rules, "addendum_date_suffix").maybe())
|
|
259
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
260
|
+
.as("combined_addenda")
|
|
261
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
262
|
+
.then(ref(rules, "space"))
|
|
263
|
+
.then(ref(rules, "type").as("type"))
|
|
264
|
+
.then(ref(rules, "space"))
|
|
265
|
+
.then(ref(rules, "code"))
|
|
266
|
+
.then(ref(rules, "dash")
|
|
267
|
+
.then(ref(rules, "year_digits").as("year")))
|
|
268
|
+
.then(ref(rules, "colon").then(ref(rules, "space")).or(ref(rules, "space")))
|
|
269
|
+
.then(str("Addenda"))
|
|
270
|
+
.then(ref(rules, "space"))
|
|
271
|
+
.then(ref(rules, "addendum_code"))
|
|
272
|
+
.then(ref(rules, "comma").then(ref(rules, "space"))
|
|
273
|
+
.then(ref(rules, "addendum_code")).repeat(1, 50)
|
|
274
|
+
.or(ref(rules, "comma").then(ref(rules, "addendum_code")).repeat(1, 50))
|
|
275
|
+
.as("additional_codes")
|
|
276
|
+
.maybe())
|
|
277
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
278
|
+
.as("combined_addenda"))
|
|
279
|
+
.or(str("Addenda")
|
|
280
|
+
.then(ref(rules, "space"))
|
|
281
|
+
.then(ref(rules, "addendum_code"))
|
|
282
|
+
.then(addendaCodeList(20, 50).as("additional_codes"))
|
|
283
|
+
.then(ref(rules, "space"))
|
|
284
|
+
.then(toFor())
|
|
285
|
+
.then(optionalCopublisherSpace())
|
|
286
|
+
.then(ref(rules, "type").as("type"))
|
|
287
|
+
.then(ref(rules, "space"))
|
|
288
|
+
.then(ref(rules, "code"))
|
|
289
|
+
.then(codeYearMaybe())
|
|
290
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
291
|
+
.as("combined_addenda"))
|
|
292
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
293
|
+
.then(ref(rules, "space"))
|
|
294
|
+
.then(str("Addenda"))
|
|
295
|
+
.then(ref(rules, "space"))
|
|
296
|
+
.then(toFor())
|
|
297
|
+
.then(ref(rules, "type").as("type"))
|
|
298
|
+
.then(ref(rules, "space"))
|
|
299
|
+
.then(ref(rules, "code"))
|
|
300
|
+
.then(codeYearMaybe())
|
|
301
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
302
|
+
.as("combined_addenda"))
|
|
303
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
304
|
+
.then(ref(rules, "space"))
|
|
305
|
+
.then(str("Addenda"))
|
|
306
|
+
.then(ref(rules, "space"))
|
|
307
|
+
.then(ref(rules, "addendum_code"))
|
|
308
|
+
.then(addendaCodeList(20, 50).as("additional_codes"))
|
|
309
|
+
.then(ref(rules, "space"))
|
|
310
|
+
.then(toFor())
|
|
311
|
+
.then(ref(rules, "code_with_year"))
|
|
312
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
313
|
+
.as("combined_addenda"))
|
|
314
|
+
.or(str("Addenda")
|
|
315
|
+
.then(ref(rules, "space"))
|
|
316
|
+
.then(ref(rules, "addendum_code"))
|
|
317
|
+
.then(addendaCodeList(20, 50).as("additional_codes"))
|
|
318
|
+
.then(ref(rules, "space"))
|
|
319
|
+
.then(toFor())
|
|
320
|
+
.then(ref(rules, "code_with_year"))
|
|
321
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
322
|
+
.as("combined_addenda"))
|
|
323
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
324
|
+
.then(ref(rules, "space"))
|
|
325
|
+
.then(ref(rules, "type").as("type"))
|
|
326
|
+
.then(ref(rules, "space"))
|
|
327
|
+
.then(ref(rules, "code"))
|
|
328
|
+
.then(codeYearMaybe())
|
|
329
|
+
.then(ref(rules, "colon").then(ref(rules, "space")).or(ref(rules, "space")))
|
|
330
|
+
.then(str("Addenda"))
|
|
331
|
+
.then(ref(rules, "space"))
|
|
332
|
+
.then(ref(rules, "addendum_code"))
|
|
333
|
+
.then(ref(rules, "space").then(str("through")).then(ref(rules, "space"))
|
|
334
|
+
.then(ref(rules, "addendum_code"))
|
|
335
|
+
.or(ref(rules, "space")
|
|
336
|
+
.or(ref(rules, "comma").then(ref(rules, "space")))
|
|
337
|
+
.then(ref(rules, "addendum_code")).repeat(1, 50))
|
|
338
|
+
.or(ref(rules, "comma").then(ref(rules, "space"))
|
|
339
|
+
.then(ref(rules, "addendum_code")).repeat(1, 50))
|
|
340
|
+
.or(ref(rules, "comma").then(ref(rules, "addendum_code")).repeat(1, 50))
|
|
341
|
+
.as("additional_codes")
|
|
342
|
+
.maybe())
|
|
343
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
344
|
+
.then(ref(rules, "addendum_date_suffix").maybe())
|
|
345
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
346
|
+
.as("combined_addenda")));
|
|
347
|
+
rule("year_first_addenda_package_identifier", () => ref(rules, "year_digits").as("package_year")
|
|
348
|
+
.then(ref(rules, "space"))
|
|
349
|
+
.then(str("Addenda")
|
|
350
|
+
.then(ref(rules, "space"))
|
|
351
|
+
.then(str("Supplement"))
|
|
352
|
+
.then(ref(rules, "space").then(str("Package")).maybe())
|
|
353
|
+
.then(ref(rules, "space"))
|
|
354
|
+
.then(str("to"))
|
|
355
|
+
.then(ref(rules, "space"))
|
|
356
|
+
.then(optionalCopublisherSpace())
|
|
357
|
+
.then(ref(rules, "type").as("type"))
|
|
358
|
+
.then(ref(rules, "space"))
|
|
359
|
+
.then(ref(rules, "code"))
|
|
360
|
+
.then(codeYearMaybe())
|
|
361
|
+
.or(str("Supplement")
|
|
362
|
+
.then(ref(rules, "space"))
|
|
363
|
+
.then(str("Addenda"))
|
|
364
|
+
.then(ref(rules, "space"))
|
|
365
|
+
.then(ref(rules, "addendum_code"))
|
|
366
|
+
.then(ref(rules, "comma").then(ref(rules, "space"))
|
|
367
|
+
.then(ref(rules, "addendum_code")).repeat(1, 50)
|
|
368
|
+
.or(ref(rules, "comma").then(ref(rules, "addendum_code")).repeat(1, 50))
|
|
369
|
+
.as("additional_codes")
|
|
370
|
+
.maybe())
|
|
371
|
+
.then(ref(rules, "space"))
|
|
372
|
+
.then(str("to"))
|
|
373
|
+
.then(ref(rules, "space"))
|
|
374
|
+
.then(optionalCopublisherSpace())
|
|
375
|
+
.then(ref(rules, "type").as("type"))
|
|
376
|
+
.then(ref(rules, "space"))
|
|
377
|
+
.then(ref(rules, "code"))
|
|
378
|
+
.then(codeYearMaybe()))
|
|
379
|
+
.or(str("Addenda")
|
|
380
|
+
.then(ref(rules, "space"))
|
|
381
|
+
.then(str("Supplement"))
|
|
382
|
+
.then(ref(rules, "space"))
|
|
383
|
+
.then(str("to"))
|
|
384
|
+
.then(ref(rules, "space"))
|
|
385
|
+
.then(optionalCopublisherSpace())
|
|
386
|
+
.then(ref(rules, "type").as("type"))
|
|
387
|
+
.then(ref(rules, "space"))
|
|
388
|
+
.then(ref(rules, "code"))
|
|
389
|
+
.then(codeYearMaybe()))
|
|
390
|
+
.or(str("Supplement")
|
|
391
|
+
.then(ref(rules, "space"))
|
|
392
|
+
.then(str("to"))
|
|
393
|
+
.then(ref(rules, "space"))
|
|
394
|
+
.then(optionalCopublisherSpace())
|
|
395
|
+
.then(ref(rules, "type").as("type"))
|
|
396
|
+
.then(ref(rules, "space"))
|
|
397
|
+
.then(ref(rules, "code"))
|
|
398
|
+
.then(codeYearMaybe())
|
|
399
|
+
.then(ref(rules, "errata_suffix_on_addendum").maybe())))
|
|
400
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
401
|
+
.as("addenda_package"));
|
|
402
|
+
const packageDescription = () => str("Supplement")
|
|
403
|
+
.then(ref(rules, "space").then(str("Package")).maybe())
|
|
404
|
+
.or(str("Package"))
|
|
405
|
+
.as("package_description");
|
|
406
|
+
const colonOrSpace = () => ref(rules, "colon").then(ref(rules, "space")).or(ref(rules, "space"));
|
|
407
|
+
rule("addenda_package_identifier", () => copublisherToken().as("copublisher")
|
|
408
|
+
.then(ref(rules, "space"))
|
|
409
|
+
.then(ref(rules, "type").as("type"))
|
|
410
|
+
.then(ref(rules, "space"))
|
|
411
|
+
.then(ref(rules, "code"))
|
|
412
|
+
.then(codeYearMaybe())
|
|
413
|
+
.then(colonOrSpace())
|
|
414
|
+
.then(str("Addenda"))
|
|
415
|
+
.then(ref(rules, "space"))
|
|
416
|
+
.then(packageDescription())
|
|
417
|
+
.then(ref(rules, "space").then(str("for")).then(ref(rules, "space"))
|
|
418
|
+
.then(ref(rules, "year_digits").as("target_year"))
|
|
419
|
+
.maybe())
|
|
420
|
+
.then(ref(rules, "optional_suffix").repeat(0, 3))
|
|
421
|
+
.as("addenda_package")
|
|
422
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
423
|
+
.then(ref(rules, "space"))
|
|
424
|
+
.then(ref(rules, "type").as("type"))
|
|
425
|
+
.then(ref(rules, "space"))
|
|
426
|
+
.then(ref(rules, "code"))
|
|
427
|
+
.then(codeYearMaybe())
|
|
428
|
+
.then(ref(rules, "comma"))
|
|
429
|
+
.then(ref(rules, "space"))
|
|
430
|
+
.then(str("Addenda"))
|
|
431
|
+
.then(ref(rules, "space"))
|
|
432
|
+
.then(ref(rules, "year_digits").as("package_year"))
|
|
433
|
+
.then(ref(rules, "space"))
|
|
434
|
+
.then(str("Supplement"))
|
|
435
|
+
.then(ref(rules, "colon"))
|
|
436
|
+
.then(ref(rules, "space"))
|
|
437
|
+
.then(str("Addenda"))
|
|
438
|
+
.then(ref(rules, "space"))
|
|
439
|
+
.then(packageDescription())
|
|
440
|
+
.then(ref(rules, "optional_suffix").repeat(0, 3))
|
|
441
|
+
.as("addenda_package"))
|
|
442
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
443
|
+
.then(ref(rules, "space"))
|
|
444
|
+
.then(ref(rules, "type").as("type"))
|
|
445
|
+
.then(ref(rules, "space"))
|
|
446
|
+
.then(ref(rules, "code"))
|
|
447
|
+
.then(codeYearMaybe())
|
|
448
|
+
.then(ref(rules, "space").then(ref(rules, "year_digits").as("package_year")).maybe())
|
|
449
|
+
.then(ref(rules, "additional_copublisher").maybe())
|
|
450
|
+
.then(ref(rules, "suffix").maybe())
|
|
451
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
452
|
+
.then(colonOrSpace())
|
|
453
|
+
.then(str("Addenda"))
|
|
454
|
+
.then(ref(rules, "space"))
|
|
455
|
+
.then(packageDescription())
|
|
456
|
+
.then(ref(rules, "space").then(str("for")).then(ref(rules, "space"))
|
|
457
|
+
.then(ref(rules, "year_digits").as("target_year"))
|
|
458
|
+
.maybe())
|
|
459
|
+
.then(ref(rules, "optional_suffix").repeat(0, 3))
|
|
460
|
+
.as("addenda_package")));
|
|
461
|
+
rule("addendum_date_suffix", () => ref(rules, "space")
|
|
462
|
+
.then(ref(rules, "lparen"))
|
|
463
|
+
.then(ref(rules, "month_name"))
|
|
464
|
+
.then(ref(rules, "space"))
|
|
465
|
+
.then(ref(rules, "digit").repeat(1, 2))
|
|
466
|
+
.then(ref(rules, "comma").maybe())
|
|
467
|
+
.then(ref(rules, "space").or(ref(rules, "comma").maybe()))
|
|
468
|
+
.then(ref(rules, "year_digits"))
|
|
469
|
+
.then(ref(rules, "rparen")));
|
|
470
|
+
const addendumTail = () => ref(rules, "additional_copublisher").maybe()
|
|
471
|
+
.then(ref(rules, "addendum_date_suffix").maybe())
|
|
472
|
+
.then(ref(rules, "errata_suffix_on_addendum").maybe())
|
|
473
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2));
|
|
474
|
+
rule("addendum_identifier", () => ref(rules, "publisher").as("publisher")
|
|
475
|
+
.then(ref(rules, "space"))
|
|
476
|
+
.then(str("Addendum"))
|
|
477
|
+
.then(ref(rules, "space"))
|
|
478
|
+
.then(ref(rules, "addendum_code"))
|
|
479
|
+
.then(ref(rules, "space"))
|
|
480
|
+
.then(toFor())
|
|
481
|
+
.then(ref(rules, "type").as("type"))
|
|
482
|
+
.then(ref(rules, "space"))
|
|
483
|
+
.then(ref(rules, "code"))
|
|
484
|
+
.then(codeYearMaybe())
|
|
485
|
+
.then(addendumTail())
|
|
486
|
+
.as("publisher_addendum")
|
|
487
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
488
|
+
.then(ref(rules, "space"))
|
|
489
|
+
.then(str("Addendum"))
|
|
490
|
+
.then(ref(rules, "space"))
|
|
491
|
+
.then(ref(rules, "addendum_code"))
|
|
492
|
+
.then(ref(rules, "space"))
|
|
493
|
+
.then(toFor())
|
|
494
|
+
.then(ref(rules, "publisher").as("base_publisher"))
|
|
495
|
+
.then(ref(rules, "space"))
|
|
496
|
+
.then(ref(rules, "type").as("type"))
|
|
497
|
+
.then(ref(rules, "space"))
|
|
498
|
+
.then(ref(rules, "code"))
|
|
499
|
+
.then(codeYearMaybe())
|
|
500
|
+
.then(addendumTail())
|
|
501
|
+
.as("publisher_base_addendum"))
|
|
502
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
503
|
+
.then(ref(rules, "space"))
|
|
504
|
+
.then(str("Addendum"))
|
|
505
|
+
.then(ref(rules, "space"))
|
|
506
|
+
.then(ref(rules, "addendum_code"))
|
|
507
|
+
.then(ref(rules, "space"))
|
|
508
|
+
.then(toFor())
|
|
509
|
+
.then(copublisherToken().as("copublisher"))
|
|
510
|
+
.then(ref(rules, "space"))
|
|
511
|
+
.then(ref(rules, "type").as("type"))
|
|
512
|
+
.then(ref(rules, "space"))
|
|
513
|
+
.then(ref(rules, "code"))
|
|
514
|
+
.then(codeYearMaybe())
|
|
515
|
+
.then(ref(rules, "addendum_date_suffix").maybe()
|
|
516
|
+
.then(ref(rules, "errata_suffix_on_addendum").maybe())
|
|
517
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2)))
|
|
518
|
+
.as("publisher_addendum_copublisher"))
|
|
519
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
520
|
+
.then(ref(rules, "space"))
|
|
521
|
+
.then(str("Addendum"))
|
|
522
|
+
.then(ref(rules, "space"))
|
|
523
|
+
.then(ref(rules, "addendum_code"))
|
|
524
|
+
.then(ref(rules, "space"))
|
|
525
|
+
.then(toFor())
|
|
526
|
+
.then(copublisherToken().as("copublisher"))
|
|
527
|
+
.then(ref(rules, "space"))
|
|
528
|
+
.then(ref(rules, "code_with_year"))
|
|
529
|
+
.then(addendumTail())
|
|
530
|
+
.as("publisher_addendum_copublisher_no_type"))
|
|
531
|
+
.or(copublisherToken().as("copublisher")
|
|
532
|
+
.then(ref(rules, "space"))
|
|
533
|
+
.maybe()
|
|
534
|
+
.then(str("Addendum"))
|
|
535
|
+
.then(ref(rules, "space"))
|
|
536
|
+
.then(ref(rules, "addendum_code"))
|
|
537
|
+
.then(ref(rules, "space"))
|
|
538
|
+
.then(toFor())
|
|
539
|
+
.then(copublisherToken().as("copublisher").then(ref(rules, "space")).maybe())
|
|
540
|
+
.then(ref(rules, "code_with_year"))
|
|
541
|
+
.then(addendumTail())
|
|
542
|
+
.as("addendum_no_type"))
|
|
543
|
+
.or(
|
|
544
|
+
// [ANSI/ASHRAE[/ASHE|/IES]] Addendum X to ASHRAE Standard/Guideline
|
|
545
|
+
// N-YYYY: leading copublisher + publisher-led base.
|
|
546
|
+
copublisherToken().as("copublisher")
|
|
547
|
+
.then(ref(rules, "space"))
|
|
548
|
+
.maybe()
|
|
549
|
+
.then(str("Addendum"))
|
|
550
|
+
.then(ref(rules, "space"))
|
|
551
|
+
.then(ref(rules, "addendum_code"))
|
|
552
|
+
.then(ref(rules, "space"))
|
|
553
|
+
.then(toFor())
|
|
554
|
+
.then(ref(rules, "publisher").as("base_publisher"))
|
|
555
|
+
.then(ref(rules, "space"))
|
|
556
|
+
.then(ref(rules, "type").as("type"))
|
|
557
|
+
.then(ref(rules, "space"))
|
|
558
|
+
.then(ref(rules, "code"))
|
|
559
|
+
.then(codeYearMaybe())
|
|
560
|
+
.then(addendumTail())
|
|
561
|
+
.as("publisher_base_addendum"))
|
|
562
|
+
.or(copublisherToken().as("copublisher")
|
|
563
|
+
.then(ref(rules, "space"))
|
|
564
|
+
.maybe()
|
|
565
|
+
.then(str("Addendum"))
|
|
566
|
+
.then(ref(rules, "space"))
|
|
567
|
+
.then(ref(rules, "addendum_code"))
|
|
568
|
+
.then(ref(rules, "space"))
|
|
569
|
+
.then(toFor())
|
|
570
|
+
.then(copublisherToken().as("copublisher").then(ref(rules, "space")).maybe())
|
|
571
|
+
.then(ref(rules, "type").as("type"))
|
|
572
|
+
.then(ref(rules, "space"))
|
|
573
|
+
.then(ref(rules, "code"))
|
|
574
|
+
.then(codeYearMaybe())
|
|
575
|
+
.then(addendumTail())
|
|
576
|
+
.as("addendum"))
|
|
577
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
578
|
+
.then(ref(rules, "space"))
|
|
579
|
+
.then(ref(rules, "type").as("type"))
|
|
580
|
+
.then(ref(rules, "space"))
|
|
581
|
+
.then(ref(rules, "code"))
|
|
582
|
+
.then(ref(rules, "space").maybe().maybe()
|
|
583
|
+
.then(ref(rules, "dash"))
|
|
584
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
585
|
+
.maybe())
|
|
586
|
+
.then(ref(rules, "additional_copublisher").maybe())
|
|
587
|
+
.then(ref(rules, "suffix").maybe())
|
|
588
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
589
|
+
.then(colonOrSpace())
|
|
590
|
+
.then(str("Addendum").or(str("addendum")))
|
|
591
|
+
.then(ref(rules, "space"))
|
|
592
|
+
.then(ref(rules, "addendum_code"))
|
|
593
|
+
.then(ref(rules, "addendum_date_suffix").maybe()
|
|
594
|
+
.then(ref(rules, "errata_suffix_on_addendum").maybe())
|
|
595
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2)))
|
|
596
|
+
.as("standard_addendum"))
|
|
597
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
598
|
+
.then(ref(rules, "space"))
|
|
599
|
+
.then(ref(rules, "type").as("type"))
|
|
600
|
+
.then(ref(rules, "space"))
|
|
601
|
+
.then(ref(rules, "code"))
|
|
602
|
+
.then(ref(rules, "space").maybe().maybe()
|
|
603
|
+
.then(ref(rules, "dash"))
|
|
604
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
605
|
+
.maybe())
|
|
606
|
+
.then(ref(rules, "additional_copublisher").maybe())
|
|
607
|
+
.then(ref(rules, "suffix").maybe())
|
|
608
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
609
|
+
.then(ref(rules, "space"))
|
|
610
|
+
.then(str("Addendum").or(str("addendum")))
|
|
611
|
+
.then(ref(rules, "space"))
|
|
612
|
+
.then(ref(rules, "addendum_code"))
|
|
613
|
+
.then(ref(rules, "addendum_date_suffix").maybe()
|
|
614
|
+
.then(ref(rules, "errata_suffix_on_addendum").maybe())
|
|
615
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2)))
|
|
616
|
+
.as("standard_addendum")));
|
|
617
|
+
rule("identifier", () => ref(rules, "errata_identifier")
|
|
618
|
+
.or(ref(rules, "interpretation_identifier").as("interpretation_identifier"))
|
|
619
|
+
.or(ref(rules, "combined_addenda_identifier"))
|
|
620
|
+
.or(ref(rules, "year_first_addenda_package_identifier"))
|
|
621
|
+
.or(ref(rules, "addenda_package_identifier"))
|
|
622
|
+
.or(ref(rules, "addendum_identifier"))
|
|
623
|
+
.or(str("ANSI").then(ref(rules, "slash")).maybe()
|
|
624
|
+
.then(str("ASHRAE").absent().then(ref(rules, "letter")).repeat(2, 10))
|
|
625
|
+
.as("copublisher")
|
|
626
|
+
.then(ref(rules, "space"))
|
|
627
|
+
.then(ref(rules, "code_with_year"))
|
|
628
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2)))
|
|
629
|
+
.or(errataCopublisher().as("copublisher")
|
|
630
|
+
.then(ref(rules, "space"))
|
|
631
|
+
.then(ref(rules, "code_with_year"))
|
|
632
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
633
|
+
.then(ref(rules, "suffix").maybe())
|
|
634
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
635
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2)))
|
|
636
|
+
.or(copublisherToken().as("copublisher")
|
|
637
|
+
.then(ref(rules, "space"))
|
|
638
|
+
.then(ref(rules, "type").as("type").maybe())
|
|
639
|
+
.then(ref(rules, "space").maybe())
|
|
640
|
+
.then(ref(rules, "code"))
|
|
641
|
+
.then(ref(rules, "space").maybe().maybe()
|
|
642
|
+
.then(ref(rules, "dash"))
|
|
643
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
644
|
+
.maybe())
|
|
645
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
646
|
+
.then(ref(rules, "suffix").maybe())
|
|
647
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
648
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2)))
|
|
649
|
+
.or(ref(rules, "publisher").as("publisher")
|
|
650
|
+
.then(ref(rules, "space"))
|
|
651
|
+
.then(ref(rules, "type").as("type").then(ref(rules, "space")).maybe())
|
|
652
|
+
.then(ref(rules, "code"))
|
|
653
|
+
.then(ref(rules, "space").maybe().maybe()
|
|
654
|
+
.then(ref(rules, "dash"))
|
|
655
|
+
.then(ref(rules, "year_digits").as("year"))
|
|
656
|
+
.maybe())
|
|
657
|
+
.then(ref(rules, "space").then(ref(rules, "additional_copublisher")).maybe())
|
|
658
|
+
.then(ref(rules, "suffix").maybe())
|
|
659
|
+
.then(ref(rules, "reaffirmed").maybe())
|
|
660
|
+
.then(ref(rules, "optional_suffix").repeat(0, 2))
|
|
661
|
+
.as("base")));
|
|
662
|
+
return rules;
|
|
663
|
+
}
|
|
664
|
+
export const ashraeGrammar = {
|
|
665
|
+
rules: buildRules(),
|
|
666
|
+
root: "identifier",
|
|
667
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tree } from "../../grammar/engine.js";
|
|
2
|
+
import type { FlavorImplementation, Identifier } from "../../conformance/implementation.js";
|
|
3
|
+
export declare function buildAshraeIdentifier(tree: Tree): Identifier;
|
|
4
|
+
export declare function ashraeGrammarImplementation(): FlavorImplementation;
|