Skip to content

Commit 3d98c77

Browse files
Defer digit to code ABNF's DIGIT and adjust to that capitalization (#440)
* Defer `digit` to code ABNF's `DIGIT` and adjust to that capitalization * Update specification/gedcom-1-hierarchical-container-format.md --------- Co-authored-by: Dave Thaler <[email protected]>
1 parent 2b63597 commit 3d98c77

7 files changed

+147
-28
lines changed

extracted-files/core.abnf build/core.abnf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; Core Rules extracted from RFC 5234 section B.1
22
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
3-
;DIGIT = %x30-39 ; 0-9
3+
DIGIT = %x30-39 ; 0-9
44
SP = %x20
55
HTAB = %x09 ; horizontal tab
66
DQUOTE = %x22 ; " (Double Quote)

extracted-files/languagetag.abnf build/languagetag.abnf

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ extlang = 3ALPHA ; selected ISO 639 codes
2121
script = 4ALPHA ; ISO 15924 code
2222

2323
region = 2ALPHA ; ISO 3166-1 code
24-
/ 3digit ; UN M.49 code
24+
/ 3DIGIT ; UN M.49 code
2525

2626
variant = 5*8alphanum ; registered variants
27-
/ (digit 3alphanum)
27+
/ (DIGIT 3alphanum)
2828

2929
extension = singleton 1*("-" (2*8alphanum))
3030

3131
; Single alphanumerics
3232
; "x" reserved for private use
33-
singleton = digit ; 0 - 9
33+
singleton = DIGIT ; 0 - 9
3434
/ %x41-57 ; A - W
3535
/ %x59-5A ; Y - Z
3636
/ %x61-77 ; a - w
@@ -69,4 +69,4 @@ regular = "art-lojban" ; these tags match the 'langtag'
6969
/ "zh-min-nan" ; subtag or sequence of subtags
7070
/ "zh-xiang"
7171

72-
alphanum = (ALPHA / digit) ; letters and numbers
72+
alphanum = (ALPHA / DIGIT) ; letters and numbers

extracted-files/mediatype.abnf build/mediatype.abnf

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ type-name = restricted-name
1414
subtype-name = restricted-name
1515

1616
restricted-name = restricted-name-first *126restricted-name-chars
17-
restricted-name-first = ALPHA / digit
18-
restricted-name-chars = ALPHA / digit / "!" / "#" /
17+
restricted-name-first = ALPHA / DIGIT
18+
restricted-name-chars = ALPHA / DIGIT / "!" / "#" /
1919
"$" / "&" / "-" / "^" / "_"
2020
restricted-name-chars =/ "." ; Characters before first dot always
2121
; specify a facet name
@@ -30,7 +30,7 @@ parameter-value = ( token / quoted-string )
3030
token = 1*tchar
3131
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
3232
/ "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
33-
/ digit / ALPHA
33+
/ DIGIT / ALPHA
3434
; any VCHAR, except delimiters
3535
OWS = *( SP / HTAB )
3636
; optional whitespace

extracted-files/grammar.abnf

+127-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ banned = %x00-08 / %x0B-0C / %x0E-1F ; C0 other than LF CR and Tab
1111
; All other rules assume the absence of any banned characters
1212

1313

14-
digit = %x30-39 ; 0 through 9
14+
; DIGIT = %x30-39 ; 0 through 9 -- part of the ABNF core
1515
nonzero = %x31-39 ; 1 through 9
1616
ucletter = %x41-5A ; A through Z
1717
underscore = %x5F ; _
@@ -22,7 +22,7 @@ atsign = %x40 ; @
2222

2323
Line = Level D [Xref D] Tag [D LineVal] EOL
2424

25-
Level = "0" / nonzero *digit
25+
Level = "0" / nonzero *DIGIT
2626
D = %x20 ; space
2727
Xref = atsign 1*tagchar atsign ; but not "@VOID@"
2828
Tag = stdTag / extTag
@@ -31,7 +31,7 @@ EOL = %x0D [%x0A] / %x0A ; CR-LF, CR, or LF
3131

3232
stdTag = ucletter *tagchar
3333
extTag = underscore 1*tagchar
34-
tagchar = ucletter / digit / underscore
34+
tagchar = ucletter / DIGIT / underscore
3535

3636
pointer = voidPtr / Xref
3737
voidPtr = %s"@VOID@"
@@ -49,7 +49,7 @@ Text = *anychar
4949

5050
; ------------- Integer -------------
5151

