pub fn parse_block_comp_decl_item<P: Parser>(p: &mut P) -> ReportedResult<ast::DeclItem> {
    match (p.peek(0).value, p.peek(1).value) {
        // vunit_binding_ind := "use" "vunit" ...
        (Keyword(Kw::Use), Keyword(Kw::Vunit)) => {
            parse_vunit_binding_ind(p).map(|i| ast::DeclItem::VunitBindInd(i))
        }
        // use_clause := "use" ...
        (Keyword(Kw::Use), _) => {
            let span = p.peek(1).span;
            parse_use_clause(p).map(|i| ast::DeclItem::UseClause(span, i))
        }
        // block_comp_config := "for" ...
        (Keyword(Kw::For), _) => parse_block_comp_config(p).map(|i| ast::DeclItem::BlockCompCfg(i)),
        // attr_spec := "attribute" ...
        (Keyword(Kw::Attribute), _) => parse_attr_decl(p).map(|i| ast::DeclItem::AttrDecl(i)),
        // group_decl := "group" ...
        (Keyword(Kw::Group), _) => parse_group_decl(p).map(|i| ast::DeclItem::GroupDecl(i)),

        (wrong, _) => {
            let sp = p.peek(0).span;
            p.emit(
                DiagBuilder2::error(format!(
                    "Expected configuration item, found {} instead",
                    wrong
                ))
                .span(sp),
            );
            Err(Reported)
        }
    }
}
/// Parse a block or component configuration declarative item.
///
/// ```text
/// block_decl_item
///   := use_clause
///   := attr_spec
///   := group_decl
///   := vunit_binding_ind
///   := block_comp_config
/// ```
Parse a block or component configuration declarative item.
Parse a block or component configuration declarative item .
pub fn parse_block_comp_decl_item<P: Parser>(p: &mut P) -> ReportedResult<ast::DeclItem> {
    match (p.peek(0).value, p.peek(1).value) {
        // vunit_binding_ind := "use" "vunit" ...
        (Keyword(Kw::Use), Keyword(Kw::Vunit)) => {
            parse_vunit_binding_ind(p).map(|i| ast::DeclItem::VunitBindInd(i))
        }
        // use_clause := "use" ...
        (Keyword(Kw::Use), _) => {
            let span = p.peek(1).span;
            parse_use_clause(p).map(|i| ast::DeclItem::UseClause(span, i))
        }
        // block_comp_config := "for" ...
        (Keyword(Kw::For), _) => parse_block_comp_config(p).map(|i| ast::DeclItem::BlockCompCfg(i)),
        // attr_spec := "attribute" ...
        (Keyword(Kw::Attribute), _) => parse_attr_decl(p).map(|i| ast::DeclItem::AttrDecl(i)),
        // group_decl := "group" ...
        (Keyword(Kw::Group), _) => parse_group_decl(p).map(|i| ast::DeclItem::GroupDecl(i)),
        (wrong, _) => {
            let sp = p.peek(0).span;
            p.emit(
                DiagBuilder2::error(format!(
                    "Expected configuration item, found {} instead",
                    wrong
                ))
                .span(sp),
            );
            Err(Reported)
        }
    }
}
pub fn parse_block_comp_decl_item < P : Parser > ( p : & mut P ) -> ReportedResult < ast :: DeclItem > { match ( p . peek ( 0 ) . value , p . peek ( 1 ) . value ) { // vunit_binding_ind := "use" "vunit" ... ( Keyword ( Kw :: Use ) , Keyword ( Kw :: Vunit ) ) => { parse_vunit_binding_ind ( p ) . map ( | i | ast :: DeclItem :: VunitBindInd ( i ) ) } // use_clause := "use" ... ( Keyword ( Kw :: Use ) , _ ) => { let span = p . peek ( 1 ) . span ; parse_use_clause ( p ) . map ( | i | ast :: DeclItem :: UseClause ( span , i ) ) } // block_comp_config := "for" ... ( Keyword ( Kw :: For ) , _ ) => parse_block_comp_config ( p ) . map ( | i | ast :: DeclItem :: BlockCompCfg ( i ) ) , // attr_spec := "attribute" ... ( Keyword ( Kw :: Attribute ) , _ ) => parse_attr_decl ( p ) . map ( | i | ast :: DeclItem :: AttrDecl ( i ) ) , // group_decl := "group" ... ( Keyword ( Kw :: Group ) , _ ) => parse_group_decl ( p ) . map ( | i | ast :: DeclItem :: GroupDecl ( i ) ) , ( wrong , _ ) => { let sp = p . peek ( 0 ) . span ; p . emit ( DiagBuilder2 :: error ( format ! ( " " wrong ) ) . span ( sp ) , ) ; Err ( Reported ) } } }
Parse a block or component configuration declarative item.
Parse a block or component configuration declarative item .
p
&mut P
p
&mut P