From 8566b31f7b21b7256b5eeb7807a9c03702be6027 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 29 Jun 2021 12:13:18 -0500 Subject: [PATCH] fix(parser): Go ahead and do lower UUIDs I need this for hash support anyways --- crates/typos/src/tokens.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/typos/src/tokens.rs b/crates/typos/src/tokens.rs index 16943f9..43b1ace 100644 --- a/crates/typos/src/tokens.rs +++ b/crates/typos/src/tokens.rs @@ -234,15 +234,15 @@ mod parser { ::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) } @@ -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)