Parse the contents of a `[...]` subscript: either a single index or a range (`a..b`, `a..=b`, `a..`, `..b`, `..`). Brackets are consumed by the caller.
(&mut self)
| 971 | rvalue: Box::new(rvalue), |
| 972 | }) |
| 973 | } else { |
| 974 | Ok(left) |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | fn parse_or(&mut self) -> Result<Expression, ParserError> { |
| 979 | let mut expr = self.parse_and()?; |
| 980 | while self.match_or() { |
| 981 | self.consume_terminators(); |
| 982 | let right = self.parse_and()?; |
| 983 | expr = Expression::Binary { |
| 984 | op: BinaryOp::Or, |
| 985 | left: Box::new(expr), |
| 986 | right: Box::new(right), |
| 987 | }; |
| 988 | } |
| 989 | Ok(expr) |
| 990 | } |
| 991 | |
| 992 | fn parse_and(&mut self) -> Result<Expression, ParserError> { |
| 993 | let mut expr = self.parse_equality()?; |
| 994 | while self.match_and() { |
| 995 | self.consume_terminators(); |
| 996 | let right = self.parse_equality()?; |
| 997 | expr = Expression::Binary { |
| 998 | op: BinaryOp::And, |
| 999 | left: Box::new(expr), |
| 1000 | right: Box::new(right), |
| 1001 | }; |
| 1002 | } |
| 1003 | Ok(expr) |
| 1004 | } |
| 1005 | |
| 1006 | // Bitwise operators bind tighter than the comparisons (as in Rust, unlike C), |
| 1007 | // so `flags & MASK == 0` is `(flags & MASK) == 0`. |
| 1008 | fn parse_bitwise_or(&mut self) -> Result<Expression, ParserError> { |
| 1009 | let mut expr = self.parse_bitwise_xor()?; |
no test coverage detected