aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-01 01:06:10 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-01 01:06:10 -0700
commit29f24e3c5066e7cb28876d40a811a4a64f9d4b33 (patch)
tree01d27aa3253da35af6fe8a5d3f69cffab08773bd /src/codegen.cpp
parent257cf09472ce5f4a51bf39808e119717fa0e4280 (diff)
downloadzig-29f24e3c5066e7cb28876d40a811a4a64f9d4b33.tar.gz
zig-29f24e3c5066e7cb28876d40a811a4a64f9d4b33.zip
add --color cli arg to override tty detection
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 3717fb63d4..2f9bf47383 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -42,6 +42,10 @@ void codegen_set_verbose(CodeGen *g, bool verbose) {
g->verbose = verbose;
}
+void codegen_set_errmsg_color(CodeGen *g, ErrColor err_color) {
+ g->err_color = err_color;
+}
+
void codegen_set_strip(CodeGen *g, bool strip) {
g->strip_debug_symbols = strip;
}
@@ -693,7 +697,7 @@ static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *source_path, Buf *sou
err->source = source_code;
err->line_offsets = tokenization.line_offsets;
- print_err_msg(err);
+ print_err_msg(err, g->err_color);
exit(1);
}
@@ -709,7 +713,7 @@ static ImportTableEntry *codegen_add_code(CodeGen *g, Buf *source_path, Buf *sou
import_entry->line_offsets = tokenization.line_offsets;
import_entry->path = source_path;
import_entry->fn_table.init(32);
- import_entry->root = ast_parse(source_code, tokenization.tokens, import_entry);
+ import_entry->root = ast_parse(source_code, tokenization.tokens, import_entry, g->err_color);
assert(import_entry->root);
if (g->verbose) {
ast_print(import_entry->root, 0);
@@ -756,7 +760,7 @@ void codegen_add_root_code(CodeGen *g, Buf *source_path, Buf *source_code) {
} else {
for (int i = 0; i < g->errors.length; i += 1) {
ErrorMsg *err = g->errors.at(i);
- print_err_msg(err);
+ print_err_msg(err, g->err_color);
}
exit(1);
}