authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-01 23:46:07-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-01 23:46:07-07:00
logf5b4b5d4cb3dec67805ac2120a24972592422cc7
tree17077c127808aa1ea060008566eb7d7df068b989
parentc8a00c4b02c3cf095ce730e4cc92f1f999018836

std.zig.fmtId: revert recent changes

integer types are valid ids; we need different logic inside the update_cpu_features tool, not to change the fmtId function.

1 files changed, 1 insertions(+), 12 deletions(-)

lib/std/zig/fmt.zig+1-12
...@@ -32,18 +32,7 @@ pub fn isValidId(bytes: []const u8) bool {...@@ -32,18 +32,7 @@ pub fn isValidId(bytes: []const u8) bool {
32 else => return false,32 else => return false,
33 }33 }
34 }34 }
35 if (std.zig.Token.getKeyword(bytes) != null) return false;35 return std.zig.Token.getKeyword(bytes) == null;
36 if (bytes.len >= 2) switch (bytes[0]) {
37 'u', 'i' => {
38 for (bytes[1..]) |b| switch (b) {
39 '0'...'9' => continue,
40 else => break,
41 } else return false;
42 },
43 else => {},
44 };
45
46 return true;
47}36}
4837
49test "isValidId" {38test "isValidId" {