Extract out parse_propval_text
This commit is contained in:
parent
3cca3a7f89
commit
fd4c6ff935
|
@ -379,17 +379,27 @@ fn parse_propval<'a, E: nom::error::ParseError<&'a str>>(
|
|||
) -> IResult<&'a str, String, E> {
|
||||
let (input, _) = multispace0(input)?;
|
||||
println!("- {}", input);
|
||||
|
||||
let (input, _) = tag("[")(input)?;
|
||||
println!("-- {}", input);
|
||||
|
||||
let (input, value) = parse_propval_text(input)?;
|
||||
println!("--- {}", input);
|
||||
|
||||
let (input, _) = tag("]")(input)?;
|
||||
|
||||
Ok((input, value.unwrap_or(String::new())))
|
||||
}
|
||||
|
||||
fn parse_propval_text<'a, E: nom::error::ParseError<&'a str>>(
|
||||
input: &'a str,
|
||||
) -> IResult<&'a str, Option<String>, E> {
|
||||
let (input, value) = opt(escaped_transform(
|
||||
is_not(r"\]"),
|
||||
'\\',
|
||||
alt((value("]", tag("\\]")), value("", tag("\\\n")))),
|
||||
value("]", tag(r"\]")), // alt((value("]", tag(r"\]")), value("", tag("\\\n")))),
|
||||
))(input)?;
|
||||
println!("--- {}", input);
|
||||
let (input, _) = tag("]")(input)?;
|
||||
|
||||
Ok((input, value.map(|v| v.to_owned()).unwrap_or(String::new())))
|
||||
Ok((input, value.map(|v| v.to_owned())))
|
||||
}
|
||||
|
||||
fn parse_size<'a, E: nom::error::ParseError<&'a str>>(input: &'a str) -> IResult<&'a str, Size, E> {
|
||||
|
|
Loading…
Reference in New Issue