parsanol 0.10.29 → 0.10.30
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/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +6 -0
- package/package.json +1 -1
- package/vendor/parsanol-wasm/BUILT_FROM +1 -1
- package/vendor/parsanol-wasm/parsanol.cjs +92 -46
- package/vendor/parsanol-wasm/parsanol.d.ts +7 -0
- package/vendor/parsanol-wasm/parsanol_bg.wasm +0 -0
- package/vendor/parsanol-wasm/parsanol_bg.wasm.d.ts +1 -0
package/dist/runtime.d.ts
CHANGED
|
@@ -40,6 +40,11 @@ export declare class PargRuntime {
|
|
|
40
40
|
readonly sourceHash: string | null;
|
|
41
41
|
readonly compilerVersion: string | null;
|
|
42
42
|
readonly source: string | null;
|
|
43
|
+
/** ruby#377 semantics fingerprint: stable across producer metadata
|
|
44
|
+
* (compiler_version, unicode_tables), so gates can tell "re-baked by
|
|
45
|
+
* a newer compiler" from "the grammar changed". Null for artifacts
|
|
46
|
+
* baked before the field existed (parsanol >= 1.3.117 / rs 0.19.14). */
|
|
47
|
+
readonly semanticsHash: string | null;
|
|
43
48
|
readonly envelope: Record<string, unknown>;
|
|
44
49
|
constructor(artifactJson: string, entry?: string);
|
|
45
50
|
/** The wire-format family ("parsanol-tree/v2"): a shape bump requires a
|
package/dist/runtime.js
CHANGED
|
@@ -60,6 +60,11 @@ export class PargRuntime {
|
|
|
60
60
|
sourceHash;
|
|
61
61
|
compilerVersion;
|
|
62
62
|
source;
|
|
63
|
+
/** ruby#377 semantics fingerprint: stable across producer metadata
|
|
64
|
+
* (compiler_version, unicode_tables), so gates can tell "re-baked by
|
|
65
|
+
* a newer compiler" from "the grammar changed". Null for artifacts
|
|
66
|
+
* baked before the field existed (parsanol >= 1.3.117 / rs 0.19.14). */
|
|
67
|
+
semanticsHash;
|
|
63
68
|
envelope;
|
|
64
69
|
constructor(artifactJson, entry) {
|
|
65
70
|
const parsed = JSON.parse(artifactJson);
|
|
@@ -83,6 +88,7 @@ export class PargRuntime {
|
|
|
83
88
|
this.sourceHash = parsed["source_hash"] ?? null;
|
|
84
89
|
this.compilerVersion = parsed["compiler_version"] ?? null;
|
|
85
90
|
this.source = parsed["source"] ?? null;
|
|
91
|
+
this.semanticsHash = parsed["semantics_hash"] ?? null;
|
|
86
92
|
this.entry = entry ?? this.defaultEntry ?? this.artifact.entryNames()[0];
|
|
87
93
|
}
|
|
88
94
|
/** The wire-format family ("parsanol-tree/v2"): a shape bump requires a
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
9c472247d315107a175c71e7eadddb819a36752f
|
|
2
2
|
built with: wasm-pack build --target=nodejs --features wasm (from parsanol-rs/parsanol)
|
|
@@ -23,10 +23,17 @@ class PargArtifactJs {
|
|
|
23
23
|
* @returns {string}
|
|
24
24
|
*/
|
|
25
25
|
applyBindings(entry, shape_json) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
let ptr0, len0, ptr1, len1;
|
|
27
|
+
try {
|
|
28
|
+
ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
29
|
+
len0 = WASM_VECTOR_LEN;
|
|
30
|
+
ptr1 = passStringToWasm0(shape_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
31
|
+
len1 = WASM_VECTOR_LEN;
|
|
32
|
+
} catch (e) {
|
|
33
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
34
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
30
37
|
const ret = wasm.pargartifactjs_applyBindings(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
31
38
|
if (ret[2]) {
|
|
32
39
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -68,10 +75,17 @@ class PargArtifactJs {
|
|
|
68
75
|
* @returns {string}
|
|
69
76
|
*/
|
|
70
77
|
parseAndBind(entry, input) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
let ptr0, len0, ptr1, len1;
|
|
79
|
+
try {
|
|
80
|
+
ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
81
|
+
len0 = WASM_VECTOR_LEN;
|
|
82
|
+
ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
83
|
+
len1 = WASM_VECTOR_LEN;
|
|
84
|
+
} catch (e) {
|
|
85
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
86
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
87
|
+
throw e;
|
|
88
|
+
}
|
|
75
89
|
const ret = wasm.pargartifactjs_parseAndBind(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
76
90
|
if (ret[2]) {
|
|
77
91
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -87,10 +101,17 @@ class PargArtifactJs {
|
|
|
87
101
|
* @returns {string}
|
|
88
102
|
*/
|
|
89
103
|
parseShapeRecovering(entry, input) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
let ptr0, len0, ptr1, len1;
|
|
105
|
+
try {
|
|
106
|
+
ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
107
|
+
len0 = WASM_VECTOR_LEN;
|
|
108
|
+
ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
109
|
+
len1 = WASM_VECTOR_LEN;
|
|
110
|
+
} catch (e) {
|
|
111
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
112
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
113
|
+
throw e;
|
|
114
|
+
}
|
|
94
115
|
const ret = wasm.pargartifactjs_parseShapeRecovering(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
95
116
|
if (ret[2]) {
|
|
96
117
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -105,10 +126,17 @@ class PargArtifactJs {
|
|
|
105
126
|
* @returns {string}
|
|
106
127
|
*/
|
|
107
128
|
parseShape(entry, input) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
129
|
+
let ptr0, len0, ptr1, len1;
|
|
130
|
+
try {
|
|
131
|
+
ptr0 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
132
|
+
len0 = WASM_VECTOR_LEN;
|
|
133
|
+
ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
134
|
+
len1 = WASM_VECTOR_LEN;
|
|
135
|
+
} catch (e) {
|
|
136
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
137
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
138
|
+
throw e;
|
|
139
|
+
}
|
|
112
140
|
const ret = wasm.pargartifactjs_parseShape(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
113
141
|
if (ret[2]) {
|
|
114
142
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -149,6 +177,17 @@ class PargArtifactJs {
|
|
|
149
177
|
}
|
|
150
178
|
return takeFromExternrefTable0(ret[0]);
|
|
151
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* The semantics hash (ruby#377): sha256 over the canonicalized
|
|
182
|
+
* envelope minus the producer set — byte-stable across re-bakes
|
|
183
|
+
* by a newer compiler when the grammar is unchanged. `undefined`
|
|
184
|
+
* on artifacts baked before the field existed.
|
|
185
|
+
* @returns {string | undefined}
|
|
186
|
+
*/
|
|
187
|
+
semanticsHash() {
|
|
188
|
+
const ret = wasm.pargartifactjs_semanticsHash(this.__wbg_ptr);
|
|
189
|
+
return ret;
|
|
190
|
+
}
|
|
152
191
|
}
|
|
153
192
|
if (Symbol.dispose) PargArtifactJs.prototype[Symbol.dispose] = PargArtifactJs.prototype.free;
|
|
154
193
|
exports.PargArtifactJs = PargArtifactJs;
|
|
@@ -189,10 +228,17 @@ class WasmParser {
|
|
|
189
228
|
* @returns {WasmParser}
|
|
190
229
|
*/
|
|
191
230
|
static fromArtifact(artifact_json, entry) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
231
|
+
let ptr0, len0, ptr1, len1;
|
|
232
|
+
try {
|
|
233
|
+
ptr0 = passStringToWasm0(artifact_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
234
|
+
len0 = WASM_VECTOR_LEN;
|
|
235
|
+
ptr1 = passStringToWasm0(entry, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
236
|
+
len1 = WASM_VECTOR_LEN;
|
|
237
|
+
} catch (e) {
|
|
238
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
239
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
240
|
+
throw e;
|
|
241
|
+
}
|
|
196
242
|
const ret = wasm.wasmparser_fromArtifact(ptr0, len0, ptr1, len1);
|
|
197
243
|
if (ret[2]) {
|
|
198
244
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -355,15 +401,15 @@ exports.setPanicHook = setPanicHook;
|
|
|
355
401
|
function __wbg_get_imports() {
|
|
356
402
|
const import0 = {
|
|
357
403
|
__proto__: null,
|
|
358
|
-
|
|
404
|
+
__wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
|
|
359
405
|
const obj = arg1;
|
|
360
406
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
361
407
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
362
408
|
var len1 = WASM_VECTOR_LEN;
|
|
363
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
364
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
409
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
410
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
365
411
|
},
|
|
366
|
-
|
|
412
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
367
413
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
368
414
|
},
|
|
369
415
|
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
@@ -377,37 +423,37 @@ function __wbg_get_imports() {
|
|
|
377
423
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
378
424
|
}
|
|
379
425
|
},
|
|
380
|
-
|
|
426
|
+
__wbg_getRandomValues_5d8c030b527203a6: function() { return handleError(function (arg0, arg1) {
|
|
381
427
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
382
428
|
}, arguments); },
|
|
383
|
-
|
|
384
|
-
const ret = new
|
|
429
|
+
__wbg_new_37eb45aaf5eeb820: function() {
|
|
430
|
+
const ret = new Array();
|
|
385
431
|
return ret;
|
|
386
432
|
},
|
|
387
|
-
|
|
388
|
-
const ret = new
|
|
433
|
+
__wbg_new_bb74001155cb8ca8: function() {
|
|
434
|
+
const ret = new Error();
|
|
389
435
|
return ret;
|
|
390
436
|
},
|
|
391
|
-
|
|
392
|
-
const ret = new
|
|
437
|
+
__wbg_new_cd4348290afae586: function() {
|
|
438
|
+
const ret = new Object();
|
|
393
439
|
return ret;
|
|
394
440
|
},
|
|
395
|
-
|
|
441
|
+
__wbg_push_c9f4893fc209f768: function(arg0, arg1) {
|
|
396
442
|
const ret = arg0.push(arg1);
|
|
397
443
|
return ret;
|
|
398
444
|
},
|
|
399
|
-
|
|
445
|
+
__wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
|
|
400
446
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
401
447
|
return ret;
|
|
402
448
|
}, arguments); },
|
|
403
|
-
|
|
449
|
+
__wbg_stack_575c4e0918581b9c: function(arg0, arg1) {
|
|
404
450
|
const ret = arg1.stack;
|
|
405
451
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
406
452
|
const len1 = WASM_VECTOR_LEN;
|
|
407
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
408
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
453
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
454
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
409
455
|
},
|
|
410
|
-
|
|
456
|
+
__wbg_stringify_0a0fbf2ef722380a: function() { return handleError(function (arg0) {
|
|
411
457
|
const ret = JSON.stringify(arg0);
|
|
412
458
|
return ret;
|
|
413
459
|
}, arguments); },
|
|
@@ -423,12 +469,11 @@ function __wbg_get_imports() {
|
|
|
423
469
|
},
|
|
424
470
|
__wbindgen_init_externref_table: function() {
|
|
425
471
|
const table = wasm.__wbindgen_externrefs;
|
|
426
|
-
const offset = table.grow(4);
|
|
427
472
|
table.set(0, undefined);
|
|
428
|
-
table.set(
|
|
429
|
-
table.set(
|
|
430
|
-
table.set(
|
|
431
|
-
table.set(
|
|
473
|
+
table.set(1024, undefined);
|
|
474
|
+
table.set(1025, null);
|
|
475
|
+
table.set(1026, true);
|
|
476
|
+
table.set(1027, false);
|
|
432
477
|
},
|
|
433
478
|
};
|
|
434
479
|
return {
|
|
@@ -488,7 +533,8 @@ function getDataViewMemory0() {
|
|
|
488
533
|
}
|
|
489
534
|
|
|
490
535
|
function getStringFromWasm0(ptr, len) {
|
|
491
|
-
|
|
536
|
+
ptr = ptr >>> 0;
|
|
537
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
492
538
|
}
|
|
493
539
|
|
|
494
540
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -555,10 +601,10 @@ function takeFromExternrefTable0(idx) {
|
|
|
555
601
|
return value;
|
|
556
602
|
}
|
|
557
603
|
|
|
558
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
604
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
559
605
|
cachedTextDecoder.decode();
|
|
560
|
-
function decodeText(
|
|
561
|
-
return cachedTextDecoder.decode(
|
|
606
|
+
function decodeText(bytes) {
|
|
607
|
+
return cachedTextDecoder.decode(bytes);
|
|
562
608
|
}
|
|
563
609
|
|
|
564
610
|
const cachedTextEncoder = new TextEncoder();
|
|
@@ -52,6 +52,13 @@ export class PargArtifactJs {
|
|
|
52
52
|
* The binding-requirements schema as JSON text.
|
|
53
53
|
*/
|
|
54
54
|
schema(): string;
|
|
55
|
+
/**
|
|
56
|
+
* The semantics hash (ruby#377): sha256 over the canonicalized
|
|
57
|
+
* envelope minus the producer set — byte-stable across re-bakes
|
|
58
|
+
* by a newer compiler when the grammar is unchanged. `undefined`
|
|
59
|
+
* on artifacts baked before the field existed.
|
|
60
|
+
*/
|
|
61
|
+
semanticsHash(): string | undefined;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
/**
|
|
Binary file
|
|
@@ -13,6 +13,7 @@ export const pargartifactjs_parseShapeRecovering: (a: number, b: number, c: numb
|
|
|
13
13
|
export const pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
14
14
|
export const pargartifactjs_schema: (a: number) => [number, number, number];
|
|
15
15
|
export const pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
16
|
+
export const pargartifactjs_semanticsHash: (a: number) => any;
|
|
16
17
|
export const parsanol_c_last_error: () => number;
|
|
17
18
|
export const parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
|
|
18
19
|
export const parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
|