Delimiter

This commit is contained in:
Greg Shuflin 2021-11-20 20:55:26 -08:00
parent b760ec7eca
commit e5b6f2bc2f

View File

@ -153,17 +153,10 @@ pub fn program(input: Span) -> ParseResult<AST> {
fn block_template<'a, O>( fn block_template<'a, O>(
input_parser: impl Parser<Span<'a>, O, VerboseError<Span<'a>>>, input_parser: impl Parser<Span<'a>, O, VerboseError<Span<'a>>>,
) -> impl FnMut(Span<'a>) -> IResult<Span<'a>, Vec<O>, VerboseError<Span<'a>>> { ) -> impl FnMut(Span<'a>) -> IResult<Span<'a>, Vec<O>, VerboseError<Span<'a>>> {
map(
delimited( delimited(
tok(char('{')), pair(tok(char('{')), many0(statement_delimiter)),
tuple((
many0(statement_delimiter),
separated_list0(many1(statement_delimiter), input_parser), separated_list0(many1(statement_delimiter), input_parser),
many0(statement_delimiter), pair(many0(statement_delimiter), tok(char('}'))),
)),
tok(char('}')),
),
|(_, items, _)| items,
) )
} }