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

Method consume_trivia_as_leading

crates/css_parse/src/parser.rs:382–389  ·  view source on GitHub ↗

Consume trivia and attach it to the next content token for output preservation. This should be called when you want to consume whitespace/comments but preserve them for round-trip output fidelity.

(&mut self)

Source from the content-addressed store, hash-verified

380 /// This should be called when you want to consume whitespace/comments but preserve
381 /// them for round-trip output fidelity.
382 pub fn consume_trivia_as_leading(&mut self) {
383 let trivia = self.consume_trivia();
384 if !trivia.is_empty() {
385 // Peek the next content token to attach trivia to it
386 let next = self.peek_n(1);
387 self.trivia.push((trivia, next));
388 }
389 }
390
391 #[allow(clippy::should_implement_trait)]
392 pub fn next(&mut self) -> Cursor {

Callers 2

parseMethod · 0.80

Calls 3

consume_triviaMethod · 0.80
peek_nMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected