-
Notifications
You must be signed in to change notification settings - Fork 14
/
bson.grammar
231 lines (231 loc) · 12.2 KB
/
bson.grammar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?xml version="1.0" encoding="UTF-8"?>
<ufwb version="1.24">
<grammar name="BSON" start="id:14" author="Kelvin Chung" fileextension="bson">
<description>Grammar for BSON, a binary form similar to JSON</description>
<structure name="BSON Document" id="14" length="Document_Size" encoding="UTF-8" endian="little" signed="no">
<number name="Document_Size" id="15" type="integer" length="4"/>
<structure name="Element" id="17" repeatmax="-1" encoding="ISO_8859-1:1987" endian="big" signed="no" order="variable">
<structref name="Element - Terminator" id="19" repeatmin="0" structure="id:18"/>
<structref name="Element - Floating Point" id="21" repeatmin="0" structure="id:20"/>
<structref name="Element - String" id="23" repeatmin="0" structure="id:22"/>
<structref name="Element - Embedded Document" id="25" repeatmin="0" structure="id:24"/>
<structref name="Element - Array" id="27" repeatmin="0" structure="id:26"/>
<structref name="Element - Binary Data" id="29" repeatmin="0" structure="id:28"/>
<structref name="Element - Undefined (Deprecated)" id="31" repeatmin="0" structure="id:30"/>
<structref name="Element - Object ID" id="33" repeatmin="0" structure="id:32"/>
<structref name="Element - Boolean" id="35" repeatmin="0" structure="id:34"/>
<structref name="Element - UTC datetime" id="37" repeatmin="0" structure="id:36"/>
<structref name="Element - Null" id="39" repeatmin="0" structure="id:38"/>
<structref name="Element - Regular Expression" id="41" repeatmin="0" structure="id:40"/>
<structref name="Element - DBPointer (Deprecated)" id="43" repeatmin="0" structure="id:42"/>
<structref name="Element - JavaScript Code" id="45" repeatmin="0" structure="id:44"/>
<structref name="Element - Symbol (Deprecated)" id="47" repeatmin="0" structure="id:46"/>
<structref name="Element - JavaScript Code with Scope" id="49" repeatmin="0" structure="id:48"/>
<structref name="Element - 32-bit Integer" id="51" repeatmin="0" structure="id:50"/>
<structref name="Element - Timestamp" id="53" repeatmin="0" structure="id:52"/>
<structref name="Element - 64-bit Integer" id="55" repeatmin="0" structure="id:54"/>
<structref name="Element - Min Key" id="57" repeatmin="0" structure="id:56"/>
<structref name="Element - Max Key" id="59" repeatmin="0" structure="id:58"/>
</structure>
</structure>
<structure name="Element Root" id="61" encoding="UTF-8" endian="little" signed="no">
<number name="Type" id="62" type="integer" length="1" display="hex"/>
</structure>
<structure name="Element Non-Terminator" id="64" extends="id:61">
<structref name="Name" id="67" structure="id:66"/>
</structure>
<structure name="Element - Terminator" id="18" extends="id:61">
<number name="Type" mustmatch="yes" id="69" type="integer">
<fixedvalues>
<fixedvalue name="Terminator" value="0x0"/>
</fixedvalues>
</number>
</structure>
<structure name="Element - Floating Point" id="20" extends="id:64">
<number name="Type" mustmatch="yes" id="71" type="integer">
<fixedvalues>
<fixedvalue name="Floating Point" value="0x1"/>
</fixedvalues>
</number>
<number name="Value" id="73" type="float" length="8"/>
</structure>
<structure name="Element - String" id="22" extends="id:64">
<number name="Type" mustmatch="yes" id="75" type="integer">
<fixedvalues>
<fixedvalue name="String" value="0x2"/>
</fixedvalues>
</number>
<structref name="Value" id="78" structure="id:77"/>
</structure>
<structure name="Element - Embedded Document" id="24" extends="id:64">
<number name="Type" mustmatch="yes" id="80" type="integer">
<fixedvalues>
<fixedvalue name="Embedded Document" value="0x3"/>
</fixedvalues>
</number>
<structref name="Document" id="82" structure="id:14"/>
</structure>
<structure name="Element - Array" id="26" extends="id:64">
<number name="Type" mustmatch="yes" id="84" type="integer">
<fixedvalues>
<fixedvalue name="Array" value="0x4"/>
</fixedvalues>
</number>
<structref name="Array" id="86" structure="id:14"/>
</structure>
<structure name="Element - Binary Data" id="28" extends="id:64">
<number name="Type" mustmatch="yes" id="88" type="integer">
<fixedvalues>
<fixedvalue name="Binary Data" value="0x5"/>
</fixedvalues>
</number>
<number name="Length" id="90" type="integer" length="4"/>
<number name="Subtype" mustmatch="yes" id="91" type="integer" length="1" display="hex">
<fixedvalues>
<fixedvalue name="Generic" value="0x0"/>
<fixedvalue name="Function" value="0x1"/>
<fixedvalue name="Generic (Old)" value="0x2"/>
<fixedvalue name="UUID (Old)" value="0x3"/>
<fixedvalue name="UUID" value="0x4"/>
<fixedvalue name="MD5" value="0x5"/>
<fixedvalue name="User-Defined" value="0x80"/>
</fixedvalues>
</number>
<binary name="Data" id="92" length="Length"/>
</structure>
<structure name="Element - Undefined (Deprecated)" id="30" extends="id:64">
<number name="Type" mustmatch="yes" id="94" type="integer">
<fixedvalues>
<fixedvalue name="Undefined" value="0x6"/>
</fixedvalues>
</number>
</structure>
<structure name="Element - Object ID" id="32" extends="id:64">
<number name="Type" mustmatch="yes" id="97" type="integer">
<fixedvalues>
<fixedvalue name="Object ID" value="0x7"/>
</fixedvalues>
</number>
<binary name="Object ID" id="99" length="12"/>
</structure>
<structure name="Element - Boolean" id="34" extends="id:64">
<number name="Type" mustmatch="yes" id="101" type="integer">
<fixedvalues>
<fixedvalue name="Boolean" value="0x8"/>
</fixedvalues>
</number>
<number name="Value" mustmatch="yes" id="103" type="integer" length="1">
<fixedvalues>
<fixedvalue name="False" value="0"/>
<fixedvalue name="True" value="1"/>
</fixedvalues>
</number>
</structure>
<structure name="Element - UTC datetime" id="36" extends="id:64">
<number name="Type" mustmatch="yes" id="105" type="integer">
<fixedvalues>
<fixedvalue name="UTC datetime" value="0x9"/>
</fixedvalues>
</number>
<number name="Value" id="107" type="integer" length="8"/>
</structure>
<structure name="Element - Null" id="38" extends="id:64">
<number name="Type" mustmatch="yes" id="109" type="integer">
<fixedvalues>
<fixedvalue name="Null" value="0xA"/>
</fixedvalues>
</number>
</structure>
<structure name="Element - Regular Expression" id="40" extends="id:64">
<number name="Type" mustmatch="yes" id="112" type="integer">
<fixedvalues>
<fixedvalue name="Regular Expression" value="0xB"/>
</fixedvalues>
</number>
<structref name="Pattern" id="114" structure="id:66"/>
<structref name="Options" id="115" structure="id:66"/>
</structure>
<structure name="Element - DBPointer (Deprecated)" id="42" extends="id:64">
<number name="Type" mustmatch="yes" id="117" type="integer">
<fixedvalues>
<fixedvalue name="DBPointer" value="0xC"/>
</fixedvalues>
</number>
<binary name="Pointer" id="119" length="12"/>
</structure>
<structure name="Element - JavaScript Code" id="44" extends="id:64">
<number name="Type" mustmatch="yes" id="121" type="integer">
<fixedvalues>
<fixedvalue name="JavaScript Code" value="0xD"/>
</fixedvalues>
</number>
<structref name="Code" id="123" structure="id:77"/>
</structure>
<structure name="Element - Symbol (Deprecated)" id="46" extends="id:64">
<number name="Type" mustmatch="yes" id="125" type="integer">
<fixedvalues>
<fixedvalue name="Symbol" value="0xE"/>
</fixedvalues>
</number>
<structref name="Symbol" id="127" structure="id:77"/>
</structure>
<structure name="Element - JavaScript Code with Scope" id="48" extends="id:64">
<number name="Type" mustmatch="yes" id="129" type="integer">
<fixedvalues>
<fixedvalue name="JavaScript Code with Scope" value="0xF"/>
</fixedvalues>
</number>
<structref name="Code With Scope" id="132" structure="id:131"/>
</structure>
<structure name="Element - 32-bit Integer" id="50" extends="id:64">
<number name="Type" mustmatch="yes" id="134" type="integer">
<fixedvalues>
<fixedvalue name="32-bit Integer" value="0x10"/>
</fixedvalues>
</number>
<number name="Value" id="136" type="integer" length="4"/>
</structure>
<structure name="Element - Timestamp" id="52" extends="id:64">
<number name="Type" mustmatch="yes" id="138" type="integer">
<fixedvalues>
<fixedvalue name="Timestamp" value="0x11"/>
</fixedvalues>
</number>
<number name="Timestamp" id="140" type="integer" length="8"/>
</structure>
<structure name="Element - 64-bit Integer" id="54" extends="id:64">
<number name="Type" mustmatch="yes" id="142" type="integer">
<fixedvalues>
<fixedvalue name="64-bit Integer" value="0x12"/>
</fixedvalues>
</number>
<number name="<new number>" id="144" type="integer" length="8"/>
</structure>
<structure name="Element - Min Key" id="56" extends="id:64">
<number name="Type" mustmatch="yes" id="146" type="integer">
<fixedvalues>
<fixedvalue name="Min Key" value="0xFF"/>
</fixedvalues>
</number>
</structure>
<structure name="Element - Max Key" id="58" extends="id:64">
<number name="Type" mustmatch="yes" id="149" type="integer">
<fixedvalues>
<fixedvalue name="Max Key" value="0x7F"/>
</fixedvalues>
</number>
</structure>
<structure name="CString" id="66" encoding="UTF-8" endian="little" signed="no">
<string name="Value" id="152" type="zero-terminated"/>
</structure>
<structure name="String" id="77" encoding="UTF-8" endian="little" signed="no">
<number name="Length" id="154" type="integer" length="4"/>
<string name="Value" id="155" type="fixed-length" length="Length"/>
</structure>
<structure name="Code With Scope" id="131" length="Length" encoding="UTF-8" endian="little" signed="no">
<number name="Length" id="157" type="integer" length="1"/>
<structref name="Code" id="158" structure="id:77"/>
<structref name="Scope" id="159" structure="id:14"/>
</structure>
</grammar>
</ufwb>