ast-grep-cli 0.22.2__tar.gz → 0.22.4__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 (99) hide show
  1. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/Cargo.lock +39 -39
  2. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/Cargo.toml +6 -6
  3. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/PKG-INFO +1 -1
  4. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/utils.rs +1 -1
  5. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/check_var.rs +38 -7
  6. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule/mod.rs +19 -0
  7. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule_core.rs +1 -0
  8. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/matcher/pattern.rs +22 -1
  9. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/node.rs +26 -0
  10. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/pyproject.toml +1 -1
  11. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/LICENSE +0 -0
  12. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/README.md +0 -0
  13. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/Cargo.toml +0 -0
  14. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/bin/ast-grep.rs +0 -0
  15. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/completions.rs +0 -0
  16. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/config.rs +0 -0
  17. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/error.rs +0 -0
  18. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/lang/custom_lang.rs +0 -0
  19. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/lang/lang_globs.rs +0 -0
  20. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/lang.rs +0 -0
  21. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/lib.rs +0 -0
  22. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/lsp.rs +0 -0
  23. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/main.rs +0 -0
  24. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/new.rs +0 -0
  25. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/print/cloud_print.rs +0 -0
  26. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/print/colored_print/test.rs +0 -0
  27. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/print/colored_print.rs +0 -0
  28. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/print/interactive_print.rs +0 -0
  29. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/print/json_print.rs +0 -0
  30. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/print/mod.rs +0 -0
  31. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/run.rs +0 -0
  32. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/scan.rs +0 -0
  33. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/verify/case_result.rs +0 -0
  34. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/verify/find_file.rs +0 -0
  35. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/verify/mod.rs +0 -0
  36. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/verify/reporter.rs +0 -0
  37. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/verify/snapshot.rs +0 -0
  38. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/src/verify/test_case.rs +0 -0
  39. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/tests/common/mod.rs +0 -0
  40. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/tests/run_test.rs +0 -0
  41. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/tests/scan_test.rs +0 -0
  42. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/cli/tests/verify_test.rs +0 -0
  43. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/Cargo.toml +0 -0
  44. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/combined.rs +0 -0
  45. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/fixer.rs +0 -0
  46. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/lib.rs +0 -0
  47. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/maybe.rs +0 -0
  48. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule/deserialize_env.rs +0 -0
  49. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule/referent_rule.rs +0 -0
  50. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule/relational_rule.rs +0 -0
  51. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule/stop_by.rs +0 -0
  52. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule_collection.rs +0 -0
  53. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/rule_config.rs +0 -0
  54. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/transform/mod.rs +0 -0
  55. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/transform/rewrite.rs +0 -0
  56. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/transform/string_case.rs +0 -0
  57. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/config/src/transform/transformation.rs +0 -0
  58. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/Cargo.toml +0 -0
  59. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/language.rs +0 -0
  60. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/lib.rs +0 -0
  61. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/match_tree.rs +0 -0
  62. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/matcher/kind.rs +0 -0
  63. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/matcher/node_match.rs +0 -0
  64. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/matcher/text.rs +0 -0
  65. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/matcher.rs +0 -0
  66. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/meta_var.rs +0 -0
  67. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/ops.rs +0 -0
  68. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/pinned.rs +0 -0
  69. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/replacer/indent.rs +0 -0
  70. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/replacer/structural.rs +0 -0
  71. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/replacer/template.rs +0 -0
  72. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/replacer.rs +0 -0
  73. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/source.rs +0 -0
  74. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/core/src/traversal.rs +0 -0
  75. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/dynamic/Cargo.toml +0 -0
  76. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/dynamic/src/lib.rs +0 -0
  77. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/Cargo.toml +0 -0
  78. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/bash.rs +0 -0
  79. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/cpp.rs +0 -0
  80. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/csharp.rs +0 -0
  81. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/css.rs +0 -0
  82. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/elixir.rs +0 -0
  83. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/go.rs +0 -0
  84. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/haskell.rs +0 -0
  85. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/html.rs +0 -0
  86. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/json.rs +0 -0
  87. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/kotlin.rs +0 -0
  88. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/lib.rs +0 -0
  89. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/lua.rs +0 -0
  90. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/parsers.rs +0 -0
  91. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/php.rs +0 -0
  92. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/python.rs +0 -0
  93. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/ruby.rs +0 -0
  94. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/rust.rs +0 -0
  95. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/scala.rs +0 -0
  96. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/language/src/swift.rs +0 -0
  97. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/lsp/Cargo.toml +0 -0
  98. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/crates/lsp/src/lib.rs +0 -0
  99. {ast_grep_cli-0.22.2 → ast_grep_cli-0.22.4}/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.83"
