@parsanol/wasm 0.20.12 → 0.20.14
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 +3 -0
- package/package.json +10 -17
- package/parsanol.d.ts +8 -0
- package/parsanol.js +37 -0
- package/parsanol_bg.wasm +0 -0
- package/parsanol_bg.wasm.d.ts +2 -0
package/README.md
CHANGED
|
@@ -29,6 +29,9 @@ const parg = new PargArtifactJs(artifactJson);
|
|
|
29
29
|
|
|
30
30
|
## Notes
|
|
31
31
|
|
|
32
|
+
- The engine is built with an 8MiB wasm stack
|
|
33
|
+
(`-C link-arg=-zstack-size=8388608`) so deep-recursive parses abort
|
|
34
|
+
with the typed `CallDepthLimitExceeded` instead of trapping.
|
|
32
35
|
- `parseAndBind` returns `{}` when the entry declares no
|
|
33
36
|
`bindings` block — the parse succeeded, nothing was bound.
|
|
34
37
|
- The async bootstrap is the package DEFAULT export
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parsanol/wasm",
|
|
3
|
-
"
|
|
4
|
-
"collaborators": [
|
|
5
|
-
"Ribose Inc. <open.source@ribose.com>"
|
|
6
|
-
],
|
|
3
|
+
"version": "0.20.14",
|
|
7
4
|
"description": "Parsanol PEG parser — WebAssembly bindings",
|
|
8
|
-
"version": "0.20.12",
|
|
9
|
-
"license": "MIT",
|
|
10
5
|
"repository": {
|
|
11
6
|
"type": "git",
|
|
12
7
|
"url": "https://github.com/parsanol/parsanol-rs"
|
|
13
8
|
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"parser",
|
|
11
|
+
"peg",
|
|
12
|
+
"wasm",
|
|
13
|
+
"rust"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"type": "module",
|
|
14
17
|
"files": [
|
|
15
18
|
"parsanol_bg.wasm",
|
|
16
19
|
"parsanol_bg.wasm.d.ts",
|
|
@@ -18,18 +21,8 @@
|
|
|
18
21
|
"parsanol.d.ts",
|
|
19
22
|
"README.md"
|
|
20
23
|
],
|
|
21
|
-
"homepage": "https://github.com/parsanol/parsanol-rs",
|
|
22
|
-
"types": "parsanol.d.ts",
|
|
23
|
-
"sideEffects": [
|
|
24
|
-
"./snippets/*"
|
|
25
|
-
],
|
|
26
|
-
"keywords": [
|
|
27
|
-
"parser",
|
|
28
|
-
"peg",
|
|
29
|
-
"wasm",
|
|
30
|
-
"rust"
|
|
31
|
-
],
|
|
32
24
|
"module": "parsanol.js",
|
|
25
|
+
"types": "parsanol.d.ts",
|
|
33
26
|
"exports": {
|
|
34
27
|
".": {
|
|
35
28
|
"types": "./parsanol.d.ts",
|
package/parsanol.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ export class PargArtifactJs {
|
|
|
49
49
|
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
50
50
|
*/
|
|
51
51
|
parseShapeRecovering(entry: string, input: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Explicit compatibility without changing parseShape defaults.
|
|
54
|
+
* The JSON envelope contains either shape or causal error diagnostics;
|
|
55
|
+
* it does not claim best-effort recovery captures.
|
|
56
|
+
*/
|
|
57
|
+
parseShapeWithCompatibility(entry: string, input: string, compatibility: string): string;
|
|
52
58
|
/**
|
|
53
59
|
* Parse an entry with the native engine; returns the parsanol-shape
|
|
54
60
|
* tree as JSON text.
|
|
@@ -182,6 +188,7 @@ export interface InitOutput {
|
|
|
182
188
|
readonly pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
183
189
|
readonly pargartifactjs_parseShape: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
184
190
|
readonly pargartifactjs_parseShapeRecovering: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
191
|
+
readonly pargartifactjs_parseShapeWithCompatibility: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
185
192
|
readonly pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
186
193
|
readonly pargartifactjs_schema: (a: number) => [number, number, number];
|
|
187
194
|
readonly pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
@@ -200,6 +207,7 @@ export interface InitOutput {
|
|
|
200
207
|
readonly parsanol_parg_free: (a: number) => void;
|
|
201
208
|
readonly parsanol_parg_parse: (a: number, b: number) => number;
|
|
202
209
|
readonly parsanol_parg_parse_recovering: (a: number, b: number, c: number) => number;
|
|
210
|
+
readonly parsanol_parg_parse_with_compatibility: (a: number, b: number, c: number, d: number) => number;
|
|
203
211
|
readonly parsanol_parse: (a: number, b: number, c: number) => number;
|
|
204
212
|
readonly parsanol_parse_end_pos: (a: number, b: number) => number;
|
|
205
213
|
readonly parsanol_parse_simple: (a: number, b: number) => number;
|
package/parsanol.js
CHANGED
|
@@ -150,6 +150,36 @@ export class PargArtifactJs {
|
|
|
150
150
|
}
|
|
151
151
|
return takeFromExternrefTable0(ret[0]);
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Explicit compatibility without changing parseShape defaults.
|
|
155
|
+
* The JSON envelope contains either shape or causal error diagnostics;
|
|
156
|
+
* it does not claim best-effort recovery captures.
|
|
157
|
+
* @param {string} entry
|
|
158
|
+
* @param {string} input
|
|
159
|
+
* @param {string} compatibility
|
|
160
|
+
* @returns {string}
|
|
161
|
+
*/
|
|
162
|
+
parseShapeWithCompatibility(entry, input, compatibility) {
|
|
163
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
164
|
+
try {
|
|
165
|
+
ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
166
|
+
len0 = WASM_VECTOR_LEN;
|
|
167
|
+
ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
168
|
+
len1 = WASM_VECTOR_LEN;
|
|
169
|
+
ptr2 = passStringToWasm0(compatibility, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
170
|
+
len2 = WASM_VECTOR_LEN;
|
|
171
|
+
} catch (e) {
|
|
172
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
173
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
174
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
175
|
+
throw e;
|
|
176
|
+
}
|
|
177
|
+
const ret = wasm.pargartifactjs_parseShapeWithCompatibility(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
178
|
+
if (ret[2]) {
|
|
179
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
180
|
+
}
|
|
181
|
+
return takeFromExternrefTable0(ret[0]);
|
|
182
|
+
}
|
|
153
183
|
/**
|
|
154
184
|
* Parse an entry with the native engine; returns the parsanol-shape
|
|
155
185
|
* tree as JSON text.
|
|
@@ -458,6 +488,10 @@ function __wbg_get_imports() {
|
|
|
458
488
|
const ret = new Array();
|
|
459
489
|
return ret;
|
|
460
490
|
},
|
|
491
|
+
__wbg_new_787b9fb330d55d78: function(arg0, arg1) {
|
|
492
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
493
|
+
return ret;
|
|
494
|
+
},
|
|
461
495
|
__wbg_new_bb74001155cb8ca8: function() {
|
|
462
496
|
const ret = new Error();
|
|
463
497
|
return ret;
|
|
@@ -474,6 +508,9 @@ function __wbg_get_imports() {
|
|
|
474
508
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
475
509
|
return ret;
|
|
476
510
|
}, arguments); },
|
|
511
|
+
__wbg_set_name_822e3903f3184979: function(arg0, arg1, arg2) {
|
|
512
|
+
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
513
|
+
},
|
|
477
514
|
__wbg_stack_575c4e0918581b9c: function(arg0, arg1) {
|
|
478
515
|
const ret = arg1.stack;
|
|
479
516
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
package/parsanol_bg.wasm
CHANGED
|
Binary file
|
package/parsanol_bg.wasm.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const pargartifactjs_new: (a: number, b: number) => [number, number, numb
|
|
|
11
11
|
export const pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
12
12
|
export const pargartifactjs_parseShape: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
13
13
|
export const pargartifactjs_parseShapeRecovering: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
14
|
+
export const pargartifactjs_parseShapeWithCompatibility: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
14
15
|
export const pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
15
16
|
export const pargartifactjs_schema: (a: number) => [number, number, number];
|
|
16
17
|
export const pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
@@ -29,6 +30,7 @@ export const parsanol_parg_error: (a: number, b: number) => number;
|
|
|
29
30
|
export const parsanol_parg_free: (a: number) => void;
|
|
30
31
|
export const parsanol_parg_parse: (a: number, b: number) => number;
|
|
31
32
|
export const parsanol_parg_parse_recovering: (a: number, b: number, c: number) => number;
|
|
33
|
+
export const parsanol_parg_parse_with_compatibility: (a: number, b: number, c: number, d: number) => number;
|
|
32
34
|
export const parsanol_parse: (a: number, b: number, c: number) => number;
|
|
33
35
|
export const parsanol_parse_end_pos: (a: number, b: number) => number;
|
|
34
36
|
export const parsanol_parse_simple: (a: number, b: number) => number;
|