@willbooster/web-tree-sitter 19.1.1 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -20
- package/debug/web-tree-sitter.cjs +14 -231
- package/debug/web-tree-sitter.cjs.map +3 -3
- package/debug/web-tree-sitter.js +14 -230
- package/debug/web-tree-sitter.js.map +3 -3
- package/debug/web-tree-sitter.wasm +0 -0
- package/debug/web-tree-sitter.wasm.map +17 -21
- package/package.json +1 -2
- package/web-tree-sitter.cjs +3 -3
- package/web-tree-sitter.cjs.map +4 -4
- package/web-tree-sitter.d.cts +2 -86
- package/web-tree-sitter.d.cts.map +1 -4
- package/web-tree-sitter.d.ts +2 -86
- package/web-tree-sitter.d.ts.map +1 -4
- 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 +22 -26
- package/web-tree-sitter.web.js +3 -3
- package/web-tree-sitter.web.js.map +4 -4
package/debug/web-tree-sitter.js
CHANGED
|
@@ -1,108 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/edit.ts
|
|
5
|
-
var Edit = class {
|
|
6
|
-
static {
|
|
7
|
-
__name(this, "Edit");
|
|
8
|
-
}
|
|
9
|
-
/** The start position of the change. */
|
|
10
|
-
startPosition;
|
|
11
|
-
/** The end position of the change before the edit. */
|
|
12
|
-
oldEndPosition;
|
|
13
|
-
/** The end position of the change after the edit. */
|
|
14
|
-
newEndPosition;
|
|
15
|
-
/** The start index of the change. */
|
|
16
|
-
startIndex;
|
|
17
|
-
/** The end index of the change before the edit. */
|
|
18
|
-
oldEndIndex;
|
|
19
|
-
/** The end index of the change after the edit. */
|
|
20
|
-
newEndIndex;
|
|
21
|
-
constructor({
|
|
22
|
-
startIndex,
|
|
23
|
-
oldEndIndex,
|
|
24
|
-
newEndIndex,
|
|
25
|
-
startPosition,
|
|
26
|
-
oldEndPosition,
|
|
27
|
-
newEndPosition
|
|
28
|
-
}) {
|
|
29
|
-
this.startIndex = startIndex >>> 0;
|
|
30
|
-
this.oldEndIndex = oldEndIndex >>> 0;
|
|
31
|
-
this.newEndIndex = newEndIndex >>> 0;
|
|
32
|
-
this.startPosition = startPosition;
|
|
33
|
-
this.oldEndPosition = oldEndPosition;
|
|
34
|
-
this.newEndPosition = newEndPosition;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Edit a point and index to keep it in-sync with source code that has been edited.
|
|
38
|
-
*
|
|
39
|
-
* This function updates a single point's byte offset and row/column position
|
|
40
|
-
* based on an edit operation. This is useful for editing points without
|
|
41
|
-
* requiring a tree or node instance.
|
|
42
|
-
*/
|
|
43
|
-
editPoint(point, index) {
|
|
44
|
-
let newIndex = index;
|
|
45
|
-
const newPoint = { ...point };
|
|
46
|
-
if (index >= this.oldEndIndex) {
|
|
47
|
-
newIndex = this.newEndIndex + (index - this.oldEndIndex);
|
|
48
|
-
const originalRow = point.row;
|
|
49
|
-
newPoint.row = this.newEndPosition.row + (point.row - this.oldEndPosition.row);
|
|
50
|
-
newPoint.column = originalRow === this.oldEndPosition.row ? this.newEndPosition.column + (point.column - this.oldEndPosition.column) : point.column;
|
|
51
|
-
} else if (index > this.startIndex) {
|
|
52
|
-
newIndex = this.newEndIndex;
|
|
53
|
-
newPoint.row = this.newEndPosition.row;
|
|
54
|
-
newPoint.column = this.newEndPosition.column;
|
|
55
|
-
}
|
|
56
|
-
return { point: newPoint, index: newIndex };
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Edit a range to keep it in-sync with source code that has been edited.
|
|
60
|
-
*
|
|
61
|
-
* This function updates a range's start and end positions based on an edit
|
|
62
|
-
* operation. This is useful for editing ranges without requiring a tree
|
|
63
|
-
* or node instance.
|
|
64
|
-
*/
|
|
65
|
-
editRange(range) {
|
|
66
|
-
const newRange = {
|
|
67
|
-
startIndex: range.startIndex,
|
|
68
|
-
startPosition: { ...range.startPosition },
|
|
69
|
-
endIndex: range.endIndex,
|
|
70
|
-
endPosition: { ...range.endPosition }
|
|
71
|
-
};
|
|
72
|
-
if (range.endIndex >= this.oldEndIndex) {
|
|
73
|
-
if (range.endIndex !== Number.MAX_SAFE_INTEGER) {
|
|
74
|
-
newRange.endIndex = this.newEndIndex + (range.endIndex - this.oldEndIndex);
|
|
75
|
-
newRange.endPosition = {
|
|
76
|
-
row: this.newEndPosition.row + (range.endPosition.row - this.oldEndPosition.row),
|
|
77
|
-
column: range.endPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.endPosition.column - this.oldEndPosition.column) : range.endPosition.column
|
|
78
|
-
};
|
|
79
|
-
if (newRange.endIndex < this.newEndIndex) {
|
|
80
|
-
newRange.endIndex = Number.MAX_SAFE_INTEGER;
|
|
81
|
-
newRange.endPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
} else if (range.endIndex > this.startIndex) {
|
|
85
|
-
newRange.endIndex = this.startIndex;
|
|
86
|
-
newRange.endPosition = { ...this.startPosition };
|
|
87
|
-
}
|
|
88
|
-
if (range.startIndex >= this.oldEndIndex) {
|
|
89
|
-
newRange.startIndex = this.newEndIndex + (range.startIndex - this.oldEndIndex);
|
|
90
|
-
newRange.startPosition = {
|
|
91
|
-
row: this.newEndPosition.row + (range.startPosition.row - this.oldEndPosition.row),
|
|
92
|
-
column: range.startPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.startPosition.column - this.oldEndPosition.column) : range.startPosition.column
|
|
93
|
-
};
|
|
94
|
-
if (newRange.startIndex < this.newEndIndex) {
|
|
95
|
-
newRange.startIndex = Number.MAX_SAFE_INTEGER;
|
|
96
|
-
newRange.startPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
|
|
97
|
-
}
|
|
98
|
-
} else if (range.startIndex > this.startIndex) {
|
|
99
|
-
newRange.startIndex = this.startIndex;
|
|
100
|
-
newRange.startPosition = { ...this.startPosition };
|
|
101
|
-
}
|
|
102
|
-
return newRange;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
4
|
// src/constants.ts
|
|
107
5
|
var SIZE_OF_INT = 4;
|
|
108
6
|
var SIZE_OF_NODE = 5 * SIZE_OF_INT;
|
|
@@ -241,8 +139,6 @@ var TreeCursor = class _TreeCursor {
|
|
|
241
139
|
/** @internal */
|
|
242
140
|
tree;
|
|
243
141
|
/** @internal */
|
|
244
|
-
editVersion = -1;
|
|
245
|
-
/** @internal */
|
|
246
142
|
_nodeTypeId = 0;
|
|
247
143
|
/** @internal */
|
|
248
144
|
_fieldId = 0;
|
|
@@ -338,7 +234,6 @@ var TreeCursor = class _TreeCursor {
|
|
|
338
234
|
}
|
|
339
235
|
/** Get the string content of the cursor's current node. */
|
|
340
236
|
get nodeText() {
|
|
341
|
-
this.syncIndices();
|
|
342
237
|
const { textSource } = this.tree;
|
|
343
238
|
return typeof textSource === "string" ? textSource.slice(this._startIndex, this._endIndex) : getCallbackText(textSource, this._startIndex, this._endIndex, this.startPosition);
|
|
344
239
|
}
|
|
@@ -354,12 +249,10 @@ var TreeCursor = class _TreeCursor {
|
|
|
354
249
|
}
|
|
355
250
|
/** Get the start index of the cursor's current node. */
|
|
356
251
|
get startIndex() {
|
|
357
|
-
this.syncIndices();
|
|
358
252
|
return this._startIndex;
|
|
359
253
|
}
|
|
360
254
|
/** Get the end index of the cursor's current node. */
|
|
361
255
|
get endIndex() {
|
|
362
|
-
this.syncIndices();
|
|
363
256
|
return this._endIndex;
|
|
364
257
|
}
|
|
365
258
|
/**
|
|
@@ -505,15 +398,6 @@ var TreeCursor = class _TreeCursor {
|
|
|
505
398
|
this._startIndex = heap[base + 2];
|
|
506
399
|
this._endIndex = heap[base + 3];
|
|
507
400
|
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
401
|
}
|
|
518
402
|
};
|
|
519
403
|
|
|
@@ -551,8 +435,6 @@ var Tree2 = class _Tree {
|
|
|
551
435
|
// Internal handle for Wasm
|
|
552
436
|
/** @internal */
|
|
553
437
|
textSource;
|
|
554
|
-
/** @internal */
|
|
555
|
-
editVersion = 0;
|
|
556
438
|
/** The language that was used to parse the syntax tree. */
|
|
557
439
|
language;
|
|
558
440
|
/** @internal */
|
|
@@ -590,42 +472,12 @@ var Tree2 = class _Tree {
|
|
|
590
472
|
C._ts_tree_root_node_with_offset_wasm(this[0]);
|
|
591
473
|
return unmarshalNode(this);
|
|
592
474
|
}
|
|
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
475
|
/** Create a new {@link TreeCursor} starting from the root of the tree. */
|
|
606
476
|
walk() {
|
|
607
477
|
C._ts_tree_root_node_wasm(this[0]);
|
|
608
478
|
const address = C._ts_tree_cursor_new_wasm(this[0]);
|
|
609
479
|
return new TreeCursor(INTERNAL, this, address);
|
|
610
480
|
}
|
|
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
481
|
/** Get the included ranges that were used to parse the syntax tree. */
|
|
630
482
|
getIncludedRanges() {
|
|
631
483
|
C._ts_tree_included_ranges_wasm(this[0]);
|
|
@@ -664,14 +516,7 @@ var Node = class {
|
|
|
664
516
|
/**
|
|
665
517
|
* The numeric id for this node that is unique.
|
|
666
518
|
*
|
|
667
|
-
* Within a given syntax tree, no two nodes have the same id.
|
|
668
|
-
*
|
|
669
|
-
* * If a new tree is created based on an older tree, and a node from the old tree is reused in
|
|
670
|
-
* the process, then that node will have the same id in both trees.
|
|
671
|
-
*
|
|
672
|
-
* * A node not marked as having changes does not guarantee it was reused.
|
|
673
|
-
*
|
|
674
|
-
* * If a node is marked as having changed in the old tree, it will not be reused.
|
|
519
|
+
* Within a given syntax tree, no two nodes have the same id.
|
|
675
520
|
*/
|
|
676
521
|
id;
|
|
677
522
|
/** The byte index where this node starts. */
|
|
@@ -744,11 +589,6 @@ var Node = class {
|
|
|
744
589
|
marshalNode(this);
|
|
745
590
|
return C._ts_node_is_missing_wasm(this.tree[0]) === 1;
|
|
746
591
|
}
|
|
747
|
-
/** Check if this node has been edited. */
|
|
748
|
-
get hasChanges() {
|
|
749
|
-
marshalNode(this);
|
|
750
|
-
return C._ts_node_has_changes_wasm(this.tree[0]) === 1;
|
|
751
|
-
}
|
|
752
592
|
/**
|
|
753
593
|
* Check if this node represents a syntax error or contains any syntax
|
|
754
594
|
* errors anywhere within it.
|
|
@@ -1106,20 +946,6 @@ var Node = class {
|
|
|
1106
946
|
const address = C._ts_tree_cursor_new_wasm(this.tree[0]);
|
|
1107
947
|
return new TreeCursor(INTERNAL, this.tree, address);
|
|
1108
948
|
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Edit this node to keep it in-sync with source code that has been edited.
|
|
1111
|
-
*
|
|
1112
|
-
* This function is only rarely needed. When you edit a syntax tree with
|
|
1113
|
-
* the {@link Tree#edit} method, all of the nodes that you retrieve from
|
|
1114
|
-
* the tree afterward will already reflect the edit. You only need to
|
|
1115
|
-
* use {@link Node#edit} when you have a specific {@link Node} instance that
|
|
1116
|
-
* you want to keep and continue to use after an edit.
|
|
1117
|
-
*/
|
|
1118
|
-
edit(edit) {
|
|
1119
|
-
const { point, index } = edit.editPoint(this.startPosition, this.startIndex);
|
|
1120
|
-
this.startPosition = point;
|
|
1121
|
-
this.startIndex = index;
|
|
1122
|
-
}
|
|
1123
949
|
/** Get the S-expression representation of this node. */
|
|
1124
950
|
toString() {
|
|
1125
951
|
marshalNode(this);
|
|
@@ -1194,20 +1020,6 @@ function unmarshalRange(address) {
|
|
|
1194
1020
|
};
|
|
1195
1021
|
}
|
|
1196
1022
|
__name(unmarshalRange, "unmarshalRange");
|
|
1197
|
-
function marshalEdit(edit, address = TRANSFER_BUFFER) {
|
|
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;
|
|
1209
|
-
}
|
|
1210
|
-
__name(marshalEdit, "marshalEdit");
|
|
1211
1023
|
function unmarshalLanguageMetadata(address) {
|
|
1212
1024
|
const base = address >>> 2;
|
|
1213
1025
|
const heap = C.HEAP32;
|
|
@@ -2218,7 +2030,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2218
2030
|
newDSO("__main__", 0, wasmImports);
|
|
2219
2031
|
}
|
|
2220
2032
|
};
|
|
2221
|
-
var ___heap_base =
|
|
2033
|
+
var ___heap_base = 81952;
|
|
2222
2034
|
var alignMemory = /* @__PURE__ */ __name((size, alignment) => {
|
|
2223
2035
|
assert(alignment, "alignment argument is required");
|
|
2224
2036
|
return Math.ceil(size / alignment) * alignment;
|
|
@@ -2313,7 +2125,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2313
2125
|
}, "convertJsFunctionToWasm");
|
|
2314
2126
|
var wasmTableMirror = [];
|
|
2315
2127
|
var wasmTable = new WebAssembly.Table({
|
|
2316
|
-
"initial":
|
|
2128
|
+
"initial": 58,
|
|
2317
2129
|
"element": "anyfunc"
|
|
2318
2130
|
});
|
|
2319
2131
|
var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
|
|
@@ -2849,12 +2661,12 @@ async function Module2(moduleArg = {}) {
|
|
|
2849
2661
|
"value": "i32",
|
|
2850
2662
|
"mutable": false
|
|
2851
2663
|
}, 1024);
|
|
2852
|
-
var ___stack_high =
|
|
2853
|
-
var ___stack_low =
|
|
2664
|
+
var ___stack_high = 81952;
|
|
2665
|
+
var ___stack_low = 16416;
|
|
2854
2666
|
var ___stack_pointer = new WebAssembly.Global({
|
|
2855
2667
|
"value": "i32",
|
|
2856
2668
|
"mutable": true
|
|
2857
|
-
},
|
|
2669
|
+
}, 81952);
|
|
2858
2670
|
var ___table_base = new WebAssembly.Global({
|
|
2859
2671
|
"value": "i32",
|
|
2860
2672
|
"mutable": false
|
|
@@ -3190,9 +3002,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3190
3002
|
var _ts_language_subtypes_wasm = Module["_ts_language_subtypes_wasm"] = makeInvalidEarlyAccess("_ts_language_subtypes_wasm");
|
|
3191
3003
|
var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_root_node_wasm");
|
|
3192
3004
|
var _ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = makeInvalidEarlyAccess("_ts_tree_root_node_with_offset_wasm");
|
|
3193
|
-
var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = makeInvalidEarlyAccess("_ts_tree_edit_wasm");
|
|
3194
3005
|
var _ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = makeInvalidEarlyAccess("_ts_tree_included_ranges_wasm");
|
|
3195
|
-
var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = makeInvalidEarlyAccess("_ts_tree_get_changed_ranges_wasm");
|
|
3196
3006
|
var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_new_wasm");
|
|
3197
3007
|
var _ts_tree_cursor_copy_wasm = Module["_ts_tree_cursor_copy_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_copy_wasm");
|
|
3198
3008
|
var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_delete_wasm");
|
|
@@ -3210,8 +3020,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3210
3020
|
var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_id_wasm");
|
|
3211
3021
|
var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_position_wasm");
|
|
3212
3022
|
var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_position_wasm");
|
|
3213
|
-
var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_index_wasm");
|
|
3214
|
-
var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_index_wasm");
|
|
3215
3023
|
var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_wasm");
|
|
3216
3024
|
var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = makeInvalidEarlyAccess("_ts_node_symbol_wasm");
|
|
3217
3025
|
var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = makeInvalidEarlyAccess("_ts_node_field_name_for_child_wasm");
|
|
@@ -3243,7 +3051,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3243
3051
|
var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = makeInvalidEarlyAccess("_ts_node_named_children_wasm");
|
|
3244
3052
|
var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = makeInvalidEarlyAccess("_ts_node_descendants_of_type_wasm");
|
|
3245
3053
|
var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = makeInvalidEarlyAccess("_ts_node_is_named_wasm");
|
|
3246
|
-
var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = makeInvalidEarlyAccess("_ts_node_has_changes_wasm");
|
|
3247
3054
|
var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = makeInvalidEarlyAccess("_ts_node_has_error_wasm");
|
|
3248
3055
|
var _ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = makeInvalidEarlyAccess("_ts_node_is_error_wasm");
|
|
3249
3056
|
var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = makeInvalidEarlyAccess("_ts_node_is_missing_wasm");
|
|
@@ -3318,7 +3125,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3318
3125
|
Module["_ts_scanner_realloc_wasm"] = _ts_scanner_realloc_wasm = createExportWrapper("ts_scanner_realloc_wasm", 2);
|
|
3319
3126
|
Module["_ts_parser_new_wasm"] = _ts_parser_new_wasm = createExportWrapper("ts_parser_new_wasm", 0);
|
|
3320
3127
|
Module["_ts_parser_enable_logger_wasm"] = _ts_parser_enable_logger_wasm = createExportWrapper("ts_parser_enable_logger_wasm", 2);
|
|
3321
|
-
Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm",
|
|
3128
|
+
Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm", 2);
|
|
3322
3129
|
Module["_ts_parser_parse_limited_wasm"] = _ts_parser_parse_limited_wasm = createExportWrapper("ts_parser_parse_limited_wasm", 2);
|
|
3323
3130
|
Module["_ts_parser_last_parse_operations_wasm"] = _ts_parser_last_parse_operations_wasm = createExportWrapper("ts_parser_last_parse_operations_wasm", 1);
|
|
3324
3131
|
Module["_ts_parser_abort_limited_wasm"] = _ts_parser_abort_limited_wasm = createExportWrapper("ts_parser_abort_limited_wasm", 0);
|
|
@@ -3330,9 +3137,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3330
3137
|
Module["_ts_language_subtypes_wasm"] = _ts_language_subtypes_wasm = createExportWrapper("ts_language_subtypes_wasm", 2);
|
|
3331
3138
|
Module["_ts_tree_root_node_wasm"] = _ts_tree_root_node_wasm = createExportWrapper("ts_tree_root_node_wasm", 1);
|
|
3332
3139
|
Module["_ts_tree_root_node_with_offset_wasm"] = _ts_tree_root_node_with_offset_wasm = createExportWrapper("ts_tree_root_node_with_offset_wasm", 1);
|
|
3333
|
-
Module["_ts_tree_edit_wasm"] = _ts_tree_edit_wasm = createExportWrapper("ts_tree_edit_wasm", 1);
|
|
3334
3140
|
Module["_ts_tree_included_ranges_wasm"] = _ts_tree_included_ranges_wasm = createExportWrapper("ts_tree_included_ranges_wasm", 1);
|
|
3335
|
-
Module["_ts_tree_get_changed_ranges_wasm"] = _ts_tree_get_changed_ranges_wasm = createExportWrapper("ts_tree_get_changed_ranges_wasm", 2);
|
|
3336
3141
|
Module["_ts_tree_cursor_new_wasm"] = _ts_tree_cursor_new_wasm = createExportWrapper("ts_tree_cursor_new_wasm", 1);
|
|
3337
3142
|
Module["_ts_tree_cursor_copy_wasm"] = _ts_tree_cursor_copy_wasm = createExportWrapper("ts_tree_cursor_copy_wasm", 1);
|
|
3338
3143
|
Module["_ts_tree_cursor_delete_wasm"] = _ts_tree_cursor_delete_wasm = createExportWrapper("ts_tree_cursor_delete_wasm", 1);
|
|
@@ -3350,8 +3155,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3350
3155
|
Module["_ts_tree_cursor_current_node_id_wasm"] = _ts_tree_cursor_current_node_id_wasm = createExportWrapper("ts_tree_cursor_current_node_id_wasm", 1);
|
|
3351
3156
|
Module["_ts_tree_cursor_start_position_wasm"] = _ts_tree_cursor_start_position_wasm = createExportWrapper("ts_tree_cursor_start_position_wasm", 1);
|
|
3352
3157
|
Module["_ts_tree_cursor_end_position_wasm"] = _ts_tree_cursor_end_position_wasm = createExportWrapper("ts_tree_cursor_end_position_wasm", 1);
|
|
3353
|
-
Module["_ts_tree_cursor_start_index_wasm"] = _ts_tree_cursor_start_index_wasm = createExportWrapper("ts_tree_cursor_start_index_wasm", 1);
|
|
3354
|
-
Module["_ts_tree_cursor_end_index_wasm"] = _ts_tree_cursor_end_index_wasm = createExportWrapper("ts_tree_cursor_end_index_wasm", 1);
|
|
3355
3158
|
Module["_ts_tree_cursor_current_node_wasm"] = _ts_tree_cursor_current_node_wasm = createExportWrapper("ts_tree_cursor_current_node_wasm", 1);
|
|
3356
3159
|
Module["_ts_node_symbol_wasm"] = _ts_node_symbol_wasm = createExportWrapper("ts_node_symbol_wasm", 1);
|
|
3357
3160
|
Module["_ts_node_field_name_for_child_wasm"] = _ts_node_field_name_for_child_wasm = createExportWrapper("ts_node_field_name_for_child_wasm", 2);
|
|
@@ -3383,7 +3186,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3383
3186
|
Module["_ts_node_named_children_wasm"] = _ts_node_named_children_wasm = createExportWrapper("ts_node_named_children_wasm", 1);
|
|
3384
3187
|
Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm", 3);
|
|
3385
3188
|
Module["_ts_node_is_named_wasm"] = _ts_node_is_named_wasm = createExportWrapper("ts_node_is_named_wasm", 1);
|
|
3386
|
-
Module["_ts_node_has_changes_wasm"] = _ts_node_has_changes_wasm = createExportWrapper("ts_node_has_changes_wasm", 1);
|
|
3387
3189
|
Module["_ts_node_has_error_wasm"] = _ts_node_has_error_wasm = createExportWrapper("ts_node_has_error_wasm", 1);
|
|
3388
3190
|
Module["_ts_node_is_error_wasm"] = _ts_node_is_error_wasm = createExportWrapper("ts_node_is_error_wasm", 1);
|
|
3389
3191
|
Module["_ts_node_is_missing_wasm"] = _ts_node_is_missing_wasm = createExportWrapper("ts_node_is_missing_wasm", 1);
|
|
@@ -3457,8 +3259,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3457
3259
|
/** @export */
|
|
3458
3260
|
invoke_iiii,
|
|
3459
3261
|
/** @export */
|
|
3460
|
-
invoke_iiiii,
|
|
3461
|
-
/** @export */
|
|
3462
3262
|
invoke_ji,
|
|
3463
3263
|
/** @export */
|
|
3464
3264
|
invoke_vi,
|
|
@@ -3531,17 +3331,6 @@ async function Module2(moduleArg = {}) {
|
|
|
3531
3331
|
}
|
|
3532
3332
|
}
|
|
3533
3333
|
__name(invoke_iiii, "invoke_iiii");
|
|
3534
|
-
function invoke_iiiii(index, a1, a2, a3, a4) {
|
|
3535
|
-
var sp = stackSave();
|
|
3536
|
-
try {
|
|
3537
|
-
return getWasmTableEntry(index)(a1, a2, a3, a4);
|
|
3538
|
-
} catch (e) {
|
|
3539
|
-
stackRestore(sp);
|
|
3540
|
-
if (e !== e + 0) throw e;
|
|
3541
|
-
_setThrew(1, 0);
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
__name(invoke_iiiii, "invoke_iiiii");
|
|
3545
3334
|
function invoke_iii(index, a1, a2) {
|
|
3546
3335
|
var sp = stackSave();
|
|
3547
3336
|
try {
|
|
@@ -3582,7 +3371,7 @@ async function Module2(moduleArg = {}) {
|
|
|
3582
3371
|
}
|
|
3583
3372
|
__name(callMain, "callMain");
|
|
3584
3373
|
function stackCheckInit() {
|
|
3585
|
-
_emscripten_stack_set_limits(
|
|
3374
|
+
_emscripten_stack_set_limits(81952, 16416);
|
|
3586
3375
|
writeStackCookie();
|
|
3587
3376
|
}
|
|
3588
3377
|
__name(stackCheckInit, "stackCheckInit");
|
|
@@ -3796,10 +3585,6 @@ var Parser = class {
|
|
|
3796
3585
|
*
|
|
3797
3586
|
* @param {string | ParseCallback} callback - The UTF8-encoded text to parse or a callback function.
|
|
3798
3587
|
*
|
|
3799
|
-
* @param {Tree | null} [oldTree] - A previous syntax tree parsed from the same document. If the text of the
|
|
3800
|
-
* document has changed since `oldTree` was created, then you must edit `oldTree` to match
|
|
3801
|
-
* the new text using {@link Tree#edit}.
|
|
3802
|
-
*
|
|
3803
3588
|
* @param {ParseOptions} [options] - Options for parsing the text.
|
|
3804
3589
|
* This can be used to set the included ranges, or a progress callback.
|
|
3805
3590
|
*
|
|
@@ -3808,7 +3593,7 @@ var Parser = class {
|
|
|
3808
3593
|
* - The progress callback returned true.
|
|
3809
3594
|
* - The memory limit was reached or the operation limit was exceeded.
|
|
3810
3595
|
*/
|
|
3811
|
-
parse(callback,
|
|
3596
|
+
parse(callback, options) {
|
|
3812
3597
|
const maxMemoryBytes = validateMemoryLimit(options?.maxMemoryBytes);
|
|
3813
3598
|
const maxOperations = validateOperationLimit(options?.maxOperations);
|
|
3814
3599
|
if (typeof callback !== "string" && typeof callback !== "function") {
|
|
@@ -3820,7 +3605,7 @@ var Parser = class {
|
|
|
3820
3605
|
this.syncLogger();
|
|
3821
3606
|
this.lastParseOperations = 0;
|
|
3822
3607
|
try {
|
|
3823
|
-
const treeAddress = this.runParse(
|
|
3608
|
+
const treeAddress = this.runParse(options, maxMemoryBytes, maxOperations);
|
|
3824
3609
|
if (!treeAddress) return null;
|
|
3825
3610
|
if (!this.language) throw new Error("Parser must have a language to parse");
|
|
3826
3611
|
return new Tree2(INTERNAL, treeAddress, this.language, callback);
|
|
@@ -3845,7 +3630,7 @@ var Parser = class {
|
|
|
3845
3630
|
}
|
|
3846
3631
|
}
|
|
3847
3632
|
/** @internal */
|
|
3848
|
-
runParse(
|
|
3633
|
+
runParse(options, maxMemoryBytes, maxOperations) {
|
|
3849
3634
|
if (maxMemoryBytes !== void 0 && !C.treeSitterSetMemoryLimit(maxMemoryBytes)) {
|
|
3850
3635
|
return 0;
|
|
3851
3636
|
}
|
|
@@ -3854,7 +3639,7 @@ var Parser = class {
|
|
|
3854
3639
|
if (rangeCount && !rangeAddress) return 0;
|
|
3855
3640
|
marshalParseInputs(maxOperations, rangeAddress, rangeCount, options?.progressCallback ? 1 : 0);
|
|
3856
3641
|
try {
|
|
3857
|
-
return maxMemoryBytes === void 0 ? this.executeOrdinaryParse(
|
|
3642
|
+
return maxMemoryBytes === void 0 ? this.executeOrdinaryParse() : this.executeLimitedParse();
|
|
3858
3643
|
} finally {
|
|
3859
3644
|
this.lastParseOperations = unmarshalOperationCount();
|
|
3860
3645
|
}
|
|
@@ -3863,9 +3648,9 @@ var Parser = class {
|
|
|
3863
3648
|
}
|
|
3864
3649
|
}
|
|
3865
3650
|
/** @internal */
|
|
3866
|
-
executeOrdinaryParse(
|
|
3651
|
+
executeOrdinaryParse() {
|
|
3867
3652
|
try {
|
|
3868
|
-
return C._ts_parser_parse_wasm(this[0], this[1]
|
|
3653
|
+
return C._ts_parser_parse_wasm(this[0], this[1]);
|
|
3869
3654
|
} catch (error) {
|
|
3870
3655
|
C._ts_parser_last_parse_operations_wasm(this[0]);
|
|
3871
3656
|
throw error;
|
|
@@ -3967,7 +3752,6 @@ function clearCallbacks() {
|
|
|
3967
3752
|
}
|
|
3968
3753
|
__name(clearCallbacks, "clearCallbacks");
|
|
3969
3754
|
export {
|
|
3970
|
-
Edit,
|
|
3971
3755
|
LANGUAGE_VERSION,
|
|
3972
3756
|
Language,
|
|
3973
3757
|
LookaheadIterator,
|