From 52824b4d0b36d8a17f879feea634be1ea898c889 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 5 Apr 2020 19:39:07 -0400 Subject: [PATCH] Rename the container parser to conditional. Rename the container parser to conditional because we are going to have other tags with bodies that do not match the same semantics as the conditional blocks. An example of this is inline partials only support a single key rather than a path. --- src/parser/parser.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 3ecff88..48bab92 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -99,9 +99,9 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> { map(special, DustTag::DTSpecial), map(comment, DustTag::DTComment), map(reference, DustTag::DTReference), - container("{#", DustTag::DTSection), - container("{?", DustTag::DTExists), - container("{^", DustTag::DTNotExists), + conditional("{#", DustTag::DTSection), + conditional("{?", DustTag::DTExists), + conditional("{^", DustTag::DTNotExists), ))(i) } @@ -154,7 +154,7 @@ fn reference(i: &str) -> IResult<&str, Reference> { )) } -fn container<'a, F>( +fn conditional<'a, F>( open_matcher: &'static str, constructor: F, ) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>> @@ -162,12 +162,12 @@ where F: Copy + Fn(Container<'a>) -> DustTag<'a>, { alt(( - container_with_body(open_matcher, constructor), - self_closing_container(open_matcher, constructor), + conditional_with_body(open_matcher, constructor), + self_closing_conditional(open_matcher, constructor), )) } -fn container_with_body<'a, F>( +fn conditional_with_body<'a, F>( open_matcher: &'static str, constructor: F, ) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>> @@ -196,7 +196,7 @@ where } } -fn self_closing_container<'a, F>( +fn self_closing_conditional<'a, F>( open_matcher: &'static str, constructor: F, ) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>