@parsanol/wasm 0.8.11 → 0.10.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/package.json +1 -1
- package/parsanol.d.ts +71 -2
- package/parsanol.js +197 -20
- package/parsanol_bg.wasm +0 -0
- package/parsanol_bg.wasm.d.ts +16 -2
package/package.json
CHANGED
package/parsanol.d.ts
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A verified PARG artifact exposed to JavaScript: checksum-verified load,
|
|
6
|
+
* native parse, bindings application, embedded-suite runs and the
|
|
7
|
+
* binding-requirements schema (PN 2/4).
|
|
8
|
+
*/
|
|
9
|
+
export class PargArtifactJs {
|
|
10
|
+
free(): void;
|
|
11
|
+
[Symbol.dispose](): void;
|
|
12
|
+
/**
|
|
13
|
+
* Apply an entry's bindings to a parsanol-shape tree (JSON text).
|
|
14
|
+
*/
|
|
15
|
+
applyBindings(entry: string, shape_json: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Declared entry point names, sorted.
|
|
18
|
+
*/
|
|
19
|
+
entryNames(): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Load and checksum-verify an artifact envelope.
|
|
22
|
+
*/
|
|
23
|
+
constructor(artifact_json: string);
|
|
24
|
+
/**
|
|
25
|
+
* Parse and bind in one step.
|
|
26
|
+
*/
|
|
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;
|
|
33
|
+
/**
|
|
34
|
+
* Run the artifact's embedded tests; returns the failure list as
|
|
35
|
+
* JSON (empty array means green).
|
|
36
|
+
*/
|
|
37
|
+
runTests(): string;
|
|
38
|
+
/**
|
|
39
|
+
* The binding-requirements schema as TypeScript source.
|
|
40
|
+
*/
|
|
41
|
+
schemaTypescript(): string;
|
|
42
|
+
/**
|
|
43
|
+
* The binding-requirements schema as JSON text.
|
|
44
|
+
*/
|
|
45
|
+
schema(): string;
|
|
46
|
+
}
|
|
47
|
+
|
|
4
48
|
/**
|
|
5
49
|
* WASM parser instance
|
|
6
50
|
*
|
|
@@ -9,6 +53,17 @@
|
|
|
9
53
|
export class WasmParser {
|
|
10
54
|
free(): void;
|
|
11
55
|
[Symbol.dispose](): void;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new parser from a PARG artifact envelope and entry name.
|
|
58
|
+
*
|
|
59
|
+
* The artifact's canonical checksum is verified before any parsing;
|
|
60
|
+
* a mismatched or corrupt artifact is rejected (PN 2).
|
|
61
|
+
*
|
|
62
|
+
* # Arguments
|
|
63
|
+
* * `artifact_json` - JSON text of the PARG artifact envelope
|
|
64
|
+
* * `entry` - entry point name declared in the artifact
|
|
65
|
+
*/
|
|
66
|
+
static fromArtifact(artifact_json: string, entry: string): WasmParser;
|
|
12
67
|
/**
|
|
13
68
|
* Create a new parser from grammar JSON
|
|
14
69
|
*
|
|
@@ -72,7 +127,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
72
127
|
|
|
73
128
|
export interface InitOutput {
|
|
74
129
|
readonly memory: WebAssembly.Memory;
|
|
130
|
+
readonly __wbg_pargartifactjs_free: (a: number, b: number) => void;
|
|
75
131
|
readonly __wbg_wasmparser_free: (a: number, b: number) => void;
|
|
132
|
+
readonly init: () => void;
|
|
133
|
+
readonly pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
134
|
+
readonly pargartifactjs_entryNames: (a: number) => [number, number];
|
|
135
|
+
readonly pargartifactjs_new: (a: number, b: number) => [number, number, number];
|
|
136
|
+
readonly pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
137
|
+
readonly pargartifactjs_parseShape: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
138
|
+
readonly pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
139
|
+
readonly pargartifactjs_schema: (a: number) => [number, number, number];
|
|
76
140
|
readonly parsanol_c_last_error: () => number;
|
|
77
141
|
readonly parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
|
|
78
142
|
readonly parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
|
|
@@ -83,6 +147,9 @@ export interface InitOutput {
|
|
|
83
147
|
readonly parsanol_grammar_new: (a: number) => number;
|
|
84
148
|
readonly parsanol_grammar_new_with_error: (a: number, b: number) => number;
|
|
85
149
|
readonly parsanol_grammar_root: (a: number) => number;
|
|
150
|
+
readonly parsanol_parg_error: (a: number, b: number) => number;
|
|
151
|
+
readonly parsanol_parg_free: (a: number) => void;
|
|
152
|
+
readonly parsanol_parg_parse: (a: number, b: number) => number;
|
|
86
153
|
readonly parsanol_parse: (a: number, b: number, c: number) => number;
|
|
87
154
|
readonly parsanol_parse_end_pos: (a: number, b: number) => number;
|
|
88
155
|
readonly parsanol_parse_simple: (a: number, b: number) => number;
|
|
@@ -91,13 +158,14 @@ export interface InitOutput {
|
|
|
91
158
|
readonly parsanol_result_error: (a: number) => number;
|
|
92
159
|
readonly parsanol_result_free: (a: number) => void;
|
|
93
160
|
readonly parsanol_result_success: (a: number) => number;
|
|
94
|
-
readonly parsanol_string_free: (a: number) => void;
|
|
95
161
|
readonly parsanol_version: () => number;
|
|
162
|
+
readonly pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
163
|
+
readonly wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
96
164
|
readonly wasmparser_new: (a: number, b: number) => [number, number, number];
|
|
97
165
|
readonly wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
|
|
98
166
|
readonly wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
|
|
99
167
|
readonly wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
100
|
-
readonly
|
|
168
|
+
readonly parsanol_string_free: (a: number) => void;
|
|
101
169
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
102
170
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
103
171
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
@@ -105,6 +173,7 @@ export interface InitOutput {
|
|
|
105
173
|
readonly __externref_table_alloc: () => number;
|
|
106
174
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
107
175
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
176
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
108
177
|
readonly __wbindgen_start: () => void;
|
|
109
178
|
}
|
|
110
179
|
|
package/parsanol.js
CHANGED
|
@@ -1,11 +1,147 @@
|
|
|
1
1
|
/* @ts-self-types="./parsanol.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A verified PARG artifact exposed to JavaScript: checksum-verified load,
|
|
5
|
+
* native parse, bindings application, embedded-suite runs and the
|
|
6
|
+
* binding-requirements schema (PN 2/4).
|
|
7
|
+
*/
|
|
8
|
+
export class PargArtifactJs {
|
|
9
|
+
__destroy_into_raw() {
|
|
10
|
+
const ptr = this.__wbg_ptr;
|
|
11
|
+
this.__wbg_ptr = 0;
|
|
12
|
+
PargArtifactJsFinalization.unregister(this);
|
|
13
|
+
return ptr;
|
|
14
|
+
}
|
|
15
|
+
free() {
|
|
16
|
+
const ptr = this.__destroy_into_raw();
|
|
17
|
+
wasm.__wbg_pargartifactjs_free(ptr, 0);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Apply an entry's bindings to a parsanol-shape tree (JSON text).
|
|
21
|
+
* @param {string} entry
|
|
22
|
+
* @param {string} shape_json
|
|
23
|
+
* @returns {string}
|
|
24
|
+
*/
|
|
25
|
+
applyBindings(entry, shape_json) {
|
|
26
|
+
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
27
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28
|
+
const ptr1 = passStringToWasm0(shape_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29
|
+
const len1 = WASM_VECTOR_LEN;
|
|
30
|
+
const ret = wasm.pargartifactjs_applyBindings(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
31
|
+
if (ret[2]) {
|
|
32
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
33
|
+
}
|
|
34
|
+
return takeFromExternrefTable0(ret[0]);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Declared entry point names, sorted.
|
|
38
|
+
* @returns {string[]}
|
|
39
|
+
*/
|
|
40
|
+
entryNames() {
|
|
41
|
+
const ret = wasm.pargartifactjs_entryNames(this.__wbg_ptr);
|
|
42
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
43
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
44
|
+
return v1;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Load and checksum-verify an artifact envelope.
|
|
48
|
+
* @param {string} artifact_json
|
|
49
|
+
*/
|
|
50
|
+
constructor(artifact_json) {
|
|
51
|
+
const ptr0 = passStringToWasm0(artifact_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
52
|
+
const len0 = WASM_VECTOR_LEN;
|
|
53
|
+
const ret = wasm.pargartifactjs_new(ptr0, len0);
|
|
54
|
+
if (ret[2]) {
|
|
55
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
56
|
+
}
|
|
57
|
+
this.__wbg_ptr = ret[0];
|
|
58
|
+
PargArtifactJsFinalization.register(this, this.__wbg_ptr, this);
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse and bind in one step.
|
|
63
|
+
* @param {string} entry
|
|
64
|
+
* @param {string} input
|
|
65
|
+
* @returns {string}
|
|
66
|
+
*/
|
|
67
|
+
parseAndBind(entry, input) {
|
|
68
|
+
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
69
|
+
const len0 = WASM_VECTOR_LEN;
|
|
70
|
+
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
71
|
+
const len1 = WASM_VECTOR_LEN;
|
|
72
|
+
const ret = wasm.pargartifactjs_parseAndBind(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
73
|
+
if (ret[2]) {
|
|
74
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
75
|
+
}
|
|
76
|
+
return takeFromExternrefTable0(ret[0]);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Parse an entry with the native engine; returns the parsanol-shape
|
|
80
|
+
* tree as JSON text.
|
|
81
|
+
* @param {string} entry
|
|
82
|
+
* @param {string} input
|
|
83
|
+
* @returns {string}
|
|
84
|
+
*/
|
|
85
|
+
parseShape(entry, input) {
|
|
86
|
+
const ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
87
|
+
const len0 = WASM_VECTOR_LEN;
|
|
88
|
+
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
89
|
+
const len1 = WASM_VECTOR_LEN;
|
|
90
|
+
const ret = wasm.pargartifactjs_parseShape(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
91
|
+
if (ret[2]) {
|
|
92
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
93
|
+
}
|
|
94
|
+
return takeFromExternrefTable0(ret[0]);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Run the artifact's embedded tests; returns the failure list as
|
|
98
|
+
* JSON (empty array means green).
|
|
99
|
+
* @returns {string}
|
|
100
|
+
*/
|
|
101
|
+
runTests() {
|
|
102
|
+
const ret = wasm.pargartifactjs_runTests(this.__wbg_ptr);
|
|
103
|
+
if (ret[2]) {
|
|
104
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
105
|
+
}
|
|
106
|
+
return takeFromExternrefTable0(ret[0]);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The binding-requirements schema as TypeScript source.
|
|
110
|
+
* @returns {string}
|
|
111
|
+
*/
|
|
112
|
+
schemaTypescript() {
|
|
113
|
+
const ret = wasm.pargartifactjs_schemaTypescript(this.__wbg_ptr);
|
|
114
|
+
if (ret[2]) {
|
|
115
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
116
|
+
}
|
|
117
|
+
return takeFromExternrefTable0(ret[0]);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The binding-requirements schema as JSON text.
|
|
121
|
+
* @returns {string}
|
|
122
|
+
*/
|
|
123
|
+
schema() {
|
|
124
|
+
const ret = wasm.pargartifactjs_schema(this.__wbg_ptr);
|
|
125
|
+
if (ret[2]) {
|
|
126
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
127
|
+
}
|
|
128
|
+
return takeFromExternrefTable0(ret[0]);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (Symbol.dispose) PargArtifactJs.prototype[Symbol.dispose] = PargArtifactJs.prototype.free;
|
|
132
|
+
|
|
3
133
|
/**
|
|
4
134
|
* WASM parser instance
|
|
5
135
|
*
|
|
6
136
|
* Create with `new WasmParser(grammarJson)` and parse with `parse(input)`.
|
|
7
137
|
*/
|
|
8
138
|
export class WasmParser {
|
|
139
|
+
static __wrap(ptr) {
|
|
140
|
+
const obj = Object.create(WasmParser.prototype);
|
|
141
|
+
obj.__wbg_ptr = ptr;
|
|
142
|
+
WasmParserFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
143
|
+
return obj;
|
|
144
|
+
}
|
|
9
145
|
__destroy_into_raw() {
|
|
10
146
|
const ptr = this.__wbg_ptr;
|
|
11
147
|
this.__wbg_ptr = 0;
|
|
@@ -16,6 +152,30 @@ export class WasmParser {
|
|
|
16
152
|
const ptr = this.__destroy_into_raw();
|
|
17
153
|
wasm.__wbg_wasmparser_free(ptr, 0);
|
|
18
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a new parser from a PARG artifact envelope and entry name.
|
|
157
|
+
*
|
|
158
|
+
* The artifact's canonical checksum is verified before any parsing;
|
|
159
|
+
* a mismatched or corrupt artifact is rejected (PN 2).
|
|
160
|
+
*
|
|
161
|
+
* # Arguments
|
|
162
|
+
* * `artifact_json` - JSON text of the PARG artifact envelope
|
|
163
|
+
* * `entry` - entry point name declared in the artifact
|
|
164
|
+
* @param {string} artifact_json
|
|
165
|
+
* @param {string} entry
|
|
166
|
+
* @returns {WasmParser}
|
|
167
|
+
*/
|
|
168
|
+
static fromArtifact(artifact_json, entry) {
|
|
169
|
+
const ptr0 = passStringToWasm0(artifact_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
170
|
+
const len0 = WASM_VECTOR_LEN;
|
|
171
|
+
const ptr1 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
172
|
+
const len1 = WASM_VECTOR_LEN;
|
|
173
|
+
const ret = wasm.wasmparser_fromArtifact(ptr0, len0, ptr1, len1);
|
|
174
|
+
if (ret[2]) {
|
|
175
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
176
|
+
}
|
|
177
|
+
return WasmParser.__wrap(ret[0]);
|
|
178
|
+
}
|
|
19
179
|
/**
|
|
20
180
|
* Create a new parser from grammar JSON
|
|
21
181
|
*
|
|
@@ -36,7 +196,7 @@ export class WasmParser {
|
|
|
36
196
|
if (ret[2]) {
|
|
37
197
|
throw takeFromExternrefTable0(ret[1]);
|
|
38
198
|
}
|
|
39
|
-
this.__wbg_ptr = ret[0]
|
|
199
|
+
this.__wbg_ptr = ret[0];
|
|
40
200
|
WasmParserFinalization.register(this, this.__wbg_ptr, this);
|
|
41
201
|
return this;
|
|
42
202
|
}
|
|
@@ -131,11 +291,10 @@ if (Symbol.dispose) WasmParser.prototype[Symbol.dispose] = WasmParser.prototype.
|
|
|
131
291
|
export function init() {
|
|
132
292
|
wasm.init();
|
|
133
293
|
}
|
|
134
|
-
|
|
135
294
|
function __wbg_get_imports() {
|
|
136
295
|
const import0 = {
|
|
137
296
|
__proto__: null,
|
|
138
|
-
|
|
297
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
139
298
|
const obj = arg1;
|
|
140
299
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
141
300
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -143,10 +302,10 @@ function __wbg_get_imports() {
|
|
|
143
302
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
144
303
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
145
304
|
},
|
|
146
|
-
|
|
305
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
147
306
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
148
307
|
},
|
|
149
|
-
|
|
308
|
+
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
150
309
|
let deferred0_0;
|
|
151
310
|
let deferred0_1;
|
|
152
311
|
try {
|
|
@@ -157,26 +316,26 @@ function __wbg_get_imports() {
|
|
|
157
316
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
158
317
|
}
|
|
159
318
|
},
|
|
160
|
-
|
|
319
|
+
__wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
|
|
161
320
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
162
321
|
}, arguments); },
|
|
163
322
|
__wbg_new_227d7c05414eb861: function() {
|
|
164
323
|
const ret = new Error();
|
|
165
324
|
return ret;
|
|
166
325
|
},
|
|
167
|
-
|
|
168
|
-
const ret = new
|
|
326
|
+
__wbg_new_617a8cdb8bb1130e: function() {
|
|
327
|
+
const ret = new Object();
|
|
169
328
|
return ret;
|
|
170
329
|
},
|
|
171
|
-
|
|
172
|
-
const ret = new
|
|
330
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
331
|
+
const ret = new Array();
|
|
173
332
|
return ret;
|
|
174
333
|
},
|
|
175
|
-
|
|
334
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
176
335
|
const ret = arg0.push(arg1);
|
|
177
336
|
return ret;
|
|
178
337
|
},
|
|
179
|
-
|
|
338
|
+
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
180
339
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
181
340
|
return ret;
|
|
182
341
|
}, arguments); },
|
|
@@ -187,16 +346,16 @@ function __wbg_get_imports() {
|
|
|
187
346
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
188
347
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
189
348
|
},
|
|
190
|
-
|
|
349
|
+
__wbg_stringify_52ff602c1cc4fbb6: function() { return handleError(function (arg0) {
|
|
191
350
|
const ret = JSON.stringify(arg0);
|
|
192
351
|
return ret;
|
|
193
352
|
}, arguments); },
|
|
194
|
-
|
|
353
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
195
354
|
// Cast intrinsic for `F64 -> Externref`.
|
|
196
355
|
const ret = arg0;
|
|
197
356
|
return ret;
|
|
198
357
|
},
|
|
199
|
-
|
|
358
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
200
359
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
201
360
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
202
361
|
return ret;
|
|
@@ -217,9 +376,12 @@ function __wbg_get_imports() {
|
|
|
217
376
|
};
|
|
218
377
|
}
|
|
219
378
|
|
|
379
|
+
const PargArtifactJsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
380
|
+
? { register: () => {}, unregister: () => {} }
|
|
381
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pargartifactjs_free(ptr, 1));
|
|
220
382
|
const WasmParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
221
383
|
? { register: () => {}, unregister: () => {} }
|
|
222
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr
|
|
384
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmparser_free(ptr, 1));
|
|
223
385
|
|
|
224
386
|
function addToExternrefTable0(obj) {
|
|
225
387
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -227,6 +389,17 @@ function addToExternrefTable0(obj) {
|
|
|
227
389
|
return idx;
|
|
228
390
|
}
|
|
229
391
|
|
|
392
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
393
|
+
ptr = ptr >>> 0;
|
|
394
|
+
const mem = getDataViewMemory0();
|
|
395
|
+
const result = [];
|
|
396
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
397
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
398
|
+
}
|
|
399
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
400
|
+
return result;
|
|
401
|
+
}
|
|
402
|
+
|
|
230
403
|
function getArrayU64FromWasm0(ptr, len) {
|
|
231
404
|
ptr = ptr >>> 0;
|
|
232
405
|
return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
@@ -254,8 +427,7 @@ function getDataViewMemory0() {
|
|
|
254
427
|
}
|
|
255
428
|
|
|
256
429
|
function getStringFromWasm0(ptr, len) {
|
|
257
|
-
|
|
258
|
-
return decodeText(ptr, len);
|
|
430
|
+
return decodeText(ptr >>> 0, len);
|
|
259
431
|
}
|
|
260
432
|
|
|
261
433
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -351,8 +523,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
351
523
|
|
|
352
524
|
let WASM_VECTOR_LEN = 0;
|
|
353
525
|
|
|
354
|
-
let wasmModule, wasm;
|
|
526
|
+
let wasmModule, wasmInstance, wasm;
|
|
355
527
|
function __wbg_finalize_init(instance, module) {
|
|
528
|
+
wasmInstance = instance;
|
|
356
529
|
wasm = instance.exports;
|
|
357
530
|
wasmModule = module;
|
|
358
531
|
cachedBigUint64ArrayMemory0 = null;
|
|
@@ -364,11 +537,15 @@ function __wbg_finalize_init(instance, module) {
|
|
|
364
537
|
|
|
365
538
|
async function __wbg_load(module, imports) {
|
|
366
539
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
540
|
+
if (!module.ok) {
|
|
541
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
542
|
+
}
|
|
543
|
+
|
|
367
544
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
368
545
|
try {
|
|
369
546
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
370
547
|
} catch (e) {
|
|
371
|
-
const validResponse =
|
|
548
|
+
const validResponse = expectedResponseType(module.type);
|
|
372
549
|
|
|
373
550
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
374
551
|
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
package/parsanol_bg.wasm
CHANGED
|
Binary file
|
package/parsanol_bg.wasm.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_pargartifactjs_free: (a: number, b: number) => void;
|
|
4
5
|
export const __wbg_wasmparser_free: (a: number, b: number) => void;
|
|
6
|
+
export const init: () => void;
|
|
7
|
+
export const pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
8
|
+
export const pargartifactjs_entryNames: (a: number) => [number, number];
|
|
9
|
+
export const pargartifactjs_new: (a: number, b: number) => [number, number, number];
|
|
10
|
+
export const pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
11
|
+
export const pargartifactjs_parseShape: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
12
|
+
export const pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
13
|
+
export const pargartifactjs_schema: (a: number) => [number, number, number];
|
|
5
14
|
export const parsanol_c_last_error: () => number;
|
|
6
15
|
export const parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
|
|
7
16
|
export const parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
|
|
@@ -12,6 +21,9 @@ export const parsanol_grammar_free: (a: number) => void;
|
|
|
12
21
|
export const parsanol_grammar_new: (a: number) => number;
|
|
13
22
|
export const parsanol_grammar_new_with_error: (a: number, b: number) => number;
|
|
14
23
|
export const parsanol_grammar_root: (a: number) => number;
|
|
24
|
+
export const parsanol_parg_error: (a: number, b: number) => number;
|
|
25
|
+
export const parsanol_parg_free: (a: number) => void;
|
|
26
|
+
export const parsanol_parg_parse: (a: number, b: number) => number;
|
|
15
27
|
export const parsanol_parse: (a: number, b: number, c: number) => number;
|
|
16
28
|
export const parsanol_parse_end_pos: (a: number, b: number) => number;
|
|
17
29
|
export const parsanol_parse_simple: (a: number, b: number) => number;
|
|
@@ -20,13 +32,14 @@ export const parsanol_result_end_pos: (a: number) => number;
|
|
|
20
32
|
export const parsanol_result_error: (a: number) => number;
|
|
21
33
|
export const parsanol_result_free: (a: number) => void;
|
|
22
34
|
export const parsanol_result_success: (a: number) => number;
|
|
23
|
-
export const parsanol_string_free: (a: number) => void;
|
|
24
35
|
export const parsanol_version: () => number;
|
|
36
|
+
export const pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
37
|
+
export const wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
25
38
|
export const wasmparser_new: (a: number, b: number) => [number, number, number];
|
|
26
39
|
export const wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
|
|
27
40
|
export const wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
|
|
28
41
|
export const wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
29
|
-
export const
|
|
42
|
+
export const parsanol_string_free: (a: number) => void;
|
|
30
43
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
31
44
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
32
45
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
@@ -34,4 +47,5 @@ export const __wbindgen_exn_store: (a: number) => void;
|
|
|
34
47
|
export const __externref_table_alloc: () => number;
|
|
35
48
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
36
49
|
export const __externref_table_dealloc: (a: number) => void;
|
|
50
|
+
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
37
51
|
export const __wbindgen_start: () => void;
|