parsanol 0.10.14 → 0.10.16
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
|
+
e79ff008757846a8fa5ae593b586cb47903e5502
|
|
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]).slice();
|
|
43
43
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
44
44
|
return v1;
|
|
45
45
|
}
|
|
@@ -54,7 +54,7 @@ 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] >>> 0;
|
|
58
58
|
PargArtifactJsFinalization.register(this, this.__wbg_ptr, this);
|
|
59
59
|
return this;
|
|
60
60
|
}
|
|
@@ -76,37 +76,37 @@ class PargArtifactJs {
|
|
|
76
76
|
return takeFromExternrefTable0(ret[0]);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
79
|
+
* Parse an entry with the native engine; returns the parsanol-shape
|
|
80
|
+
* tree as JSON text.
|
|
82
81
|
* @param {string} entry
|
|
83
82
|
* @param {string} input
|
|
84
83
|
* @returns {string}
|
|
85
84
|
*/
|
|
86
|
-
|
|
85
|
+
parseShape(entry, input) {
|
|
87
86
|
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
87
|
const len0 = WASM_VECTOR_LEN;
|
|
89
88
|
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
90
89
|
const len1 = WASM_VECTOR_LEN;
|
|
91
|
-
const ret = wasm.
|
|
90
|
+
const ret = wasm.pargartifactjs_parseShape(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
92
91
|
if (ret[2]) {
|
|
93
92
|
throw takeFromExternrefTable0(ret[1]);
|
|
94
93
|
}
|
|
95
94
|
return takeFromExternrefTable0(ret[0]);
|
|
96
95
|
}
|
|
97
96
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
97
|
+
* Best-effort recovery (TODO.sota/1): success returns
|
|
98
|
+
* `{"ok": true, "shape": ...}`; failure returns
|
|
99
|
+
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
100
100
|
* @param {string} entry
|
|
101
101
|
* @param {string} input
|
|
102
102
|
* @returns {string}
|
|
103
103
|
*/
|
|
104
|
-
|
|
104
|
+
parseShapeRecovering(entry, input) {
|
|
105
105
|
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
106
106
|
const len0 = WASM_VECTOR_LEN;
|
|
107
107
|
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
108
108
|
const len1 = WASM_VECTOR_LEN;
|
|
109
|
-
const ret = wasm.
|
|
109
|
+
const ret = wasm.pargartifactjs_parseShapeRecovering(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
110
110
|
if (ret[2]) {
|
|
111
111
|
throw takeFromExternrefTable0(ret[1]);
|
|
112
112
|
}
|
|
@@ -125,22 +125,22 @@ class PargArtifactJs {
|
|
|
125
125
|
return takeFromExternrefTable0(ret[0]);
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* The binding-requirements schema as
|
|
128
|
+
* The binding-requirements schema as JSON text.
|
|
129
129
|
* @returns {string}
|
|
130
130
|
*/
|
|
131
|
-
|
|
132
|
-
const ret = wasm.
|
|
131
|
+
schema() {
|
|
132
|
+
const ret = wasm.pargartifactjs_schema(this.__wbg_ptr);
|
|
133
133
|
if (ret[2]) {
|
|
134
134
|
throw takeFromExternrefTable0(ret[1]);
|
|
135
135
|
}
|
|
136
136
|
return takeFromExternrefTable0(ret[0]);
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* The binding-requirements schema as
|
|
139
|
+
* The binding-requirements schema as TypeScript source.
|
|
140
140
|
* @returns {string}
|
|
141
141
|
*/
|
|
142
|
-
|
|
143
|
-
const ret = wasm.
|
|
142
|
+
schemaTypescript() {
|
|
143
|
+
const ret = wasm.pargartifactjs_schemaTypescript(this.__wbg_ptr);
|
|
144
144
|
if (ret[2]) {
|
|
145
145
|
throw takeFromExternrefTable0(ret[1]);
|
|
146
146
|
}
|
|
@@ -157,6 +157,7 @@ exports.PargArtifactJs = PargArtifactJs;
|
|
|
157
157
|
*/
|
|
158
158
|
class WasmParser {
|
|
159
159
|
static __wrap(ptr) {
|
|
160
|
+
ptr = ptr >>> 0;
|
|
160
161
|
const obj = Object.create(WasmParser.prototype);
|
|
161
162
|
obj.__wbg_ptr = ptr;
|
|
162
163
|
WasmParserFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -216,7 +217,7 @@ class WasmParser {
|
|
|
216
217
|
if (ret[2]) {
|
|
217
218
|
throw takeFromExternrefTable0(ret[1]);
|
|
218
219
|
}
|
|
219
|
-
this.__wbg_ptr = ret[0];
|
|
220
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
220
221
|
WasmParserFinalization.register(this, this.__wbg_ptr, this);
|
|
221
222
|
return this;
|
|
222
223
|
}
|
|
@@ -313,10 +314,11 @@ function init() {
|
|
|
313
314
|
wasm.init();
|
|
314
315
|
}
|
|
315
316
|
exports.init = init;
|
|
317
|
+
|
|
316
318
|
function __wbg_get_imports() {
|
|
317
319
|
const import0 = {
|
|
318
320
|
__proto__: null,
|
|
319
|
-
|
|
321
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
320
322
|
const obj = arg1;
|
|
321
323
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
322
324
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -324,10 +326,10 @@ function __wbg_get_imports() {
|
|
|
324
326
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
325
327
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
326
328
|
},
|
|
327
|
-
|
|
329
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
328
330
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
329
331
|
},
|
|
330
|
-
|
|
332
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
331
333
|
let deferred0_0;
|
|
332
334
|
let deferred0_1;
|
|
333
335
|
try {
|
|
@@ -338,26 +340,26 @@ function __wbg_get_imports() {
|
|
|
338
340
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
339
341
|
}
|
|
340
342
|
},
|
|
341
|
-
|
|
343
|
+
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
|
|
342
344
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
343
345
|
}, arguments); },
|
|
344
346
|
__wbg_new_227d7c05414eb861: function() {
|
|
345
347
|
const ret = new Error();
|
|
346
348
|
return ret;
|
|
347
349
|
},
|
|
348
|
-
|
|
349
|
-
const ret = new
|
|
350
|
+
__wbg_new_a70fbab9066b301f: function() {
|
|
351
|
+
const ret = new Array();
|
|
350
352
|
return ret;
|
|
351
353
|
},
|
|
352
|
-
|
|
353
|
-
const ret = new
|
|
354
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
355
|
+
const ret = new Object();
|
|
354
356
|
return ret;
|
|
355
357
|
},
|
|
356
|
-
|
|
358
|
+
__wbg_push_e87b0e732085a946: function(arg0, arg1) {
|
|
357
359
|
const ret = arg0.push(arg1);
|
|
358
360
|
return ret;
|
|
359
361
|
},
|
|
360
|
-
|
|
362
|
+
__wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
|
|
361
363
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
362
364
|
return ret;
|
|
363
365
|
}, arguments); },
|
|
@@ -368,16 +370,16 @@ function __wbg_get_imports() {
|
|
|
368
370
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
369
371
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
370
372
|
},
|
|
371
|
-
|
|
373
|
+
__wbg_stringify_5ae93966a84901ac: function() { return handleError(function (arg0) {
|
|
372
374
|
const ret = JSON.stringify(arg0);
|
|
373
375
|
return ret;
|
|
374
376
|
}, arguments); },
|
|
375
|
-
|
|
377
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
376
378
|
// Cast intrinsic for `F64 -> Externref`.
|
|
377
379
|
const ret = arg0;
|
|
378
380
|
return ret;
|
|
379
381
|
},
|
|
380
|
-
|
|
382
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
381
383
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
382
384
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
383
385
|
return ret;
|
|
@@ -400,10 +402,10 @@ function __wbg_get_imports() {
|
|
|
400
402
|
|
|
401
403
|
const PargArtifactJsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
402
404
|
? { register: () => {}, unregister: () => {} }
|
|
403
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr, 1));
|
|
405
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr >>> 0, 1));
|
|
404
406
|
const WasmParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
405
407
|
? { register: () => {}, unregister: () => {} }
|
|
406
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr, 1));
|
|
408
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr >>> 0, 1));
|
|
407
409
|
|
|
408
410
|
function addToExternrefTable0(obj) {
|
|
409
411
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -449,7 +451,8 @@ function getDataViewMemory0() {
|
|
|
449
451
|
}
|
|
450
452
|
|
|
451
453
|
function getStringFromWasm0(ptr, len) {
|
|
452
|
-
|
|
454
|
+
ptr = ptr >>> 0;
|
|
455
|
+
return decodeText(ptr, len);
|
|
453
456
|
}
|
|
454
457
|
|
|
455
458
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -540,6 +543,5 @@ let WASM_VECTOR_LEN = 0;
|
|
|
540
543
|
const wasmPath = `${__dirname}/parsanol_bg.wasm`;
|
|
541
544
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
542
545
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
543
|
-
let
|
|
544
|
-
let wasm = wasmInstance.exports;
|
|
546
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
545
547
|
wasm.__wbindgen_start();
|
|
@@ -25,30 +25,30 @@ export class PargArtifactJs {
|
|
|
25
25
|
* Parse and bind in one step.
|
|
26
26
|
*/
|
|
27
27
|
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;
|
|
28
33
|
/**
|
|
29
34
|
* Best-effort recovery (TODO.sota/1): success returns
|
|
30
35
|
* `{"ok": true, "shape": ...}`; failure returns
|
|
31
36
|
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
32
37
|
*/
|
|
33
38
|
parseShapeRecovering(entry: string, input: string): string;
|
|
34
|
-
/**
|
|
35
|
-
* Parse an entry with the native engine; returns the parsanol-shape
|
|
36
|
-
* tree as JSON text.
|
|
37
|
-
*/
|
|
38
|
-
parseShape(entry: string, input: string): string;
|
|
39
39
|
/**
|
|
40
40
|
* Run the artifact's embedded tests; returns the failure list as
|
|
41
41
|
* JSON (empty array means green).
|
|
42
42
|
*/
|
|
43
43
|
runTests(): string;
|
|
44
|
-
/**
|
|
45
|
-
* The binding-requirements schema as TypeScript source.
|
|
46
|
-
*/
|
|
47
|
-
schemaTypescript(): string;
|
|
48
44
|
/**
|
|
49
45
|
* The binding-requirements schema as JSON text.
|
|
50
46
|
*/
|
|
51
47
|
schema(): string;
|
|
48
|
+
/**
|
|
49
|
+
* The binding-requirements schema as TypeScript source.
|
|
50
|
+
*/
|
|
51
|
+
schemaTypescript(): string;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
Binary file
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_pargartifactjs_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_wasmparser_free: (a: number, b: number) => void;
|
|
6
|
-
export const init: () => void;
|
|
7
6
|
export const pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
8
7
|
export const pargartifactjs_entryNames: (a: number) => [number, number];
|
|
9
8
|
export const pargartifactjs_new: (a: number, b: number) => [number, number, number];
|
|
@@ -12,6 +11,7 @@ export const pargartifactjs_parseShape: (a: number, b: number, c: number, d: num
|
|
|
12
11
|
export const pargartifactjs_parseShapeRecovering: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
13
12
|
export const pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
14
13
|
export const pargartifactjs_schema: (a: number) => [number, number, number];
|
|
14
|
+
export const pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
15
15
|
export const parsanol_c_last_error: () => number;
|
|
16
16
|
export const parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
|
|
17
17
|
export const parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
|
|
@@ -25,6 +25,7 @@ export const parsanol_grammar_root: (a: number) => number;
|
|
|
25
25
|
export const parsanol_parg_error: (a: number, b: number) => number;
|
|
26
26
|
export const parsanol_parg_free: (a: number) => void;
|
|
27
27
|
export const parsanol_parg_parse: (a: number, b: number) => number;
|
|
28
|
+
export const parsanol_parg_parse_recovering: (a: number, b: number, c: number) => number;
|
|
28
29
|
export const parsanol_parse: (a: number, b: number, c: number) => number;
|
|
29
30
|
export const parsanol_parse_end_pos: (a: number, b: number) => number;
|
|
30
31
|
export const parsanol_parse_simple: (a: number, b: number) => number;
|
|
@@ -34,12 +35,12 @@ export const parsanol_result_error: (a: number) => number;
|
|
|
34
35
|
export const parsanol_result_free: (a: number) => void;
|
|
35
36
|
export const parsanol_result_success: (a: number) => number;
|
|
36
37
|
export const parsanol_version: () => number;
|
|
37
|
-
export const pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
38
38
|
export const wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
39
39
|
export const wasmparser_new: (a: number, b: number) => [number, number, number];
|
|
40
40
|
export const wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
|
|
41
41
|
export const wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
|
|
42
42
|
export const wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
43
|
+
export const init: () => void;
|
|
43
44
|
export const parsanol_string_free: (a: number) => void;
|
|
44
45
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
45
46
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|