]> git.lizzy.rs Git - rust.git/blob - src/etc/indenter
Rollup merge of #106005 - LeSeulArtichaut:if-let-guard-borrowck-test, r=Nilstrieb
[rust.git] / src / etc / indenter
1 #!/usr/bin/env python
2 import re
3 import sys
4
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
12
13     if more_re.match(line):
14         indent += 1
15
16     print("%03d %s%s" % (indent, " " * indent, line.strip()))
17
18     if less_re.match(line):
19         indent -= 1