Lines Matching refs:Cursor

6 //! [`Cursor`] type. `Cursor` is a cheaply copyable cursor over a range of
10 //! [`Cursor`]: crate::buffer::Cursor
185 use crate::buffer::{Cursor, TokenBuffer};
225 /// Cursor position within a buffered token stream.
247 // Instead of Cell<Cursor<'a>> so that ParseBuffer<'a> is covariant in 'a.
251 // Cell<Cursor<'a>> cannot be covariant in 'a because then we could take a
253 // than 'a, and then assign a Cursor<'short> into the Cell.
256 // Cursor<'a> and trusts that it lives as long as the cursor currently in
258 cell: Cell<Cursor<'static>>,
259 marker: PhantomData<Cursor<'a>>,
286 /// Cursor state associated with speculative parsing.
333 cursor: Cursor<'c>,
342 marker: PhantomData<fn(Cursor<'c>) -> Cursor<'a>>,
346 type Target = Cursor<'c>;
371 pub(crate) fn advance_step_cursor<'c, 'a>(proof: StepCursor<'c, 'a>, to: Cursor<'c>) -> Cursor<'a> {
374 // Cursor is covariant in its lifetime parameter so we can cast a
375 // Cursor<'c> to one with the shorter lifetime Cursor<'a>.
377 unsafe { mem::transmute::<Cursor<'c>, Cursor<'a>>(to) }
382 cursor: Cursor,
388 cell: Cell::new(unsafe { mem::transmute::<Cursor, Cursor<'static>>(cursor) }),
440 fn span_of_unexpected_ignoring_nones(mut cursor: Cursor) -> Option<Span> {
616 fn peek2(buffer: &ParseBuffer, peek: fn(Cursor) -> bool) -> bool {
631 fn peek3(buffer: &ParseBuffer, peek: fn(Cursor) -> bool) -> bool {
633 if group.0.skip().and_then(Cursor::skip).map_or(false, peek) {
640 .and_then(Cursor::skip)
1054 F: for<'c> FnOnce(StepCursor<'c, 'a>) -> Result<(R, Cursor<'c>)>,
1057 // that the Cursor<'c> they return is either derived from the input
1058 // StepCursor<'c, 'a> or from a Cursor<'static>.
1065 // Cursor<'short>, and we would wrongly write that Cursor<'short> into
1066 // the Cell intended to hold Cursor<'a>.
1068 // In some cases it may be necessary for R to contain a Cursor<'a>.
1071 // from Cursor<'c> to Cursor<'a>. If needed outside of Syn, it would be
1104 /// use syn::buffer::Cursor;
1121 /// fn tokens_between(begin: Cursor, end: Cursor) -> TokenStream {
1151 pub fn cursor(&self) -> Cursor<'a> {
1184 input.step(|cursor| Ok((cursor.token_stream(), Cursor::empty())))