Parses a range pattern expression. # Example Input ```text 10..20 0..=100 ..10 5.. ``` This parses any valid Rust range expression.
(input: syn::parse::ParseStream)
| 26 | /// |
| 27 | /// This parses any valid Rust range expression. |
| 28 | fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { |
| 29 | let expr: syn::Expr = input.parse()?; |
| 30 | |
| 31 | // Verify this is actually a range expression |
| 32 | if !matches!(expr, syn::Expr::Range(_)) { |
| 33 | return Err(syn::Error::new_spanned( |
| 34 | &expr, |
| 35 | "Expected a range expression", |
| 36 | )); |
| 37 | } |
| 38 | |
| 39 | Ok(PatternRange { |
| 40 | node_id: next_node_id(), |
| 41 | expr, |
| 42 | }) |
| 43 | } |
| 44 | } |
nothing calls this directly
no test coverage detected