@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.
Files changed (149) hide show
  1. package/cli.mjs +1 -1
  2. package/package.json +1 -1
  3. package/reachability-analyzers-cli.mjs +1 -1
  4. package/repos/coana-tech/alucard/alucard.jar +0 -0
  5. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/cli.mjs +24669 -0
  6. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/LICENSE.md +9 -0
  7. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/README.md +95 -0
  8. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/common.gypi +21 -0
  9. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/except.gypi +25 -0
  10. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/index.js +14 -0
  11. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  12. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/napi-inl.h +6941 -0
  13. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/napi.h +3295 -0
  14. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/node_addon_api.gyp +42 -0
  15. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/node_api.gyp +9 -0
  16. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/noexcept.gypi +26 -0
  17. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/nothing.c +0 -0
  18. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/package-support.json +21 -0
  19. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/package.json +480 -0
  20. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/README.md +73 -0
  21. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/check-napi.js +99 -0
  22. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/clang-format.js +71 -0
  23. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-addon-api/tools/conversion.js +301 -0
  24. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/LICENSE +21 -0
  25. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/README.md +58 -0
  26. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/SECURITY.md +5 -0
  27. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/bin.js +84 -0
  28. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/build-test.js +19 -0
  29. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/index.js +6 -0
  30. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  31. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/optional.js +7 -0
  32. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/node-gyp-build/package.json +43 -0
  33. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/LICENSE +21 -0
  34. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/README.md +128 -0
  35. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/binding.gyp +80 -0
  36. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/index.js +919 -0
  37. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/node_modules/.bin/node-gyp-build +16 -0
  38. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/node_modules/.bin/node-gyp-build-optional +16 -0
  39. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/node_modules/.bin/node-gyp-build-test +16 -0
  40. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/package.json +76 -0
  41. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/darwin-arm64/tree-sitter.node +0 -0
  42. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/darwin-x64/tree-sitter.node +0 -0
  43. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/linux-arm64/tree-sitter.node +0 -0
  44. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/linux-x64/tree-sitter.node +0 -0
  45. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/win32-arm64/tree-sitter.node +0 -0
  46. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/prebuilds/win32-x64/tree-sitter.node +0 -0
  47. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/addon_data.h +47 -0
  48. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/binding.cc +35 -0
  49. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/conversions.cc +140 -0
  50. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/conversions.h +22 -0
  51. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/language.cc +106 -0
  52. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/language.h +17 -0
  53. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/logger.cc +70 -0
  54. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/logger.h +19 -0
  55. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/lookaheaditerator.cc +122 -0
  56. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/lookaheaditerator.h +33 -0
  57. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/node.cc +1088 -0
  58. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/node.h +30 -0
  59. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/parser.cc +306 -0
  60. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/parser.h +35 -0
  61. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/query.cc +397 -0
  62. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/query.h +40 -0
  63. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree.cc +316 -0
  64. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree.h +45 -0
  65. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree_cursor.cc +213 -0
  66. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/src/tree_cursor.h +52 -0
  67. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/tree-sitter.d.ts +1042 -0
  68. 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
  69. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.c +48 -0
  70. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/alloc.h +41 -0
  71. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/array.h +291 -0
  72. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/atomic.h +68 -0
  73. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/clock.h +146 -0
  74. 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
  75. 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
  76. 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
  77. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/host.h +21 -0
  78. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.c +223 -0
  79. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/language.h +297 -0
  80. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/length.h +52 -0
  81. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.c +435 -0
  82. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lexer.h +49 -0
  83. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/lib.c +12 -0
  84. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/node.c +920 -0
  85. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.c +2165 -0
  86. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/parser.h +266 -0
  87. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/point.h +62 -0
  88. 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
  89. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/query.c +4187 -0
  90. 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
  91. 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
  92. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.c +899 -0
  93. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/stack.h +130 -0
  94. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.c +1066 -0
  95. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/subtree.h +399 -0
  96. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.c +170 -0
  97. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/tree.h +31 -0
  98. 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
  99. 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
  100. 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
  101. 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
  102. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode/LICENSE +414 -0
  103. 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
  104. 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
  105. 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
  106. 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
  107. 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
  108. 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
  109. 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
  110. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter/vendor/tree-sitter/lib/src/unicode.h +83 -0
  111. 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
  112. 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
  113. 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
  114. 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
  115. 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
  116. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/LICENSE +22 -0
  117. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/README.md +21 -0
  118. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/binding.gyp +30 -0
  119. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/binding.cc +20 -0
  120. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/binding_test.js +9 -0
  121. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/index.d.ts +28 -0
  122. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/bindings/node/index.js +11 -0
  123. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/grammar.js +1281 -0
  124. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/node_modules/.bin/node-gyp-build +16 -0
  125. 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
  126. 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
  127. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/package.json +77 -0
  128. 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
  129. 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
  130. 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
  131. 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
  132. 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
  133. 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
  134. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/queries/highlights.scm +154 -0
  135. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/queries/locals.scm +27 -0
  136. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/queries/tags.scm +64 -0
  137. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/grammar.json +8364 -0
  138. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/node-types.json +4108 -0
  139. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/parser.c +471247 -0
  140. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/scanner.c +1107 -0
  141. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/tree_sitter/alloc.h +54 -0
  142. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/tree_sitter/array.h +290 -0
  143. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/src/tree_sitter/parser.h +266 -0
  144. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/tree-sitter-ruby.wasm +0 -0
  145. package/repos/coana-tech/callgraph-reachability-analyzers/packages/cli/dist/bundle/node_modules/tree-sitter-ruby/tree-sitter.json +46 -0
  146. package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
  147. package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
  148. package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
  149. package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
