From 2ca84f9fea1c01649cec2c8bfce674d8f48c4181 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 4 Oct 2015 02:11:17 +0300 Subject: [PATCH] Highlight source range in IR dumps using colors. --- artiq/compiler/ir.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/ir.py b/artiq/compiler/ir.py index f20357ed8..c6b00869c 100644 --- a/artiq/compiler/ir.py +++ b/artiq/compiler/ir.py @@ -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"))