design: Document option type
This commit is contained in:
parent
77a4d7893f
commit
50ca98f3c6
@ -33,6 +33,11 @@ PDL allows defining a protocol using HOPP and TAPE.
|
||||
| {...} | KTV | * | Table with defined schema
|
||||
| Any | * | * | Value of an undefined type
|
||||
|
||||
Tables with a defined schema can specify some fields as optional using a
|
||||
question mark before the type. This will wrap the field the go-util
|
||||
ucontainer.Option type. When encoding, void fields will not be included in the
|
||||
output, and when decoding, unspecified fields are left void.
|
||||
|
||||
[^1]: Excluding SI and SBA. I5 and U5 cannot be used in an array, but String and
|
||||
Buffer are simply forced to use their "long" variant.
|
||||
|
||||
@ -48,6 +53,7 @@ structures. They are separated by whitespace.
|
||||
| Method | `M[0-9A-Fa-f]{4}` | A 16-bit hexadecimal method code.
|
||||
| Key | `[0-9A-Fa-f]{4}` | A 16-bit hexadecimal table key.
|
||||
| Ident | `[A-Z][A-Za-z0-9]` | An identifier.
|
||||
| Option | `?` | A question mark.
|
||||
| Comma | `,` | A comma separator.
|
||||
| LBrace | `{` | A left curly brace.
|
||||
| RBrace | `}` | A right curly brace.
|
||||
@ -107,7 +113,7 @@ Below is an EBNF description of the language.
|
||||
<method> -> /M[0-9A-Fa-f]{4}/
|
||||
<key> -> /[0-9A-Fa-f]{4}/
|
||||
<ident> -> /[A-Z][A-Za-z0-9]/
|
||||
<field> -> <key> <ident> <type>
|
||||
<field> -> <key> <ident> ["?"] <type>
|
||||
<type> -> <ident>
|
||||
| "[" "]" <type>
|
||||
| "{" (<comment>* <field> ",")* [<comment>* <field>] "}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user