| author | |
| committer | |
| log | 02b3d5b58adc58f85f213b580e60f4a07ae9b140 |
| tree | ed09b32ab7012c61392129c016688e52d01b9179 |
| parent | e4447c54eaae4d416cb3027d9cefad11196f9f6d |
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 { | ... | @@ -8011,7 +8011,7 @@ fn charLiteral(p: *Parser) Error!Result { |
| 8011 | const slice = char_kind.contentSlice(p.tokSlice(p.tok_i)); | 8011 | const slice = char_kind.contentSlice(p.tokSlice(p.tok_i)); |
| 8012 | 8012 | ||
| 8013 | var is_multichar = false; | 8013 | 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])) { |
| 8015 | // fast path: single unescaped ASCII char | 8015 | // fast path: single unescaped ASCII char |
| 8016 | val = slice[0]; | 8016 | val = slice[0]; |
| 8017 | } else { | 8017 | } else { |
lib/std/ascii.zig+6-3| ... | @@ -130,7 +130,7 @@ pub fn isLower(c: u8) bool { | ... | @@ -130,7 +130,7 @@ pub fn isLower(c: u8) bool { |
| 130 | /// Returns whether the character is printable and has some graphical representation, | 130 | /// Returns whether the character is printable and has some graphical representation, |
| 131 | /// including the space character. | 131 | /// including the space character. |
| 132 | pub fn isPrint(c: u8) bool { | 132 | pub fn isPrint(c: u8) bool { |
| 133 | return isASCII(c) and !isControl(c); | 133 | return isAscii(c) and !isControl(c); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /// Returns whether this character is included in `whitespace`. | 136 | /// Returns whether this character is included in `whitespace`. |
| ... | @@ -151,7 +151,7 @@ test whitespace { | ... | @@ -151,7 +151,7 @@ test whitespace { |
| 151 | for (whitespace) |char| try std.testing.expect(isWhitespace(char)); | 151 | for (whitespace) |char| try std.testing.expect(isWhitespace(char)); |
| 152 | 152 | ||
| 153 | var i: u8 = 0; | 153 | var i: u8 = 0; |
| 154 | while (isASCII(i)) : (i += 1) { | 154 | while (isAscii(i)) : (i += 1) { |
| 155 | if (isWhitespace(i)) try std.testing.expect(std.mem.indexOfScalar(u8, &whitespace, i) != null); | 155 | if (isWhitespace(i)) try std.testing.expect(std.mem.indexOfScalar(u8, &whitespace, i) != null); |
| 156 | } | 156 | } |
| 157 | } | 157 | } |
| ... | @@ -173,10 +173,13 @@ pub fn isHex(c: u8) bool { | ... | @@ -173,10 +173,13 @@ pub fn isHex(c: u8) bool { |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | /// Returns whether the character is a 7-bit ASCII character. | 175 | /// Returns whether the character is a 7-bit ASCII character. |
| 176 | pub fn isASCII(c: u8) bool { | 176 | pub fn isAscii(c: u8) bool { |
| 177 | return c < 128; | 177 | return c < 128; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | /// /// Deprecated: use `isAscii` | ||
| 181 | pub const isASCII = isAscii; | ||
| 182 | |||
| 180 | /// Uppercases the character and returns it as-is if already uppercase or not a letter. | 183 | /// Uppercases the character and returns it as-is if already uppercase or not a letter. |
| 181 | pub fn toUpper(c: u8) u8 { | 184 | pub fn toUpper(c: u8) u8 { |
| 182 | if (isLower(c)) { | 185 | if (isLower(c)) { |
lib/std/net.zig+1-1| ... | @@ -1363,7 +1363,7 @@ pub fn isValidHostName(hostname: []const u8) bool { | ... | @@ -1363,7 +1363,7 @@ pub fn isValidHostName(hostname: []const u8) bool { |
| 1363 | if (hostname.len >= 254) return false; | 1363 | if (hostname.len >= 254) return false; |
| 1364 | if (!std.unicode.utf8ValidateSlice(hostname)) return false; | 1364 | if (!std.unicode.utf8ValidateSlice(hostname)) return false; |
| 1365 | for (hostname) |byte| { | 1365 | 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)) { |
| 1367 | continue; | 1367 | continue; |
| 1368 | } | 1368 | } |
| 1369 | return false; | 1369 | return false; |
lib/std/zig/tokenizer.zig+1-1| ... | @@ -1270,7 +1270,7 @@ pub const Tokenizer = struct { | ... | @@ -1270,7 +1270,7 @@ pub const Tokenizer = struct { |
| 1270 | 1270 | ||
| 1271 | fn getInvalidCharacterLength(self: *Tokenizer) u3 { | 1271 | fn getInvalidCharacterLength(self: *Tokenizer) u3 { |
| 1272 | const c0 = self.buffer[self.index]; | 1272 | const c0 = self.buffer[self.index]; |
| 1273 | if (std.ascii.isASCII(c0)) { | 1273 | if (std.ascii.isAscii(c0)) { |
| 1274 | if (c0 == '\r') { | 1274 | if (c0 == '\r') { |
| 1275 | if (self.index + 1 < self.buffer.len and self.buffer[self.index + 1] == '\n') { | 1275 | if (self.index + 1 < self.buffer.len and self.buffer[self.index + 1] == '\n') { |
| 1276 | // Carriage returns are *only* allowed just before a linefeed as part of a CRLF pair, otherwise | 1276 | // Carriage returns are *only* allowed just before a linefeed as part of a CRLF pair, otherwise |