@colbymchenry/codegraph-darwin-x64 0.9.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.
Files changed (569) hide show
  1. package/bin/codegraph +3 -0
  2. package/lib/dist/bin/codegraph.d.ts +21 -0
  3. package/lib/dist/bin/codegraph.d.ts.map +1 -0
  4. package/lib/dist/bin/codegraph.js +1273 -0
  5. package/lib/dist/bin/codegraph.js.map +1 -0
  6. package/lib/dist/bin/node-version-check.d.ts +37 -0
  7. package/lib/dist/bin/node-version-check.d.ts.map +1 -0
  8. package/lib/dist/bin/node-version-check.js +79 -0
  9. package/lib/dist/bin/node-version-check.js.map +1 -0
  10. package/lib/dist/bin/uninstall.d.ts +14 -0
  11. package/lib/dist/bin/uninstall.d.ts.map +1 -0
  12. package/lib/dist/bin/uninstall.js +36 -0
  13. package/lib/dist/bin/uninstall.js.map +1 -0
  14. package/lib/dist/config.d.ts +51 -0
  15. package/lib/dist/config.d.ts.map +1 -0
  16. package/lib/dist/config.js +321 -0
  17. package/lib/dist/config.js.map +1 -0
  18. package/lib/dist/context/formatter.d.ts +30 -0
  19. package/lib/dist/context/formatter.d.ts.map +1 -0
  20. package/lib/dist/context/formatter.js +244 -0
  21. package/lib/dist/context/formatter.js.map +1 -0
  22. package/lib/dist/context/index.d.ts +97 -0
  23. package/lib/dist/context/index.d.ts.map +1 -0
  24. package/lib/dist/context/index.js +1050 -0
  25. package/lib/dist/context/index.js.map +1 -0
  26. package/lib/dist/db/index.d.ts +83 -0
  27. package/lib/dist/db/index.d.ts.map +1 -0
  28. package/lib/dist/db/index.js +219 -0
  29. package/lib/dist/db/index.js.map +1 -0
  30. package/lib/dist/db/migrations.d.ts +44 -0
  31. package/lib/dist/db/migrations.d.ts.map +1 -0
  32. package/lib/dist/db/migrations.js +131 -0
  33. package/lib/dist/db/migrations.js.map +1 -0
  34. package/lib/dist/db/queries.d.ts +253 -0
  35. package/lib/dist/db/queries.d.ts.map +1 -0
  36. package/lib/dist/db/queries.js +1207 -0
  37. package/lib/dist/db/queries.js.map +1 -0
  38. package/lib/dist/db/schema.sql +151 -0
  39. package/lib/dist/db/sqlite-adapter.d.ts +46 -0
  40. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -0
  41. package/lib/dist/db/sqlite-adapter.js +114 -0
  42. package/lib/dist/db/sqlite-adapter.js.map +1 -0
  43. package/lib/dist/directory.d.ts +57 -0
  44. package/lib/dist/directory.d.ts.map +1 -0
  45. package/lib/dist/directory.js +264 -0
  46. package/lib/dist/directory.js.map +1 -0
  47. package/lib/dist/errors.d.ts +136 -0
  48. package/lib/dist/errors.d.ts.map +1 -0
  49. package/lib/dist/errors.js +219 -0
  50. package/lib/dist/errors.js.map +1 -0
  51. package/lib/dist/extraction/dfm-extractor.d.ts +31 -0
  52. package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -0
  53. package/lib/dist/extraction/dfm-extractor.js +151 -0
  54. package/lib/dist/extraction/dfm-extractor.js.map +1 -0
  55. package/lib/dist/extraction/grammars.d.ts +78 -0
  56. package/lib/dist/extraction/grammars.d.ts.map +1 -0
  57. package/lib/dist/extraction/grammars.js +332 -0
  58. package/lib/dist/extraction/grammars.js.map +1 -0
  59. package/lib/dist/extraction/index.d.ts +130 -0
  60. package/lib/dist/extraction/index.d.ts.map +1 -0
  61. package/lib/dist/extraction/index.js +1305 -0
  62. package/lib/dist/extraction/index.js.map +1 -0
  63. package/lib/dist/extraction/languages/c-cpp.d.ts +4 -0
  64. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  65. package/lib/dist/extraction/languages/c-cpp.js +126 -0
  66. package/lib/dist/extraction/languages/c-cpp.js.map +1 -0
  67. package/lib/dist/extraction/languages/csharp.d.ts +3 -0
  68. package/lib/dist/extraction/languages/csharp.d.ts.map +1 -0
  69. package/lib/dist/extraction/languages/csharp.js +72 -0
  70. package/lib/dist/extraction/languages/csharp.js.map +1 -0
  71. package/lib/dist/extraction/languages/dart.d.ts +3 -0
  72. package/lib/dist/extraction/languages/dart.d.ts.map +1 -0
  73. package/lib/dist/extraction/languages/dart.js +192 -0
  74. package/lib/dist/extraction/languages/dart.js.map +1 -0
  75. package/lib/dist/extraction/languages/go.d.ts +3 -0
  76. package/lib/dist/extraction/languages/go.d.ts.map +1 -0
  77. package/lib/dist/extraction/languages/go.js +58 -0
  78. package/lib/dist/extraction/languages/go.js.map +1 -0
  79. package/lib/dist/extraction/languages/index.d.ts +10 -0
  80. package/lib/dist/extraction/languages/index.d.ts.map +1 -0
  81. package/lib/dist/extraction/languages/index.js +49 -0
  82. package/lib/dist/extraction/languages/index.js.map +1 -0
  83. package/lib/dist/extraction/languages/java.d.ts +3 -0
  84. package/lib/dist/extraction/languages/java.d.ts.map +1 -0
  85. package/lib/dist/extraction/languages/java.js +64 -0
  86. package/lib/dist/extraction/languages/java.js.map +1 -0
  87. package/lib/dist/extraction/languages/javascript.d.ts +3 -0
  88. package/lib/dist/extraction/languages/javascript.d.ts.map +1 -0
  89. package/lib/dist/extraction/languages/javascript.js +90 -0
  90. package/lib/dist/extraction/languages/javascript.js.map +1 -0
  91. package/lib/dist/extraction/languages/kotlin.d.ts +3 -0
  92. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -0
  93. package/lib/dist/extraction/languages/kotlin.js +253 -0
  94. package/lib/dist/extraction/languages/kotlin.js.map +1 -0
  95. package/lib/dist/extraction/languages/lua.d.ts +3 -0
  96. package/lib/dist/extraction/languages/lua.d.ts.map +1 -0
  97. package/lib/dist/extraction/languages/lua.js +150 -0
  98. package/lib/dist/extraction/languages/lua.js.map +1 -0
  99. package/lib/dist/extraction/languages/luau.d.ts +3 -0
  100. package/lib/dist/extraction/languages/luau.d.ts.map +1 -0
  101. package/lib/dist/extraction/languages/luau.js +37 -0
  102. package/lib/dist/extraction/languages/luau.js.map +1 -0
  103. package/lib/dist/extraction/languages/pascal.d.ts +3 -0
  104. package/lib/dist/extraction/languages/pascal.d.ts.map +1 -0
  105. package/lib/dist/extraction/languages/pascal.js +66 -0
  106. package/lib/dist/extraction/languages/pascal.js.map +1 -0
  107. package/lib/dist/extraction/languages/php.d.ts +3 -0
  108. package/lib/dist/extraction/languages/php.d.ts.map +1 -0
  109. package/lib/dist/extraction/languages/php.js +107 -0
  110. package/lib/dist/extraction/languages/php.js.map +1 -0
  111. package/lib/dist/extraction/languages/python.d.ts +3 -0
  112. package/lib/dist/extraction/languages/python.d.ts.map +1 -0
  113. package/lib/dist/extraction/languages/python.js +56 -0
  114. package/lib/dist/extraction/languages/python.js.map +1 -0
  115. package/lib/dist/extraction/languages/ruby.d.ts +3 -0
  116. package/lib/dist/extraction/languages/ruby.d.ts.map +1 -0
  117. package/lib/dist/extraction/languages/ruby.js +114 -0
  118. package/lib/dist/extraction/languages/ruby.js.map +1 -0
  119. package/lib/dist/extraction/languages/rust.d.ts +3 -0
  120. package/lib/dist/extraction/languages/rust.d.ts.map +1 -0
  121. package/lib/dist/extraction/languages/rust.js +109 -0
  122. package/lib/dist/extraction/languages/rust.js.map +1 -0
  123. package/lib/dist/extraction/languages/scala.d.ts +3 -0
  124. package/lib/dist/extraction/languages/scala.d.ts.map +1 -0
  125. package/lib/dist/extraction/languages/scala.js +139 -0
  126. package/lib/dist/extraction/languages/scala.js.map +1 -0
  127. package/lib/dist/extraction/languages/swift.d.ts +3 -0
  128. package/lib/dist/extraction/languages/swift.d.ts.map +1 -0
  129. package/lib/dist/extraction/languages/swift.js +91 -0
  130. package/lib/dist/extraction/languages/swift.js.map +1 -0
  131. package/lib/dist/extraction/languages/typescript.d.ts +3 -0
  132. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -0
  133. package/lib/dist/extraction/languages/typescript.js +129 -0
  134. package/lib/dist/extraction/languages/typescript.js.map +1 -0
  135. package/lib/dist/extraction/liquid-extractor.d.ts +52 -0
  136. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -0
  137. package/lib/dist/extraction/liquid-extractor.js +313 -0
  138. package/lib/dist/extraction/liquid-extractor.js.map +1 -0
  139. package/lib/dist/extraction/parse-worker.d.ts +8 -0
  140. package/lib/dist/extraction/parse-worker.d.ts.map +1 -0
  141. package/lib/dist/extraction/parse-worker.js +94 -0
  142. package/lib/dist/extraction/parse-worker.js.map +1 -0
  143. package/lib/dist/extraction/svelte-extractor.d.ts +56 -0
  144. package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -0
  145. package/lib/dist/extraction/svelte-extractor.js +272 -0
  146. package/lib/dist/extraction/svelte-extractor.js.map +1 -0
  147. package/lib/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  148. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  149. package/lib/dist/extraction/tree-sitter-helpers.js +103 -0
  150. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -0
  151. package/lib/dist/extraction/tree-sitter-types.d.ts +179 -0
  152. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  153. package/lib/dist/extraction/tree-sitter-types.js +10 -0
  154. package/lib/dist/extraction/tree-sitter-types.js.map +1 -0
  155. package/lib/dist/extraction/tree-sitter.d.ts +233 -0
  156. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -0
  157. package/lib/dist/extraction/tree-sitter.js +2425 -0
  158. package/lib/dist/extraction/tree-sitter.js.map +1 -0
  159. package/lib/dist/extraction/vue-extractor.d.ts +36 -0
  160. package/lib/dist/extraction/vue-extractor.d.ts.map +1 -0
  161. package/lib/dist/extraction/vue-extractor.js +163 -0
  162. package/lib/dist/extraction/vue-extractor.js.map +1 -0
  163. package/lib/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  164. package/lib/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  165. package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  166. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  167. package/lib/dist/graph/index.d.ts +8 -0
  168. package/lib/dist/graph/index.d.ts.map +1 -0
  169. package/lib/dist/graph/index.js +13 -0
  170. package/lib/dist/graph/index.js.map +1 -0
  171. package/lib/dist/graph/queries.d.ts +106 -0
  172. package/lib/dist/graph/queries.d.ts.map +1 -0
  173. package/lib/dist/graph/queries.js +366 -0
  174. package/lib/dist/graph/queries.js.map +1 -0
  175. package/lib/dist/graph/traversal.d.ts +127 -0
  176. package/lib/dist/graph/traversal.d.ts.map +1 -0
  177. package/lib/dist/graph/traversal.js +493 -0
  178. package/lib/dist/graph/traversal.js.map +1 -0
  179. package/lib/dist/index.d.ts +453 -0
  180. package/lib/dist/index.d.ts.map +1 -0
  181. package/lib/dist/index.js +833 -0
  182. package/lib/dist/index.js.map +1 -0
  183. package/lib/dist/installer/claude-md-template.d.ts +14 -0
  184. package/lib/dist/installer/claude-md-template.d.ts.map +1 -0
  185. package/lib/dist/installer/claude-md-template.js +21 -0
  186. package/lib/dist/installer/claude-md-template.js.map +1 -0
  187. package/lib/dist/installer/config-writer.d.ts +29 -0
  188. package/lib/dist/installer/config-writer.d.ts.map +1 -0
  189. package/lib/dist/installer/config-writer.js +111 -0
  190. package/lib/dist/installer/config-writer.js.map +1 -0
  191. package/lib/dist/installer/index.d.ts +65 -0
  192. package/lib/dist/installer/index.d.ts.map +1 -0
  193. package/lib/dist/installer/index.js +406 -0
  194. package/lib/dist/installer/index.js.map +1 -0
  195. package/lib/dist/installer/instructions-template.d.ts +28 -0
  196. package/lib/dist/installer/instructions-template.d.ts.map +1 -0
  197. package/lib/dist/installer/instructions-template.js +64 -0
  198. package/lib/dist/installer/instructions-template.js.map +1 -0
  199. package/lib/dist/installer/targets/claude.d.ts +47 -0
  200. package/lib/dist/installer/targets/claude.d.ts.map +1 -0
  201. package/lib/dist/installer/targets/claude.js +401 -0
  202. package/lib/dist/installer/targets/claude.js.map +1 -0
  203. package/lib/dist/installer/targets/codex.d.ts +18 -0
  204. package/lib/dist/installer/targets/codex.d.ts.map +1 -0
  205. package/lib/dist/installer/targets/codex.js +185 -0
  206. package/lib/dist/installer/targets/codex.js.map +1 -0
  207. package/lib/dist/installer/targets/cursor.d.ts +35 -0
  208. package/lib/dist/installer/targets/cursor.d.ts.map +1 -0
  209. package/lib/dist/installer/targets/cursor.js +229 -0
  210. package/lib/dist/installer/targets/cursor.js.map +1 -0
  211. package/lib/dist/installer/targets/opencode.d.ts +30 -0
  212. package/lib/dist/installer/targets/opencode.d.ts.map +1 -0
  213. package/lib/dist/installer/targets/opencode.js +235 -0
  214. package/lib/dist/installer/targets/opencode.js.map +1 -0
  215. package/lib/dist/installer/targets/registry.d.ts +35 -0
  216. package/lib/dist/installer/targets/registry.d.ts.map +1 -0
  217. package/lib/dist/installer/targets/registry.js +83 -0
  218. package/lib/dist/installer/targets/registry.js.map +1 -0
  219. package/lib/dist/installer/targets/shared.d.ts +77 -0
  220. package/lib/dist/installer/targets/shared.d.ts.map +1 -0
  221. package/lib/dist/installer/targets/shared.js +246 -0
  222. package/lib/dist/installer/targets/shared.js.map +1 -0
  223. package/lib/dist/installer/targets/toml.d.ts +52 -0
  224. package/lib/dist/installer/targets/toml.d.ts.map +1 -0
  225. package/lib/dist/installer/targets/toml.js +147 -0
  226. package/lib/dist/installer/targets/toml.js.map +1 -0
  227. package/lib/dist/installer/targets/types.d.ts +116 -0
  228. package/lib/dist/installer/targets/types.d.ts.map +1 -0
  229. package/lib/dist/installer/targets/types.js +16 -0
  230. package/lib/dist/installer/targets/types.js.map +1 -0
  231. package/lib/dist/mcp/index.d.ts +94 -0
  232. package/lib/dist/mcp/index.d.ts.map +1 -0
  233. package/lib/dist/mcp/index.js +453 -0
  234. package/lib/dist/mcp/index.js.map +1 -0
  235. package/lib/dist/mcp/server-instructions.d.ts +19 -0
  236. package/lib/dist/mcp/server-instructions.d.ts.map +1 -0
  237. package/lib/dist/mcp/server-instructions.js +71 -0
  238. package/lib/dist/mcp/server-instructions.js.map +1 -0
  239. package/lib/dist/mcp/tools.d.ts +257 -0
  240. package/lib/dist/mcp/tools.d.ts.map +1 -0
  241. package/lib/dist/mcp/tools.js +1646 -0
  242. package/lib/dist/mcp/tools.js.map +1 -0
  243. package/lib/dist/mcp/transport.d.ts +106 -0
  244. package/lib/dist/mcp/transport.d.ts.map +1 -0
  245. package/lib/dist/mcp/transport.js +233 -0
  246. package/lib/dist/mcp/transport.js.map +1 -0
  247. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  248. package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  249. package/lib/dist/resolution/frameworks/cargo-workspace.js +225 -0
  250. package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  251. package/lib/dist/resolution/frameworks/csharp.d.ts +8 -0
  252. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  253. package/lib/dist/resolution/frameworks/csharp.js +213 -0
  254. package/lib/dist/resolution/frameworks/csharp.js.map +1 -0
  255. package/lib/dist/resolution/frameworks/express.d.ts +8 -0
  256. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -0
  257. package/lib/dist/resolution/frameworks/express.js +225 -0
  258. package/lib/dist/resolution/frameworks/express.js.map +1 -0
  259. package/lib/dist/resolution/frameworks/go.d.ts +8 -0
  260. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -0
  261. package/lib/dist/resolution/frameworks/go.js +158 -0
  262. package/lib/dist/resolution/frameworks/go.js.map +1 -0
  263. package/lib/dist/resolution/frameworks/index.d.ts +42 -0
  264. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -0
  265. package/lib/dist/resolution/frameworks/index.js +133 -0
  266. package/lib/dist/resolution/frameworks/index.js.map +1 -0
  267. package/lib/dist/resolution/frameworks/java.d.ts +8 -0
  268. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -0
  269. package/lib/dist/resolution/frameworks/java.js +177 -0
  270. package/lib/dist/resolution/frameworks/java.js.map +1 -0
  271. package/lib/dist/resolution/frameworks/laravel.d.ts +13 -0
  272. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  273. package/lib/dist/resolution/frameworks/laravel.js +248 -0
  274. package/lib/dist/resolution/frameworks/laravel.js.map +1 -0
  275. package/lib/dist/resolution/frameworks/nestjs.d.ts +26 -0
  276. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  277. package/lib/dist/resolution/frameworks/nestjs.js +374 -0
  278. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -0
  279. package/lib/dist/resolution/frameworks/python.d.ts +10 -0
  280. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -0
  281. package/lib/dist/resolution/frameworks/python.js +278 -0
  282. package/lib/dist/resolution/frameworks/python.js.map +1 -0
  283. package/lib/dist/resolution/frameworks/react.d.ts +8 -0
  284. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -0
  285. package/lib/dist/resolution/frameworks/react.js +272 -0
  286. package/lib/dist/resolution/frameworks/react.js.map +1 -0
  287. package/lib/dist/resolution/frameworks/ruby.d.ts +8 -0
  288. package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  289. package/lib/dist/resolution/frameworks/ruby.js +198 -0
  290. package/lib/dist/resolution/frameworks/ruby.js.map +1 -0
  291. package/lib/dist/resolution/frameworks/rust.d.ts +8 -0
  292. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -0
  293. package/lib/dist/resolution/frameworks/rust.js +207 -0
  294. package/lib/dist/resolution/frameworks/rust.js.map +1 -0
  295. package/lib/dist/resolution/frameworks/svelte.d.ts +9 -0
  296. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  297. package/lib/dist/resolution/frameworks/svelte.js +249 -0
  298. package/lib/dist/resolution/frameworks/svelte.js.map +1 -0
  299. package/lib/dist/resolution/frameworks/swift.d.ts +10 -0
  300. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -0
  301. package/lib/dist/resolution/frameworks/swift.js +376 -0
  302. package/lib/dist/resolution/frameworks/swift.js.map +1 -0
  303. package/lib/dist/resolution/frameworks/vue.d.ts +9 -0
  304. package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -0
  305. package/lib/dist/resolution/frameworks/vue.js +306 -0
  306. package/lib/dist/resolution/frameworks/vue.js.map +1 -0
  307. package/lib/dist/resolution/import-resolver.d.ts +40 -0
  308. package/lib/dist/resolution/import-resolver.d.ts.map +1 -0
  309. package/lib/dist/resolution/import-resolver.js +663 -0
  310. package/lib/dist/resolution/import-resolver.js.map +1 -0
  311. package/lib/dist/resolution/index.d.ts +106 -0
  312. package/lib/dist/resolution/index.d.ts.map +1 -0
  313. package/lib/dist/resolution/index.js +709 -0
  314. package/lib/dist/resolution/index.js.map +1 -0
  315. package/lib/dist/resolution/name-matcher.d.ts +32 -0
  316. package/lib/dist/resolution/name-matcher.d.ts.map +1 -0
  317. package/lib/dist/resolution/name-matcher.js +384 -0
  318. package/lib/dist/resolution/name-matcher.js.map +1 -0
  319. package/lib/dist/resolution/path-aliases.d.ts +68 -0
  320. package/lib/dist/resolution/path-aliases.d.ts.map +1 -0
  321. package/lib/dist/resolution/path-aliases.js +238 -0
  322. package/lib/dist/resolution/path-aliases.js.map +1 -0
  323. package/lib/dist/resolution/strip-comments.d.ts +27 -0
  324. package/lib/dist/resolution/strip-comments.d.ts.map +1 -0
  325. package/lib/dist/resolution/strip-comments.js +441 -0
  326. package/lib/dist/resolution/strip-comments.js.map +1 -0
  327. package/lib/dist/resolution/types.d.ts +172 -0
  328. package/lib/dist/resolution/types.d.ts.map +1 -0
  329. package/lib/dist/resolution/types.js +8 -0
  330. package/lib/dist/resolution/types.js.map +1 -0
  331. package/lib/dist/search/query-parser.d.ts +57 -0
  332. package/lib/dist/search/query-parser.d.ts.map +1 -0
  333. package/lib/dist/search/query-parser.js +177 -0
  334. package/lib/dist/search/query-parser.js.map +1 -0
  335. package/lib/dist/search/query-utils.d.ts +53 -0
  336. package/lib/dist/search/query-utils.d.ts.map +1 -0
  337. package/lib/dist/search/query-utils.js +350 -0
  338. package/lib/dist/search/query-utils.js.map +1 -0
  339. package/lib/dist/sync/git-hooks.d.ts +45 -0
  340. package/lib/dist/sync/git-hooks.d.ts.map +1 -0
  341. package/lib/dist/sync/git-hooks.js +223 -0
  342. package/lib/dist/sync/git-hooks.js.map +1 -0
  343. package/lib/dist/sync/index.d.ts +17 -0
  344. package/lib/dist/sync/index.d.ts.map +1 -0
  345. package/lib/dist/sync/index.js +28 -0
  346. package/lib/dist/sync/index.js.map +1 -0
  347. package/lib/dist/sync/watch-policy.d.ts +48 -0
  348. package/lib/dist/sync/watch-policy.d.ts.map +1 -0
  349. package/lib/dist/sync/watch-policy.js +124 -0
  350. package/lib/dist/sync/watch-policy.js.map +1 -0
  351. package/lib/dist/sync/watcher.d.ts +81 -0
  352. package/lib/dist/sync/watcher.d.ts.map +1 -0
  353. package/lib/dist/sync/watcher.js +194 -0
  354. package/lib/dist/sync/watcher.js.map +1 -0
  355. package/lib/dist/types.d.ts +423 -0
  356. package/lib/dist/types.d.ts.map +1 -0
  357. package/lib/dist/types.js +262 -0
  358. package/lib/dist/types.js.map +1 -0
  359. package/lib/dist/ui/glyphs.d.ts +42 -0
  360. package/lib/dist/ui/glyphs.d.ts.map +1 -0
  361. package/lib/dist/ui/glyphs.js +78 -0
  362. package/lib/dist/ui/glyphs.js.map +1 -0
  363. package/lib/dist/ui/shimmer-progress.d.ts +11 -0
  364. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -0
  365. package/lib/dist/ui/shimmer-progress.js +90 -0
  366. package/lib/dist/ui/shimmer-progress.js.map +1 -0
  367. package/lib/dist/ui/shimmer-worker.d.ts +2 -0
  368. package/lib/dist/ui/shimmer-worker.d.ts.map +1 -0
  369. package/lib/dist/ui/shimmer-worker.js +118 -0
  370. package/lib/dist/ui/shimmer-worker.js.map +1 -0
  371. package/lib/dist/ui/types.d.ts +17 -0
  372. package/lib/dist/ui/types.d.ts.map +1 -0
  373. package/lib/dist/ui/types.js +3 -0
  374. package/lib/dist/ui/types.js.map +1 -0
  375. package/lib/dist/utils.d.ts +205 -0
  376. package/lib/dist/utils.d.ts.map +1 -0
  377. package/lib/dist/utils.js +549 -0
  378. package/lib/dist/utils.js.map +1 -0
  379. package/lib/node_modules/.package-lock.json +116 -0
  380. package/lib/node_modules/@clack/core/CHANGELOG.md +348 -0
  381. package/lib/node_modules/@clack/core/LICENSE +9 -0
  382. package/lib/node_modules/@clack/core/README.md +22 -0
  383. package/lib/node_modules/@clack/core/dist/index.d.mts +363 -0
  384. package/lib/node_modules/@clack/core/dist/index.mjs +17 -0
  385. package/lib/node_modules/@clack/core/dist/index.mjs.map +1 -0
  386. package/lib/node_modules/@clack/core/package.json +63 -0
  387. package/lib/node_modules/@clack/prompts/CHANGELOG.md +591 -0
  388. package/lib/node_modules/@clack/prompts/LICENSE +9 -0
  389. package/lib/node_modules/@clack/prompts/README.md +375 -0
  390. package/lib/node_modules/@clack/prompts/dist/index.d.mts +396 -0
  391. package/lib/node_modules/@clack/prompts/dist/index.mjs +144 -0
  392. package/lib/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
  393. package/lib/node_modules/@clack/prompts/package.json +68 -0
  394. package/lib/node_modules/commander/LICENSE +22 -0
  395. package/lib/node_modules/commander/Readme.md +1176 -0
  396. package/lib/node_modules/commander/esm.mjs +16 -0
  397. package/lib/node_modules/commander/index.js +24 -0
  398. package/lib/node_modules/commander/lib/argument.js +150 -0
  399. package/lib/node_modules/commander/lib/command.js +2777 -0
  400. package/lib/node_modules/commander/lib/error.js +39 -0
  401. package/lib/node_modules/commander/lib/help.js +747 -0
  402. package/lib/node_modules/commander/lib/option.js +380 -0
  403. package/lib/node_modules/commander/lib/suggestSimilar.js +101 -0
  404. package/lib/node_modules/commander/package-support.json +19 -0
  405. package/lib/node_modules/commander/package.json +82 -0
  406. package/lib/node_modules/commander/typings/esm.d.mts +3 -0
  407. package/lib/node_modules/commander/typings/index.d.ts +1113 -0
  408. package/lib/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
  409. package/lib/node_modules/fast-string-truncated-width/dist/index.js +111 -0
  410. package/lib/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
  411. package/lib/node_modules/fast-string-truncated-width/dist/types.js +2 -0
  412. package/lib/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
  413. package/lib/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
  414. package/lib/node_modules/fast-string-truncated-width/license +21 -0
  415. package/lib/node_modules/fast-string-truncated-width/package.json +35 -0
  416. package/lib/node_modules/fast-string-truncated-width/readme.md +59 -0
  417. package/lib/node_modules/fast-string-width/dist/index.d.ts +4 -0
  418. package/lib/node_modules/fast-string-width/dist/index.js +14 -0
  419. package/lib/node_modules/fast-string-width/license +21 -0
  420. package/lib/node_modules/fast-string-width/package.json +34 -0
  421. package/lib/node_modules/fast-string-width/readme.md +42 -0
  422. package/lib/node_modules/fast-wrap-ansi/LICENSE +23 -0
  423. package/lib/node_modules/fast-wrap-ansi/README.md +26 -0
  424. package/lib/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
  425. package/lib/node_modules/fast-wrap-ansi/lib/main.js +219 -0
  426. package/lib/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
  427. package/lib/node_modules/fast-wrap-ansi/package.json +51 -0
  428. package/lib/node_modules/jsonc-parser/CHANGELOG.md +76 -0
  429. package/lib/node_modules/jsonc-parser/LICENSE.md +21 -0
  430. package/lib/node_modules/jsonc-parser/README.md +364 -0
  431. package/lib/node_modules/jsonc-parser/SECURITY.md +41 -0
  432. package/lib/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
  433. package/lib/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
  434. package/lib/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
  435. package/lib/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
  436. package/lib/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
  437. package/lib/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
  438. package/lib/node_modules/jsonc-parser/lib/esm/main.js +178 -0
  439. package/lib/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
  440. package/lib/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
  441. package/lib/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
  442. package/lib/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
  443. package/lib/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
  444. package/lib/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
  445. package/lib/node_modules/jsonc-parser/lib/umd/main.js +194 -0
  446. package/lib/node_modules/jsonc-parser/package.json +37 -0
  447. package/lib/node_modules/picomatch/LICENSE +21 -0
  448. package/lib/node_modules/picomatch/README.md +738 -0
  449. package/lib/node_modules/picomatch/index.js +17 -0
  450. package/lib/node_modules/picomatch/lib/constants.js +180 -0
  451. package/lib/node_modules/picomatch/lib/parse.js +1085 -0
  452. package/lib/node_modules/picomatch/lib/picomatch.js +341 -0
  453. package/lib/node_modules/picomatch/lib/scan.js +391 -0
  454. package/lib/node_modules/picomatch/lib/utils.js +72 -0
  455. package/lib/node_modules/picomatch/package.json +83 -0
  456. package/lib/node_modules/picomatch/posix.js +3 -0
  457. package/lib/node_modules/sisteransi/license +21 -0
  458. package/lib/node_modules/sisteransi/package.json +34 -0
  459. package/lib/node_modules/sisteransi/readme.md +113 -0
  460. package/lib/node_modules/sisteransi/src/index.js +58 -0
  461. package/lib/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
  462. package/lib/node_modules/tree-sitter-wasms/LICENSE +24 -0
  463. package/lib/node_modules/tree-sitter-wasms/README.md +23 -0
  464. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-bash.wasm +0 -0
  465. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c.wasm +0 -0
  466. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
  467. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-cpp.wasm +0 -0
  468. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-css.wasm +0 -0
  469. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-dart.wasm +0 -0
  470. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elisp.wasm +0 -0
  471. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elixir.wasm +0 -0
  472. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elm.wasm +0 -0
  473. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-embedded_template.wasm +0 -0
  474. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
  475. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-html.wasm +0 -0
  476. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
  477. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
  478. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-json.wasm +0 -0
  479. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
  480. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-lua.wasm +0 -0
  481. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-objc.wasm +0 -0
  482. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ocaml.wasm +0 -0
  483. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
  484. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
  485. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ql.wasm +0 -0
  486. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rescript.wasm +0 -0
  487. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
  488. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
  489. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
  490. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-solidity.wasm +0 -0
  491. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-swift.wasm +0 -0
  492. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-systemrdl.wasm +0 -0
  493. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tlaplus.wasm +0 -0
  494. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-toml.wasm +0 -0
  495. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
  496. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
  497. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-vue.wasm +0 -0
  498. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-yaml.wasm +0 -0
  499. package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-zig.wasm +0 -0
  500. package/lib/node_modules/tree-sitter-wasms/package.json +64 -0
  501. package/lib/node_modules/web-tree-sitter/LICENSE +21 -0
  502. package/lib/node_modules/web-tree-sitter/README.md +269 -0
  503. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
  504. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
  505. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
  506. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
  507. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
  508. package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
  509. package/lib/node_modules/web-tree-sitter/lib/alloc.c +48 -0
  510. package/lib/node_modules/web-tree-sitter/lib/alloc.h +41 -0
  511. package/lib/node_modules/web-tree-sitter/lib/array.h +291 -0
  512. package/lib/node_modules/web-tree-sitter/lib/atomic.h +68 -0
  513. package/lib/node_modules/web-tree-sitter/lib/clock.h +146 -0
  514. package/lib/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
  515. package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
  516. package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
  517. package/lib/node_modules/web-tree-sitter/lib/host.h +21 -0
  518. package/lib/node_modules/web-tree-sitter/lib/language.c +293 -0
  519. package/lib/node_modules/web-tree-sitter/lib/language.h +293 -0
  520. package/lib/node_modules/web-tree-sitter/lib/length.h +52 -0
  521. package/lib/node_modules/web-tree-sitter/lib/lexer.c +483 -0
  522. package/lib/node_modules/web-tree-sitter/lib/lexer.h +54 -0
  523. package/lib/node_modules/web-tree-sitter/lib/lib.c +12 -0
  524. package/lib/node_modules/web-tree-sitter/lib/node.c +875 -0
  525. package/lib/node_modules/web-tree-sitter/lib/parser.c +2297 -0
  526. package/lib/node_modules/web-tree-sitter/lib/parser.h +286 -0
  527. package/lib/node_modules/web-tree-sitter/lib/point.h +48 -0
  528. package/lib/node_modules/web-tree-sitter/lib/query.c +4347 -0
  529. package/lib/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
  530. package/lib/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
  531. package/lib/node_modules/web-tree-sitter/lib/stack.c +912 -0
  532. package/lib/node_modules/web-tree-sitter/lib/stack.h +133 -0
  533. package/lib/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
  534. package/lib/node_modules/web-tree-sitter/lib/subtree.h +399 -0
  535. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
  536. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
  537. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
  538. package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
  539. package/lib/node_modules/web-tree-sitter/lib/tree.c +170 -0
  540. package/lib/node_modules/web-tree-sitter/lib/tree.h +31 -0
  541. package/lib/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
  542. package/lib/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
  543. package/lib/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
  544. package/lib/node_modules/web-tree-sitter/lib/unicode.h +75 -0
  545. package/lib/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
  546. package/lib/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
  547. package/lib/node_modules/web-tree-sitter/package.json +98 -0
  548. package/lib/node_modules/web-tree-sitter/src/bindings.ts +26 -0
  549. package/lib/node_modules/web-tree-sitter/src/constants.ts +133 -0
  550. package/lib/node_modules/web-tree-sitter/src/index.ts +31 -0
  551. package/lib/node_modules/web-tree-sitter/src/language.ts +291 -0
  552. package/lib/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
  553. package/lib/node_modules/web-tree-sitter/src/marshal.ts +176 -0
  554. package/lib/node_modules/web-tree-sitter/src/node.ts +646 -0
  555. package/lib/node_modules/web-tree-sitter/src/parser.ts +325 -0
  556. package/lib/node_modules/web-tree-sitter/src/query.ts +973 -0
  557. package/lib/node_modules/web-tree-sitter/src/tree.ts +145 -0
  558. package/lib/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
  559. package/lib/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
  560. package/lib/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
  561. package/lib/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
  562. package/lib/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
  563. package/lib/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
  564. package/lib/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
  565. package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
  566. package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
  567. package/lib/package.json +55 -0
  568. package/node +0 -0
  569. package/package.json +17 -0