52-
Integer = 1*digit
52+
Integer = 1*DIGIT
5353

5454

5555
; ------------- Enumeration -------------
@@ -88,10 +88,10 @@ epoch = %s"BCE" / extTag ; constrained by calendar
8888

8989
Time = hour ":" minute [":" second ["." fraction]] [%s"Z"]
9090

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
9595

9696

9797
; ------------- Age -------------
@@ -141,3 +141,122 @@ MediaType = type "/" subtype parameters
141141
Special = Text
142142

143143

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+
/ %x41-57 ; A - W
178+
/ %x59-5A ; Y - Z
179+
/ %x61-77 ; a - w
180+
/ %x79-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 / %x21 / %x23-5B / %x5D-7E / obs-text
254+
obs-text = %x80-FF
255+
quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
256+
; Core Rules extracted from RFC 5234 section B.1
257+
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
258+
DIGIT = %x30-39 ; 0-9
259+
SP = %x20
260+
HTAB = %x09 ; horizontal tab
261+
DQUOTE = %x22 ; " (Double Quote)
262+
VCHAR = %x21-7E ; visible (printing) characters

extracted-files/tags/type-Time

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ specification:
1818
```abnf
1919
Time = hour ":" minute [":" second ["." fraction]] [%s"Z"]
2020

21-
hour = digit / ("0" / "1") digit / "2" ("0" / "1" / "2" / "3")
22-
minute = ("0" / "1" / "2" / "3" / "4" / "5") digit
23-
second = ("0" / "1" / "2" / "3" / "4" / "5") digit
24-
fraction = 1*digit
21+
hour = DIGIT / ("0" / "1") DIGIT / "2" ("0" / "1" / "2" / "3")
22+
minute = ("0" / "1" / "2" / "3" / "4" / "5") DIGIT
23+
second = ("0" / "1" / "2" / "3" / "4" / "5") DIGIT
24+
fraction = 1*DIGIT
2525
```
2626

2727
<div class="note">

specification/gedcom-1-hierarchical-container-format.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ This document additionally makes use of the following named character sets in AB
6060

6161

6262
```abnf
63-
digit = %x30-39 ; 0 through 9
63+
; DIGIT = %x30-39 ; 0 through 9 -- defined in RFC 5234 section B.1
6464
nonzero = %x31-39 ; 1 through 9
6565
ucletter = %x41-5A ; A through Z
6666
underscore = %x5F ; _
@@ -125,7 +125,7 @@ It matches the production `Line`:
125125
```abnf
126126
Line = Level D [Xref D] Tag [D LineVal] EOL
127127
128-
Level = "0" / nonzero *digit
128+
Level = "0" / nonzero *DIGIT
129129
D = %x20 ; space
130130
Xref = atsign 1*tagchar atsign ; but not "@VOID@"
131131
Tag = stdTag / extTag
@@ -134,7 +134,7 @@ EOL = %x0D [%x0A] / %x0A ; CR-LF, CR, or LF
134134
135135
stdTag = ucletter *tagchar
136136
extTag = underscore 1*tagchar
137-
tagchar = ucletter / digit / underscore
137+
tagchar = ucletter / DIGIT / underscore
138138
139139
pointer = voidPtr / Xref
140140
voidPtr = %s"@VOID@"

specification/gedcom-2-data-types.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ and represents a non-negative integer in base-10.
2323
Leading zeros have no semantic meaning and should be omitted.
2424

2525
```abnf
26-
Integer = 1*digit
26+
Integer = 1*DIGIT
2727
```
2828

2929
Negative integers are not supported by this specification.
@@ -177,10 +177,10 @@ When a time is used together with a `DateExact`, it is recommended that UTC time
177177
```abnf
178178
Time = hour ":" minute [":" second ["." fraction]] [%s"Z"]
179179
180-
hour = digit / ("0" / "1") digit / "2" ("0" / "1" / "2" / "3")
181-
minute = ("0" / "1" / "2" / "3" / "4" / "5") digit
182-
second = ("0" / "1" / "2" / "3" / "4" / "5") digit
183-
fraction = 1*digit
180+
hour = DIGIT / ("0" / "1") DIGIT / "2" ("0" / "1" / "2" / "3")
181+
minute = ("0" / "1" / "2" / "3" / "4" / "5") DIGIT
182+
second = ("0" / "1" / "2" / "3" / "4" / "5") DIGIT
183+
fraction = 1*DIGIT
184184
```
185185

186186
:::note

0 commit comments

Comments
 (0)