Commit 37b1707370

r00ster91 <r00ster91@proton.me>
2022-11-18 23:11:06
DepTokenizer.printUnderstandableChar: consider space printable
This makes the function consider space to be printable as well (because it is) and simplifies that function.
1 parent 45650f7
Changed files (1)
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});
     }
 }