ast-grep-py 0.39.3__tar.gz → 0.39.5__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.
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/Cargo.lock +114 -76
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/Cargo.toml +6 -6
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/PKG-INFO +1 -1
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/match_tree/match_node.rs +1 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/match_tree/strictness.rs +14 -2
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/Cargo.toml +2 -2
- ast_grep_py-0.39.5/crates/language/src/hcl.rs +61 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/lib.rs +2 -2
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/Cargo.toml +2 -2
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/src/py_node.rs +3 -3
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/pyproject.toml +1 -1
- ast_grep_py-0.39.3/crates/language/src/hcl.rs +0 -47
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/README.md +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/ast_grep_py/__init__.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/ast_grep_py/ast_grep_py.pyi +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/ast_grep_py/py.typed +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/Cargo.toml +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/check_var.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/combined.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/fixer.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/label.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/lib.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/maybe.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/deserialize_env.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/mod.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/nth_child.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/range.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/referent_rule.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/relational_rule.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/selector.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule/stop_by.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule_collection.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule_config.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/rule_core.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/transform/mod.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/transform/parse.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/transform/rewrite.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/transform/string_case.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/config/src/transform/trans.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/Cargo.toml +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/language.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/lib.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/match_tree/mod.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/matcher/kind.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/matcher/node_match.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/matcher/pattern.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/matcher/text.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/matcher.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/meta_var.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/node.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/ops.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/pinned.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/replacer/indent.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/replacer/structural.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/replacer/template.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/replacer.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/source.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/tree_sitter/mod.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/core/src/tree_sitter/traversal.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/dynamic/Cargo.toml +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/dynamic/src/custom_lang.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/dynamic/src/lib.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/bash.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/cpp.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/csharp.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/css.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/elixir.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/go.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/haskell.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/html.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/json.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/kotlin.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/lua.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/nix.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/parsers.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/php.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/python.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/ruby.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/rust.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/scala.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/solidity.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/swift.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/language/src/yaml.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/README.md +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/ast_grep_py/__init__.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/ast_grep_py/ast_grep_py.pyi +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/ast_grep_py/py.typed +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/src/lib.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/src/py_lang.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/src/range.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/src/unicode_position.rs +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_fix.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_range.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_register_lang.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_rule.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_simple.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_traversal.py +0 -0
- {ast_grep_py-0.39.3 → ast_grep_py-0.39.5}/crates/pyo3/tests/test_wrong_usage.py +0 -0
|
@@ -87,9 +87,9 @@ dependencies = [
|
|
|
87
87
|
|
|
88
88
|
[[package]]
|
|
89
89
|
name = "anyhow"
|
|
90
|
-
version = "1.0.
|
|
90
|
+
version = "1.0.99"
|
|
91
91
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
|
-
checksum = "
|
|
92
|
+
checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
|
|
93
93
|
|
|
94
94
|
[[package]]
|
|
95
95
|
name = "assert_cmd"
|
|
@@ -109,7 +109,7 @@ dependencies = [
|
|
|
109
109
|
|
|
110
110
|
[[package]]
|
|
111
111
|
name = "ast-grep"
|
|
112
|
-
version = "0.39.
|
|
112
|
+
version = "0.39.5"
|
|
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.
|
|
146
|
+
version = "0.39.5"
|
|
147
147
|
dependencies = [
|
|
148
148
|
"ast-grep-core",
|
|
149
149
|
"bit-set",
|
|
@@ -152,24 +152,24 @@ dependencies = [
|
|
|
152
152
|
"schemars",
|
|
153
153
|
"serde",
|
|
154
154
|
"serde_yaml",
|
|
155
|
-
"thiserror 2.0.
|
|
155
|
+
"thiserror 2.0.16",
|
|
156
156
|
"tree-sitter-typescript",
|
|
157
157
|
]
|
|
158
158
|
|
|
159
159
|
[[package]]
|
|
160
160
|
name = "ast-grep-core"
|
|
161
|
-
version = "0.39.
|
|
161
|
+
version = "0.39.5"
|
|
162
162
|
dependencies = [
|
|
163
163
|
"bit-set",
|
|
164
164
|
"regex",
|
|
165
|
-
"thiserror 2.0.
|
|
165
|
+
"thiserror 2.0.16",
|
|
166
166
|
"tree-sitter",
|
|
167
167
|
"tree-sitter-typescript",
|
|
168
168
|
]
|
|
169
169
|
|
|
170
170
|
[[package]]
|
|
171
171
|
name = "ast-grep-dynamic"
|
|
172
|
-
version = "0.39.
|
|
172
|
+
version = "0.39.5"
|
|
173
173
|
dependencies = [
|
|
174
174
|
"ast-grep-core",
|
|
175
175
|
"ignore",
|
|
@@ -177,13 +177,13 @@ dependencies = [
|
|
|
177
177
|
"serde",
|
|
178
178
|
"serde_yaml",
|
|
179
179
|
"target-triple",
|
|
180
|
-
"thiserror 2.0.
|
|
180
|
+
"thiserror 2.0.16",
|
|
181
181
|
"tree-sitter",
|
|
182
182
|
]
|
|
183
183
|
|
|
184
184
|
[[package]]
|
|
185
185
|
name = "ast-grep-language"
|
|
186
|
-
version = "0.39.
|
|
186
|
+
version = "0.39.5"
|
|
187
187
|
dependencies = [
|
|
188
188
|
"ast-grep-core",
|
|
189
189
|
"ignore",
|
|
@@ -218,21 +218,25 @@ dependencies = [
|
|
|
218
218
|
|
|
219
219
|
[[package]]
|
|
220
220
|
name = "ast-grep-lsp"
|
|
221
|
-
version = "0.39.
|
|
221
|
+
version = "0.39.5"
|
|
222
222
|
dependencies = [
|
|
223
|
+
"anyhow",
|
|
223
224
|
"ast-grep-config",
|
|
224
225
|
"ast-grep-core",
|
|
225
226
|
"ast-grep-language",
|
|
226
227
|
"dashmap",
|
|
228
|
+
"futures",
|
|
227
229
|
"serde",
|
|
228
230
|
"serde_json",
|
|
229
231
|
"tokio",
|
|
232
|
+
"tokio-stream",
|
|
233
|
+
"tokio-util",
|
|
230
234
|
"tower-lsp-server",
|
|
231
235
|
]
|
|
232
236
|
|
|
233
237
|
[[package]]
|
|
234
238
|
name = "ast-grep-napi"
|
|
235
|
-
version = "0.39.
|
|
239
|
+
version = "0.39.5"
|
|
236
240
|
dependencies = [
|
|
237
241
|
"ast-grep-config",
|
|
238
242
|
"ast-grep-core",
|
|
@@ -248,7 +252,7 @@ dependencies = [
|
|
|
248
252
|
|
|
249
253
|
[[package]]
|
|
250
254
|
name = "ast-grep-py"
|
|
251
|
-
version = "0.39.
|
|
255
|
+
version = "0.39.5"
|
|
252
256
|
dependencies = [
|
|
253
257
|
"anyhow",
|
|
254
258
|
"ast-grep-config",
|
|
@@ -365,9 +369,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|
|
365
369
|
|
|
366
370
|
[[package]]
|
|
367
371
|
name = "clap"
|
|
368
|
-
version = "4.5.
|
|
372
|
+
version = "4.5.47"
|
|
369
373
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
370
|
-
checksum = "
|
|
374
|
+
checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931"
|
|
371
375
|
dependencies = [
|
|
372
376
|
"clap_builder",
|
|
373
377
|
"clap_derive",
|
|
@@ -375,9 +379,9 @@ dependencies = [
|
|
|
375
379
|
|
|
376
380
|
[[package]]
|
|
377
381
|
name = "clap_builder"
|
|
378
|
-
version = "4.5.
|
|
382
|
+
version = "4.5.47"
|
|
379
383
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
380
|
-
checksum = "
|
|
384
|
+
checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6"
|
|
381
385
|
dependencies = [
|
|
382
386
|
"anstream",
|
|
383
387
|
"anstyle",
|
|
@@ -387,18 +391,18 @@ dependencies = [
|
|
|
387
391
|
|
|
388
392
|
[[package]]
|
|
389
393
|
name = "clap_complete"
|
|
390
|
-
version = "4.5.
|
|
394
|
+
version = "4.5.57"
|
|
391
395
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
392
|
-
checksum = "
|
|
396
|
+
checksum = "4d9501bd3f5f09f7bbee01da9a511073ed30a80cd7a509f1214bb74eadea71ad"
|
|
393
397
|
dependencies = [
|
|
394
398
|
"clap",
|
|
395
399
|
]
|
|
396
400
|
|
|
397
401
|
[[package]]
|
|
398
402
|
name = "clap_derive"
|
|
399
|
-
version = "4.5.
|
|
403
|
+
version = "4.5.47"
|
|
400
404
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
401
|
-
checksum = "
|
|
405
|
+
checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c"
|
|
402
406
|
dependencies = [
|
|
403
407
|
"heck",
|
|
404
408
|
"proc-macro2",
|
|
@@ -458,9 +462,9 @@ dependencies = [
|
|
|
458
462
|
|
|
459
463
|
[[package]]
|
|
460
464
|
name = "crokey"
|
|
461
|
-
version = "1.
|
|
465
|
+
version = "1.3.0"
|
|
462
466
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
463
|
-
checksum = "
|
|
467
|
+
checksum = "51360853ebbeb3df20c76c82aecf43d387a62860f1a59ba65ab51f00eea85aad"
|
|
464
468
|
dependencies = [
|
|
465
469
|
"crokey-proc_macros",
|
|
466
470
|
"crossterm 0.29.0",
|
|
@@ -471,9 +475,9 @@ dependencies = [
|
|
|
471
475
|
|
|
472
476
|
[[package]]
|
|
473
477
|
name = "crokey-proc_macros"
|
|
474
|
-
version = "1.
|
|
478
|
+
version = "1.3.0"
|
|
475
479
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
476
|
-
checksum = "
|
|
480
|
+
checksum = "3bf1a727caeb5ee5e0a0826a97f205a9cf84ee964b0b48239fef5214a00ae439"
|
|
477
481
|
dependencies = [
|
|
478
482
|
"crossterm 0.29.0",
|
|
479
483
|
"proc-macro2",
|
|
@@ -583,9 +587,9 @@ dependencies = [
|
|
|
583
587
|
|
|
584
588
|
[[package]]
|
|
585
589
|
name = "ctor"
|
|
586
|
-
version = "0.
|
|
590
|
+
version = "0.5.0"
|
|
587
591
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
588
|
-
checksum = "
|
|
592
|
+
checksum = "67773048316103656a637612c4a62477603b777d91d9c62ff2290f9cde178fdb"
|
|
589
593
|
dependencies = [
|
|
590
594
|
"ctor-proc-macro",
|
|
591
595
|
"dtor",
|
|
@@ -593,9 +597,9 @@ dependencies = [
|
|
|
593
597
|
|
|
594
598
|
[[package]]
|
|
595
599
|
name = "ctor-proc-macro"
|
|
596
|
-
version = "0.0.
|
|
600
|
+
version = "0.0.6"
|
|
597
601
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
598
|
-
checksum = "
|
|
602
|
+
checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2"
|
|
599
603
|
|
|
600
604
|
[[package]]
|
|
601
605
|
name = "dashmap"
|
|
@@ -655,18 +659,18 @@ dependencies = [
|
|
|
655
659
|
|
|
656
660
|
[[package]]
|
|
657
661
|
name = "dtor"
|
|
658
|
-
version = "0.0
|
|
662
|
+
version = "0.1.0"
|
|
659
663
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
660
|
-
checksum = "
|
|
664
|
+
checksum = "e58a0764cddb55ab28955347b45be00ade43d4d6f3ba4bf3dc354e4ec9432934"
|
|
661
665
|
dependencies = [
|
|
662
666
|
"dtor-proc-macro",
|
|
663
667
|
]
|
|
664
668
|
|
|
665
669
|
[[package]]
|
|
666
670
|
name = "dtor-proc-macro"
|
|
667
|
-
version = "0.0.
|
|
671
|
+
version = "0.0.6"
|
|
668
672
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
669
|
-
checksum = "
|
|
673
|
+
checksum = "f678cf4a922c215c63e0de95eb1ff08a958a81d47e485cf9da1e27bf6305cfa5"
|
|
670
674
|
|
|
671
675
|
[[package]]
|
|
672
676
|
name = "dyn-clone"
|
|
@@ -722,6 +726,7 @@ checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
|
|
722
726
|
dependencies = [
|
|
723
727
|
"futures-channel",
|
|
724
728
|
"futures-core",
|
|
729
|
+
"futures-executor",
|
|
725
730
|
"futures-io",
|
|
726
731
|
"futures-sink",
|
|
727
732
|
"futures-task",
|
|
@@ -744,6 +749,17 @@ version = "0.3.31"
|
|
|
744
749
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
745
750
|
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
|
746
751
|
|
|
752
|
+
[[package]]
|
|
753
|
+
name = "futures-executor"
|
|
754
|
+
version = "0.3.31"
|
|
755
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
756
|
+
checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f"
|
|
757
|
+
dependencies = [
|
|
758
|
+
"futures-core",
|
|
759
|
+
"futures-task",
|
|
760
|
+
"futures-util",
|
|
761
|
+
]
|
|
762
|
+
|
|
747
763
|
[[package]]
|
|
748
764
|
name = "futures-io"
|
|
749
765
|
version = "0.3.31"
|
|
@@ -1084,9 +1100,9 @@ dependencies = [
|
|
|
1084
1100
|
|
|
1085
1101
|
[[package]]
|
|
1086
1102
|
name = "napi"
|
|
1087
|
-
version = "3.
|
|
1103
|
+
version = "3.2.4"
|
|
1088
1104
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1089
|
-
checksum = "
|
|
1105
|
+
checksum = "fc1d56eed08a179e1c5bedb1613c58e882087cec97fcaa7788cc42366335a41d"
|
|
1090
1106
|
dependencies = [
|
|
1091
1107
|
"anyhow",
|
|
1092
1108
|
"bitflags 2.9.0",
|
|
@@ -1107,9 +1123,9 @@ checksum = "dcae8ad5609d14afb3a3b91dee88c757016261b151e9dcecabf1b2a31a6cab14"
|
|
|
1107
1123
|
|
|
1108
1124
|
[[package]]
|
|
1109
1125
|
name = "napi-derive"
|
|
1110
|
-
version = "3.
|
|
1126
|
+
version = "3.2.4"
|
|
1111
1127
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1112
|
-
checksum = "
|
|
1128
|
+
checksum = "3a9ad4169931359f24cc9ad3fae4ab272f0390c59f7a764f7719b1b8a3dde1af"
|
|
1113
1129
|
dependencies = [
|
|
1114
1130
|
"convert_case 0.8.0",
|
|
1115
1131
|
"ctor",
|
|
@@ -1121,9 +1137,9 @@ dependencies = [
|
|
|
1121
1137
|
|
|
1122
1138
|
[[package]]
|
|
1123
1139
|
name = "napi-derive-backend"
|
|
1124
|
-
version = "2.
|
|
1140
|
+
version = "2.1.4"
|
|
1125
1141
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1126
|
-
checksum = "
|
|
1142
|
+
checksum = "55a014314cb458d5832b4fc7d0041764ac136396447303d95e3fa0a5ea7cf5d3"
|
|
1127
1143
|
dependencies = [
|
|
1128
1144
|
"convert_case 0.8.0",
|
|
1129
1145
|
"proc-macro2",
|
|
@@ -1280,9 +1296,9 @@ dependencies = [
|
|
|
1280
1296
|
|
|
1281
1297
|
[[package]]
|
|
1282
1298
|
name = "pyo3"
|
|
1283
|
-
version = "0.
|
|
1299
|
+
version = "0.26.0"
|
|
1284
1300
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1285
|
-
checksum = "
|
|
1301
|
+
checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
|
|
1286
1302
|
dependencies = [
|
|
1287
1303
|
"anyhow",
|
|
1288
1304
|
"indoc",
|
|
@@ -1298,19 +1314,18 @@ dependencies = [
|
|
|
1298
1314
|
|
|
1299
1315
|
[[package]]
|
|
1300
1316
|
name = "pyo3-build-config"
|
|
1301
|
-
version = "0.
|
|
1317
|
+
version = "0.26.0"
|
|
1302
1318
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1303
|
-
checksum = "
|
|
1319
|
+
checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
|
|
1304
1320
|
dependencies = [
|
|
1305
|
-
"once_cell",
|
|
1306
1321
|
"target-lexicon",
|
|
1307
1322
|
]
|
|
1308
1323
|
|
|
1309
1324
|
[[package]]
|
|
1310
1325
|
name = "pyo3-ffi"
|
|
1311
|
-
version = "0.
|
|
1326
|
+
version = "0.26.0"
|
|
1312
1327
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1313
|
-
checksum = "
|
|
1328
|
+
checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
|
|
1314
1329
|
dependencies = [
|
|
1315
1330
|
"libc",
|
|
1316
1331
|
"pyo3-build-config",
|
|
@@ -1318,9 +1333,9 @@ dependencies = [
|
|
|
1318
1333
|
|
|
1319
1334
|
[[package]]
|
|
1320
1335
|
name = "pyo3-macros"
|
|
1321
|
-
version = "0.
|
|
1336
|
+
version = "0.26.0"
|
|
1322
1337
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1323
|
-
checksum = "
|
|
1338
|
+
checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
|
|
1324
1339
|
dependencies = [
|
|
1325
1340
|
"proc-macro2",
|
|
1326
1341
|
"pyo3-macros-backend",
|
|
@@ -1330,9 +1345,9 @@ dependencies = [
|
|
|
1330
1345
|
|
|
1331
1346
|
[[package]]
|
|
1332
1347
|
name = "pyo3-macros-backend"
|
|
1333
|
-
version = "0.
|
|
1348
|
+
version = "0.26.0"
|
|
1334
1349
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1335
|
-
checksum = "
|
|
1350
|
+
checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
|
|
1336
1351
|
dependencies = [
|
|
1337
1352
|
"heck",
|
|
1338
1353
|
"proc-macro2",
|
|
@@ -1343,9 +1358,9 @@ dependencies = [
|
|
|
1343
1358
|
|
|
1344
1359
|
[[package]]
|
|
1345
1360
|
name = "pythonize"
|
|
1346
|
-
version = "0.
|
|
1361
|
+
version = "0.26.0"
|
|
1347
1362
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1348
|
-
checksum = "
|
|
1363
|
+
checksum = "11e06e4cff9be2bbf2bddf28a486ae619172ea57e79787f856572878c62dcfe2"
|
|
1349
1364
|
dependencies = [
|
|
1350
1365
|
"pyo3",
|
|
1351
1366
|
"serde",
|
|
@@ -1397,9 +1412,9 @@ dependencies = [
|
|
|
1397
1412
|
|
|
1398
1413
|
[[package]]
|
|
1399
1414
|
name = "regex"
|
|
1400
|
-
version = "1.11.
|
|
1415
|
+
version = "1.11.2"
|
|
1401
1416
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1402
|
-
checksum = "
|
|
1417
|
+
checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912"
|
|
1403
1418
|
dependencies = [
|
|
1404
1419
|
"aho-corasick",
|
|
1405
1420
|
"memchr",
|
|
@@ -1534,9 +1549,9 @@ dependencies = [
|
|
|
1534
1549
|
|
|
1535
1550
|
[[package]]
|
|
1536
1551
|
name = "serde_json"
|
|
1537
|
-
version = "1.0.
|
|
1552
|
+
version = "1.0.143"
|
|
1538
1553
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1539
|
-
checksum = "
|
|
1554
|
+
checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
|
|
1540
1555
|
dependencies = [
|
|
1541
1556
|
"indexmap",
|
|
1542
1557
|
"itoa",
|
|
@@ -1676,9 +1691,9 @@ checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790"
|
|
|
1676
1691
|
|
|
1677
1692
|
[[package]]
|
|
1678
1693
|
name = "tempfile"
|
|
1679
|
-
version = "3.
|
|
1694
|
+
version = "3.21.0"
|
|
1680
1695
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1681
|
-
checksum = "
|
|
1696
|
+
checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e"
|
|
1682
1697
|
dependencies = [
|
|
1683
1698
|
"fastrand",
|
|
1684
1699
|
"getrandom",
|
|
@@ -1698,9 +1713,9 @@ dependencies = [
|
|
|
1698
1713
|
|
|
1699
1714
|
[[package]]
|
|
1700
1715
|
name = "termimad"
|
|
1701
|
-
version = "0.
|
|
1716
|
+
version = "0.34.0"
|
|
1702
1717
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1703
|
-
checksum = "
|
|
1718
|
+
checksum = "68ff5ca043d65d4ea43b65cdb4e3aba119657d0d12caf44f93212ec3168a8e20"
|
|
1704
1719
|
dependencies = [
|
|
1705
1720
|
"coolor",
|
|
1706
1721
|
"crokey",
|
|
@@ -1708,7 +1723,7 @@ dependencies = [
|
|
|
1708
1723
|
"lazy-regex",
|
|
1709
1724
|
"minimad",
|
|
1710
1725
|
"serde",
|
|
1711
|
-
"thiserror 2.0.
|
|
1726
|
+
"thiserror 2.0.16",
|
|
1712
1727
|
"unicode-width 0.1.14",
|
|
1713
1728
|
]
|
|
1714
1729
|
|
|
@@ -1741,11 +1756,11 @@ dependencies = [
|
|
|
1741
1756
|
|
|
1742
1757
|
[[package]]
|
|
1743
1758
|
name = "thiserror"
|
|
1744
|
-
version = "2.0.
|
|
1759
|
+
version = "2.0.16"
|
|
1745
1760
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1746
|
-
checksum = "
|
|
1761
|
+
checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0"
|
|
1747
1762
|
dependencies = [
|
|
1748
|
-
"thiserror-impl 2.0.
|
|
1763
|
+
"thiserror-impl 2.0.16",
|
|
1749
1764
|
]
|
|
1750
1765
|
|
|
1751
1766
|
[[package]]
|
|
@@ -1761,9 +1776,9 @@ dependencies = [
|
|
|
1761
1776
|
|
|
1762
1777
|
[[package]]
|
|
1763
1778
|
name = "thiserror-impl"
|
|
1764
|
-
version = "2.0.
|
|
1779
|
+
version = "2.0.16"
|
|
1765
1780
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1766
|
-
checksum = "
|
|
1781
|
+
checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960"
|
|
1767
1782
|
dependencies = [
|
|
1768
1783
|
"proc-macro2",
|
|
1769
1784
|
"quote",
|
|
@@ -1793,13 +1808,36 @@ dependencies = [
|
|
|
1793
1808
|
"mio 1.0.3",
|
|
1794
1809
|
"pin-project-lite",
|
|
1795
1810
|
"slab",
|
|
1811
|
+
"tokio-macros",
|
|
1812
|
+
]
|
|
1813
|
+
|
|
1814
|
+
[[package]]
|
|
1815
|
+
name = "tokio-macros"
|
|
1816
|
+
version = "2.5.0"
|
|
1817
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1818
|
+
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
|
|
1819
|
+
dependencies = [
|
|
1820
|
+
"proc-macro2",
|
|
1821
|
+
"quote",
|
|
1822
|
+
"syn",
|
|
1823
|
+
]
|
|
1824
|
+
|
|
1825
|
+
[[package]]
|
|
1826
|
+
name = "tokio-stream"
|
|
1827
|
+
version = "0.1.17"
|
|
1828
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1829
|
+
checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047"
|
|
1830
|
+
dependencies = [
|
|
1831
|
+
"futures-core",
|
|
1832
|
+
"pin-project-lite",
|
|
1833
|
+
"tokio",
|
|
1796
1834
|
]
|
|
1797
1835
|
|
|
1798
1836
|
[[package]]
|
|
1799
1837
|
name = "tokio-util"
|
|
1800
|
-
version = "0.7.
|
|
1838
|
+
version = "0.7.16"
|
|
1801
1839
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1802
|
-
checksum = "
|
|
1840
|
+
checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5"
|
|
1803
1841
|
dependencies = [
|
|
1804
1842
|
"bytes",
|
|
1805
1843
|
"futures-core",
|
|
@@ -1819,9 +1857,9 @@ dependencies = [
|
|
|
1819
1857
|
|
|
1820
1858
|
[[package]]
|
|
1821
1859
|
name = "toml_edit"
|
|
1822
|
-
version = "0.23.
|
|
1860
|
+
version = "0.23.4"
|
|
1823
1861
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1824
|
-
checksum = "
|
|
1862
|
+
checksum = "7211ff1b8f0d3adae1663b7da9ffe396eabe1ca25f0b0bee42b0da29a9ddce93"
|
|
1825
1863
|
dependencies = [
|
|
1826
1864
|
"indexmap",
|
|
1827
1865
|
"toml_datetime",
|
|
@@ -1832,9 +1870,9 @@ dependencies = [
|
|
|
1832
1870
|
|
|
1833
1871
|
[[package]]
|
|
1834
1872
|
name = "toml_parser"
|
|
1835
|
-
version = "1.0.
|
|
1873
|
+
version = "1.0.2"
|
|
1836
1874
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1837
|
-
checksum = "
|
|
1875
|
+
checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10"
|
|
1838
1876
|
dependencies = [
|
|
1839
1877
|
"winnow",
|
|
1840
1878
|
]
|
|
@@ -2048,9 +2086,9 @@ dependencies = [
|
|
|
2048
2086
|
|
|
2049
2087
|
[[package]]
|
|
2050
2088
|
name = "tree-sitter-javascript"
|
|
2051
|
-
version = "0.
|
|
2089
|
+
version = "0.25.0"
|
|
2052
2090
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2053
|
-
checksum = "
|
|
2091
|
+
checksum = "68204f2abc0627a90bdf06e605f5c470aa26fdcb2081ea553a04bdad756693f5"
|
|
2054
2092
|
dependencies = [
|
|
2055
2093
|
"cc",
|
|
2056
2094
|
"tree-sitter-language",
|
|
@@ -2104,9 +2142,9 @@ dependencies = [
|
|
|
2104
2142
|
|
|
2105
2143
|
[[package]]
|
|
2106
2144
|
name = "tree-sitter-php"
|
|
2107
|
-
version = "0.
|
|
2145
|
+
version = "0.24.2"
|
|
2108
2146
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2109
|
-
checksum = "
|
|
2147
|
+
checksum = "0d8c17c3ab69052c5eeaa7ff5cd972dd1bc25d1b97ee779fec391ad3b5df5592"
|
|
2110
2148
|
dependencies = [
|
|
2111
2149
|
"cc",
|
|
2112
2150
|
"tree-sitter-language",
|
|
@@ -7,7 +7,7 @@ resolver = "2"
|
|
|
7
7
|
lto = true
|
|
8
8
|
|
|
9
9
|
[workspace.package]
|
|
10
|
-
version = "0.39.
|
|
10
|
+
version = "0.39.5"
|
|
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.
|
|
22
|
-
ast-grep-config = { path = "crates/config", version = "0.39.
|
|
23
|
-
ast-grep-dynamic = { path = "crates/dynamic", version = "0.39.
|
|
24
|
-
ast-grep-language = { path = "crates/language", version = "0.39.
|
|
25
|
-
ast-grep-lsp = { path = "crates/lsp", version = "0.39.
|
|
21
|
+
ast-grep-core = { path = "crates/core", version = "0.39.5", default-features = false }
|
|
22
|
+
ast-grep-config = { path = "crates/config", version = "0.39.5" }
|
|
23
|
+
ast-grep-dynamic = { path = "crates/dynamic", version = "0.39.5" }
|
|
24
|
+
ast-grep-language = { path = "crates/language", version = "0.39.5" }
|
|
25
|
+
ast-grep-lsp = { path = "crates/lsp", version = "0.39.5" }
|
|
26
26
|
|
|
27
27
|
bit-set = { version = "0.8.0" }
|
|
28
28
|
ignore = { version = "0.4.22" }
|
|
@@ -46,6 +46,15 @@ impl MatchStrictness {
|
|
|
46
46
|
M::Signature => false,
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
fn should_skip_comment(&self) -> bool {
|
|
51
|
+
use MatchStrictness as M;
|
|
52
|
+
match self {
|
|
53
|
+
M::Cst | M::Smart | M::Ast => false,
|
|
54
|
+
M::Relaxed | M::Signature | M::Template => true,
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
49
58
|
pub(crate) fn match_terminal(
|
|
50
59
|
&self,
|
|
51
60
|
is_named: bool,
|
|
@@ -62,16 +71,19 @@ impl MatchStrictness {
|
|
|
62
71
|
if is_kind_matched && (!is_named || text == candidate.text()) {
|
|
63
72
|
return MatchOneNode::MatchedBoth;
|
|
64
73
|
}
|
|
74
|
+
if self.should_skip_comment() && skip_comment(candidate) {
|
|
75
|
+
return MatchOneNode::SkipCandidate;
|
|
76
|
+
}
|
|
65
77
|
let (skip_goal, skip_candidate) = match self {
|
|
66
78
|
M::Cst => (false, false),
|
|
67
79
|
M::Smart => (false, !candidate.is_named()),
|
|
68
80
|
M::Ast => (!is_named, !candidate.is_named()),
|
|
69
|
-
M::Relaxed => (!is_named,
|
|
81
|
+
M::Relaxed => (!is_named, !candidate.is_named()),
|
|
70
82
|
M::Signature => {
|
|
71
83
|
if is_kind_matched {
|
|
72
84
|
return MatchOneNode::MatchedBoth;
|
|
73
85
|
}
|
|
74
|
-
(!is_named,
|
|
86
|
+
(!is_named, !candidate.is_named())
|
|
75
87
|
}
|
|
76
88
|
M::Template => {
|
|
77
89
|
if text == candidate.text() {
|
|
@@ -26,13 +26,13 @@ tree-sitter-elixir = { version = "0.3.0", optional = true }
|
|
|
26
26
|
tree-sitter-go = { version = "0.23.0", optional = true }
|
|
27
27
|
tree-sitter-haskell = { version = "0.23.0", optional = true }
|
|
28
28
|
tree-sitter-html = { version = "0.23.0", optional = true }
|
|
29
|
-
tree-sitter-javascript = { version = "0.
|
|
29
|
+
tree-sitter-javascript = { version = "0.25.0", optional = true }
|
|
30
30
|
tree-sitter-java = { version = "0.23.0", optional = true }
|
|
31
31
|
tree-sitter-json = { version = "0.23.0", optional = true }
|
|
32
32
|
tree-sitter-kotlin = { version = "0.4.0", optional = true, package = "tree-sitter-kotlin-sg" }
|
|
33
33
|
tree-sitter-lua = { version = "0.2.0", optional = true }
|
|
34
34
|
tree-sitter-nix = { version = "0.3.0", optional = true }
|
|
35
|
-
tree-sitter-php = { version = "0.
|
|
35
|
+
tree-sitter-php = { version = "0.24.0", optional = true }
|
|
36
36
|
tree-sitter-python = { version = "0.23.0", optional = true }
|
|
37
37
|
tree-sitter-ruby = { version = "0.23.0", optional = true }
|
|
38
38
|
tree-sitter-rust = { version = "0.24.0", optional = true }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#![cfg(test)]
|
|
2
|
+
use super::*;
|
|
3
|
+
use crate::test::{test_match_lang, test_replace_lang};
|
|
4
|
+
|
|
5
|
+
fn test_match(s1: &str, s2: &str) {
|
|
6
|
+
test_match_lang(s1, s2, Hcl)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#[test]
|
|
10
|
+
fn test_hcl_pattern() {
|
|
11
|
+
test_match("$A = $B", r#"foo = "bar""#);
|
|
12
|
+
test_match(
|
|
13
|
+
"resource $TYPE $NAME $BODY",
|
|
14
|
+
r#"resource "aws_instance" "example" { ami = "ami-123" }"#,
|
|
15
|
+
);
|
|
16
|
+
test_match(
|
|
17
|
+
"$BLOCK $BODY",
|
|
18
|
+
r#"terraform { required_providers { aws = { source = "hashicorp/aws" } } }"#,
|
|
19
|
+
);
|
|
20
|
+
test_match(
|
|
21
|
+
"variable $NAME $CONFIG",
|
|
22
|
+
r#"variable "region" { default = "us-west-2" }"#,
|
|
23
|
+
);
|
|
24
|
+
test_match(
|
|
25
|
+
"output $NAME $VALUE",
|
|
26
|
+
r#"output "instance_ip" { value = aws_instance.example.public_ip }"#,
|
|
27
|
+
);
|
|
28
|
+
test_match("$VAR = [$$$ITEMS]", r#"tags = ["production", "web"]"#);
|
|
29
|
+
test_match(
|
|
30
|
+
"$VAR = { $$$PAIRS }",
|
|
31
|
+
r#"labels = { environment = "prod", team = "backend" }"#,
|
|
32
|
+
);
|
|
33
|
+
test_match(r#"$VAR = "$CONTENT""#, r#"name = "instance""#);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fn test_replace(src: &str, pattern: &str, replacer: &str) -> String {
|
|
37
|
+
test_replace_lang(src, pattern, replacer, Hcl)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#[test]
|
|
41
|
+
fn test_hcl_replace() {
|
|
42
|
+
let ret = test_replace(r#"foo = "bar""#, r#"$A = $B"#, r#"$B = $A"#);
|
|
43
|
+
assert_eq!(ret, r#""bar" = foo"#);
|
|
44
|
+
|
|
45
|
+
let ret = test_replace(
|
|
46
|
+
r#"resource "aws_instance" "example" { ami = "ami-123" }"#,
|
|
47
|
+
r#"resource $TYPE $NAME $BODY"#,
|
|
48
|
+
r#"resource $NAME $TYPE $BODY"#,
|
|
49
|
+
);
|
|
50
|
+
assert_eq!(
|
|
51
|
+
ret,
|
|
52
|
+
r#"resource "example" "aws_instance" { ami = "ami-123" }"#
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
let ret = test_replace(
|
|
56
|
+
r#"variable "region" { default = "us-west-2" }"#,
|
|
57
|
+
r#"variable "region" { default = $DEFAULT }"#,
|
|
58
|
+
r#"variable "region" { default = "eu-west-1" }"#,
|
|
59
|
+
);
|
|
60
|
+
assert_eq!(ret, r#"variable "region" { default = "eu-west-1" }"#);
|
|
61
|
+
}
|
|
@@ -276,8 +276,8 @@ impl SupportLang {
|
|
|
276
276
|
pub const fn all_langs() -> &'static [SupportLang] {
|
|
277
277
|
use SupportLang::*;
|
|
278
278
|
&[
|
|
279
|
-
Bash, C, Cpp, CSharp, Css, Elixir, Go, Haskell, Hcl, Html, Java, JavaScript, Json, Kotlin,
|
|
280
|
-
Nix, Php, Python, Ruby, Rust, Scala, Solidity, Swift, Tsx, TypeScript, Yaml,
|
|
279
|
+
Bash, C, Cpp, CSharp, Css, Elixir, Go, Haskell, Hcl, Html, Java, JavaScript, Json, Kotlin,
|
|
280
|
+
Lua, Nix, Php, Python, Ruby, Rust, Scala, Solidity, Swift, Tsx, TypeScript, Yaml,
|
|
281
281
|
]
|
|
282
282
|
}
|
|
283
283
|
|
|
@@ -23,8 +23,8 @@ ast-grep-config.workspace = true
|
|
|
23
23
|
ast-grep-language.workspace = true
|
|
24
24
|
ast-grep-dynamic.workspace = true
|
|
25
25
|
anyhow.workspace = true
|
|
26
|
-
pyo3 = { version = "0.
|
|
27
|
-
pythonize = { version = "0.
|
|
26
|
+
pyo3 = { version = "0.26.0", optional = true, features = ["anyhow", "py-clone"] }
|
|
27
|
+
pythonize = { version = "0.26.0", optional = true }
|
|
28
28
|
serde.workspace = true
|
|
29
29
|
|
|
30
30
|
# uncomment default features when developing pyo3
|
|
@@ -29,7 +29,7 @@ unsafe impl Send for SgNode {}
|
|
|
29
29
|
impl SgNode {
|
|
30
30
|
/*---------- Node Inspection ----------*/
|
|
31
31
|
fn range(&self) -> Range {
|
|
32
|
-
Python::
|
|
32
|
+
Python::attach(|py| {
|
|
33
33
|
let root = self.root.bind(py);
|
|
34
34
|
let root = root.borrow();
|
|
35
35
|
Range::from(&self.inner, &root.position)
|
|
@@ -254,7 +254,7 @@ impl SgNode {
|
|
|
254
254
|
/*---------- Edit ----------*/
|
|
255
255
|
fn replace(&self, text: &str) -> Edit {
|
|
256
256
|
let byte_range = self.inner.range();
|
|
257
|
-
Python::
|
|
257
|
+
Python::attach(|py| {
|
|
258
258
|
let root = self.root.bind(py);
|
|
259
259
|
let root = root.borrow();
|
|
260
260
|
let start_pos = root.position.byte_to_char(byte_range.start);
|
|
@@ -271,7 +271,7 @@ impl SgNode {
|
|
|
271
271
|
edits.sort_by_key(|edit| edit.start_pos);
|
|
272
272
|
let mut new_content = String::new();
|
|
273
273
|
let old_content = self.text();
|
|
274
|
-
let converted: Vec<_> = Python::
|
|
274
|
+
let converted: Vec<_> = Python::attach(move |py| {
|
|
275
275
|
let root = self.root.bind(py);
|
|
276
276
|
let root = root.borrow();
|
|
277
277
|
let conv = &root.position;
|
|
@@ -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.
|
|
8
|
+
version = "0.39.5"
|
|
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" }]
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#![cfg(test)]
|
|
2
|
-
use super::*;
|
|
3
|
-
use crate::test::{test_match_lang,test_replace_lang};
|
|
4
|
-
|
|
5
|
-
fn test_match(s1: &str, s2: &str) {
|
|
6
|
-
test_match_lang(s1, s2, Hcl)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
#[test]
|
|
10
|
-
fn test_hcl_pattern() {
|
|
11
|
-
test_match("$A = $B", "foo = \"bar\"");
|
|
12
|
-
test_match("resource $TYPE $NAME $BODY", "resource \"aws_instance\" \"example\" { ami = \"ami-123\" }");
|
|
13
|
-
test_match("$BLOCK $BODY", "terraform { required_providers { aws = { source = \"hashicorp/aws\" } } }");
|
|
14
|
-
test_match("variable $NAME $CONFIG", "variable \"region\" { default = \"us-west-2\" }");
|
|
15
|
-
test_match("output $NAME $VALUE", "output \"instance_ip\" { value = aws_instance.example.public_ip }");
|
|
16
|
-
test_match("$VAR = [$$$ITEMS]", "tags = [\"production\", \"web\"]");
|
|
17
|
-
test_match("$VAR = { $$$PAIRS }", "labels = { environment = \"prod\", team = \"backend\" }");
|
|
18
|
-
test_match("$VAR = \"$CONTENT\"", "name = \"instance\"");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
fn test_replace(src: &str, pattern: &str, replacer: &str) -> String {
|
|
22
|
-
test_replace_lang(src, pattern, replacer, Hcl)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
#[test]
|
|
26
|
-
fn test_hcl_replace() {
|
|
27
|
-
let ret = test_replace(
|
|
28
|
-
"foo = \"bar\"",
|
|
29
|
-
"$A = $B",
|
|
30
|
-
"$B = $A"
|
|
31
|
-
);
|
|
32
|
-
assert_eq!(ret, "\"bar\" = foo");
|
|
33
|
-
|
|
34
|
-
let ret = test_replace(
|
|
35
|
-
"resource \"aws_instance\" \"example\" { ami = \"ami-123\" }",
|
|
36
|
-
"resource $TYPE $NAME $BODY",
|
|
37
|
-
"resource $NAME $TYPE $BODY",
|
|
38
|
-
);
|
|
39
|
-
assert_eq!(ret, "resource \"example\" \"aws_instance\" { ami = \"ami-123\" }");
|
|
40
|
-
|
|
41
|
-
let ret = test_replace(
|
|
42
|
-
"variable \"region\" { default = \"us-west-2\" }",
|
|
43
|
-
"variable \"region\" { default = $DEFAULT }",
|
|
44
|
-
"variable \"region\" { default = \"eu-west-1\" }",
|
|
45
|
-
);
|
|
46
|
-
assert_eq!(ret, "variable \"region\" { default = \"eu-west-1\" }");
|
|
47
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|