@willbooster/web-tree-sitter 19.0.2 → 19.1.1
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/debug/web-tree-sitter.cjs +546 -664
- package/debug/web-tree-sitter.cjs.map +4 -4
- package/debug/web-tree-sitter.js +546 -664
- package/debug/web-tree-sitter.js.map +4 -4
- package/debug/web-tree-sitter.wasm +0 -0
- package/debug/web-tree-sitter.wasm.map +10 -12
- package/package.json +1 -1
- package/web-tree-sitter.cjs +3 -3
- package/web-tree-sitter.cjs.map +4 -4
- package/web-tree-sitter.d.cts +8 -1
- package/web-tree-sitter.d.cts.map +1 -1
- package/web-tree-sitter.d.ts +8 -1
- package/web-tree-sitter.d.ts.map +1 -1
- package/web-tree-sitter.js +3 -3
- package/web-tree-sitter.js.map +4 -4
- package/web-tree-sitter.wasm +0 -0
- package/web-tree-sitter.wasm.map +14 -16
- package/web-tree-sitter.web.js +3 -3
- package/web-tree-sitter.web.js.map +4 -4
package/debug/web-tree-sitter.js
CHANGED
|
@@ -104,9 +104,7 @@ var Edit = class {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
// src/constants.ts
|
|
107
|
-
var SIZE_OF_SHORT = 2;
|
|
108
107
|
var SIZE_OF_INT = 4;
|
|
109
|
-
var SIZE_OF_CURSOR = 4 * SIZE_OF_INT;
|
|
110
108
|
var SIZE_OF_NODE = 5 * SIZE_OF_INT;
|
|
111
109
|
var SIZE_OF_POINT = 2 * SIZE_OF_INT;
|
|
112
110
|
var SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT;
|
|
@@ -229,177 +227,53 @@ var LookaheadIterator = class {
|
|
|
229
227
|
}
|
|
230
228
|
};
|
|
231
229
|
|
|
232
|
-
// src/
|
|
233
|
-
function getText(tree, startIndex, endIndex, startPosition) {
|
|
234
|
-
const length = endIndex - startIndex;
|
|
235
|
-
let result = tree.textCallback(startIndex, startPosition);
|
|
236
|
-
if (result) {
|
|
237
|
-
startIndex += result.length;
|
|
238
|
-
while (startIndex < endIndex) {
|
|
239
|
-
const string = tree.textCallback(startIndex, startPosition);
|
|
240
|
-
if (string && string.length > 0) {
|
|
241
|
-
startIndex += string.length;
|
|
242
|
-
result += string;
|
|
243
|
-
} else {
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if (startIndex > endIndex) {
|
|
248
|
-
result = result.slice(0, length);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return result ?? "";
|
|
252
|
-
}
|
|
253
|
-
__name(getText, "getText");
|
|
230
|
+
// src/tree_cursor.ts
|
|
254
231
|
var finalizer2 = newFinalizer((address) => {
|
|
255
|
-
C.
|
|
232
|
+
C._ts_tree_cursor_delete_wasm(address);
|
|
256
233
|
});
|
|
257
|
-
var
|
|
234
|
+
var TreeCursor = class _TreeCursor {
|
|
258
235
|
static {
|
|
259
|
-
__name(this, "
|
|
236
|
+
__name(this, "TreeCursor");
|
|
260
237
|
}
|
|
261
238
|
/** @internal */
|
|
262
239
|
[0] = 0;
|
|
263
240
|
// Internal handle for Wasm
|
|
264
241
|
/** @internal */
|
|
265
|
-
|
|
266
|
-
/** The language that was used to parse the syntax tree. */
|
|
267
|
-
language;
|
|
242
|
+
tree;
|
|
268
243
|
/** @internal */
|
|
269
|
-
|
|
270
|
-
assertInternal(internal);
|
|
271
|
-
this[0] = address;
|
|
272
|
-
this.language = language;
|
|
273
|
-
this.textCallback = textCallback;
|
|
274
|
-
finalizer2?.register(this, address, this);
|
|
275
|
-
}
|
|
276
|
-
/** Create a shallow copy of the syntax tree. This is very fast. */
|
|
277
|
-
copy() {
|
|
278
|
-
const address = C._ts_tree_copy(this[0]);
|
|
279
|
-
return new _Tree(INTERNAL, address, this.language, this.textCallback);
|
|
280
|
-
}
|
|
281
|
-
/** Delete the syntax tree, freeing its resources. */
|
|
282
|
-
delete() {
|
|
283
|
-
finalizer2?.unregister(this);
|
|
284
|
-
C._ts_tree_delete(this[0]);
|
|
285
|
-
this[0] = 0;
|
|
286
|
-
}
|
|
287
|
-
/** Get the root node of the syntax tree. */
|
|
288
|
-
get rootNode() {
|
|
289
|
-
C._ts_tree_root_node_wasm(this[0]);
|
|
290
|
-
return unmarshalNode(this);
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Get the root node of the syntax tree, but with its position shifted
|
|
294
|
-
* forward by the given offset.
|
|
295
|
-
*/
|
|
296
|
-
rootNodeWithOffset(offsetBytes, offsetExtent) {
|
|
297
|
-
const address = TRANSFER_BUFFER + SIZE_OF_NODE;
|
|
298
|
-
C.setValue(address, offsetBytes, "i32");
|
|
299
|
-
marshalPoint(address + SIZE_OF_INT, offsetExtent);
|
|
300
|
-
C._ts_tree_root_node_with_offset_wasm(this[0]);
|
|
301
|
-
return unmarshalNode(this);
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Edit the syntax tree to keep it in sync with source code that has been
|
|
305
|
-
* edited.
|
|
306
|
-
*
|
|
307
|
-
* You must describe the edit both in terms of byte offsets and in terms of
|
|
308
|
-
* row/column coordinates.
|
|
309
|
-
*/
|
|
310
|
-
edit(edit) {
|
|
311
|
-
marshalEdit(edit);
|
|
312
|
-
C._ts_tree_edit_wasm(this[0]);
|
|
313
|
-
}
|
|
314
|
-
/** Create a new {@link TreeCursor} starting from the root of the tree. */
|
|
315
|
-
walk() {
|
|
316
|
-
return this.rootNode.walk();
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Compare this old edited syntax tree to a new syntax tree representing
|
|
320
|
-
* the same document, returning a sequence of ranges whose syntactic
|
|
321
|
-
* structure has changed.
|
|
322
|
-
*
|
|
323
|
-
* For this to work correctly, this syntax tree must have been edited such
|
|
324
|
-
* that its ranges match up to the new tree. Generally, you'll want to
|
|
325
|
-
* call this method right after calling one of the [`Parser::parse`]
|
|
326
|
-
* functions. Call it on the old tree that was passed to parse, and
|
|
327
|
-
* pass the new tree that was returned from `parse`.
|
|
328
|
-
*/
|
|
329
|
-
getChangedRanges(other) {
|
|
330
|
-
if (!(other instanceof _Tree)) {
|
|
331
|
-
throw new TypeError("Argument must be a Tree");
|
|
332
|
-
}
|
|
333
|
-
C._ts_tree_get_changed_ranges_wasm(this[0], other[0]);
|
|
334
|
-
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
335
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
336
|
-
const result = new Array(count);
|
|
337
|
-
if (count > 0) {
|
|
338
|
-
let address = buffer;
|
|
339
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
340
|
-
result[i2] = unmarshalRange(address);
|
|
341
|
-
address += SIZE_OF_RANGE;
|
|
342
|
-
}
|
|
343
|
-
C._ts_free_wasm(buffer);
|
|
344
|
-
}
|
|
345
|
-
return result;
|
|
346
|
-
}
|
|
347
|
-
/** Get the included ranges that were used to parse the syntax tree. */
|
|
348
|
-
getIncludedRanges() {
|
|
349
|
-
C._ts_tree_included_ranges_wasm(this[0]);
|
|
350
|
-
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
351
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
352
|
-
const result = new Array(count);
|
|
353
|
-
if (count > 0) {
|
|
354
|
-
let address = buffer;
|
|
355
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
356
|
-
result[i2] = unmarshalRange(address);
|
|
357
|
-
address += SIZE_OF_RANGE;
|
|
358
|
-
}
|
|
359
|
-
C._ts_free_wasm(buffer);
|
|
360
|
-
}
|
|
361
|
-
return result;
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// src/tree_cursor.ts
|
|
366
|
-
var finalizer3 = newFinalizer((handles) => {
|
|
367
|
-
marshalTreeCursor({ handles });
|
|
368
|
-
C._ts_tree_cursor_delete_wasm(0);
|
|
369
|
-
});
|
|
370
|
-
var TreeCursor = class _TreeCursor {
|
|
371
|
-
static {
|
|
372
|
-
__name(this, "TreeCursor");
|
|
373
|
-
}
|
|
244
|
+
editVersion = -1;
|
|
374
245
|
/** @internal */
|
|
375
|
-
|
|
376
|
-
// Internal handles for Wasm, shared with the finalizer.
|
|
246
|
+
_nodeTypeId = 0;
|
|
377
247
|
/** @internal */
|
|
378
|
-
|
|
248
|
+
_fieldId = 0;
|
|
249
|
+
/** @internal */
|
|
250
|
+
_startIndex = 0;
|
|
251
|
+
/** @internal */
|
|
252
|
+
_endIndex = 0;
|
|
379
253
|
/** @internal */
|
|
380
|
-
|
|
254
|
+
_flags = 0;
|
|
255
|
+
/** @internal */
|
|
256
|
+
constructor(internal, tree, address) {
|
|
381
257
|
assertInternal(internal);
|
|
258
|
+
this[0] = address;
|
|
382
259
|
this.tree = tree;
|
|
383
|
-
|
|
384
|
-
|
|
260
|
+
this.readNodeCache();
|
|
261
|
+
finalizer2?.register(this, address, this);
|
|
385
262
|
}
|
|
386
263
|
/** Creates a deep copy of the tree cursor. This allocates new memory. */
|
|
387
264
|
copy() {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
return new _TreeCursor(INTERNAL, this.tree);
|
|
265
|
+
const address = C._ts_tree_cursor_copy_wasm(this[0]);
|
|
266
|
+
return new _TreeCursor(INTERNAL, this.tree, address);
|
|
391
267
|
}
|
|
392
268
|
/** Delete the tree cursor, freeing its resources. */
|
|
393
269
|
delete() {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
this.handles.fill(0);
|
|
270
|
+
finalizer2?.unregister(this);
|
|
271
|
+
C._ts_tree_cursor_delete_wasm(this[0]);
|
|
272
|
+
this[0] = 0;
|
|
398
273
|
}
|
|
399
274
|
/** Get the tree cursor's current {@link Node}. */
|
|
400
275
|
get currentNode() {
|
|
401
|
-
|
|
402
|
-
C._ts_tree_cursor_current_node_wasm(this.tree[0]);
|
|
276
|
+
C._ts_tree_cursor_current_node_wasm(this[0]);
|
|
403
277
|
return unmarshalNode(this.tree);
|
|
404
278
|
}
|
|
405
279
|
/**
|
|
@@ -408,47 +282,41 @@ var TreeCursor = class _TreeCursor {
|
|
|
408
282
|
* See also {@link TreeCursor#currentFieldName}.
|
|
409
283
|
*/
|
|
410
284
|
get currentFieldId() {
|
|
411
|
-
|
|
412
|
-
return C._ts_tree_cursor_current_field_id_wasm(this.tree[0]);
|
|
285
|
+
return this._fieldId;
|
|
413
286
|
}
|
|
414
287
|
/** Get the field name of this tree cursor's current node. */
|
|
415
288
|
get currentFieldName() {
|
|
416
|
-
return this.tree.language.fields[this.
|
|
289
|
+
return this.tree.language.fields[this._fieldId] ?? null;
|
|
417
290
|
}
|
|
418
291
|
/**
|
|
419
292
|
* Get the depth of the cursor's current node relative to the original
|
|
420
293
|
* node that the cursor was constructed with.
|
|
421
294
|
*/
|
|
422
295
|
get currentDepth() {
|
|
423
|
-
|
|
424
|
-
return C._ts_tree_cursor_current_depth_wasm(this.tree[0]);
|
|
296
|
+
return C._ts_tree_cursor_current_depth(this[0]) >>> 0;
|
|
425
297
|
}
|
|
426
298
|
/**
|
|
427
299
|
* Get the index of the cursor's current node out of all of the
|
|
428
300
|
* descendants of the original node that the cursor was constructed with.
|
|
429
301
|
*/
|
|
430
302
|
get currentDescendantIndex() {
|
|
431
|
-
|
|
432
|
-
return C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0]);
|
|
303
|
+
return C._ts_tree_cursor_current_descendant_index(this[0]) >>> 0;
|
|
433
304
|
}
|
|
434
305
|
/** Get the type of the cursor's current node. */
|
|
435
306
|
get nodeType() {
|
|
436
|
-
return this.tree.language.types[this.
|
|
307
|
+
return this.tree.language.types[this._nodeTypeId] || "ERROR";
|
|
437
308
|
}
|
|
438
309
|
/** Get the type id of the cursor's current node. */
|
|
439
310
|
get nodeTypeId() {
|
|
440
|
-
|
|
441
|
-
return C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0]);
|
|
311
|
+
return this._nodeTypeId;
|
|
442
312
|
}
|
|
443
313
|
/** Get the state id of the cursor's current node. */
|
|
444
314
|
get nodeStateId() {
|
|
445
|
-
|
|
446
|
-
return C._ts_tree_cursor_current_node_state_id_wasm(this.tree[0]);
|
|
315
|
+
return C._ts_tree_cursor_current_node_state_id_wasm(this[0]);
|
|
447
316
|
}
|
|
448
317
|
/** Get the id of the cursor's current node. */
|
|
449
318
|
get nodeId() {
|
|
450
|
-
|
|
451
|
-
return C._ts_tree_cursor_current_node_id_wasm(this.tree[0]);
|
|
319
|
+
return C._ts_tree_cursor_current_node_id_wasm(this[0]);
|
|
452
320
|
}
|
|
453
321
|
/**
|
|
454
322
|
* Check if the cursor's current node is *named*.
|
|
@@ -457,8 +325,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
457
325
|
* *anonymous* nodes correspond to string literals in the grammar.
|
|
458
326
|
*/
|
|
459
327
|
get nodeIsNamed() {
|
|
460
|
-
|
|
461
|
-
return C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0]) === 1;
|
|
328
|
+
return (this._flags & 1) !== 0;
|
|
462
329
|
}
|
|
463
330
|
/**
|
|
464
331
|
* Check if the cursor's current node is *missing*.
|
|
@@ -467,39 +334,33 @@ var TreeCursor = class _TreeCursor {
|
|
|
467
334
|
* certain kinds of syntax errors.
|
|
468
335
|
*/
|
|
469
336
|
get nodeIsMissing() {
|
|
470
|
-
|
|
471
|
-
return C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0]) === 1;
|
|
337
|
+
return (this._flags & 2) !== 0;
|
|
472
338
|
}
|
|
473
339
|
/** Get the string content of the cursor's current node. */
|
|
474
340
|
get nodeText() {
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
C._ts_tree_cursor_start_position_wasm(this.tree[0]);
|
|
479
|
-
const startPosition = unmarshalPoint(TRANSFER_BUFFER);
|
|
480
|
-
return getText(this.tree, startIndex, endIndex, startPosition);
|
|
341
|
+
this.syncIndices();
|
|
342
|
+
const { textSource } = this.tree;
|
|
343
|
+
return typeof textSource === "string" ? textSource.slice(this._startIndex, this._endIndex) : getCallbackText(textSource, this._startIndex, this._endIndex, this.startPosition);
|
|
481
344
|
}
|
|
482
345
|
/** Get the start position of the cursor's current node. */
|
|
483
346
|
get startPosition() {
|
|
484
|
-
|
|
485
|
-
C._ts_tree_cursor_start_position_wasm(this.tree[0]);
|
|
347
|
+
C._ts_tree_cursor_start_position_wasm(this[0]);
|
|
486
348
|
return unmarshalPoint(TRANSFER_BUFFER);
|
|
487
349
|
}
|
|
488
350
|
/** Get the end position of the cursor's current node. */
|
|
489
351
|
get endPosition() {
|
|
490
|
-
|
|
491
|
-
C._ts_tree_cursor_end_position_wasm(this.tree[0]);
|
|
352
|
+
C._ts_tree_cursor_end_position_wasm(this[0]);
|
|
492
353
|
return unmarshalPoint(TRANSFER_BUFFER);
|
|
493
354
|
}
|
|
494
355
|
/** Get the start index of the cursor's current node. */
|
|
495
356
|
get startIndex() {
|
|
496
|
-
|
|
497
|
-
return
|
|
357
|
+
this.syncIndices();
|
|
358
|
+
return this._startIndex;
|
|
498
359
|
}
|
|
499
360
|
/** Get the end index of the cursor's current node. */
|
|
500
361
|
get endIndex() {
|
|
501
|
-
|
|
502
|
-
return
|
|
362
|
+
this.syncIndices();
|
|
363
|
+
return this._endIndex;
|
|
503
364
|
}
|
|
504
365
|
/**
|
|
505
366
|
* Move this cursor to the first child of its current node.
|
|
@@ -508,10 +369,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
508
369
|
* `false` if there were no children.
|
|
509
370
|
*/
|
|
510
371
|
gotoFirstChild() {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return result === 1;
|
|
372
|
+
if (!C._ts_tree_cursor_goto_first_child_wasm(this[0])) return false;
|
|
373
|
+
this.readNodeCache();
|
|
374
|
+
return true;
|
|
515
375
|
}
|
|
516
376
|
/**
|
|
517
377
|
* Move this cursor to the last child of its current node.
|
|
@@ -524,10 +384,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
524
384
|
* iterate through all the children to compute the child's position.
|
|
525
385
|
*/
|
|
526
386
|
gotoLastChild() {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
return result === 1;
|
|
387
|
+
if (!C._ts_tree_cursor_goto_last_child_wasm(this[0])) return false;
|
|
388
|
+
this.readNodeCache();
|
|
389
|
+
return true;
|
|
531
390
|
}
|
|
532
391
|
/**
|
|
533
392
|
* Move this cursor to the parent of its current node.
|
|
@@ -540,10 +399,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
540
399
|
* of the cursor, and the cursor cannot walk outside this node.
|
|
541
400
|
*/
|
|
542
401
|
gotoParent() {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return result === 1;
|
|
402
|
+
if (!C._ts_tree_cursor_goto_parent_wasm(this[0])) return false;
|
|
403
|
+
this.readNodeCache();
|
|
404
|
+
return true;
|
|
547
405
|
}
|
|
548
406
|
/**
|
|
549
407
|
* Move this cursor to the next sibling of its current node.
|
|
@@ -555,10 +413,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
555
413
|
* of the cursor, and the cursor cannot walk outside this node.
|
|
556
414
|
*/
|
|
557
415
|
gotoNextSibling() {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
return result === 1;
|
|
416
|
+
if (!C._ts_tree_cursor_goto_next_sibling_wasm(this[0])) return false;
|
|
417
|
+
this.readNodeCache();
|
|
418
|
+
return true;
|
|
562
419
|
}
|
|
563
420
|
/**
|
|
564
421
|
* Move this cursor to the previous sibling of its current node.
|
|
@@ -574,10 +431,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
574
431
|
* considered the root of the cursor, and the cursor cannot walk outside this node.
|
|
575
432
|
*/
|
|
576
433
|
gotoPreviousSibling() {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
return result === 1;
|
|
434
|
+
if (!C._ts_tree_cursor_goto_previous_sibling_wasm(this[0])) return false;
|
|
435
|
+
this.readNodeCache();
|
|
436
|
+
return true;
|
|
581
437
|
}
|
|
582
438
|
/**
|
|
583
439
|
* Move the cursor to the node that is the nth descendant of
|
|
@@ -585,9 +441,8 @@ var TreeCursor = class _TreeCursor {
|
|
|
585
441
|
* zero represents the original node itself.
|
|
586
442
|
*/
|
|
587
443
|
gotoDescendant(goalDescendantIndex) {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
unmarshalTreeCursor(this);
|
|
444
|
+
C._ts_tree_cursor_goto_descendant_wasm(this[0], goalDescendantIndex);
|
|
445
|
+
this.readNodeCache();
|
|
591
446
|
}
|
|
592
447
|
/**
|
|
593
448
|
* Move this cursor to the first child of its current node that contains or
|
|
@@ -597,11 +452,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
597
452
|
* `false` if no such child was found.
|
|
598
453
|
*/
|
|
599
454
|
gotoFirstChildForIndex(goalIndex) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
unmarshalTreeCursor(this);
|
|
604
|
-
return result === 1;
|
|
455
|
+
if (!C._ts_tree_cursor_goto_first_child_for_index_wasm(this[0], goalIndex)) return false;
|
|
456
|
+
this.readNodeCache();
|
|
457
|
+
return true;
|
|
605
458
|
}
|
|
606
459
|
/**
|
|
607
460
|
* Move this cursor to the first child of its current node that contains or
|
|
@@ -611,11 +464,15 @@ var TreeCursor = class _TreeCursor {
|
|
|
611
464
|
* `false` if no such child was found.
|
|
612
465
|
*/
|
|
613
466
|
gotoFirstChildForPosition(goalPosition) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
467
|
+
if (!C._ts_tree_cursor_goto_first_child_for_position_wasm(
|
|
468
|
+
this[0],
|
|
469
|
+
goalPosition.row,
|
|
470
|
+
goalPosition.column
|
|
471
|
+
)) {
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
this.readNodeCache();
|
|
475
|
+
return true;
|
|
619
476
|
}
|
|
620
477
|
/**
|
|
621
478
|
* Re-initialize this tree cursor to start at the original node that the
|
|
@@ -623,10 +480,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
623
480
|
*/
|
|
624
481
|
reset(node) {
|
|
625
482
|
marshalNode(node);
|
|
626
|
-
marshalTreeCursor(this, TRANSFER_BUFFER + SIZE_OF_NODE);
|
|
627
|
-
C._ts_tree_cursor_reset_wasm(node.tree[0]);
|
|
628
|
-
unmarshalTreeCursor(this);
|
|
629
483
|
this.tree = node.tree;
|
|
484
|
+
C._ts_tree_cursor_reset_wasm(this[0], node.tree[0]);
|
|
485
|
+
this.readNodeCache();
|
|
630
486
|
}
|
|
631
487
|
/**
|
|
632
488
|
* Re-initialize a tree cursor to the same position as another cursor.
|
|
@@ -635,11 +491,145 @@ var TreeCursor = class _TreeCursor {
|
|
|
635
491
|
* information and allows reusing already created cursors.
|
|
636
492
|
*/
|
|
637
493
|
resetTo(cursor) {
|
|
638
|
-
|
|
639
|
-
marshalTreeCursor(cursor, TRANSFER_BUFFER + SIZE_OF_CURSOR);
|
|
640
|
-
C._ts_tree_cursor_reset_to_wasm(this.tree[0], cursor.tree[0]);
|
|
641
|
-
unmarshalTreeCursor(this);
|
|
494
|
+
if (this[0] === cursor[0]) return;
|
|
642
495
|
this.tree = cursor.tree;
|
|
496
|
+
C._ts_tree_cursor_reset_to_wasm(this[0], cursor[0]);
|
|
497
|
+
this.readNodeCache();
|
|
498
|
+
}
|
|
499
|
+
/** @internal */
|
|
500
|
+
readNodeCache() {
|
|
501
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
502
|
+
const heap = C.HEAPU32;
|
|
503
|
+
this._nodeTypeId = heap[base];
|
|
504
|
+
this._fieldId = heap[base + 1];
|
|
505
|
+
this._startIndex = heap[base + 2];
|
|
506
|
+
this._endIndex = heap[base + 3];
|
|
507
|
+
this._flags = heap[base + 4];
|
|
508
|
+
this.editVersion = this.tree.editVersion;
|
|
509
|
+
}
|
|
510
|
+
/** @internal */
|
|
511
|
+
syncIndices() {
|
|
512
|
+
if (this.editVersion !== this.tree.editVersion) {
|
|
513
|
+
this._startIndex = C._ts_tree_cursor_start_index_wasm(this[0]) >>> 0;
|
|
514
|
+
this._endIndex = C._ts_tree_cursor_end_index_wasm(this[0]) >>> 0;
|
|
515
|
+
this.editVersion = this.tree.editVersion;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// src/tree.ts
|
|
521
|
+
function getCallbackText(textSource, startIndex, endIndex, startPosition) {
|
|
522
|
+
const length = endIndex - startIndex;
|
|
523
|
+
let result = textSource(startIndex, startPosition);
|
|
524
|
+
if (result) {
|
|
525
|
+
startIndex += result.length;
|
|
526
|
+
while (startIndex < endIndex) {
|
|
527
|
+
const string = textSource(startIndex, startPosition);
|
|
528
|
+
if (string && string.length > 0) {
|
|
529
|
+
startIndex += string.length;
|
|
530
|
+
result += string;
|
|
531
|
+
} else {
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (startIndex > endIndex) {
|
|
536
|
+
result = result.slice(0, length);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return result ?? "";
|
|
540
|
+
}
|
|
541
|
+
__name(getCallbackText, "getCallbackText");
|
|
542
|
+
var finalizer3 = newFinalizer((address) => {
|
|
543
|
+
C._ts_tree_delete(address);
|
|
544
|
+
});
|
|
545
|
+
var Tree2 = class _Tree {
|
|
546
|
+
static {
|
|
547
|
+
__name(this, "Tree");
|
|
548
|
+
}
|
|
549
|
+
/** @internal */
|
|
550
|
+
[0] = 0;
|
|
551
|
+
// Internal handle for Wasm
|
|
552
|
+
/** @internal */
|
|
553
|
+
textSource;
|
|
554
|
+
/** @internal */
|
|
555
|
+
editVersion = 0;
|
|
556
|
+
/** The language that was used to parse the syntax tree. */
|
|
557
|
+
language;
|
|
558
|
+
/** @internal */
|
|
559
|
+
constructor(internal, address, language, textSource) {
|
|
560
|
+
assertInternal(internal);
|
|
561
|
+
this[0] = address;
|
|
562
|
+
this.language = language;
|
|
563
|
+
this.textSource = textSource;
|
|
564
|
+
finalizer3?.register(this, address, this);
|
|
565
|
+
}
|
|
566
|
+
/** Create a shallow copy of the syntax tree. This is very fast. */
|
|
567
|
+
copy() {
|
|
568
|
+
const address = C._ts_tree_copy(this[0]);
|
|
569
|
+
return new _Tree(INTERNAL, address, this.language, this.textSource);
|
|
570
|
+
}
|
|
571
|
+
/** Delete the syntax tree, freeing its resources. */
|
|
572
|
+
delete() {
|
|
573
|
+
finalizer3?.unregister(this);
|
|
574
|
+
C._ts_tree_delete(this[0]);
|
|
575
|
+
this[0] = 0;
|
|
576
|
+
}
|
|
577
|
+
/** Get the root node of the syntax tree. */
|
|
578
|
+
get rootNode() {
|
|
579
|
+
C._ts_tree_root_node_wasm(this[0]);
|
|
580
|
+
return unmarshalNode(this);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Get the root node of the syntax tree, but with its position shifted
|
|
584
|
+
* forward by the given offset.
|
|
585
|
+
*/
|
|
586
|
+
rootNodeWithOffset(offsetBytes, offsetExtent) {
|
|
587
|
+
const address = TRANSFER_BUFFER + SIZE_OF_NODE;
|
|
588
|
+
C.HEAP32[address >>> 2] = offsetBytes;
|
|
589
|
+
marshalPoint(address + SIZE_OF_INT, offsetExtent);
|
|
590
|
+
C._ts_tree_root_node_with_offset_wasm(this[0]);
|
|
591
|
+
return unmarshalNode(this);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Edit the syntax tree to keep it in sync with source code that has been
|
|
595
|
+
* edited.
|
|
596
|
+
*
|
|
597
|
+
* You must describe the edit both in terms of byte offsets and in terms of
|
|
598
|
+
* row/column coordinates.
|
|
599
|
+
*/
|
|
600
|
+
edit(edit) {
|
|
601
|
+
marshalEdit(edit);
|
|
602
|
+
C._ts_tree_edit_wasm(this[0]);
|
|
603
|
+
this.editVersion++;
|
|
604
|
+
}
|
|
605
|
+
/** Create a new {@link TreeCursor} starting from the root of the tree. */
|
|
606
|
+
walk() {
|
|
607
|
+
C._ts_tree_root_node_wasm(this[0]);
|
|
608
|
+
const address = C._ts_tree_cursor_new_wasm(this[0]);
|
|
609
|
+
return new TreeCursor(INTERNAL, this, address);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Compare this old edited syntax tree to a new syntax tree representing
|
|
613
|
+
* the same document, returning a sequence of ranges whose syntactic
|
|
614
|
+
* structure has changed.
|
|
615
|
+
*
|
|
616
|
+
* For this to work correctly, this syntax tree must have been edited such
|
|
617
|
+
* that its ranges match up to the new tree. Generally, you'll want to
|
|
618
|
+
* call this method right after calling one of the [`Parser::parse`]
|
|
619
|
+
* functions. Call it on the old tree that was passed to parse, and
|
|
620
|
+
* pass the new tree that was returned from `parse`.
|
|
621
|
+
*/
|
|
622
|
+
getChangedRanges(other) {
|
|
623
|
+
if (!(other instanceof _Tree)) {
|
|
624
|
+
throw new TypeError("Argument must be a Tree");
|
|
625
|
+
}
|
|
626
|
+
C._ts_tree_get_changed_ranges_wasm(this[0], other[0]);
|
|
627
|
+
return unmarshalRanges();
|
|
628
|
+
}
|
|
629
|
+
/** Get the included ranges that were used to parse the syntax tree. */
|
|
630
|
+
getIncludedRanges() {
|
|
631
|
+
C._ts_tree_included_ranges_wasm(this[0]);
|
|
632
|
+
return unmarshalRanges();
|
|
643
633
|
}
|
|
644
634
|
};
|
|
645
635
|
|
|
@@ -780,7 +770,8 @@ var Node = class {
|
|
|
780
770
|
}
|
|
781
771
|
/** Get the string content of this node. */
|
|
782
772
|
get text() {
|
|
783
|
-
|
|
773
|
+
const { textSource } = this.tree;
|
|
774
|
+
return typeof textSource === "string" ? textSource.slice(this.startIndex, this.endIndex) : getCallbackText(textSource, this.startIndex, this.endIndex, this.startPosition);
|
|
784
775
|
}
|
|
785
776
|
/** Get this node's parse state. */
|
|
786
777
|
get parseState() {
|
|
@@ -875,24 +866,13 @@ var Node = class {
|
|
|
875
866
|
childrenForFieldId(fieldId) {
|
|
876
867
|
marshalNode(this);
|
|
877
868
|
C._ts_node_children_by_field_id_wasm(this.tree[0], fieldId);
|
|
878
|
-
|
|
879
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
880
|
-
const result = new Array(count);
|
|
881
|
-
if (count > 0) {
|
|
882
|
-
let address = buffer;
|
|
883
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
884
|
-
result[i2] = unmarshalNode(this.tree, address);
|
|
885
|
-
address += SIZE_OF_NODE;
|
|
886
|
-
}
|
|
887
|
-
C._ts_free_wasm(buffer);
|
|
888
|
-
}
|
|
889
|
-
return result;
|
|
869
|
+
return unmarshalNodeArray(this.tree, true);
|
|
890
870
|
}
|
|
891
871
|
/** Get the node's first child that contains or starts after the given byte offset. */
|
|
892
872
|
firstChildForIndex(index) {
|
|
893
873
|
marshalNode(this);
|
|
894
874
|
const address = TRANSFER_BUFFER + SIZE_OF_NODE;
|
|
895
|
-
C.
|
|
875
|
+
C.HEAP32[address >>> 2] = index;
|
|
896
876
|
C._ts_node_first_child_for_byte_wasm(this.tree[0]);
|
|
897
877
|
return unmarshalNode(this.tree);
|
|
898
878
|
}
|
|
@@ -900,7 +880,7 @@ var Node = class {
|
|
|
900
880
|
firstNamedChildForIndex(index) {
|
|
901
881
|
marshalNode(this);
|
|
902
882
|
const address = TRANSFER_BUFFER + SIZE_OF_NODE;
|
|
903
|
-
C.
|
|
883
|
+
C.HEAP32[address >>> 2] = index;
|
|
904
884
|
C._ts_node_first_named_child_for_byte_wasm(this.tree[0]);
|
|
905
885
|
return unmarshalNode(this.tree);
|
|
906
886
|
}
|
|
@@ -952,17 +932,7 @@ var Node = class {
|
|
|
952
932
|
if (!this._children) {
|
|
953
933
|
marshalNode(this);
|
|
954
934
|
C._ts_node_children_wasm(this.tree[0]);
|
|
955
|
-
|
|
956
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
957
|
-
this._children = new Array(count);
|
|
958
|
-
if (count > 0) {
|
|
959
|
-
let address = buffer;
|
|
960
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
961
|
-
this._children[i2] = unmarshalNode(this.tree, address);
|
|
962
|
-
address += SIZE_OF_NODE;
|
|
963
|
-
}
|
|
964
|
-
C._free(buffer);
|
|
965
|
-
}
|
|
935
|
+
this._children = unmarshalNodeArray(this.tree);
|
|
966
936
|
}
|
|
967
937
|
return this._children;
|
|
968
938
|
}
|
|
@@ -975,17 +945,7 @@ var Node = class {
|
|
|
975
945
|
if (!this._namedChildren) {
|
|
976
946
|
marshalNode(this);
|
|
977
947
|
C._ts_node_named_children_wasm(this.tree[0]);
|
|
978
|
-
|
|
979
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
980
|
-
this._namedChildren = new Array(count);
|
|
981
|
-
if (count > 0) {
|
|
982
|
-
let address = buffer;
|
|
983
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
984
|
-
this._namedChildren[i2] = unmarshalNode(this.tree, address);
|
|
985
|
-
address += SIZE_OF_NODE;
|
|
986
|
-
}
|
|
987
|
-
C._free(buffer);
|
|
988
|
-
}
|
|
948
|
+
this._namedChildren = unmarshalNodeArray(this.tree);
|
|
989
949
|
}
|
|
990
950
|
return this._namedChildren;
|
|
991
951
|
}
|
|
@@ -1009,30 +969,21 @@ var Node = class {
|
|
|
1009
969
|
symbols.push(65535);
|
|
1010
970
|
}
|
|
1011
971
|
const symbolsAddress = C._malloc(SIZE_OF_INT * symbols.length);
|
|
972
|
+
const symbolsHeap = C.HEAPU32;
|
|
973
|
+
const symbolsBase = symbolsAddress >>> 2;
|
|
1012
974
|
for (let i2 = 0, n = symbols.length; i2 < n; i2++) {
|
|
1013
|
-
|
|
975
|
+
symbolsHeap[symbolsBase + i2] = symbols[i2];
|
|
1014
976
|
}
|
|
1015
977
|
marshalNode(this);
|
|
978
|
+
const pointAddress = TRANSFER_BUFFER + SIZE_OF_NODE;
|
|
979
|
+
marshalPoint(pointAddress, startPosition);
|
|
980
|
+
marshalPoint(pointAddress + SIZE_OF_POINT, endPosition);
|
|
1016
981
|
C._ts_node_descendants_of_type_wasm(
|
|
1017
982
|
this.tree[0],
|
|
1018
983
|
symbolsAddress,
|
|
1019
|
-
symbols.length
|
|
1020
|
-
startPosition.row,
|
|
1021
|
-
startPosition.column,
|
|
1022
|
-
endPosition.row,
|
|
1023
|
-
endPosition.column
|
|
984
|
+
symbols.length
|
|
1024
985
|
);
|
|
1025
|
-
const
|
|
1026
|
-
const descendantAddress = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
1027
|
-
const result = new Array(descendantCount);
|
|
1028
|
-
if (descendantCount > 0) {
|
|
1029
|
-
let address = descendantAddress;
|
|
1030
|
-
for (let i2 = 0; i2 < descendantCount; i2++) {
|
|
1031
|
-
result[i2] = unmarshalNode(this.tree, address);
|
|
1032
|
-
address += SIZE_OF_NODE;
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
C._ts_free_wasm(descendantAddress);
|
|
986
|
+
const result = unmarshalNodeArray(this.tree, true);
|
|
1036
987
|
C._free(symbolsAddress);
|
|
1037
988
|
return result;
|
|
1038
989
|
}
|
|
@@ -1100,9 +1051,10 @@ var Node = class {
|
|
|
1100
1051
|
throw new Error("Arguments must be numbers");
|
|
1101
1052
|
}
|
|
1102
1053
|
marshalNode(this);
|
|
1103
|
-
const
|
|
1104
|
-
C.
|
|
1105
|
-
|
|
1054
|
+
const base = TRANSFER_BUFFER + SIZE_OF_NODE >>> 2;
|
|
1055
|
+
const heap = C.HEAP32;
|
|
1056
|
+
heap[base] = start2;
|
|
1057
|
+
heap[base + 1] = end;
|
|
1106
1058
|
C._ts_node_descendant_for_index_wasm(this.tree[0]);
|
|
1107
1059
|
return unmarshalNode(this.tree);
|
|
1108
1060
|
}
|
|
@@ -1112,9 +1064,10 @@ var Node = class {
|
|
|
1112
1064
|
throw new Error("Arguments must be numbers");
|
|
1113
1065
|
}
|
|
1114
1066
|
marshalNode(this);
|
|
1115
|
-
const
|
|
1116
|
-
C.
|
|
1117
|
-
|
|
1067
|
+
const base = TRANSFER_BUFFER + SIZE_OF_NODE >>> 2;
|
|
1068
|
+
const heap = C.HEAP32;
|
|
1069
|
+
heap[base] = start2;
|
|
1070
|
+
heap[base + 1] = end;
|
|
1118
1071
|
C._ts_node_named_descendant_for_index_wasm(this.tree[0]);
|
|
1119
1072
|
return unmarshalNode(this.tree);
|
|
1120
1073
|
}
|
|
@@ -1150,8 +1103,8 @@ var Node = class {
|
|
|
1150
1103
|
*/
|
|
1151
1104
|
walk() {
|
|
1152
1105
|
marshalNode(this);
|
|
1153
|
-
C._ts_tree_cursor_new_wasm(this.tree[0]);
|
|
1154
|
-
return new TreeCursor(INTERNAL, this.tree);
|
|
1106
|
+
const address = C._ts_tree_cursor_new_wasm(this.tree[0]);
|
|
1107
|
+
return new TreeCursor(INTERNAL, this.tree, address);
|
|
1155
1108
|
}
|
|
1156
1109
|
/**
|
|
1157
1110
|
* Edit this node to keep it in-sync with source code that has been edited.
|
|
@@ -1179,109 +1132,130 @@ var Node = class {
|
|
|
1179
1132
|
|
|
1180
1133
|
// src/marshal.ts
|
|
1181
1134
|
function marshalNode(node, index = 0) {
|
|
1182
|
-
|
|
1183
|
-
C.
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
C.setValue(address, node.startPosition.column, "i32");
|
|
1190
|
-
address += SIZE_OF_INT;
|
|
1191
|
-
C.setValue(address, node[0], "i32");
|
|
1135
|
+
const base = TRANSFER_BUFFER + index * SIZE_OF_NODE >>> 2;
|
|
1136
|
+
const heap = C.HEAP32;
|
|
1137
|
+
heap[base] = node.id;
|
|
1138
|
+
heap[base + 1] = node.startIndex;
|
|
1139
|
+
heap[base + 2] = node.startPosition.row;
|
|
1140
|
+
heap[base + 3] = node.startPosition.column;
|
|
1141
|
+
heap[base + 4] = node[0];
|
|
1192
1142
|
}
|
|
1193
1143
|
__name(marshalNode, "marshalNode");
|
|
1194
1144
|
function unmarshalNode(tree, address = TRANSFER_BUFFER) {
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1145
|
+
const base = address >>> 2;
|
|
1146
|
+
const heap = C.HEAP32;
|
|
1147
|
+
const id = heap[base];
|
|
1197
1148
|
if (id === 0) return null;
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
-
const row = C.getValue(address, "i32");
|
|
1201
|
-
address += SIZE_OF_INT;
|
|
1202
|
-
const column = C.getValue(address, "i32");
|
|
1203
|
-
address += SIZE_OF_INT;
|
|
1204
|
-
const other = C.getValue(address, "i32");
|
|
1205
|
-
const result = new Node(INTERNAL, {
|
|
1149
|
+
const heapU32 = C.HEAPU32;
|
|
1150
|
+
return new Node(INTERNAL, {
|
|
1206
1151
|
id,
|
|
1207
1152
|
tree,
|
|
1208
|
-
startIndex:
|
|
1209
|
-
startPosition: { row, column },
|
|
1210
|
-
other
|
|
1153
|
+
startIndex: heapU32[base + 1],
|
|
1154
|
+
startPosition: { row: heapU32[base + 2], column: heapU32[base + 3] },
|
|
1155
|
+
other: heap[base + 4]
|
|
1211
1156
|
});
|
|
1212
|
-
return result;
|
|
1213
1157
|
}
|
|
1214
1158
|
__name(unmarshalNode, "unmarshalNode");
|
|
1215
|
-
function marshalTreeCursor({ handles }, address = TRANSFER_BUFFER) {
|
|
1216
|
-
C.setValue(address + 0 * SIZE_OF_INT, handles[0], "i32");
|
|
1217
|
-
C.setValue(address + 1 * SIZE_OF_INT, handles[1], "i32");
|
|
1218
|
-
C.setValue(address + 2 * SIZE_OF_INT, handles[2], "i32");
|
|
1219
|
-
C.setValue(address + 3 * SIZE_OF_INT, handles[3], "i32");
|
|
1220
|
-
}
|
|
1221
|
-
__name(marshalTreeCursor, "marshalTreeCursor");
|
|
1222
|
-
function unmarshalTreeCursor({ handles }) {
|
|
1223
|
-
handles[0] = C.getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, "i32");
|
|
1224
|
-
handles[1] = C.getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, "i32");
|
|
1225
|
-
handles[2] = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
|
|
1226
|
-
handles[3] = C.getValue(TRANSFER_BUFFER + 3 * SIZE_OF_INT, "i32");
|
|
1227
|
-
}
|
|
1228
|
-
__name(unmarshalTreeCursor, "unmarshalTreeCursor");
|
|
1229
1159
|
function marshalPoint(address, point) {
|
|
1230
|
-
|
|
1231
|
-
|
|
1160
|
+
const base = address >>> 2;
|
|
1161
|
+
const heap = C.HEAP32;
|
|
1162
|
+
heap[base] = point.row;
|
|
1163
|
+
heap[base + 1] = point.column;
|
|
1232
1164
|
}
|
|
1233
1165
|
__name(marshalPoint, "marshalPoint");
|
|
1234
1166
|
function unmarshalPoint(address) {
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1237
|
-
|
|
1167
|
+
const base = address >>> 2;
|
|
1168
|
+
const heap = C.HEAPU32;
|
|
1169
|
+
return {
|
|
1170
|
+
row: heap[base],
|
|
1171
|
+
column: heap[base + 1]
|
|
1238
1172
|
};
|
|
1239
|
-
return result;
|
|
1240
1173
|
}
|
|
1241
1174
|
__name(unmarshalPoint, "unmarshalPoint");
|
|
1242
1175
|
function marshalRange(address, range) {
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1176
|
+
const base = address >>> 2;
|
|
1177
|
+
const heap = C.HEAP32;
|
|
1178
|
+
heap[base] = range.startPosition.row;
|
|
1179
|
+
heap[base + 1] = range.startPosition.column;
|
|
1180
|
+
heap[base + 2] = range.endPosition.row;
|
|
1181
|
+
heap[base + 3] = range.endPosition.column;
|
|
1182
|
+
heap[base + 4] = range.startIndex;
|
|
1183
|
+
heap[base + 5] = range.endIndex;
|
|
1250
1184
|
}
|
|
1251
1185
|
__name(marshalRange, "marshalRange");
|
|
1252
1186
|
function unmarshalRange(address) {
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
return result;
|
|
1187
|
+
const base = address >>> 2;
|
|
1188
|
+
const heap = C.HEAPU32;
|
|
1189
|
+
return {
|
|
1190
|
+
startPosition: { row: heap[base], column: heap[base + 1] },
|
|
1191
|
+
endPosition: { row: heap[base + 2], column: heap[base + 3] },
|
|
1192
|
+
startIndex: heap[base + 4],
|
|
1193
|
+
endIndex: heap[base + 5]
|
|
1194
|
+
};
|
|
1262
1195
|
}
|
|
1263
1196
|
__name(unmarshalRange, "unmarshalRange");
|
|
1264
1197
|
function marshalEdit(edit, address = TRANSFER_BUFFER) {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1198
|
+
const base = address >>> 2;
|
|
1199
|
+
const heap = C.HEAP32;
|
|
1200
|
+
heap[base] = edit.startPosition.row;
|
|
1201
|
+
heap[base + 1] = edit.startPosition.column;
|
|
1202
|
+
heap[base + 2] = edit.oldEndPosition.row;
|
|
1203
|
+
heap[base + 3] = edit.oldEndPosition.column;
|
|
1204
|
+
heap[base + 4] = edit.newEndPosition.row;
|
|
1205
|
+
heap[base + 5] = edit.newEndPosition.column;
|
|
1206
|
+
heap[base + 6] = edit.startIndex;
|
|
1207
|
+
heap[base + 7] = edit.oldEndIndex;
|
|
1208
|
+
heap[base + 8] = edit.newEndIndex;
|
|
1276
1209
|
}
|
|
1277
1210
|
__name(marshalEdit, "marshalEdit");
|
|
1278
1211
|
function unmarshalLanguageMetadata(address) {
|
|
1279
|
-
const
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1282
|
-
|
|
1212
|
+
const base = address >>> 2;
|
|
1213
|
+
const heap = C.HEAP32;
|
|
1214
|
+
return {
|
|
1215
|
+
major_version: heap[base],
|
|
1216
|
+
minor_version: heap[base + 1],
|
|
1217
|
+
patch_version: heap[base + 2]
|
|
1218
|
+
};
|
|
1283
1219
|
}
|
|
1284
1220
|
__name(unmarshalLanguageMetadata, "unmarshalLanguageMetadata");
|
|
1221
|
+
function unmarshalSymbols() {
|
|
1222
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
1223
|
+
const count = C.HEAPU32[base];
|
|
1224
|
+
const buffer = C.HEAPU32[base + 1];
|
|
1225
|
+
const result = new Array(count);
|
|
1226
|
+
if (count > 0) {
|
|
1227
|
+
const symbolBase = buffer >>> 1;
|
|
1228
|
+
const heapU16 = C.HEAPU16;
|
|
1229
|
+
for (let i2 = 0; i2 < count; i2++) {
|
|
1230
|
+
result[i2] = heapU16[symbolBase + i2];
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
return result;
|
|
1234
|
+
}
|
|
1235
|
+
__name(unmarshalSymbols, "unmarshalSymbols");
|
|
1236
|
+
function unmarshalRanges(useTsFree = true) {
|
|
1237
|
+
return unmarshalArray(SIZE_OF_RANGE, unmarshalRange, useTsFree);
|
|
1238
|
+
}
|
|
1239
|
+
__name(unmarshalRanges, "unmarshalRanges");
|
|
1240
|
+
function unmarshalNodeArray(tree, useTsFree = false) {
|
|
1241
|
+
return unmarshalArray(SIZE_OF_NODE, (address) => unmarshalNode(tree, address), useTsFree);
|
|
1242
|
+
}
|
|
1243
|
+
__name(unmarshalNodeArray, "unmarshalNodeArray");
|
|
1244
|
+
function unmarshalArray(stride, readItem, useTsFree) {
|
|
1245
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
1246
|
+
const count = C.HEAPU32[base];
|
|
1247
|
+
const buffer = C.HEAP32[base + 1];
|
|
1248
|
+
const result = new Array(count);
|
|
1249
|
+
for (let i2 = 0, address = buffer; i2 < count; i2++, address += stride) {
|
|
1250
|
+
result[i2] = readItem(address);
|
|
1251
|
+
}
|
|
1252
|
+
if (buffer) {
|
|
1253
|
+
if (useTsFree) C._ts_free_wasm(buffer);
|
|
1254
|
+
else C._free(buffer);
|
|
1255
|
+
}
|
|
1256
|
+
return result;
|
|
1257
|
+
}
|
|
1258
|
+
__name(unmarshalArray, "unmarshalArray");
|
|
1285
1259
|
|
|
1286
1260
|
// src/language.ts
|
|
1287
1261
|
var LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/;
|
|
@@ -1343,7 +1317,7 @@ var Language = class {
|
|
|
1343
1317
|
*/
|
|
1344
1318
|
get metadata() {
|
|
1345
1319
|
C._ts_language_metadata_wasm(this[0]);
|
|
1346
|
-
const length = C.
|
|
1320
|
+
const length = C.HEAP32[TRANSFER_BUFFER >>> 2];
|
|
1347
1321
|
if (length === 0) return null;
|
|
1348
1322
|
return unmarshalLanguageMetadata(TRANSFER_BUFFER + SIZE_OF_INT);
|
|
1349
1323
|
}
|
|
@@ -1417,34 +1391,14 @@ var Language = class {
|
|
|
1417
1391
|
*/
|
|
1418
1392
|
get supertypes() {
|
|
1419
1393
|
C._ts_language_supertypes_wasm(this[0]);
|
|
1420
|
-
|
|
1421
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
1422
|
-
const result = new Array(count);
|
|
1423
|
-
if (count > 0) {
|
|
1424
|
-
let address = buffer;
|
|
1425
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
1426
|
-
result[i2] = C.getValue(address, "i16");
|
|
1427
|
-
address += SIZE_OF_SHORT;
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
return result;
|
|
1394
|
+
return unmarshalSymbols();
|
|
1431
1395
|
}
|
|
1432
1396
|
/**
|
|
1433
1397
|
* Get the subtype ids for a given supertype node id.
|
|
1434
1398
|
*/
|
|
1435
1399
|
subtypes(supertype) {
|
|
1436
1400
|
C._ts_language_subtypes_wasm(this[0], supertype);
|
|
1437
|
-
|
|
1438
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
1439
|
-
const result = new Array(count);
|
|
1440
|
-
if (count > 0) {
|
|
1441
|
-
let address = buffer;
|
|
1442
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
1443
|
-
result[i2] = C.getValue(address, "i16");
|
|
1444
|
-
address += SIZE_OF_SHORT;
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
return result;
|
|
1401
|
+
return unmarshalSymbols();
|
|
1448
1402
|
}
|
|
1449
1403
|
/**
|
|
1450
1404
|
* Get the next state id for a given state id and node type id.
|
|
@@ -1692,8 +1646,8 @@ async function Module2(moduleArg = {}) {
|
|
|
1692
1646
|
if (max == 0) {
|
|
1693
1647
|
max += 4;
|
|
1694
1648
|
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1649
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, max >> 2, "storing")] = 34821223;
|
|
1650
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, max + 4 >> 2, "storing")] = 2310721022;
|
|
1697
1651
|
}
|
|
1698
1652
|
__name(writeStackCookie, "writeStackCookie");
|
|
1699
1653
|
function checkStackCookie() {
|
|
@@ -1702,8 +1656,8 @@ async function Module2(moduleArg = {}) {
|
|
|
1702
1656
|
if (max == 0) {
|
|
1703
1657
|
max += 4;
|
|
1704
1658
|
}
|
|
1705
|
-
var cookie1 =
|
|
1706
|
-
var cookie2 =
|
|
1659
|
+
var cookie1 = HEAPU32[SAFE_HEAP_INDEX(HEAPU32, max >> 2, "loading")];
|
|
1660
|
+
var cookie2 = HEAPU32[SAFE_HEAP_INDEX(HEAPU32, max + 4 >> 2, "loading")];
|
|
1707
1661
|
if (cookie1 != 34821223 || cookie2 != 2310721022) {
|
|
1708
1662
|
abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
|
|
1709
1663
|
}
|
|
@@ -1715,6 +1669,12 @@ async function Module2(moduleArg = {}) {
|
|
|
1715
1669
|
console.warn(...args2);
|
|
1716
1670
|
}
|
|
1717
1671
|
__name(dbg, "dbg");
|
|
1672
|
+
(() => {
|
|
1673
|
+
var h16 = new Int16Array(1);
|
|
1674
|
+
var h8 = new Int8Array(h16.buffer);
|
|
1675
|
+
h16[0] = 25459;
|
|
1676
|
+
if (h8[0] !== 115 || h8[1] !== 99) abort("Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)");
|
|
1677
|
+
})();
|
|
1718
1678
|
function consumedModuleProp(prop) {
|
|
1719
1679
|
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
1720
1680
|
Object.defineProperty(Module, prop, {
|
|
@@ -1785,29 +1745,26 @@ async function Module2(moduleArg = {}) {
|
|
|
1785
1745
|
var wasmMemory;
|
|
1786
1746
|
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
1787
1747
|
var HEAP64, HEAPU64;
|
|
1788
|
-
var HEAP_DATA_VIEW;
|
|
1789
1748
|
var runtimeInitialized = false;
|
|
1790
1749
|
function updateMemoryViews() {
|
|
1791
1750
|
var b = wasmMemory.buffer;
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1751
|
+
HEAP8 = new Int8Array(b);
|
|
1752
|
+
HEAP16 = new Int16Array(b);
|
|
1753
|
+
HEAPU8 = new Uint8Array(b);
|
|
1795
1754
|
Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
|
|
1796
1755
|
Module["HEAP32"] = HEAP32 = new Int32Array(b);
|
|
1797
1756
|
Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
Module["HEAP_DATA_VIEW"] = HEAP_DATA_VIEW = new DataView(b);
|
|
1803
|
-
LE_HEAP_UPDATE();
|
|
1757
|
+
HEAPF32 = new Float32Array(b);
|
|
1758
|
+
HEAPF64 = new Float64Array(b);
|
|
1759
|
+
HEAP64 = new BigInt64Array(b);
|
|
1760
|
+
HEAPU64 = new BigUint64Array(b);
|
|
1804
1761
|
}
|
|
1805
1762
|
__name(updateMemoryViews, "updateMemoryViews");
|
|
1806
1763
|
function initMemory() {
|
|
1807
1764
|
if (Module["wasmMemory"]) {
|
|
1808
1765
|
wasmMemory = Module["wasmMemory"];
|
|
1809
1766
|
} else {
|
|
1810
|
-
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] ||
|
|
1767
|
+
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 4194304;
|
|
1811
1768
|
assert(INITIAL_MEMORY >= 65536, "INITIAL_MEMORY should be larger than STACK_SIZE, was " + INITIAL_MEMORY + "! (STACK_SIZE=65536)");
|
|
1812
1769
|
wasmMemory = new WebAssembly.Memory({
|
|
1813
1770
|
"initial": INITIAL_MEMORY / 65536,
|
|
@@ -2052,77 +2009,6 @@ async function Module2(moduleArg = {}) {
|
|
|
2052
2009
|
return rtn;
|
|
2053
2010
|
}
|
|
2054
2011
|
};
|
|
2055
|
-
var LE_ATOMICS_ADD = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2056
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2057
|
-
const res = order(Atomics.add(heap, offset, order(value)));
|
|
2058
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2059
|
-
}, "LE_ATOMICS_ADD");
|
|
2060
|
-
var LE_ATOMICS_AND = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2061
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2062
|
-
const res = order(Atomics.and(heap, offset, order(value)));
|
|
2063
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2064
|
-
}, "LE_ATOMICS_AND");
|
|
2065
|
-
var LE_ATOMICS_COMPAREEXCHANGE = /* @__PURE__ */ __name((heap, offset, expected, replacement) => {
|
|
2066
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2067
|
-
const res = order(Atomics.compareExchange(heap, offset, order(expected), order(replacement)));
|
|
2068
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2069
|
-
}, "LE_ATOMICS_COMPAREEXCHANGE");
|
|
2070
|
-
var LE_ATOMICS_EXCHANGE = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2071
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2072
|
-
const res = order(Atomics.exchange(heap, offset, order(value)));
|
|
2073
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2074
|
-
}, "LE_ATOMICS_EXCHANGE");
|
|
2075
|
-
var LE_ATOMICS_ISLOCKFREE = /* @__PURE__ */ __name((size) => Atomics.isLockFree(size), "LE_ATOMICS_ISLOCKFREE");
|
|
2076
|
-
var LE_ATOMICS_LOAD = /* @__PURE__ */ __name((heap, offset) => {
|
|
2077
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2078
|
-
const res = order(Atomics.load(heap, offset));
|
|
2079
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2080
|
-
}, "LE_ATOMICS_LOAD");
|
|
2081
|
-
var LE_ATOMICS_NATIVE_BYTE_ORDER = [];
|
|
2082
|
-
var LE_ATOMICS_NOTIFY = /* @__PURE__ */ __name((heap, offset, count) => Atomics.notify(heap, offset, count), "LE_ATOMICS_NOTIFY");
|
|
2083
|
-
var LE_ATOMICS_OR = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2084
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2085
|
-
const res = order(Atomics.or(heap, offset, order(value)));
|
|
2086
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2087
|
-
}, "LE_ATOMICS_OR");
|
|
2088
|
-
var LE_ATOMICS_STORE = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2089
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2090
|
-
Atomics.store(heap, offset, order(value));
|
|
2091
|
-
}, "LE_ATOMICS_STORE");
|
|
2092
|
-
var LE_ATOMICS_SUB = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2093
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2094
|
-
const res = order(Atomics.sub(heap, offset, order(value)));
|
|
2095
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2096
|
-
}, "LE_ATOMICS_SUB");
|
|
2097
|
-
var LE_ATOMICS_WAIT = /* @__PURE__ */ __name((heap, offset, value, timeout) => {
|
|
2098
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2099
|
-
return Atomics.wait(heap, offset, order(value), timeout);
|
|
2100
|
-
}, "LE_ATOMICS_WAIT");
|
|
2101
|
-
var LE_ATOMICS_WAITASYNC = /* @__PURE__ */ __name((heap, offset, value, timeout) => {
|
|
2102
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2103
|
-
return Atomics.waitAsync(heap, offset, order(value), timeout);
|
|
2104
|
-
}, "LE_ATOMICS_WAITASYNC");
|
|
2105
|
-
var LE_ATOMICS_XOR = /* @__PURE__ */ __name((heap, offset, value) => {
|
|
2106
|
-
const order = LE_ATOMICS_NATIVE_BYTE_ORDER[heap.BYTES_PER_ELEMENT - 1];
|
|
2107
|
-
const res = order(Atomics.xor(heap, offset, order(value)));
|
|
2108
|
-
return heap.unsigned ? heap.unsigned(res) : res;
|
|
2109
|
-
}, "LE_ATOMICS_XOR");
|
|
2110
|
-
var LE_HEAP_LOAD_F32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat32(byteOffset, true), "LE_HEAP_LOAD_F32");
|
|
2111
|
-
var LE_HEAP_LOAD_F64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat64(byteOffset, true), "LE_HEAP_LOAD_F64");
|
|
2112
|
-
var LE_HEAP_LOAD_I16 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt16(byteOffset, true), "LE_HEAP_LOAD_I16");
|
|
2113
|
-
var LE_HEAP_LOAD_I32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt32(byteOffset, true), "LE_HEAP_LOAD_I32");
|
|
2114
|
-
var LE_HEAP_LOAD_I64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getBigInt64(byteOffset, true), "LE_HEAP_LOAD_I64");
|
|
2115
|
-
var LE_HEAP_LOAD_U16 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getUint16(byteOffset, true), "LE_HEAP_LOAD_U16");
|
|
2116
|
-
var LE_HEAP_LOAD_U32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getUint32(byteOffset, true), "LE_HEAP_LOAD_U32");
|
|
2117
|
-
var LE_HEAP_LOAD_U64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getBigUint64(byteOffset, true), "LE_HEAP_LOAD_U64");
|
|
2118
|
-
var LE_HEAP_STORE_F32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat32(byteOffset, value, true), "LE_HEAP_STORE_F32");
|
|
2119
|
-
var LE_HEAP_STORE_F64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat64(byteOffset, value, true), "LE_HEAP_STORE_F64");
|
|
2120
|
-
var LE_HEAP_STORE_I16 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt16(byteOffset, value, true), "LE_HEAP_STORE_I16");
|
|
2121
|
-
var LE_HEAP_STORE_I32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt32(byteOffset, value, true), "LE_HEAP_STORE_I32");
|
|
2122
|
-
var LE_HEAP_STORE_I64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setBigInt64(byteOffset, value, true), "LE_HEAP_STORE_I64");
|
|
2123
|
-
var LE_HEAP_STORE_U16 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setUint16(byteOffset, value, true), "LE_HEAP_STORE_U16");
|
|
2124
|
-
var LE_HEAP_STORE_U32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setUint32(byteOffset, value, true), "LE_HEAP_STORE_U32");
|
|
2125
|
-
var LE_HEAP_STORE_U64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setBigUint64(byteOffset, value, true), "LE_HEAP_STORE_U64");
|
|
2126
2012
|
var callRuntimeCallbacks = /* @__PURE__ */ __name((callbacks) => {
|
|
2127
2013
|
while (callbacks.length > 0) {
|
|
2128
2014
|
callbacks.shift()(Module);
|
|
@@ -2223,7 +2109,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2223
2109
|
end = binary2.length;
|
|
2224
2110
|
} else {
|
|
2225
2111
|
var int32View = new Uint32Array(new Uint8Array(binary2.subarray(0, 24)).buffer);
|
|
2226
|
-
var magicNumberFound = int32View[0] == 1836278016
|
|
2112
|
+
var magicNumberFound = int32View[0] == 1836278016;
|
|
2227
2113
|
failIf(!magicNumberFound, "need to see wasm magic number");
|
|
2228
2114
|
failIf(binary2[8] !== 0, "need the dylink section to be first");
|
|
2229
2115
|
offset = 9;
|
|
@@ -2295,17 +2181,17 @@ async function Module2(moduleArg = {}) {
|
|
|
2295
2181
|
case "i8":
|
|
2296
2182
|
return HEAP8[SAFE_HEAP_INDEX(HEAP8, ptr, "loading")];
|
|
2297
2183
|
case "i16":
|
|
2298
|
-
return
|
|
2184
|
+
return HEAP16[SAFE_HEAP_INDEX(HEAP16, ptr >> 1, "loading")];
|
|
2299
2185
|
case "i32":
|
|
2300
|
-
return
|
|
2186
|
+
return HEAP32[SAFE_HEAP_INDEX(HEAP32, ptr >> 2, "loading")];
|
|
2301
2187
|
case "i64":
|
|
2302
|
-
return
|
|
2188
|
+
return HEAP64[SAFE_HEAP_INDEX(HEAP64, ptr >> 3, "loading")];
|
|
2303
2189
|
case "float":
|
|
2304
|
-
return
|
|
2190
|
+
return HEAPF32[SAFE_HEAP_INDEX(HEAPF32, ptr >> 2, "loading")];
|
|
2305
2191
|
case "double":
|
|
2306
|
-
return
|
|
2192
|
+
return HEAPF64[SAFE_HEAP_INDEX(HEAPF64, ptr >> 3, "loading")];
|
|
2307
2193
|
case "*":
|
|
2308
|
-
return
|
|
2194
|
+
return HEAPU32[SAFE_HEAP_INDEX(HEAPU32, ptr >> 2, "loading")];
|
|
2309
2195
|
default:
|
|
2310
2196
|
abort(`invalid type for getValue: ${type}`);
|
|
2311
2197
|
}
|
|
@@ -2332,7 +2218,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2332
2218
|
newDSO("__main__", 0, wasmImports);
|
|
2333
2219
|
}
|
|
2334
2220
|
};
|
|
2335
|
-
var ___heap_base =
|
|
2221
|
+
var ___heap_base = 82464;
|
|
2336
2222
|
var alignMemory = /* @__PURE__ */ __name((size, alignment) => {
|
|
2337
2223
|
assert(alignment, "alignment argument is required");
|
|
2338
2224
|
return Math.ceil(size / alignment) * alignment;
|
|
@@ -2427,7 +2313,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2427
2313
|
}, "convertJsFunctionToWasm");
|
|
2428
2314
|
var wasmTableMirror = [];
|
|
2429
2315
|
var wasmTable = new WebAssembly.Table({
|
|
2430
|
-
"initial":
|
|
2316
|
+
"initial": 59,
|
|
2431
2317
|
"element": "anyfunc"
|
|
2432
2318
|
});
|
|
2433
2319
|
var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
|
|
@@ -2588,10 +2474,10 @@ async function Module2(moduleArg = {}) {
|
|
|
2588
2474
|
var tableBase = metadata.tableSize ? wasmTable.length : 0;
|
|
2589
2475
|
if (handle) {
|
|
2590
2476
|
HEAP8[SAFE_HEAP_INDEX(HEAP8, handle + 8, "storing")] = 1;
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2477
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, handle + 12 >> 2, "storing")] = memoryBase;
|
|
2478
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, handle + 16 >> 2, "storing")] = metadata.memorySize;
|
|
2479
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, handle + 20 >> 2, "storing")] = tableBase;
|
|
2480
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, handle + 24 >> 2, "storing")] = metadata.tableSize;
|
|
2595
2481
|
}
|
|
2596
2482
|
if (metadata.tableSize) {
|
|
2597
2483
|
assert(wasmTable.length == tableBase, `unexpected table size while loading ${libName}: ${wasmTable.length}`);
|
|
@@ -2793,8 +2679,8 @@ async function Module2(moduleArg = {}) {
|
|
|
2793
2679
|
dso.global = flags2.global;
|
|
2794
2680
|
function loadLibData() {
|
|
2795
2681
|
if (handle2) {
|
|
2796
|
-
var data =
|
|
2797
|
-
var dataSize =
|
|
2682
|
+
var data = HEAPU32[SAFE_HEAP_INDEX(HEAPU32, handle2 + 28 >> 2, "loading")];
|
|
2683
|
+
var dataSize = HEAPU32[SAFE_HEAP_INDEX(HEAPU32, handle2 + 32 >> 2, "loading")];
|
|
2798
2684
|
if (data && dataSize) {
|
|
2799
2685
|
var libData = HEAP8.slice(data, data + dataSize);
|
|
2800
2686
|
return flags2.loadAsync ? Promise.resolve(libData) : libData;
|
|
@@ -2937,22 +2823,22 @@ async function Module2(moduleArg = {}) {
|
|
|
2937
2823
|
HEAP8[SAFE_HEAP_INDEX(HEAP8, ptr, "storing")] = value;
|
|
2938
2824
|
break;
|
|
2939
2825
|
case "i16":
|
|
2940
|
-
|
|
2826
|
+
HEAP16[SAFE_HEAP_INDEX(HEAP16, ptr >> 1, "storing")] = value;
|
|
2941
2827
|
break;
|
|
2942
2828
|
case "i32":
|
|
2943
|
-
|
|
2829
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, ptr >> 2, "storing")] = value;
|
|
2944
2830
|
break;
|
|
2945
2831
|
case "i64":
|
|
2946
|
-
|
|
2832
|
+
HEAP64[SAFE_HEAP_INDEX(HEAP64, ptr >> 3, "storing")] = BigInt(value);
|
|
2947
2833
|
break;
|
|
2948
2834
|
case "float":
|
|
2949
|
-
|
|
2835
|
+
HEAPF32[SAFE_HEAP_INDEX(HEAPF32, ptr >> 2, "storing")] = value;
|
|
2950
2836
|
break;
|
|
2951
2837
|
case "double":
|
|
2952
|
-
|
|
2838
|
+
HEAPF64[SAFE_HEAP_INDEX(HEAPF64, ptr >> 3, "storing")] = value;
|
|
2953
2839
|
break;
|
|
2954
2840
|
case "*":
|
|
2955
|
-
|
|
2841
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, ptr >> 2, "storing")] = value;
|
|
2956
2842
|
break;
|
|
2957
2843
|
default:
|
|
2958
2844
|
abort(`invalid type for setValue: ${type}`);
|
|
@@ -2963,18 +2849,16 @@ async function Module2(moduleArg = {}) {
|
|
|
2963
2849
|
"value": "i32",
|
|
2964
2850
|
"mutable": false
|
|
2965
2851
|
}, 1024);
|
|
2966
|
-
var ___stack_high =
|
|
2967
|
-
var ___stack_low =
|
|
2852
|
+
var ___stack_high = 82464;
|
|
2853
|
+
var ___stack_low = 16928;
|
|
2968
2854
|
var ___stack_pointer = new WebAssembly.Global({
|
|
2969
2855
|
"value": "i32",
|
|
2970
2856
|
"mutable": true
|
|
2971
|
-
},
|
|
2857
|
+
}, 82464);
|
|
2972
2858
|
var ___table_base = new WebAssembly.Global({
|
|
2973
2859
|
"value": "i32",
|
|
2974
2860
|
"mutable": false
|
|
2975
2861
|
}, 1);
|
|
2976
|
-
var __abort_js = /* @__PURE__ */ __name(() => abort("native code called abort()"), "__abort_js");
|
|
2977
|
-
__abort_js.sig = "v";
|
|
2978
2862
|
var __emscripten_throw_longjmp = /* @__PURE__ */ __name(() => {
|
|
2979
2863
|
throw Infinity;
|
|
2980
2864
|
}, "__emscripten_throw_longjmp");
|
|
@@ -3058,15 +2942,15 @@ async function Module2(moduleArg = {}) {
|
|
|
3058
2942
|
var _fd_write = /* @__PURE__ */ __name((fd, iov, iovcnt, pnum) => {
|
|
3059
2943
|
var num = 0;
|
|
3060
2944
|
for (var i2 = 0; i2 < iovcnt; i2++) {
|
|
3061
|
-
var ptr =
|
|
3062
|
-
var len =
|
|
2945
|
+
var ptr = HEAPU32[SAFE_HEAP_INDEX(HEAPU32, iov >> 2, "loading")];
|
|
2946
|
+
var len = HEAPU32[SAFE_HEAP_INDEX(HEAPU32, iov + 4 >> 2, "loading")];
|
|
3063
2947
|
iov += 8;
|
|
3064
2948
|
for (var j = 0; j < len; j++) {
|
|
3065
2949
|
printChar(fd, HEAPU8[SAFE_HEAP_INDEX(HEAPU8, ptr + j, "loading")]);
|
|
3066
2950
|
}
|
|
3067
2951
|
num += len;
|
|
3068
2952
|
}
|
|
3069
|
-
|
|
2953
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, pnum >> 2, "storing")] = num;
|
|
3070
2954
|
return 0;
|
|
3071
2955
|
}, "_fd_write");
|
|
3072
2956
|
_fd_write.sig = "iippp";
|
|
@@ -3077,18 +2961,29 @@ async function Module2(moduleArg = {}) {
|
|
|
3077
2961
|
}
|
|
3078
2962
|
}
|
|
3079
2963
|
__name(_tree_sitter_log_callback, "_tree_sitter_log_callback");
|
|
3080
|
-
function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
|
|
3081
|
-
const
|
|
3082
|
-
const
|
|
2964
|
+
function _tree_sitter_parse_callback(inputBufferAddress, maxCodeUnits, index, row, column, lengthAddress) {
|
|
2965
|
+
const source = Module.currentParseCallback;
|
|
2966
|
+
const isString = typeof source === "string";
|
|
2967
|
+
const chunk = isString ? source : source(index, {
|
|
3083
2968
|
row,
|
|
3084
2969
|
column
|
|
3085
2970
|
});
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
2971
|
+
const offset = isString ? index : 0;
|
|
2972
|
+
const remaining = typeof chunk === "string" ? chunk.length - offset : 0;
|
|
2973
|
+
if (remaining <= 0) {
|
|
2974
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, lengthAddress >>> 2, "storing")] = 0;
|
|
2975
|
+
return;
|
|
2976
|
+
}
|
|
2977
|
+
let count = remaining < maxCodeUnits ? remaining : maxCodeUnits;
|
|
2978
|
+
if (count < remaining && count > 1) {
|
|
2979
|
+
const last = chunk.charCodeAt(offset + count - 1);
|
|
2980
|
+
if (last >= 55296 && last <= 56319) count--;
|
|
2981
|
+
}
|
|
2982
|
+
const base = inputBufferAddress >>> 1;
|
|
2983
|
+
for (let i2 = 0; i2 < count; i2++) {
|
|
2984
|
+
HEAPU16[SAFE_HEAP_INDEX(HEAPU16, base + i2, "storing")] = chunk.charCodeAt(offset + i2);
|
|
3091
2985
|
}
|
|
2986
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, lengthAddress >>> 2, "storing")] = count;
|
|
3092
2987
|
}
|
|
3093
2988
|
__name(_tree_sitter_parse_callback, "_tree_sitter_parse_callback");
|
|
3094
2989
|
function _tree_sitter_progress_callback(currentOffset, hasError) {
|
|
@@ -3202,40 +3097,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3202
3097
|
str += String.fromCharCode(ch);
|
|
3203
3098
|
}
|
|
3204
3099
|
}, "AsciiToString");
|
|
3205
|
-
var stringToUTF16 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => {
|
|
3206
|
-
assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!");
|
|
3207
|
-
assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
|
|
3208
|
-
maxBytesToWrite ??= 2147483647;
|
|
3209
|
-
if (maxBytesToWrite < 2) return 0;
|
|
3210
|
-
maxBytesToWrite -= 2;
|
|
3211
|
-
var startPtr = outPtr;
|
|
3212
|
-
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
3213
|
-
for (var i2 = 0; i2 < numCharsToWrite; ++i2) {
|
|
3214
|
-
var codeUnit = str.charCodeAt(i2);
|
|
3215
|
-
LE_HEAP_STORE_I16(SAFE_HEAP_INDEX(HEAP16, outPtr >> 1, "storing") * 2, codeUnit);
|
|
3216
|
-
outPtr += 2;
|
|
3217
|
-
}
|
|
3218
|
-
LE_HEAP_STORE_I16(SAFE_HEAP_INDEX(HEAP16, outPtr >> 1, "storing") * 2, 0);
|
|
3219
|
-
return outPtr - startPtr;
|
|
3220
|
-
}, "stringToUTF16");
|
|
3221
|
-
LE_ATOMICS_NATIVE_BYTE_ORDER = new Int8Array(new Int16Array([1]).buffer)[0] === 1 ? [
|
|
3222
|
-
/* little endian */
|
|
3223
|
-
((x) => x),
|
|
3224
|
-
((x) => x),
|
|
3225
|
-
void 0,
|
|
3226
|
-
((x) => x)
|
|
3227
|
-
] : [
|
|
3228
|
-
/* big endian */
|
|
3229
|
-
((x) => x),
|
|
3230
|
-
((x) => ((x & 65280) << 8 | (x & 255) << 24) >> 16),
|
|
3231
|
-
void 0,
|
|
3232
|
-
((x) => x >> 24 & 255 | x >> 8 & 65280 | (x & 65280) << 8 | (x & 255) << 24)
|
|
3233
|
-
];
|
|
3234
|
-
function LE_HEAP_UPDATE() {
|
|
3235
|
-
HEAPU16.unsigned = ((x) => x & 65535);
|
|
3236
|
-
HEAPU32.unsigned = ((x) => x >>> 0);
|
|
3237
|
-
}
|
|
3238
|
-
__name(LE_HEAP_UPDATE, "LE_HEAP_UPDATE");
|
|
3239
3100
|
{
|
|
3240
3101
|
initMemory();
|
|
3241
3102
|
if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
|
|
@@ -3267,18 +3128,14 @@ async function Module2(moduleArg = {}) {
|
|
|
3267
3128
|
}
|
|
3268
3129
|
consumedModuleProp("preInit");
|
|
3269
3130
|
}
|
|
3270
|
-
Module["setValue"] = setValue;
|
|
3271
|
-
Module["getValue"] = getValue;
|
|
3272
3131
|
Module["UTF8ToString"] = UTF8ToString;
|
|
3273
3132
|
Module["stringToUTF8"] = stringToUTF8;
|
|
3274
3133
|
Module["lengthBytesUTF8"] = lengthBytesUTF8;
|
|
3275
3134
|
Module["AsciiToString"] = AsciiToString;
|
|
3276
|
-
Module["stringToUTF16"] = stringToUTF16;
|
|
3277
3135
|
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
3278
|
-
|
|
3279
|
-
var missingLibrarySymbols = ["writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "zeroMemory", "withStackSave", "strError", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "readEmAsmArgs", "runEmAsmFunction", "runMainThreadEmAsm", "jstoi_q", "getExecutableName", "autoResumeAudioContext", "getDynCaller", "runtimeKeepalivePush", "runtimeKeepalivePop", "callUserCallback", "maybeExit", "asmjsMangle", "mmapAlloc", "HandleAllocator", "getNativeTypeSize", "getUniqueRunDependency", "addOnInit", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "ccall", "cwrap", "removeFunction", "intArrayFromString", "intArrayToString", "stringToAscii", "UTF16ToString", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "getEnvStrings", "checkWasiClock", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "initRandomFill", "randomFill", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "Browser_asyncPrepareDataCounter", "isLeapYear", "ydayFromDate", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "dlopenInternal", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "demangle", "stackTrace"];
|
|
3136
|
+
var missingLibrarySymbols = ["writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "zeroMemory", "withStackSave", "strError", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "readEmAsmArgs", "runEmAsmFunction", "runMainThreadEmAsm", "jstoi_q", "getExecutableName", "autoResumeAudioContext", "getDynCaller", "runtimeKeepalivePush", "runtimeKeepalivePop", "callUserCallback", "maybeExit", "asmjsMangle", "mmapAlloc", "HandleAllocator", "getNativeTypeSize", "getUniqueRunDependency", "addOnInit", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "ccall", "cwrap", "removeFunction", "intArrayFromString", "intArrayToString", "stringToAscii", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "getEnvStrings", "checkWasiClock", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "initRandomFill", "randomFill", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "Browser_asyncPrepareDataCounter", "isLeapYear", "ydayFromDate", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "dlopenInternal", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "demangle", "stackTrace"];
|
|
3280
3137
|
missingLibrarySymbols.forEach(missingLibrarySymbol);
|
|
3281
|
-
var unexportedSymbols = ["run", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "dynCall", "handleException", "keepRuntimeAlive", "asyncLoad", "alignMemory", "wasmTable", "noExitRuntime", "addRunDependency", "removeRunDependency", "addOnPreRun", "addOnPostCtor", "addOnPostRun", "convertJsFunctionToWasm", "freeTableIndexes", "functionsInTableMap", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "stringToUTF8Array", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "flush_NO_FILESYSTEM", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "Browser", "requestFullscreen", "requestFullScreen", "setCanvasSize", "getUserMedia", "createContext", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "SYSCALLS", "isSymbolDefined", "GOT", "currentModuleWeakSymbols", "LDSO", "getMemory", "mergeLibSymbols", "newDSO", "loadDynamicLibrary", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr", "jstoi_s"
|
|
3138
|
+
var unexportedSymbols = ["run", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "HEAPF32", "HEAPF64", "HEAP8", "HEAPU8", "HEAP16", "HEAP64", "HEAPU64", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "dynCall", "handleException", "keepRuntimeAlive", "asyncLoad", "alignMemory", "wasmTable", "noExitRuntime", "addRunDependency", "removeRunDependency", "addOnPreRun", "addOnPostCtor", "addOnPostRun", "convertJsFunctionToWasm", "freeTableIndexes", "functionsInTableMap", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "stringToUTF8Array", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "flush_NO_FILESYSTEM", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "Browser", "requestFullscreen", "requestFullScreen", "setCanvasSize", "getUserMedia", "createContext", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "SYSCALLS", "isSymbolDefined", "GOT", "currentModuleWeakSymbols", "LDSO", "getMemory", "mergeLibSymbols", "newDSO", "loadDynamicLibrary", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr", "jstoi_s"];
|
|
3282
3139
|
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
3283
3140
|
function checkIncomingModuleAPI() {
|
|
3284
3141
|
ignoredModuleProp("fetchSettings");
|
|
@@ -3289,7 +3146,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3289
3146
|
var _calloc = Module["_calloc"] = makeInvalidEarlyAccess("_calloc");
|
|
3290
3147
|
var _realloc = Module["_realloc"] = makeInvalidEarlyAccess("_realloc");
|
|
3291
3148
|
var _free = Module["_free"] = makeInvalidEarlyAccess("_free");
|
|
3292
|
-
var _ts_range_edit = Module["_ts_range_edit"] = makeInvalidEarlyAccess("_ts_range_edit");
|
|
3293
3149
|
var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = makeInvalidEarlyAccess("_ts_language_symbol_count");
|
|
3294
3150
|
var _ts_language_state_count = Module["_ts_language_state_count"] = makeInvalidEarlyAccess("_ts_language_state_count");
|
|
3295
3151
|
var _ts_language_abi_version = Module["_ts_language_abi_version"] = makeInvalidEarlyAccess("_ts_language_abi_version");
|
|
@@ -3307,12 +3163,12 @@ async function Module2(moduleArg = {}) {
|
|
|
3307
3163
|
var _ts_lookahead_iterator_reset = Module["_ts_lookahead_iterator_reset"] = makeInvalidEarlyAccess("_ts_lookahead_iterator_reset");
|
|
3308
3164
|
var _ts_lookahead_iterator_next = Module["_ts_lookahead_iterator_next"] = makeInvalidEarlyAccess("_ts_lookahead_iterator_next");
|
|
3309
3165
|
var _ts_lookahead_iterator_current_symbol = Module["_ts_lookahead_iterator_current_symbol"] = makeInvalidEarlyAccess("_ts_lookahead_iterator_current_symbol");
|
|
3310
|
-
var _ts_point_edit = Module["_ts_point_edit"] = makeInvalidEarlyAccess("_ts_point_edit");
|
|
3311
3166
|
var _ts_parser_delete = Module["_ts_parser_delete"] = makeInvalidEarlyAccess("_ts_parser_delete");
|
|
3312
3167
|
var _ts_parser_set_language = Module["_ts_parser_set_language"] = makeInvalidEarlyAccess("_ts_parser_set_language");
|
|
3313
3168
|
var _ts_parser_reset = Module["_ts_parser_reset"] = makeInvalidEarlyAccess("_ts_parser_reset");
|
|
3314
|
-
var _ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = makeInvalidEarlyAccess("_ts_parser_set_included_ranges");
|
|
3315
3169
|
var _memcmp = Module["_memcmp"] = makeInvalidEarlyAccess("_memcmp");
|
|
3170
|
+
var _ts_tree_cursor_current_descendant_index = Module["_ts_tree_cursor_current_descendant_index"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_descendant_index");
|
|
3171
|
+
var _ts_tree_cursor_current_depth = Module["_ts_tree_cursor_current_depth"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_depth");
|
|
3316
3172
|
var _ts_tree_copy = Module["_ts_tree_copy"] = makeInvalidEarlyAccess("_ts_tree_copy");
|
|
3317
3173
|
var _ts_tree_delete = Module["_ts_tree_delete"] = makeInvalidEarlyAccess("_ts_tree_delete");
|
|
3318
3174
|
var _ts_init = Module["_ts_init"] = makeInvalidEarlyAccess("_ts_init");
|
|
@@ -3324,6 +3180,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3324
3180
|
var _ts_parser_enable_logger_wasm = Module["_ts_parser_enable_logger_wasm"] = makeInvalidEarlyAccess("_ts_parser_enable_logger_wasm");
|
|
3325
3181
|
var _ts_parser_parse_wasm = Module["_ts_parser_parse_wasm"] = makeInvalidEarlyAccess("_ts_parser_parse_wasm");
|
|
3326
3182
|
var _ts_parser_parse_limited_wasm = Module["_ts_parser_parse_limited_wasm"] = makeInvalidEarlyAccess("_ts_parser_parse_limited_wasm");
|
|
3183
|
+
var _ts_parser_last_parse_operations_wasm = Module["_ts_parser_last_parse_operations_wasm"] = makeInvalidEarlyAccess("_ts_parser_last_parse_operations_wasm");
|
|
3327
3184
|
var _ts_parser_abort_limited_wasm = Module["_ts_parser_abort_limited_wasm"] = makeInvalidEarlyAccess("_ts_parser_abort_limited_wasm");
|
|
3328
3185
|
var _ts_parser_included_ranges_wasm = Module["_ts_parser_included_ranges_wasm"] = makeInvalidEarlyAccess("_ts_parser_included_ranges_wasm");
|
|
3329
3186
|
var _ts_language_type_is_named_wasm = Module["_ts_language_type_is_named_wasm"] = makeInvalidEarlyAccess("_ts_language_type_is_named_wasm");
|
|
@@ -3349,18 +3206,12 @@ async function Module2(moduleArg = {}) {
|
|
|
3349
3206
|
var _ts_tree_cursor_goto_previous_sibling_wasm = Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_goto_previous_sibling_wasm");
|
|
3350
3207
|
var _ts_tree_cursor_goto_descendant_wasm = Module["_ts_tree_cursor_goto_descendant_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_goto_descendant_wasm");
|
|
3351
3208
|
var _ts_tree_cursor_goto_parent_wasm = Module["_ts_tree_cursor_goto_parent_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_goto_parent_wasm");
|
|
3352
|
-
var _ts_tree_cursor_current_node_type_id_wasm = Module["_ts_tree_cursor_current_node_type_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_type_id_wasm");
|
|
3353
3209
|
var _ts_tree_cursor_current_node_state_id_wasm = Module["_ts_tree_cursor_current_node_state_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_state_id_wasm");
|
|
3354
|
-
var _ts_tree_cursor_current_node_is_named_wasm = Module["_ts_tree_cursor_current_node_is_named_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_is_named_wasm");
|
|
3355
|
-
var _ts_tree_cursor_current_node_is_missing_wasm = Module["_ts_tree_cursor_current_node_is_missing_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_is_missing_wasm");
|
|
3356
3210
|
var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_id_wasm");
|
|
3357
3211
|
var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_position_wasm");
|
|
3358
3212
|
var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_position_wasm");
|
|
3359
3213
|
var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_index_wasm");
|
|
3360
3214
|
var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_index_wasm");
|
|
3361
|
-
var _ts_tree_cursor_current_field_id_wasm = Module["_ts_tree_cursor_current_field_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_field_id_wasm");
|
|
3362
|
-
var _ts_tree_cursor_current_depth_wasm = Module["_ts_tree_cursor_current_depth_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_depth_wasm");
|
|
3363
|
-
var _ts_tree_cursor_current_descendant_index_wasm = Module["_ts_tree_cursor_current_descendant_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_descendant_index_wasm");
|
|
3364
3215
|
var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_wasm");
|
|
3365
3216
|
var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = makeInvalidEarlyAccess("_ts_node_symbol_wasm");
|
|
3366
3217
|
var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = makeInvalidEarlyAccess("_ts_node_field_name_for_child_wasm");
|
|
@@ -3385,9 +3236,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3385
3236
|
var _ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = makeInvalidEarlyAccess("_ts_node_named_descendant_for_index_wasm");
|
|
3386
3237
|
var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = makeInvalidEarlyAccess("_ts_node_descendant_for_position_wasm");
|
|
3387
3238
|
var _ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = makeInvalidEarlyAccess("_ts_node_named_descendant_for_position_wasm");
|
|
3388
|
-
var _ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = makeInvalidEarlyAccess("_ts_node_start_point_wasm");
|
|
3389
3239
|
var _ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = makeInvalidEarlyAccess("_ts_node_end_point_wasm");
|
|
3390
|
-
var _ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = makeInvalidEarlyAccess("_ts_node_start_index_wasm");
|
|
3391
3240
|
var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = makeInvalidEarlyAccess("_ts_node_end_index_wasm");
|
|
3392
3241
|
var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = makeInvalidEarlyAccess("_ts_node_to_string_wasm");
|
|
3393
3242
|
var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = makeInvalidEarlyAccess("_ts_node_children_wasm");
|
|
@@ -3401,9 +3250,9 @@ async function Module2(moduleArg = {}) {
|
|
|
3401
3250
|
var _ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = makeInvalidEarlyAccess("_ts_node_is_extra_wasm");
|
|
3402
3251
|
var _ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = makeInvalidEarlyAccess("_ts_node_parse_state_wasm");
|
|
3403
3252
|
var _ts_node_next_parse_state_wasm = Module["_ts_node_next_parse_state_wasm"] = makeInvalidEarlyAccess("_ts_node_next_parse_state_wasm");
|
|
3404
|
-
var _memset = Module["_memset"] = makeInvalidEarlyAccess("_memset");
|
|
3405
3253
|
var _memcpy = Module["_memcpy"] = makeInvalidEarlyAccess("_memcpy");
|
|
3406
3254
|
var _memmove = Module["_memmove"] = makeInvalidEarlyAccess("_memmove");
|
|
3255
|
+
var _memset = Module["_memset"] = makeInvalidEarlyAccess("_memset");
|
|
3407
3256
|
var _fflush = makeInvalidEarlyAccess("_fflush");
|
|
3408
3257
|
var _strlen = Module["_strlen"] = makeInvalidEarlyAccess("_strlen");
|
|
3409
3258
|
var _iswalnum = Module["_iswalnum"] = makeInvalidEarlyAccess("_iswalnum");
|
|
@@ -3437,7 +3286,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3437
3286
|
Module["_calloc"] = _calloc = createExportWrapper("calloc", 2);
|
|
3438
3287
|
Module["_realloc"] = _realloc = createExportWrapper("realloc", 2);
|
|
3439
3288
|
Module["_free"] = _free = createExportWrapper("free", 1);
|
|
3440
|
-
Module["_ts_range_edit"] = _ts_range_edit = createExportWrapper("ts_range_edit", 2);
|
|
3441
3289
|
Module["_ts_language_symbol_count"] = _ts_language_symbol_count = createExportWrapper("ts_language_symbol_count", 1);
|
|
3442
3290
|
Module["_ts_language_state_count"] = _ts_language_state_count = createExportWrapper("ts_language_state_count", 1);
|
|
3443
3291
|
Module["_ts_language_abi_version"] = _ts_language_abi_version = createExportWrapper("ts_language_abi_version", 1);
|
|
@@ -3455,12 +3303,12 @@ async function Module2(moduleArg = {}) {
|
|
|
3455
3303
|
Module["_ts_lookahead_iterator_reset"] = _ts_lookahead_iterator_reset = createExportWrapper("ts_lookahead_iterator_reset", 3);
|
|
3456
3304
|
Module["_ts_lookahead_iterator_next"] = _ts_lookahead_iterator_next = createExportWrapper("ts_lookahead_iterator_next", 1);
|
|
3457
3305
|
Module["_ts_lookahead_iterator_current_symbol"] = _ts_lookahead_iterator_current_symbol = createExportWrapper("ts_lookahead_iterator_current_symbol", 1);
|
|
3458
|
-
Module["_ts_point_edit"] = _ts_point_edit = createExportWrapper("ts_point_edit", 3);
|
|
3459
3306
|
Module["_ts_parser_delete"] = _ts_parser_delete = createExportWrapper("ts_parser_delete", 1);
|
|
3460
3307
|
Module["_ts_parser_set_language"] = _ts_parser_set_language = createExportWrapper("ts_parser_set_language", 2);
|
|
3461
3308
|
Module["_ts_parser_reset"] = _ts_parser_reset = createExportWrapper("ts_parser_reset", 1);
|
|
3462
|
-
Module["_ts_parser_set_included_ranges"] = _ts_parser_set_included_ranges = createExportWrapper("ts_parser_set_included_ranges", 3);
|
|
3463
3309
|
Module["_memcmp"] = _memcmp = createExportWrapper("memcmp", 3);
|
|
3310
|
+
Module["_ts_tree_cursor_current_descendant_index"] = _ts_tree_cursor_current_descendant_index = createExportWrapper("ts_tree_cursor_current_descendant_index", 1);
|
|
3311
|
+
Module["_ts_tree_cursor_current_depth"] = _ts_tree_cursor_current_depth = createExportWrapper("ts_tree_cursor_current_depth", 1);
|
|
3464
3312
|
Module["_ts_tree_copy"] = _ts_tree_copy = createExportWrapper("ts_tree_copy", 1);
|
|
3465
3313
|
Module["_ts_tree_delete"] = _ts_tree_delete = createExportWrapper("ts_tree_delete", 1);
|
|
3466
3314
|
Module["_ts_init"] = _ts_init = createExportWrapper("ts_init", 0);
|
|
@@ -3470,8 +3318,9 @@ async function Module2(moduleArg = {}) {
|
|
|
3470
3318
|
Module["_ts_scanner_realloc_wasm"] = _ts_scanner_realloc_wasm = createExportWrapper("ts_scanner_realloc_wasm", 2);
|
|
3471
3319
|
Module["_ts_parser_new_wasm"] = _ts_parser_new_wasm = createExportWrapper("ts_parser_new_wasm", 0);
|
|
3472
3320
|
Module["_ts_parser_enable_logger_wasm"] = _ts_parser_enable_logger_wasm = createExportWrapper("ts_parser_enable_logger_wasm", 2);
|
|
3473
|
-
Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm",
|
|
3474
|
-
Module["_ts_parser_parse_limited_wasm"] = _ts_parser_parse_limited_wasm = createExportWrapper("ts_parser_parse_limited_wasm",
|
|
3321
|
+
Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm", 3);
|
|
3322
|
+
Module["_ts_parser_parse_limited_wasm"] = _ts_parser_parse_limited_wasm = createExportWrapper("ts_parser_parse_limited_wasm", 2);
|
|
3323
|
+
Module["_ts_parser_last_parse_operations_wasm"] = _ts_parser_last_parse_operations_wasm = createExportWrapper("ts_parser_last_parse_operations_wasm", 1);
|
|
3475
3324
|
Module["_ts_parser_abort_limited_wasm"] = _ts_parser_abort_limited_wasm = createExportWrapper("ts_parser_abort_limited_wasm", 0);
|
|
3476
3325
|
Module["_ts_parser_included_ranges_wasm"] = _ts_parser_included_ranges_wasm = createExportWrapper("ts_parser_included_ranges_wasm", 1);
|
|
3477
3326
|
Module["_ts_language_type_is_named_wasm"] = _ts_language_type_is_named_wasm = createExportWrapper("ts_language_type_is_named_wasm", 2);
|
|
@@ -3487,28 +3336,22 @@ async function Module2(moduleArg = {}) {
|
|
|
3487
3336
|
Module["_ts_tree_cursor_new_wasm"] = _ts_tree_cursor_new_wasm = createExportWrapper("ts_tree_cursor_new_wasm", 1);
|
|
3488
3337
|
Module["_ts_tree_cursor_copy_wasm"] = _ts_tree_cursor_copy_wasm = createExportWrapper("ts_tree_cursor_copy_wasm", 1);
|
|
3489
3338
|
Module["_ts_tree_cursor_delete_wasm"] = _ts_tree_cursor_delete_wasm = createExportWrapper("ts_tree_cursor_delete_wasm", 1);
|
|
3490
|
-
Module["_ts_tree_cursor_reset_wasm"] = _ts_tree_cursor_reset_wasm = createExportWrapper("ts_tree_cursor_reset_wasm",
|
|
3339
|
+
Module["_ts_tree_cursor_reset_wasm"] = _ts_tree_cursor_reset_wasm = createExportWrapper("ts_tree_cursor_reset_wasm", 2);
|
|
3491
3340
|
Module["_ts_tree_cursor_reset_to_wasm"] = _ts_tree_cursor_reset_to_wasm = createExportWrapper("ts_tree_cursor_reset_to_wasm", 2);
|
|
3492
3341
|
Module["_ts_tree_cursor_goto_first_child_wasm"] = _ts_tree_cursor_goto_first_child_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_wasm", 1);
|
|
3493
3342
|
Module["_ts_tree_cursor_goto_last_child_wasm"] = _ts_tree_cursor_goto_last_child_wasm = createExportWrapper("ts_tree_cursor_goto_last_child_wasm", 1);
|
|
3494
|
-
Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = _ts_tree_cursor_goto_first_child_for_index_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_index_wasm",
|
|
3495
|
-
Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = _ts_tree_cursor_goto_first_child_for_position_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_position_wasm",
|
|
3343
|
+
Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = _ts_tree_cursor_goto_first_child_for_index_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_index_wasm", 2);
|
|
3344
|
+
Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = _ts_tree_cursor_goto_first_child_for_position_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_position_wasm", 3);
|
|
3496
3345
|
Module["_ts_tree_cursor_goto_next_sibling_wasm"] = _ts_tree_cursor_goto_next_sibling_wasm = createExportWrapper("ts_tree_cursor_goto_next_sibling_wasm", 1);
|
|
3497
3346
|
Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = _ts_tree_cursor_goto_previous_sibling_wasm = createExportWrapper("ts_tree_cursor_goto_previous_sibling_wasm", 1);
|
|
3498
3347
|
Module["_ts_tree_cursor_goto_descendant_wasm"] = _ts_tree_cursor_goto_descendant_wasm = createExportWrapper("ts_tree_cursor_goto_descendant_wasm", 2);
|
|
3499
3348
|
Module["_ts_tree_cursor_goto_parent_wasm"] = _ts_tree_cursor_goto_parent_wasm = createExportWrapper("ts_tree_cursor_goto_parent_wasm", 1);
|
|
3500
|
-
Module["_ts_tree_cursor_current_node_type_id_wasm"] = _ts_tree_cursor_current_node_type_id_wasm = createExportWrapper("ts_tree_cursor_current_node_type_id_wasm", 1);
|
|
3501
3349
|
Module["_ts_tree_cursor_current_node_state_id_wasm"] = _ts_tree_cursor_current_node_state_id_wasm = createExportWrapper("ts_tree_cursor_current_node_state_id_wasm", 1);
|
|
3502
|
-
Module["_ts_tree_cursor_current_node_is_named_wasm"] = _ts_tree_cursor_current_node_is_named_wasm = createExportWrapper("ts_tree_cursor_current_node_is_named_wasm", 1);
|
|
3503
|
-
Module["_ts_tree_cursor_current_node_is_missing_wasm"] = _ts_tree_cursor_current_node_is_missing_wasm = createExportWrapper("ts_tree_cursor_current_node_is_missing_wasm", 1);
|
|
3504
3350
|
Module["_ts_tree_cursor_current_node_id_wasm"] = _ts_tree_cursor_current_node_id_wasm = createExportWrapper("ts_tree_cursor_current_node_id_wasm", 1);
|
|
3505
3351
|
Module["_ts_tree_cursor_start_position_wasm"] = _ts_tree_cursor_start_position_wasm = createExportWrapper("ts_tree_cursor_start_position_wasm", 1);
|
|
3506
3352
|
Module["_ts_tree_cursor_end_position_wasm"] = _ts_tree_cursor_end_position_wasm = createExportWrapper("ts_tree_cursor_end_position_wasm", 1);
|
|
3507
3353
|
Module["_ts_tree_cursor_start_index_wasm"] = _ts_tree_cursor_start_index_wasm = createExportWrapper("ts_tree_cursor_start_index_wasm", 1);
|
|
3508
3354
|
Module["_ts_tree_cursor_end_index_wasm"] = _ts_tree_cursor_end_index_wasm = createExportWrapper("ts_tree_cursor_end_index_wasm", 1);
|
|
3509
|
-
Module["_ts_tree_cursor_current_field_id_wasm"] = _ts_tree_cursor_current_field_id_wasm = createExportWrapper("ts_tree_cursor_current_field_id_wasm", 1);
|
|
3510
|
-
Module["_ts_tree_cursor_current_depth_wasm"] = _ts_tree_cursor_current_depth_wasm = createExportWrapper("ts_tree_cursor_current_depth_wasm", 1);
|
|
3511
|
-
Module["_ts_tree_cursor_current_descendant_index_wasm"] = _ts_tree_cursor_current_descendant_index_wasm = createExportWrapper("ts_tree_cursor_current_descendant_index_wasm", 1);
|
|
3512
3355
|
Module["_ts_tree_cursor_current_node_wasm"] = _ts_tree_cursor_current_node_wasm = createExportWrapper("ts_tree_cursor_current_node_wasm", 1);
|
|
3513
3356
|
Module["_ts_node_symbol_wasm"] = _ts_node_symbol_wasm = createExportWrapper("ts_node_symbol_wasm", 1);
|
|
3514
3357
|
Module["_ts_node_field_name_for_child_wasm"] = _ts_node_field_name_for_child_wasm = createExportWrapper("ts_node_field_name_for_child_wasm", 2);
|
|
@@ -3533,14 +3376,12 @@ async function Module2(moduleArg = {}) {
|
|
|
3533
3376
|
Module["_ts_node_named_descendant_for_index_wasm"] = _ts_node_named_descendant_for_index_wasm = createExportWrapper("ts_node_named_descendant_for_index_wasm", 1);
|
|
3534
3377
|
Module["_ts_node_descendant_for_position_wasm"] = _ts_node_descendant_for_position_wasm = createExportWrapper("ts_node_descendant_for_position_wasm", 1);
|
|
3535
3378
|
Module["_ts_node_named_descendant_for_position_wasm"] = _ts_node_named_descendant_for_position_wasm = createExportWrapper("ts_node_named_descendant_for_position_wasm", 1);
|
|
3536
|
-
Module["_ts_node_start_point_wasm"] = _ts_node_start_point_wasm = createExportWrapper("ts_node_start_point_wasm", 1);
|
|
3537
3379
|
Module["_ts_node_end_point_wasm"] = _ts_node_end_point_wasm = createExportWrapper("ts_node_end_point_wasm", 1);
|
|
3538
|
-
Module["_ts_node_start_index_wasm"] = _ts_node_start_index_wasm = createExportWrapper("ts_node_start_index_wasm", 1);
|
|
3539
3380
|
Module["_ts_node_end_index_wasm"] = _ts_node_end_index_wasm = createExportWrapper("ts_node_end_index_wasm", 1);
|
|
3540
3381
|
Module["_ts_node_to_string_wasm"] = _ts_node_to_string_wasm = createExportWrapper("ts_node_to_string_wasm", 1);
|
|
3541
3382
|
Module["_ts_node_children_wasm"] = _ts_node_children_wasm = createExportWrapper("ts_node_children_wasm", 1);
|
|
3542
3383
|
Module["_ts_node_named_children_wasm"] = _ts_node_named_children_wasm = createExportWrapper("ts_node_named_children_wasm", 1);
|
|
3543
|
-
Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm",
|
|
3384
|
+
Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm", 3);
|
|
3544
3385
|
Module["_ts_node_is_named_wasm"] = _ts_node_is_named_wasm = createExportWrapper("ts_node_is_named_wasm", 1);
|
|
3545
3386
|
Module["_ts_node_has_changes_wasm"] = _ts_node_has_changes_wasm = createExportWrapper("ts_node_has_changes_wasm", 1);
|
|
3546
3387
|
Module["_ts_node_has_error_wasm"] = _ts_node_has_error_wasm = createExportWrapper("ts_node_has_error_wasm", 1);
|
|
@@ -3549,9 +3390,9 @@ async function Module2(moduleArg = {}) {
|
|
|
3549
3390
|
Module["_ts_node_is_extra_wasm"] = _ts_node_is_extra_wasm = createExportWrapper("ts_node_is_extra_wasm", 1);
|
|
3550
3391
|
Module["_ts_node_parse_state_wasm"] = _ts_node_parse_state_wasm = createExportWrapper("ts_node_parse_state_wasm", 1);
|
|
3551
3392
|
Module["_ts_node_next_parse_state_wasm"] = _ts_node_next_parse_state_wasm = createExportWrapper("ts_node_next_parse_state_wasm", 1);
|
|
3552
|
-
Module["_memset"] = _memset = createExportWrapper("memset", 3);
|
|
3553
3393
|
Module["_memcpy"] = _memcpy = createExportWrapper("memcpy", 3);
|
|
3554
3394
|
Module["_memmove"] = _memmove = createExportWrapper("memmove", 3);
|
|
3395
|
+
Module["_memset"] = _memset = createExportWrapper("memset", 3);
|
|
3555
3396
|
_fflush = createExportWrapper("fflush", 1);
|
|
3556
3397
|
Module["_strlen"] = _strlen = createExportWrapper("strlen", 1);
|
|
3557
3398
|
Module["_iswalnum"] = _iswalnum = createExportWrapper("iswalnum", 1);
|
|
@@ -3598,8 +3439,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3598
3439
|
/** @export */
|
|
3599
3440
|
__table_base: ___table_base,
|
|
3600
3441
|
/** @export */
|
|
3601
|
-
_abort_js: __abort_js,
|
|
3602
|
-
/** @export */
|
|
3603
3442
|
_emscripten_throw_longjmp: __emscripten_throw_longjmp,
|
|
3604
3443
|
/** @export */
|
|
3605
3444
|
alignfault,
|
|
@@ -3612,8 +3451,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3612
3451
|
/** @export */
|
|
3613
3452
|
fd_write: _fd_write,
|
|
3614
3453
|
/** @export */
|
|
3615
|
-
invoke_i,
|
|
3616
|
-
/** @export */
|
|
3617
3454
|
invoke_ii,
|
|
3618
3455
|
/** @export */
|
|
3619
3456
|
invoke_iii,
|
|
@@ -3622,9 +3459,11 @@ async function Module2(moduleArg = {}) {
|
|
|
3622
3459
|
/** @export */
|
|
3623
3460
|
invoke_iiiii,
|
|
3624
3461
|
/** @export */
|
|
3462
|
+
invoke_ji,
|
|
3463
|
+
/** @export */
|
|
3625
3464
|
invoke_vi,
|
|
3626
3465
|
/** @export */
|
|
3627
|
-
|
|
3466
|
+
invoke_vj,
|
|
3628
3467
|
/** @export */
|
|
3629
3468
|
memory: wasmMemory,
|
|
3630
3469
|
/** @export */
|
|
@@ -3647,17 +3486,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3647
3486
|
}
|
|
3648
3487
|
}
|
|
3649
3488
|
__name(invoke_vi, "invoke_vi");
|
|
3650
|
-
function invoke_i(index) {
|
|
3651
|
-
var sp = stackSave();
|
|
3652
|
-
try {
|
|
3653
|
-
return getWasmTableEntry(index)();
|
|
3654
|
-
} catch (e) {
|
|
3655
|
-
stackRestore(sp);
|
|
3656
|
-
if (e !== e + 0) throw e;
|
|
3657
|
-
_setThrew(1, 0);
|
|
3658
|
-
}
|
|
3659
|
-
}
|
|
3660
|
-
__name(invoke_i, "invoke_i");
|
|
3661
3489
|
function invoke_ii(index, a1) {
|
|
3662
3490
|
var sp = stackSave();
|
|
3663
3491
|
try {
|
|
@@ -3669,28 +3497,29 @@ async function Module2(moduleArg = {}) {
|
|
|
3669
3497
|
}
|
|
3670
3498
|
}
|
|
3671
3499
|
__name(invoke_ii, "invoke_ii");
|
|
3672
|
-
function
|
|
3500
|
+
function invoke_vj(index, a1) {
|
|
3673
3501
|
var sp = stackSave();
|
|
3674
3502
|
try {
|
|
3675
|
-
|
|
3503
|
+
getWasmTableEntry(index)(a1);
|
|
3676
3504
|
} catch (e) {
|
|
3677
3505
|
stackRestore(sp);
|
|
3678
3506
|
if (e !== e + 0) throw e;
|
|
3679
3507
|
_setThrew(1, 0);
|
|
3680
3508
|
}
|
|
3681
3509
|
}
|
|
3682
|
-
__name(
|
|
3683
|
-
function
|
|
3510
|
+
__name(invoke_vj, "invoke_vj");
|
|
3511
|
+
function invoke_ji(index, a1) {
|
|
3684
3512
|
var sp = stackSave();
|
|
3685
3513
|
try {
|
|
3686
|
-
getWasmTableEntry(index)(a1
|
|
3514
|
+
return getWasmTableEntry(index)(a1);
|
|
3687
3515
|
} catch (e) {
|
|
3688
3516
|
stackRestore(sp);
|
|
3689
3517
|
if (e !== e + 0) throw e;
|
|
3690
3518
|
_setThrew(1, 0);
|
|
3519
|
+
return 0n;
|
|
3691
3520
|
}
|
|
3692
3521
|
}
|
|
3693
|
-
__name(
|
|
3522
|
+
__name(invoke_ji, "invoke_ji");
|
|
3694
3523
|
function invoke_iiii(index, a1, a2, a3) {
|
|
3695
3524
|
var sp = stackSave();
|
|
3696
3525
|
try {
|
|
@@ -3713,6 +3542,17 @@ async function Module2(moduleArg = {}) {
|
|
|
3713
3542
|
}
|
|
3714
3543
|
}
|
|
3715
3544
|
__name(invoke_iiiii, "invoke_iiiii");
|
|
3545
|
+
function invoke_iii(index, a1, a2) {
|
|
3546
|
+
var sp = stackSave();
|
|
3547
|
+
try {
|
|
3548
|
+
return getWasmTableEntry(index)(a1, a2);
|
|
3549
|
+
} catch (e) {
|
|
3550
|
+
stackRestore(sp);
|
|
3551
|
+
if (e !== e + 0) throw e;
|
|
3552
|
+
_setThrew(1, 0);
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
__name(invoke_iii, "invoke_iii");
|
|
3716
3556
|
var calledRun;
|
|
3717
3557
|
function callMain(args2 = []) {
|
|
3718
3558
|
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
|
|
@@ -3724,10 +3564,10 @@ async function Module2(moduleArg = {}) {
|
|
|
3724
3564
|
var argv = stackAlloc((argc + 1) * 4);
|
|
3725
3565
|
var argv_ptr = argv;
|
|
3726
3566
|
args2.forEach((arg) => {
|
|
3727
|
-
|
|
3567
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, argv_ptr >> 2, "storing")] = stringToUTF8OnStack(arg);
|
|
3728
3568
|
argv_ptr += 4;
|
|
3729
3569
|
});
|
|
3730
|
-
|
|
3570
|
+
HEAPU32[SAFE_HEAP_INDEX(HEAPU32, argv_ptr >> 2, "storing")] = 0;
|
|
3731
3571
|
try {
|
|
3732
3572
|
var ret = entryFunction(argc, argv);
|
|
3733
3573
|
exitJS(
|
|
@@ -3742,7 +3582,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3742
3582
|
}
|
|
3743
3583
|
__name(callMain, "callMain");
|
|
3744
3584
|
function stackCheckInit() {
|
|
3745
|
-
_emscripten_stack_set_limits(
|
|
3585
|
+
_emscripten_stack_set_limits(82464, 16928);
|
|
3746
3586
|
writeStackCookie();
|
|
3747
3587
|
}
|
|
3748
3588
|
__name(stackCheckInit, "stackCheckInit");
|
|
@@ -3852,8 +3692,10 @@ function checkModule() {
|
|
|
3852
3692
|
__name(checkModule, "checkModule");
|
|
3853
3693
|
|
|
3854
3694
|
// src/parser.ts
|
|
3695
|
+
var TWO_POW_32 = 4294967296;
|
|
3855
3696
|
var TRANSFER_BUFFER;
|
|
3856
3697
|
var LANGUAGE_VERSION;
|
|
3698
|
+
var MIN_COMPATIBLE_VERSION;
|
|
3857
3699
|
function assertSupportedLanguage(language) {
|
|
3858
3700
|
const version = C._ts_language_abi_version(language[0]);
|
|
3859
3701
|
if (version < MIN_COMPATIBLE_VERSION || version > LANGUAGE_VERSION) {
|
|
@@ -3863,7 +3705,6 @@ function assertSupportedLanguage(language) {
|
|
|
3863
3705
|
}
|
|
3864
3706
|
}
|
|
3865
3707
|
__name(assertSupportedLanguage, "assertSupportedLanguage");
|
|
3866
|
-
var MIN_COMPATIBLE_VERSION;
|
|
3867
3708
|
var finalizer4 = newFinalizer((addresses) => {
|
|
3868
3709
|
C._ts_parser_delete(addresses[0]);
|
|
3869
3710
|
C._free(addresses[1]);
|
|
@@ -3880,8 +3721,12 @@ var Parser = class {
|
|
|
3880
3721
|
// Internal handle for Wasm
|
|
3881
3722
|
/** @internal */
|
|
3882
3723
|
logCallback = null;
|
|
3724
|
+
/** @internal */
|
|
3725
|
+
loggerEnabled = false;
|
|
3883
3726
|
/** The parser's current language. */
|
|
3884
3727
|
language = null;
|
|
3728
|
+
/** The number of parse operations executed by the most recent {@link Parser#parse} call. */
|
|
3729
|
+
lastParseOperations = 0;
|
|
3885
3730
|
/**
|
|
3886
3731
|
* This must always be called before creating a Parser.
|
|
3887
3732
|
*
|
|
@@ -3892,8 +3737,9 @@ var Parser = class {
|
|
|
3892
3737
|
static async init(options) {
|
|
3893
3738
|
setModule(await initializeBinding(options));
|
|
3894
3739
|
TRANSFER_BUFFER = C._ts_init();
|
|
3895
|
-
|
|
3896
|
-
|
|
3740
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
3741
|
+
LANGUAGE_VERSION = C.HEAP32[base];
|
|
3742
|
+
MIN_COMPATIBLE_VERSION = C.HEAP32[base + 1];
|
|
3897
3743
|
}
|
|
3898
3744
|
/**
|
|
3899
3745
|
* Create a new parser.
|
|
@@ -3908,8 +3754,10 @@ var Parser = class {
|
|
|
3908
3754
|
throw new Error("cannot construct a Parser before calling `init()`");
|
|
3909
3755
|
}
|
|
3910
3756
|
C._ts_parser_new_wasm();
|
|
3911
|
-
|
|
3912
|
-
this[
|
|
3757
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
3758
|
+
this[0] = C.HEAP32[base];
|
|
3759
|
+
this[1] = C.HEAP32[base + 1];
|
|
3760
|
+
this.loggerEnabled = false;
|
|
3913
3761
|
}
|
|
3914
3762
|
/** Delete the parser, freeing its resources. */
|
|
3915
3763
|
delete() {
|
|
@@ -3958,42 +3806,84 @@ var Parser = class {
|
|
|
3958
3806
|
* @returns {Tree | null} A {@link Tree} if parsing succeeded, or `null` if:
|
|
3959
3807
|
* - The parser has not yet had a language assigned with {@link Parser#setLanguage}.
|
|
3960
3808
|
* - The progress callback returned true.
|
|
3961
|
-
* - The memory limit was reached.
|
|
3809
|
+
* - The memory limit was reached or the operation limit was exceeded.
|
|
3962
3810
|
*/
|
|
3963
3811
|
parse(callback, oldTree, options) {
|
|
3964
3812
|
const maxMemoryBytes = validateMemoryLimit(options?.maxMemoryBytes);
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
} else if (typeof callback === "function") {
|
|
3968
|
-
C.currentParseCallback = callback;
|
|
3969
|
-
} else {
|
|
3813
|
+
const maxOperations = validateOperationLimit(options?.maxOperations);
|
|
3814
|
+
if (typeof callback !== "string" && typeof callback !== "function") {
|
|
3970
3815
|
throw new Error("Argument must be a string or a function");
|
|
3971
3816
|
}
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3817
|
+
const progressCallback = options?.progressCallback ?? null;
|
|
3818
|
+
C.currentParseCallback = callback;
|
|
3819
|
+
C.currentProgressCallback = progressCallback;
|
|
3820
|
+
this.syncLogger();
|
|
3821
|
+
this.lastParseOperations = 0;
|
|
3822
|
+
try {
|
|
3823
|
+
const treeAddress = this.runParse(oldTree, options, maxMemoryBytes, maxOperations);
|
|
3824
|
+
if (!treeAddress) return null;
|
|
3825
|
+
if (!this.language) throw new Error("Parser must have a language to parse");
|
|
3826
|
+
return new Tree2(INTERNAL, treeAddress, this.language, callback);
|
|
3827
|
+
} finally {
|
|
3828
|
+
clearCallbacks();
|
|
3976
3829
|
}
|
|
3830
|
+
}
|
|
3831
|
+
/** @internal */
|
|
3832
|
+
syncLogger() {
|
|
3977
3833
|
if (this.logCallback) {
|
|
3978
3834
|
C.currentLogCallback = this.logCallback;
|
|
3979
|
-
|
|
3835
|
+
if (!this.loggerEnabled) {
|
|
3836
|
+
C._ts_parser_enable_logger_wasm(this[0], 1);
|
|
3837
|
+
this.loggerEnabled = true;
|
|
3838
|
+
}
|
|
3980
3839
|
} else {
|
|
3981
3840
|
C.currentLogCallback = null;
|
|
3982
|
-
|
|
3841
|
+
if (this.loggerEnabled) {
|
|
3842
|
+
C._ts_parser_enable_logger_wasm(this[0], 0);
|
|
3843
|
+
this.loggerEnabled = false;
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
/** @internal */
|
|
3848
|
+
runParse(oldTree, options, maxMemoryBytes, maxOperations) {
|
|
3849
|
+
if (maxMemoryBytes !== void 0 && !C.treeSitterSetMemoryLimit(maxMemoryBytes)) {
|
|
3850
|
+
return 0;
|
|
3983
3851
|
}
|
|
3984
3852
|
try {
|
|
3985
|
-
const
|
|
3986
|
-
if (!
|
|
3987
|
-
|
|
3988
|
-
|
|
3853
|
+
const [rangeAddress, rangeCount] = prepareRanges(options?.includedRanges);
|
|
3854
|
+
if (rangeCount && !rangeAddress) return 0;
|
|
3855
|
+
marshalParseInputs(maxOperations, rangeAddress, rangeCount, options?.progressCallback ? 1 : 0);
|
|
3856
|
+
try {
|
|
3857
|
+
return maxMemoryBytes === void 0 ? this.executeOrdinaryParse(oldTree ? oldTree[0] : 0) : this.executeLimitedParse();
|
|
3858
|
+
} finally {
|
|
3859
|
+
this.lastParseOperations = unmarshalOperationCount();
|
|
3860
|
+
}
|
|
3989
3861
|
} finally {
|
|
3990
|
-
|
|
3862
|
+
if (maxMemoryBytes !== void 0) C.treeSitterSetMemoryLimit(0);
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
/** @internal */
|
|
3866
|
+
executeOrdinaryParse(oldTreeAddress) {
|
|
3867
|
+
try {
|
|
3868
|
+
return C._ts_parser_parse_wasm(this[0], this[1], oldTreeAddress);
|
|
3869
|
+
} catch (error) {
|
|
3870
|
+
C._ts_parser_last_parse_operations_wasm(this[0]);
|
|
3871
|
+
throw error;
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
/** @internal */
|
|
3875
|
+
executeLimitedParse() {
|
|
3876
|
+
try {
|
|
3877
|
+
return C._ts_parser_parse_limited_wasm(this[0], this[1]);
|
|
3878
|
+
} catch (error) {
|
|
3879
|
+
C._ts_parser_abort_limited_wasm();
|
|
3880
|
+
throw error;
|
|
3991
3881
|
}
|
|
3992
3882
|
}
|
|
3993
3883
|
/**
|
|
3994
3884
|
* Instruct the parser to start the next parse from the beginning.
|
|
3995
3885
|
*
|
|
3996
|
-
* If the parser previously failed because of a callback,
|
|
3886
|
+
* If the parser previously failed because of a callback,
|
|
3997
3887
|
* then by default, it will resume where it left off on the
|
|
3998
3888
|
* next call to {@link Parser#parse} or other parsing functions.
|
|
3999
3889
|
* If you don't want to resume, and instead intend to use this parser to
|
|
@@ -4005,18 +3895,7 @@ var Parser = class {
|
|
|
4005
3895
|
/** Get the ranges of text that the parser will include when parsing. */
|
|
4006
3896
|
getIncludedRanges() {
|
|
4007
3897
|
C._ts_parser_included_ranges_wasm(this[0]);
|
|
4008
|
-
|
|
4009
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
4010
|
-
const result = new Array(count);
|
|
4011
|
-
if (count > 0) {
|
|
4012
|
-
let address = buffer;
|
|
4013
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
4014
|
-
result[i2] = unmarshalRange(address);
|
|
4015
|
-
address += SIZE_OF_RANGE;
|
|
4016
|
-
}
|
|
4017
|
-
C._free(buffer);
|
|
4018
|
-
}
|
|
4019
|
-
return result;
|
|
3898
|
+
return unmarshalRanges(false);
|
|
4020
3899
|
}
|
|
4021
3900
|
/** Set the logging callback that a parser should use during parsing. */
|
|
4022
3901
|
setLogger(callback) {
|
|
@@ -4041,43 +3920,46 @@ function validateMemoryLimit(maxMemoryBytes) {
|
|
|
4041
3920
|
return maxMemoryBytes;
|
|
4042
3921
|
}
|
|
4043
3922
|
__name(validateMemoryLimit, "validateMemoryLimit");
|
|
3923
|
+
function validateOperationLimit(maxOperations) {
|
|
3924
|
+
if (maxOperations !== void 0 && (!Number.isSafeInteger(maxOperations) || maxOperations <= 0)) {
|
|
3925
|
+
throw new RangeError("maxOperations must be a positive safe integer");
|
|
3926
|
+
}
|
|
3927
|
+
return maxOperations;
|
|
3928
|
+
}
|
|
3929
|
+
__name(validateOperationLimit, "validateOperationLimit");
|
|
4044
3930
|
function prepareRanges(ranges) {
|
|
4045
3931
|
if (!ranges?.length) return [0, 0];
|
|
4046
3932
|
const rangeAddress = C._calloc(ranges.length, SIZE_OF_RANGE);
|
|
4047
3933
|
if (!rangeAddress) return [0, ranges.length];
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
3934
|
+
try {
|
|
3935
|
+
let address = rangeAddress;
|
|
3936
|
+
for (const range of ranges) {
|
|
3937
|
+
marshalRange(address, range);
|
|
3938
|
+
address += SIZE_OF_RANGE;
|
|
3939
|
+
}
|
|
3940
|
+
return [rangeAddress, ranges.length];
|
|
3941
|
+
} catch (error) {
|
|
3942
|
+
C._free(rangeAddress);
|
|
3943
|
+
throw error;
|
|
4052
3944
|
}
|
|
4053
|
-
return [rangeAddress, ranges.length];
|
|
4054
3945
|
}
|
|
4055
3946
|
__name(prepareRanges, "prepareRanges");
|
|
4056
|
-
function
|
|
4057
|
-
const
|
|
4058
|
-
|
|
4059
|
-
|
|
3947
|
+
function marshalParseInputs(maxOperations, rangeAddress, rangeCount, hasProgressCallback) {
|
|
3948
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
3949
|
+
const heapU32 = C.HEAPU32;
|
|
3950
|
+
heapU32[base] = maxOperations === void 0 ? 0 : maxOperations >>> 0;
|
|
3951
|
+
heapU32[base + 1] = maxOperations === void 0 ? 0 : Math.floor(maxOperations / TWO_POW_32) >>> 0;
|
|
3952
|
+
heapU32[base + 2] = rangeAddress;
|
|
3953
|
+
heapU32[base + 3] = rangeCount;
|
|
3954
|
+
heapU32[base + 4] = hasProgressCallback;
|
|
4060
3955
|
}
|
|
4061
|
-
__name(
|
|
4062
|
-
function
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
const [address, rangeCount] = prepareRanges(ranges);
|
|
4067
|
-
rangeAddress = address;
|
|
4068
|
-
if (rangeCount && !address) return 0;
|
|
4069
|
-
try {
|
|
4070
|
-
return C._ts_parser_parse_limited_wasm(parserAddress, inputBuffer, address, rangeCount);
|
|
4071
|
-
} catch (error) {
|
|
4072
|
-
C._ts_parser_abort_limited_wasm();
|
|
4073
|
-
throw error;
|
|
4074
|
-
}
|
|
4075
|
-
} finally {
|
|
4076
|
-
if (rangeAddress) C._free(rangeAddress);
|
|
4077
|
-
C.treeSitterSetMemoryLimit(0);
|
|
4078
|
-
}
|
|
3956
|
+
__name(marshalParseInputs, "marshalParseInputs");
|
|
3957
|
+
function unmarshalOperationCount() {
|
|
3958
|
+
const base = TRANSFER_BUFFER >>> 2;
|
|
3959
|
+
const heapU32 = C.HEAPU32;
|
|
3960
|
+
return heapU32[base] + heapU32[base + 1] * TWO_POW_32;
|
|
4079
3961
|
}
|
|
4080
|
-
__name(
|
|
3962
|
+
__name(unmarshalOperationCount, "unmarshalOperationCount");
|
|
4081
3963
|
function clearCallbacks() {
|
|
4082
3964
|
C.currentParseCallback = null;
|
|
4083
3965
|
C.currentLogCallback = null;
|
|
@@ -4092,7 +3974,7 @@ export {
|
|
|
4092
3974
|
MIN_COMPATIBLE_VERSION,
|
|
4093
3975
|
Node,
|
|
4094
3976
|
Parser,
|
|
4095
|
-
Tree,
|
|
3977
|
+
Tree2 as Tree,
|
|
4096
3978
|
TreeCursor
|
|
4097
3979
|
};
|
|
4098
3980
|
//# sourceMappingURL=web-tree-sitter.js.map
|