authorgravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2023-02-07 22:06:23+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-02-11 14:25:25+02:00
logc63be507cf0e9ccbd45cc70e4dc0ac619930733c
tree38e55901af67952de2fc90efc924566011df70ac
parent1bda8be2a3504d0d9f6d66d69f85ecd4db447b09

don't tokenize an invalid string literal


1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/zig/tokenizer.zig+2-1
...@@ -739,6 +739,7 @@ pub const Tokenizer = struct {...@@ -739,6 +739,7 @@ pub const Tokenizer = struct {
739 },739 },
740 0 => {740 0 => {
741 if (self.index == self.buffer.len) {741 if (self.index == self.buffer.len) {
742 result.tag = .invalid;
742 break;743 break;
743 } else {744 } else {
744 self.checkLiteralCharacter();745 self.checkLiteralCharacter();
...@@ -1326,7 +1327,7 @@ test "newline in string literal" {...@@ -1326,7 +1327,7 @@ test "newline in string literal" {
1326 try testTokenize(1327 try testTokenize(
1327 \\"1328 \\"
1328 \\"1329 \\"
1329 , &.{ .invalid, .string_literal });1330 , &.{ .invalid, .invalid });
1330}1331}
13311332
1332test "code point literal with unicode escapes" {1333test "code point literal with unicode escapes" {