Commit c63be507cf

Techatrix <19954306+Techatrix@users.noreply.github.com>
2023-02-07 22:06:23
don't tokenize an invalid string literal
1 parent 1bda8be
Changed files (1)
lib
lib/std/zig/tokenizer.zig
@@ -739,6 +739,7 @@ pub const Tokenizer = struct {
                     },
                     0 => {
                         if (self.index == self.buffer.len) {
+                            result.tag = .invalid;
                             break;
                         } else {
                             self.checkLiteralCharacter();
@@ -1326,7 +1327,7 @@ test "newline in string literal" {
     try testTokenize(
         \\"
         \\"
-    , &.{ .invalid, .string_literal });
+    , &.{ .invalid, .invalid });
 }
 
 test "code point literal with unicode escapes" {