authorgravatar for github@mjb.ioMichael Bradshaw <github@mjb.io> 2024-06-28 08:10:55-07:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2024-07-02 16:31:15+02:00
log02b3d5b58adc58f85f213b580e60f4a07ae9b140
treeed09b32ab7012c61392129c016688e52d01b9179
parente4447c54eaae4d416cb3027d9cefad11196f9f6d

Rename isASCII to isAscii


4 files changed, 9 insertions(+), 6 deletions(-)

lib/compiler/aro/aro/Parser.zig+1-1
......@@ -8011,7 +8011,7 @@ fn charLiteral(p: *Parser) Error!Result {
80118011 const slice = char_kind.contentSlice(p.tokSlice(p.tok_i));
80128012
80138013 var is_multichar = false;
8014 if (slice.len == 1 and std.ascii.isASCII(slice[0])) {
8014 if (slice.len == 1 and std.ascii.isAscii(slice[0])) {
80158015 // fast path: single unescaped ASCII char
80168016 val = slice[0];
80178017 } else {
lib/std/ascii.zig+6-3
......@@ -130,7 +130,7 @@ pub fn isLower(c: u8) bool {
130130/// Returns whether the character is printable and has some graphical representation,
131131/// including the space character.
132132pub fn isPrint(c: u8) bool {
133 return isASCII(c) and !isControl(c);
133 return isAscii(c) and !isControl(c);
134134}
135135
136136/// Returns whether this character is included in `whitespace`.
......@@ -151,7 +151,7 @@ test whitespace {
151151 for (whitespace) |char| try std.testing.expect(isWhitespace(char));
152152
153153 var i: u8 = 0;
154 while (isASCII(i)) : (i += 1) {
154 while (isAscii(i)) : (i += 1) {
155155 if (isWhitespace(i)) try std.testing.expect(std.mem.indexOfScalar(u8, &whitespace, i) != null);
156156 }
157157}
......@@ -173,10 +173,13 @@ pub fn isHex(c: u8) bool {
173173}
174174
175175/// Returns whether the character is a 7-bit ASCII character.
176pub fn isASCII(c: u8) bool {
176pub fn isAscii(c: u8) bool {
177177 return c < 128;
178178}
179179
180/// /// Deprecated: use `isAscii`
181pub const isASCII = isAscii;
182
180183/// Uppercases the character and returns it as-is if already uppercase or not a letter.
181184pub fn toUpper(c: u8) u8 {
182185 if (isLower(c)) {
lib/std/net.zig+1-1
......@@ -1363,7 +1363,7 @@ pub fn isValidHostName(hostname: []const u8) bool {
13631363 if (hostname.len >= 254) return false;
13641364 if (!std.unicode.utf8ValidateSlice(hostname)) return false;
13651365 for (hostname) |byte| {
1366 if (!std.ascii.isASCII(byte) or byte == '.' or byte == '-' or std.ascii.isAlphanumeric(byte)) {
1366 if (!std.ascii.isAscii(byte) or byte == '.' or byte == '-' or std.ascii.isAlphanumeric(byte)) {
13671367 continue;
13681368 }
13691369 return false;
lib/std/zig/tokenizer.zig+1-1
......@@ -1270,7 +1270,7 @@ pub const Tokenizer = struct {
12701270
12711271 fn getInvalidCharacterLength(self: *Tokenizer) u3 {
12721272 const c0 = self.buffer[self.index];
1273 if (std.ascii.isASCII(c0)) {
1273 if (std.ascii.isAscii(c0)) {
12741274 if (c0 == '\r') {
12751275 if (self.index + 1 < self.buffer.len and self.buffer[self.index + 1] == '\n') {
12761276 // Carriage returns are *only* allowed just before a linefeed as part of a CRLF pair, otherwise