Skip to content

Commit

Permalink
fixup! fix: parse empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel committed Jul 28, 2023
1 parent 22d05bb commit e6eb3a6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions biscuit-parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ fn name(i: &str) -> IResult<&str, &str, Error> {
}

fn printable(i: &str) -> IResult<&str, &str, Error> {
take_while1(|c: char| c != '\\' && c != '"')(i)
take_while(|c: char| c != '\\' && c != '"')(i)
}

fn parse_string_internal(i: &str) -> IResult<&str, String, Error> {
Expand All @@ -695,10 +695,11 @@ fn parse_string_internal(i: &str) -> IResult<&str, String, Error> {
}

fn parse_string(i: &str) -> IResult<&str, String, Error> {
alt((
value("".to_string(), tag("\"\"")),
delimited(char('"'), parse_string_internal, char('"')),
))(i)
// alt((
// value("".to_string(), tag("\"\"")),
// delimited(char('"'), parse_string_internal, char('"')),
// ))(i)
delimited(char('"'), parse_string_internal, char('"'))(i)
}

fn string(i: &str) -> IResult<&str, builder::Term, Error> {
Expand Down

0 comments on commit e6eb3a6

Please sign in to comment.