ast-grep-cli 0.22.0__tar.gz → 0.22.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.
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/Cargo.lock +24 -13
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/Cargo.toml +7 -7
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/PKG-INFO +1 -1
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/verify/reporter.rs +1 -1
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/Cargo.toml +3 -1
- ast_grep_cli-0.22.2/crates/language/src/haskell.rs +68 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/lib.rs +11 -2
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/parsers.rs +4 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/pyproject.toml +1 -1
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/LICENSE +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/README.md +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/Cargo.toml +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/bin/ast-grep.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/completions.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/config.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/error.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/lang/custom_lang.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/lang/lang_globs.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/lang.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/lib.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/lsp.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/main.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/new.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/print/cloud_print.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/print/colored_print/test.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/print/colored_print.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/print/interactive_print.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/print/json_print.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/print/mod.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/run.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/scan.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/utils.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/verify/case_result.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/verify/find_file.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/verify/mod.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/verify/snapshot.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/src/verify/test_case.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/tests/common/mod.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/tests/run_test.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/tests/scan_test.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/cli/tests/verify_test.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/Cargo.toml +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/check_var.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/combined.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/fixer.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/lib.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/maybe.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule/deserialize_env.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule/mod.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule/referent_rule.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule/relational_rule.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule/stop_by.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule_collection.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule_config.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/rule_core.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/transform/mod.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/transform/rewrite.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/transform/string_case.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/config/src/transform/transformation.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/Cargo.toml +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/language.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/lib.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/match_tree.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/matcher/kind.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/matcher/node_match.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/matcher/pattern.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/matcher/text.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/matcher.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/meta_var.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/node.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/ops.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/pinned.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/replacer/indent.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/replacer/structural.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/replacer/template.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/replacer.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/source.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/core/src/traversal.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/dynamic/Cargo.toml +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/dynamic/src/lib.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/bash.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/cpp.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/csharp.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/css.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/elixir.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/go.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/html.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/json.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/kotlin.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/lua.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/php.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/python.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/ruby.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/rust.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/scala.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/language/src/swift.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/lsp/Cargo.toml +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/lsp/src/lib.rs +0 -0
- {ast_grep_cli-0.22.0 → ast_grep_cli-0.22.2}/crates/lsp/tests/basic.rs +0 -0
|
@@ -113,7 +113,7 @@ dependencies = [
|
|
|
113
113
|
|
|
114
114
|
[[package]]
|
|
115
115
|
name = "ast-grep"
|
|
116
|
-
version = "0.22.
|
|
116
|
+
version = "0.22.2"
|
|
117
117
|
dependencies = [
|
|
118
118
|
"ansi_term",
|
|
119
119
|
"anyhow",
|
|
@@ -144,7 +144,7 @@ dependencies = [
|
|
|
144
144
|
|
|
145
145
|
[[package]]
|
|
146
146
|
name = "ast-grep-config"
|
|
147
|
-
version = "0.22.
|
|
147
|
+
version = "0.22.2"
|
|
148
148
|
dependencies = [
|
|
149
149
|
"anyhow",
|
|
150
150
|
"ast-grep-core",
|
|
@@ -160,7 +160,7 @@ dependencies = [
|
|
|
160
160
|
|
|
161
161
|
[[package]]
|
|
162
162
|
name = "ast-grep-core"
|
|
163
|
-
version = "0.22.
|
|
163
|
+
version = "0.22.2"
|
|
164
164
|
dependencies = [
|
|
165
165
|
"bit-set",
|
|
166
166
|
"regex",
|
|
@@ -171,7 +171,7 @@ dependencies = [
|
|
|
171
171
|
|
|
172
172
|
[[package]]
|
|
173
173
|
name = "ast-grep-dynamic"
|
|
174
|
-
version = "0.22.
|
|
174
|
+
version = "0.22.2"
|
|
175
175
|
dependencies = [
|
|
176
176
|
"ast-grep-core",
|
|
177
177
|
"ignore",
|
|
@@ -183,7 +183,7 @@ dependencies = [
|
|
|
183
183
|
|
|
184
184
|
[[package]]
|
|
185
185
|
name = "ast-grep-language"
|
|
186
|
-
version = "0.22.
|
|
186
|
+
version = "0.22.2"
|
|
187
187
|
dependencies = [
|
|
188
188
|
"ast-grep-core",
|
|
189
189
|
"ignore",
|
|
@@ -196,6 +196,7 @@ dependencies = [
|
|
|
196
196
|
"tree-sitter-dart",
|
|
197
197
|
"tree-sitter-elixir",
|
|
198
198
|
"tree-sitter-go",
|
|
199
|
+
"tree-sitter-haskell",
|
|
199
200
|
"tree-sitter-html",
|
|
200
201
|
"tree-sitter-java",
|
|
201
202
|
"tree-sitter-javascript-sg",
|
|
@@ -213,7 +214,7 @@ dependencies = [
|
|
|
213
214
|
|
|
214
215
|
[[package]]
|
|
215
216
|
name = "ast-grep-lsp"
|
|
216
|
-
version = "0.22.
|
|
217
|
+
version = "0.22.2"
|
|
217
218
|
dependencies = [
|
|
218
219
|
"ast-grep-config",
|
|
219
220
|
"ast-grep-core",
|
|
@@ -227,7 +228,7 @@ dependencies = [
|
|
|
227
228
|
|
|
228
229
|
[[package]]
|
|
229
230
|
name = "ast-grep-napi"
|
|
230
|
-
version = "0.22.
|
|
231
|
+
version = "0.22.2"
|
|
231
232
|
dependencies = [
|
|
232
233
|
"ast-grep-config",
|
|
233
234
|
"ast-grep-core",
|
|
@@ -245,7 +246,7 @@ dependencies = [
|
|
|
245
246
|
|
|
246
247
|
[[package]]
|
|
247
248
|
name = "ast-grep-py"
|
|
248
|
-
version = "0.22.
|
|
249
|
+
version = "0.22.2"
|
|
249
250
|
dependencies = [
|
|
250
251
|
"anyhow",
|
|
251
252
|
"ast-grep-config",
|
|
@@ -311,7 +312,7 @@ dependencies = [
|
|
|
311
312
|
|
|
312
313
|
[[package]]
|
|
313
314
|
name = "benches"
|
|
314
|
-
version = "0.22.
|
|
315
|
+
version = "0.22.2"
|
|
315
316
|
dependencies = [
|
|
316
317
|
"ast-grep-config",
|
|
317
318
|
"ast-grep-core",
|
|
@@ -1877,9 +1878,9 @@ dependencies = [
|
|
|
1877
1878
|
|
|
1878
1879
|
[[package]]
|
|
1879
1880
|
name = "tree-sitter-c"
|
|
1880
|
-
version = "0.21.
|
|
1881
|
+
version = "0.21.1"
|
|
1881
1882
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1882
|
-
checksum = "
|
|
1883
|
+
checksum = "b4f0e5c383fd633a792eb8878367dc9d4a3c0e788bad5dcc84c200332ed1b8f2"
|
|
1883
1884
|
dependencies = [
|
|
1884
1885
|
"cc",
|
|
1885
1886
|
"tree-sitter",
|
|
@@ -1937,9 +1938,9 @@ dependencies = [
|
|
|
1937
1938
|
|
|
1938
1939
|
[[package]]
|
|
1939
1940
|
name = "tree-sitter-facade-sg"
|
|
1940
|
-
version = "0.21.
|
|
1941
|
+
version = "0.21.4"
|
|
1941
1942
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1942
|
-
checksum = "
|
|
1943
|
+
checksum = "e7ca50a891218430da4837d9f411b365b83ce6a22c28f8d99933bcc5bc18cd0c"
|
|
1943
1944
|
dependencies = [
|
|
1944
1945
|
"js-sys",
|
|
1945
1946
|
"tree-sitter",
|
|
@@ -1958,6 +1959,16 @@ dependencies = [
|
|
|
1958
1959
|
"tree-sitter",
|
|
1959
1960
|
]
|
|
1960
1961
|
|
|
1962
|
+
[[package]]
|
|
1963
|
+
name = "tree-sitter-haskell"
|
|
1964
|
+
version = "0.21.0"
|
|
1965
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1966
|
+
checksum = "ef25a7e6c73cc1cbe0c0b7dbd5406e7b3485b370bd61c5d8d852ae0781f9bf9a"
|
|
1967
|
+
dependencies = [
|
|
1968
|
+
"cc",
|
|
1969
|
+
"tree-sitter",
|
|
1970
|
+
]
|
|
1971
|
+
|
|
1961
1972
|
[[package]]
|
|
1962
1973
|
name = "tree-sitter-html"
|
|
1963
1974
|
version = "0.20.3"
|
|
@@ -7,7 +7,7 @@ resolver = "2"
|
|
|
7
7
|
lto = true
|
|
8
8
|
|
|
9
9
|
[workspace.package]
|
|
10
|
-
version = "0.22.
|
|
10
|
+
version = "0.22.2"
|
|
11
11
|
authors = ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"]
|
|
12
12
|
edition = "2021"
|
|
13
13
|
license = "MIT"
|
|
@@ -18,17 +18,17 @@ rust-version = "1.67"
|
|
|
18
18
|
readme = "README.md"
|
|
19
19
|
|
|
20
20
|
[workspace.dependencies]
|
|
21
|
-
ast-grep-core = { path = "crates/core", version = "0.22.
|
|
22
|
-
ast-grep-config = { path = "crates/config", version = "0.22.
|
|
23
|
-
ast-grep-dynamic = { path = "crates/dynamic", version = "0.22.
|
|
24
|
-
ast-grep-language = { path = "crates/language", version = "0.22.
|
|
25
|
-
ast-grep-lsp = { path = "crates/lsp", version = "0.22.
|
|
21
|
+
ast-grep-core = { path = "crates/core", version = "0.22.2" }
|
|
22
|
+
ast-grep-config = { path = "crates/config", version = "0.22.2" }
|
|
23
|
+
ast-grep-dynamic = { path = "crates/dynamic", version = "0.22.2" }
|
|
24
|
+
ast-grep-language = { path = "crates/language", version = "0.22.2" }
|
|
25
|
+
ast-grep-lsp = { path = "crates/lsp", version = "0.22.2" }
|
|
26
26
|
|
|
27
27
|
bit-set = { version = "0.5.3" }
|
|
28
28
|
ignore = { version = "0.4.22" }
|
|
29
29
|
regex = { version = "1.10.4" }
|
|
30
30
|
serde = { version = "1.0.200", features = ["derive"] }
|
|
31
|
-
tree-sitter = { version = "0.21.
|
|
31
|
+
tree-sitter = { version = "0.21.4", package = "tree-sitter-facade-sg" }
|
|
32
32
|
thiserror = "1.0.59"
|
|
33
33
|
schemars = "0.8.17"
|
|
34
34
|
anyhow = "1.0.82"
|
|
@@ -165,7 +165,7 @@ fn report_case_detail_impl<W: Write>(
|
|
|
165
165
|
CaseStatus::Updated { source, .. } => {
|
|
166
166
|
writeln!(
|
|
167
167
|
output,
|
|
168
|
-
"[{update}] Rule {case_id}'s snapshot
|
|
168
|
+
"[{update}] Rule {case_id}'s snapshot baseline has been updated."
|
|
169
169
|
)?;
|
|
170
170
|
writeln!(output)?;
|
|
171
171
|
indented_write(output, source)?;
|
|
@@ -24,6 +24,7 @@ tree-sitter-css = { version = "0.21.0", optional = true }
|
|
|
24
24
|
tree-sitter-dart= { version = "0.0.4", optional = true }
|
|
25
25
|
tree-sitter-elixir = { version = "0.2.0", optional = true }
|
|
26
26
|
tree-sitter-go = { version = "0.21.0", optional = true }
|
|
27
|
+
tree-sitter-haskell = { version = "0.21.0", optional = true }
|
|
27
28
|
tree-sitter-html = { version = "0.20.3", optional = true }
|
|
28
29
|
tree-sitter-java = { version = "0.21.0", optional = true }
|
|
29
30
|
# https://github.com/tree-sitter/tree-sitter-javascript/issues/316
|
|
@@ -50,6 +51,7 @@ builtin-parser = [
|
|
|
50
51
|
"tree-sitter-dart",
|
|
51
52
|
"tree-sitter-elixir",
|
|
52
53
|
"tree-sitter-go",
|
|
54
|
+
"tree-sitter-haskell",
|
|
53
55
|
"tree-sitter-html",
|
|
54
56
|
"tree-sitter-java",
|
|
55
57
|
"tree-sitter-javascript",
|
|
@@ -64,4 +66,4 @@ builtin-parser = [
|
|
|
64
66
|
"tree-sitter-swift",
|
|
65
67
|
"tree-sitter-typescript",
|
|
66
68
|
]
|
|
67
|
-
default = ["builtin-parser"]
|
|
69
|
+
default = ["builtin-parser"]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#![cfg(test)]
|
|
2
|
+
use ast_grep_core::source::TSParseError;
|
|
3
|
+
|
|
4
|
+
use super::*;
|
|
5
|
+
|
|
6
|
+
fn test_match(query: &str, source: &str) {
|
|
7
|
+
use crate::test::test_match_lang;
|
|
8
|
+
test_match_lang(query, source, Haskell);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
fn test_non_match(query: &str, source: &str) {
|
|
12
|
+
use crate::test::test_non_match_lang;
|
|
13
|
+
test_non_match_lang(query, source, Haskell);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[test]
|
|
17
|
+
fn test_haskell_str() {
|
|
18
|
+
test_match("return $A", "return 3");
|
|
19
|
+
test_match(r#""abc""#, r#""abc""#);
|
|
20
|
+
test_match("$A $B", "f x");
|
|
21
|
+
test_match("$A ($B $C)", "f (x y)");
|
|
22
|
+
test_match("let $A = $B in $A + $A", "let x = 3 in x + x");
|
|
23
|
+
test_non_match("$A $B", "f");
|
|
24
|
+
test_non_match("$A + $A", "3 + 4");
|
|
25
|
+
test_non_match("$A ($B $C)", "f x y");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fn test_replace(src: &str, pattern: &str, replacer: &str) -> Result<String, TSParseError> {
|
|
29
|
+
use crate::test::test_replace_lang;
|
|
30
|
+
test_replace_lang(src, pattern, replacer, Haskell)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#[test]
|
|
34
|
+
fn test_haskell_replace() -> Result<(), TSParseError> {
|
|
35
|
+
let ret = test_replace(
|
|
36
|
+
r#"
|
|
37
|
+
fibonacci :: [Int]
|
|
38
|
+
fibonacci =
|
|
39
|
+
1 : 1 : zipWith (+) fibonacci (tail fibonacci)
|
|
40
|
+
"#,
|
|
41
|
+
r#"$F = $$$BODY"#,
|
|
42
|
+
r#"$F = undefined"#,
|
|
43
|
+
)?;
|
|
44
|
+
assert_eq!(
|
|
45
|
+
ret,
|
|
46
|
+
r#"
|
|
47
|
+
fibonacci :: [Int]
|
|
48
|
+
fibonacci = undefined
|
|
49
|
+
"#
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
let ret = test_replace(
|
|
53
|
+
r#"
|
|
54
|
+
flip :: (a -> b -> c) -> b -> a -> c
|
|
55
|
+
flip f x y = f y x
|
|
56
|
+
"#,
|
|
57
|
+
r#"$F :: $A -> $B"#,
|
|
58
|
+
r#"$F :: ($B) -> $A"#,
|
|
59
|
+
)?;
|
|
60
|
+
assert_eq!(
|
|
61
|
+
ret,
|
|
62
|
+
r#"
|
|
63
|
+
flip :: (b -> a -> c) -> (a -> b -> c)
|
|
64
|
+
flip f x y = f y x
|
|
65
|
+
"#
|
|
66
|
+
);
|
|
67
|
+
Ok(())
|
|
68
|
+
}
|
|
@@ -13,6 +13,7 @@ mod csharp;
|
|
|
13
13
|
mod css;
|
|
14
14
|
mod elixir;
|
|
15
15
|
mod go;
|
|
16
|
+
mod haskell;
|
|
16
17
|
mod html;
|
|
17
18
|
mod json;
|
|
18
19
|
mod kotlin;
|
|
@@ -109,6 +110,10 @@ impl_lang_expando!(Elixir, language_elixir, 'µ');
|
|
|
109
110
|
// we can use any Unicode code point categorized as "Letter"
|
|
110
111
|
// https://go.dev/ref/spec#letter
|
|
111
112
|
impl_lang_expando!(Go, language_go, 'µ');
|
|
113
|
+
// GHC supports Unicode syntax per
|
|
114
|
+
// https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/unicode_syntax.html
|
|
115
|
+
// and the tree-sitter-haskell grammar parses it too.
|
|
116
|
+
impl_lang_expando!(Haskell, language_haskell, 'µ');
|
|
112
117
|
// tree-sitter-html uses locale dependent iswalnum for tagName
|
|
113
118
|
// https://github.com/tree-sitter/tree-sitter-html/blob/b5d9758e22b4d3d25704b72526670759a9e4d195/src/scanner.c#L194
|
|
114
119
|
impl_lang_expando!(Html, language_html, 'z');
|
|
@@ -152,6 +157,7 @@ pub enum SupportLang {
|
|
|
152
157
|
Dart,
|
|
153
158
|
Go,
|
|
154
159
|
Elixir,
|
|
160
|
+
Haskell,
|
|
155
161
|
Html,
|
|
156
162
|
Java,
|
|
157
163
|
JavaScript,
|
|
@@ -172,8 +178,8 @@ impl SupportLang {
|
|
|
172
178
|
pub const fn all_langs() -> &'static [SupportLang] {
|
|
173
179
|
use SupportLang::*;
|
|
174
180
|
&[
|
|
175
|
-
Bash, C, Cpp, CSharp, Css, Dart, Elixir, Go, Html, Java, JavaScript, Json, Kotlin,
|
|
176
|
-
Python, Ruby, Rust, Scala, Swift, Tsx, TypeScript,
|
|
181
|
+
Bash, C, Cpp, CSharp, Css, Dart, Elixir, Go, Haskell, Html, Java, JavaScript, Json, Kotlin,
|
|
182
|
+
Lua, Php, Python, Ruby, Rust, Scala, Swift, Tsx, TypeScript,
|
|
177
183
|
]
|
|
178
184
|
}
|
|
179
185
|
|
|
@@ -225,6 +231,7 @@ const fn alias(lang: &SupportLang) -> &[&str] {
|
|
|
225
231
|
Dart => &["dart"],
|
|
226
232
|
Elixir => &["ex", "elixir"],
|
|
227
233
|
Go => &["go", "golang"],
|
|
234
|
+
Haskell => &["hs", "haskell"],
|
|
228
235
|
Html => &["html"],
|
|
229
236
|
Java => &["java"],
|
|
230
237
|
JavaScript => &["javascript", "js", "jsx"],
|
|
@@ -269,6 +276,7 @@ macro_rules! execute_lang_method {
|
|
|
269
276
|
S::Dart => Dart.$method($($pname,)*),
|
|
270
277
|
S::Elixir => Elixir.$method($($pname,)*),
|
|
271
278
|
S::Go => Go.$method($($pname,)*),
|
|
279
|
+
S::Haskell => Haskell.$method($($pname,)*),
|
|
272
280
|
S::Html => Html.$method($($pname,)*),
|
|
273
281
|
S::Java => Java.$method($($pname,)*),
|
|
274
282
|
S::JavaScript => JavaScript.$method($($pname,)*),
|
|
@@ -324,6 +332,7 @@ fn extensions(lang: &SupportLang) -> &[&str] {
|
|
|
324
332
|
Dart => &["dart"],
|
|
325
333
|
Elixir => &["ex", "exs"],
|
|
326
334
|
Go => &["go"],
|
|
335
|
+
Haskell => &["hs"],
|
|
327
336
|
Html => &["html", "htm", "xhtml"],
|
|
328
337
|
Java => &["java"],
|
|
329
338
|
JavaScript => &["cjs", "js", "mjs", "jsx"],
|
|
@@ -32,6 +32,9 @@ mod parser_implementation {
|
|
|
32
32
|
pub fn language_go() -> TSLanguage {
|
|
33
33
|
tree_sitter_go::language().into()
|
|
34
34
|
}
|
|
35
|
+
pub fn language_haskell() -> TSLanguage {
|
|
36
|
+
tree_sitter_haskell::language().into()
|
|
37
|
+
}
|
|
35
38
|
pub fn language_html() -> TSLanguage {
|
|
36
39
|
tree_sitter_html::language().into()
|
|
37
40
|
}
|
|
@@ -104,6 +107,7 @@ mod parser_implementation {
|
|
|
104
107
|
language_dart,
|
|
105
108
|
language_elixir,
|
|
106
109
|
language_go,
|
|
110
|
+
language_haskell,
|
|
107
111
|
language_html,
|
|
108
112
|
language_java,
|
|
109
113
|
language_javascript,
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ast-grep-cli"
|
|
7
|
-
version = "0.22.
|
|
7
|
+
version = "0.22.2"
|
|
8
8
|
description = "Structural Search and Rewrite code at large scale using precise AST pattern."
|
|
9
9
|
authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
|
|
10
10
|
maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
|
|
File without changes
|
|
File without changes
|
|
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
|
|
File without changes
|
|
File without changes
|