diff --git a/zkat/suffixes/draft-marchan-kdl2.html b/zkat/suffixes/draft-marchan-kdl2.html index 9dc5863..5a73934 100644 --- a/zkat/suffixes/draft-marchan-kdl2.html +++ b/zkat/suffixes/draft-marchan-kdl2.html @@ -1181,19 +1181,16 @@ https://creativecommons.org/licenses/by-sa/4.0/3.8. Type Annotation
3.8.2. Reserved Type Annotations for Numbers Without Decimal Parts
+3.8.3. Reserved Type Annotations for Numbers With Decimal Parts
+A type annotation is a prefix to any Node Name (Section 3.2) or Value (Section 3.7) that -includes a suggestion of what type the value is intended to be treated as, -or as a context-specific elaboration of the more generic type the node name -indicates.¶
-Type annotations are written as a set of ( and ) with a single
-String (Section 3.9) in it. It may contain Whitespace after the ( and before
-the ), and may be separated from its target by Whitespace.¶
KDL does not specify any restrictions on what implementations might do with +
A type annotation is a String (Section 3.9) value attached to any Node Name +(Section 3.2) or Value (Section 3.7) that includes a suggestion of what type the +value is intended to be treated as, or as a context-specific elaboration of +the more generic type the node name indicates.¶
+KDL does not specify any restrictions on what implementations might do with these annotations. They are free to ignore them, or use them to make decisions -about how to interpret a value.¶
-When a Value (Section 3.7) is a Number (Section 3.14), it's possible to attach the
-type annotation as a "suffix", instead of prepending it between ( and ).
-This makes it possible to, for example, write 10px, 10.5%, 512GiB, etc.,
-which are equivalent to (px)10, (%)5, and (GiB)512, respectively.¶
There are two kinds of Suffix Type Annotations (Section 3.8.1) -available: Bare Suffix Type Annotations (Section 3.8.1.1)s and -Explicit Suffix Type Annotations (Section 3.8.1.2).¶
-Most suffixes can be appended directly to the number (a Bare Suffix Type
-Annotation (Section 3.8.1.1)), as shown in the previous
-paragraph. To avoid parsing ambiguity, there are some restrictions on this; an
-Explicit Suffix Type Annotation (Section 3.8.1.2) avoids all
-these restrictions by using an additional # to explicitly indicate it. For
-example, 10.0u8 is invalid, but 10.0#u8 is valid and equivalent to
-(u8)10.0. See Bare Suffix Type Annotation (Section 3.8.1.1)
-for the full list of restrictions.¶
An implementation that finds BOTH a parenthesized (Section 3.8) and a -Suffix Type Annotation (Section 3.8.1) on the same Number -(Section 3.14) MUST yield a syntax error.¶
-Suffixes MUST BE plain Identifier Strings (Section 3.10). No other -String (Section 3.9) syntax is acceptable.¶
-When a Value (Section 3.7) is a decimal Number (Section 3.14) WITHOUT exponential
-syntax (1e+5 etc) (and ONLY a decimal. That is, numbers which do NOT have a
-0b/0o/0x prefix with an optional sign), it's possible to append the type
-annotation as a suffix directly to the number, without any additional syntax.¶
To remove further ambiguity, on top of not being available for non-decimal
-prefixes, and for decimals with exponent parts, the suffix Identifier String
-(Section 3.10) itself MUST NOT start with any of ., ,, or _, as
-well as [eE][-+]?[0-9]? as part of the exponential restriction above. Note the
-optional digit, which is added to prevent typo ambiguity.¶
For example, the following are all illegal:¶
-10,000 (suffix would start with ,)¶
10e0n (suffix on an exponential)¶
0xyz (starts with reserved hexadecimal prefix)¶
0b (starts with reserved binary prefix)¶
5e+oops (looks too close to an exponential)¶
Whereas the following are all legal:¶
-0u8 (aka (u8)0)¶
5em (aka (em)5. The e is not followed by a digit.)¶
1xyz (aka (xyz)1. No longer starts with 0 as above.)¶
20b (aka (b)20, "20 bytes". No longer starts with just 0 as above.)¶
If the desired suffix would violate any of the above rules, either regular -parenthetical Type Annotations (Section 3.8) or Explicit Suffix Type -Annotations (Section 3.8.1.2) may be used.¶
-Any Number (Section 3.14) may have a # appended to it, followed by any valid
-Identifier String (Section 3.10). This is an Explicit Suffix Type
-Annotation (Section 3.8.1) syntax without any of the added
-restrictions of Bare Suffix Type Annotations (Section 3.8.1.1),
-which can be a useful escape hatch. For example: 0#b is invalid syntax without
-the # prefix.¶
Note that, unlike Bare Suffix Type Annotations
-(Section 3.8.1.1), Explicit Suffixes may be used with ALL Number
-(Section 3.14) formats (hexadecimal, decimal, octal, and binary). For example,
-0x1234#u32 is valid.¶
Additionally, the following type annotations MAY be recognized by KDL parsers -and, if used, SHOULD interpret these types as follows.¶
-Signed integers of various sizes (the number is the bit size):¶
- -Unsigned integers of various sizes (the number is the bit size):¶
- -Platform-dependent integer types, both signed and unsigned:¶
- -IEEE 754 floating point numbers, both single (32) and double (64) precision:¶
- -IEEE 754-2008 decimal floating point numbers¶
- -date-time: ISO8601 date/time format.¶
time: "Time" section of ISO8601.¶
date: "Date" section of ISO8601.¶
duration: ISO8601 duration format.¶
decimal: IEEE 754-2008 decimal string format.¶
currency: ISO 4217 currency code.¶
country-2: ISO 3166-1 alpha-2 country code.¶
country-3: ISO 3166-1 alpha-3 country code.¶
country-subdivision: ISO 3166-2 country subdivision code.¶
email: RFC5322 email address.¶
idn-email: RFC6531 internationalized email address.¶
hostname: RFC1123 internet hostname (only ASCII segments)¶
idn-hostname: RFC5890 internationalized internet hostname
-(only xn---prefixed ASCII "punycode" segments, or non-ASCII segments)¶
ipv4: RFC2673 dotted-quad IPv4 address.¶
ipv6: RFC2373 IPv6 address.¶
url: RFC3986 URI.¶
url-reference: RFC3986 URI Reference.¶
irl: RFC3987 Internationalized Resource Identifier.¶
irl-reference: RFC3987 Internationalized Resource Identifier Reference.¶
url-template: RFC6570 URI Template.¶
uuid: RFC4122 UUID.¶
regex: Regular expression. Specific patterns may be implementation-dependent.¶
base64: A Base64-encoded string, denoting arbitrary binary data.¶
base85: An Ascii85-encoded string, denoting arbitrary binary data.¶
There are two kinds of Type Annotation syntaxes in KDL: Prefix Type Annotations +(Section 3.8.2) and Suffix Type Annotations +(Section 3.8.3).¶
Prefix Type Annotations are written as a set of ( and ) with a single String
+(Section 3.9) in it. It may contain Whitespace after the ( and before the ),
+and may be separated from its target by Whitespace. Unlike the other annotation
+types, any String type may be used.¶
When a Value (Section 3.7) is a Number (Section 3.14), it's possible to attach the
+type annotation as a "suffix", instead of prepending it between ( and ).
+This makes it possible to, for example, write 10px, 10.5%, 512GiB, etc.,
+which are equivalent to (px)10, (%)5, and (GiB)512, respectively.¶
There are two kinds of Suffix Type Annotations (Section 3.8.3) +available: Bare Suffix Type Annotations (Section 3.8.3.1)s and +Explicit Suffix Type Annotations (Section 3.8.3.2).¶
+Most suffixes can be appended directly to the number (a Bare Suffix Type
+Annotation (Section 3.8.3.1)), as shown in the previous
+paragraph. To avoid parsing ambiguity, there are some restrictions on this; an
+Explicit Suffix Type Annotation (Section 3.8.3.2) avoids all
+these restrictions by using an additional # to explicitly indicate it. For
+example, 10.0u8 is invalid, but 10.0#u8 is valid and equivalent to
+(u8)10.0. See Bare Suffix Type Annotation (Section 3.8.3.1)
+for the full list of restrictions.¶
An implementation that finds BOTH a parenthesized (Section 3.8) and a +Suffix Type Annotation (Section 3.8.3) on the same Number +(Section 3.14) MUST yield a syntax error.¶
+Suffixes MUST BE plain Identifier Strings (Section 3.10). No other +String (Section 3.9) syntax is acceptable.¶
+When a Value (Section 3.7) is a decimal Number (Section 3.14) WITHOUT an exponential
+part--that is, numbers which do NOT have a 0b/0o/0x prefix with an
+optional sign, or which look like 5.2e+3--it's possible to append the type
+annotation as a suffix directly to the number, without any additional syntax.¶
To remove further ambiguity, on top of not being available for non-decimal
+prefixes, and for decimals with exponent parts, the suffix Identifier String
+(Section 3.10) itself MUST NOT start with either . or ,, as well as
+[eE][-+]?[0-9]? (as part of the exponential restriction above). Note the
+optional digit, which is added to prevent typo ambiguity. Additionally, a
+standalone non-decimal Number (Section 3.14) prefix MUST yield a syntax error
+(e.g. 0b is an incorrect binary number, not (b)0).¶
For example, the following are all illegal:¶
+10,000 (suffix would start with ,)¶
10e0n (suffix on an exponential)¶
0xyz (starts with reserved hexadecimal prefix)¶
0b (starts with reserved binary prefix)¶
5e+oops (looks too close to an exponential)¶
Whereas the following are all legal:¶
+0u8 (aka (u8)0)¶
5em (aka (em)5. The e is not followed by a digit.)¶
1xyz (aka (xyz)1. No longer starts with 0 as above.)¶
20b (aka (b)20, "20 bytes". No longer starts with just 0 as above.)¶
If the desired suffix would violate any of the above rules, either regular +parenthetical Type Annotations (Section 3.8) or Explicit Suffix Type +Annotations (Section 3.8.3.2) may be used.¶
+Any Number (Section 3.14) may have a # appended to it, followed by any valid
+Identifier String (Section 3.10). This is an Explicit Suffix Type
+Annotation (Section 3.8.3) syntax without any of the added
+restrictions of Bare Suffix Type Annotations (Section 3.8.3.1),
+which can be a useful escape hatch. For example: 0#b is invalid syntax without
+the # prefix.¶
Note that, unlike Bare Suffix Type Annotations
+(Section 3.8.3.1), Explicit Suffixes may be used with ALL Number
+(Section 3.14) formats (hexadecimal, decimal, octal, and binary). For example,
+0x1234#u32 is valid.¶
Additionally, the following type annotations MAY be recognized by KDL parsers +and, if used, SHOULD interpret these types as follows.¶
+Signed integers of various sizes (the number is the bit size):¶
+ +Unsigned integers of various sizes (the number is the bit size):¶
+ +Platform-dependent integer types, both signed and unsigned:¶
+ +IEEE 754 floating point numbers, both single (32) and double (64) precision:¶
+ +IEEE 754-2008 decimal floating point numbers¶
+ +date-time: ISO8601 date/time format.¶
time: "Time" section of ISO8601.¶
date: "Date" section of ISO8601.¶
duration: ISO8601 duration format.¶
decimal: IEEE 754-2008 decimal string format.¶
currency: ISO 4217 currency code.¶
country-2: ISO 3166-1 alpha-2 country code.¶
country-3: ISO 3166-1 alpha-3 country code.¶
country-subdivision: ISO 3166-2 country subdivision code.¶
email: RFC5322 email address.¶
idn-email: RFC6531 internationalized email address.¶
hostname: RFC1123 internet hostname (only ASCII segments)¶
idn-hostname: RFC5890 internationalized internet hostname
+(only xn---prefixed ASCII "punycode" segments, or non-ASCII segments)¶
ipv4: RFC2673 dotted-quad IPv4 address.¶
ipv6: RFC2373 IPv6 address.¶
url: RFC3986 URI.¶
url-reference: RFC3986 URI Reference.¶
irl: RFC3987 Internationalized Resource Identifier.¶
irl-reference: RFC3987 Internationalized Resource Identifier Reference.¶
url-template: RFC6570 URI Template.¶
uuid: RFC4122 UUID.¶
regex: Regular expression. Specific patterns may be implementation-dependent.¶
base64: A Base64-encoded string, denoting arbitrary binary data.¶
base85: An Ascii85-encoded string, denoting arbitrary binary data.¶