Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bytearrays to msgpack library #702

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions serialization/msgpack.ksy
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,24 @@ seq:
size: str_len
if: is_str
# ========================================================================
- id: num_array_elements_16
- id: len_byte_array8
type: u1
if: is_byte_array_8
- id: len_byte_array16
type: u2
if: is_array_16
- id: num_array_elements_32
if: is_array_16 or is_byte_array_16
- id: len_byte_array32
type: u4
if: is_array_32
if: is_array_32 or is_byte_array_32
- id: byte_array8
size: len_byte_array8
if: is_byte_array_8
- id: byte_array16
size: len_byte_array16
if: is_byte_array_16
- id: byte_array32
size: len_byte_array32
if: is_byte_array_32
- id: array_elements
type: msgpack
repeat: expr
Expand All @@ -76,12 +88,6 @@ seq:
repeat-expr: num_map_elements
if: is_map
instances:
# value:
# value: >-
# is_bool ? bool_value :
# is_int ? int_value :
# is_array ? array_elements :
# 0
is_nil:
value: b1 == 0xc0
doc-ref: 'https://github.com/msgpack/msgpack/blob/master/spec.md#formats-nil'
Expand Down Expand Up @@ -159,11 +165,22 @@ instances:
is_array_32:
value: b1 == 0xdd
doc-ref: 'https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array'
is_byte_array_8:
value: b1 == 0xc4
doc-ref: 'https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array'
is_byte_array_16:
value: b1 == 0xc5
doc-ref: 'https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array'
is_byte_array_32:
value: b1 == 0xc6
doc-ref: 'https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array'
num_array_elements:
value: >-
is_fix_array ? b1 & 0b0000_1111 :
is_array_16 ? num_array_elements_16 :
num_array_elements_32
is_byte_array_8 ? len_byte_array8 :
is_array_16 or is_byte_array_16 ? len_byte_array16 :
is_byte_array_32 ? len_byte_array32 :
len_byte_array32
if: is_array
doc-ref: 'https://github.com/msgpack/msgpack/blob/master/spec.md#formats-array'
# ========================================================================
Expand Down