diff --git a/lib/std/zig/tokenizer.zig b/lib/std/zig/tokenizer.zig index 3c3c333e2a9c..8eaf1206b0df 100644 --- a/lib/std/zig/tokenizer.zig +++ b/lib/std/zig/tokenizer.zig @@ -514,10 +514,12 @@ pub const Tokenizer = struct { .expect_newline => { self.index += 1; switch (self.buffer[self.index]) { - 0 => if (self.index == self.buffer.len) { - result.tag = .invalid; - } else { - continue :state .invalid; + 0 => { + if (self.index == self.buffer.len) { + result.tag = .invalid; + } else { + continue :state .invalid; + } }, '\n' => { self.index += 1; @@ -542,10 +544,7 @@ pub const Tokenizer = struct { .saw_at_sign => { self.index += 1; switch (self.buffer[self.index]) { - 0, '\n' => { - result.tag = .invalid; - break; - }, + 0, '\n' => result.tag = .invalid, '"' => { result.tag = .identifier; continue :state .string_literal; @@ -625,12 +624,10 @@ pub const Tokenizer = struct { '=' => { result.tag = .plus_equal; self.index += 1; - break; }, '+' => { result.tag = .plus_plus; self.index += 1; - break; }, '%' => continue :state .plus_percent, '|' => continue :state .plus_pipe, @@ -702,10 +699,12 @@ pub const Tokenizer = struct { .string_literal => { self.index += 1; switch (self.buffer[self.index]) { - 0 => if (self.index != self.buffer.len) { - continue :state .invalid; - } else { - result.tag = .invalid; + 0 => { + if (self.index != self.buffer.len) { + continue :state .invalid; + } else { + result.tag = .invalid; + } }, '\n' => result.tag = .invalid, '\\' => continue :state .string_literal_backslash, @@ -728,10 +727,12 @@ pub const Tokenizer = struct { .char_literal => { self.index += 1; switch (self.buffer[self.index]) { - 0 => if (self.index != self.buffer.len) { - continue :state .invalid; - } else { - result.tag = .invalid; + 0 => { + if (self.index != self.buffer.len) { + continue :state .invalid; + } else { + result.tag = .invalid; + } }, '\n' => result.tag = .invalid, '\\' => continue :state .char_literal_backslash, @@ -746,10 +747,12 @@ pub const Tokenizer = struct { .char_literal_backslash => { self.index += 1; switch (self.buffer[self.index]) { - 0 => if (self.index != self.buffer.len) { - continue :state .invalid; - } else { - result.tag = .invalid; + 0 => { + if (self.index != self.buffer.len) { + continue :state .invalid; + } else { + result.tag = .invalid; + } }, '\n' => result.tag = .invalid, 0x01...0x09, 0x0b...0x1f, 0x7f => {