1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::ast::{Else, ExprBlock};
use crate::error::{ParseError, Result};
use crate::parser::Parser;
use crate::traits::Parse;
use runestick::unit::Span;
#[derive(Debug, Clone)]
pub struct ExprElse {
pub else_: Else,
pub block: Box<ExprBlock>,
}
impl ExprElse {
pub fn span(&self) -> Span {
self.else_.span().join(self.block.span())
}
}
impl Parse for ExprElse {
fn parse(parser: &mut Parser) -> Result<Self, ParseError> {
Ok(ExprElse {
else_: parser.parse()?,
block: Box::new(parser.parse()?),
})
}
}