@@ -0,0 +1,316 @@
1
+ #include "./tree.h"
2
+ #include "./addon_data.h"
3
+ #include "./conversions.h"
4
+ #include "./node.h"
5
+
6
+ #include <napi.h>
7
+
8
+ using namespace Napi;
9
+
10
+ namespace node_tree_sitter {
11
+
12
+ /*
13
+ tstag() {
14
+ b2sum -l64 <(printf tree-sitter) <(printf "$1") | \
15
+ awk '{printf "0x" toupper($1) (NR == 1 ? ", " : "\n")}'
16
+ }
17
+ tstag tree # => 0x8AF2E5212AD58ABF, 0x7FA28BFC1966AC2D
18
+ */
19
+ const napi_type_tag TREE_TYPE_TAG = {
20
+ 0x8AF2E5212AD58ABF, 0x7FA28BFC1966AC2D
21
+ };
22
+
23
+ using node_methods::UnmarshalNodeId;
24
+
25
+ void Tree::Init(Napi::Env env, Napi::Object exports) {
26
+ auto *data = env.GetInstanceData<AddonData>();
27
+
28
+ Function ctor = DefineClass(env, "Tree", {
29
+ InstanceMethod("edit", &Tree::Edit, napi_default_method),
30
+ InstanceMethod("rootNode", &Tree::RootNode, napi_default_method),
31
+ InstanceMethod("rootNodeWithOffset", &Tree::RootNodeWithOffset, napi_default_method),
32
+ InstanceMethod("printDotGraph", &Tree::PrintDotGraph, napi_default_method),
33
+ InstanceMethod("getChangedRanges", &Tree::GetChangedRanges, napi_default_method),
34
+ InstanceMethod("getIncludedRanges", &Tree::GetIncludedRanges, napi_default_method),
35
+ InstanceMethod("getEditedRange", &Tree::GetEditedRange, napi_default_method),
36
+ InstanceMethod("_cacheNode", &Tree::CacheNode, napi_default_method),
37
+ InstanceMethod("_cacheNodes", &Tree::CacheNodes, napi_default_method),
38
+ });
39
+
40
+ data->tree_constructor = Napi::Persistent(ctor);
41
+ exports["Tree"] = ctor;
42
+ }
43
+
44
+ Tree::Tree(const Napi::CallbackInfo &info) : Napi::ObjectWrap<Tree>(info), tree_(nullptr) {
45
+ Value().TypeTag(&TREE_TYPE_TAG);
46
+ }
47
+
48
+ Tree::~Tree() {
49
+ ts_tree_delete(tree_);
50
+ for (auto &entry : cached_nodes_) {
51
+ entry.second->tree = nullptr;
52
+ }
53
+ }
54
+
55
+ Napi::Value Tree::NewInstance(Napi::Env env, TSTree *tree) {
56
+ auto *data = env.GetInstanceData<AddonData>();
57
+ if (tree != nullptr) {
58
+ Object self = data->tree_constructor.New({});
59
+ Tree::Unwrap(self)->tree_ = tree;
60
+ return self;
61
+ }
62
+
63
+ return env.Null();
64
+ }
65
+
66
+ const Tree *Tree::UnwrapTree(const Napi::Value &value) {
67
+ if (!value.IsObject()) {
68
+ return nullptr;
69
+ }
70
+ auto js_tree = value.As<Object>();
71
+ if (!js_tree.CheckTypeTag(&TREE_TYPE_TAG)) {
72
+ return nullptr;
73
+ }
74
+ return Tree::Unwrap(js_tree);
75
+ }
76
+
77
+ #define read_number_from_js(out, value, name) \
78
+ if (!(value).IsNumber()) { \
79
+ throw TypeError::New(env, name " must be an integer"); \
80
+ return env.Undefined(); \
81
+ } \
82
+ *(out) = (value).As<Number>().Uint32Value();
83
+
84
+ #define read_byte_count_from_js(out, value, name) \
85
+ read_number_from_js(out, value, name); \
86
+ (*(out)) *= 2
87
+
88
+ Napi::Value Tree::Edit(const Napi::CallbackInfo &info) {
89
+ Napi::Env env = info.Env();
90
+ TSInputEdit edit;
91
+ read_number_from_js(&edit.start_point.row, info[0], "startPosition.row");
92
+ read_byte_count_from_js(&edit.start_point.column, info[1], "startPosition.column");
93
+ read_number_from_js(&edit.old_end_point.row, info[2], "oldEndPosition.row");
94
+ read_byte_count_from_js(&edit.old_end_point.column, info[3], "oldEndPosition.column");
95
+ read_number_from_js(&edit.new_end_point.row, info[4], "newEndPosition.row");
96
+ read_byte_count_from_js(&edit.new_end_point.column, info[5], "newEndPosition.column");
97
+ read_byte_count_from_js(&edit.start_byte, info[6], "startIndex");
98
+ read_byte_count_from_js(&edit.old_end_byte, info[7], "oldEndIndex");
99
+ read_byte_count_from_js(&edit.new_end_byte, info[8], "newEndIndex");
100
+
101
+ ts_tree_edit(tree_, &edit);
102
+
103
+ for (auto &entry : cached_nodes_) {
104
+ Object js_node = entry.second->node.Value();
105
+ if (js_node.IsEmpty()) {
106
+ continue;
107
+ }
108
+ TSNode node;
109
+ node.id = entry.first;
110
+ for (unsigned i = 0; i < 4; i++) {
111
+ Napi::Value node_field = js_node[i + 2];
112
+ if (node_field.IsNumber()) {
113
+ node.context[i] = node_field.As<Number>().Uint32Value();
114
+ }
115
+ }
116
+
117
+ ts_node_edit(&node, &edit);
118
+
119
+ for (unsigned i = 0; i < 4; i++) {
120
+ js_node[i + 2U] = Number::New(env, node.context[i]);
121
+ }
122
+ }
123
+
124
+ return info.This();
125
+ }
126
+
127
+ Napi::Value Tree::RootNode(const Napi::CallbackInfo &info) {
128
+ return node_methods::MarshalNode(info, this, ts_tree_root_node(tree_));
129
+ }
130
+
131
+ Napi::Value Tree::RootNodeWithOffset(const Napi::CallbackInfo &info) {
132
+ Napi::Env env = info.Env();
133
+ uint32_t offset_bytes = 0;
134
+ TSPoint offset_extent = {0, UINT32_MAX};
135
+
136
+ read_byte_count_from_js(&offset_bytes, info[0], "offsetBytes");
137
+ read_number_from_js(&offset_extent.row, info[1], "offsetExtent.row");
138
+ read_byte_count_from_js(&offset_extent.column, info[2], "offsetExtent.column");
139
+
140
+ return node_methods::MarshalNode(info, this, ts_tree_root_node_with_offset(tree_, offset_bytes, offset_extent));
141
+ }
142
+
143
+ Napi::Value Tree::GetChangedRanges(const Napi::CallbackInfo &info) {
144
+ Napi::Env env = info.Env();
145
+ const Tree *other_tree = UnwrapTree(info[0]);
146
+ if (other_tree == nullptr) {
147
+ throw TypeError::New(env, "Argument must be a tree");
148
+ }
149
+
150
+ uint32_t range_count;
151
+ TSRange *ranges = ts_tree_get_changed_ranges(tree_, other_tree->tree_, &range_count);
152
+
153
+ Array result = Array::New(env);
154
+ for (size_t i = 0; i < range_count; i++) {
155
+ result[i] = RangeToJS(env, ranges[i]);
156
+ }
157
+
158
+ free(ranges);
159
+
160
+ return result;
161
+ }
162
+
163
+ Napi::Value Tree::GetIncludedRanges(const Napi::CallbackInfo &info) {
164
+ Napi::Env env = info.Env();
165
+ uint32_t range_count;
166
+ TSRange *ranges = ts_tree_included_ranges(tree_, &range_count);
167
+
168
+ Array result = Array::New(env);
169
+ for (size_t i = 0; i < range_count; i++) {
170
+ result[i] = RangeToJS(env, ranges[i]);
171
+ }
172
+
173
+ free(ranges);
174
+
175
+ return result;
176
+ }
177
+
178
+ Napi::Value Tree::GetEditedRange(const Napi::CallbackInfo &info) {
179
+ Napi::Env env = info.Env();
180
+ TSNode root = ts_tree_root_node(tree_);
181
+ if (!ts_node_has_changes(root)) {
182
+ return env.Undefined();
183
+ }
184
+ TSRange result = {
185
+ ts_node_start_point(root),
186
+ ts_node_end_point(root),
187
+ ts_node_start_byte(root),
188
+ ts_node_end_byte(root),
189
+ };
190
+
191
+ TSTreeCursor cursor = ts_tree_cursor_new(root);
192
+
193
+ while (true) {
194
+ if (!ts_tree_cursor_goto_first_child(&cursor)) {
195
+ break;
196
+ }
197
+ while (true) {
198
+ TSNode node = ts_tree_cursor_current_node(&cursor);
199
+ if (ts_node_has_changes(node)) {
200
+ result.start_byte = ts_node_start_byte(node);
201
+ result.start_point = ts_node_start_point(node);
202
+ break;
203
+ }
204
+ if (!ts_tree_cursor_goto_next_sibling(&cursor)) {
205
+ break;
206
+ }
207
+ }
208
+ }
209
+
210
+ while (ts_tree_cursor_goto_parent(&cursor)) {}
211
+
212
+ while (true) {
213
+ if (!ts_tree_cursor_goto_first_child(&cursor)) {
214
+ break;
215
+ }
216
+ while (true) {
217
+ TSNode node = ts_tree_cursor_current_node(&cursor);
218
+ if (ts_node_has_changes(node)) {
219
+ result.end_byte = ts_node_end_byte(node);
220
+ result.end_point = ts_node_end_point(node);
221
+ }
222
+
223
+ if (!ts_tree_cursor_goto_next_sibling(&cursor)) {
224
+ break;
225
+ }
226
+ }
227
+ }
228
+
229
+ ts_tree_cursor_delete(&cursor);
230
+ return RangeToJS(env, result);
231
+ }
232
+
233
+ Napi::Value Tree::PrintDotGraph(const Napi::CallbackInfo &info) {
234
+ int fd = fileno(stderr);
235
+
236
+ if (info.Length() > 0) {
237
+ if (!info[0].IsNumber()) {
238
+ throw TypeError::New(info.Env(), "First argument must be a number");
239
+ }
240
+ fd = info[0].As<Number>().Int32Value();
241
+ }
242
+
243
+ ts_tree_print_dot_graph(tree_, fd);
244
+ return info.This();
245
+ }
246
+
247
+ namespace {
248
+
249
+ void FinalizeNode(Napi::Env _env, Tree::NodeCacheEntry *cache_entry) {
250
+ assert(!cache_entry->node.IsEmpty());
251
+ cache_entry->node.Reset();
252
+ if (cache_entry->tree != nullptr) {
253
+ assert(cache_entry->tree->cached_nodes_.count(cache_entry->key));
254
+ cache_entry->tree->cached_nodes_.erase(cache_entry->key);
255
+ }
256
+ delete cache_entry;
257
+ }
258
+
259
+ void CacheNodeForTree(Tree *tree, Napi::Env _env, Object js_node) {
260
+ Value js_node_field1 = js_node[0U];
261
+ Value js_node_field2 = js_node[1U];
262
+ if (!js_node_field1.IsNumber() || !js_node_field2.IsNumber()) {
263
+ return;
264
+ }
265
+ uint32_t key_parts[2] = {
266
+ js_node_field1.As<Number>().Uint32Value(),
267
+ js_node_field2.As<Number>().Uint32Value(),
268
+ };
269
+ const void *key = UnmarshalNodeId(key_parts);
270
+
271
+ // A Node could have been garbage collected but the finalizer has not yet run to remove its cache entry
272
+ if (tree->cached_nodes_.count(key)) {
273
+ return;
274
+ }
275
+
276
+ auto *cache_entry = new Tree::NodeCacheEntry{tree, key, {}};
277
+ cache_entry->node = Napi::Weak(js_node);
278
+ js_node.AddFinalizer(&FinalizeNode, cache_entry);
279
+
280
+ tree->cached_nodes_[key] = cache_entry;
281
+ }
282
+
283
+ } // namespace
284
+
285
+ Napi::Value Tree::CacheNode(const Napi::CallbackInfo &info) {
286
+ Napi::Env env = info.Env();
287
+
288
+ if (!info[0].IsObject()) {
289
+ throw TypeError::New(env, "not an object");
290
+ }
291
+
292
+ CacheNodeForTree(this, env, info[0].As<Object>());
293
+ return env.Undefined();
294
+ }
295
+
296
+ Napi::Value Tree::CacheNodes(const Napi::CallbackInfo &info) {
297
+ Napi::Env env = info.Env();
298
+
299
+ if (!info[0].IsArray()) {
300
+ throw TypeError::New(env, "not an array");
301
+ }
302
+ auto js_nodes = info[0].As<Array>();
303
+ uint32_t length = js_nodes.Length();
304
+
305
+ for (uint32_t i = 0; i < length; ++i) {
306
+ Napi::Value js_node = js_nodes[i];
307
+ if (!js_node.IsObject()) {
308
+ throw TypeError::New(env, "not an object");
309
+ }
310
+ CacheNodeForTree(this, env, js_node.As<Object>());
311
+ }
312
+
313
+ return env.Undefined();
314
+ }
315
+
316
+ } // namespace node_tree_sitter
@@ -0,0 +1,45 @@
1
+ #ifndef NODE_TREE_SITTER_TREE_H_
2
+ #define NODE_TREE_SITTER_TREE_H_
3
+
4
+ #include "./addon_data.h"
5
+ #include "tree_sitter/api.h"
6
+
7
+ #include <napi.h>
8
+ #include <node_object_wrap.h>
9
+ #include <unordered_map>
10
+
11
+ namespace node_tree_sitter {
12
+
13
+ class Tree final : public Napi::ObjectWrap<Tree> {
14
+ public:
15
+ static void Init(Napi::Env env, Napi::Object exports);
16
+ static Napi::Value NewInstance(Napi::Env env, TSTree *tree);
17
+ static const Tree *UnwrapTree(const Napi::Value &value);
18
+
19
+ explicit Tree(const Napi::CallbackInfo &);
20
+ ~Tree() final;
21
+
22
+ struct NodeCacheEntry {
23
+ Tree *tree;
24
+ const void *key;
25
+ Napi::ObjectReference node;
26
+ };
27
+
28
+ TSTree *tree_;
29
+ std::unordered_map<const void *, NodeCacheEntry *> cached_nodes_;
30
+
31
+ private:
32
+ Napi::Value Edit(const Napi::CallbackInfo &info);
33
+ Napi::Value RootNode(const Napi::CallbackInfo &info);
34
+ Napi::Value RootNodeWithOffset(const Napi::CallbackInfo &info);
35
+ Napi::Value PrintDotGraph(const Napi::CallbackInfo &info);
36
+ Napi::Value GetEditedRange(const Napi::CallbackInfo &info);
37
+ Napi::Value GetChangedRanges(const Napi::CallbackInfo &info);
38
+ Napi::Value GetIncludedRanges(const Napi::CallbackInfo &info);
39
+ Napi::Value CacheNode(const Napi::CallbackInfo &info);
40
+ Napi::Value CacheNodes(const Napi::CallbackInfo &info);
41
+ };
42
+
43
+ } // namespace node_tree_sitter
44
+
45
+ #endif // NODE_TREE_SITTER_TREE_H_
@@ -0,0 +1,213 @@
1
+ #include "./conversions.h"
2
+ #include "./node.h"
3
+ #include "./tree.h"
4
+ #include "./tree_cursor.h"
5
+ #include "tree_sitter/api.h"
6
+
7
+ #include <napi.h>
8
+
9
+ using namespace Napi;
10
+
11
+ namespace node_tree_sitter {
12
+
13
+ void TreeCursor::Init(Napi::Env env, Napi::Object exports) {
14
+ auto *data = env.GetInstanceData<AddonData>();
15
+
16
+ Function ctor = DefineClass(env, "TreeCursor", {
17
+ InstanceAccessor("startIndex", &TreeCursor::StartIndex, nullptr, napi_default_method),
18
+ InstanceAccessor("endIndex", &TreeCursor::EndIndex, nullptr, napi_default_method),
19
+ InstanceAccessor("nodeType", &TreeCursor::NodeType, nullptr, napi_default_method),
20
+ InstanceAccessor("nodeTypeId", &TreeCursor::NodeTypeId, nullptr, napi_default_method),
21
+ InstanceAccessor("nodeStateId", &TreeCursor::NodeStateId, nullptr, napi_default_method),
22
+ InstanceAccessor("nodeIsNamed", &TreeCursor::NodeIsNamed, nullptr, napi_default_method),
23
+ InstanceAccessor("nodeIsMissing", &TreeCursor::NodeIsMissing, nullptr, napi_default_method),
24
+ InstanceAccessor("currentFieldId", &TreeCursor::CurrentFieldId, nullptr, napi_default_method),
25
+ InstanceAccessor("currentFieldName", &TreeCursor::CurrentFieldName, nullptr, napi_default_method),
26
+ InstanceAccessor("currentDepth", &TreeCursor::CurrentDepth, nullptr, napi_default_method),
27
+ InstanceAccessor("currentDescendantIndex", &TreeCursor::CurrentDescendantIndex, nullptr, napi_default_method),
28
+
29
+ InstanceMethod("gotoFirstChild", &TreeCursor::GotoFirstChild, napi_default_method),
30
+ InstanceMethod("gotoLastChild", &TreeCursor::GotoLastChild, napi_default_method),
31
+ InstanceMethod("gotoParent", &TreeCursor::GotoParent, napi_default_method),
32
+ InstanceMethod("gotoNextSibling", &TreeCursor::GotoNextSibling, napi_default_method),
33
+ InstanceMethod("gotoPreviousSibling", &TreeCursor::GotoPreviousSibling, napi_default_method),
34
+ InstanceMethod("gotoDescendant", &TreeCursor::GotoDescendant, napi_default_method),
35
+ InstanceMethod("gotoFirstChildForIndex", &TreeCursor::GotoFirstChildForIndex, napi_default_method),
36
+ InstanceMethod("gotoFirstChildForPosition", &TreeCursor::GotoFirstChildForPosition, napi_default_method),
37
+ InstanceMethod("startPosition", &TreeCursor::StartPosition, napi_default_method),
38
+ InstanceMethod("endPosition", &TreeCursor::EndPosition, napi_default_method),
39
+ InstanceMethod("currentNode", &TreeCursor::CurrentNode, napi_default_method),
40
+ InstanceMethod("reset", &TreeCursor::Reset, napi_default_method),
41
+ InstanceMethod("resetTo", &TreeCursor::ResetTo, napi_default_method),
42
+ });
43
+
44
+ exports["TreeCursor"] = ctor;
45
+ data->tree_cursor_constructor = Napi::Persistent(ctor);
46
+ }
47
+
48
+ Napi::Value TreeCursor::NewInstance(Napi::Env env, TSTreeCursor cursor) {
49
+ auto *data = env.GetInstanceData<AddonData>();
50
+
51
+ Object self = data->tree_cursor_constructor.New({});
52
+ TreeCursor::Unwrap(self)->cursor_ = cursor;
53
+ return self;
54
+ }
55
+
56
+ TreeCursor::TreeCursor(const Napi::CallbackInfo& info) : Napi::ObjectWrap<TreeCursor>(info), cursor_() {}
57
+
58
+ TreeCursor::~TreeCursor() { ts_tree_cursor_delete(&cursor_); }
59
+
60
+ Napi::Value TreeCursor::GotoFirstChild(const Napi::CallbackInfo &info) {
61
+ bool result = ts_tree_cursor_goto_first_child(&cursor_);
62
+ return Boolean::New(info.Env(), result);
63
+ }
64
+
65
+ Napi::Value TreeCursor::GotoLastChild(const Napi::CallbackInfo &info) {
66
+ bool result = ts_tree_cursor_goto_last_child(&cursor_);
67
+ return Boolean::New(info.Env(), result);
68
+ }
69
+
70
+ Napi::Value TreeCursor::GotoParent(const Napi::CallbackInfo &info) {
71
+ bool result = ts_tree_cursor_goto_parent(&cursor_);
72
+ return Boolean::New(info.Env(), result);
73
+ }
74
+
75
+ Napi::Value TreeCursor::GotoNextSibling(const Napi::CallbackInfo &info) {
76
+ bool result = ts_tree_cursor_goto_next_sibling(&cursor_);
77
+ return Boolean::New(info.Env(), result);
78
+ }
79
+
80
+ Napi::Value TreeCursor::GotoPreviousSibling(const Napi::CallbackInfo &info) {
81
+ bool result = ts_tree_cursor_goto_previous_sibling(&cursor_);
82
+ return Boolean::New(info.Env(), result);
83
+ }
84
+
85
+ Napi::Value TreeCursor::GotoDescendant(const Napi::CallbackInfo &info) {
86
+ Napi::Env env = info.Env();
87
+ if (!info[0].IsNumber()) {
88
+ throw TypeError::New(env, "First argument must be an integer");
89
+ }
90
+ int64_t goal_descendant_index = info[0].As<Number>().Uint32Value();
91
+ ts_tree_cursor_goto_descendant(&cursor_, goal_descendant_index);
92
+ return env.Undefined();
93
+ }
94
+
95
+ Napi::Value TreeCursor::GotoFirstChildForIndex(const Napi::CallbackInfo &info) {
96
+ Napi::Env env = info.Env();
97
+ if (!info[0].IsNumber()) {
98
+ throw TypeError::New(env, "First argument must be an integer");
99
+ }
100
+ auto index = info[0].As<Number>();
101
+ uint32_t goal_byte = index.Uint32Value() * 2;
102
+ int64_t child_index = ts_tree_cursor_goto_first_child_for_byte(&cursor_, goal_byte);
103
+ if (child_index < 0) {
104
+ return env.Null();
105
+ }
106
+ return Number::New(env, static_cast<double>(child_index));
107
+
108
+ }
109
+
110
+ Napi::Value TreeCursor::GotoFirstChildForPosition(const Napi::CallbackInfo &info) {
111
+ Napi::Env env = info.Env();
112
+ Napi::Maybe<TSPoint> goal_point = PointFromJS(info[0].As<Object>());
113
+ if (goal_point.IsNothing()) {
114
+ throw TypeError::New(env, "First argument must be a Point object");
115
+ }
116
+ int64_t child_index = ts_tree_cursor_goto_first_child_for_point(&cursor_, goal_point.Unwrap());
117
+ if (child_index < 0) {
118
+ return env.Null();
119
+ }
120
+ return Number::New(env, static_cast<double>(child_index));
121
+ }
122
+
123
+ Napi::Value TreeCursor::StartPosition(const Napi::CallbackInfo &info) {
124
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
125
+ TransferPoint(info.Env(), ts_node_start_point(node));
126
+ return info.Env().Undefined();
127
+ }
128
+
129
+ Napi::Value TreeCursor::EndPosition(const Napi::CallbackInfo &info) {
130
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
131
+ TransferPoint(info.Env(), ts_node_end_point(node));
132
+ return info.Env().Undefined();
133
+ }
134
+
135
+ Napi::Value TreeCursor::CurrentNode(const Napi::CallbackInfo &info) {
136
+ const Tree *tree = Tree::UnwrapTree(info.This().As<Object>()["tree"]);
137
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
138
+ return node_methods::MarshalNode(info, tree, node);
139
+ }
140
+
141
+ Napi::Value TreeCursor::Reset(const Napi::CallbackInfo &info) {
142
+ const Tree *tree = Tree::UnwrapTree(info.This().As<Object>()["tree"]);
143
+ TSNode node = node_methods::UnmarshalNode(info.Env(), tree);
144
+ ts_tree_cursor_reset(&cursor_, node);
145
+ return info.Env().Undefined();
146
+ }
147
+
148
+ Napi::Value TreeCursor::ResetTo(const Napi::CallbackInfo &info) {
149
+ TSTreeCursor other_cursor = TreeCursor::Unwrap(info[0].As<Object>())->cursor_;
150
+ ts_tree_cursor_reset_to(&cursor_, &other_cursor);
151
+ return info.Env().Undefined();
152
+ }
153
+
154
+ Napi::Value TreeCursor::NodeType(const Napi::CallbackInfo &info) {
155
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
156
+ return String::New(info.Env(), ts_node_type(node));;
157
+ }
158
+
159
+ Napi::Value TreeCursor::NodeTypeId(const Napi::CallbackInfo &info) {
160
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
161
+ return Number::New(info.Env(), static_cast<double>(ts_node_symbol(node)));
162
+ }
163
+
164
+ Napi::Value TreeCursor::NodeStateId(const Napi::CallbackInfo &info) {
165
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
166
+ return Number::New(info.Env(), static_cast<double>(ts_node_parse_state(node)));
167
+ }
168
+
169
+ Napi::Value TreeCursor::NodeIsNamed(const Napi::CallbackInfo &info) {
170
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
171
+ return Boolean::New(info.Env(), ts_node_is_named(node));
172
+ }
173
+
174
+ Napi::Value TreeCursor::NodeIsMissing(const Napi::CallbackInfo &info) {
175
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
176
+ return Boolean::New(info.Env(), ts_node_is_missing(node));
177
+ }
178
+
179
+ Napi::Value TreeCursor::CurrentFieldId(const Napi::CallbackInfo &info) {
180
+ TSFieldId field_id = ts_tree_cursor_current_field_id(&cursor_);
181
+ if (field_id != 0) {
182
+ return Number::New(info.Env(), static_cast<double>(field_id));
183
+ }
184
+ return info.Env().Undefined();
185
+ }
186
+
187
+ Napi::Value TreeCursor::CurrentFieldName(const Napi::CallbackInfo &info) {
188
+ const char *field_name = ts_tree_cursor_current_field_name(&cursor_);
189
+ if (field_name != nullptr) {
190
+ return String::New(info.Env(), field_name);
191
+ }
192
+ return info.Env().Undefined();
193
+ }
194
+
195
+ Napi::Value TreeCursor::CurrentDepth(const Napi::CallbackInfo &info) {
196
+ return Number::New(info.Env(), static_cast<double>(ts_tree_cursor_current_depth(&cursor_)));
197
+ }
198
+
199
+ Napi::Value TreeCursor::CurrentDescendantIndex(const Napi::CallbackInfo &info) {
200
+ return Number::New(info.Env(), static_cast<double>(ts_tree_cursor_current_descendant_index(&cursor_)));
201
+ }
202
+
203
+ Napi::Value TreeCursor::StartIndex(const Napi::CallbackInfo &info) {
204
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
205
+ return ByteCountToJS(info.Env(), ts_node_start_byte(node));
206
+ }
207
+
208
+ Napi::Value TreeCursor::EndIndex(const Napi::CallbackInfo &info) {
209
+ TSNode node = ts_tree_cursor_current_node(&cursor_);
210
+ return ByteCountToJS(info.Env(), ts_node_end_byte(node));
211
+ }
212
+
213
+ } // namespace node_tree_sitter
@@ -0,0 +1,52 @@
1
+ #ifndef NODE_TREE_SITTER_TREE_CURSOR_H_
2
+ #define NODE_TREE_SITTER_TREE_CURSOR_H_
3
+
4
+ #include "./addon_data.h"
5
+ #include "tree_sitter/api.h"
6
+
7
+ #include <napi.h>
8
+ #include <node_object_wrap.h>
9
+
10
+ namespace node_tree_sitter {
11
+
12
+ class TreeCursor final : public Napi::ObjectWrap<TreeCursor> {
13
+ public:
14
+ static void Init(Napi::Env env, Napi::Object exports);
15
+ static Napi::Value NewInstance(Napi::Env Env, TSTreeCursor);
16
+
17
+ explicit TreeCursor(const Napi::CallbackInfo &);
18
+ ~TreeCursor() final;
19
+
20
+ TSTreeCursor cursor_;
21
+
22
+ private:
23
+ Napi::Value GotoFirstChild(const Napi::CallbackInfo &);
24
+ Napi::Value GotoLastChild(const Napi::CallbackInfo &);
25
+ Napi::Value GotoParent(const Napi::CallbackInfo &);
26
+ Napi::Value GotoNextSibling(const Napi::CallbackInfo &);
27
+ Napi::Value GotoPreviousSibling(const Napi::CallbackInfo &);
28
+ Napi::Value GotoDescendant(const Napi::CallbackInfo &);
29
+ Napi::Value GotoFirstChildForIndex(const Napi::CallbackInfo &);
30
+ Napi::Value GotoFirstChildForPosition(const Napi::CallbackInfo &);
31
+ Napi::Value StartPosition(const Napi::CallbackInfo &);
32
+ Napi::Value EndPosition(const Napi::CallbackInfo &);
33
+ Napi::Value CurrentNode(const Napi::CallbackInfo &);
34
+ Napi::Value Reset(const Napi::CallbackInfo &);
35
+ Napi::Value ResetTo(const Napi::CallbackInfo &);
36
+
37
+ Napi::Value NodeType(const Napi::CallbackInfo &);
38
+ Napi::Value NodeTypeId(const Napi::CallbackInfo &);
39
+ Napi::Value NodeStateId(const Napi::CallbackInfo &);
40
+ Napi::Value NodeIsNamed(const Napi::CallbackInfo &);
41
+ Napi::Value NodeIsMissing(const Napi::CallbackInfo &);
42
+ Napi::Value CurrentFieldId(const Napi::CallbackInfo &);
43
+ Napi::Value CurrentFieldName(const Napi::CallbackInfo &);
44
+ Napi::Value CurrentDepth(const Napi::CallbackInfo &);
45
+ Napi::Value CurrentDescendantIndex(const Napi::CallbackInfo &);
46
+ Napi::Value StartIndex(const Napi::CallbackInfo &);
47
+ Napi::Value EndIndex(const Napi::CallbackInfo &);
48
+ };
49
+
50
+ } // namespace node_tree_sitter
51
+
52
+ #endif // NODE_TREE_SITTER_TREE_CURSOR_H_