@kerebron/tree-sitter 0.5.5 → 0.6.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 +1 -2
- package/esm/{deno-tree-sitter/main/extended → extended}/base_node.d.ts +9 -12
- package/esm/extended/base_node.d.ts.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/base_node.js +14 -14
- package/esm/extended/base_node.js.map +1 -0
- package/esm/extended/node_extended.d.ts +243 -0
- package/esm/extended/node_extended.d.ts.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/node_extended.js +196 -186
- package/esm/extended/node_extended.js.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/parser.d.ts +19 -17
- package/esm/extended/parser.d.ts.map +1 -0
- package/esm/extended/parser.js +61 -0
- package/esm/extended/parser.js.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/soft_node.d.ts +4 -3
- package/esm/extended/soft_node.d.ts.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/soft_node.js +1 -1
- package/esm/extended/soft_node.js.map +1 -0
- package/esm/extended/soft_text_node.d.ts +9 -0
- package/esm/extended/soft_text_node.d.ts.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/soft_text_node.js +2 -2
- package/esm/extended/soft_text_node.js.map +1 -0
- package/esm/extended/whitespace_node.d.ts +9 -0
- package/esm/extended/whitespace_node.d.ts.map +1 -0
- package/esm/{deno-tree-sitter/main/extended → extended}/whitespace_node.js +2 -2
- package/esm/extended/whitespace_node.js.map +1 -0
- package/esm/extras/misc.d.ts +2 -0
- package/esm/extras/misc.d.ts.map +1 -0
- package/esm/{deno-tree-sitter/main/extras → extras}/misc.js +2 -2
- package/esm/extras/misc.js.map +1 -0
- package/esm/mod.d.ts +1 -6
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -7
- package/esm/mod.js.map +1 -1
- package/package.json +4 -1
- package/src/extended/base_node.ts +175 -0
- package/src/extended/node_extended.ts +651 -0
- package/src/extended/parser.ts +96 -0
- package/src/extended/soft_node.ts +32 -0
- package/src/extended/soft_text_node.ts +11 -0
- package/src/extended/whitespace_node.ts +11 -0
- package/src/extras/misc.ts +15 -0
- package/src/mod.ts +1 -8
- package/esm/deno-tree-sitter/main/extended/base_node.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extended/base_node.js.map +0 -1
- package/esm/deno-tree-sitter/main/extended/node_extended.d.ts +0 -237
- package/esm/deno-tree-sitter/main/extended/node_extended.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extended/node_extended.js.map +0 -1
- package/esm/deno-tree-sitter/main/extended/parser.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extended/parser.js +0 -87
- package/esm/deno-tree-sitter/main/extended/parser.js.map +0 -1
- package/esm/deno-tree-sitter/main/extended/soft_node.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extended/soft_node.js.map +0 -1
- package/esm/deno-tree-sitter/main/extended/soft_text_node.d.ts +0 -10
- package/esm/deno-tree-sitter/main/extended/soft_text_node.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extended/soft_text_node.js.map +0 -1
- package/esm/deno-tree-sitter/main/extended/whitespace_node.d.ts +0 -10
- package/esm/deno-tree-sitter/main/extended/whitespace_node.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extended/whitespace_node.js.map +0 -1
- package/esm/deno-tree-sitter/main/extras/misc.d.ts +0 -2
- package/esm/deno-tree-sitter/main/extras/misc.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/extras/misc.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/bindings.d.ts +0 -14
- package/esm/deno-tree-sitter/main/tree_sitter/bindings.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/bindings.js +0 -22
- package/esm/deno-tree-sitter/main/tree_sitter/bindings.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/constants.d.ts +0 -60
- package/esm/deno-tree-sitter/main/tree_sitter/constants.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/constants.js +0 -67
- package/esm/deno-tree-sitter/main/tree_sitter/constants.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/language.d.ts +0 -137
- package/esm/deno-tree-sitter/main/tree_sitter/language.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/language.js +0 -265
- package/esm/deno-tree-sitter/main/tree_sitter/language.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.d.ts +0 -41
- package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js +0 -66
- package/esm/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/marshal.d.ts +0 -85
- package/esm/deno-tree-sitter/main/tree_sitter/marshal.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/marshal.js +0 -174
- package/esm/deno-tree-sitter/main/tree_sitter/marshal.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/node.d.ts +0 -260
- package/esm/deno-tree-sitter/main/tree_sitter/node.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/node.js +0 -558
- package/esm/deno-tree-sitter/main/tree_sitter/node.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/parser.d.ts +0 -124
- package/esm/deno-tree-sitter/main/tree_sitter/parser.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/parser.js +0 -253
- package/esm/deno-tree-sitter/main/tree_sitter/parser.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/query.d.ts +0 -134
- package/esm/deno-tree-sitter/main/tree_sitter/query.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/query.js +0 -621
- package/esm/deno-tree-sitter/main/tree_sitter/query.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/tree.d.ts +0 -49
- package/esm/deno-tree-sitter/main/tree_sitter/tree.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/tree.js +0 -131
- package/esm/deno-tree-sitter/main/tree_sitter/tree.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.d.ts +0 -165
- package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.js +0 -281
- package/esm/deno-tree-sitter/main/tree_sitter/tree_cursor.js.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter_wasm.d.ts +0 -3
- package/esm/deno-tree-sitter/main/tree_sitter_wasm.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/tree_sitter_wasm.js +0 -0
- package/esm/deno-tree-sitter/main/tree_sitter_wasm.js.map +0 -1
- package/esm/deno-tree-sitter/main/wasm_loader.d.ts +0 -29
- package/esm/deno-tree-sitter/main/wasm_loader.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/wasm_loader.js +0 -1703
- package/esm/deno-tree-sitter/main/wasm_loader.js.map +0 -1
- package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.d.ts +0 -3
- package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.d.ts.map +0 -1
- package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.js +0 -9
- package/esm/deno-tree-sitter/main/wasm_loader_with_defaults.js.map +0 -1
- package/src/deno-tree-sitter/main/extended/base_node.js +0 -174
- package/src/deno-tree-sitter/main/extended/node_extended.js +0 -588
- package/src/deno-tree-sitter/main/extended/parser.js +0 -87
- package/src/deno-tree-sitter/main/extended/soft_node.js +0 -32
- package/src/deno-tree-sitter/main/extended/soft_text_node.js +0 -11
- package/src/deno-tree-sitter/main/extended/whitespace_node.js +0 -11
- package/src/deno-tree-sitter/main/extras/misc.js +0 -12
- package/src/deno-tree-sitter/main/tree_sitter/bindings.js +0 -26
- package/src/deno-tree-sitter/main/tree_sitter/constants.js +0 -79
- package/src/deno-tree-sitter/main/tree_sitter/language.js +0 -289
- package/src/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js +0 -74
- package/src/deno-tree-sitter/main/tree_sitter/marshal.js +0 -186
- package/src/deno-tree-sitter/main/tree_sitter/node.js +0 -616
- package/src/deno-tree-sitter/main/tree_sitter/parser.js +0 -273
- package/src/deno-tree-sitter/main/tree_sitter/query.js +0 -705
- package/src/deno-tree-sitter/main/tree_sitter/tree.js +0 -145
- package/src/deno-tree-sitter/main/tree_sitter/tree_cursor.js +0 -314
- package/src/deno-tree-sitter/main/tree_sitter_wasm.js +0 -0
- package/src/deno-tree-sitter/main/wasm_loader.js +0 -1702
- package/src/deno-tree-sitter/main/wasm_loader_with_defaults.js +0 -9
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { C, assertInternal } from "./constants.js";
|
|
2
|
-
import { Language } from "./language.js";
|
|
3
|
-
export class LookaheadIterator {
|
|
4
|
-
/** @internal */
|
|
5
|
-
[0] = 0; // Internal handle for Wasm
|
|
6
|
-
/** @internal */
|
|
7
|
-
language;
|
|
8
|
-
/** @internal */
|
|
9
|
-
constructor(internal, address, language) {
|
|
10
|
-
assertInternal(internal);
|
|
11
|
-
this[0] = address;
|
|
12
|
-
this.language = language;
|
|
13
|
-
}
|
|
14
|
-
/** Get the current symbol of the lookahead iterator. */
|
|
15
|
-
get currentTypeId() {
|
|
16
|
-
return C._ts_lookahead_iterator_current_symbol(this[0]);
|
|
17
|
-
}
|
|
18
|
-
/** Get the current symbol name of the lookahead iterator. */
|
|
19
|
-
get currentType() {
|
|
20
|
-
return this.language.types[this.currentTypeId] || "ERROR";
|
|
21
|
-
}
|
|
22
|
-
/** Delete the lookahead iterator, freeing its resources. */
|
|
23
|
-
delete() {
|
|
24
|
-
C._ts_lookahead_iterator_delete(this[0]);
|
|
25
|
-
this[0] = 0;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Reset the lookahead iterator.
|
|
29
|
-
*
|
|
30
|
-
* This returns `true` if the language was set successfully and `false`
|
|
31
|
-
* otherwise.
|
|
32
|
-
*/
|
|
33
|
-
reset(language, stateId) {
|
|
34
|
-
if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
|
|
35
|
-
this.language = language;
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Reset the lookahead iterator to another state.
|
|
42
|
-
*
|
|
43
|
-
* This returns `true` if the iterator was reset to the given state and
|
|
44
|
-
* `false` otherwise.
|
|
45
|
-
*/
|
|
46
|
-
resetState(stateId) {
|
|
47
|
-
return Boolean(C._ts_lookahead_iterator_reset_state(this[0], stateId));
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Returns an iterator that iterates over the symbols of the lookahead iterator.
|
|
51
|
-
*
|
|
52
|
-
* The iterator will yield the current symbol name as a string for each step
|
|
53
|
-
* until there are no more symbols to iterate over.
|
|
54
|
-
*/
|
|
55
|
-
[Symbol.iterator]() {
|
|
56
|
-
return {
|
|
57
|
-
next: () => {
|
|
58
|
-
if (C._ts_lookahead_iterator_next(this[0])) {
|
|
59
|
-
return { done: false, value: this.currentType };
|
|
60
|
-
}
|
|
61
|
-
return { done: true, value: "" };
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=lookahead_iterator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lookahead_iterator.js","sourceRoot":"","sources":["../../../../src/deno-tree-sitter/main/tree_sitter/lookahead_iterator.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,OAAO,iBAAiB;IAC1B,gBAAgB;IAChB,CAA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IAAI,CAAC,CAAC,2BAA2B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAA;gBACnD,CAAC;gBACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;YACpC,CAAC;SACJ,CAAA;IACL,CAAC;CACJ"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @internal
|
|
3
|
-
*
|
|
4
|
-
* Unmarshals a {@link QueryMatch} to the transfer buffer.
|
|
5
|
-
*/
|
|
6
|
-
export function unmarshalCaptures(query: any, tree: any, address: any, patternIndex: any, result: any): any;
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*
|
|
10
|
-
* Marshals a {@link Node} to the transfer buffer.
|
|
11
|
-
*/
|
|
12
|
-
export function marshalNode(node: any, index?: number): void;
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*
|
|
16
|
-
* Unmarshals a {@link Node} from the transfer buffer.
|
|
17
|
-
*/
|
|
18
|
-
export function unmarshalNode(tree: any, address?: any): any;
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*
|
|
22
|
-
* Marshals a {@link TreeCursor} to the transfer buffer.
|
|
23
|
-
*/
|
|
24
|
-
export function marshalTreeCursor(cursor: any, address?: any): void;
|
|
25
|
-
/**
|
|
26
|
-
* @internal
|
|
27
|
-
*
|
|
28
|
-
* Unmarshals a {@link TreeCursor} from the transfer buffer.
|
|
29
|
-
*/
|
|
30
|
-
export function unmarshalTreeCursor(cursor: any): void;
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
*
|
|
34
|
-
* Marshals a {@link Point} to the transfer buffer.
|
|
35
|
-
*/
|
|
36
|
-
export function marshalPoint(address: any, point: any): void;
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
*
|
|
40
|
-
* Unmarshals a {@link Point} from the transfer buffer.
|
|
41
|
-
*/
|
|
42
|
-
export function unmarshalPoint(address: any): {
|
|
43
|
-
row: number;
|
|
44
|
-
column: number;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @internal
|
|
48
|
-
*
|
|
49
|
-
* Marshals a {@link Range} to the transfer buffer.
|
|
50
|
-
*/
|
|
51
|
-
export function marshalRange(address: any, range: any): void;
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
*
|
|
55
|
-
* Unmarshals a {@link Range} from the transfer buffer.
|
|
56
|
-
*/
|
|
57
|
-
export function unmarshalRange(address: any): {
|
|
58
|
-
startPosition: {
|
|
59
|
-
row: number;
|
|
60
|
-
column: number;
|
|
61
|
-
};
|
|
62
|
-
endPosition: {
|
|
63
|
-
row: number;
|
|
64
|
-
column: number;
|
|
65
|
-
};
|
|
66
|
-
startIndex: number;
|
|
67
|
-
endIndex: number;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* @internal
|
|
71
|
-
*
|
|
72
|
-
* Marshals an {@link Edit} to the transfer buffer.
|
|
73
|
-
*/
|
|
74
|
-
export function marshalEdit(edit: any, address?: any): void;
|
|
75
|
-
/**
|
|
76
|
-
* @internal
|
|
77
|
-
*
|
|
78
|
-
* Unmarshals a {@link LanguageMetadata} from the transfer buffer.
|
|
79
|
-
*/
|
|
80
|
-
export function unmarshalLanguageMetadata(address: any): {
|
|
81
|
-
major_version: any;
|
|
82
|
-
minor_version: any;
|
|
83
|
-
field_count: any;
|
|
84
|
-
};
|
|
85
|
-
//# sourceMappingURL=marshal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marshal.d.ts","sourceRoot":"","sources":["../../../../src/deno-tree-sitter/main/tree_sitter/marshal.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH,4GASC;AAED;;;;GAIG;AACH,6DAWC;AAED;;;;GAIG;AACH,6DAsBC;AAED;;;;GAIG;AACH,oEAKC;AAED;;;;GAIG;AACH,uDAKC;AAED;;;;GAIG;AACH,6DAGC;AAED;;;;GAIG;AACH;;;EAMC;AAED;;;;GAIG;AACH,6DASC;AAED;;;;GAIG;AACH;;;;;;;;;;;EAUC;AAED;;;;GAIG;AACH,4DAaC;AAED;;;;GAIG;AACH;;;;EAQC"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { INTERNAL, SIZE_OF_INT, SIZE_OF_NODE, SIZE_OF_POINT, C } from "./constants.js";
|
|
2
|
-
import { Node } from "./node.js";
|
|
3
|
-
import { Tree } from "./tree.js";
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
-
import { Query } from "./query.js";
|
|
6
|
-
import { TreeCursor } from "./tree_cursor.js";
|
|
7
|
-
import { TRANSFER_BUFFER } from "./parser.js";
|
|
8
|
-
import { LanguageMetadata } from "./language.js";
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*
|
|
12
|
-
* Unmarshals a {@link QueryMatch} to the transfer buffer.
|
|
13
|
-
*/
|
|
14
|
-
export function unmarshalCaptures(query, tree, address, patternIndex, result) {
|
|
15
|
-
for (let i = 0, n = result.length; i < n; i++) {
|
|
16
|
-
const captureIndex = C.getValue(address, "i32");
|
|
17
|
-
address += SIZE_OF_INT;
|
|
18
|
-
const node = unmarshalNode(tree, address);
|
|
19
|
-
address += SIZE_OF_NODE;
|
|
20
|
-
result[i] = { patternIndex, name: query.captureNames[captureIndex], node };
|
|
21
|
-
}
|
|
22
|
-
return address;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @internal
|
|
26
|
-
*
|
|
27
|
-
* Marshals a {@link Node} to the transfer buffer.
|
|
28
|
-
*/
|
|
29
|
-
export function marshalNode(node, index = 0) {
|
|
30
|
-
let address = TRANSFER_BUFFER + index * SIZE_OF_NODE;
|
|
31
|
-
C.setValue(address, node.id, "i32");
|
|
32
|
-
address += SIZE_OF_INT;
|
|
33
|
-
C.setValue(address, node.startIndex, "i32");
|
|
34
|
-
address += SIZE_OF_INT;
|
|
35
|
-
C.setValue(address, node.startPosition.row, "i32");
|
|
36
|
-
address += SIZE_OF_INT;
|
|
37
|
-
C.setValue(address, node.startPosition.column, "i32");
|
|
38
|
-
address += SIZE_OF_INT;
|
|
39
|
-
C.setValue(address, node[0], "i32");
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @internal
|
|
43
|
-
*
|
|
44
|
-
* Unmarshals a {@link Node} from the transfer buffer.
|
|
45
|
-
*/
|
|
46
|
-
export function unmarshalNode(tree, address = TRANSFER_BUFFER) {
|
|
47
|
-
const id = C.getValue(address, "i32");
|
|
48
|
-
address += SIZE_OF_INT;
|
|
49
|
-
if (id === 0)
|
|
50
|
-
return null;
|
|
51
|
-
const index = C.getValue(address, "i32");
|
|
52
|
-
address += SIZE_OF_INT;
|
|
53
|
-
const row = C.getValue(address, "i32");
|
|
54
|
-
address += SIZE_OF_INT;
|
|
55
|
-
const column = C.getValue(address, "i32");
|
|
56
|
-
address += SIZE_OF_INT;
|
|
57
|
-
const other = C.getValue(address, "i32");
|
|
58
|
-
const result = new Node(INTERNAL, {
|
|
59
|
-
id,
|
|
60
|
-
tree,
|
|
61
|
-
startIndex: index,
|
|
62
|
-
startPosition: { row, column },
|
|
63
|
-
other,
|
|
64
|
-
});
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
*
|
|
70
|
-
* Marshals a {@link TreeCursor} to the transfer buffer.
|
|
71
|
-
*/
|
|
72
|
-
export function marshalTreeCursor(cursor, address = TRANSFER_BUFFER) {
|
|
73
|
-
C.setValue(address + 0 * SIZE_OF_INT, cursor[0], "i32");
|
|
74
|
-
C.setValue(address + 1 * SIZE_OF_INT, cursor[1], "i32");
|
|
75
|
-
C.setValue(address + 2 * SIZE_OF_INT, cursor[2], "i32");
|
|
76
|
-
C.setValue(address + 3 * SIZE_OF_INT, cursor[3], "i32");
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @internal
|
|
80
|
-
*
|
|
81
|
-
* Unmarshals a {@link TreeCursor} from the transfer buffer.
|
|
82
|
-
*/
|
|
83
|
-
export function unmarshalTreeCursor(cursor) {
|
|
84
|
-
cursor[0] = C.getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, "i32");
|
|
85
|
-
cursor[1] = C.getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, "i32");
|
|
86
|
-
cursor[2] = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
|
|
87
|
-
cursor[3] = C.getValue(TRANSFER_BUFFER + 3 * SIZE_OF_INT, "i32");
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @internal
|
|
91
|
-
*
|
|
92
|
-
* Marshals a {@link Point} to the transfer buffer.
|
|
93
|
-
*/
|
|
94
|
-
export function marshalPoint(address, point) {
|
|
95
|
-
C.setValue(address, point.row, "i32");
|
|
96
|
-
C.setValue(address + SIZE_OF_INT, point.column, "i32");
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* @internal
|
|
100
|
-
*
|
|
101
|
-
* Unmarshals a {@link Point} from the transfer buffer.
|
|
102
|
-
*/
|
|
103
|
-
export function unmarshalPoint(address) {
|
|
104
|
-
const result = {
|
|
105
|
-
row: C.getValue(address, "i32") >>> 0,
|
|
106
|
-
column: C.getValue(address + SIZE_OF_INT, "i32") >>> 0,
|
|
107
|
-
};
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @internal
|
|
112
|
-
*
|
|
113
|
-
* Marshals a {@link Range} to the transfer buffer.
|
|
114
|
-
*/
|
|
115
|
-
export function marshalRange(address, range) {
|
|
116
|
-
marshalPoint(address, range.startPosition);
|
|
117
|
-
address += SIZE_OF_POINT;
|
|
118
|
-
marshalPoint(address, range.endPosition);
|
|
119
|
-
address += SIZE_OF_POINT;
|
|
120
|
-
C.setValue(address, range.startIndex, "i32");
|
|
121
|
-
address += SIZE_OF_INT;
|
|
122
|
-
C.setValue(address, range.endIndex, "i32");
|
|
123
|
-
address += SIZE_OF_INT;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* @internal
|
|
127
|
-
*
|
|
128
|
-
* Unmarshals a {@link Range} from the transfer buffer.
|
|
129
|
-
*/
|
|
130
|
-
export function unmarshalRange(address) {
|
|
131
|
-
const result = {};
|
|
132
|
-
result.startPosition = unmarshalPoint(address);
|
|
133
|
-
address += SIZE_OF_POINT;
|
|
134
|
-
result.endPosition = unmarshalPoint(address);
|
|
135
|
-
address += SIZE_OF_POINT;
|
|
136
|
-
result.startIndex = C.getValue(address, "i32") >>> 0;
|
|
137
|
-
address += SIZE_OF_INT;
|
|
138
|
-
result.endIndex = C.getValue(address, "i32") >>> 0;
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* @internal
|
|
143
|
-
*
|
|
144
|
-
* Marshals an {@link Edit} to the transfer buffer.
|
|
145
|
-
*/
|
|
146
|
-
export function marshalEdit(edit, address = TRANSFER_BUFFER) {
|
|
147
|
-
marshalPoint(address, edit.startPosition);
|
|
148
|
-
address += SIZE_OF_POINT;
|
|
149
|
-
marshalPoint(address, edit.oldEndPosition);
|
|
150
|
-
address += SIZE_OF_POINT;
|
|
151
|
-
marshalPoint(address, edit.newEndPosition);
|
|
152
|
-
address += SIZE_OF_POINT;
|
|
153
|
-
C.setValue(address, edit.startIndex, "i32");
|
|
154
|
-
address += SIZE_OF_INT;
|
|
155
|
-
C.setValue(address, edit.oldEndIndex, "i32");
|
|
156
|
-
address += SIZE_OF_INT;
|
|
157
|
-
C.setValue(address, edit.newEndIndex, "i32");
|
|
158
|
-
address += SIZE_OF_INT;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
*
|
|
163
|
-
* Unmarshals a {@link LanguageMetadata} from the transfer buffer.
|
|
164
|
-
*/
|
|
165
|
-
export function unmarshalLanguageMetadata(address) {
|
|
166
|
-
const result = {};
|
|
167
|
-
result.major_version = C.getValue(address, "i32");
|
|
168
|
-
address += SIZE_OF_INT;
|
|
169
|
-
result.minor_version = C.getValue(address, "i32");
|
|
170
|
-
address += SIZE_OF_INT;
|
|
171
|
-
result.field_count = C.getValue(address, "i32");
|
|
172
|
-
return result;
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=marshal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marshal.js","sourceRoot":"","sources":["../../../../src/deno-tree-sitter/main/tree_sitter/marshal.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,EAAE,MAAM,gBAAgB,CAAA;AACtF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,6DAA6D;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM;IACxE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,YAAY,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAC/C,OAAO,IAAI,WAAW,CAAA;QACtB,MAAM,IAAI,GAAG,aAA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,WAAW,CAAA;IACtB,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAC5C,OAAO,IAAI,WAAW,CAAA;IACtB,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAC5C,OAAO,IAAI,WAAW,CAAA;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAO;IAC7C,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACjD,OAAO,IAAI,WAAW,CAAA;IACtB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACjD,OAAO,IAAI,WAAW,CAAA;IACtB,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC/C,OAAO,MAAM,CAAA;AACjB,CAAC"}
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
/** A single node within a syntax {@link Tree}. */
|
|
2
|
-
export class Node {
|
|
3
|
-
/** @internal */
|
|
4
|
-
constructor(internal: any, { id, tree, startIndex, startPosition, other }: {
|
|
5
|
-
id: any;
|
|
6
|
-
tree: any;
|
|
7
|
-
startIndex: any;
|
|
8
|
-
startPosition: any;
|
|
9
|
-
other: any;
|
|
10
|
-
});
|
|
11
|
-
/** @internal */
|
|
12
|
-
0: number;
|
|
13
|
-
/** @internal */
|
|
14
|
-
_children: any;
|
|
15
|
-
/** @internal */
|
|
16
|
-
_namedChildren: any;
|
|
17
|
-
/**
|
|
18
|
-
* The numeric id for this node that is unique.
|
|
19
|
-
*
|
|
20
|
-
* Within a given syntax tree, no two nodes have the same id. However:
|
|
21
|
-
*
|
|
22
|
-
* * If a new tree is created based on an older tree, and a node from the old tree is reused in
|
|
23
|
-
* the process, then that node will have the same id in both trees.
|
|
24
|
-
*
|
|
25
|
-
* * A node not marked as having changes does not guarantee it was reused.
|
|
26
|
-
*
|
|
27
|
-
* * If a node is marked as having changed in the old tree, it will not be reused.
|
|
28
|
-
*/
|
|
29
|
-
id: any;
|
|
30
|
-
/** The tree that this node belongs to. */
|
|
31
|
-
tree: any;
|
|
32
|
-
/** The byte index where this node starts. */
|
|
33
|
-
startIndex: any;
|
|
34
|
-
/** The position where this node starts. */
|
|
35
|
-
startPosition: any;
|
|
36
|
-
/** Get this node's type as a numerical id. */
|
|
37
|
-
get typeId(): any;
|
|
38
|
-
/**
|
|
39
|
-
* Get the node's type as a numerical id as it appears in the grammar,
|
|
40
|
-
* ignoring aliases.
|
|
41
|
-
*/
|
|
42
|
-
get grammarId(): any;
|
|
43
|
-
/** Get this node's type as a string. */
|
|
44
|
-
get type(): any;
|
|
45
|
-
/**
|
|
46
|
-
* Get this node's symbol name as it appears in the grammar, ignoring
|
|
47
|
-
* aliases as a string.
|
|
48
|
-
*/
|
|
49
|
-
get grammarType(): any;
|
|
50
|
-
/**
|
|
51
|
-
* Check if this node is *named*.
|
|
52
|
-
*
|
|
53
|
-
* Named nodes correspond to named rules in the grammar, whereas
|
|
54
|
-
* *anonymous* nodes correspond to string literals in the grammar.
|
|
55
|
-
*/
|
|
56
|
-
get isNamed(): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Check if this node is *extra*.
|
|
59
|
-
*
|
|
60
|
-
* Extra nodes represent things like comments, which are not required
|
|
61
|
-
* by the grammar, but can appear anywhere.
|
|
62
|
-
*/
|
|
63
|
-
get isExtra(): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Check if this node represents a syntax error.
|
|
66
|
-
*
|
|
67
|
-
* Syntax errors represent parts of the code that could not be incorporated
|
|
68
|
-
* into a valid syntax tree.
|
|
69
|
-
*/
|
|
70
|
-
get isError(): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Check if this node is *missing*.
|
|
73
|
-
*
|
|
74
|
-
* Missing nodes are inserted by the parser in order to recover from
|
|
75
|
-
* certain kinds of syntax errors.
|
|
76
|
-
*/
|
|
77
|
-
get isMissing(): boolean;
|
|
78
|
-
/** Check if this node has been edited. */
|
|
79
|
-
get hasChanges(): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Check if this node represents a syntax error or contains any syntax
|
|
82
|
-
* errors anywhere within it.
|
|
83
|
-
*/
|
|
84
|
-
get hasError(): boolean;
|
|
85
|
-
/** Get the byte index where this node ends. */
|
|
86
|
-
get endIndex(): any;
|
|
87
|
-
/** Get the position where this node ends. */
|
|
88
|
-
get endPosition(): {
|
|
89
|
-
row: number;
|
|
90
|
-
column: number;
|
|
91
|
-
};
|
|
92
|
-
/** Get the string content of this node. */
|
|
93
|
-
get text(): any;
|
|
94
|
-
/** Get this node's parse state. */
|
|
95
|
-
get parseState(): any;
|
|
96
|
-
/** Get the parse state after this node. */
|
|
97
|
-
get nextParseState(): any;
|
|
98
|
-
/** Check if this node is equal to another node. */
|
|
99
|
-
equals(other: any): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Get the node's child at the given index, where zero represents the first child.
|
|
102
|
-
*
|
|
103
|
-
* This method is fairly fast, but its cost is technically log(n), so if
|
|
104
|
-
* you might be iterating over a long list of children, you should use
|
|
105
|
-
* {@link Node#children} instead.
|
|
106
|
-
*/
|
|
107
|
-
child(index: any): any;
|
|
108
|
-
/**
|
|
109
|
-
* Get this node's *named* child at the given index.
|
|
110
|
-
*
|
|
111
|
-
* See also {@link Node#isNamed}.
|
|
112
|
-
* This method is fairly fast, but its cost is technically log(n), so if
|
|
113
|
-
* you might be iterating over a long list of children, you should use
|
|
114
|
-
* {@link Node#namedChildren} instead.
|
|
115
|
-
*/
|
|
116
|
-
namedChild(index: any): any;
|
|
117
|
-
/**
|
|
118
|
-
* Get this node's child with the given numerical field id.
|
|
119
|
-
*
|
|
120
|
-
* See also {@link Node#childForFieldName}. You can
|
|
121
|
-
* convert a field name to an id using {@link Language#fieldIdForName}.
|
|
122
|
-
*/
|
|
123
|
-
childForFieldId(fieldId: any): any;
|
|
124
|
-
/**
|
|
125
|
-
* Get the first child with the given field name.
|
|
126
|
-
*
|
|
127
|
-
* If multiple children may have the same field name, access them using
|
|
128
|
-
* {@link Node#childrenForFieldName}.
|
|
129
|
-
*/
|
|
130
|
-
childForFieldName(fieldName: any): any;
|
|
131
|
-
/** Get the field name of this node's child at the given index. */
|
|
132
|
-
fieldNameForChild(index: any): any;
|
|
133
|
-
/** Get the field name of this node's named child at the given index. */
|
|
134
|
-
fieldNameForNamedChild(index: any): any;
|
|
135
|
-
/**
|
|
136
|
-
* Get an array of this node's children with a given field name.
|
|
137
|
-
*
|
|
138
|
-
* See also {@link Node#children}.
|
|
139
|
-
*/
|
|
140
|
-
childrenForFieldName(fieldName: any): any[];
|
|
141
|
-
/**
|
|
142
|
-
* Get an array of this node's children with a given field id.
|
|
143
|
-
*
|
|
144
|
-
* See also {@link Node#childrenForFieldName}.
|
|
145
|
-
*/
|
|
146
|
-
childrenForFieldId(fieldId: any): any[];
|
|
147
|
-
/** Get the node's first child that contains or starts after the given byte offset. */
|
|
148
|
-
firstChildForIndex(index: any): any;
|
|
149
|
-
/** Get the node's first named child that contains or starts after the given byte offset. */
|
|
150
|
-
firstNamedChildForIndex(index: any): any;
|
|
151
|
-
/** Get this node's number of children. */
|
|
152
|
-
get childCount(): any;
|
|
153
|
-
/**
|
|
154
|
-
* Get this node's number of *named* children.
|
|
155
|
-
*
|
|
156
|
-
* See also {@link Node#isNamed}.
|
|
157
|
-
*/
|
|
158
|
-
get namedChildCount(): any;
|
|
159
|
-
/** Get this node's first child. */
|
|
160
|
-
get firstChild(): any;
|
|
161
|
-
/**
|
|
162
|
-
* Get this node's first named child.
|
|
163
|
-
*
|
|
164
|
-
* See also {@link Node#isNamed}.
|
|
165
|
-
*/
|
|
166
|
-
get firstNamedChild(): any;
|
|
167
|
-
/** Get this node's last child. */
|
|
168
|
-
get lastChild(): any;
|
|
169
|
-
/**
|
|
170
|
-
* Get this node's last named child.
|
|
171
|
-
*
|
|
172
|
-
* See also {@link Node#isNamed}.
|
|
173
|
-
*/
|
|
174
|
-
get lastNamedChild(): any;
|
|
175
|
-
/**
|
|
176
|
-
* Iterate over this node's children.
|
|
177
|
-
*
|
|
178
|
-
* If you're walking the tree recursively, you may want to use the
|
|
179
|
-
* {@link TreeCursor} APIs directly instead.
|
|
180
|
-
*/
|
|
181
|
-
get children(): any;
|
|
182
|
-
/**
|
|
183
|
-
* Iterate over this node's named children.
|
|
184
|
-
*
|
|
185
|
-
* See also {@link Node#children}.
|
|
186
|
-
*/
|
|
187
|
-
get namedChildren(): any;
|
|
188
|
-
/**
|
|
189
|
-
* Get the descendants of this node that are the given type, or in the given types array.
|
|
190
|
-
*
|
|
191
|
-
* The types array should contain node type strings, which can be retrieved from {@link Language#types}.
|
|
192
|
-
*
|
|
193
|
-
* Additionally, a `startPosition` and `endPosition` can be passed in to restrict the search to a byte range.
|
|
194
|
-
*/
|
|
195
|
-
descendantsOfType(types: any, startPosition?: {
|
|
196
|
-
row: number;
|
|
197
|
-
column: number;
|
|
198
|
-
}, endPosition?: {
|
|
199
|
-
row: number;
|
|
200
|
-
column: number;
|
|
201
|
-
}): any[];
|
|
202
|
-
/** Get this node's next sibling. */
|
|
203
|
-
get nextSibling(): any;
|
|
204
|
-
/** Get this node's previous sibling. */
|
|
205
|
-
get previousSibling(): any;
|
|
206
|
-
/**
|
|
207
|
-
* Get this node's next *named* sibling.
|
|
208
|
-
*
|
|
209
|
-
* See also {@link Node#isNamed}.
|
|
210
|
-
*/
|
|
211
|
-
get nextNamedSibling(): any;
|
|
212
|
-
/**
|
|
213
|
-
* Get this node's previous *named* sibling.
|
|
214
|
-
*
|
|
215
|
-
* See also {@link Node#isNamed}.
|
|
216
|
-
*/
|
|
217
|
-
get previousNamedSibling(): any;
|
|
218
|
-
/** Get the node's number of descendants, including one for the node itself. */
|
|
219
|
-
get descendantCount(): any;
|
|
220
|
-
/**
|
|
221
|
-
* Get this node's immediate parent.
|
|
222
|
-
* Prefer {@link Node#childWithDescendant} for iterating over this node's ancestors.
|
|
223
|
-
*/
|
|
224
|
-
get parent(): any;
|
|
225
|
-
/**
|
|
226
|
-
* Get the node that contains `descendant`.
|
|
227
|
-
*
|
|
228
|
-
* Note that this can return `descendant` itself.
|
|
229
|
-
*/
|
|
230
|
-
childWithDescendant(descendant: any): any;
|
|
231
|
-
/** Get the smallest node within this node that spans the given byte range. */
|
|
232
|
-
descendantForIndex(start: any, end?: any): any;
|
|
233
|
-
/** Get the smallest named node within this node that spans the given byte range. */
|
|
234
|
-
namedDescendantForIndex(start: any, end?: any): any;
|
|
235
|
-
/** Get the smallest node within this node that spans the given point range. */
|
|
236
|
-
descendantForPosition(start: any, end?: any): any;
|
|
237
|
-
/** Get the smallest named node within this node that spans the given point range. */
|
|
238
|
-
namedDescendantForPosition(start: any, end?: any): any;
|
|
239
|
-
/**
|
|
240
|
-
* Create a new {@link TreeCursor} starting from this node.
|
|
241
|
-
*
|
|
242
|
-
* Note that the given node is considered the root of the cursor,
|
|
243
|
-
* and the cursor cannot walk outside this node.
|
|
244
|
-
*/
|
|
245
|
-
walk(): TreeCursor;
|
|
246
|
-
/**
|
|
247
|
-
* Edit this node to keep it in-sync with source code that has been edited.
|
|
248
|
-
*
|
|
249
|
-
* This function is only rarely needed. When you edit a syntax tree with
|
|
250
|
-
* the {@link Tree#edit} method, all of the nodes that you retrieve from
|
|
251
|
-
* the tree afterward will already reflect the edit. You only need to
|
|
252
|
-
* use {@link Node#edit} when you have a specific {@link Node} instance that
|
|
253
|
-
* you want to keep and continue to use after an edit.
|
|
254
|
-
*/
|
|
255
|
-
edit(edit: any): void;
|
|
256
|
-
/** Get the S-expression representation of this node. */
|
|
257
|
-
toString(): any;
|
|
258
|
-
}
|
|
259
|
-
import { TreeCursor } from "./tree_cursor.js";
|
|
260
|
-
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../src/deno-tree-sitter/main/tree_sitter/node.js"],"names":[],"mappings":"AAQA,kDAAkD;AAClD;IAUI,gBAAgB;IAChB;;;;;;OAOC;IAjBD,gBAAgB;IAChB,UAAO;IAEP,gBAAgB;IAChB,eAAS;IAET,gBAAgB;IAChB,oBAAc;IAYd;;;;;;;;;;;OAWG;IACH,QAAE;IAQF,0CAA0C;IAC1C,UAAI;IAPJ,6CAA6C;IAC7C,gBAAU;IAEV,2CAA2C;IAC3C,mBAAa;IAKb,8CAA8C;IAC9C,kBAGC;IAED;;;OAGG;IACH,qBAGC;IAED,wCAAwC;IACxC,gBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;;OAKG;IACH,uBAGC;IAED;;;;;OAKG;IACH,uBAGC;IAED;;;;;OAKG;IACH,uBAGC;IAED;;;;;OAKG;IACH,yBAGC;IAED,0CAA0C;IAC1C,0BAGC;IAED;;;OAGG;IACH,wBAGC;IAED,+CAA+C;IAC/C,oBAGC;IAED,6CAA6C;IAC7C;;;MAIC;IAED,2CAA2C;IAC3C,gBAEC;IAED,mCAAmC;IACnC,sBAGC;IAED,2CAA2C;IAC3C,0BAGC;IAED,mDAAmD;IACnD,4BAEC;IAED;;;;;;OAMG;IACH,uBAIC;IAED;;;;;;;OAOG;IACH,4BAIC;IAED;;;;;OAKG;IACH,mCAIC;IAED;;;;;OAKG;IACH,uCAIC;IAED,kEAAkE;IAClE,mCAKC;IAED,wEAAwE;IACxE,wCAKC;IACD;;;;OAIG;IACH,4CAIC;IAED;;;;OAIG;IACH,wCAgBC;IAED,sFAAsF;IACtF,oCAMC;IAED,4FAA4F;IAC5F,yCAMC;IAED,0CAA0C;IAC1C,sBAGC;IAED;;;;OAIG;IACH,2BAGC;IAED,mCAAmC;IACnC,sBAEC;IAED;;;;OAIG;IACH,2BAEC;IAED,kCAAkC;IAClC,qBAEC;IAED;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