ast-grep-cli 0.27.2__tar.gz → 0.27.3__tar.gz

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 (106) hide show
  1. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/Cargo.lock +54 -54
  2. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/Cargo.toml +6 -6
  3. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/PKG-INFO +1 -1
  4. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/debug.rs +92 -8
  5. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/run.rs +3 -5
  6. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/matcher/pattern.rs +7 -2
  7. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/pyproject.toml +1 -1
  8. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/LICENSE +0 -0
  9. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/README.md +0 -0
  10. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/Cargo.toml +0 -0
  11. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/bin/ast-grep.rs +0 -0
  12. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/completions.rs +0 -0
  13. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/config.rs +0 -0
  14. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/error.rs +0 -0
  15. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/lang/custom_lang.rs +0 -0
  16. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/lang/injection.rs +0 -0
  17. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/lang/lang_globs.rs +0 -0
  18. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/lang.rs +0 -0
  19. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/lib.rs +0 -0
  20. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/lsp.rs +0 -0
  21. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/main.rs +0 -0
  22. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/new.rs +0 -0
  23. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/print/cloud_print.rs +0 -0
  24. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/print/colored_print/test.rs +0 -0
  25. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/print/colored_print.rs +0 -0
  26. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/print/interactive_print.rs +0 -0
  27. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/print/json_print.rs +0 -0
  28. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/print/mod.rs +0 -0
  29. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/scan.rs +0 -0
  30. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/utils.rs +0 -0
  31. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/verify/case_result.rs +0 -0
  32. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/verify/find_file.rs +0 -0
  33. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/verify/mod.rs +0 -0
  34. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/verify/reporter.rs +0 -0
  35. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/verify/snapshot.rs +0 -0
  36. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/src/verify/test_case.rs +0 -0
  37. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/tests/common/mod.rs +0 -0
  38. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/tests/run_test.rs +0 -0
  39. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/tests/scan_test.rs +0 -0
  40. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/cli/tests/verify_test.rs +0 -0
  41. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/Cargo.toml +0 -0
  42. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/check_var.rs +0 -0
  43. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/combined.rs +0 -0
  44. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/fixer.rs +0 -0
  45. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/lib.rs +0 -0
  46. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/maybe.rs +0 -0
  47. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule/deserialize_env.rs +0 -0
  48. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule/mod.rs +0 -0
  49. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule/nth_child.rs +0 -0
  50. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule/referent_rule.rs +0 -0
  51. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule/relational_rule.rs +0 -0
  52. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule/stop_by.rs +0 -0
  53. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule_collection.rs +0 -0
  54. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule_config.rs +0 -0
  55. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/rule_core.rs +0 -0
  56. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/transform/mod.rs +0 -0
  57. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/transform/rewrite.rs +0 -0
  58. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/transform/string_case.rs +0 -0
  59. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/config/src/transform/transformation.rs +0 -0
  60. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/Cargo.toml +0 -0
  61. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/language.rs +0 -0
  62. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/lib.rs +0 -0
  63. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/match_tree/match_node.rs +0 -0
  64. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/match_tree/mod.rs +0 -0
  65. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/match_tree/strictness.rs +0 -0
  66. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/matcher/kind.rs +0 -0
  67. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/matcher/node_match.rs +0 -0
  68. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/matcher/text.rs +0 -0
  69. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/matcher.rs +0 -0
  70. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/meta_var.rs +0 -0
  71. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/node.rs +0 -0
  72. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/ops.rs +0 -0
  73. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/pinned.rs +0 -0
  74. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/replacer/indent.rs +0 -0
  75. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/replacer/structural.rs +0 -0
  76. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/replacer/template.rs +0 -0
  77. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/replacer.rs +0 -0
  78. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/source.rs +0 -0
  79. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/core/src/traversal.rs +0 -0
  80. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/dynamic/Cargo.toml +0 -0
  81. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/dynamic/src/lib.rs +0 -0
  82. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/Cargo.toml +0 -0
  83. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/bash.rs +0 -0
  84. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/cpp.rs +0 -0
  85. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/csharp.rs +0 -0
  86. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/css.rs +0 -0
  87. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/elixir.rs +0 -0
  88. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/go.rs +0 -0
  89. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/haskell.rs +0 -0
  90. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/html.rs +0 -0
  91. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/json.rs +0 -0
  92. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/kotlin.rs +0 -0
  93. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/lib.rs +0 -0
  94. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/lua.rs +0 -0
  95. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/parsers.rs +0 -0
  96. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/php.rs +0 -0
  97. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/python.rs +0 -0
  98. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/ruby.rs +0 -0
  99. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/rust.rs +0 -0
  100. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/scala.rs +0 -0
  101. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/swift.rs +0 -0
  102. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/language/src/yaml.rs +0 -0
  103. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/lsp/Cargo.toml +0 -0
  104. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/lsp/src/lib.rs +0 -0
  105. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/lsp/src/utils.rs +0 -0
  106. {ast_grep_cli-0.27.2 → ast_grep_cli-0.27.3}/crates/lsp/tests/basic.rs +0 -0
