形式化定义
优质
小牛编辑
131浏览
2023-12-01
ABNF:
- serialize-data = integer / long / double / nan / positive-infinity / negative-infinity /
- true / false / null / empty / utf8-char / bytes / string / datetime / guid /
- list / map / object / ref
- UINT = "0" / %x31-39 *DIGIT
- SINT = *("+" / "-") UINT
- integer = DIGIT / %x69 SINT ";"
- long = %x6C SINT ";"
- double = %x64 SINT ["." 1*DIGIT ["E" SINT]] ";"
- nan = %x4E
- positive-infinity = %x49 "+"
- negative-infinity = %x49 "-"
- true = %x74
- false = %x66
- null = %x6E
- empty = %x65
- one-byte-utf8 = %x00-7F
- two-byte-utf8 = %xC0-DF %x80-BF
- three-byte-utf8 = %xE0-EF %x80-BF %x80-BF
- four-byte-utf8 = %xF0-F7 %x80-BF %x80-BF %x80-BF
- utf8 = one-byte-utf8 / two-byte-utf8 / three-byte-utf8 / four-byte-utf8
- utf8-char = %x75 (one-byte-utf8 / two-byte-utf8 / three-byte-utf8)
- bytes-length = UINT
- bytes = %x62 DQUOTE DQUOTE / %x62 bytes-length DQUOTE <bytes-length>OCTET DQUOTE
- string-length = UINT
- string = %x73 DQUOTE DQUOTE / %x73 string-length DQUOTE <string-length>utf8 DQUOTE
- year = 4DIGIT
- month = "0" %x31-39 / "1" %x30-32
- day = "0" %x31-39 / %x31-32 %x30-39 / "3" %x30-31
- local = ";"
- utc = %x5A
- timezone = local / utc
- date = %x44 year month day timezone
- hour = %x30-31 DIGIT / "2" %x30-x33
- minute = %x30-35 DIGIT
- second = %x30-35 DIGIT
- millisecond = 3DIGIT
- microsecond = 6DIGIT
- nanosecond = 9DIGIT
- time = %x54 hour minute second ["." (millisecond / microsecond / nanosecond)] timezone
- datetime = date / time / %x44 year month day time
- guid = %x67 "{" 8HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 12HEXDIG "}"
- element = serialize-data
- list-count = UINT
- list = %x61 "{" "}" / %x61 list-count "{" <list-count>element "}"
- key = serialize-data
- value = serialize-data
- keyvalue = key value
- map-count = UINT
- map = %x6D "{" "}" / %x6D map-count "{" <map-count>keyvalue "}"
- classname-length = UINT
- classname = classname-length DQUOTE <classname-length>utf8 DQUOTE
- fieldname = string
- field-count = UINT
- class = %x63 classname field-count "{" <field-count>fieldname "}"
- class-ref = UINT
- fieldvalue = serialize-data
- object = [class] %x6F class-ref "{" <field-count>fieldvalue "}"
- ref = %x72 UINT ";"
- string-list = %x61 list-count "{" <list-count>string "}"
- end = %x7A
- function-list = %x46 string-list end
- function-name = string
- function-arguments = list
- passing-by-ref = true
- rpc-call = 1*(%x43 function-name [function-arguments [passing-by-ref]]) end
- rpc-result = %x52 serialize-data
- rpc-arguments = %x41 list
- rpc-error = %x45 string
- rpc-reply = rpc-error end / 1*(rpc-result [rpc-arguments]) [rpc-error] end