Lines Matching refs:cursor
2 //! cheaply copyable cursor.
75 /// Creates a cursor referencing the first token in the buffer and able to
83 /// A cheaply copyable cursor into a `TokenBuffer`.
85 /// This cursor holds a shared reference into the immutable data which is used
90 /// object and get a cursor to its first token with `begin()`.
94 // This is the only `Entry::End` object which this cursor is allowed to
103 /// Creates a cursor referencing a static empty TokenStream.
124 /// `None`-delimited scopes when the cursor reaches the end of them,
127 // NOTE: If we're looking at a `End`, we want to advance the cursor
129 // our cursor's scope. We should only have `ptr != scope` at the exit
150 /// Bump the cursor to point at the next token after the current one. This
151 /// is undefined behavior if the cursor is currently looking at an
154 /// If the cursor is looking at an `Entry::Group`, the bumped cursor will
160 /// While the cursor is looking at a `None`-delimited group, move it to look
162 /// the cursor past the `None`-delimited group.
175 /// Checks whether the cursor is currently pointing at the end of its valid
182 /// If the cursor is pointing at a `Group` with the given delimiter, returns
183 /// a cursor into that group and one pointing to the next `TokenTree`.
228 /// If the cursor is pointing at a `Ident`, returns it along with a cursor
238 /// If the cursor is pointing at a `Punct`, returns it along with a cursor
250 /// If the cursor is pointing at a `Literal`, return it along with a cursor
260 /// If the cursor is pointing at a `Lifetime`, returns it along with a
261 /// cursor pointing at the next `TokenTree`.
278 /// Copies all remaining tokens visible from this cursor into a
282 let mut cursor = self;
283 while let Some((tt, rest)) = cursor.token_tree() {
285 cursor = rest;
290 /// If the cursor is pointing at a `TokenTree`, returns it along with a
291 /// cursor pointing at the next `TokenTree`.
293 /// Returns `None` if the cursor has reached the end of its stream.
296 /// will return a `Group(None, ..)` if the cursor is looking at one.
311 /// cursor points to eof.
323 /// this cursor, or of the current token if there is no previous one.
350 /// cursor points to eof.
407 fn start_of_buffer(cursor: Cursor) -> *const Entry {
409 match &*cursor.scope {
410 Entry::End(offset) => cursor.scope.offset(*offset),
420 pub(crate) fn open_span_of_group(cursor: Cursor) -> Span {
421 match cursor.entry() {
423 _ => cursor.span(),
427 pub(crate) fn close_span_of_group(cursor: Cursor) -> Span {
428 match cursor.entry() {
430 _ => cursor.span(),