@coana-tech/cli 14.12.76 → 14.12.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.mjs +1 -1
- package/package.json +1 -1
- package/reachability-analyzers-cli.mjs +1 -1
- package/repos/coana-tech/alucard/alucard.jar +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/cli.mjs +24669 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/LICENSE.md +9 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/README.md +95 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/common.gypi +21 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/except.gypi +25 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/index.js +14 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/napi-inl.h +6941 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/napi.h +3295 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/node_addon_api.gyp +42 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/node_api.gyp +9 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/noexcept.gypi +26 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/nothing.c +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/package-support.json +21 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/package.json +480 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/README.md +73 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/check-napi.js +99 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/clang-format.js +71 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/conversion.js +301 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/LICENSE +21 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/README.md +58 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/SECURITY.md +5 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/bin.js +84 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/build-test.js +19 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/index.js +6 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/optional.js +7 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/package.json +43 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/LICENSE +21 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/README.md +128 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/binding.gyp +80 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/index.js +919 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/node_modules/.bin/node-gyp-build +16 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/node_modules/.bin/node-gyp-build-optional +16 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/node_modules/.bin/node-gyp-build-test +16 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/package.json +76 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/linux-arm64/tree-sitter.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/win32-arm64/tree-sitter.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/addon_data.h +47 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/binding.cc +35 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/conversions.cc +140 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/conversions.h +22 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/language.cc +106 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/language.h +17 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/logger.cc +70 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/logger.h +19 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/node.cc +1088 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/node.h +30 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/parser.cc +306 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/parser.h +35 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/query.cc +397 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/query.h +40 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree.cc +316 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree.h +45 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree_cursor.h +52 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/tree-sitter.d.ts +1042 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/include/tree_sitter/api.h +1318 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +291 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/error_costs.h +11 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.c +501 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/get_changed_ranges.h +36 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +223 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +297 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +435 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +12 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +920 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2165 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +266 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/portable/endian.h +206 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4187 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reduce_action.h +34 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/reusable_node.h +95 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +130 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1066 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +399 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +170 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.c +712 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree_cursor.h +48 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/ts_assert.h +11 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ICU_SHA +1 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/README.md +29 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/ptypes.h +1 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/umachine.h +448 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/urename.h +1 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf.h +1 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf16.h +733 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/utf8.h +881 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +83 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib-symbols.txt +24 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/stdlib.c +109 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm/wasm-stdlib.h +1302 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.c +1859 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/wasm_store.h +31 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/LICENSE +22 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/README.md +21 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/binding.gyp +30 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/binding.cc +20 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/binding_test.js +9 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/index.d.ts +28 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/index.js +11 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/grammar.js +1281 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/node_modules/.bin/node-gyp-build +16 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/node_modules/.bin/node-gyp-build-optional +16 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/node_modules/.bin/node-gyp-build-test +16 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/package.json +77 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/prebuilds/darwin-arm64/tree-sitter-ruby.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/prebuilds/darwin-x64/tree-sitter-ruby.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/prebuilds/linux-arm64/tree-sitter-ruby.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/prebuilds/linux-x64/tree-sitter-ruby.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/prebuilds/win32-arm64/tree-sitter-ruby.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/prebuilds/win32-x64/tree-sitter-ruby.node +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/queries/highlights.scm +154 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/queries/locals.scm +27 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/queries/tags.scm +64 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/grammar.json +8364 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/node-types.json +4108 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/parser.c +471247 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/scanner.c +1107 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/tree_sitter/alloc.h +54 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/tree_sitter/array.h +290 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/tree_sitter/parser.h +266 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/tree-sitter-ruby.wasm +0 -0
- package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/tree-sitter.json +46 -0
- package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
|
@@ -0,0 +1,1318 @@
|
|
|
1
|
+
#ifndef TREE_SITTER_API_H_
|
|
2
|
+
#define TREE_SITTER_API_H_
|
|
3
|
+
|
|
4
|
+
#ifndef TREE_SITTER_HIDE_SYMBOLS
|
|
5
|
+
#if defined(__GNUC__) || defined(__clang__)
|
|
6
|
+
#pragma GCC visibility push(default)
|
|
7
|
+
#endif
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#include <stdlib.h>
|
|
11
|
+
#include <stdint.h>
|
|
12
|
+
#include <stdbool.h>
|
|
13
|
+
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
extern "C" {
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
/****************************/
|
|
19
|
+
/* Section - ABI Versioning */
|
|
20
|
+
/****************************/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The latest ABI version that is supported by the current version of the
|
|
24
|
+
* library. When Languages are generated by the Tree-sitter CLI, they are
|
|
25
|
+
* assigned an ABI version number that corresponds to the current CLI version.
|
|
26
|
+
* The Tree-sitter library is generally backwards-compatible with languages
|
|
27
|
+
* generated using older CLI versions, but is not forwards-compatible.
|
|
28
|
+
*/
|
|
29
|
+
#define TREE_SITTER_LANGUAGE_VERSION 14
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The earliest ABI version that is supported by the current version of the
|
|
33
|
+
* library.
|
|
34
|
+
*/
|
|
35
|
+
#define TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION 13
|
|
36
|
+
|
|
37
|
+
/*******************/
|
|
38
|
+
/* Section - Types */
|
|
39
|
+
/*******************/
|
|
40
|
+
|
|
41
|
+
typedef uint16_t TSStateId;
|
|
42
|
+
typedef uint16_t TSSymbol;
|
|
43
|
+
typedef uint16_t TSFieldId;
|
|
44
|
+
typedef struct TSLanguage TSLanguage;
|
|
45
|
+
typedef struct TSParser TSParser;
|
|
46
|
+
typedef struct TSTree TSTree;
|
|
47
|
+
typedef struct TSQuery TSQuery;
|
|
48
|
+
typedef struct TSQueryCursor TSQueryCursor;
|
|
49
|
+
typedef struct TSLookaheadIterator TSLookaheadIterator;
|
|
50
|
+
|
|
51
|
+
typedef enum TSInputEncoding {
|
|
52
|
+
TSInputEncodingUTF8,
|
|
53
|
+
TSInputEncodingUTF16LE,
|
|
54
|
+
TSInputEncodingUTF16BE,
|
|
55
|
+
} TSInputEncoding;
|
|
56
|
+
|
|
57
|
+
typedef enum TSSymbolType {
|
|
58
|
+
TSSymbolTypeRegular,
|
|
59
|
+
TSSymbolTypeAnonymous,
|
|
60
|
+
TSSymbolTypeSupertype,
|
|
61
|
+
TSSymbolTypeAuxiliary,
|
|
62
|
+
} TSSymbolType;
|
|
63
|
+
|
|
64
|
+
typedef struct TSPoint {
|
|
65
|
+
uint32_t row;
|
|
66
|
+
uint32_t column;
|
|
67
|
+
} TSPoint;
|
|
68
|
+
|
|
69
|
+
typedef struct TSRange {
|
|
70
|
+
TSPoint start_point;
|
|
71
|
+
TSPoint end_point;
|
|
72
|
+
uint32_t start_byte;
|
|
73
|
+
uint32_t end_byte;
|
|
74
|
+
} TSRange;
|
|
75
|
+
|
|
76
|
+
typedef struct TSInput {
|
|
77
|
+
void *payload;
|
|
78
|
+
const char *(*read)(void *payload, uint32_t byte_index, TSPoint position, uint32_t *bytes_read);
|
|
79
|
+
TSInputEncoding encoding;
|
|
80
|
+
} TSInput;
|
|
81
|
+
|
|
82
|
+
typedef enum TSLogType {
|
|
83
|
+
TSLogTypeParse,
|
|
84
|
+
TSLogTypeLex,
|
|
85
|
+
} TSLogType;
|
|
86
|
+
|
|
87
|
+
typedef struct TSLogger {
|
|
88
|
+
void *payload;
|
|
89
|
+
void (*log)(void *payload, TSLogType log_type, const char *buffer);
|
|
90
|
+
} TSLogger;
|
|
91
|
+
|
|
92
|
+
typedef struct TSInputEdit {
|
|
93
|
+
uint32_t start_byte;
|
|
94
|
+
uint32_t old_end_byte;
|
|
95
|
+
uint32_t new_end_byte;
|
|
96
|
+
TSPoint start_point;
|
|
97
|
+
TSPoint old_end_point;
|
|
98
|
+
TSPoint new_end_point;
|
|
99
|
+
} TSInputEdit;
|
|
100
|
+
|
|
101
|
+
typedef struct TSNode {
|
|
102
|
+
uint32_t context[4];
|
|
103
|
+
const void *id;
|
|
104
|
+
const TSTree *tree;
|
|
105
|
+
} TSNode;
|
|
106
|
+
|
|
107
|
+
typedef struct TSTreeCursor {
|
|
108
|
+
const void *tree;
|
|
109
|
+
const void *id;
|
|
110
|
+
uint32_t context[3];
|
|
111
|
+
} TSTreeCursor;
|
|
112
|
+
|
|
113
|
+
typedef struct TSQueryCapture {
|
|
114
|
+
TSNode node;
|
|
115
|
+
uint32_t index;
|
|
116
|
+
} TSQueryCapture;
|
|
117
|
+
|
|
118
|
+
typedef enum TSQuantifier {
|
|
119
|
+
TSQuantifierZero = 0, // must match the array initialization value
|
|
120
|
+
TSQuantifierZeroOrOne,
|
|
121
|
+
TSQuantifierZeroOrMore,
|
|
122
|
+
TSQuantifierOne,
|
|
123
|
+
TSQuantifierOneOrMore,
|
|
124
|
+
} TSQuantifier;
|
|
125
|
+
|
|
126
|
+
typedef struct TSQueryMatch {
|
|
127
|
+
uint32_t id;
|
|
128
|
+
uint16_t pattern_index;
|
|
129
|
+
uint16_t capture_count;
|
|
130
|
+
const TSQueryCapture *captures;
|
|
131
|
+
} TSQueryMatch;
|
|
132
|
+
|
|
133
|
+
typedef enum TSQueryPredicateStepType {
|
|
134
|
+
TSQueryPredicateStepTypeDone,
|
|
135
|
+
TSQueryPredicateStepTypeCapture,
|
|
136
|
+
TSQueryPredicateStepTypeString,
|
|
137
|
+
} TSQueryPredicateStepType;
|
|
138
|
+
|
|
139
|
+
typedef struct TSQueryPredicateStep {
|
|
140
|
+
TSQueryPredicateStepType type;
|
|
141
|
+
uint32_t value_id;
|
|
142
|
+
} TSQueryPredicateStep;
|
|
143
|
+
|
|
144
|
+
typedef enum TSQueryError {
|
|
145
|
+
TSQueryErrorNone = 0,
|
|
146
|
+
TSQueryErrorSyntax,
|
|
147
|
+
TSQueryErrorNodeType,
|
|
148
|
+
TSQueryErrorField,
|
|
149
|
+
TSQueryErrorCapture,
|
|
150
|
+
TSQueryErrorStructure,
|
|
151
|
+
TSQueryErrorLanguage,
|
|
152
|
+
} TSQueryError;
|
|
153
|
+
|
|
154
|
+
/********************/
|
|
155
|
+
/* Section - Parser */
|
|
156
|
+
/********************/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Create a new parser.
|
|
160
|
+
*/
|
|
161
|
+
TSParser *ts_parser_new(void);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Delete the parser, freeing all of the memory that it used.
|
|
165
|
+
*/
|
|
166
|
+
void ts_parser_delete(TSParser *self);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get the parser's current language.
|
|
170
|
+
*/
|
|
171
|
+
const TSLanguage *ts_parser_language(const TSParser *self);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Set the language that the parser should use for parsing.
|
|
175
|
+
*
|
|
176
|
+
* Returns a boolean indicating whether or not the language was successfully
|
|
177
|
+
* assigned. True means assignment succeeded. False means there was a version
|
|
178
|
+
* mismatch: the language was generated with an incompatible version of the
|
|
179
|
+
* Tree-sitter CLI. Check the language's version using [`ts_language_version`]
|
|
180
|
+
* and compare it to this library's [`TREE_SITTER_LANGUAGE_VERSION`] and
|
|
181
|
+
* [`TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION`] constants.
|
|
182
|
+
*/
|
|
183
|
+
bool ts_parser_set_language(TSParser *self, const TSLanguage *language);
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Set the ranges of text that the parser should include when parsing.
|
|
187
|
+
*
|
|
188
|
+
* By default, the parser will always include entire documents. This function
|
|
189
|
+
* allows you to parse only a *portion* of a document but still return a syntax
|
|
190
|
+
* tree whose ranges match up with the document as a whole. You can also pass
|
|
191
|
+
* multiple disjoint ranges.
|
|
192
|
+
*
|
|
193
|
+
* The second and third parameters specify the location and length of an array
|
|
194
|
+
* of ranges. The parser does *not* take ownership of these ranges; it copies
|
|
195
|
+
* the data, so it doesn't matter how these ranges are allocated.
|
|
196
|
+
*
|
|
197
|
+
* If `count` is zero, then the entire document will be parsed. Otherwise,
|
|
198
|
+
* the given ranges must be ordered from earliest to latest in the document,
|
|
199
|
+
* and they must not overlap. That is, the following must hold for all:
|
|
200
|
+
*
|
|
201
|
+
* `i < count - 1`: `ranges[i].end_byte <= ranges[i + 1].start_byte`
|
|
202
|
+
*
|
|
203
|
+
* If this requirement is not satisfied, the operation will fail, the ranges
|
|
204
|
+
* will not be assigned, and this function will return `false`. On success,
|
|
205
|
+
* this function returns `true`
|
|
206
|
+
*/
|
|
207
|
+
bool ts_parser_set_included_ranges(
|
|
208
|
+
TSParser *self,
|
|
209
|
+
const TSRange *ranges,
|
|
210
|
+
uint32_t count
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Get the ranges of text that the parser will include when parsing.
|
|
215
|
+
*
|
|
216
|
+
* The returned pointer is owned by the parser. The caller should not free it
|
|
217
|
+
* or write to it. The length of the array will be written to the given
|
|
218
|
+
* `count` pointer.
|
|
219
|
+
*/
|
|
220
|
+
const TSRange *ts_parser_included_ranges(
|
|
221
|
+
const TSParser *self,
|
|
222
|
+
uint32_t *count
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Use the parser to parse some source code and create a syntax tree.
|
|
227
|
+
*
|
|
228
|
+
* If you are parsing this document for the first time, pass `NULL` for the
|
|
229
|
+
* `old_tree` parameter. Otherwise, if you have already parsed an earlier
|
|
230
|
+
* version of this document and the document has since been edited, pass the
|
|
231
|
+
* previous syntax tree so that the unchanged parts of it can be reused.
|
|
232
|
+
* This will save time and memory. For this to work correctly, you must have
|
|
233
|
+
* already edited the old syntax tree using the [`ts_tree_edit`] function in a
|
|
234
|
+
* way that exactly matches the source code changes.
|
|
235
|
+
*
|
|
236
|
+
* The [`TSInput`] parameter lets you specify how to read the text. It has the
|
|
237
|
+
* following three fields:
|
|
238
|
+
* 1. [`read`]: A function to retrieve a chunk of text at a given byte offset
|
|
239
|
+
* and (row, column) position. The function should return a pointer to the
|
|
240
|
+
* text and write its length to the [`bytes_read`] pointer. The parser does
|
|
241
|
+
* not take ownership of this buffer; it just borrows it until it has
|
|
242
|
+
* finished reading it. The function should write a zero value to the
|
|
243
|
+
* [`bytes_read`] pointer to indicate the end of the document.
|
|
244
|
+
* 2. [`payload`]: An arbitrary pointer that will be passed to each invocation
|
|
245
|
+
* of the [`read`] function.
|
|
246
|
+
* 3. [`encoding`]: An indication of how the text is encoded. Either
|
|
247
|
+
* `TSInputEncodingUTF8` or `TSInputEncodingUTF16`.
|
|
248
|
+
*
|
|
249
|
+
* This function returns a syntax tree on success, and `NULL` on failure. There
|
|
250
|
+
* are three possible reasons for failure:
|
|
251
|
+
* 1. The parser does not have a language assigned. Check for this using the
|
|
252
|
+
[`ts_parser_language`] function.
|
|
253
|
+
* 2. Parsing was cancelled due to a timeout that was set by an earlier call to
|
|
254
|
+
* the [`ts_parser_set_timeout_micros`] function. You can resume parsing from
|
|
255
|
+
* where the parser left out by calling [`ts_parser_parse`] again with the
|
|
256
|
+
* same arguments. Or you can start parsing from scratch by first calling
|
|
257
|
+
* [`ts_parser_reset`].
|
|
258
|
+
* 3. Parsing was cancelled using a cancellation flag that was set by an
|
|
259
|
+
* earlier call to [`ts_parser_set_cancellation_flag`]. You can resume parsing
|
|
260
|
+
* from where the parser left out by calling [`ts_parser_parse`] again with
|
|
261
|
+
* the same arguments.
|
|
262
|
+
*
|
|
263
|
+
* [`read`]: TSInput::read
|
|
264
|
+
* [`payload`]: TSInput::payload
|
|
265
|
+
* [`encoding`]: TSInput::encoding
|
|
266
|
+
* [`bytes_read`]: TSInput::read
|
|
267
|
+
*/
|
|
268
|
+
TSTree *ts_parser_parse(
|
|
269
|
+
TSParser *self,
|
|
270
|
+
const TSTree *old_tree,
|
|
271
|
+
TSInput input
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Use the parser to parse some source code stored in one contiguous buffer.
|
|
276
|
+
* The first two parameters are the same as in the [`ts_parser_parse`] function
|
|
277
|
+
* above. The second two parameters indicate the location of the buffer and its
|
|
278
|
+
* length in bytes.
|
|
279
|
+
*/
|
|
280
|
+
TSTree *ts_parser_parse_string(
|
|
281
|
+
TSParser *self,
|
|
282
|
+
const TSTree *old_tree,
|
|
283
|
+
const char *string,
|
|
284
|
+
uint32_t length
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Use the parser to parse some source code stored in one contiguous buffer with
|
|
289
|
+
* a given encoding. The first four parameters work the same as in the
|
|
290
|
+
* [`ts_parser_parse_string`] method above. The final parameter indicates whether
|
|
291
|
+
* the text is encoded as UTF8 or UTF16.
|
|
292
|
+
*/
|
|
293
|
+
TSTree *ts_parser_parse_string_encoding(
|
|
294
|
+
TSParser *self,
|
|
295
|
+
const TSTree *old_tree,
|
|
296
|
+
const char *string,
|
|
297
|
+
uint32_t length,
|
|
298
|
+
TSInputEncoding encoding
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Instruct the parser to start the next parse from the beginning.
|
|
303
|
+
*
|
|
304
|
+
* If the parser previously failed because of a timeout or a cancellation, then
|
|
305
|
+
* by default, it will resume where it left off on the next call to
|
|
306
|
+
* [`ts_parser_parse`] or other parsing functions. If you don't want to resume,
|
|
307
|
+
* and instead intend to use this parser to parse some other document, you must
|
|
308
|
+
* call [`ts_parser_reset`] first.
|
|
309
|
+
*/
|
|
310
|
+
void ts_parser_reset(TSParser *self);
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Set the maximum duration in microseconds that parsing should be allowed to
|
|
314
|
+
* take before halting.
|
|
315
|
+
*
|
|
316
|
+
* If parsing takes longer than this, it will halt early, returning NULL.
|
|
317
|
+
* See [`ts_parser_parse`] for more information.
|
|
318
|
+
*/
|
|
319
|
+
void ts_parser_set_timeout_micros(TSParser *self, uint64_t timeout_micros);
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Get the duration in microseconds that parsing is allowed to take.
|
|
323
|
+
*/
|
|
324
|
+
uint64_t ts_parser_timeout_micros(const TSParser *self);
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Set the parser's current cancellation flag pointer.
|
|
328
|
+
*
|
|
329
|
+
* If a non-null pointer is assigned, then the parser will periodically read
|
|
330
|
+
* from this pointer during parsing. If it reads a non-zero value, it will
|
|
331
|
+
* halt early, returning NULL. See [`ts_parser_parse`] for more information.
|
|
332
|
+
*/
|
|
333
|
+
void ts_parser_set_cancellation_flag(TSParser *self, const size_t *flag);
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Get the parser's current cancellation flag pointer.
|
|
337
|
+
*/
|
|
338
|
+
const size_t *ts_parser_cancellation_flag(const TSParser *self);
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Set the logger that a parser should use during parsing.
|
|
342
|
+
*
|
|
343
|
+
* The parser does not take ownership over the logger payload. If a logger was
|
|
344
|
+
* previously assigned, the caller is responsible for releasing any memory
|
|
345
|
+
* owned by the previous logger.
|
|
346
|
+
*/
|
|
347
|
+
void ts_parser_set_logger(TSParser *self, TSLogger logger);
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Get the parser's current logger.
|
|
351
|
+
*/
|
|
352
|
+
TSLogger ts_parser_logger(const TSParser *self);
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Set the file descriptor to which the parser should write debugging graphs
|
|
356
|
+
* during parsing. The graphs are formatted in the DOT language. You may want
|
|
357
|
+
* to pipe these graphs directly to a `dot(1)` process in order to generate
|
|
358
|
+
* SVG output. You can turn off this logging by passing a negative number.
|
|
359
|
+
*/
|
|
360
|
+
void ts_parser_print_dot_graphs(TSParser *self, int fd);
|
|
361
|
+
|
|
362
|
+
/******************/
|
|
363
|
+
/* Section - Tree */
|
|
364
|
+
/******************/
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Create a shallow copy of the syntax tree. This is very fast.
|
|
368
|
+
*
|
|
369
|
+
* You need to copy a syntax tree in order to use it on more than one thread at
|
|
370
|
+
* a time, as syntax trees are not thread safe.
|
|
371
|
+
*/
|
|
372
|
+
TSTree *ts_tree_copy(const TSTree *self);
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Delete the syntax tree, freeing all of the memory that it used.
|
|
376
|
+
*/
|
|
377
|
+
void ts_tree_delete(TSTree *self);
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Get the root node of the syntax tree.
|
|
381
|
+
*/
|
|
382
|
+
TSNode ts_tree_root_node(const TSTree *self);
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Get the root node of the syntax tree, but with its position
|
|
386
|
+
* shifted forward by the given offset.
|
|
387
|
+
*/
|
|
388
|
+
TSNode ts_tree_root_node_with_offset(
|
|
389
|
+
const TSTree *self,
|
|
390
|
+
uint32_t offset_bytes,
|
|
391
|
+
TSPoint offset_extent
|
|
392
|
+
);
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Get the language that was used to parse the syntax tree.
|
|
396
|
+
*/
|
|
397
|
+
const TSLanguage *ts_tree_language(const TSTree *self);
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Get the array of included ranges that was used to parse the syntax tree.
|
|
401
|
+
*
|
|
402
|
+
* The returned pointer must be freed by the caller.
|
|
403
|
+
*/
|
|
404
|
+
TSRange *ts_tree_included_ranges(const TSTree *self, uint32_t *length);
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Edit the syntax tree to keep it in sync with source code that has been
|
|
408
|
+
* edited.
|
|
409
|
+
*
|
|
410
|
+
* You must describe the edit both in terms of byte offsets and in terms of
|
|
411
|
+
* (row, column) coordinates.
|
|
412
|
+
*/
|
|
413
|
+
void ts_tree_edit(TSTree *self, const TSInputEdit *edit);
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Compare an old edited syntax tree to a new syntax tree representing the same
|
|
417
|
+
* document, returning an array of ranges whose syntactic structure has changed.
|
|
418
|
+
*
|
|
419
|
+
* For this to work correctly, the old syntax tree must have been edited such
|
|
420
|
+
* that its ranges match up to the new tree. Generally, you'll want to call
|
|
421
|
+
* this function right after calling one of the [`ts_parser_parse`] functions.
|
|
422
|
+
* You need to pass the old tree that was passed to parse, as well as the new
|
|
423
|
+
* tree that was returned from that function.
|
|
424
|
+
*
|
|
425
|
+
* The returned array is allocated using `malloc` and the caller is responsible
|
|
426
|
+
* for freeing it using `free`. The length of the array will be written to the
|
|
427
|
+
* given `length` pointer.
|
|
428
|
+
*/
|
|
429
|
+
TSRange *ts_tree_get_changed_ranges(
|
|
430
|
+
const TSTree *old_tree,
|
|
431
|
+
const TSTree *new_tree,
|
|
432
|
+
uint32_t *length
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Write a DOT graph describing the syntax tree to the given file.
|
|
437
|
+
*/
|
|
438
|
+
void ts_tree_print_dot_graph(const TSTree *self, int file_descriptor);
|
|
439
|
+
|
|
440
|
+
/******************/
|
|
441
|
+
/* Section - Node */
|
|
442
|
+
/******************/
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Get the node's type as a null-terminated string.
|
|
446
|
+
*/
|
|
447
|
+
const char *ts_node_type(TSNode self);
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Get the node's type as a numerical id.
|
|
451
|
+
*/
|
|
452
|
+
TSSymbol ts_node_symbol(TSNode self);
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Get the node's language.
|
|
456
|
+
*/
|
|
457
|
+
const TSLanguage *ts_node_language(TSNode self);
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Get the node's type as it appears in the grammar ignoring aliases as a
|
|
461
|
+
* null-terminated string.
|
|
462
|
+
*/
|
|
463
|
+
const char *ts_node_grammar_type(TSNode self);
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Get the node's type as a numerical id as it appears in the grammar ignoring
|
|
467
|
+
* aliases. This should be used in [`ts_language_next_state`] instead of
|
|
468
|
+
* [`ts_node_symbol`].
|
|
469
|
+
*/
|
|
470
|
+
TSSymbol ts_node_grammar_symbol(TSNode self);
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Get the node's start byte.
|
|
474
|
+
*/
|
|
475
|
+
uint32_t ts_node_start_byte(TSNode self);
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Get the node's start position in terms of rows and columns.
|
|
479
|
+
*/
|
|
480
|
+
TSPoint ts_node_start_point(TSNode self);
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Get the node's end byte.
|
|
484
|
+
*/
|
|
485
|
+
uint32_t ts_node_end_byte(TSNode self);
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Get the node's end position in terms of rows and columns.
|
|
489
|
+
*/
|
|
490
|
+
TSPoint ts_node_end_point(TSNode self);
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Get an S-expression representing the node as a string.
|
|
494
|
+
*
|
|
495
|
+
* This string is allocated with `malloc` and the caller is responsible for
|
|
496
|
+
* freeing it using `free`.
|
|
497
|
+
*/
|
|
498
|
+
char *ts_node_string(TSNode self);
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Check if the node is null. Functions like [`ts_node_child`] and
|
|
502
|
+
* [`ts_node_next_sibling`] will return a null node to indicate that no such node
|
|
503
|
+
* was found.
|
|
504
|
+
*/
|
|
505
|
+
bool ts_node_is_null(TSNode self);
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Check if the node is *named*. Named nodes correspond to named rules in the
|
|
509
|
+
* grammar, whereas *anonymous* nodes correspond to string literals in the
|
|
510
|
+
* grammar.
|
|
511
|
+
*/
|
|
512
|
+
bool ts_node_is_named(TSNode self);
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Check if the node is *missing*. Missing nodes are inserted by the parser in
|
|
516
|
+
* order to recover from certain kinds of syntax errors.
|
|
517
|
+
*/
|
|
518
|
+
bool ts_node_is_missing(TSNode self);
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Check if the node is *extra*. Extra nodes represent things like comments,
|
|
522
|
+
* which are not required the grammar, but can appear anywhere.
|
|
523
|
+
*/
|
|
524
|
+
bool ts_node_is_extra(TSNode self);
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Check if a syntax node has been edited.
|
|
528
|
+
*/
|
|
529
|
+
bool ts_node_has_changes(TSNode self);
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Check if the node is a syntax error or contains any syntax errors.
|
|
533
|
+
*/
|
|
534
|
+
bool ts_node_has_error(TSNode self);
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Check if the node is a syntax error.
|
|
538
|
+
*/
|
|
539
|
+
bool ts_node_is_error(TSNode self);
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Get this node's parse state.
|
|
543
|
+
*/
|
|
544
|
+
TSStateId ts_node_parse_state(TSNode self);
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Get the parse state after this node.
|
|
548
|
+
*/
|
|
549
|
+
TSStateId ts_node_next_parse_state(TSNode self);
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Get the node's immediate parent.
|
|
553
|
+
* Prefer [`ts_node_child_containing_descendant`] for
|
|
554
|
+
* iterating over the node's ancestors.
|
|
555
|
+
*/
|
|
556
|
+
TSNode ts_node_parent(TSNode self);
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* @deprecated use [`ts_node_contains_descendant`] instead, this will be removed in 0.25
|
|
560
|
+
*
|
|
561
|
+
* Get the node's child containing `descendant`. This will not return
|
|
562
|
+
* the descendant if it is a direct child of `self`, for that use
|
|
563
|
+
* `ts_node_contains_descendant`.
|
|
564
|
+
*/
|
|
565
|
+
TSNode ts_node_child_containing_descendant(TSNode self, TSNode descendant);
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Get the node that contains `descendant`.
|
|
569
|
+
*
|
|
570
|
+
* Note that this can return `descendant` itself, unlike the deprecated function
|
|
571
|
+
* [`ts_node_child_containing_descendant`].
|
|
572
|
+
*/
|
|
573
|
+
TSNode ts_node_child_with_descendant(TSNode self, TSNode descendant);
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Get the node's child at the given index, where zero represents the first
|
|
577
|
+
* child.
|
|
578
|
+
*/
|
|
579
|
+
TSNode ts_node_child(TSNode self, uint32_t child_index);
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Get the field name for node's child at the given index, where zero represents
|
|
583
|
+
* the first child. Returns NULL, if no field is found.
|
|
584
|
+
*/
|
|
585
|
+
const char *ts_node_field_name_for_child(TSNode self, uint32_t child_index);
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Get the field name for node's named child at the given index, where zero
|
|
589
|
+
* represents the first named child. Returns NULL, if no field is found.
|
|
590
|
+
*/
|
|
591
|
+
const char *ts_node_field_name_for_named_child(TSNode self, uint32_t named_child_index);
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Get the node's number of children.
|
|
595
|
+
*/
|
|
596
|
+
uint32_t ts_node_child_count(TSNode self);
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Get the node's *named* child at the given index.
|
|
600
|
+
*
|
|
601
|
+
* See also [`ts_node_is_named`].
|
|
602
|
+
*/
|
|
603
|
+
TSNode ts_node_named_child(TSNode self, uint32_t child_index);
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Get the node's number of *named* children.
|
|
607
|
+
*
|
|
608
|
+
* See also [`ts_node_is_named`].
|
|
609
|
+
*/
|
|
610
|
+
uint32_t ts_node_named_child_count(TSNode self);
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Get the node's child with the given field name.
|
|
614
|
+
*/
|
|
615
|
+
TSNode ts_node_child_by_field_name(
|
|
616
|
+
TSNode self,
|
|
617
|
+
const char *name,
|
|
618
|
+
uint32_t name_length
|
|
619
|
+
);
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Get the node's child with the given numerical field id.
|
|
623
|
+
*
|
|
624
|
+
* You can convert a field name to an id using the
|
|
625
|
+
* [`ts_language_field_id_for_name`] function.
|
|
626
|
+
*/
|
|
627
|
+
TSNode ts_node_child_by_field_id(TSNode self, TSFieldId field_id);
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Get the node's next / previous sibling.
|
|
631
|
+
*/
|
|
632
|
+
TSNode ts_node_next_sibling(TSNode self);
|
|
633
|
+
TSNode ts_node_prev_sibling(TSNode self);
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Get the node's next / previous *named* sibling.
|
|
637
|
+
*/
|
|
638
|
+
TSNode ts_node_next_named_sibling(TSNode self);
|
|
639
|
+
TSNode ts_node_prev_named_sibling(TSNode self);
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Get the node's first child that extends beyond the given byte offset.
|
|
643
|
+
*/
|
|
644
|
+
TSNode ts_node_first_child_for_byte(TSNode self, uint32_t byte);
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* Get the node's first named child that extends beyond the given byte offset.
|
|
648
|
+
*/
|
|
649
|
+
TSNode ts_node_first_named_child_for_byte(TSNode self, uint32_t byte);
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Get the node's number of descendants, including one for the node itself.
|
|
653
|
+
*/
|
|
654
|
+
uint32_t ts_node_descendant_count(TSNode self);
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Get the smallest node within this node that spans the given range of bytes
|
|
658
|
+
* or (row, column) positions.
|
|
659
|
+
*/
|
|
660
|
+
TSNode ts_node_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end);
|
|
661
|
+
TSNode ts_node_descendant_for_point_range(TSNode self, TSPoint start, TSPoint end);
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Get the smallest named node within this node that spans the given range of
|
|
665
|
+
* bytes or (row, column) positions.
|
|
666
|
+
*/
|
|
667
|
+
TSNode ts_node_named_descendant_for_byte_range(TSNode self, uint32_t start, uint32_t end);
|
|
668
|
+
TSNode ts_node_named_descendant_for_point_range(TSNode self, TSPoint start, TSPoint end);
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Edit the node to keep it in-sync with source code that has been edited.
|
|
672
|
+
*
|
|
673
|
+
* This function is only rarely needed. When you edit a syntax tree with the
|
|
674
|
+
* [`ts_tree_edit`] function, all of the nodes that you retrieve from the tree
|
|
675
|
+
* afterward will already reflect the edit. You only need to use [`ts_node_edit`]
|
|
676
|
+
* when you have a [`TSNode`] instance that you want to keep and continue to use
|
|
677
|
+
* after an edit.
|
|
678
|
+
*/
|
|
679
|
+
void ts_node_edit(TSNode *self, const TSInputEdit *edit);
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Check if two nodes are identical.
|
|
683
|
+
*/
|
|
684
|
+
bool ts_node_eq(TSNode self, TSNode other);
|
|
685
|
+
|
|
686
|
+
/************************/
|
|
687
|
+
/* Section - TreeCursor */
|
|
688
|
+
/************************/
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Create a new tree cursor starting from the given node.
|
|
692
|
+
*
|
|
693
|
+
* A tree cursor allows you to walk a syntax tree more efficiently than is
|
|
694
|
+
* possible using the [`TSNode`] functions. It is a mutable object that is always
|
|
695
|
+
* on a certain syntax node, and can be moved imperatively to different nodes.
|
|
696
|
+
*/
|
|
697
|
+
TSTreeCursor ts_tree_cursor_new(TSNode node);
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Delete a tree cursor, freeing all of the memory that it used.
|
|
701
|
+
*/
|
|
702
|
+
void ts_tree_cursor_delete(TSTreeCursor *self);
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Re-initialize a tree cursor to start at the original node that the cursor was
|
|
706
|
+
* constructed with.
|
|
707
|
+
*/
|
|
708
|
+
void ts_tree_cursor_reset(TSTreeCursor *self, TSNode node);
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Re-initialize a tree cursor to the same position as another cursor.
|
|
712
|
+
*
|
|
713
|
+
* Unlike [`ts_tree_cursor_reset`], this will not lose parent information and
|
|
714
|
+
* allows reusing already created cursors.
|
|
715
|
+
*/
|
|
716
|
+
void ts_tree_cursor_reset_to(TSTreeCursor *dst, const TSTreeCursor *src);
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Get the tree cursor's current node.
|
|
720
|
+
*/
|
|
721
|
+
TSNode ts_tree_cursor_current_node(const TSTreeCursor *self);
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Get the field name of the tree cursor's current node.
|
|
725
|
+
*
|
|
726
|
+
* This returns `NULL` if the current node doesn't have a field.
|
|
727
|
+
* See also [`ts_node_child_by_field_name`].
|
|
728
|
+
*/
|
|
729
|
+
const char *ts_tree_cursor_current_field_name(const TSTreeCursor *self);
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Get the field id of the tree cursor's current node.
|
|
733
|
+
*
|
|
734
|
+
* This returns zero if the current node doesn't have a field.
|
|
735
|
+
* See also [`ts_node_child_by_field_id`], [`ts_language_field_id_for_name`].
|
|
736
|
+
*/
|
|
737
|
+
TSFieldId ts_tree_cursor_current_field_id(const TSTreeCursor *self);
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Move the cursor to the parent of its current node.
|
|
741
|
+
*
|
|
742
|
+
* This returns `true` if the cursor successfully moved, and returns `false`
|
|
743
|
+
* if there was no parent node (the cursor was already on the root node).
|
|
744
|
+
*/
|
|
745
|
+
bool ts_tree_cursor_goto_parent(TSTreeCursor *self);
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Move the cursor to the next sibling of its current node.
|
|
749
|
+
*
|
|
750
|
+
* This returns `true` if the cursor successfully moved, and returns `false`
|
|
751
|
+
* if there was no next sibling node.
|
|
752
|
+
*/
|
|
753
|
+
bool ts_tree_cursor_goto_next_sibling(TSTreeCursor *self);
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Move the cursor to the previous sibling of its current node.
|
|
757
|
+
*
|
|
758
|
+
* This returns `true` if the cursor successfully moved, and returns `false` if
|
|
759
|
+
* there was no previous sibling node.
|
|
760
|
+
*
|
|
761
|
+
* Note, that this function may be slower than
|
|
762
|
+
* [`ts_tree_cursor_goto_next_sibling`] due to how node positions are stored. In
|
|
763
|
+
* the worst case, this will need to iterate through all the children upto the
|
|
764
|
+
* previous sibling node to recalculate its position.
|
|
765
|
+
*/
|
|
766
|
+
bool ts_tree_cursor_goto_previous_sibling(TSTreeCursor *self);
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Move the cursor to the first child of its current node.
|
|
770
|
+
*
|
|
771
|
+
* This returns `true` if the cursor successfully moved, and returns `false`
|
|
772
|
+
* if there were no children.
|
|
773
|
+
*/
|
|
774
|
+
bool ts_tree_cursor_goto_first_child(TSTreeCursor *self);
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Move the cursor to the last child of its current node.
|
|
778
|
+
*
|
|
779
|
+
* This returns `true` if the cursor successfully moved, and returns `false` if
|
|
780
|
+
* there were no children.
|
|
781
|
+
*
|
|
782
|
+
* Note that this function may be slower than [`ts_tree_cursor_goto_first_child`]
|
|
783
|
+
* because it needs to iterate through all the children to compute the child's
|
|
784
|
+
* position.
|
|
785
|
+
*/
|
|
786
|
+
bool ts_tree_cursor_goto_last_child(TSTreeCursor *self);
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Move the cursor to the node that is the nth descendant of
|
|
790
|
+
* the original node that the cursor was constructed with, where
|
|
791
|
+
* zero represents the original node itself.
|
|
792
|
+
*/
|
|
793
|
+
void ts_tree_cursor_goto_descendant(TSTreeCursor *self, uint32_t goal_descendant_index);
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Get the index of the cursor's current node out of all of the
|
|
797
|
+
* descendants of the original node that the cursor was constructed with.
|
|
798
|
+
*/
|
|
799
|
+
uint32_t ts_tree_cursor_current_descendant_index(const TSTreeCursor *self);
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Get the depth of the cursor's current node relative to the original
|
|
803
|
+
* node that the cursor was constructed with.
|
|
804
|
+
*/
|
|
805
|
+
uint32_t ts_tree_cursor_current_depth(const TSTreeCursor *self);
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Move the cursor to the first child of its current node that extends beyond
|
|
809
|
+
* the given byte offset or point.
|
|
810
|
+
*
|
|
811
|
+
* This returns the index of the child node if one was found, and returns -1
|
|
812
|
+
* if no such child was found.
|
|
813
|
+
*/
|
|
814
|
+
int64_t ts_tree_cursor_goto_first_child_for_byte(TSTreeCursor *self, uint32_t goal_byte);
|
|
815
|
+
int64_t ts_tree_cursor_goto_first_child_for_point(TSTreeCursor *self, TSPoint goal_point);
|
|
816
|
+
|
|
817
|
+
TSTreeCursor ts_tree_cursor_copy(const TSTreeCursor *cursor);
|
|
818
|
+
|
|
819
|
+
/*******************/
|
|
820
|
+
/* Section - Query */
|
|
821
|
+
/*******************/
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Create a new query from a string containing one or more S-expression
|
|
825
|
+
* patterns. The query is associated with a particular language, and can
|
|
826
|
+
* only be run on syntax nodes parsed with that language.
|
|
827
|
+
*
|
|
828
|
+
* If all of the given patterns are valid, this returns a [`TSQuery`].
|
|
829
|
+
* If a pattern is invalid, this returns `NULL`, and provides two pieces
|
|
830
|
+
* of information about the problem:
|
|
831
|
+
* 1. The byte offset of the error is written to the `error_offset` parameter.
|
|
832
|
+
* 2. The type of error is written to the `error_type` parameter.
|
|
833
|
+
*/
|
|
834
|
+
TSQuery *ts_query_new(
|
|
835
|
+
const TSLanguage *language,
|
|
836
|
+
const char *source,
|
|
837
|
+
uint32_t source_len,
|
|
838
|
+
uint32_t *error_offset,
|
|
839
|
+
TSQueryError *error_type
|
|
840
|
+
);
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Delete a query, freeing all of the memory that it used.
|
|
844
|
+
*/
|
|
845
|
+
void ts_query_delete(TSQuery *self);
|
|
846
|
+
|
|
847
|
+
/**
|
|
848
|
+
* Get the number of patterns, captures, or string literals in the query.
|
|
849
|
+
*/
|
|
850
|
+
uint32_t ts_query_pattern_count(const TSQuery *self);
|
|
851
|
+
uint32_t ts_query_capture_count(const TSQuery *self);
|
|
852
|
+
uint32_t ts_query_string_count(const TSQuery *self);
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Get the byte offset where the given pattern starts in the query's source.
|
|
856
|
+
*
|
|
857
|
+
* This can be useful when combining queries by concatenating their source
|
|
858
|
+
* code strings.
|
|
859
|
+
*/
|
|
860
|
+
uint32_t ts_query_start_byte_for_pattern(const TSQuery *self, uint32_t pattern_index);
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Get the byte offset where the given pattern ends in the query's source.
|
|
864
|
+
*
|
|
865
|
+
* This can be useful when combining queries by concatenating their source
|
|
866
|
+
* code strings.
|
|
867
|
+
*/
|
|
868
|
+
uint32_t ts_query_end_byte_for_pattern(const TSQuery *self, uint32_t pattern_index);
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Get all of the predicates for the given pattern in the query.
|
|
872
|
+
*
|
|
873
|
+
* The predicates are represented as a single array of steps. There are three
|
|
874
|
+
* types of steps in this array, which correspond to the three legal values for
|
|
875
|
+
* the `type` field:
|
|
876
|
+
* - `TSQueryPredicateStepTypeCapture` - Steps with this type represent names
|
|
877
|
+
* of captures. Their `value_id` can be used with the
|
|
878
|
+
* [`ts_query_capture_name_for_id`] function to obtain the name of the capture.
|
|
879
|
+
* - `TSQueryPredicateStepTypeString` - Steps with this type represent literal
|
|
880
|
+
* strings. Their `value_id` can be used with the
|
|
881
|
+
* [`ts_query_string_value_for_id`] function to obtain their string value.
|
|
882
|
+
* - `TSQueryPredicateStepTypeDone` - Steps with this type are *sentinels*
|
|
883
|
+
* that represent the end of an individual predicate. If a pattern has two
|
|
884
|
+
* predicates, then there will be two steps with this `type` in the array.
|
|
885
|
+
*/
|
|
886
|
+
const TSQueryPredicateStep *ts_query_predicates_for_pattern(
|
|
887
|
+
const TSQuery *self,
|
|
888
|
+
uint32_t pattern_index,
|
|
889
|
+
uint32_t *step_count
|
|
890
|
+
);
|
|
891
|
+
|
|
892
|
+
/*
|
|
893
|
+
* Check if the given pattern in the query has a single root node.
|
|
894
|
+
*/
|
|
895
|
+
bool ts_query_is_pattern_rooted(const TSQuery *self, uint32_t pattern_index);
|
|
896
|
+
|
|
897
|
+
/*
|
|
898
|
+
* Check if the given pattern in the query is 'non local'.
|
|
899
|
+
*
|
|
900
|
+
* A non-local pattern has multiple root nodes and can match within a
|
|
901
|
+
* repeating sequence of nodes, as specified by the grammar. Non-local
|
|
902
|
+
* patterns disable certain optimizations that would otherwise be possible
|
|
903
|
+
* when executing a query on a specific range of a syntax tree.
|
|
904
|
+
*/
|
|
905
|
+
bool ts_query_is_pattern_non_local(const TSQuery *self, uint32_t pattern_index);
|
|
906
|
+
|
|
907
|
+
/*
|
|
908
|
+
* Check if a given pattern is guaranteed to match once a given step is reached.
|
|
909
|
+
* The step is specified by its byte offset in the query's source code.
|
|
910
|
+
*/
|
|
911
|
+
bool ts_query_is_pattern_guaranteed_at_step(const TSQuery *self, uint32_t byte_offset);
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Get the name and length of one of the query's captures, or one of the
|
|
915
|
+
* query's string literals. Each capture and string is associated with a
|
|
916
|
+
* numeric id based on the order that it appeared in the query's source.
|
|
917
|
+
*/
|
|
918
|
+
const char *ts_query_capture_name_for_id(
|
|
919
|
+
const TSQuery *self,
|
|
920
|
+
uint32_t index,
|
|
921
|
+
uint32_t *length
|
|
922
|
+
);
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Get the quantifier of the query's captures. Each capture is * associated
|
|
926
|
+
* with a numeric id based on the order that it appeared in the query's source.
|
|
927
|
+
*/
|
|
928
|
+
TSQuantifier ts_query_capture_quantifier_for_id(
|
|
929
|
+
const TSQuery *self,
|
|
930
|
+
uint32_t pattern_index,
|
|
931
|
+
uint32_t capture_index
|
|
932
|
+
);
|
|
933
|
+
|
|
934
|
+
const char *ts_query_string_value_for_id(
|
|
935
|
+
const TSQuery *self,
|
|
936
|
+
uint32_t index,
|
|
937
|
+
uint32_t *length
|
|
938
|
+
);
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Disable a certain capture within a query.
|
|
942
|
+
*
|
|
943
|
+
* This prevents the capture from being returned in matches, and also avoids
|
|
944
|
+
* any resource usage associated with recording the capture. Currently, there
|
|
945
|
+
* is no way to undo this.
|
|
946
|
+
*/
|
|
947
|
+
void ts_query_disable_capture(TSQuery *self, const char *name, uint32_t length);
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Disable a certain pattern within a query.
|
|
951
|
+
*
|
|
952
|
+
* This prevents the pattern from matching and removes most of the overhead
|
|
953
|
+
* associated with the pattern. Currently, there is no way to undo this.
|
|
954
|
+
*/
|
|
955
|
+
void ts_query_disable_pattern(TSQuery *self, uint32_t pattern_index);
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Create a new cursor for executing a given query.
|
|
959
|
+
*
|
|
960
|
+
* The cursor stores the state that is needed to iteratively search
|
|
961
|
+
* for matches. To use the query cursor, first call [`ts_query_cursor_exec`]
|
|
962
|
+
* to start running a given query on a given syntax node. Then, there are
|
|
963
|
+
* two options for consuming the results of the query:
|
|
964
|
+
* 1. Repeatedly call [`ts_query_cursor_next_match`] to iterate over all of the
|
|
965
|
+
* *matches* in the order that they were found. Each match contains the
|
|
966
|
+
* index of the pattern that matched, and an array of captures. Because
|
|
967
|
+
* multiple patterns can match the same set of nodes, one match may contain
|
|
968
|
+
* captures that appear *before* some of the captures from a previous match.
|
|
969
|
+
* 2. Repeatedly call [`ts_query_cursor_next_capture`] to iterate over all of the
|
|
970
|
+
* individual *captures* in the order that they appear. This is useful if
|
|
971
|
+
* don't care about which pattern matched, and just want a single ordered
|
|
972
|
+
* sequence of captures.
|
|
973
|
+
*
|
|
974
|
+
* If you don't care about consuming all of the results, you can stop calling
|
|
975
|
+
* [`ts_query_cursor_next_match`] or [`ts_query_cursor_next_capture`] at any point.
|
|
976
|
+
* You can then start executing another query on another node by calling
|
|
977
|
+
* [`ts_query_cursor_exec`] again.
|
|
978
|
+
*/
|
|
979
|
+
TSQueryCursor *ts_query_cursor_new(void);
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Delete a query cursor, freeing all of the memory that it used.
|
|
983
|
+
*/
|
|
984
|
+
void ts_query_cursor_delete(TSQueryCursor *self);
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Start running a given query on a given node.
|
|
988
|
+
*/
|
|
989
|
+
void ts_query_cursor_exec(TSQueryCursor *self, const TSQuery *query, TSNode node);
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Manage the maximum number of in-progress matches allowed by this query
|
|
993
|
+
* cursor.
|
|
994
|
+
*
|
|
995
|
+
* Query cursors have an optional maximum capacity for storing lists of
|
|
996
|
+
* in-progress captures. If this capacity is exceeded, then the
|
|
997
|
+
* earliest-starting match will silently be dropped to make room for further
|
|
998
|
+
* matches. This maximum capacity is optional — by default, query cursors allow
|
|
999
|
+
* any number of pending matches, dynamically allocating new space for them as
|
|
1000
|
+
* needed as the query is executed.
|
|
1001
|
+
*/
|
|
1002
|
+
bool ts_query_cursor_did_exceed_match_limit(const TSQueryCursor *self);
|
|
1003
|
+
uint32_t ts_query_cursor_match_limit(const TSQueryCursor *self);
|
|
1004
|
+
void ts_query_cursor_set_match_limit(TSQueryCursor *self, uint32_t limit);
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Set the maximum duration in microseconds that query execution should be allowed to
|
|
1008
|
+
* take before halting.
|
|
1009
|
+
*
|
|
1010
|
+
* If query execution takes longer than this, it will halt early, returning NULL.
|
|
1011
|
+
* See [`ts_query_cursor_next_match`] or [`ts_query_cursor_next_capture`] for more information.
|
|
1012
|
+
*/
|
|
1013
|
+
void ts_query_cursor_set_timeout_micros(TSQueryCursor *self, uint64_t timeout_micros);
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Get the duration in microseconds that query execution is allowed to take.
|
|
1017
|
+
*
|
|
1018
|
+
* This is set via [`ts_query_cursor_set_timeout_micros`].
|
|
1019
|
+
*/
|
|
1020
|
+
uint64_t ts_query_cursor_timeout_micros(const TSQueryCursor *self);
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Set the range of bytes or (row, column) positions in which the query
|
|
1024
|
+
* will be executed.
|
|
1025
|
+
*/
|
|
1026
|
+
void ts_query_cursor_set_byte_range(TSQueryCursor *self, uint32_t start_byte, uint32_t end_byte);
|
|
1027
|
+
void ts_query_cursor_set_point_range(TSQueryCursor *self, TSPoint start_point, TSPoint end_point);
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Advance to the next match of the currently running query.
|
|
1031
|
+
*
|
|
1032
|
+
* If there is a match, write it to `*match` and return `true`.
|
|
1033
|
+
* Otherwise, return `false`.
|
|
1034
|
+
*/
|
|
1035
|
+
bool ts_query_cursor_next_match(TSQueryCursor *self, TSQueryMatch *match);
|
|
1036
|
+
void ts_query_cursor_remove_match(TSQueryCursor *self, uint32_t match_id);
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Advance to the next capture of the currently running query.
|
|
1040
|
+
*
|
|
1041
|
+
* If there is a capture, write its match to `*match` and its index within
|
|
1042
|
+
* the matche's capture list to `*capture_index`. Otherwise, return `false`.
|
|
1043
|
+
*/
|
|
1044
|
+
bool ts_query_cursor_next_capture(
|
|
1045
|
+
TSQueryCursor *self,
|
|
1046
|
+
TSQueryMatch *match,
|
|
1047
|
+
uint32_t *capture_index
|
|
1048
|
+
);
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Set the maximum start depth for a query cursor.
|
|
1052
|
+
*
|
|
1053
|
+
* This prevents cursors from exploring children nodes at a certain depth.
|
|
1054
|
+
* Note if a pattern includes many children, then they will still be checked.
|
|
1055
|
+
*
|
|
1056
|
+
* The zero max start depth value can be used as a special behavior and
|
|
1057
|
+
* it helps to destructure a subtree by staying on a node and using captures
|
|
1058
|
+
* for interested parts. Note that the zero max start depth only limit a search
|
|
1059
|
+
* depth for a pattern's root node but other nodes that are parts of the pattern
|
|
1060
|
+
* may be searched at any depth what defined by the pattern structure.
|
|
1061
|
+
*
|
|
1062
|
+
* Set to `UINT32_MAX` to remove the maximum start depth.
|
|
1063
|
+
*/
|
|
1064
|
+
void ts_query_cursor_set_max_start_depth(TSQueryCursor *self, uint32_t max_start_depth);
|
|
1065
|
+
|
|
1066
|
+
/**********************/
|
|
1067
|
+
/* Section - Language */
|
|
1068
|
+
/**********************/
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Get another reference to the given language.
|
|
1072
|
+
*/
|
|
1073
|
+
const TSLanguage *ts_language_copy(const TSLanguage *self);
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Free any dynamically-allocated resources for this language, if
|
|
1077
|
+
* this is the last reference.
|
|
1078
|
+
*/
|
|
1079
|
+
void ts_language_delete(const TSLanguage *self);
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Get the number of distinct node types in the language.
|
|
1083
|
+
*/
|
|
1084
|
+
uint32_t ts_language_symbol_count(const TSLanguage *self);
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Get the number of valid states in this language.
|
|
1088
|
+
*/
|
|
1089
|
+
uint32_t ts_language_state_count(const TSLanguage *self);
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Get a node type string for the given numerical id.
|
|
1093
|
+
*/
|
|
1094
|
+
const char *ts_language_symbol_name(const TSLanguage *self, TSSymbol symbol);
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Get the numerical id for the given node type string.
|
|
1098
|
+
*/
|
|
1099
|
+
TSSymbol ts_language_symbol_for_name(
|
|
1100
|
+
const TSLanguage *self,
|
|
1101
|
+
const char *string,
|
|
1102
|
+
uint32_t length,
|
|
1103
|
+
bool is_named
|
|
1104
|
+
);
|
|
1105
|
+
|
|
1106
|
+
/**
|
|
1107
|
+
* Get the number of distinct field names in the language.
|
|
1108
|
+
*/
|
|
1109
|
+
uint32_t ts_language_field_count(const TSLanguage *self);
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Get the field name string for the given numerical id.
|
|
1113
|
+
*/
|
|
1114
|
+
const char *ts_language_field_name_for_id(const TSLanguage *self, TSFieldId id);
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Get the numerical id for the given field name string.
|
|
1118
|
+
*/
|
|
1119
|
+
TSFieldId ts_language_field_id_for_name(const TSLanguage *self, const char *name, uint32_t name_length);
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Check whether the given node type id belongs to named nodes, anonymous nodes,
|
|
1123
|
+
* or a hidden nodes.
|
|
1124
|
+
*
|
|
1125
|
+
* See also [`ts_node_is_named`]. Hidden nodes are never returned from the API.
|
|
1126
|
+
*/
|
|
1127
|
+
TSSymbolType ts_language_symbol_type(const TSLanguage *self, TSSymbol symbol);
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Get the ABI version number for this language. This version number is used
|
|
1131
|
+
* to ensure that languages were generated by a compatible version of
|
|
1132
|
+
* Tree-sitter.
|
|
1133
|
+
*
|
|
1134
|
+
* See also [`ts_parser_set_language`].
|
|
1135
|
+
*/
|
|
1136
|
+
uint32_t ts_language_version(const TSLanguage *self);
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Get the next parse state. Combine this with lookahead iterators to generate
|
|
1140
|
+
* completion suggestions or valid symbols in error nodes. Use
|
|
1141
|
+
* [`ts_node_grammar_symbol`] for valid symbols.
|
|
1142
|
+
*/
|
|
1143
|
+
TSStateId ts_language_next_state(const TSLanguage *self, TSStateId state, TSSymbol symbol);
|
|
1144
|
+
|
|
1145
|
+
/********************************/
|
|
1146
|
+
/* Section - Lookahead Iterator */
|
|
1147
|
+
/********************************/
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Create a new lookahead iterator for the given language and parse state.
|
|
1151
|
+
*
|
|
1152
|
+
* This returns `NULL` if state is invalid for the language.
|
|
1153
|
+
*
|
|
1154
|
+
* Repeatedly using [`ts_lookahead_iterator_next`] and
|
|
1155
|
+
* [`ts_lookahead_iterator_current_symbol`] will generate valid symbols in the
|
|
1156
|
+
* given parse state. Newly created lookahead iterators will contain the `ERROR`
|
|
1157
|
+
* symbol.
|
|
1158
|
+
*
|
|
1159
|
+
* Lookahead iterators can be useful to generate suggestions and improve syntax
|
|
1160
|
+
* error diagnostics. To get symbols valid in an ERROR node, use the lookahead
|
|
1161
|
+
* iterator on its first leaf node state. For `MISSING` nodes, a lookahead
|
|
1162
|
+
* iterator created on the previous non-extra leaf node may be appropriate.
|
|
1163
|
+
*/
|
|
1164
|
+
TSLookaheadIterator *ts_lookahead_iterator_new(const TSLanguage *self, TSStateId state);
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Delete a lookahead iterator freeing all the memory used.
|
|
1168
|
+
*/
|
|
1169
|
+
void ts_lookahead_iterator_delete(TSLookaheadIterator *self);
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Reset the lookahead iterator to another state.
|
|
1173
|
+
*
|
|
1174
|
+
* This returns `true` if the iterator was reset to the given state and `false`
|
|
1175
|
+
* otherwise.
|
|
1176
|
+
*/
|
|
1177
|
+
bool ts_lookahead_iterator_reset_state(TSLookaheadIterator *self, TSStateId state);
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Reset the lookahead iterator.
|
|
1181
|
+
*
|
|
1182
|
+
* This returns `true` if the language was set successfully and `false`
|
|
1183
|
+
* otherwise.
|
|
1184
|
+
*/
|
|
1185
|
+
bool ts_lookahead_iterator_reset(TSLookaheadIterator *self, const TSLanguage *language, TSStateId state);
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Get the current language of the lookahead iterator.
|
|
1189
|
+
*/
|
|
1190
|
+
const TSLanguage *ts_lookahead_iterator_language(const TSLookaheadIterator *self);
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Advance the lookahead iterator to the next symbol.
|
|
1194
|
+
*
|
|
1195
|
+
* This returns `true` if there is a new symbol and `false` otherwise.
|
|
1196
|
+
*/
|
|
1197
|
+
bool ts_lookahead_iterator_next(TSLookaheadIterator *self);
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Get the current symbol of the lookahead iterator;
|
|
1201
|
+
*/
|
|
1202
|
+
TSSymbol ts_lookahead_iterator_current_symbol(const TSLookaheadIterator *self);
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Get the current symbol type of the lookahead iterator as a null terminated
|
|
1206
|
+
* string.
|
|
1207
|
+
*/
|
|
1208
|
+
const char *ts_lookahead_iterator_current_symbol_name(const TSLookaheadIterator *self);
|
|
1209
|
+
|
|
1210
|
+
/*************************************/
|
|
1211
|
+
/* Section - WebAssembly Integration */
|
|
1212
|
+
/************************************/
|
|
1213
|
+
|
|
1214
|
+
typedef struct wasm_engine_t TSWasmEngine;
|
|
1215
|
+
typedef struct TSWasmStore TSWasmStore;
|
|
1216
|
+
|
|
1217
|
+
typedef enum {
|
|
1218
|
+
TSWasmErrorKindNone = 0,
|
|
1219
|
+
TSWasmErrorKindParse,
|
|
1220
|
+
TSWasmErrorKindCompile,
|
|
1221
|
+
TSWasmErrorKindInstantiate,
|
|
1222
|
+
TSWasmErrorKindAllocate,
|
|
1223
|
+
} TSWasmErrorKind;
|
|
1224
|
+
|
|
1225
|
+
typedef struct {
|
|
1226
|
+
TSWasmErrorKind kind;
|
|
1227
|
+
char *message;
|
|
1228
|
+
} TSWasmError;
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Create a Wasm store.
|
|
1232
|
+
*/
|
|
1233
|
+
TSWasmStore *ts_wasm_store_new(
|
|
1234
|
+
TSWasmEngine *engine,
|
|
1235
|
+
TSWasmError *error
|
|
1236
|
+
);
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Free the memory associated with the given Wasm store.
|
|
1240
|
+
*/
|
|
1241
|
+
void ts_wasm_store_delete(TSWasmStore *);
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* Create a language from a buffer of Wasm. The resulting language behaves
|
|
1245
|
+
* like any other Tree-sitter language, except that in order to use it with
|
|
1246
|
+
* a parser, that parser must have a Wasm store. Note that the language
|
|
1247
|
+
* can be used with any Wasm store, it doesn't need to be the same store that
|
|
1248
|
+
* was used to originally load it.
|
|
1249
|
+
*/
|
|
1250
|
+
const TSLanguage *ts_wasm_store_load_language(
|
|
1251
|
+
TSWasmStore *,
|
|
1252
|
+
const char *name,
|
|
1253
|
+
const char *wasm,
|
|
1254
|
+
uint32_t wasm_len,
|
|
1255
|
+
TSWasmError *error
|
|
1256
|
+
);
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Get the number of languages instantiated in the given wasm store.
|
|
1260
|
+
*/
|
|
1261
|
+
size_t ts_wasm_store_language_count(const TSWasmStore *);
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Check if the language came from a Wasm module. If so, then in order to use
|
|
1265
|
+
* this language with a Parser, that parser must have a Wasm store assigned.
|
|
1266
|
+
*/
|
|
1267
|
+
bool ts_language_is_wasm(const TSLanguage *);
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Assign the given Wasm store to the parser. A parser must have a Wasm store
|
|
1271
|
+
* in order to use Wasm languages.
|
|
1272
|
+
*/
|
|
1273
|
+
void ts_parser_set_wasm_store(TSParser *, TSWasmStore *);
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Remove the parser's current Wasm store and return it. This returns NULL if
|
|
1277
|
+
* the parser doesn't have a Wasm store.
|
|
1278
|
+
*/
|
|
1279
|
+
TSWasmStore *ts_parser_take_wasm_store(TSParser *);
|
|
1280
|
+
|
|
1281
|
+
/**********************************/
|
|
1282
|
+
/* Section - Global Configuration */
|
|
1283
|
+
/**********************************/
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* Set the allocation functions used by the library.
|
|
1287
|
+
*
|
|
1288
|
+
* By default, Tree-sitter uses the standard libc allocation functions,
|
|
1289
|
+
* but aborts the process when an allocation fails. This function lets
|
|
1290
|
+
* you supply alternative allocation functions at runtime.
|
|
1291
|
+
*
|
|
1292
|
+
* If you pass `NULL` for any parameter, Tree-sitter will switch back to
|
|
1293
|
+
* its default implementation of that function.
|
|
1294
|
+
*
|
|
1295
|
+
* If you call this function after the library has already been used, then
|
|
1296
|
+
* you must ensure that either:
|
|
1297
|
+
* 1. All the existing objects have been freed.
|
|
1298
|
+
* 2. The new allocator shares its state with the old one, so it is capable
|
|
1299
|
+
* of freeing memory that was allocated by the old allocator.
|
|
1300
|
+
*/
|
|
1301
|
+
void ts_set_allocator(
|
|
1302
|
+
void *(*new_malloc)(size_t),
|
|
1303
|
+
void *(*new_calloc)(size_t, size_t),
|
|
1304
|
+
void *(*new_realloc)(void *, size_t),
|
|
1305
|
+
void (*new_free)(void *)
|
|
1306
|
+
);
|
|
1307
|
+
|
|
1308
|
+
#ifdef __cplusplus
|
|
1309
|
+
}
|
|
1310
|
+
#endif
|
|
1311
|
+
|
|
1312
|
+
#ifndef TREE_SITTER_HIDE_SYMBOLS
|
|
1313
|
+
#if defined(__GNUC__) || defined(__clang__)
|
|
1314
|
+
#pragma GCC visibility pop
|
|
1315
|
+
#endif
|
|
1316
|
+
#endif
|
|
1317
|
+
|
|
1318
|
+
#endif // TREE_SITTER_API_H_
|