Home
last modified time | relevance | path

Searched refs:TokenTree (Results 1 – 25 of 28) sorted by relevance

12

/linux/rust/macros/
H A Dpaste.rs3 use proc_macro::{Delimiter, Group, Ident, Spacing, Span, TokenTree};
5 fn concat_helper(tokens: &[TokenTree]) -> Vec<(String, Span)> { in concat_helper()
12 Some(TokenTree::Literal(lit)) => { in concat_helper()
21 Some(TokenTree::Ident(ident)) => { in concat_helper()
28 Some(TokenTree::Punct(p)) if p.as_char() == ':' => { in concat_helper()
29 let Some(TokenTree::Ident(ident)) = tokens.next() else { in concat_helper()
49 Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::None => { in concat_helper()
50 let tokens = group.stream().into_iter().collect::<Vec<TokenTree>>(); in concat_helper()
60 fn concat(tokens: &[TokenTree], group_span: Span) -> TokenTree { in concat() argument
63 TokenTree::Ident(Ident::new(&pasted, group_span)) in concat()
[all …]
H A Dpin_data.rs
H A Dquote.rs3 use proc_macro::{TokenStream, TokenTree};
19 tokens.extend([TokenTree::from(self.clone())]); in to_tokens()
25 tokens.extend([TokenTree::from(self.clone())]); in to_tokens()
29 impl ToTokens for TokenTree { implementation
72 $v.extend([::proc_macro::TokenTree::Group(::proc_macro::Group::new(
81 $v.extend([::proc_macro::TokenTree::Group(::proc_macro::Group::new(
90 $v.extend([::proc_macro::TokenTree::Group(::proc_macro::Group::new(
98 ::proc_macro::TokenTree::Punct(::proc_macro::Punct::new(':', spacing))
103 $v.extend([::proc_macro::TokenTree::Punct(
109 $v.extend([::proc_macro::TokenTree::Punct(
[all …]
H A Dvtable.rs3 use proc_macro::{Delimiter, Group, TokenStream, TokenTree};
14 TokenTree::Ident(ident) => match ident.to_string().as_str() { in vtable()
25 Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Brace => group, in vtable()
34 TokenTree::Ident(ident) if ident.to_string() == "fn" => { in vtable()
36 Some(TokenTree::Ident(ident)) => ident.to_string(), in vtable()
42 TokenTree::Ident(ident) if ident.to_string() == "const" => { in vtable()
44 Some(TokenTree::Ident(ident)) => ident.to_string(), in vtable()
94 tokens.push(TokenTree::Group(Group::new(Delimiter::Brace, new_body))); in vtable()
H A Dpinned_drop.rs
H A Dhelpers.rs3 use proc_macro::{token_stream, Group, Ident, TokenStream, TokenTree};
6 if let Some(TokenTree::Ident(ident)) = it.next() { in try_ident()
16 Some(TokenTree::Punct(punct)) if punct.as_char() == '-' => { in try_sign()
25 if let Some(TokenTree::Literal(literal)) = it.next() { in try_literal()
53 if let TokenTree::Punct(punct) = it.next().expect("Reached end of token stream for Punct") { in expect_punct()
71 if let TokenTree::Group(group) = it.next().expect("Reached end of token stream for Group") { in expect_group()
89 TokenTree::Ident(i) if i.to_string() == "fn" => { in function_name()
90 if let Some(TokenTree::Ident(i)) = input.next() { in function_name()
H A Dzeroable.rs
H A Dconcat_idents.rs3 use proc_macro::{token_stream, Ident, TokenStream, TokenTree};
8 if let Some(TokenTree::Ident(ident)) = it.next() { in expect_ident()
22 TokenStream::from_iter([TokenTree::Ident(res)]) in concat_idents()
H A Dfmt.rs3 use proc_macro::{Ident, TokenStream, TokenTree};
15 Some(TokenTree::Literal(first_lit)) => { in fmt()
60 if matches!(&tt, TokenTree::Punct(p) if p.as_char() == '=') { in fmt()
77 TokenTree::Punct(p) if p.as_char() == ',' => { in fmt()
H A Dmodule.rs4 use proc_macro::{token_stream, Delimiter, Literal, TokenStream, TokenTree};
17 Some(TokenTree::Punct(punct)) => assert_eq!(punct.as_char(), ','), in expect_string_array()
228 Some(TokenTree::Ident(ident)) => ident.to_string(), in expect_params()
275 Some(TokenTree::Ident(ident)) => ident.to_string(), in parse()
/linux/rust/syn/
H A Dtt.rs3 use proc_macro2::{Delimiter, TokenStream, TokenTree};
6 pub(crate) struct TokenTreeHelper<'a>(pub &'a TokenTree);
13 (TokenTree::Group(g1), TokenTree::Group(g2)) => { in eq()
36 (TokenTree::Punct(o1), TokenTree::Punct(o2)) => { in eq()
43 (TokenTree::Literal(l1), TokenTree::Literal(l2)) => l1.to_string() == l2.to_string(), in eq()
44 (TokenTree::Ident(s1), TokenTree::Ident(s2)) => s1 == s2, in eq()
55 TokenTree::Group(g) => { in hash()
69 TokenTree::Punct(op) => { in hash()
77 TokenTree::Literal(lit) => (2u8, lit.to_string()).hash(h), in hash()
78 TokenTree::Ident(word) => (3u8, word).hash(h), in hash()
H A Derror.rs7 Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree,
286 TokenTree::Punct({ in to_compile_error()
291 TokenTree::Punct({ in to_compile_error()
296 TokenTree::Ident(Ident::new("core", start)), in to_compile_error()
297 TokenTree::Punct({ in to_compile_error()
302 TokenTree::Punct({ in to_compile_error()
307 TokenTree::Ident(Ident::new("compile_error", start)), in to_compile_error()
308 TokenTree::Punct({ in to_compile_error()
313 TokenTree::Group({ in to_compile_error()
315 TokenStream::from_iter([TokenTree::Literal({ in to_compile_error()
H A Dbuffer.rs12 use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
44 TokenTree::Ident(ident) => entries.push(Entry::Ident(ident)), in recursive_new()
45 TokenTree::Punct(punct) => entries.push(Entry::Punct(punct)), in recursive_new()
46 TokenTree::Literal(literal) => entries.push(Entry::Literal(literal)), in recursive_new()
47 TokenTree::Group(group) => { in recursive_new()
306 pub fn token_tree(self) -> Option<(TokenTree, Cursor<'a>)> { in token_tree() argument
H A Dmac.rs14 use proc_macro2::TokenTree;
157 if let Some((TokenTree::Group(g), rest)) = cursor.token_tree() { in parse_delimiter()
H A Dscan_expr.rs4 use proc_macro2::{Delimiter, Ident, Spacing, TokenTree};
222 Input::ConsumeAny => input.parse::<Option<TokenTree>>()?.is_some(), in scan_expr()
H A Dclassify.rs14 use proc_macro2::{Delimiter, TokenStream, TokenTree};
307 if let Some(TokenTree::Group(last)) = tokens.clone().into_iter().last() { in expr_trailing_brace()
/linux/rust/pin-init/internal/src/
H A Dzeroable.rs7 use proc_macro::{TokenStream, TokenTree};
12 Vec<TokenTree>, in parse_zeroable_derive_input() argument
13 Vec<TokenTree>, in parse_zeroable_derive_input()
14 Vec<TokenTree>, in parse_zeroable_derive_input()
15 Option<TokenTree>, in parse_zeroable_derive_input() argument
38 TokenTree::Punct(p) if nested == 0 && p.as_char() == ',' => { in parse_zeroable_derive_input()
47 TokenTree::Punct(p) if nested == 0 && p.as_char() == '\'' => { in parse_zeroable_derive_input()
51 TokenTree::Punct(p) if nested == 0 && p.as_char() == ':' => { in parse_zeroable_derive_input()
58 TokenTree::Punct(p) if p.as_char() == '<' => { in parse_zeroable_derive_input()
62 TokenTree::Punct(p) if p.as_char() == '>' => { in parse_zeroable_derive_input()
H A Dpinned_drop.rs6 use proc_macro::{TokenStream, TokenTree};
12 assert!(matches!(&toks[0], TokenTree::Ident(i) if i.to_string() == "impl")); in pinned_drop()
18 TokenTree::Punct(p) if p.as_char() == '<' => { in pinned_drop()
21 TokenTree::Punct(p) if p.as_char() == '>' => { in pinned_drop()
30 matches!(tt, TokenTree::Ident(i) if i.to_string() == "PinnedDrop"), in pinned_drop()
42 if let Some(TokenTree::Group(last)) = toks.pop() { in pinned_drop()
/linux/rust/proc-macro2/
H A Dlib.rs277 impl From<TokenTree> for TokenStream {
278 fn from(token: TokenTree) -> Self { in from()
283 impl Extend<TokenTree> for TokenStream {
284 fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I) { in extend()
297 impl FromIterator<TokenTree> for TokenStream {
298 fn from_iter<I: IntoIterator<Item = TokenTree>>(streams: I) -> Self { in from_iter()
535 pub enum TokenTree { enum
546 impl TokenTree { impl
551 TokenTree::Group(t) => t.span(), in span()
552 TokenTree::Ident(t) => t.span(), in span()
[all …]
H A Dwrapper.rs13 use crate::{Delimiter, Punct, Spacing, TokenTree};
35 extra: Vec<proc_macro::TokenTree>,
163 fn into_compiler_token(token: TokenTree) -> proc_macro::TokenTree { in into_compiler_token() argument
165 TokenTree::Group(tt) => proc_macro::TokenTree::Group(tt.inner.unwrap_nightly()), in into_compiler_token()
166 TokenTree::Punct(tt) => { in into_compiler_token()
173 proc_macro::TokenTree::Punct(punct) in into_compiler_token()
175 TokenTree::Ident(tt) => proc_macro::TokenTree::Ident(tt.inner.unwrap_nightly()), in into_compiler_token()
176 TokenTree::Literal(tt) => proc_macro::TokenTree::Literal(tt.inner.unwrap_nightly()), in into_compiler_token()
180 impl From<TokenTree> for TokenStream {
181 fn from(token: TokenTree) -> Self { in from()
[all …]
H A Dfallback.rs9 use crate::{Delimiter, Spacing, TokenTree};
49 inner: RcVec<TokenTree>,
98 fn take_inner(self) -> RcVecBuilder<TokenTree> { in take_inner() argument
104 fn push_token_from_proc_macro(mut vec: RcVecMut<TokenTree>, token: TokenTree) { in push_token_from_proc_macro() argument
107 TokenTree::Literal(crate::Literal { in push_token_from_proc_macro()
120 fn push_negative_literal(mut vec: RcVecMut<TokenTree>, mut literal: Literal) { in push_token_from_proc_macro() argument
124 vec.push(TokenTree::Punct(punct)); in push_token_from_proc_macro()
125 vec.push(TokenTree::Literal(crate::Literal::_new_fallback(literal))); in push_token_from_proc_macro()
140 TokenTree::Group(group) => group.inner, in drop()
163 inner: RcVecBuilder<TokenTree>,
[all …]
H A Dparse.rs7 use crate::{Delimiter, Punct, Spacing, TokenTree};
237 trees.push_token_from_parser(TokenTree::Group(crate::Group::_new_fallback(g))); in token_stream()
268 fn leaf_token(input: Cursor) -> PResult<TokenTree> { in leaf_token() argument
271 Ok((input, TokenTree::Literal(crate::Literal::_new_fallback(l)))) in leaf_token()
273 Ok((input, TokenTree::Punct(p))) in leaf_token()
275 Ok((input, TokenTree::Ident(i))) in leaf_token()
279 Ok((rest, TokenTree::Literal(repr))) in leaf_token()
937 trees.push_token_from_parser(TokenTree::Punct(pound)); in doc_comment()
942 trees.push_token_from_parser(TokenTree::Punct(bang)); in doc_comment()
951 bracketed.push_token_from_parser(TokenTree::Ident(doc_ident)); in doc_comment()
[all …]
/linux/rust/quote/
H A Dext.rs5 use proc_macro2::{TokenStream, TokenTree};
16 U: Into<TokenTree>; in append() argument
64 U: Into<TokenTree>, in append() argument
H A Druntime.rs8 use proc_macro2::{Group, Ident, Punct, Spacing, TokenTree};
281 fn respan_token_tree(mut token: TokenTree, span: Span) -> TokenTree { in respan_token_tree() argument
283 TokenTree::Group(g) => { in respan_token_tree()
311 TokenTree::Punct(Punct::new('\'', Spacing::Joint)), in push_lifetime()
312 TokenTree::Ident(Ident::new(&lifetime[1..], Span::call_site())), in push_lifetime()
319 TokenTree::Punct({ in push_lifetime_spanned()
324 TokenTree::Ident(Ident::new(&lifetime[1..], span)), in push_lifetime_spanned()
H A Dto_tokens.rs7 use proc_macro2::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree};
259 impl ToTokens for TokenTree { implementation

12