pub fn require<P: Parser>(p: &mut P, expect: Token) -> ReportedResult<()> {
    let Spanned {
        value: actual,
        span,
    } = p.peek(0);
    if actual == expect {
        p.bump();
        Ok(())
    } else {
        p.emit(
            DiagBuilder2::error(format!("Expected {}, but found {} instead", expect, actual))
                .span(span),
        );
        Err(Reported)
    }
}
/// Consume a specific token, or emit an error if the next token in the stream
/// does not match the expected one.
Consume a specific token, or emit an error if the next token in the stream
does not match the expected one.
Consume a specific token or emit an error if the next token in the stream does not match the expected one .
pub fn require<P: Parser>(p: &mut P, expect: Token) -> ReportedResult<()> {
    let Spanned {
        value: actual,
        span,
    } = p.peek(0);
    if actual == expect {
        p.bump();
        Ok(())
    } else {
        p.emit(
            DiagBuilder2::error(format!("Expected {}, but found {} instead", expect, actual))
                .span(span),
        );
        Err(Reported)
    }
}
pub fn require < P : Parser > ( p : & mut P , expect : Token ) -> ReportedResult < ( ) > { let Spanned { value : actual , span , } = p . peek ( 0 ) ; if actual == expect { p . bump ( ) ; Ok ( ( ) ) } else { p . emit ( DiagBuilder2 :: error ( format ! ( " " expect actual ) ) . span ( span ) , ) ; Err ( Reported ) } }
Consume a specific token, or emit an error if the next token in the stream
does not match the expected one.
Consume a specific token or emit an error if the next token in the stream does not match the expected one .
p
&mut P
expect
Token
p
&mut P
expect
Token