MCPcopy Create free account
hub / github.com/csskit/csskit / may_compact

Method may_compact

crates/css_lexer/src/source_cursor.rs:172–184  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

170 /// - Dimension: combines number and unit checks
171 #[inline]
172 pub fn may_compact(&self) -> bool {
173 let token = self.token();
174 match token.kind() {
175 Kind::Whitespace => token.len() > 1,
176 Kind::Ident | Kind::Function | Kind::AtKeyword | Kind::Hash => token.contains_escape_chars(),
177 Kind::Number => self.can_compact_number(),
178 Kind::Dimension => {
179 self.can_compact_number()
180 || self.source[(self.token().numeric_len() as usize)..].bytes().any(|b| b == b'\\' || b == 0)
181 }
182 _ => false,
183 }
184 }
185
186 /// Check if the numeric value could be compacted.
187 #[inline]

Callers 1

visit_timeMethod · 0.80

Calls 6

contains_escape_charsMethod · 0.80
can_compact_numberMethod · 0.80
numeric_lenMethod · 0.80
tokenMethod · 0.45
kindMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected