authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-04-22 09:02:03+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-22 12:48:45-04:00
log0a2519fafb083e13fb40eac5afcfcb8b741e3438
tree612acd63956ccabfb6b6dd4d7c9fdcb63db4477e
parent48dc3b6fe9e16e9a5dc4b586d260e19bdbd682a1

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 files changed, 9 insertions(+), 0 deletions(-)

lib/std/zig/tokenizer.zig+9
...@@ -848,6 +848,7 @@ pub const Tokenizer = struct {...@@ -848,6 +848,7 @@ pub const Tokenizer = struct {
848 self.index += 1;848 self.index += 1;
849 break;849 break;
850 },850 },
851 '\t' => {},
851 else => self.checkLiteralCharacter(),852 else => self.checkLiteralCharacter(),
852 },853 },
853854
...@@ -1687,6 +1688,14 @@ test "tokenizer - string identifier and builtin fns" {...@@ -1687,6 +1688,14 @@ test "tokenizer - string identifier and builtin fns" {
1687 });1688 });
1688}1689}
16891690
1691test "tokenizer - multiline string literal with literal tab" {
1692 testTokenize(
1693 \\\\foo bar
1694 , &[_]Token.Id{
1695 Token.Id.MultilineStringLiteralLine,
1696 });
1697}
1698
1690test "tokenizer - pipe and then invalid" {1699test "tokenizer - pipe and then invalid" {
1691 testTokenize("||=", &[_]Token.Id{1700 testTokenize("||=", &[_]Token.Id{
1692 Token.Id.PipePipe,1701 Token.Id.PipePipe,