aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-07-05 14:46:21 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-07-05 14:46:21 -0400
commit4f43a4b30f8a6dad7a9a35ccf1cef89b6d239997 (patch)
tree08f296237b8fd4b75ab48d23f62ae2433849cd7a /src-self-hosted
parent5b42c7695183b2b529a1ce119f9b76de09f728df (diff)
downloadzig-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.zig31
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 {