-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract regex and add fancy_regex
backend
#908
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
.vim | ||
.env | ||
.venv | ||
target | ||
.idea | ||
Cargo.lock | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ harness = false | |
[dependencies] | ||
lazy_static = "1.4" | ||
rand = "0.7" | ||
onig = { version = "6.0", default-features = false } | ||
regex = "1.3" | ||
regex-syntax = "0.6" | ||
rayon = "1.3" | ||
|
@@ -59,11 +58,18 @@ cached-path = { version = "0.5", optional = true } | |
aho-corasick = "0.7" | ||
paste = "1.0.6" | ||
proc_macros = { path = "./src/utils/proc_macros" } | ||
once_cell = "1.8" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need that either. Even keeping the idea of |
||
cfg-if = "1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's needed actually. You can probably write this as pure rust compilation |
||
onig = { version = "6.0", default-features = false, optional = true } | ||
fancy-regex = { version = "0.7", optional = true } | ||
|
||
[features] | ||
default = ["progressbar", "http"] | ||
default = ["progressbar", "http", "regex-onig"] | ||
progressbar = ["indicatif"] | ||
http = ["reqwest", "cached-path"] | ||
regex-fancy = ["fancy-regex"] | ||
regex-onig = ["onig"] | ||
regex-all-test = ["regex-onig", "regex-fancy"] | ||
|
||
[dev-dependencies] | ||
criterion = "0.3" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use onig::Regex; | ||
use crate::utils::regex::Regex; | ||
use serde::{Deserialize, Deserializer, Serialize}; | ||
|
||
use crate::tokenizer::{ | ||
|
@@ -80,8 +80,8 @@ impl Split { | |
) -> Result<Self> { | ||
let pattern: SplitPattern = pattern.into(); | ||
let regex = match &pattern { | ||
SplitPattern::String(s) => Regex::new(®ex::escape(s))?, | ||
SplitPattern::Regex(r) => Regex::new(r)?, | ||
SplitPattern::String(s) => Regex::new(regex::escape(s)), | ||
SplitPattern::Regex(r) => Regex::new(r.to_owned()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to refrain making everything owned when the compiler asks you too. It's the easy way out, but the incorrect way out most likely. |
||
}; | ||
|
||
Ok(Self { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. That's a user thing it does not belong here.
Please use a global
.gitignore
for you (then you also only define it once on your machine).