@@ -0,0 +1,483 @@
1
+ #include "./length.h"
2
+ #include "./lexer.h"
3
+ #include "./unicode.h"
4
+
5
+ #include "tree_sitter/api.h"
6
+
7
+ #include <stdarg.h>
8
+ #include <stdio.h>
9
+
10
+ #define LOG(message, character) \
11
+ if (self->logger.log) { \
12
+ snprintf( \
13
+ self->debug_buffer, \
14
+ TREE_SITTER_SERIALIZATION_BUFFER_SIZE, \
15
+ 32 <= character && character < 127 ? \
16
+ message " character:'%c'" : \
17
+ message " character:%d", \
18
+ character \
19
+ ); \
20
+ self->logger.log( \
21
+ self->logger.payload, \
22
+ TSLogTypeLex, \
23
+ self->debug_buffer \
24
+ ); \
25
+ }
26
+
27
+ static const int32_t BYTE_ORDER_MARK = 0xFEFF;
28
+
29
+ static const TSRange DEFAULT_RANGE = {
30
+ .start_point = {
31
+ .row = 0,
32
+ .column = 0,
33
+ },
34
+ .end_point = {
35
+ .row = UINT32_MAX,
36
+ .column = UINT32_MAX,
37
+ },
38
+ .start_byte = 0,
39
+ .end_byte = UINT32_MAX
40
+ };
41
+
42
+ /**
43
+ * Sets the column data to the given value and marks it valid.
44
+ * @param self The lexer state.
45
+ * @param val The new value of the column data.
46
+ */
47
+ static void ts_lexer__set_column_data(Lexer *self, uint32_t val) {
48
+ self->column_data.valid = true;
49
+ self->column_data.value = val;
50
+ }
51
+
52
+ /**
53
+ * Increments the value of the column data; no-op if invalid.
54
+ * @param self The lexer state.
55
+ */
56
+ static void ts_lexer__increment_column_data(Lexer *self) {
57
+ if (self->column_data.valid) {
58
+ self->column_data.value++;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Marks the column data as invalid.
64
+ * @param self The lexer state.
65
+ */
66
+ static void ts_lexer__invalidate_column_data(Lexer *self) {
67
+ self->column_data.valid = false;
68
+ self->column_data.value = 0;
69
+ }
70
+
71
+ // Check if the lexer has reached EOF. This state is stored
72
+ // by setting the lexer's `current_included_range_index` such that
73
+ // it has consumed all of its available ranges.
74
+ static bool ts_lexer__eof(const TSLexer *_self) {
75
+ Lexer *self = (Lexer *)_self;
76
+ return self->current_included_range_index == self->included_range_count;
77
+ }
78
+
79
+ // Clear the currently stored chunk of source code, because the lexer's
80
+ // position has changed.
81
+ static void ts_lexer__clear_chunk(Lexer *self) {
82
+ self->chunk = NULL;
83
+ self->chunk_size = 0;
84
+ self->chunk_start = 0;
85
+ }
86
+
87
+ // Call the lexer's input callback to obtain a new chunk of source code
88
+ // for the current position.
89
+ static void ts_lexer__get_chunk(Lexer *self) {
90
+ self->chunk_start = self->current_position.bytes;
91
+ self->chunk = self->input.read(
92
+ self->input.payload,
93
+ self->current_position.bytes,
94
+ self->current_position.extent,
95
+ &self->chunk_size
96
+ );
97
+ if (!self->chunk_size) {
98
+ self->current_included_range_index = self->included_range_count;
99
+ self->chunk = NULL;
100
+ }
101
+ }
102
+
103
+ // Decode the next unicode character in the current chunk of source code.
104
+ // This assumes that the lexer has already retrieved a chunk of source
105
+ // code that spans the current position.
106
+ static void ts_lexer__get_lookahead(Lexer *self) {
107
+ uint32_t position_in_chunk = self->current_position.bytes - self->chunk_start;
108
+ uint32_t size = self->chunk_size - position_in_chunk;
109
+
110
+ if (size == 0) {
111
+ self->lookahead_size = 1;
112
+ self->data.lookahead = '\0';
113
+ return;
114
+ }
115
+
116
+ const uint8_t *chunk = (const uint8_t *)self->chunk + position_in_chunk;
117
+ DecodeFunction decode =
118
+ self->input.encoding == TSInputEncodingUTF8 ? ts_decode_utf8 :
119
+ self->input.encoding == TSInputEncodingUTF16LE ? ts_decode_utf16_le :
120
+ self->input.encoding == TSInputEncodingUTF16BE ? ts_decode_utf16_be : self->input.decode;
121
+
122
+ self->lookahead_size = decode(chunk, size, &self->data.lookahead);
123
+
124
+ // If this chunk ended in the middle of a multi-byte character,
125
+ // try again with a fresh chunk.
126
+ if (self->data.lookahead == TS_DECODE_ERROR && size < 4) {
127
+ ts_lexer__get_chunk(self);
128
+ chunk = (const uint8_t *)self->chunk;
129
+ size = self->chunk_size;
130
+ self->lookahead_size = decode(chunk, size, &self->data.lookahead);
131
+ }
132
+
133
+ if (self->data.lookahead == TS_DECODE_ERROR) {
134
+ self->lookahead_size = 1;
135
+ }
136
+ }
137
+
138
+ static void ts_lexer_goto(Lexer *self, Length position) {
139
+ if (position.bytes != self->current_position.bytes) {
140
+ ts_lexer__invalidate_column_data(self);
141
+ }
142
+
143
+ self->current_position = position;
144
+
145
+ // Move to the first valid position at or after the given position.
146
+ bool found_included_range = false;
147
+ for (unsigned i = 0; i < self->included_range_count; i++) {
148
+ TSRange *included_range = &self->included_ranges[i];
149
+ if (
150
+ included_range->end_byte > self->current_position.bytes &&
151
+ included_range->end_byte > included_range->start_byte
152
+ ) {
153
+ if (included_range->start_byte >= self->current_position.bytes) {
154
+ self->current_position = (Length) {
155
+ .bytes = included_range->start_byte,
156
+ .extent = included_range->start_point,
157
+ };
158
+ }
159
+
160
+ self->current_included_range_index = i;
161
+ found_included_range = true;
162
+ break;
163
+ }
164
+ }
165
+
166
+ if (found_included_range) {
167
+ // If the current position is outside of the current chunk of text,
168
+ // then clear out the current chunk of text.
169
+ if (self->chunk && (
170
+ self->current_position.bytes < self->chunk_start ||
171
+ self->current_position.bytes >= self->chunk_start + self->chunk_size
172
+ )) {
173
+ ts_lexer__clear_chunk(self);
174
+ }
175
+
176
+ self->lookahead_size = 0;
177
+ self->data.lookahead = '\0';
178
+ }
179
+
180
+ // If the given position is beyond any of included ranges, move to the EOF
181
+ // state - past the end of the included ranges.
182
+ else {
183
+ self->current_included_range_index = self->included_range_count;
184
+ TSRange *last_included_range = &self->included_ranges[self->included_range_count - 1];
185
+ self->current_position = (Length) {
186
+ .bytes = last_included_range->end_byte,
187
+ .extent = last_included_range->end_point,
188
+ };
189
+ ts_lexer__clear_chunk(self);
190
+ self->lookahead_size = 1;
191
+ self->data.lookahead = '\0';
192
+ }
193
+ }
194
+
195
+ /**
196
+ * Actually advances the lexer. Does not log anything.
197
+ * @param self The lexer state.
198
+ * @param skip Whether to mark the consumed codepoint as whitespace.
199
+ */
200
+ static void ts_lexer__do_advance(Lexer *self, bool skip) {
201
+ if (self->lookahead_size) {
202
+ if (self->data.lookahead == '\n') {
203
+ self->current_position.extent.row++;
204
+ self->current_position.extent.column = 0;
205
+ ts_lexer__set_column_data(self, 0);
206
+ } else {
207
+ bool is_bom = self->current_position.bytes == 0 &&
208
+ self->data.lookahead == BYTE_ORDER_MARK;
209
+ if (!is_bom) ts_lexer__increment_column_data(self);
210
+ self->current_position.extent.column += self->lookahead_size;
211
+ }
212
+ self->current_position.bytes += self->lookahead_size;
213
+ }
214
+
215
+ const TSRange *current_range = &self->included_ranges[self->current_included_range_index];
216
+ while (
217
+ self->current_position.bytes >= current_range->end_byte ||
218
+ current_range->end_byte == current_range->start_byte
219
+ ) {
220
+ if (self->current_included_range_index < self->included_range_count) {
221
+ self->current_included_range_index++;
222
+ }
223
+ if (self->current_included_range_index < self->included_range_count) {
224
+ current_range++;
225
+ self->current_position = (Length) {
226
+ current_range->start_byte,
227
+ current_range->start_point,
228
+ };
229
+ } else {
230
+ current_range = NULL;
231
+ break;
232
+ }
233
+ }
234
+
235
+ if (skip) self->token_start_position = self->current_position;
236
+
237
+ if (current_range) {
238
+ if (
239
+ self->current_position.bytes < self->chunk_start ||
240
+ self->current_position.bytes >= self->chunk_start + self->chunk_size
241
+ ) {
242
+ ts_lexer__get_chunk(self);
243
+ }
244
+ ts_lexer__get_lookahead(self);
245
+ } else {
246
+ ts_lexer__clear_chunk(self);
247
+ self->data.lookahead = '\0';
248
+ self->lookahead_size = 1;
249
+ }
250
+ }
251
+
252
+ // Advance to the next character in the source code, retrieving a new
253
+ // chunk of source code if needed.
254
+ static void ts_lexer__advance(TSLexer *_self, bool skip) {
255
+ Lexer *self = (Lexer *)_self;
256
+ if (!self->chunk) return;
257
+
258
+ if (skip) {
259
+ LOG("skip", self->data.lookahead)
260
+ } else {
261
+ LOG("consume", self->data.lookahead)
262
+ }
263
+
264
+ ts_lexer__do_advance(self, skip);
265
+ }
266
+
267
+ // Mark that a token match has completed. This can be called multiple
268
+ // times if a longer match is found later.
269
+ static void ts_lexer__mark_end(TSLexer *_self) {
270
+ Lexer *self = (Lexer *)_self;
271
+ if (!ts_lexer__eof(&self->data)) {
272
+ // If the lexer is right at the beginning of included range,
273
+ // then the token should be considered to end at the *end* of the
274
+ // previous included range, rather than here.
275
+ TSRange *current_included_range = &self->included_ranges[
276
+ self->current_included_range_index
277
+ ];
278
+ if (
279
+ self->current_included_range_index > 0 &&
280
+ self->current_position.bytes == current_included_range->start_byte
281
+ ) {
282
+ TSRange *previous_included_range = current_included_range - 1;
283
+ self->token_end_position = (Length) {
284
+ previous_included_range->end_byte,
285
+ previous_included_range->end_point,
286
+ };
287
+ return;
288
+ }
289
+ }
290
+ self->token_end_position = self->current_position;
291
+ }
292
+
293
+ static uint32_t ts_lexer__get_column(TSLexer *_self) {
294
+ Lexer *self = (Lexer *)_self;
295
+
296
+ self->did_get_column = true;
297
+
298
+ if (!self->column_data.valid) {
299
+ // Record current position
300
+ uint32_t goal_byte = self->current_position.bytes;
301
+
302
+ // Back up to the beginning of the line
303
+ Length start_of_col = {
304
+ self->current_position.bytes - self->current_position.extent.column,
305
+ {self->current_position.extent.row, 0},
306
+ };
307
+ ts_lexer_goto(self, start_of_col);
308
+ ts_lexer__set_column_data(self, 0);
309
+ ts_lexer__get_chunk(self);
310
+
311
+ if (!ts_lexer__eof(_self)) {
312
+ ts_lexer__get_lookahead(self);
313
+
314
+ // Advance to the recorded position
315
+ while (self->current_position.bytes < goal_byte && !ts_lexer__eof(_self) && self->chunk) {
316
+ ts_lexer__do_advance(self, false);
317
+ if (ts_lexer__eof(_self)) break;
318
+ }
319
+ }
320
+ }
321
+
322
+ return self->column_data.value;
323
+ }
324
+
325
+ // Is the lexer at a boundary between two disjoint included ranges of
326
+ // source code? This is exposed as an API because some languages' external
327
+ // scanners need to perform custom actions at these boundaries.
328
+ static bool ts_lexer__is_at_included_range_start(const TSLexer *_self) {
329
+ const Lexer *self = (const Lexer *)_self;
330
+ if (self->current_included_range_index < self->included_range_count) {
331
+ TSRange *current_range = &self->included_ranges[self->current_included_range_index];
332
+ return self->current_position.bytes == current_range->start_byte;
333
+ } else {
334
+ return false;
335
+ }
336
+ }
337
+
338
+ static void ts_lexer__log(const TSLexer *_self, const char *fmt, ...) {
339
+ Lexer *self = (Lexer *)_self;
340
+ va_list args;
341
+ va_start(args, fmt);
342
+ if (self->logger.log) {
343
+ vsnprintf(self->debug_buffer, TREE_SITTER_SERIALIZATION_BUFFER_SIZE, fmt, args);
344
+ self->logger.log(self->logger.payload, TSLogTypeLex, self->debug_buffer);
345
+ }
346
+ va_end(args);
347
+ }
348
+
349
+ void ts_lexer_init(Lexer *self) {
350
+ *self = (Lexer) {
351
+ .data = {
352
+ // The lexer's methods are stored as struct fields so that generated
353
+ // parsers can call them without needing to be linked against this
354
+ // library.
355
+ .advance = ts_lexer__advance,
356
+ .mark_end = ts_lexer__mark_end,
357
+ .get_column = ts_lexer__get_column,
358
+ .is_at_included_range_start = ts_lexer__is_at_included_range_start,
359
+ .eof = ts_lexer__eof,
360
+ .log = ts_lexer__log,
361
+ .lookahead = 0,
362
+ .result_symbol = 0,
363
+ },
364
+ .chunk = NULL,
365
+ .chunk_size = 0,
366
+ .chunk_start = 0,
367
+ .current_position = {0, {0, 0}},
368
+ .logger = {
369
+ .payload = NULL,
370
+ .log = NULL
371
+ },
372
+ .included_ranges = NULL,
373
+ .included_range_count = 0,
374
+ .current_included_range_index = 0,
375
+ .did_get_column = false,
376
+ .column_data = {
377
+ .valid = false,
378
+ .value = 0
379
+ }
380
+ };
381
+ ts_lexer_set_included_ranges(self, NULL, 0);
382
+ }
383
+
384
+ void ts_lexer_delete(Lexer *self) {
385
+ ts_free(self->included_ranges);
386
+ }
387
+
388
+ void ts_lexer_set_input(Lexer *self, TSInput input) {
389
+ self->input = input;
390
+ ts_lexer__clear_chunk(self);
391
+ ts_lexer_goto(self, self->current_position);
392
+ }
393
+
394
+ // Move the lexer to the given position. This doesn't do any work
395
+ // if the parser is already at the given position.
396
+ void ts_lexer_reset(Lexer *self, Length position) {
397
+ if (position.bytes != self->current_position.bytes) {
398
+ ts_lexer_goto(self, position);
399
+ }
400
+ }
401
+
402
+ void ts_lexer_start(Lexer *self) {
403
+ self->token_start_position = self->current_position;
404
+ self->token_end_position = LENGTH_UNDEFINED;
405
+ self->data.result_symbol = 0;
406
+ self->did_get_column = false;
407
+ if (!ts_lexer__eof(&self->data)) {
408
+ if (!self->chunk_size) ts_lexer__get_chunk(self);
409
+ if (!self->lookahead_size) ts_lexer__get_lookahead(self);
410
+ if (self->current_position.bytes == 0) {
411
+ if (self->data.lookahead == BYTE_ORDER_MARK) {
412
+ ts_lexer__advance(&self->data, true);
413
+ }
414
+ ts_lexer__set_column_data(self, 0);
415
+ }
416
+ }
417
+ }
418
+
419
+ void ts_lexer_finish(Lexer *self, uint32_t *lookahead_end_byte) {
420
+ if (length_is_undefined(self->token_end_position)) {
421
+ ts_lexer__mark_end(&self->data);
422
+ }
423
+
424
+ // If the token ended at an included range boundary, then its end position
425
+ // will have been reset to the end of the preceding range. Reset the start
426
+ // position to match.
427
+ if (self->token_end_position.bytes < self->token_start_position.bytes) {
428
+ self->token_start_position = self->token_end_position;
429
+ }
430
+
431
+ uint32_t current_lookahead_end_byte = self->current_position.bytes + 1;
432
+
433
+ // In order to determine that a byte sequence is invalid UTF8 or UTF16,
434
+ // the character decoding algorithm may have looked at the following byte.
435
+ // Therefore, the next byte *after* the current (invalid) character
436
+ // affects the interpretation of the current character.
437
+ if (self->data.lookahead == TS_DECODE_ERROR) {
438
+ current_lookahead_end_byte += 4; // the maximum number of bytes read to identify an invalid code point
439
+ }
440
+
441
+ if (current_lookahead_end_byte > *lookahead_end_byte) {
442
+ *lookahead_end_byte = current_lookahead_end_byte;
443
+ }
444
+ }
445
+
446
+ void ts_lexer_mark_end(Lexer *self) {
447
+ ts_lexer__mark_end(&self->data);
448
+ }
449
+
450
+ bool ts_lexer_set_included_ranges(
451
+ Lexer *self,
452
+ const TSRange *ranges,
453
+ uint32_t count
454
+ ) {
455
+ if (count == 0 || !ranges) {
456
+ ranges = &DEFAULT_RANGE;
457
+ count = 1;
458
+ } else {
459
+ uint32_t previous_byte = 0;
460
+ for (unsigned i = 0; i < count; i++) {
461
+ const TSRange *range = &ranges[i];
462
+ if (
463
+ range->start_byte < previous_byte ||
464
+ range->end_byte < range->start_byte
465
+ ) return false;
466
+ previous_byte = range->end_byte;
467
+ }
468
+ }
469
+
470
+ size_t size = count * sizeof(TSRange);
471
+ self->included_ranges = ts_realloc(self->included_ranges, size);
472
+ memcpy(self->included_ranges, ranges, size);
473
+ self->included_range_count = count;
474
+ ts_lexer_goto(self, self->current_position);
475
+ return true;
476
+ }
477
+
478
+ TSRange *ts_lexer_included_ranges(const Lexer *self, uint32_t *count) {
479
+ *count = self->included_range_count;
480
+ return self->included_ranges;
481
+ }
482
+
483
+ #undef LOG
@@ -0,0 +1,54 @@
1
+ #ifndef TREE_SITTER_LEXER_H_
2
+ #define TREE_SITTER_LEXER_H_
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include "./length.h"
9
+ #include "./subtree.h"
10
+ #include "tree_sitter/api.h"
11
+ #include "./parser.h"
12
+
13
+ typedef struct {
14
+ uint32_t value;
15
+ bool valid;
16
+ } ColumnData;
17
+
18
+ typedef struct {
19
+ TSLexer data;
20
+ Length current_position;
21
+ Length token_start_position;
22
+ Length token_end_position;
23
+
24
+ TSRange *included_ranges;
25
+ const char *chunk;
26
+ TSInput input;
27
+ TSLogger logger;
28
+
29
+ uint32_t included_range_count;
30
+ uint32_t current_included_range_index;
31
+ uint32_t chunk_start;
32
+ uint32_t chunk_size;
33
+ uint32_t lookahead_size;
34
+ bool did_get_column;
35
+ ColumnData column_data;
36
+
37
+ char debug_buffer[TREE_SITTER_SERIALIZATION_BUFFER_SIZE];
38
+ } Lexer;
39
+
40
+ void ts_lexer_init(Lexer *self);
41
+ void ts_lexer_delete(Lexer *self);
42
+ void ts_lexer_set_input(Lexer *self, TSInput input);
43
+ void ts_lexer_reset(Lexer *self, Length position);
44
+ void ts_lexer_start(Lexer *self);
45
+ void ts_lexer_finish(Lexer *self, uint32_t *lookahead_end_byte);
46
+ void ts_lexer_mark_end(Lexer *self);
47
+ bool ts_lexer_set_included_ranges(Lexer *self, const TSRange *ranges, uint32_t count);
48
+ TSRange *ts_lexer_included_ranges(const Lexer *self, uint32_t *count);
49
+
50
+ #ifdef __cplusplus
51
+ }
52
+ #endif
53
+
54
+ #endif // TREE_SITTER_LEXER_H_
@@ -0,0 +1,12 @@
1
+ #include "./alloc.c"
2
+ #include "./get_changed_ranges.c"
3
+ #include "./language.c"
4
+ #include "./lexer.c"
5
+ #include "./node.c"
6
+ #include "./parser.c"
7
+ #include "./query.c"
8
+ #include "./stack.c"
9
+ #include "./subtree.c"
10
+ #include "./tree_cursor.c"
11
+ #include "./tree.c"
12
+ #include "./wasm_store.c"