semantifold 0.1.1 → 0.3.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 (399) hide show
  1. package/README.md +42 -10
  2. package/build/index.d.ts +32 -3
  3. package/build/index.d.ts.map +1 -1
  4. package/build/index.js +99 -4
  5. package/build/src/acceptance.d.ts +32 -0
  6. package/build/src/acceptance.d.ts.map +1 -0
  7. package/build/src/acceptance.js +358 -0
  8. package/build/src/array.d.ts +7 -0
  9. package/build/src/array.d.ts.map +1 -0
  10. package/build/src/array.js +18 -0
  11. package/build/src/artifact-path.d.ts +13 -0
  12. package/build/src/artifact-path.d.ts.map +1 -0
  13. package/build/src/artifact-path.js +30 -0
  14. package/build/src/artifacts.d.ts +7 -0
  15. package/build/src/artifacts.d.ts.map +1 -0
  16. package/build/src/artifacts.js +389 -0
  17. package/build/src/backends/c-runtime.d.ts +3 -0
  18. package/build/src/backends/c-runtime.d.ts.map +1 -0
  19. package/build/src/backends/c-runtime.js +151 -0
  20. package/build/src/backends/c-validation.d.ts +12 -0
  21. package/build/src/backends/c-validation.d.ts.map +1 -0
  22. package/build/src/backends/c-validation.js +85 -0
  23. package/build/src/backends/c.d.ts +31 -0
  24. package/build/src/backends/c.d.ts.map +1 -0
  25. package/build/src/backends/c.js +308 -0
  26. package/build/src/backends/cpp-runtime.d.ts +3 -0
  27. package/build/src/backends/cpp-runtime.d.ts.map +1 -0
  28. package/build/src/backends/cpp-runtime.js +99 -0
  29. package/build/src/backends/cpp-validation.d.ts +9 -0
  30. package/build/src/backends/cpp-validation.d.ts.map +1 -0
  31. package/build/src/backends/cpp-validation.js +74 -0
  32. package/build/src/backends/cpp.d.ts +16 -0
  33. package/build/src/backends/cpp.d.ts.map +1 -0
  34. package/build/src/backends/cpp.js +285 -0
  35. package/build/src/backends/csharp.d.ts +20 -0
  36. package/build/src/backends/csharp.d.ts.map +1 -0
  37. package/build/src/backends/csharp.js +259 -0
  38. package/build/src/backends/go.d.ts +20 -0
  39. package/build/src/backends/go.d.ts.map +1 -0
  40. package/build/src/backends/go.js +374 -0
  41. package/build/src/backends/identifiers.d.ts +12 -0
  42. package/build/src/backends/identifiers.d.ts.map +1 -1
  43. package/build/src/backends/identifiers.js +79 -2
  44. package/build/src/backends/index.d.ts.map +1 -1
  45. package/build/src/backends/index.js +27 -37
  46. package/build/src/backends/native-validation.d.ts +9 -0
  47. package/build/src/backends/native-validation.d.ts.map +1 -0
  48. package/build/src/backends/native-validation.js +59 -0
  49. package/build/src/backends/ordered-expressions.d.ts +74 -0
  50. package/build/src/backends/ordered-expressions.d.ts.map +1 -0
  51. package/build/src/backends/ordered-expressions.js +159 -0
  52. package/build/src/backends/python.d.ts +8 -0
  53. package/build/src/backends/python.d.ts.map +1 -0
  54. package/build/src/backends/python.js +162 -0
  55. package/build/src/backends/scalars.d.ts.map +1 -1
  56. package/build/src/backends/scalars.js +8 -2
  57. package/build/src/backends/shared.d.ts.map +1 -1
  58. package/build/src/backends/shared.js +67 -19
  59. package/build/src/binary-mapping.d.ts +32 -0
  60. package/build/src/binary-mapping.d.ts.map +1 -0
  61. package/build/src/binary-mapping.js +285 -0
  62. package/build/src/diagnostic.d.ts +36 -4
  63. package/build/src/diagnostic.d.ts.map +1 -1
  64. package/build/src/diagnostic.js +42 -3
  65. package/build/src/frontends/c-parser.d.ts +20 -0
  66. package/build/src/frontends/c-parser.d.ts.map +1 -0
  67. package/build/src/frontends/c-parser.js +14 -0
  68. package/build/src/frontends/c.d.ts +220 -0
  69. package/build/src/frontends/c.d.ts.map +1 -0
  70. package/build/src/frontends/c.js +750 -0
  71. package/build/src/frontends/cpp-parser.d.ts +11 -0
  72. package/build/src/frontends/cpp-parser.d.ts.map +1 -0
  73. package/build/src/frontends/cpp-parser.js +15 -0
  74. package/build/src/frontends/cpp.d.ts +227 -0
  75. package/build/src/frontends/cpp.d.ts.map +1 -0
  76. package/build/src/frontends/cpp.js +784 -0
  77. package/build/src/frontends/csharp.d.ts +14 -0
  78. package/build/src/frontends/csharp.d.ts.map +1 -0
  79. package/build/src/frontends/csharp.js +708 -0
  80. package/build/src/frontends/go.d.ts +15 -0
  81. package/build/src/frontends/go.d.ts.map +1 -0
  82. package/build/src/frontends/go.js +712 -0
  83. package/build/src/frontends/index.d.ts.map +1 -1
  84. package/build/src/frontends/index.js +5 -23
  85. package/build/src/frontends/python.d.ts +14 -0
  86. package/build/src/frontends/python.d.ts.map +1 -0
  87. package/build/src/frontends/python.js +615 -0
  88. package/build/src/frontends/scalars.d.ts.map +1 -1
  89. package/build/src/frontends/scalars.js +21 -1
  90. package/build/src/language-registry.d.ts +113 -0
  91. package/build/src/language-registry.d.ts.map +1 -0
  92. package/build/src/language-registry.js +421 -0
  93. package/build/src/mapping.js +3 -2
  94. package/build/src/semantic/location.d.ts +7 -0
  95. package/build/src/semantic/location.d.ts.map +1 -1
  96. package/build/src/semantic/location.js +10 -1
  97. package/build/src/semantic/provenance.js +3 -3
  98. package/build/src/semantic/types.d.ts +399 -2
  99. package/build/src/semantic/types.d.ts.map +1 -1
  100. package/build/src/semantic/types.js +110 -2
  101. package/build/src/subprocess.d.ts +38 -0
  102. package/build/src/subprocess.d.ts.map +1 -0
  103. package/build/src/subprocess.js +233 -0
  104. package/build/src/timeout.d.ts +8 -0
  105. package/build/src/timeout.d.ts.map +1 -0
  106. package/build/src/timeout.js +11 -0
  107. package/build/src/toolchains.d.ts +107 -0
  108. package/build/src/toolchains.d.ts.map +1 -0
  109. package/build/src/toolchains.js +417 -0
  110. package/docs/architecture.md +23 -5
  111. package/docs/c.md +60 -0
  112. package/docs/cpp.md +61 -0
  113. package/docs/goals.md +4 -2
  114. package/docs/language-support.md +46 -6
  115. package/docs/parser-qualification.md +219 -0
  116. package/docs/plans/2026-09-05-standard-library-portability.md +46 -0
  117. package/docs/source-maps.md +38 -5
  118. package/docs/standard-library-portability.md +190 -0
  119. package/docs/testing.md +131 -3
  120. package/index.js +109 -4
  121. package/node_modules/node-addon-api/LICENSE.md +9 -0
  122. package/node_modules/node-addon-api/README.md +95 -0
  123. package/node_modules/node-addon-api/common.gypi +21 -0
  124. package/node_modules/node-addon-api/except.gypi +25 -0
  125. package/node_modules/node-addon-api/index.js +14 -0
  126. package/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  127. package/node_modules/node-addon-api/napi-inl.h +7250 -0
  128. package/node_modules/node-addon-api/napi.h +3463 -0
  129. package/node_modules/node-addon-api/node_addon_api.gyp +42 -0
  130. package/node_modules/node-addon-api/node_api.gyp +9 -0
  131. package/node_modules/node-addon-api/noexcept.gypi +26 -0
  132. package/node_modules/node-addon-api/nothing.c +0 -0
  133. package/node_modules/node-addon-api/package-support.json +21 -0
  134. package/node_modules/node-addon-api/package.json +481 -0
  135. package/node_modules/node-addon-api/tools/README.md +73 -0
  136. package/node_modules/node-addon-api/tools/check-napi.js +99 -0
  137. package/node_modules/node-addon-api/tools/clang-format.js +71 -0
  138. package/node_modules/node-addon-api/tools/conversion.js +301 -0
  139. package/node_modules/node-gyp-build/LICENSE +21 -0
  140. package/node_modules/node-gyp-build/README.md +58 -0
  141. package/node_modules/node-gyp-build/SECURITY.md +5 -0
  142. package/node_modules/node-gyp-build/bin.js +84 -0
  143. package/node_modules/node-gyp-build/build-test.js +19 -0
  144. package/node_modules/node-gyp-build/index.js +6 -0
  145. package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  146. package/node_modules/node-gyp-build/optional.js +7 -0
  147. package/node_modules/node-gyp-build/package.json +43 -0
  148. package/node_modules/semantifold-tree-sitter-legacy-internal/LICENSE +15 -0
  149. package/node_modules/semantifold-tree-sitter-legacy-internal/README.md +7 -0
  150. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/LICENSE +21 -0
  151. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/README.md +90 -0
  152. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/binding.gyp +79 -0
  153. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/index.js +895 -0
  154. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/package.json +62 -0
  155. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  156. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  157. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  158. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  159. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/addon_data.h +47 -0
  160. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/binding.cc +35 -0
  161. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/conversions.cc +140 -0
  162. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/conversions.h +22 -0
  163. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/language.cc +106 -0
  164. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/language.h +17 -0
  165. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/logger.cc +70 -0
  166. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/logger.h +19 -0
  167. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  168. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  169. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/node.cc +1056 -0
  170. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/node.h +30 -0
  171. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/parser.cc +298 -0
  172. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/parser.h +35 -0
  173. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/query.cc +383 -0
  174. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/query.h +39 -0
  175. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree.cc +307 -0
  176. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree.h +45 -0
  177. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  178. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  179. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/tree-sitter.d.ts +211 -0
  180. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1266 -0
  181. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  182. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  183. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +290 -0
  184. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  185. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  186. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  187. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
  188. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  189. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  190. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +221 -0
  191. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +299 -0
  192. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  193. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +419 -0
  194. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
  195. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +14 -0
  196. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +774 -0
  197. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2151 -0
  198. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +230 -0
  199. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
  200. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4134 -0
  201. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  202. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  203. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
  204. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  205. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1060 -0
  206. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +382 -0
  207. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +165 -0
  208. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  209. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +714 -0
  210. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  211. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  212. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  213. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  214. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  215. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  216. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  217. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  218. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  219. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  220. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +50 -0
  221. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +23 -0
  222. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
  223. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1294 -0
  224. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1823 -0
  225. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  226. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/LICENSE +21 -0
  227. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/README.md +18 -0
  228. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/binding.gyp +29 -0
  229. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/binding.cc +20 -0
  230. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/binding_test.js +9 -0
  231. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/index.d.ts +28 -0
  232. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/bindings/node/index.js +11 -0
  233. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/grammar.js +1470 -0
  234. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/package.json +60 -0
  235. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/darwin-arm64/tree-sitter-c.node +0 -0
  236. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/darwin-x64/tree-sitter-c.node +0 -0
  237. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/linux-arm64/tree-sitter-c.node +0 -0
  238. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/linux-x64/tree-sitter-c.node +0 -0
  239. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/win32-arm64/tree-sitter-c.node +0 -0
  240. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/prebuilds/win32-x64/tree-sitter-c.node +0 -0
  241. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/queries/highlights.scm +81 -0
  242. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/queries/tags.scm +9 -0
  243. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/grammar.json +9735 -0
  244. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/node-types.json +4614 -0
  245. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/parser.c +119615 -0
  246. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/alloc.h +54 -0
  247. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/array.h +290 -0
  248. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/src/tree_sitter/parser.h +266 -0
  249. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/tree-sitter-c.wasm +0 -0
  250. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-c/tree-sitter.json +43 -0
  251. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/LICENSE +21 -0
  252. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/README.md +22 -0
  253. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/binding.gyp +30 -0
  254. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/binding.cc +20 -0
  255. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/binding_test.js +9 -0
  256. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/index.d.ts +28 -0
  257. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/bindings/node/index.js +11 -0
  258. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/grammar.js +1436 -0
  259. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/package.json +61 -0
  260. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/darwin-arm64/tree-sitter-cpp.node +0 -0
  261. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/darwin-x64/tree-sitter-cpp.node +0 -0
  262. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/linux-arm64/tree-sitter-cpp.node +0 -0
  263. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/linux-x64/tree-sitter-cpp.node +0 -0
  264. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/win32-arm64/tree-sitter-cpp.node +0 -0
  265. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/prebuilds/win32-x64/tree-sitter-cpp.node +0 -0
  266. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/highlights.scm +70 -0
  267. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/injections.scm +3 -0
  268. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/queries/tags.scm +15 -0
  269. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/grammar.json +17084 -0
  270. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/node-types.json +7997 -0
  271. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/parser.c +530368 -0
  272. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/scanner.c +148 -0
  273. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/alloc.h +54 -0
  274. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/array.h +290 -0
  275. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/src/tree_sitter/parser.h +266 -0
  276. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/tree-sitter-cpp.wasm +0 -0
  277. package/node_modules/semantifold-tree-sitter-legacy-internal/node_modules/tree-sitter-cpp/tree-sitter.json +55 -0
  278. package/node_modules/semantifold-tree-sitter-legacy-internal/package.json +22 -0
  279. package/node_modules/semantifold-tree-sitter-legacy-internal/src/c.js +152 -0
  280. package/node_modules/tree-sitter/LICENSE +21 -0
  281. package/node_modules/tree-sitter/README.md +128 -0
  282. package/node_modules/tree-sitter/binding.gyp +88 -0
  283. package/node_modules/tree-sitter/index.js +950 -0
  284. package/node_modules/tree-sitter/package.json +76 -0
  285. package/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  286. package/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  287. package/node_modules/tree-sitter/prebuilds/linux-arm64/tree-sitter.node +0 -0
  288. package/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  289. package/node_modules/tree-sitter/prebuilds/win32-arm64/tree-sitter.node +0 -0
  290. package/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  291. package/node_modules/tree-sitter/src/addon_data.h +47 -0
  292. package/node_modules/tree-sitter/src/binding.cc +35 -0
  293. package/node_modules/tree-sitter/src/conversions.cc +140 -0
  294. package/node_modules/tree-sitter/src/conversions.h +22 -0
  295. package/node_modules/tree-sitter/src/language.cc +105 -0
  296. package/node_modules/tree-sitter/src/language.h +17 -0
  297. package/node_modules/tree-sitter/src/logger.cc +70 -0
  298. package/node_modules/tree-sitter/src/logger.h +19 -0
  299. package/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  300. package/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  301. package/node_modules/tree-sitter/src/node.cc +1088 -0
  302. package/node_modules/tree-sitter/src/node.h +30 -0
  303. package/node_modules/tree-sitter/src/parser.cc +332 -0
  304. package/node_modules/tree-sitter/src/parser.h +35 -0
  305. package/node_modules/tree-sitter/src/query.cc +425 -0
  306. package/node_modules/tree-sitter/src/query.h +40 -0
  307. package/node_modules/tree-sitter/src/tree.cc +316 -0
  308. package/node_modules/tree-sitter/src/tree.h +45 -0
  309. package/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  310. package/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  311. package/node_modules/tree-sitter/tree-sitter.d.ts +1083 -0
  312. package/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1478 -0
  313. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  314. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  315. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +291 -0
  316. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  317. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  318. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
  319. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +523 -0
  320. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
  321. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  322. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +293 -0
  323. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +293 -0
  324. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  325. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +483 -0
  326. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +54 -0
  327. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +12 -0
  328. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +875 -0
  329. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2297 -0
  330. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +286 -0
  331. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +48 -0
  332. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/portable/endian.h +241 -0
  333. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4347 -0
  334. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
  335. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
  336. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +912 -0
  337. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +133 -0
  338. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1034 -0
  339. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +399 -0
  340. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +170 -0
  341. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  342. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +716 -0
  343. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
  344. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/ts_assert.h +11 -0
  345. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
  346. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  347. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
  348. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
  349. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
  350. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
  351. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
  352. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
  353. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
  354. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +75 -0
  355. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +24 -0
  356. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +137 -0
  357. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1314 -0
  358. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1937 -0
  359. package/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
  360. package/package.json +24 -6
  361. package/src/acceptance.js +380 -0
  362. package/src/array.js +19 -0
  363. package/src/artifact-path.js +34 -0
  364. package/src/artifacts.js +420 -0
  365. package/src/backends/c-runtime.js +151 -0
  366. package/src/backends/c-validation.js +83 -0
  367. package/src/backends/c.js +308 -0
  368. package/src/backends/cpp-runtime.js +99 -0
  369. package/src/backends/cpp-validation.js +70 -0
  370. package/src/backends/cpp.js +285 -0
  371. package/src/backends/csharp.js +270 -0
  372. package/src/backends/go.js +383 -0
  373. package/src/backends/identifiers.js +80 -1
  374. package/src/backends/index.js +23 -32
  375. package/src/backends/native-validation.js +64 -0
  376. package/src/backends/ordered-expressions.js +161 -0
  377. package/src/backends/python.js +175 -0
  378. package/src/backends/scalars.js +8 -1
  379. package/src/backends/shared.js +64 -17
  380. package/src/binary-mapping.js +305 -0
  381. package/src/diagnostic.js +34 -2
  382. package/src/frontends/c-parser.js +17 -0
  383. package/src/frontends/c.js +780 -0
  384. package/src/frontends/cpp-parser.js +18 -0
  385. package/src/frontends/cpp.js +816 -0
  386. package/src/frontends/csharp.js +759 -0
  387. package/src/frontends/go.js +770 -0
  388. package/src/frontends/index.js +5 -20
  389. package/src/frontends/python.js +689 -0
  390. package/src/frontends/scalars.js +20 -0
  391. package/src/language-registry.js +454 -0
  392. package/src/mapping.js +2 -1
  393. package/src/semantic/location.js +10 -0
  394. package/src/semantic/provenance.js +2 -2
  395. package/src/semantic/types.js +124 -1
  396. package/src/subprocess.js +232 -0
  397. package/src/timeout.js +12 -0
  398. package/src/toolchains.js +448 -0
  399. package/tsconfig.json +1 -0
