Added surrounding quotes

This commit is contained in:
Tom Alexander 2020-04-06 21:03:03 -04:00
parent 878cbf56ca
commit 5463ed2cdf
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -328,8 +328,12 @@ pub fn template(i: &str) -> IResult<&str, Template> {
Ok((remaining, Template { contents: contents }))
}
fn temp_string(i: &str) -> IResult<&str, &str> {
escaped(is_not(r#"\""#), '\\', one_of(r#"\""#))(i)
fn quoted_string(i: &str) -> IResult<&str, &str> {
delimited(
tag(r#"""#),
escaped(is_not(r#"\""#), '\\', one_of(r#"\""#)),
tag(r#"""#),
)(i)
}
#[cfg(test)]
@ -610,6 +614,6 @@ mod tests {
#[test]
fn test_temp_string() {
assert_eq!(temp_string(r#"foo\"bar"#), Ok(("", r#"foo\"bar"#)));
assert_eq!(quoted_string(r#""foo\"bar""#), Ok(("", r#"foo\"bar"#)));
}
}