Richo Healey | de3ea99 | 2015-01-15 08:23:46 | [diff] [blame] | 1 | #!/usr/bin/env python |
2 | import re | ||||
3 | import sys | ||||
Niko Matsakis | f1afb0b | 2012-04-06 03:59:07 | [diff] [blame] | 4 | |
Richo Healey | de3ea99 | 2015-01-15 08:23:46 | [diff] [blame] | 5 | indent = 0 |
6 | more_re = re.compile(r"^rust: ~\">>") | ||||
7 | less_re = re.compile(r"^rust: ~\"<<") | ||||
8 | while True: | ||||
9 | line = sys.stdin.readline() | ||||
10 | if not line: | ||||
11 | break | ||||
Niko Matsakis | f1afb0b | 2012-04-06 03:59:07 | [diff] [blame] | 12 | |
Richo Healey | de3ea99 | 2015-01-15 08:23:46 | [diff] [blame] | 13 | if more_re.match(line): |
14 | indent += 1 | ||||
Niko Matsakis | 30d5638 | 2012-04-21 17:04:58 | [diff] [blame] | 15 | |
Collin Anderson | 261d4d8 | 2017-11-16 17:39:20 | [diff] [blame] | 16 | print("%03d %s%s" % (indent, " " * indent, line.strip())) |
Richo Healey | de3ea99 | 2015-01-15 08:23:46 | [diff] [blame] | 17 | |
18 | if less_re.match(line): | ||||
19 | indent -= 1 |