@@ -92,9 +92,9 @@ dependencies = [
92
92
 
93
93
  [[package]]
94
94
  name = "anyhow"
95
- version = "1.0.86"
95
+ version = "1.0.89"
96
96
  source = "registry+https://github.com/rust-lang/crates.io-index"
97
- checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
97
+ checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
98
98
 
99
99
  [[package]]
100
100
  name = "assert_cmd"
@@ -114,7 +114,7 @@ dependencies = [
114
114
 
115
115
  [[package]]
116
116
  name = "ast-grep"
117
- version = "0.27.2"
117
+ version = "0.27.3"
118
118
  dependencies = [
119
119
  "ansi_term",
120
120
  "anyhow",
@@ -145,7 +145,7 @@ dependencies = [
145
145
 
146
146
  [[package]]
147
147
  name = "ast-grep-config"
148
- version = "0.27.2"
148
+ version = "0.27.3"
149
149
  dependencies = [
150
150
  "anyhow",
151
151
  "ast-grep-core",
@@ -161,7 +161,7 @@ dependencies = [
161
161
 
162
162
  [[package]]
163
163
  name = "ast-grep-core"
164
- version = "0.27.2"
164
+ version = "0.27.3"
165
165
  dependencies = [
166
166
  "bit-set",
167
167
  "regex",
@@ -172,7 +172,7 @@ dependencies = [
172
172
 
173
173
  [[package]]
174
174
  name = "ast-grep-dynamic"
175
- version = "0.27.2"
175
+ version = "0.27.3"
176
176
  dependencies = [
177
177
  "ast-grep-core",
178
178
  "ignore",
@@ -184,7 +184,7 @@ dependencies = [
184
184
 
185
185
  [[package]]
186
186
  name = "ast-grep-language"
187
- version = "0.27.2"
187
+ version = "0.27.3"
188
188
  dependencies = [
189
189
  "ast-grep-core",
190
190
  "ignore",
@@ -217,12 +217,12 @@ dependencies = [
217
217
 
218
218
  [[package]]
219
219
  name = "ast-grep-lsp"
220
- version = "0.27.2"
220
+ version = "0.27.3"
221
221
  dependencies = [
222
222
  "ast-grep-config",
223
223
  "ast-grep-core",
224
224
  "ast-grep-language",
225
- "dashmap 6.0.1",
225
+ "dashmap 6.1.0",
226
226
  "serde",
227
227
  "serde_json",
228
228
  "tokio",
@@ -231,7 +231,7 @@ dependencies = [
231
231
 
232
232
  [[package]]
233
233
  name = "ast-grep-napi"
234
- version = "0.27.2"
234
+ version = "0.27.3"
235
235
  dependencies = [
236
236
  "ast-grep-config",
237
237
  "ast-grep-core",
@@ -250,7 +250,7 @@ dependencies = [
250
250
 
251
251
  [[package]]
252
252
  name = "ast-grep-py"
253
- version = "0.27.2"
253
+ version = "0.27.3"
254
254
  dependencies = [
255
255
  "anyhow",
256
256
  "ast-grep-config",
@@ -318,7 +318,7 @@ dependencies = [
318
318
 
319
319
  [[package]]
320
320
  name = "benches"
321
- version = "0.27.2"
321
+ version = "0.27.3"
322
322
  dependencies = [
323
323
  "ast-grep-config",
324
324
  "ast-grep-core",
@@ -429,9 +429,9 @@ dependencies = [
429
429
 
430
430
  [[package]]
431
431
  name = "clap"
432
- version = "4.5.16"
432
+ version = "4.5.18"
433
433
  source = "registry+https://github.com/rust-lang/crates.io-index"
434
- checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019"
434
+ checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3"
435
435
  dependencies = [
436
436
  "clap_builder",
437
437
  "clap_derive",
@@ -439,9 +439,9 @@ dependencies = [
439
439
 
440
440
  [[package]]
441
441
  name = "clap_builder"
442
- version = "4.5.15"
442
+ version = "4.5.18"
443
443
  source = "registry+https://github.com/rust-lang/crates.io-index"
444
- checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"
444
+ checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b"
445
445
  dependencies = [
446
446
  "anstream",
447
447
  "anstyle",
@@ -451,18 +451,18 @@ dependencies = [
451
451
 
452
452
  [[package]]
453
453
  name = "clap_complete"
454
- version = "4.5.23"
454
+ version = "4.5.29"
455
455
  source = "registry+https://github.com/rust-lang/crates.io-index"
456
- checksum = "531d7959c5bbb6e266cecdd0f20213639c3a5c3e4d615f97db87661745f781ff"
456
+ checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e"
457
457
  dependencies = [
458
458
  "clap",
459
459
  ]
460
460
 
461
461
  [[package]]
462
462
  name = "clap_derive"
463
- version = "4.5.13"
463
+ version = "4.5.18"
464
464
  source = "registry+https://github.com/rust-lang/crates.io-index"
465
- checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
465
+ checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
466
466
  dependencies = [
467
467
  "heck",
468
468
  "proc-macro2",
@@ -634,9 +634,9 @@ dependencies = [
634
634
 
635
635
  [[package]]
636
636
  name = "dashmap"
637
- version = "6.0.1"
637
+ version = "6.1.0"
638
638
  source = "registry+https://github.com/rust-lang/crates.io-index"
639
- checksum = "804c8821570c3f8b70230c2ba75ffa5c0f9a4189b9a432b6656c536712acae28"
639
+ checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
640
640
  dependencies = [
641
641
  "cfg-if",
642
642
  "crossbeam-utils",
@@ -813,9 +813,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
813
813
 
814
814
  [[package]]
815
815
  name = "globset"
816
- version = "0.4.14"
816
+ version = "0.4.15"
817
817
  source = "registry+https://github.com/rust-lang/crates.io-index"
818
- checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
818
+ checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19"
819
819
  dependencies = [
820
820
  "aho-corasick",
821
821
  "bstr",
@@ -879,9 +879,9 @@ dependencies = [
879
879
 
880
880
  [[package]]
881
881
  name = "ignore"
882
- version = "0.4.22"
882
+ version = "0.4.23"
883
883
  source = "registry+https://github.com/rust-lang/crates.io-index"
884
- checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1"
884
+ checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b"
885
885
  dependencies = [
886
886
  "crossbeam-deque",
887
887
  "globset",
@@ -895,9 +895,9 @@ dependencies = [
895
895
 
896
896
  [[package]]
897
897
  name = "indexmap"
898
- version = "2.2.6"
898
+ version = "2.5.0"
899
899
  source = "registry+https://github.com/rust-lang/crates.io-index"
900
- checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
900
+ checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
901
901
  dependencies = [
902
902
  "equivalent",
903
903
  "hashbrown",
@@ -1069,9 +1069,9 @@ dependencies = [
1069
1069
 
1070
1070
  [[package]]
1071
1071
  name = "napi"
1072
- version = "2.16.9"
1072
+ version = "2.16.11"
1073
1073
  source = "registry+https://github.com/rust-lang/crates.io-index"
1074
- checksum = "1277600d452e570cc83cf5f4e8efb389cc21e5cbefadcfba7239f4551e2e3e99"
1074
+ checksum = "53575dfa17f208dd1ce3a2da2da4659aae393b256a472f2738a8586a6c4107fd"
1075
1075
  dependencies = [
1076
1076
  "anyhow",
1077
1077
  "bitflags 2.5.0",
@@ -1091,9 +1091,9 @@ checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a"
1091
1091
 
1092
1092
  [[package]]
1093
1093
  name = "napi-derive"
1094
- version = "2.16.11"
1094
+ version = "2.16.12"
1095
1095
  source = "registry+https://github.com/rust-lang/crates.io-index"
1096
- checksum = "150d87c4440b9f4815cb454918db498b5aae9a57aa743d20783fe75381181d01"
1096
+ checksum = "17435f7a00bfdab20b0c27d9c56f58f6499e418252253081bfff448099da31d1"
1097
1097
  dependencies = [
1098
1098
  "cfg-if",
1099
1099
  "convert_case",
@@ -1105,9 +1105,9 @@ dependencies = [
1105
1105
 
1106
1106
  [[package]]
1107
1107
  name = "napi-derive-backend"
1108
- version = "1.0.73"
1108
+ version = "1.0.74"
1109
1109
  source = "registry+https://github.com/rust-lang/crates.io-index"
1110
- checksum = "0cd81b794fc1d6051acf8c4f3cb4f82833b0621272a232b4ff0cf3df1dbddb61"
1110
+ checksum = "967c485e00f0bf3b1bdbe510a38a4606919cf1d34d9a37ad41f25a81aa077abe"
1111
1111
  dependencies = [
1112
1112
  "convert_case",
1113
1113
  "once_cell",
@@ -1318,9 +1318,9 @@ dependencies = [
1318
1318
 
1319
1319
  [[package]]
1320
1320
  name = "pyo3"
1321
- version = "0.22.2"
1321
+ version = "0.22.3"
1322
1322
  source = "registry+https://github.com/rust-lang/crates.io-index"
1323
- checksum = "831e8e819a138c36e212f3af3fd9eeffed6bf1510a805af35b0edee5ffa59433"
1323
+ checksum = "15ee168e30649f7f234c3d49ef5a7a6cbf5134289bc46c29ff3155fa3221c225"
1324
1324
  dependencies = [
1325
1325
  "anyhow",
1326
1326
  "cfg-if",
@@ -1337,9 +1337,9 @@ dependencies = [
1337
1337
 
1338
1338
  [[package]]
1339
1339
  name = "pyo3-build-config"
1340
- version = "0.22.2"
1340
+ version = "0.22.3"
1341
1341
  source = "registry+https://github.com/rust-lang/crates.io-index"
1342
- checksum = "1e8730e591b14492a8945cdff32f089250b05f5accecf74aeddf9e8272ce1fa8"
1342
+ checksum = "e61cef80755fe9e46bb8a0b8f20752ca7676dcc07a5277d8b7768c6172e529b3"
1343
1343
  dependencies = [
1344
1344
  "once_cell",
1345
1345
  "target-lexicon",
@@ -1347,9 +1347,9 @@ dependencies = [
1347
1347
 
1348
1348
  [[package]]
1349
1349
  name = "pyo3-ffi"
1350
- version = "0.22.2"
1350
+ version = "0.22.3"
1351
1351
  source = "registry+https://github.com/rust-lang/crates.io-index"
1352
- checksum = "5e97e919d2df92eb88ca80a037969f44e5e70356559654962cbb3316d00300c6"
1352
+ checksum = "67ce096073ec5405f5ee2b8b31f03a68e02aa10d5d4f565eca04acc41931fa1c"
1353
1353
  dependencies = [
1354
1354
  "libc",
1355
1355
  "pyo3-build-config",
@@ -1357,9 +1357,9 @@ dependencies = [
1357
1357
 
1358
1358
  [[package]]
1359
1359
  name = "pyo3-macros"
1360
- version = "0.22.2"
1360
+ version = "0.22.3"
1361
1361
  source = "registry+https://github.com/rust-lang/crates.io-index"
1362
- checksum = "eb57983022ad41f9e683a599f2fd13c3664d7063a3ac5714cae4b7bee7d3f206"
1362
+ checksum = "2440c6d12bc8f3ae39f1e775266fa5122fd0c8891ce7520fa6048e683ad3de28"
1363
1363
  dependencies = [
1364
1364
  "proc-macro2",
1365
1365
  "pyo3-macros-backend",
@@ -1369,9 +1369,9 @@ dependencies = [
1369
1369
 
1370
1370
  [[package]]
1371
1371
  name = "pyo3-macros-backend"
1372
- version = "0.22.2"
1372
+ version = "0.22.3"
1373
1373
  source = "registry+https://github.com/rust-lang/crates.io-index"
1374
- checksum = "ec480c0c51ddec81019531705acac51bcdbeae563557c982aa8263bb96880372"
1374
+ checksum = "1be962f0e06da8f8465729ea2cb71a416d2257dff56cbe40a70d3e62a93ae5d1"
1375
1375
  dependencies = [
1376
1376
  "heck",
1377
1377
  "proc-macro2",
@@ -1529,18 +1529,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
1529
1529
 
1530
1530
  [[package]]
1531
1531
  name = "serde"
1532
- version = "1.0.209"
1532
+ version = "1.0.210"
1533
1533
  source = "registry+https://github.com/rust-lang/crates.io-index"
1534
- checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
1534
+ checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
1535
1535
  dependencies = [
1536
1536
  "serde_derive",
1537
1537
  ]
1538
1538
 
1539
1539
  [[package]]
1540
1540
  name = "serde_derive"
1541
- version = "1.0.209"
1541
+ version = "1.0.210"
1542
1542
  source = "registry+https://github.com/rust-lang/crates.io-index"
1543
- checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
1543
+ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
1544
1544
  dependencies = [
1545
1545
  "proc-macro2",
1546
1546
  "quote",
@@ -1560,9 +1560,9 @@ dependencies = [
1560
1560
 
1561
1561
  [[package]]
1562
1562
  name = "serde_json"
1563
- version = "1.0.127"
1563
+ version = "1.0.128"
1564
1564
  source = "registry+https://github.com/rust-lang/crates.io-index"
1565
- checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
1565
+ checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
1566
1566
  dependencies = [
1567
1567
  "indexmap",
1568
1568
  "itoa",
@@ -1755,9 +1755,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1755
1755
 
1756
1756
  [[package]]
1757
1757
  name = "tokio"
1758
- version = "1.39.3"
1758
+ version = "1.40.0"
1759
1759
  source = "registry+https://github.com/rust-lang/crates.io-index"
1760
- checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
1760
+ checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
1761
1761
  dependencies = [
1762
1762
  "backtrace",
1763
1763
  "bytes",
@@ -1785,9 +1785,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
1785
1785
 
1786
1786
  [[package]]
1787
1787
  name = "toml_edit"
1788
- version = "0.22.20"
1788
+ version = "0.22.21"
1789
1789
  source = "registry+https://github.com/rust-lang/crates.io-index"
1790
- checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
1790
+ checksum = "3b072cee73c449a636ffd6f32bd8de3a9f7119139aff882f44943ce2986dc5cf"
1791
1791
  dependencies = [
1792
1792
  "indexmap",
1793
1793
  "toml_datetime",
@@ -7,7 +7,7 @@ resolver = "2"
7
7
  lto = true
8
8
 
9
9
  [workspace.package]
10
- version = "0.27.2"
10
+ version = "0.27.3"
11
11
  authors = ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"]
12
12
  edition = "2021"
13
13
  license = "MIT"
@@ -18,11 +18,11 @@ rust-version = "1.67"
18
18
  readme = "README.md"
19
19
 
20
20
  [workspace.dependencies]
21
- ast-grep-core = { path = "crates/core", version = "0.27.2" }
22
- ast-grep-config = { path = "crates/config", version = "0.27.2" }
23
- ast-grep-dynamic = { path = "crates/dynamic", version = "0.27.2" }
24
- ast-grep-language = { path = "crates/language", version = "0.27.2" }
25
- ast-grep-lsp = { path = "crates/lsp", version = "0.27.2" }
21
+ ast-grep-core = { path = "crates/core", version = "0.27.3" }
22
+ ast-grep-config = { path = "crates/config", version = "0.27.3" }
23
+ ast-grep-dynamic = { path = "crates/dynamic", version = "0.27.3" }
24
+ ast-grep-language = { path = "crates/language", version = "0.27.3" }
25
+ ast-grep-lsp = { path = "crates/lsp", version = "0.27.3" }
26
26
 
27
27
  bit-set = { version = "0.8.0" }
28
28
  ignore = { version = "0.4.22" }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ast-grep-cli
3
- Version: 0.27.2
3
+ Version: 0.27.3
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -1,7 +1,7 @@
1
1
  use crate::lang::SgLang;
2
2
  use crate::print::ColorArg;
3
3
  use ansi_term::Style;
4
- use ast_grep_core::Pattern;
4
+ use ast_grep_core::{language::TSLanguage, matcher::PatternNode, meta_var::MetaVariable, Pattern};
5
5
  use ast_grep_language::Language;
6
6
  use clap::ValueEnum;
7
7
  use tree_sitter as ts;
@@ -18,24 +18,28 @@ pub enum DebugFormat {
18
18
  Sexp,
19
19
  }
20
20
  impl DebugFormat {
21
- pub fn debug_query(&self, pattern: &str, lang: SgLang, color: ColorArg) {
21
+ pub fn debug_query(&self, src: &str, pattern: &Pattern<SgLang>, lang: SgLang, color: ColorArg) {
22
22
  let colored = color.should_use_color();
23
23
  match self {
24
24
  DebugFormat::Pattern => {
25
- let pattern = Pattern::try_new(pattern, lang).expect("pattern must be validated in run");
26
- println!("Debug Pattern:\n{:?}", pattern);
25
+ let lang = lang.get_ts_language();
26
+ let mut ret = String::new();
27
+ let fmt = DumpFmt::named(colored);
28
+ dump_pattern(&pattern.node, &lang, &fmt, 0, &mut ret)
29
+ .expect("unexpected error in writing string");
30
+ println!("Debug Pattern:\n{}", ret);
27
31
  }
28
32
  DebugFormat::Sexp => {
29
- let root = lang.ast_grep(pattern);
33
+ let root = lang.ast_grep(src);
30
34
  println!("Debug Sexp:\n{}", root.root().to_sexp());
31
35
  }
32
36
  DebugFormat::Ast => {
33
- let root = lang.ast_grep(pattern);
37
+ let root = lang.ast_grep(src);
34
38
  let dumped = dump_node(root.root().get_ts_node());
35
39
  println!("Debug AST:\n{}", dumped.ast(colored));
36
40
  }
37
41
  DebugFormat::Cst => {
38
- let root = lang.ast_grep(pattern);
42
+ let root = lang.ast_grep(src);
39
43
  let dumped = dump_node(root.root().get_ts_node());
40
44
  println!("Debug CST:\n{}", dumped.cst(colored));
41
45
  }
@@ -43,6 +47,51 @@ impl DebugFormat {
43
47
  }
44
48
  }
45
49
 
50
+ fn dump_pattern(
51
+ pattern: &PatternNode,
52
+ lang: &TSLanguage,
53
+ style: &DumpFmt,
54
+ indent: usize,
55
+ ret: &mut String,
56
+ ) -> FmtResult {
57
+ write!(ret, "{}", " ".repeat(indent))?;
58
+ match pattern {
59
+ PatternNode::MetaVar { meta_var } => {
60
+ let meta_var = match meta_var {
61
+ MetaVariable::Capture(name, _) => format!("${name}"),
62
+ MetaVariable::MultiCapture(name) => format!("$$${name}"),
63
+ MetaVariable::Multiple => "$$$".to_string(),
64
+ MetaVariable::Dropped(_) => "$_".to_string(),
65
+ };
66
+ let meta_var = style.kind_style.paint(meta_var);
67
+ writeln!(ret, "{} {meta_var}", style.field_style.paint("MetaVar"))?;
68
+ }
69
+ PatternNode::Terminal {
70
+ text,
71
+ kind_id,
72
+ is_named,
73
+ } => {
74
+ let lang = lang.get_ts_language();
75
+ if *is_named {
76
+ let kind = lang.node_kind_for_id(*kind_id).unwrap();
77
+ let kind = style.kind_style.paint(format!("{kind}"));
78
+ writeln!(ret, "{kind} {text}")?;
79
+ } else {
80
+ writeln!(ret, "{text}")?;
81
+ }
82
+ }
83
+ PatternNode::Internal { kind_id, children } => {
84
+ let kind = lang.node_kind_for_id(*kind_id).unwrap();
85
+ let kind = style.kind_style.paint(kind);
86
+ writeln!(ret, "{kind}")?;
87
+ for child in children {
88
+ dump_pattern(child, lang, style, indent + 1, ret)?;
89
+ }
90
+ }
91
+ }
92
+ Ok(())
93
+ }
94
+
46
95
  pub struct DumpNode {
47
96
  field: Option<String>,
48
97
  kind: String,
@@ -77,7 +126,6 @@ impl DumpFmt {
77
126
  }
78
127
  }
79
128
 
80
- // TODO: add colorized output
81
129
  use std::fmt::{Result as FmtResult, Write};
82
130
  impl DumpNode {
83
131
  pub fn ast(&self, colored: bool) -> String {
@@ -178,3 +226,39 @@ fn dump_nodes(cursor: &mut ts::TreeCursor, target: &mut Vec<DumpNode>) {
178
226
  }
179
227
  }
180
228
  }
229
+
230
+ #[cfg(test)]
231
+ mod test {
232
+ use super::*;
233
+ use ast_grep_language::{TypeScript, C};
234
+ const DUMPED: &str = r#"
235
+ program (0,0)-(0,11)
236
+ variable_declaration (0,0)-(0,11)
237
+ variable_declarator (0,4)-(0,11)
238
+ name: identifier (0,4)-(0,5)
239
+ value: number (0,8)-(0,11)"#;
240
+ #[test]
241
+ fn test_dump_node() {
242
+ let lang = SgLang::Builtin(TypeScript.into());
243
+ let root = lang.ast_grep("var a = 123");
244
+ let dumped = dump_node(root.root().get_ts_node());
245
+ assert_eq!(DUMPED.trim(), dumped.ast(false).trim());
246
+ }
247
+
248
+ const MISSING: &str = r#"
249
+ translation_unit (0,0)-(0,9)
250
+ declaration (0,0)-(0,9)
251
+ type: primitive_type (0,0)-(0,3)
252
+ declarator: init_declarator (0,4)-(0,9)
253
+ declarator: identifier (0,4)-(0,5)
254
+ = (0,6)-(0,7)
255
+ value: number_literal (0,8)-(0,9)
256
+ MISSING ; (0,9)-(0,9)"#;
257
+ #[test]
258
+ fn test_missing_node() {
259
+ let lang = SgLang::Builtin(C.into());
260
+ let root = lang.ast_grep("int a = 1");
261
+ let dumped = dump_node(root.root().get_ts_node());
262
+ assert_eq!(MISSING.trim(), dumped.cst(false).trim());
263
+ }
264
+ }
@@ -264,6 +264,9 @@ impl<Printer> RunWithSpecificLang<Printer> {
264
264
  fn new(arg: RunArg, printer: Printer) -> Result<Self> {
265
265
  let lang = arg.lang.ok_or(anyhow::anyhow!(EC::LanguageNotSpecified))?;
266
266
  let pattern = arg.build_pattern(lang)?;
267
+ if let Some(format) = arg.debug_query {
268
+ format.debug_query(&arg.pattern, &pattern, lang, arg.output.color);
269
+ }
267
270
  let rewrite = if let Some(s) = &arg.rewrite {
268
271
  Some(Fixer::from_str(s, &lang).context(EC::ParsePattern)?)
269
272
  } else {
@@ -284,11 +287,6 @@ impl<P: Printer> Worker for RunWithSpecificLang<P> {
284
287
  fn consume_items(&self, items: Items<Self::Item>) -> Result<()> {
285
288
  let printer = &self.printer;
286
289
  printer.before_print()?;
287
- let arg = &self.arg;
288
- let lang = arg.lang.expect("must present");
289
- if let Some(format) = arg.debug_query {
290
- format.debug_query(&self.arg.pattern, lang, self.arg.output.color);
291
- }
292
290
  let mut has_matches = false;
293
291
  for match_unit in items {
294
292
  match_one_file(printer, &match_unit, &self.rewrite)?;
@@ -260,6 +260,11 @@ impl<L: Language> Matcher<L> for Pattern<L> {
260
260
  node: Node<'tree, D>,
261
261
  env: &mut Cow<MetaVarEnv<'tree, D>>,
262
262
  ) -> Option<Node<'tree, D>> {
263
+ if let Some(k) = self.root_kind {
264
+ if node.kind_id() != k {
265
+ return None;
266
+ }
267
+ }
263
268
  // do not pollute the env if pattern does not match
264
269
  let mut may_write = Cow::Borrowed(env.as_ref());
265
270
  let node = match_node_non_recursive(self, node, &mut may_write)?;
@@ -523,8 +528,8 @@ mod test {
523
528
  fn test_bare_wildcard_in_context() {
524
529
  let pattern = Pattern::contextual("class A { $F }", "property_identifier", Tsx).expect("test");
525
530
  let cand = pattern_node("let b = 123");
526
- // should it match?
527
- assert!(pattern.find_node(cand.root()).is_some());
531
+ // it should not match
532
+ assert!(pattern.find_node(cand.root()).is_none());
528
533
  }
529
534
 
530
535
  #[test]
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "ast-grep-cli"
7
- version = "0.27.2"
7
+ version = "0.27.3"
8
8
  description = "Structural Search and Rewrite code at large scale using precise AST pattern."
9
9
  authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
10
10
  maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
File without changes
File without changes