@parsanol/wasm 0.20.0 → 0.20.2

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
@@ -5,7 +5,7 @@
5
5
  "Ribose Inc. <open.source@ribose.com>"
6
6
  ],
7
7
  "description": "Parsanol PEG parser — WebAssembly bindings",
8
- "version": "0.20.0",
8
+ "version": "0.20.2",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/parsanol.d.ts CHANGED
@@ -16,6 +16,14 @@
16
16
  export class PargArtifactJs {
17
17
  free(): void;
18
18
  [Symbol.dispose](): void;
19
+ /**
20
+ * Apply an entry's DECLARED bindings artifact (parsanol-ruby#432)
21
+ * to a parsanol-shape tree. The bindings artifact is verified
22
+ * (kind, checksum, `ts` target, binding version) and pair-checked
23
+ * against this parse artifact by grammar source hash before the
24
+ * shared apply core runs.
25
+ */
26
+ applyBindingsArtifact(bindings_json: string, entry: string, shape_json: string): string;
19
27
  /**
20
28
  * Apply an entry's bindings to a parsanol-shape tree (JSON text).
21
29
  */
@@ -168,6 +176,7 @@ export interface InitOutput {
168
176
  readonly __wbg_wasmparser_free: (a: number, b: number) => void;
169
177
  readonly compileSource: (a: number, b: number) => [number, number, number, number];
170
178
  readonly pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
179
+ readonly pargartifactjs_applyBindingsArtifact: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
171
180
  readonly pargartifactjs_entryNames: (a: number) => [number, number];
172
181
  readonly pargartifactjs_new: (a: number, b: number) => [number, number, number];
173
182
  readonly pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
package/parsanol.js CHANGED
@@ -16,6 +16,38 @@ export class PargArtifactJs {
16
16
  const ptr = this.__destroy_into_raw();
17
17
  wasm.__wbg_pargartifactjs_free(ptr, 0);
18
18
  }
19
+ /**
20
+ * Apply an entry's DECLARED bindings artifact (parsanol-ruby#432)
21
+ * to a parsanol-shape tree. The bindings artifact is verified
22
+ * (kind, checksum, `ts` target, binding version) and pair-checked
23
+ * against this parse artifact by grammar source hash before the
24
+ * shared apply core runs.
25
+ * @param {string} bindings_json
26
+ * @param {string} entry
27
+ * @param {string} shape_json
28
+ * @returns {string}
29
+ */
30
+ applyBindingsArtifact(bindings_json, entry, shape_json) {
31
+ let ptr0, len0, ptr1, len1, ptr2, len2;
32
+ try {
33
+ ptr0 = passStringToWasm0(bindings_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
34
+ len0 = WASM_VECTOR_LEN;
35
+ ptr1 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
36
+ len1 = WASM_VECTOR_LEN;
37
+ ptr2 = passStringToWasm0(shape_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
38
+ len2 = WASM_VECTOR_LEN;
39
+ } catch (e) {
40
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
41
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
42
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
43
+ throw e;
44
+ }
45
+ const ret = wasm.pargartifactjs_applyBindingsArtifact(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
46
+ if (ret[2]) {
47
+ throw takeFromExternrefTable0(ret[1]);
48
+ }
49
+ return takeFromExternrefTable0(ret[0]);
50
+ }
19
51
  /**
20
52
  * Apply an entry's bindings to a parsanol-shape tree (JSON text).
21
53
  * @param {string} entry
package/parsanol_bg.wasm CHANGED
Binary file
@@ -5,6 +5,7 @@ export const __wbg_pargartifactjs_free: (a: number, b: number) => void;
5
5
  export const __wbg_wasmparser_free: (a: number, b: number) => void;
6
6
  export const compileSource: (a: number, b: number) => [number, number, number, number];
7
7
  export const pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
8
+ export const pargartifactjs_applyBindingsArtifact: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
8
9
  export const pargartifactjs_entryNames: (a: number) => [number, number];
9
10
  export const pargartifactjs_new: (a: number, b: number) => [number, number, number];
10
11
  export const pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];