feat(parser): Treat contractions as a word

This should be safe.  Rarely is `'` used as syntax in a language that
separates literals.

- `'` is used within hex literals in C++ but we want to treat them as
  one word
- `'` is used for lifetimes in Rust but there are other symbols on the
  left side.
This commit is contained in:
Ed Page 2019-07-13 19:26:37 -06:00
parent 006204e66a
commit b6ab968478

View file

@ -42,7 +42,7 @@ impl<'t> Identifier<'t> {
lazy_static::lazy_static! {
// Getting false positives for this lint
#[allow(clippy::invalid_regex)]
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_)+\b"#).unwrap();
static ref SPLIT: regex::bytes::Regex = regex::bytes::Regex::new(r#"\b(\p{Alphabetic}|\d|_|')+\b"#).unwrap();
}
SPLIT.find_iter(content).filter_map(|m| {
let s = std::str::from_utf8(m.as_bytes()).ok();