Skip to content

Commit

Permalink
fix(parser): Go ahead and do lower UUIDs
Browse files Browse the repository at this point in the history
I need this for hash support anyways
  • Loading branch information
epage committed Jun 29, 2021
1 parent 85082cd commit 8566b31
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crates/typos/src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ mod parser {
<T as nom::InputIter>::Item: AsChar + Copy,
{
recognize(tuple((
take_while_m_n(8, 8, AsChar::is_hex_digit),
take_while_m_n(8, 8, is_lower_hex_digit),
char('-'),
take_while_m_n(4, 4, AsChar::is_hex_digit),
take_while_m_n(4, 4, is_lower_hex_digit),
char('-'),
take_while_m_n(4, 4, AsChar::is_hex_digit),
take_while_m_n(4, 4, is_lower_hex_digit),
char('-'),
take_while_m_n(4, 4, AsChar::is_hex_digit),
take_while_m_n(4, 4, is_lower_hex_digit),
char('-'),
take_while_m_n(12, 12, AsChar::is_hex_digit),
take_while_m_n(12, 12, is_lower_hex_digit),
)))(input)
}

Expand Down Expand Up @@ -287,6 +287,11 @@ mod parser {
i.is_hex_digit() || is_digit_sep(i.as_char())
}

fn is_lower_hex_digit(i: impl AsChar + Copy) -> bool {
let c = i.as_char();
('a'..='f').contains(&c) || ('0'..='9').contains(&c)
}

fn is_xid_continue(i: impl AsChar + Copy) -> bool {
let c = i.as_char();
unicode_xid::UnicodeXID::is_xid_continue(c)
Expand Down

0 comments on commit 8566b31

Please sign in to comment.