diff --git a/stellarisdashboard/parsing/rust_parser/src/parser.rs b/stellarisdashboard/parsing/rust_parser/src/parser.rs index 608134f..80655e0 100644 --- a/stellarisdashboard/parsing/rust_parser/src/parser.rs +++ b/stellarisdashboard/parsing/rust_parser/src/parser.rs @@ -247,7 +247,7 @@ fn parse_float(input: &str) -> IResult<&str, f64> { fn parse_str(input: &str) -> IResult<&str, &str> { preceded( multispace0, - delimited(tag("\""), escaped(none_of("\"\\"), '\\', one_of("\"")), tag("\"")), + delimited(tag("\""), escaped(none_of("\"\\"), '\\', one_of("\"\\")), tag("\"")), )(input) } @@ -585,6 +585,14 @@ mod tests { parse_file(test_input).expect("Should parse"); } + #[test] + fn test_escaped_backslash() { + // from a bug report for a save that failed to parse + // narrowed down to mishandled escaped backslash at end of string + let test_input = "prefix=\"GATE \\\\\""; + parse_file(test_input).expect("Should parse"); + } + #[test] fn test_skipped_key_in_mapping() { assert_eq!(