]> git.lizzy.rs Git - rust.git/blob - src/etc/indenter
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[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