rfc9165v3.txt | rfc9165.txt | |||
---|---|---|---|---|
Internet Engineering Task Force (IETF) C. Bormann | Internet Engineering Task Force (IETF) C. Bormann | |||
Request for Comments: 9165 Universität Bremen TZI | Request for Comments: 9165 Universität Bremen TZI | |||
Category: Standards Track December 2021 | Category: Standards Track December 2021 | |||
ISSN: 2070-1721 | ISSN: 2070-1721 | |||
Additional Control Operators for Concise Data Definition Language (CDDL) | Additional Control Operators for the Concise Data Definition Language | |||
(CDDL) | ||||
Abstract | Abstract | |||
The Concise Data Definition Language (CDDL), standardized in RFC | The Concise Data Definition Language (CDDL), standardized in RFC | |||
8610, provides "control operators" as its main language extension | 8610, provides "control operators" as its main language extension | |||
point. | point. | |||
The present document defines a number of control operators that were | The present document defines a number of control operators that were | |||
not yet ready at the time RFC 8610 was completed: .plus, .cat, and | not yet ready at the time RFC 8610 was completed: .plus, .cat, and | |||
.det for the construction of constants; .abnf/.abnfb for including | .det for the construction of constants; .abnf/.abnfb for including | |||
skipping to change at line 162 ¶ | skipping to change at line 163 ¶ | |||
interval<X> | interval<X> | |||
interval<Y> | interval<Y> | |||
} | } | |||
Figure 1: An Example of Addition to a Base Value | Figure 1: An Example of Addition to a Base Value | |||
The example in Figure 1 contains the generic definition of a CDDL | The example in Figure 1 contains the generic definition of a CDDL | |||
group interval that gives a lower and upper bound and, optionally, a | group interval that gives a lower and upper bound and, optionally, a | |||
tolerance. The parameter BASE allows the non-conflicting use of a | tolerance. The parameter BASE allows the non-conflicting use of a | |||
multiple of these interval groups in one map by assigning different | multiple of these interval groups in one map by assigning different | |||
labels to the entries of the interval. rect combines two of these | labels to the entries of the interval. The rule rect combines two of | |||
interval groups into a map, one group for the X dimension (using 0, | these interval groups into a map, one group for the X dimension | |||
1, and 2 as labels) and one for the Y dimension (using 3, 4, and 5 as | (using 0, 1, and 2 as labels) and one for the Y dimension (using 3, | |||
labels). | 4, and 5 as labels). | |||
2.2. String Concatenation | 2.2. String Concatenation | |||
It is often useful to be able to compose string literals out of | It is often useful to be able to compose string literals out of | |||
component literals defined in different places in the specification. | component literals defined in different places in the specification. | |||
The .cat control identifies a string that is built from a | The .cat control identifies a string that is built from a | |||
concatenation of the target and the controller. The target and | concatenation of the target and the controller. The target and | |||
controller both MUST be strings. The result of the operation has the | controller both MUST be strings. The result of the operation has the | |||
same type as the target. The concatenation is performed on the bytes | same type as the target. The concatenation is performed on the bytes | |||
skipping to change at line 188 ¶ | skipping to change at line 189 ¶ | |||
c = "foo" .cat ' | c = "foo" .cat ' | |||
bar | bar | |||
baz | baz | |||
' | ' | |||
; on a system where the newline is \n, is the same string as: | ; on a system where the newline is \n, is the same string as: | |||
b = "foo\n bar\n baz\n" | b = "foo\n bar\n baz\n" | |||
Figure 2: An Example of Concatenation of Text and Byte Strings | Figure 2: An Example of Concatenation of Text and Byte Strings | |||
The example in Figure 2 builds a text string named a text string | The example in Figure 2 builds a text string named c from | |||
named c from concatenating the target text string "foo" and the | concatenating the target text string "foo" and the controller byte | |||
controller byte string entered in a text form byte string literal. | string entered in a text form byte string literal. (This particular | |||
(This particular idiom is useful when the text string contains | idiom is useful when the text string contains newlines, which, as | |||
newlines, which, as shown in the example for b, may be harder to read | shown in the example for b, may be harder to read when entered in the | |||
when entered in the format that the pure CDDL text string notation | format that the pure CDDL text string notation inherits from JSON.) | |||
inherits from JSON.) | ||||
2.3. String Concatenation with Dedenting | 2.3. String Concatenation with Dedenting | |||
Multi-line string literals for various applications, including | Multi-line string literals for various applications, including | |||
embedded ABNF (Section 3), need to be set flush left, at least | embedded ABNF (Section 3), need to be set flush left, at least | |||
partially. Often, having some indentation in the source code for the | partially. Often, having some indentation in the source code for the | |||
literal can promote readability, as in Figure 3. | literal can promote readability, as in Figure 3. | |||
oid = bytes .abnfb ("oid" .det cbor-tags-oid) | oid = bytes .abnfb ("oid" .det cbor-tags-oid) | |||
roid = bytes .abnfb ("roid" .det cbor-tags-oid) | roid = bytes .abnfb ("roid" .det cbor-tags-oid) | |||
End of changes. 3 change blocks. | ||||
12 lines changed or deleted | 12 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |