fn parse_if_expr(
        &mut self,
        start_token: Token<'file>,
    ) -> Result<Term<'file>, Diagnostic<FileSpan>> {
        let condition = self.parse_term(Prec(0))?;
        self.expect_match(Keyword("then"))?;
        let consequent = self.parse_term(Prec(0))?;
        self.expect_match(Keyword("else"))?;
        let alternative = self.parse_term(Prec(0))?;

        let span = FileSpan::merge(start_token.span(), alternative.span());

        Ok(Term::If(
            span,
            Box::new(condition),
            Box::new(consequent),
            Box::new(alternative),
        ))
    }
/// Parse the trailing part of an if expression.
///
/// ```text
/// if-expr ::= term(0) "then" term(0) "else" term(0)
/// ```
Parse the trailing part of an if expression.
Parse the trailing part of an if expression .
fn parse_if_expr(
        &mut self,
        start_token: Token<'file>,
    ) -> Result<Term<'file>, Diagnostic<FileSpan>> {
        let condition = self.parse_term(Prec(0))?;
        self.expect_match(Keyword("then"))?;
        let consequent = self.parse_term(Prec(0))?;
        self.expect_match(Keyword("else"))?;
        let alternative = self.parse_term(Prec(0))?;
        let span = FileSpan::merge(start_token.span(), alternative.span());
        Ok(Term::If(
            span,
            Box::new(condition),
            Box::new(consequent),
            Box::new(alternative),
        ))
    }
fn parse_if_expr ( & mut self , start_token : Token < ' file > , ) -> Result < Term < ' file > , Diagnostic < FileSpan > > { let condition = self . parse_term ( Prec ( 0 ) ) ? ; self . expect_match ( Keyword ( " " ) ) ? ; let consequent = self . parse_term ( Prec ( 0 ) ) ? ; self . expect_match ( Keyword ( " " ) ) ? ; let alternative = self . parse_term ( Prec ( 0 ) ) ? ; let span = FileSpan :: merge ( start_token . span ( ) , alternative . span ( ) ) ; Ok ( Term :: If ( span , Box :: new ( condition ) , Box :: new ( consequent ) , Box :: new ( alternative ) , ) ) }
Parse the trailing part of an if expression.
Parse the trailing part of an if expression .
&mut self
start_token
Token<'file>
&mut self
start_token
Token<'file>