aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-12-10 14:53:41 -0500
committerGitHub <noreply@github.com>2022-12-10 14:53:41 -0500
commit023b597ab4a74adbbe658bd7476fa5d20b02a133 (patch)
tree3b6234ccf647312eb55561218555a08f2ea35e8a /src
parentac0488430fd4ab35cab972d6409a0e244ad9637c (diff)
parenta01993e908b636835d4c2905928af700da23ea8e (diff)
downloadzig-023b597ab4a74adbbe658bd7476fa5d20b02a133.tar.gz
zig-023b597ab4a74adbbe658bd7476fa5d20b02a133.zip
Merge pull request #13370 from r00ster91/newascii
std.ascii: remove LUT and deprecations
Diffstat (limited to 'src')
-rw-r--r--src/DepTokenizer.zig8
-rw-r--r--src/translate_c.zig2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/DepTokenizer.zig b/src/DepTokenizer.zig
index 867bfc1aa3..8f9f2f81cd 100644
--- a/src/DepTokenizer.zig
+++ b/src/DepTokenizer.zig
@@ -866,7 +866,7 @@ test "error target - continuation expecting end-of-line" {
);
try depTokenizer("foo.o: \\ ",
\\target = {foo.o}
- \\ERROR: illegal char \x20 at position 8: continuation expecting end-of-line
+ \\ERROR: illegal char ' ' at position 8: continuation expecting end-of-line
);
try depTokenizer("foo.o: \\x",
\\target = {foo.o}
@@ -1053,10 +1053,10 @@ fn printCharValues(out: anytype, bytes: []const u8) !void {
}
fn printUnderstandableChar(out: anytype, char: u8) !void {
- if (!std.ascii.isPrint(char) or char == ' ') {
- try out.print("\\x{X:0>2}", .{char});
+ if (std.ascii.isPrint(char)) {
+ try out.print("'{c}'", .{char});
} else {
- try out.print("'{c}'", .{printable_char_tab[char]});
+ try out.print("\\x{X:0>2}", .{char});
}
}
diff --git a/src/translate_c.zig b/src/translate_c.zig
index b324504a54..8ead8e6a28 100644
--- a/src/translate_c.zig
+++ b/src/translate_c.zig
@@ -5738,7 +5738,7 @@ fn parseCNumLit(c: *Context, m: *MacroCtx) ParseError!Node {
if (mem.indexOfScalar(u8, lit_bytes, '.')) |dot_index| {
if (dot_index == 2) {
lit_bytes = try std.fmt.allocPrint(c.arena, "0x0{s}", .{lit_bytes[2..]});
- } else if (dot_index + 1 == lit_bytes.len or !std.ascii.isXDigit(lit_bytes[dot_index + 1])) {
+ } else if (dot_index + 1 == lit_bytes.len or !std.ascii.isHex(lit_bytes[dot_index + 1])) {
// If the literal lacks a digit after the `.`, we need to
// add one since `0x1.p10` would be invalid syntax in Zig.
lit_bytes = try std.fmt.allocPrint(c.arena, "0x{s}0{s}", .{