Put cut around string parsing

This commit is contained in:
Greg Shuflin 2021-11-21 00:51:27 -08:00
parent a9afb6d24e
commit 2ba0fb4869

View File

@ -842,7 +842,14 @@ fn bare_string_literal(input: Span) -> ParseResult<String> {
alt((value("\\", tag("\\")), value("\"", tag("\"")), value("\n", tag("n")), value("\t", tag("t"))));
alt((
map(tag(r#""""#), |_| String::new()),
delimited(char('"'), escaped_transform(none_of(r#""\"#), '\\', string_escape_transforms), char('"')),
preceded(
peek(char('"')),
cut(delimited(
char('"'),
escaped_transform(none_of(r#""\"#), '\\', string_escape_transforms),
char('"'),
)),
),
))(input)
}