diff --git a/src/etc/indenter b/src/etc/indenter index 1a3a4465335..b3eed6a1443 100755 --- a/src/etc/indenter +++ b/src/etc/indenter @@ -1,16 +1,19 @@ -#!/usr/bin/perl -use strict; -use warnings; +#!/usr/bin/env python +import re +import sys -my $indent = 0; -while (<>) { - if (/^rust: ~">>/) { - $indent += 1; - } +indent = 0 +more_re = re.compile(r"^rust: ~\">>") +less_re = re.compile(r"^rust: ~\"<<") +while True: + line = sys.stdin.readline() + if not line: + break - printf "%03d %s%s", $indent, (" " x $indent), $_; + if more_re.match(line): + indent += 1 - if (/^rust: ~"<