css_parse/
parser_checkpoint.rs1use crate::{Cursor, Kind, KindSet, Span, State, ToSpan, Token};
2
3#[derive(Debug, Clone)]
8pub struct ParserCheckpoint<I> {
9 pub(crate) cursor: Cursor,
10 pub(crate) errors_pos: u8,
11 pub(crate) trivia_pos: u16,
12 pub(crate) iter: I,
13 pub(crate) buffer: [Cursor; 12],
14 pub(crate) buffer_index: usize,
15 pub(crate) skip: KindSet,
16 pub(crate) stop: KindSet,
17 pub(crate) state: State,
18}
19
20impl<I> From<ParserCheckpoint<I>> for Cursor {
21 fn from(value: ParserCheckpoint<I>) -> Self {
22 value.cursor
23 }
24}
25
26impl<I> From<ParserCheckpoint<I>> for Token {
27 fn from(value: ParserCheckpoint<I>) -> Self {
28 value.cursor.token()
29 }
30}
31
32impl<I> From<ParserCheckpoint<I>> for Kind {
33 fn from(value: ParserCheckpoint<I>) -> Self {
34 value.cursor.token().kind()
35 }
36}
37
38impl<I> ToSpan for ParserCheckpoint<I> {
39 fn to_span(&self) -> Span {
40 self.cursor.span()
41 }
42}