95
+ version = "1.0.86"
96
96
  source = "registry+https://github.com/rust-lang/crates.io-index"
97
- checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
97
+ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
98
98
 
99
99
  [[package]]
100
100
  name = "assert_cmd"
@@ -113,7 +113,7 @@ dependencies = [
113
113
 
114
114
  [[package]]
115
115
  name = "ast-grep"
116
- version = "0.22.2"
116
+ version = "0.22.4"
117
117
  dependencies = [
118
118
  "ansi_term",
119
119
  "anyhow",
@@ -144,7 +144,7 @@ dependencies = [
144
144
 
145
145
  [[package]]
146
146
  name = "ast-grep-config"
147
- version = "0.22.2"
147
+ version = "0.22.4"
148
148
  dependencies = [
149
149
  "anyhow",
150
150
  "ast-grep-core",
@@ -160,7 +160,7 @@ dependencies = [
160
160
 
161
161
  [[package]]
162
162
  name = "ast-grep-core"
163
- version = "0.22.2"
163
+ version = "0.22.4"
164
164
  dependencies = [
165
165
  "bit-set",
166
166
  "regex",
@@ -171,7 +171,7 @@ dependencies = [
171
171
 
172
172
  [[package]]
173
173
  name = "ast-grep-dynamic"
174
- version = "0.22.2"
174
+ version = "0.22.4"
175
175
  dependencies = [
176
176
  "ast-grep-core",
177
177
  "ignore",
@@ -183,7 +183,7 @@ dependencies = [
183
183
 
184
184
  [[package]]
185
185
  name = "ast-grep-language"
186
- version = "0.22.2"
186
+ version = "0.22.4"
187
187
  dependencies = [
188
188
  "ast-grep-core",
189
189
  "ignore",
@@ -214,7 +214,7 @@ dependencies = [
214
214
 
215
215
  [[package]]
216
216
  name = "ast-grep-lsp"
217
- version = "0.22.2"
217
+ version = "0.22.4"
218
218
  dependencies = [
219
219
  "ast-grep-config",
220
220
  "ast-grep-core",
@@ -228,7 +228,7 @@ dependencies = [
228
228
 
229
229
  [[package]]
230
230
  name = "ast-grep-napi"
231
- version = "0.22.2"
231
+ version = "0.22.4"
232
232
  dependencies = [
233
233
  "ast-grep-config",
234
234
  "ast-grep-core",
@@ -246,7 +246,7 @@ dependencies = [
246
246
 
247
247
  [[package]]
248
248
  name = "ast-grep-py"
249
- version = "0.22.2"
249
+ version = "0.22.4"
250
250
  dependencies = [
251
251
  "anyhow",
252
252
  "ast-grep-config",
@@ -312,7 +312,7 @@ dependencies = [
312
312
 
313
313
  [[package]]
314
314
  name = "benches"
315
- version = "0.22.2"
315
+ version = "0.22.4"
316
316
  dependencies = [
317
317
  "ast-grep-config",
318
318
  "ast-grep-core",
@@ -1064,9 +1064,9 @@ checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a"
1064
1064
 
1065
1065
  [[package]]
1066
1066
  name = "napi-derive"
1067
- version = "2.16.4"
1067
+ version = "2.16.5"
1068
1068
  source = "registry+https://github.com/rust-lang/crates.io-index"
1069
- checksum = "4bb613535cde46cff231e53cd819c1694a32d48946bc2dda6b41174ace52ac08"
1069
+ checksum = "e0e034ddf6155192cf83f267ede763fe6c164dfa9971585436b16173718d94c4"
1070
1070
  dependencies = [
1071
1071
  "cfg-if",
1072
1072
  "convert_case",
@@ -1078,9 +1078,9 @@ dependencies = [
1078
1078
 
1079
1079
  [[package]]
1080
1080
  name = "napi-derive-backend"
1081
- version = "1.0.66"
1081
+ version = "1.0.67"
1082
1082
  source = "registry+https://github.com/rust-lang/crates.io-index"
1083
- checksum = "da041b19246ab4240998774e987fd9a7d92cc7406b91b5eddb6691e81feac044"
1083
+ checksum = "bff2c00437f3b3266391eb5e6aa25d0029187daf5caf05b8e3271468fb5ae73e"
1084
1084
  dependencies = [
1085
1085
  "convert_case",
1086
1086
  "once_cell",
@@ -1466,9 +1466,9 @@ dependencies = [
1466
1466
 
1467
1467
  [[package]]
1468
1468
  name = "schemars"
1469
- version = "0.8.19"
1469
+ version = "0.8.21"
1470
1470
  source = "registry+https://github.com/rust-lang/crates.io-index"
1471
- checksum = "fc6e7ed6919cb46507fb01ff1654309219f62b4d603822501b0b80d42f6f21ef"
1471
+ checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92"
1472
1472
  dependencies = [
1473
1473
  "dyn-clone",
1474
1474
  "schemars_derive",
@@ -1478,9 +1478,9 @@ dependencies = [
1478
1478
 
1479
1479
  [[package]]
1480
1480
  name = "schemars_derive"
1481
- version = "0.8.19"
1481
+ version = "0.8.21"
1482
1482
  source = "registry+https://github.com/rust-lang/crates.io-index"
1483
- checksum = "185f2b7aa7e02d418e453790dde16890256bbd2bcd04b7dc5348811052b53f49"
1483
+ checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e"
1484
1484
  dependencies = [
1485
1485
  "proc-macro2",
1486
1486
  "quote",
@@ -1502,18 +1502,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
1502
1502
 
1503
1503
  [[package]]
1504
1504
  name = "serde"
1505
- version = "1.0.201"
1505
+ version = "1.0.203"
1506
1506
  source = "registry+https://github.com/rust-lang/crates.io-index"
1507
- checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c"
1507
+ checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
1508
1508
  dependencies = [
1509
1509
  "serde_derive",
1510
1510
  ]
1511
1511
 
1512
1512
  [[package]]
1513
1513
  name = "serde_derive"
1514
- version = "1.0.201"
1514
+ version = "1.0.203"
1515
1515
  source = "registry+https://github.com/rust-lang/crates.io-index"
1516
- checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
1516
+ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
1517
1517
  dependencies = [
1518
1518
  "proc-macro2",
1519
1519
  "quote",
@@ -1670,18 +1670,18 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76"
1670
1670
 
1671
1671
  [[package]]
1672
1672
  name = "thiserror"
1673
- version = "1.0.60"
1673
+ version = "1.0.61"
1674
1674
  source = "registry+https://github.com/rust-lang/crates.io-index"
1675
- checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
1675
+ checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
1676
1676
  dependencies = [
1677
1677
  "thiserror-impl",
1678
1678
  ]
1679
1679
 
1680
1680
  [[package]]
1681
1681
  name = "thiserror-impl"
1682
- version = "1.0.60"
1682
+ version = "1.0.61"
1683
1683
  source = "registry+https://github.com/rust-lang/crates.io-index"
1684
- checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
1684
+ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
1685
1685
  dependencies = [
1686
1686
  "proc-macro2",
1687
1687
  "quote",
@@ -1750,15 +1750,15 @@ dependencies = [
1750
1750
 
1751
1751
  [[package]]
1752
1752
  name = "toml_datetime"
1753
- version = "0.6.5"
1753
+ version = "0.6.6"
1754
1754
  source = "registry+https://github.com/rust-lang/crates.io-index"
1755
- checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
1755
+ checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
1756
1756
 
1757
1757
  [[package]]
1758
1758
  name = "toml_edit"
1759
- version = "0.22.12"
1759
+ version = "0.22.13"
1760
1760
  source = "registry+https://github.com/rust-lang/crates.io-index"
1761
- checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef"
1761
+ checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
1762
1762
  dependencies = [
1763
1763
  "indexmap",
1764
1764
  "toml_datetime",
@@ -1878,9 +1878,9 @@ dependencies = [
1878
1878
 
1879
1879
  [[package]]
1880
1880
  name = "tree-sitter-c"
1881
- version = "0.21.1"
1881
+ version = "0.21.3"
1882
1882
  source = "registry+https://github.com/rust-lang/crates.io-index"
1883
- checksum = "b4f0e5c383fd633a792eb8878367dc9d4a3c0e788bad5dcc84c200332ed1b8f2"
1883
+ checksum = "0e942d789b24dda298d41c95db353841159232feb80a52103c717e7c062bb9f3"
1884
1884
  dependencies = [
1885
1885
  "cc",
1886
1886
  "tree-sitter",
@@ -1898,9 +1898,9 @@ dependencies = [
1898
1898
 
1899
1899
  [[package]]
1900
1900
  name = "tree-sitter-cpp"
1901
- version = "0.22.0"
1901
+ version = "0.22.1"
1902
1902
  source = "registry+https://github.com/rust-lang/crates.io-index"
1903
- checksum = "28cd45e7e51833e81da966a15b0cb42baa50d82a45467292e2e5e25999e9736b"
1903
+ checksum = "128d495a2a236f365661c098f077cd57aada284891fb06df22a8cfbbcb596199"
1904
1904
  dependencies = [
1905
1905
  "cc",
1906
1906
  "tree-sitter",
@@ -1938,9 +1938,9 @@ dependencies = [
1938
1938
 
1939
1939
  [[package]]
1940
1940
  name = "tree-sitter-facade-sg"
1941
- version = "0.21.4"
1941
+ version = "0.21.5"
1942
1942
  source = "registry+https://github.com/rust-lang/crates.io-index"
1943
- checksum = "e7ca50a891218430da4837d9f411b365b83ce6a22c28f8d99933bcc5bc18cd0c"
1943
+ checksum = "906493dd94525dbb0cc38af596432245bede875810a4804dccd72433f450d223"
1944
1944
  dependencies = [
1945
1945
  "js-sys",
1946
1946
  "tree-sitter",
@@ -2031,9 +2031,9 @@ dependencies = [
2031
2031
 
2032
2032
  [[package]]
2033
2033
  name = "tree-sitter-php"
2034
- version = "0.22.4"
2034
+ version = "0.22.5"
2035
2035
  source = "registry+https://github.com/rust-lang/crates.io-index"
2036
- checksum = "bcd2a1c0c0e32fe11b2cd96ef6b978ed366989c893e17f8af0f3b49beb4aaf5e"
2036
+ checksum = "579299df8217105cae7688e8781f233af7eba6a1c10d870115bb34ba56341593"
2037
2037
  dependencies = [
2038
2038
  "cc",
2039
2039
  "tree-sitter",
@@ -7,7 +7,7 @@ resolver = "2"
7
7
  lto = true
8
8
 
9
9
  [workspace.package]
10
- version = "0.22.2"
10
+ version = "0.22.4"
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.22.2" }
22
- ast-grep-config = { path = "crates/config", version = "0.22.2" }
23
- ast-grep-dynamic = { path = "crates/dynamic", version = "0.22.2" }
24
- ast-grep-language = { path = "crates/language", version = "0.22.2" }
25
- ast-grep-lsp = { path = "crates/lsp", version = "0.22.2" }
21
+ ast-grep-core = { path = "crates/core", version = "0.22.4" }
22
+ ast-grep-config = { path = "crates/config", version = "0.22.4" }
23
+ ast-grep-dynamic = { path = "crates/dynamic", version = "0.22.4" }
24
+ ast-grep-language = { path = "crates/language", version = "0.22.4" }
25
+ ast-grep-lsp = { path = "crates/lsp", version = "0.22.4" }
26
26
 
27
27
  bit-set = { version = "0.5.3" }
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.22.2
3
+ Version: 0.22.4
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -187,7 +187,7 @@ fn run_worker<W: PathWorker + ?Sized + 'static>(worker: Arc<W>) -> Result<()> {
187
187
  fn read_file(path: &Path) -> Option<String> {
188
188
  let file_content = read_to_string(path)
189
189
  .with_context(|| format!("Cannot read file {}", path.to_string_lossy()))
190
- .map_err(|err| eprintln!("{err}"))
190
+ .map_err(|err| eprintln!("{err:#}"))
191
191
  .ok()?;
192
192
  // skip large files or empty file
193
193
  if file_too_large(&file_content) || file_content.is_empty() {
@@ -1,4 +1,5 @@
1
1
  use crate::fixer::Fixer;
2
+ use crate::rule::referent_rule::RuleRegistration;
2
3
  use crate::rule::Rule;
3
4
  use crate::rule_config::RuleConfigError;
4
5
  use crate::rule_core::RuleCoreError;
@@ -21,6 +22,7 @@ pub enum CheckHint<'r> {
21
22
  /// so we need to check rules with different hints.
22
23
  pub fn check_rule_with_hint<'r, L: Language>(
23
24
  rule: &'r Rule<L>,
25
+ utils: &'r RuleRegistration<L>,
24
26
  constraints: &'r HashMap<String, Rule<L>>,
25
27
  transform: &'r Option<HashMap<String, Transformation>>,
26
28
  fixer: &Option<Fixer<L>>,
@@ -29,16 +31,16 @@ pub fn check_rule_with_hint<'r, L: Language>(
29
31
  match hint {
30
32
  CheckHint::Global => {
31
33
  // do not check utils defined here because global rules are not yet ready
32
- check_vars(rule, constraints, transform, fixer)?;
34
+ check_vars(rule, utils, constraints, transform, fixer)?;
33
35
  }
34
36
  CheckHint::Normal => {
35
37
  check_utils_defined(rule, constraints)?;
36
- check_vars(rule, constraints, transform, fixer)?;
38
+ check_vars(rule, utils, constraints, transform, fixer)?;
37
39
  }
38
40
  // upper_vars is needed to check metavar defined in containing vars
39
41
  CheckHint::Rewriter(upper_vars) => {
40
42
  check_utils_defined(rule, constraints)?;
41
- check_vars_in_rewriter(rule, constraints, transform, fixer, upper_vars)?;
43
+ check_vars_in_rewriter(rule, utils, constraints, transform, fixer, upper_vars)?;
42
44
  }
43
45
  }
44
46
  Ok(())
@@ -46,12 +48,14 @@ pub fn check_rule_with_hint<'r, L: Language>(
46
48
 
47
49
  fn check_vars_in_rewriter<'r, L: Language>(
48
50
  rule: &'r Rule<L>,
51
+ utils: &'r RuleRegistration<L>,
49
52
  constraints: &'r HashMap<String, Rule<L>>,
50
53
  transform: &'r Option<HashMap<String, Transformation>>,
51
54
  fixer: &Option<Fixer<L>>,
52
55
  upper_var: &HashSet<&str>,
53
56
  ) -> RResult<()> {
54
- let vars = check_var_in_constraints(rule, constraints)?;
57
+ let vars = get_vars_from_rules(rule, utils);
58
+ let vars = check_var_in_constraints(vars, constraints)?;
55
59
  let mut vars = check_var_in_transform(vars, transform)?;
56
60
  for v in upper_var {
57
61
  vars.insert(v);
@@ -73,21 +77,33 @@ fn check_utils_defined<L: Language>(
73
77
 
74
78
  fn check_vars<'r, L: Language>(
75
79
  rule: &'r Rule<L>,
80
+ utils: &'r RuleRegistration<L>,
76
81
  constraints: &'r HashMap<String, Rule<L>>,
77
82
  transform: &'r Option<HashMap<String, Transformation>>,
78
83
  fixer: &Option<Fixer<L>>,
79
84
  ) -> RResult<()> {
80
- let vars = check_var_in_constraints(rule, constraints)?;
85
+ let vars = get_vars_from_rules(rule, utils);
86
+ let vars = check_var_in_constraints(vars, constraints)?;
81
87
  let vars = check_var_in_transform(vars, transform)?;
82
88
  check_var_in_fix(vars, fixer)?;
83
89
  Ok(())
84
90
  }
85
91
 
86
- fn check_var_in_constraints<'r, L: Language>(
92
+ fn get_vars_from_rules<'r, L: Language>(
87
93
  rule: &'r Rule<L>,
94
+ utils: &'r RuleRegistration<L>,
95
+ ) -> HashSet<&'r str> {
96
+ let mut vars = rule.defined_vars();
97
+ for var in utils.get_local_util_vars() {
98
+ vars.insert(var);
99
+ }
100
+ vars
101
+ }
102
+
103
+ fn check_var_in_constraints<'r, L: Language>(
104
+ mut vars: HashSet<&'r str>,
88
105
  constraints: &'r HashMap<String, Rule<L>>,
89
106
  ) -> RResult<HashSet<&'r str>> {
90
- let mut vars = rule.defined_vars();
91
107
  for rule in constraints.values() {
92
108
  for var in rule.defined_vars() {
93
109
  vars.insert(var);
@@ -269,6 +285,21 @@ utils:
269
285
  assert_eq!(matcher.defined_vars(), ["B"].into_iter().collect());
270
286
  }
271
287
 
288
+ #[test]
289
+ fn test_use_vars_in_utils() {
290
+ let env = DeserializeEnv::new(TypeScript::Tsx);
291
+ let ser_rule: SerializableRuleCore = from_str(
292
+ r"
293
+ utils:
294
+ test: { pattern: $B }
295
+ rule: { matches: test }
296
+ fix: $B = 123",
297
+ )
298
+ .expect("should deser");
299
+ let matcher = ser_rule.get_matcher(env).expect("should parse");
300
+ assert_eq!(matcher.defined_vars(), ["B"].into_iter().collect());
301
+ }
302
+
272
303
  #[test]
273
304
  fn test_defined_vars_cyclic() {
274
305
  let env = DeserializeEnv::new(TypeScript::Tsx);
@@ -554,4 +554,23 @@ inside:
554
554
  let rule = deserialize_rule(rule, &env).expect("should deserialize");
555
555
  assert_eq!(rule.defined_vars(), ["A", "B"].into_iter().collect());
556
556
  }
557
+
558
+ #[test]
559
+ fn test_issue_1164() {
560
+ let src = r"
561
+ kind: statement_block
562
+ has:
563
+ pattern: this.$A = promise()
564
+ stopBy: end";
565
+ let rule: SerializableRule = from_str(src).expect("cannot parse rule");
566
+ let env = DeserializeEnv::new(TypeScript::Tsx);
567
+ let rule = deserialize_rule(rule, &env).expect("should deserialize");
568
+ let root = TypeScript::Tsx.ast_grep(
569
+ "if (a) {
570
+ this.a = b;
571
+ this.d = promise()
572
+ }",
573
+ );
574
+ assert!(root.root().find(rule).is_some());
575
+ }
557
576
  }
@@ -131,6 +131,7 @@ impl SerializableRuleCore {
131
131
  let ret = self.get_matcher_from_env(&env)?;
132
132
  check_rule_with_hint(
133
133
  &ret.rule,
134
+ &ret.utils,
134
135
  &ret.constraints,
135
136
  &self.transform,
136
137
  &ret.fixer,
@@ -221,7 +221,14 @@ impl<L: Language> Matcher<L> for Pattern<L> {
221
221
  node: Node<'tree, D>,
222
222
  env: &mut Cow<MetaVarEnv<'tree, D>>,
223
223
  ) -> Option<Node<'tree, D>> {
224
- match_node_non_recursive(self, node, env)
224
+ // do not pollute the env if pattern does not match
225
+ let mut may_write = Cow::Borrowed(env.as_ref());
226
+ let node = match_node_non_recursive(self, node, &mut may_write)?;
227
+ if let Cow::Owned(map) = may_write {
228
+ // only change env when pattern matches
229
+ *env = Cow::Owned(map);
230
+ }
231
+ Some(node)
225
232
  }
226
233
 
227
234
  fn potential_kinds(&self) -> Option<bit_set::BitSet> {
@@ -312,6 +319,20 @@ mod test {
312
319
  assert_eq!(env["VALUE"], "123");
313
320
  }
314
321
 
322
+ #[test]
323
+ fn test_pattern_should_not_pollute_env() {
324
+ // gh issue #1164
325
+ let pattern = Pattern::str("const $A = 114", Tsx);
326
+ let cand = pattern_node("const a = 514");
327
+ let cand = cand.root().child(0).unwrap();
328
+ let map = MetaVarEnv::new();
329
+ let mut env = Cow::Borrowed(&map);
330
+ let nm = pattern.match_node_with_env(cand, &mut env);
331
+ assert!(nm.is_none());
332
+ assert!(env.get_match("A").is_none());
333
+ assert!(map.get_match("A").is_none());
334
+ }
335
+
315
336
  #[test]
316
337
  fn test_match_non_atomic() {
317
338
  let env = match_env("const a = $VALUE", "const a = 5 + 3");
@@ -379,6 +379,7 @@ impl<'r, D: Doc> Node<'r, D> {
379
379
  // NOTE: Need go to parent first, then move to current node by byte offset.
380
380
  // This is because tree_sitter cursor is scoped to the starting node.
381
381
  // See https://github.com/tree-sitter/tree-sitter/issues/567
382
+ #[cfg(not(target_arch = "wasm32"))]
382
383
  pub fn next_all(&self) -> impl Iterator<Item = Node<'r, D>> + '_ {
383
384
  // if root is none, use self as fallback to return a type-stable Iterator
384
385
  let node = self.parent().unwrap_or_else(|| self.clone());
@@ -393,6 +394,18 @@ impl<'r, D: Doc> Node<'r, D> {
393
394
  })
394
395
  }
395
396
 
397
+ // wasm32 has wrong goto_first_child_for_byte
398
+ #[cfg(target_arch = "wasm32")]
399
+ pub fn next_all(&self) -> impl Iterator<Item = Node<'r, D>> + '_ {
400
+ let mut node = self.clone();
401
+ std::iter::from_fn(move || {
402
+ node.next().map(|n| {
403
+ node = n.clone();
404
+ n
405
+ })
406
+ })
407
+ }
408
+
396
409
  #[must_use]
397
410
  pub fn prev(&self) -> Option<Node<'r, D>> {
398
411
  let inner = self.inner.prev_sibling()?;
@@ -402,6 +415,7 @@ impl<'r, D: Doc> Node<'r, D> {
402
415
  })
403
416
  }
404
417
 
418
+ #[cfg(not(target_arch = "wasm32"))]
405
419
  pub fn prev_all(&self) -> impl Iterator<Item = Node<'r, D>> + '_ {
406
420
  // if root is none, use self as fallback to return a type-stable Iterator
407
421
  let node = self.parent().unwrap_or_else(|| self.clone());
@@ -416,6 +430,18 @@ impl<'r, D: Doc> Node<'r, D> {
416
430
  })
417
431
  }
418
432
 
433
+ // wasm32 has wrong goto_first_child_for_byte
434
+ #[cfg(target_arch = "wasm32")]
435
+ pub fn prev_all(&self) -> impl Iterator<Item = Node<'r, D>> + '_ {
436
+ let mut node = self.clone();
437
+ std::iter::from_fn(move || {
438
+ node.prev().map(|n| {
439
+ node = n.clone();
440
+ n
441
+ })
442
+ })
443
+ }
444
+
419
445
  pub fn dfs<'s>(&'s self) -> Pre<'r, D> {
420
446
  Pre::new(self)
421
447
  }
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "ast-grep-cli"
7
- version = "0.22.2"
7
+ version = "0.22.4"
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