Commit 0a2519fafb

LemonBoy <thatlemon@gmail.com>
2020-04-22 09:02:03
stage2: Allow \t in string literals
Lift the ban on literal tab chars in string literals as they have nothing to do with code formatting.
1 parent 48dc3b6
Changed files (1)
lib
lib/std/zig/tokenizer.zig
@@ -848,6 +848,7 @@ pub const Tokenizer = struct {
                         self.index += 1;
                         break;
                     },
+                    '\t' => {},
                     else => self.checkLiteralCharacter(),
                 },
 
@@ -1687,6 +1688,14 @@ test "tokenizer - string identifier and builtin fns" {
     });
 }
 
+test "tokenizer - multiline string literal with literal tab" {
+    testTokenize(
+        \\\\foo	bar
+    , &[_]Token.Id{
+        Token.Id.MultilineStringLiteralLine,
+    });
+}
+
 test "tokenizer - pipe and then invalid" {
     testTokenize("||=", &[_]Token.Id{
         Token.Id.PipePipe,