fn parse_intro_param(&mut self) -> Result<IntroParam<'file>, Diagnostic<FileSpan>> {
        if let Some(start_token) = self.try_match(TokenKind::Open(DelimKind::Brace)) {
            let is_instance = self.try_match(TokenKind::Open(DelimKind::Brace)).is_some();

            let label = self.expect_identifier()?;
            let term = match self.try_match(TokenKind::Equals) {
                Some(_) => Some(self.parse_pattern(Prec(0))?),
                None => None,
            };

            let end_token = if is_instance {
                self.expect_match(TokenKind::Close(DelimKind::Brace))?;
                self.expect_match(TokenKind::Close(DelimKind::Brace))?
            } else {
                self.expect_match(TokenKind::Close(DelimKind::Brace))?
            };

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

            Ok(if is_instance {
                IntroParam::Instance(span, label, term)
            } else {
                IntroParam::Implicit(span, label, term)
            })
        } else {
            Ok(IntroParam::Explicit(self.parse_pattern(Prec(0))?))
        }
    }
/// Parse a function introduction parameter.
///
/// ```text
/// intro-param ::= pattern(0)
///               | "{" IDENTIFIER ("=" pattern(0))? "}"
///               | "{{" IDENTIFIER ("=" pattern(0))? "}}"
/// ```
Parse a function introduction parameter.
Parse a function introduction parameter .
fn parse_intro_param(&mut self) -> Result<IntroParam<'file>, Diagnostic<FileSpan>> {
        if let Some(start_token) = self.try_match(TokenKind::Open(DelimKind::Brace)) {
            let is_instance = self.try_match(TokenKind::Open(DelimKind::Brace)).is_some();
            let label = self.expect_identifier()?;
            let term = match self.try_match(TokenKind::Equals) {
                Some(_) => Some(self.parse_pattern(Prec(0))?),
                None => None,
            };
            let end_token = if is_instance {
                self.expect_match(TokenKind::Close(DelimKind::Brace))?;
                self.expect_match(TokenKind::Close(DelimKind::Brace))?
            } else {
                self.expect_match(TokenKind::Close(DelimKind::Brace))?
            };
            let span = FileSpan::merge(start_token.span(), end_token.span());
            Ok(if is_instance {
                IntroParam::Instance(span, label, term)
            } else {
                IntroParam::Implicit(span, label, term)
            })
        } else {
            Ok(IntroParam::Explicit(self.parse_pattern(Prec(0))?))
        }
    }
fn parse_intro_param ( & mut self ) -> Result < IntroParam < ' file > , Diagnostic < FileSpan > > { if let Some ( start_token ) = self . try_match ( TokenKind :: Open ( DelimKind :: Brace ) ) { let is_instance = self . try_match ( TokenKind :: Open ( DelimKind :: Brace ) ) . is_some ( ) ; let label = self . expect_identifier ( ) ? ; let term = match self . try_match ( TokenKind :: Equals ) { Some ( _ ) => Some ( self . parse_pattern ( Prec ( 0 ) ) ? ) , None => None , } ; let end_token = if is_instance { self . expect_match ( TokenKind :: Close ( DelimKind :: Brace ) ) ? ; self . expect_match ( TokenKind :: Close ( DelimKind :: Brace ) ) ? } else { self . expect_match ( TokenKind :: Close ( DelimKind :: Brace ) ) ? } ; let span = FileSpan :: merge ( start_token . span ( ) , end_token . span ( ) ) ; Ok ( if is_instance { IntroParam :: Instance ( span , label , term ) } else { IntroParam :: Implicit ( span , label , term ) } ) } else { Ok ( IntroParam :: Explicit ( self . parse_pattern ( Prec ( 0 ) ) ? ) ) } }
Parse a function introduction parameter.
Parse a function introduction parameter .
&mut self
&mut self