Skip to content

Commit bce3aab

Browse files
authored
parser: validate more string types (#1132)
1 parent 02c90e8 commit bce3aab

5 files changed

Lines changed: 682 additions & 115 deletions

File tree

crates/squawk_parser/src/grammar.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ fn literal(p: &mut Parser<'_>) -> Option<CompletedMarker> {
3535
return None;
3636
}
3737
let m = p.start();
38+
// E021-03 string continuation syntax
39+
// If two string literals are next to each other, and don't have a comment
40+
// between them, then they are automatically combined.
3841
if p.eat(UNICODE_ESC_STRING) {
42+
while !p.at(EOF) && p.eat(STRING) {}
3943
if p.eat(UESCAPE_KW) {
4044
p.expect(STRING);
4145
}
42-
}
43-
// E021-03 string continuation syntax
44-
// If two string literals are next to each other, and don't have a comment
45-
// between them, then they are automatically combined.
46-
else if p.eat(STRING) {
46+
} else if p.eat(STRING) || p.eat(ESC_STRING) || p.eat(BIT_STRING) || p.eat(BYTE_STRING) {
4747
while !p.at(EOF) && p.eat(STRING) {}
4848
} else {
4949
p.bump_any();

0 commit comments

Comments
 (0)