@willbooster/web-tree-sitter 19.1.0 → 20.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
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);
@@ -771,7 +771,7 @@ var require_web_tree_sitter = __commonJS({
771
771
  newDSO("__main__", 0, wasmImports);
772
772
  }
773
773
  };
774
- var ___heap_base = 82464;
774
+ var ___heap_base = 81952;
775
775
  var alignMemory = /* @__PURE__ */ __name((size, alignment) => {
776
776
  assert(alignment, "alignment argument is required");
777
777
  return Math.ceil(size / alignment) * alignment;
@@ -866,7 +866,7 @@ var require_web_tree_sitter = __commonJS({
866
866
  }, "convertJsFunctionToWasm");
867
867
  var wasmTableMirror = [];
868
868
  var wasmTable = new WebAssembly.Table({
869
- "initial": 59,
869
+ "initial": 58,
870
870
  "element": "anyfunc"
871
871
  });
872
872
  var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
@@ -1402,18 +1402,16 @@ var require_web_tree_sitter = __commonJS({
1402
1402
  "value": "i32",
1403
1403
  "mutable": false
1404
1404
  }, 1024);
1405
- var ___stack_high = 82464;
1406
- var ___stack_low = 16928;
1405
+ var ___stack_high = 81952;
1406
+ var ___stack_low = 16416;
1407
1407
  var ___stack_pointer = new WebAssembly.Global({
1408
1408
  "value": "i32",
1409
1409
  "mutable": true
1410
- }, 82464);
1410
+ }, 81952);
1411
1411
  var ___table_base = new WebAssembly.Global({
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 INPUT_BUFFER_SIZE = 10 * 1024;
1521
- const string = Module.currentParseCallback(index, {
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
- if (typeof string === "string") {
1526
- HEAP32[SAFE_HEAP_INDEX(HEAP32, lengthAddress >> 2, "storing")] = string.length;
1527
- stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
1528
- } else {
1529
- HEAP32[SAFE_HEAP_INDEX(HEAP32, lengthAddress >> 2, "storing")] = 0;
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");
@@ -1752,9 +1743,7 @@ var require_web_tree_sitter = __commonJS({
1752
1743
  var _ts_language_subtypes_wasm = Module["_ts_language_subtypes_wasm"] = makeInvalidEarlyAccess("_ts_language_subtypes_wasm");
1753
1744
  var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_root_node_wasm");
1754
1745
  var _ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = makeInvalidEarlyAccess("_ts_tree_root_node_with_offset_wasm");
1755
- var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = makeInvalidEarlyAccess("_ts_tree_edit_wasm");
1756
1746
  var _ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = makeInvalidEarlyAccess("_ts_tree_included_ranges_wasm");
1757
- var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = makeInvalidEarlyAccess("_ts_tree_get_changed_ranges_wasm");
1758
1747
  var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_new_wasm");
1759
1748
  var _ts_tree_cursor_copy_wasm = Module["_ts_tree_cursor_copy_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_copy_wasm");
1760
1749
  var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_delete_wasm");
@@ -1772,10 +1761,6 @@ var require_web_tree_sitter = __commonJS({
1772
1761
  var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_id_wasm");
1773
1762
  var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_position_wasm");
1774
1763
  var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_end_position_wasm");
1775
- var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_start_index_wasm");
1776
- 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
1764
  var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = makeInvalidEarlyAccess("_ts_tree_cursor_current_node_wasm");
1780
1765
  var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = makeInvalidEarlyAccess("_ts_node_symbol_wasm");
1781
1766
  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,25 +1785,22 @@ var require_web_tree_sitter = __commonJS({
1800
1785
  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
1786
  var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = makeInvalidEarlyAccess("_ts_node_descendant_for_position_wasm");
1802
1787
  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
1788
  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
1789
  var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = makeInvalidEarlyAccess("_ts_node_end_index_wasm");
1807
1790
  var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = makeInvalidEarlyAccess("_ts_node_to_string_wasm");
1808
1791
  var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = makeInvalidEarlyAccess("_ts_node_children_wasm");
1809
1792
  var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = makeInvalidEarlyAccess("_ts_node_named_children_wasm");
1810
1793
  var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = makeInvalidEarlyAccess("_ts_node_descendants_of_type_wasm");
1811
1794
  var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = makeInvalidEarlyAccess("_ts_node_is_named_wasm");
1812
- var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = makeInvalidEarlyAccess("_ts_node_has_changes_wasm");
1813
1795
  var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = makeInvalidEarlyAccess("_ts_node_has_error_wasm");
1814
1796
  var _ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = makeInvalidEarlyAccess("_ts_node_is_error_wasm");
1815
1797
  var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = makeInvalidEarlyAccess("_ts_node_is_missing_wasm");
1816
1798
  var _ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = makeInvalidEarlyAccess("_ts_node_is_extra_wasm");
1817
1799
  var _ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = makeInvalidEarlyAccess("_ts_node_parse_state_wasm");
1818
1800
  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
1801
  var _memcpy = Module["_memcpy"] = makeInvalidEarlyAccess("_memcpy");
1821
1802
  var _memmove = Module["_memmove"] = makeInvalidEarlyAccess("_memmove");
1803
+ var _memset = Module["_memset"] = makeInvalidEarlyAccess("_memset");
1822
1804
  var _fflush = makeInvalidEarlyAccess("_fflush");
1823
1805
  var _strlen = Module["_strlen"] = makeInvalidEarlyAccess("_strlen");
1824
1806
  var _iswalnum = Module["_iswalnum"] = makeInvalidEarlyAccess("_iswalnum");
@@ -1852,7 +1834,6 @@ var require_web_tree_sitter = __commonJS({
1852
1834
  Module["_calloc"] = _calloc = createExportWrapper("calloc", 2);
1853
1835
  Module["_realloc"] = _realloc = createExportWrapper("realloc", 2);
1854
1836
  Module["_free"] = _free = createExportWrapper("free", 1);
1855
- Module["_ts_range_edit"] = _ts_range_edit = createExportWrapper("ts_range_edit", 2);
1856
1837
  Module["_ts_language_symbol_count"] = _ts_language_symbol_count = createExportWrapper("ts_language_symbol_count", 1);
1857
1838
  Module["_ts_language_state_count"] = _ts_language_state_count = createExportWrapper("ts_language_state_count", 1);
1858
1839
  Module["_ts_language_abi_version"] = _ts_language_abi_version = createExportWrapper("ts_language_abi_version", 1);
@@ -1870,12 +1851,12 @@ var require_web_tree_sitter = __commonJS({
1870
1851
  Module["_ts_lookahead_iterator_reset"] = _ts_lookahead_iterator_reset = createExportWrapper("ts_lookahead_iterator_reset", 3);
1871
1852
  Module["_ts_lookahead_iterator_next"] = _ts_lookahead_iterator_next = createExportWrapper("ts_lookahead_iterator_next", 1);
1872
1853
  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
1854
  Module["_ts_parser_delete"] = _ts_parser_delete = createExportWrapper("ts_parser_delete", 1);
1875
1855
  Module["_ts_parser_set_language"] = _ts_parser_set_language = createExportWrapper("ts_parser_set_language", 2);
1876
1856
  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
1857
  Module["_memcmp"] = _memcmp = createExportWrapper("memcmp", 3);
1858
+ Module["_ts_tree_cursor_current_descendant_index"] = _ts_tree_cursor_current_descendant_index = createExportWrapper("ts_tree_cursor_current_descendant_index", 1);
1859
+ Module["_ts_tree_cursor_current_depth"] = _ts_tree_cursor_current_depth = createExportWrapper("ts_tree_cursor_current_depth", 1);
1879
1860
  Module["_ts_tree_copy"] = _ts_tree_copy = createExportWrapper("ts_tree_copy", 1);
1880
1861
  Module["_ts_tree_delete"] = _ts_tree_delete = createExportWrapper("ts_tree_delete", 1);
1881
1862
  Module["_ts_init"] = _ts_init = createExportWrapper("ts_init", 0);
@@ -1885,7 +1866,7 @@ var require_web_tree_sitter = __commonJS({
1885
1866
  Module["_ts_scanner_realloc_wasm"] = _ts_scanner_realloc_wasm = createExportWrapper("ts_scanner_realloc_wasm", 2);
1886
1867
  Module["_ts_parser_new_wasm"] = _ts_parser_new_wasm = createExportWrapper("ts_parser_new_wasm", 0);
1887
1868
  Module["_ts_parser_enable_logger_wasm"] = _ts_parser_enable_logger_wasm = createExportWrapper("ts_parser_enable_logger_wasm", 2);
1888
- Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm", 3);
1869
+ Module["_ts_parser_parse_wasm"] = _ts_parser_parse_wasm = createExportWrapper("ts_parser_parse_wasm", 2);
1889
1870
  Module["_ts_parser_parse_limited_wasm"] = _ts_parser_parse_limited_wasm = createExportWrapper("ts_parser_parse_limited_wasm", 2);
1890
1871
  Module["_ts_parser_last_parse_operations_wasm"] = _ts_parser_last_parse_operations_wasm = createExportWrapper("ts_parser_last_parse_operations_wasm", 1);
1891
1872
  Module["_ts_parser_abort_limited_wasm"] = _ts_parser_abort_limited_wasm = createExportWrapper("ts_parser_abort_limited_wasm", 0);
@@ -1897,9 +1878,7 @@ var require_web_tree_sitter = __commonJS({
1897
1878
  Module["_ts_language_subtypes_wasm"] = _ts_language_subtypes_wasm = createExportWrapper("ts_language_subtypes_wasm", 2);
1898
1879
  Module["_ts_tree_root_node_wasm"] = _ts_tree_root_node_wasm = createExportWrapper("ts_tree_root_node_wasm", 1);
1899
1880
  Module["_ts_tree_root_node_with_offset_wasm"] = _ts_tree_root_node_with_offset_wasm = createExportWrapper("ts_tree_root_node_with_offset_wasm", 1);
1900
- Module["_ts_tree_edit_wasm"] = _ts_tree_edit_wasm = createExportWrapper("ts_tree_edit_wasm", 1);
1901
1881
  Module["_ts_tree_included_ranges_wasm"] = _ts_tree_included_ranges_wasm = createExportWrapper("ts_tree_included_ranges_wasm", 1);
1902
- Module["_ts_tree_get_changed_ranges_wasm"] = _ts_tree_get_changed_ranges_wasm = createExportWrapper("ts_tree_get_changed_ranges_wasm", 2);
1903
1882
  Module["_ts_tree_cursor_new_wasm"] = _ts_tree_cursor_new_wasm = createExportWrapper("ts_tree_cursor_new_wasm", 1);
1904
1883
  Module["_ts_tree_cursor_copy_wasm"] = _ts_tree_cursor_copy_wasm = createExportWrapper("ts_tree_cursor_copy_wasm", 1);
1905
1884
  Module["_ts_tree_cursor_delete_wasm"] = _ts_tree_cursor_delete_wasm = createExportWrapper("ts_tree_cursor_delete_wasm", 1);
@@ -1908,7 +1887,7 @@ var require_web_tree_sitter = __commonJS({
1908
1887
  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
1888
  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
1889
  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", 1);
1890
+ 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
1891
  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
1892
  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
1893
  Module["_ts_tree_cursor_goto_descendant_wasm"] = _ts_tree_cursor_goto_descendant_wasm = createExportWrapper("ts_tree_cursor_goto_descendant_wasm", 2);
@@ -1917,10 +1896,6 @@ var require_web_tree_sitter = __commonJS({
1917
1896
  Module["_ts_tree_cursor_current_node_id_wasm"] = _ts_tree_cursor_current_node_id_wasm = createExportWrapper("ts_tree_cursor_current_node_id_wasm", 1);
1918
1897
  Module["_ts_tree_cursor_start_position_wasm"] = _ts_tree_cursor_start_position_wasm = createExportWrapper("ts_tree_cursor_start_position_wasm", 1);
1919
1898
  Module["_ts_tree_cursor_end_position_wasm"] = _ts_tree_cursor_end_position_wasm = createExportWrapper("ts_tree_cursor_end_position_wasm", 1);
1920
- Module["_ts_tree_cursor_start_index_wasm"] = _ts_tree_cursor_start_index_wasm = createExportWrapper("ts_tree_cursor_start_index_wasm", 1);
1921
- 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
1899
  Module["_ts_tree_cursor_current_node_wasm"] = _ts_tree_cursor_current_node_wasm = createExportWrapper("ts_tree_cursor_current_node_wasm", 1);
1925
1900
  Module["_ts_node_symbol_wasm"] = _ts_node_symbol_wasm = createExportWrapper("ts_node_symbol_wasm", 1);
1926
1901
  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,25 +1920,22 @@ var require_web_tree_sitter = __commonJS({
1945
1920
  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
1921
  Module["_ts_node_descendant_for_position_wasm"] = _ts_node_descendant_for_position_wasm = createExportWrapper("ts_node_descendant_for_position_wasm", 1);
1947
1922
  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
1923
  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
1924
  Module["_ts_node_end_index_wasm"] = _ts_node_end_index_wasm = createExportWrapper("ts_node_end_index_wasm", 1);
1952
1925
  Module["_ts_node_to_string_wasm"] = _ts_node_to_string_wasm = createExportWrapper("ts_node_to_string_wasm", 1);
1953
1926
  Module["_ts_node_children_wasm"] = _ts_node_children_wasm = createExportWrapper("ts_node_children_wasm", 1);
1954
1927
  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", 7);
1928
+ Module["_ts_node_descendants_of_type_wasm"] = _ts_node_descendants_of_type_wasm = createExportWrapper("ts_node_descendants_of_type_wasm", 3);
1956
1929
  Module["_ts_node_is_named_wasm"] = _ts_node_is_named_wasm = createExportWrapper("ts_node_is_named_wasm", 1);
1957
- Module["_ts_node_has_changes_wasm"] = _ts_node_has_changes_wasm = createExportWrapper("ts_node_has_changes_wasm", 1);
1958
1930
  Module["_ts_node_has_error_wasm"] = _ts_node_has_error_wasm = createExportWrapper("ts_node_has_error_wasm", 1);
1959
1931
  Module["_ts_node_is_error_wasm"] = _ts_node_is_error_wasm = createExportWrapper("ts_node_is_error_wasm", 1);
1960
1932
  Module["_ts_node_is_missing_wasm"] = _ts_node_is_missing_wasm = createExportWrapper("ts_node_is_missing_wasm", 1);
1961
1933
  Module["_ts_node_is_extra_wasm"] = _ts_node_is_extra_wasm = createExportWrapper("ts_node_is_extra_wasm", 1);
1962
1934
  Module["_ts_node_parse_state_wasm"] = _ts_node_parse_state_wasm = createExportWrapper("ts_node_parse_state_wasm", 1);
1963
1935
  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
1936
  Module["_memcpy"] = _memcpy = createExportWrapper("memcpy", 3);
1966
1937
  Module["_memmove"] = _memmove = createExportWrapper("memmove", 3);
1938
+ Module["_memset"] = _memset = createExportWrapper("memset", 3);
1967
1939
  _fflush = createExportWrapper("fflush", 1);
1968
1940
  Module["_strlen"] = _strlen = createExportWrapper("strlen", 1);
1969
1941
  Module["_iswalnum"] = _iswalnum = createExportWrapper("iswalnum", 1);
@@ -2010,8 +1982,6 @@ var require_web_tree_sitter = __commonJS({
2010
1982
  /** @export */
2011
1983
  __table_base: ___table_base,
2012
1984
  /** @export */
2013
- _abort_js: __abort_js,
2014
- /** @export */
2015
1985
  _emscripten_throw_longjmp: __emscripten_throw_longjmp,
2016
1986
  /** @export */
2017
1987
  alignfault,
@@ -2024,18 +1994,16 @@ var require_web_tree_sitter = __commonJS({
2024
1994
  /** @export */
2025
1995
  fd_write: _fd_write,
2026
1996
  /** @export */
1997
+ invoke_ii,
1998
+ /** @export */
2027
1999
  invoke_iii,
2028
2000
  /** @export */
2029
2001
  invoke_iiii,
2030
2002
  /** @export */
2031
- invoke_iiiii,
2032
- /** @export */
2033
2003
  invoke_ji,
2034
2004
  /** @export */
2035
2005
  invoke_vi,
2036
2006
  /** @export */
2037
- invoke_vii,
2038
- /** @export */
2039
2007
  invoke_vj,
2040
2008
  /** @export */
2041
2009
  memory: wasmMemory,
@@ -2048,28 +2016,28 @@ var require_web_tree_sitter = __commonJS({
2048
2016
  /** @export */
2049
2017
  tree_sitter_progress_callback: _tree_sitter_progress_callback
2050
2018
  };
2051
- function invoke_vii(index, a1, a2) {
2019
+ function invoke_vi(index, a1) {
2052
2020
  var sp = stackSave();
2053
2021
  try {
2054
- getWasmTableEntry(index)(a1, a2);
2022
+ getWasmTableEntry(index)(a1);
2055
2023
  } catch (e) {
2056
2024
  stackRestore(sp);
2057
2025
  if (e !== e + 0) throw e;
2058
2026
  _setThrew(1, 0);
2059
2027
  }
2060
2028
  }
2061
- __name(invoke_vii, "invoke_vii");
2062
- function invoke_iii(index, a1, a2) {
2029
+ __name(invoke_vi, "invoke_vi");
2030
+ function invoke_ii(index, a1) {
2063
2031
  var sp = stackSave();
2064
2032
  try {
2065
- return getWasmTableEntry(index)(a1, a2);
2033
+ return getWasmTableEntry(index)(a1);
2066
2034
  } catch (e) {
2067
2035
  stackRestore(sp);
2068
2036
  if (e !== e + 0) throw e;
2069
2037
  _setThrew(1, 0);
2070
2038
  }
2071
2039
  }
2072
- __name(invoke_iii, "invoke_iii");
2040
+ __name(invoke_ii, "invoke_ii");
2073
2041
  function invoke_vj(index, a1) {
2074
2042
  var sp = stackSave();
2075
2043
  try {
@@ -2093,17 +2061,6 @@ var require_web_tree_sitter = __commonJS({
2093
2061
  }
2094
2062
  }
2095
2063
  __name(invoke_ji, "invoke_ji");
2096
- function invoke_iiiii(index, a1, a2, a3, a4) {
2097
- var sp = stackSave();
2098
- try {
2099
- return getWasmTableEntry(index)(a1, a2, a3, a4);
2100
- } catch (e) {
2101
- stackRestore(sp);
2102
- if (e !== e + 0) throw e;
2103
- _setThrew(1, 0);
2104
- }
2105
- }
2106
- __name(invoke_iiiii, "invoke_iiiii");
2107
2064
  function invoke_iiii(index, a1, a2, a3) {
2108
2065
  var sp = stackSave();
2109
2066
  try {
@@ -2115,17 +2072,17 @@ var require_web_tree_sitter = __commonJS({
2115
2072
  }
2116
2073
  }
2117
2074
  __name(invoke_iiii, "invoke_iiii");
2118
- function invoke_vi(index, a1) {
2075
+ function invoke_iii(index, a1, a2) {
2119
2076
  var sp = stackSave();
2120
2077
  try {
2121
- getWasmTableEntry(index)(a1);
2078
+ return getWasmTableEntry(index)(a1, a2);
2122
2079
  } catch (e) {
2123
2080
  stackRestore(sp);
2124
2081
  if (e !== e + 0) throw e;
2125
2082
  _setThrew(1, 0);
2126
2083
  }
2127
2084
  }
2128
- __name(invoke_vi, "invoke_vi");
2085
+ __name(invoke_iii, "invoke_iii");
2129
2086
  var calledRun;
2130
2087
  function callMain(args2 = []) {
2131
2088
  assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
@@ -2155,7 +2112,7 @@ var require_web_tree_sitter = __commonJS({
2155
2112
  }
2156
2113
  __name(callMain, "callMain");
2157
2114
  function stackCheckInit() {
2158
- _emscripten_stack_set_limits(82464, 16928);
2115
+ _emscripten_stack_set_limits(81952, 16416);
2159
2116
  writeStackCookie();
2160
2117
  }
2161
2118
  __name(stackCheckInit, "stackCheckInit");
@@ -2251,7 +2208,6 @@ var require_web_tree_sitter = __commonJS({
2251
2208
  // src/index.ts
2252
2209
  var index_exports = {};
2253
2210
  __export(index_exports, {
2254
- Edit: () => Edit,
2255
2211
  LANGUAGE_VERSION: () => LANGUAGE_VERSION,
2256
2212
  Language: () => Language,
2257
2213
  LookaheadIterator: () => LookaheadIterator,
@@ -2263,108 +2219,6 @@ __export(index_exports, {
2263
2219
  });
2264
2220
  module.exports = __toCommonJS(index_exports);
2265
2221
 
2266
- // src/edit.ts
2267
- var Edit = class {
2268
- static {
2269
- __name(this, "Edit");
2270
- }
2271
- /** The start position of the change. */
2272
- startPosition;
2273
- /** The end position of the change before the edit. */
2274
- oldEndPosition;
2275
- /** The end position of the change after the edit. */
2276
- newEndPosition;
2277
- /** The start index of the change. */
2278
- startIndex;
2279
- /** The end index of the change before the edit. */
2280
- oldEndIndex;
2281
- /** The end index of the change after the edit. */
2282
- newEndIndex;
2283
- constructor({
2284
- startIndex,
2285
- oldEndIndex,
2286
- newEndIndex,
2287
- startPosition,
2288
- oldEndPosition,
2289
- newEndPosition
2290
- }) {
2291
- this.startIndex = startIndex >>> 0;
2292
- this.oldEndIndex = oldEndIndex >>> 0;
2293
- this.newEndIndex = newEndIndex >>> 0;
2294
- this.startPosition = startPosition;
2295
- this.oldEndPosition = oldEndPosition;
2296
- this.newEndPosition = newEndPosition;
2297
- }
2298
- /**
2299
- * Edit a point and index to keep it in-sync with source code that has been edited.
2300
- *
2301
- * This function updates a single point's byte offset and row/column position
2302
- * based on an edit operation. This is useful for editing points without
2303
- * requiring a tree or node instance.
2304
- */
2305
- editPoint(point, index) {
2306
- let newIndex = index;
2307
- const newPoint = { ...point };
2308
- if (index >= this.oldEndIndex) {
2309
- newIndex = this.newEndIndex + (index - this.oldEndIndex);
2310
- const originalRow = point.row;
2311
- newPoint.row = this.newEndPosition.row + (point.row - this.oldEndPosition.row);
2312
- newPoint.column = originalRow === this.oldEndPosition.row ? this.newEndPosition.column + (point.column - this.oldEndPosition.column) : point.column;
2313
- } else if (index > this.startIndex) {
2314
- newIndex = this.newEndIndex;
2315
- newPoint.row = this.newEndPosition.row;
2316
- newPoint.column = this.newEndPosition.column;
2317
- }
2318
- return { point: newPoint, index: newIndex };
2319
- }
2320
- /**
2321
- * Edit a range to keep it in-sync with source code that has been edited.
2322
- *
2323
- * This function updates a range's start and end positions based on an edit
2324
- * operation. This is useful for editing ranges without requiring a tree
2325
- * or node instance.
2326
- */
2327
- editRange(range) {
2328
- const newRange = {
2329
- startIndex: range.startIndex,
2330
- startPosition: { ...range.startPosition },
2331
- endIndex: range.endIndex,
2332
- endPosition: { ...range.endPosition }
2333
- };
2334
- if (range.endIndex >= this.oldEndIndex) {
2335
- if (range.endIndex !== Number.MAX_SAFE_INTEGER) {
2336
- newRange.endIndex = this.newEndIndex + (range.endIndex - this.oldEndIndex);
2337
- newRange.endPosition = {
2338
- row: this.newEndPosition.row + (range.endPosition.row - this.oldEndPosition.row),
2339
- column: range.endPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.endPosition.column - this.oldEndPosition.column) : range.endPosition.column
2340
- };
2341
- if (newRange.endIndex < this.newEndIndex) {
2342
- newRange.endIndex = Number.MAX_SAFE_INTEGER;
2343
- newRange.endPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
2344
- }
2345
- }
2346
- } else if (range.endIndex > this.startIndex) {
2347
- newRange.endIndex = this.startIndex;
2348
- newRange.endPosition = { ...this.startPosition };
2349
- }
2350
- if (range.startIndex >= this.oldEndIndex) {
2351
- newRange.startIndex = this.newEndIndex + (range.startIndex - this.oldEndIndex);
2352
- newRange.startPosition = {
2353
- row: this.newEndPosition.row + (range.startPosition.row - this.oldEndPosition.row),
2354
- column: range.startPosition.row === this.oldEndPosition.row ? this.newEndPosition.column + (range.startPosition.column - this.oldEndPosition.column) : range.startPosition.column
2355
- };
2356
- if (newRange.startIndex < this.newEndIndex) {
2357
- newRange.startIndex = Number.MAX_SAFE_INTEGER;
2358
- newRange.startPosition = { row: Number.MAX_SAFE_INTEGER, column: Number.MAX_SAFE_INTEGER };
2359
- }
2360
- } else if (range.startIndex > this.startIndex) {
2361
- newRange.startIndex = this.startIndex;
2362
- newRange.startPosition = { ...this.startPosition };
2363
- }
2364
- return newRange;
2365
- }
2366
- };
2367
-
2368
2222
  // src/constants.ts
2369
2223
  var SIZE_OF_INT = 4;
2370
2224
  var SIZE_OF_NODE = 5 * SIZE_OF_INT;
@@ -2503,8 +2357,6 @@ var TreeCursor = class _TreeCursor {
2503
2357
  /** @internal */
2504
2358
  tree;
2505
2359
  /** @internal */
2506
- editVersion = -1;
2507
- /** @internal */
2508
2360
  _nodeTypeId = 0;
2509
2361
  /** @internal */
2510
2362
  _fieldId = 0;
@@ -2548,21 +2400,21 @@ var TreeCursor = class _TreeCursor {
2548
2400
  }
2549
2401
  /** Get the field name of this tree cursor's current node. */
2550
2402
  get currentFieldName() {
2551
- return this.tree.language.fields[this._fieldId];
2403
+ return this.tree.language.fields[this._fieldId] ?? null;
2552
2404
  }
2553
2405
  /**
2554
2406
  * Get the depth of the cursor's current node relative to the original
2555
2407
  * node that the cursor was constructed with.
2556
2408
  */
2557
2409
  get currentDepth() {
2558
- return C._ts_tree_cursor_current_depth_wasm(this[0]);
2410
+ return C._ts_tree_cursor_current_depth(this[0]) >>> 0;
2559
2411
  }
2560
2412
  /**
2561
2413
  * Get the index of the cursor's current node out of all of the
2562
2414
  * descendants of the original node that the cursor was constructed with.
2563
2415
  */
2564
2416
  get currentDescendantIndex() {
2565
- return C._ts_tree_cursor_current_descendant_index_wasm(this[0]);
2417
+ return C._ts_tree_cursor_current_descendant_index(this[0]) >>> 0;
2566
2418
  }
2567
2419
  /** Get the type of the cursor's current node. */
2568
2420
  get nodeType() {
@@ -2600,8 +2452,8 @@ var TreeCursor = class _TreeCursor {
2600
2452
  }
2601
2453
  /** Get the string content of the cursor's current node. */
2602
2454
  get nodeText() {
2603
- this.syncIndices();
2604
- return getText(this.tree, this._startIndex, this._endIndex, () => this.startPosition);
2455
+ const { textSource } = this.tree;
2456
+ return typeof textSource === "string" ? textSource.slice(this._startIndex, this._endIndex) : getCallbackText(textSource, this._startIndex, this._endIndex, this.startPosition);
2605
2457
  }
2606
2458
  /** Get the start position of the cursor's current node. */
2607
2459
  get startPosition() {
@@ -2615,12 +2467,10 @@ var TreeCursor = class _TreeCursor {
2615
2467
  }
2616
2468
  /** Get the start index of the cursor's current node. */
2617
2469
  get startIndex() {
2618
- this.syncIndices();
2619
2470
  return this._startIndex;
2620
2471
  }
2621
2472
  /** Get the end index of the cursor's current node. */
2622
2473
  get endIndex() {
2623
- this.syncIndices();
2624
2474
  return this._endIndex;
2625
2475
  }
2626
2476
  /**
@@ -2725,8 +2575,13 @@ var TreeCursor = class _TreeCursor {
2725
2575
  * `false` if no such child was found.
2726
2576
  */
2727
2577
  gotoFirstChildForPosition(goalPosition) {
2728
- marshalPoint(TRANSFER_BUFFER, goalPosition);
2729
- if (!C._ts_tree_cursor_goto_first_child_for_position_wasm(this[0])) return false;
2578
+ if (!C._ts_tree_cursor_goto_first_child_for_position_wasm(
2579
+ this[0],
2580
+ goalPosition.row,
2581
+ goalPosition.column
2582
+ )) {
2583
+ return false;
2584
+ }
2730
2585
  this.readNodeCache();
2731
2586
  return true;
2732
2587
  }
@@ -2747,7 +2602,7 @@ var TreeCursor = class _TreeCursor {
2747
2602
  * information and allows reusing already created cursors.
2748
2603
  */
2749
2604
  resetTo(cursor) {
2750
- if (cursor === this) return;
2605
+ if (this[0] === cursor[0]) return;
2751
2606
  this.tree = cursor.tree;
2752
2607
  C._ts_tree_cursor_reset_to_wasm(this[0], cursor[0]);
2753
2608
  this.readNodeCache();
@@ -2761,30 +2616,17 @@ var TreeCursor = class _TreeCursor {
2761
2616
  this._startIndex = heap[base + 2];
2762
2617
  this._endIndex = heap[base + 3];
2763
2618
  this._flags = heap[base + 4];
2764
- this.editVersion = this.tree.editVersion;
2765
- }
2766
- /** @internal */
2767
- syncIndices() {
2768
- if (this.editVersion !== this.tree.editVersion) {
2769
- this._startIndex = C._ts_tree_cursor_start_index_wasm(this[0]) >>> 0;
2770
- this._endIndex = C._ts_tree_cursor_end_index_wasm(this[0]) >>> 0;
2771
- this.editVersion = this.tree.editVersion;
2772
- }
2773
2619
  }
2774
2620
  };
2775
2621
 
2776
2622
  // src/tree.ts
2777
- function getText(tree, startIndex, endIndex, getStartPosition) {
2778
- if (tree.sourceText !== void 0) {
2779
- return tree.sourceText.slice(startIndex, endIndex);
2780
- }
2781
- const startPosition = getStartPosition();
2623
+ function getCallbackText(textSource, startIndex, endIndex, startPosition) {
2782
2624
  const length = endIndex - startIndex;
2783
- let result = tree.textCallback(startIndex, startPosition);
2625
+ let result = textSource(startIndex, startPosition);
2784
2626
  if (result) {
2785
2627
  startIndex += result.length;
2786
2628
  while (startIndex < endIndex) {
2787
- const string = tree.textCallback(startIndex, startPosition);
2629
+ const string = textSource(startIndex, startPosition);
2788
2630
  if (string && string.length > 0) {
2789
2631
  startIndex += string.length;
2790
2632
  result += string;
@@ -2798,7 +2640,7 @@ function getText(tree, startIndex, endIndex, getStartPosition) {
2798
2640
  }
2799
2641
  return result ?? "";
2800
2642
  }
2801
- __name(getText, "getText");
2643
+ __name(getCallbackText, "getCallbackText");
2802
2644
  var finalizer3 = newFinalizer((address) => {
2803
2645
  C._ts_tree_delete(address);
2804
2646
  });
@@ -2810,26 +2652,21 @@ var Tree2 = class _Tree {
2810
2652
  [0] = 0;
2811
2653
  // Internal handle for Wasm
2812
2654
  /** @internal */
2813
- textCallback;
2814
- /** @internal */
2815
- sourceText;
2816
- /** @internal */
2817
- editVersion = 0;
2655
+ textSource;
2818
2656
  /** The language that was used to parse the syntax tree. */
2819
2657
  language;
2820
2658
  /** @internal */
2821
- constructor(internal, address, language, textCallback, sourceText) {
2659
+ constructor(internal, address, language, textSource) {
2822
2660
  assertInternal(internal);
2823
2661
  this[0] = address;
2824
2662
  this.language = language;
2825
- this.textCallback = textCallback;
2826
- this.sourceText = sourceText;
2663
+ this.textSource = textSource;
2827
2664
  finalizer3?.register(this, address, this);
2828
2665
  }
2829
2666
  /** Create a shallow copy of the syntax tree. This is very fast. */
2830
2667
  copy() {
2831
2668
  const address = C._ts_tree_copy(this[0]);
2832
- return new _Tree(INTERNAL, address, this.language, this.textCallback, this.sourceText);
2669
+ return new _Tree(INTERNAL, address, this.language, this.textSource);
2833
2670
  }
2834
2671
  /** Delete the syntax tree, freeing its resources. */
2835
2672
  delete() {
@@ -2853,42 +2690,12 @@ var Tree2 = class _Tree {
2853
2690
  C._ts_tree_root_node_with_offset_wasm(this[0]);
2854
2691
  return unmarshalNode(this);
2855
2692
  }
2856
- /**
2857
- * Edit the syntax tree to keep it in sync with source code that has been
2858
- * edited.
2859
- *
2860
- * You must describe the edit both in terms of byte offsets and in terms of
2861
- * row/column coordinates.
2862
- */
2863
- edit(edit) {
2864
- marshalEdit(edit);
2865
- C._ts_tree_edit_wasm(this[0]);
2866
- this.editVersion++;
2867
- }
2868
2693
  /** Create a new {@link TreeCursor} starting from the root of the tree. */
2869
2694
  walk() {
2870
2695
  C._ts_tree_root_node_wasm(this[0]);
2871
2696
  const address = C._ts_tree_cursor_new_wasm(this[0]);
2872
2697
  return new TreeCursor(INTERNAL, this, address);
2873
2698
  }
2874
- /**
2875
- * Compare this old edited syntax tree to a new syntax tree representing
2876
- * the same document, returning a sequence of ranges whose syntactic
2877
- * structure has changed.
2878
- *
2879
- * For this to work correctly, this syntax tree must have been edited such
2880
- * that its ranges match up to the new tree. Generally, you'll want to
2881
- * call this method right after calling one of the [`Parser::parse`]
2882
- * functions. Call it on the old tree that was passed to parse, and
2883
- * pass the new tree that was returned from `parse`.
2884
- */
2885
- getChangedRanges(other) {
2886
- if (!(other instanceof _Tree)) {
2887
- throw new TypeError("Argument must be a Tree");
2888
- }
2889
- C._ts_tree_get_changed_ranges_wasm(this[0], other[0]);
2890
- return unmarshalRanges();
2891
- }
2892
2699
  /** Get the included ranges that were used to parse the syntax tree. */
2893
2700
  getIncludedRanges() {
2894
2701
  C._ts_tree_included_ranges_wasm(this[0]);
@@ -2927,14 +2734,7 @@ var Node = class {
2927
2734
  /**
2928
2735
  * The numeric id for this node that is unique.
2929
2736
  *
2930
- * Within a given syntax tree, no two nodes have the same id. However:
2931
- *
2932
- * * If a new tree is created based on an older tree, and a node from the old tree is reused in
2933
- * the process, then that node will have the same id in both trees.
2934
- *
2935
- * * A node not marked as having changes does not guarantee it was reused.
2936
- *
2937
- * * If a node is marked as having changed in the old tree, it will not be reused.
2737
+ * Within a given syntax tree, no two nodes have the same id.
2938
2738
  */
2939
2739
  id;
2940
2740
  /** The byte index where this node starts. */
@@ -3007,11 +2807,6 @@ var Node = class {
3007
2807
  marshalNode(this);
3008
2808
  return C._ts_node_is_missing_wasm(this.tree[0]) === 1;
3009
2809
  }
3010
- /** Check if this node has been edited. */
3011
- get hasChanges() {
3012
- marshalNode(this);
3013
- return C._ts_node_has_changes_wasm(this.tree[0]) === 1;
3014
- }
3015
2810
  /**
3016
2811
  * Check if this node represents a syntax error or contains any syntax
3017
2812
  * errors anywhere within it.
@@ -3033,7 +2828,8 @@ var Node = class {
3033
2828
  }
3034
2829
  /** Get the string content of this node. */
3035
2830
  get text() {
3036
- return getText(this.tree, this.startIndex, this.endIndex, () => this.startPosition);
2831
+ const { textSource } = this.tree;
2832
+ return typeof textSource === "string" ? textSource.slice(this.startIndex, this.endIndex) : getCallbackText(textSource, this.startIndex, this.endIndex, this.startPosition);
3037
2833
  }
3038
2834
  /** Get this node's parse state. */
3039
2835
  get parseState() {
@@ -3231,21 +3027,21 @@ var Node = class {
3231
3027
  symbols.push(65535);
3232
3028
  }
3233
3029
  const symbolsAddress = C._malloc(SIZE_OF_INT * symbols.length);
3030
+ const symbolsHeap = C.HEAPU32;
3234
3031
  const symbolsBase = symbolsAddress >>> 2;
3235
3032
  for (let i2 = 0, n = symbols.length; i2 < n; i2++) {
3236
- C.HEAPU32[symbolsBase + i2] = symbols[i2];
3033
+ symbolsHeap[symbolsBase + i2] = symbols[i2];
3237
3034
  }
3238
3035
  marshalNode(this);
3036
+ const pointAddress = TRANSFER_BUFFER + SIZE_OF_NODE;
3037
+ marshalPoint(pointAddress, startPosition);
3038
+ marshalPoint(pointAddress + SIZE_OF_POINT, endPosition);
3239
3039
  C._ts_node_descendants_of_type_wasm(
3240
3040
  this.tree[0],
3241
3041
  symbolsAddress,
3242
- symbols.length,
3243
- startPosition.row,
3244
- startPosition.column,
3245
- endPosition.row,
3246
- endPosition.column
3042
+ symbols.length
3247
3043
  );
3248
- const result = unmarshalNodeArray(this.tree, true, true);
3044
+ const result = unmarshalNodeArray(this.tree, true);
3249
3045
  C._free(symbolsAddress);
3250
3046
  return result;
3251
3047
  }
@@ -3314,8 +3110,9 @@ var Node = class {
3314
3110
  }
3315
3111
  marshalNode(this);
3316
3112
  const base = TRANSFER_BUFFER + SIZE_OF_NODE >>> 2;
3317
- C.HEAP32[base] = start2;
3318
- C.HEAP32[base + 1] = end;
3113
+ const heap = C.HEAP32;
3114
+ heap[base] = start2;
3115
+ heap[base + 1] = end;
3319
3116
  C._ts_node_descendant_for_index_wasm(this.tree[0]);
3320
3117
  return unmarshalNode(this.tree);
3321
3118
  }
@@ -3326,8 +3123,9 @@ var Node = class {
3326
3123
  }
3327
3124
  marshalNode(this);
3328
3125
  const base = TRANSFER_BUFFER + SIZE_OF_NODE >>> 2;
3329
- C.HEAP32[base] = start2;
3330
- C.HEAP32[base + 1] = end;
3126
+ const heap = C.HEAP32;
3127
+ heap[base] = start2;
3128
+ heap[base + 1] = end;
3331
3129
  C._ts_node_named_descendant_for_index_wasm(this.tree[0]);
3332
3130
  return unmarshalNode(this.tree);
3333
3131
  }
@@ -3366,20 +3164,6 @@ var Node = class {
3366
3164
  const address = C._ts_tree_cursor_new_wasm(this.tree[0]);
3367
3165
  return new TreeCursor(INTERNAL, this.tree, address);
3368
3166
  }
3369
- /**
3370
- * Edit this node to keep it in-sync with source code that has been edited.
3371
- *
3372
- * This function is only rarely needed. When you edit a syntax tree with
3373
- * the {@link Tree#edit} method, all of the nodes that you retrieve from
3374
- * the tree afterward will already reflect the edit. You only need to
3375
- * use {@link Node#edit} when you have a specific {@link Node} instance that
3376
- * you want to keep and continue to use after an edit.
3377
- */
3378
- edit(edit) {
3379
- const { point, index } = edit.editPoint(this.startPosition, this.startIndex);
3380
- this.startPosition = point;
3381
- this.startIndex = index;
3382
- }
3383
3167
  /** Get the S-expression representation of this node. */
3384
3168
  toString() {
3385
3169
  marshalNode(this);
@@ -3454,19 +3238,6 @@ function unmarshalRange(address) {
3454
3238
  };
3455
3239
  }
3456
3240
  __name(unmarshalRange, "unmarshalRange");
3457
- function marshalEdit(edit, address = TRANSFER_BUFFER) {
3458
- marshalPoint(address, edit.startPosition);
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;
3464
- const heap = C.HEAP32;
3465
- heap[base] = edit.startIndex;
3466
- heap[base + 1] = edit.oldEndIndex;
3467
- heap[base + 2] = edit.newEndIndex;
3468
- }
3469
- __name(marshalEdit, "marshalEdit");
3470
3241
  function unmarshalLanguageMetadata(address) {
3471
3242
  const base = address >>> 2;
3472
3243
  const heap = C.HEAP32;
@@ -3493,14 +3264,14 @@ function unmarshalSymbols() {
3493
3264
  }
3494
3265
  __name(unmarshalSymbols, "unmarshalSymbols");
3495
3266
  function unmarshalRanges(useTsFree = true) {
3496
- return unmarshalArray(SIZE_OF_RANGE, unmarshalRange, useTsFree, false);
3267
+ return unmarshalArray(SIZE_OF_RANGE, unmarshalRange, useTsFree);
3497
3268
  }
3498
3269
  __name(unmarshalRanges, "unmarshalRanges");
3499
- function unmarshalNodeArray(tree, useTsFree = false, alwaysFree = false) {
3500
- return unmarshalArray(SIZE_OF_NODE, (address) => unmarshalNode(tree, address), useTsFree, alwaysFree);
3270
+ function unmarshalNodeArray(tree, useTsFree = false) {
3271
+ return unmarshalArray(SIZE_OF_NODE, (address) => unmarshalNode(tree, address), useTsFree);
3501
3272
  }
3502
3273
  __name(unmarshalNodeArray, "unmarshalNodeArray");
3503
- function unmarshalArray(stride, readItem, useTsFree, alwaysFree) {
3274
+ function unmarshalArray(stride, readItem, useTsFree) {
3504
3275
  const base = TRANSFER_BUFFER >>> 2;
3505
3276
  const count = C.HEAPU32[base];
3506
3277
  const buffer = C.HEAP32[base + 1];
@@ -3508,7 +3279,7 @@ function unmarshalArray(stride, readItem, useTsFree, alwaysFree) {
3508
3279
  for (let i2 = 0, address = buffer; i2 < count; i2++, address += stride) {
3509
3280
  result[i2] = readItem(address);
3510
3281
  }
3511
- if (count > 0 || alwaysFree) {
3282
+ if (buffer) {
3512
3283
  if (useTsFree) C._ts_free_wasm(buffer);
3513
3284
  else C._free(buffer);
3514
3285
  }
@@ -3794,6 +3565,8 @@ var Parser = class {
3794
3565
  // Internal handle for Wasm
3795
3566
  /** @internal */
3796
3567
  logCallback = null;
3568
+ /** @internal */
3569
+ loggerEnabled = false;
3797
3570
  /** The parser's current language. */
3798
3571
  language = null;
3799
3572
  /** The number of parse operations executed by the most recent {@link Parser#parse} call. */
@@ -3828,6 +3601,7 @@ var Parser = class {
3828
3601
  const base = TRANSFER_BUFFER >>> 2;
3829
3602
  this[0] = C.HEAP32[base];
3830
3603
  this[1] = C.HEAP32[base + 1];
3604
+ this.loggerEnabled = false;
3831
3605
  }
3832
3606
  /** Delete the parser, freeing its resources. */
3833
3607
  delete() {
@@ -3866,10 +3640,6 @@ var Parser = class {
3866
3640
  *
3867
3641
  * @param {string | ParseCallback} callback - The UTF8-encoded text to parse or a callback function.
3868
3642
  *
3869
- * @param {Tree | null} [oldTree] - A previous syntax tree parsed from the same document. If the text of the
3870
- * document has changed since `oldTree` was created, then you must edit `oldTree` to match
3871
- * the new text using {@link Tree#edit}.
3872
- *
3873
3643
  * @param {ParseOptions} [options] - Options for parsing the text.
3874
3644
  * This can be used to set the included ranges, or a progress callback.
3875
3645
  *
@@ -3878,41 +3648,78 @@ var Parser = class {
3878
3648
  * - The progress callback returned true.
3879
3649
  * - The memory limit was reached or the operation limit was exceeded.
3880
3650
  */
3881
- parse(callback, oldTree, options) {
3651
+ parse(callback, options) {
3882
3652
  const maxMemoryBytes = validateMemoryLimit(options?.maxMemoryBytes);
3883
3653
  const maxOperations = validateOperationLimit(options?.maxOperations);
3884
- const { sourceText, textCallback } = resolveInput(callback);
3885
- C.currentParseCallback = sourceText === void 0 ? textCallback : null;
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);
3654
+ if (typeof callback !== "string" && typeof callback !== "function") {
3655
+ throw new Error("Argument must be a string or a function");
3893
3656
  }
3657
+ const progressCallback = options?.progressCallback ?? null;
3658
+ C.currentParseCallback = callback;
3659
+ C.currentProgressCallback = progressCallback;
3660
+ this.syncLogger();
3894
3661
  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
3662
  try {
3908
- const treeAddress = maxMemoryBytes === void 0 ? parseOrdinaryWasm(request) : parseLimitedWasm(request, maxMemoryBytes);
3663
+ const treeAddress = this.runParse(options, maxMemoryBytes, maxOperations);
3909
3664
  if (!treeAddress) return null;
3910
3665
  if (!this.language) throw new Error("Parser must have a language to parse");
3911
- return new Tree2(INTERNAL, treeAddress, this.language, textCallback, sourceText);
3666
+ return new Tree2(INTERNAL, treeAddress, this.language, callback);
3912
3667
  } finally {
3913
3668
  clearCallbacks();
3914
3669
  }
3915
3670
  }
3671
+ /** @internal */
3672
+ syncLogger() {
3673
+ if (this.logCallback) {
3674
+ C.currentLogCallback = this.logCallback;
3675
+ if (!this.loggerEnabled) {
3676
+ C._ts_parser_enable_logger_wasm(this[0], 1);
3677
+ this.loggerEnabled = true;
3678
+ }
3679
+ } else {
3680
+ C.currentLogCallback = null;
3681
+ if (this.loggerEnabled) {
3682
+ C._ts_parser_enable_logger_wasm(this[0], 0);
3683
+ this.loggerEnabled = false;
3684
+ }
3685
+ }
3686
+ }
3687
+ /** @internal */
3688
+ runParse(options, maxMemoryBytes, maxOperations) {
3689
+ if (maxMemoryBytes !== void 0 && !C.treeSitterSetMemoryLimit(maxMemoryBytes)) {
3690
+ return 0;
3691
+ }
3692
+ try {
3693
+ const [rangeAddress, rangeCount] = prepareRanges(options?.includedRanges);
3694
+ if (rangeCount && !rangeAddress) return 0;
3695
+ marshalParseInputs(maxOperations, rangeAddress, rangeCount, options?.progressCallback ? 1 : 0);
3696
+ try {
3697
+ return maxMemoryBytes === void 0 ? this.executeOrdinaryParse() : this.executeLimitedParse();
3698
+ } finally {
3699
+ this.lastParseOperations = unmarshalOperationCount();
3700
+ }
3701
+ } finally {
3702
+ if (maxMemoryBytes !== void 0) C.treeSitterSetMemoryLimit(0);
3703
+ }
3704
+ }
3705
+ /** @internal */
3706
+ executeOrdinaryParse() {
3707
+ try {
3708
+ return C._ts_parser_parse_wasm(this[0], this[1]);
3709
+ } catch (error) {
3710
+ C._ts_parser_last_parse_operations_wasm(this[0]);
3711
+ throw error;
3712
+ }
3713
+ }
3714
+ /** @internal */
3715
+ executeLimitedParse() {
3716
+ try {
3717
+ return C._ts_parser_parse_limited_wasm(this[0], this[1]);
3718
+ } catch (error) {
3719
+ C._ts_parser_abort_limited_wasm();
3720
+ throw error;
3721
+ }
3722
+ }
3916
3723
  /**
3917
3724
  * Instruct the parser to start the next parse from the beginning.
3918
3725
  *
@@ -3960,102 +3767,31 @@ function validateOperationLimit(maxOperations) {
3960
3767
  return maxOperations;
3961
3768
  }
3962
3769
  __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
3770
  function prepareRanges(ranges) {
4039
3771
  if (!ranges?.length) return [0, 0];
4040
3772
  const rangeAddress = C._calloc(ranges.length, SIZE_OF_RANGE);
4041
3773
  if (!rangeAddress) return [0, ranges.length];
4042
- let address = rangeAddress;
4043
- for (const range of ranges) {
4044
- marshalRange(address, range);
4045
- address += SIZE_OF_RANGE;
3774
+ try {
3775
+ let address = rangeAddress;
3776
+ for (const range of ranges) {
3777
+ marshalRange(address, range);
3778
+ address += SIZE_OF_RANGE;
3779
+ }
3780
+ return [rangeAddress, ranges.length];
3781
+ } catch (error) {
3782
+ C._free(rangeAddress);
3783
+ throw error;
4046
3784
  }
4047
- return [rangeAddress, ranges.length];
4048
3785
  }
4049
3786
  __name(prepareRanges, "prepareRanges");
4050
- function marshalParseInputs(maxOperations, byteLength, rangeAddress, rangeCount, isStringInput, hasProgressCallback) {
3787
+ function marshalParseInputs(maxOperations, rangeAddress, rangeCount, hasProgressCallback) {
4051
3788
  const base = TRANSFER_BUFFER >>> 2;
4052
3789
  const heapU32 = C.HEAPU32;
4053
3790
  heapU32[base] = maxOperations === void 0 ? 0 : maxOperations >>> 0;
4054
3791
  heapU32[base + 1] = maxOperations === void 0 ? 0 : Math.floor(maxOperations / TWO_POW_32) >>> 0;
4055
- heapU32[base + 2] = byteLength;
4056
- heapU32[base + 3] = rangeAddress;
4057
- heapU32[base + 4] = rangeCount;
4058
- heapU32[base + 5] = (isStringInput ? 1 : 0) | (hasProgressCallback ? 2 : 0);
3792
+ heapU32[base + 2] = rangeAddress;
3793
+ heapU32[base + 3] = rangeCount;
3794
+ heapU32[base + 4] = hasProgressCallback;
4059
3795
  }
4060
3796
  __name(marshalParseInputs, "marshalParseInputs");
4061
3797
  function unmarshalOperationCount() {
@@ -4072,7 +3808,6 @@ function clearCallbacks() {
4072
3808
  __name(clearCallbacks, "clearCallbacks");
4073
3809
  // Annotate the CommonJS export names for ESM import in node:
4074
3810
  0 && (module.exports = {
4075
- Edit,
4076
3811
  LANGUAGE_VERSION,
4077
3812
  Language,
4078
3813
  LookaheadIterator,