syn
syn copied to clipboard
Parser for Rust source code
I need to check if I'm at the end of the input or in front of some delimiter, to parse in a certain way. Checking for the delimiter works perfectly...
Per title. `index` and `index_mut` doesn't fit the bill as both of them do not (and should not) return an `Option`, however it still makes sense to have an API...
Currently, let_else will be treated as `ExprVerbatim`: ``` [tests/test_stmt.rs:108] &stmt = Ok( Semi( Verbatim( TokenStream [ Ident { sym: let, }, Ident { sym: Some, }, Group { delimiter: Parenthesis,...
Should `~const` be a variant of `syn::TraitBoundModifier` among with `None` and `Maybe(Token![?])`?
In combination, ```rust #![feature(const_trait_impl)] #![feature(const_fn_trait_bound)] ``` Nightly features () allow constantly implement traits. According to [clarfonthey](https://github.com/clarfonthey) > The variance is mostly in terms of what implementations of traits are okay...
```rust let _ = || 0 .. 0 .. None.unwrap(); ``` Rustc parses this as `(|| (0..0))..None.unwrap()` which is of type `Range Range>`. Syn parses `|| ((0..0)..None.unwrap())` which is `Range`.
The `ToTokens` impl for `Generics` does not tokenize the contained `WhereClause` - instead, any items which contain a `Generics` (e.g. `ItemStruct`) explicitly tokenize the `WhereClause` in the correct position. This...
This is a small issue, but I think method is not the same as associated fn. `ImplItem::Method` and `TraitItem::Method` actually should be named something else... Please take this into consideration...
It's possible to parse `"lit 1" | "lit 2" => todo!()` into `syn::Arm`, but parsing `"lit 1" | "lit 2"` into `syn::Pat` fails with `unexpected token`. [Playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a28d125f5714ab4f45a194d1756a465c)
Part of RFC 2102. - RFC: https://github.com/rust-lang/rfcs/pull/2102 - Tracking issue: https://github.com/rust-lang/rust/issues/49804 - Example usage: https://github.com/rust-lang/rust/blob/e3c71f1e33b026dea7c9ca7c1c4554e63f56a0da/src/test/pretty/anonymous-types.rs ```rust type A = struct { field: u8 }; ```
In [syn::group](https://github.com/dtolnay/syn/blob/master/src/group.rs), `parse_group()` is the only function that is not included in a macro to parse groups with `Delimiter::None` and that is `pub(crate)`. Is there another way to access this...