/// Try to parse a delay mechanism.
///
/// ```text
/// "transport" | ["reject" expr] "inertial"
/// ```
Try to parse a delay mechanism.
Try to parse a delay mechanism .
pub fn try_delay_mech<P: Parser>(p: &mut P) -> ReportedResult<Option<Spanned<ast::DelayMech>>> {
    Ok(match p.peek(0).value {
        Keyword(Kw::Transport) => {
            p.bump();
            Some(Spanned::new(ast::DelayMech::Transport, p.last_span()))
        }
        Keyword(Kw::Inertial) => {
            p.bump();
            Some(Spanned::new(ast::DelayMech::Inertial, p.last_span()))
        }
        Keyword(Kw::Reject) => {
            p.bump();
            let sp = p.last_span();
            let expr = parse_expr(p)?;
            require(p, Keyword(Kw::Inertial))?;
            Some(Spanned::new(ast::DelayMech::InertialReject(expr), sp))
        }
        _ => return Ok(None),
    })
}
pub fn try_delay_mech < P : Parser > ( p : & mut P ) -> ReportedResult < Option < Spanned < ast :: DelayMech > > > { Ok ( match p . peek ( 0 ) . value { Keyword ( Kw :: Transport ) => { p . bump ( ) ; Some ( Spanned :: new ( ast :: DelayMech :: Transport , p . last_span ( ) ) ) } Keyword ( Kw :: Inertial ) => { p . bump ( ) ; Some ( Spanned :: new ( ast :: DelayMech :: Inertial , p . last_span ( ) ) ) } Keyword ( Kw :: Reject ) => { p . bump ( ) ; let sp = p . last_span ( ) ; let expr = parse_expr ( p ) ? ; require ( p , Keyword ( Kw :: Inertial ) ) ? ; Some ( Spanned :: new ( ast :: DelayMech :: InertialReject ( expr ) , sp ) ) } _ => return Ok ( None ) , } ) }
Try to parse a delay mechanism.
Try to parse a delay mechanism .
p
&mut P