Lowest precedence, branches split on the pipe. */
(&mut self)
| 45 | |
| 46 | /* Lowest precedence, branches split on the pipe. */ |
| 47 | fn alternation(&mut self) -> Result<Node, ParseError> { |
| 48 | let mut branches = Vec::new(); |
| 49 | branches.push(self.concat()?); |
| 50 | while self.peek() == Some('|') { |
| 51 | self.bump(); |
| 52 | branches.push(self.concat()?); |
| 53 | } |
| 54 | if branches.len() == 1 { Ok(branches.pop().unwrap()) } |
| 55 | else { Ok(Node::Alt(branches)) } |
| 56 | } |
| 57 | |
| 58 | /* A run of quantified atoms until pipe, close paren, or end. */ |
| 59 | fn concat(&mut self) -> Result<Node, ParseError> { |