|
|
|
@ -358,7 +358,10 @@ fn key_to_path<'a>(i: &'a str) -> IResult<&str, Path<'a>> {
|
|
|
|
|
fn postitive_integer_literal(i: &str) -> IResult<&str, u64> {
|
|
|
|
|
map(
|
|
|
|
|
verify(
|
|
|
|
|
map(digit1, |number_string: &str| number_string.parse::<u64>()),
|
|
|
|
|
map(
|
|
|
|
|
recognize(tuple((opt(tag("+")), digit1))),
|
|
|
|
|
|number_string: &str| number_string.parse::<u64>(),
|
|
|
|
|
),
|
|
|
|
|
|parse_result| parse_result.is_ok(),
|
|
|
|
|
),
|
|
|
|
|
|parsed_number| parsed_number.unwrap(),
|
|
|
|
@ -434,7 +437,11 @@ fn key_value_pair(i: &str) -> IResult<&str, KVPair> {
|
|
|
|
|
|
|
|
|
|
/// Display a value from the context
|
|
|
|
|
fn reference(i: &str) -> IResult<&str, Reference> {
|
|
|
|
|
let (remaining, (p, filters)) = delimited(tag("{"), tuple((path, many0(filter))), tag("}"))(i)?;
|
|
|
|
|
let (remaining, (p, filters)) = delimited(
|
|
|
|
|
tag("{"),
|
|
|
|
|
tuple((path, many0(filter))),
|
|
|
|
|
preceded(space0, tag("}")),
|
|
|
|
|
)(i)?;
|
|
|
|
|
Ok((
|
|
|
|
|
remaining,
|
|
|
|
|
Reference {
|
|
|
|
@ -484,12 +491,8 @@ where
|
|
|
|
|
preceded(tag(open_matcher), name_matcher),
|
|
|
|
|
opt(preceded(tag(":"), path)),
|
|
|
|
|
terminated(
|
|
|
|
|
opt(delimited(
|
|
|
|
|
space1,
|
|
|
|
|
separated_list1(space1, key_value_pair),
|
|
|
|
|
space0,
|
|
|
|
|
)),
|
|
|
|
|
tag("}"),
|
|
|
|
|
opt(preceded(space1, separated_list1(space1, key_value_pair))),
|
|
|
|
|
preceded(space0, tag("}")),
|
|
|
|
|
),
|
|
|
|
|
opt(body),
|
|
|
|
|
opt(preceded(tag("{:else}"), opt(body))),
|
|
|
|
@ -525,12 +528,8 @@ where
|
|
|
|
|
preceded(tag(open_matcher), name_matcher),
|
|
|
|
|
opt(preceded(tag(":"), path)),
|
|
|
|
|
terminated(
|
|
|
|
|
opt(delimited(
|
|
|
|
|
space1,
|
|
|
|
|
separated_list1(space1, key_value_pair),
|
|
|
|
|
space0,
|
|
|
|
|
)),
|
|
|
|
|
tag("}"),
|
|
|
|
|
opt(preceded(space1, separated_list1(space1, key_value_pair))),
|
|
|
|
|
preceded(space0, tag("}")),
|
|
|
|
|
),
|
|
|
|
|
opt(body),
|
|
|
|
|
delimited(tag("{/"), name_matcher, tag("}")),
|
|
|
|
@ -564,13 +563,9 @@ where
|
|
|
|
|
tuple((
|
|
|
|
|
name_matcher,
|
|
|
|
|
opt(preceded(tag(":"), path)),
|
|
|
|
|
opt(delimited(
|
|
|
|
|
space1,
|
|
|
|
|
separated_list1(space1, key_value_pair),
|
|
|
|
|
space0,
|
|
|
|
|
)),
|
|
|
|
|
opt(preceded(space1, separated_list1(space1, key_value_pair))),
|
|
|
|
|
)),
|
|
|
|
|
tag("/}"),
|
|
|
|
|
preceded(space0, tag("/}")),
|
|
|
|
|
)(i)?;
|
|
|
|
|
|
|
|
|
|
Ok((
|
|
|
|
@ -595,13 +590,9 @@ fn partial_with_plain_tag<'a>(
|
|
|
|
|
tuple((
|
|
|
|
|
key,
|
|
|
|
|
opt(preceded(tag(":"), path)),
|
|
|
|
|
opt(delimited(
|
|
|
|
|
space1,
|
|
|
|
|
separated_list1(space1, key_value_pair),
|
|
|
|
|
space0,
|
|
|
|
|
)),
|
|
|
|
|
opt(preceded(space1, separated_list1(space1, key_value_pair))),
|
|
|
|
|
)),
|
|
|
|
|
tag("/}"),
|
|
|
|
|
preceded(space0, tag("/}")),
|
|
|
|
|
)(i)?;
|
|
|
|
|
|
|
|
|
|
Ok((
|
|
|
|
@ -633,13 +624,9 @@ fn partial_with_quoted_tag<'a>(
|
|
|
|
|
tuple((
|
|
|
|
|
template_string_rvalue,
|
|
|
|
|
opt(preceded(tag(":"), path)),
|
|
|
|
|
opt(delimited(
|
|
|
|
|
space1,
|
|
|
|
|
separated_list1(space1, key_value_pair),
|
|
|
|
|
space0,
|
|
|
|
|
)),
|
|
|
|
|
opt(preceded(space1, separated_list1(space1, key_value_pair))),
|
|
|
|
|
)),
|
|
|
|
|
tag("/}"),
|
|
|
|
|
preceded(space0, tag("/}")),
|
|
|
|
|
)(i)?;
|
|
|
|
|
|
|
|
|
|
Ok((
|
|
|
|
|