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 {
848848 self.index += 1;
849849 break;
850850 },
851 '\t' => {},
851852 else => self.checkLiteralCharacter(),
852853 },
853854
......@@ -1687,6 +1688,14 @@ test "tokenizer - string identifier and builtin fns" {
16871688 });
16881689}
16891690
1691test "tokenizer - multiline string literal with literal tab" {
1692 testTokenize(
1693 \\\\foo bar
1694 , &[_]Token.Id{
1695 Token.Id.MultilineStringLiteralLine,
1696 });
1697}
1698
16901699test "tokenizer - pipe and then invalid" {
16911700 testTokenize("||=", &[_]Token.Id{
16921701 Token.Id.PipePipe,