diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-07-05 14:46:21 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-07-05 14:46:21 -0400 |
| commit | 4f43a4b30f8a6dad7a9a35ccf1cef89b6d239997 (patch) | |
| tree | 08f296237b8fd4b75ab48d23f62ae2433849cd7a /src-self-hosted | |
| parent | 5b42c7695183b2b529a1ce119f9b76de09f728df (diff) | |
| download | zig-4f43a4b30f8a6dad7a9a35ccf1cef89b6d239997.tar.gz zig-4f43a4b30f8a6dad7a9a35ccf1cef89b6d239997.zip | |
zig fmt: fix whitespace
closes #2819
closes #2825
Diffstat (limited to 'src-self-hosted')
| -rw-r--r-- | src-self-hosted/stage1.zig | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/src-self-hosted/stage1.zig b/src-self-hosted/stage1.zig index 3d2606c5ec..dd26e9594c 100644 --- a/src-self-hosted/stage1.zig +++ b/src-self-hosted/stage1.zig @@ -375,28 +375,21 @@ fn printErrMsgToFile( const text = text_buf.toOwnedSlice(); const stream = &file.outStream().stream; - if (!color_on) { - try stream.print( - "{}:{}:{}: error: {}\n", - path, - start_loc.line + 1, - start_loc.column + 1, - text, - ); - return; - } + try stream.print( "{}:{}:{}: error: {}\n", path, start_loc.line + 1, start_loc.column + 1, text); - try stream.print( - "{}:{}:{}: error: {}\n{}\n", - path, - start_loc.line + 1, - start_loc.column + 1, - text, - tree.source[start_loc.line_start..start_loc.line_end], - ); + if (!color_on) return; + + // Print \r and \t as one space each so that column counts line up + for (tree.source[start_loc.line_start..start_loc.line_end]) |byte| { + try stream.writeByte(switch (byte) { + '\r', '\t' => ' ', + else => byte, + }); + } + try stream.writeByte('\n'); try stream.writeByteNTimes(' ', start_loc.column); try stream.writeByteNTimes('~', last_token.end - first_token.start); - try stream.write("\n"); + try stream.writeByte('\n'); } export fn stage2_DepTokenizer_init(input: [*]const u8, len: usize) stage2_DepTokenizer { |
