From 850e403c309bd274564ec9a6f69d367c8f1082da Mon Sep 17 00:00:00 2001 From: Rea Rustagi <85902999+rustagir@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:32:18 -0400 Subject: [PATCH] fix formatting in spec file (#83) --- spec.html | 711 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 364 insertions(+), 347 deletions(-) diff --git a/spec.html b/spec.html index 034fd29..7c235c0 100644 --- a/spec.html +++ b/spec.html @@ -1,366 +1,383 @@ + - BSON (Binary JSON): Specification - + BSON (Binary JSON): Specification + + -

Specification Version 1.1

+

Specification Version 1.1

-

BSON is a binary format in which zero or more ordered key/value -pairs are stored as a single entity. We call this entity -a document.

+

BSON is a binary format in which zero or more ordered key/value + pairs are stored as a single entity. We call this entity + a document.

-

The following grammar specifies version 1.1 of the -BSON standard. We've written the grammar using a -pseudo-BNF -syntax. Valid BSON data is represented by -the document non-terminal.

+

The following grammar specifies version 1.1 of the + BSON standard. We've written the grammar using a + pseudo-BNF + syntax. Valid BSON data is represented by + the document non-terminal.

-
-

Basic Types

+
+

Basic Types

-

The following basic types are used as terminals in - the rest of the grammar. Each type must be serialized in - little-endian format.

+

The following basic types are used as terminals in + the rest of the grammar. Each type must be serialized in + little-endian format.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
byte1 byte (8-bits)
signed_byte(n)8-bit, two's complement signed integer for which the value is n
unsigned_byte(n)8-bit unsigned integer for which the value is n
int324 bytes (32-bit signed integer, two's complement)
int648 bytes (64-bit signed integer, two's complement)
uint648 bytes (64-bit unsigned integer)
double8 bytes (64-bit IEEE 754-2008 binary floating point)
decimal12816 bytes (128-bit IEEE 754-2008 decimal floating point)
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
byte1 byte (8-bits)
signed_byte(n)8-bit, two's complement signed integer for which the value is n
unsigned_byte(n)8-bit unsigned integer for which the value is n
int324 bytes (32-bit signed integer, two's complement)
int648 bytes (64-bit signed integer, two's complement)
uint648 bytes (64-bit unsigned integer)
double8 bytes (64-bit IEEE 754-2008 binary floating point)
decimal12816 bytes (128-bit IEEE 754-2008 decimal floating point)
+
-

Non-terminals

+

Non-terminals

-

The following specifies the rest of the BSON - grammar. Note that we use the * operator as - shorthand for repetition (e.g. (byte*2) - is byte byte). When used as a unary - operator, * means that the repetition can - occur 0 or more times.

+

The following specifies the rest of the BSON + grammar. Note that we use the * operator as + shorthand for repetition (e.g. (byte*2) + is byte byte). When used as a unary + operator, * means that the repetition can + occur 0 or more times.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
document::=int32 e_list unsigned_byte(0)BSON Document. int32 is the total number of bytes comprising the document.
e_list::=element e_list
|""
element::=signed_byte(1) e_name double64-bit binary floating point
|signed_byte(2) e_name stringUTF-8 string
|signed_byte(3) e_name documentEmbedded document
|signed_byte(4) e_name documentArray
|signed_byte(5) e_name binaryBinary data
|signed_byte(6) e_nameUndefined (value) — Deprecated
|signed_byte(7) e_name (byte*12)ObjectId
|signed_byte(8) e_name unsigned_byte(0)Boolean - false
|signed_byte(8) e_name unsigned_byte(1)Boolean - true
|signed_byte(9) e_name int64UTC datetime
|signed_byte(10) e_nameNull value
|signed_byte(11) e_name cstring cstringRegular expression - The first cstring is the regex pattern, the second is the regex options string. Options are identified by characters, which must be stored in alphabetical order. Valid options are 'i' for case insensitive matching, 'm' for multiline matching, 'x' for verbose mode, 'l' to make \w, \W, etc. locale dependent, 's' for dotall mode ('.' matches everything), and 'u' to make \w, \W, etc. match unicode.
|signed_byte(12) e_name string (byte*12)DBPointer — Deprecated
|signed_byte(13) e_name stringJavaScript code
|signed_byte(14) e_name string Symbol — Deprecated
|signed_byte(15) e_name code_w_sJavaScript code with scope — Deprecated
|signed_byte(16) e_name int3232-bit integer
|signed_byte(17) e_name uint64Timestamp
|signed_byte(18) e_name int6464-bit integer
|signed_byte(19) e_name decimal128128-bit decimal floating point
|signed_byte(-1) e_nameMin key
|signed_byte(127) e_nameMax key
e_name::=cstringKey name
string::=int32 (byte*) unsigned_byte(0)String - The int32 is the number bytes in the - (byte*) plus one for the trailing null byte. The (byte*) is - zero or more UTF-8 encoded characters.
cstring::=(byte*) unsigned_byte(0)Zero or more modified UTF-8 encoded characters - followed by the null byte. The (byte*) MUST NOT contain - unsigned_byte(0), hence it is not full UTF-8.
binary::=int32 subtype (byte*)Binary - The int32 is the number of bytes in the (byte*).
subtype::=unsigned_byte(0)Generic binary subtype
|unsigned_byte(1)Function
|unsigned_byte(2)Binary (Old)
|unsigned_byte(3)UUID (Old)
|unsigned_byte(4)UUID
|unsigned_byte(5)MD5
|unsigned_byte(6)Encrypted BSON value
|unsigned_byte(7)Compressed BSON column
|unsigned_byte(8)Sensitive
|unsigned_byte(128)—unsigned_byte(255)User defined
code_w_s::=int32 string documentCode with scope — Deprecated
-
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
document::=int32 e_list unsigned_byte(0)BSON Document. int32 is the total number of bytes comprising the document.
e_list::=element e_list
|""
element::=signed_byte(1) e_name double64-bit binary floating point
|signed_byte(2) e_name stringUTF-8 string
|signed_byte(3) e_name documentEmbedded document
|signed_byte(4) e_name documentArray
|signed_byte(5) e_name binaryBinary data
|signed_byte(6) e_nameUndefined (value) — Deprecated
|signed_byte(7) e_name (byte*12)ObjectId
|signed_byte(8) e_name unsigned_byte(0)Boolean - false
|signed_byte(8) e_name unsigned_byte(1)Boolean - true
|signed_byte(9) e_name int64UTC datetime
|signed_byte(10) e_nameNull value
|signed_byte(11) e_name cstring cstringRegular expression - The first cstring is the regex pattern, the second is the regex options string. + Options are identified by characters, which must be stored in alphabetical order. Valid options are 'i' for + case insensitive matching, 'm' for multiline matching, 'x' for verbose mode, 'l' to make \w, \W, etc. locale + dependent, 's' for dotall mode ('.' matches everything), and 'u' to make \w, \W, etc. match unicode.
|signed_byte(12) e_name string (byte*12)DBPointer — Deprecated
|signed_byte(13) e_name stringJavaScript code
|signed_byte(14) e_name string Symbol — Deprecated
|signed_byte(15) e_name code_w_sJavaScript code with scope — Deprecated
|signed_byte(16) e_name int3232-bit integer
|signed_byte(17) e_name uint64Timestamp
|signed_byte(18) e_name int6464-bit integer
|signed_byte(19) e_name decimal128128-bit + decimal floating point
|signed_byte(-1) e_nameMin key
|signed_byte(127) e_nameMax key
e_name::=cstringKey name
string::=int32 (byte*) unsigned_byte(0)String - The int32 is the number bytes in the + (byte*) plus one for the trailing null byte. The (byte*) is + zero or more UTF-8 encoded characters.
cstring::=(byte*) unsigned_byte(0)Zero or more modified UTF-8 encoded characters + followed by the null byte. The (byte*) MUST NOT contain + unsigned_byte(0), hence it is not full UTF-8. +
binary::=int32 subtype (byte*)Binary - The int32 is the number of bytes in the (byte*).
subtype::=unsigned_byte(0)Generic binary subtype
|unsigned_byte(1)Function
|unsigned_byte(2)Binary (Old)
|unsigned_byte(3)UUID (Old)
|unsigned_byte(4)UUID
|unsigned_byte(5)MD5
|unsigned_byte(6)Encrypted + BSON value
|unsigned_byte(7)Compressed BSON column
|unsigned_byte(8)Sensitive
|unsigned_byte(128)—unsigned_byte(255)User defined
code_w_s::=int32 string documentCode with scope — Deprecated
+
+
-

Notes

- - - + + - + + \ No newline at end of file