cleaner match and returning
This commit is contained in:
parent
2531b4ac0d
commit
32d068649c
|
@ -221,11 +221,11 @@ impl<'a> Parser<'a> {
|
|||
match *self.peek()? {
|
||||
Symbol::Eq => {
|
||||
self.next();
|
||||
return Ok(Node::new(NodeOp::Assign, vec![lhs, self.parse_expr()?]));
|
||||
Ok(Node::new(NodeOp::Assign, vec![lhs, self.parse_expr()?]))
|
||||
}
|
||||
Symbol::Term => {
|
||||
self.next();
|
||||
return Ok(lhs);
|
||||
Ok(lhs)
|
||||
}
|
||||
Symbol::Id(_) | Symbol::Int(_) => {
|
||||
loop {
|
||||
|
@ -238,12 +238,10 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
self.expect(Symbol::Term, ParseError::ExpectedTerm)?;
|
||||
self.next();
|
||||
return Ok(lhs);
|
||||
Ok(lhs)
|
||||
}
|
||||
_ => (),
|
||||
_ => Err(ParseError::Eof),
|
||||
}
|
||||
|
||||
Err(ParseError::Eof)
|
||||
}
|
||||
|
||||
pub fn parse(&mut self) -> ParseResult<Vec<Node>> {
|
||||
|
|
Loading…
Reference in New Issue