ast-grep-py 0.39.1__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.1 → ast_grep_py-0.39.2}/Cargo.lock +60 -39
  2. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/Cargo.toml +7 -7
  3. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/PKG-INFO +1 -1
  4. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/maybe.rs +7 -3
  5. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/relational_rule.rs +3 -0
  6. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/stop_by.rs +24 -3
  7. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule_config.rs +9 -14
  8. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/match_tree/match_node.rs +9 -4
  9. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/match_tree/strictness.rs +44 -5
  10. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/pyproject.toml +1 -1
  11. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/README.md +0 -0
  12. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/ast_grep_py/__init__.py +0 -0
  13. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/ast_grep_py/ast_grep_py.pyi +0 -0
  14. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/ast_grep_py/py.typed +0 -0
  15. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/Cargo.toml +0 -0
  16. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/check_var.rs +0 -0
  17. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/combined.rs +0 -0
  18. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/fixer.rs +0 -0
  19. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/label.rs +0 -0
  20. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/lib.rs +0 -0
  21. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/deserialize_env.rs +0 -0
  22. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/mod.rs +0 -0
  23. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/nth_child.rs +0 -0
  24. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/range.rs +0 -0
  25. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/referent_rule.rs +0 -0
  26. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule/selector.rs +0 -0
  27. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule_collection.rs +0 -0
  28. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/rule_core.rs +0 -0
  29. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/transform/mod.rs +0 -0
  30. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/transform/parse.rs +0 -0
  31. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/transform/rewrite.rs +0 -0
  32. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/transform/string_case.rs +0 -0
  33. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/config/src/transform/trans.rs +0 -0
  34. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/Cargo.toml +0 -0
  35. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/language.rs +0 -0
  36. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/lib.rs +0 -0
  37. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/match_tree/mod.rs +0 -0
  38. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/matcher/kind.rs +0 -0
  39. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/matcher/node_match.rs +0 -0
  40. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/matcher/pattern.rs +0 -0
  41. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/matcher/text.rs +0 -0
  42. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/matcher.rs +0 -0
  43. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/meta_var.rs +0 -0
  44. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/node.rs +0 -0
  45. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/ops.rs +0 -0
  46. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/pinned.rs +0 -0
  47. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/replacer/indent.rs +0 -0
  48. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/replacer/structural.rs +0 -0
  49. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/replacer/template.rs +0 -0
  50. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/replacer.rs +0 -0
  51. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/source.rs +0 -0
  52. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/tree_sitter/mod.rs +0 -0
  53. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/core/src/tree_sitter/traversal.rs +0 -0
  54. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/dynamic/Cargo.toml +0 -0
  55. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/dynamic/src/custom_lang.rs +0 -0
  56. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/dynamic/src/lib.rs +0 -0
  57. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/Cargo.toml +0 -0
  58. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/bash.rs +0 -0
  59. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/cpp.rs +0 -0
  60. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/csharp.rs +0 -0
  61. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/css.rs +0 -0
  62. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/elixir.rs +0 -0
  63. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/go.rs +0 -0
  64. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/haskell.rs +0 -0
  65. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/html.rs +0 -0
  66. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/json.rs +0 -0
  67. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/kotlin.rs +0 -0
  68. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/lib.rs +0 -0
  69. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/lua.rs +0 -0
  70. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/nix.rs +0 -0
  71. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/parsers.rs +0 -0
  72. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/php.rs +0 -0
  73. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/python.rs +0 -0
  74. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/ruby.rs +0 -0
  75. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/rust.rs +0 -0
  76. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/scala.rs +0 -0
  77. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/solidity.rs +0 -0
  78. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/swift.rs +0 -0
  79. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/language/src/yaml.rs +0 -0
  80. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/Cargo.toml +0 -0
  81. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/README.md +0 -0
  82. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/ast_grep_py/__init__.py +0 -0
  83. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/ast_grep_py/ast_grep_py.pyi +0 -0
  84. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/ast_grep_py/py.typed +0 -0
  85. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/src/lib.rs +0 -0
  86. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/src/py_lang.rs +0 -0
  87. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/src/py_node.rs +0 -0
  88. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/src/range.rs +0 -0
  89. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/src/unicode_position.rs +0 -0
  90. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_fix.py +0 -0
  91. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_range.py +0 -0
  92. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_register_lang.py +0 -0
  93. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_rule.py +0 -0
  94. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_simple.py +0 -0
  95. {ast_grep_py-0.39.1 → ast_grep_py-0.39.2}/crates/pyo3/tests/test_traversal.py +0 -0
  96. {ast_grep_py-0.39.1 → 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.1"
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.1"
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.1"
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.1"
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.1"
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.1"
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.1"
234
+ version = "0.39.2"
235
235
  dependencies = [
236
236
  "ast-grep-config",
237
237
  "ast-grep-core",
@@ -247,7 +247,7 @@ dependencies = [
247
247
 
248
248
  [[package]]
249
249
  name = "ast-grep-py"
250
- version = "0.39.1"
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,9 +1083,9 @@ 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",
@@ -1100,15 +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"
1105
+ checksum = "dcae8ad5609d14afb3a3b91dee88c757016261b151e9dcecabf1b2a31a6cab14"
1106
1106
 
1107
1107
  [[package]]
1108
1108
  name = "napi-derive"
1109
- version = "3.0.0"
1109
+ version = "3.1.1"
1110
1110
  source = "registry+https://github.com/rust-lang/crates.io-index"
1111
- checksum = "ce09c2a155c7c38447a6ff1711899375bdd8f9dd5a50aad700a9c765c9f8a375"
1111
+ checksum = "43e61844e0c0bb81e711f2084abe7cff187b03ca21ff8b000cb59bbda61e15a9"
1112
1112
  dependencies = [
1113
1113
  "convert_case 0.8.0",
1114
1114
  "ctor",
@@ -1120,9 +1120,9 @@ dependencies = [
1120
1120
 
1121
1121
  [[package]]
1122
1122
  name = "napi-derive-backend"
1123
- version = "2.0.0"
1123
+ version = "2.0.2"
1124
1124
  source = "registry+https://github.com/rust-lang/crates.io-index"
1125
- checksum = "17923387d68ecfe057a04a38ee89aeb41f415c43b4c7a508a3683bf0c1511c5a"
1125
+ checksum = "b7ab19e9b98efb13895f492a2e367ca50c955ac3c4723613af73fdda4011afcc"
1126
1126
  dependencies = [
1127
1127
  "convert_case 0.8.0",
1128
1128
  "proc-macro2",
@@ -1279,9 +1279,9 @@ dependencies = [
1279
1279
 
1280
1280
  [[package]]
1281
1281
  name = "pyo3"
1282
- version = "0.25.0"
1282
+ version = "0.25.1"
1283
1283
  source = "registry+https://github.com/rust-lang/crates.io-index"
1284
- checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4"
1284
+ checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a"
1285
1285
  dependencies = [
1286
1286
  "anyhow",
1287
1287
  "indoc",
@@ -1297,9 +1297,9 @@ dependencies = [
1297
1297
 
1298
1298
  [[package]]
1299
1299
  name = "pyo3-build-config"
1300
- version = "0.25.0"
1300
+ version = "0.25.1"
1301
1301
  source = "registry+https://github.com/rust-lang/crates.io-index"
1302
- checksum = "755ea671a1c34044fa165247aaf6f419ca39caa6003aee791a0df2713d8f1b6d"
1302
+ checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598"
1303
1303
  dependencies = [
1304
1304
  "once_cell",
1305
1305
  "target-lexicon",
@@ -1307,9 +1307,9 @@ dependencies = [
1307
1307
 
1308
1308
  [[package]]
1309
1309
  name = "pyo3-ffi"
1310
- version = "0.25.0"
1310
+ version = "0.25.1"
1311
1311
  source = "registry+https://github.com/rust-lang/crates.io-index"
1312
- checksum = "fc95a2e67091e44791d4ea300ff744be5293f394f1bafd9f78c080814d35956e"
1312
+ checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c"
1313
1313
  dependencies = [
1314
1314
  "libc",
1315
1315
  "pyo3-build-config",
@@ -1317,9 +1317,9 @@ dependencies = [
1317
1317
 
1318
1318
  [[package]]
1319
1319
  name = "pyo3-macros"
1320
- version = "0.25.0"
1320
+ version = "0.25.1"
1321
1321
  source = "registry+https://github.com/rust-lang/crates.io-index"
1322
- checksum = "a179641d1b93920829a62f15e87c0ed791b6c8db2271ba0fd7c2686090510214"
1322
+ checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50"
1323
1323
  dependencies = [
1324
1324
  "proc-macro2",
1325
1325
  "pyo3-macros-backend",
@@ -1329,9 +1329,9 @@ dependencies = [
1329
1329
 
1330
1330
  [[package]]
1331
1331
  name = "pyo3-macros-backend"
1332
- version = "0.25.0"
1332
+ version = "0.25.1"
1333
1333
  source = "registry+https://github.com/rust-lang/crates.io-index"
1334
- checksum = "9dff85ebcaab8c441b0e3f7ae40a6963ecea8a9f5e74f647e33fcf5ec9a1e89e"
1334
+ checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc"
1335
1335
  dependencies = [
1336
1336
  "heck",
1337
1337
  "proc-macro2",
@@ -1374,6 +1374,26 @@ dependencies = [
1374
1374
  "bitflags 2.9.0",
1375
1375
  ]
1376
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
+
1377
1397
  [[package]]
1378
1398
  name = "regex"
1379
1399
  version = "1.11.1"
@@ -1425,7 +1445,7 @@ dependencies = [
1425
1445
  "errno",
1426
1446
  "libc",
1427
1447
  "linux-raw-sys",
1428
- "windows-sys 0.52.0",
1448
+ "windows-sys 0.59.0",
1429
1449
  ]
1430
1450
 
1431
1451
  [[package]]
@@ -1445,11 +1465,12 @@ dependencies = [
1445
1465
 
1446
1466
  [[package]]
1447
1467
  name = "schemars"
1448
- version = "0.8.22"
1468
+ version = "1.0.4"
1449
1469
  source = "registry+https://github.com/rust-lang/crates.io-index"
1450
- checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615"
1470
+ checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0"
1451
1471
  dependencies = [
1452
1472
  "dyn-clone",
1473
+ "ref-cast",
1453
1474
  "schemars_derive",
1454
1475
  "serde",
1455
1476
  "serde_json",
@@ -1457,9 +1478,9 @@ dependencies = [
1457
1478
 
1458
1479
  [[package]]
1459
1480
  name = "schemars_derive"
1460
- version = "0.8.22"
1481
+ version = "1.0.4"
1461
1482
  source = "registry+https://github.com/rust-lang/crates.io-index"
1462
- checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d"
1483
+ checksum = "33d020396d1d138dc19f1165df7545479dcd58d93810dc5d646a16e55abefa80"
1463
1484
  dependencies = [
1464
1485
  "proc-macro2",
1465
1486
  "quote",
@@ -1662,7 +1683,7 @@ dependencies = [
1662
1683
  "getrandom",
1663
1684
  "once_cell",
1664
1685
  "rustix",
1665
- "windows-sys 0.52.0",
1686
+ "windows-sys 0.59.0",
1666
1687
  ]
1667
1688
 
1668
1689
  [[package]]
@@ -1760,9 +1781,9 @@ dependencies = [
1760
1781
 
1761
1782
  [[package]]
1762
1783
  name = "tokio"
1763
- version = "1.46.1"
1784
+ version = "1.47.0"
1764
1785
  source = "registry+https://github.com/rust-lang/crates.io-index"
1765
- checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17"
1786
+ checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35"
1766
1787
  dependencies = [
1767
1788
  "backtrace",
1768
1789
  "bytes",
@@ -2122,9 +2143,9 @@ dependencies = [
2122
2143
 
2123
2144
  [[package]]
2124
2145
  name = "tree-sitter-solidity"
2125
- version = "1.2.11"
2146
+ version = "1.2.12"
2126
2147
  source = "registry+https://github.com/rust-lang/crates.io-index"
2127
- checksum = "316bcbf903cd09a781734f4127ef21341e810cf85f89b0b96fffab48d55fd672"
2148
+ checksum = "92f0b44ef36f0779873ec118f2cbad31cfc18d6ae7ba48ce75d5ce09870884d1"
2128
2149
  dependencies = [
2129
2150
  "cc",
2130
2151
  "tree-sitter-language",
@@ -2258,7 +2279,7 @@ version = "0.1.9"
2258
2279
  source = "registry+https://github.com/rust-lang/crates.io-index"
2259
2280
  checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
2260
2281
  dependencies = [
2261
- "windows-sys 0.48.0",
2282
+ "windows-sys 0.59.0",
2262
2283
  ]
2263
2284
 
2264
2285
  [[package]]
@@ -7,7 +7,7 @@ resolver = "2"
7
7
  lto = true
8
8
 
9
9
  [workspace.package]
10
- version = "0.39.1"
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.1", default-features = false }
22
- ast-grep-config = { path = "crates/config", version = "0.39.1" }
23
- ast-grep-dynamic = { path = "crates/dynamic", version = "0.39.1" }
24
- ast-grep-language = { path = "crates/language", version = "0.39.1" }
25
- ast-grep-lsp = { path = "crates/lsp", version = "0.39.1" }
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.1
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,
@@ -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.1"
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