polyglot-piranha 0.4.1__tar.gz → 0.4.3__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.
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/Cargo.lock +206 -13
- polyglot_piranha-0.4.3/Cargo.toml +17 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/PKG-INFO +1 -1
- polyglot_piranha-0.4.3/crates/concrete-syntax/Cargo.toml +46 -0
- polyglot_piranha-0.4.3/crates/concrete-syntax/README.md +36 -0
- {polyglot_piranha-0.4.1/src/models/concrete_syntax → polyglot_piranha-0.4.3/crates/concrete-syntax/src}/concrete_syntax.pest +4 -3
- polyglot_piranha-0.4.3/crates/concrete-syntax/src/lib.rs +259 -0
- polyglot_piranha-0.4.3/crates/concrete-syntax/src/mod.rs +22 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/constraint_checker.rs +4 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/cursor_utils.rs +7 -4
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/interpreter.rs +72 -42
- polyglot_piranha-0.4.3/crates/concrete-syntax/src/models/concrete_syntax/mod.rs +23 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/parser.rs +46 -18
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/resolver.rs +23 -14
- polyglot_piranha-0.4.3/crates/concrete-syntax/src/models/concrete_syntax/tree_sitter_adapter.rs +322 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/types.rs +3 -7
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/unit_tests/interpreter_test.rs +177 -23
- {polyglot_piranha-0.4.1/src/models/concrete_syntax → polyglot_piranha-0.4.3/crates/concrete-syntax/src/models/concrete_syntax/unit_tests}/mod.rs +2 -6
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/unit_tests/parser_test.rs +19 -2
- polyglot_piranha-0.4.3/crates/concrete-syntax/src/models/matches.rs +143 -0
- polyglot_piranha-0.4.3/crates/concrete-syntax/src/models/mod.rs +15 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/Cargo.toml +13 -11
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/capture_group_patterns.rs +16 -6
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/matches.rs +44 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/mod.rs +0 -2
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/rule.rs +56 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/rule_graph.rs +9 -1
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/rule_store.rs +3 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/scopes.rs +20 -1
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/source_code_unit.rs +34 -4
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/piranha_arguments_test.rs +2 -2
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/mod.rs +17 -13
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_go.rs +9 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_python.rs +9 -10
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/pyproject.toml +2 -4
- polyglot_piranha-0.4.1/plugins/pyproject.toml +0 -22
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/LICENSE +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/NOTICE +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/README.md +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/unit_tests/constraint_checker_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/concrete-syntax}/src/models/concrete_syntax/unit_tests/resolver_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/go/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/go/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/go/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/java/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/java/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/java/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/java_cs/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/java_cs/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/java_cs/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/kt/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/kt/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/kt/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/ruby/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/ruby/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/ruby/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/scala/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/swift/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/swift/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/cleanup_rules/swift/scope_config.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/df/README.md +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/df/analysis.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/df/mod.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/df/tag_analysis.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/df/unit_tests/tag_analysis_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/df/utils.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/lib.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/main.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/default_configs.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/edit.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/filter.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/language.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/outgoing_edges.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/piranha_arguments.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/piranha_output.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/rule_graph_validation_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/rule_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/scopes_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/source_code_unit_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/testdata/custom_builtin/edges.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/models/unit_tests/testdata/custom_builtin/rules.toml +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_java.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_kt.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_scala.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_scm.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_strings.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_swift.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_thrift.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_ts.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_tsx.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/tests/test_piranha_yaml.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/utilities/mod.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/utilities/regex_utilities.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/utilities/tree_sitter_utilities.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/utilities/unit_tests/tree_sitter_utilities_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3/crates/core}/src/utilities/unit_tests/utilities_test.rs +0 -0
- {polyglot_piranha-0.4.1 → polyglot_piranha-0.4.3}/polyglot_piranha.pyi +0 -0
@@ -115,6 +115,12 @@ dependencies = [
|
|
115
115
|
"serde",
|
116
116
|
]
|
117
117
|
|
118
|
+
[[package]]
|
119
|
+
name = "bumpalo"
|
120
|
+
version = "3.19.0"
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
122
|
+
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
123
|
+
|
118
124
|
[[package]]
|
119
125
|
name = "cc"
|
120
126
|
version = "1.0.106"
|
@@ -135,9 +141,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|
135
141
|
|
136
142
|
[[package]]
|
137
143
|
name = "clap"
|
138
|
-
version = "4.5.
|
144
|
+
version = "4.5.41"
|
139
145
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
140
|
-
checksum = "
|
146
|
+
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
|
141
147
|
dependencies = [
|
142
148
|
"clap_builder",
|
143
149
|
"clap_derive",
|
@@ -145,9 +151,9 @@ dependencies = [
|
|
145
151
|
|
146
152
|
[[package]]
|
147
153
|
name = "clap_builder"
|
148
|
-
version = "4.5.
|
154
|
+
version = "4.5.41"
|
149
155
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
150
|
-
checksum = "
|
156
|
+
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
|
151
157
|
dependencies = [
|
152
158
|
"anstream",
|
153
159
|
"anstyle",
|
@@ -157,9 +163,9 @@ dependencies = [
|
|
157
163
|
|
158
164
|
[[package]]
|
159
165
|
name = "clap_derive"
|
160
|
-
version = "4.5.
|
166
|
+
version = "4.5.41"
|
161
167
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
162
|
-
checksum = "
|
168
|
+
checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491"
|
163
169
|
dependencies = [
|
164
170
|
"heck 0.5.0",
|
165
171
|
"proc-macro2",
|
@@ -189,6 +195,31 @@ dependencies = [
|
|
189
195
|
"windows-sys",
|
190
196
|
]
|
191
197
|
|
198
|
+
[[package]]
|
199
|
+
name = "concrete_syntax"
|
200
|
+
version = "0.4.3"
|
201
|
+
dependencies = [
|
202
|
+
"js-sys",
|
203
|
+
"pest",
|
204
|
+
"pest_derive",
|
205
|
+
"regex",
|
206
|
+
"serde",
|
207
|
+
"serde-wasm-bindgen",
|
208
|
+
"serde_json",
|
209
|
+
"tree-sitter",
|
210
|
+
"tree-sitter-go",
|
211
|
+
"tree-sitter-java",
|
212
|
+
"tree-sitter-kotlin",
|
213
|
+
"tree-sitter-python",
|
214
|
+
"tree-sitter-ruby",
|
215
|
+
"tree-sitter-swift",
|
216
|
+
"tree-sitter-traversal",
|
217
|
+
"tree-sitter-typescript",
|
218
|
+
"wasm-bindgen",
|
219
|
+
"wasm-bindgen-test",
|
220
|
+
"web-sys",
|
221
|
+
]
|
222
|
+
|
192
223
|
[[package]]
|
193
224
|
name = "cpufeatures"
|
194
225
|
version = "0.2.17"
|
@@ -520,6 +551,16 @@ version = "1.0.15"
|
|
520
551
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
521
552
|
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
522
553
|
|
554
|
+
[[package]]
|
555
|
+
name = "js-sys"
|
556
|
+
version = "0.3.77"
|
557
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
558
|
+
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
|
559
|
+
dependencies = [
|
560
|
+
"once_cell",
|
561
|
+
"wasm-bindgen",
|
562
|
+
]
|
563
|
+
|
523
564
|
[[package]]
|
524
565
|
name = "json"
|
525
566
|
version = "0.12.4"
|
@@ -579,6 +620,16 @@ dependencies = [
|
|
579
620
|
"autocfg",
|
580
621
|
]
|
581
622
|
|
623
|
+
[[package]]
|
624
|
+
name = "minicov"
|
625
|
+
version = "0.3.7"
|
626
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
627
|
+
checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b"
|
628
|
+
dependencies = [
|
629
|
+
"cc",
|
630
|
+
"walkdir",
|
631
|
+
]
|
632
|
+
|
582
633
|
[[package]]
|
583
634
|
name = "nix"
|
584
635
|
version = "0.30.1"
|
@@ -687,12 +738,13 @@ dependencies = [
|
|
687
738
|
|
688
739
|
[[package]]
|
689
740
|
name = "piranha"
|
690
|
-
version = "0.4.
|
741
|
+
version = "0.4.3"
|
691
742
|
dependencies = [
|
692
743
|
"assert_cmd",
|
693
744
|
"cc",
|
694
745
|
"clap",
|
695
746
|
"colored",
|
747
|
+
"concrete_syntax",
|
696
748
|
"ctrlc",
|
697
749
|
"derive_builder",
|
698
750
|
"env_logger",
|
@@ -939,9 +991,9 @@ dependencies = [
|
|
939
991
|
|
940
992
|
[[package]]
|
941
993
|
name = "redox_syscall"
|
942
|
-
version = "0.5.
|
994
|
+
version = "0.5.14"
|
943
995
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
944
|
-
checksum = "
|
996
|
+
checksum = "de3a5d9f0aba1dbcec1cc47f0ff94a4b778fe55bca98a6dfa92e4e094e57b1c4"
|
945
997
|
dependencies = [
|
946
998
|
"bitflags",
|
947
999
|
]
|
@@ -984,12 +1036,27 @@ dependencies = [
|
|
984
1036
|
"winapi",
|
985
1037
|
]
|
986
1038
|
|
1039
|
+
[[package]]
|
1040
|
+
name = "rustversion"
|
1041
|
+
version = "1.0.21"
|
1042
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1043
|
+
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
1044
|
+
|
987
1045
|
[[package]]
|
988
1046
|
name = "ryu"
|
989
1047
|
version = "1.0.20"
|
990
1048
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
991
1049
|
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
992
1050
|
|
1051
|
+
[[package]]
|
1052
|
+
name = "same-file"
|
1053
|
+
version = "1.0.6"
|
1054
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1055
|
+
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
1056
|
+
dependencies = [
|
1057
|
+
"winapi-util",
|
1058
|
+
]
|
1059
|
+
|
993
1060
|
[[package]]
|
994
1061
|
name = "scopeguard"
|
995
1062
|
version = "1.2.0"
|
@@ -1005,6 +1072,17 @@ dependencies = [
|
|
1005
1072
|
"serde_derive",
|
1006
1073
|
]
|
1007
1074
|
|
1075
|
+
[[package]]
|
1076
|
+
name = "serde-wasm-bindgen"
|
1077
|
+
version = "0.6.5"
|
1078
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1079
|
+
checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b"
|
1080
|
+
dependencies = [
|
1081
|
+
"js-sys",
|
1082
|
+
"serde",
|
1083
|
+
"wasm-bindgen",
|
1084
|
+
]
|
1085
|
+
|
1008
1086
|
[[package]]
|
1009
1087
|
name = "serde_derive"
|
1010
1088
|
version = "1.0.219"
|
@@ -1018,9 +1096,9 @@ dependencies = [
|
|
1018
1096
|
|
1019
1097
|
[[package]]
|
1020
1098
|
name = "serde_json"
|
1021
|
-
version = "1.0.
|
1099
|
+
version = "1.0.141"
|
1022
1100
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1023
|
-
checksum = "
|
1101
|
+
checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3"
|
1024
1102
|
dependencies = [
|
1025
1103
|
"itoa",
|
1026
1104
|
"memchr",
|
@@ -1360,6 +1438,121 @@ dependencies = [
|
|
1360
1438
|
"libc",
|
1361
1439
|
]
|
1362
1440
|
|
1441
|
+
[[package]]
|
1442
|
+
name = "walkdir"
|
1443
|
+
version = "2.5.0"
|
1444
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1445
|
+
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
1446
|
+
dependencies = [
|
1447
|
+
"same-file",
|
1448
|
+
"winapi-util",
|
1449
|
+
]
|
1450
|
+
|
1451
|
+
[[package]]
|
1452
|
+
name = "wasm-bindgen"
|
1453
|
+
version = "0.2.100"
|
1454
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1455
|
+
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
1456
|
+
dependencies = [
|
1457
|
+
"cfg-if",
|
1458
|
+
"once_cell",
|
1459
|
+
"rustversion",
|
1460
|
+
"wasm-bindgen-macro",
|
1461
|
+
]
|
1462
|
+
|
1463
|
+
[[package]]
|
1464
|
+
name = "wasm-bindgen-backend"
|
1465
|
+
version = "0.2.100"
|
1466
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1467
|
+
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
|
1468
|
+
dependencies = [
|
1469
|
+
"bumpalo",
|
1470
|
+
"log",
|
1471
|
+
"proc-macro2",
|
1472
|
+
"quote",
|
1473
|
+
"syn 2.0.104",
|
1474
|
+
"wasm-bindgen-shared",
|
1475
|
+
]
|
1476
|
+
|
1477
|
+
[[package]]
|
1478
|
+
name = "wasm-bindgen-futures"
|
1479
|
+
version = "0.4.50"
|
1480
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1481
|
+
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
|
1482
|
+
dependencies = [
|
1483
|
+
"cfg-if",
|
1484
|
+
"js-sys",
|
1485
|
+
"once_cell",
|
1486
|
+
"wasm-bindgen",
|
1487
|
+
"web-sys",
|
1488
|
+
]
|
1489
|
+
|
1490
|
+
[[package]]
|
1491
|
+
name = "wasm-bindgen-macro"
|
1492
|
+
version = "0.2.100"
|
1493
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1494
|
+
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
|
1495
|
+
dependencies = [
|
1496
|
+
"quote",
|
1497
|
+
"wasm-bindgen-macro-support",
|
1498
|
+
]
|
1499
|
+
|
1500
|
+
[[package]]
|
1501
|
+
name = "wasm-bindgen-macro-support"
|
1502
|
+
version = "0.2.100"
|
1503
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1504
|
+
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
1505
|
+
dependencies = [
|
1506
|
+
"proc-macro2",
|
1507
|
+
"quote",
|
1508
|
+
"syn 2.0.104",
|
1509
|
+
"wasm-bindgen-backend",
|
1510
|
+
"wasm-bindgen-shared",
|
1511
|
+
]
|
1512
|
+
|
1513
|
+
[[package]]
|
1514
|
+
name = "wasm-bindgen-shared"
|
1515
|
+
version = "0.2.100"
|
1516
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1517
|
+
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
|
1518
|
+
dependencies = [
|
1519
|
+
"unicode-ident",
|
1520
|
+
]
|
1521
|
+
|
1522
|
+
[[package]]
|
1523
|
+
name = "wasm-bindgen-test"
|
1524
|
+
version = "0.3.50"
|
1525
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1526
|
+
checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3"
|
1527
|
+
dependencies = [
|
1528
|
+
"js-sys",
|
1529
|
+
"minicov",
|
1530
|
+
"wasm-bindgen",
|
1531
|
+
"wasm-bindgen-futures",
|
1532
|
+
"wasm-bindgen-test-macro",
|
1533
|
+
]
|
1534
|
+
|
1535
|
+
[[package]]
|
1536
|
+
name = "wasm-bindgen-test-macro"
|
1537
|
+
version = "0.3.50"
|
1538
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1539
|
+
checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b"
|
1540
|
+
dependencies = [
|
1541
|
+
"proc-macro2",
|
1542
|
+
"quote",
|
1543
|
+
"syn 2.0.104",
|
1544
|
+
]
|
1545
|
+
|
1546
|
+
[[package]]
|
1547
|
+
name = "web-sys"
|
1548
|
+
version = "0.3.77"
|
1549
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1550
|
+
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
|
1551
|
+
dependencies = [
|
1552
|
+
"js-sys",
|
1553
|
+
"wasm-bindgen",
|
1554
|
+
]
|
1555
|
+
|
1363
1556
|
[[package]]
|
1364
1557
|
name = "winapi"
|
1365
1558
|
version = "0.3.9"
|
@@ -1466,9 +1659,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
|
1466
1659
|
|
1467
1660
|
[[package]]
|
1468
1661
|
name = "winnow"
|
1469
|
-
version = "0.7.
|
1662
|
+
version = "0.7.12"
|
1470
1663
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1471
|
-
checksum = "
|
1664
|
+
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
|
1472
1665
|
dependencies = [
|
1473
1666
|
"memchr",
|
1474
1667
|
]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
[workspace]
|
2
|
+
members = ["crates/core"]
|
3
|
+
resolver = "2"
|
4
|
+
|
5
|
+
[workspace.package]
|
6
|
+
version = "0.4.3"
|
7
|
+
edition = "2021"
|
8
|
+
authors = ["Uber Technologies Inc."]
|
9
|
+
license-file = "LICENSE"
|
10
|
+
|
11
|
+
# Workspace-level dependencies that can be inherited by member crates
|
12
|
+
[workspace.dependencies]
|
13
|
+
# Core dependencies
|
14
|
+
serde = "1.0.136"
|
15
|
+
serde_derive = "1.0.136"
|
16
|
+
serde_json = "1.0.82"
|
17
|
+
regex = "1.11.1"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
[package]
|
2
|
+
name = "concrete_syntax"
|
3
|
+
description = "Concrete syntax pattern matching library with Rust and WASM support"
|
4
|
+
license-file = "../../LICENSE"
|
5
|
+
|
6
|
+
version.workspace = true
|
7
|
+
authors.workspace = true
|
8
|
+
edition.workspace = true
|
9
|
+
readme = "README.md"
|
10
|
+
|
11
|
+
[lib]
|
12
|
+
crate-type = ["cdylib", "rlib"]
|
13
|
+
|
14
|
+
[dependencies]
|
15
|
+
# Core dependencies
|
16
|
+
tree-sitter = { version = "0.20.6", optional = true }
|
17
|
+
tree-sitter-traversal = { version = "0.1.2", optional = true }
|
18
|
+
pest = "2.7"
|
19
|
+
pest_derive = "2.7"
|
20
|
+
serde = { workspace = true, features = ["derive"] }
|
21
|
+
serde_json = { workspace = true }
|
22
|
+
|
23
|
+
# WASM dependencies
|
24
|
+
wasm-bindgen = { version = "0.2", optional = true }
|
25
|
+
js-sys = { version = "0.3", optional = true }
|
26
|
+
web-sys = { version = "0.3", features = ["console"], optional = true }
|
27
|
+
serde-wasm-bindgen = { version = "0.6", optional = true }
|
28
|
+
regex = { workspace = true }
|
29
|
+
|
30
|
+
[features]
|
31
|
+
default = ["native"]
|
32
|
+
native = ["tree-sitter", "tree-sitter-traversal"]
|
33
|
+
wasm = ["wasm-bindgen", "js-sys", "web-sys", "serde-wasm-bindgen"]
|
34
|
+
|
35
|
+
|
36
|
+
[dev-dependencies]
|
37
|
+
wasm-bindgen-test = "0.3"
|
38
|
+
tree-sitter-kotlin = { git = "https://github.com/danieltrt/tree-sitter-kotlin", rev = "5e0b07cb2ba628842028313b60b97699cc5e0fee" }
|
39
|
+
tree-sitter-java = "0.20.2"
|
40
|
+
# TODO: Update after: https://github.com/alex-pinkus/tree-sitter-swift/issues/278 resolves
|
41
|
+
tree-sitter-swift = { git = "https://github.com/satyam1749/tree-sitter-swift.git", rev = "08a28993599f1968bc81631a89690503e1db7704" }
|
42
|
+
tree-sitter-python = "0.20.2"
|
43
|
+
tree-sitter-ruby = "0.20.1"
|
44
|
+
tree-sitter-typescript = "0.20.1"
|
45
|
+
# TODO: Update after https://github.com/tree-sitter/tree-sitter-go/pull/103 lands
|
46
|
+
tree-sitter-go = { git = "https://github.com/danieltrt/tree-sitter-go.git", rev = "ea5ceb716012db8813a2c05fab23c3a020988724" }
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Concrete Syntax
|
2
|
+
|
3
|
+
A Rust library for structural pattern matching on code using concrete syntax patterns.
|
4
|
+
|
5
|
+
## Building
|
6
|
+
|
7
|
+
### WebAssembly (WASM)
|
8
|
+
|
9
|
+
To build for web browsers:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
# Build for web target
|
13
|
+
cargo build --target wasm32-unknown-unknown --no-default-features --features wasm
|
14
|
+
wasm-pack build --target web --out-dir pkg-web --no-default-features --features wasm
|
15
|
+
```
|
16
|
+
|
17
|
+
### Native (Piranha)
|
18
|
+
|
19
|
+
To build for native use within Piranha:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
cargo build --release
|
23
|
+
```
|
24
|
+
|
25
|
+
## Tree-Sitter Integration
|
26
|
+
|
27
|
+
The WASM bindings require tree-sitter node wrappers to interface with the Rust code. The wrappers implement:
|
28
|
+
|
29
|
+
- `TreeSitterNodeWrapper` - Implements the `WasmSyntaxNode` interface
|
30
|
+
- `TreeSitterCursorWrapper` - Implements the `WasmSyntaxCursor` interface
|
31
|
+
|
32
|
+
These wrappers bridge tree-sitter's JavaScript API with the Rust WASM module's expected interfaces.
|
33
|
+
|
34
|
+
## Tree-Sitter Playground Integration
|
35
|
+
|
36
|
+
The concrete syntax functionality is integrated into the tree-sitter playground at https://uber.github.io/piranha/tree-sitter-playground/.
|
@@ -7,7 +7,7 @@ element = _{ capture | literal_text }
|
|
7
7
|
|
8
8
|
// Captures: :[name], :[name+], :[name*], @name
|
9
9
|
capture = { (":[" ~ identifier ~ capture_mode? ~ "]") | "@"~identifier } // FIXME: Should remove @ from the grammar, because literals may be parsed incorrectly
|
10
|
-
capture_mode = { "+" | "*" }
|
10
|
+
capture_mode = { "+" | "*" | "?"}
|
11
11
|
identifier = { (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* }
|
12
12
|
|
13
13
|
// Literal text - single word/token without whitespace
|
@@ -17,8 +17,9 @@ WHITESPACE = _{ (" " | "\t" | "\r" | "\n")+ }
|
|
17
17
|
// Where constraints (extensible for future constraint types)
|
18
18
|
constraints = { constraint ~ ("," ~ constraint)* }
|
19
19
|
constraint = { in_constraint | regex_constraint }
|
20
|
-
in_constraint = { capture ~ "in" ~ "[" ~ list_items? ~ "]" }
|
21
|
-
regex_constraint = { capture ~ "matches" ~ regex_pattern }
|
20
|
+
in_constraint = { capture ~ not_keyword? ~ "in" ~ "[" ~ list_items? ~ "]" }
|
21
|
+
regex_constraint = { capture ~ not_keyword? ~ "matches" ~ regex_pattern }
|
22
|
+
not_keyword = { "not" }
|
22
23
|
list_items = { quoted_string ~ ("," ~ quoted_string)* }
|
23
24
|
quoted_string = { "\"" ~ ( "\\\\" | "\\\"" | (!"\"" ~ ANY) )* ~ "\"" }
|
24
25
|
regex_pattern = { "/" ~ regex_content ~ "/" }
|