forked from M-Labs/artiq
1
0
Fork 0

Highlight source range in IR dumps using colors.

This commit is contained in:
whitequark 2015-10-04 02:11:17 +03:00
parent 651e6b1b7a
commit 2ca84f9fea
1 changed files with 2 additions and 2 deletions

View File

@ -365,9 +365,9 @@ class BasicBlock(NamedValue):
source_lines = loc.source_lines()
beg_col, end_col = loc.column(), loc.end().column()
source_lines[-1] = \
source_lines[-1][:end_col] + "`" + source_lines[-1][end_col:]
source_lines[-1][:end_col] + "\x1b[0m" + source_lines[-1][end_col:]
source_lines[0] = \
source_lines[0][:beg_col] + "`" + source_lines[0][beg_col:]
source_lines[0][:beg_col] + "\x1b[1;32m" + source_lines[0][beg_col:]
line_desc = "{}:{}".format(loc.source_buffer.name, loc.line())
lines += ["; {} {}".format(line_desc, line.rstrip("\n"))