@@ -11,7 +11,7 @@ banned = %x00-08 / %x0B-0C / %x0E-1F ; C0 other than LF CR and Tab
11
11
; All other rules assume the absence of any banned characters
12
12
13
13
14
- digit = %x 30 -39 ; 0 through 9
14
+ ; DIGIT = %x30-39 ; 0 through 9 -- part of the ABNF core
15
15
nonzero = %x 31 -39 ; 1 through 9
16
16
ucletter = %x 41 -5A ; A through Z
17
17
underscore = %x 5F ; _
@@ -22,7 +22,7 @@ atsign = %x40 ; @
22
22
23
23
Line = Level D [Xref D ] Tag [D LineVal ] EOL
24
24
25
- Level = " 0" / nonzero * digit
25
+ Level = " 0" / nonzero * DIGIT
26
26
D = %x 20 ; space
27
27
Xref = atsign 1 * tagchar atsign ; but not "@VOID@"
28
28
Tag = stdTag / extTag
@@ -31,7 +31,7 @@ EOL = %x0D [%x0A] / %x0A ; CR-LF, CR, or LF
31
31
32
32
stdTag = ucletter * tagchar
33
33
extTag = underscore 1 * tagchar
34
- tagchar = ucletter / digit / underscore
34
+ tagchar = ucletter / DIGIT / underscore
35
35
36
36
pointer = voidPtr / Xref
37
37
voidPtr = %s " @VOID@"
@@ -49,7 +49,7 @@ Text = *anychar
49
49
50
50
; ------------- Integer -------------
51
51
52
- Integer = 1 * digit
52
+ Integer = 1 * DIGIT
53
53
54
54
55
55
; ------------- Enumeration -------------
@@ -88,10 +88,10 @@ epoch = %s"BCE" / extTag ; constrained by calendar
88
88
89
89
Time = hour " :" minute [" :" second [" ." fraction ]] [%s " Z" ]
90
90
91
- hour = digit / (" 0" / " 1" ) digit / " 2" (" 0" / " 1" / " 2" / " 3" )
92
- minute = (" 0" / " 1" / " 2" / " 3" / " 4" / " 5" ) digit
93
- second = (" 0" / " 1" / " 2" / " 3" / " 4" / " 5" ) digit
94
- fraction = 1 * digit
91
+ hour = DIGIT / (" 0" / " 1" ) DIGIT / " 2" (" 0" / " 1" / " 2" / " 3" )
92
+ minute = (" 0" / " 1" / " 2" / " 3" / " 4" / " 5" ) DIGIT
93
+ second = (" 0" / " 1" / " 2" / " 3" / " 4" / " 5" ) DIGIT
94
+ fraction = 1 * DIGIT
95
95
96
96
97
97
; ------------- Age -------------
@@ -141,3 +141,122 @@ MediaType = type "/" subtype parameters
141
141
Special = Text
142
142
143
143
144
+ ; ABNF derived from RFC 5646 section 2.1
145
+ Language-Tag = langtag ; normal language tags
146
+ / privateuse ; private use tag
147
+ / grandfathered ; grandfathered tags
148
+ langtag = language
149
+ [" -" script ]
150
+ [" -" region ]
151
+ * (" -" variant )
152
+ * (" -" extension )
153
+ [" -" privateuse ]
154
+
155
+ language = 2 * 3ALPHA ; shortest ISO 639 code
156
+ [" -" extlang ] ; sometimes followed by
157
+ ; extended language subtags
158
+ / 4ALPHA ; or reserved for future use
159
+ / 5 * 8ALPHA ; or registered language subtag
160
+
161
+ extlang = 3ALPHA ; selected ISO 639 codes
162
+ * 2(" -" 3ALPHA ) ; permanently reserved
163
+
164
+ script = 4ALPHA ; ISO 15924 code
165
+
166
+ region = 2ALPHA ; ISO 3166-1 code
167
+ / 3DIGIT ; UN M.49 code
168
+
169
+ variant = 5 * 8alphanum ; registered variants
170
+ / (DIGIT 3alphanum )
171
+
172
+ extension = singleton 1 * (" -" (2 * 8alphanum ))
173
+
174
+ ; Single alphanumerics
175
+ ; "x" reserved for private use
176
+ singleton = DIGIT ; 0 - 9
177
+ / %x 41 -57 ; A - W
178
+ / %x 59 -5A ; Y - Z
179
+ / %x 61 -77 ; a - w
180
+ / %x 79 -7A ; y - z
181
+
182
+ privateuse = " x" 1 * (" -" (1 * 8alphanum ))
183
+
184
+ grandfathered = irregular ; non-redundant tags registered
185
+ / regular ; during the RFC 3066 era
186
+
187
+ irregular = " en-GB-oed" ; irregular tags do not match
188
+ / " i-ami" ; the 'langtag' production and
189
+ / " i-bnn" ; would not otherwise be
190
+ / " i-default" ; considered 'well-formed'
191
+ / " i-enochian" ; These tags are all valid,
192
+ / " i-hak" ; but most are deprecated
193
+ / " i-klingon" ; in favor of more modern
194
+ / " i-lux" ; subtags or subtag
195
+ / " i-mingo" ; combination
196
+ / " i-navajo"
197
+ / " i-pwn"
198
+ / " i-tao"
199
+ / " i-tay"
200
+ / " i-tsu"
201
+ / " sgn-BE-FR"
202
+ / " sgn-BE-NL"
203
+ / " sgn-CH-DE"
204
+
205
+ regular = " art-lojban" ; these tags match the 'langtag'
206
+ / " cel-gaulish" ; production, but their subtags
207
+ / " no-bok" ; are not extended language
208
+ / " no-nyn" ; or variant subtags: their meaning
209
+ / " zh-guoyu" ; is defined by their registration
210
+ / " zh-hakka" ; and all of these are deprecated
211
+ / " zh-min" ; in favor of a more modern
212
+ / " zh-min-nan" ; subtag or sequence of subtags
213
+ / " zh-xiang"
214
+
215
+ alphanum = (ALPHA / DIGIT ) ; letters and numbers
216
+ ; ABNF derived from RFC 2045 section 5.1
217
+ type = discrete-type / composite-type
218
+ discrete-type = " text" / " image" / " audio" / " video" /
219
+ " application" / extension-token
220
+ composite-type = " message" / " multipart" / extension-token
221
+ extension-token = ietf-token / x-token
222
+ ietf-token = type-name
223
+ x-token = " x-" token
224
+ subtype = extension-token / iana-token
225
+ iana-token = subtype-name
226
+
227
+ ; ABNF derived from RFC 6838 section 4.2
228
+ type-name = restricted-name
229
+ subtype-name = restricted-name
230
+
231
+ restricted-name = restricted-name-first * 126restricted-name-chars
232
+ restricted-name-first = ALPHA / DIGIT
233
+ restricted-name-chars = ALPHA / DIGIT / " !" / " #" /
234
+ " $" / " &" / " -" / " ^" / " _"
235
+ restricted-name-chars =/ " ." ; Characters before first dot always
236
+ ; specify a facet name
237
+ restricted-name-chars =/ " +" ; Characters after last plus always
238
+ ; specify a structured syntax suffix
239
+
240
+ ; ABNF derived from RFC 9110 section 5.6
241
+ parameters = * ( OWS " ;" OWS [ parameter ] )
242
+ parameter = parameter-name " =" parameter-value
243
+ parameter-name = token
244
+ parameter-value = ( token / quoted-string )
245
+ token = 1 * tchar
246
+ tchar = " !" / " #" / " $" / " %" / " &" / " '" / " *"
247
+ / " +" / " -" / " ." / " ^" / " _" / " `" / " |" / " ~"
248
+ / DIGIT / ALPHA
249
+ ; any VCHAR, except delimiters
250
+ OWS = * ( SP / HTAB )
251
+ ; optional whitespace
252
+ quoted-string = DQUOTE * ( qdtext / quoted-pair ) DQUOTE
253
+ qdtext = HTAB / SP / %x 21 / %x 23 -5B / %x 5D -7E / obs-text
254
+ obs-text = %x 80 -FF
255
+ quoted-pair = " \" ( HTAB / SP / VCHAR / obs-text )
256
+ ; Core Rules extracted from RFC 5234 section B.1
257
+ ALPHA = %x 41 -5A / %x 61 -7A ; A-Z / a-z
258
+ DIGIT = %x 30 -39 ; 0-9
259
+ SP = %x 20
260
+ HTAB = %x 09 ; horizontal tab
261
+ DQUOTE = %x 22 ; " (Double Quote)
262
+ VCHAR = %x 21 -7E ; visible (printing) characters
0 commit comments