Skip to content

Latest commit

 

History

History
52 lines (49 loc) · 4.16 KB

implementation.org

File metadata and controls

52 lines (49 loc) · 4.16 KB

Parsing BULK

Jump table

Parsing a BULK stream means parsing a sequence of expressions. Parsing an expression means reading a marker byte and parsing the corresponding payload.

Bits and bytes are in big-endian order.

markeraction
0x0Return nil
0x1Start sequence
0x2End sequence
0x3Parse an expression (must be an integer);
read as many bytes and return them as an array
0x4Read the next byte as an 8 bits unsigned integer and return it
0x5Read the next 2 bytes as a 16 bits unsigned integer and return it
0x6Read the next 4 bytes as a 32 bits unsigned integer and return it
0x7Read the next 8 bytes as a 64 bits unsigned integer and return it
0x8Read the next 16 bytes as a 128 bits unsigned integer and return it
0x9Read the next byte as an 8 bits signed integer and return it
0xARead the next 2 bytes as a 16 bits signed integer and return it
0xBRead the next 4 bytes as a 32 bits signed integer and return it
0xCRead the next 8 bytes as a 64 bits signed integer and return it
0xDRead the next 16 bytes as a 128 bits signed integer and return it
0xE-0x1FError
0x20-0xFERead the next byte; return a reference object:
its name field is that byte as an 8 bits unsigned integer
its namespace field is the marker byte as an 8 bits unsigned integer
0xFFRead bytes until a byte is different than 0xFF and compute the sum of each
of those bytes, including the first marker 0xFF, taken as unsigned integers;
read the next byte as an 8 bits unsigned integer; return a reference object:
its namespace and name fields are the two integers