Skip to content

Commit

Permalink
Fix dependency on compiler in apis.
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Feb 11, 2024
1 parent a27a2c5 commit 5e69961
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/apis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 21 additions & 3 deletions packages/apis/src/extract_substrs.rs
Original file line number Diff line number Diff line change
@@ -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<RegexPartConfig>,
}

/// 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<SoldityType>,
}

/// Error definitions of the compiler.
#[derive(Error, Debug)]
Expand Down Expand Up @@ -374,8 +394,6 @@ pub fn extract_message_id_idxes_node(mut cx: FunctionContext) -> JsResult<JsArra

#[cfg(test)]
mod test {
use zk_regex_compiler::RegexPartConfig;

use super::*;

#[test]
Expand Down
3 changes: 0 additions & 3 deletions packages/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ pub enum CompilerError {
/// A configuration of decomposed regexes.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DecomposedRegexConfig {
/// Maximum byte size of the input string.
// pub max_byte_size: usize,
/// A vector of decomposed regexes.
pub parts: Vec<RegexPartConfig>,
}

Expand Down

0 comments on commit 5e69961

Please sign in to comment.