@@ -0,0 +1,1083 @@
1
+ /** @module */
2
+ declare module "tree-sitter" {
3
+ class Parser {
4
+ /**
5
+ * Parse UTF8 text into a syntax tree.
6
+ *
7
+ * @param input - The text to parse, either as a string or a custom input function
8
+ * that provides text chunks. If providing a function, it should return text chunks
9
+ * based on byte index and position.
10
+ *
11
+ * @param oldTree - An optional previous syntax tree from the same document.
12
+ * If provided and the document has changed, you must first edit this tree using
13
+ * {@link Parser.Tree.edit} to match the new text.
14
+ *
15
+ * @param options - Optional parsing settings:
16
+ * - bufferSize: Size of internal parsing buffer
17
+ * - includedRanges: Array of ranges to parse within the input
18
+ * - progressCallback: A callback that receives the current parse state
19
+ *
20
+ * @returns A syntax tree representing the parsed text
21
+ *
22
+ * @throws May fail if no language has been set or parsing was halted.
23
+ */
24
+ parse(input: string | Parser.Input, oldTree?: Parser.Tree | null, options?: Parser.Options): Parser.Tree;
25
+
26
+ /**
27
+ * Get the ranges of text that the parser will include when parsing.
28
+ *
29
+ * @returns An array of ranges that will be included in parsing
30
+ */
31
+ getIncludedRanges(): Parser.Range[];
32
+
33
+ /**
34
+ * Get the duration in microseconds that parsing is allowed to take.
35
+ *
36
+ * This timeout can be set via {@link Parser.setTimeoutMicros}.
37
+ *
38
+ * @returns The parsing timeout in microseconds
39
+ *
40
+ * @deprecated Use the {@link progressCallback}
41
+ */
42
+ getTimeoutMicros(): number;
43
+
44
+ /**
45
+ * Set the maximum duration that parsing is allowed to take before halting.
46
+ *
47
+ * If parsing takes longer than this, it will halt early, returning null.
48
+ *
49
+ * @param timeout - The maximum parsing duration in microseconds
50
+ *
51
+ * @deprecated Use the {@link progressCallback}
52
+ */
53
+ setTimeoutMicros(timeout: number): void;
54
+
55
+ /**
56
+ * Instruct the parser to start the next parse from the beginning.
57
+ *
58
+ * If the parser previously failed, it will resume where it left off
59
+ * on the next parse by default. Call this method if you want to parse
60
+ * a different document instead of resuming.
61
+ */
62
+ reset(): void;
63
+
64
+ /**
65
+ * Get the parser's current language
66
+ */
67
+ getLanguage(): Parser.Language;
68
+
69
+ /**
70
+ * Set the language that the parser should use for parsing.
71
+ *
72
+ * The language must be compatible with the version of tree-sitter
73
+ * being used. A version mismatch will prevent the language from
74
+ * being assigned successfully.
75
+ *
76
+ * @param language - The language to use for parsing
77
+ */
78
+ setLanguage(language?: Parser.Language): void;
79
+
80
+ /**
81
+ * Get the parser's current logger
82
+ *
83
+ * @returns The current logging callback
84
+ */
85
+ getLogger(): Parser.Logger;
86
+
87
+ /**
88
+ * Set the logging callback that the parser should use during parsing.
89
+ *
90
+ * @param logFunc - The logging callback to use, or null/false to disable logging
91
+ */
92
+ setLogger(logFunc?: Parser.Logger | string | false | null): void;
93
+
94
+ /**
95
+ * Set the destination to which the parser should write debugging graphs during parsing.
96
+ *
97
+ * The graphs are formatted in the DOT language. You may want to pipe these graphs
98
+ * directly to a 'dot' process to generate SVG output.
99
+ *
100
+ * @param enabled - Whether to enable or disable graph output
101
+ * @param fd - Optional file descriptor for the output
102
+ */
103
+ printDotGraphs(enabled?: boolean, fd?: number): void;
104
+ }
105
+
106
+ namespace Parser {
107
+ /** Configuration options for parsing */
108
+ export type Options = {
109
+ /** Size of the internal parsing buffer */
110
+ bufferSize?: number;
111
+
112
+ /** Array of ranges to include when parsing the input */
113
+ includedRanges?: Range[];
114
+
115
+ /**
116
+ * A callback that receives the parse state during parsing.
117
+ *
118
+ * @param index - The byte offset in the document that the parser is currently at
119
+ * @param hasError - Indicates whether the parser has encountered an error during parsing
120
+ *
121
+ * @returns `true` to stop parsing or `false` to continue
122
+ */
123
+ progressCallback?: (index: number, hasError: boolean) => boolean;
124
+ };
125
+
126
+ /**
127
+ * A position in a multi-line text document, in terms of rows and columns.
128
+ * Both values are zero-based.
129
+ */
130
+ export type Point = {
131
+ /** Zero-based row number */
132
+ row: number;
133
+
134
+ /** Zero-based column number */
135
+ column: number;
136
+ };
137
+
138
+ /**
139
+ * A range of positions in a multi-line text document, specified both in
140
+ * terms of byte offsets and row/column positions.
141
+ */
142
+ export type Range = {
143
+ /** The byte offset of the start of the range */
144
+ startIndex: number;
145
+
146
+ /** The byte offset of the end of the range */
147
+ endIndex: number;
148
+
149
+ /** The row and column where the range starts */
150
+ startPosition: Point;
151
+
152
+ /** The row and column where the range ends */
153
+ endPosition: Point;
154
+ };
155
+
156
+ /**
157
+ * A summary of a change to a text document
158
+ */
159
+ export type Edit = {
160
+ /** The byte offset where the edit starts */
161
+ startIndex: number;
162
+
163
+ /** The byte offset where the edit ends in the old document */
164
+ oldEndIndex: number;
165
+
166
+ /** The byte offset where the edit ends in the new document */
167
+ newEndIndex: number;
168
+
169
+ /** The row and column where the edit starts */
170
+ startPosition: Point;
171
+
172
+ /** The row and column where the edit ends in the old document */
173
+ oldEndPosition: Point;
174
+
175
+ /** The row and column where the edit ends in the new document */
176
+ newEndPosition: Point;
177
+ };
178
+
179
+ /**
180
+ * A callback that receives log messages during parsing.
181
+ *
182
+ * @param message - The log message
183
+ * @param params - Parameters associated with the log message
184
+ * @param type - The type of log message
185
+ */
186
+ export type Logger = (
187
+ message: string,
188
+ params: { [param: string]: string },
189
+ type: "parse" | "lex"
190
+ ) => void;
191
+
192
+ /** A function that provides text content for parsing based on byte index and position */
193
+ export interface Input {
194
+ /**
195
+ * Get a chunk of text at the given byte offset.
196
+ *
197
+ * @param index - The byte index into the text
198
+ * @param position - Optional position in the text as {row, column}
199
+ * @returns A string chunk, or null/undefined if no text at this index
200
+ */
201
+ (index: number, position?: Point): string | null | undefined;
202
+ }
203
+
204
+ /** The syntax tree that contains this node */
205
+ export interface SyntaxNode {
206
+ /** The syntax tree that contains this node */
207
+ readonly tree: Tree;
208
+
209
+ /**
210
+ * A unique numeric identifier for this node.
211
+ * Within a given syntax tree, no two nodes have the same id.
212
+ * If a new tree is created based on an older tree and reuses
213
+ * a node, that node will have the same id in both trees.
214
+ */
215
+ readonly id: number;
216
+
217
+ /**
218
+ * This node's type as a numeric id
219
+ */
220
+ readonly typeId: number;
221
+
222
+ /**
223
+ * This node's type as a numeric id as it appears in the grammar,
224
+ * ignoring aliases
225
+ */
226
+ readonly grammarId: number;
227
+
228
+ /**
229
+ * This node's type as a string
230
+ */
231
+ readonly type: string;
232
+
233
+ /**
234
+ * This node's symbol name as it appears in the grammar,
235
+ * ignoring aliases
236
+ */
237
+ readonly grammarType: string;
238
+
239
+ /**
240
+ * Whether this node is named.
241
+ * Named nodes correspond to named rules in the grammar,
242
+ * whereas anonymous nodes correspond to string literals in the grammar.
243
+ */
244
+ readonly isNamed: boolean;
245
+
246
+ /**
247
+ * Whether this node is missing.
248
+ * Missing nodes are inserted by the parser in order to
249
+ * recover from certain kinds of syntax errors.
250
+ */
251
+ readonly isMissing: boolean;
252
+
253
+ /**
254
+ * Whether this node is extra.
255
+ * Extra nodes represent things like comments, which are not
256
+ * required by the grammar but can appear anywhere.
257
+ */
258
+ readonly isExtra: boolean;
259
+
260
+ /**
261
+ * Whether this node has been edited
262
+ */
263
+ readonly hasChanges: boolean;
264
+
265
+ /**
266
+ * Whether this node represents a syntax error or contains
267
+ * any syntax errors within it
268
+ */
269
+ readonly hasError: boolean;
270
+
271
+ /**
272
+ * Whether this node represents a syntax error.
273
+ * Syntax errors represent parts of the code that could not
274
+ * be incorporated into a valid syntax tree.
275
+ */
276
+ readonly isError: boolean;
277
+
278
+ /** The text content for this node from the source code */
279
+ readonly text: string;
280
+
281
+ /** The parse state of this node */
282
+ readonly parseState: number;
283
+
284
+ /** The parse state that follows this node */
285
+ readonly nextParseState: number;
286
+
287
+ /** The position where this node starts in terms of rows and columns */
288
+ readonly startPosition: Point;
289
+
290
+ /** The position where this node ends in terms of rows and columns */
291
+ readonly endPosition: Point;
292
+
293
+ /** The byte offset where this node starts */
294
+ readonly startIndex: number;
295
+
296
+ /** The byte offset where this node ends */
297
+ readonly endIndex: number;
298
+
299
+ /**
300
+ * This node's immediate parent.
301
+ * For iterating over ancestors, prefer using {@link childWithDescendant}
302
+ */
303
+ readonly parent: SyntaxNode | null;
304
+
305
+ /** Array of all child nodes */
306
+ readonly children: Array<SyntaxNode>;
307
+
308
+ /** Array of all named child nodes */
309
+ readonly namedChildren: Array<SyntaxNode>;
310
+
311
+ /** The number of children this node has */
312
+ readonly childCount: number;
313
+
314
+ /**
315
+ * The number of named children this node has.
316
+ * @see {@link isNamed}
317
+ */
318
+ readonly namedChildCount: number;
319
+
320
+ /** The first child of this node */
321
+ readonly firstChild: SyntaxNode | null;
322
+
323
+ /** The first named child of this node */
324
+ readonly firstNamedChild: SyntaxNode | null;
325
+
326
+ /** The last child of this node */
327
+ readonly lastChild: SyntaxNode | null;
328
+
329
+ /** The last child of this node */
330
+ readonly lastNamedChild: SyntaxNode | null;
331
+
332
+ /** This node's next sibling */
333
+ readonly nextSibling: SyntaxNode | null;
334
+
335
+ /** This node's next named sibling */
336
+ readonly nextNamedSibling: SyntaxNode | null;
337
+
338
+ /** This node's previous sibling */
339
+ readonly previousSibling: SyntaxNode | null;
340
+
341
+ /** This node's previous named sibling */
342
+ readonly previousNamedSibling: SyntaxNode | null;
343
+
344
+ /**
345
+ * The number of descendants this node has, including itself
346
+ */
347
+ readonly descendantCount: number;
348
+
349
+ /**
350
+ * The names of extra fields available in the subclass, if any.
351
+ */
352
+ readonly fields: Array<`${string}Node` | `${string}Nodes`>;
353
+
354
+ /**
355
+ * Convert this node to its string representation
356
+ */
357
+ toString(): string;
358
+
359
+ /**
360
+ * Convert this node to its JSON representation
361
+ */
362
+ toJSON(): object;
363
+
364
+ /**
365
+ * Get the node's child at the given index, where zero represents the first child.
366
+ *
367
+ * Note: While fairly fast, this method's cost is technically log(i).
368
+ * For iterating over many children, prefer using the children array.
369
+ *
370
+ * @param index - Zero-based index of the child to retrieve
371
+ * @returns The child node, or null if none exists at the given index
372
+ */
373
+ child(index: number): SyntaxNode | null;
374
+
375
+ /**
376
+ * Get this node's named child at the given index.
377
+ *
378
+ * Note: While fairly fast, this method's cost is technically log(i).
379
+ * For iterating over many children, prefer using the namedChildren array.
380
+ *
381
+ * @param index - Zero-based index of the named child to retrieve
382
+ * @returns The named child node, or null if none exists at the given index
383
+ */
384
+ namedChild(index: number): SyntaxNode | null;
385
+
386
+ /**
387
+ * Get the first child with the given field name.
388
+ *
389
+ * For fields that may have multiple children, use childrenForFieldName instead.
390
+ *
391
+ * @param fieldName - The field name to search for
392
+ * @returns The child node, or null if no child has the given field name
393
+ */
394
+ childForFieldName(fieldName: string): SyntaxNode | null;
395
+
396
+ /**
397
+ * Get this node's child with the given numerical field id.
398
+ *
399
+ * Field IDs can be obtained from field names using the parser's language object.
400
+ *
401
+ * @param fieldId - The field ID to search for
402
+ * @returns The child node, or null if no child has the given field ID
403
+ */
404
+ childForFieldId(fieldId: number): SyntaxNode | null;
405
+
406
+ /**
407
+ * Get the field name of the child at the given index
408
+ *
409
+ * @param childIndex - Zero-based index of the child
410
+ * @returns The field name, or null if the child has no field name
411
+ */
412
+ fieldNameForChild(childIndex: number): string | null;
413
+
414
+ /**
415
+ * Get the field name of the named child at the given index
416
+ *
417
+ * @param namedChildIndex - Zero-based index of the named child
418
+ * @returns The field name, or null if the named child has no field name
419
+ */
420
+ fieldNameForNamedChild(namedChildIndex: number): string | null;
421
+
422
+ /**
423
+ * Get all children that have the given field name
424
+ *
425
+ * @param fieldName - The field name to search for
426
+ * @returns Array of child nodes with the given field name
427
+ */
428
+ childrenForFieldName(fieldName: string): Array<SyntaxNode>;
429
+
430
+ /**
431
+ * Get all children that have the given field ID
432
+ *
433
+ * @param fieldId - The field ID to search for
434
+ * @returns Array of child nodes with the given field ID
435
+ */
436
+ childrenForFieldId(fieldId: number): Array<SyntaxNode>;
437
+
438
+ /**
439
+ * Get the node's first child that extends beyond the given byte offset
440
+ *
441
+ * @param index - The byte offset to search from
442
+ * @returns The first child extending beyond the offset, or null if none found
443
+ */
444
+ firstChildForIndex(index: number): SyntaxNode | null;
445
+
446
+ /**
447
+ * Get the node's first named child that extends beyond the given byte offset
448
+ *
449
+ * @param index - The byte offset to search from
450
+ * @returns The first named child extending beyond the offset, or null if none found
451
+ */
452
+ firstNamedChildForIndex(index: number): SyntaxNode | null;
453
+
454
+ /**
455
+ * Get the immediate child that contains the given descendant node.
456
+ * Note that this can return the descendant itself if it is an immediate child.
457
+ *
458
+ * @param descendant - The descendant node to find the parent of
459
+ * @returns The child containing the descendant, or null if not found
460
+ */
461
+ childWithDescendant(descendant: SyntaxNode): SyntaxNode | null;
462
+
463
+ /**
464
+ * Get the smallest node within this node that spans the given byte offset.
465
+ *
466
+ * @param index - The byte offset to search for
467
+ * @returns The smallest node spanning the offset
468
+ */
469
+ descendantForIndex(index: number): SyntaxNode;
470
+
471
+ /**
472
+ * Get the smallest node within this node that spans the given byte range.
473
+ *
474
+ * @param startIndex - The starting byte offset
475
+ * @param endIndex - The ending byte offset
476
+ * @returns The smallest node spanning the range
477
+ */
478
+ descendantForIndex(startIndex: number, endIndex: number): SyntaxNode;
479
+
480
+ /**
481
+ * Get the smallest named node within this node that spans the given byte offset.
482
+ *
483
+ * @param index - The byte offset to search for
484
+ * @returns The smallest named node spanning the offset
485
+ */
486
+ namedDescendantForIndex(index: number): SyntaxNode;
487
+
488
+ /**
489
+ * Get the smallest named node within this node that spans the given byte range.
490
+ *
491
+ * @param startIndex - The starting byte offset
492
+ * @param endIndex - The ending byte offset
493
+ * @returns The smallest named node spanning the range
494
+ */
495
+ namedDescendantForIndex(startIndex: number, endIndex: number): SyntaxNode;
496
+
497
+ /**
498
+ * Get the smallest node within this node that spans the given position.
499
+ * When only one position is provided, it's used as both start and end.
500
+ *
501
+ * @param position - The point to search for
502
+ * @returns The smallest node spanning the position
503
+ */
504
+ descendantForPosition(position: Point): SyntaxNode;
505
+
506
+ /**
507
+ * Get the smallest node within this node that spans the given position range.
508
+ *
509
+ * @param startPosition - The starting position
510
+ * @param endPosition - The ending position
511
+ * @returns The smallest node spanning the range
512
+ */
513
+ descendantForPosition(startPosition: Point, endPosition: Point): SyntaxNode;
514
+
515
+ /**
516
+ * Get the smallest named node within this node that spans the given position.
517
+ * When only one position is provided, it's used as both start and end.
518
+ *
519
+ * @param position - The point to search for
520
+ * @returns The smallest named node spanning the position
521
+ */
522
+ namedDescendantForPosition(position: Point): SyntaxNode;
523
+
524
+ /**
525
+ * Get the smallest named node within this node that spans the given position range.
526
+ *
527
+ * @param startPosition - The starting position
528
+ * @param endPosition - The ending position
529
+ * @returns The smallest named node spanning the range
530
+ */
531
+ namedDescendantForPosition(startPosition: Point, endPosition: Point): SyntaxNode;
532
+
533
+ /**
534
+ * Get all descendants of this node that have the given type(s)
535
+ *
536
+ * @param types - A string or array of strings of node types to find
537
+ * @param startPosition - Optional starting position to search from
538
+ * @param endPosition - Optional ending position to search to
539
+ * @returns Array of descendant nodes matching the given types
540
+ */
541
+ descendantsOfType(types: String | Array<String>, startPosition?: Point, endPosition?: Point): Array<SyntaxNode>;
542
+
543
+ /**
544
+ * Find the closest ancestor of the current node that matches the given type(s).
545
+ *
546
+ * Starting from the node's parent, walks up the tree until it finds a node
547
+ * whose type matches any of the given types.
548
+ *
549
+ * @example
550
+ * const property = tree.rootNode.descendantForIndex(5);
551
+ * // Find closest unary expression ancestor
552
+ * const unary = property.closest('unary_expression');
553
+ * // Find closest binary or call expression ancestor
554
+ * const expr = property.closest(['binary_expression', 'call_expression']);
555
+ *
556
+ * @param types - A string or array of strings representing the node types to search for
557
+ * @returns The closest matching ancestor node, or null if none found
558
+ * @throws If the argument is not a string or array of strings
559
+ */
560
+ closest(types: String | Array<String>): SyntaxNode | null;
561
+
562
+ /**
563
+ * Create a new TreeCursor starting from this node.
564
+ *
565
+ * @returns A new cursor positioned at this node
566
+ */
567
+ walk(): TreeCursor;
568
+
569
+ readonly [name: `${string}Node`]: SyntaxNode;
570
+
571
+ readonly [name: `${string}Nodes`]: Array<SyntaxNode>;
572
+ }
573
+
574
+ /** A stateful object for walking a syntax {@link Tree} efficiently */
575
+ export interface TreeCursor {
576
+ /** The type of the current node as a string */
577
+ nodeType: string;
578
+
579
+ /** The type of the current node as a numeric ID */
580
+ nodeTypeId: number;
581
+
582
+ /** The parse state of the current node */
583
+ nodeStateId: number;
584
+
585
+ /** The text of the current node */
586
+ nodeText: string;
587
+
588
+ /** Whether the current node is named */
589
+ nodeIsNamed: boolean;
590
+
591
+ /** Whether the current node is missing from the source code */
592
+ nodeIsMissing: boolean;
593
+
594
+ /** The start position of the current node */
595
+ startPosition: Point;
596
+
597
+ /** The end position of the current node */
598
+ endPosition: Point;
599
+
600
+ /** The start byte index of the current node */
601
+ startIndex: number;
602
+
603
+ /** The end byte index of the current node */
604
+ endIndex: number;
605
+
606
+ /** The current node that the cursor is pointing to */
607
+ readonly currentNode: SyntaxNode;
608
+
609
+ /** The field name of the current node */
610
+ readonly currentFieldName: string;
611
+
612
+ /** The numerical field ID of the current node */
613
+ readonly currentFieldId: number;
614
+
615
+ /** The depth of the current node relative to the node where the cursor was created */
616
+ readonly currentDepth: number;
617
+
618
+ /** The index of the current node among all descendants of the original node */
619
+ readonly currentDescendantIndex: number;
620
+
621
+ /**
622
+ * Re-initialize this cursor to start at a new node
623
+ *
624
+ * @param node - The node to start from
625
+ */
626
+ reset(node: SyntaxNode): void;
627
+
628
+ /**
629
+ * Re-initialize this cursor to the same position as another cursor.
630
+ * Unlike reset(), this will not lose parent information and allows
631
+ * reusing already created cursors.
632
+ *
633
+ * @param cursor - The cursor to copy the position from
634
+ */
635
+ resetTo(cursor: TreeCursor): void;
636
+
637
+ /**
638
+ * Move this cursor to the parent of its current node.
639
+ *
640
+ * @returns true if cursor successfully moved, false if there was no parent
641
+ * (cursor was already at the root node)
642
+ */
643
+ gotoParent(): boolean;
644
+
645
+ /**
646
+ * Move this cursor to the first child of its current node.
647
+ *
648
+ * @returns true if cursor successfully moved, false if there were no children
649
+ */
650
+ gotoFirstChild(): boolean;
651
+
652
+ /**
653
+ * Move this cursor to the last child of its current node.
654
+ * Note: This may be slower than gotoFirstChild() as it needs to iterate
655
+ * through all children to compute the position.
656
+ *
657
+ * @returns true if cursor successfully moved, false if there were no children
658
+ */
659
+ gotoLastChild(): boolean;
660
+
661
+ /**
662
+ * Move this cursor to the first child that extends beyond the given byte offset
663
+ *
664
+ * @param goalIndex - The byte offset to search for
665
+ * @returns true if a child was found and cursor moved, false otherwise
666
+ */
667
+ gotoFirstChildForIndex(goalIndex: number): boolean;
668
+
669
+ /**
670
+ * Move this cursor to the first child that extends beyond the given position
671
+ *
672
+ * @param goalPosition - The position to search for
673
+ * @returns true if a child was found and cursor moved, false otherwise
674
+ */
675
+ gotoFirstChildForPosition(goalPosition: Point): boolean;
676
+
677
+ /**
678
+ * Move this cursor to the next sibling of its current node
679
+ *
680
+ * @returns true if cursor successfully moved, false if there was no next sibling
681
+ */
682
+ gotoNextSibling(): boolean;
683
+
684
+ /**
685
+ * Move this cursor to the previous sibling of its current node.
686
+ * Note: This may be slower than gotoNextSibling() due to how node positions
687
+ * are stored. In the worst case, it will need to iterate through all previous
688
+ * siblings to recalculate positions.
689
+ *
690
+ * @returns true if cursor successfully moved, false if there was no previous sibling
691
+ */
692
+ gotoPreviousSibling(): boolean;
693
+
694
+ /**
695
+ * Move the cursor to the descendant node at the given index, where zero
696
+ * represents the original node the cursor was created with.
697
+ *
698
+ * @param goalDescendantIndex - The index of the descendant to move to
699
+ */
700
+ gotoDescendant(goalDescendantIndex: number): void;
701
+ }
702
+
703
+ /**
704
+ * A tree that represents the syntactic structure of a source code file.
705
+ */
706
+ export interface Tree {
707
+ /**
708
+ * The root node of the syntax tree
709
+ */
710
+ readonly rootNode: SyntaxNode;
711
+
712
+ /**
713
+ * Get the root node of the syntax tree, but with its position shifted
714
+ * forward by the given offset.
715
+ *
716
+ * @param offsetBytes - The number of bytes to shift by
717
+ * @param offsetExtent - The number of rows/columns to shift by
718
+ * @returns The root node with its position offset
719
+ */
720
+ rootNodeWithOffset(offsetBytes: number, offsetExtent: Point): SyntaxNode;
721
+
722
+ /**
723
+ * Edit the syntax tree to keep it in sync with source code that has been edited.
724
+ * The edit must be described both in terms of byte offsets and in terms of
725
+ * row/column coordinates.
726
+ *
727
+ * @param edit - The edit to apply to the tree
728
+ * @returns The edited tree
729
+ */
730
+ edit(edit: Edit): Tree;
731
+
732
+ /**
733
+ * Create a new TreeCursor starting from the root of the tree.
734
+ *
735
+ * @returns A new cursor positioned at the root node
736
+ */
737
+ walk(): TreeCursor;
738
+
739
+ /**
740
+ * Get the text for a node within this tree
741
+ *
742
+ * @param node - The syntax node to get text for
743
+ * @returns The source text for the node
744
+ */
745
+ getText(node: SyntaxNode): string;
746
+
747
+ /**
748
+ * Compare this edited syntax tree to a new syntax tree representing the
749
+ * same document, returning ranges whose syntactic structure has changed.
750
+ *
751
+ * For this to work correctly, this tree must have been edited to match
752
+ * the new tree's ranges. Generally, you'll want to call this right after
753
+ * parsing, using the old tree that was passed to parse and the new tree
754
+ * that was returned.
755
+ *
756
+ * @param other - The new tree to compare against
757
+ * @returns Array of ranges that have changed
758
+ */
759
+ getChangedRanges(other: Tree): Range[];
760
+
761
+ /**
762
+ * Get the ranges that were included when parsing this syntax tree
763
+ *
764
+ * @returns Array of included ranges
765
+ */
766
+ getIncludedRanges(): Range[];
767
+
768
+ /**
769
+ * Get the range that was edited in this tree
770
+ *
771
+ * @returns The edited range
772
+ */
773
+ getEditedRange(): Range;
774
+
775
+ /**
776
+ * Print a graph of the tree in the DOT language.
777
+ * You may want to pipe this to a 'dot' process to generate SVG output.
778
+ *
779
+ * @param fd - Optional file descriptor for the output
780
+ */
781
+ printDotGraph(fd?: number): void;
782
+ }
783
+
784
+ /**
785
+ * A particular syntax node that was captured by a named pattern in a query.
786
+ */
787
+ export interface QueryCapture {
788
+ /** The name that was used to capture the node in the query */
789
+ name: string;
790
+
791
+ /** The captured syntax node */
792
+ node: SyntaxNode;
793
+ }
794
+
795
+ /**
796
+ * A match of a {@link Query} to a particular set of {@link SyntaxNode}s.
797
+ */
798
+ export interface QueryMatch {
799
+ /**
800
+ * The index of the pattern that was matched.
801
+ * Each pattern in a query is assigned a numeric index in sequence.
802
+ */
803
+ pattern: number;
804
+
805
+ /** Array of nodes that were captured in the pattern match */
806
+ captures: QueryCapture[];
807
+ }
808
+
809
+ export type QueryOptions = {
810
+ /** The starting row/column position in which the query will be executed. */
811
+ startPosition?: Point;
812
+
813
+ /** The ending row/column position in which the query will be executed. */
814
+ endPosition?: Point;
815
+
816
+ /** The starting byte offset in which the query will be executed. */
817
+ startIndex?: number;
818
+
819
+ /** The ending byte offset in which the query will be executed. */
820
+ endIndex?: number;
821
+
822
+ /** The maximum number of in-progress matches for this cursor. The limit must be > 0 and <= 65536. */
823
+ matchLimit?: number;
824
+
825
+ /**
826
+ * The maximum start depth for a query cursor.
827
+ *
828
+ * This prevents cursors from exploring children nodes at a certain depth.
829
+ * Note if a pattern includes many children, then they will still be
830
+ * checked.
831
+ *
832
+ * The zero max start depth value can be used as a special behavior and
833
+ * it helps to destructure a subtree by staying on a node and using
834
+ * captures for interested parts. Note that the zero max start depth
835
+ * only limit a search depth for a pattern's root node but other nodes
836
+ * that are parts of the pattern may be searched at any depth what
837
+ * defined by the pattern structure.
838
+ */
839
+ maxStartDepth?: number;
840
+
841
+ /**
842
+ * The maximum duration in microseconds that query execution should be allowed to
843
+ * take before halting.
844
+ *
845
+ * If query execution takes longer than this, it will halt early, returning None.
846
+ *
847
+ * @deprecated Use the {@link progressCallback}
848
+ */
849
+ timeoutMicros?: number;
850
+
851
+ /**
852
+ * A callback that receives the query state during execution.
853
+ *
854
+ * @param index - The current byte offset
855
+ *
856
+ * @returns `true` to stop the query or `false` to continue
857
+ */
858
+ progressCallback?: (index: number) => boolean;
859
+ };
860
+
861
+ export class Query {
862
+ /** The maximum number of in-progress matches for this cursor. */
863
+ readonly matchLimit: number;
864
+
865
+ /**
866
+ * Create a new query from a string containing one or more S-expression
867
+ * patterns.
868
+ *
869
+ * The query is associated with a particular language, and can only be run
870
+ * on syntax nodes parsed with that language. References to Queries can be
871
+ * shared between multiple threads.
872
+ */
873
+ constructor(language: Language, source: string | Buffer);
874
+
875
+ /**
876
+ * Iterate over all of the individual captures in the order that they
877
+ * appear.
878
+ *
879
+ * This is useful if you don't care about which pattern matched, and just
880
+ * want a single, ordered sequence of captures.
881
+ *
882
+ * @param node - The syntax node to query
883
+ * @param options - Optional query options
884
+ *
885
+ * @returns An array of captures
886
+ */
887
+ captures(node: SyntaxNode, options?: QueryOptions): QueryCapture[];
888
+
889
+ /**
890
+ * Iterate over all of the matches in the order that they were found.
891
+ *
892
+ * Each match contains the index of the pattern that matched, and a list of
893
+ * captures. Because multiple patterns can match the same set of nodes,
894
+ * one match may contain captures that appear *before* some of the
895
+ * captures from a previous match.
896
+ *
897
+ * @param node - The syntax node to query
898
+ * @param options - Optional query options
899
+ *
900
+ * @returns An array of matches
901
+ */
902
+ matches(node: SyntaxNode, options?: QueryOptions): QueryMatch[];
903
+
904
+ /**
905
+ * Disable a certain capture within a query.
906
+ *
907
+ * This prevents the capture from being returned in matches, and also
908
+ * avoids any resource usage associated with recording the capture.
909
+ *
910
+ * @param captureName - The name of the capture to disable
911
+ */
912
+ disableCapture(captureName: string): void;
913
+
914
+ /**
915
+ * Disable a certain pattern within a query.
916
+ *
917
+ * This prevents the pattern from matching, and also avoids any resource
918
+ * usage associated with the pattern.
919
+ *
920
+ * @param patternIndex - The index of the pattern to disable
921
+ */
922
+ disablePattern(patternIndex: number): void;
923
+
924
+ /**
925
+ * Check if a given step in a query is 'definite'.
926
+ *
927
+ * A query step is 'definite' if its parent pattern will be guaranteed to
928
+ * match successfully once it reaches the step.
929
+ *
930
+ * @param byteOffset - The byte offset of the step to check
931
+ */
932
+ isPatternGuaranteedAtStep(byteOffset: number): boolean;
933
+
934
+ /**
935
+ * Check if a given pattern within a query has a single root node.
936
+ *
937
+ * @param patternIndex - The index of the pattern to check
938
+ */
939
+ isPatternRooted(patternIndex: number): boolean;
940
+
941
+ /**
942
+ * Check if a given pattern within a query has a single root node.
943
+ *
944
+ * @param patternIndex - The index of the pattern to check
945
+ */
946
+ isPatternNonLocal(patternIndex: number): boolean;
947
+
948
+ /**
949
+ * Get the byte offset where the given pattern starts in the query's
950
+ * source.
951
+ *
952
+ * @param patternIndex - The index of the pattern to check
953
+ *
954
+ * @returns The byte offset where the pattern starts
955
+ */
956
+ startIndexForPattern(patternIndex: number): number;
957
+
958
+ /**
959
+ * Get the byte offset where the given pattern ends in the query's
960
+ * source.
961
+ *
962
+ * @param patternIndex - The index of the pattern to check
963
+ *
964
+ * @returns The byte offset where the pattern ends
965
+ */
966
+ endIndexForPattern(patternIndex: number): number;
967
+
968
+ /**
969
+ * Check if, on its last execution, this cursor exceeded its maximum number
970
+ * of in-progress matches.
971
+ *
972
+ * @returns true if the cursor exceeded its match limit
973
+ */
974
+ didExceedMatchLimit(): boolean;
975
+ }
976
+
977
+ export class LookaheadIterator {
978
+ /** The current symbol of the lookahead iterator. */
979
+ readonly currentTypeId: number;
980
+
981
+ /** The current symbol name of the lookahead iterator. */
982
+ readonly currentType: string;
983
+
984
+ /**
985
+ * Create a new lookahead iterator for this language and parse state.
986
+ *
987
+ * This returns `null` if the state is invalid for this language.
988
+ *
989
+ * Iterating {@link LookaheadIterator} will yield valid symbols in the given
990
+ * parse state. Newly created lookahead iterators will have {@link currentType}
991
+ * populated with the `ERROR` symbol.
992
+ *
993
+ * Lookahead iterators can be useful to generate suggestions and improve
994
+ * syntax error diagnostics. To get symbols valid in an ERROR node, use the
995
+ * lookahead iterator on its first leaf node state. For `MISSING` nodes, a
996
+ * lookahead iterator created on the previous non-extra leaf node may be
997
+ * appropriate.
998
+ *
999
+ * @param language - The language to use for the lookahead iterator
1000
+ * @param state - The parse state to use for the lookahead iterator
1001
+ */
1002
+ constructor(language: Language, state: number);
1003
+
1004
+ /**
1005
+ * Reset the lookahead iterator.
1006
+ *
1007
+ * This returns `true` if the language was set successfully and `false`
1008
+ * otherwise.
1009
+ *
1010
+ * @param language - The language to use for the lookahead iterator
1011
+ * @param stateId - The parse state to use for the lookahead iterator
1012
+ */
1013
+ reset(language: Language, stateId: number): boolean;
1014
+
1015
+ /**
1016
+ * Reset the lookahead iterator to another state.
1017
+ *
1018
+ * This returns `true` if the iterator was reset to the given state and
1019
+ * `false` otherwise.
1020
+ *
1021
+ * @param stateId - The parse state to reset the lookahead iterator to
1022
+ */
1023
+ resetState(stateId: number): boolean;
1024
+
1025
+ /**
1026
+ * Get an iterator for the lookahead iterator.
1027
+ *
1028
+ * This allows the lookahead iterator to be used in a for-of loop,
1029
+ * iterating over the valid symbols in the current parse state.
1030
+ *
1031
+ * @returns An iterator over the symbol names
1032
+ */
1033
+ [Symbol.iterator](): Iterator<string>;
1034
+ }
1035
+
1036
+ /** The base node type */
1037
+ type BaseNode = {
1038
+ /** The node's type */
1039
+ type: string;
1040
+ /** Whether the node is named */
1041
+ named: boolean;
1042
+ };
1043
+
1044
+ /** A child within a node */
1045
+ type ChildNode = {
1046
+ /** Whether the child is repeated */
1047
+ multiple: boolean;
1048
+ /** Whether the child is required */
1049
+ required: boolean;
1050
+ /** The child's type */
1051
+ types: BaseNode[];
1052
+ };
1053
+
1054
+ /** Information about a language's node types */
1055
+ type NodeInfo =
1056
+ | (BaseNode & {
1057
+ /** The subtypes of this node if it's a supertype */
1058
+ subtypes: BaseNode[];
1059
+ })
1060
+ | (BaseNode & {
1061
+ /** The fields within this node */
1062
+ fields: { [name: string]: ChildNode };
1063
+ /** The child nodes of this node */
1064
+ children: ChildNode[];
1065
+ });
1066
+
1067
+ /** Information about a language */
1068
+ interface Language {
1069
+ /**
1070
+ * The name of the language
1071
+ *
1072
+ * @deprecated
1073
+ */
1074
+ name?: string;
1075
+ /** The inner language object */
1076
+ language: unknown;
1077
+ /** The node type information of the language */
1078
+ nodeTypeInfo: NodeInfo[];
1079
+ }
1080
+ }
1081
+
1082
+ export = Parser
1083
+ }