@willbooster/web-tree-sitter 10.0.4 → 11.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/debug/web-tree-sitter.cjs +53 -79
- package/debug/web-tree-sitter.cjs.map +2 -2
- package/debug/web-tree-sitter.js +53 -79
- package/debug/web-tree-sitter.js.map +2 -2
- package/debug/web-tree-sitter.wasm +0 -0
- package/debug/web-tree-sitter.wasm.map +3 -3
- package/package.json +1 -1
- package/web-tree-sitter.cjs +52 -78
- package/web-tree-sitter.cjs.map +2 -2
- package/web-tree-sitter.d.cts +8 -8
- package/web-tree-sitter.d.cts.map +1 -1
- package/web-tree-sitter.d.ts +8 -8
- package/web-tree-sitter.d.ts.map +1 -1
- package/web-tree-sitter.js +52 -78
- package/web-tree-sitter.js.map +2 -2
- package/web-tree-sitter.wasm +0 -0
- package/web-tree-sitter.wasm.map +3 -3
- package/web-tree-sitter.web.js +52 -78
- package/web-tree-sitter.web.js.map +2 -2
package/web-tree-sitter.d.cts
CHANGED
|
@@ -726,7 +726,7 @@
|
|
|
726
726
|
gotoDescendant(goalDescendantIndex: number): void;
|
|
727
727
|
/**
|
|
728
728
|
* Move this cursor to the first child of its current node that contains or
|
|
729
|
-
* starts after the given
|
|
729
|
+
* starts after the given index.
|
|
730
730
|
*
|
|
731
731
|
* This returns `true` if the cursor successfully moved to a child node, and returns
|
|
732
732
|
* `false` if no such child was found.
|
|
@@ -734,10 +734,10 @@
|
|
|
734
734
|
gotoFirstChildForIndex(goalIndex: number): boolean;
|
|
735
735
|
/**
|
|
736
736
|
* Move this cursor to the first child of its current node that contains or
|
|
737
|
-
* starts after the given
|
|
737
|
+
* starts after the given position.
|
|
738
738
|
*
|
|
739
|
-
* This returns
|
|
740
|
-
* `
|
|
739
|
+
* This returns `true` if the cursor successfully moved to a child node, and returns
|
|
740
|
+
* `false` if no such child was found.
|
|
741
741
|
*/
|
|
742
742
|
gotoFirstChildForPosition(goalPosition: Point): boolean;
|
|
743
743
|
/**
|
|
@@ -990,9 +990,9 @@
|
|
|
990
990
|
* of in-progress matches.
|
|
991
991
|
*/
|
|
992
992
|
didExceedMatchLimit(): boolean;
|
|
993
|
-
/** Get the
|
|
993
|
+
/** Get the index where the given pattern starts in the query's source. */
|
|
994
994
|
startIndexForPattern(patternIndex: number): number;
|
|
995
|
-
/** Get the
|
|
995
|
+
/** Get the index where the given pattern ends in the query's source. */
|
|
996
996
|
endIndexForPattern(patternIndex: number): number;
|
|
997
997
|
/** Get the number of patterns in the query. */
|
|
998
998
|
patternCount(): number;
|
|
@@ -1003,12 +1003,12 @@
|
|
|
1003
1003
|
/** Check if a given pattern within a query has a single root node. */
|
|
1004
1004
|
isPatternNonLocal(patternIndex: number): boolean;
|
|
1005
1005
|
/**
|
|
1006
|
-
* Check if
|
|
1006
|
+
* Check if the step at the given index in the query's source is 'definite'.
|
|
1007
1007
|
*
|
|
1008
1008
|
* A query step is 'definite' if its parent pattern will be guaranteed to
|
|
1009
1009
|
* match successfully once it reaches the step.
|
|
1010
1010
|
*/
|
|
1011
|
-
isPatternGuaranteedAtStep(
|
|
1011
|
+
isPatternGuaranteedAtStep(index: number): boolean;
|
|
1012
1012
|
}
|
|
1013
1013
|
export class LookaheadIterator implements Iterable<string> {
|
|
1014
1014
|
/**
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
null,
|
|
57
57
|
null
|
|
58
58
|
],
|
|
59
|
-
"mappings": ";;;;;;kBASiBA,KAAKA;;;;;;;;;;kBAYLC,KAAKA;;;;;;;;;;;;;aAsCVC,aAAaA;;;;aAKbC,gBAAgBA;;;;;;aAOhBC,WAAWA;;kBChENC,iBAAiBA;;;;;;;cCLrBC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBCgBAC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmCZC,UAAUA;;;;;;;;;;;;;;YAuBhBC,gBAAgBA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endantIndex: number): void;
|
|
727
727
|
/**
|
|
728
728
|
* Move this cursor to the first child of its current node that contains or
|
|
729
|
-
* starts after the given
|
|
729
|
+
* starts after the given index.
|
|
730
730
|
*
|
|
731
731
|
* This returns `true` if the cursor successfully moved to a child node, and returns
|
|
732
732
|
* `false` if no such child was found.
|
|
@@ -734,10 +734,10 @@
|
|
|
734
734
|
gotoFirstChildForIndex(goalIndex: number): boolean;
|
|
735
735
|
/**
|
|
736
736
|
* Move this cursor to the first child of its current node that contains or
|
|
737
|
-
* starts after the given
|
|
737
|
+
* starts after the given position.
|
|
738
738
|
*
|
|
739
|
-
* This returns
|
|
740
|
-
* `
|
|
739
|
+
* This returns `true` if the cursor successfully moved to a child node, and returns
|
|
740
|
+
* `false` if no such child was found.
|
|
741
741
|
*/
|
|
742
742
|
gotoFirstChildForPosition(goalPosition: Point): boolean;
|
|
743
743
|
/**
|
|
@@ -990,9 +990,9 @@
|
|
|
990
990
|
* of in-progress matches.
|
|
991
991
|
*/
|
|
992
992
|
didExceedMatchLimit(): boolean;
|
|
993
|
-
/** Get the
|
|
993
|
+
/** Get the index where the given pattern starts in the query's source. */
|
|
994
994
|
startIndexForPattern(patternIndex: number): number;
|
|
995
|
-
/** Get the
|
|
995
|
+
/** Get the index where the given pattern ends in the query's source. */
|
|
996
996
|
endIndexForPattern(patternIndex: number): number;
|
|
997
997
|
/** Get the number of patterns in the query. */
|
|
998
998
|
patternCount(): number;
|
|
@@ -1003,12 +1003,12 @@
|
|
|
1003
1003
|
/** Check if a given pattern within a query has a single root node. */
|
|
1004
1004
|
isPatternNonLocal(patternIndex: number): boolean;
|
|
1005
1005
|
/**
|
|
1006
|
-
* Check if
|
|
1006
|
+
* Check if the step at the given index in the query's source is 'definite'.
|
|
1007
1007
|
*
|
|
1008
1008
|
* A query step is 'definite' if its parent pattern will be guaranteed to
|
|
1009
1009
|
* match successfully once it reaches the step.
|
|
1010
1010
|
*/
|
|
1011
|
-
isPatternGuaranteedAtStep(
|
|
1011
|
+
isPatternGuaranteedAtStep(index: number): boolean;
|
|
1012
1012
|
}
|
|
1013
1013
|
export class LookaheadIterator implements Iterable<string> {
|
|
1014
1014
|
/**
|
package/web-tree-sitter.d.ts.map
CHANGED
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
null,
|
|
57
57
|
null
|
|
58
58
|
],
|
|
59
|
-
"mappings": ";;;;;;kBASiBA,KAAKA;;;;;;;;;;kBAYLC,KAAKA;;;;;;;;;;;;;aAsCVC,aAAaA;;;;aAKbC,gBAAgBA;;;;;;aAOhBC,WAAWA;;kBChENC,iBAAiBA;;;;;;;cCLrBC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBCgBAC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmCZC,UAAUA;;;;;;;;;;;;;;YAuBhBC,gBAAgBA;;;;;YAqBhBC,sBAAsBA;;;;;cAWpBC,MAAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WCrGFC,gBAAgBA;;;;;;;;;cAYpBC,QAAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCiBRC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC1BJC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
59
|
+
"mappings": ";;;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;;;;;;;;;;;;;;;;;;;;;kBA2EZC,UAAUA;;;;;aAMfC,eAAeA;;;;kBAKVC,cAAcA;;;;;;;;;;kBAYdC,YAAYA;;;;;;;;;;;;;;;kBAqBZC,UAAUA;;;;;;;;;;;;;cA2BfC,iBAAiBA;;;;;;;;aAAjBA,iBAAiBA;;;;;;;;;;;;aAajBC,aAAaA;;;;;;WAORC,oBAAoBA;;;;;;;;;WAOpBC,mBAAmBA;;;;cAmVvBC,KAAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCxgBLC,iBAAiBA",
|
|
60
60
|
"ignoreList": []
|
|
61
61
|
}
|
package/web-tree-sitter.js
CHANGED
|
@@ -363,29 +363,17 @@ var Tree = class _Tree {
|
|
|
363
363
|
};
|
|
364
364
|
|
|
365
365
|
// src/tree_cursor.ts
|
|
366
|
-
var finalizer3 = newFinalizer((
|
|
367
|
-
|
|
366
|
+
var finalizer3 = newFinalizer((handles) => {
|
|
367
|
+
marshalTreeCursor({ handles });
|
|
368
|
+
C._ts_tree_cursor_delete_wasm(0);
|
|
368
369
|
});
|
|
369
370
|
var TreeCursor = class _TreeCursor {
|
|
370
371
|
static {
|
|
371
372
|
__name(this, "TreeCursor");
|
|
372
373
|
}
|
|
373
374
|
/** @internal */
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
// Internal handle for Wasm
|
|
377
|
-
/** @internal */
|
|
378
|
-
// @ts-expect-error: never read
|
|
379
|
-
[1] = 0;
|
|
380
|
-
// Internal handle for Wasm
|
|
381
|
-
/** @internal */
|
|
382
|
-
// @ts-expect-error: never read
|
|
383
|
-
[2] = 0;
|
|
384
|
-
// Internal handle for Wasm
|
|
385
|
-
/** @internal */
|
|
386
|
-
// @ts-expect-error: never read
|
|
387
|
-
[3] = 0;
|
|
388
|
-
// Internal handle for Wasm
|
|
375
|
+
handles = [0, 0, 0, 0];
|
|
376
|
+
// Internal handles for Wasm, shared with the finalizer.
|
|
389
377
|
/** @internal */
|
|
390
378
|
tree;
|
|
391
379
|
/** @internal */
|
|
@@ -393,22 +381,20 @@ var TreeCursor = class _TreeCursor {
|
|
|
393
381
|
assertInternal(internal);
|
|
394
382
|
this.tree = tree;
|
|
395
383
|
unmarshalTreeCursor(this);
|
|
396
|
-
finalizer3?.register(this, this.
|
|
384
|
+
finalizer3?.register(this, this.handles, this);
|
|
397
385
|
}
|
|
398
386
|
/** Creates a deep copy of the tree cursor. This allocates new memory. */
|
|
399
387
|
copy() {
|
|
400
388
|
marshalTreeCursor(this);
|
|
401
|
-
const copy = new _TreeCursor(INTERNAL, this.tree);
|
|
402
389
|
C._ts_tree_cursor_copy_wasm(this.tree[0]);
|
|
403
|
-
|
|
404
|
-
return copy;
|
|
390
|
+
return new _TreeCursor(INTERNAL, this.tree);
|
|
405
391
|
}
|
|
406
392
|
/** Delete the tree cursor, freeing its resources. */
|
|
407
393
|
delete() {
|
|
408
394
|
finalizer3?.unregister(this);
|
|
409
395
|
marshalTreeCursor(this);
|
|
410
396
|
C._ts_tree_cursor_delete_wasm(this.tree[0]);
|
|
411
|
-
this
|
|
397
|
+
this.handles.fill(0);
|
|
412
398
|
}
|
|
413
399
|
/** Get the tree cursor's current {@link Node}. */
|
|
414
400
|
get currentNode() {
|
|
@@ -605,7 +591,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
605
591
|
}
|
|
606
592
|
/**
|
|
607
593
|
* Move this cursor to the first child of its current node that contains or
|
|
608
|
-
* starts after the given
|
|
594
|
+
* starts after the given index.
|
|
609
595
|
*
|
|
610
596
|
* This returns `true` if the cursor successfully moved to a child node, and returns
|
|
611
597
|
* `false` if no such child was found.
|
|
@@ -619,10 +605,10 @@ var TreeCursor = class _TreeCursor {
|
|
|
619
605
|
}
|
|
620
606
|
/**
|
|
621
607
|
* Move this cursor to the first child of its current node that contains or
|
|
622
|
-
* starts after the given
|
|
608
|
+
* starts after the given position.
|
|
623
609
|
*
|
|
624
|
-
* This returns
|
|
625
|
-
* `
|
|
610
|
+
* This returns `true` if the cursor successfully moved to a child node, and returns
|
|
611
|
+
* `false` if no such child was found.
|
|
626
612
|
*/
|
|
627
613
|
gotoFirstChildForPosition(goalPosition) {
|
|
628
614
|
marshalTreeCursor(this);
|
|
@@ -638,8 +624,9 @@ var TreeCursor = class _TreeCursor {
|
|
|
638
624
|
reset(node) {
|
|
639
625
|
marshalNode(node);
|
|
640
626
|
marshalTreeCursor(this, TRANSFER_BUFFER + SIZE_OF_NODE);
|
|
641
|
-
C._ts_tree_cursor_reset_wasm(
|
|
627
|
+
C._ts_tree_cursor_reset_wasm(node.tree[0]);
|
|
642
628
|
unmarshalTreeCursor(this);
|
|
629
|
+
this.tree = node.tree;
|
|
643
630
|
}
|
|
644
631
|
/**
|
|
645
632
|
* Re-initialize a tree cursor to the same position as another cursor.
|
|
@@ -652,6 +639,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
652
639
|
marshalTreeCursor(cursor, TRANSFER_BUFFER + SIZE_OF_CURSOR);
|
|
653
640
|
C._ts_tree_cursor_reset_to_wasm(this.tree[0], cursor.tree[0]);
|
|
654
641
|
unmarshalTreeCursor(this);
|
|
642
|
+
this.tree = cursor.tree;
|
|
655
643
|
}
|
|
656
644
|
};
|
|
657
645
|
|
|
@@ -1012,16 +1000,14 @@ var Node = class {
|
|
|
1012
1000
|
if (!Array.isArray(types)) types = [types];
|
|
1013
1001
|
const symbols = [];
|
|
1014
1002
|
const typesBySymbol = this.tree.language.types;
|
|
1015
|
-
for (const node_type of types) {
|
|
1016
|
-
if (node_type == "ERROR") {
|
|
1017
|
-
symbols.push(65535);
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
1003
|
for (let i2 = 0, n = typesBySymbol.length; i2 < n; i2++) {
|
|
1021
1004
|
if (types.includes(typesBySymbol[i2])) {
|
|
1022
1005
|
symbols.push(i2);
|
|
1023
1006
|
}
|
|
1024
1007
|
}
|
|
1008
|
+
if (types.includes("ERROR")) {
|
|
1009
|
+
symbols.push(65535);
|
|
1010
|
+
}
|
|
1025
1011
|
const symbolsAddress = C._malloc(SIZE_OF_INT * symbols.length);
|
|
1026
1012
|
for (let i2 = 0, n = symbols.length; i2 < n; i2++) {
|
|
1027
1013
|
C.setValue(symbolsAddress + i2 * SIZE_OF_INT, symbols[i2], "i32");
|
|
@@ -1177,31 +1163,9 @@ var Node = class {
|
|
|
1177
1163
|
* you want to keep and continue to use after an edit.
|
|
1178
1164
|
*/
|
|
1179
1165
|
edit(edit) {
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
let subbedPointColumn;
|
|
1184
|
-
if (this.startPosition.row > edit.oldEndPosition.row) {
|
|
1185
|
-
subbedPointRow = this.startPosition.row - edit.oldEndPosition.row;
|
|
1186
|
-
subbedPointColumn = this.startPosition.column;
|
|
1187
|
-
} else {
|
|
1188
|
-
subbedPointRow = 0;
|
|
1189
|
-
subbedPointColumn = this.startPosition.column;
|
|
1190
|
-
if (this.startPosition.column >= edit.oldEndPosition.column) {
|
|
1191
|
-
subbedPointColumn = this.startPosition.column - edit.oldEndPosition.column;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
if (subbedPointRow > 0) {
|
|
1195
|
-
this.startPosition.row += subbedPointRow;
|
|
1196
|
-
this.startPosition.column = subbedPointColumn;
|
|
1197
|
-
} else {
|
|
1198
|
-
this.startPosition.column += subbedPointColumn;
|
|
1199
|
-
}
|
|
1200
|
-
} else if (this.startIndex > edit.startIndex) {
|
|
1201
|
-
this.startIndex = edit.newEndIndex;
|
|
1202
|
-
this.startPosition.row = edit.newEndPosition.row;
|
|
1203
|
-
this.startPosition.column = edit.newEndPosition.column;
|
|
1204
|
-
}
|
|
1166
|
+
const { point, index } = edit.editPoint(this.startPosition, this.startIndex);
|
|
1167
|
+
this.startPosition = point;
|
|
1168
|
+
this.startIndex = index;
|
|
1205
1169
|
}
|
|
1206
1170
|
/** Get the S-expression representation of this node. */
|
|
1207
1171
|
toString() {
|
|
@@ -1259,18 +1223,18 @@ function unmarshalNode(tree, address = TRANSFER_BUFFER) {
|
|
|
1259
1223
|
return result;
|
|
1260
1224
|
}
|
|
1261
1225
|
__name(unmarshalNode, "unmarshalNode");
|
|
1262
|
-
function marshalTreeCursor(
|
|
1263
|
-
C.setValue(address + 0 * SIZE_OF_INT,
|
|
1264
|
-
C.setValue(address + 1 * SIZE_OF_INT,
|
|
1265
|
-
C.setValue(address + 2 * SIZE_OF_INT,
|
|
1266
|
-
C.setValue(address + 3 * SIZE_OF_INT,
|
|
1226
|
+
function marshalTreeCursor({ handles }, address = TRANSFER_BUFFER) {
|
|
1227
|
+
C.setValue(address + 0 * SIZE_OF_INT, handles[0], "i32");
|
|
1228
|
+
C.setValue(address + 1 * SIZE_OF_INT, handles[1], "i32");
|
|
1229
|
+
C.setValue(address + 2 * SIZE_OF_INT, handles[2], "i32");
|
|
1230
|
+
C.setValue(address + 3 * SIZE_OF_INT, handles[3], "i32");
|
|
1267
1231
|
}
|
|
1268
1232
|
__name(marshalTreeCursor, "marshalTreeCursor");
|
|
1269
|
-
function unmarshalTreeCursor(
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1233
|
+
function unmarshalTreeCursor({ handles }) {
|
|
1234
|
+
handles[0] = C.getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, "i32");
|
|
1235
|
+
handles[1] = C.getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, "i32");
|
|
1236
|
+
handles[2] = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
|
|
1237
|
+
handles[3] = C.getValue(TRANSFER_BUFFER + 3 * SIZE_OF_INT, "i32");
|
|
1274
1238
|
}
|
|
1275
1239
|
__name(unmarshalTreeCursor, "unmarshalTreeCursor");
|
|
1276
1240
|
function marshalPoint(address, point) {
|
|
@@ -2097,7 +2061,7 @@ async function Module2(moduleArg = {}) {
|
|
|
2097
2061
|
newDSO("__main__", 0, wasmImports);
|
|
2098
2062
|
}
|
|
2099
2063
|
};
|
|
2100
|
-
var ___heap_base =
|
|
2064
|
+
var ___heap_base = 82384;
|
|
2101
2065
|
var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
|
|
2102
2066
|
var getMemory = /* @__PURE__ */ __name((size) => {
|
|
2103
2067
|
if (runtimeInitialized) {
|
|
@@ -2662,12 +2626,12 @@ async function Module2(moduleArg = {}) {
|
|
|
2662
2626
|
"value": "i32",
|
|
2663
2627
|
"mutable": false
|
|
2664
2628
|
}, 1024);
|
|
2665
|
-
var ___stack_high =
|
|
2666
|
-
var ___stack_low =
|
|
2629
|
+
var ___stack_high = 82384;
|
|
2630
|
+
var ___stack_low = 16848;
|
|
2667
2631
|
var ___stack_pointer = new WebAssembly.Global({
|
|
2668
2632
|
"value": "i32",
|
|
2669
2633
|
"mutable": true
|
|
2670
|
-
},
|
|
2634
|
+
}, 82384);
|
|
2671
2635
|
var ___table_base = new WebAssembly.Global({
|
|
2672
2636
|
"value": "i32",
|
|
2673
2637
|
"mutable": false
|
|
@@ -3651,6 +3615,10 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
|
|
|
3651
3615
|
}
|
|
3652
3616
|
}
|
|
3653
3617
|
__name(parsePattern, "parsePattern");
|
|
3618
|
+
function indexForByteOffset(source, byteOffset) {
|
|
3619
|
+
return new TextEncoder().encodeInto(source, new Uint8Array(byteOffset)).read;
|
|
3620
|
+
}
|
|
3621
|
+
__name(indexForByteOffset, "indexForByteOffset");
|
|
3654
3622
|
var finalizer5 = newFinalizer((address) => {
|
|
3655
3623
|
C._ts_query_delete(address);
|
|
3656
3624
|
});
|
|
@@ -3665,6 +3633,8 @@ var Query = class {
|
|
|
3665
3633
|
exceededMatchLimit;
|
|
3666
3634
|
/** @internal */
|
|
3667
3635
|
textPredicates;
|
|
3636
|
+
/** @internal */
|
|
3637
|
+
source;
|
|
3668
3638
|
/** The names of the captures used in the query. */
|
|
3669
3639
|
captureNames;
|
|
3670
3640
|
/** The quantifiers of the captures used in the query. */
|
|
@@ -3804,6 +3774,7 @@ var Query = class {
|
|
|
3804
3774
|
this.captureNames = captureNames;
|
|
3805
3775
|
this.captureQuantifiers = captureQuantifiers;
|
|
3806
3776
|
this.textPredicates = textPredicates;
|
|
3777
|
+
this.source = source;
|
|
3807
3778
|
this.predicates = predicates;
|
|
3808
3779
|
this.setProperties = setProperties;
|
|
3809
3780
|
this.assertedProperties = assertedProperties;
|
|
@@ -4014,23 +3985,25 @@ var Query = class {
|
|
|
4014
3985
|
didExceedMatchLimit() {
|
|
4015
3986
|
return this.exceededMatchLimit;
|
|
4016
3987
|
}
|
|
4017
|
-
/** Get the
|
|
3988
|
+
/** Get the index where the given pattern starts in the query's source. */
|
|
4018
3989
|
startIndexForPattern(patternIndex) {
|
|
4019
3990
|
if (patternIndex >= this.predicates.length) {
|
|
4020
3991
|
throw new Error(
|
|
4021
3992
|
`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`
|
|
4022
3993
|
);
|
|
4023
3994
|
}
|
|
4024
|
-
|
|
3995
|
+
const byteOffset = C._ts_query_start_byte_for_pattern(this[0], patternIndex);
|
|
3996
|
+
return indexForByteOffset(this.source, byteOffset);
|
|
4025
3997
|
}
|
|
4026
|
-
/** Get the
|
|
3998
|
+
/** Get the index where the given pattern ends in the query's source. */
|
|
4027
3999
|
endIndexForPattern(patternIndex) {
|
|
4028
4000
|
if (patternIndex >= this.predicates.length) {
|
|
4029
4001
|
throw new Error(
|
|
4030
4002
|
`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`
|
|
4031
4003
|
);
|
|
4032
4004
|
}
|
|
4033
|
-
|
|
4005
|
+
const byteOffset = C._ts_query_end_byte_for_pattern(this[0], patternIndex);
|
|
4006
|
+
return indexForByteOffset(this.source, byteOffset);
|
|
4034
4007
|
}
|
|
4035
4008
|
/** Get the number of patterns in the query. */
|
|
4036
4009
|
patternCount() {
|
|
@@ -4049,13 +4022,14 @@ var Query = class {
|
|
|
4049
4022
|
return C._ts_query_is_pattern_non_local(this[0], patternIndex) === 1;
|
|
4050
4023
|
}
|
|
4051
4024
|
/**
|
|
4052
|
-
* Check if
|
|
4025
|
+
* Check if the step at the given index in the query's source is 'definite'.
|
|
4053
4026
|
*
|
|
4054
4027
|
* A query step is 'definite' if its parent pattern will be guaranteed to
|
|
4055
4028
|
* match successfully once it reaches the step.
|
|
4056
4029
|
*/
|
|
4057
|
-
isPatternGuaranteedAtStep(
|
|
4058
|
-
|
|
4030
|
+
isPatternGuaranteedAtStep(index) {
|
|
4031
|
+
const byteOffset = C.lengthBytesUTF8(this.source.slice(0, index));
|
|
4032
|
+
return C._ts_query_is_pattern_guaranteed_at_step(this[0], byteOffset) === 1;
|
|
4059
4033
|
}
|
|
4060
4034
|
};
|
|
4061
4035
|
function prepareQuery(query, options) {
|