Lines Matching +full:single +full:- +full:tt

1 // SPDX-License-Identifier: Apache-2.0 OR MIT
7 // Syn, and caution should be used when editing it. The public-facing interface
20 // Mimicking types from proc-macro.
35 // NOTE: Do not implement clone on this - while the current design could be
42 for tt in stream { in recursive_new()
43 match tt { in recursive_new()
52 let group_offset = group_end_index - group_start_index; in recursive_new()
54 -(group_end_index as isize), in recursive_new()
55 -(group_offset as isize), in recursive_new()
65 #[cfg(feature = "proc-macro")]
66 #[cfg_attr(docsrs, doc(cfg(feature = "proc-macro")))]
67 pub fn new(stream: proc_macro::TokenStream) -> Self { in new()
73 pub fn new2(stream: TokenStream) -> Self { in new2()
76 entries.push(Entry::End(-(entries.len() as isize), 0)); in new2()
84 pub fn begin(&self) -> Cursor { in begin()
86 unsafe { Cursor::create(ptr, ptr.add(self.entries.len() - 1)) } in begin()
111 pub fn empty() -> Self { in empty()
114 // (`Ident` is a reference into a thread-local table). This is because in empty()
130 /// This create method intelligently exits non-explicitly-entered
131 /// `None`-delimited scopes when the cursor reaches the end of them,
133 unsafe fn create(mut ptr: *const Entry, scope: *const Entry) -> Self { in create()
137 // from None-delimited groups entered with `ignore_none`. in create()
153 fn entry(self) -> &'a Entry { in entry()
163 unsafe fn bump_ignore_group(self) -> Cursor<'a> { in bump_ignore_group()
167 /// While the cursor is looking at a `None`-delimited group, move it to look
169 /// the cursor past the `None`-delimited group.
184 pub fn eof(self) -> bool { in eof()
191 pub fn ident(mut self) -> Option<(Ident, Cursor<'a>)> { in ident()
201 pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> { in punct()
213 pub fn literal(mut self) -> Option<(Literal, Cursor<'a>)> { in literal()
223 pub fn lifetime(mut self) -> Option<(Lifetime, Cursor<'a>)> { in lifetime()
241 pub fn group(mut self, delim: Delimiter) -> Option<(Cursor<'a>, DelimSpan, Cursor<'a>)> { in group()
242 // If we're not trying to enter a none-delimited group, we want to in group()
264 pub fn any_group(self) -> Option<(Cursor<'a>, Delimiter, DelimSpan, Cursor<'a>)> { in any_group()
277 pub(crate) fn any_group_token(self) -> Option<(Group, Cursor<'a>)> { in any_group_token()
289 pub fn token_stream(self) -> TokenStream { in token_stream()
292 while let Some((tt, rest)) = cursor.token_tree() { in token_stream()
293 tts.push(tt); in token_stream()
304 /// This method does not treat `None`-delimited groups as transparent, and
306 pub fn token_tree(self) -> Option<(TokenTree, Cursor<'a>)> { in token_tree()
321 pub fn span(mut self) -> Span { in span()
341 pub(crate) fn prev_span(mut self) -> Span { in prev_span()
343 self.ptr = unsafe { self.ptr.offset(-1) }; in prev_span()
348 /// Skip over the next token that is not a None-delimited group, without
351 /// This method treats `'lifetimes` as a single token.
352 pub(crate) fn skip(mut self) -> Option<Cursor<'a>> { in skip()
358 // Treat lifetimes as a single tt for the purposes of 'skip'. in skip()
373 pub(crate) fn scope_delimiter(self) -> Delimiter { in scope_delimiter()
387 fn clone(&self) -> Self { in clone()
395 fn eq(&self, other: &Self) -> bool { in eq()
401 fn partial_cmp(&self, other: &Self) -> Option<Ordering> { in partial_cmp()
410 pub(crate) fn same_scope(a: Cursor, b: Cursor) -> bool { in same_scope()
414 pub(crate) fn same_buffer(a: Cursor, b: Cursor) -> bool { in same_buffer()
418 fn start_of_buffer(cursor: Cursor) -> *const Entry { in start_of_buffer()
427 pub(crate) fn cmp_assuming_same_buffer(a: Cursor, b: Cursor) -> Ordering { in cmp_assuming_same_buffer()
431 pub(crate) fn open_span_of_group(cursor: Cursor) -> Span { in open_span_of_group()