Skip to content

Commit

Permalink
Highlight source range in IR dumps using colors.
Browse files Browse the repository at this point in the history
whitequark committed Oct 3, 2015
1 parent 651e6b1 commit 2ca84f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions artiq/compiler/ir.py
Original file line number Diff line number Diff line change
@@ -365,9 +365,9 @@ def __str__(self):
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"))

0 comments on commit 2ca84f9

Please sign in to comment.