diff --git a/src/utils.rs b/src/utils.rs index d475795..dab4447 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -746,3 +746,13 @@ pub(crate) fn read_until_char>( pub(crate) fn is_ident_char(c: char) -> bool { c.is_ascii_alphabetic() || c == '_' || c == '\\' || (!c.is_ascii() && !c.is_control()) } + +pub(crate) fn hex_char_for(number: u32) -> char { + assert!(number < 0x10); + std::char::from_u32(if number < 0xA { + 0x30 + number + } else { + 0x61 - 0xA + number + }) + .unwrap() +} diff --git a/src/value/mod.rs b/src/value/mod.rs index aa7eaf7..c2be0b9 100644 --- a/src/value/mod.rs +++ b/src/value/mod.rs @@ -7,6 +7,7 @@ use crate::color::Color; use crate::common::{Brackets, ListSeparator, Op, QuoteKind}; use crate::error::SassResult; use crate::unit::{Unit, UNIT_CONVERSION_TABLE}; +use crate::utils::hex_char_for; use css_function::is_special_function; pub(crate) use map::SassMap; @@ -39,16 +40,6 @@ pub(crate) enum Value { Function(SassFunction), } -fn hex_char_for(number: u32) -> char { - assert!(number < 0x10); - std::char::from_u32(if number < 0xA { - 0x30 + number - } else { - 0x61 - 0xA + number - }) - .unwrap() -} - fn visit_quoted_string(buf: &mut String, force_double_quote: bool, string: &str) -> SassResult<()> { let mut has_single_quote = false; let mut has_double_quote = false;