diff --git a/Cargo.lock b/Cargo.lock index a928fda..5132e78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1728,9 +1728,9 @@ dependencies = [ "fancy-regex", "itertools", "neon", + "serde", "serde_json", "thiserror", - "zk-regex-compiler", ] [[package]] diff --git a/packages/apis/Cargo.toml b/packages/apis/Cargo.toml index a6d26cc..9aad838 100644 --- a/packages/apis/Cargo.toml +++ b/packages/apis/Cargo.toml @@ -17,7 +17,8 @@ crate-type = ["rlib", "cdylib"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -zk-regex-compiler = { path = "../compiler", default-features = false } +# zk-regex-compiler = { path = "../compiler", default-features = false } +serde = { version = "1.0.159", features = ["derive"] } fancy-regex = "0.11.0" itertools = "0.10.3" thiserror = "1.0.40" diff --git a/packages/apis/src/extract_substrs.rs b/packages/apis/src/extract_substrs.rs index 311a1ed..b73d655 100644 --- a/packages/apis/src/extract_substrs.rs +++ b/packages/apis/src/extract_substrs.rs @@ -1,8 +1,28 @@ use fancy_regex::Regex; use neon::prelude::*; +use serde::{Deserialize, Serialize}; use serde_json; use thiserror::Error; -use zk_regex_compiler::DecomposedRegexConfig; +// use zk_regex_compiler::DecomposedRegexConfig; + +/// A configuration of decomposed regexes. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DecomposedRegexConfig { + pub parts: Vec, +} + +/// Decomposed regex part. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RegexPartConfig { + /// A flag indicating whether the substring matching with `regex_def` should be exposed. + pub is_public: bool, + /// A regex string. + pub regex_def: String, + // Maximum byte size of the substring in this part. + // pub max_size: usize, + // (Optional) A solidity type of the substring in this part, e.g., "String", "Int", "Decimal". + // pub solidity: Option, +} /// Error definitions of the compiler. #[derive(Error, Debug)] @@ -374,8 +394,6 @@ pub fn extract_message_id_idxes_node(mut cx: FunctionContext) -> JsResult, }