@fro.bot/systematic 3.13.7 → 3.14.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/dist/index.js
CHANGED
|
@@ -3989,9 +3989,89 @@ import { randomBytes as randomBytes3 } from "crypto";
|
|
|
3989
3989
|
import fs7 from "fs";
|
|
3990
3990
|
import { fileURLToPath } from "url";
|
|
3991
3991
|
|
|
3992
|
-
// node_modules/.bun/web-tree-sitter@0.
|
|
3992
|
+
// node_modules/.bun/web-tree-sitter@0.26.12/node_modules/web-tree-sitter/web-tree-sitter.js
|
|
3993
3993
|
var __defProp = Object.defineProperty;
|
|
3994
3994
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3995
|
+
var Edit = class {
|
|
3996
|
+
static {
|
|
3997
|
+
__name(this, "Edit");
|
|
3998
|
+
}
|
|
3999
|
+
startPosition;
|
|
4000
|
+
oldEndPosition;
|
|
4001
|
+
newEndPosition;
|
|
4002
|
+
startIndex;
|
|
4003
|
+
oldEndIndex;
|
|
4004
|
+
newEndIndex;
|
|
4005
|
+
constructor({
|
|
4006
|
+
startIndex,
|
|
4007
|
+
oldEndIndex,
|
|
4008
|
+
newEndIndex,
|
|
4009
|
+
startPosition,
|
|
4010
|
+
oldEndPosition,
|
|
4011
|
+
newEndPosition
|
|
4012
|
+
}) {
|
|
4013
|
+
this.startIndex = startIndex >>> 0;
|
|
4014
|
+
this.oldEndIndex = oldEndIndex >>> 0;
|
|
4015
|
+
this.newEndIndex = newEndIndex >>> 0;
|
|
4016
|
+
this.startPosition = startPosition;
|
|
4017
|
+
this.oldEndPosition = oldEndPosition;
|
|
4018
|
+
this.newEndPosition = newEndPosition;
|
|
4019
|
+
}
|
|
4020
|
+
editPoint(point, index) {
|
|
4021
|
+
let newIndex = index;
|
|
4022
|
+
const newPoint = { ...point };
|
|
4023
|
+
if (index >= this.oldEndIndex) {
|
|
4024
|
+
newIndex = this.newEndIndex + (index - this.oldEndIndex);
|
|
4025
|
+
const originalRow = point.row;
|
|
4026
|
+
newPoint.row = this.newEndPosition.row + (point.row - this.oldEndPosition.row);
|
|
4027
|
+
newPoint.column = originalRow === this.oldEndPosition.row ? this.newEndPosition.column + (point.column - this.oldEndPosition.column) : point.column;
|
|
4028
|
+
} else if (index > this.startIndex) {
|
|
4029
|
+
newIndex = this.newEndIndex;
|
|
4030
|
+
newPoint.row = this.newEndPosition.row;
|
|
4031
|
+
newPoint.column = this.newEndPosition.column;
|
|
4032
|
+
}
|
|
4033
|
+
return { point: newPoint, index: newIndex };
|
|
4034
|
+
}
|
|
4035
|
+
editRange(range) {
|
|
4036
|
+
const newRange = {
|
|
4037
|
+
startIndex: range.startIndex,
|
|
4038
|
+
startPosition: { ...range.startPosition },
|
|
4039
|
+
endIndex: range.endIndex,
|
|
4040
|
+
endPosition: { ...range.endPosition }
|
|
4041
|
+
};
|
|
4042
|
+
if (range.endIndex >= this.oldEndIndex) {
|
|
4043
|
+
if (range.endIndex !== Number.MAX_SAFE_INTEGER) {
|
|
4044
|
+
newRange.endIndex = this.newEndIndex + (range.endIndex - this.oldEndIndex);
|
|
4045
|
+
newRange.endPosition = {
|
|
4046
|
+
row: this.newEndPosition.row + (range.endPosition.row - this.oldEndPosition.row),
|
|
4047
|
+
column: range.endPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.endPosition.column - this.oldEndPosition.column) : range.endPosition.column
|
|
4048
|
+
};
|
|
4049
|
+
if (newRange.endIndex < this.newEndIndex) {
|
|
4050
|
+
newRange.endIndex = Number.MAX_SAFE_INTEGER;
|
|
4051
|
+
newRange.endPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
} else if (range.endIndex > this.startIndex) {
|
|
4055
|
+
newRange.endIndex = this.startIndex;
|
|
4056
|
+
newRange.endPosition = { ...this.startPosition };
|
|
4057
|
+
}
|
|
4058
|
+
if (range.startIndex >= this.oldEndIndex) {
|
|
4059
|
+
newRange.startIndex = this.newEndIndex + (range.startIndex - this.oldEndIndex);
|
|
4060
|
+
newRange.startPosition = {
|
|
4061
|
+
row: this.newEndPosition.row + (range.startPosition.row - this.oldEndPosition.row),
|
|
4062
|
+
column: range.startPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.startPosition.column - this.oldEndPosition.column) : range.startPosition.column
|
|
4063
|
+
};
|
|
4064
|
+
if (newRange.startIndex < this.newEndIndex) {
|
|
4065
|
+
newRange.startIndex = Number.MAX_SAFE_INTEGER;
|
|
4066
|
+
newRange.startPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
|
|
4067
|
+
}
|
|
4068
|
+
} else if (range.startIndex > this.startIndex) {
|
|
4069
|
+
newRange.startIndex = this.startIndex;
|
|
4070
|
+
newRange.startPosition = { ...this.startPosition };
|
|
4071
|
+
}
|
|
4072
|
+
return newRange;
|
|
4073
|
+
}
|
|
4074
|
+
};
|
|
3995
4075
|
var SIZE_OF_SHORT = 2;
|
|
3996
4076
|
var SIZE_OF_INT = 4;
|
|
3997
4077
|
var SIZE_OF_CURSOR = 4 * SIZE_OF_INT;
|
|
@@ -3999,7 +4079,7 @@ var SIZE_OF_NODE = 5 * SIZE_OF_INT;
|
|
|
3999
4079
|
var SIZE_OF_POINT = 2 * SIZE_OF_INT;
|
|
4000
4080
|
var SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT;
|
|
4001
4081
|
var ZERO_POINT = { row: 0, column: 0 };
|
|
4002
|
-
var INTERNAL = Symbol("INTERNAL");
|
|
4082
|
+
var INTERNAL = /* @__PURE__ */ Symbol("INTERNAL");
|
|
4003
4083
|
function assertInternal(x) {
|
|
4004
4084
|
if (x !== INTERNAL)
|
|
4005
4085
|
throw new Error("Illegal constructor");
|
|
@@ -4791,2272 +4871,1721 @@ function unmarshalLanguageMetadata(address) {
|
|
|
4791
4871
|
return { major_version, minor_version, patch_version };
|
|
4792
4872
|
}
|
|
4793
4873
|
__name(unmarshalLanguageMetadata, "unmarshalLanguageMetadata");
|
|
4794
|
-
var
|
|
4795
|
-
var
|
|
4796
|
-
var QUERY_WORD_REGEX = /[\w-]+/g;
|
|
4797
|
-
var CaptureQuantifier = {
|
|
4798
|
-
Zero: 0,
|
|
4799
|
-
ZeroOrOne: 1,
|
|
4800
|
-
ZeroOrMore: 2,
|
|
4801
|
-
One: 3,
|
|
4802
|
-
OneOrMore: 4
|
|
4803
|
-
};
|
|
4804
|
-
var isCaptureStep = /* @__PURE__ */ __name((step) => step.type === "capture", "isCaptureStep");
|
|
4805
|
-
var isStringStep = /* @__PURE__ */ __name((step) => step.type === "string", "isStringStep");
|
|
4806
|
-
var QueryErrorKind = {
|
|
4807
|
-
Syntax: 1,
|
|
4808
|
-
NodeName: 2,
|
|
4809
|
-
FieldName: 3,
|
|
4810
|
-
CaptureName: 4,
|
|
4811
|
-
PatternStructure: 5
|
|
4812
|
-
};
|
|
4813
|
-
var QueryError = class _QueryError extends Error {
|
|
4814
|
-
constructor(kind, info2, index, length) {
|
|
4815
|
-
super(_QueryError.formatMessage(kind, info2));
|
|
4816
|
-
this.kind = kind;
|
|
4817
|
-
this.info = info2;
|
|
4818
|
-
this.index = index;
|
|
4819
|
-
this.length = length;
|
|
4820
|
-
this.name = "QueryError";
|
|
4821
|
-
}
|
|
4874
|
+
var LANGUAGE_FUNCTION_REGEX = /^tree_sitter_\w+$/;
|
|
4875
|
+
var Language = class _Language {
|
|
4822
4876
|
static {
|
|
4823
|
-
__name(this, "
|
|
4877
|
+
__name(this, "Language");
|
|
4824
4878
|
}
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4879
|
+
[0] = 0;
|
|
4880
|
+
types;
|
|
4881
|
+
fields;
|
|
4882
|
+
constructor(internal, address) {
|
|
4883
|
+
assertInternal(internal);
|
|
4884
|
+
this[0] = address;
|
|
4885
|
+
this.types = new Array(C._ts_language_symbol_count(this[0]));
|
|
4886
|
+
for (let i2 = 0, n = this.types.length;i2 < n; i2++) {
|
|
4887
|
+
if (C._ts_language_symbol_type(this[0], i2) < 2) {
|
|
4888
|
+
this.types[i2] = C.UTF8ToString(C._ts_language_symbol_name(this[0], i2));
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
this.fields = new Array(C._ts_language_field_count(this[0]) + 1);
|
|
4892
|
+
for (let i2 = 0, n = this.fields.length;i2 < n; i2++) {
|
|
4893
|
+
const fieldName = C._ts_language_field_name_for_id(this[0], i2);
|
|
4894
|
+
if (fieldName !== 0) {
|
|
4895
|
+
this.fields[i2] = C.UTF8ToString(fieldName);
|
|
4896
|
+
} else {
|
|
4897
|
+
this.fields[i2] = null;
|
|
4898
|
+
}
|
|
4837
4899
|
}
|
|
4838
4900
|
}
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
if (!isCaptureStep(steps[1])) {
|
|
4845
|
-
throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}"`);
|
|
4901
|
+
get name() {
|
|
4902
|
+
const ptr = C._ts_language_name(this[0]);
|
|
4903
|
+
if (ptr === 0)
|
|
4904
|
+
return null;
|
|
4905
|
+
return C.UTF8ToString(ptr);
|
|
4846
4906
|
}
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
if (isCaptureStep(steps[2])) {
|
|
4850
|
-
const captureName1 = steps[1].name;
|
|
4851
|
-
const captureName2 = steps[2].name;
|
|
4852
|
-
textPredicates[index].push((captures) => {
|
|
4853
|
-
const nodes1 = [];
|
|
4854
|
-
const nodes2 = [];
|
|
4855
|
-
for (const c of captures) {
|
|
4856
|
-
if (c.name === captureName1)
|
|
4857
|
-
nodes1.push(c.node);
|
|
4858
|
-
if (c.name === captureName2)
|
|
4859
|
-
nodes2.push(c.node);
|
|
4860
|
-
}
|
|
4861
|
-
const compare = /* @__PURE__ */ __name((n1, n2, positive) => {
|
|
4862
|
-
return positive ? n1.text === n2.text : n1.text !== n2.text;
|
|
4863
|
-
}, "compare");
|
|
4864
|
-
return matchAll ? nodes1.every((n1) => nodes2.some((n2) => compare(n1, n2, isPositive))) : nodes1.some((n1) => nodes2.some((n2) => compare(n1, n2, isPositive)));
|
|
4865
|
-
});
|
|
4866
|
-
} else {
|
|
4867
|
-
const captureName = steps[1].name;
|
|
4868
|
-
const stringValue = steps[2].value;
|
|
4869
|
-
const matches = /* @__PURE__ */ __name((n) => n.text === stringValue, "matches");
|
|
4870
|
-
const doesNotMatch = /* @__PURE__ */ __name((n) => n.text !== stringValue, "doesNotMatch");
|
|
4871
|
-
textPredicates[index].push((captures) => {
|
|
4872
|
-
const nodes = [];
|
|
4873
|
-
for (const c of captures) {
|
|
4874
|
-
if (c.name === captureName)
|
|
4875
|
-
nodes.push(c.node);
|
|
4876
|
-
}
|
|
4877
|
-
const test = isPositive ? matches : doesNotMatch;
|
|
4878
|
-
return matchAll ? nodes.every(test) : nodes.some(test);
|
|
4879
|
-
});
|
|
4907
|
+
get abiVersion() {
|
|
4908
|
+
return C._ts_language_abi_version(this[0]);
|
|
4880
4909
|
}
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4910
|
+
get metadata() {
|
|
4911
|
+
C._ts_language_metadata_wasm(this[0]);
|
|
4912
|
+
const length = C.getValue(TRANSFER_BUFFER, "i32");
|
|
4913
|
+
if (length === 0)
|
|
4914
|
+
return null;
|
|
4915
|
+
return unmarshalLanguageMetadata(TRANSFER_BUFFER + SIZE_OF_INT);
|
|
4886
4916
|
}
|
|
4887
|
-
|
|
4888
|
-
|
|
4917
|
+
get fieldCount() {
|
|
4918
|
+
return this.fields.length - 1;
|
|
4889
4919
|
}
|
|
4890
|
-
|
|
4891
|
-
|
|
4920
|
+
get stateCount() {
|
|
4921
|
+
return C._ts_language_state_count(this[0]);
|
|
4892
4922
|
}
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
const regex = new RegExp(steps[2].value);
|
|
4897
|
-
textPredicates[index].push((captures) => {
|
|
4898
|
-
const nodes = [];
|
|
4899
|
-
for (const c of captures) {
|
|
4900
|
-
if (c.name === captureName)
|
|
4901
|
-
nodes.push(c.node.text);
|
|
4902
|
-
}
|
|
4903
|
-
const test = /* @__PURE__ */ __name((text, positive) => {
|
|
4904
|
-
return positive ? regex.test(text) : !regex.test(text);
|
|
4905
|
-
}, "test");
|
|
4906
|
-
if (nodes.length === 0)
|
|
4907
|
-
return !isPositive;
|
|
4908
|
-
return matchAll ? nodes.every((text) => test(text, isPositive)) : nodes.some((text) => test(text, isPositive));
|
|
4909
|
-
});
|
|
4910
|
-
}
|
|
4911
|
-
__name(parseMatchPredicate, "parseMatchPredicate");
|
|
4912
|
-
function parseAnyOfPredicate(steps, index, operator, textPredicates) {
|
|
4913
|
-
if (steps.length < 2) {
|
|
4914
|
-
throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected at least 1. Got ${steps.length - 1}.`);
|
|
4923
|
+
fieldIdForName(fieldName) {
|
|
4924
|
+
const result = this.fields.indexOf(fieldName);
|
|
4925
|
+
return result !== -1 ? result : null;
|
|
4915
4926
|
}
|
|
4916
|
-
|
|
4917
|
-
|
|
4927
|
+
fieldNameForId(fieldId) {
|
|
4928
|
+
return this.fields[fieldId] ?? null;
|
|
4918
4929
|
}
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4930
|
+
idForNodeType(type, named) {
|
|
4931
|
+
const typeLength = C.lengthBytesUTF8(type);
|
|
4932
|
+
const typeAddress = C._malloc(typeLength + 1);
|
|
4933
|
+
C.stringToUTF8(type, typeAddress, typeLength + 1);
|
|
4934
|
+
const result = C._ts_language_symbol_for_name(this[0], typeAddress, typeLength, named ? 1 : 0);
|
|
4935
|
+
C._free(typeAddress);
|
|
4936
|
+
return result || null;
|
|
4924
4937
|
}
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
const nodes = [];
|
|
4928
|
-
for (const c of captures) {
|
|
4929
|
-
if (c.name === captureName)
|
|
4930
|
-
nodes.push(c.node.text);
|
|
4931
|
-
}
|
|
4932
|
-
if (nodes.length === 0)
|
|
4933
|
-
return !isPositive;
|
|
4934
|
-
return nodes.every((text) => values.includes(text)) === isPositive;
|
|
4935
|
-
});
|
|
4936
|
-
}
|
|
4937
|
-
__name(parseAnyOfPredicate, "parseAnyOfPredicate");
|
|
4938
|
-
function parseIsPredicate(steps, index, operator, assertedProperties, refutedProperties) {
|
|
4939
|
-
if (steps.length < 2 || steps.length > 3) {
|
|
4940
|
-
throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
|
|
4938
|
+
get nodeTypeCount() {
|
|
4939
|
+
return C._ts_language_symbol_count(this[0]);
|
|
4941
4940
|
}
|
|
4942
|
-
|
|
4943
|
-
|
|
4941
|
+
nodeTypeForId(typeId) {
|
|
4942
|
+
const name2 = C._ts_language_symbol_name(this[0], typeId);
|
|
4943
|
+
return name2 ? C.UTF8ToString(name2) : null;
|
|
4944
4944
|
}
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
properties[index] = {};
|
|
4948
|
-
properties[index][steps[1].value] = steps[2]?.value ?? null;
|
|
4949
|
-
}
|
|
4950
|
-
__name(parseIsPredicate, "parseIsPredicate");
|
|
4951
|
-
function parseSetDirective(steps, index, setProperties) {
|
|
4952
|
-
if (steps.length < 2 || steps.length > 3) {
|
|
4953
|
-
throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
|
|
4945
|
+
nodeTypeIsNamed(typeId) {
|
|
4946
|
+
return C._ts_language_type_is_named_wasm(this[0], typeId) ? true : false;
|
|
4954
4947
|
}
|
|
4955
|
-
|
|
4956
|
-
|
|
4948
|
+
nodeTypeIsVisible(typeId) {
|
|
4949
|
+
return C._ts_language_type_is_visible_wasm(this[0], typeId) ? true : false;
|
|
4957
4950
|
}
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
} else if (steps.length > 0) {
|
|
4970
|
-
if (steps[0].type !== "string") {
|
|
4971
|
-
throw new Error("Predicates must begin with a literal value");
|
|
4951
|
+
get supertypes() {
|
|
4952
|
+
C._ts_language_supertypes_wasm(this[0]);
|
|
4953
|
+
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
4954
|
+
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
4955
|
+
const result = new Array(count);
|
|
4956
|
+
if (count > 0) {
|
|
4957
|
+
let address = buffer;
|
|
4958
|
+
for (let i2 = 0;i2 < count; i2++) {
|
|
4959
|
+
result[i2] = C.getValue(address, "i16");
|
|
4960
|
+
address += SIZE_OF_SHORT;
|
|
4961
|
+
}
|
|
4972
4962
|
}
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
break;
|
|
4987
|
-
case "not-any-of?":
|
|
4988
|
-
case "any-of?":
|
|
4989
|
-
parseAnyOfPredicate(steps, index, operator, textPredicates);
|
|
4990
|
-
break;
|
|
4991
|
-
case "is?":
|
|
4992
|
-
case "is-not?":
|
|
4993
|
-
parseIsPredicate(steps, index, operator, assertedProperties, refutedProperties);
|
|
4994
|
-
break;
|
|
4995
|
-
case "set!":
|
|
4996
|
-
parseSetDirective(steps, index, setProperties);
|
|
4997
|
-
break;
|
|
4998
|
-
default:
|
|
4999
|
-
predicates[index].push({ operator, operands: steps.slice(1) });
|
|
4963
|
+
return result;
|
|
4964
|
+
}
|
|
4965
|
+
subtypes(supertype) {
|
|
4966
|
+
C._ts_language_subtypes_wasm(this[0], supertype);
|
|
4967
|
+
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
4968
|
+
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
4969
|
+
const result = new Array(count);
|
|
4970
|
+
if (count > 0) {
|
|
4971
|
+
let address = buffer;
|
|
4972
|
+
for (let i2 = 0;i2 < count; i2++) {
|
|
4973
|
+
result[i2] = C.getValue(address, "i16");
|
|
4974
|
+
address += SIZE_OF_SHORT;
|
|
4975
|
+
}
|
|
5000
4976
|
}
|
|
5001
|
-
|
|
4977
|
+
return result;
|
|
5002
4978
|
}
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
var Query = class {
|
|
5006
|
-
static {
|
|
5007
|
-
__name(this, "Query");
|
|
4979
|
+
nextState(stateId, typeId) {
|
|
4980
|
+
return C._ts_language_next_state(this[0], stateId, typeId);
|
|
5008
4981
|
}
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
`)[0];
|
|
5030
|
-
const word = suffix.match(QUERY_WORD_REGEX)?.[0] ?? "";
|
|
5031
|
-
C._free(sourceAddress);
|
|
5032
|
-
switch (errorId) {
|
|
5033
|
-
case QueryErrorKind.Syntax:
|
|
5034
|
-
throw new QueryError(QueryErrorKind.Syntax, { suffix: `${errorIndex}: '${suffix}'...` }, errorIndex, 0);
|
|
5035
|
-
case QueryErrorKind.NodeName:
|
|
5036
|
-
throw new QueryError(errorId, { word }, errorIndex, word.length);
|
|
5037
|
-
case QueryErrorKind.FieldName:
|
|
5038
|
-
throw new QueryError(errorId, { word }, errorIndex, word.length);
|
|
5039
|
-
case QueryErrorKind.CaptureName:
|
|
5040
|
-
throw new QueryError(errorId, { word }, errorIndex, word.length);
|
|
5041
|
-
case QueryErrorKind.PatternStructure:
|
|
5042
|
-
throw new QueryError(errorId, { suffix: `${errorIndex}: '${suffix}'...` }, errorIndex, 0);
|
|
4982
|
+
lookaheadIterator(stateId) {
|
|
4983
|
+
const address = C._ts_lookahead_iterator_new(this[0], stateId);
|
|
4984
|
+
if (address)
|
|
4985
|
+
return new LookaheadIterator(INTERNAL, address, this);
|
|
4986
|
+
return null;
|
|
4987
|
+
}
|
|
4988
|
+
static async load(input) {
|
|
4989
|
+
let binary2;
|
|
4990
|
+
if (input instanceof Uint8Array) {
|
|
4991
|
+
binary2 = input;
|
|
4992
|
+
} else if (globalThis.process?.versions.node) {
|
|
4993
|
+
const fs22 = await import("fs/promises");
|
|
4994
|
+
binary2 = await fs22.readFile(input);
|
|
4995
|
+
} else {
|
|
4996
|
+
const response = await fetch(input);
|
|
4997
|
+
if (!response.ok) {
|
|
4998
|
+
const body2 = await response.text();
|
|
4999
|
+
throw new Error(`Language.load failed with status ${response.status}.
|
|
5000
|
+
|
|
5001
|
+
${body2}`);
|
|
5043
5002
|
}
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
for (let i2 = 0;i2 < captureCount; i2++) {
|
|
5052
|
-
const nameAddress = C._ts_query_capture_name_for_id(address, i2, TRANSFER_BUFFER);
|
|
5053
|
-
const nameLength = C.getValue(TRANSFER_BUFFER, "i32");
|
|
5054
|
-
captureNames[i2] = C.UTF8ToString(nameAddress, nameLength);
|
|
5055
|
-
}
|
|
5056
|
-
for (let i2 = 0;i2 < patternCount; i2++) {
|
|
5057
|
-
const captureQuantifiersArray = new Array(captureCount);
|
|
5058
|
-
for (let j = 0;j < captureCount; j++) {
|
|
5059
|
-
const quantifier = C._ts_query_capture_quantifier_for_id(address, i2, j);
|
|
5060
|
-
captureQuantifiersArray[j] = quantifier;
|
|
5003
|
+
const retryResp = response.clone();
|
|
5004
|
+
try {
|
|
5005
|
+
binary2 = await WebAssembly.compileStreaming(response);
|
|
5006
|
+
} catch (reason) {
|
|
5007
|
+
console.error("wasm streaming compile failed:", reason);
|
|
5008
|
+
console.error("falling back to ArrayBuffer instantiation");
|
|
5009
|
+
binary2 = new Uint8Array(await retryResp.arrayBuffer());
|
|
5061
5010
|
}
|
|
5062
|
-
captureQuantifiers[i2] = captureQuantifiersArray;
|
|
5063
|
-
}
|
|
5064
|
-
for (let i2 = 0;i2 < stringCount; i2++) {
|
|
5065
|
-
const valueAddress = C._ts_query_string_value_for_id(address, i2, TRANSFER_BUFFER);
|
|
5066
|
-
const nameLength = C.getValue(TRANSFER_BUFFER, "i32");
|
|
5067
|
-
stringValues[i2] = C.UTF8ToString(valueAddress, nameLength);
|
|
5068
5011
|
}
|
|
5069
|
-
const
|
|
5070
|
-
const
|
|
5071
|
-
const
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
const stepCount = C.getValue(TRANSFER_BUFFER, "i32");
|
|
5077
|
-
predicates[i2] = [];
|
|
5078
|
-
textPredicates[i2] = [];
|
|
5079
|
-
const steps = new Array;
|
|
5080
|
-
let stepAddress = predicatesAddress;
|
|
5081
|
-
for (let j = 0;j < stepCount; j++) {
|
|
5082
|
-
const stepType = C.getValue(stepAddress, "i32");
|
|
5083
|
-
stepAddress += SIZE_OF_INT;
|
|
5084
|
-
const stepValueId = C.getValue(stepAddress, "i32");
|
|
5085
|
-
stepAddress += SIZE_OF_INT;
|
|
5086
|
-
parsePattern(i2, stepType, stepValueId, captureNames, stringValues, steps, textPredicates, predicates, setProperties, assertedProperties, refutedProperties);
|
|
5087
|
-
}
|
|
5088
|
-
Object.freeze(textPredicates[i2]);
|
|
5089
|
-
Object.freeze(predicates[i2]);
|
|
5090
|
-
Object.freeze(setProperties[i2]);
|
|
5091
|
-
Object.freeze(assertedProperties[i2]);
|
|
5092
|
-
Object.freeze(refutedProperties[i2]);
|
|
5012
|
+
const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
|
|
5013
|
+
const symbolNames = Object.keys(mod);
|
|
5014
|
+
const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
|
|
5015
|
+
if (!functionName) {
|
|
5016
|
+
console.log(`Couldn't find language function in Wasm file. Symbols:
|
|
5017
|
+
${JSON.stringify(symbolNames, null, 2)}`);
|
|
5018
|
+
throw new Error("Language.load failed: no language function found in Wasm file");
|
|
5093
5019
|
}
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
this.captureNames = captureNames;
|
|
5097
|
-
this.captureQuantifiers = captureQuantifiers;
|
|
5098
|
-
this.textPredicates = textPredicates;
|
|
5099
|
-
this.predicates = predicates;
|
|
5100
|
-
this.setProperties = setProperties;
|
|
5101
|
-
this.assertedProperties = assertedProperties;
|
|
5102
|
-
this.refutedProperties = refutedProperties;
|
|
5103
|
-
this.exceededMatchLimit = false;
|
|
5104
|
-
}
|
|
5105
|
-
delete() {
|
|
5106
|
-
C._ts_query_delete(this[0]);
|
|
5107
|
-
this[0] = 0;
|
|
5020
|
+
const languageAddress = mod[functionName]();
|
|
5021
|
+
return new _Language(INTERNAL, languageAddress);
|
|
5108
5022
|
}
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
const
|
|
5118
|
-
|
|
5119
|
-
|
|
5023
|
+
};
|
|
5024
|
+
async function Module2(moduleArg = {}) {
|
|
5025
|
+
var moduleRtn;
|
|
5026
|
+
var Module = moduleArg;
|
|
5027
|
+
var ENVIRONMENT_IS_WEB = typeof window == "object";
|
|
5028
|
+
var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined";
|
|
5029
|
+
var ENVIRONMENT_IS_NODE = typeof process == "object" && process.versions?.node && process.type != "renderer";
|
|
5030
|
+
if (ENVIRONMENT_IS_NODE) {
|
|
5031
|
+
const { createRequire } = await import("module");
|
|
5032
|
+
var require = createRequire(import.meta.url);
|
|
5033
|
+
}
|
|
5034
|
+
Module.currentQueryProgressCallback = null;
|
|
5035
|
+
Module.currentProgressCallback = null;
|
|
5036
|
+
Module.currentLogCallback = null;
|
|
5037
|
+
Module.currentParseCallback = null;
|
|
5038
|
+
var arguments_ = [];
|
|
5039
|
+
var thisProgram = "./this.program";
|
|
5040
|
+
var quit_ = /* @__PURE__ */ __name((status, toThrow) => {
|
|
5041
|
+
throw toThrow;
|
|
5042
|
+
}, "quit_");
|
|
5043
|
+
var _scriptName = import.meta.url;
|
|
5044
|
+
var scriptDirectory = "";
|
|
5045
|
+
function locateFile(path6) {
|
|
5046
|
+
if (Module["locateFile"]) {
|
|
5047
|
+
return Module["locateFile"](path6, scriptDirectory);
|
|
5048
|
+
}
|
|
5049
|
+
return scriptDirectory + path6;
|
|
5050
|
+
}
|
|
5051
|
+
__name(locateFile, "locateFile");
|
|
5052
|
+
var readAsync, readBinary;
|
|
5053
|
+
if (ENVIRONMENT_IS_NODE) {
|
|
5054
|
+
var fs = require("fs");
|
|
5055
|
+
if (_scriptName.startsWith("file:")) {
|
|
5056
|
+
scriptDirectory = require("path").dirname(require("url").fileURLToPath(_scriptName)) + "/";
|
|
5057
|
+
}
|
|
5058
|
+
readBinary = /* @__PURE__ */ __name((filename) => {
|
|
5059
|
+
filename = isFileURI(filename) ? new URL(filename) : filename;
|
|
5060
|
+
var ret = fs.readFileSync(filename);
|
|
5061
|
+
return ret;
|
|
5062
|
+
}, "readBinary");
|
|
5063
|
+
readAsync = /* @__PURE__ */ __name(async (filename, binary2 = true) => {
|
|
5064
|
+
filename = isFileURI(filename) ? new URL(filename) : filename;
|
|
5065
|
+
var ret = fs.readFileSync(filename, binary2 ? undefined : "utf8");
|
|
5066
|
+
return ret;
|
|
5067
|
+
}, "readAsync");
|
|
5068
|
+
if (process.argv.length > 1) {
|
|
5069
|
+
thisProgram = process.argv[1].replace(/\\/g, "/");
|
|
5120
5070
|
}
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5071
|
+
arguments_ = process.argv.slice(2);
|
|
5072
|
+
quit_ = /* @__PURE__ */ __name((status, toThrow) => {
|
|
5073
|
+
process.exitCode = status;
|
|
5074
|
+
throw toThrow;
|
|
5075
|
+
}, "quit_");
|
|
5076
|
+
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
5077
|
+
try {
|
|
5078
|
+
scriptDirectory = new URL(".", _scriptName).href;
|
|
5079
|
+
} catch {}
|
|
5080
|
+
{
|
|
5081
|
+
if (ENVIRONMENT_IS_WORKER) {
|
|
5082
|
+
readBinary = /* @__PURE__ */ __name((url) => {
|
|
5083
|
+
var xhr = new XMLHttpRequest;
|
|
5084
|
+
xhr.open("GET", url, false);
|
|
5085
|
+
xhr.responseType = "arraybuffer";
|
|
5086
|
+
xhr.send(null);
|
|
5087
|
+
return new Uint8Array(xhr.response);
|
|
5088
|
+
}, "readBinary");
|
|
5089
|
+
}
|
|
5090
|
+
readAsync = /* @__PURE__ */ __name(async (url) => {
|
|
5091
|
+
if (isFileURI(url)) {
|
|
5092
|
+
return new Promise((resolve, reject) => {
|
|
5093
|
+
var xhr = new XMLHttpRequest;
|
|
5094
|
+
xhr.open("GET", url, true);
|
|
5095
|
+
xhr.responseType = "arraybuffer";
|
|
5096
|
+
xhr.onload = () => {
|
|
5097
|
+
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
5098
|
+
resolve(xhr.response);
|
|
5099
|
+
return;
|
|
5100
|
+
}
|
|
5101
|
+
reject(xhr.status);
|
|
5102
|
+
};
|
|
5103
|
+
xhr.onerror = reject;
|
|
5104
|
+
xhr.send(null);
|
|
5105
|
+
});
|
|
5106
|
+
}
|
|
5107
|
+
var response = await fetch(url, {
|
|
5108
|
+
credentials: "same-origin"
|
|
5109
|
+
});
|
|
5110
|
+
if (response.ok) {
|
|
5111
|
+
return response.arrayBuffer();
|
|
5112
|
+
}
|
|
5113
|
+
throw new Error(response.status + " : " + response.url);
|
|
5114
|
+
}, "readAsync");
|
|
5124
5115
|
}
|
|
5125
|
-
|
|
5126
|
-
|
|
5116
|
+
}
|
|
5117
|
+
var out = console.log.bind(console);
|
|
5118
|
+
var err = console.error.bind(console);
|
|
5119
|
+
var dynamicLibraries = [];
|
|
5120
|
+
var wasmBinary;
|
|
5121
|
+
var ABORT = false;
|
|
5122
|
+
var EXITSTATUS;
|
|
5123
|
+
var isFileURI = /* @__PURE__ */ __name((filename) => filename.startsWith("file://"), "isFileURI");
|
|
5124
|
+
var readyPromiseResolve, readyPromiseReject;
|
|
5125
|
+
var wasmMemory;
|
|
5126
|
+
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
5127
|
+
var HEAP64, HEAPU64;
|
|
5128
|
+
var HEAP_DATA_VIEW;
|
|
5129
|
+
var runtimeInitialized = false;
|
|
5130
|
+
function updateMemoryViews() {
|
|
5131
|
+
var b = wasmMemory.buffer;
|
|
5132
|
+
Module["HEAP8"] = HEAP8 = new Int8Array(b);
|
|
5133
|
+
Module["HEAP16"] = HEAP16 = new Int16Array(b);
|
|
5134
|
+
Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
|
|
5135
|
+
Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
|
|
5136
|
+
Module["HEAP32"] = HEAP32 = new Int32Array(b);
|
|
5137
|
+
Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
|
|
5138
|
+
Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
|
|
5139
|
+
Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
|
|
5140
|
+
Module["HEAP64"] = HEAP64 = new BigInt64Array(b);
|
|
5141
|
+
Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b);
|
|
5142
|
+
Module["HEAP_DATA_VIEW"] = HEAP_DATA_VIEW = new DataView(b);
|
|
5143
|
+
LE_HEAP_UPDATE();
|
|
5144
|
+
}
|
|
5145
|
+
__name(updateMemoryViews, "updateMemoryViews");
|
|
5146
|
+
function initMemory() {
|
|
5147
|
+
if (Module["wasmMemory"]) {
|
|
5148
|
+
wasmMemory = Module["wasmMemory"];
|
|
5149
|
+
} else {
|
|
5150
|
+
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 33554432;
|
|
5151
|
+
wasmMemory = new WebAssembly.Memory({
|
|
5152
|
+
initial: INITIAL_MEMORY / 65536,
|
|
5153
|
+
maximum: 32768
|
|
5154
|
+
});
|
|
5127
5155
|
}
|
|
5128
|
-
|
|
5129
|
-
|
|
5156
|
+
updateMemoryViews();
|
|
5157
|
+
}
|
|
5158
|
+
__name(initMemory, "initMemory");
|
|
5159
|
+
var __RELOC_FUNCS__ = [];
|
|
5160
|
+
function preRun() {
|
|
5161
|
+
if (Module["preRun"]) {
|
|
5162
|
+
if (typeof Module["preRun"] == "function")
|
|
5163
|
+
Module["preRun"] = [Module["preRun"]];
|
|
5164
|
+
while (Module["preRun"].length) {
|
|
5165
|
+
addOnPreRun(Module["preRun"].shift());
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
callRuntimeCallbacks(onPreRuns);
|
|
5169
|
+
}
|
|
5170
|
+
__name(preRun, "preRun");
|
|
5171
|
+
function initRuntime() {
|
|
5172
|
+
runtimeInitialized = true;
|
|
5173
|
+
callRuntimeCallbacks(__RELOC_FUNCS__);
|
|
5174
|
+
wasmExports["__wasm_call_ctors"]();
|
|
5175
|
+
callRuntimeCallbacks(onPostCtors);
|
|
5176
|
+
}
|
|
5177
|
+
__name(initRuntime, "initRuntime");
|
|
5178
|
+
function preMain() {}
|
|
5179
|
+
__name(preMain, "preMain");
|
|
5180
|
+
function postRun() {
|
|
5181
|
+
if (Module["postRun"]) {
|
|
5182
|
+
if (typeof Module["postRun"] == "function")
|
|
5183
|
+
Module["postRun"] = [Module["postRun"]];
|
|
5184
|
+
while (Module["postRun"].length) {
|
|
5185
|
+
addOnPostRun(Module["postRun"].shift());
|
|
5186
|
+
}
|
|
5187
|
+
}
|
|
5188
|
+
callRuntimeCallbacks(onPostRuns);
|
|
5189
|
+
}
|
|
5190
|
+
__name(postRun, "postRun");
|
|
5191
|
+
function abort(what) {
|
|
5192
|
+
Module["onAbort"]?.(what);
|
|
5193
|
+
what = "Aborted(" + what + ")";
|
|
5194
|
+
err(what);
|
|
5195
|
+
ABORT = true;
|
|
5196
|
+
what += ". Build with -sASSERTIONS for more info.";
|
|
5197
|
+
var e = new WebAssembly.RuntimeError(what);
|
|
5198
|
+
readyPromiseReject?.(e);
|
|
5199
|
+
throw e;
|
|
5200
|
+
}
|
|
5201
|
+
__name(abort, "abort");
|
|
5202
|
+
var wasmBinaryFile;
|
|
5203
|
+
function findWasmBinary() {
|
|
5204
|
+
if (Module["locateFile"]) {
|
|
5205
|
+
return locateFile("web-tree-sitter.wasm");
|
|
5206
|
+
}
|
|
5207
|
+
return new URL("web-tree-sitter.wasm", import.meta.url).href;
|
|
5208
|
+
}
|
|
5209
|
+
__name(findWasmBinary, "findWasmBinary");
|
|
5210
|
+
function getBinarySync(file) {
|
|
5211
|
+
if (file == wasmBinaryFile && wasmBinary) {
|
|
5212
|
+
return new Uint8Array(wasmBinary);
|
|
5213
|
+
}
|
|
5214
|
+
if (readBinary) {
|
|
5215
|
+
return readBinary(file);
|
|
5216
|
+
}
|
|
5217
|
+
throw "both async and sync fetching of the wasm failed";
|
|
5218
|
+
}
|
|
5219
|
+
__name(getBinarySync, "getBinarySync");
|
|
5220
|
+
async function getWasmBinary(binaryFile) {
|
|
5221
|
+
if (!wasmBinary) {
|
|
5222
|
+
try {
|
|
5223
|
+
var response = await readAsync(binaryFile);
|
|
5224
|
+
return new Uint8Array(response);
|
|
5225
|
+
} catch {}
|
|
5130
5226
|
}
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5227
|
+
return getBinarySync(binaryFile);
|
|
5228
|
+
}
|
|
5229
|
+
__name(getWasmBinary, "getWasmBinary");
|
|
5230
|
+
async function instantiateArrayBuffer(binaryFile, imports) {
|
|
5231
|
+
try {
|
|
5232
|
+
var binary2 = await getWasmBinary(binaryFile);
|
|
5233
|
+
var instance2 = await WebAssembly.instantiate(binary2, imports);
|
|
5234
|
+
return instance2;
|
|
5235
|
+
} catch (reason) {
|
|
5236
|
+
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
5237
|
+
abort(reason);
|
|
5238
|
+
}
|
|
5239
|
+
}
|
|
5240
|
+
__name(instantiateArrayBuffer, "instantiateArrayBuffer");
|
|
5241
|
+
async function instantiateAsync(binary2, binaryFile, imports) {
|
|
5242
|
+
if (!binary2 && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) {
|
|
5243
|
+
try {
|
|
5244
|
+
var response = fetch(binaryFile, {
|
|
5245
|
+
credentials: "same-origin"
|
|
5246
|
+
});
|
|
5247
|
+
var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
|
|
5248
|
+
return instantiationResult;
|
|
5249
|
+
} catch (reason) {
|
|
5250
|
+
err(`wasm streaming compile failed: ${reason}`);
|
|
5251
|
+
err("falling back to ArrayBuffer instantiation");
|
|
5156
5252
|
}
|
|
5157
5253
|
}
|
|
5158
|
-
|
|
5159
|
-
C._free(startAddress);
|
|
5160
|
-
C.currentQueryProgressCallback = null;
|
|
5161
|
-
return result;
|
|
5254
|
+
return instantiateArrayBuffer(binaryFile, imports);
|
|
5162
5255
|
}
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5256
|
+
__name(instantiateAsync, "instantiateAsync");
|
|
5257
|
+
function getWasmImports() {
|
|
5258
|
+
return {
|
|
5259
|
+
env: wasmImports,
|
|
5260
|
+
wasi_snapshot_preview1: wasmImports,
|
|
5261
|
+
"GOT.mem": new Proxy(wasmImports, GOTHandler),
|
|
5262
|
+
"GOT.func": new Proxy(wasmImports, GOTHandler)
|
|
5263
|
+
};
|
|
5264
|
+
}
|
|
5265
|
+
__name(getWasmImports, "getWasmImports");
|
|
5266
|
+
async function createWasm() {
|
|
5267
|
+
function receiveInstance(instance2, module2) {
|
|
5268
|
+
wasmExports = instance2.exports;
|
|
5269
|
+
wasmExports = relocateExports(wasmExports, 1024);
|
|
5270
|
+
var metadata2 = getDylinkMetadata(module2);
|
|
5271
|
+
if (metadata2.neededDynlibs) {
|
|
5272
|
+
dynamicLibraries = metadata2.neededDynlibs.concat(dynamicLibraries);
|
|
5273
|
+
}
|
|
5274
|
+
mergeLibSymbols(wasmExports, "main");
|
|
5275
|
+
LDSO.init();
|
|
5276
|
+
loadDylibs();
|
|
5277
|
+
__RELOC_FUNCS__.push(wasmExports["__wasm_apply_data_relocs"]);
|
|
5278
|
+
assignWasmExports(wasmExports);
|
|
5279
|
+
return wasmExports;
|
|
5280
|
+
}
|
|
5281
|
+
__name(receiveInstance, "receiveInstance");
|
|
5282
|
+
function receiveInstantiationResult(result2) {
|
|
5283
|
+
return receiveInstance(result2["instance"], result2["module"]);
|
|
5284
|
+
}
|
|
5285
|
+
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
5286
|
+
var info2 = getWasmImports();
|
|
5287
|
+
if (Module["instantiateWasm"]) {
|
|
5288
|
+
return new Promise((resolve, reject) => {
|
|
5289
|
+
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
5290
|
+
resolve(receiveInstance(mod, inst));
|
|
5291
|
+
});
|
|
5292
|
+
});
|
|
5174
5293
|
}
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5294
|
+
wasmBinaryFile ??= findWasmBinary();
|
|
5295
|
+
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info2);
|
|
5296
|
+
var exports = receiveInstantiationResult(result);
|
|
5297
|
+
return exports;
|
|
5298
|
+
}
|
|
5299
|
+
__name(createWasm, "createWasm");
|
|
5300
|
+
|
|
5301
|
+
class ExitStatus {
|
|
5302
|
+
static {
|
|
5303
|
+
__name(this, "ExitStatus");
|
|
5304
|
+
}
|
|
5305
|
+
name = "ExitStatus";
|
|
5306
|
+
constructor(status) {
|
|
5307
|
+
this.message = `Program terminated with exit(${status})`;
|
|
5308
|
+
this.status = status;
|
|
5309
|
+
}
|
|
5310
|
+
}
|
|
5311
|
+
var GOT = {};
|
|
5312
|
+
var currentModuleWeakSymbols = /* @__PURE__ */ new Set([]);
|
|
5313
|
+
var GOTHandler = {
|
|
5314
|
+
get(obj, symName) {
|
|
5315
|
+
var rtn = GOT[symName];
|
|
5316
|
+
if (!rtn) {
|
|
5317
|
+
rtn = GOT[symName] = new WebAssembly.Global({
|
|
5318
|
+
value: "i32",
|
|
5319
|
+
mutable: true
|
|
5320
|
+
});
|
|
5321
|
+
}
|
|
5322
|
+
if (!currentModuleWeakSymbols.has(symName)) {
|
|
5323
|
+
rtn.required = true;
|
|
5324
|
+
}
|
|
5325
|
+
return rtn;
|
|
5184
5326
|
}
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5327
|
+
};
|
|
5328
|
+
var LE_ATOMICS_NATIVE_BYTE_ORDER = [];
|
|
5329
|
+
var LE_HEAP_LOAD_F32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat32(byteOffset, true), "LE_HEAP_LOAD_F32");
|
|
5330
|
+
var LE_HEAP_LOAD_F64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat64(byteOffset, true), "LE_HEAP_LOAD_F64");
|
|
5331
|
+
var LE_HEAP_LOAD_I16 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt16(byteOffset, true), "LE_HEAP_LOAD_I16");
|
|
5332
|
+
var LE_HEAP_LOAD_I32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt32(byteOffset, true), "LE_HEAP_LOAD_I32");
|
|
5333
|
+
var LE_HEAP_LOAD_I64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getBigInt64(byteOffset, true), "LE_HEAP_LOAD_I64");
|
|
5334
|
+
var LE_HEAP_LOAD_U32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getUint32(byteOffset, true), "LE_HEAP_LOAD_U32");
|
|
5335
|
+
var LE_HEAP_STORE_F32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat32(byteOffset, value, true), "LE_HEAP_STORE_F32");
|
|
5336
|
+
var LE_HEAP_STORE_F64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat64(byteOffset, value, true), "LE_HEAP_STORE_F64");
|
|
5337
|
+
var LE_HEAP_STORE_I16 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt16(byteOffset, value, true), "LE_HEAP_STORE_I16");
|
|
5338
|
+
var LE_HEAP_STORE_I32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt32(byteOffset, value, true), "LE_HEAP_STORE_I32");
|
|
5339
|
+
var LE_HEAP_STORE_I64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setBigInt64(byteOffset, value, true), "LE_HEAP_STORE_I64");
|
|
5340
|
+
var LE_HEAP_STORE_U32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setUint32(byteOffset, value, true), "LE_HEAP_STORE_U32");
|
|
5341
|
+
var callRuntimeCallbacks = /* @__PURE__ */ __name((callbacks) => {
|
|
5342
|
+
while (callbacks.length > 0) {
|
|
5343
|
+
callbacks.shift()(Module);
|
|
5344
|
+
}
|
|
5345
|
+
}, "callRuntimeCallbacks");
|
|
5346
|
+
var onPostRuns = [];
|
|
5347
|
+
var addOnPostRun = /* @__PURE__ */ __name((cb) => onPostRuns.push(cb), "addOnPostRun");
|
|
5348
|
+
var onPreRuns = [];
|
|
5349
|
+
var addOnPreRun = /* @__PURE__ */ __name((cb) => onPreRuns.push(cb), "addOnPreRun");
|
|
5350
|
+
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined;
|
|
5351
|
+
var findStringEnd = /* @__PURE__ */ __name((heapOrArray, idx, maxBytesToRead, ignoreNul) => {
|
|
5352
|
+
var maxIdx = idx + maxBytesToRead;
|
|
5353
|
+
if (ignoreNul)
|
|
5354
|
+
return maxIdx;
|
|
5355
|
+
while (heapOrArray[idx] && !(idx >= maxIdx))
|
|
5356
|
+
++idx;
|
|
5357
|
+
return idx;
|
|
5358
|
+
}, "findStringEnd");
|
|
5359
|
+
var UTF8ArrayToString = /* @__PURE__ */ __name((heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
|
|
5360
|
+
var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
|
|
5361
|
+
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
5362
|
+
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
5363
|
+
}
|
|
5364
|
+
var str = "";
|
|
5365
|
+
while (idx < endPtr) {
|
|
5366
|
+
var u0 = heapOrArray[idx++];
|
|
5367
|
+
if (!(u0 & 128)) {
|
|
5368
|
+
str += String.fromCharCode(u0);
|
|
5369
|
+
continue;
|
|
5370
|
+
}
|
|
5371
|
+
var u1 = heapOrArray[idx++] & 63;
|
|
5372
|
+
if ((u0 & 224) == 192) {
|
|
5373
|
+
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
5374
|
+
continue;
|
|
5375
|
+
}
|
|
5376
|
+
var u2 = heapOrArray[idx++] & 63;
|
|
5377
|
+
if ((u0 & 240) == 224) {
|
|
5378
|
+
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
5379
|
+
} else {
|
|
5380
|
+
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
5381
|
+
}
|
|
5382
|
+
if (u0 < 65536) {
|
|
5383
|
+
str += String.fromCharCode(u0);
|
|
5384
|
+
} else {
|
|
5385
|
+
var ch = u0 - 65536;
|
|
5386
|
+
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
5387
|
+
}
|
|
5388
|
+
}
|
|
5389
|
+
return str;
|
|
5390
|
+
}, "UTF8ArrayToString");
|
|
5391
|
+
var getDylinkMetadata = /* @__PURE__ */ __name((binary2) => {
|
|
5392
|
+
var offset = 0;
|
|
5393
|
+
var end = 0;
|
|
5394
|
+
function getU8() {
|
|
5395
|
+
return binary2[offset++];
|
|
5396
|
+
}
|
|
5397
|
+
__name(getU8, "getU8");
|
|
5398
|
+
function getLEB() {
|
|
5399
|
+
var ret = 0;
|
|
5400
|
+
var mul = 1;
|
|
5401
|
+
while (true) {
|
|
5402
|
+
var byte = binary2[offset++];
|
|
5403
|
+
ret += (byte & 127) * mul;
|
|
5404
|
+
mul *= 128;
|
|
5405
|
+
if (!(byte & 128))
|
|
5406
|
+
break;
|
|
5212
5407
|
}
|
|
5408
|
+
return ret;
|
|
5213
5409
|
}
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
}
|
|
5228
|
-
disablePattern(patternIndex) {
|
|
5229
|
-
if (patternIndex >= this.predicates.length) {
|
|
5230
|
-
throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);
|
|
5410
|
+
__name(getLEB, "getLEB");
|
|
5411
|
+
function getString() {
|
|
5412
|
+
var len = getLEB();
|
|
5413
|
+
offset += len;
|
|
5414
|
+
return UTF8ArrayToString(binary2, offset - len, len);
|
|
5415
|
+
}
|
|
5416
|
+
__name(getString, "getString");
|
|
5417
|
+
function getStringList() {
|
|
5418
|
+
var count2 = getLEB();
|
|
5419
|
+
var rtn = [];
|
|
5420
|
+
while (count2--)
|
|
5421
|
+
rtn.push(getString());
|
|
5422
|
+
return rtn;
|
|
5231
5423
|
}
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
if (
|
|
5239
|
-
|
|
5424
|
+
__name(getStringList, "getStringList");
|
|
5425
|
+
function failIf(condition, message) {
|
|
5426
|
+
if (condition)
|
|
5427
|
+
throw new Error(message);
|
|
5428
|
+
}
|
|
5429
|
+
__name(failIf, "failIf");
|
|
5430
|
+
if (binary2 instanceof WebAssembly.Module) {
|
|
5431
|
+
var dylinkSection = WebAssembly.Module.customSections(binary2, "dylink.0");
|
|
5432
|
+
failIf(dylinkSection.length === 0, "need dylink section");
|
|
5433
|
+
binary2 = new Uint8Array(dylinkSection[0]);
|
|
5434
|
+
end = binary2.length;
|
|
5435
|
+
} else {
|
|
5436
|
+
var int32View = new Uint32Array(new Uint8Array(binary2.subarray(0, 24)).buffer);
|
|
5437
|
+
var magicNumberFound = int32View[0] == 1836278016 || int32View[0] == 6386541;
|
|
5438
|
+
failIf(!magicNumberFound, "need to see wasm magic number");
|
|
5439
|
+
failIf(binary2[8] !== 0, "need the dylink section to be first");
|
|
5440
|
+
offset = 9;
|
|
5441
|
+
var section_size = getLEB();
|
|
5442
|
+
end = offset + section_size;
|
|
5443
|
+
var name2 = getString();
|
|
5444
|
+
failIf(name2 !== "dylink.0");
|
|
5445
|
+
}
|
|
5446
|
+
var customSection = {
|
|
5447
|
+
neededDynlibs: [],
|
|
5448
|
+
tlsExports: /* @__PURE__ */ new Set,
|
|
5449
|
+
weakImports: /* @__PURE__ */ new Set,
|
|
5450
|
+
runtimePaths: []
|
|
5451
|
+
};
|
|
5452
|
+
var WASM_DYLINK_MEM_INFO = 1;
|
|
5453
|
+
var WASM_DYLINK_NEEDED = 2;
|
|
5454
|
+
var WASM_DYLINK_EXPORT_INFO = 3;
|
|
5455
|
+
var WASM_DYLINK_IMPORT_INFO = 4;
|
|
5456
|
+
var WASM_DYLINK_RUNTIME_PATH = 5;
|
|
5457
|
+
var WASM_SYMBOL_TLS = 256;
|
|
5458
|
+
var WASM_SYMBOL_BINDING_MASK = 3;
|
|
5459
|
+
var WASM_SYMBOL_BINDING_WEAK = 1;
|
|
5460
|
+
while (offset < end) {
|
|
5461
|
+
var subsectionType = getU8();
|
|
5462
|
+
var subsectionSize = getLEB();
|
|
5463
|
+
if (subsectionType === WASM_DYLINK_MEM_INFO) {
|
|
5464
|
+
customSection.memorySize = getLEB();
|
|
5465
|
+
customSection.memoryAlign = getLEB();
|
|
5466
|
+
customSection.tableSize = getLEB();
|
|
5467
|
+
customSection.tableAlign = getLEB();
|
|
5468
|
+
} else if (subsectionType === WASM_DYLINK_NEEDED) {
|
|
5469
|
+
customSection.neededDynlibs = getStringList();
|
|
5470
|
+
} else if (subsectionType === WASM_DYLINK_EXPORT_INFO) {
|
|
5471
|
+
var count = getLEB();
|
|
5472
|
+
while (count--) {
|
|
5473
|
+
var symname = getString();
|
|
5474
|
+
var flags2 = getLEB();
|
|
5475
|
+
if (flags2 & WASM_SYMBOL_TLS) {
|
|
5476
|
+
customSection.tlsExports.add(symname);
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
} else if (subsectionType === WASM_DYLINK_IMPORT_INFO) {
|
|
5480
|
+
var count = getLEB();
|
|
5481
|
+
while (count--) {
|
|
5482
|
+
var modname = getString();
|
|
5483
|
+
var symname = getString();
|
|
5484
|
+
var flags2 = getLEB();
|
|
5485
|
+
if ((flags2 & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {
|
|
5486
|
+
customSection.weakImports.add(symname);
|
|
5487
|
+
}
|
|
5488
|
+
}
|
|
5489
|
+
} else if (subsectionType === WASM_DYLINK_RUNTIME_PATH) {
|
|
5490
|
+
customSection.runtimePaths = getStringList();
|
|
5491
|
+
} else {
|
|
5492
|
+
offset += subsectionSize;
|
|
5493
|
+
}
|
|
5494
|
+
}
|
|
5495
|
+
return customSection;
|
|
5496
|
+
}, "getDylinkMetadata");
|
|
5497
|
+
function getValue(ptr, type = "i8") {
|
|
5498
|
+
if (type.endsWith("*"))
|
|
5499
|
+
type = "*";
|
|
5500
|
+
switch (type) {
|
|
5501
|
+
case "i1":
|
|
5502
|
+
return HEAP8[ptr];
|
|
5503
|
+
case "i8":
|
|
5504
|
+
return HEAP8[ptr];
|
|
5505
|
+
case "i16":
|
|
5506
|
+
return LE_HEAP_LOAD_I16((ptr >> 1) * 2);
|
|
5507
|
+
case "i32":
|
|
5508
|
+
return LE_HEAP_LOAD_I32((ptr >> 2) * 4);
|
|
5509
|
+
case "i64":
|
|
5510
|
+
return LE_HEAP_LOAD_I64((ptr >> 3) * 8);
|
|
5511
|
+
case "float":
|
|
5512
|
+
return LE_HEAP_LOAD_F32((ptr >> 2) * 4);
|
|
5513
|
+
case "double":
|
|
5514
|
+
return LE_HEAP_LOAD_F64((ptr >> 3) * 8);
|
|
5515
|
+
case "*":
|
|
5516
|
+
return LE_HEAP_LOAD_U32((ptr >> 2) * 4);
|
|
5517
|
+
default:
|
|
5518
|
+
abort(`invalid type for getValue: ${type}`);
|
|
5240
5519
|
}
|
|
5241
|
-
return C._ts_query_start_byte_for_pattern(this[0], patternIndex);
|
|
5242
5520
|
}
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5521
|
+
__name(getValue, "getValue");
|
|
5522
|
+
var newDSO = /* @__PURE__ */ __name((name2, handle2, syms) => {
|
|
5523
|
+
var dso = {
|
|
5524
|
+
refcount: Infinity,
|
|
5525
|
+
name: name2,
|
|
5526
|
+
exports: syms,
|
|
5527
|
+
global: true
|
|
5528
|
+
};
|
|
5529
|
+
LDSO.loadedLibsByName[name2] = dso;
|
|
5530
|
+
if (handle2 != null) {
|
|
5531
|
+
LDSO.loadedLibsByHandle[handle2] = dso;
|
|
5532
|
+
}
|
|
5533
|
+
return dso;
|
|
5534
|
+
}, "newDSO");
|
|
5535
|
+
var LDSO = {
|
|
5536
|
+
loadedLibsByName: {},
|
|
5537
|
+
loadedLibsByHandle: {},
|
|
5538
|
+
init() {
|
|
5539
|
+
newDSO("__main__", 0, wasmImports);
|
|
5246
5540
|
}
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
};
|
|
5265
|
-
var
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5541
|
+
};
|
|
5542
|
+
var ___heap_base = 78240;
|
|
5543
|
+
var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
|
|
5544
|
+
var getMemory = /* @__PURE__ */ __name((size) => {
|
|
5545
|
+
if (runtimeInitialized) {
|
|
5546
|
+
return _calloc(size, 1);
|
|
5547
|
+
}
|
|
5548
|
+
var ret = ___heap_base;
|
|
5549
|
+
var end = ret + alignMemory(size, 16);
|
|
5550
|
+
___heap_base = end;
|
|
5551
|
+
GOT["__heap_base"].value = end;
|
|
5552
|
+
return ret;
|
|
5553
|
+
}, "getMemory");
|
|
5554
|
+
var isInternalSym = /* @__PURE__ */ __name((symName) => ["__cpp_exception", "__c_longjmp", "__wasm_apply_data_relocs", "__dso_handle", "__tls_size", "__tls_align", "__set_stack_limits", "_emscripten_tls_init", "__wasm_init_tls", "__wasm_call_ctors", "__start_em_asm", "__stop_em_asm", "__start_em_js", "__stop_em_js"].includes(symName) || symName.startsWith("__em_js__"), "isInternalSym");
|
|
5555
|
+
var uleb128EncodeWithLen = /* @__PURE__ */ __name((arr) => {
|
|
5556
|
+
const n = arr.length;
|
|
5557
|
+
return [n % 128 | 128, n >> 7, ...arr];
|
|
5558
|
+
}, "uleb128EncodeWithLen");
|
|
5559
|
+
var wasmTypeCodes = {
|
|
5560
|
+
i: 127,
|
|
5561
|
+
p: 127,
|
|
5562
|
+
j: 126,
|
|
5563
|
+
f: 125,
|
|
5564
|
+
d: 124,
|
|
5565
|
+
e: 111
|
|
5566
|
+
};
|
|
5567
|
+
var generateTypePack = /* @__PURE__ */ __name((types) => uleb128EncodeWithLen(Array.from(types, (type) => {
|
|
5568
|
+
var code = wasmTypeCodes[type];
|
|
5569
|
+
return code;
|
|
5570
|
+
})), "generateTypePack");
|
|
5571
|
+
var convertJsFunctionToWasm = /* @__PURE__ */ __name((func2, sig) => {
|
|
5572
|
+
var bytes = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, ...uleb128EncodeWithLen([
|
|
5573
|
+
1,
|
|
5574
|
+
96,
|
|
5575
|
+
...generateTypePack(sig.slice(1)),
|
|
5576
|
+
...generateTypePack(sig[0] === "v" ? "" : sig[0])
|
|
5577
|
+
]), 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0);
|
|
5578
|
+
var module2 = new WebAssembly.Module(bytes);
|
|
5579
|
+
var instance2 = new WebAssembly.Instance(module2, {
|
|
5580
|
+
e: {
|
|
5581
|
+
f: func2
|
|
5280
5582
|
}
|
|
5281
|
-
}
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5583
|
+
});
|
|
5584
|
+
var wrappedFunc = instance2.exports["f"];
|
|
5585
|
+
return wrappedFunc;
|
|
5586
|
+
}, "convertJsFunctionToWasm");
|
|
5587
|
+
var wasmTableMirror = [];
|
|
5588
|
+
var wasmTable = new WebAssembly.Table({
|
|
5589
|
+
initial: 31,
|
|
5590
|
+
element: "anyfunc"
|
|
5591
|
+
});
|
|
5592
|
+
var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
|
|
5593
|
+
var func2 = wasmTableMirror[funcPtr];
|
|
5594
|
+
if (!func2) {
|
|
5595
|
+
wasmTableMirror[funcPtr] = func2 = wasmTable.get(funcPtr);
|
|
5596
|
+
}
|
|
5597
|
+
return func2;
|
|
5598
|
+
}, "getWasmTableEntry");
|
|
5599
|
+
var updateTableMap = /* @__PURE__ */ __name((offset, count) => {
|
|
5600
|
+
if (functionsInTableMap) {
|
|
5601
|
+
for (var i2 = offset;i2 < offset + count; i2++) {
|
|
5602
|
+
var item = getWasmTableEntry(i2);
|
|
5603
|
+
if (item) {
|
|
5604
|
+
functionsInTableMap.set(item, i2);
|
|
5605
|
+
}
|
|
5289
5606
|
}
|
|
5290
5607
|
}
|
|
5291
|
-
}
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
if (
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
get stateCount() {
|
|
5316
|
-
return C._ts_language_state_count(this[0]);
|
|
5317
|
-
}
|
|
5318
|
-
fieldIdForName(fieldName) {
|
|
5319
|
-
const result = this.fields.indexOf(fieldName);
|
|
5320
|
-
return result !== -1 ? result : null;
|
|
5321
|
-
}
|
|
5322
|
-
fieldNameForId(fieldId) {
|
|
5323
|
-
return this.fields[fieldId] ?? null;
|
|
5324
|
-
}
|
|
5325
|
-
idForNodeType(type, named) {
|
|
5326
|
-
const typeLength = C.lengthBytesUTF8(type);
|
|
5327
|
-
const typeAddress = C._malloc(typeLength + 1);
|
|
5328
|
-
C.stringToUTF8(type, typeAddress, typeLength + 1);
|
|
5329
|
-
const result = C._ts_language_symbol_for_name(this[0], typeAddress, typeLength, named ? 1 : 0);
|
|
5330
|
-
C._free(typeAddress);
|
|
5331
|
-
return result || null;
|
|
5332
|
-
}
|
|
5333
|
-
get nodeTypeCount() {
|
|
5334
|
-
return C._ts_language_symbol_count(this[0]);
|
|
5335
|
-
}
|
|
5336
|
-
nodeTypeForId(typeId) {
|
|
5337
|
-
const name2 = C._ts_language_symbol_name(this[0], typeId);
|
|
5338
|
-
return name2 ? C.UTF8ToString(name2) : null;
|
|
5339
|
-
}
|
|
5340
|
-
nodeTypeIsNamed(typeId) {
|
|
5341
|
-
return C._ts_language_type_is_named_wasm(this[0], typeId) ? true : false;
|
|
5342
|
-
}
|
|
5343
|
-
nodeTypeIsVisible(typeId) {
|
|
5344
|
-
return C._ts_language_type_is_visible_wasm(this[0], typeId) ? true : false;
|
|
5345
|
-
}
|
|
5346
|
-
get supertypes() {
|
|
5347
|
-
C._ts_language_supertypes_wasm(this[0]);
|
|
5348
|
-
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
5349
|
-
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
5350
|
-
const result = new Array(count);
|
|
5351
|
-
if (count > 0) {
|
|
5352
|
-
let address = buffer;
|
|
5353
|
-
for (let i2 = 0;i2 < count; i2++) {
|
|
5354
|
-
result[i2] = C.getValue(address, "i16");
|
|
5355
|
-
address += SIZE_OF_SHORT;
|
|
5356
|
-
}
|
|
5608
|
+
}, "updateTableMap");
|
|
5609
|
+
var functionsInTableMap;
|
|
5610
|
+
var getFunctionAddress = /* @__PURE__ */ __name((func2) => {
|
|
5611
|
+
if (!functionsInTableMap) {
|
|
5612
|
+
functionsInTableMap = /* @__PURE__ */ new WeakMap;
|
|
5613
|
+
updateTableMap(0, wasmTable.length);
|
|
5614
|
+
}
|
|
5615
|
+
return functionsInTableMap.get(func2) || 0;
|
|
5616
|
+
}, "getFunctionAddress");
|
|
5617
|
+
var freeTableIndexes = [];
|
|
5618
|
+
var getEmptyTableSlot = /* @__PURE__ */ __name(() => {
|
|
5619
|
+
if (freeTableIndexes.length) {
|
|
5620
|
+
return freeTableIndexes.pop();
|
|
5621
|
+
}
|
|
5622
|
+
return wasmTable["grow"](1);
|
|
5623
|
+
}, "getEmptyTableSlot");
|
|
5624
|
+
var setWasmTableEntry = /* @__PURE__ */ __name((idx, func2) => {
|
|
5625
|
+
wasmTable.set(idx, func2);
|
|
5626
|
+
wasmTableMirror[idx] = wasmTable.get(idx);
|
|
5627
|
+
}, "setWasmTableEntry");
|
|
5628
|
+
var addFunction = /* @__PURE__ */ __name((func2, sig) => {
|
|
5629
|
+
var rtn = getFunctionAddress(func2);
|
|
5630
|
+
if (rtn) {
|
|
5631
|
+
return rtn;
|
|
5357
5632
|
}
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5633
|
+
var ret = getEmptyTableSlot();
|
|
5634
|
+
try {
|
|
5635
|
+
setWasmTableEntry(ret, func2);
|
|
5636
|
+
} catch (err2) {
|
|
5637
|
+
if (!(err2 instanceof TypeError)) {
|
|
5638
|
+
throw err2;
|
|
5639
|
+
}
|
|
5640
|
+
var wrapped = convertJsFunctionToWasm(func2, sig);
|
|
5641
|
+
setWasmTableEntry(ret, wrapped);
|
|
5642
|
+
}
|
|
5643
|
+
functionsInTableMap.set(func2, ret);
|
|
5644
|
+
return ret;
|
|
5645
|
+
}, "addFunction");
|
|
5646
|
+
var updateGOT = /* @__PURE__ */ __name((exports, replace) => {
|
|
5647
|
+
for (var symName in exports) {
|
|
5648
|
+
if (isInternalSym(symName)) {
|
|
5649
|
+
continue;
|
|
5650
|
+
}
|
|
5651
|
+
var value = exports[symName];
|
|
5652
|
+
GOT[symName] ||= new WebAssembly.Global({
|
|
5653
|
+
value: "i32",
|
|
5654
|
+
mutable: true
|
|
5655
|
+
});
|
|
5656
|
+
if (replace || GOT[symName].value == 0) {
|
|
5657
|
+
if (typeof value == "function") {
|
|
5658
|
+
GOT[symName].value = addFunction(value);
|
|
5659
|
+
} else if (typeof value == "number") {
|
|
5660
|
+
GOT[symName].value = value;
|
|
5661
|
+
} else {
|
|
5662
|
+
err(`unhandled export type for '${symName}': ${typeof value}`);
|
|
5663
|
+
}
|
|
5370
5664
|
}
|
|
5371
5665
|
}
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
}
|
|
5383
|
-
query(source) {
|
|
5384
|
-
console.warn("Language.query is deprecated. Use new Query(language, source) instead.");
|
|
5385
|
-
return new Query(this, source);
|
|
5386
|
-
}
|
|
5387
|
-
static async load(input) {
|
|
5388
|
-
let bytes;
|
|
5389
|
-
if (input instanceof Uint8Array) {
|
|
5390
|
-
bytes = Promise.resolve(input);
|
|
5391
|
-
} else {
|
|
5392
|
-
if (globalThis.process?.versions.node) {
|
|
5393
|
-
const fs22 = await import("fs/promises");
|
|
5394
|
-
bytes = fs22.readFile(input);
|
|
5395
|
-
} else {
|
|
5396
|
-
bytes = fetch(input).then((response) => response.arrayBuffer().then((buffer) => {
|
|
5397
|
-
if (response.ok) {
|
|
5398
|
-
return new Uint8Array(buffer);
|
|
5399
|
-
} else {
|
|
5400
|
-
const body2 = new TextDecoder("utf-8").decode(buffer);
|
|
5401
|
-
throw new Error(`Language.load failed with status ${response.status}.
|
|
5402
|
-
|
|
5403
|
-
${body2}`);
|
|
5404
|
-
}
|
|
5405
|
-
}));
|
|
5666
|
+
}, "updateGOT");
|
|
5667
|
+
var relocateExports = /* @__PURE__ */ __name((exports, memoryBase2, replace) => {
|
|
5668
|
+
var relocated = {};
|
|
5669
|
+
for (var e in exports) {
|
|
5670
|
+
var value = exports[e];
|
|
5671
|
+
if (typeof value == "object") {
|
|
5672
|
+
value = value.value;
|
|
5673
|
+
}
|
|
5674
|
+
if (typeof value == "number") {
|
|
5675
|
+
value += memoryBase2;
|
|
5406
5676
|
}
|
|
5677
|
+
relocated[e] = value;
|
|
5407
5678
|
}
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5679
|
+
updateGOT(relocated, replace);
|
|
5680
|
+
return relocated;
|
|
5681
|
+
}, "relocateExports");
|
|
5682
|
+
var isSymbolDefined = /* @__PURE__ */ __name((symName) => {
|
|
5683
|
+
var existing = wasmImports[symName];
|
|
5684
|
+
if (!existing || existing.stub) {
|
|
5685
|
+
return false;
|
|
5415
5686
|
}
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
var
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
var
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
var
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
var scriptDirectory = "";
|
|
5449
|
-
function locateFile(path6) {
|
|
5450
|
-
if (Module["locateFile"]) {
|
|
5451
|
-
return Module["locateFile"](path6, scriptDirectory);
|
|
5452
|
-
}
|
|
5453
|
-
return scriptDirectory + path6;
|
|
5454
|
-
}
|
|
5455
|
-
__name(locateFile, "locateFile");
|
|
5456
|
-
var readAsync, readBinary;
|
|
5457
|
-
if (ENVIRONMENT_IS_NODE) {
|
|
5458
|
-
var fs = require("fs");
|
|
5459
|
-
var nodePath = require("path");
|
|
5460
|
-
if (!import.meta.url.startsWith("data:")) {
|
|
5461
|
-
scriptDirectory = nodePath.dirname(require("url").fileURLToPath(import.meta.url)) + "/";
|
|
5462
|
-
}
|
|
5463
|
-
readBinary = /* @__PURE__ */ __name((filename) => {
|
|
5464
|
-
filename = isFileURI(filename) ? new URL(filename) : filename;
|
|
5465
|
-
var ret = fs.readFileSync(filename);
|
|
5466
|
-
return ret;
|
|
5467
|
-
}, "readBinary");
|
|
5468
|
-
readAsync = /* @__PURE__ */ __name(async (filename, binary2 = true) => {
|
|
5469
|
-
filename = isFileURI(filename) ? new URL(filename) : filename;
|
|
5470
|
-
var ret = fs.readFileSync(filename, binary2 ? undefined : "utf8");
|
|
5471
|
-
return ret;
|
|
5472
|
-
}, "readAsync");
|
|
5473
|
-
if (!Module["thisProgram"] && process.argv.length > 1) {
|
|
5474
|
-
thisProgram = process.argv[1].replace(/\\/g, "/");
|
|
5475
|
-
}
|
|
5476
|
-
arguments_ = process.argv.slice(2);
|
|
5477
|
-
quit_ = /* @__PURE__ */ __name((status, toThrow) => {
|
|
5478
|
-
process.exitCode = status;
|
|
5479
|
-
throw toThrow;
|
|
5480
|
-
}, "quit_");
|
|
5481
|
-
} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
5482
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
5483
|
-
scriptDirectory = self.location.href;
|
|
5484
|
-
} else if (typeof document != "undefined" && document.currentScript) {
|
|
5485
|
-
scriptDirectory = document.currentScript.src;
|
|
5486
|
-
}
|
|
5487
|
-
if (_scriptName) {
|
|
5488
|
-
scriptDirectory = _scriptName;
|
|
5489
|
-
}
|
|
5490
|
-
if (scriptDirectory.startsWith("blob:")) {
|
|
5491
|
-
scriptDirectory = "";
|
|
5492
|
-
} else {
|
|
5493
|
-
scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
|
|
5494
|
-
}
|
|
5495
|
-
{
|
|
5496
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
5497
|
-
readBinary = /* @__PURE__ */ __name((url) => {
|
|
5498
|
-
var xhr = new XMLHttpRequest;
|
|
5499
|
-
xhr.open("GET", url, false);
|
|
5500
|
-
xhr.responseType = "arraybuffer";
|
|
5501
|
-
xhr.send(null);
|
|
5502
|
-
return new Uint8Array(xhr.response);
|
|
5503
|
-
}, "readBinary");
|
|
5504
|
-
}
|
|
5505
|
-
readAsync = /* @__PURE__ */ __name(async (url) => {
|
|
5506
|
-
if (isFileURI(url)) {
|
|
5507
|
-
return new Promise((resolve, reject) => {
|
|
5508
|
-
var xhr = new XMLHttpRequest;
|
|
5509
|
-
xhr.open("GET", url, true);
|
|
5510
|
-
xhr.responseType = "arraybuffer";
|
|
5511
|
-
xhr.onload = () => {
|
|
5512
|
-
if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
|
|
5513
|
-
resolve(xhr.response);
|
|
5514
|
-
return;
|
|
5515
|
-
}
|
|
5516
|
-
reject(xhr.status);
|
|
5517
|
-
};
|
|
5518
|
-
xhr.onerror = reject;
|
|
5519
|
-
xhr.send(null);
|
|
5520
|
-
});
|
|
5521
|
-
}
|
|
5522
|
-
var response = await fetch(url, {
|
|
5523
|
-
credentials: "same-origin"
|
|
5524
|
-
});
|
|
5525
|
-
if (response.ok) {
|
|
5526
|
-
return response.arrayBuffer();
|
|
5527
|
-
}
|
|
5528
|
-
throw new Error(response.status + " : " + response.url);
|
|
5529
|
-
}, "readAsync");
|
|
5530
|
-
}
|
|
5531
|
-
}
|
|
5532
|
-
var out = Module["print"] || console.log.bind(console);
|
|
5533
|
-
var err = Module["printErr"] || console.error.bind(console);
|
|
5534
|
-
Object.assign(Module, moduleOverrides);
|
|
5535
|
-
moduleOverrides = null;
|
|
5536
|
-
if (Module["arguments"])
|
|
5537
|
-
arguments_ = Module["arguments"];
|
|
5538
|
-
if (Module["thisProgram"])
|
|
5539
|
-
thisProgram = Module["thisProgram"];
|
|
5540
|
-
var dynamicLibraries = Module["dynamicLibraries"] || [];
|
|
5541
|
-
var wasmBinary = Module["wasmBinary"];
|
|
5542
|
-
var wasmMemory;
|
|
5543
|
-
var ABORT = false;
|
|
5544
|
-
var EXITSTATUS;
|
|
5545
|
-
function assert(condition, text) {
|
|
5546
|
-
if (!condition) {
|
|
5547
|
-
abort(text);
|
|
5548
|
-
}
|
|
5549
|
-
}
|
|
5550
|
-
__name(assert, "assert");
|
|
5551
|
-
var HEAP, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAP64, HEAPU64, HEAPF64;
|
|
5552
|
-
var HEAP_DATA_VIEW;
|
|
5553
|
-
var runtimeInitialized = false;
|
|
5554
|
-
var isFileURI = /* @__PURE__ */ __name((filename) => filename.startsWith("file://"), "isFileURI");
|
|
5555
|
-
function updateMemoryViews() {
|
|
5556
|
-
var b = wasmMemory.buffer;
|
|
5557
|
-
Module["HEAP_DATA_VIEW"] = HEAP_DATA_VIEW = new DataView(b);
|
|
5558
|
-
Module["HEAP8"] = HEAP8 = new Int8Array(b);
|
|
5559
|
-
Module["HEAP16"] = HEAP16 = new Int16Array(b);
|
|
5560
|
-
Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
|
|
5561
|
-
Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
|
|
5562
|
-
Module["HEAP32"] = HEAP32 = new Int32Array(b);
|
|
5563
|
-
Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
|
|
5564
|
-
Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
|
|
5565
|
-
Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
|
|
5566
|
-
Module["HEAP64"] = HEAP64 = new BigInt64Array(b);
|
|
5567
|
-
Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b);
|
|
5568
|
-
}
|
|
5569
|
-
__name(updateMemoryViews, "updateMemoryViews");
|
|
5570
|
-
if (Module["wasmMemory"]) {
|
|
5571
|
-
wasmMemory = Module["wasmMemory"];
|
|
5572
|
-
} else {
|
|
5573
|
-
var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 33554432;
|
|
5574
|
-
wasmMemory = new WebAssembly.Memory({
|
|
5575
|
-
initial: INITIAL_MEMORY / 65536,
|
|
5576
|
-
maximum: 32768
|
|
5577
|
-
});
|
|
5578
|
-
}
|
|
5579
|
-
updateMemoryViews();
|
|
5580
|
-
var __RELOC_FUNCS__ = [];
|
|
5581
|
-
function preRun() {
|
|
5582
|
-
if (Module["preRun"]) {
|
|
5583
|
-
if (typeof Module["preRun"] == "function")
|
|
5584
|
-
Module["preRun"] = [Module["preRun"]];
|
|
5585
|
-
while (Module["preRun"].length) {
|
|
5586
|
-
addOnPreRun(Module["preRun"].shift());
|
|
5587
|
-
}
|
|
5588
|
-
}
|
|
5589
|
-
callRuntimeCallbacks(onPreRuns);
|
|
5590
|
-
}
|
|
5591
|
-
__name(preRun, "preRun");
|
|
5592
|
-
function initRuntime() {
|
|
5593
|
-
runtimeInitialized = true;
|
|
5594
|
-
callRuntimeCallbacks(__RELOC_FUNCS__);
|
|
5595
|
-
wasmExports["__wasm_call_ctors"]();
|
|
5596
|
-
callRuntimeCallbacks(onPostCtors);
|
|
5597
|
-
}
|
|
5598
|
-
__name(initRuntime, "initRuntime");
|
|
5599
|
-
function preMain() {}
|
|
5600
|
-
__name(preMain, "preMain");
|
|
5601
|
-
function postRun() {
|
|
5602
|
-
if (Module["postRun"]) {
|
|
5603
|
-
if (typeof Module["postRun"] == "function")
|
|
5604
|
-
Module["postRun"] = [Module["postRun"]];
|
|
5605
|
-
while (Module["postRun"].length) {
|
|
5606
|
-
addOnPostRun(Module["postRun"].shift());
|
|
5607
|
-
}
|
|
5608
|
-
}
|
|
5609
|
-
callRuntimeCallbacks(onPostRuns);
|
|
5610
|
-
}
|
|
5611
|
-
__name(postRun, "postRun");
|
|
5612
|
-
var runDependencies = 0;
|
|
5613
|
-
var dependenciesFulfilled = null;
|
|
5614
|
-
function getUniqueRunDependency(id) {
|
|
5615
|
-
return id;
|
|
5616
|
-
}
|
|
5617
|
-
__name(getUniqueRunDependency, "getUniqueRunDependency");
|
|
5618
|
-
function addRunDependency(id) {
|
|
5619
|
-
runDependencies++;
|
|
5620
|
-
Module["monitorRunDependencies"]?.(runDependencies);
|
|
5621
|
-
}
|
|
5622
|
-
__name(addRunDependency, "addRunDependency");
|
|
5623
|
-
function removeRunDependency(id) {
|
|
5624
|
-
runDependencies--;
|
|
5625
|
-
Module["monitorRunDependencies"]?.(runDependencies);
|
|
5626
|
-
if (runDependencies == 0) {
|
|
5627
|
-
if (dependenciesFulfilled) {
|
|
5628
|
-
var callback = dependenciesFulfilled;
|
|
5629
|
-
dependenciesFulfilled = null;
|
|
5630
|
-
callback();
|
|
5631
|
-
}
|
|
5632
|
-
}
|
|
5633
|
-
}
|
|
5634
|
-
__name(removeRunDependency, "removeRunDependency");
|
|
5635
|
-
function abort(what) {
|
|
5636
|
-
Module["onAbort"]?.(what);
|
|
5637
|
-
what = "Aborted(" + what + ")";
|
|
5638
|
-
err(what);
|
|
5639
|
-
ABORT = true;
|
|
5640
|
-
what += ". Build with -sASSERTIONS for more info.";
|
|
5641
|
-
var e = new WebAssembly.RuntimeError(what);
|
|
5642
|
-
readyPromiseReject(e);
|
|
5643
|
-
throw e;
|
|
5644
|
-
}
|
|
5645
|
-
__name(abort, "abort");
|
|
5646
|
-
var wasmBinaryFile;
|
|
5647
|
-
function findWasmBinary() {
|
|
5648
|
-
if (Module["locateFile"]) {
|
|
5649
|
-
return locateFile("tree-sitter.wasm");
|
|
5650
|
-
}
|
|
5651
|
-
return new URL("tree-sitter.wasm", import.meta.url).href;
|
|
5652
|
-
}
|
|
5653
|
-
__name(findWasmBinary, "findWasmBinary");
|
|
5654
|
-
function getBinarySync(file) {
|
|
5655
|
-
if (file == wasmBinaryFile && wasmBinary) {
|
|
5656
|
-
return new Uint8Array(wasmBinary);
|
|
5657
|
-
}
|
|
5658
|
-
if (readBinary) {
|
|
5659
|
-
return readBinary(file);
|
|
5660
|
-
}
|
|
5661
|
-
throw "both async and sync fetching of the wasm failed";
|
|
5662
|
-
}
|
|
5663
|
-
__name(getBinarySync, "getBinarySync");
|
|
5664
|
-
async function getWasmBinary(binaryFile) {
|
|
5665
|
-
if (!wasmBinary) {
|
|
5666
|
-
try {
|
|
5667
|
-
var response = await readAsync(binaryFile);
|
|
5668
|
-
return new Uint8Array(response);
|
|
5669
|
-
} catch {}
|
|
5670
|
-
}
|
|
5671
|
-
return getBinarySync(binaryFile);
|
|
5672
|
-
}
|
|
5673
|
-
__name(getWasmBinary, "getWasmBinary");
|
|
5674
|
-
async function instantiateArrayBuffer(binaryFile, imports) {
|
|
5675
|
-
try {
|
|
5676
|
-
var binary2 = await getWasmBinary(binaryFile);
|
|
5677
|
-
var instance2 = await WebAssembly.instantiate(binary2, imports);
|
|
5678
|
-
return instance2;
|
|
5679
|
-
} catch (reason) {
|
|
5680
|
-
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
5681
|
-
abort(reason);
|
|
5682
|
-
}
|
|
5683
|
-
}
|
|
5684
|
-
__name(instantiateArrayBuffer, "instantiateArrayBuffer");
|
|
5685
|
-
async function instantiateAsync(binary2, binaryFile, imports) {
|
|
5686
|
-
if (!binary2 && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) {
|
|
5687
|
-
try {
|
|
5688
|
-
var response = fetch(binaryFile, {
|
|
5689
|
-
credentials: "same-origin"
|
|
5690
|
-
});
|
|
5691
|
-
var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
|
|
5692
|
-
return instantiationResult;
|
|
5693
|
-
} catch (reason) {
|
|
5694
|
-
err(`wasm streaming compile failed: ${reason}`);
|
|
5695
|
-
err("falling back to ArrayBuffer instantiation");
|
|
5696
|
-
}
|
|
5697
|
-
}
|
|
5698
|
-
return instantiateArrayBuffer(binaryFile, imports);
|
|
5699
|
-
}
|
|
5700
|
-
__name(instantiateAsync, "instantiateAsync");
|
|
5701
|
-
function getWasmImports() {
|
|
5702
|
-
return {
|
|
5703
|
-
env: wasmImports,
|
|
5704
|
-
wasi_snapshot_preview1: wasmImports,
|
|
5705
|
-
"GOT.mem": new Proxy(wasmImports, GOTHandler),
|
|
5706
|
-
"GOT.func": new Proxy(wasmImports, GOTHandler)
|
|
5707
|
-
};
|
|
5708
|
-
}
|
|
5709
|
-
__name(getWasmImports, "getWasmImports");
|
|
5710
|
-
async function createWasm() {
|
|
5711
|
-
function receiveInstance(instance2, module2) {
|
|
5712
|
-
wasmExports = instance2.exports;
|
|
5713
|
-
wasmExports = relocateExports(wasmExports, 1024);
|
|
5714
|
-
var metadata2 = getDylinkMetadata(module2);
|
|
5715
|
-
if (metadata2.neededDynlibs) {
|
|
5716
|
-
dynamicLibraries = metadata2.neededDynlibs.concat(dynamicLibraries);
|
|
5717
|
-
}
|
|
5718
|
-
mergeLibSymbols(wasmExports, "main");
|
|
5719
|
-
LDSO.init();
|
|
5720
|
-
loadDylibs();
|
|
5721
|
-
__RELOC_FUNCS__.push(wasmExports["__wasm_apply_data_relocs"]);
|
|
5722
|
-
removeRunDependency("wasm-instantiate");
|
|
5723
|
-
return wasmExports;
|
|
5724
|
-
}
|
|
5725
|
-
__name(receiveInstance, "receiveInstance");
|
|
5726
|
-
addRunDependency("wasm-instantiate");
|
|
5727
|
-
function receiveInstantiationResult(result2) {
|
|
5728
|
-
return receiveInstance(result2["instance"], result2["module"]);
|
|
5729
|
-
}
|
|
5730
|
-
__name(receiveInstantiationResult, "receiveInstantiationResult");
|
|
5731
|
-
var info2 = getWasmImports();
|
|
5732
|
-
if (Module["instantiateWasm"]) {
|
|
5733
|
-
return new Promise((resolve, reject) => {
|
|
5734
|
-
Module["instantiateWasm"](info2, (mod, inst) => {
|
|
5735
|
-
receiveInstance(mod, inst);
|
|
5736
|
-
resolve(mod.exports);
|
|
5737
|
-
});
|
|
5738
|
-
});
|
|
5739
|
-
}
|
|
5740
|
-
wasmBinaryFile ??= findWasmBinary();
|
|
5741
|
-
try {
|
|
5742
|
-
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info2);
|
|
5743
|
-
var exports = receiveInstantiationResult(result);
|
|
5744
|
-
return exports;
|
|
5745
|
-
} catch (e) {
|
|
5746
|
-
readyPromiseReject(e);
|
|
5747
|
-
return Promise.reject(e);
|
|
5748
|
-
}
|
|
5687
|
+
return true;
|
|
5688
|
+
}, "isSymbolDefined");
|
|
5689
|
+
var dynCall = /* @__PURE__ */ __name((sig, ptr, args2 = [], promising = false) => {
|
|
5690
|
+
var func2 = getWasmTableEntry(ptr);
|
|
5691
|
+
var rtn = func2(...args2);
|
|
5692
|
+
function convert(rtn2) {
|
|
5693
|
+
return rtn2;
|
|
5694
|
+
}
|
|
5695
|
+
__name(convert, "convert");
|
|
5696
|
+
return convert(rtn);
|
|
5697
|
+
}, "dynCall");
|
|
5698
|
+
var stackSave = /* @__PURE__ */ __name(() => _emscripten_stack_get_current(), "stackSave");
|
|
5699
|
+
var stackRestore = /* @__PURE__ */ __name((val) => __emscripten_stack_restore(val), "stackRestore");
|
|
5700
|
+
var createInvokeFunction = /* @__PURE__ */ __name((sig) => (ptr, ...args2) => {
|
|
5701
|
+
var sp = stackSave();
|
|
5702
|
+
try {
|
|
5703
|
+
return dynCall(sig, ptr, args2);
|
|
5704
|
+
} catch (e) {
|
|
5705
|
+
stackRestore(sp);
|
|
5706
|
+
if (e !== e + 0)
|
|
5707
|
+
throw e;
|
|
5708
|
+
_setThrew(1, 0);
|
|
5709
|
+
if (sig[0] == "j")
|
|
5710
|
+
return 0n;
|
|
5711
|
+
}
|
|
5712
|
+
}, "createInvokeFunction");
|
|
5713
|
+
var resolveGlobalSymbol = /* @__PURE__ */ __name((symName, direct = false) => {
|
|
5714
|
+
var sym;
|
|
5715
|
+
if (isSymbolDefined(symName)) {
|
|
5716
|
+
sym = wasmImports[symName];
|
|
5717
|
+
} else if (symName.startsWith("invoke_")) {
|
|
5718
|
+
sym = wasmImports[symName] = createInvokeFunction(symName.split("_")[1]);
|
|
5749
5719
|
}
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
class ExitStatus {
|
|
5754
|
-
static {
|
|
5755
|
-
__name(this, "ExitStatus");
|
|
5756
|
-
}
|
|
5757
|
-
name = "ExitStatus";
|
|
5758
|
-
constructor(status) {
|
|
5759
|
-
this.message = `Program terminated with exit(${status})`;
|
|
5760
|
-
this.status = status;
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5763
|
-
var GOT = {};
|
|
5764
|
-
var currentModuleWeakSymbols = /* @__PURE__ */ new Set([]);
|
|
5765
|
-
var GOTHandler = {
|
|
5766
|
-
get(obj, symName) {
|
|
5767
|
-
var rtn = GOT[symName];
|
|
5768
|
-
if (!rtn) {
|
|
5769
|
-
rtn = GOT[symName] = new WebAssembly.Global({
|
|
5770
|
-
value: "i32",
|
|
5771
|
-
mutable: true
|
|
5772
|
-
});
|
|
5773
|
-
}
|
|
5774
|
-
if (!currentModuleWeakSymbols.has(symName)) {
|
|
5775
|
-
rtn.required = true;
|
|
5776
|
-
}
|
|
5777
|
-
return rtn;
|
|
5778
|
-
}
|
|
5720
|
+
return {
|
|
5721
|
+
sym,
|
|
5722
|
+
name: symName
|
|
5779
5723
|
};
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
var
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
5806
|
-
++endPtr;
|
|
5807
|
-
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
5808
|
-
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
5809
|
-
}
|
|
5810
|
-
var str = "";
|
|
5811
|
-
while (idx < endPtr) {
|
|
5812
|
-
var u0 = heapOrArray[idx++];
|
|
5813
|
-
if (!(u0 & 128)) {
|
|
5814
|
-
str += String.fromCharCode(u0);
|
|
5815
|
-
continue;
|
|
5816
|
-
}
|
|
5817
|
-
var u1 = heapOrArray[idx++] & 63;
|
|
5818
|
-
if ((u0 & 224) == 192) {
|
|
5819
|
-
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
5820
|
-
continue;
|
|
5821
|
-
}
|
|
5822
|
-
var u2 = heapOrArray[idx++] & 63;
|
|
5823
|
-
if ((u0 & 240) == 224) {
|
|
5824
|
-
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
5825
|
-
} else {
|
|
5826
|
-
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
5827
|
-
}
|
|
5828
|
-
if (u0 < 65536) {
|
|
5829
|
-
str += String.fromCharCode(u0);
|
|
5830
|
-
} else {
|
|
5831
|
-
var ch = u0 - 65536;
|
|
5832
|
-
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
5833
|
-
}
|
|
5834
|
-
}
|
|
5835
|
-
return str;
|
|
5836
|
-
}, "UTF8ArrayToString");
|
|
5837
|
-
var getDylinkMetadata = /* @__PURE__ */ __name((binary2) => {
|
|
5838
|
-
var offset = 0;
|
|
5839
|
-
var end = 0;
|
|
5840
|
-
function getU8() {
|
|
5841
|
-
return binary2[offset++];
|
|
5842
|
-
}
|
|
5843
|
-
__name(getU8, "getU8");
|
|
5844
|
-
function getLEB() {
|
|
5845
|
-
var ret = 0;
|
|
5846
|
-
var mul = 1;
|
|
5847
|
-
while (true) {
|
|
5848
|
-
var byte = binary2[offset++];
|
|
5849
|
-
ret += (byte & 127) * mul;
|
|
5850
|
-
mul *= 128;
|
|
5851
|
-
if (!(byte & 128))
|
|
5852
|
-
break;
|
|
5853
|
-
}
|
|
5854
|
-
return ret;
|
|
5855
|
-
}
|
|
5856
|
-
__name(getLEB, "getLEB");
|
|
5857
|
-
function getString() {
|
|
5858
|
-
var len = getLEB();
|
|
5859
|
-
offset += len;
|
|
5860
|
-
return UTF8ArrayToString(binary2, offset - len, len);
|
|
5861
|
-
}
|
|
5862
|
-
__name(getString, "getString");
|
|
5863
|
-
function failIf(condition, message) {
|
|
5864
|
-
if (condition)
|
|
5865
|
-
throw new Error(message);
|
|
5866
|
-
}
|
|
5867
|
-
__name(failIf, "failIf");
|
|
5868
|
-
var name2 = "dylink.0";
|
|
5869
|
-
if (binary2 instanceof WebAssembly.Module) {
|
|
5870
|
-
var dylinkSection = WebAssembly.Module.customSections(binary2, name2);
|
|
5871
|
-
if (dylinkSection.length === 0) {
|
|
5872
|
-
name2 = "dylink";
|
|
5873
|
-
dylinkSection = WebAssembly.Module.customSections(binary2, name2);
|
|
5724
|
+
}, "resolveGlobalSymbol");
|
|
5725
|
+
var onPostCtors = [];
|
|
5726
|
+
var addOnPostCtor = /* @__PURE__ */ __name((cb) => onPostCtors.push(cb), "addOnPostCtor");
|
|
5727
|
+
var UTF8ToString = /* @__PURE__ */ __name((ptr, maxBytesToRead, ignoreNul) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : "", "UTF8ToString");
|
|
5728
|
+
var loadWebAssemblyModule = /* @__PURE__ */ __name((binary, flags, libName, localScope, handle) => {
|
|
5729
|
+
var metadata = getDylinkMetadata(binary);
|
|
5730
|
+
function loadModule() {
|
|
5731
|
+
var memAlign = Math.pow(2, metadata.memoryAlign);
|
|
5732
|
+
var memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0;
|
|
5733
|
+
var tableBase = metadata.tableSize ? wasmTable.length : 0;
|
|
5734
|
+
if (handle) {
|
|
5735
|
+
HEAP8[handle + 8] = 1;
|
|
5736
|
+
LE_HEAP_STORE_U32((handle + 12 >> 2) * 4, memoryBase);
|
|
5737
|
+
LE_HEAP_STORE_I32((handle + 16 >> 2) * 4, metadata.memorySize);
|
|
5738
|
+
LE_HEAP_STORE_U32((handle + 20 >> 2) * 4, tableBase);
|
|
5739
|
+
LE_HEAP_STORE_I32((handle + 24 >> 2) * 4, metadata.tableSize);
|
|
5740
|
+
}
|
|
5741
|
+
if (metadata.tableSize) {
|
|
5742
|
+
wasmTable.grow(metadata.tableSize);
|
|
5743
|
+
}
|
|
5744
|
+
var moduleExports;
|
|
5745
|
+
function resolveSymbol(sym) {
|
|
5746
|
+
var resolved = resolveGlobalSymbol(sym).sym;
|
|
5747
|
+
if (!resolved && localScope) {
|
|
5748
|
+
resolved = localScope[sym];
|
|
5874
5749
|
}
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
end = binary2.length;
|
|
5878
|
-
} else {
|
|
5879
|
-
var int32View = new Uint32Array(new Uint8Array(binary2.subarray(0, 24)).buffer);
|
|
5880
|
-
var magicNumberFound = int32View[0] == 1836278016 || int32View[0] == 6386541;
|
|
5881
|
-
failIf(!magicNumberFound, "need to see wasm magic number");
|
|
5882
|
-
failIf(binary2[8] !== 0, "need the dylink section to be first");
|
|
5883
|
-
offset = 9;
|
|
5884
|
-
var section_size = getLEB();
|
|
5885
|
-
end = offset + section_size;
|
|
5886
|
-
name2 = getString();
|
|
5887
|
-
}
|
|
5888
|
-
var customSection = {
|
|
5889
|
-
neededDynlibs: [],
|
|
5890
|
-
tlsExports: /* @__PURE__ */ new Set,
|
|
5891
|
-
weakImports: /* @__PURE__ */ new Set
|
|
5892
|
-
};
|
|
5893
|
-
if (name2 == "dylink") {
|
|
5894
|
-
customSection.memorySize = getLEB();
|
|
5895
|
-
customSection.memoryAlign = getLEB();
|
|
5896
|
-
customSection.tableSize = getLEB();
|
|
5897
|
-
customSection.tableAlign = getLEB();
|
|
5898
|
-
var neededDynlibsCount = getLEB();
|
|
5899
|
-
for (var i2 = 0;i2 < neededDynlibsCount; ++i2) {
|
|
5900
|
-
var libname = getString();
|
|
5901
|
-
customSection.neededDynlibs.push(libname);
|
|
5750
|
+
if (!resolved) {
|
|
5751
|
+
resolved = moduleExports[sym];
|
|
5902
5752
|
}
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
var subsectionType = getU8();
|
|
5914
|
-
var subsectionSize = getLEB();
|
|
5915
|
-
if (subsectionType === WASM_DYLINK_MEM_INFO) {
|
|
5916
|
-
customSection.memorySize = getLEB();
|
|
5917
|
-
customSection.memoryAlign = getLEB();
|
|
5918
|
-
customSection.tableSize = getLEB();
|
|
5919
|
-
customSection.tableAlign = getLEB();
|
|
5920
|
-
} else if (subsectionType === WASM_DYLINK_NEEDED) {
|
|
5921
|
-
var neededDynlibsCount = getLEB();
|
|
5922
|
-
for (var i2 = 0;i2 < neededDynlibsCount; ++i2) {
|
|
5923
|
-
libname = getString();
|
|
5924
|
-
customSection.neededDynlibs.push(libname);
|
|
5925
|
-
}
|
|
5926
|
-
} else if (subsectionType === WASM_DYLINK_EXPORT_INFO) {
|
|
5927
|
-
var count = getLEB();
|
|
5928
|
-
while (count--) {
|
|
5929
|
-
var symname = getString();
|
|
5930
|
-
var flags2 = getLEB();
|
|
5931
|
-
if (flags2 & WASM_SYMBOL_TLS) {
|
|
5932
|
-
customSection.tlsExports.add(symname);
|
|
5933
|
-
}
|
|
5934
|
-
}
|
|
5935
|
-
} else if (subsectionType === WASM_DYLINK_IMPORT_INFO) {
|
|
5936
|
-
var count = getLEB();
|
|
5937
|
-
while (count--) {
|
|
5938
|
-
var modname = getString();
|
|
5939
|
-
var symname = getString();
|
|
5940
|
-
var flags2 = getLEB();
|
|
5941
|
-
if ((flags2 & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {
|
|
5942
|
-
customSection.weakImports.add(symname);
|
|
5943
|
-
}
|
|
5944
|
-
}
|
|
5945
|
-
} else {
|
|
5946
|
-
offset += subsectionSize;
|
|
5753
|
+
return resolved;
|
|
5754
|
+
}
|
|
5755
|
+
__name(resolveSymbol, "resolveSymbol");
|
|
5756
|
+
var proxyHandler = {
|
|
5757
|
+
get(stubs, prop) {
|
|
5758
|
+
switch (prop) {
|
|
5759
|
+
case "__memory_base":
|
|
5760
|
+
return memoryBase;
|
|
5761
|
+
case "__table_base":
|
|
5762
|
+
return tableBase;
|
|
5947
5763
|
}
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
}, "getDylinkMetadata");
|
|
5952
|
-
function getValue(ptr, type = "i8") {
|
|
5953
|
-
if (type.endsWith("*"))
|
|
5954
|
-
type = "*";
|
|
5955
|
-
switch (type) {
|
|
5956
|
-
case "i1":
|
|
5957
|
-
return HEAP8[ptr];
|
|
5958
|
-
case "i8":
|
|
5959
|
-
return HEAP8[ptr];
|
|
5960
|
-
case "i16":
|
|
5961
|
-
return LE_HEAP_LOAD_I16((ptr >> 1) * 2);
|
|
5962
|
-
case "i32":
|
|
5963
|
-
return LE_HEAP_LOAD_I32((ptr >> 2) * 4);
|
|
5964
|
-
case "i64":
|
|
5965
|
-
return HEAP64[ptr >> 3];
|
|
5966
|
-
case "float":
|
|
5967
|
-
return LE_HEAP_LOAD_F32((ptr >> 2) * 4);
|
|
5968
|
-
case "double":
|
|
5969
|
-
return LE_HEAP_LOAD_F64((ptr >> 3) * 8);
|
|
5970
|
-
case "*":
|
|
5971
|
-
return LE_HEAP_LOAD_U32((ptr >> 2) * 4);
|
|
5972
|
-
default:
|
|
5973
|
-
abort(`invalid type for getValue: ${type}`);
|
|
5974
|
-
}
|
|
5975
|
-
}
|
|
5976
|
-
__name(getValue, "getValue");
|
|
5977
|
-
var newDSO = /* @__PURE__ */ __name((name2, handle2, syms) => {
|
|
5978
|
-
var dso = {
|
|
5979
|
-
refcount: Infinity,
|
|
5980
|
-
name: name2,
|
|
5981
|
-
exports: syms,
|
|
5982
|
-
global: true
|
|
5983
|
-
};
|
|
5984
|
-
LDSO.loadedLibsByName[name2] = dso;
|
|
5985
|
-
if (handle2 != null) {
|
|
5986
|
-
LDSO.loadedLibsByHandle[handle2] = dso;
|
|
5987
|
-
}
|
|
5988
|
-
return dso;
|
|
5989
|
-
}, "newDSO");
|
|
5990
|
-
var LDSO = {
|
|
5991
|
-
loadedLibsByName: {},
|
|
5992
|
-
loadedLibsByHandle: {},
|
|
5993
|
-
init() {
|
|
5994
|
-
newDSO("__main__", 0, wasmImports);
|
|
5995
|
-
}
|
|
5996
|
-
};
|
|
5997
|
-
var ___heap_base = 78224;
|
|
5998
|
-
var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
|
|
5999
|
-
var getMemory = /* @__PURE__ */ __name((size) => {
|
|
6000
|
-
if (runtimeInitialized) {
|
|
6001
|
-
return _calloc(size, 1);
|
|
6002
|
-
}
|
|
6003
|
-
var ret = ___heap_base;
|
|
6004
|
-
var end = ret + alignMemory(size, 16);
|
|
6005
|
-
___heap_base = end;
|
|
6006
|
-
GOT["__heap_base"].value = end;
|
|
6007
|
-
return ret;
|
|
6008
|
-
}, "getMemory");
|
|
6009
|
-
var isInternalSym = /* @__PURE__ */ __name((symName) => ["__cpp_exception", "__c_longjmp", "__wasm_apply_data_relocs", "__dso_handle", "__tls_size", "__tls_align", "__set_stack_limits", "_emscripten_tls_init", "__wasm_init_tls", "__wasm_call_ctors", "__start_em_asm", "__stop_em_asm", "__start_em_js", "__stop_em_js"].includes(symName) || symName.startsWith("__em_js__"), "isInternalSym");
|
|
6010
|
-
var uleb128Encode = /* @__PURE__ */ __name((n, target) => {
|
|
6011
|
-
if (n < 128) {
|
|
6012
|
-
target.push(n);
|
|
6013
|
-
} else {
|
|
6014
|
-
target.push(n % 128 | 128, n >> 7);
|
|
6015
|
-
}
|
|
6016
|
-
}, "uleb128Encode");
|
|
6017
|
-
var sigToWasmTypes = /* @__PURE__ */ __name((sig) => {
|
|
6018
|
-
var typeNames = {
|
|
6019
|
-
i: "i32",
|
|
6020
|
-
j: "i64",
|
|
6021
|
-
f: "f32",
|
|
6022
|
-
d: "f64",
|
|
6023
|
-
e: "externref",
|
|
6024
|
-
p: "i32"
|
|
6025
|
-
};
|
|
6026
|
-
var type = {
|
|
6027
|
-
parameters: [],
|
|
6028
|
-
results: sig[0] == "v" ? [] : [typeNames[sig[0]]]
|
|
6029
|
-
};
|
|
6030
|
-
for (var i2 = 1;i2 < sig.length; ++i2) {
|
|
6031
|
-
type.parameters.push(typeNames[sig[i2]]);
|
|
6032
|
-
}
|
|
6033
|
-
return type;
|
|
6034
|
-
}, "sigToWasmTypes");
|
|
6035
|
-
var generateFuncType = /* @__PURE__ */ __name((sig, target) => {
|
|
6036
|
-
var sigRet = sig.slice(0, 1);
|
|
6037
|
-
var sigParam = sig.slice(1);
|
|
6038
|
-
var typeCodes = {
|
|
6039
|
-
i: 127,
|
|
6040
|
-
p: 127,
|
|
6041
|
-
j: 126,
|
|
6042
|
-
f: 125,
|
|
6043
|
-
d: 124,
|
|
6044
|
-
e: 111
|
|
6045
|
-
};
|
|
6046
|
-
target.push(96);
|
|
6047
|
-
uleb128Encode(sigParam.length, target);
|
|
6048
|
-
for (var i2 = 0;i2 < sigParam.length; ++i2) {
|
|
6049
|
-
target.push(typeCodes[sigParam[i2]]);
|
|
6050
|
-
}
|
|
6051
|
-
if (sigRet == "v") {
|
|
6052
|
-
target.push(0);
|
|
6053
|
-
} else {
|
|
6054
|
-
target.push(1, typeCodes[sigRet]);
|
|
6055
|
-
}
|
|
6056
|
-
}, "generateFuncType");
|
|
6057
|
-
var convertJsFunctionToWasm = /* @__PURE__ */ __name((func2, sig) => {
|
|
6058
|
-
if (typeof WebAssembly.Function == "function") {
|
|
6059
|
-
return new WebAssembly.Function(sigToWasmTypes(sig), func2);
|
|
6060
|
-
}
|
|
6061
|
-
var typeSectionBody = [1];
|
|
6062
|
-
generateFuncType(sig, typeSectionBody);
|
|
6063
|
-
var bytes = [
|
|
6064
|
-
0,
|
|
6065
|
-
97,
|
|
6066
|
-
115,
|
|
6067
|
-
109,
|
|
6068
|
-
1,
|
|
6069
|
-
0,
|
|
6070
|
-
0,
|
|
6071
|
-
0,
|
|
6072
|
-
1
|
|
6073
|
-
];
|
|
6074
|
-
uleb128Encode(typeSectionBody.length, bytes);
|
|
6075
|
-
bytes.push(...typeSectionBody);
|
|
6076
|
-
bytes.push(2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0);
|
|
6077
|
-
var module2 = new WebAssembly.Module(new Uint8Array(bytes));
|
|
6078
|
-
var instance2 = new WebAssembly.Instance(module2, {
|
|
6079
|
-
e: {
|
|
6080
|
-
f: func2
|
|
6081
|
-
}
|
|
6082
|
-
});
|
|
6083
|
-
var wrappedFunc = instance2.exports["f"];
|
|
6084
|
-
return wrappedFunc;
|
|
6085
|
-
}, "convertJsFunctionToWasm");
|
|
6086
|
-
var wasmTableMirror = [];
|
|
6087
|
-
var wasmTable = new WebAssembly.Table({
|
|
6088
|
-
initial: 31,
|
|
6089
|
-
element: "anyfunc"
|
|
6090
|
-
});
|
|
6091
|
-
var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
|
|
6092
|
-
var func2 = wasmTableMirror[funcPtr];
|
|
6093
|
-
if (!func2) {
|
|
6094
|
-
if (funcPtr >= wasmTableMirror.length)
|
|
6095
|
-
wasmTableMirror.length = funcPtr + 1;
|
|
6096
|
-
wasmTableMirror[funcPtr] = func2 = wasmTable.get(funcPtr);
|
|
6097
|
-
}
|
|
6098
|
-
return func2;
|
|
6099
|
-
}, "getWasmTableEntry");
|
|
6100
|
-
var updateTableMap = /* @__PURE__ */ __name((offset, count) => {
|
|
6101
|
-
if (functionsInTableMap) {
|
|
6102
|
-
for (var i2 = offset;i2 < offset + count; i2++) {
|
|
6103
|
-
var item = getWasmTableEntry(i2);
|
|
6104
|
-
if (item) {
|
|
6105
|
-
functionsInTableMap.set(item, i2);
|
|
5764
|
+
if (prop in wasmImports && !wasmImports[prop].stub) {
|
|
5765
|
+
var res = wasmImports[prop];
|
|
5766
|
+
return res;
|
|
6106
5767
|
}
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
functionsInTableMap = /* @__PURE__ */ new WeakMap;
|
|
6114
|
-
updateTableMap(0, wasmTable.length);
|
|
6115
|
-
}
|
|
6116
|
-
return functionsInTableMap.get(func2) || 0;
|
|
6117
|
-
}, "getFunctionAddress");
|
|
6118
|
-
var freeTableIndexes = [];
|
|
6119
|
-
var getEmptyTableSlot = /* @__PURE__ */ __name(() => {
|
|
6120
|
-
if (freeTableIndexes.length) {
|
|
6121
|
-
return freeTableIndexes.pop();
|
|
6122
|
-
}
|
|
6123
|
-
try {
|
|
6124
|
-
wasmTable.grow(1);
|
|
6125
|
-
} catch (err2) {
|
|
6126
|
-
if (!(err2 instanceof RangeError)) {
|
|
6127
|
-
throw err2;
|
|
6128
|
-
}
|
|
6129
|
-
throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
|
|
6130
|
-
}
|
|
6131
|
-
return wasmTable.length - 1;
|
|
6132
|
-
}, "getEmptyTableSlot");
|
|
6133
|
-
var setWasmTableEntry = /* @__PURE__ */ __name((idx, func2) => {
|
|
6134
|
-
wasmTable.set(idx, func2);
|
|
6135
|
-
wasmTableMirror[idx] = wasmTable.get(idx);
|
|
6136
|
-
}, "setWasmTableEntry");
|
|
6137
|
-
var addFunction = /* @__PURE__ */ __name((func2, sig) => {
|
|
6138
|
-
var rtn = getFunctionAddress(func2);
|
|
6139
|
-
if (rtn) {
|
|
6140
|
-
return rtn;
|
|
6141
|
-
}
|
|
6142
|
-
var ret = getEmptyTableSlot();
|
|
6143
|
-
try {
|
|
6144
|
-
setWasmTableEntry(ret, func2);
|
|
6145
|
-
} catch (err2) {
|
|
6146
|
-
if (!(err2 instanceof TypeError)) {
|
|
6147
|
-
throw err2;
|
|
6148
|
-
}
|
|
6149
|
-
var wrapped = convertJsFunctionToWasm(func2, sig);
|
|
6150
|
-
setWasmTableEntry(ret, wrapped);
|
|
6151
|
-
}
|
|
6152
|
-
functionsInTableMap.set(func2, ret);
|
|
6153
|
-
return ret;
|
|
6154
|
-
}, "addFunction");
|
|
6155
|
-
var updateGOT = /* @__PURE__ */ __name((exports, replace) => {
|
|
6156
|
-
for (var symName in exports) {
|
|
6157
|
-
if (isInternalSym(symName)) {
|
|
6158
|
-
continue;
|
|
6159
|
-
}
|
|
6160
|
-
var value = exports[symName];
|
|
6161
|
-
GOT[symName] ||= new WebAssembly.Global({
|
|
6162
|
-
value: "i32",
|
|
6163
|
-
mutable: true
|
|
6164
|
-
});
|
|
6165
|
-
if (replace || GOT[symName].value == 0) {
|
|
6166
|
-
if (typeof value == "function") {
|
|
6167
|
-
GOT[symName].value = addFunction(value);
|
|
6168
|
-
} else if (typeof value == "number") {
|
|
6169
|
-
GOT[symName].value = value;
|
|
6170
|
-
} else {
|
|
6171
|
-
err(`unhandled export type for '${symName}': ${typeof value}`);
|
|
5768
|
+
if (!(prop in stubs)) {
|
|
5769
|
+
var resolved;
|
|
5770
|
+
stubs[prop] = (...args2) => {
|
|
5771
|
+
resolved ||= resolveSymbol(prop);
|
|
5772
|
+
return resolved(...args2);
|
|
5773
|
+
};
|
|
6172
5774
|
}
|
|
5775
|
+
return stubs[prop];
|
|
6173
5776
|
}
|
|
6174
|
-
}
|
|
6175
|
-
}, "updateGOT");
|
|
6176
|
-
var relocateExports = /* @__PURE__ */ __name((exports, memoryBase2, replace) => {
|
|
6177
|
-
var relocated = {};
|
|
6178
|
-
for (var e in exports) {
|
|
6179
|
-
var value = exports[e];
|
|
6180
|
-
if (typeof value == "object") {
|
|
6181
|
-
value = value.value;
|
|
6182
|
-
}
|
|
6183
|
-
if (typeof value == "number") {
|
|
6184
|
-
value += memoryBase2;
|
|
6185
|
-
}
|
|
6186
|
-
relocated[e] = value;
|
|
6187
|
-
}
|
|
6188
|
-
updateGOT(relocated, replace);
|
|
6189
|
-
return relocated;
|
|
6190
|
-
}, "relocateExports");
|
|
6191
|
-
var isSymbolDefined = /* @__PURE__ */ __name((symName) => {
|
|
6192
|
-
var existing = wasmImports[symName];
|
|
6193
|
-
if (!existing || existing.stub) {
|
|
6194
|
-
return false;
|
|
6195
|
-
}
|
|
6196
|
-
return true;
|
|
6197
|
-
}, "isSymbolDefined");
|
|
6198
|
-
var dynCall = /* @__PURE__ */ __name((sig, ptr, args2 = []) => {
|
|
6199
|
-
var rtn = getWasmTableEntry(ptr)(...args2);
|
|
6200
|
-
return rtn;
|
|
6201
|
-
}, "dynCall");
|
|
6202
|
-
var stackSave = /* @__PURE__ */ __name(() => _emscripten_stack_get_current(), "stackSave");
|
|
6203
|
-
var stackRestore = /* @__PURE__ */ __name((val) => __emscripten_stack_restore(val), "stackRestore");
|
|
6204
|
-
var createInvokeFunction = /* @__PURE__ */ __name((sig) => (ptr, ...args2) => {
|
|
6205
|
-
var sp = stackSave();
|
|
6206
|
-
try {
|
|
6207
|
-
return dynCall(sig, ptr, args2);
|
|
6208
|
-
} catch (e) {
|
|
6209
|
-
stackRestore(sp);
|
|
6210
|
-
if (e !== e + 0)
|
|
6211
|
-
throw e;
|
|
6212
|
-
_setThrew(1, 0);
|
|
6213
|
-
if (sig[0] == "j")
|
|
6214
|
-
return 0n;
|
|
6215
|
-
}
|
|
6216
|
-
}, "createInvokeFunction");
|
|
6217
|
-
var resolveGlobalSymbol = /* @__PURE__ */ __name((symName, direct = false) => {
|
|
6218
|
-
var sym;
|
|
6219
|
-
if (isSymbolDefined(symName)) {
|
|
6220
|
-
sym = wasmImports[symName];
|
|
6221
|
-
} else if (symName.startsWith("invoke_")) {
|
|
6222
|
-
sym = wasmImports[symName] = createInvokeFunction(symName.split("_")[1]);
|
|
6223
|
-
}
|
|
6224
|
-
return {
|
|
6225
|
-
sym,
|
|
6226
|
-
name: symName
|
|
6227
5777
|
};
|
|
6228
|
-
|
|
6229
|
-
var onPostCtors = [];
|
|
6230
|
-
var addOnPostCtor = /* @__PURE__ */ __name((cb) => onPostCtors.unshift(cb), "addOnPostCtor");
|
|
6231
|
-
var UTF8ToString = /* @__PURE__ */ __name((ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "", "UTF8ToString");
|
|
6232
|
-
var loadWebAssemblyModule = /* @__PURE__ */ __name((binary, flags, libName, localScope, handle) => {
|
|
6233
|
-
var metadata = getDylinkMetadata(binary);
|
|
5778
|
+
var proxy = new Proxy({}, proxyHandler);
|
|
6234
5779
|
currentModuleWeakSymbols = metadata.weakImports;
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
if (metadata.tableSize) {
|
|
6247
|
-
wasmTable.grow(metadata.tableSize);
|
|
6248
|
-
}
|
|
6249
|
-
var moduleExports;
|
|
6250
|
-
function resolveSymbol(sym) {
|
|
6251
|
-
var resolved = resolveGlobalSymbol(sym).sym;
|
|
6252
|
-
if (!resolved && localScope) {
|
|
6253
|
-
resolved = localScope[sym];
|
|
6254
|
-
}
|
|
6255
|
-
if (!resolved) {
|
|
6256
|
-
resolved = moduleExports[sym];
|
|
6257
|
-
}
|
|
6258
|
-
return resolved;
|
|
5780
|
+
var info = {
|
|
5781
|
+
"GOT.mem": new Proxy({}, GOTHandler),
|
|
5782
|
+
"GOT.func": new Proxy({}, GOTHandler),
|
|
5783
|
+
env: proxy,
|
|
5784
|
+
wasi_snapshot_preview1: proxy
|
|
5785
|
+
};
|
|
5786
|
+
function postInstantiation(module, instance) {
|
|
5787
|
+
updateTableMap(tableBase, metadata.tableSize);
|
|
5788
|
+
moduleExports = relocateExports(instance.exports, memoryBase);
|
|
5789
|
+
if (!flags.allowUndefined) {
|
|
5790
|
+
reportUndefinedSymbols();
|
|
6259
5791
|
}
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
case "__table_base":
|
|
6267
|
-
return tableBase;
|
|
6268
|
-
}
|
|
6269
|
-
if (prop in wasmImports && !wasmImports[prop].stub) {
|
|
6270
|
-
var res = wasmImports[prop];
|
|
6271
|
-
return res;
|
|
6272
|
-
}
|
|
6273
|
-
if (!(prop in stubs)) {
|
|
6274
|
-
var resolved;
|
|
6275
|
-
stubs[prop] = (...args2) => {
|
|
6276
|
-
resolved ||= resolveSymbol(prop);
|
|
6277
|
-
return resolved(...args2);
|
|
6278
|
-
};
|
|
6279
|
-
}
|
|
6280
|
-
return stubs[prop];
|
|
6281
|
-
}
|
|
6282
|
-
};
|
|
6283
|
-
var proxy = new Proxy({}, proxyHandler);
|
|
6284
|
-
var info = {
|
|
6285
|
-
"GOT.mem": new Proxy({}, GOTHandler),
|
|
6286
|
-
"GOT.func": new Proxy({}, GOTHandler),
|
|
6287
|
-
env: proxy,
|
|
6288
|
-
wasi_snapshot_preview1: proxy
|
|
6289
|
-
};
|
|
6290
|
-
function postInstantiation(module, instance) {
|
|
6291
|
-
updateTableMap(tableBase, metadata.tableSize);
|
|
6292
|
-
moduleExports = relocateExports(instance.exports, memoryBase);
|
|
6293
|
-
if (!flags.allowUndefined) {
|
|
6294
|
-
reportUndefinedSymbols();
|
|
6295
|
-
}
|
|
6296
|
-
function addEmAsm(addr, body) {
|
|
6297
|
-
var args = [];
|
|
6298
|
-
var arity = 0;
|
|
6299
|
-
for (;arity < 16; arity++) {
|
|
6300
|
-
if (body.indexOf("$" + arity) != -1) {
|
|
6301
|
-
args.push("$" + arity);
|
|
6302
|
-
} else {
|
|
6303
|
-
break;
|
|
6304
|
-
}
|
|
6305
|
-
}
|
|
6306
|
-
args = args.join(",");
|
|
6307
|
-
var func = `(${args}) => { ${body} };`;
|
|
6308
|
-
ASM_CONSTS[start] = eval(func);
|
|
6309
|
-
}
|
|
6310
|
-
__name(addEmAsm, "addEmAsm");
|
|
6311
|
-
if ("__start_em_asm" in moduleExports) {
|
|
6312
|
-
var start = moduleExports["__start_em_asm"];
|
|
6313
|
-
var stop = moduleExports["__stop_em_asm"];
|
|
6314
|
-
while (start < stop) {
|
|
6315
|
-
var jsString = UTF8ToString(start);
|
|
6316
|
-
addEmAsm(start, jsString);
|
|
6317
|
-
start = HEAPU8.indexOf(0, start) + 1;
|
|
6318
|
-
}
|
|
6319
|
-
}
|
|
6320
|
-
function addEmJs(name, cSig, body) {
|
|
6321
|
-
var jsArgs = [];
|
|
6322
|
-
cSig = cSig.slice(1, -1);
|
|
6323
|
-
if (cSig != "void") {
|
|
6324
|
-
cSig = cSig.split(",");
|
|
6325
|
-
for (var i in cSig) {
|
|
6326
|
-
var jsArg = cSig[i].split(" ").pop();
|
|
6327
|
-
jsArgs.push(jsArg.replace("*", ""));
|
|
6328
|
-
}
|
|
6329
|
-
}
|
|
6330
|
-
var func = `(${jsArgs}) => ${body};`;
|
|
6331
|
-
moduleExports[name] = eval(func);
|
|
6332
|
-
}
|
|
6333
|
-
__name(addEmJs, "addEmJs");
|
|
6334
|
-
for (var name in moduleExports) {
|
|
6335
|
-
if (name.startsWith("__em_js__")) {
|
|
6336
|
-
var start = moduleExports[name];
|
|
6337
|
-
var jsString = UTF8ToString(start);
|
|
6338
|
-
var parts = jsString.split("<::>");
|
|
6339
|
-
addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]);
|
|
6340
|
-
delete moduleExports[name];
|
|
6341
|
-
}
|
|
6342
|
-
}
|
|
6343
|
-
var applyRelocs = moduleExports["__wasm_apply_data_relocs"];
|
|
6344
|
-
if (applyRelocs) {
|
|
6345
|
-
if (runtimeInitialized) {
|
|
6346
|
-
applyRelocs();
|
|
6347
|
-
} else {
|
|
6348
|
-
__RELOC_FUNCS__.push(applyRelocs);
|
|
6349
|
-
}
|
|
6350
|
-
}
|
|
6351
|
-
var init = moduleExports["__wasm_call_ctors"];
|
|
6352
|
-
if (init) {
|
|
6353
|
-
if (runtimeInitialized) {
|
|
6354
|
-
init();
|
|
5792
|
+
function addEmAsm(addr, body) {
|
|
5793
|
+
var args = [];
|
|
5794
|
+
var arity = 0;
|
|
5795
|
+
for (;arity < 16; arity++) {
|
|
5796
|
+
if (body.indexOf("$" + arity) != -1) {
|
|
5797
|
+
args.push("$" + arity);
|
|
6355
5798
|
} else {
|
|
6356
|
-
|
|
5799
|
+
break;
|
|
6357
5800
|
}
|
|
6358
5801
|
}
|
|
6359
|
-
|
|
5802
|
+
args = args.join(",");
|
|
5803
|
+
var func = `(${args}) => { ${body} };`;
|
|
5804
|
+
ASM_CONSTS[start] = eval(func);
|
|
6360
5805
|
}
|
|
6361
|
-
__name(
|
|
6362
|
-
if (
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
5806
|
+
__name(addEmAsm, "addEmAsm");
|
|
5807
|
+
if ("__start_em_asm" in moduleExports) {
|
|
5808
|
+
var start = moduleExports["__start_em_asm"];
|
|
5809
|
+
var stop = moduleExports["__stop_em_asm"];
|
|
5810
|
+
while (start < stop) {
|
|
5811
|
+
var jsString = UTF8ToString(start);
|
|
5812
|
+
addEmAsm(start, jsString);
|
|
5813
|
+
start = HEAPU8.indexOf(0, start) + 1;
|
|
6366
5814
|
}
|
|
6367
|
-
return WebAssembly.instantiate(binary, info).then((result) => postInstantiation(result.module, result.instance));
|
|
6368
5815
|
}
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
return loadModule();
|
|
6379
|
-
}, "loadWebAssemblyModule");
|
|
6380
|
-
var mergeLibSymbols = /* @__PURE__ */ __name((exports, libName2) => {
|
|
6381
|
-
for (var [sym, exp] of Object.entries(exports)) {
|
|
6382
|
-
const setImport = /* @__PURE__ */ __name((target) => {
|
|
6383
|
-
if (!isSymbolDefined(target)) {
|
|
6384
|
-
wasmImports[target] = exp;
|
|
5816
|
+
function addEmJs(name, cSig, body) {
|
|
5817
|
+
var jsArgs = [];
|
|
5818
|
+
cSig = cSig.slice(1, -1);
|
|
5819
|
+
if (cSig != "void") {
|
|
5820
|
+
cSig = cSig.split(",");
|
|
5821
|
+
for (var i in cSig) {
|
|
5822
|
+
var jsArg = cSig[i].split(" ").pop();
|
|
5823
|
+
jsArgs.push(jsArg.replace("*", ""));
|
|
5824
|
+
}
|
|
6385
5825
|
}
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
const main_alias = "__main_argc_argv";
|
|
6389
|
-
if (sym == "main") {
|
|
6390
|
-
setImport(main_alias);
|
|
6391
|
-
}
|
|
6392
|
-
if (sym == main_alias) {
|
|
6393
|
-
setImport("main");
|
|
5826
|
+
var func = `(${jsArgs}) => ${body};`;
|
|
5827
|
+
moduleExports[name] = eval(func);
|
|
6394
5828
|
}
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
nodelete: true
|
|
6404
|
-
}, localScope2, handle2) {
|
|
6405
|
-
var dso = LDSO.loadedLibsByName[libName2];
|
|
6406
|
-
if (dso) {
|
|
6407
|
-
if (!flags2.global) {
|
|
6408
|
-
if (localScope2) {
|
|
6409
|
-
Object.assign(localScope2, dso.exports);
|
|
5829
|
+
__name(addEmJs, "addEmJs");
|
|
5830
|
+
for (var name in moduleExports) {
|
|
5831
|
+
if (name.startsWith("__em_js__")) {
|
|
5832
|
+
var start = moduleExports[name];
|
|
5833
|
+
var jsString = UTF8ToString(start);
|
|
5834
|
+
var parts = jsString.split("<::>");
|
|
5835
|
+
addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]);
|
|
5836
|
+
delete moduleExports[name];
|
|
6410
5837
|
}
|
|
6411
|
-
} else if (!dso.global) {
|
|
6412
|
-
dso.global = true;
|
|
6413
|
-
mergeLibSymbols(dso.exports, libName2);
|
|
6414
|
-
}
|
|
6415
|
-
if (flags2.nodelete && dso.refcount !== Infinity) {
|
|
6416
|
-
dso.refcount = Infinity;
|
|
6417
5838
|
}
|
|
6418
|
-
|
|
6419
|
-
if (
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
dso = newDSO(libName2, handle2, "loading");
|
|
6425
|
-
dso.refcount = flags2.nodelete ? Infinity : 1;
|
|
6426
|
-
dso.global = flags2.global;
|
|
6427
|
-
function loadLibData() {
|
|
6428
|
-
if (handle2) {
|
|
6429
|
-
var data = LE_HEAP_LOAD_U32((handle2 + 28 >> 2) * 4);
|
|
6430
|
-
var dataSize = LE_HEAP_LOAD_U32((handle2 + 32 >> 2) * 4);
|
|
6431
|
-
if (data && dataSize) {
|
|
6432
|
-
var libData = HEAP8.slice(data, data + dataSize);
|
|
6433
|
-
return flags2.loadAsync ? Promise.resolve(libData) : libData;
|
|
5839
|
+
var applyRelocs = moduleExports["__wasm_apply_data_relocs"];
|
|
5840
|
+
if (applyRelocs) {
|
|
5841
|
+
if (runtimeInitialized) {
|
|
5842
|
+
applyRelocs();
|
|
5843
|
+
} else {
|
|
5844
|
+
__RELOC_FUNCS__.push(applyRelocs);
|
|
6434
5845
|
}
|
|
6435
5846
|
}
|
|
6436
|
-
var
|
|
6437
|
-
if (
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
if (!readBinary) {
|
|
6441
|
-
throw new Error(`${libFile}: file not found, and synchronous loading of external files is not available`);
|
|
6442
|
-
}
|
|
6443
|
-
return readBinary(libFile);
|
|
6444
|
-
}
|
|
6445
|
-
__name(loadLibData, "loadLibData");
|
|
6446
|
-
function getExports() {
|
|
6447
|
-
if (flags2.loadAsync) {
|
|
6448
|
-
return loadLibData().then((libData) => loadWebAssemblyModule(libData, flags2, libName2, localScope2, handle2));
|
|
6449
|
-
}
|
|
6450
|
-
return loadWebAssemblyModule(loadLibData(), flags2, libName2, localScope2, handle2);
|
|
6451
|
-
}
|
|
6452
|
-
__name(getExports, "getExports");
|
|
6453
|
-
function moduleLoaded(exports) {
|
|
6454
|
-
if (dso.global) {
|
|
6455
|
-
mergeLibSymbols(exports, libName2);
|
|
6456
|
-
} else if (localScope2) {
|
|
6457
|
-
Object.assign(localScope2, exports);
|
|
6458
|
-
}
|
|
6459
|
-
dso.exports = exports;
|
|
6460
|
-
}
|
|
6461
|
-
__name(moduleLoaded, "moduleLoaded");
|
|
6462
|
-
if (flags2.loadAsync) {
|
|
6463
|
-
return getExports().then((exports) => {
|
|
6464
|
-
moduleLoaded(exports);
|
|
6465
|
-
return true;
|
|
6466
|
-
});
|
|
6467
|
-
}
|
|
6468
|
-
moduleLoaded(getExports());
|
|
6469
|
-
return true;
|
|
6470
|
-
}
|
|
6471
|
-
__name(loadDynamicLibrary, "loadDynamicLibrary");
|
|
6472
|
-
var reportUndefinedSymbols = /* @__PURE__ */ __name(() => {
|
|
6473
|
-
for (var [symName, entry] of Object.entries(GOT)) {
|
|
6474
|
-
if (entry.value == 0) {
|
|
6475
|
-
var value = resolveGlobalSymbol(symName, true).sym;
|
|
6476
|
-
if (!value && !entry.required) {
|
|
6477
|
-
continue;
|
|
6478
|
-
}
|
|
6479
|
-
if (typeof value == "function") {
|
|
6480
|
-
entry.value = addFunction(value, value.sig);
|
|
6481
|
-
} else if (typeof value == "number") {
|
|
6482
|
-
entry.value = value;
|
|
5847
|
+
var init = moduleExports["__wasm_call_ctors"];
|
|
5848
|
+
if (init) {
|
|
5849
|
+
if (runtimeInitialized) {
|
|
5850
|
+
init();
|
|
6483
5851
|
} else {
|
|
6484
|
-
|
|
5852
|
+
addOnPostCtor(init);
|
|
6485
5853
|
}
|
|
6486
5854
|
}
|
|
5855
|
+
return moduleExports;
|
|
6487
5856
|
}
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
allowUndefined: true
|
|
6500
|
-
})), Promise.resolve()).then(() => {
|
|
6501
|
-
reportUndefinedSymbols();
|
|
6502
|
-
removeRunDependency("loadDylibs");
|
|
6503
|
-
});
|
|
6504
|
-
}, "loadDylibs");
|
|
6505
|
-
var noExitRuntime = Module["noExitRuntime"] || true;
|
|
6506
|
-
function setValue(ptr, value, type = "i8") {
|
|
6507
|
-
if (type.endsWith("*"))
|
|
6508
|
-
type = "*";
|
|
6509
|
-
switch (type) {
|
|
6510
|
-
case "i1":
|
|
6511
|
-
HEAP8[ptr] = value;
|
|
6512
|
-
break;
|
|
6513
|
-
case "i8":
|
|
6514
|
-
HEAP8[ptr] = value;
|
|
6515
|
-
break;
|
|
6516
|
-
case "i16":
|
|
6517
|
-
LE_HEAP_STORE_I16((ptr >> 1) * 2, value);
|
|
6518
|
-
break;
|
|
6519
|
-
case "i32":
|
|
6520
|
-
LE_HEAP_STORE_I32((ptr >> 2) * 4, value);
|
|
6521
|
-
break;
|
|
6522
|
-
case "i64":
|
|
6523
|
-
HEAP64[ptr >> 3] = BigInt(value);
|
|
6524
|
-
break;
|
|
6525
|
-
case "float":
|
|
6526
|
-
LE_HEAP_STORE_F32((ptr >> 2) * 4, value);
|
|
6527
|
-
break;
|
|
6528
|
-
case "double":
|
|
6529
|
-
LE_HEAP_STORE_F64((ptr >> 3) * 8, value);
|
|
6530
|
-
break;
|
|
6531
|
-
case "*":
|
|
6532
|
-
LE_HEAP_STORE_U32((ptr >> 2) * 4, value);
|
|
6533
|
-
break;
|
|
6534
|
-
default:
|
|
6535
|
-
abort(`invalid type for setValue: ${type}`);
|
|
6536
|
-
}
|
|
6537
|
-
}
|
|
6538
|
-
__name(setValue, "setValue");
|
|
6539
|
-
var ___memory_base = new WebAssembly.Global({
|
|
6540
|
-
value: "i32",
|
|
6541
|
-
mutable: false
|
|
6542
|
-
}, 1024);
|
|
6543
|
-
var ___stack_pointer = new WebAssembly.Global({
|
|
6544
|
-
value: "i32",
|
|
6545
|
-
mutable: true
|
|
6546
|
-
}, 78224);
|
|
6547
|
-
var ___table_base = new WebAssembly.Global({
|
|
6548
|
-
value: "i32",
|
|
6549
|
-
mutable: false
|
|
6550
|
-
}, 1);
|
|
6551
|
-
var __abort_js = /* @__PURE__ */ __name(() => abort(""), "__abort_js");
|
|
6552
|
-
__abort_js.sig = "v";
|
|
6553
|
-
var _emscripten_get_now = /* @__PURE__ */ __name(() => performance.now(), "_emscripten_get_now");
|
|
6554
|
-
_emscripten_get_now.sig = "d";
|
|
6555
|
-
var _emscripten_date_now = /* @__PURE__ */ __name(() => Date.now(), "_emscripten_date_now");
|
|
6556
|
-
_emscripten_date_now.sig = "d";
|
|
6557
|
-
var nowIsMonotonic = 1;
|
|
6558
|
-
var checkWasiClock = /* @__PURE__ */ __name((clock_id) => clock_id >= 0 && clock_id <= 3, "checkWasiClock");
|
|
6559
|
-
var INT53_MAX = 9007199254740992;
|
|
6560
|
-
var INT53_MIN = -9007199254740992;
|
|
6561
|
-
var bigintToI53Checked = /* @__PURE__ */ __name((num) => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num), "bigintToI53Checked");
|
|
6562
|
-
function _clock_time_get(clk_id, ignored_precision, ptime) {
|
|
6563
|
-
ignored_precision = bigintToI53Checked(ignored_precision);
|
|
6564
|
-
if (!checkWasiClock(clk_id)) {
|
|
6565
|
-
return 28;
|
|
6566
|
-
}
|
|
6567
|
-
var now;
|
|
6568
|
-
if (clk_id === 0) {
|
|
6569
|
-
now = _emscripten_date_now();
|
|
6570
|
-
} else if (nowIsMonotonic) {
|
|
6571
|
-
now = _emscripten_get_now();
|
|
6572
|
-
} else {
|
|
6573
|
-
return 52;
|
|
5857
|
+
__name(postInstantiation, "postInstantiation");
|
|
5858
|
+
if (flags.loadAsync) {
|
|
5859
|
+
return (async () => {
|
|
5860
|
+
var instance2;
|
|
5861
|
+
if (binary instanceof WebAssembly.Module) {
|
|
5862
|
+
instance2 = new WebAssembly.Instance(binary, info);
|
|
5863
|
+
} else {
|
|
5864
|
+
({ module: binary, instance: instance2 } = await WebAssembly.instantiate(binary, info));
|
|
5865
|
+
}
|
|
5866
|
+
return postInstantiation(binary, instance2);
|
|
5867
|
+
})();
|
|
6574
5868
|
}
|
|
6575
|
-
var
|
|
6576
|
-
|
|
6577
|
-
return
|
|
5869
|
+
var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary);
|
|
5870
|
+
var instance = new WebAssembly.Instance(module, info);
|
|
5871
|
+
return postInstantiation(module, instance);
|
|
6578
5872
|
}
|
|
6579
|
-
__name(
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
try {
|
|
6586
|
-
wasmMemory.grow(pages);
|
|
6587
|
-
updateMemoryViews();
|
|
6588
|
-
return 1;
|
|
6589
|
-
} catch (e) {}
|
|
6590
|
-
}, "growMemory");
|
|
6591
|
-
var _emscripten_resize_heap = /* @__PURE__ */ __name((requestedSize) => {
|
|
6592
|
-
var oldSize = HEAPU8.length;
|
|
6593
|
-
requestedSize >>>= 0;
|
|
6594
|
-
var maxHeapSize = getHeapMax();
|
|
6595
|
-
if (requestedSize > maxHeapSize) {
|
|
6596
|
-
return false;
|
|
5873
|
+
__name(loadModule, "loadModule");
|
|
5874
|
+
flags = {
|
|
5875
|
+
...flags,
|
|
5876
|
+
rpath: {
|
|
5877
|
+
parentLibPath: libName,
|
|
5878
|
+
paths: metadata.runtimePaths
|
|
6597
5879
|
}
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
5880
|
+
};
|
|
5881
|
+
if (flags.loadAsync) {
|
|
5882
|
+
return metadata.neededDynlibs.reduce((chain, dynNeeded) => chain.then(() => loadDynamicLibrary(dynNeeded, flags, localScope)), Promise.resolve()).then(loadModule);
|
|
5883
|
+
}
|
|
5884
|
+
metadata.neededDynlibs.forEach((needed) => loadDynamicLibrary(needed, flags, localScope));
|
|
5885
|
+
return loadModule();
|
|
5886
|
+
}, "loadWebAssemblyModule");
|
|
5887
|
+
var mergeLibSymbols = /* @__PURE__ */ __name((exports, libName2) => {
|
|
5888
|
+
for (var [sym, exp] of Object.entries(exports)) {
|
|
5889
|
+
const setImport = /* @__PURE__ */ __name((target) => {
|
|
5890
|
+
if (!isSymbolDefined(target)) {
|
|
5891
|
+
wasmImports[target] = exp;
|
|
6605
5892
|
}
|
|
5893
|
+
}, "setImport");
|
|
5894
|
+
setImport(sym);
|
|
5895
|
+
const main_alias = "__main_argc_argv";
|
|
5896
|
+
if (sym == "main") {
|
|
5897
|
+
setImport(main_alias);
|
|
5898
|
+
}
|
|
5899
|
+
if (sym == main_alias) {
|
|
5900
|
+
setImport("main");
|
|
5901
|
+
}
|
|
5902
|
+
}
|
|
5903
|
+
}, "mergeLibSymbols");
|
|
5904
|
+
var asyncLoad = /* @__PURE__ */ __name(async (url) => {
|
|
5905
|
+
var arrayBuffer = await readAsync(url);
|
|
5906
|
+
return new Uint8Array(arrayBuffer);
|
|
5907
|
+
}, "asyncLoad");
|
|
5908
|
+
function loadDynamicLibrary(libName2, flags2 = {
|
|
5909
|
+
global: true,
|
|
5910
|
+
nodelete: true
|
|
5911
|
+
}, localScope2, handle2) {
|
|
5912
|
+
var dso = LDSO.loadedLibsByName[libName2];
|
|
5913
|
+
if (dso) {
|
|
5914
|
+
if (!flags2.global) {
|
|
5915
|
+
if (localScope2) {
|
|
5916
|
+
Object.assign(localScope2, dso.exports);
|
|
5917
|
+
}
|
|
5918
|
+
} else if (!dso.global) {
|
|
5919
|
+
dso.global = true;
|
|
5920
|
+
mergeLibSymbols(dso.exports, libName2);
|
|
6606
5921
|
}
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
_emscripten_resize_heap.sig = "ip";
|
|
6610
|
-
var _fd_close = /* @__PURE__ */ __name((fd) => 52, "_fd_close");
|
|
6611
|
-
_fd_close.sig = "ii";
|
|
6612
|
-
function _fd_seek(fd, offset, whence, newOffset) {
|
|
6613
|
-
offset = bigintToI53Checked(offset);
|
|
6614
|
-
return 70;
|
|
6615
|
-
}
|
|
6616
|
-
__name(_fd_seek, "_fd_seek");
|
|
6617
|
-
_fd_seek.sig = "iijip";
|
|
6618
|
-
var printCharBuffers = [null, [], []];
|
|
6619
|
-
var printChar = /* @__PURE__ */ __name((stream, curr) => {
|
|
6620
|
-
var buffer = printCharBuffers[stream];
|
|
6621
|
-
if (curr === 0 || curr === 10) {
|
|
6622
|
-
(stream === 1 ? out : err)(UTF8ArrayToString(buffer));
|
|
6623
|
-
buffer.length = 0;
|
|
6624
|
-
} else {
|
|
6625
|
-
buffer.push(curr);
|
|
6626
|
-
}
|
|
6627
|
-
}, "printChar");
|
|
6628
|
-
var flush_NO_FILESYSTEM = /* @__PURE__ */ __name(() => {
|
|
6629
|
-
if (printCharBuffers[1].length)
|
|
6630
|
-
printChar(1, 10);
|
|
6631
|
-
if (printCharBuffers[2].length)
|
|
6632
|
-
printChar(2, 10);
|
|
6633
|
-
}, "flush_NO_FILESYSTEM");
|
|
6634
|
-
var SYSCALLS = {
|
|
6635
|
-
varargs: undefined,
|
|
6636
|
-
getStr(ptr) {
|
|
6637
|
-
var ret = UTF8ToString(ptr);
|
|
6638
|
-
return ret;
|
|
5922
|
+
if (flags2.nodelete && dso.refcount !== Infinity) {
|
|
5923
|
+
dso.refcount = Infinity;
|
|
6639
5924
|
}
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
5925
|
+
dso.refcount++;
|
|
5926
|
+
if (handle2) {
|
|
5927
|
+
LDSO.loadedLibsByHandle[handle2] = dso;
|
|
5928
|
+
}
|
|
5929
|
+
return flags2.loadAsync ? Promise.resolve(true) : true;
|
|
5930
|
+
}
|
|
5931
|
+
dso = newDSO(libName2, handle2, "loading");
|
|
5932
|
+
dso.refcount = flags2.nodelete ? Infinity : 1;
|
|
5933
|
+
dso.global = flags2.global;
|
|
5934
|
+
function loadLibData() {
|
|
5935
|
+
if (handle2) {
|
|
5936
|
+
var data = LE_HEAP_LOAD_U32((handle2 + 28 >> 2) * 4);
|
|
5937
|
+
var dataSize = LE_HEAP_LOAD_U32((handle2 + 32 >> 2) * 4);
|
|
5938
|
+
if (data && dataSize) {
|
|
5939
|
+
var libData = HEAP8.slice(data, data + dataSize);
|
|
5940
|
+
return flags2.loadAsync ? Promise.resolve(libData) : libData;
|
|
6649
5941
|
}
|
|
6650
|
-
num += len;
|
|
6651
5942
|
}
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
_fd_write.sig = "iippp";
|
|
6656
|
-
function _tree_sitter_log_callback(isLexMessage, messageAddress) {
|
|
6657
|
-
if (Module.currentLogCallback) {
|
|
6658
|
-
const message = UTF8ToString(messageAddress);
|
|
6659
|
-
Module.currentLogCallback(message, isLexMessage !== 0);
|
|
6660
|
-
}
|
|
6661
|
-
}
|
|
6662
|
-
__name(_tree_sitter_log_callback, "_tree_sitter_log_callback");
|
|
6663
|
-
function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
|
|
6664
|
-
const INPUT_BUFFER_SIZE = 10240;
|
|
6665
|
-
const string = Module.currentParseCallback(index, {
|
|
6666
|
-
row,
|
|
6667
|
-
column
|
|
6668
|
-
});
|
|
6669
|
-
if (typeof string === "string") {
|
|
6670
|
-
setValue(lengthAddress, string.length, "i32");
|
|
6671
|
-
stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
|
|
6672
|
-
} else {
|
|
6673
|
-
setValue(lengthAddress, 0, "i32");
|
|
5943
|
+
var libFile = locateFile(libName2);
|
|
5944
|
+
if (flags2.loadAsync) {
|
|
5945
|
+
return asyncLoad(libFile);
|
|
6674
5946
|
}
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
function _tree_sitter_progress_callback(currentOffset, hasError) {
|
|
6678
|
-
if (Module.currentProgressCallback) {
|
|
6679
|
-
return Module.currentProgressCallback({
|
|
6680
|
-
currentOffset,
|
|
6681
|
-
hasError
|
|
6682
|
-
});
|
|
5947
|
+
if (!readBinary) {
|
|
5948
|
+
throw new Error(`${libFile}: file not found, and synchronous loading of external files is not available`);
|
|
6683
5949
|
}
|
|
6684
|
-
return
|
|
5950
|
+
return readBinary(libFile);
|
|
6685
5951
|
}
|
|
6686
|
-
__name(
|
|
6687
|
-
function
|
|
6688
|
-
if (
|
|
6689
|
-
return
|
|
6690
|
-
currentOffset
|
|
6691
|
-
});
|
|
5952
|
+
__name(loadLibData, "loadLibData");
|
|
5953
|
+
function getExports() {
|
|
5954
|
+
if (flags2.loadAsync) {
|
|
5955
|
+
return loadLibData().then((libData) => loadWebAssemblyModule(libData, flags2, libName2, localScope2, handle2));
|
|
6692
5956
|
}
|
|
6693
|
-
return
|
|
5957
|
+
return loadWebAssemblyModule(loadLibData(), flags2, libName2, localScope2, handle2);
|
|
6694
5958
|
}
|
|
6695
|
-
__name(
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
Module["onExit"]?.(code);
|
|
6702
|
-
ABORT = true;
|
|
6703
|
-
}
|
|
6704
|
-
quit_(code, new ExitStatus(code));
|
|
6705
|
-
}, "_proc_exit");
|
|
6706
|
-
_proc_exit.sig = "vi";
|
|
6707
|
-
var exitJS = /* @__PURE__ */ __name((status, implicit) => {
|
|
6708
|
-
EXITSTATUS = status;
|
|
6709
|
-
_proc_exit(status);
|
|
6710
|
-
}, "exitJS");
|
|
6711
|
-
var handleException = /* @__PURE__ */ __name((e) => {
|
|
6712
|
-
if (e instanceof ExitStatus || e == "unwind") {
|
|
6713
|
-
return EXITSTATUS;
|
|
6714
|
-
}
|
|
6715
|
-
quit_(1, e);
|
|
6716
|
-
}, "handleException");
|
|
6717
|
-
var lengthBytesUTF8 = /* @__PURE__ */ __name((str) => {
|
|
6718
|
-
var len = 0;
|
|
6719
|
-
for (var i2 = 0;i2 < str.length; ++i2) {
|
|
6720
|
-
var c = str.charCodeAt(i2);
|
|
6721
|
-
if (c <= 127) {
|
|
6722
|
-
len++;
|
|
6723
|
-
} else if (c <= 2047) {
|
|
6724
|
-
len += 2;
|
|
6725
|
-
} else if (c >= 55296 && c <= 57343) {
|
|
6726
|
-
len += 4;
|
|
6727
|
-
++i2;
|
|
6728
|
-
} else {
|
|
6729
|
-
len += 3;
|
|
6730
|
-
}
|
|
5959
|
+
__name(getExports, "getExports");
|
|
5960
|
+
function moduleLoaded(exports) {
|
|
5961
|
+
if (dso.global) {
|
|
5962
|
+
mergeLibSymbols(exports, libName2);
|
|
5963
|
+
} else if (localScope2) {
|
|
5964
|
+
Object.assign(localScope2, exports);
|
|
6731
5965
|
}
|
|
6732
|
-
|
|
6733
|
-
}
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
5966
|
+
dso.exports = exports;
|
|
5967
|
+
}
|
|
5968
|
+
__name(moduleLoaded, "moduleLoaded");
|
|
5969
|
+
if (flags2.loadAsync) {
|
|
5970
|
+
return getExports().then((exports) => {
|
|
5971
|
+
moduleLoaded(exports);
|
|
5972
|
+
return true;
|
|
5973
|
+
});
|
|
5974
|
+
}
|
|
5975
|
+
moduleLoaded(getExports());
|
|
5976
|
+
return true;
|
|
5977
|
+
}
|
|
5978
|
+
__name(loadDynamicLibrary, "loadDynamicLibrary");
|
|
5979
|
+
var reportUndefinedSymbols = /* @__PURE__ */ __name(() => {
|
|
5980
|
+
for (var [symName, entry] of Object.entries(GOT)) {
|
|
5981
|
+
if (entry.value == 0) {
|
|
5982
|
+
var value = resolveGlobalSymbol(symName, true).sym;
|
|
5983
|
+
if (!value && !entry.required) {
|
|
5984
|
+
continue;
|
|
6744
5985
|
}
|
|
6745
|
-
if (
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
} else if (u <= 2047) {
|
|
6750
|
-
if (outIdx + 1 >= endIdx)
|
|
6751
|
-
break;
|
|
6752
|
-
heap[outIdx++] = 192 | u >> 6;
|
|
6753
|
-
heap[outIdx++] = 128 | u & 63;
|
|
6754
|
-
} else if (u <= 65535) {
|
|
6755
|
-
if (outIdx + 2 >= endIdx)
|
|
6756
|
-
break;
|
|
6757
|
-
heap[outIdx++] = 224 | u >> 12;
|
|
6758
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
6759
|
-
heap[outIdx++] = 128 | u & 63;
|
|
5986
|
+
if (typeof value == "function") {
|
|
5987
|
+
entry.value = addFunction(value, value.sig);
|
|
5988
|
+
} else if (typeof value == "number") {
|
|
5989
|
+
entry.value = value;
|
|
6760
5990
|
} else {
|
|
6761
|
-
|
|
6762
|
-
break;
|
|
6763
|
-
heap[outIdx++] = 240 | u >> 18;
|
|
6764
|
-
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
6765
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
6766
|
-
heap[outIdx++] = 128 | u & 63;
|
|
5991
|
+
throw new Error(`bad export type for '${symName}': ${typeof value}`);
|
|
6767
5992
|
}
|
|
6768
5993
|
}
|
|
6769
|
-
heap[outIdx] = 0;
|
|
6770
|
-
return outIdx - startIdx;
|
|
6771
|
-
}, "stringToUTF8Array");
|
|
6772
|
-
var stringToUTF8 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite), "stringToUTF8");
|
|
6773
|
-
var stackAlloc = /* @__PURE__ */ __name((sz) => __emscripten_stack_alloc(sz), "stackAlloc");
|
|
6774
|
-
var stringToUTF8OnStack = /* @__PURE__ */ __name((str) => {
|
|
6775
|
-
var size = lengthBytesUTF8(str) + 1;
|
|
6776
|
-
var ret = stackAlloc(size);
|
|
6777
|
-
stringToUTF8(str, ret, size);
|
|
6778
|
-
return ret;
|
|
6779
|
-
}, "stringToUTF8OnStack");
|
|
6780
|
-
var AsciiToString = /* @__PURE__ */ __name((ptr) => {
|
|
6781
|
-
var str = "";
|
|
6782
|
-
while (true) {
|
|
6783
|
-
var ch = HEAPU8[ptr++];
|
|
6784
|
-
if (!ch)
|
|
6785
|
-
return str;
|
|
6786
|
-
str += String.fromCharCode(ch);
|
|
6787
|
-
}
|
|
6788
|
-
}, "AsciiToString");
|
|
6789
|
-
var stringToUTF16 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => {
|
|
6790
|
-
maxBytesToWrite ??= 2147483647;
|
|
6791
|
-
if (maxBytesToWrite < 2)
|
|
6792
|
-
return 0;
|
|
6793
|
-
maxBytesToWrite -= 2;
|
|
6794
|
-
var startPtr = outPtr;
|
|
6795
|
-
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
6796
|
-
for (var i2 = 0;i2 < numCharsToWrite; ++i2) {
|
|
6797
|
-
var codeUnit = str.charCodeAt(i2);
|
|
6798
|
-
LE_HEAP_STORE_I16((outPtr >> 1) * 2, codeUnit);
|
|
6799
|
-
outPtr += 2;
|
|
6800
|
-
}
|
|
6801
|
-
LE_HEAP_STORE_I16((outPtr >> 1) * 2, 0);
|
|
6802
|
-
return outPtr - startPtr;
|
|
6803
|
-
}, "stringToUTF16");
|
|
6804
|
-
var wasmImports = {
|
|
6805
|
-
__heap_base: ___heap_base,
|
|
6806
|
-
__indirect_function_table: wasmTable,
|
|
6807
|
-
__memory_base: ___memory_base,
|
|
6808
|
-
__stack_pointer: ___stack_pointer,
|
|
6809
|
-
__table_base: ___table_base,
|
|
6810
|
-
_abort_js: __abort_js,
|
|
6811
|
-
clock_time_get: _clock_time_get,
|
|
6812
|
-
emscripten_resize_heap: _emscripten_resize_heap,
|
|
6813
|
-
fd_close: _fd_close,
|
|
6814
|
-
fd_seek: _fd_seek,
|
|
6815
|
-
fd_write: _fd_write,
|
|
6816
|
-
memory: wasmMemory,
|
|
6817
|
-
tree_sitter_log_callback: _tree_sitter_log_callback,
|
|
6818
|
-
tree_sitter_parse_callback: _tree_sitter_parse_callback,
|
|
6819
|
-
tree_sitter_progress_callback: _tree_sitter_progress_callback,
|
|
6820
|
-
tree_sitter_query_progress_callback: _tree_sitter_query_progress_callback
|
|
6821
|
-
};
|
|
6822
|
-
var wasmExports = await createWasm();
|
|
6823
|
-
var ___wasm_call_ctors = wasmExports["__wasm_call_ctors"];
|
|
6824
|
-
var _malloc = Module["_malloc"] = wasmExports["malloc"];
|
|
6825
|
-
var _calloc = Module["_calloc"] = wasmExports["calloc"];
|
|
6826
|
-
var _realloc = Module["_realloc"] = wasmExports["realloc"];
|
|
6827
|
-
var _free = Module["_free"] = wasmExports["free"];
|
|
6828
|
-
var _memcmp = Module["_memcmp"] = wasmExports["memcmp"];
|
|
6829
|
-
var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = wasmExports["ts_language_symbol_count"];
|
|
6830
|
-
var _ts_language_state_count = Module["_ts_language_state_count"] = wasmExports["ts_language_state_count"];
|
|
6831
|
-
var _ts_language_version = Module["_ts_language_version"] = wasmExports["ts_language_version"];
|
|
6832
|
-
var _ts_language_abi_version = Module["_ts_language_abi_version"] = wasmExports["ts_language_abi_version"];
|
|
6833
|
-
var _ts_language_metadata = Module["_ts_language_metadata"] = wasmExports["ts_language_metadata"];
|
|
6834
|
-
var _ts_language_name = Module["_ts_language_name"] = wasmExports["ts_language_name"];
|
|
6835
|
-
var _ts_language_field_count = Module["_ts_language_field_count"] = wasmExports["ts_language_field_count"];
|
|
6836
|
-
var _ts_language_next_state = Module["_ts_language_next_state"] = wasmExports["ts_language_next_state"];
|
|
6837
|
-
var _ts_language_symbol_name = Module["_ts_language_symbol_name"] = wasmExports["ts_language_symbol_name"];
|
|
6838
|
-
var _ts_language_symbol_for_name = Module["_ts_language_symbol_for_name"] = wasmExports["ts_language_symbol_for_name"];
|
|
6839
|
-
var _strncmp = Module["_strncmp"] = wasmExports["strncmp"];
|
|
6840
|
-
var _ts_language_symbol_type = Module["_ts_language_symbol_type"] = wasmExports["ts_language_symbol_type"];
|
|
6841
|
-
var _ts_language_field_name_for_id = Module["_ts_language_field_name_for_id"] = wasmExports["ts_language_field_name_for_id"];
|
|
6842
|
-
var _ts_lookahead_iterator_new = Module["_ts_lookahead_iterator_new"] = wasmExports["ts_lookahead_iterator_new"];
|
|
6843
|
-
var _ts_lookahead_iterator_delete = Module["_ts_lookahead_iterator_delete"] = wasmExports["ts_lookahead_iterator_delete"];
|
|
6844
|
-
var _ts_lookahead_iterator_reset_state = Module["_ts_lookahead_iterator_reset_state"] = wasmExports["ts_lookahead_iterator_reset_state"];
|
|
6845
|
-
var _ts_lookahead_iterator_reset = Module["_ts_lookahead_iterator_reset"] = wasmExports["ts_lookahead_iterator_reset"];
|
|
6846
|
-
var _ts_lookahead_iterator_next = Module["_ts_lookahead_iterator_next"] = wasmExports["ts_lookahead_iterator_next"];
|
|
6847
|
-
var _ts_lookahead_iterator_current_symbol = Module["_ts_lookahead_iterator_current_symbol"] = wasmExports["ts_lookahead_iterator_current_symbol"];
|
|
6848
|
-
var _ts_parser_delete = Module["_ts_parser_delete"] = wasmExports["ts_parser_delete"];
|
|
6849
|
-
var _ts_parser_reset = Module["_ts_parser_reset"] = wasmExports["ts_parser_reset"];
|
|
6850
|
-
var _ts_parser_set_language = Module["_ts_parser_set_language"] = wasmExports["ts_parser_set_language"];
|
|
6851
|
-
var _ts_parser_timeout_micros = Module["_ts_parser_timeout_micros"] = wasmExports["ts_parser_timeout_micros"];
|
|
6852
|
-
var _ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = wasmExports["ts_parser_set_timeout_micros"];
|
|
6853
|
-
var _ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = wasmExports["ts_parser_set_included_ranges"];
|
|
6854
|
-
var _ts_query_new = Module["_ts_query_new"] = wasmExports["ts_query_new"];
|
|
6855
|
-
var _ts_query_delete = Module["_ts_query_delete"] = wasmExports["ts_query_delete"];
|
|
6856
|
-
var _iswspace = Module["_iswspace"] = wasmExports["iswspace"];
|
|
6857
|
-
var _iswalnum = Module["_iswalnum"] = wasmExports["iswalnum"];
|
|
6858
|
-
var _ts_query_pattern_count = Module["_ts_query_pattern_count"] = wasmExports["ts_query_pattern_count"];
|
|
6859
|
-
var _ts_query_capture_count = Module["_ts_query_capture_count"] = wasmExports["ts_query_capture_count"];
|
|
6860
|
-
var _ts_query_string_count = Module["_ts_query_string_count"] = wasmExports["ts_query_string_count"];
|
|
6861
|
-
var _ts_query_capture_name_for_id = Module["_ts_query_capture_name_for_id"] = wasmExports["ts_query_capture_name_for_id"];
|
|
6862
|
-
var _ts_query_capture_quantifier_for_id = Module["_ts_query_capture_quantifier_for_id"] = wasmExports["ts_query_capture_quantifier_for_id"];
|
|
6863
|
-
var _ts_query_string_value_for_id = Module["_ts_query_string_value_for_id"] = wasmExports["ts_query_string_value_for_id"];
|
|
6864
|
-
var _ts_query_predicates_for_pattern = Module["_ts_query_predicates_for_pattern"] = wasmExports["ts_query_predicates_for_pattern"];
|
|
6865
|
-
var _ts_query_start_byte_for_pattern = Module["_ts_query_start_byte_for_pattern"] = wasmExports["ts_query_start_byte_for_pattern"];
|
|
6866
|
-
var _ts_query_end_byte_for_pattern = Module["_ts_query_end_byte_for_pattern"] = wasmExports["ts_query_end_byte_for_pattern"];
|
|
6867
|
-
var _ts_query_is_pattern_rooted = Module["_ts_query_is_pattern_rooted"] = wasmExports["ts_query_is_pattern_rooted"];
|
|
6868
|
-
var _ts_query_is_pattern_non_local = Module["_ts_query_is_pattern_non_local"] = wasmExports["ts_query_is_pattern_non_local"];
|
|
6869
|
-
var _ts_query_is_pattern_guaranteed_at_step = Module["_ts_query_is_pattern_guaranteed_at_step"] = wasmExports["ts_query_is_pattern_guaranteed_at_step"];
|
|
6870
|
-
var _ts_query_disable_capture = Module["_ts_query_disable_capture"] = wasmExports["ts_query_disable_capture"];
|
|
6871
|
-
var _ts_query_disable_pattern = Module["_ts_query_disable_pattern"] = wasmExports["ts_query_disable_pattern"];
|
|
6872
|
-
var _ts_tree_copy = Module["_ts_tree_copy"] = wasmExports["ts_tree_copy"];
|
|
6873
|
-
var _ts_tree_delete = Module["_ts_tree_delete"] = wasmExports["ts_tree_delete"];
|
|
6874
|
-
var _ts_init = Module["_ts_init"] = wasmExports["ts_init"];
|
|
6875
|
-
var _ts_parser_new_wasm = Module["_ts_parser_new_wasm"] = wasmExports["ts_parser_new_wasm"];
|
|
6876
|
-
var _ts_parser_enable_logger_wasm = Module["_ts_parser_enable_logger_wasm"] = wasmExports["ts_parser_enable_logger_wasm"];
|
|
6877
|
-
var _ts_parser_parse_wasm = Module["_ts_parser_parse_wasm"] = wasmExports["ts_parser_parse_wasm"];
|
|
6878
|
-
var _ts_parser_included_ranges_wasm = Module["_ts_parser_included_ranges_wasm"] = wasmExports["ts_parser_included_ranges_wasm"];
|
|
6879
|
-
var _ts_language_type_is_named_wasm = Module["_ts_language_type_is_named_wasm"] = wasmExports["ts_language_type_is_named_wasm"];
|
|
6880
|
-
var _ts_language_type_is_visible_wasm = Module["_ts_language_type_is_visible_wasm"] = wasmExports["ts_language_type_is_visible_wasm"];
|
|
6881
|
-
var _ts_language_supertypes_wasm = Module["_ts_language_supertypes_wasm"] = wasmExports["ts_language_supertypes_wasm"];
|
|
6882
|
-
var _ts_language_subtypes_wasm = Module["_ts_language_subtypes_wasm"] = wasmExports["ts_language_subtypes_wasm"];
|
|
6883
|
-
var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = wasmExports["ts_tree_root_node_wasm"];
|
|
6884
|
-
var _ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = wasmExports["ts_tree_root_node_with_offset_wasm"];
|
|
6885
|
-
var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = wasmExports["ts_tree_edit_wasm"];
|
|
6886
|
-
var _ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = wasmExports["ts_tree_included_ranges_wasm"];
|
|
6887
|
-
var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = wasmExports["ts_tree_get_changed_ranges_wasm"];
|
|
6888
|
-
var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = wasmExports["ts_tree_cursor_new_wasm"];
|
|
6889
|
-
var _ts_tree_cursor_copy_wasm = Module["_ts_tree_cursor_copy_wasm"] = wasmExports["ts_tree_cursor_copy_wasm"];
|
|
6890
|
-
var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = wasmExports["ts_tree_cursor_delete_wasm"];
|
|
6891
|
-
var _ts_tree_cursor_reset_wasm = Module["_ts_tree_cursor_reset_wasm"] = wasmExports["ts_tree_cursor_reset_wasm"];
|
|
6892
|
-
var _ts_tree_cursor_reset_to_wasm = Module["_ts_tree_cursor_reset_to_wasm"] = wasmExports["ts_tree_cursor_reset_to_wasm"];
|
|
6893
|
-
var _ts_tree_cursor_goto_first_child_wasm = Module["_ts_tree_cursor_goto_first_child_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_wasm"];
|
|
6894
|
-
var _ts_tree_cursor_goto_last_child_wasm = Module["_ts_tree_cursor_goto_last_child_wasm"] = wasmExports["ts_tree_cursor_goto_last_child_wasm"];
|
|
6895
|
-
var _ts_tree_cursor_goto_first_child_for_index_wasm = Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_for_index_wasm"];
|
|
6896
|
-
var _ts_tree_cursor_goto_first_child_for_position_wasm = Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_for_position_wasm"];
|
|
6897
|
-
var _ts_tree_cursor_goto_next_sibling_wasm = Module["_ts_tree_cursor_goto_next_sibling_wasm"] = wasmExports["ts_tree_cursor_goto_next_sibling_wasm"];
|
|
6898
|
-
var _ts_tree_cursor_goto_previous_sibling_wasm = Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = wasmExports["ts_tree_cursor_goto_previous_sibling_wasm"];
|
|
6899
|
-
var _ts_tree_cursor_goto_descendant_wasm = Module["_ts_tree_cursor_goto_descendant_wasm"] = wasmExports["ts_tree_cursor_goto_descendant_wasm"];
|
|
6900
|
-
var _ts_tree_cursor_goto_parent_wasm = Module["_ts_tree_cursor_goto_parent_wasm"] = wasmExports["ts_tree_cursor_goto_parent_wasm"];
|
|
6901
|
-
var _ts_tree_cursor_current_node_type_id_wasm = Module["_ts_tree_cursor_current_node_type_id_wasm"] = wasmExports["ts_tree_cursor_current_node_type_id_wasm"];
|
|
6902
|
-
var _ts_tree_cursor_current_node_state_id_wasm = Module["_ts_tree_cursor_current_node_state_id_wasm"] = wasmExports["ts_tree_cursor_current_node_state_id_wasm"];
|
|
6903
|
-
var _ts_tree_cursor_current_node_is_named_wasm = Module["_ts_tree_cursor_current_node_is_named_wasm"] = wasmExports["ts_tree_cursor_current_node_is_named_wasm"];
|
|
6904
|
-
var _ts_tree_cursor_current_node_is_missing_wasm = Module["_ts_tree_cursor_current_node_is_missing_wasm"] = wasmExports["ts_tree_cursor_current_node_is_missing_wasm"];
|
|
6905
|
-
var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = wasmExports["ts_tree_cursor_current_node_id_wasm"];
|
|
6906
|
-
var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = wasmExports["ts_tree_cursor_start_position_wasm"];
|
|
6907
|
-
var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = wasmExports["ts_tree_cursor_end_position_wasm"];
|
|
6908
|
-
var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = wasmExports["ts_tree_cursor_start_index_wasm"];
|
|
6909
|
-
var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = wasmExports["ts_tree_cursor_end_index_wasm"];
|
|
6910
|
-
var _ts_tree_cursor_current_field_id_wasm = Module["_ts_tree_cursor_current_field_id_wasm"] = wasmExports["ts_tree_cursor_current_field_id_wasm"];
|
|
6911
|
-
var _ts_tree_cursor_current_depth_wasm = Module["_ts_tree_cursor_current_depth_wasm"] = wasmExports["ts_tree_cursor_current_depth_wasm"];
|
|
6912
|
-
var _ts_tree_cursor_current_descendant_index_wasm = Module["_ts_tree_cursor_current_descendant_index_wasm"] = wasmExports["ts_tree_cursor_current_descendant_index_wasm"];
|
|
6913
|
-
var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = wasmExports["ts_tree_cursor_current_node_wasm"];
|
|
6914
|
-
var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = wasmExports["ts_node_symbol_wasm"];
|
|
6915
|
-
var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = wasmExports["ts_node_field_name_for_child_wasm"];
|
|
6916
|
-
var _ts_node_field_name_for_named_child_wasm = Module["_ts_node_field_name_for_named_child_wasm"] = wasmExports["ts_node_field_name_for_named_child_wasm"];
|
|
6917
|
-
var _ts_node_children_by_field_id_wasm = Module["_ts_node_children_by_field_id_wasm"] = wasmExports["ts_node_children_by_field_id_wasm"];
|
|
6918
|
-
var _ts_node_first_child_for_byte_wasm = Module["_ts_node_first_child_for_byte_wasm"] = wasmExports["ts_node_first_child_for_byte_wasm"];
|
|
6919
|
-
var _ts_node_first_named_child_for_byte_wasm = Module["_ts_node_first_named_child_for_byte_wasm"] = wasmExports["ts_node_first_named_child_for_byte_wasm"];
|
|
6920
|
-
var _ts_node_grammar_symbol_wasm = Module["_ts_node_grammar_symbol_wasm"] = wasmExports["ts_node_grammar_symbol_wasm"];
|
|
6921
|
-
var _ts_node_child_count_wasm = Module["_ts_node_child_count_wasm"] = wasmExports["ts_node_child_count_wasm"];
|
|
6922
|
-
var _ts_node_named_child_count_wasm = Module["_ts_node_named_child_count_wasm"] = wasmExports["ts_node_named_child_count_wasm"];
|
|
6923
|
-
var _ts_node_child_wasm = Module["_ts_node_child_wasm"] = wasmExports["ts_node_child_wasm"];
|
|
6924
|
-
var _ts_node_named_child_wasm = Module["_ts_node_named_child_wasm"] = wasmExports["ts_node_named_child_wasm"];
|
|
6925
|
-
var _ts_node_child_by_field_id_wasm = Module["_ts_node_child_by_field_id_wasm"] = wasmExports["ts_node_child_by_field_id_wasm"];
|
|
6926
|
-
var _ts_node_next_sibling_wasm = Module["_ts_node_next_sibling_wasm"] = wasmExports["ts_node_next_sibling_wasm"];
|
|
6927
|
-
var _ts_node_prev_sibling_wasm = Module["_ts_node_prev_sibling_wasm"] = wasmExports["ts_node_prev_sibling_wasm"];
|
|
6928
|
-
var _ts_node_next_named_sibling_wasm = Module["_ts_node_next_named_sibling_wasm"] = wasmExports["ts_node_next_named_sibling_wasm"];
|
|
6929
|
-
var _ts_node_prev_named_sibling_wasm = Module["_ts_node_prev_named_sibling_wasm"] = wasmExports["ts_node_prev_named_sibling_wasm"];
|
|
6930
|
-
var _ts_node_descendant_count_wasm = Module["_ts_node_descendant_count_wasm"] = wasmExports["ts_node_descendant_count_wasm"];
|
|
6931
|
-
var _ts_node_parent_wasm = Module["_ts_node_parent_wasm"] = wasmExports["ts_node_parent_wasm"];
|
|
6932
|
-
var _ts_node_child_with_descendant_wasm = Module["_ts_node_child_with_descendant_wasm"] = wasmExports["ts_node_child_with_descendant_wasm"];
|
|
6933
|
-
var _ts_node_descendant_for_index_wasm = Module["_ts_node_descendant_for_index_wasm"] = wasmExports["ts_node_descendant_for_index_wasm"];
|
|
6934
|
-
var _ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = wasmExports["ts_node_named_descendant_for_index_wasm"];
|
|
6935
|
-
var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = wasmExports["ts_node_descendant_for_position_wasm"];
|
|
6936
|
-
var _ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = wasmExports["ts_node_named_descendant_for_position_wasm"];
|
|
6937
|
-
var _ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = wasmExports["ts_node_start_point_wasm"];
|
|
6938
|
-
var _ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = wasmExports["ts_node_end_point_wasm"];
|
|
6939
|
-
var _ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = wasmExports["ts_node_start_index_wasm"];
|
|
6940
|
-
var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = wasmExports["ts_node_end_index_wasm"];
|
|
6941
|
-
var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = wasmExports["ts_node_to_string_wasm"];
|
|
6942
|
-
var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = wasmExports["ts_node_children_wasm"];
|
|
6943
|
-
var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = wasmExports["ts_node_named_children_wasm"];
|
|
6944
|
-
var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = wasmExports["ts_node_descendants_of_type_wasm"];
|
|
6945
|
-
var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = wasmExports["ts_node_is_named_wasm"];
|
|
6946
|
-
var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = wasmExports["ts_node_has_changes_wasm"];
|
|
6947
|
-
var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = wasmExports["ts_node_has_error_wasm"];
|
|
6948
|
-
var _ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = wasmExports["ts_node_is_error_wasm"];
|
|
6949
|
-
var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = wasmExports["ts_node_is_missing_wasm"];
|
|
6950
|
-
var _ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = wasmExports["ts_node_is_extra_wasm"];
|
|
6951
|
-
var _ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = wasmExports["ts_node_parse_state_wasm"];
|
|
6952
|
-
var _ts_node_next_parse_state_wasm = Module["_ts_node_next_parse_state_wasm"] = wasmExports["ts_node_next_parse_state_wasm"];
|
|
6953
|
-
var _ts_query_matches_wasm = Module["_ts_query_matches_wasm"] = wasmExports["ts_query_matches_wasm"];
|
|
6954
|
-
var _ts_query_captures_wasm = Module["_ts_query_captures_wasm"] = wasmExports["ts_query_captures_wasm"];
|
|
6955
|
-
var _memset = Module["_memset"] = wasmExports["memset"];
|
|
6956
|
-
var _memcpy = Module["_memcpy"] = wasmExports["memcpy"];
|
|
6957
|
-
var _memmove = Module["_memmove"] = wasmExports["memmove"];
|
|
6958
|
-
var _iswalpha = Module["_iswalpha"] = wasmExports["iswalpha"];
|
|
6959
|
-
var _iswblank = Module["_iswblank"] = wasmExports["iswblank"];
|
|
6960
|
-
var _iswdigit = Module["_iswdigit"] = wasmExports["iswdigit"];
|
|
6961
|
-
var _iswlower = Module["_iswlower"] = wasmExports["iswlower"];
|
|
6962
|
-
var _iswupper = Module["_iswupper"] = wasmExports["iswupper"];
|
|
6963
|
-
var _iswxdigit = Module["_iswxdigit"] = wasmExports["iswxdigit"];
|
|
6964
|
-
var _memchr = Module["_memchr"] = wasmExports["memchr"];
|
|
6965
|
-
var _strlen = Module["_strlen"] = wasmExports["strlen"];
|
|
6966
|
-
var _strcmp = Module["_strcmp"] = wasmExports["strcmp"];
|
|
6967
|
-
var _strncat = Module["_strncat"] = wasmExports["strncat"];
|
|
6968
|
-
var _strncpy = Module["_strncpy"] = wasmExports["strncpy"];
|
|
6969
|
-
var _towlower = Module["_towlower"] = wasmExports["towlower"];
|
|
6970
|
-
var _towupper = Module["_towupper"] = wasmExports["towupper"];
|
|
6971
|
-
var _setThrew = wasmExports["setThrew"];
|
|
6972
|
-
var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"];
|
|
6973
|
-
var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"];
|
|
6974
|
-
var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"];
|
|
6975
|
-
var ___wasm_apply_data_relocs = wasmExports["__wasm_apply_data_relocs"];
|
|
6976
|
-
Module["setValue"] = setValue;
|
|
6977
|
-
Module["getValue"] = getValue;
|
|
6978
|
-
Module["UTF8ToString"] = UTF8ToString;
|
|
6979
|
-
Module["stringToUTF8"] = stringToUTF8;
|
|
6980
|
-
Module["lengthBytesUTF8"] = lengthBytesUTF8;
|
|
6981
|
-
Module["AsciiToString"] = AsciiToString;
|
|
6982
|
-
Module["stringToUTF16"] = stringToUTF16;
|
|
6983
|
-
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
6984
|
-
function callMain(args2 = []) {
|
|
6985
|
-
var entryFunction = resolveGlobalSymbol("main").sym;
|
|
6986
|
-
if (!entryFunction)
|
|
6987
|
-
return;
|
|
6988
|
-
args2.unshift(thisProgram);
|
|
6989
|
-
var argc = args2.length;
|
|
6990
|
-
var argv = stackAlloc((argc + 1) * 4);
|
|
6991
|
-
var argv_ptr = argv;
|
|
6992
|
-
args2.forEach((arg) => {
|
|
6993
|
-
LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, stringToUTF8OnStack(arg));
|
|
6994
|
-
argv_ptr += 4;
|
|
6995
|
-
});
|
|
6996
|
-
LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, 0);
|
|
6997
|
-
try {
|
|
6998
|
-
var ret = entryFunction(argc, argv);
|
|
6999
|
-
exitJS(ret, true);
|
|
7000
|
-
return ret;
|
|
7001
|
-
} catch (e) {
|
|
7002
|
-
return handleException(e);
|
|
7003
|
-
}
|
|
7004
5994
|
}
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
if (
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
} else {
|
|
7037
|
-
doRun();
|
|
7038
|
-
}
|
|
5995
|
+
}, "reportUndefinedSymbols");
|
|
5996
|
+
var runDependencies = 0;
|
|
5997
|
+
var dependenciesFulfilled = null;
|
|
5998
|
+
var removeRunDependency = /* @__PURE__ */ __name((id) => {
|
|
5999
|
+
runDependencies--;
|
|
6000
|
+
Module["monitorRunDependencies"]?.(runDependencies);
|
|
6001
|
+
if (runDependencies == 0) {
|
|
6002
|
+
if (dependenciesFulfilled) {
|
|
6003
|
+
var callback = dependenciesFulfilled;
|
|
6004
|
+
dependenciesFulfilled = null;
|
|
6005
|
+
callback();
|
|
6006
|
+
}
|
|
6007
|
+
}
|
|
6008
|
+
}, "removeRunDependency");
|
|
6009
|
+
var addRunDependency = /* @__PURE__ */ __name((id) => {
|
|
6010
|
+
runDependencies++;
|
|
6011
|
+
Module["monitorRunDependencies"]?.(runDependencies);
|
|
6012
|
+
}, "addRunDependency");
|
|
6013
|
+
var loadDylibs = /* @__PURE__ */ __name(async () => {
|
|
6014
|
+
if (!dynamicLibraries.length) {
|
|
6015
|
+
reportUndefinedSymbols();
|
|
6016
|
+
return;
|
|
6017
|
+
}
|
|
6018
|
+
addRunDependency("loadDylibs");
|
|
6019
|
+
for (var lib of dynamicLibraries) {
|
|
6020
|
+
await loadDynamicLibrary(lib, {
|
|
6021
|
+
loadAsync: true,
|
|
6022
|
+
global: true,
|
|
6023
|
+
nodelete: true,
|
|
6024
|
+
allowUndefined: true
|
|
6025
|
+
});
|
|
7039
6026
|
}
|
|
7040
|
-
|
|
7041
|
-
|
|
6027
|
+
reportUndefinedSymbols();
|
|
6028
|
+
removeRunDependency("loadDylibs");
|
|
6029
|
+
}, "loadDylibs");
|
|
6030
|
+
var noExitRuntime = true;
|
|
6031
|
+
function setValue(ptr, value, type = "i8") {
|
|
6032
|
+
if (type.endsWith("*"))
|
|
6033
|
+
type = "*";
|
|
6034
|
+
switch (type) {
|
|
6035
|
+
case "i1":
|
|
6036
|
+
HEAP8[ptr] = value;
|
|
6037
|
+
break;
|
|
6038
|
+
case "i8":
|
|
6039
|
+
HEAP8[ptr] = value;
|
|
6040
|
+
break;
|
|
6041
|
+
case "i16":
|
|
6042
|
+
LE_HEAP_STORE_I16((ptr >> 1) * 2, value);
|
|
6043
|
+
break;
|
|
6044
|
+
case "i32":
|
|
6045
|
+
LE_HEAP_STORE_I32((ptr >> 2) * 4, value);
|
|
6046
|
+
break;
|
|
6047
|
+
case "i64":
|
|
6048
|
+
LE_HEAP_STORE_I64((ptr >> 3) * 8, BigInt(value));
|
|
6049
|
+
break;
|
|
6050
|
+
case "float":
|
|
6051
|
+
LE_HEAP_STORE_F32((ptr >> 2) * 4, value);
|
|
6052
|
+
break;
|
|
6053
|
+
case "double":
|
|
6054
|
+
LE_HEAP_STORE_F64((ptr >> 3) * 8, value);
|
|
6055
|
+
break;
|
|
6056
|
+
case "*":
|
|
6057
|
+
LE_HEAP_STORE_U32((ptr >> 2) * 4, value);
|
|
6058
|
+
break;
|
|
6059
|
+
default:
|
|
6060
|
+
abort(`invalid type for setValue: ${type}`);
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
__name(setValue, "setValue");
|
|
6064
|
+
var ___memory_base = new WebAssembly.Global({
|
|
6065
|
+
value: "i32",
|
|
6066
|
+
mutable: false
|
|
6067
|
+
}, 1024);
|
|
6068
|
+
var ___stack_high = 78240;
|
|
6069
|
+
var ___stack_low = 12704;
|
|
6070
|
+
var ___stack_pointer = new WebAssembly.Global({
|
|
6071
|
+
value: "i32",
|
|
6072
|
+
mutable: true
|
|
6073
|
+
}, 78240);
|
|
6074
|
+
var ___table_base = new WebAssembly.Global({
|
|
6075
|
+
value: "i32",
|
|
6076
|
+
mutable: false
|
|
6077
|
+
}, 1);
|
|
6078
|
+
var __abort_js = /* @__PURE__ */ __name(() => abort(""), "__abort_js");
|
|
6079
|
+
__abort_js.sig = "v";
|
|
6080
|
+
var getHeapMax = /* @__PURE__ */ __name(() => 2147483648, "getHeapMax");
|
|
6081
|
+
var growMemory = /* @__PURE__ */ __name((size) => {
|
|
6082
|
+
var oldHeapSize = wasmMemory.buffer.byteLength;
|
|
6083
|
+
var pages = (size - oldHeapSize + 65535) / 65536 | 0;
|
|
6084
|
+
try {
|
|
6085
|
+
wasmMemory.grow(pages);
|
|
6086
|
+
updateMemoryViews();
|
|
6087
|
+
return 1;
|
|
6088
|
+
} catch (e) {}
|
|
6089
|
+
}, "growMemory");
|
|
6090
|
+
var _emscripten_resize_heap = /* @__PURE__ */ __name((requestedSize) => {
|
|
6091
|
+
var oldSize = HEAPU8.length;
|
|
6092
|
+
requestedSize >>>= 0;
|
|
6093
|
+
var maxHeapSize = getHeapMax();
|
|
6094
|
+
if (requestedSize > maxHeapSize) {
|
|
6095
|
+
return false;
|
|
6096
|
+
}
|
|
6097
|
+
for (var cutDown = 1;cutDown <= 4; cutDown *= 2) {
|
|
6098
|
+
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
|
|
6099
|
+
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
|
|
6100
|
+
var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
6101
|
+
var replacement = growMemory(newSize);
|
|
6102
|
+
if (replacement) {
|
|
6103
|
+
return true;
|
|
6104
|
+
}
|
|
6105
|
+
}
|
|
6106
|
+
return false;
|
|
6107
|
+
}, "_emscripten_resize_heap");
|
|
6108
|
+
_emscripten_resize_heap.sig = "ip";
|
|
6109
|
+
var _fd_close = /* @__PURE__ */ __name((fd) => 52, "_fd_close");
|
|
6110
|
+
_fd_close.sig = "ii";
|
|
6111
|
+
var INT53_MAX = 9007199254740992;
|
|
6112
|
+
var INT53_MIN = -9007199254740992;
|
|
6113
|
+
var bigintToI53Checked = /* @__PURE__ */ __name((num) => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num), "bigintToI53Checked");
|
|
6114
|
+
function _fd_seek(fd, offset, whence, newOffset) {
|
|
6115
|
+
offset = bigintToI53Checked(offset);
|
|
6116
|
+
return 70;
|
|
6117
|
+
}
|
|
6118
|
+
__name(_fd_seek, "_fd_seek");
|
|
6119
|
+
_fd_seek.sig = "iijip";
|
|
6120
|
+
var printCharBuffers = [null, [], []];
|
|
6121
|
+
var printChar = /* @__PURE__ */ __name((stream, curr) => {
|
|
6122
|
+
var buffer = printCharBuffers[stream];
|
|
6123
|
+
if (curr === 0 || curr === 10) {
|
|
6124
|
+
(stream === 1 ? out : err)(UTF8ArrayToString(buffer));
|
|
6125
|
+
buffer.length = 0;
|
|
6126
|
+
} else {
|
|
6127
|
+
buffer.push(curr);
|
|
6128
|
+
}
|
|
6129
|
+
}, "printChar");
|
|
6130
|
+
var _fd_write = /* @__PURE__ */ __name((fd, iov, iovcnt, pnum) => {
|
|
6131
|
+
var num = 0;
|
|
6132
|
+
for (var i2 = 0;i2 < iovcnt; i2++) {
|
|
6133
|
+
var ptr = LE_HEAP_LOAD_U32((iov >> 2) * 4);
|
|
6134
|
+
var len = LE_HEAP_LOAD_U32((iov + 4 >> 2) * 4);
|
|
6135
|
+
iov += 8;
|
|
6136
|
+
for (var j = 0;j < len; j++) {
|
|
6137
|
+
printChar(fd, HEAPU8[ptr + j]);
|
|
6138
|
+
}
|
|
6139
|
+
num += len;
|
|
6140
|
+
}
|
|
6141
|
+
LE_HEAP_STORE_U32((pnum >> 2) * 4, num);
|
|
6142
|
+
return 0;
|
|
6143
|
+
}, "_fd_write");
|
|
6144
|
+
_fd_write.sig = "iippp";
|
|
6145
|
+
function _tree_sitter_log_callback(isLexMessage, messageAddress) {
|
|
6146
|
+
if (Module.currentLogCallback) {
|
|
6147
|
+
const message = UTF8ToString(messageAddress);
|
|
6148
|
+
Module.currentLogCallback(message, isLexMessage !== 0);
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6151
|
+
__name(_tree_sitter_log_callback, "_tree_sitter_log_callback");
|
|
6152
|
+
function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
|
|
6153
|
+
const INPUT_BUFFER_SIZE = 10240;
|
|
6154
|
+
const string = Module.currentParseCallback(index, {
|
|
6155
|
+
row,
|
|
6156
|
+
column
|
|
6157
|
+
});
|
|
6158
|
+
if (typeof string === "string") {
|
|
6159
|
+
setValue(lengthAddress, string.length, "i32");
|
|
6160
|
+
stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
|
|
6161
|
+
} else {
|
|
6162
|
+
setValue(lengthAddress, 0, "i32");
|
|
6163
|
+
}
|
|
6164
|
+
}
|
|
6165
|
+
__name(_tree_sitter_parse_callback, "_tree_sitter_parse_callback");
|
|
6166
|
+
function _tree_sitter_progress_callback(currentOffset, hasError) {
|
|
6167
|
+
if (Module.currentProgressCallback) {
|
|
6168
|
+
return Module.currentProgressCallback({
|
|
6169
|
+
currentOffset,
|
|
6170
|
+
hasError
|
|
6171
|
+
});
|
|
6172
|
+
}
|
|
6173
|
+
return false;
|
|
6174
|
+
}
|
|
6175
|
+
__name(_tree_sitter_progress_callback, "_tree_sitter_progress_callback");
|
|
6176
|
+
function _tree_sitter_query_progress_callback(currentOffset) {
|
|
6177
|
+
if (Module.currentQueryProgressCallback) {
|
|
6178
|
+
return Module.currentQueryProgressCallback({
|
|
6179
|
+
currentOffset
|
|
6180
|
+
});
|
|
6181
|
+
}
|
|
6182
|
+
return false;
|
|
6183
|
+
}
|
|
6184
|
+
__name(_tree_sitter_query_progress_callback, "_tree_sitter_query_progress_callback");
|
|
6185
|
+
var runtimeKeepaliveCounter = 0;
|
|
6186
|
+
var keepRuntimeAlive = /* @__PURE__ */ __name(() => noExitRuntime || runtimeKeepaliveCounter > 0, "keepRuntimeAlive");
|
|
6187
|
+
var _proc_exit = /* @__PURE__ */ __name((code) => {
|
|
6188
|
+
EXITSTATUS = code;
|
|
6189
|
+
if (!keepRuntimeAlive()) {
|
|
6190
|
+
Module["onExit"]?.(code);
|
|
6191
|
+
ABORT = true;
|
|
6192
|
+
}
|
|
6193
|
+
quit_(code, new ExitStatus(code));
|
|
6194
|
+
}, "_proc_exit");
|
|
6195
|
+
_proc_exit.sig = "vi";
|
|
6196
|
+
var exitJS = /* @__PURE__ */ __name((status, implicit) => {
|
|
6197
|
+
EXITSTATUS = status;
|
|
6198
|
+
_proc_exit(status);
|
|
6199
|
+
}, "exitJS");
|
|
6200
|
+
var handleException = /* @__PURE__ */ __name((e) => {
|
|
6201
|
+
if (e instanceof ExitStatus || e == "unwind") {
|
|
6202
|
+
return EXITSTATUS;
|
|
6203
|
+
}
|
|
6204
|
+
quit_(1, e);
|
|
6205
|
+
}, "handleException");
|
|
6206
|
+
var lengthBytesUTF8 = /* @__PURE__ */ __name((str) => {
|
|
6207
|
+
var len = 0;
|
|
6208
|
+
for (var i2 = 0;i2 < str.length; ++i2) {
|
|
6209
|
+
var c = str.charCodeAt(i2);
|
|
6210
|
+
if (c <= 127) {
|
|
6211
|
+
len++;
|
|
6212
|
+
} else if (c <= 2047) {
|
|
6213
|
+
len += 2;
|
|
6214
|
+
} else if (c >= 55296 && c <= 57343) {
|
|
6215
|
+
len += 4;
|
|
6216
|
+
++i2;
|
|
6217
|
+
} else {
|
|
6218
|
+
len += 3;
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
return len;
|
|
6222
|
+
}, "lengthBytesUTF8");
|
|
6223
|
+
var stringToUTF8Array = /* @__PURE__ */ __name((str, heap, outIdx, maxBytesToWrite) => {
|
|
6224
|
+
if (!(maxBytesToWrite > 0))
|
|
6225
|
+
return 0;
|
|
6226
|
+
var startIdx = outIdx;
|
|
6227
|
+
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
6228
|
+
for (var i2 = 0;i2 < str.length; ++i2) {
|
|
6229
|
+
var u = str.codePointAt(i2);
|
|
6230
|
+
if (u <= 127) {
|
|
6231
|
+
if (outIdx >= endIdx)
|
|
6232
|
+
break;
|
|
6233
|
+
heap[outIdx++] = u;
|
|
6234
|
+
} else if (u <= 2047) {
|
|
6235
|
+
if (outIdx + 1 >= endIdx)
|
|
6236
|
+
break;
|
|
6237
|
+
heap[outIdx++] = 192 | u >> 6;
|
|
6238
|
+
heap[outIdx++] = 128 | u & 63;
|
|
6239
|
+
} else if (u <= 65535) {
|
|
6240
|
+
if (outIdx + 2 >= endIdx)
|
|
6241
|
+
break;
|
|
6242
|
+
heap[outIdx++] = 224 | u >> 12;
|
|
6243
|
+
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
6244
|
+
heap[outIdx++] = 128 | u & 63;
|
|
6245
|
+
} else {
|
|
6246
|
+
if (outIdx + 3 >= endIdx)
|
|
6247
|
+
break;
|
|
6248
|
+
heap[outIdx++] = 240 | u >> 18;
|
|
6249
|
+
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
6250
|
+
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
6251
|
+
heap[outIdx++] = 128 | u & 63;
|
|
6252
|
+
i2++;
|
|
6253
|
+
}
|
|
6254
|
+
}
|
|
6255
|
+
heap[outIdx] = 0;
|
|
6256
|
+
return outIdx - startIdx;
|
|
6257
|
+
}, "stringToUTF8Array");
|
|
6258
|
+
var stringToUTF8 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite), "stringToUTF8");
|
|
6259
|
+
var stackAlloc = /* @__PURE__ */ __name((sz) => __emscripten_stack_alloc(sz), "stackAlloc");
|
|
6260
|
+
var stringToUTF8OnStack = /* @__PURE__ */ __name((str) => {
|
|
6261
|
+
var size = lengthBytesUTF8(str) + 1;
|
|
6262
|
+
var ret = stackAlloc(size);
|
|
6263
|
+
stringToUTF8(str, ret, size);
|
|
6264
|
+
return ret;
|
|
6265
|
+
}, "stringToUTF8OnStack");
|
|
6266
|
+
var AsciiToString = /* @__PURE__ */ __name((ptr) => {
|
|
6267
|
+
var str = "";
|
|
6268
|
+
while (true) {
|
|
6269
|
+
var ch = HEAPU8[ptr++];
|
|
6270
|
+
if (!ch)
|
|
6271
|
+
return str;
|
|
6272
|
+
str += String.fromCharCode(ch);
|
|
6273
|
+
}
|
|
6274
|
+
}, "AsciiToString");
|
|
6275
|
+
var stringToUTF16 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => {
|
|
6276
|
+
maxBytesToWrite ??= 2147483647;
|
|
6277
|
+
if (maxBytesToWrite < 2)
|
|
6278
|
+
return 0;
|
|
6279
|
+
maxBytesToWrite -= 2;
|
|
6280
|
+
var startPtr = outPtr;
|
|
6281
|
+
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
6282
|
+
for (var i2 = 0;i2 < numCharsToWrite; ++i2) {
|
|
6283
|
+
var codeUnit = str.charCodeAt(i2);
|
|
6284
|
+
LE_HEAP_STORE_I16((outPtr >> 1) * 2, codeUnit);
|
|
6285
|
+
outPtr += 2;
|
|
6286
|
+
}
|
|
6287
|
+
LE_HEAP_STORE_I16((outPtr >> 1) * 2, 0);
|
|
6288
|
+
return outPtr - startPtr;
|
|
6289
|
+
}, "stringToUTF16");
|
|
6290
|
+
LE_ATOMICS_NATIVE_BYTE_ORDER = new Int8Array(new Int16Array([1]).buffer)[0] === 1 ? [
|
|
6291
|
+
(x) => x,
|
|
6292
|
+
(x) => x,
|
|
6293
|
+
undefined,
|
|
6294
|
+
(x) => x
|
|
6295
|
+
] : [
|
|
6296
|
+
(x) => x,
|
|
6297
|
+
(x) => ((x & 65280) << 8 | (x & 255) << 24) >> 16,
|
|
6298
|
+
undefined,
|
|
6299
|
+
(x) => x >> 24 & 255 | x >> 8 & 65280 | (x & 65280) << 8 | (x & 255) << 24
|
|
6300
|
+
];
|
|
6301
|
+
function LE_HEAP_UPDATE() {
|
|
6302
|
+
HEAPU16.unsigned = (x) => x & 65535;
|
|
6303
|
+
HEAPU32.unsigned = (x) => x >>> 0;
|
|
6304
|
+
}
|
|
6305
|
+
__name(LE_HEAP_UPDATE, "LE_HEAP_UPDATE");
|
|
6306
|
+
{
|
|
6307
|
+
initMemory();
|
|
6308
|
+
if (Module["noExitRuntime"])
|
|
6309
|
+
noExitRuntime = Module["noExitRuntime"];
|
|
6310
|
+
if (Module["print"])
|
|
6311
|
+
out = Module["print"];
|
|
6312
|
+
if (Module["printErr"])
|
|
6313
|
+
err = Module["printErr"];
|
|
6314
|
+
if (Module["dynamicLibraries"])
|
|
6315
|
+
dynamicLibraries = Module["dynamicLibraries"];
|
|
6316
|
+
if (Module["wasmBinary"])
|
|
6317
|
+
wasmBinary = Module["wasmBinary"];
|
|
6318
|
+
if (Module["arguments"])
|
|
6319
|
+
arguments_ = Module["arguments"];
|
|
6320
|
+
if (Module["thisProgram"])
|
|
6321
|
+
thisProgram = Module["thisProgram"];
|
|
6322
|
+
if (Module["preInit"]) {
|
|
7042
6323
|
if (typeof Module["preInit"] == "function")
|
|
7043
6324
|
Module["preInit"] = [Module["preInit"]];
|
|
7044
6325
|
while (Module["preInit"].length > 0) {
|
|
7045
|
-
Module["preInit"].
|
|
7046
|
-
}
|
|
7047
|
-
}
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
6326
|
+
Module["preInit"].shift()();
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6330
|
+
Module["setValue"] = setValue;
|
|
6331
|
+
Module["getValue"] = getValue;
|
|
6332
|
+
Module["UTF8ToString"] = UTF8ToString;
|
|
6333
|
+
Module["stringToUTF8"] = stringToUTF8;
|
|
6334
|
+
Module["lengthBytesUTF8"] = lengthBytesUTF8;
|
|
6335
|
+
Module["AsciiToString"] = AsciiToString;
|
|
6336
|
+
Module["stringToUTF16"] = stringToUTF16;
|
|
6337
|
+
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
6338
|
+
Module["LE_HEAP_STORE_I64"] = LE_HEAP_STORE_I64;
|
|
6339
|
+
var ASM_CONSTS = {};
|
|
6340
|
+
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
6341
|
+
function assignWasmExports(wasmExports2) {
|
|
6342
|
+
Module["_malloc"] = _malloc = wasmExports2["malloc"];
|
|
6343
|
+
Module["_calloc"] = _calloc = wasmExports2["calloc"];
|
|
6344
|
+
Module["_realloc"] = _realloc = wasmExports2["realloc"];
|
|
6345
|
+
Module["_free"] = _free = wasmExports2["free"];
|
|
6346
|
+
Module["_ts_range_edit"] = _ts_range_edit = wasmExports2["ts_range_edit"];
|
|
6347
|
+
Module["_memcmp"] = _memcmp = wasmExports2["memcmp"];
|
|
6348
|
+
Module["_ts_language_symbol_count"] = _ts_language_symbol_count = wasmExports2["ts_language_symbol_count"];
|
|
6349
|
+
Module["_ts_language_state_count"] = _ts_language_state_count = wasmExports2["ts_language_state_count"];
|
|
6350
|
+
Module["_ts_language_abi_version"] = _ts_language_abi_version = wasmExports2["ts_language_abi_version"];
|
|
6351
|
+
Module["_ts_language_name"] = _ts_language_name = wasmExports2["ts_language_name"];
|
|
6352
|
+
Module["_ts_language_field_count"] = _ts_language_field_count = wasmExports2["ts_language_field_count"];
|
|
6353
|
+
Module["_ts_language_next_state"] = _ts_language_next_state = wasmExports2["ts_language_next_state"];
|
|
6354
|
+
Module["_ts_language_symbol_name"] = _ts_language_symbol_name = wasmExports2["ts_language_symbol_name"];
|
|
6355
|
+
Module["_ts_language_symbol_for_name"] = _ts_language_symbol_for_name = wasmExports2["ts_language_symbol_for_name"];
|
|
6356
|
+
Module["_strncmp"] = _strncmp = wasmExports2["strncmp"];
|
|
6357
|
+
Module["_ts_language_symbol_type"] = _ts_language_symbol_type = wasmExports2["ts_language_symbol_type"];
|
|
6358
|
+
Module["_ts_language_field_name_for_id"] = _ts_language_field_name_for_id = wasmExports2["ts_language_field_name_for_id"];
|
|
6359
|
+
Module["_ts_lookahead_iterator_new"] = _ts_lookahead_iterator_new = wasmExports2["ts_lookahead_iterator_new"];
|
|
6360
|
+
Module["_ts_lookahead_iterator_delete"] = _ts_lookahead_iterator_delete = wasmExports2["ts_lookahead_iterator_delete"];
|
|
6361
|
+
Module["_ts_lookahead_iterator_reset_state"] = _ts_lookahead_iterator_reset_state = wasmExports2["ts_lookahead_iterator_reset_state"];
|
|
6362
|
+
Module["_ts_lookahead_iterator_reset"] = _ts_lookahead_iterator_reset = wasmExports2["ts_lookahead_iterator_reset"];
|
|
6363
|
+
Module["_ts_lookahead_iterator_next"] = _ts_lookahead_iterator_next = wasmExports2["ts_lookahead_iterator_next"];
|
|
6364
|
+
Module["_ts_lookahead_iterator_current_symbol"] = _ts_lookahead_iterator_current_symbol = wasmExports2["ts_lookahead_iterator_current_symbol"];
|
|
6365
|
+
Module["_ts_point_edit"] = _ts_point_edit = wasmExports2["ts_point_edit"];
|
|
6366
|
+
Module["_ts_parser_delete"] = _ts_parser_delete = wasmExports2["ts_parser_delete"];
|
|
6367
|
+
Module["_ts_parser_reset"] = _ts_parser_reset = wasmExports2["ts_parser_reset"];
|
|
6368
|
+
Module["_ts_parser_set_language"] = _ts_parser_set_language = wasmExports2["ts_parser_set_language"];
|
|
6369
|
+
Module["_ts_parser_set_included_ranges"] = _ts_parser_set_included_ranges = wasmExports2["ts_parser_set_included_ranges"];
|
|
6370
|
+
Module["_ts_query_new"] = _ts_query_new = wasmExports2["ts_query_new"];
|
|
6371
|
+
Module["_ts_query_delete"] = _ts_query_delete = wasmExports2["ts_query_delete"];
|
|
6372
|
+
Module["_iswspace"] = _iswspace = wasmExports2["iswspace"];
|
|
6373
|
+
Module["_iswalnum"] = _iswalnum = wasmExports2["iswalnum"];
|
|
6374
|
+
Module["_ts_query_pattern_count"] = _ts_query_pattern_count = wasmExports2["ts_query_pattern_count"];
|
|
6375
|
+
Module["_ts_query_capture_count"] = _ts_query_capture_count = wasmExports2["ts_query_capture_count"];
|
|
6376
|
+
Module["_ts_query_string_count"] = _ts_query_string_count = wasmExports2["ts_query_string_count"];
|
|
6377
|
+
Module["_ts_query_capture_name_for_id"] = _ts_query_capture_name_for_id = wasmExports2["ts_query_capture_name_for_id"];
|
|
6378
|
+
Module["_ts_query_capture_quantifier_for_id"] = _ts_query_capture_quantifier_for_id = wasmExports2["ts_query_capture_quantifier_for_id"];
|
|
6379
|
+
Module["_ts_query_string_value_for_id"] = _ts_query_string_value_for_id = wasmExports2["ts_query_string_value_for_id"];
|
|
6380
|
+
Module["_ts_query_predicates_for_pattern"] = _ts_query_predicates_for_pattern = wasmExports2["ts_query_predicates_for_pattern"];
|
|
6381
|
+
Module["_ts_query_start_byte_for_pattern"] = _ts_query_start_byte_for_pattern = wasmExports2["ts_query_start_byte_for_pattern"];
|
|
6382
|
+
Module["_ts_query_end_byte_for_pattern"] = _ts_query_end_byte_for_pattern = wasmExports2["ts_query_end_byte_for_pattern"];
|
|
6383
|
+
Module["_ts_query_is_pattern_rooted"] = _ts_query_is_pattern_rooted = wasmExports2["ts_query_is_pattern_rooted"];
|
|
6384
|
+
Module["_ts_query_is_pattern_non_local"] = _ts_query_is_pattern_non_local = wasmExports2["ts_query_is_pattern_non_local"];
|
|
6385
|
+
Module["_ts_query_is_pattern_guaranteed_at_step"] = _ts_query_is_pattern_guaranteed_at_step = wasmExports2["ts_query_is_pattern_guaranteed_at_step"];
|
|
6386
|
+
Module["_ts_query_disable_capture"] = _ts_query_disable_capture = wasmExports2["ts_query_disable_capture"];
|
|
6387
|
+
Module["_ts_query_disable_pattern"] = _ts_query_disable_pattern = wasmExports2["ts_query_disable_pattern"];
|
|
6388
|
+
Module["_ts_tree_copy"] = _ts_tree_copy = wasmExports2["ts_tree_copy"];
|
|
6389
|
+
Module["_ts_tree_delete"] = _ts_tree_delete = wasmExports2["ts_tree_delete"];
|
|
6390
|
+
Module["_ts_init"] = _ts_init = wasmExports2["ts_init"];
|
|
6391
|
+
Module["_ts_parser_new_wasm"] = _ts_parser_new_wasm = wasmExports2["ts_parser_new_wasm"];
|
|
6392
|
+
Module["_ts_parser_enable_logger_wasm"] = _ts_parser_enable_logger_wasm = wasmExports2["ts_parser_enable_logger_wasm"];
|
|
6393
|
+
Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = wasmExports2["ts_parser_parse_wasm"];
|
|
6394
|
+
Module["_ts_parser_included_ranges_wasm"] = _ts_parser_included_ranges_wasm = wasmExports2["ts_parser_included_ranges_wasm"];
|
|
6395
|
+
Module["_ts_language_type_is_named_wasm"] = _ts_language_type_is_named_wasm = wasmExports2["ts_language_type_is_named_wasm"];
|
|
6396
|
+
Module["_ts_language_type_is_visible_wasm"] = _ts_language_type_is_visible_wasm = wasmExports2["ts_language_type_is_visible_wasm"];
|
|
6397
|
+
Module["_ts_language_metadata_wasm"] = _ts_language_metadata_wasm = wasmExports2["ts_language_metadata_wasm"];
|
|
6398
|
+
Module["_ts_language_supertypes_wasm"] = _ts_language_supertypes_wasm = wasmExports2["ts_language_supertypes_wasm"];
|
|
6399
|
+
Module["_ts_language_subtypes_wasm"] = _ts_language_subtypes_wasm = wasmExports2["ts_language_subtypes_wasm"];
|
|
6400
|
+
Module["_ts_tree_root_node_wasm"] = _ts_tree_root_node_wasm = wasmExports2["ts_tree_root_node_wasm"];
|
|
6401
|
+
Module["_ts_tree_root_node_with_offset_wasm"] = _ts_tree_root_node_with_offset_wasm = wasmExports2["ts_tree_root_node_with_offset_wasm"];
|
|
6402
|
+
Module["_ts_tree_edit_wasm"] = _ts_tree_edit_wasm = wasmExports2["ts_tree_edit_wasm"];
|
|
6403
|
+
Module["_ts_tree_included_ranges_wasm"] = _ts_tree_included_ranges_wasm = wasmExports2["ts_tree_included_ranges_wasm"];
|
|
6404
|
+
Module["_ts_tree_get_changed_ranges_wasm"] = _ts_tree_get_changed_ranges_wasm = wasmExports2["ts_tree_get_changed_ranges_wasm"];
|
|
6405
|
+
Module["_ts_tree_cursor_new_wasm"] = _ts_tree_cursor_new_wasm = wasmExports2["ts_tree_cursor_new_wasm"];
|
|
6406
|
+
Module["_ts_tree_cursor_copy_wasm"] = _ts_tree_cursor_copy_wasm = wasmExports2["ts_tree_cursor_copy_wasm"];
|
|
6407
|
+
Module["_ts_tree_cursor_delete_wasm"] = _ts_tree_cursor_delete_wasm = wasmExports2["ts_tree_cursor_delete_wasm"];
|
|
6408
|
+
Module["_ts_tree_cursor_reset_wasm"] = _ts_tree_cursor_reset_wasm = wasmExports2["ts_tree_cursor_reset_wasm"];
|
|
6409
|
+
Module["_ts_tree_cursor_reset_to_wasm"] = _ts_tree_cursor_reset_to_wasm = wasmExports2["ts_tree_cursor_reset_to_wasm"];
|
|
6410
|
+
Module["_ts_tree_cursor_goto_first_child_wasm"] = _ts_tree_cursor_goto_first_child_wasm = wasmExports2["ts_tree_cursor_goto_first_child_wasm"];
|
|
6411
|
+
Module["_ts_tree_cursor_goto_last_child_wasm"] = _ts_tree_cursor_goto_last_child_wasm = wasmExports2["ts_tree_cursor_goto_last_child_wasm"];
|
|
6412
|
+
Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = _ts_tree_cursor_goto_first_child_for_index_wasm = wasmExports2["ts_tree_cursor_goto_first_child_for_index_wasm"];
|
|
6413
|
+
Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = _ts_tree_cursor_goto_first_child_for_position_wasm = wasmExports2["ts_tree_cursor_goto_first_child_for_position_wasm"];
|
|
6414
|
+
Module["_ts_tree_cursor_goto_next_sibling_wasm"] = _ts_tree_cursor_goto_next_sibling_wasm = wasmExports2["ts_tree_cursor_goto_next_sibling_wasm"];
|
|
6415
|
+
Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = _ts_tree_cursor_goto_previous_sibling_wasm = wasmExports2["ts_tree_cursor_goto_previous_sibling_wasm"];
|
|
6416
|
+
Module["_ts_tree_cursor_goto_descendant_wasm"] = _ts_tree_cursor_goto_descendant_wasm = wasmExports2["ts_tree_cursor_goto_descendant_wasm"];
|
|
6417
|
+
Module["_ts_tree_cursor_goto_parent_wasm"] = _ts_tree_cursor_goto_parent_wasm = wasmExports2["ts_tree_cursor_goto_parent_wasm"];
|
|
6418
|
+
Module["_ts_tree_cursor_current_node_type_id_wasm"] = _ts_tree_cursor_current_node_type_id_wasm = wasmExports2["ts_tree_cursor_current_node_type_id_wasm"];
|
|
6419
|
+
Module["_ts_tree_cursor_current_node_state_id_wasm"] = _ts_tree_cursor_current_node_state_id_wasm = wasmExports2["ts_tree_cursor_current_node_state_id_wasm"];
|
|
6420
|
+
Module["_ts_tree_cursor_current_node_is_named_wasm"] = _ts_tree_cursor_current_node_is_named_wasm = wasmExports2["ts_tree_cursor_current_node_is_named_wasm"];
|
|
6421
|
+
Module["_ts_tree_cursor_current_node_is_missing_wasm"] = _ts_tree_cursor_current_node_is_missing_wasm = wasmExports2["ts_tree_cursor_current_node_is_missing_wasm"];
|
|
6422
|
+
Module["_ts_tree_cursor_current_node_id_wasm"] = _ts_tree_cursor_current_node_id_wasm = wasmExports2["ts_tree_cursor_current_node_id_wasm"];
|
|
6423
|
+
Module["_ts_tree_cursor_start_position_wasm"] = _ts_tree_cursor_start_position_wasm = wasmExports2["ts_tree_cursor_start_position_wasm"];
|
|
6424
|
+
Module["_ts_tree_cursor_end_position_wasm"] = _ts_tree_cursor_end_position_wasm = wasmExports2["ts_tree_cursor_end_position_wasm"];
|
|
6425
|
+
Module["_ts_tree_cursor_start_index_wasm"] = _ts_tree_cursor_start_index_wasm = wasmExports2["ts_tree_cursor_start_index_wasm"];
|
|
6426
|
+
Module["_ts_tree_cursor_end_index_wasm"] = _ts_tree_cursor_end_index_wasm = wasmExports2["ts_tree_cursor_end_index_wasm"];
|
|
6427
|
+
Module["_ts_tree_cursor_current_field_id_wasm"] = _ts_tree_cursor_current_field_id_wasm = wasmExports2["ts_tree_cursor_current_field_id_wasm"];
|
|
6428
|
+
Module["_ts_tree_cursor_current_depth_wasm"] = _ts_tree_cursor_current_depth_wasm = wasmExports2["ts_tree_cursor_current_depth_wasm"];
|
|
6429
|
+
Module["_ts_tree_cursor_current_descendant_index_wasm"] = _ts_tree_cursor_current_descendant_index_wasm = wasmExports2["ts_tree_cursor_current_descendant_index_wasm"];
|
|
6430
|
+
Module["_ts_tree_cursor_current_node_wasm"] = _ts_tree_cursor_current_node_wasm = wasmExports2["ts_tree_cursor_current_node_wasm"];
|
|
6431
|
+
Module["_ts_node_symbol_wasm"] = _ts_node_symbol_wasm = wasmExports2["ts_node_symbol_wasm"];
|
|
6432
|
+
Module["_ts_node_field_name_for_child_wasm"] = _ts_node_field_name_for_child_wasm = wasmExports2["ts_node_field_name_for_child_wasm"];
|
|
6433
|
+
Module["_ts_node_field_name_for_named_child_wasm"] = _ts_node_field_name_for_named_child_wasm = wasmExports2["ts_node_field_name_for_named_child_wasm"];
|
|
6434
|
+
Module["_ts_node_children_by_field_id_wasm"] = _ts_node_children_by_field_id_wasm = wasmExports2["ts_node_children_by_field_id_wasm"];
|
|
6435
|
+
Module["_ts_node_first_child_for_byte_wasm"] = _ts_node_first_child_for_byte_wasm = wasmExports2["ts_node_first_child_for_byte_wasm"];
|
|
6436
|
+
Module["_ts_node_first_named_child_for_byte_wasm"] = _ts_node_first_named_child_for_byte_wasm = wasmExports2["ts_node_first_named_child_for_byte_wasm"];
|
|
6437
|
+
Module["_ts_node_grammar_symbol_wasm"] = _ts_node_grammar_symbol_wasm = wasmExports2["ts_node_grammar_symbol_wasm"];
|
|
6438
|
+
Module["_ts_node_child_count_wasm"] = _ts_node_child_count_wasm = wasmExports2["ts_node_child_count_wasm"];
|
|
6439
|
+
Module["_ts_node_named_child_count_wasm"] = _ts_node_named_child_count_wasm = wasmExports2["ts_node_named_child_count_wasm"];
|
|
6440
|
+
Module["_ts_node_child_wasm"] = _ts_node_child_wasm = wasmExports2["ts_node_child_wasm"];
|
|
6441
|
+
Module["_ts_node_named_child_wasm"] = _ts_node_named_child_wasm = wasmExports2["ts_node_named_child_wasm"];
|
|
6442
|
+
Module["_ts_node_child_by_field_id_wasm"] = _ts_node_child_by_field_id_wasm = wasmExports2["ts_node_child_by_field_id_wasm"];
|
|
6443
|
+
Module["_ts_node_next_sibling_wasm"] = _ts_node_next_sibling_wasm = wasmExports2["ts_node_next_sibling_wasm"];
|
|
6444
|
+
Module["_ts_node_prev_sibling_wasm"] = _ts_node_prev_sibling_wasm = wasmExports2["ts_node_prev_sibling_wasm"];
|
|
6445
|
+
Module["_ts_node_next_named_sibling_wasm"] = _ts_node_next_named_sibling_wasm = wasmExports2["ts_node_next_named_sibling_wasm"];
|
|
6446
|
+
Module["_ts_node_prev_named_sibling_wasm"] = _ts_node_prev_named_sibling_wasm = wasmExports2["ts_node_prev_named_sibling_wasm"];
|
|
6447
|
+
Module["_ts_node_descendant_count_wasm"] = _ts_node_descendant_count_wasm = wasmExports2["ts_node_descendant_count_wasm"];
|
|
6448
|
+
Module["_ts_node_parent_wasm"] = _ts_node_parent_wasm = wasmExports2["ts_node_parent_wasm"];
|
|
6449
|
+
Module["_ts_node_child_with_descendant_wasm"] = _ts_node_child_with_descendant_wasm = wasmExports2["ts_node_child_with_descendant_wasm"];
|
|
6450
|
+
Module["_ts_node_descendant_for_index_wasm"] = _ts_node_descendant_for_index_wasm = wasmExports2["ts_node_descendant_for_index_wasm"];
|
|
6451
|
+
Module["_ts_node_named_descendant_for_index_wasm"] = _ts_node_named_descendant_for_index_wasm = wasmExports2["ts_node_named_descendant_for_index_wasm"];
|
|
6452
|
+
Module["_ts_node_descendant_for_position_wasm"] = _ts_node_descendant_for_position_wasm = wasmExports2["ts_node_descendant_for_position_wasm"];
|
|
6453
|
+
Module["_ts_node_named_descendant_for_position_wasm"] = _ts_node_named_descendant_for_position_wasm = wasmExports2["ts_node_named_descendant_for_position_wasm"];
|
|
6454
|
+
Module["_ts_node_start_point_wasm"] = _ts_node_start_point_wasm = wasmExports2["ts_node_start_point_wasm"];
|
|
6455
|
+
Module["_ts_node_end_point_wasm"] = _ts_node_end_point_wasm = wasmExports2["ts_node_end_point_wasm"];
|
|
6456
|
+
Module["_ts_node_start_index_wasm"] = _ts_node_start_index_wasm = wasmExports2["ts_node_start_index_wasm"];
|
|
6457
|
+
Module["_ts_node_end_index_wasm"] = _ts_node_end_index_wasm = wasmExports2["ts_node_end_index_wasm"];
|
|
6458
|
+
Module["_ts_node_to_string_wasm"] = _ts_node_to_string_wasm = wasmExports2["ts_node_to_string_wasm"];
|
|
6459
|
+
Module["_ts_node_children_wasm"] = _ts_node_children_wasm = wasmExports2["ts_node_children_wasm"];
|
|
6460
|
+
Module["_ts_node_named_children_wasm"] = _ts_node_named_children_wasm = wasmExports2["ts_node_named_children_wasm"];
|
|
6461
|
+
Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = wasmExports2["ts_node_descendants_of_type_wasm"];
|
|
6462
|
+
Module["_ts_node_is_named_wasm"] = _ts_node_is_named_wasm = wasmExports2["ts_node_is_named_wasm"];
|
|
6463
|
+
Module["_ts_node_has_changes_wasm"] = _ts_node_has_changes_wasm = wasmExports2["ts_node_has_changes_wasm"];
|
|
6464
|
+
Module["_ts_node_has_error_wasm"] = _ts_node_has_error_wasm = wasmExports2["ts_node_has_error_wasm"];
|
|
6465
|
+
Module["_ts_node_is_error_wasm"] = _ts_node_is_error_wasm = wasmExports2["ts_node_is_error_wasm"];
|
|
6466
|
+
Module["_ts_node_is_missing_wasm"] = _ts_node_is_missing_wasm = wasmExports2["ts_node_is_missing_wasm"];
|
|
6467
|
+
Module["_ts_node_is_extra_wasm"] = _ts_node_is_extra_wasm = wasmExports2["ts_node_is_extra_wasm"];
|
|
6468
|
+
Module["_ts_node_parse_state_wasm"] = _ts_node_parse_state_wasm = wasmExports2["ts_node_parse_state_wasm"];
|
|
6469
|
+
Module["_ts_node_next_parse_state_wasm"] = _ts_node_next_parse_state_wasm = wasmExports2["ts_node_next_parse_state_wasm"];
|
|
6470
|
+
Module["_ts_query_matches_wasm"] = _ts_query_matches_wasm = wasmExports2["ts_query_matches_wasm"];
|
|
6471
|
+
Module["_ts_query_captures_wasm"] = _ts_query_captures_wasm = wasmExports2["ts_query_captures_wasm"];
|
|
6472
|
+
Module["_memset"] = _memset = wasmExports2["memset"];
|
|
6473
|
+
Module["_memcpy"] = _memcpy = wasmExports2["memcpy"];
|
|
6474
|
+
Module["_memmove"] = _memmove = wasmExports2["memmove"];
|
|
6475
|
+
Module["_iswalpha"] = _iswalpha = wasmExports2["iswalpha"];
|
|
6476
|
+
Module["_iswblank"] = _iswblank = wasmExports2["iswblank"];
|
|
6477
|
+
Module["_iswdigit"] = _iswdigit = wasmExports2["iswdigit"];
|
|
6478
|
+
Module["_iswlower"] = _iswlower = wasmExports2["iswlower"];
|
|
6479
|
+
Module["_iswupper"] = _iswupper = wasmExports2["iswupper"];
|
|
6480
|
+
Module["_iswxdigit"] = _iswxdigit = wasmExports2["iswxdigit"];
|
|
6481
|
+
Module["_memchr"] = _memchr = wasmExports2["memchr"];
|
|
6482
|
+
Module["_strlen"] = _strlen = wasmExports2["strlen"];
|
|
6483
|
+
Module["_strcmp"] = _strcmp = wasmExports2["strcmp"];
|
|
6484
|
+
Module["_strncat"] = _strncat = wasmExports2["strncat"];
|
|
6485
|
+
Module["_strncpy"] = _strncpy = wasmExports2["strncpy"];
|
|
6486
|
+
Module["_towlower"] = _towlower = wasmExports2["towlower"];
|
|
6487
|
+
Module["_towupper"] = _towupper = wasmExports2["towupper"];
|
|
6488
|
+
_setThrew = wasmExports2["setThrew"];
|
|
6489
|
+
__emscripten_stack_restore = wasmExports2["_emscripten_stack_restore"];
|
|
6490
|
+
__emscripten_stack_alloc = wasmExports2["_emscripten_stack_alloc"];
|
|
6491
|
+
_emscripten_stack_get_current = wasmExports2["emscripten_stack_get_current"];
|
|
6492
|
+
___wasm_apply_data_relocs = wasmExports2["__wasm_apply_data_relocs"];
|
|
6493
|
+
}
|
|
6494
|
+
__name(assignWasmExports, "assignWasmExports");
|
|
6495
|
+
var wasmImports = {
|
|
6496
|
+
__heap_base: ___heap_base,
|
|
6497
|
+
__indirect_function_table: wasmTable,
|
|
6498
|
+
__memory_base: ___memory_base,
|
|
6499
|
+
__stack_high: ___stack_high,
|
|
6500
|
+
__stack_low: ___stack_low,
|
|
6501
|
+
__stack_pointer: ___stack_pointer,
|
|
6502
|
+
__table_base: ___table_base,
|
|
6503
|
+
_abort_js: __abort_js,
|
|
6504
|
+
emscripten_resize_heap: _emscripten_resize_heap,
|
|
6505
|
+
fd_close: _fd_close,
|
|
6506
|
+
fd_seek: _fd_seek,
|
|
6507
|
+
fd_write: _fd_write,
|
|
6508
|
+
memory: wasmMemory,
|
|
6509
|
+
tree_sitter_log_callback: _tree_sitter_log_callback,
|
|
6510
|
+
tree_sitter_parse_callback: _tree_sitter_parse_callback,
|
|
6511
|
+
tree_sitter_progress_callback: _tree_sitter_progress_callback,
|
|
6512
|
+
tree_sitter_query_progress_callback: _tree_sitter_query_progress_callback
|
|
7051
6513
|
};
|
|
7052
|
-
|
|
7053
|
-
var
|
|
6514
|
+
function callMain(args2 = []) {
|
|
6515
|
+
var entryFunction = resolveGlobalSymbol("main").sym;
|
|
6516
|
+
if (!entryFunction)
|
|
6517
|
+
return;
|
|
6518
|
+
args2.unshift(thisProgram);
|
|
6519
|
+
var argc = args2.length;
|
|
6520
|
+
var argv = stackAlloc((argc + 1) * 4);
|
|
6521
|
+
var argv_ptr = argv;
|
|
6522
|
+
args2.forEach((arg) => {
|
|
6523
|
+
LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, stringToUTF8OnStack(arg));
|
|
6524
|
+
argv_ptr += 4;
|
|
6525
|
+
});
|
|
6526
|
+
LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, 0);
|
|
6527
|
+
try {
|
|
6528
|
+
var ret = entryFunction(argc, argv);
|
|
6529
|
+
exitJS(ret, true);
|
|
6530
|
+
return ret;
|
|
6531
|
+
} catch (e) {
|
|
6532
|
+
return handleException(e);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
__name(callMain, "callMain");
|
|
6536
|
+
function run(args2 = arguments_) {
|
|
6537
|
+
if (runDependencies > 0) {
|
|
6538
|
+
dependenciesFulfilled = run;
|
|
6539
|
+
return;
|
|
6540
|
+
}
|
|
6541
|
+
preRun();
|
|
6542
|
+
if (runDependencies > 0) {
|
|
6543
|
+
dependenciesFulfilled = run;
|
|
6544
|
+
return;
|
|
6545
|
+
}
|
|
6546
|
+
function doRun() {
|
|
6547
|
+
Module["calledRun"] = true;
|
|
6548
|
+
if (ABORT)
|
|
6549
|
+
return;
|
|
6550
|
+
initRuntime();
|
|
6551
|
+
preMain();
|
|
6552
|
+
readyPromiseResolve?.(Module);
|
|
6553
|
+
Module["onRuntimeInitialized"]?.();
|
|
6554
|
+
var noInitialRun = Module["noInitialRun"] || false;
|
|
6555
|
+
if (!noInitialRun)
|
|
6556
|
+
callMain(args2);
|
|
6557
|
+
postRun();
|
|
6558
|
+
}
|
|
6559
|
+
__name(doRun, "doRun");
|
|
6560
|
+
if (Module["setStatus"]) {
|
|
6561
|
+
Module["setStatus"]("Running...");
|
|
6562
|
+
setTimeout(() => {
|
|
6563
|
+
setTimeout(() => Module["setStatus"](""), 1);
|
|
6564
|
+
doRun();
|
|
6565
|
+
}, 1);
|
|
6566
|
+
} else {
|
|
6567
|
+
doRun();
|
|
6568
|
+
}
|
|
6569
|
+
}
|
|
6570
|
+
__name(run, "run");
|
|
6571
|
+
var wasmExports;
|
|
6572
|
+
wasmExports = await createWasm();
|
|
6573
|
+
run();
|
|
6574
|
+
if (runtimeInitialized) {
|
|
6575
|
+
moduleRtn = Module;
|
|
6576
|
+
} else {
|
|
6577
|
+
moduleRtn = new Promise((resolve, reject) => {
|
|
6578
|
+
readyPromiseResolve = resolve;
|
|
6579
|
+
readyPromiseReject = reject;
|
|
6580
|
+
});
|
|
6581
|
+
}
|
|
6582
|
+
return moduleRtn;
|
|
6583
|
+
}
|
|
6584
|
+
__name(Module2, "Module");
|
|
6585
|
+
var web_tree_sitter_default = Module2;
|
|
7054
6586
|
var Module3 = null;
|
|
7055
6587
|
async function initializeBinding(moduleOptions) {
|
|
7056
|
-
|
|
7057
|
-
Module3 = await tree_sitter_default(moduleOptions);
|
|
7058
|
-
}
|
|
7059
|
-
return Module3;
|
|
6588
|
+
return Module3 ??= await web_tree_sitter_default(moduleOptions);
|
|
7060
6589
|
}
|
|
7061
6590
|
__name(initializeBinding, "initializeBinding");
|
|
7062
6591
|
function checkModule() {
|
|
@@ -7087,117 +6616,600 @@ var Parser = class {
|
|
|
7087
6616
|
if (!checkModule()) {
|
|
7088
6617
|
throw new Error("cannot construct a Parser before calling `init()`");
|
|
7089
6618
|
}
|
|
7090
|
-
C._ts_parser_new_wasm();
|
|
7091
|
-
this[0] = C.getValue(TRANSFER_BUFFER, "i32");
|
|
7092
|
-
this[1] = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
6619
|
+
C._ts_parser_new_wasm();
|
|
6620
|
+
this[0] = C.getValue(TRANSFER_BUFFER, "i32");
|
|
6621
|
+
this[1] = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
6622
|
+
}
|
|
6623
|
+
delete() {
|
|
6624
|
+
C._ts_parser_delete(this[0]);
|
|
6625
|
+
C._free(this[1]);
|
|
6626
|
+
this[0] = 0;
|
|
6627
|
+
this[1] = 0;
|
|
6628
|
+
}
|
|
6629
|
+
setLanguage(language) {
|
|
6630
|
+
let address;
|
|
6631
|
+
if (!language) {
|
|
6632
|
+
address = 0;
|
|
6633
|
+
this.language = null;
|
|
6634
|
+
} else if (language.constructor === Language) {
|
|
6635
|
+
address = language[0];
|
|
6636
|
+
const version = C._ts_language_abi_version(address);
|
|
6637
|
+
if (version < MIN_COMPATIBLE_VERSION || LANGUAGE_VERSION < version) {
|
|
6638
|
+
throw new Error(`Incompatible language version ${version}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${LANGUAGE_VERSION}.`);
|
|
6639
|
+
}
|
|
6640
|
+
this.language = language;
|
|
6641
|
+
} else {
|
|
6642
|
+
throw new Error("Argument must be a Language");
|
|
6643
|
+
}
|
|
6644
|
+
C._ts_parser_set_language(this[0], address);
|
|
6645
|
+
return this;
|
|
6646
|
+
}
|
|
6647
|
+
parse(callback, oldTree, options) {
|
|
6648
|
+
if (typeof callback === "string") {
|
|
6649
|
+
C.currentParseCallback = (index) => callback.slice(index);
|
|
6650
|
+
} else if (typeof callback === "function") {
|
|
6651
|
+
C.currentParseCallback = callback;
|
|
6652
|
+
} else {
|
|
6653
|
+
throw new Error("Argument must be a string or a function");
|
|
6654
|
+
}
|
|
6655
|
+
if (options?.progressCallback) {
|
|
6656
|
+
C.currentProgressCallback = options.progressCallback;
|
|
6657
|
+
} else {
|
|
6658
|
+
C.currentProgressCallback = null;
|
|
6659
|
+
}
|
|
6660
|
+
if (this.logCallback) {
|
|
6661
|
+
C.currentLogCallback = this.logCallback;
|
|
6662
|
+
C._ts_parser_enable_logger_wasm(this[0], 1);
|
|
6663
|
+
} else {
|
|
6664
|
+
C.currentLogCallback = null;
|
|
6665
|
+
C._ts_parser_enable_logger_wasm(this[0], 0);
|
|
6666
|
+
}
|
|
6667
|
+
let rangeCount = 0;
|
|
6668
|
+
let rangeAddress = 0;
|
|
6669
|
+
if (options?.includedRanges) {
|
|
6670
|
+
rangeCount = options.includedRanges.length;
|
|
6671
|
+
rangeAddress = C._calloc(rangeCount, SIZE_OF_RANGE);
|
|
6672
|
+
let address = rangeAddress;
|
|
6673
|
+
for (let i2 = 0;i2 < rangeCount; i2++) {
|
|
6674
|
+
marshalRange(address, options.includedRanges[i2]);
|
|
6675
|
+
address += SIZE_OF_RANGE;
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
const treeAddress = C._ts_parser_parse_wasm(this[0], this[1], oldTree ? oldTree[0] : 0, rangeAddress, rangeCount);
|
|
6679
|
+
if (!treeAddress) {
|
|
6680
|
+
C.currentParseCallback = null;
|
|
6681
|
+
C.currentLogCallback = null;
|
|
6682
|
+
C.currentProgressCallback = null;
|
|
6683
|
+
return null;
|
|
6684
|
+
}
|
|
6685
|
+
if (!this.language) {
|
|
6686
|
+
throw new Error("Parser must have a language to parse");
|
|
6687
|
+
}
|
|
6688
|
+
const result = new Tree(INTERNAL, treeAddress, this.language, C.currentParseCallback);
|
|
6689
|
+
C.currentParseCallback = null;
|
|
6690
|
+
C.currentLogCallback = null;
|
|
6691
|
+
C.currentProgressCallback = null;
|
|
6692
|
+
return result;
|
|
6693
|
+
}
|
|
6694
|
+
reset() {
|
|
6695
|
+
C._ts_parser_reset(this[0]);
|
|
6696
|
+
}
|
|
6697
|
+
getIncludedRanges() {
|
|
6698
|
+
C._ts_parser_included_ranges_wasm(this[0]);
|
|
6699
|
+
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
6700
|
+
const buffer = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
6701
|
+
const result = new Array(count);
|
|
6702
|
+
if (count > 0) {
|
|
6703
|
+
let address = buffer;
|
|
6704
|
+
for (let i2 = 0;i2 < count; i2++) {
|
|
6705
|
+
result[i2] = unmarshalRange(address);
|
|
6706
|
+
address += SIZE_OF_RANGE;
|
|
6707
|
+
}
|
|
6708
|
+
C._free(buffer);
|
|
6709
|
+
}
|
|
6710
|
+
return result;
|
|
6711
|
+
}
|
|
6712
|
+
setLogger(callback) {
|
|
6713
|
+
if (!callback) {
|
|
6714
|
+
this.logCallback = null;
|
|
6715
|
+
} else if (typeof callback !== "function") {
|
|
6716
|
+
throw new Error("Logger callback must be a function");
|
|
6717
|
+
} else {
|
|
6718
|
+
this.logCallback = callback;
|
|
6719
|
+
}
|
|
6720
|
+
return this;
|
|
6721
|
+
}
|
|
6722
|
+
getLogger() {
|
|
6723
|
+
return this.logCallback;
|
|
6724
|
+
}
|
|
6725
|
+
};
|
|
6726
|
+
var PREDICATE_STEP_TYPE_CAPTURE = 1;
|
|
6727
|
+
var PREDICATE_STEP_TYPE_STRING = 2;
|
|
6728
|
+
var QUERY_WORD_REGEX = /[\w-]+/g;
|
|
6729
|
+
var CaptureQuantifier = {
|
|
6730
|
+
Zero: 0,
|
|
6731
|
+
ZeroOrOne: 1,
|
|
6732
|
+
ZeroOrMore: 2,
|
|
6733
|
+
One: 3,
|
|
6734
|
+
OneOrMore: 4
|
|
6735
|
+
};
|
|
6736
|
+
var isCaptureStep = /* @__PURE__ */ __name((step) => step.type === "capture", "isCaptureStep");
|
|
6737
|
+
var isStringStep = /* @__PURE__ */ __name((step) => step.type === "string", "isStringStep");
|
|
6738
|
+
var QueryErrorKind = {
|
|
6739
|
+
Syntax: 1,
|
|
6740
|
+
NodeName: 2,
|
|
6741
|
+
FieldName: 3,
|
|
6742
|
+
CaptureName: 4,
|
|
6743
|
+
PatternStructure: 5
|
|
6744
|
+
};
|
|
6745
|
+
var QueryError = class _QueryError extends Error {
|
|
6746
|
+
constructor(kind, info2, index, length) {
|
|
6747
|
+
super(_QueryError.formatMessage(kind, info2));
|
|
6748
|
+
this.kind = kind;
|
|
6749
|
+
this.info = info2;
|
|
6750
|
+
this.index = index;
|
|
6751
|
+
this.length = length;
|
|
6752
|
+
this.name = "QueryError";
|
|
6753
|
+
}
|
|
6754
|
+
static {
|
|
6755
|
+
__name(this, "QueryError");
|
|
6756
|
+
}
|
|
6757
|
+
static formatMessage(kind, info2) {
|
|
6758
|
+
switch (kind) {
|
|
6759
|
+
case QueryErrorKind.NodeName:
|
|
6760
|
+
return `Bad node name '${info2.word}'`;
|
|
6761
|
+
case QueryErrorKind.FieldName:
|
|
6762
|
+
return `Bad field name '${info2.word}'`;
|
|
6763
|
+
case QueryErrorKind.CaptureName:
|
|
6764
|
+
return `Bad capture name @${info2.word}`;
|
|
6765
|
+
case QueryErrorKind.PatternStructure:
|
|
6766
|
+
return `Bad pattern structure at offset ${info2.suffix}`;
|
|
6767
|
+
case QueryErrorKind.Syntax:
|
|
6768
|
+
return `Bad syntax at offset ${info2.suffix}`;
|
|
6769
|
+
}
|
|
6770
|
+
}
|
|
6771
|
+
};
|
|
6772
|
+
function parseAnyPredicate(steps, index, operator, textPredicates) {
|
|
6773
|
+
if (steps.length !== 3) {
|
|
6774
|
+
throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 2, got ${steps.length - 1}`);
|
|
6775
|
+
}
|
|
6776
|
+
if (!isCaptureStep(steps[1])) {
|
|
6777
|
+
throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}"`);
|
|
6778
|
+
}
|
|
6779
|
+
const isPositive = operator === "eq?" || operator === "any-eq?";
|
|
6780
|
+
const matchAll = !operator.startsWith("any-");
|
|
6781
|
+
if (isCaptureStep(steps[2])) {
|
|
6782
|
+
const captureName1 = steps[1].name;
|
|
6783
|
+
const captureName2 = steps[2].name;
|
|
6784
|
+
textPredicates[index].push((captures) => {
|
|
6785
|
+
const nodes1 = [];
|
|
6786
|
+
const nodes2 = [];
|
|
6787
|
+
for (const c of captures) {
|
|
6788
|
+
if (c.name === captureName1)
|
|
6789
|
+
nodes1.push(c.node);
|
|
6790
|
+
if (c.name === captureName2)
|
|
6791
|
+
nodes2.push(c.node);
|
|
6792
|
+
}
|
|
6793
|
+
const compare = /* @__PURE__ */ __name((n1, n2, positive) => {
|
|
6794
|
+
return positive ? n1.text === n2.text : n1.text !== n2.text;
|
|
6795
|
+
}, "compare");
|
|
6796
|
+
return matchAll ? nodes1.every((n1) => nodes2.some((n2) => compare(n1, n2, isPositive))) : nodes1.some((n1) => nodes2.some((n2) => compare(n1, n2, isPositive)));
|
|
6797
|
+
});
|
|
6798
|
+
} else {
|
|
6799
|
+
const captureName = steps[1].name;
|
|
6800
|
+
const stringValue = steps[2].value;
|
|
6801
|
+
const matches = /* @__PURE__ */ __name((n) => n.text === stringValue, "matches");
|
|
6802
|
+
const doesNotMatch = /* @__PURE__ */ __name((n) => n.text !== stringValue, "doesNotMatch");
|
|
6803
|
+
textPredicates[index].push((captures) => {
|
|
6804
|
+
const nodes = [];
|
|
6805
|
+
for (const c of captures) {
|
|
6806
|
+
if (c.name === captureName)
|
|
6807
|
+
nodes.push(c.node);
|
|
6808
|
+
}
|
|
6809
|
+
const test = isPositive ? matches : doesNotMatch;
|
|
6810
|
+
return matchAll ? nodes.every(test) : nodes.some(test);
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
}
|
|
6814
|
+
__name(parseAnyPredicate, "parseAnyPredicate");
|
|
6815
|
+
function parseMatchPredicate(steps, index, operator, textPredicates) {
|
|
6816
|
+
if (steps.length !== 3) {
|
|
6817
|
+
throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 2, got ${steps.length - 1}.`);
|
|
6818
|
+
}
|
|
6819
|
+
if (steps[1].type !== "capture") {
|
|
6820
|
+
throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}".`);
|
|
6821
|
+
}
|
|
6822
|
+
if (steps[2].type !== "string") {
|
|
6823
|
+
throw new Error(`Second argument of \`#${operator}\` predicate must be a string. Got @${steps[2].name}.`);
|
|
6824
|
+
}
|
|
6825
|
+
const isPositive = operator === "match?" || operator === "any-match?";
|
|
6826
|
+
const matchAll = !operator.startsWith("any-");
|
|
6827
|
+
const captureName = steps[1].name;
|
|
6828
|
+
const regex = new RegExp(steps[2].value);
|
|
6829
|
+
textPredicates[index].push((captures) => {
|
|
6830
|
+
const nodes = [];
|
|
6831
|
+
for (const c of captures) {
|
|
6832
|
+
if (c.name === captureName)
|
|
6833
|
+
nodes.push(c.node.text);
|
|
6834
|
+
}
|
|
6835
|
+
const test = /* @__PURE__ */ __name((text, positive) => {
|
|
6836
|
+
return positive ? regex.test(text) : !regex.test(text);
|
|
6837
|
+
}, "test");
|
|
6838
|
+
if (nodes.length === 0)
|
|
6839
|
+
return !isPositive;
|
|
6840
|
+
return matchAll ? nodes.every((text) => test(text, isPositive)) : nodes.some((text) => test(text, isPositive));
|
|
6841
|
+
});
|
|
6842
|
+
}
|
|
6843
|
+
__name(parseMatchPredicate, "parseMatchPredicate");
|
|
6844
|
+
function parseAnyOfPredicate(steps, index, operator, textPredicates) {
|
|
6845
|
+
if (steps.length < 2) {
|
|
6846
|
+
throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected at least 1. Got ${steps.length - 1}.`);
|
|
6847
|
+
}
|
|
6848
|
+
if (steps[1].type !== "capture") {
|
|
6849
|
+
throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}".`);
|
|
6850
|
+
}
|
|
6851
|
+
const isPositive = operator === "any-of?";
|
|
6852
|
+
const captureName = steps[1].name;
|
|
6853
|
+
const stringSteps = steps.slice(2);
|
|
6854
|
+
if (!stringSteps.every(isStringStep)) {
|
|
6855
|
+
throw new Error(`Arguments to \`#${operator}\` predicate must be strings.".`);
|
|
6856
|
+
}
|
|
6857
|
+
const values = stringSteps.map((s) => s.value);
|
|
6858
|
+
textPredicates[index].push((captures) => {
|
|
6859
|
+
const nodes = [];
|
|
6860
|
+
for (const c of captures) {
|
|
6861
|
+
if (c.name === captureName)
|
|
6862
|
+
nodes.push(c.node.text);
|
|
6863
|
+
}
|
|
6864
|
+
if (nodes.length === 0)
|
|
6865
|
+
return !isPositive;
|
|
6866
|
+
return nodes.every((text) => values.includes(text)) === isPositive;
|
|
6867
|
+
});
|
|
6868
|
+
}
|
|
6869
|
+
__name(parseAnyOfPredicate, "parseAnyOfPredicate");
|
|
6870
|
+
function parseIsPredicate(steps, index, operator, assertedProperties, refutedProperties) {
|
|
6871
|
+
if (steps.length < 2 || steps.length > 3) {
|
|
6872
|
+
throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
|
|
6873
|
+
}
|
|
6874
|
+
if (!steps.every(isStringStep)) {
|
|
6875
|
+
throw new Error(`Arguments to \`#${operator}\` predicate must be strings.".`);
|
|
6876
|
+
}
|
|
6877
|
+
const properties = operator === "is?" ? assertedProperties : refutedProperties;
|
|
6878
|
+
if (!properties[index])
|
|
6879
|
+
properties[index] = {};
|
|
6880
|
+
properties[index][steps[1].value] = steps[2]?.value ?? null;
|
|
6881
|
+
}
|
|
6882
|
+
__name(parseIsPredicate, "parseIsPredicate");
|
|
6883
|
+
function parseSetDirective(steps, index, setProperties) {
|
|
6884
|
+
if (steps.length < 2 || steps.length > 3) {
|
|
6885
|
+
throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
|
|
6886
|
+
}
|
|
6887
|
+
if (!steps.every(isStringStep)) {
|
|
6888
|
+
throw new Error(`Arguments to \`#set!\` predicate must be strings.".`);
|
|
6889
|
+
}
|
|
6890
|
+
if (!setProperties[index])
|
|
6891
|
+
setProperties[index] = {};
|
|
6892
|
+
setProperties[index][steps[1].value] = steps[2]?.value ?? null;
|
|
6893
|
+
}
|
|
6894
|
+
__name(parseSetDirective, "parseSetDirective");
|
|
6895
|
+
function parsePattern(index, stepType, stepValueId, captureNames, stringValues, steps, textPredicates, predicates, setProperties, assertedProperties, refutedProperties) {
|
|
6896
|
+
if (stepType === PREDICATE_STEP_TYPE_CAPTURE) {
|
|
6897
|
+
const name2 = captureNames[stepValueId];
|
|
6898
|
+
steps.push({ type: "capture", name: name2 });
|
|
6899
|
+
} else if (stepType === PREDICATE_STEP_TYPE_STRING) {
|
|
6900
|
+
steps.push({ type: "string", value: stringValues[stepValueId] });
|
|
6901
|
+
} else if (steps.length > 0) {
|
|
6902
|
+
if (steps[0].type !== "string") {
|
|
6903
|
+
throw new Error("Predicates must begin with a literal value");
|
|
6904
|
+
}
|
|
6905
|
+
const operator = steps[0].value;
|
|
6906
|
+
switch (operator) {
|
|
6907
|
+
case "any-not-eq?":
|
|
6908
|
+
case "not-eq?":
|
|
6909
|
+
case "any-eq?":
|
|
6910
|
+
case "eq?":
|
|
6911
|
+
parseAnyPredicate(steps, index, operator, textPredicates);
|
|
6912
|
+
break;
|
|
6913
|
+
case "any-not-match?":
|
|
6914
|
+
case "not-match?":
|
|
6915
|
+
case "any-match?":
|
|
6916
|
+
case "match?":
|
|
6917
|
+
parseMatchPredicate(steps, index, operator, textPredicates);
|
|
6918
|
+
break;
|
|
6919
|
+
case "not-any-of?":
|
|
6920
|
+
case "any-of?":
|
|
6921
|
+
parseAnyOfPredicate(steps, index, operator, textPredicates);
|
|
6922
|
+
break;
|
|
6923
|
+
case "is?":
|
|
6924
|
+
case "is-not?":
|
|
6925
|
+
parseIsPredicate(steps, index, operator, assertedProperties, refutedProperties);
|
|
6926
|
+
break;
|
|
6927
|
+
case "set!":
|
|
6928
|
+
parseSetDirective(steps, index, setProperties);
|
|
6929
|
+
break;
|
|
6930
|
+
default:
|
|
6931
|
+
predicates[index].push({ operator, operands: steps.slice(1) });
|
|
6932
|
+
}
|
|
6933
|
+
steps.length = 0;
|
|
6934
|
+
}
|
|
6935
|
+
}
|
|
6936
|
+
__name(parsePattern, "parsePattern");
|
|
6937
|
+
var Query = class {
|
|
6938
|
+
static {
|
|
6939
|
+
__name(this, "Query");
|
|
6940
|
+
}
|
|
6941
|
+
[0] = 0;
|
|
6942
|
+
exceededMatchLimit;
|
|
6943
|
+
textPredicates;
|
|
6944
|
+
captureNames;
|
|
6945
|
+
captureQuantifiers;
|
|
6946
|
+
predicates;
|
|
6947
|
+
setProperties;
|
|
6948
|
+
assertedProperties;
|
|
6949
|
+
refutedProperties;
|
|
6950
|
+
matchLimit;
|
|
6951
|
+
constructor(language, source) {
|
|
6952
|
+
const sourceLength = C.lengthBytesUTF8(source);
|
|
6953
|
+
const sourceAddress = C._malloc(sourceLength + 1);
|
|
6954
|
+
C.stringToUTF8(source, sourceAddress, sourceLength + 1);
|
|
6955
|
+
const address = C._ts_query_new(language[0], sourceAddress, sourceLength, TRANSFER_BUFFER, TRANSFER_BUFFER + SIZE_OF_INT);
|
|
6956
|
+
if (!address) {
|
|
6957
|
+
const errorId = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
6958
|
+
const errorByte = C.getValue(TRANSFER_BUFFER, "i32");
|
|
6959
|
+
const errorIndex = C.UTF8ToString(sourceAddress, errorByte).length;
|
|
6960
|
+
const suffix = source.slice(errorIndex, errorIndex + 100).split(`
|
|
6961
|
+
`)[0];
|
|
6962
|
+
const word = suffix.match(QUERY_WORD_REGEX)?.[0] ?? "";
|
|
6963
|
+
C._free(sourceAddress);
|
|
6964
|
+
switch (errorId) {
|
|
6965
|
+
case QueryErrorKind.Syntax:
|
|
6966
|
+
throw new QueryError(QueryErrorKind.Syntax, { suffix: `${errorIndex}: '${suffix}'...` }, errorIndex, 0);
|
|
6967
|
+
case QueryErrorKind.NodeName:
|
|
6968
|
+
throw new QueryError(errorId, { word }, errorIndex, word.length);
|
|
6969
|
+
case QueryErrorKind.FieldName:
|
|
6970
|
+
throw new QueryError(errorId, { word }, errorIndex, word.length);
|
|
6971
|
+
case QueryErrorKind.CaptureName:
|
|
6972
|
+
throw new QueryError(errorId, { word }, errorIndex, word.length);
|
|
6973
|
+
case QueryErrorKind.PatternStructure:
|
|
6974
|
+
throw new QueryError(errorId, { suffix: `${errorIndex}: '${suffix}'...` }, errorIndex, 0);
|
|
6975
|
+
}
|
|
6976
|
+
}
|
|
6977
|
+
const stringCount = C._ts_query_string_count(address);
|
|
6978
|
+
const captureCount = C._ts_query_capture_count(address);
|
|
6979
|
+
const patternCount = C._ts_query_pattern_count(address);
|
|
6980
|
+
const captureNames = new Array(captureCount);
|
|
6981
|
+
const captureQuantifiers = new Array(patternCount);
|
|
6982
|
+
const stringValues = new Array(stringCount);
|
|
6983
|
+
for (let i2 = 0;i2 < captureCount; i2++) {
|
|
6984
|
+
const nameAddress = C._ts_query_capture_name_for_id(address, i2, TRANSFER_BUFFER);
|
|
6985
|
+
const nameLength = C.getValue(TRANSFER_BUFFER, "i32");
|
|
6986
|
+
captureNames[i2] = C.UTF8ToString(nameAddress, nameLength);
|
|
6987
|
+
}
|
|
6988
|
+
for (let i2 = 0;i2 < patternCount; i2++) {
|
|
6989
|
+
const captureQuantifiersArray = new Array(captureCount);
|
|
6990
|
+
for (let j = 0;j < captureCount; j++) {
|
|
6991
|
+
const quantifier = C._ts_query_capture_quantifier_for_id(address, i2, j);
|
|
6992
|
+
captureQuantifiersArray[j] = quantifier;
|
|
6993
|
+
}
|
|
6994
|
+
captureQuantifiers[i2] = captureQuantifiersArray;
|
|
6995
|
+
}
|
|
6996
|
+
for (let i2 = 0;i2 < stringCount; i2++) {
|
|
6997
|
+
const valueAddress = C._ts_query_string_value_for_id(address, i2, TRANSFER_BUFFER);
|
|
6998
|
+
const nameLength = C.getValue(TRANSFER_BUFFER, "i32");
|
|
6999
|
+
stringValues[i2] = C.UTF8ToString(valueAddress, nameLength);
|
|
7000
|
+
}
|
|
7001
|
+
const setProperties = new Array(patternCount);
|
|
7002
|
+
const assertedProperties = new Array(patternCount);
|
|
7003
|
+
const refutedProperties = new Array(patternCount);
|
|
7004
|
+
const predicates = new Array(patternCount);
|
|
7005
|
+
const textPredicates = new Array(patternCount);
|
|
7006
|
+
for (let i2 = 0;i2 < patternCount; i2++) {
|
|
7007
|
+
const predicatesAddress = C._ts_query_predicates_for_pattern(address, i2, TRANSFER_BUFFER);
|
|
7008
|
+
const stepCount = C.getValue(TRANSFER_BUFFER, "i32");
|
|
7009
|
+
predicates[i2] = [];
|
|
7010
|
+
textPredicates[i2] = [];
|
|
7011
|
+
const steps = new Array;
|
|
7012
|
+
let stepAddress = predicatesAddress;
|
|
7013
|
+
for (let j = 0;j < stepCount; j++) {
|
|
7014
|
+
const stepType = C.getValue(stepAddress, "i32");
|
|
7015
|
+
stepAddress += SIZE_OF_INT;
|
|
7016
|
+
const stepValueId = C.getValue(stepAddress, "i32");
|
|
7017
|
+
stepAddress += SIZE_OF_INT;
|
|
7018
|
+
parsePattern(i2, stepType, stepValueId, captureNames, stringValues, steps, textPredicates, predicates, setProperties, assertedProperties, refutedProperties);
|
|
7019
|
+
}
|
|
7020
|
+
Object.freeze(textPredicates[i2]);
|
|
7021
|
+
Object.freeze(predicates[i2]);
|
|
7022
|
+
Object.freeze(setProperties[i2]);
|
|
7023
|
+
Object.freeze(assertedProperties[i2]);
|
|
7024
|
+
Object.freeze(refutedProperties[i2]);
|
|
7025
|
+
}
|
|
7026
|
+
C._free(sourceAddress);
|
|
7027
|
+
this[0] = address;
|
|
7028
|
+
this.captureNames = captureNames;
|
|
7029
|
+
this.captureQuantifiers = captureQuantifiers;
|
|
7030
|
+
this.textPredicates = textPredicates;
|
|
7031
|
+
this.predicates = predicates;
|
|
7032
|
+
this.setProperties = setProperties;
|
|
7033
|
+
this.assertedProperties = assertedProperties;
|
|
7034
|
+
this.refutedProperties = refutedProperties;
|
|
7035
|
+
this.exceededMatchLimit = false;
|
|
7093
7036
|
}
|
|
7094
7037
|
delete() {
|
|
7095
|
-
C.
|
|
7096
|
-
C._free(this[1]);
|
|
7038
|
+
C._ts_query_delete(this[0]);
|
|
7097
7039
|
this[0] = 0;
|
|
7098
|
-
this[1] = 0;
|
|
7099
7040
|
}
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
throw new Error("
|
|
7041
|
+
matches(node, options = {}) {
|
|
7042
|
+
const startPosition = options.startPosition ?? ZERO_POINT;
|
|
7043
|
+
const endPosition = options.endPosition ?? ZERO_POINT;
|
|
7044
|
+
const startIndex = options.startIndex ?? 0;
|
|
7045
|
+
const endIndex = options.endIndex ?? 0;
|
|
7046
|
+
const startContainingPosition = options.startContainingPosition ?? ZERO_POINT;
|
|
7047
|
+
const endContainingPosition = options.endContainingPosition ?? ZERO_POINT;
|
|
7048
|
+
const startContainingIndex = options.startContainingIndex ?? 0;
|
|
7049
|
+
const endContainingIndex = options.endContainingIndex ?? 0;
|
|
7050
|
+
const matchLimit = options.matchLimit ?? 4294967295;
|
|
7051
|
+
const maxStartDepth = options.maxStartDepth ?? 4294967295;
|
|
7052
|
+
const progressCallback = options.progressCallback;
|
|
7053
|
+
if (typeof matchLimit !== "number") {
|
|
7054
|
+
throw new Error("Arguments must be numbers");
|
|
7114
7055
|
}
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
parse(callback, oldTree, options) {
|
|
7119
|
-
if (typeof callback === "string") {
|
|
7120
|
-
C.currentParseCallback = (index) => callback.slice(index);
|
|
7121
|
-
} else if (typeof callback === "function") {
|
|
7122
|
-
C.currentParseCallback = callback;
|
|
7123
|
-
} else {
|
|
7124
|
-
throw new Error("Argument must be a string or a function");
|
|
7056
|
+
this.matchLimit = matchLimit;
|
|
7057
|
+
if (endIndex !== 0 && startIndex > endIndex) {
|
|
7058
|
+
throw new Error("`startIndex` cannot be greater than `endIndex`");
|
|
7125
7059
|
}
|
|
7126
|
-
if (
|
|
7127
|
-
|
|
7128
|
-
} else {
|
|
7129
|
-
C.currentProgressCallback = null;
|
|
7060
|
+
if (endPosition !== ZERO_POINT && (startPosition.row > endPosition.row || startPosition.row === endPosition.row && startPosition.column > endPosition.column)) {
|
|
7061
|
+
throw new Error("`startPosition` cannot be greater than `endPosition`");
|
|
7130
7062
|
}
|
|
7131
|
-
if (
|
|
7132
|
-
|
|
7133
|
-
C._ts_parser_enable_logger_wasm(this[0], 1);
|
|
7134
|
-
} else {
|
|
7135
|
-
C.currentLogCallback = null;
|
|
7136
|
-
C._ts_parser_enable_logger_wasm(this[0], 0);
|
|
7063
|
+
if (endContainingIndex !== 0 && startContainingIndex > endContainingIndex) {
|
|
7064
|
+
throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");
|
|
7137
7065
|
}
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
if (options?.includedRanges) {
|
|
7141
|
-
rangeCount = options.includedRanges.length;
|
|
7142
|
-
rangeAddress = C._calloc(rangeCount, SIZE_OF_RANGE);
|
|
7143
|
-
let address = rangeAddress;
|
|
7144
|
-
for (let i2 = 0;i2 < rangeCount; i2++) {
|
|
7145
|
-
marshalRange(address, options.includedRanges[i2]);
|
|
7146
|
-
address += SIZE_OF_RANGE;
|
|
7147
|
-
}
|
|
7066
|
+
if (endContainingPosition !== ZERO_POINT && (startContainingPosition.row > endContainingPosition.row || startContainingPosition.row === endContainingPosition.row && startContainingPosition.column > endContainingPosition.column)) {
|
|
7067
|
+
throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");
|
|
7148
7068
|
}
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
C.currentParseCallback = null;
|
|
7152
|
-
C.currentLogCallback = null;
|
|
7153
|
-
C.currentProgressCallback = null;
|
|
7154
|
-
return null;
|
|
7069
|
+
if (progressCallback) {
|
|
7070
|
+
C.currentQueryProgressCallback = progressCallback;
|
|
7155
7071
|
}
|
|
7156
|
-
|
|
7157
|
-
|
|
7072
|
+
marshalNode(node);
|
|
7073
|
+
C._ts_query_matches_wasm(this[0], node.tree[0], startPosition.row, startPosition.column, endPosition.row, endPosition.column, startIndex, endIndex, startContainingPosition.row, startContainingPosition.column, endContainingPosition.row, endContainingPosition.column, startContainingIndex, endContainingIndex, matchLimit, maxStartDepth);
|
|
7074
|
+
const rawCount = C.getValue(TRANSFER_BUFFER, "i32");
|
|
7075
|
+
const startAddress = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
7076
|
+
const didExceedMatchLimit = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
|
|
7077
|
+
const result = new Array(rawCount);
|
|
7078
|
+
this.exceededMatchLimit = Boolean(didExceedMatchLimit);
|
|
7079
|
+
let filteredCount = 0;
|
|
7080
|
+
let address = startAddress;
|
|
7081
|
+
for (let i2 = 0;i2 < rawCount; i2++) {
|
|
7082
|
+
const patternIndex = C.getValue(address, "i32");
|
|
7083
|
+
address += SIZE_OF_INT;
|
|
7084
|
+
const captureCount = C.getValue(address, "i32");
|
|
7085
|
+
address += SIZE_OF_INT;
|
|
7086
|
+
const captures = new Array(captureCount);
|
|
7087
|
+
address = unmarshalCaptures(this, node.tree, address, patternIndex, captures);
|
|
7088
|
+
if (this.textPredicates[patternIndex].every((p) => p(captures))) {
|
|
7089
|
+
result[filteredCount] = { patternIndex, captures };
|
|
7090
|
+
const setProperties = this.setProperties[patternIndex];
|
|
7091
|
+
result[filteredCount].setProperties = setProperties;
|
|
7092
|
+
const assertedProperties = this.assertedProperties[patternIndex];
|
|
7093
|
+
result[filteredCount].assertedProperties = assertedProperties;
|
|
7094
|
+
const refutedProperties = this.refutedProperties[patternIndex];
|
|
7095
|
+
result[filteredCount].refutedProperties = refutedProperties;
|
|
7096
|
+
filteredCount++;
|
|
7097
|
+
}
|
|
7158
7098
|
}
|
|
7159
|
-
|
|
7160
|
-
C.
|
|
7161
|
-
C.
|
|
7162
|
-
C.currentProgressCallback = null;
|
|
7099
|
+
result.length = filteredCount;
|
|
7100
|
+
C._free(startAddress);
|
|
7101
|
+
C.currentQueryProgressCallback = null;
|
|
7163
7102
|
return result;
|
|
7164
7103
|
}
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7104
|
+
captures(node, options = {}) {
|
|
7105
|
+
const startPosition = options.startPosition ?? ZERO_POINT;
|
|
7106
|
+
const endPosition = options.endPosition ?? ZERO_POINT;
|
|
7107
|
+
const startIndex = options.startIndex ?? 0;
|
|
7108
|
+
const endIndex = options.endIndex ?? 0;
|
|
7109
|
+
const startContainingPosition = options.startContainingPosition ?? ZERO_POINT;
|
|
7110
|
+
const endContainingPosition = options.endContainingPosition ?? ZERO_POINT;
|
|
7111
|
+
const startContainingIndex = options.startContainingIndex ?? 0;
|
|
7112
|
+
const endContainingIndex = options.endContainingIndex ?? 0;
|
|
7113
|
+
const matchLimit = options.matchLimit ?? 4294967295;
|
|
7114
|
+
const maxStartDepth = options.maxStartDepth ?? 4294967295;
|
|
7115
|
+
const progressCallback = options.progressCallback;
|
|
7116
|
+
if (typeof matchLimit !== "number") {
|
|
7117
|
+
throw new Error("Arguments must be numbers");
|
|
7118
|
+
}
|
|
7119
|
+
this.matchLimit = matchLimit;
|
|
7120
|
+
if (endIndex !== 0 && startIndex > endIndex) {
|
|
7121
|
+
throw new Error("`startIndex` cannot be greater than `endIndex`");
|
|
7122
|
+
}
|
|
7123
|
+
if (endPosition !== ZERO_POINT && (startPosition.row > endPosition.row || startPosition.row === endPosition.row && startPosition.column > endPosition.column)) {
|
|
7124
|
+
throw new Error("`startPosition` cannot be greater than `endPosition`");
|
|
7125
|
+
}
|
|
7126
|
+
if (endContainingIndex !== 0 && startContainingIndex > endContainingIndex) {
|
|
7127
|
+
throw new Error("`startContainingIndex` cannot be greater than `endContainingIndex`");
|
|
7128
|
+
}
|
|
7129
|
+
if (endContainingPosition !== ZERO_POINT && (startContainingPosition.row > endContainingPosition.row || startContainingPosition.row === endContainingPosition.row && startContainingPosition.column > endContainingPosition.column)) {
|
|
7130
|
+
throw new Error("`startContainingPosition` cannot be greater than `endContainingPosition`");
|
|
7131
|
+
}
|
|
7132
|
+
if (progressCallback) {
|
|
7133
|
+
C.currentQueryProgressCallback = progressCallback;
|
|
7134
|
+
}
|
|
7135
|
+
marshalNode(node);
|
|
7136
|
+
C._ts_query_captures_wasm(this[0], node.tree[0], startPosition.row, startPosition.column, endPosition.row, endPosition.column, startIndex, endIndex, startContainingPosition.row, startContainingPosition.column, endContainingPosition.row, endContainingPosition.column, startContainingIndex, endContainingIndex, matchLimit, maxStartDepth);
|
|
7170
7137
|
const count = C.getValue(TRANSFER_BUFFER, "i32");
|
|
7171
|
-
const
|
|
7172
|
-
const
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7138
|
+
const startAddress = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
|
|
7139
|
+
const didExceedMatchLimit = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
|
|
7140
|
+
const result = new Array;
|
|
7141
|
+
this.exceededMatchLimit = Boolean(didExceedMatchLimit);
|
|
7142
|
+
const captures = new Array;
|
|
7143
|
+
let address = startAddress;
|
|
7144
|
+
for (let i2 = 0;i2 < count; i2++) {
|
|
7145
|
+
const patternIndex = C.getValue(address, "i32");
|
|
7146
|
+
address += SIZE_OF_INT;
|
|
7147
|
+
const captureCount = C.getValue(address, "i32");
|
|
7148
|
+
address += SIZE_OF_INT;
|
|
7149
|
+
const captureIndex = C.getValue(address, "i32");
|
|
7150
|
+
address += SIZE_OF_INT;
|
|
7151
|
+
captures.length = captureCount;
|
|
7152
|
+
address = unmarshalCaptures(this, node.tree, address, patternIndex, captures);
|
|
7153
|
+
if (this.textPredicates[patternIndex].every((p) => p(captures))) {
|
|
7154
|
+
const capture = captures[captureIndex];
|
|
7155
|
+
const setProperties = this.setProperties[patternIndex];
|
|
7156
|
+
capture.setProperties = setProperties;
|
|
7157
|
+
const assertedProperties = this.assertedProperties[patternIndex];
|
|
7158
|
+
capture.assertedProperties = assertedProperties;
|
|
7159
|
+
const refutedProperties = this.refutedProperties[patternIndex];
|
|
7160
|
+
capture.refutedProperties = refutedProperties;
|
|
7161
|
+
result.push(capture);
|
|
7178
7162
|
}
|
|
7179
|
-
C._free(buffer);
|
|
7180
7163
|
}
|
|
7164
|
+
C._free(startAddress);
|
|
7165
|
+
C.currentQueryProgressCallback = null;
|
|
7181
7166
|
return result;
|
|
7182
7167
|
}
|
|
7183
|
-
|
|
7184
|
-
return
|
|
7168
|
+
predicatesForPattern(patternIndex) {
|
|
7169
|
+
return this.predicates[patternIndex];
|
|
7185
7170
|
}
|
|
7186
|
-
|
|
7187
|
-
C.
|
|
7171
|
+
disableCapture(captureName) {
|
|
7172
|
+
const captureNameLength = C.lengthBytesUTF8(captureName);
|
|
7173
|
+
const captureNameAddress = C._malloc(captureNameLength + 1);
|
|
7174
|
+
C.stringToUTF8(captureName, captureNameAddress, captureNameLength + 1);
|
|
7175
|
+
C._ts_query_disable_capture(this[0], captureNameAddress, captureNameLength);
|
|
7176
|
+
C._free(captureNameAddress);
|
|
7188
7177
|
}
|
|
7189
|
-
|
|
7190
|
-
if (
|
|
7191
|
-
this.
|
|
7192
|
-
} else if (typeof callback !== "function") {
|
|
7193
|
-
throw new Error("Logger callback must be a function");
|
|
7194
|
-
} else {
|
|
7195
|
-
this.logCallback = callback;
|
|
7178
|
+
disablePattern(patternIndex) {
|
|
7179
|
+
if (patternIndex >= this.predicates.length) {
|
|
7180
|
+
throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);
|
|
7196
7181
|
}
|
|
7197
|
-
|
|
7182
|
+
C._ts_query_disable_pattern(this[0], patternIndex);
|
|
7198
7183
|
}
|
|
7199
|
-
|
|
7200
|
-
return this.
|
|
7184
|
+
didExceedMatchLimit() {
|
|
7185
|
+
return this.exceededMatchLimit;
|
|
7186
|
+
}
|
|
7187
|
+
startIndexForPattern(patternIndex) {
|
|
7188
|
+
if (patternIndex >= this.predicates.length) {
|
|
7189
|
+
throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);
|
|
7190
|
+
}
|
|
7191
|
+
return C._ts_query_start_byte_for_pattern(this[0], patternIndex);
|
|
7192
|
+
}
|
|
7193
|
+
endIndexForPattern(patternIndex) {
|
|
7194
|
+
if (patternIndex >= this.predicates.length) {
|
|
7195
|
+
throw new Error(`Pattern index is ${patternIndex} but the pattern count is ${this.predicates.length}`);
|
|
7196
|
+
}
|
|
7197
|
+
return C._ts_query_end_byte_for_pattern(this[0], patternIndex);
|
|
7198
|
+
}
|
|
7199
|
+
patternCount() {
|
|
7200
|
+
return C._ts_query_pattern_count(this[0]);
|
|
7201
|
+
}
|
|
7202
|
+
captureIndexForName(captureName) {
|
|
7203
|
+
return this.captureNames.indexOf(captureName);
|
|
7204
|
+
}
|
|
7205
|
+
isPatternRooted(patternIndex) {
|
|
7206
|
+
return C._ts_query_is_pattern_rooted(this[0], patternIndex) === 1;
|
|
7207
|
+
}
|
|
7208
|
+
isPatternNonLocal(patternIndex) {
|
|
7209
|
+
return C._ts_query_is_pattern_non_local(this[0], patternIndex) === 1;
|
|
7210
|
+
}
|
|
7211
|
+
isPatternGuaranteedAtStep(byteIndex) {
|
|
7212
|
+
return C._ts_query_is_pattern_guaranteed_at_step(this[0], byteIndex) === 1;
|
|
7201
7213
|
}
|
|
7202
7214
|
};
|
|
7203
7215
|
|
|
@@ -7522,7 +7534,7 @@ function matchesToolIdentity(tool, executable) {
|
|
|
7522
7534
|
return tool === "bash" || tool === executable;
|
|
7523
7535
|
}
|
|
7524
7536
|
async function initializeParserAssets(options) {
|
|
7525
|
-
const treeSitterWasmPath = options.treeSitterWasmPath ?? resolveAsset("web-tree-sitter/tree-sitter.wasm");
|
|
7537
|
+
const treeSitterWasmPath = options.treeSitterWasmPath ?? resolveAsset("web-tree-sitter/web-tree-sitter.wasm");
|
|
7526
7538
|
const bashWasmPath = options.bashWasmPath ?? resolveAsset("tree-sitter-bash/tree-sitter-bash.wasm");
|
|
7527
7539
|
if (!fs7.existsSync(treeSitterWasmPath) || !fs7.existsSync(bashWasmPath)) {
|
|
7528
7540
|
throw new Error("parser-asset-unavailable");
|
|
@@ -10918,12 +10930,12 @@ function buildMarker(sources, malformed, current) {
|
|
|
10918
10930
|
enforcement: selected.worst.enforcement,
|
|
10919
10931
|
statusDigest: selected.worst.statusDigest
|
|
10920
10932
|
};
|
|
10921
|
-
const
|
|
10933
|
+
const document = {
|
|
10922
10934
|
protocolVersion: MARKER_PROTOCOL_VERSION,
|
|
10923
10935
|
sources: selected.sources,
|
|
10924
10936
|
aggregate
|
|
10925
10937
|
};
|
|
10926
|
-
return `${MARKER_OPEN}${JSON.stringify(
|
|
10938
|
+
return `${MARKER_OPEN}${JSON.stringify(document)}${MARKER_CLOSE}`;
|
|
10927
10939
|
}
|
|
10928
10940
|
function createSessionRuntime(options, operationObservers, recoveredOperationContexts) {
|
|
10929
10941
|
let ledger;
|