Add parser support for select/any/none.
This commit is contained in:
@@ -44,6 +44,9 @@ pub enum DustTag<'a> {
|
||||
DTHelperSep(ParameterizedBlock<'a>),
|
||||
DTHelperFirst(ParameterizedBlock<'a>),
|
||||
DTHelperLast(ParameterizedBlock<'a>),
|
||||
DTHelperSelect(ParameterizedBlock<'a>),
|
||||
DTHelperAny(ParameterizedBlock<'a>),
|
||||
DTHelperNone(ParameterizedBlock<'a>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
@@ -219,6 +222,15 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
||||
DustTag::DTInlinePartial,
|
||||
),
|
||||
partial("{>", DustTag::DTPartial),
|
||||
dust_tag_helper,
|
||||
))(i)
|
||||
}
|
||||
|
||||
/// Nom's alt() is limited to 21 possibilities, so I pushed this out
|
||||
/// into its own parser. Otherwise there is no reason for this not to
|
||||
/// be part of the dust_tag parser.
|
||||
fn dust_tag_helper(i: &str) -> IResult<&str, DustTag> {
|
||||
alt((
|
||||
map(
|
||||
parameterized_block("{@", &tag_to_path("gte")),
|
||||
DustTag::DTHelperGreaterThanOrEquals,
|
||||
@@ -255,6 +267,18 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
||||
parameterized_block("{@", &tag_to_path("last")),
|
||||
DustTag::DTHelperLast,
|
||||
),
|
||||
map(
|
||||
parameterized_block("{@", &tag_to_path("select")),
|
||||
DustTag::DTHelperSelect,
|
||||
),
|
||||
map(
|
||||
parameterized_block("{@", &tag_to_path("any")),
|
||||
DustTag::DTHelperAny,
|
||||
),
|
||||
map(
|
||||
parameterized_block("{@", &tag_to_path("none")),
|
||||
DustTag::DTHelperNone,
|
||||
),
|
||||
))(i)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user