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

Method new

crates/css_parse/src/parser.rs:68–88  ·  view source on GitHub ↗

Create a new parser with an iterator over cursors

(bump: &'a Bump, source_text: &'a str, mut cursor_iter: I)

Source from the content-addressed store, hash-verified

66{
67 /// Create a new parser with an iterator over cursors
68 pub fn new(bump: &'a Bump, source_text: &'a str, mut cursor_iter: I) -> Self {
69 let eof_cursor = eof_cursor(source_text.len());
70 let mut buffer = [eof_cursor; BUFFER_LEN];
71 buffer.fill_with(|| cursor_iter.next().unwrap_or(eof_cursor));
72
73 Self {
74 source_text,
75 cursor_iter,
76 features: Feature::none(),
77 errors: Vec::new_in(bump),
78 trivia: Vec::new_in(bump),
79 state: State::none(),
80 skip: KindSet::TRIVIA,
81 stop: KindSet::NONE,
82 buffer,
83 buffer_index: 0,
84 bump,
85 #[cfg(debug_assertions)]
86 last_cursor: None,
87 }
88 }
89
90 pub fn with_features(mut self, features: Feature) -> Self {
91 self.features = features;

Callers

nothing calls this directly

Calls 3

eof_cursorFunction · 0.85
lenMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected