(input: syn::parse::ParseStream)
| 40 | |
| 41 | impl Parse for ComparisonOp { |
| 42 | fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { |
| 43 | // Check compound operators before their single-char prefixes, since |
| 44 | // peek(Token![<]) also matches the `<` in `<=`. |
| 45 | if input.peek(Token![<=]) { |
| 46 | Ok(ComparisonOp::LessEqual(input.parse()?)) |
| 47 | } else if input.peek(Token![<]) { |
| 48 | Ok(ComparisonOp::Less(input.parse()?)) |
| 49 | } else if input.peek(Token![>=]) { |
| 50 | Ok(ComparisonOp::GreaterEqual(input.parse()?)) |
| 51 | } else if input.peek(Token![>]) { |
| 52 | Ok(ComparisonOp::Greater(input.parse()?)) |
| 53 | } else if input.peek(Token![==]) { |
| 54 | Ok(ComparisonOp::Equal(input.parse()?)) |
| 55 | } else if input.peek(Token![!=]) { |
| 56 | Ok(ComparisonOp::NotEqual(input.parse()?)) |
| 57 | } else { |
| 58 | Err(input.error("expected comparison operator (<, <=, >, >=, ==, !=)")) |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | impl Parse for PatternComparison { |
nothing calls this directly
no test coverage detected