| 5260 | this._ext_hook = ext_hook; |
| 5261 | } |
| 5262 | value() { |
| 5263 | const c = this._view.getUint8(this.skip(1)); |
| 5264 | if (c >= 0xe0) { |
| 5265 | return c - 0x100; |
| 5266 | } |
| 5267 | if (c < 0xC0) { |
| 5268 | if (c < 0x80) { |
| 5269 | return c; |
| 5270 | } |
| 5271 | if (c < 0x90) { |
| 5272 | return this.map(c - 0x80); |
| 5273 | } |
| 5274 | if (c < 0xa0) { |
| 5275 | return this.array(c - 0x90); |
| 5276 | } |
| 5277 | return this.string(c - 0xa0); |
| 5278 | } |
| 5279 | switch (c) { |
| 5280 | case 0xC0: return null; |
| 5281 | case 0xC2: return false; |
| 5282 | case 0xC3: return true; |
| 5283 | case 0xC4: return this.read(this._view.getUint8(this.skip(1))); |
| 5284 | case 0xC5: return this.read(this._view.getUint16(this.skip(2))); |
| 5285 | case 0xC6: return this.read(this._view.getUint32(this.skip(4))); |
| 5286 | case 0xC7: return this.extension(this._view.getUint8(this.skip(1))); |
| 5287 | case 0xC8: return this.extension(this._view.getUint16(this.skip(2))); |
| 5288 | case 0xC9: return this.extension(this._view.getUint32(this.skip(4))); |
| 5289 | case 0xCA: return this._view.getFloat32(this.skip(4)); |
| 5290 | case 0xCB: return this._view.getFloat64(this.skip(8)); |
| 5291 | case 0xCC: return this._view.getUint8(this.skip(1)); |
| 5292 | case 0xCD: return this._view.getUint16(this.skip(2)); |
| 5293 | case 0xCE: return this._view.getUint32(this.skip(4)); |
| 5294 | case 0xCF: return this._view.getBitUint64(this.skip(8)); |
| 5295 | case 0xD0: return this._view.getInt8(this.skip(1)); |
| 5296 | case 0xD1: return this._view.getInt16(this.skip(2)); |
| 5297 | case 0xD2: return this._view.getInt32(this.skip(4)); |
| 5298 | case 0xD3: return this._view.getBigInt64(this.skip(8)); |
| 5299 | case 0xD4: return this.extension(1); |
| 5300 | case 0xD5: return this.extension(2); |
| 5301 | case 0xD6: return this.extension(4); |
| 5302 | case 0xD7: return this.extension(8); |
| 5303 | case 0xD8: return this.extension(16); |
| 5304 | case 0xD9: return this.string(this._view.getUint8(this.skip(1))); |
| 5305 | case 0xDA: return this.string(this._view.getUint16(this.skip(2))); |
| 5306 | case 0xDB: return this.string(this._view.getUint32(this.skip(4))); |
| 5307 | case 0xDC: return this.array(this._view.getUint16(this.skip(2))); |
| 5308 | case 0xDD: return this.array(this._view.getUint32(this.skip(4))); |
| 5309 | case 0xDE: return this.map(this._view.getUint16(this.skip(2))); |
| 5310 | case 0xDF: return this.map(this._view.getUint32(this.skip(4))); |
| 5311 | default: throw new python.Error(`Invalid code '${c}'.`); |
| 5312 | } |
| 5313 | } |
| 5314 | map(size) { |
| 5315 | const map = {}; |
| 5316 | for (let i = 0; i < size; i++) { |