parsanol 0.10.44 → 0.10.45
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 +42 -0
- package/dist/browser.d.ts +16 -0
- package/dist/browser.js +43 -0
- package/dist/runtime-core.d.ts +162 -0
- package/dist/runtime-core.js +268 -0
- package/dist/runtime.d.ts +5 -121
- package/dist/runtime.js +5 -176
- package/package.json +21 -5
- package/vendor/parsanol-wasm/BUILT_FROM +1 -1
- package/vendor/parsanol-wasm/BUILT_FROM.json +29 -0
- package/vendor/parsanol-wasm/LICENSE +21 -0
- package/vendor/parsanol-wasm/parsanol.cjs +37 -0
- package/vendor/parsanol-wasm/parsanol.d.ts +6 -0
- package/vendor/parsanol-wasm/parsanol_bg.wasm +0 -0
- package/vendor/parsanol-wasm/parsanol_bg.wasm.d.ts +17 -15
- package/vendor/parsanol-web/BUILT_FROM.json +24 -0
- package/vendor/parsanol-web/LICENSE +21 -0
- package/vendor/parsanol-web/README.md +36 -0
- package/vendor/parsanol-web/parsanol.d.ts +251 -0
- package/vendor/parsanol-web/parsanol.js +803 -0
- package/vendor/parsanol-web/parsanol_bg.wasm +0 -0
- package/vendor/parsanol-web/parsanol_bg.wasm.d.ts +58 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A verified PARG artifact exposed to JavaScript: checksum-verified
|
|
6
|
+
* load, native parse, bindings application, embedded-suite runs and
|
|
7
|
+
* the binding-requirements schema (PN 2/4).
|
|
8
|
+
*/
|
|
9
|
+
export class PargArtifactJs {
|
|
10
|
+
free(): void;
|
|
11
|
+
[Symbol.dispose](): void;
|
|
12
|
+
/**
|
|
13
|
+
* Apply an entry's DECLARED bindings artifact (parsanol-ruby#432)
|
|
14
|
+
* to a parsanol-shape tree. The bindings artifact is verified
|
|
15
|
+
* (kind, checksum, `ts` target, binding version) and pair-checked
|
|
16
|
+
* against this parse artifact by grammar source hash before the
|
|
17
|
+
* shared apply core runs.
|
|
18
|
+
*/
|
|
19
|
+
applyBindingsArtifact(bindings_json: string, entry: string, shape_json: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Apply an entry's bindings to a parsanol-shape tree (JSON text).
|
|
22
|
+
*/
|
|
23
|
+
applyBindings(entry: string, shape_json: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Declared entry point names, sorted.
|
|
26
|
+
*/
|
|
27
|
+
entryNames(): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Load and checksum-verify an artifact envelope.
|
|
30
|
+
*/
|
|
31
|
+
constructor(artifact_json: string);
|
|
32
|
+
/**
|
|
33
|
+
* Parse and bind in one step: the bound attribute hash as JSON.
|
|
34
|
+
*
|
|
35
|
+
* Returns `{}` when the entry declares no `bindings` block — the
|
|
36
|
+
* parse succeeded, there was simply nothing to bind.
|
|
37
|
+
*/
|
|
38
|
+
parseAndBind(entry: string, input: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Best-effort recovery (TODO.sota/1): success returns
|
|
41
|
+
* `{"ok": true, "shape": ...}`; failure returns
|
|
42
|
+
* `{"ok": false, "captures": ..., "error": ..., "consumed_upto"}`.
|
|
43
|
+
*/
|
|
44
|
+
parseShapeRecovering(entry: string, input: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Explicit compatibility without changing parseShape defaults.
|
|
47
|
+
* The JSON envelope contains either shape or causal error diagnostics;
|
|
48
|
+
* it does not claim best-effort recovery captures.
|
|
49
|
+
*/
|
|
50
|
+
parseShapeWithCompatibility(entry: string, input: string, compatibility: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Parse an entry with the native engine; returns the parsanol-shape
|
|
53
|
+
* tree as JSON text.
|
|
54
|
+
*/
|
|
55
|
+
parseShape(entry: string, input: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Run the artifact's embedded tests; returns the failure list as
|
|
58
|
+
* JSON (empty array means green).
|
|
59
|
+
*/
|
|
60
|
+
runTests(): string;
|
|
61
|
+
/**
|
|
62
|
+
* The binding-requirements schema as TypeScript source.
|
|
63
|
+
*/
|
|
64
|
+
schemaTypescript(): string;
|
|
65
|
+
/**
|
|
66
|
+
* The binding-requirements schema as JSON text.
|
|
67
|
+
*/
|
|
68
|
+
schema(): string;
|
|
69
|
+
/**
|
|
70
|
+
* The semantics hash (ruby#377): sha256 over the canonicalized
|
|
71
|
+
* envelope minus the producer set — byte-stable across re-bakes
|
|
72
|
+
* by a newer compiler when the grammar is unchanged. `undefined`
|
|
73
|
+
* on artifacts baked before the field existed.
|
|
74
|
+
*/
|
|
75
|
+
semanticsHash(): string | undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* WASM parser instance
|
|
80
|
+
*
|
|
81
|
+
* Create with `new WasmParser(grammarJson)` and parse with `parse(input)`.
|
|
82
|
+
*/
|
|
83
|
+
export class WasmParser {
|
|
84
|
+
free(): void;
|
|
85
|
+
[Symbol.dispose](): void;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new parser from a PARG artifact envelope and entry name.
|
|
88
|
+
*
|
|
89
|
+
* The artifact's canonical checksum is verified before any parsing;
|
|
90
|
+
* a mismatched or corrupt artifact is rejected (PN 2).
|
|
91
|
+
*
|
|
92
|
+
* # Arguments
|
|
93
|
+
* * `artifact_json` - JSON text of the PARG artifact envelope
|
|
94
|
+
* * `entry` - entry point name declared in the artifact
|
|
95
|
+
*/
|
|
96
|
+
static fromArtifact(artifact_json: string, entry: string): WasmParser;
|
|
97
|
+
/**
|
|
98
|
+
* Create a new parser from grammar JSON
|
|
99
|
+
*
|
|
100
|
+
* # Arguments
|
|
101
|
+
* * `grammar_json` - JSON string representing the grammar
|
|
102
|
+
*
|
|
103
|
+
* # Returns
|
|
104
|
+
* A new WasmParser instance
|
|
105
|
+
*
|
|
106
|
+
* # Throws
|
|
107
|
+
* If the grammar JSON is invalid
|
|
108
|
+
*/
|
|
109
|
+
constructor(grammar_json: string);
|
|
110
|
+
/**
|
|
111
|
+
* Parse input and return JavaScript AST
|
|
112
|
+
*
|
|
113
|
+
* # Arguments
|
|
114
|
+
* * `input` - The input string to parse
|
|
115
|
+
*
|
|
116
|
+
* # Returns
|
|
117
|
+
* A JavaScript object representing the parsed AST
|
|
118
|
+
*
|
|
119
|
+
* # Throws
|
|
120
|
+
* If parsing fails
|
|
121
|
+
*/
|
|
122
|
+
parse(input: string): any;
|
|
123
|
+
/**
|
|
124
|
+
* Parse and return flat array (for Opal compatibility)
|
|
125
|
+
*
|
|
126
|
+
* # Arguments
|
|
127
|
+
* * `input` - The input string to parse
|
|
128
|
+
*
|
|
129
|
+
* # Returns
|
|
130
|
+
* A Uint32Array containing the flattened AST
|
|
131
|
+
*
|
|
132
|
+
* # Throws
|
|
133
|
+
* If parsing fails
|
|
134
|
+
*/
|
|
135
|
+
parse_flat(input: string): BigUint64Array;
|
|
136
|
+
/**
|
|
137
|
+
* Parse and return JSON string
|
|
138
|
+
*
|
|
139
|
+
* # Arguments
|
|
140
|
+
* * `input` - The input string to parse
|
|
141
|
+
*
|
|
142
|
+
* # Returns
|
|
143
|
+
* A JSON string representing the parsed AST
|
|
144
|
+
*
|
|
145
|
+
* # Throws
|
|
146
|
+
* If parsing fails
|
|
147
|
+
*/
|
|
148
|
+
parse_json(input: string): string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Compile PARG source to a checksummed artifact — the playground's
|
|
153
|
+
* compiler-in-the-browser (site#19). Single-file grammars: `use`
|
|
154
|
+
* imports have no filesystem here and reject with the merge error.
|
|
155
|
+
*/
|
|
156
|
+
export function compileSource(source: string): string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Install the panic hook (better panic messages in the console).
|
|
160
|
+
*
|
|
161
|
+
* The glue's real bootstrap is the DEFAULT export —
|
|
162
|
+
* `__wbg_init(module_or_path?)` / `initSync` — which calls this on
|
|
163
|
+
* its way up; calling it directly is only needed outside the
|
|
164
|
+
* bootstrap. It is deliberately NOT named `init`: that name in the
|
|
165
|
+
* generated d.ts typed the bootstrap as `() => void` and hid the
|
|
166
|
+
* real signatures (rs#308).
|
|
167
|
+
*/
|
|
168
|
+
export function setPanicHook(): void;
|
|
169
|
+
|
|
170
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
171
|
+
|
|
172
|
+
export interface InitOutput {
|
|
173
|
+
readonly memory: WebAssembly.Memory;
|
|
174
|
+
readonly parsanol_c_last_error: () => number;
|
|
175
|
+
readonly parsanol_c_parse: (a: bigint, b: number, c: number, d: number) => number;
|
|
176
|
+
readonly parsanol_c_parse_len: (a: bigint, b: number, c: number, d: number, e: number) => number;
|
|
177
|
+
readonly parsanol_c_register: (a: number) => bigint;
|
|
178
|
+
readonly parsanol_c_release: (a: bigint) => void;
|
|
179
|
+
readonly parsanol_grammar_atom_count: (a: number) => number;
|
|
180
|
+
readonly parsanol_grammar_free: (a: number) => void;
|
|
181
|
+
readonly parsanol_grammar_new: (a: number) => number;
|
|
182
|
+
readonly parsanol_grammar_new_with_error: (a: number, b: number) => number;
|
|
183
|
+
readonly parsanol_grammar_root: (a: number) => number;
|
|
184
|
+
readonly parsanol_parg_error: (a: number, b: number) => number;
|
|
185
|
+
readonly parsanol_parg_free: (a: number) => void;
|
|
186
|
+
readonly parsanol_parg_parse: (a: number, b: number) => number;
|
|
187
|
+
readonly parsanol_parg_parse_recovering: (a: number, b: number, c: number) => number;
|
|
188
|
+
readonly parsanol_parg_parse_with_compatibility: (a: number, b: number, c: number, d: number) => number;
|
|
189
|
+
readonly parsanol_parse: (a: number, b: number, c: number) => number;
|
|
190
|
+
readonly parsanol_parse_end_pos: (a: number, b: number) => number;
|
|
191
|
+
readonly parsanol_parse_simple: (a: number, b: number) => number;
|
|
192
|
+
readonly parsanol_result_ast_json: (a: number) => number;
|
|
193
|
+
readonly parsanol_result_end_pos: (a: number) => number;
|
|
194
|
+
readonly parsanol_result_error: (a: number) => number;
|
|
195
|
+
readonly parsanol_result_free: (a: number) => void;
|
|
196
|
+
readonly parsanol_result_success: (a: number) => number;
|
|
197
|
+
readonly parsanol_version: () => number;
|
|
198
|
+
readonly parsanol_string_free: (a: number) => void;
|
|
199
|
+
readonly __wbg_pargartifactjs_free: (a: number, b: number) => void;
|
|
200
|
+
readonly __wbg_wasmparser_free: (a: number, b: number) => void;
|
|
201
|
+
readonly compileSource: (a: number, b: number) => [number, number, number, number];
|
|
202
|
+
readonly pargartifactjs_applyBindings: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
203
|
+
readonly pargartifactjs_applyBindingsArtifact: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
204
|
+
readonly pargartifactjs_entryNames: (a: number) => [number, number];
|
|
205
|
+
readonly pargartifactjs_new: (a: number, b: number) => [number, number, number];
|
|
206
|
+
readonly pargartifactjs_parseAndBind: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
207
|
+
readonly pargartifactjs_parseShape: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
208
|
+
readonly pargartifactjs_parseShapeRecovering: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
209
|
+
readonly pargartifactjs_parseShapeWithCompatibility: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
210
|
+
readonly pargartifactjs_runTests: (a: number) => [number, number, number];
|
|
211
|
+
readonly pargartifactjs_schema: (a: number) => [number, number, number];
|
|
212
|
+
readonly pargartifactjs_schemaTypescript: (a: number) => [number, number, number];
|
|
213
|
+
readonly pargartifactjs_semanticsHash: (a: number) => any;
|
|
214
|
+
readonly setPanicHook: () => void;
|
|
215
|
+
readonly wasmparser_fromArtifact: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
216
|
+
readonly wasmparser_new: (a: number, b: number) => [number, number, number];
|
|
217
|
+
readonly wasmparser_parse: (a: number, b: number, c: number) => [number, number, number];
|
|
218
|
+
readonly wasmparser_parse_flat: (a: number, b: number, c: number) => [number, number, number, number];
|
|
219
|
+
readonly wasmparser_parse_json: (a: number, b: number, c: number) => [number, number, number, number];
|
|
220
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
221
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
222
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
223
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
224
|
+
readonly __externref_table_alloc: () => number;
|
|
225
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
226
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
227
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
228
|
+
readonly __wbindgen_start: () => void;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
235
|
+
* a precompiled `WebAssembly.Module`.
|
|
236
|
+
*
|
|
237
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
238
|
+
*
|
|
239
|
+
* @returns {InitOutput}
|
|
240
|
+
*/
|
|
241
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
245
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
246
|
+
*
|
|
247
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
248
|
+
*
|
|
249
|
+
* @returns {Promise<InitOutput>}
|
|
250
|
+
*/
|
|
251
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|