This commit is contained in:
Greg Shuflin 2021-11-19 01:08:07 -08:00
parent 7ae7eaa07b
commit 8365690860

View File

@ -689,19 +689,11 @@ fn string_literal(input: Span) -> ParseResult<ExpressionKind> {
}
fn bare_string_literal(input: Span) -> ParseResult<String> {
println!("BARE STRING: {}", input.fragment());
let string_escape_transforms =
alt((value("\\", tag("\\")), value("\"", tag("\"")), value("\n", tag("n")), value("\t", tag("t"))));
alt((
map(tag(r#""""#), |_| String::new()),
map(
tuple((
char('"'),
escaped_transform(none_of(r#""\"#), '\\', string_escape_transforms),
char('"'),
)),
|(_, s, _)| s,
),
delimited(char('"'), escaped_transform(none_of(r#""\"#), '\\', string_escape_transforms), char('"'))
))(input)
}