bq2cst 0.4.32 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/bq2cst.d.ts +4 -3
- package/bq2cst.js +43 -33
- package/bq2cst_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# bq2cst
|
|
2
2
|
Parse standard SQL, which is a dialect of [BigQuery](https://cloud.google.com/bigquery), into a concrete syntax tree.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
> [!WARNING]
|
|
5
|
+
> This parser is designed to be used via [prettier-plugin-bq](https://github.com/dr666m1/prettier-plugin-bq).
|
|
5
6
|
|
|
6
7
|
## Features
|
|
7
8
|
- forcused on standard SQL (in other words, other SQL dialects are out of scope)
|
package/bq2cst.d.ts
CHANGED
|
@@ -38,12 +38,12 @@ export type UnknownNode =
|
|
|
38
38
|
| Comment
|
|
39
39
|
| Constraint
|
|
40
40
|
| CreateFunctionStatement
|
|
41
|
+
| CreateIndexStatement
|
|
41
42
|
| CreateModelStatement
|
|
42
43
|
| CreateProcedureStatement
|
|
43
44
|
| CreateReservationStatement
|
|
44
45
|
| CreateRowAccessPolicyStatement
|
|
45
46
|
| CreateSchemaStatement
|
|
46
|
-
| CreateSearchIndexStatement
|
|
47
47
|
| CreateTableStatement
|
|
48
48
|
| CreateViewStatement
|
|
49
49
|
| DeclareStatement
|
|
@@ -653,9 +653,10 @@ export type CreateSchemaStatement = XXXStatement & {
|
|
|
653
653
|
};
|
|
654
654
|
};
|
|
655
655
|
|
|
656
|
-
export type
|
|
657
|
-
node_type: "
|
|
656
|
+
export type CreateIndexStatement = XXXStatement & {
|
|
657
|
+
node_type: "CreateIndexStatement";
|
|
658
658
|
children: {
|
|
659
|
+
or_replace?: NodeVecChild;
|
|
659
660
|
what: NodeChild;
|
|
660
661
|
if_not_exists?: NodeVecChild;
|
|
661
662
|
ident: NodeChild;
|
package/bq2cst.js
CHANGED
|
@@ -3,7 +3,7 @@ imports['__wbindgen_placeholder__'] = module.exports;
|
|
|
3
3
|
let wasm;
|
|
4
4
|
const { TextDecoder, TextEncoder } = require(`util`);
|
|
5
5
|
|
|
6
|
-
const heap = new Array(
|
|
6
|
+
const heap = new Array(128).fill(undefined);
|
|
7
7
|
|
|
8
8
|
heap.push(undefined, null, true, false);
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ function getObject(idx) { return heap[idx]; }
|
|
|
12
12
|
let heap_next = heap.length;
|
|
13
13
|
|
|
14
14
|
function dropObject(idx) {
|
|
15
|
-
if (idx <
|
|
15
|
+
if (idx < 132) return;
|
|
16
16
|
heap[idx] = heap_next;
|
|
17
17
|
heap_next = idx;
|
|
18
18
|
}
|
|
@@ -23,32 +23,33 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function addHeapObject(obj) {
|
|
27
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
+
const idx = heap_next;
|
|
29
|
+
heap_next = heap[idx];
|
|
30
|
+
|
|
31
|
+
heap[idx] = obj;
|
|
32
|
+
return idx;
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
27
36
|
|
|
28
37
|
cachedTextDecoder.decode();
|
|
29
38
|
|
|
30
|
-
let cachedUint8Memory0 =
|
|
39
|
+
let cachedUint8Memory0 = null;
|
|
31
40
|
|
|
32
41
|
function getUint8Memory0() {
|
|
33
|
-
if (cachedUint8Memory0.byteLength === 0) {
|
|
42
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
34
43
|
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
35
44
|
}
|
|
36
45
|
return cachedUint8Memory0;
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
function getStringFromWasm0(ptr, len) {
|
|
49
|
+
ptr = ptr >>> 0;
|
|
40
50
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
function addHeapObject(obj) {
|
|
44
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
45
|
-
const idx = heap_next;
|
|
46
|
-
heap_next = heap[idx];
|
|
47
|
-
|
|
48
|
-
heap[idx] = obj;
|
|
49
|
-
return idx;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
53
|
function debugString(val) {
|
|
53
54
|
// primitive types
|
|
54
55
|
const type = typeof val;
|
|
@@ -135,14 +136,14 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
135
136
|
|
|
136
137
|
if (realloc === undefined) {
|
|
137
138
|
const buf = cachedTextEncoder.encode(arg);
|
|
138
|
-
const ptr = malloc(buf.length);
|
|
139
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
139
140
|
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
140
141
|
WASM_VECTOR_LEN = buf.length;
|
|
141
142
|
return ptr;
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
let len = arg.length;
|
|
145
|
-
let ptr = malloc(len);
|
|
146
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
146
147
|
|
|
147
148
|
const mem = getUint8Memory0();
|
|
148
149
|
|
|
@@ -158,7 +159,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
158
159
|
if (offset !== 0) {
|
|
159
160
|
arg = arg.slice(offset);
|
|
160
161
|
}
|
|
161
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
162
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
162
163
|
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
163
164
|
const ret = encodeString(arg, view);
|
|
164
165
|
|
|
@@ -169,10 +170,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
169
170
|
return ptr;
|
|
170
171
|
}
|
|
171
172
|
|
|
172
|
-
let cachedInt32Memory0 =
|
|
173
|
+
let cachedInt32Memory0 = null;
|
|
173
174
|
|
|
174
175
|
function getInt32Memory0() {
|
|
175
|
-
if (cachedInt32Memory0.byteLength === 0) {
|
|
176
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
176
177
|
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
177
178
|
}
|
|
178
179
|
return cachedInt32Memory0;
|
|
@@ -225,6 +226,16 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
225
226
|
takeObject(arg0);
|
|
226
227
|
};
|
|
227
228
|
|
|
229
|
+
module.exports.__wbindgen_as_number = function(arg0) {
|
|
230
|
+
const ret = +getObject(arg0);
|
|
231
|
+
return ret;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
235
|
+
const ret = getObject(arg0);
|
|
236
|
+
return addHeapObject(ret);
|
|
237
|
+
};
|
|
238
|
+
|
|
228
239
|
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
229
240
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
230
241
|
return addHeapObject(ret);
|
|
@@ -237,25 +248,24 @@ module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
|
237
248
|
|
|
238
249
|
module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
239
250
|
const ret = getObject(arg1).stack;
|
|
240
|
-
const
|
|
241
|
-
const
|
|
242
|
-
getInt32Memory0()[arg0 / 4 + 1] =
|
|
243
|
-
getInt32Memory0()[arg0 / 4 + 0] =
|
|
251
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
252
|
+
const len1 = WASM_VECTOR_LEN;
|
|
253
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
254
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
244
255
|
};
|
|
245
256
|
|
|
246
257
|
module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
258
|
+
let deferred0_0;
|
|
259
|
+
let deferred0_1;
|
|
247
260
|
try {
|
|
261
|
+
deferred0_0 = arg0;
|
|
262
|
+
deferred0_1 = arg1;
|
|
248
263
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
249
264
|
} finally {
|
|
250
|
-
wasm.__wbindgen_free(
|
|
265
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
251
266
|
}
|
|
252
267
|
};
|
|
253
268
|
|
|
254
|
-
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
255
|
-
const ret = getObject(arg0);
|
|
256
|
-
return addHeapObject(ret);
|
|
257
|
-
};
|
|
258
|
-
|
|
259
269
|
module.exports.__wbindgen_number_new = function(arg0) {
|
|
260
270
|
const ret = arg0;
|
|
261
271
|
return addHeapObject(ret);
|
|
@@ -271,7 +281,7 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
271
281
|
return addHeapObject(ret);
|
|
272
282
|
};
|
|
273
283
|
|
|
274
|
-
module.exports.
|
|
284
|
+
module.exports.__wbg_set_9182712abebf82ef = function(arg0, arg1, arg2) {
|
|
275
285
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
276
286
|
};
|
|
277
287
|
|
|
@@ -306,10 +316,10 @@ module.exports.__wbg_set_933729cf5b66ac11 = function(arg0, arg1, arg2) {
|
|
|
306
316
|
|
|
307
317
|
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
308
318
|
const ret = debugString(getObject(arg1));
|
|
309
|
-
const
|
|
310
|
-
const
|
|
311
|
-
getInt32Memory0()[arg0 / 4 + 1] =
|
|
312
|
-
getInt32Memory0()[arg0 / 4 + 0] =
|
|
319
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
320
|
+
const len1 = WASM_VECTOR_LEN;
|
|
321
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
322
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
313
323
|
};
|
|
314
324
|
|
|
315
325
|
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
package/bq2cst_bg.wasm
CHANGED
|
Binary file
|