diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 6c6d4a7..68d0778 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs @@ -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"#))); } }