ast-grep-py 0.39.0__tar.gz → 0.39.2__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.

Potentially problematic release.


This version of ast-grep-py might be problematic. Click here for more details.

Files changed (96) hide show
  1. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/Cargo.lock +62 -47
  2. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/Cargo.toml +7 -7
  3. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/PKG-INFO +1 -1
  4. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/maybe.rs +7 -3
  5. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/relational_rule.rs +3 -0
  6. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/selector.rs +4 -4
  7. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/stop_by.rs +24 -3
  8. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule_config.rs +9 -14
  9. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/match_tree/match_node.rs +9 -4
  10. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/match_tree/strictness.rs +44 -5
  11. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/pyproject.toml +1 -1
  12. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/README.md +0 -0
  13. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/ast_grep_py/__init__.py +0 -0
  14. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/ast_grep_py/ast_grep_py.pyi +0 -0
  15. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/ast_grep_py/py.typed +0 -0
  16. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/Cargo.toml +0 -0
  17. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/check_var.rs +0 -0
  18. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/combined.rs +0 -0
  19. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/fixer.rs +0 -0
  20. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/label.rs +0 -0
  21. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/lib.rs +0 -0
  22. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/deserialize_env.rs +0 -0
  23. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/mod.rs +0 -0
  24. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/nth_child.rs +0 -0
  25. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/range.rs +0 -0
  26. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule/referent_rule.rs +0 -0
  27. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule_collection.rs +0 -0
  28. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/rule_core.rs +0 -0
  29. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/transform/mod.rs +0 -0
  30. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/transform/parse.rs +0 -0
  31. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/transform/rewrite.rs +0 -0
  32. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/transform/string_case.rs +0 -0
  33. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/config/src/transform/trans.rs +0 -0
  34. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/Cargo.toml +0 -0
  35. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/language.rs +0 -0
  36. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/lib.rs +0 -0
  37. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/match_tree/mod.rs +0 -0
  38. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/matcher/kind.rs +0 -0
  39. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/matcher/node_match.rs +0 -0
  40. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/matcher/pattern.rs +0 -0
  41. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/matcher/text.rs +0 -0
  42. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/matcher.rs +0 -0
  43. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/meta_var.rs +0 -0
  44. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/node.rs +0 -0
  45. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/ops.rs +0 -0
  46. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/pinned.rs +0 -0
  47. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/replacer/indent.rs +0 -0
  48. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/replacer/structural.rs +0 -0
  49. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/replacer/template.rs +0 -0
  50. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/replacer.rs +0 -0
  51. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/source.rs +0 -0
  52. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/tree_sitter/mod.rs +0 -0
  53. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/core/src/tree_sitter/traversal.rs +0 -0
  54. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/dynamic/Cargo.toml +0 -0
  55. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/dynamic/src/custom_lang.rs +0 -0
  56. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/dynamic/src/lib.rs +0 -0
  57. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/Cargo.toml +0 -0
  58. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/bash.rs +0 -0
  59. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/cpp.rs +0 -0
  60. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/csharp.rs +0 -0
  61. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/css.rs +0 -0
  62. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/elixir.rs +0 -0
  63. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/go.rs +0 -0
  64. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/haskell.rs +0 -0
  65. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/html.rs +0 -0
  66. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/json.rs +0 -0
  67. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/kotlin.rs +0 -0
  68. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/lib.rs +0 -0
  69. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/lua.rs +0 -0
  70. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/nix.rs +0 -0
  71. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/parsers.rs +0 -0
  72. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/php.rs +0 -0
  73. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/python.rs +0 -0
  74. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/ruby.rs +0 -0
  75. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/rust.rs +0 -0
  76. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/scala.rs +0 -0
  77. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/solidity.rs +0 -0
  78. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/swift.rs +0 -0
  79. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/language/src/yaml.rs +0 -0
  80. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/Cargo.toml +0 -0
  81. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/README.md +0 -0
  82. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/ast_grep_py/__init__.py +0 -0
  83. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/ast_grep_py/ast_grep_py.pyi +0 -0
  84. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/ast_grep_py/py.typed +0 -0
  85. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/src/lib.rs +0 -0
  86. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/src/py_lang.rs +0 -0
  87. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/src/py_node.rs +0 -0
  88. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/src/range.rs +0 -0
  89. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/src/unicode_position.rs +0 -0
  90. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_fix.py +0 -0
  91. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_range.py +0 -0
  92. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_register_lang.py +0 -0
  93. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_rule.py +0 -0
  94. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_simple.py +0 -0
  95. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_traversal.py +0 -0
  96. {ast_grep_py-0.39.0 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_wrong_usage.py +0 -0
@@ -109,7 +109,7 @@ dependencies = [
109
109
 
110
110
  [[package]]
111
111
  name = "ast-grep"
112
- version = "0.39.0"
112
+ version = "0.39.2"
113
113
  dependencies = [
114
114
  "ansi_term",
115
115
  "anyhow",
@@ -143,7 +143,7 @@ dependencies = [
143
143
 
144
144
  [[package]]
145
145
  name = "ast-grep-config"
146
- version = "0.39.0"
146
+ version = "0.39.2"
147
147
  dependencies = [
148
148
  "ast-grep-core",
149
149
  "bit-set",
@@ -158,7 +158,7 @@ dependencies = [
158
158
 
159
159
  [[package]]
160
160
  name = "ast-grep-core"
161
- version = "0.39.0"
161
+ version = "0.39.2"
162
162
  dependencies = [
163
163
  "bit-set",
164
164
  "regex",
@@ -169,7 +169,7 @@ dependencies = [
169
169
 
170
170
  [[package]]
171
171
  name = "ast-grep-dynamic"
172
- version = "0.39.0"
172
+ version = "0.39.2"
173
173
  dependencies = [
174
174
  "ast-grep-core",
175
175
  "ignore",
@@ -183,7 +183,7 @@ dependencies = [
183
183
 
184
184
  [[package]]
185
185
  name = "ast-grep-language"
186
- version = "0.39.0"
186
+ version = "0.39.2"
187
187
  dependencies = [
188
188
  "ast-grep-core",
189
189
  "ignore",
@@ -217,7 +217,7 @@ dependencies = [
217
217
 
218
218
  [[package]]
219
219
  name = "ast-grep-lsp"
220
- version = "0.39.0"
220
+ version = "0.39.2"
221
221
  dependencies = [
222
222
  "ast-grep-config",
223
223
  "ast-grep-core",
@@ -231,7 +231,7 @@ dependencies = [
231
231
 
232
232
  [[package]]
233
233
  name = "ast-grep-napi"
234
- version = "0.39.0"
234
+ version = "0.39.2"
235
235
  dependencies = [
236
236
  "ast-grep-config",
237
237
  "ast-grep-core",
@@ -239,7 +239,7 @@ dependencies = [
239
239
  "ast-grep-language",
240
240
  "ignore",
241
241
  "napi",
242
- "napi-build 3.0.0-beta.0",
242
+ "napi-build",
243
243
  "napi-derive",
244
244
  "serde_json",
245
245
  "tree-sitter",
@@ -247,7 +247,7 @@ dependencies = [
247
247
 
248
248
  [[package]]
249
249
  name = "ast-grep-py"
250
- version = "0.39.0"
250
+ version = "0.39.2"
251
251
  dependencies = [
252
252
  "anyhow",
253
253
  "ast-grep-config",
@@ -686,7 +686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
686
686
  checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
687
687
  dependencies = [
688
688
  "libc",
689
- "windows-sys 0.52.0",
689
+ "windows-sys 0.59.0",
690
690
  ]
691
691
 
692
692
  [[package]]
@@ -980,7 +980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
980
980
  checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667"
981
981
  dependencies = [
982
982
  "cfg-if",
983
- "windows-targets 0.48.5",
983
+ "windows-targets 0.52.6",
984
984
  ]
985
985
 
986
986
  [[package]]
@@ -1083,14 +1083,14 @@ dependencies = [
1083
1083
 
1084
1084
  [[package]]
1085
1085
  name = "napi"
1086
- version = "3.0.0"
1086
+ version = "3.1.3"
1087
1087
  source = "registry+https://github.com/rust-lang/crates.io-index"
1088
- checksum = "abf3f418eeb94d86f02f3388324017e1e21e36937e4b1d8075ea5843d980f766"
1088
+ checksum = "afaf586c21f260e9dc327ae3585fc6efcbb24a416d5151da38bbd35a1f2663c8"
1089
1089
  dependencies = [
1090
1090
  "anyhow",
1091
1091
  "bitflags 2.9.0",
1092
1092
  "ctor",
1093
- "napi-build 2.2.2",
1093
+ "napi-build",
1094
1094
  "napi-sys",
1095
1095
  "nohash-hasher",
1096
1096
  "rustc-hash",
@@ -1100,21 +1100,15 @@ dependencies = [
1100
1100
 
1101
1101
  [[package]]
1102
1102
  name = "napi-build"
1103
- version = "2.2.2"
1103
+ version = "2.2.3"
1104
1104
  source = "registry+https://github.com/rust-lang/crates.io-index"
1105
- checksum = "fff539e61c5e3dd4d7d283610662f5d672c2aea0f158df78af694f13dbb3287b"
1106
-
1107
- [[package]]
1108
- name = "napi-build"
1109
- version = "3.0.0-beta.0"
1110
- source = "registry+https://github.com/rust-lang/crates.io-index"
1111
- checksum = "42908a235da4c4a18c481eb5a8bb38570daa18581a68c508ca8efab662e38bc6"
1105
+ checksum = "dcae8ad5609d14afb3a3b91dee88c757016261b151e9dcecabf1b2a31a6cab14"
1112
1106
 
1113
1107
  [[package]]
1114
1108
  name = "napi-derive"
1115
- version = "3.0.0"
1109
+ version = "3.1.1"
1116
1110
  source = "registry+https://github.com/rust-lang/crates.io-index"
1117
- checksum = "ce09c2a155c7c38447a6ff1711899375bdd8f9dd5a50aad700a9c765c9f8a375"
1111
+ checksum = "43e61844e0c0bb81e711f2084abe7cff187b03ca21ff8b000cb59bbda61e15a9"
1118
1112
  dependencies = [
1119
1113
  "convert_case 0.8.0",
1120
1114
  "ctor",
@@ -1126,9 +1120,9 @@ dependencies = [
1126
1120
 
1127
1121
  [[package]]
1128
1122
  name = "napi-derive-backend"
1129
- version = "2.0.0"
1123
+ version = "2.0.2"
1130
1124
  source = "registry+https://github.com/rust-lang/crates.io-index"
1131
- checksum = "17923387d68ecfe057a04a38ee89aeb41f415c43b4c7a508a3683bf0c1511c5a"
1125
+ checksum = "b7ab19e9b98efb13895f492a2e367ca50c955ac3c4723613af73fdda4011afcc"
1132
1126
  dependencies = [
1133
1127
  "convert_case 0.8.0",
1134
1128
  "proc-macro2",
@@ -1285,9 +1279,9 @@ dependencies = [
1285
1279
 
1286
1280
  [[package]]
1287
1281
  name = "pyo3"
1288
- version = "0.25.0"
1282
+ version = "0.25.1"
1289
1283
  source = "registry+https://github.com/rust-lang/crates.io-index"
1290
- checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4"
1284
+ checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
1291
1285
  dependencies = [
1292
1286
  "anyhow",
1293
1287
  "indoc",
@@ -1303,9 +1297,9 @@ dependencies = [
1303
1297
 
1304
1298
  [[package]]
1305
1299
  name = "pyo3-build-config"
1306
- version = "0.25.0"
1300
+ version = "0.25.1"
1307
1301
  source = "registry+https://github.com/rust-lang/crates.io-index"
1308
- checksum = "755ea671a1c34044fa165247aaf6f419ca39caa6003aee791a0df2713d8f1b6d"
1302
+ checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
1309
1303
  dependencies = [
1310
1304
  "once_cell",
1311
1305
  "target-lexicon",
@@ -1313,9 +1307,9 @@ dependencies = [
1313
1307
 
1314
1308
  [[package]]
1315
1309
  name = "pyo3-ffi"
1316
- version = "0.25.0"
1310
+ version = "0.25.1"
1317
1311
  source = "registry+https://github.com/rust-lang/crates.io-index"
1318
- checksum = "fc95a2e67091e44791d4ea300ff744be5293f394f1bafd9f78c080814d35956e"
1312
+ checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
1319
1313
  dependencies = [
1320
1314
  "libc",
1321
1315
  "pyo3-build-config",
@@ -1323,9 +1317,9 @@ dependencies = [
1323
1317
 
1324
1318
  [[package]]
1325
1319
  name = "pyo3-macros"
1326
- version = "0.25.0"
1320
+ version = "0.25.1"
1327
1321
  source = "registry+https://github.com/rust-lang/crates.io-index"
1328
- checksum = "a179641d1b93920829a62f15e87c0ed791b6c8db2271ba0fd7c2686090510214"
1322
+ checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
1329
1323
  dependencies = [
1330
1324
  "proc-macro2",
1331
1325
  "pyo3-macros-backend",
@@ -1335,9 +1329,9 @@ dependencies = [
1335
1329
 
1336
1330
  [[package]]
1337
1331
  name = "pyo3-macros-backend"
1338
- version = "0.25.0"
1332
+ version = "0.25.1"
1339
1333
  source = "registry+https://github.com/rust-lang/crates.io-index"
1340
- checksum = "9dff85ebcaab8c441b0e3f7ae40a6963ecea8a9f5e74f647e33fcf5ec9a1e89e"
1334
+ checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
1341
1335
  dependencies = [
1342
1336
  "heck",
1343
1337
  "proc-macro2",
@@ -1380,6 +1374,26 @@ dependencies = [
1380
1374
  "bitflags 2.9.0",
1381
1375
  ]
1382
1376
 
1377
+ [[package]]
1378
+ name = "ref-cast"
1379
+ version = "1.0.24"
1380
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1381
+ checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf"
1382
+ dependencies = [
1383
+ "ref-cast-impl",
1384
+ ]
1385
+
1386
+ [[package]]
1387
+ name = "ref-cast-impl"
1388
+ version = "1.0.24"
1389
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1390
+ checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
1391
+ dependencies = [
1392
+ "proc-macro2",
1393
+ "quote",
1394
+ "syn",
1395
+ ]
1396
+
1383
1397
  [[package]]
1384
1398
  name = "regex"
1385
1399
  version = "1.11.1"
@@ -1431,7 +1445,7 @@ dependencies = [
1431
1445
  "errno",
1432
1446
  "libc",
1433
1447
  "linux-raw-sys",
1434
- "windows-sys 0.52.0",
1448
+ "windows-sys 0.59.0",
1435
1449
  ]
1436
1450
 
1437
1451
  [[package]]
@@ -1451,11 +1465,12 @@ dependencies = [
1451
1465
 
1452
1466
  [[package]]
1453
1467
  name = "schemars"
1454
- version = "0.8.22"
1468
+ version = "1.0.4"
1455
1469
  source = "registry+https://github.com/rust-lang/crates.io-index"
1456
- checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615"
1470
+ checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
1457
1471
  dependencies = [
1458
1472
  "dyn-clone",
1473
+ "ref-cast",
1459
1474
  "schemars_derive",
1460
1475
  "serde",
1461
1476
  "serde_json",
@@ -1463,9 +1478,9 @@ dependencies = [
1463
1478
 
1464
1479
  [[package]]
1465
1480
  name = "schemars_derive"
1466
- version = "0.8.22"
1481
+ version = "1.0.4"
1467
1482
  source = "registry+https://github.com/rust-lang/crates.io-index"
1468
- checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d"
1483
+ checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
1469
1484
  dependencies = [
1470
1485
  "proc-macro2",
1471
1486
  "quote",
@@ -1668,7 +1683,7 @@ dependencies = [
1668
1683
  "getrandom",
1669
1684
  "once_cell",
1670
1685
  "rustix",
1671
- "windows-sys 0.52.0",
1686
+ "windows-sys 0.59.0",
1672
1687
  ]
1673
1688
 
1674
1689
  [[package]]
@@ -1766,9 +1781,9 @@ dependencies = [
1766
1781
 
1767
1782
  [[package]]
1768
1783
  name = "tokio"
1769
- version = "1.46.1"
1784
+ version = "1.47.0"
1770
1785
  source = "registry+https://github.com/rust-lang/crates.io-index"
1771
- checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17"
1786
+ checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35"
1772
1787
  dependencies = [
1773
1788
  "backtrace",
1774
1789
  "bytes",
@@ -2128,9 +2143,9 @@ dependencies = [
2128
2143
 
2129
2144
  [[package]]
2130
2145
  name = "tree-sitter-solidity"
2131
- version = "1.2.11"
2146
+ version = "1.2.12"
2132
2147
  source = "registry+https://github.com/rust-lang/crates.io-index"
2133
- checksum = "316bcbf903cd09a781734f4127ef21341e810cf85f89b0b96fffab48d55fd672"
2148
+ checksum = "92f0b44ef36f0779873ec118f2cbad31cfc18d6ae7ba48ce75d5ce09870884d1"
2134
2149
  dependencies = [
2135
2150
  "cc",
2136
2151
  "tree-sitter-language",
@@ -2264,7 +2279,7 @@ version = "0.1.9"
2264
2279
  source = "registry+https://github.com/rust-lang/crates.io-index"
2265
2280
  checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
2266
2281
  dependencies = [
2267
- "windows-sys 0.48.0",
2282
+ "windows-sys 0.59.0",
2268
2283
  ]
2269
2284
 
2270
2285
  [[package]]
@@ -7,7 +7,7 @@ resolver = "2"
7
7
  lto = true
8
8
 
9
9
  [workspace.package]
10
- version = "0.39.0"
10
+ version = "0.39.2"
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.79"
18
18
  readme = "README.md"
19
19
 
20
20
  [workspace.dependencies]
21
- ast-grep-core = { path = "crates/core", version = "0.39.0", default-features = false }
22
- ast-grep-config = { path = "crates/config", version = "0.39.0" }
23
- ast-grep-dynamic = { path = "crates/dynamic", version = "0.39.0" }
24
- ast-grep-language = { path = "crates/language", version = "0.39.0" }
25
- ast-grep-lsp = { path = "crates/lsp", version = "0.39.0" }
21
+ ast-grep-core = { path = "crates/core", version = "0.39.2", default-features = false }
22
+ ast-grep-config = { path = "crates/config", version = "0.39.2" }
23
+ ast-grep-dynamic = { path = "crates/dynamic", version = "0.39.2" }
24
+ ast-grep-language = { path = "crates/language", version = "0.39.2" }
25
+ ast-grep-lsp = { path = "crates/lsp", version = "0.39.2" }
26
26
 
27
27
  bit-set = { version = "0.8.0" }
28
28
  ignore = { version = "0.4.22" }
@@ -31,6 +31,6 @@ serde = { version = "1.0.200", features = ["derive"] }
31
31
  serde_yaml = "0.9.33"
32
32
  tree-sitter = { version = "0.25.4" }
33
33
  thiserror = "2.0.0"
34
- schemars = "0.8.17"
34
+ schemars = "1.0.0"
35
35
  anyhow = "1.0.82"
36
36
  dashmap = "6.0.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ast-grep-py
3
- Version: 0.39.0
3
+ Version: 0.39.2
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -1,4 +1,4 @@
1
- use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema};
1
+ use schemars::{JsonSchema, Schema, SchemaGenerator};
2
2
  use serde::{de, ser, Deserialize, Serialize};
3
3
  use std::borrow::Cow;
4
4
 
@@ -70,8 +70,8 @@ impl<'de, T: Deserialize<'de>> Deserialize<'de> for Maybe<T> {
70
70
  }
71
71
 
72
72
  impl<T: JsonSchema> JsonSchema for Maybe<T> {
73
- fn schema_name() -> String {
74
- format!("Maybe_{}", T::schema_name())
73
+ fn schema_name() -> Cow<'static, str> {
74
+ Cow::Owned(format!("Maybe_{}", T::schema_name()))
75
75
  }
76
76
  fn schema_id() -> Cow<'static, str> {
77
77
  Cow::Owned(format!("Maybe<{}>", T::schema_id()))
@@ -80,6 +80,10 @@ impl<T: JsonSchema> JsonSchema for Maybe<T> {
80
80
  gen.subschema_for::<T>()
81
81
  }
82
82
 
83
+ fn inline_schema() -> bool {
84
+ true
85
+ }
86
+
83
87
  fn _schemars_private_non_optional_json_schema(gen: &mut SchemaGenerator) -> Schema {
84
88
  T::_schemars_private_non_optional_json_schema(gen)
85
89
  }
@@ -12,6 +12,9 @@ use std::collections::HashSet;
12
12
 
13
13
  #[derive(Serialize, Deserialize, Clone, JsonSchema)]
14
14
  #[serde(rename_all = "camelCase")]
15
+ #[schemars(
16
+ description = "A relational rule object, which is a Rule object with two additional fields stopBy and field."
17
+ )]
15
18
  pub struct Relation {
16
19
  #[serde(flatten)]
17
20
  pub rule: SerializableRule,
@@ -180,9 +180,9 @@ fn try_parse_subclass_selector<'a, L: Language>(
180
180
  input: &mut Input<'a, L>,
181
181
  ) -> Result<Option<Rule>, SelectorError> {
182
182
  if let Some(Token::ClassDot) = input.peek()? {
183
- todo!()
183
+ return Err(SelectorError::Unsupported("class-selector"));
184
184
  } else if let Some(Token::PseudoColon) = input.peek()? {
185
- todo!()
185
+ return Err(SelectorError::Unsupported("pseudo-class-selector"));
186
186
  }
187
187
  Ok(None)
188
188
  }
@@ -197,6 +197,8 @@ pub enum SelectorError {
197
197
  MissingSelector,
198
198
  #[error("Invalid Kind")]
199
199
  InvalidKind(#[from] KindMatcherError),
200
+ #[error("{0} is not supported yet")]
201
+ Unsupported(&'static str),
200
202
  }
201
203
 
202
204
  struct Input<'a, L: Language> {
@@ -284,8 +286,6 @@ impl<'a, L: Language> Input<'a, L> {
284
286
 
285
287
  #[cfg(test)]
286
288
  mod test {
287
- use std::num;
288
-
289
289
  use super::*;
290
290
  use crate::test::TypeScript as TS;
291
291
  use ast_grep_core::tree_sitter::LanguageExt;
@@ -4,17 +4,17 @@ use crate::rule::{Rule, RuleSerializeError, SerializableRule};
4
4
  use ast_grep_core::language::Language;
5
5
  use ast_grep_core::{Doc, Node};
6
6
 
7
- use schemars::JsonSchema;
7
+ use schemars::{json_schema, JsonSchema, Schema, SchemaGenerator};
8
8
  use serde::de::{self, Deserializer, MapAccess, Visitor};
9
9
  use serde::{Deserialize, Serialize};
10
10
 
11
+ use std::borrow::Cow;
11
12
  use std::collections::HashSet;
12
13
  use std::fmt;
13
14
 
14
15
  // NB StopBy's JsonSchema is changed in xtask/schema.rs
15
16
  // revise schema is easier than manually implementation
16
- #[derive(Clone, Default, JsonSchema)]
17
- #[serde(rename_all = "camelCase")]
17
+ #[derive(Clone, Default)]
18
18
  pub enum SerializableStopBy {
19
19
  #[default]
20
20
  Neighbor,
@@ -22,6 +22,27 @@ pub enum SerializableStopBy {
22
22
  Rule(Box<SerializableRule>),
23
23
  }
24
24
 
25
+ impl JsonSchema for SerializableStopBy {
26
+ fn schema_name() -> Cow<'static, str> {
27
+ Cow::Borrowed("SerializableStopBy")
28
+ }
29
+
30
+ fn json_schema(_: &mut SchemaGenerator) -> Schema {
31
+ json_schema!({
32
+ "description": "Control how the relational rule search should stop",
33
+ "oneOf": [
34
+ {
35
+ "type": "string",
36
+ "enum": [SerializableStopBy::NEIGHBOR_KEY, SerializableStopBy::END_KEY],
37
+ },
38
+ {
39
+ "$ref": "#/$defs/SerializableRule"
40
+ }
41
+ ],
42
+ })
43
+ }
44
+ }
45
+
25
46
  impl SerializableStopBy {
26
47
  /// String key used for serializing the Neighbor variant
27
48
  const NEIGHBOR_KEY: &str = "neighbor";
@@ -11,7 +11,7 @@ use ast_grep_core::replacer::Replacer;
11
11
  use ast_grep_core::source::Content;
12
12
  use ast_grep_core::{Doc, Matcher, NodeMatch};
13
13
 
14
- use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema};
14
+ use schemars::{json_schema, JsonSchema, Schema, SchemaGenerator};
15
15
  use serde::{Deserialize, Serialize};
16
16
  use serde_yaml::Error as YamlError;
17
17
  use serde_yaml::{with::singleton_map_recursive::deserialize, Deserializer};
@@ -64,6 +64,7 @@ pub struct SerializableRewriter {
64
64
  }
65
65
 
66
66
  #[derive(Serialize, Deserialize, Clone, JsonSchema)]
67
+ #[schemars(title = "ast-grep rule")]
67
68
  pub struct SerializableRuleConfig<L: Language> {
68
69
  #[serde(flatten)]
69
70
  pub core: SerializableRuleCore,
@@ -102,24 +103,18 @@ pub struct SerializableRuleConfig<L: Language> {
102
103
  pub struct Metadata(HashMap<String, serde_yaml::Value>);
103
104
 
104
105
  impl JsonSchema for Metadata {
105
- fn schema_name() -> String {
106
- "Metadata".to_string()
106
+ fn schema_name() -> Cow<'static, str> {
107
+ Cow::Borrowed("Metadata")
107
108
  }
108
109
  fn schema_id() -> Cow<'static, str> {
109
110
  Cow::Borrowed("Metadata")
110
111
  }
111
112
  fn json_schema(_gen: &mut SchemaGenerator) -> Schema {
112
- use schemars::schema::{InstanceType, ObjectValidation, SchemaObject};
113
- let subschema = Schema::Bool(true);
114
- SchemaObject {
115
- instance_type: Some(InstanceType::Object.into()),
116
- object: Some(Box::new(ObjectValidation {
117
- additional_properties: Some(Box::new(subschema)),
118
- ..Default::default()
119
- })),
120
- ..Default::default()
121
- }
122
- .into()
113
+ json_schema!({
114
+ "type": "object",
115
+ "additionalProperties": true,
116
+ "description": "Additional metadata for the rule, can be used to store extra information."
117
+ })
123
118
  }
124
119
  }
125
120
 
@@ -28,10 +28,15 @@ pub(super) fn match_node_impl<'tree, D: Doc>(
28
28
  }
29
29
  c => c,
30
30
  },
31
- P::MetaVar { meta_var, .. } => match agg.match_meta_var(meta_var, candidate) {
32
- Some(()) => MatchOneNode::MatchedBoth,
33
- None => MatchOneNode::NoMatch, // TODO: this may be wrong
34
- },
31
+ P::MetaVar { meta_var, .. } => {
32
+ if strictness.should_skip_cand_for_metavar(candidate) {
33
+ return MatchOneNode::SkipCandidate;
34
+ }
35
+ match agg.match_meta_var(meta_var, candidate) {
36
+ Some(()) => MatchOneNode::MatchedBoth,
37
+ None => MatchOneNode::NoMatch, // TODO: this may be wrong
38
+ }
39
+ }
35
40
  P::Internal {
36
41
  kind_id, children, ..
37
42
  } => {
@@ -23,12 +23,15 @@ pub(crate) enum MatchOneNode {
23
23
  NoMatch,
24
24
  }
25
25
 
26
+ fn skip_comment(n: &Node<impl Doc>) -> bool {
27
+ n.kind().contains("comment")
28
+ }
29
+
26
30
  fn skip_comment_or_unnamed(n: &Node<impl Doc>) -> bool {
27
31
  if !n.is_named() {
28
32
  return true;
29
33
  }
30
- let kind = n.kind();
31
- kind.contains("comment")
34
+ skip_comment(n)
32
35
  }
33
36
 
34
37
  impl MatchStrictness {
@@ -86,6 +89,14 @@ impl MatchStrictness {
86
89
  }
87
90
  }
88
91
 
92
+ pub(crate) fn should_skip_cand_for_metavar<D: Doc>(&self, candidate: &Node<D>) -> bool {
93
+ use MatchStrictness as M;
94
+ match self {
95
+ M::Cst | M::Ast | M::Smart => false,
96
+ M::Relaxed | M::Signature | M::Template => skip_comment(candidate),
97
+ }
98
+ }
99
+
89
100
  // TODO: this is a method for working around trailing nodes after pattern is matched
90
101
  pub(crate) fn should_skip_trailing<D: Doc>(&self, candidate: &Node<D>) -> bool {
91
102
  use MatchStrictness as M;
@@ -95,7 +106,7 @@ impl MatchStrictness {
95
106
  M::Ast => false,
96
107
  M::Relaxed => skip_comment_or_unnamed(candidate),
97
108
  M::Signature => skip_comment_or_unnamed(candidate),
98
- M::Template => true,
109
+ M::Template => skip_comment(candidate),
99
110
  }
100
111
  }
101
112
 
@@ -158,14 +169,18 @@ mod test {
158
169
  use crate::language::Tsx;
159
170
  use crate::{Pattern, Root};
160
171
 
161
- fn template_pattern(p: &str, n: &str) -> bool {
172
+ fn test_match(p: &str, n: &str, strictness: MatchStrictness) -> bool {
162
173
  let mut pattern = Pattern::new(p, Tsx);
163
- pattern.strictness = MatchStrictness::Template;
174
+ pattern.strictness = strictness;
164
175
  let root = Root::str(n, Tsx);
165
176
  let node = root.root();
166
177
  node.find(pattern).is_some()
167
178
  }
168
179
 
180
+ fn template_pattern(p: &str, n: &str) -> bool {
181
+ test_match(p, n, MatchStrictness::Template)
182
+ }
183
+
169
184
  #[test]
170
185
  fn test_template_pattern() {
171
186
  assert!(template_pattern("$A = $B", "a = b"));
@@ -174,4 +189,28 @@ mod test {
174
189
  assert!(template_pattern("$A = $B", "const a = b"));
175
190
  assert!(template_pattern("$A = $B", "class A { a = b }"));
176
191
  }
192
+
193
+ fn relaxed_pattern(p: &str, n: &str) -> bool {
194
+ test_match(p, n, MatchStrictness::Relaxed)
195
+ }
196
+
197
+ #[test]
198
+ fn test_ignore_comment() {
199
+ assert!(relaxed_pattern("$A($B)", "foo(bar /* .. */)"));
200
+ assert!(relaxed_pattern(
201
+ "$A($B)",
202
+ "
203
+ foo(
204
+ bar, // ..
205
+ )"
206
+ ));
207
+ assert!(relaxed_pattern("$A($B)", "foo(/* .. */ bar)"));
208
+ assert!(relaxed_pattern(
209
+ "$A($B)",
210
+ "
211
+ foo( // ..
212
+ bar
213
+ )"
214
+ ));
215
+ }
177
216
  }
@@ -5,7 +5,7 @@ build-backend = "maturin"
5
5
  [project]
6
6
  name = "ast-grep-py"
7
7
  requires-python = ">=3.8"
8
- version = "0.39.0"
8
+ version = "0.39.2"
9
9
  description = "Structural Search and Rewrite code at large scale using precise AST pattern."
10
10
  authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
11
11
  maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
File without changes