diff --git a/biscuit-parser/src/parser.rs b/biscuit-parser/src/parser.rs index e2134a78..392e46b3 100644 --- a/biscuit-parser/src/parser.rs +++ b/biscuit-parser/src/parser.rs @@ -695,7 +695,10 @@ fn parse_string_internal(i: &str) -> IResult<&str, String, Error> { } fn parse_string(i: &str) -> IResult<&str, String, Error> { - delimited(char('"'), parse_string_internal, char('"'))(i) + alt(( + value("".to_string(), tag("\"\"")), + delimited(char('"'), parse_string_internal, char('"')), + ))(i) } fn string(i: &str) -> IResult<&str, builder::Term, Error> { @@ -1195,6 +1198,11 @@ mod tests { ); } + #[test] + fn empty_string() { + assert_eq!(super::string("\"\""), Ok(("", builder::string("")))); + } + #[test] fn integer() { assert_eq!(super::integer("123"), Ok(("", builder::int(123))));