| /linux/rust/syn/ |
| H A D | item.rs | 927 use crate::parse::discouraged::Speculative as _; 928 use crate::parse::{Parse, ParseBuffer, ParseStream}; 940 impl Parse for Item { 941 fn parse(input: ParseStream) -> Result<Self> { in parse() method 954 let vis: Visibility = ahead.parse()?; in parse_rest_of_item() 959 let vis: Visibility = input.parse()?; in parse_rest_of_item() 960 let sig: Signature = input.parse()?; in parse_rest_of_item() 962 input.parse::<Token![;]>()?; in parse_rest_of_item() 968 ahead.parse::<Token![extern]>()?; in parse_rest_of_item() 971 input.parse().map(Item::ExternCrate) in parse_rest_of_item() [all …]
|
| H A D | parse.rs | 18 //! enums (not shown) and structs, then provide implementations of the [`Parse`] 19 //! trait to parse these syntax tree data structures from a token stream. 21 //! Once `Parse` impls have been defined, they can be called conveniently from a 25 //! pointing out the exact token that triggered the failure to parse. 34 //! use syn::parse::{Parse, ParseStream}; 51 //! impl Parse for Item { 52 //! fn parse(input: ParseStream) -> Result<Self> { 55 //! input.parse().map(Item::Struct) 57 //! input.parse().map(Item::Enum) 64 //! impl Parse for ItemStruct { [all …]
|
| H A D | ty.rs | 284 use crate::parse::{Parse, ParseStream}; 298 impl Parse for Type { 299 fn parse(input: ParseStream) -> Result<Self> { in parse() method 328 let mut group: TypeGroup = input.parse()?; in ambig_ty() 351 *arguments = PathArguments::AngleBracketed(input.parse()?); in ambig_ty() 365 lifetimes = input.parse()?; in ambig_ty() 393 elem: Box::new(Type::TraitObject(content.parse()?)), in ambig_ty() 403 ..content.parse()? in ambig_ty() 405 while let Some(plus) = input.parse()? { in ambig_ty() 421 let mut first: Type = content.parse()?; in ambig_ty() [all …]
|
| H A D | parse_quote.rs | 8 /// The return type can be any syntax tree node that implements the [`Parse`] 11 /// [`Parse`]: crate::parse::Parse 53 /// This macro can parse the following additional types as a special case even 54 /// though they do not implement the `Parse` trait. 77 /// Panics if the tokens fail to parse as the expected syntax tree type. The 121 // Can parse any type that implements Parse. 124 use crate::parse::{Parse, ParseStream, Parser}; 130 pub fn parse<T: ParseQuote>(token_stream: TokenStream) -> T { in parse() function 131 let parser = T::parse; in parse() 140 fn parse(input: ParseStream) -> Result<Self>; in parse() method [all …]
|
| H A D | op.rs | 85 use crate::parse::{Parse, ParseStream}; 88 impl Parse for BinOp { 89 fn parse(input: ParseStream) -> Result<Self> { in parse() method 91 input.parse().map(BinOp::AddAssign) in parse() 93 input.parse().map(BinOp::SubAssign) in parse() 95 input.parse().map(BinOp::MulAssign) in parse() 97 input.parse().map(BinOp::DivAssign) in parse() 99 input.parse().map(BinOp::RemAssign) in parse() 101 input.parse().map(BinOp::BitXorAssign) in parse() 103 input.parse().map(BinOp::BitAndAssign) in parse() [all …]
|
| H A D | group.rs | 4 use crate::parse::ParseBuffer; 88 let nested = crate::parse::advance_step_cursor(cursor, content); in parse_delimited() 89 let unexpected = crate::parse::get_unexpected(input); in parse_delimited() 90 let content = crate::parse::new_parse_buffer(scope, nested, unexpected); in parse_delimited() 104 /// Parse a set of parentheses and expose their content to subsequent parsers. 112 /// use syn::parse::{Parse, ParseStream}; 115 /// // Parse a simplified tuple struct syntax like: 126 /// impl Parse for TupleStruct { 127 /// fn parse(input: ParseStream) -> Result<Self> { 130 /// struct_token: input.parse()?, [all …]
|
| H A D | lookahead.rs | 11 /// Support for checking the next token in a stream to decide how to parse. 20 /// [`ParseStream::peek`]: crate::parse::ParseBuffer::peek 21 /// [`ParseStream::lookahead1`]: crate::parse::ParseBuffer::lookahead1 30 /// use syn::parse::{Parse, ParseStream}; 49 /// impl Parse for GenericParam { 50 /// fn parse(input: ParseStream) -> Result<Self> { 53 /// input.parse().map(GenericParam::Type) 55 /// input.parse().map(GenericParam::Lifetime) 57 /// input.parse().map(GenericParam::Const) 91 /// Looks at the next token in the parse stream to determine whether it [all …]
|
| H A D | derive.rs | 76 use crate::parse::{Parse, ParseStream}; 82 impl Parse for DeriveInput { 83 fn parse(input: ParseStream) -> Result<Self> { in parse() method 85 let vis = input.parse::<Visibility>()?; in parse() 89 let struct_token = input.parse::<Token![struct]>()?; in parse() 90 let ident = input.parse::<Ident>()?; in parse() 91 let generics = input.parse::<Generics>()?; in parse() 108 let enum_token = input.parse::<Token![enum]>()?; in parse() 109 let ident = input.parse::<Ident>()?; in parse() 110 let generics = input.parse::<Generics>()?; in parse() [all …]
|
| H A D | expr.rs | 17 use crate::parse::ParseStream; 747 /// An alternative to the primary `Expr::parse` parser (from the [`Parse`] 751 /// [`Parse`]: crate::parse::Parse 772 /// We would want to parse the above using `Expr::parse` after the `=` 791 /// For that reason we would want to parse if-conditions using 797 /// at various syntactic positions is fairly arbitrary. Really either parse 834 /// An alternative to the primary `Expr::parse` parser (from the [`Parse`] 840 /// [`Parse`]: crate::parse::Parse 881 /// placement of expression boundaries, and parse as `Expr::If`, with the 896 /// Returns whether the next token in the parse stream is one that might [all …]
|
| H A D | generics.rs | 532 use crate::parse::{Parse, ParseStream}; 540 impl Parse for Generics { 541 fn parse(input: ParseStream) -> Result<Self> { in parse() method 546 let lt_token: Token![<] = input.parse()?; in parse() 559 ..input.parse()? in parse() 564 ..input.parse()? in parse() 569 ..input.parse()? in parse() 587 let punct = input.parse()?; in parse() 591 let gt_token: Token![>] = input.parse()?; in parse() 603 impl Parse for GenericParam { [all …]
|
| H A D | discouraged.rs | 7 use crate::parse::{inner_unexpected, ParseBuffer, Unexpected}; 16 /// Advance this parse stream to the position of a forked parse stream. 19 /// parse stream, perform some speculative parsing, then join the original 24 /// generate useful errors. That said, it is often the only way to parse 26 /// is that when the fork fails to parse an `A`, it's impossible to tell 49 /// `advance_to`, we can avoid having to parse the speculatively parsed 53 /// `Parse` implementation for `PathSegment`: 57 /// use syn::parse::discouraged::Speculative; 58 /// # use syn::parse::{Parse, ParseStream}; 78 /// impl Parse for PathSegment { [all …]
|
| H A D | mac.rs | 6 use crate::parse::{Parse, ParseStream, Parser}; 56 /// Parse the tokens within the macro invocation's delimiters into a syntax 67 /// use syn::parse::{Error, Parse, ParseStream, Result}; 80 /// impl Parse for FormatArgs { 81 /// fn parse(input: ParseStream) -> Result<Self> { 86 /// format_string = input.parse()?; 88 /// input.parse::<Token![,]>()?; 95 /// input.parse::<Token![=]>()?; 96 /// let value: Expr = input.parse()?; 101 /// input.parse::<Token![,]>()?; [all …]
|
| H A D | parse_macro_input.rs | 3 /// Parse the input TokenStream of a macro, triggering a compile error if the 4 /// tokens fail to parse. 6 /// Refer to the [`parse` module] documentation for more details about parsing 9 /// [`parse` module]: mod@crate::parse 25 /// use syn::parse::{Parse, ParseStream}; 31 /// impl Parse for MyMacroInput { 32 /// fn parse(input: ParseStream) -> Result<Self> { 56 /// [`Parser` trait]: crate::parse::Parser 63 /// # use syn::parse::ParseStream; 96 /// match syn::parse::<$Type>($variable) { [all …]
|
| H A D | path.rs | 297 use crate::parse::{Parse, ParseStream}; 311 impl Parse for Path { 312 fn parse(input: ParseStream) -> Result<Self> { in parse() method 318 impl Parse for GenericArgument { 319 fn parse(input: ParseStream) -> Result<Self> { in parse() method 321 return Ok(GenericArgument::Lifetime(input.parse()?)); in parse() 328 let mut argument: Type = input.parse()?; in parse() 340 if let Some(eq_token) = input.parse::<Option<Token![=]>>()? { in parse() 360 ty: input.parse()?, in parse() 366 if let Some(colon_token) = input.parse::<Option<Token![:]>>()? { in parse() [all …]
|
| H A D | attr.rs | 12 use crate::parse::{Parse, ParseStream, Parser}; 84 /// This type does not implement the [`Parse`] trait and thus cannot be 85 /// parsed directly by [`ParseStream::parse`]. Instead use 88 /// which you intend to parse. 90 /// [`Parse`]: crate::parse::Parse 91 /// [`ParseStream::parse`]: crate::parse::ParseBuffer::parse 92 /// [`ParseStream::call`]: crate::parse::ParseBuffer::call 96 /// use syn::parse::{Parse, ParseStream}; 109 /// impl Parse for UnitStruct { 110 /// fn parse(input: ParseStream) -> Result<Self> { [all …]
|
| H A D | custom_keyword.rs | 23 /// - [Parsing] — `input.parse::<kw::whatever>()?` 31 /// [Peeking]: crate::parse::ParseBuffer::peek 32 /// [Parsing]: crate::parse::ParseBuffer::parse 50 /// use syn::parse::{Parse, ParseStream}; 70 /// impl Parse for Argument { 71 /// fn parse(input: ParseStream) -> Result<Self> { 75 /// bool_token: input.parse::<kw::bool>()?, 76 /// eq_token: input.parse()?, 77 /// value: input.parse()?, 81 /// str_token: input.parse::<kw::str>()?, [all …]
|
| H A D | stmt.rs | 43 /// A local `let` binding: `let x: u64 = s.parse()?;`. 58 /// `LocalInit` represents `= s.parse()?` in `let x: u64 = s.parse()?` and 91 use crate::parse::discouraged::Speculative as _; 92 use crate::parse::{Parse, ParseStream}; 103 /// Parse the body of a block as zero or more statements, possibly 110 /// use syn::parse::{Parse, ParseStream}; 112 /// // Parse a function with no generics or parameter list. 127 /// impl Parse for MiniFunction { 128 /// fn parse(input: ParseStream) -> Result<Self> { 130 /// let fn_token: Token![fn] = input.parse()?; [all …]
|
| H A D | data.rs | 250 use crate::parse::discouraged::Speculative as _; 251 use crate::parse::{Parse, ParseStream}; 260 impl Parse for Variant { 261 fn parse(input: ParseStream) -> Result<Self> { in parse() method 263 let _visibility: Visibility = input.parse()?; in parse() 264 let ident: Ident = input.parse()?; in parse() 266 Fields::Named(input.parse()?) in parse() 268 Fields::Unnamed(input.parse()?) in parse() 273 let eq_token: Token![=] = input.parse()?; in parse() 275 let discriminant: Expr = input.parse()?; in parse() [all …]
|
| H A D | token.rs | 36 //! Keywords and punctuation can be parsed through the [`ParseStream::parse`] 40 //! [`ParseStream::parse`]: crate::parse::ParseBuffer::parse() 47 //! use syn::parse::{Parse, ParseStream}; 51 //! // Parse the ItemStatic struct shown above. 52 //! impl Parse for ItemStatic { 53 //! fn parse(input: ParseStream) -> Result<Self> { 55 //! # fn parse(input: ParseStream) -> Result<ItemStatic> { 58 //! vis: input.parse()?, 59 //! static_token: input.parse()?, 60 //! mutability: input.parse()?, [all …]
|
| H A D | pat.rs | 251 use crate::parse::{Parse, ParseBuffer, ParseStream}; 265 /// Parse a pattern that does _not_ involve `|` at the top level. 334 /// Parse a pattern, possibly involving `|`, but not a leading `|`. 339 /// Parse a pattern, possibly involving `|`, possibly including a 382 let leading_vert: Option<Token![|]> = input.parse()?; in parse_multi_with_leading_vert() 388 impl Parse for PatType { 389 fn parse(input: ParseStream) -> Result<Self> { in parse() method 393 colon_token: input.parse()?, in parse() 394 ty: input.parse()?, in parse() 407 let punct = input.parse()?; in multi_pat_impl() [all …]
|
| H A D | lit.rs | 6 use crate::parse::{Parse, Parser}; 152 /// Parse a syntax tree node from the content of this string literal. 174 /// return lit_str.parse().map(Some); 185 pub fn parse<T: Parse>(&self) -> Result<T> { in parse() method 186 self.parse_with(T::parse) in parse() 206 /// // Parse a string literal like "a::b::c" into a Path, not allowing 239 // Parse string literal into a token stream with every span equal to the in parse_with() 245 let result = crate::parse::parse_scoped(parser, span, tokens)?; in parse_with() 418 Some(parse) => parse, in new() 422 let mut token: Literal = repr.parse().unwrap(); in new() [all …]
|
| /linux/tools/testing/selftests/bpf/ |
| H A D | test_bpftool_synctypes.py | 26 @reader: a pointer to the open file to parse 34 @start_marker: regex marking the beginning of a structure to parse 42 def parse(self, pattern, end_marker): member in BlockParser 44 Parse a block and return a set of values. Values to extract must be 47 @end_marker: regex marking the end of the block to parse 62 @reader: a pointer to the open file to parse 63 @array_name: name of the array to parse 78 def parse(self): member in ArrayParser 80 Parse a block and return data as a dictionary. Items to extract must be 98 def parse(self, pattern, end_marker): member in InlineListParser [all …]
|
| /linux/lib/ |
| H A D | decompress_unlzo.c | 44 u8 *parse = input; in parse_header() local 50 * Then it is possible to parse several fields until the minimum in parse_header() 58 if (*parse++ != lzop_magic[l]) in parse_header() 64 version = get_unaligned_be16(parse); in parse_header() 65 parse += 7; in parse_header() 67 parse++; in parse_header() 68 if (get_unaligned_be32(parse) & HEADER_HAS_FILTER) in parse_header() 69 parse += 8; /* flags + filter info */ in parse_header() 71 parse += 4; /* flags */ in parse_header() 79 if (end - parse < 8 + 1 + 4) in parse_header() [all …]
|
| /linux/drivers/net/ethernet/intel/ice/ |
| H A D | ice_parser.c | 12 * ice_parser_sect_item_get - parse an item from a section 85 * @parse_item: the function to parse the item 169 dev_info(dev, "parse graph key builder:\n"); in ice_imem_pg_kb_dump() 232 * ice_imem_bm_init - parse 4 bits of Boost Main 248 * ice_imem_bkb_init - parse 10 bits of Boost Main Build 263 * ice_imem_npkb_init - parse 18 bits of Next Protocol Key Build 285 * ice_imem_pgkb_init - parse 35 bits of Parse Graph Key Build 286 * @kb: pointer to the Parse Graph Key Build structure 287 * @data: Parse Graph Key Build data to be parsed 328 * ice_imem_alu_init - parse 96 bits of ALU entry [all …]
|
| /linux/drivers/pcmcia/ |
| H A D | pcmcia_cis.c | 31 * @parse: buffer where the tuple shall be parsed (or NULL, if no parse) 33 * pccard_read_tuple() reads out one tuple and attempts to parse it 36 cisdata_t code, void *parse) in pccard_read_tuple() argument 60 ret = pcmcia_parse_tuple(&tuple, parse); in pccard_read_tuple() 72 * @parse: buffer where the tuple shall be parsed (or NULL, if no parse) 75 * gets passed the raw tuple, the paresed tuple (if @parse is 83 cisdata_t code, cisparse_t *parse, void *priv_data, in pccard_loop_tuple() argument 85 cisparse_t *parse, in pccard_loop_tuple() 109 if (parse) in pccard_loop_tuple() 110 if (pcmcia_parse_tuple(&tuple, parse)) in pccard_loop_tuple() [all …]
|