@willbooster/web-tree-sitter 19.1.0 → 19.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug/web-tree-sitter.cjs +175 -223
- package/debug/web-tree-sitter.cjs.map +3 -3
- package/debug/web-tree-sitter.js +175 -223
- package/debug/web-tree-sitter.js.map +3 -3
- package/debug/web-tree-sitter.wasm +0 -0
- package/debug/web-tree-sitter.wasm.map +4 -6
- package/package.json +1 -1
- package/web-tree-sitter.cjs +3 -3
- package/web-tree-sitter.cjs.map +3 -3
- package/web-tree-sitter.d.cts.map +1 -1
- package/web-tree-sitter.d.ts.map +1 -1
- package/web-tree-sitter.js +3 -3
- package/web-tree-sitter.js.map +3 -3
- package/web-tree-sitter.wasm +0 -0
- package/web-tree-sitter.wasm.map +9 -11
- package/web-tree-sitter.web.js +3 -3
- package/web-tree-sitter.web.js.map +3 -3
|
@@ -306,7 +306,7 @@ var require_web_tree_sitter = __commonJS({
|
|
|
306
306
|
var b = wasmMemory.buffer;
|
|
307
307
|
HEAP8 = new Int8Array(b);
|
|
308
308
|
HEAP16 = new Int16Array(b);
|
|
309
|
-
|
|
309
|
+
HEAPU8 = new Uint8Array(b);
|
|
310
310
|
Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
|
|
311
311
|
Module["HEAP32"] = HEAP32 = new Int32Array(b);
|
|
312
312
|
Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
|
|
@@ -1412,8 +1412,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1412
1412
|
"value": "i32",
|
|
1413
1413
|
"mutable": false
|
|
1414
1414
|
}, 1);
|
|
1415
|
-
var __abort_js = /* @__PURE__ */ __name(() => abort("native code called abort()"), "__abort_js");
|
|
1416
|
-
__abort_js.sig = "v";
|
|
1417
1415
|
var __emscripten_throw_longjmp = /* @__PURE__ */ __name(() => {
|
|
1418
1416
|
throw Infinity;
|
|
1419
1417
|
}, "__emscripten_throw_longjmp");
|
|
@@ -1516,18 +1514,29 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1516
1514
|
}
|
|
1517
1515
|
}
|
|
1518
1516
|
__name(_tree_sitter_log_callback, "_tree_sitter_log_callback");
|
|
1519
|
-
function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
|
|
1520
|
-
const
|
|
1521
|
-
const
|
|
1517
|
+
function _tree_sitter_parse_callback(inputBufferAddress, maxCodeUnits, index, row, column, lengthAddress) {
|
|
1518
|
+
const source = Module.currentParseCallback;
|
|
1519
|
+
const isString = typeof source === "string";
|
|
1520
|
+
const chunk = isString ? source : source(index, {
|
|
1522
1521
|
row,
|
|
1523
1522
|
column
|
|
1524
1523
|
});
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1524
|
+
const offset = isString ? index : 0;
|
|
1525
|
+
const remaining = typeof chunk === "string" ? chunk.length - offset : 0;
|
|
1526
|
+
if (remaining <= 0) {
|
|
1527
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, lengthAddress >>> 2, "storing")] = 0;
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
let count = remaining < maxCodeUnits ? remaining : maxCodeUnits;
|
|
1531
|
+
if (count < remaining && count > 1) {
|
|
1532
|
+
const last = chunk.charCodeAt(offset + count - 1);
|
|
1533
|
+
if (last >= 55296 && last <= 56319) count--;
|
|
1530
1534
|
}
|
|
1535
|
+
const base = inputBufferAddress >>> 1;
|
|
1536
|
+
for (let i2 = 0; i2 < count; i2++) {
|
|
1537
|
+
HEAPU16[SAFE_HEAP_INDEX(HEAPU16, base + i2, "storing")] = chunk.charCodeAt(offset + i2);
|
|
1538
|
+
}
|
|
1539
|
+
HEAP32[SAFE_HEAP_INDEX(HEAP32, lengthAddress >>> 2, "storing")] = count;
|
|
1531
1540
|
}
|
|
1532
1541
|
__name(_tree_sitter_parse_callback, "_tree_sitter_parse_callback");
|
|
1533
1542
|
function _tree_sitter_progress_callback(currentOffset, hasError) {
|
|
@@ -1641,22 +1650,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1641
1650
|
str += String.fromCharCode(ch);
|
|
1642
1651
|
}
|
|
1643
1652
|
}, "AsciiToString");
|
|
1644
|
-
var stringToUTF16 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => {
|
|
1645
|
-
assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!");
|
|
1646
|
-
assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
|
|
1647
|
-
maxBytesToWrite ??= 2147483647;
|
|
1648
|
-
if (maxBytesToWrite < 2) return 0;
|
|
1649
|
-
maxBytesToWrite -= 2;
|
|
1650
|
-
var startPtr = outPtr;
|
|
1651
|
-
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
1652
|
-
for (var i2 = 0; i2 < numCharsToWrite; ++i2) {
|
|
1653
|
-
var codeUnit = str.charCodeAt(i2);
|
|
1654
|
-
HEAP16[SAFE_HEAP_INDEX(HEAP16, outPtr >> 1, "storing")] = codeUnit;
|
|
1655
|
-
outPtr += 2;
|
|
1656
|
-
}
|
|
1657
|
-
HEAP16[SAFE_HEAP_INDEX(HEAP16, outPtr >> 1, "storing")] = 0;
|
|
1658
|
-
return outPtr - startPtr;
|
|
1659
|
-
}, "stringToUTF16");
|
|
1660
1653
|
{
|
|
1661
1654
|
initMemory();
|
|
1662
1655
|
if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
|
|
@@ -1692,11 +1685,10 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1692
1685
|
Module["stringToUTF8"] = stringToUTF8;
|
|
1693
1686
|
Module["lengthBytesUTF8"] = lengthBytesUTF8;
|
|
1694
1687
|
Module["AsciiToString"] = AsciiToString;
|
|
1695
|
-
Module["stringToUTF16"] = stringToUTF16;
|
|
1696
1688
|
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
1697
|
-
var missingLibrarySymbols = ["writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "zeroMemory", "withStackSave", "strError", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "readEmAsmArgs", "runEmAsmFunction", "runMainThreadEmAsm", "jstoi_q", "getExecutableName", "autoResumeAudioContext", "getDynCaller", "runtimeKeepalivePush", "runtimeKeepalivePop", "callUserCallback", "maybeExit", "asmjsMangle", "mmapAlloc", "HandleAllocator", "getNativeTypeSize", "getUniqueRunDependency", "addOnInit", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "ccall", "cwrap", "removeFunction", "intArrayFromString", "intArrayToString", "stringToAscii", "UTF16ToString", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "getEnvStrings", "checkWasiClock", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "initRandomFill", "randomFill", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "Browser_asyncPrepareDataCounter", "isLeapYear", "ydayFromDate", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "dlopenInternal", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "demangle", "stackTrace"];
|
|
1689
|
+
var missingLibrarySymbols = ["writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "zeroMemory", "withStackSave", "strError", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "readEmAsmArgs", "runEmAsmFunction", "runMainThreadEmAsm", "jstoi_q", "getExecutableName", "autoResumeAudioContext", "getDynCaller", "runtimeKeepalivePush", "runtimeKeepalivePop", "callUserCallback", "maybeExit", "asmjsMangle", "mmapAlloc", "HandleAllocator", "getNativeTypeSize", "getUniqueRunDependency", "addOnInit", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "ccall", "cwrap", "removeFunction", "intArrayFromString", "intArrayToString", "stringToAscii", "UTF16ToString", "stringToUTF16", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "getEnvStrings", "checkWasiClock", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "initRandomFill", "randomFill", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "Browser_asyncPrepareDataCounter", "isLeapYear", "ydayFromDate", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "dlopenInternal", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "demangle", "stackTrace"];
|
|
1698
1690
|
missingLibrarySymbols.forEach(missingLibrarySymbol);
|
|
1699
|
-
var unexportedSymbols = ["run", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "HEAPF32", "HEAPF64", "HEAP8", "HEAP16", "HEAP64", "HEAPU64", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "dynCall", "handleException", "keepRuntimeAlive", "asyncLoad", "alignMemory", "wasmTable", "noExitRuntime", "addRunDependency", "removeRunDependency", "addOnPreRun", "addOnPostCtor", "addOnPostRun", "convertJsFunctionToWasm", "freeTableIndexes", "functionsInTableMap", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "stringToUTF8Array", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "flush_NO_FILESYSTEM", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "Browser", "requestFullscreen", "requestFullScreen", "setCanvasSize", "getUserMedia", "createContext", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "SYSCALLS", "isSymbolDefined", "GOT", "currentModuleWeakSymbols", "LDSO", "getMemory", "mergeLibSymbols", "newDSO", "loadDynamicLibrary", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr", "jstoi_s"];
|
|
1691
|
+
var unexportedSymbols = ["run", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "HEAPF32", "HEAPF64", "HEAP8", "HEAPU8", "HEAP16", "HEAP64", "HEAPU64", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "dynCall", "handleException", "keepRuntimeAlive", "asyncLoad", "alignMemory", "wasmTable", "noExitRuntime", "addRunDependency", "removeRunDependency", "addOnPreRun", "addOnPostCtor", "addOnPostRun", "convertJsFunctionToWasm", "freeTableIndexes", "functionsInTableMap", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "setValue", "getValue", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "stringToUTF8Array", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "flush_NO_FILESYSTEM", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "Browser", "requestFullscreen", "requestFullScreen", "setCanvasSize", "getUserMedia", "createContext", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "SYSCALLS", "isSymbolDefined", "GOT", "currentModuleWeakSymbols", "LDSO", "getMemory", "mergeLibSymbols", "newDSO", "loadDynamicLibrary", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr", "jstoi_s"];
|
|
1700
1692
|
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
1701
1693
|
function checkIncomingModuleAPI() {
|
|
1702
1694
|
ignoredModuleProp("fetchSettings");
|
|
@@ -1707,7 +1699,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1707
1699
|
var _calloc = Module["_calloc"] = makeInvalidEarlyAccess("_calloc");
|
|
1708
1700
|
var _realloc = Module["_realloc"] = makeInvalidEarlyAccess("_realloc");
|
|
1709
1701
|
var _free = Module["_free"] = makeInvalidEarlyAccess("_free");
|
|
1710
|
-
var _ts_range_edit = Module["_ts_range_edit"] = makeInvalidEarlyAccess("_ts_range_edit");
|
|
1711
1702
|
var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = makeInvalidEarlyAccess("_ts_language_symbol_count");
|
|
1712
1703
|
var _ts_language_state_count = Module["_ts_language_state_count"] = makeInvalidEarlyAccess("_ts_language_state_count");
|
|
1713
1704
|
var _ts_language_abi_version = Module["_ts_language_abi_version"] = makeInvalidEarlyAccess("_ts_language_abi_version");
|
|
@@ -1725,12 +1716,12 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1725
1716
|
var _ts_lookahead_iterator_reset = Module["_ts_lookahead_iterator_reset"] = makeInvalidEarlyAccess("_ts_lookahead_iterator_reset");
|
|
1726
1717
|
var _ts_lookahead_iterator_next = Module["_ts_lookahead_iterator_next"] = makeInvalidEarlyAccess("_ts_lookahead_iterator_next");
|
|
1727
1718
|
var _ts_lookahead_iterator_current_symbol = Module["_ts_lookahead_iterator_current_symbol"] = makeInvalidEarlyAccess("_ts_lookahead_iterator_current_symbol");
|
|
1728
|
-
var _ts_point_edit = Module["_ts_point_edit"] = makeInvalidEarlyAccess("_ts_point_edit");
|
|
1729
1719
|
var _ts_parser_delete = Module["_ts_parser_delete"] = makeInvalidEarlyAccess("_ts_parser_delete");
|
|
1730
1720
|
var _ts_parser_set_language = Module["_ts_parser_set_language"] = makeInvalidEarlyAccess("_ts_parser_set_language");
|
|
1731
1721
|
var _ts_parser_reset = Module["_ts_parser_reset"] = makeInvalidEarlyAccess("_ts_parser_reset");
|
|
1732
|
-
var _ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = makeInvalidEarlyAccess("_ts_parser_set_included_ranges");
|
|
1733
1722
|
var _memcmp = Module["_memcmp"] = makeInvalidEarlyAccess("_memcmp");
|
|
1723
|
+
var _ts_tree_cursor_current_descendant_index = Module["_ts_tree_cursor_current_descendant_index"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_descendant_index");
|
|
1724
|
+
var _ts_tree_cursor_current_depth = Module["_ts_tree_cursor_current_depth"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_depth");
|
|
1734
1725
|
var _ts_tree_copy = Module["_ts_tree_copy"] = makeInvalidEarlyAccess("_ts_tree_copy");
|
|
1735
1726
|
var _ts_tree_delete = Module["_ts_tree_delete"] = makeInvalidEarlyAccess("_ts_tree_delete");
|
|
1736
1727
|
var _ts_init = Module["_ts_init"] = makeInvalidEarlyAccess("_ts_init");
|
|
@@ -1774,8 +1765,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1774
1765
|
var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_position_wasm");
|
|
1775
1766
|
var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_index_wasm");
|
|
1776
1767
|
var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_index_wasm");
|
|
1777
|
-
var _ts_tree_cursor_current_depth_wasm = Module["_ts_tree_cursor_current_depth_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_depth_wasm");
|
|
1778
|
-
var _ts_tree_cursor_current_descendant_index_wasm = Module["_ts_tree_cursor_current_descendant_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_descendant_index_wasm");
|
|
1779
1768
|
var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_wasm");
|
|
1780
1769
|
var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = makeInvalidEarlyAccess("_ts_node_symbol_wasm");
|
|
1781
1770
|
var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = makeInvalidEarlyAccess("_ts_node_field_name_for_child_wasm");
|
|
@@ -1800,9 +1789,7 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1800
1789
|
var _ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = makeInvalidEarlyAccess("_ts_node_named_descendant_for_index_wasm");
|
|
1801
1790
|
var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = makeInvalidEarlyAccess("_ts_node_descendant_for_position_wasm");
|
|
1802
1791
|
var _ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = makeInvalidEarlyAccess("_ts_node_named_descendant_for_position_wasm");
|
|
1803
|
-
var _ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = makeInvalidEarlyAccess("_ts_node_start_point_wasm");
|
|
1804
1792
|
var _ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = makeInvalidEarlyAccess("_ts_node_end_point_wasm");
|
|
1805
|
-
var _ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = makeInvalidEarlyAccess("_ts_node_start_index_wasm");
|
|
1806
1793
|
var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = makeInvalidEarlyAccess("_ts_node_end_index_wasm");
|
|
1807
1794
|
var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = makeInvalidEarlyAccess("_ts_node_to_string_wasm");
|
|
1808
1795
|
var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = makeInvalidEarlyAccess("_ts_node_children_wasm");
|
|
@@ -1816,9 +1803,9 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1816
1803
|
var _ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = makeInvalidEarlyAccess("_ts_node_is_extra_wasm");
|
|
1817
1804
|
var _ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = makeInvalidEarlyAccess("_ts_node_parse_state_wasm");
|
|
1818
1805
|
var _ts_node_next_parse_state_wasm = Module["_ts_node_next_parse_state_wasm"] = makeInvalidEarlyAccess("_ts_node_next_parse_state_wasm");
|
|
1819
|
-
var _memset = Module["_memset"] = makeInvalidEarlyAccess("_memset");
|
|
1820
1806
|
var _memcpy = Module["_memcpy"] = makeInvalidEarlyAccess("_memcpy");
|
|
1821
1807
|
var _memmove = Module["_memmove"] = makeInvalidEarlyAccess("_memmove");
|
|
1808
|
+
var _memset = Module["_memset"] = makeInvalidEarlyAccess("_memset");
|
|
1822
1809
|
var _fflush = makeInvalidEarlyAccess("_fflush");
|
|
1823
1810
|
var _strlen = Module["_strlen"] = makeInvalidEarlyAccess("_strlen");
|
|
1824
1811
|
var _iswalnum = Module["_iswalnum"] = makeInvalidEarlyAccess("_iswalnum");
|
|
@@ -1852,7 +1839,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1852
1839
|
Module["_calloc"] = _calloc = createExportWrapper("calloc", 2);
|
|
1853
1840
|
Module["_realloc"] = _realloc = createExportWrapper("realloc", 2);
|
|
1854
1841
|
Module["_free"] = _free = createExportWrapper("free", 1);
|
|
1855
|
-
Module["_ts_range_edit"] = _ts_range_edit = createExportWrapper("ts_range_edit", 2);
|
|
1856
1842
|
Module["_ts_language_symbol_count"] = _ts_language_symbol_count = createExportWrapper("ts_language_symbol_count", 1);
|
|
1857
1843
|
Module["_ts_language_state_count"] = _ts_language_state_count = createExportWrapper("ts_language_state_count", 1);
|
|
1858
1844
|
Module["_ts_language_abi_version"] = _ts_language_abi_version = createExportWrapper("ts_language_abi_version", 1);
|
|
@@ -1870,12 +1856,12 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1870
1856
|
Module["_ts_lookahead_iterator_reset"] = _ts_lookahead_iterator_reset = createExportWrapper("ts_lookahead_iterator_reset", 3);
|
|
1871
1857
|
Module["_ts_lookahead_iterator_next"] = _ts_lookahead_iterator_next = createExportWrapper("ts_lookahead_iterator_next", 1);
|
|
1872
1858
|
Module["_ts_lookahead_iterator_current_symbol"] = _ts_lookahead_iterator_current_symbol = createExportWrapper("ts_lookahead_iterator_current_symbol", 1);
|
|
1873
|
-
Module["_ts_point_edit"] = _ts_point_edit = createExportWrapper("ts_point_edit", 3);
|
|
1874
1859
|
Module["_ts_parser_delete"] = _ts_parser_delete = createExportWrapper("ts_parser_delete", 1);
|
|
1875
1860
|
Module["_ts_parser_set_language"] = _ts_parser_set_language = createExportWrapper("ts_parser_set_language", 2);
|
|
1876
1861
|
Module["_ts_parser_reset"] = _ts_parser_reset = createExportWrapper("ts_parser_reset", 1);
|
|
1877
|
-
Module["_ts_parser_set_included_ranges"] = _ts_parser_set_included_ranges = createExportWrapper("ts_parser_set_included_ranges", 3);
|
|
1878
1862
|
Module["_memcmp"] = _memcmp = createExportWrapper("memcmp", 3);
|
|
1863
|
+
Module["_ts_tree_cursor_current_descendant_index"] = _ts_tree_cursor_current_descendant_index = createExportWrapper("ts_tree_cursor_current_descendant_index", 1);
|
|
1864
|
+
Module["_ts_tree_cursor_current_depth"] = _ts_tree_cursor_current_depth = createExportWrapper("ts_tree_cursor_current_depth", 1);
|
|
1879
1865
|
Module["_ts_tree_copy"] = _ts_tree_copy = createExportWrapper("ts_tree_copy", 1);
|
|
1880
1866
|
Module["_ts_tree_delete"] = _ts_tree_delete = createExportWrapper("ts_tree_delete", 1);
|
|
1881
1867
|
Module["_ts_init"] = _ts_init = createExportWrapper("ts_init", 0);
|
|
@@ -1908,7 +1894,7 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1908
1894
|
Module["_ts_tree_cursor_goto_first_child_wasm"] = _ts_tree_cursor_goto_first_child_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_wasm", 1);
|
|
1909
1895
|
Module["_ts_tree_cursor_goto_last_child_wasm"] = _ts_tree_cursor_goto_last_child_wasm = createExportWrapper("ts_tree_cursor_goto_last_child_wasm", 1);
|
|
1910
1896
|
Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = _ts_tree_cursor_goto_first_child_for_index_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_index_wasm", 2);
|
|
1911
|
-
Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = _ts_tree_cursor_goto_first_child_for_position_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_position_wasm",
|
|
1897
|
+
Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = _ts_tree_cursor_goto_first_child_for_position_wasm = createExportWrapper("ts_tree_cursor_goto_first_child_for_position_wasm", 3);
|
|
1912
1898
|
Module["_ts_tree_cursor_goto_next_sibling_wasm"] = _ts_tree_cursor_goto_next_sibling_wasm = createExportWrapper("ts_tree_cursor_goto_next_sibling_wasm", 1);
|
|
1913
1899
|
Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = _ts_tree_cursor_goto_previous_sibling_wasm = createExportWrapper("ts_tree_cursor_goto_previous_sibling_wasm", 1);
|
|
1914
1900
|
Module["_ts_tree_cursor_goto_descendant_wasm"] = _ts_tree_cursor_goto_descendant_wasm = createExportWrapper("ts_tree_cursor_goto_descendant_wasm", 2);
|
|
@@ -1919,8 +1905,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1919
1905
|
Module["_ts_tree_cursor_end_position_wasm"] = _ts_tree_cursor_end_position_wasm = createExportWrapper("ts_tree_cursor_end_position_wasm", 1);
|
|
1920
1906
|
Module["_ts_tree_cursor_start_index_wasm"] = _ts_tree_cursor_start_index_wasm = createExportWrapper("ts_tree_cursor_start_index_wasm", 1);
|
|
1921
1907
|
Module["_ts_tree_cursor_end_index_wasm"] = _ts_tree_cursor_end_index_wasm = createExportWrapper("ts_tree_cursor_end_index_wasm", 1);
|
|
1922
|
-
Module["_ts_tree_cursor_current_depth_wasm"] = _ts_tree_cursor_current_depth_wasm = createExportWrapper("ts_tree_cursor_current_depth_wasm", 1);
|
|
1923
|
-
Module["_ts_tree_cursor_current_descendant_index_wasm"] = _ts_tree_cursor_current_descendant_index_wasm = createExportWrapper("ts_tree_cursor_current_descendant_index_wasm", 1);
|
|
1924
1908
|
Module["_ts_tree_cursor_current_node_wasm"] = _ts_tree_cursor_current_node_wasm = createExportWrapper("ts_tree_cursor_current_node_wasm", 1);
|
|
1925
1909
|
Module["_ts_node_symbol_wasm"] = _ts_node_symbol_wasm = createExportWrapper("ts_node_symbol_wasm", 1);
|
|
1926
1910
|
Module["_ts_node_field_name_for_child_wasm"] = _ts_node_field_name_for_child_wasm = createExportWrapper("ts_node_field_name_for_child_wasm", 2);
|
|
@@ -1945,14 +1929,12 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1945
1929
|
Module["_ts_node_named_descendant_for_index_wasm"] = _ts_node_named_descendant_for_index_wasm = createExportWrapper("ts_node_named_descendant_for_index_wasm", 1);
|
|
1946
1930
|
Module["_ts_node_descendant_for_position_wasm"] = _ts_node_descendant_for_position_wasm = createExportWrapper("ts_node_descendant_for_position_wasm", 1);
|
|
1947
1931
|
Module["_ts_node_named_descendant_for_position_wasm"] = _ts_node_named_descendant_for_position_wasm = createExportWrapper("ts_node_named_descendant_for_position_wasm", 1);
|
|
1948
|
-
Module["_ts_node_start_point_wasm"] = _ts_node_start_point_wasm = createExportWrapper("ts_node_start_point_wasm", 1);
|
|
1949
1932
|
Module["_ts_node_end_point_wasm"] = _ts_node_end_point_wasm = createExportWrapper("ts_node_end_point_wasm", 1);
|
|
1950
|
-
Module["_ts_node_start_index_wasm"] = _ts_node_start_index_wasm = createExportWrapper("ts_node_start_index_wasm", 1);
|
|
1951
1933
|
Module["_ts_node_end_index_wasm"] = _ts_node_end_index_wasm = createExportWrapper("ts_node_end_index_wasm", 1);
|
|
1952
1934
|
Module["_ts_node_to_string_wasm"] = _ts_node_to_string_wasm = createExportWrapper("ts_node_to_string_wasm", 1);
|
|
1953
1935
|
Module["_ts_node_children_wasm"] = _ts_node_children_wasm = createExportWrapper("ts_node_children_wasm", 1);
|
|
1954
1936
|
Module["_ts_node_named_children_wasm"] = _ts_node_named_children_wasm = createExportWrapper("ts_node_named_children_wasm", 1);
|
|
1955
|
-
Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm",
|
|
1937
|
+
Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm", 3);
|
|
1956
1938
|
Module["_ts_node_is_named_wasm"] = _ts_node_is_named_wasm = createExportWrapper("ts_node_is_named_wasm", 1);
|
|
1957
1939
|
Module["_ts_node_has_changes_wasm"] = _ts_node_has_changes_wasm = createExportWrapper("ts_node_has_changes_wasm", 1);
|
|
1958
1940
|
Module["_ts_node_has_error_wasm"] = _ts_node_has_error_wasm = createExportWrapper("ts_node_has_error_wasm", 1);
|
|
@@ -1961,9 +1943,9 @@ var require_web_tree_sitter = __commonJS({
|
|
|
1961
1943
|
Module["_ts_node_is_extra_wasm"] = _ts_node_is_extra_wasm = createExportWrapper("ts_node_is_extra_wasm", 1);
|
|
1962
1944
|
Module["_ts_node_parse_state_wasm"] = _ts_node_parse_state_wasm = createExportWrapper("ts_node_parse_state_wasm", 1);
|
|
1963
1945
|
Module["_ts_node_next_parse_state_wasm"] = _ts_node_next_parse_state_wasm = createExportWrapper("ts_node_next_parse_state_wasm", 1);
|
|
1964
|
-
Module["_memset"] = _memset = createExportWrapper("memset", 3);
|
|
1965
1946
|
Module["_memcpy"] = _memcpy = createExportWrapper("memcpy", 3);
|
|
1966
1947
|
Module["_memmove"] = _memmove = createExportWrapper("memmove", 3);
|
|
1948
|
+
Module["_memset"] = _memset = createExportWrapper("memset", 3);
|
|
1967
1949
|
_fflush = createExportWrapper("fflush", 1);
|
|
1968
1950
|
Module["_strlen"] = _strlen = createExportWrapper("strlen", 1);
|
|
1969
1951
|
Module["_iswalnum"] = _iswalnum = createExportWrapper("iswalnum", 1);
|
|
@@ -2010,8 +1992,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
2010
1992
|
/** @export */
|
|
2011
1993
|
__table_base: ___table_base,
|
|
2012
1994
|
/** @export */
|
|
2013
|
-
_abort_js: __abort_js,
|
|
2014
|
-
/** @export */
|
|
2015
1995
|
_emscripten_throw_longjmp: __emscripten_throw_longjmp,
|
|
2016
1996
|
/** @export */
|
|
2017
1997
|
alignfault,
|
|
@@ -2024,6 +2004,8 @@ var require_web_tree_sitter = __commonJS({
|
|
|
2024
2004
|
/** @export */
|
|
2025
2005
|
fd_write: _fd_write,
|
|
2026
2006
|
/** @export */
|
|
2007
|
+
invoke_ii,
|
|
2008
|
+
/** @export */
|
|
2027
2009
|
invoke_iii,
|
|
2028
2010
|
/** @export */
|
|
2029
2011
|
invoke_iiii,
|
|
@@ -2034,8 +2016,6 @@ var require_web_tree_sitter = __commonJS({
|
|
|
2034
2016
|
/** @export */
|
|
2035
2017
|
invoke_vi,
|
|
2036
2018
|
/** @export */
|
|
2037
|
-
invoke_vii,
|
|
2038
|
-
/** @export */
|
|
2039
2019
|
invoke_vj,
|
|
2040
2020
|
/** @export */
|
|
2041
2021
|
memory: wasmMemory,
|
|
@@ -2048,28 +2028,28 @@ var require_web_tree_sitter = __commonJS({
|
|
|
2048
2028
|
/** @export */
|
|
2049
2029
|
tree_sitter_progress_callback: _tree_sitter_progress_callback
|
|
2050
2030
|
};
|
|
2051
|
-
function
|
|
2031
|
+
function invoke_vi(index, a1) {
|
|
2052
2032
|
var sp = stackSave();
|
|
2053
2033
|
try {
|
|
2054
|
-
getWasmTableEntry(index)(a1
|
|
2034
|
+
getWasmTableEntry(index)(a1);
|
|
2055
2035
|
} catch (e) {
|
|
2056
2036
|
stackRestore(sp);
|
|
2057
2037
|
if (e !== e + 0) throw e;
|
|
2058
2038
|
_setThrew(1, 0);
|
|
2059
2039
|
}
|
|
2060
2040
|
}
|
|
2061
|
-
__name(
|
|
2062
|
-
function
|
|
2041
|
+
__name(invoke_vi, "invoke_vi");
|
|
2042
|
+
function invoke_ii(index, a1) {
|
|
2063
2043
|
var sp = stackSave();
|
|
2064
2044
|
try {
|
|
2065
|
-
return getWasmTableEntry(index)(a1
|
|
2045
|
+
return getWasmTableEntry(index)(a1);
|
|
2066
2046
|
} catch (e) {
|
|
2067
2047
|
stackRestore(sp);
|
|
2068
2048
|
if (e !== e + 0) throw e;
|
|
2069
2049
|
_setThrew(1, 0);
|
|
2070
2050
|
}
|
|
2071
2051
|
}
|
|
2072
|
-
__name(
|
|
2052
|
+
__name(invoke_ii, "invoke_ii");
|
|
2073
2053
|
function invoke_vj(index, a1) {
|
|
2074
2054
|
var sp = stackSave();
|
|
2075
2055
|
try {
|
|
@@ -2093,39 +2073,39 @@ var require_web_tree_sitter = __commonJS({
|
|
|
2093
2073
|
}
|
|
2094
2074
|
}
|
|
2095
2075
|
__name(invoke_ji, "invoke_ji");
|
|
2096
|
-
function
|
|
2076
|
+
function invoke_iiii(index, a1, a2, a3) {
|
|
2097
2077
|
var sp = stackSave();
|
|
2098
2078
|
try {
|
|
2099
|
-
return getWasmTableEntry(index)(a1, a2, a3
|
|
2079
|
+
return getWasmTableEntry(index)(a1, a2, a3);
|
|
2100
2080
|
} catch (e) {
|
|
2101
2081
|
stackRestore(sp);
|
|
2102
2082
|
if (e !== e + 0) throw e;
|
|
2103
2083
|
_setThrew(1, 0);
|
|
2104
2084
|
}
|
|
2105
2085
|
}
|
|
2106
|
-
__name(
|
|
2107
|
-
function
|
|
2086
|
+
__name(invoke_iiii, "invoke_iiii");
|
|
2087
|
+
function invoke_iiiii(index, a1, a2, a3, a4) {
|
|
2108
2088
|
var sp = stackSave();
|
|
2109
2089
|
try {
|
|
2110
|
-
return getWasmTableEntry(index)(a1, a2, a3);
|
|
2090
|
+
return getWasmTableEntry(index)(a1, a2, a3, a4);
|
|
2111
2091
|
} catch (e) {
|
|
2112
2092
|
stackRestore(sp);
|
|
2113
2093
|
if (e !== e + 0) throw e;
|
|
2114
2094
|
_setThrew(1, 0);
|
|
2115
2095
|
}
|
|
2116
2096
|
}
|
|
2117
|
-
__name(
|
|
2118
|
-
function
|
|
2097
|
+
__name(invoke_iiiii, "invoke_iiiii");
|
|
2098
|
+
function invoke_iii(index, a1, a2) {
|
|
2119
2099
|
var sp = stackSave();
|
|
2120
2100
|
try {
|
|
2121
|
-
getWasmTableEntry(index)(a1);
|
|
2101
|
+
return getWasmTableEntry(index)(a1, a2);
|
|
2122
2102
|
} catch (e) {
|
|
2123
2103
|
stackRestore(sp);
|
|
2124
2104
|
if (e !== e + 0) throw e;
|
|
2125
2105
|
_setThrew(1, 0);
|
|
2126
2106
|
}
|
|
2127
2107
|
}
|
|
2128
|
-
__name(
|
|
2108
|
+
__name(invoke_iii, "invoke_iii");
|
|
2129
2109
|
var calledRun;
|
|
2130
2110
|
function callMain(args2 = []) {
|
|
2131
2111
|
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
|
|
@@ -2548,21 +2528,21 @@ var TreeCursor = class _TreeCursor {
|
|
|
2548
2528
|
}
|
|
2549
2529
|
/** Get the field name of this tree cursor's current node. */
|
|
2550
2530
|
get currentFieldName() {
|
|
2551
|
-
return this.tree.language.fields[this._fieldId];
|
|
2531
|
+
return this.tree.language.fields[this._fieldId] ?? null;
|
|
2552
2532
|
}
|
|
2553
2533
|
/**
|
|
2554
2534
|
* Get the depth of the cursor's current node relative to the original
|
|
2555
2535
|
* node that the cursor was constructed with.
|
|
2556
2536
|
*/
|
|
2557
2537
|
get currentDepth() {
|
|
2558
|
-
return C.
|
|
2538
|
+
return C._ts_tree_cursor_current_depth(this[0]) >>> 0;
|
|
2559
2539
|
}
|
|
2560
2540
|
/**
|
|
2561
2541
|
* Get the index of the cursor's current node out of all of the
|
|
2562
2542
|
* descendants of the original node that the cursor was constructed with.
|
|
2563
2543
|
*/
|
|
2564
2544
|
get currentDescendantIndex() {
|
|
2565
|
-
return C.
|
|
2545
|
+
return C._ts_tree_cursor_current_descendant_index(this[0]) >>> 0;
|
|
2566
2546
|
}
|
|
2567
2547
|
/** Get the type of the cursor's current node. */
|
|
2568
2548
|
get nodeType() {
|
|
@@ -2601,7 +2581,8 @@ var TreeCursor = class _TreeCursor {
|
|
|
2601
2581
|
/** Get the string content of the cursor's current node. */
|
|
2602
2582
|
get nodeText() {
|
|
2603
2583
|
this.syncIndices();
|
|
2604
|
-
|
|
2584
|
+
const { textSource } = this.tree;
|
|
2585
|
+
return typeof textSource === "string" ? textSource.slice(this._startIndex, this._endIndex) : getCallbackText(textSource, this._startIndex, this._endIndex, this.startPosition);
|
|
2605
2586
|
}
|
|
2606
2587
|
/** Get the start position of the cursor's current node. */
|
|
2607
2588
|
get startPosition() {
|
|
@@ -2725,8 +2706,13 @@ var TreeCursor = class _TreeCursor {
|
|
|
2725
2706
|
* `false` if no such child was found.
|
|
2726
2707
|
*/
|
|
2727
2708
|
gotoFirstChildForPosition(goalPosition) {
|
|
2728
|
-
|
|
2729
|
-
|
|
2709
|
+
if (!C._ts_tree_cursor_goto_first_child_for_position_wasm(
|
|
2710
|
+
this[0],
|
|
2711
|
+
goalPosition.row,
|
|
2712
|
+
goalPosition.column
|
|
2713
|
+
)) {
|
|
2714
|
+
return false;
|
|
2715
|
+
}
|
|
2730
2716
|
this.readNodeCache();
|
|
2731
2717
|
return true;
|
|
2732
2718
|
}
|
|
@@ -2747,7 +2733,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
2747
2733
|
* information and allows reusing already created cursors.
|
|
2748
2734
|
*/
|
|
2749
2735
|
resetTo(cursor) {
|
|
2750
|
-
if (
|
|
2736
|
+
if (this[0] === cursor[0]) return;
|
|
2751
2737
|
this.tree = cursor.tree;
|
|
2752
2738
|
C._ts_tree_cursor_reset_to_wasm(this[0], cursor[0]);
|
|
2753
2739
|
this.readNodeCache();
|
|
@@ -2774,17 +2760,13 @@ var TreeCursor = class _TreeCursor {
|
|
|
2774
2760
|
};
|
|
2775
2761
|
|
|
2776
2762
|
// src/tree.ts
|
|
2777
|
-
function
|
|
2778
|
-
if (tree.sourceText !== void 0) {
|
|
2779
|
-
return tree.sourceText.slice(startIndex, endIndex);
|
|
2780
|
-
}
|
|
2781
|
-
const startPosition = getStartPosition();
|
|
2763
|
+
function getCallbackText(textSource, startIndex, endIndex, startPosition) {
|
|
2782
2764
|
const length = endIndex - startIndex;
|
|
2783
|
-
let result =
|
|
2765
|
+
let result = textSource(startIndex, startPosition);
|
|
2784
2766
|
if (result) {
|
|
2785
2767
|
startIndex += result.length;
|
|
2786
2768
|
while (startIndex < endIndex) {
|
|
2787
|
-
const string =
|
|
2769
|
+
const string = textSource(startIndex, startPosition);
|
|
2788
2770
|
if (string && string.length > 0) {
|
|
2789
2771
|
startIndex += string.length;
|
|
2790
2772
|
result += string;
|
|
@@ -2798,7 +2780,7 @@ function getText(tree, startIndex, endIndex, getStartPosition) {
|
|
|
2798
2780
|
}
|
|
2799
2781
|
return result ?? "";
|
|
2800
2782
|
}
|
|
2801
|
-
__name(
|
|
2783
|
+
__name(getCallbackText, "getCallbackText");
|
|
2802
2784
|
var finalizer3 = newFinalizer((address) => {
|
|
2803
2785
|
C._ts_tree_delete(address);
|
|
2804
2786
|
});
|
|
@@ -2810,26 +2792,23 @@ var Tree2 = class _Tree {
|
|
|
2810
2792
|
[0] = 0;
|
|
2811
2793
|
// Internal handle for Wasm
|
|
2812
2794
|
/** @internal */
|
|
2813
|
-
|
|
2814
|
-
/** @internal */
|
|
2815
|
-
sourceText;
|
|
2795
|
+
textSource;
|
|
2816
2796
|
/** @internal */
|
|
2817
2797
|
editVersion = 0;
|
|
2818
2798
|
/** The language that was used to parse the syntax tree. */
|
|
2819
2799
|
language;
|
|
2820
2800
|
/** @internal */
|
|
2821
|
-
constructor(internal, address, language,
|
|
2801
|
+
constructor(internal, address, language, textSource) {
|
|
2822
2802
|
assertInternal(internal);
|
|
2823
2803
|
this[0] = address;
|
|
2824
2804
|
this.language = language;
|
|
2825
|
-
this.
|
|
2826
|
-
this.sourceText = sourceText;
|
|
2805
|
+
this.textSource = textSource;
|
|
2827
2806
|
finalizer3?.register(this, address, this);
|
|
2828
2807
|
}
|
|
2829
2808
|
/** Create a shallow copy of the syntax tree. This is very fast. */
|
|
2830
2809
|
copy() {
|
|
2831
2810
|
const address = C._ts_tree_copy(this[0]);
|
|
2832
|
-
return new _Tree(INTERNAL, address, this.language, this.
|
|
2811
|
+
return new _Tree(INTERNAL, address, this.language, this.textSource);
|
|
2833
2812
|
}
|
|
2834
2813
|
/** Delete the syntax tree, freeing its resources. */
|
|
2835
2814
|
delete() {
|
|
@@ -3033,7 +3012,8 @@ var Node = class {
|
|
|
3033
3012
|
}
|
|
3034
3013
|
/** Get the string content of this node. */
|
|
3035
3014
|
get text() {
|
|
3036
|
-
|
|
3015
|
+
const { textSource } = this.tree;
|
|
3016
|
+
return typeof textSource === "string" ? textSource.slice(this.startIndex, this.endIndex) : getCallbackText(textSource, this.startIndex, this.endIndex, this.startPosition);
|
|
3037
3017
|
}
|
|
3038
3018
|
/** Get this node's parse state. */
|
|
3039
3019
|
get parseState() {
|
|
@@ -3231,21 +3211,21 @@ var Node = class {
|
|
|
3231
3211
|
symbols.push(65535);
|
|
3232
3212
|
}
|
|
3233
3213
|
const symbolsAddress = C._malloc(SIZE_OF_INT * symbols.length);
|
|
3214
|
+
const symbolsHeap = C.HEAPU32;
|
|
3234
3215
|
const symbolsBase = symbolsAddress >>> 2;
|
|
3235
3216
|
for (let i2 = 0, n = symbols.length; i2 < n; i2++) {
|
|
3236
|
-
|
|
3217
|
+
symbolsHeap[symbolsBase + i2] = symbols[i2];
|
|
3237
3218
|
}
|
|
3238
3219
|
marshalNode(this);
|
|
3220
|
+
const pointAddress = TRANSFER_BUFFER + SIZE_OF_NODE;
|
|
3221
|
+
marshalPoint(pointAddress, startPosition);
|
|
3222
|
+
marshalPoint(pointAddress + SIZE_OF_POINT, endPosition);
|
|
3239
3223
|
C._ts_node_descendants_of_type_wasm(
|
|
3240
3224
|
this.tree[0],
|
|
3241
3225
|
symbolsAddress,
|
|
3242
|
-
symbols.length
|
|
3243
|
-
startPosition.row,
|
|
3244
|
-
startPosition.column,
|
|
3245
|
-
endPosition.row,
|
|
3246
|
-
endPosition.column
|
|
3226
|
+
symbols.length
|
|
3247
3227
|
);
|
|
3248
|
-
const result = unmarshalNodeArray(this.tree, true
|
|
3228
|
+
const result = unmarshalNodeArray(this.tree, true);
|
|
3249
3229
|
C._free(symbolsAddress);
|
|
3250
3230
|
return result;
|
|
3251
3231
|
}
|
|
@@ -3314,8 +3294,9 @@ var Node = class {
|
|
|
3314
3294
|
}
|
|
3315
3295
|
marshalNode(this);
|
|
3316
3296
|
const base = TRANSFER_BUFFER + SIZE_OF_NODE >>> 2;
|
|
3317
|
-
C.HEAP32
|
|
3318
|
-
|
|
3297
|
+
const heap = C.HEAP32;
|
|
3298
|
+
heap[base] = start2;
|
|
3299
|
+
heap[base + 1] = end;
|
|
3319
3300
|
C._ts_node_descendant_for_index_wasm(this.tree[0]);
|
|
3320
3301
|
return unmarshalNode(this.tree);
|
|
3321
3302
|
}
|
|
@@ -3326,8 +3307,9 @@ var Node = class {
|
|
|
3326
3307
|
}
|
|
3327
3308
|
marshalNode(this);
|
|
3328
3309
|
const base = TRANSFER_BUFFER + SIZE_OF_NODE >>> 2;
|
|
3329
|
-
C.HEAP32
|
|
3330
|
-
|
|
3310
|
+
const heap = C.HEAP32;
|
|
3311
|
+
heap[base] = start2;
|
|
3312
|
+
heap[base + 1] = end;
|
|
3331
3313
|
C._ts_node_named_descendant_for_index_wasm(this.tree[0]);
|
|
3332
3314
|
return unmarshalNode(this.tree);
|
|
3333
3315
|
}
|
|
@@ -3455,16 +3437,17 @@ function unmarshalRange(address) {
|
|
|
3455
3437
|
}
|
|
3456
3438
|
__name(unmarshalRange, "unmarshalRange");
|
|
3457
3439
|
function marshalEdit(edit, address = TRANSFER_BUFFER) {
|
|
3458
|
-
|
|
3459
|
-
address += SIZE_OF_POINT;
|
|
3460
|
-
marshalPoint(address, edit.oldEndPosition);
|
|
3461
|
-
address += SIZE_OF_POINT;
|
|
3462
|
-
marshalPoint(address, edit.newEndPosition);
|
|
3463
|
-
const base = address + SIZE_OF_POINT >>> 2;
|
|
3440
|
+
const base = address >>> 2;
|
|
3464
3441
|
const heap = C.HEAP32;
|
|
3465
|
-
heap[base] = edit.
|
|
3466
|
-
heap[base + 1] = edit.
|
|
3467
|
-
heap[base + 2] = edit.
|
|
3442
|
+
heap[base] = edit.startPosition.row;
|
|
3443
|
+
heap[base + 1] = edit.startPosition.column;
|
|
3444
|
+
heap[base + 2] = edit.oldEndPosition.row;
|
|
3445
|
+
heap[base + 3] = edit.oldEndPosition.column;
|
|
3446
|
+
heap[base + 4] = edit.newEndPosition.row;
|
|
3447
|
+
heap[base + 5] = edit.newEndPosition.column;
|
|
3448
|
+
heap[base + 6] = edit.startIndex;
|
|
3449
|
+
heap[base + 7] = edit.oldEndIndex;
|
|
3450
|
+
heap[base + 8] = edit.newEndIndex;
|
|
3468
3451
|
}
|
|
3469
3452
|
__name(marshalEdit, "marshalEdit");
|
|
3470
3453
|
function unmarshalLanguageMetadata(address) {
|
|
@@ -3493,14 +3476,14 @@ function unmarshalSymbols() {
|
|
|
3493
3476
|
}
|
|
3494
3477
|
__name(unmarshalSymbols, "unmarshalSymbols");
|
|
3495
3478
|
function unmarshalRanges(useTsFree = true) {
|
|
3496
|
-
return unmarshalArray(SIZE_OF_RANGE, unmarshalRange, useTsFree
|
|
3479
|
+
return unmarshalArray(SIZE_OF_RANGE, unmarshalRange, useTsFree);
|
|
3497
3480
|
}
|
|
3498
3481
|
__name(unmarshalRanges, "unmarshalRanges");
|
|
3499
|
-
function unmarshalNodeArray(tree, useTsFree = false
|
|
3500
|
-
return unmarshalArray(SIZE_OF_NODE, (address) => unmarshalNode(tree, address), useTsFree
|
|
3482
|
+
function unmarshalNodeArray(tree, useTsFree = false) {
|
|
3483
|
+
return unmarshalArray(SIZE_OF_NODE, (address) => unmarshalNode(tree, address), useTsFree);
|
|
3501
3484
|
}
|
|
3502
3485
|
__name(unmarshalNodeArray, "unmarshalNodeArray");
|
|
3503
|
-
function unmarshalArray(stride, readItem, useTsFree
|
|
3486
|
+
function unmarshalArray(stride, readItem, useTsFree) {
|
|
3504
3487
|
const base = TRANSFER_BUFFER >>> 2;
|
|
3505
3488
|
const count = C.HEAPU32[base];
|
|
3506
3489
|
const buffer = C.HEAP32[base + 1];
|
|
@@ -3508,7 +3491,7 @@ function unmarshalArray(stride, readItem, useTsFree, alwaysFree) {
|
|
|
3508
3491
|
for (let i2 = 0, address = buffer; i2 < count; i2++, address += stride) {
|
|
3509
3492
|
result[i2] = readItem(address);
|
|
3510
3493
|
}
|
|
3511
|
-
if (
|
|
3494
|
+
if (buffer) {
|
|
3512
3495
|
if (useTsFree) C._ts_free_wasm(buffer);
|
|
3513
3496
|
else C._free(buffer);
|
|
3514
3497
|
}
|
|
@@ -3794,6 +3777,8 @@ var Parser = class {
|
|
|
3794
3777
|
// Internal handle for Wasm
|
|
3795
3778
|
/** @internal */
|
|
3796
3779
|
logCallback = null;
|
|
3780
|
+
/** @internal */
|
|
3781
|
+
loggerEnabled = false;
|
|
3797
3782
|
/** The parser's current language. */
|
|
3798
3783
|
language = null;
|
|
3799
3784
|
/** The number of parse operations executed by the most recent {@link Parser#parse} call. */
|
|
@@ -3828,6 +3813,7 @@ var Parser = class {
|
|
|
3828
3813
|
const base = TRANSFER_BUFFER >>> 2;
|
|
3829
3814
|
this[0] = C.HEAP32[base];
|
|
3830
3815
|
this[1] = C.HEAP32[base + 1];
|
|
3816
|
+
this.loggerEnabled = false;
|
|
3831
3817
|
}
|
|
3832
3818
|
/** Delete the parser, freeing its resources. */
|
|
3833
3819
|
delete() {
|
|
@@ -3881,38 +3867,75 @@ var Parser = class {
|
|
|
3881
3867
|
parse(callback, oldTree, options) {
|
|
3882
3868
|
const maxMemoryBytes = validateMemoryLimit(options?.maxMemoryBytes);
|
|
3883
3869
|
const maxOperations = validateOperationLimit(options?.maxOperations);
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
C.currentProgressCallback = options?.progressCallback ?? null;
|
|
3887
|
-
if (this.logCallback) {
|
|
3888
|
-
C.currentLogCallback = this.logCallback;
|
|
3889
|
-
C._ts_parser_enable_logger_wasm(this[0], 1);
|
|
3890
|
-
} else {
|
|
3891
|
-
C.currentLogCallback = null;
|
|
3892
|
-
C._ts_parser_enable_logger_wasm(this[0], 0);
|
|
3870
|
+
if (typeof callback !== "string" && typeof callback !== "function") {
|
|
3871
|
+
throw new Error("Argument must be a string or a function");
|
|
3893
3872
|
}
|
|
3873
|
+
const progressCallback = options?.progressCallback ?? null;
|
|
3874
|
+
C.currentParseCallback = callback;
|
|
3875
|
+
C.currentProgressCallback = progressCallback;
|
|
3876
|
+
this.syncLogger();
|
|
3894
3877
|
this.lastParseOperations = 0;
|
|
3895
|
-
const request = {
|
|
3896
|
-
parserAddress: this[0],
|
|
3897
|
-
callbackBuffer: this[1],
|
|
3898
|
-
sourceText,
|
|
3899
|
-
oldTreeAddress: oldTree ? oldTree[0] : 0,
|
|
3900
|
-
ranges: options?.includedRanges,
|
|
3901
|
-
maxOperations,
|
|
3902
|
-
hasProgressCallback: options?.progressCallback ? 1 : 0,
|
|
3903
|
-
onOperations: /* @__PURE__ */ __name((operations) => {
|
|
3904
|
-
this.lastParseOperations = operations;
|
|
3905
|
-
}, "onOperations")
|
|
3906
|
-
};
|
|
3907
3878
|
try {
|
|
3908
|
-
const treeAddress =
|
|
3879
|
+
const treeAddress = this.runParse(oldTree, options, maxMemoryBytes, maxOperations);
|
|
3909
3880
|
if (!treeAddress) return null;
|
|
3910
3881
|
if (!this.language) throw new Error("Parser must have a language to parse");
|
|
3911
|
-
return new Tree2(INTERNAL, treeAddress, this.language,
|
|
3882
|
+
return new Tree2(INTERNAL, treeAddress, this.language, callback);
|
|
3912
3883
|
} finally {
|
|
3913
3884
|
clearCallbacks();
|
|
3914
3885
|
}
|
|
3915
3886
|
}
|
|
3887
|
+
/** @internal */
|
|
3888
|
+
syncLogger() {
|
|
3889
|
+
if (this.logCallback) {
|
|
3890
|
+
C.currentLogCallback = this.logCallback;
|
|
3891
|
+
if (!this.loggerEnabled) {
|
|
3892
|
+
C._ts_parser_enable_logger_wasm(this[0], 1);
|
|
3893
|
+
this.loggerEnabled = true;
|
|
3894
|
+
}
|
|
3895
|
+
} else {
|
|
3896
|
+
C.currentLogCallback = null;
|
|
3897
|
+
if (this.loggerEnabled) {
|
|
3898
|
+
C._ts_parser_enable_logger_wasm(this[0], 0);
|
|
3899
|
+
this.loggerEnabled = false;
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
/** @internal */
|
|
3904
|
+
runParse(oldTree, options, maxMemoryBytes, maxOperations) {
|
|
3905
|
+
if (maxMemoryBytes !== void 0 && !C.treeSitterSetMemoryLimit(maxMemoryBytes)) {
|
|
3906
|
+
return 0;
|
|
3907
|
+
}
|
|
3908
|
+
try {
|
|
3909
|
+
const [rangeAddress, rangeCount] = prepareRanges(options?.includedRanges);
|
|
3910
|
+
if (rangeCount && !rangeAddress) return 0;
|
|
3911
|
+
marshalParseInputs(maxOperations, rangeAddress, rangeCount, options?.progressCallback ? 1 : 0);
|
|
3912
|
+
try {
|
|
3913
|
+
return maxMemoryBytes === void 0 ? this.executeOrdinaryParse(oldTree ? oldTree[0] : 0) : this.executeLimitedParse();
|
|
3914
|
+
} finally {
|
|
3915
|
+
this.lastParseOperations = unmarshalOperationCount();
|
|
3916
|
+
}
|
|
3917
|
+
} finally {
|
|
3918
|
+
if (maxMemoryBytes !== void 0) C.treeSitterSetMemoryLimit(0);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
/** @internal */
|
|
3922
|
+
executeOrdinaryParse(oldTreeAddress) {
|
|
3923
|
+
try {
|
|
3924
|
+
return C._ts_parser_parse_wasm(this[0], this[1], oldTreeAddress);
|
|
3925
|
+
} catch (error) {
|
|
3926
|
+
C._ts_parser_last_parse_operations_wasm(this[0]);
|
|
3927
|
+
throw error;
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
/** @internal */
|
|
3931
|
+
executeLimitedParse() {
|
|
3932
|
+
try {
|
|
3933
|
+
return C._ts_parser_parse_limited_wasm(this[0], this[1]);
|
|
3934
|
+
} catch (error) {
|
|
3935
|
+
C._ts_parser_abort_limited_wasm();
|
|
3936
|
+
throw error;
|
|
3937
|
+
}
|
|
3938
|
+
}
|
|
3916
3939
|
/**
|
|
3917
3940
|
* Instruct the parser to start the next parse from the beginning.
|
|
3918
3941
|
*
|
|
@@ -3960,102 +3983,31 @@ function validateOperationLimit(maxOperations) {
|
|
|
3960
3983
|
return maxOperations;
|
|
3961
3984
|
}
|
|
3962
3985
|
__name(validateOperationLimit, "validateOperationLimit");
|
|
3963
|
-
function resolveInput(callback) {
|
|
3964
|
-
if (typeof callback === "string") {
|
|
3965
|
-
return { sourceText: callback, textCallback: /* @__PURE__ */ __name((index) => callback.slice(index), "textCallback") };
|
|
3966
|
-
}
|
|
3967
|
-
if (typeof callback === "function") {
|
|
3968
|
-
return { sourceText: void 0, textCallback: callback };
|
|
3969
|
-
}
|
|
3970
|
-
throw new Error("Argument must be a string or a function");
|
|
3971
|
-
}
|
|
3972
|
-
__name(resolveInput, "resolveInput");
|
|
3973
|
-
function parseOrdinaryWasm(request) {
|
|
3974
|
-
return withPreparedParse(request, (inputBuffer) => {
|
|
3975
|
-
try {
|
|
3976
|
-
return C._ts_parser_parse_wasm(request.parserAddress, inputBuffer, request.oldTreeAddress);
|
|
3977
|
-
} catch (error) {
|
|
3978
|
-
C._ts_parser_last_parse_operations_wasm(request.parserAddress);
|
|
3979
|
-
throw error;
|
|
3980
|
-
}
|
|
3981
|
-
});
|
|
3982
|
-
}
|
|
3983
|
-
__name(parseOrdinaryWasm, "parseOrdinaryWasm");
|
|
3984
|
-
function parseLimitedWasm(request, maxMemoryBytes) {
|
|
3985
|
-
if (!C.treeSitterSetMemoryLimit(maxMemoryBytes)) return 0;
|
|
3986
|
-
try {
|
|
3987
|
-
return withPreparedParse(request, (inputBuffer) => {
|
|
3988
|
-
try {
|
|
3989
|
-
return C._ts_parser_parse_limited_wasm(request.parserAddress, inputBuffer);
|
|
3990
|
-
} catch (error) {
|
|
3991
|
-
C._ts_parser_abort_limited_wasm();
|
|
3992
|
-
throw error;
|
|
3993
|
-
}
|
|
3994
|
-
});
|
|
3995
|
-
} finally {
|
|
3996
|
-
C.treeSitterSetMemoryLimit(0);
|
|
3997
|
-
}
|
|
3998
|
-
}
|
|
3999
|
-
__name(parseLimitedWasm, "parseLimitedWasm");
|
|
4000
|
-
function withPreparedParse(request, execute) {
|
|
4001
|
-
let sourceAddress = 0;
|
|
4002
|
-
let rangeAddress = 0;
|
|
4003
|
-
let executed = false;
|
|
4004
|
-
try {
|
|
4005
|
-
const [allocatedSource, byteLength, ok] = prepareSourceBuffer(request.sourceText);
|
|
4006
|
-
sourceAddress = allocatedSource;
|
|
4007
|
-
if (!ok) return 0;
|
|
4008
|
-
const [allocatedRanges, rangeCount] = prepareRanges(request.ranges);
|
|
4009
|
-
rangeAddress = allocatedRanges;
|
|
4010
|
-
if (rangeCount && !allocatedRanges) return 0;
|
|
4011
|
-
const isStringInput = request.sourceText !== void 0;
|
|
4012
|
-
marshalParseInputs(request.maxOperations, byteLength, allocatedRanges, rangeCount, isStringInput, request.hasProgressCallback);
|
|
4013
|
-
executed = true;
|
|
4014
|
-
return execute(isStringInput ? allocatedSource : request.callbackBuffer);
|
|
4015
|
-
} finally {
|
|
4016
|
-
if (executed) request.onOperations(unmarshalOperationCount());
|
|
4017
|
-
if (rangeAddress) C._free(rangeAddress);
|
|
4018
|
-
if (sourceAddress) C._free(sourceAddress);
|
|
4019
|
-
}
|
|
4020
|
-
}
|
|
4021
|
-
__name(withPreparedParse, "withPreparedParse");
|
|
4022
|
-
function prepareSourceBuffer(sourceText) {
|
|
4023
|
-
if (sourceText === void 0) return [0, 0, true];
|
|
4024
|
-
const codeUnits = sourceText.length;
|
|
4025
|
-
if (codeUnits === 0) return [0, 0, true];
|
|
4026
|
-
if (codeUnits > 1073741823) return [0, 0, false];
|
|
4027
|
-
const byteLength = codeUnits * 2;
|
|
4028
|
-
const address = C._malloc(byteLength);
|
|
4029
|
-
if (!address) return [0, 0, false];
|
|
4030
|
-
const heapU16 = C.HEAPU16;
|
|
4031
|
-
const base = address >>> 1;
|
|
4032
|
-
for (let i2 = 0; i2 < codeUnits; i2++) {
|
|
4033
|
-
heapU16[base + i2] = sourceText.charCodeAt(i2);
|
|
4034
|
-
}
|
|
4035
|
-
return [address, byteLength, true];
|
|
4036
|
-
}
|
|
4037
|
-
__name(prepareSourceBuffer, "prepareSourceBuffer");
|
|
4038
3986
|
function prepareRanges(ranges) {
|
|
4039
3987
|
if (!ranges?.length) return [0, 0];
|
|
4040
3988
|
const rangeAddress = C._calloc(ranges.length, SIZE_OF_RANGE);
|
|
4041
3989
|
if (!rangeAddress) return [0, ranges.length];
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
3990
|
+
try {
|
|
3991
|
+
let address = rangeAddress;
|
|
3992
|
+
for (const range of ranges) {
|
|
3993
|
+
marshalRange(address, range);
|
|
3994
|
+
address += SIZE_OF_RANGE;
|
|
3995
|
+
}
|
|
3996
|
+
return [rangeAddress, ranges.length];
|
|
3997
|
+
} catch (error) {
|
|
3998
|
+
C._free(rangeAddress);
|
|
3999
|
+
throw error;
|
|
4046
4000
|
}
|
|
4047
|
-
return [rangeAddress, ranges.length];
|
|
4048
4001
|
}
|
|
4049
4002
|
__name(prepareRanges, "prepareRanges");
|
|
4050
|
-
function marshalParseInputs(maxOperations,
|
|
4003
|
+
function marshalParseInputs(maxOperations, rangeAddress, rangeCount, hasProgressCallback) {
|
|
4051
4004
|
const base = TRANSFER_BUFFER >>> 2;
|
|
4052
4005
|
const heapU32 = C.HEAPU32;
|
|
4053
4006
|
heapU32[base] = maxOperations === void 0 ? 0 : maxOperations >>> 0;
|
|
4054
4007
|
heapU32[base + 1] = maxOperations === void 0 ? 0 : Math.floor(maxOperations / TWO_POW_32) >>> 0;
|
|
4055
|
-
heapU32[base + 2] =
|
|
4056
|
-
heapU32[base + 3] =
|
|
4057
|
-
heapU32[base + 4] =
|
|
4058
|
-
heapU32[base + 5] = (isStringInput ? 1 : 0) | (hasProgressCallback ? 2 : 0);
|
|
4008
|
+
heapU32[base + 2] = rangeAddress;
|
|
4009
|
+
heapU32[base + 3] = rangeCount;
|
|
4010
|
+
heapU32[base + 4] = hasProgressCallback;
|
|
4059
4011
|
}
|
|
4060
4012
|
__name(marshalParseInputs, "marshalParseInputs");
|
|
4061
4013
|
function unmarshalOperationCount() {
|