From 03a3189a3d8e3e9d198ccf73bc0a836aaa6b6e3d Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 12 Oct 2022 18:45:52 -0400 Subject: feat(tvix/eval): Initial impl of builtins.match Implement an *initial* version of builtins.match, using the rust `regex` crate for regular expressions. The rust regex crate definitely has different semantics than nix's regular expressions - but we'd like to see how far we can get before the incompatibility starts to matter. This consciously leaves out any sort of memo for compiled regular expressions (which upstream nix also has) for the sake of expediency - in the future we should implement that so we don't have to compile the same regular expression multiple times. Change-Id: I5b718635831ec83397940e417a9047c4342b6fa1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6989 Tested-by: BuildkiteCI Reviewed-by: Adam Joseph Reviewed-by: tazjin --- corp/tvixbolt/Cargo.lock | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'corp') diff --git a/corp/tvixbolt/Cargo.lock b/corp/tvixbolt/Cargo.lock index c402a18d4d..a50ca39bf2 100644 --- a/corp/tvixbolt/Cargo.lock +++ b/corp/tvixbolt/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + [[package]] name = "atty" version = "0.2.14" @@ -310,6 +319,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + [[package]] name = "memoffset" version = "0.6.5" @@ -399,6 +414,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + [[package]] name = "rnix" version = "0.11.0-dev" @@ -580,6 +612,7 @@ dependencies = [ "codemap-diagnostic", "dirs", "path-clean", + "regex", "rnix", "rowan", "serde_json", -- cgit 1.4.1