parsanol 0.10.15 → 0.10.17
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/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
bf1fb62b747b533e929410a9f08e514679e80010
|
|
2
2
|
built with: wasm-pack build --target=nodejs --features wasm (from parsanol-rs/parsanol)
|
|
@@ -39,7 +39,7 @@ class PargArtifactJs {
|
|
|
39
39
|
*/
|
|
40
40
|
entryNames() {
|
|
41
41
|
const ret = wasm.pargartifactjs_entryNames(this.__wbg_ptr);
|
|
42
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1])
|
|
42
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
43
43
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
44
44
|
return v1;
|
|
45
45
|
}
|
|
@@ -54,12 +54,15 @@ class PargArtifactJs {
|
|
|
54
54
|
if (ret[2]) {
|
|
55
55
|
throw takeFromExternrefTable0(ret[1]);
|
|
56
56
|
}
|
|
57
|
-
this.__wbg_ptr = ret[0]
|
|
57
|
+
this.__wbg_ptr = ret[0];
|
|
58
58
|
PargArtifactJsFinalization.register(this, this.__wbg_ptr, this);
|
|
59
59
|
return this;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Parse and bind in one step.
|
|
62
|
+
* Parse and bind in one step: the bound attribute hash as JSON.
|
|
63
|
+
*
|
|
64
|
+
* Returns `{}` when the entry declares no `bindings` block — the
|
|
65
|
+
* parse succeeded, there was simply nothing to bind.
|
|
63
66
|
* @param {string} entry
|
|
64
67
|
* @param {string} input
|
|
65
68
|
* @returns {string}
|
|
@@ -76,37 +79,37 @@ class PargArtifactJs {
|
|
|
76
79
|
return takeFromExternrefTable0(ret[0]);
|
|
77
80
|
}
|
|
78
81
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
82
|
+
* Best-effort recovery (TODO.sota/1): success returns
|
|
83
|
+
* `{"ok": true, "shape": ...}`; failure returns
|
|
84
|
+
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
81
85
|
* @param {string} entry
|
|
82
86
|
* @param {string} input
|
|
83
87
|
* @returns {string}
|
|
84
88
|
*/
|
|
85
|
-
|
|
89
|
+
parseShapeRecovering(entry, input) {
|
|
86
90
|
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
87
91
|
const len0 = WASM_VECTOR_LEN;
|
|
88
92
|
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
89
93
|
const len1 = WASM_VECTOR_LEN;
|
|
90
|
-
const ret = wasm.
|
|
94
|
+
const ret = wasm.pargartifactjs_parseShapeRecovering(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
91
95
|
if (ret[2]) {
|
|
92
96
|
throw takeFromExternrefTable0(ret[1]);
|
|
93
97
|
}
|
|
94
98
|
return takeFromExternrefTable0(ret[0]);
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
101
|
+
* Parse an entry with the native engine; returns the parsanol-shape
|
|
102
|
+
* tree as JSON text.
|
|
100
103
|
* @param {string} entry
|
|
101
104
|
* @param {string} input
|
|
102
105
|
* @returns {string}
|
|
103
106
|
*/
|
|
104
|
-
|
|
107
|
+
parseShape(entry, input) {
|
|
105
108
|
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
106
109
|
const len0 = WASM_VECTOR_LEN;
|
|
107
110
|
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
108
111
|
const len1 = WASM_VECTOR_LEN;
|
|
109
|
-
const ret = wasm.
|
|
112
|
+
const ret = wasm.pargartifactjs_parseShape(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
110
113
|
if (ret[2]) {
|
|
111
114
|
throw takeFromExternrefTable0(ret[1]);
|
|
112
115
|
}
|
|
@@ -125,22 +128,22 @@ class PargArtifactJs {
|
|
|
125
128
|
return takeFromExternrefTable0(ret[0]);
|
|
126
129
|
}
|
|
127
130
|
/**
|
|
128
|
-
* The binding-requirements schema as
|
|
131
|
+
* The binding-requirements schema as TypeScript source.
|
|
129
132
|
* @returns {string}
|
|
130
133
|
*/
|
|
131
|
-
|
|
132
|
-
const ret = wasm.
|
|
134
|
+
schemaTypescript() {
|
|
135
|
+
const ret = wasm.pargartifactjs_schemaTypescript(this.__wbg_ptr);
|
|
133
136
|
if (ret[2]) {
|
|
134
137
|
throw takeFromExternrefTable0(ret[1]);
|
|
135
138
|
}
|
|
136
139
|
return takeFromExternrefTable0(ret[0]);
|
|
137
140
|
}
|
|
138
141
|
/**
|
|
139
|
-
* The binding-requirements schema as
|
|
142
|
+
* The binding-requirements schema as JSON text.
|
|
140
143
|
* @returns {string}
|
|
141
144
|
*/
|
|
142
|
-
|
|
143
|
-
const ret = wasm.
|
|
145
|
+
schema() {
|
|
146
|
+
const ret = wasm.pargartifactjs_schema(this.__wbg_ptr);
|
|
144
147
|
if (ret[2]) {
|
|
145
148
|
throw takeFromExternrefTable0(ret[1]);
|
|
146
149
|
}
|
|
@@ -157,7 +160,6 @@ exports.PargArtifactJs = PargArtifactJs;
|
|
|
157
160
|
*/
|
|
158
161
|
class WasmParser {
|
|
159
162
|
static __wrap(ptr) {
|
|
160
|
-
ptr = ptr >>> 0;
|
|
161
163
|
const obj = Object.create(WasmParser.prototype);
|
|
162
164
|
obj.__wbg_ptr = ptr;
|
|
163
165
|
WasmParserFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -217,7 +219,7 @@ class WasmParser {
|
|
|
217
219
|
if (ret[2]) {
|
|
218
220
|
throw takeFromExternrefTable0(ret[1]);
|
|
219
221
|
}
|
|
220
|
-
this.__wbg_ptr = ret[0]
|
|
222
|
+
this.__wbg_ptr = ret[0];
|
|
221
223
|
WasmParserFinalization.register(this, this.__wbg_ptr, this);
|
|
222
224
|
return this;
|
|
223
225
|
}
|
|
@@ -308,17 +310,23 @@ if (Symbol.dispose) WasmParser.prototype[Symbol.dispose] = WasmParser.prototype.
|
|
|
308
310
|
exports.WasmParser = WasmParser;
|
|
309
311
|
|
|
310
312
|
/**
|
|
311
|
-
*
|
|
313
|
+
* Install the panic hook (better panic messages in the console).
|
|
314
|
+
*
|
|
315
|
+
* The glue's real bootstrap is the DEFAULT export —
|
|
316
|
+
* `__wbg_init(module_or_path?)` / `initSync` — which calls this on
|
|
317
|
+
* its way up; calling it directly is only needed outside the
|
|
318
|
+
* bootstrap. It is deliberately NOT named `init`: that name in the
|
|
319
|
+
* generated d.ts typed the bootstrap as `() => void` and hid the
|
|
320
|
+
* real signatures (rs#308).
|
|
312
321
|
*/
|
|
313
|
-
function
|
|
314
|
-
wasm.
|
|
322
|
+
function setPanicHook() {
|
|
323
|
+
wasm.setPanicHook();
|
|
315
324
|
}
|
|
316
|
-
exports.
|
|
317
|
-
|
|
325
|
+
exports.setPanicHook = setPanicHook;
|
|
318
326
|
function __wbg_get_imports() {
|
|
319
327
|
const import0 = {
|
|
320
328
|
__proto__: null,
|
|
321
|
-
|
|
329
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
322
330
|
const obj = arg1;
|
|
323
331
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
324
332
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -326,10 +334,10 @@ function __wbg_get_imports() {
|
|
|
326
334
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
327
335
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
328
336
|
},
|
|
329
|
-
|
|
337
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
330
338
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
331
339
|
},
|
|
332
|
-
|
|
340
|
+
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
333
341
|
let deferred0_0;
|
|
334
342
|
let deferred0_1;
|
|
335
343
|
try {
|
|
@@ -340,26 +348,26 @@ function __wbg_get_imports() {
|
|
|
340
348
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
341
349
|
}
|
|
342
350
|
},
|
|
343
|
-
|
|
351
|
+
__wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
|
|
344
352
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
345
353
|
}, arguments); },
|
|
346
354
|
__wbg_new_227d7c05414eb861: function() {
|
|
347
355
|
const ret = new Error();
|
|
348
356
|
return ret;
|
|
349
357
|
},
|
|
350
|
-
|
|
351
|
-
const ret = new
|
|
358
|
+
__wbg_new_617a8cdb8bb1130e: function() {
|
|
359
|
+
const ret = new Object();
|
|
352
360
|
return ret;
|
|
353
361
|
},
|
|
354
|
-
|
|
355
|
-
const ret = new
|
|
362
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
363
|
+
const ret = new Array();
|
|
356
364
|
return ret;
|
|
357
365
|
},
|
|
358
|
-
|
|
366
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
359
367
|
const ret = arg0.push(arg1);
|
|
360
368
|
return ret;
|
|
361
369
|
},
|
|
362
|
-
|
|
370
|
+
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
363
371
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
364
372
|
return ret;
|
|
365
373
|
}, arguments); },
|
|
@@ -370,16 +378,16 @@ function __wbg_get_imports() {
|
|
|
370
378
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
371
379
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
372
380
|
},
|
|
373
|
-
|
|
381
|
+
__wbg_stringify_52ff602c1cc4fbb6: function() { return handleError(function (arg0) {
|
|
374
382
|
const ret = JSON.stringify(arg0);
|
|
375
383
|
return ret;
|
|
376
384
|
}, arguments); },
|
|
377
|
-
|
|
385
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
378
386
|
// Cast intrinsic for `F64 -> Externref`.
|
|
379
387
|
const ret = arg0;
|
|
380
388
|
return ret;
|
|
381
389
|
},
|
|
382
|
-
|
|
390
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
383
391
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
384
392
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
385
393
|
return ret;
|
|
@@ -402,10 +410,10 @@ function __wbg_get_imports() {
|
|
|
402
410
|
|
|
403
411
|
const PargArtifactJsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
404
412
|
? { register: () => {}, unregister: () => {} }
|
|
405
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr
|
|
413
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr, 1));
|
|
406
414
|
const WasmParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
407
415
|
? { register: () => {}, unregister: () => {} }
|
|
408
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr
|
|
416
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr, 1));
|
|
409
417
|
|
|
410
418
|
function addToExternrefTable0(obj) {
|
|
411
419
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -451,8 +459,7 @@ function getDataViewMemory0() {
|
|
|
451
459
|
}
|
|
452
460
|
|
|
453
461
|
function getStringFromWasm0(ptr, len) {
|
|
454
|
-
|
|
455
|
-
return decodeText(ptr, len);
|
|
462
|
+
return decodeText(ptr >>> 0, len);
|
|
456
463
|
}
|
|
457
464
|
|
|
458
465
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -543,5 +550,6 @@ let WASM_VECTOR_LEN = 0;
|
|
|
543
550
|
const wasmPath = `${__dirname}/parsanol_bg.wasm`;
|
|
544
551
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
545
552
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
546
|
-
let
|
|
553
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
554
|
+
let wasm = wasmInstance.exports;
|
|
547
555
|
wasm.__wbindgen_start();
|
|
@@ -22,33 +22,36 @@ export class PargArtifactJs {
|
|
|
22
22
|
*/
|
|
23
23
|
constructor(artifact_json: string);
|
|
24
24
|
/**
|
|
25
|
-
* Parse and bind in one step.
|
|
25
|
+
* Parse and bind in one step: the bound attribute hash as JSON.
|
|
26
|
+
*
|
|
27
|
+
* Returns `{}` when the entry declares no `bindings` block — the
|
|
28
|
+
* parse succeeded, there was simply nothing to bind.
|
|
26
29
|
*/
|
|
27
30
|
parseAndBind(entry: string, input: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Parse an entry with the native engine; returns the parsanol-shape
|
|
30
|
-
* tree as JSON text.
|
|
31
|
-
*/
|
|
32
|
-
parseShape(entry: string, input: string): string;
|
|
33
31
|
/**
|
|
34
32
|
* Best-effort recovery (TODO.sota/1): success returns
|
|
35
33
|
* `{"ok": true, "shape": ...}`; failure returns
|
|
36
34
|
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
37
35
|
*/
|
|
38
36
|
parseShapeRecovering(entry: string, input: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Parse an entry with the native engine; returns the parsanol-shape
|
|
39
|
+
* tree as JSON text.
|
|
40
|
+
*/
|
|
41
|
+
parseShape(entry: string, input: string): string;
|
|
39
42
|
/**
|
|
40
43
|
* Run the artifact's embedded tests; returns the failure list as
|
|
41
44
|
* JSON (empty array means green).
|
|
42
45
|
*/
|
|
43
46
|
runTests(): string;
|
|
44
|
-
/**
|
|
45
|
-
* The binding-requirements schema as JSON text.
|
|
46
|
-
*/
|
|
47
|
-
schema(): string;
|
|
48
47
|
/**
|
|
49
48
|
* The binding-requirements schema as TypeScript source.
|
|
50
49
|
*/
|
|
51
50
|
schemaTypescript(): string;
|
|
51
|
+
/**
|
|
52
|
+
* The binding-requirements schema as JSON text.
|
|
53
|
+
*/
|
|
54
|
+
schema(): string;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/**
|
|
@@ -125,6 +128,13 @@ export class WasmParser {
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
/**
|
|
128
|
-
*
|
|
131
|
+
* Install the panic hook (better panic messages in the console).
|
|
132
|
+
*
|
|
133
|
+
* The glue's real bootstrap is the DEFAULT export —
|
|
134
|
+
* `__wbg_init(module_or_path?)` / `initSync` — which calls this on
|
|
135
|
+
* its way up; calling it directly is only needed outside the
|
|
136
|
+
* bootstrap. It is deliberately NOT named `init`: that name in the
|
|
137
|
+
* generated d.ts typed the bootstrap as `() => void` and hid the
|
|
138
|
+
* real signatures (rs#308).
|
|
129
139
|
*/
|
|
130
|
-
export function
|
|
140
|
+
export function setPanicHook(): void;
|
|
Binary file
|
|
@@ -35,12 +35,12 @@ export const parsanol_result_error: (a: number) => number;
|
|
|
35
35
|
export const parsanol_result_free: (a: number) => void;
|
|
36
36
|
export const parsanol_result_success: (a: number) => number;
|
|
37
37
|
export const parsanol_version: () => number;
|
|
38
|
+
export const setPanicHook: () => void;
|
|
38
39
|
export const wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
39
40
|
export const wasmparser_new: (a: number, b: number) => [number, number, number];
|
|
40
41
|
export const wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
|
|
41
42
|
export const wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
|
|
42
43
|
export const wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
43
|
-
export const init: () => void;
|
|
44
44
|
export const parsanol_string_free: (a: number) => void;
|
|
45
45
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
46
46
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|