Create a new parser with an iterator over cursors
(bump: &'a Bump, source_text: &'a str, mut cursor_iter: I)
| 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; |
nothing calls this directly
no test coverage detected