use super::{ module::inputs_list, module::PortDecl, tokens::{token, TokenKind as tk, TokenSpan}, typename, IResult, Span, }; use nom::sequence::delimited; use nom::sequence::preceded; use nom::sequence::tuple; use nom::{ combinator::{cut, map}, multi::many0, }; #[derive(Debug)] pub struct CombBlock<'a> { pub name: Span<'a>, pub ports: Vec>, } pub fn comb_block(input: TokenSpan) -> IResult { map( preceded( token(tk::Comb), cut(tuple(( token(tk::Ident), delimited(token(tk::LParen), inputs_list, token(tk::RParen)), preceded(token(tk::RArrow), typename), delimited( token(tk::LBrace), many0(token(tk::Error)), token(tk::RBrace), ), ))), ), |(name, inputs, _ret, _items)| CombBlock { // TODO: bring back returns name: name.span(), ports: inputs, }, )(input) }