polyglot-piranha 0.3.35__tar.gz → 0.3.36__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.3.35 → polyglot_piranha-0.3.36}/Cargo.lock +164 -21
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/Cargo.toml +3 -1
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/PKG-INFO +12 -1
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/README.md +9 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/pyproject.toml +7 -1
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/df/utils.rs +2 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/lib.rs +0 -1
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/capture_group_patterns.rs +5 -4
- polyglot_piranha-0.3.36/src/models/concrete_syntax/concrete_syntax.pest +15 -0
- polyglot_piranha-0.3.35/src/models/concrete_syntax.rs → polyglot_piranha-0.3.36/src/models/concrete_syntax/interpreter.rs +123 -64
- polyglot_piranha-0.3.36/src/models/concrete_syntax/mod.rs +15 -0
- polyglot_piranha-0.3.36/src/models/concrete_syntax/parser.rs +112 -0
- polyglot_piranha-0.3.35/src/models/unit_tests/concrete_syntax_test.rs → polyglot_piranha-0.3.36/src/models/concrete_syntax/unit_tests/interpreter_test.rs +27 -3
- polyglot_piranha-0.3.36/src/models/concrete_syntax/unit_tests/test_parser.rs +270 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/mod.rs +2 -1
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/LICENSE +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/NOTICE +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/plugins/pyproject.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/polyglot_piranha.pyi +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/go/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/go/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/go/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/java/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/java/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/java/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/java_cs/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/java_cs/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/java_cs/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/kt/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/kt/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/kt/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/ruby/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/ruby/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/ruby/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/scala/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/swift/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/swift/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/cleanup_rules/swift/scope_config.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/df/README.md +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/df/analysis.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/df/mod.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/df/tag_analysis.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/df/unit_tests/tag_analysis_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/main.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/default_configs.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/edit.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/filter.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/language.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/matches.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/outgoing_edges.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/piranha_arguments.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/piranha_output.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/rule.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/rule_graph.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/rule_store.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/scopes.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/source_code_unit.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/piranha_arguments_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/rule_graph_validation_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/rule_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/scopes_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/source_code_unit_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/testdata/custom_builtin/edges.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/models/unit_tests/testdata/custom_builtin/rules.toml +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/mod.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_go.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_java.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_kt.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_python.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_scala.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_scm.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_strings.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_swift.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_thrift.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_ts.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_tsx.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/tests/test_piranha_yaml.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/utilities/mod.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/utilities/regex_utilities.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/utilities/tree_sitter_utilities.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/utilities/unit_tests/tree_sitter_utilities_test.rs +0 -0
- {polyglot_piranha-0.3.35 → polyglot_piranha-0.3.36}/src/utilities/unit_tests/utilities_test.rs +0 -0
@@ -85,9 +85,9 @@ dependencies = [
|
|
85
85
|
|
86
86
|
[[package]]
|
87
87
|
name = "autocfg"
|
88
|
-
version = "1.
|
88
|
+
version = "1.5.0"
|
89
89
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
90
|
-
checksum = "
|
90
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
91
91
|
|
92
92
|
[[package]]
|
93
93
|
name = "bitflags"
|
@@ -95,6 +95,15 @@ version = "2.9.1"
|
|
95
95
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
96
96
|
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
97
97
|
|
98
|
+
[[package]]
|
99
|
+
name = "block-buffer"
|
100
|
+
version = "0.10.4"
|
101
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
102
|
+
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
103
|
+
dependencies = [
|
104
|
+
"generic-array",
|
105
|
+
]
|
106
|
+
|
98
107
|
[[package]]
|
99
108
|
name = "bstr"
|
100
109
|
version = "1.12.0"
|
@@ -155,7 +164,7 @@ dependencies = [
|
|
155
164
|
"heck 0.5.0",
|
156
165
|
"proc-macro2",
|
157
166
|
"quote",
|
158
|
-
"syn 2.0.
|
167
|
+
"syn 2.0.104",
|
159
168
|
]
|
160
169
|
|
161
170
|
[[package]]
|
@@ -180,6 +189,15 @@ dependencies = [
|
|
180
189
|
"windows-sys",
|
181
190
|
]
|
182
191
|
|
192
|
+
[[package]]
|
193
|
+
name = "cpufeatures"
|
194
|
+
version = "0.2.17"
|
195
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
196
|
+
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
|
197
|
+
dependencies = [
|
198
|
+
"libc",
|
199
|
+
]
|
200
|
+
|
183
201
|
[[package]]
|
184
202
|
name = "crossbeam"
|
185
203
|
version = "0.8.4"
|
@@ -236,6 +254,16 @@ version = "0.8.21"
|
|
236
254
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
237
255
|
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
|
238
256
|
|
257
|
+
[[package]]
|
258
|
+
name = "crypto-common"
|
259
|
+
version = "0.1.6"
|
260
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
261
|
+
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
262
|
+
dependencies = [
|
263
|
+
"generic-array",
|
264
|
+
"typenum",
|
265
|
+
]
|
266
|
+
|
239
267
|
[[package]]
|
240
268
|
name = "ctrlc"
|
241
269
|
version = "3.4.7"
|
@@ -318,6 +346,16 @@ version = "0.4.0"
|
|
318
346
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
319
347
|
checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
|
320
348
|
|
349
|
+
[[package]]
|
350
|
+
name = "digest"
|
351
|
+
version = "0.10.7"
|
352
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
353
|
+
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
354
|
+
dependencies = [
|
355
|
+
"block-buffer",
|
356
|
+
"crypto-common",
|
357
|
+
]
|
358
|
+
|
321
359
|
[[package]]
|
322
360
|
name = "doc-comment"
|
323
361
|
version = "0.3.3"
|
@@ -370,16 +408,26 @@ version = "0.1.1"
|
|
370
408
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
371
409
|
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
372
410
|
|
411
|
+
[[package]]
|
412
|
+
name = "generic-array"
|
413
|
+
version = "0.14.7"
|
414
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
415
|
+
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
416
|
+
dependencies = [
|
417
|
+
"typenum",
|
418
|
+
"version_check",
|
419
|
+
]
|
420
|
+
|
373
421
|
[[package]]
|
374
422
|
name = "getset"
|
375
|
-
version = "0.1.
|
423
|
+
version = "0.1.6"
|
376
424
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
377
|
-
checksum = "
|
425
|
+
checksum = "9cf0fc11e47561d47397154977bc219f4cf809b2974facc3ccb3b89e2436f912"
|
378
426
|
dependencies = [
|
379
427
|
"proc-macro-error2",
|
380
428
|
"proc-macro2",
|
381
429
|
"quote",
|
382
|
-
"syn 2.0.
|
430
|
+
"syn 2.0.104",
|
383
431
|
]
|
384
432
|
|
385
433
|
[[package]]
|
@@ -408,9 +456,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
408
456
|
|
409
457
|
[[package]]
|
410
458
|
name = "hermit-abi"
|
411
|
-
version = "0.5.
|
459
|
+
version = "0.5.2"
|
412
460
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
413
|
-
checksum = "
|
461
|
+
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
414
462
|
|
415
463
|
[[package]]
|
416
464
|
name = "humantime"
|
@@ -426,9 +474,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
|
426
474
|
|
427
475
|
[[package]]
|
428
476
|
name = "indexmap"
|
429
|
-
version = "2.
|
477
|
+
version = "2.10.0"
|
430
478
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
431
|
-
checksum = "
|
479
|
+
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
432
480
|
dependencies = [
|
433
481
|
"equivalent",
|
434
482
|
"hashbrown",
|
@@ -496,9 +544,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
496
544
|
|
497
545
|
[[package]]
|
498
546
|
name = "libc"
|
499
|
-
version = "0.2.
|
547
|
+
version = "0.2.174"
|
500
548
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
501
|
-
checksum = "
|
549
|
+
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
502
550
|
|
503
551
|
[[package]]
|
504
552
|
name = "lock_api"
|
@@ -593,9 +641,53 @@ dependencies = [
|
|
593
641
|
"windows-targets",
|
594
642
|
]
|
595
643
|
|
644
|
+
[[package]]
|
645
|
+
name = "pest"
|
646
|
+
version = "2.8.1"
|
647
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
648
|
+
checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323"
|
649
|
+
dependencies = [
|
650
|
+
"memchr",
|
651
|
+
"thiserror",
|
652
|
+
"ucd-trie",
|
653
|
+
]
|
654
|
+
|
655
|
+
[[package]]
|
656
|
+
name = "pest_derive"
|
657
|
+
version = "2.8.1"
|
658
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
659
|
+
checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc"
|
660
|
+
dependencies = [
|
661
|
+
"pest",
|
662
|
+
"pest_generator",
|
663
|
+
]
|
664
|
+
|
665
|
+
[[package]]
|
666
|
+
name = "pest_generator"
|
667
|
+
version = "2.8.1"
|
668
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
669
|
+
checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966"
|
670
|
+
dependencies = [
|
671
|
+
"pest",
|
672
|
+
"pest_meta",
|
673
|
+
"proc-macro2",
|
674
|
+
"quote",
|
675
|
+
"syn 2.0.104",
|
676
|
+
]
|
677
|
+
|
678
|
+
[[package]]
|
679
|
+
name = "pest_meta"
|
680
|
+
version = "2.8.1"
|
681
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
682
|
+
checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5"
|
683
|
+
dependencies = [
|
684
|
+
"pest",
|
685
|
+
"sha2",
|
686
|
+
]
|
687
|
+
|
596
688
|
[[package]]
|
597
689
|
name = "piranha"
|
598
|
-
version = "0.3.
|
690
|
+
version = "0.3.36"
|
599
691
|
dependencies = [
|
600
692
|
"assert_cmd",
|
601
693
|
"cc",
|
@@ -611,6 +703,8 @@ dependencies = [
|
|
611
703
|
"jwalk",
|
612
704
|
"lazy_static",
|
613
705
|
"log",
|
706
|
+
"pest",
|
707
|
+
"pest_derive",
|
614
708
|
"predicates",
|
615
709
|
"pyo3",
|
616
710
|
"pyo3-log",
|
@@ -691,7 +785,7 @@ dependencies = [
|
|
691
785
|
"proc-macro-error-attr2",
|
692
786
|
"proc-macro2",
|
693
787
|
"quote",
|
694
|
-
"syn 2.0.
|
788
|
+
"syn 2.0.104",
|
695
789
|
]
|
696
790
|
|
697
791
|
[[package]]
|
@@ -761,7 +855,7 @@ dependencies = [
|
|
761
855
|
"proc-macro2",
|
762
856
|
"pyo3-macros-backend",
|
763
857
|
"quote",
|
764
|
-
"syn 2.0.
|
858
|
+
"syn 2.0.104",
|
765
859
|
]
|
766
860
|
|
767
861
|
[[package]]
|
@@ -774,7 +868,7 @@ dependencies = [
|
|
774
868
|
"proc-macro2",
|
775
869
|
"pyo3-build-config",
|
776
870
|
"quote",
|
777
|
-
"syn 2.0.
|
871
|
+
"syn 2.0.104",
|
778
872
|
]
|
779
873
|
|
780
874
|
[[package]]
|
@@ -845,9 +939,9 @@ dependencies = [
|
|
845
939
|
|
846
940
|
[[package]]
|
847
941
|
name = "redox_syscall"
|
848
|
-
version = "0.5.
|
942
|
+
version = "0.5.13"
|
849
943
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
850
|
-
checksum = "
|
944
|
+
checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
|
851
945
|
dependencies = [
|
852
946
|
"bitflags",
|
853
947
|
]
|
@@ -919,7 +1013,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
|
919
1013
|
dependencies = [
|
920
1014
|
"proc-macro2",
|
921
1015
|
"quote",
|
922
|
-
"syn 2.0.
|
1016
|
+
"syn 2.0.104",
|
923
1017
|
]
|
924
1018
|
|
925
1019
|
[[package]]
|
@@ -943,6 +1037,17 @@ dependencies = [
|
|
943
1037
|
"serde",
|
944
1038
|
]
|
945
1039
|
|
1040
|
+
[[package]]
|
1041
|
+
name = "sha2"
|
1042
|
+
version = "0.10.9"
|
1043
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1044
|
+
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
1045
|
+
dependencies = [
|
1046
|
+
"cfg-if",
|
1047
|
+
"cpufeatures",
|
1048
|
+
"digest",
|
1049
|
+
]
|
1050
|
+
|
946
1051
|
[[package]]
|
947
1052
|
name = "smallvec"
|
948
1053
|
version = "1.15.1"
|
@@ -974,9 +1079,9 @@ dependencies = [
|
|
974
1079
|
|
975
1080
|
[[package]]
|
976
1081
|
name = "syn"
|
977
|
-
version = "2.0.
|
1082
|
+
version = "2.0.104"
|
978
1083
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
979
|
-
checksum = "
|
1084
|
+
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
980
1085
|
dependencies = [
|
981
1086
|
"proc-macro2",
|
982
1087
|
"quote",
|
@@ -1014,6 +1119,26 @@ version = "0.5.1"
|
|
1014
1119
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1015
1120
|
checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
|
1016
1121
|
|
1122
|
+
[[package]]
|
1123
|
+
name = "thiserror"
|
1124
|
+
version = "2.0.12"
|
1125
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1126
|
+
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
1127
|
+
dependencies = [
|
1128
|
+
"thiserror-impl",
|
1129
|
+
]
|
1130
|
+
|
1131
|
+
[[package]]
|
1132
|
+
name = "thiserror-impl"
|
1133
|
+
version = "2.0.12"
|
1134
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1135
|
+
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
1136
|
+
dependencies = [
|
1137
|
+
"proc-macro2",
|
1138
|
+
"quote",
|
1139
|
+
"syn 2.0.104",
|
1140
|
+
]
|
1141
|
+
|
1017
1142
|
[[package]]
|
1018
1143
|
name = "toml"
|
1019
1144
|
version = "0.8.23"
|
@@ -1190,6 +1315,18 @@ dependencies = [
|
|
1190
1315
|
"tree-sitter",
|
1191
1316
|
]
|
1192
1317
|
|
1318
|
+
[[package]]
|
1319
|
+
name = "typenum"
|
1320
|
+
version = "1.18.0"
|
1321
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1322
|
+
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
|
1323
|
+
|
1324
|
+
[[package]]
|
1325
|
+
name = "ucd-trie"
|
1326
|
+
version = "0.1.7"
|
1327
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1328
|
+
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
|
1329
|
+
|
1193
1330
|
[[package]]
|
1194
1331
|
name = "unicode-ident"
|
1195
1332
|
version = "1.0.18"
|
@@ -1208,6 +1345,12 @@ version = "0.2.2"
|
|
1208
1345
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1209
1346
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
1210
1347
|
|
1348
|
+
[[package]]
|
1349
|
+
name = "version_check"
|
1350
|
+
version = "0.9.5"
|
1351
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1352
|
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
1353
|
+
|
1211
1354
|
[[package]]
|
1212
1355
|
name = "wait-timeout"
|
1213
1356
|
version = "0.2.1"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
authors = ["Uber Technologies Inc."]
|
3
3
|
name = "piranha"
|
4
4
|
description = "Polyglot Piranha is a library for performing structural find and replace with deep cleanup."
|
5
|
-
version = "0.3.
|
5
|
+
version = "0.3.36"
|
6
6
|
edition = "2021"
|
7
7
|
include = ["pyproject.toml", "src/"]
|
8
8
|
exclude = ["legacy"]
|
@@ -70,6 +70,8 @@ pyo3 = "0.20.0"
|
|
70
70
|
pyo3-log = "0.9.0"
|
71
71
|
glob = "0.3.1"
|
72
72
|
lazy_static = "1.4.0"
|
73
|
+
pest = "2.8.1"
|
74
|
+
pest_derive = "2.8.1"
|
73
75
|
|
74
76
|
[features]
|
75
77
|
extension-module = ["pyo3/extension-module"]
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: polyglot_piranha
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.36
|
4
|
+
Requires-Dist: pytest>=8.0 ; extra == 'dev'
|
5
|
+
Provides-Extra: dev
|
4
6
|
License-File: LICENSE
|
5
7
|
License-File: NOTICE
|
6
8
|
Summary: Polyglot Piranha is a library for performing structural find and replace with deep cleanup.
|
@@ -114,6 +116,15 @@ A few additional links on Piranha:
|
|
114
116
|
|
115
117
|
If you have any questions on how to use Piranha or find any bugs, please [open a GitHub issue](https://github.com/uber/piranha/issues).
|
116
118
|
|
119
|
+
## Piranha Development
|
120
|
+
|
121
|
+
Piranha uses several grammar repositories with custom patches to support the transformations. While
|
122
|
+
these patches are being upstreamed, there may be discrepancies between the grammars in this
|
123
|
+
repository and the upstream grammars. Therefore, we have built a custom tree-sitter playground
|
124
|
+
that can be used to test the grammars and queries for easier development:
|
125
|
+
|
126
|
+
https://uber.github.io/piranha/tree-sitter-playground/
|
127
|
+
|
117
128
|
## License
|
118
129
|
Piranha is licensed under the Apache 2.0 license. See the LICENSE file for more information.
|
119
130
|
|
@@ -99,6 +99,15 @@ A few additional links on Piranha:
|
|
99
99
|
|
100
100
|
If you have any questions on how to use Piranha or find any bugs, please [open a GitHub issue](https://github.com/uber/piranha/issues).
|
101
101
|
|
102
|
+
## Piranha Development
|
103
|
+
|
104
|
+
Piranha uses several grammar repositories with custom patches to support the transformations. While
|
105
|
+
these patches are being upstreamed, there may be discrepancies between the grammars in this
|
106
|
+
repository and the upstream grammars. Therefore, we have built a custom tree-sitter playground
|
107
|
+
that can be used to test the grammars and queries for easier development:
|
108
|
+
|
109
|
+
https://uber.github.io/piranha/tree-sitter-playground/
|
110
|
+
|
102
111
|
## License
|
103
112
|
Piranha is licensed under the Apache 2.0 license. See the LICENSE file for more information.
|
104
113
|
|
@@ -20,9 +20,15 @@ documentation = "https://github.com/uber/piranha"
|
|
20
20
|
repository = "https://github.com/uber/piranha"
|
21
21
|
|
22
22
|
[build-system]
|
23
|
-
|
23
|
+
# There is a bug with maturin 1.9.0 that incorrectly packages LICENSE file causing a problem.
|
24
|
+
# For now we have to pin it to 1.8.7 (last stable version).
|
25
|
+
# TODO: remove this check once maturin is fixed.
|
26
|
+
requires = ["maturin>=1.4.0,<=1.8.7"]
|
24
27
|
build-backend = "maturin"
|
25
28
|
|
29
|
+
[project.optional-dependencies]
|
30
|
+
dev = ["pytest>=8.0"]
|
31
|
+
|
26
32
|
[tool.maturin]
|
27
33
|
bindings = "pyo3"
|
28
34
|
include = ["LICENSE", "NOTICE", "polyglot_piranha.pyi"]
|
@@ -34,6 +34,7 @@ pub fn get_capture_groups_from_matcher(node: &Rule) -> Vec<String> {
|
|
34
34
|
match &node.query().pattern_type() {
|
35
35
|
PatternType::Tsq => get_capture_groups_from_tsq(node.query().pattern()),
|
36
36
|
PatternType::Regex => get_capture_groups_from_regex(node.query().extract_regex().unwrap()),
|
37
|
+
PatternType::Cs => vec![],
|
37
38
|
PatternType::Unknown => vec![],
|
38
39
|
}
|
39
40
|
}
|
@@ -47,6 +48,7 @@ pub fn get_capture_group_usage_from_matcher(node: &Rule) -> Vec<String> {
|
|
47
48
|
match &node.query().pattern_type() {
|
48
49
|
PatternType::Tsq => get_capture_group_usage_from_tsq(node.query().pattern()),
|
49
50
|
PatternType::Regex => get_capture_group_usage_from_regex(node.query().pattern()),
|
51
|
+
PatternType::Cs => vec![],
|
50
52
|
PatternType::Unknown => vec![],
|
51
53
|
}
|
52
54
|
}
|
@@ -11,7 +11,8 @@ Copyright (c) 2023 Uber Technologies, Inc.
|
|
11
11
|
limitations under the License.
|
12
12
|
*/
|
13
13
|
|
14
|
-
use crate::models::concrete_syntax::get_all_matches_for_concrete_syntax;
|
14
|
+
use crate::models::concrete_syntax::interpreter::get_all_matches_for_concrete_syntax;
|
15
|
+
use crate::models::concrete_syntax::parser::ConcreteSyntax;
|
15
16
|
use crate::{
|
16
17
|
models::Validator,
|
17
18
|
utilities::{
|
@@ -26,8 +27,6 @@ use serde_derive::Deserialize;
|
|
26
27
|
use std::collections::HashMap;
|
27
28
|
use tree_sitter::{Node, Query};
|
28
29
|
|
29
|
-
#[derive(Debug)]
|
30
|
-
pub struct ConcreteSyntax(pub String);
|
31
30
|
use super::{
|
32
31
|
default_configs::{CONCRETE_SYNTAX_QUERY_PREFIX, REGEX_QUERY_PREFIX},
|
33
32
|
matches::Match,
|
@@ -36,6 +35,7 @@ use super::{
|
|
36
35
|
pub enum PatternType {
|
37
36
|
Tsq,
|
38
37
|
Regex,
|
38
|
+
Cs,
|
39
39
|
Unknown,
|
40
40
|
}
|
41
41
|
|
@@ -59,13 +59,14 @@ impl CGPattern {
|
|
59
59
|
|
60
60
|
pub(crate) fn extract_concrete_syntax(&self) -> ConcreteSyntax {
|
61
61
|
let mut _val = &self.pattern()[CONCRETE_SYNTAX_QUERY_PREFIX.len()..];
|
62
|
-
ConcreteSyntax(_val.
|
62
|
+
ConcreteSyntax::parse(_val).unwrap()
|
63
63
|
}
|
64
64
|
|
65
65
|
pub(crate) fn pattern_type(&self) -> PatternType {
|
66
66
|
match self.0.as_str() {
|
67
67
|
pattern if pattern.starts_with("rgx") => PatternType::Regex,
|
68
68
|
pattern if pattern.trim().starts_with('(') => PatternType::Tsq,
|
69
|
+
pattern if pattern.trim().starts_with("cs") => PatternType::Cs,
|
69
70
|
_ => PatternType::Unknown,
|
70
71
|
}
|
71
72
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// Concrete Syntax Grammar for Piranha
|
2
|
+
concrete_syntax = { SOI ~ pattern ~ EOI }
|
3
|
+
pattern = { (element)+ }
|
4
|
+
|
5
|
+
// An element is either a capture or literal text
|
6
|
+
element = _{ capture | literal_text | whitespace }
|
7
|
+
|
8
|
+
// Captures: :[name], :[name+], :[name*], @name
|
9
|
+
capture = { (":[" ~ identifier ~ capture_mode? ~ "]") | "@"~identifier } // FIXME: Should remove @ from the grammar, because literals may be parsed incorrectly
|
10
|
+
capture_mode = { "+" | "*" }
|
11
|
+
identifier = { (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* }
|
12
|
+
|
13
|
+
// Literal text - single word/token without whitespace
|
14
|
+
literal_text = { (!( ":[" | whitespace ) ~ ANY)+ }
|
15
|
+
whitespace = _{ (" " | "\t" | "\r" | "\n")+ }
|