move util hex_char_for() to utils.rs
This commit is contained in:
parent
e820395cc5
commit
18a04b2669
10
src/utils.rs
10
src/utils.rs
@ -746,3 +746,13 @@ pub(crate) fn read_until_char<I: Iterator<Item = Token>>(
|
|||||||
pub(crate) fn is_ident_char(c: char) -> bool {
|
pub(crate) fn is_ident_char(c: char) -> bool {
|
||||||
c.is_ascii_alphabetic() || c == '_' || c == '\\' || (!c.is_ascii() && !c.is_control())
|
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()
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@ use crate::color::Color;
|
|||||||
use crate::common::{Brackets, ListSeparator, Op, QuoteKind};
|
use crate::common::{Brackets, ListSeparator, Op, QuoteKind};
|
||||||
use crate::error::SassResult;
|
use crate::error::SassResult;
|
||||||
use crate::unit::{Unit, UNIT_CONVERSION_TABLE};
|
use crate::unit::{Unit, UNIT_CONVERSION_TABLE};
|
||||||
|
use crate::utils::hex_char_for;
|
||||||
|
|
||||||
use css_function::is_special_function;
|
use css_function::is_special_function;
|
||||||
pub(crate) use map::SassMap;
|
pub(crate) use map::SassMap;
|
||||||
@ -39,16 +40,6 @@ pub(crate) enum Value {
|
|||||||
Function(SassFunction),
|
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<()> {
|
fn visit_quoted_string(buf: &mut String, force_double_quote: bool, string: &str) -> SassResult<()> {
|
||||||
let mut has_single_quote = false;
|
let mut has_single_quote = false;
|
||||||
let mut has_double_quote = false;
|
let mut has_double_quote = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user