Commit 8fd20a5eb0
Changed files (1)
lib
std
lib/std/zig/tokenizer.zig
@@ -797,6 +797,10 @@ pub const Tokenizer = struct {
remaining_code_units = 3;
state = .char_literal_unicode;
},
+ '\n' => {
+ result.tag = .invalid;
+ break;
+ },
else => {
state = .char_literal_end;
},
@@ -1507,6 +1511,20 @@ test "tokenizer - code point literal with hex escape" {
, &.{ .invalid, .invalid });
}
+test "tokenizer - newline in char literal" {
+ try testTokenize(
+ \\'
+ \\'
+ , &.{ .invalid, .invalid });
+}
+
+test "tokenizer - newline in string literal" {
+ try testTokenize(
+ \\"
+ \\"
+ , &.{ .invalid, .string_literal });
+}
+
test "tokenizer - code point literal with unicode escapes" {
// Valid unicode escapes
try testTokenize(