diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-04-22 09:02:03 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-04-22 12:48:45 -0400 |
| commit | 0a2519fafb083e13fb40eac5afcfcb8b741e3438 (patch) | |
| tree | 612acd63956ccabfb6b6dd4d7c9fdcb63db4477e /lib/std | |
| parent | 48dc3b6fe9e16e9a5dc4b586d260e19bdbd682a1 (diff) | |
| download | zig-0a2519fafb083e13fb40eac5afcfcb8b741e3438.tar.gz zig-0a2519fafb083e13fb40eac5afcfcb8b741e3438.zip | |
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.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/zig/tokenizer.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/zig/tokenizer.zig b/lib/std/zig/tokenizer.zig index 6cb66595a7..99574f2a98 100644 --- a/lib/std/zig/tokenizer.zig +++ b/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, |
