mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
fix: Limit words to just identifiers
This commit is contained in:
parent
c0c99ef3ad
commit
d8ca9f9d5a
1 changed files with 1 additions and 1 deletions
|
@ -23,7 +23,7 @@ impl<'t> Token<'t> {
|
||||||
|
|
||||||
pub fn tokenize(content: &[u8]) -> impl Iterator<Item=Token> {
|
pub fn tokenize(content: &[u8]) -> impl Iterator<Item=Token> {
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b\w+\b"#).unwrap();
|
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_)+\b"#).unwrap();
|
||||||
}
|
}
|
||||||
SPLIT.find_iter(content).map(|m| Token::new(m.as_bytes(), m.start()))
|
SPLIT.find_iter(content).map(|m| Token::new(m.as_bytes(), m.start()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue