Skip to content
Myr

Update to regex-syntax 0.5

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The new regex 0.2.7 has updated to regex-syntax 0.5, so it seems prudent to update fd's dependency too, if only to avoid duplication.

authored by Josh Stone · committed by David Peter · parent 88fb9d7 · Browse files · 3 files+37 added−22 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+37 added−22 removed

  • other:+37 added−22 removed

3 files+37 added−22 removed

modified:src/internal.rs+17 added-11 removed
11 unmodified lines
12use std::io::Write;1314use exec::CommandTemplate;15use lscolors::LsColors;16use regex_syntax::{Expr, ExprBuilder};16use regex_syntax::Parser;17use regex_syntax::hir::Hir;18use regex::RegexSet;1920/// Whether or not to show21pub struct FileTypes {
77 unmodified lines
99}100101/// Determine if a regex pattern contains a literal uppercase character.102pub fn pattern_has_uppercase_char(pattern: &str) -> bool {102 ExprBuilder::new()103 Parser::new()104 .parse(pattern)104 .map(|expr| expr_has_uppercase_char(&expr))105 .map(|hir| hir_has_uppercase_char(&hir))106 .unwrap_or(false)107}108109/// Determine if a regex expression contains a literal uppercase character.109fn expr_has_uppercase_char(expr: &Expr) -> bool {110 match *expr {111 Expr::Literal { ref chars, .. } => chars.iter().any(|c| c.is_uppercase()),112 Expr::Class(ref ranges) => ranges110fn hir_has_uppercase_char(hir: &Hir) -> bool {111 use regex_syntax::hir::*;112113 match *hir.kind() {114 HirKind::Literal(Literal::Unicode(c)) => c.is_uppercase(),115 HirKind::Class(Class::Unicode(ref ranges)) => ranges116 .iter()114 .any(|r| r.start.is_uppercase() || r.end.is_uppercase()),115 Expr::Group { ref e, .. } | Expr::Repeat { ref e, .. } => expr_has_uppercase_char(e),116 Expr::Concat(ref es) => es.iter().any(expr_has_uppercase_char),117 Expr::Alternate(ref es) => es.iter().any(expr_has_uppercase_char),117 .any(|r| r.start().is_uppercase() || r.end().is_uppercase()),118 HirKind::Group(Group { ref hir, .. }) | HirKind::Repetition(Repetition { ref hir, .. }) => {119 hir_has_uppercase_char(hir)120 }121 HirKind::Concat(ref hirs) | HirKind::Alternation(ref hirs) => {122 hirs.iter().any(hir_has_uppercase_char)123 }124 _ => false,125 }126}127
124 unmodified lines
modified:Cargo.lock+18 added-9 removed
88 unmodified lines
89 "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",90 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",91 "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",92 "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",93 "regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",94 "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",93 "regex 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",94 "regex-syntax 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",95 "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",96 "version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",97 "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",98]
25 unmodified lines
124 "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",125 "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",126 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",127 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",128 "regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",128 "regex 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",129]130131[[package]]132name = "ignore"
4 unmodified lines
137 "globset 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",138 "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",139 "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",140 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",141 "regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",141 "regex 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",142 "same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",143 "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",144 "walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",145 "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
77 unmodified lines
223]224225[[package]]226name = "regex"227version = "0.2.6"227version = "0.2.7"228source = "registry+https://github.com/rust-lang/crates.io-index"229dependencies = [230 "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",231 "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",232 "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",232 "regex-syntax 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",233 "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",234 "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",235]236237[[package]]238name = "regex-syntax"239version = "0.4.2"239version = "0.5.0"240source = "registry+https://github.com/rust-lang/crates.io-index"241dependencies = [242 "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",243]244245[[package]]246name = "remove_dir_all"247version = "0.3.0"
63 unmodified lines
311 "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",312]313314[[package]]315name = "ucd-util"316version = "0.1.1"317source = "registry+https://github.com/rust-lang/crates.io-index"318319[[package]]320name = "unicode-width"321version = "0.1.4"322source = "registry+https://github.com/rust-lang/crates.io-index"323
89 unmodified lines
413"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"414"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"415"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"416"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"409"checksum regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5be5347bde0c48cfd8c3fdc0766cdfe9d8a755ef84d620d6794c778c91de8b2b"410"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"417"checksum regex 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a62bf8bb734ab90b7f234b681b01af396e5d39b028906c210dc04fa1d5e9e5b3"418"checksum regex-syntax 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48d7391e7e90e06eaf3aefbe4652464153ecfec64806f3bf77ffc59638a63e77"419"checksum remove_dir_all 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d2f806b0fcdabd98acd380dc8daef485e22bcb7cddc811d1337967f2528cf5"420"checksum same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637"421"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"422"checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e"423"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"424"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"425"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"426"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"427"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"428"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"429"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"430"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"431"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
8 unmodified lines
modified:Cargo.toml+2 added-2 removed