fixup! 9458c279b7cfa272420d3eede13459a4ca8c06f0

This commit is contained in:
Noah Hellman 2022-12-02 08:16:47 +01:00
parent 1c96e6f856
commit 02fb0b6585

View file

@ -136,7 +136,7 @@ impl<'s> Lexer<'s> {
'\\' => {
let next = self.peek();
if next == ' ' || next.is_ascii_punctuation() {
if next.is_whitespace() || next.is_ascii_punctuation() {
self.escape = true;
Escape
} else {
@ -316,6 +316,13 @@ mod test {
test_lex!(r#"\{-"#, Escape.l(1), Text.l(1), Seq(Hyphen).l(1));
}
#[test]
fn hardbreak() {
test_lex!("a\\\n", Text.l(1), Escape.l(1), Hardbreak.l(1));
test_lex!("a\\ \n", Text.l(1), Escape.l(1), Hardbreak.l(4));
test_lex!("a\\\t \t \n", Text.l(1), Escape.l(1), Hardbreak.l(5));
}
#[test]
fn delim() {
test_lex!("{-", Open(BraceHyphen).l(2));