Home
last modified time | relevance | path

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

123

/external/rust/crates/syn/tests/
Dtest_ty.rs4 use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
22 TokenTree::Group(Group::new(Delimiter::None, quote! { ty })), in test_macro_variable_type()
23 TokenTree::Punct(Punct::new('<', Spacing::Alone)), in test_macro_variable_type()
24 TokenTree::Ident(Ident::new("T", Span::call_site())), in test_macro_variable_type()
25 TokenTree::Punct(Punct::new('>', Spacing::Alone)), in test_macro_variable_type()
56 TokenTree::Group(Group::new(Delimiter::None, quote! { ty })), in test_macro_variable_type()
57 TokenTree::Punct(Punct::new(':', Spacing::Joint)), in test_macro_variable_type()
58 TokenTree::Punct(Punct::new(':', Spacing::Alone)), in test_macro_variable_type()
59 TokenTree::Punct(Punct::new('<', Spacing::Alone)), in test_macro_variable_type()
60 TokenTree::Ident(Ident::new("T", Span::call_site())), in test_macro_variable_type()
[all …]
Dtest_expr.rs4 use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
125 TokenTree::Group(Group::new(Delimiter::None, quote! { f })), in test_macro_variable_func()
126 TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())), in test_macro_variable_func()
147 TokenTree::Punct(Punct::new('#', Spacing::Alone)), in test_macro_variable_func()
148 TokenTree::Group(Group::new(Delimiter::Bracket, quote! { outside })), in test_macro_variable_func()
149 TokenTree::Group(Group::new(Delimiter::None, quote! { #[inside] f })), in test_macro_variable_func()
150 TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())), in test_macro_variable_func()
203 TokenTree::Group(Group::new(Delimiter::None, quote! { m })), in test_macro_variable_macro()
204 TokenTree::Punct(Punct::new('!', Spacing::Alone)), in test_macro_variable_macro()
205 TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())), in test_macro_variable_macro()
[all …]
Dtest_grouping.rs4 use proc_macro2::{Delimiter, Group, Literal, Punct, Spacing, TokenStream, TokenTree};
11 TokenTree::Literal(Literal::i32_suffixed(1)), in test_grouping()
12 TokenTree::Punct(Punct::new('+', Spacing::Alone)), in test_grouping()
13 TokenTree::Group(Group::new( in test_grouping()
16 TokenTree::Literal(Literal::i32_suffixed(2)), in test_grouping()
17 TokenTree::Punct(Punct::new('+', Spacing::Alone)), in test_grouping()
18 TokenTree::Literal(Literal::i32_suffixed(3)), in test_grouping()
21 TokenTree::Punct(Punct::new('*', Spacing::Alone)), in test_grouping()
22 TokenTree::Literal(Literal::i32_suffixed(4)), in test_grouping()
Dtest_item.rs4 use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
13 TokenTree::Group(Group::new(Delimiter::None, quote! { #[test] })), in test_macro_variable_attr()
14 TokenTree::Ident(Ident::new("fn", Span::call_site())), in test_macro_variable_attr()
15 TokenTree::Ident(Ident::new("f", Span::call_site())), in test_macro_variable_attr()
16 TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())), in test_macro_variable_attr()
17 TokenTree::Group(Group::new(Delimiter::Brace, TokenStream::new())), in test_macro_variable_attr()
126 TokenTree::Ident(Ident::new("impl", Span::call_site())), in test_macro_variable_impl()
127 TokenTree::Group(Group::new(Delimiter::None, quote!(Trait))), in test_macro_variable_impl()
128 TokenTree::Ident(Ident::new("for", Span::call_site())), in test_macro_variable_impl()
129 TokenTree::Group(Group::new(Delimiter::None, quote!(Type))), in test_macro_variable_impl()
[all …]
Dtest_stmt.rs4 use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
51 let tokens = TokenStream::from_iter(vec![TokenTree::Group(Group::new( in test_none_group()
54 TokenTree::Ident(Ident::new("async", Span::call_site())), in test_none_group()
55 TokenTree::Ident(Ident::new("fn", Span::call_site())), in test_none_group()
56 TokenTree::Ident(Ident::new("f", Span::call_site())), in test_none_group()
57 TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())), in test_none_group()
58 TokenTree::Group(Group::new(Delimiter::Brace, TokenStream::new())), in test_none_group()
Dtest_visibility.rs4 use proc_macro2::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
110 TokenTree::Ident(Ident::new("struct", Span::call_site())), in test_empty_group_vis()
111 TokenTree::Ident(Ident::new("S", Span::call_site())), in test_empty_group_vis()
112 TokenTree::Group(Group::new( in test_empty_group_vis()
115 TokenTree::Group(Group::new(Delimiter::None, TokenStream::new())), in test_empty_group_vis()
116 TokenTree::Group(Group::new( in test_empty_group_vis()
118 TokenStream::from_iter(vec![TokenTree::Ident(Ident::new( in test_empty_group_vis()
123 TokenTree::Punct(Punct::new(':', Spacing::Alone)), in test_empty_group_vis()
124 TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())), in test_empty_group_vis()
Dtest_parse_buffer.rs1 use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenStream, TokenTree};
71 TokenTree::Punct(Punct::new('+', Spacing::Alone)), in trailing_empty_none_group()
72 TokenTree::Group(Group::new( in trailing_empty_none_group()
75 TokenTree::Punct(Punct::new('+', Spacing::Alone)), in trailing_empty_none_group()
76 TokenTree::Group(Group::new(Delimiter::None, TokenStream::new())), in trailing_empty_none_group()
79 TokenTree::Group(Group::new(Delimiter::None, TokenStream::new())), in trailing_empty_none_group()
80 TokenTree::Group(Group::new( in trailing_empty_none_group()
82 TokenStream::from_iter(vec![TokenTree::Group(Group::new( in trailing_empty_none_group()
/external/rust/crates/proc-macro-error-attr/src/
Dparse.rs2 use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree};
8 ) -> Result<(Vec<Attribute>, Vec<TokenTree>, TokenTree)> { in parse_input() argument
28 input: &mut Peekable<impl Iterator<Item = TokenTree>>, in parse_next_attr()
31 Some(TokenTree::Punct(ref punct)) if punct.as_char() == '#' => input.next().unwrap(), in parse_next_attr()
36 Some(TokenTree::Group(ref group)) if group.delimiter() == Delimiter::Bracket => { in parse_next_attr()
48 Some(TokenTree::Ident(ident)) => Some(ident), in parse_next_attr()
54 group: TokenTree::Group(group), in parse_next_attr()
59 fn parse_signature(input: &mut Peekable<impl Iterator<Item = TokenTree>>) -> Vec<TokenTree> { in parse_signature()
63 Some(TokenTree::Group(ref group)) if group.delimiter() == Delimiter::Brace => { in parse_signature()
73 pub(crate) shebang: TokenTree,
[all …]
/external/rust/crates/syn/src/
Dtt.rs1 use proc_macro2::{Delimiter, TokenStream, TokenTree};
4 pub struct TokenTreeHelper<'a>(pub &'a TokenTree);
11 (TokenTree::Group(g1), TokenTree::Group(g2)) => { in eq()
34 (TokenTree::Punct(o1), TokenTree::Punct(o2)) => { in eq()
41 (TokenTree::Literal(l1), TokenTree::Literal(l2)) => l1.to_string() == l2.to_string(), in eq()
42 (TokenTree::Ident(s1), TokenTree::Ident(s2)) => s1 == s2, in eq()
53 TokenTree::Group(g) => { in hash()
67 TokenTree::Punct(op) => { in hash()
75 TokenTree::Literal(lit) => (2u8, lit.to_string()).hash(h), in hash()
76 TokenTree::Ident(word) => (3u8, word).hash(h), in hash()
/external/rust/crates/paste/src/
Dlib.rs156 use proc_macro::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
195 (Some(TokenTree::Punct(fst)), Some(TokenTree::Punct(snd))) => { in expand()
203 expanded.extend(iter::once(TokenTree::Group(group))); in expand()
207 Some(TokenTree::Group(group)) => { in expand()
244 expanded.extend(iter::once(TokenTree::Group(group))); in expand()
254 Some(TokenTree::Punct(punct)) => { in expand()
262 expanded.extend(iter::once(TokenTree::Punct(punct))); in expand()
298 (State::Init, TokenTree::Ident(_)) => State::Ident, in is_single_interpolation_group()
299 (State::Init, TokenTree::Literal(_)) => State::Literal, in is_single_interpolation_group()
300 (State::Init, TokenTree::Punct(punct)) if punct.as_char() == '\'' => State::Apostrophe, in is_single_interpolation_group()
[all …]
Dattr.rs3 use proc_macro::{Delimiter, Group, Span, TokenStream, TokenTree};
22 Some(TokenTree::Punct(ref punct)) in expand_attr()
28 Some(TokenTree::Ident(_)) if leading_colons != 1 && leading_path % 3 == 0 => { in expand_attr()
32 Some(TokenTree::Punct(ref punct)) if punct.as_char() == ':' && leading_path % 3 > 0 => { in expand_attr()
36 Some(TokenTree::Punct(ref punct)) in expand_attr()
48 Some(TokenTree::Group(ref group)) in expand_attr()
68 TokenTree::Punct(punct) if punct.as_char() == ',' => { in expand_attr()
97 .chain(iter::once(TokenTree::Group(group))) in expand_attr()
143 fn is_stringlike(token: &TokenTree) -> bool { in is_stringlike()
145 TokenTree::Ident(_) => true, in is_stringlike()
[all …]
Dsegment.rs2 use proc_macro::{token_stream, Delimiter, Ident, Span, TokenTree};
25 Some(TokenTree::Punct(punct)) => punct.as_char() != '>', in parse()
29 TokenTree::Ident(ident) => { in parse()
36 Some(TokenTree::Punct(punct)) => punct.as_char() == '!', in parse()
43 Some(TokenTree::Group(group)) in parse()
59 Some(TokenTree::Literal(lit)) => lit, in parse()
98 TokenTree::Literal(lit) => { in parse()
104 TokenTree::Punct(punct) => match punct.as_char() { in parse()
114 Some(TokenTree::Ident(ident)) => ident, in parse()
116 let span = wrong.as_ref().map_or(colon_span, TokenTree::span); in parse()
[all …]
Derror.rs1 use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
28 TokenTree::Ident(Ident::new("compile_error", self.begin)), in to_compile_error()
29 TokenTree::Punct({ in to_compile_error()
34 TokenTree::Group({ in to_compile_error()
36 TokenStream::from_iter(vec![TokenTree::Literal({ in to_compile_error()
/external/rust/crates/proc-macro2/src/
Dlib.rs205 impl From<TokenTree> for TokenStream {
206 fn from(token: TokenTree) -> Self { in from()
211 impl Extend<TokenTree> for TokenStream {
212 fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, streams: I) { in extend()
225 impl FromIterator<TokenTree> for TokenStream {
226 fn from_iter<I: IntoIterator<Item = TokenTree>>(streams: I) -> Self { in from_iter()
512 pub enum TokenTree { enum
523 impl TokenTree { impl
528 TokenTree::Group(t) => t.span(), in span()
529 TokenTree::Ident(t) => t.span(), in span()
[all …]
/external/rust/crates/rustversion/src/
Dtoken.rs3 use proc_macro::{Delimiter, Group, Ident, Literal, Span, TokenTree};
7 Some(TokenTree::Punct(ref punct)) if punct.as_char() == ch => Ok(()), in parse_punct()
11 .map_or_else(Span::call_site, TokenTree::span); in parse_punct()
19 Some(TokenTree::Punct(punct)) if punct.as_char() == ch => iter.next().map(drop), in parse_optional_punct()
26 Some(TokenTree::Ident(ident)) if ident.to_string() == keyword => { in parse_optional_keyword()
35 Some(TokenTree::Literal(literal)) => Ok(literal), in parse_literal()
39 .map_or_else(Span::call_site, TokenTree::span); in parse_literal()
47 Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Parenthesis => { in parse_paren()
49 Some(TokenTree::Group(group)) => Ok(group), in parse_paren()
63 Some(TokenTree::Group(group)) if group.delimiter() == Delimiter::Parenthesis => { in parse_optional_paren()
[all …]
Dlib.rs165 use proc_macro::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
226 let mut full_args = TokenStream::from(TokenTree::Ident(introducer)); in try_cfg()
228 full_args.extend(std::iter::once(TokenTree::Group(Group::new( in try_cfg()
263 TokenTree::Punct(Punct::new('#', Spacing::Alone)), in try_attr()
264 TokenTree::Group(Group::new( in try_attr()
267 TokenTree::Ident(Ident::new("cfg_attr", Span::call_site())), in try_attr()
268 TokenTree::Group(Group::new( in try_attr()
272 TokenTree::Ident(Ident::new("all", Span::call_site())), in try_attr()
273 TokenTree::Group(Group::new( in try_attr()
277 TokenTree::Punct(Punct::new(',', Spacing::Alone)), in try_attr()
Diter.rs1 use proc_macro::{token_stream, Delimiter, TokenStream, TokenTree};
7 peeked: Option<TokenTree>,
18 pub fn peek(&mut self) -> Option<&TokenTree> { in peek() argument
25 type Item = TokenTree;
35 Some(TokenTree::Group(ref group)) if group.delimiter() == Delimiter::None => { in next()
Dexpr.rs8 use proc_macro::{Ident, Span, TokenTree};
54 Some(TokenTree::Ident(i)) if i.to_string() == "stable" => parse_stable(iter), in parse()
55 Some(TokenTree::Ident(i)) if i.to_string() == "beta" => Ok(Expr::Beta), in parse()
56 Some(TokenTree::Ident(i)) if i.to_string() == "nightly" => parse_nightly(iter), in parse()
57 Some(TokenTree::Ident(i)) if i.to_string() == "since" => parse_since(i, iter), in parse()
58 Some(TokenTree::Ident(i)) if i.to_string() == "before" => parse_before(i, iter), in parse()
59 Some(TokenTree::Ident(i)) if i.to_string() == "not" => parse_not(i, iter), in parse()
60 Some(TokenTree::Ident(i)) if i.to_string() == "any" => parse_any(i, iter), in parse()
61 Some(TokenTree::Ident(i)) if i.to_string() == "all" => parse_all(i, iter), in parse()
65 .map_or_else(Span::call_site, TokenTree::span); in parse()
/external/rust/crates/proc-macro-hack/src/
Dparse.rs4 use proc_macro::{Delimiter, Ident, Span, TokenStream, TokenTree};
31 Some(TokenTree::Group(group)) if group.delimiter() == Brace => { in parse_export()
59 Some(TokenTree::Punct(punct)) if punct.as_char() == ch => { in parse_punct()
64 tt.map_or_else(Span::call_site, TokenTree::span), in parse_punct()
90 Some(TokenTree::Ident(ident)) if ident.to_string() == "as" => { in parse_macro()
101 Some(TokenTree::Ident(ident)) => Ok(ident), in parse_ident()
103 tt.as_ref().map_or_else(Span::call_site, TokenTree::span), in parse_ident()
111 Some(TokenTree::Ident(ident)) if ident.to_string() == kw => Ok(()), in parse_keyword()
113 tt.as_ref().map_or_else(Span::call_site, TokenTree::span), in parse_keyword()
121 Some(TokenTree::Literal(lit)) => lit.to_string().parse().map_err(|_| lit.span()), in parse_int()
[all …]
Diter.rs1 use proc_macro::{token_stream, Delimiter, TokenStream, TokenTree};
7 peeked: Option<TokenTree>,
18 pub fn peek(&mut self) -> Option<&TokenTree> { in peek() argument
25 type Item = TokenTree;
35 Some(TokenTree::Group(ref group)) if group.delimiter() == Delimiter::None => { in next()
Derror.rs1 use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
21 TokenTree::Ident(Ident::new("compile_error", err.span)), in compile_error()
22 TokenTree::Punct({ in compile_error()
27 TokenTree::Group({ in compile_error()
29 TokenStream::from_iter(vec![TokenTree::Literal({ in compile_error()
Dlib.rs164 use proc_macro::{Ident, Punct, Spacing, Span, TokenStream, TokenTree};
327 .map(|_| TokenTree::Punct(Punct::new('!', Spacing::Alone))) in expand_export()
441 #pub_name::TokenTree::Group(group) => group.stream().into_iter(), in expand_define()
450 #pub_name::TokenTree::Group(group) => group.stream().into_iter(), in expand_define()
457 #pub_name::TokenTree::Group(group) => group.stream(), in expand_define()
467 #pub_name::TokenTree::Punct(punct) => { in expand_define()
472 #pub_name::TokenTree::Group(group) => { in expand_define()
485 #pub_name::TokenTree::Ident( in expand_define()
488 #pub_name::TokenTree::Punct( in expand_define()
491 #pub_name::TokenTree::Ident( in expand_define()
[all …]
/external/rust/crates/async-trait/src/
Dreceiver.rs1 use proc_macro2::{Group, Span, TokenStream, TokenTree};
23 TokenTree::Ident(ident) => ident == "Self", in has_self_in_token_stream()
24 TokenTree::Group(group) => has_self_in_token_stream(group.stream()), in has_self_in_token_stream()
37 TokenTree::Ident(ident) => ident == "fn", in contains_fn()
38 TokenTree::Group(group) => contains_fn(group.stream()), in contains_fn()
115 out: &mut Vec<TokenTree>, in visit_token_stream() argument
119 TokenTree::Ident(mut ident) => { in visit_token_stream()
121 out.push(TokenTree::Ident(ident)); in visit_token_stream()
123 TokenTree::Group(group) => { in visit_token_stream()
128 out.push(TokenTree::Group(new)); in visit_token_stream()
/external/rust/crates/proc-macro2/tests/
Dcomments.rs1 use proc_macro2::{Delimiter, Literal, Spacing, TokenStream, TokenTree};
16 TokenTree::Punct(punct) => { in lit_of_doc_comment()
24 TokenTree::Punct(punct) => { in lit_of_doc_comment()
32 TokenTree::Group(group) => { in lit_of_doc_comment()
40 TokenTree::Ident(ident) => assert_eq!(ident.to_string(), "doc"), in lit_of_doc_comment()
44 TokenTree::Punct(punct) => { in lit_of_doc_comment()
51 TokenTree::Literal(literal) => { in lit_of_doc_comment()
/external/rust/crates/serde_derive/src/internals/
Drespan.rs1 use proc_macro2::{Group, Span, TokenStream, TokenTree};
10 fn respan_token(mut token: TokenTree, span: Span) -> TokenTree { in respan_token() argument
11 if let TokenTree::Group(g) = &mut token { in respan_token()

123