Forbid escapable characters in string literals

This commit is contained in:
Joscha 2022-11-20 18:09:22 +01:00
parent 3130736057
commit dfaa878820

View file

@ -81,7 +81,7 @@ fn num_lit() -> impl Parser<char, NumLit, Error = Error> {
} }
fn string_lit_elem() -> impl Parser<char, StringLitElem, Error = Error> { fn string_lit_elem() -> impl Parser<char, StringLitElem, Error = Error> {
let plain = filter(|c: &char| !matches!(c, '"' | '\\')) let plain = filter(|c: &char| !matches!(c, '\\' | '"' | '\t' | '\r' | '\n'))
.repeated() .repeated()
.at_least(1) .at_least(1)
.collect::<String>() .collect::<String>()