Skip to content

Commit

Permalink
Port indenter to python
Browse files Browse the repository at this point in the history
  • Loading branch information
richo committed Jan 16, 2015
1 parent 68372ae commit de3ea99
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions 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: ~"<</) {
$indent -= 1;
}
}
print "%03d %s%s" % (indent, " " * indent, line.strip())

if less_re.match(line):
indent -= 1

5 comments on commit de3ea99

@bors
Copy link
Contributor

@bors bors commented on de3ea99 Jan 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at richo@de3ea99

@bors
Copy link
Contributor

@bors bors commented on de3ea99 Jan 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging 7 batched pull requests into batch

@bors
Copy link
Contributor

@bors bors commented on de3ea99 Jan 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "8dac4f2aee481b8e48002795c68ad35d87a40f3a", "rollup_pulls": [[21242, "de3ea99ec55d5f544abef6df836d67e6b87cb299"], [21294, "8da284a045c4d59a850f63fe9a11ab7ddb38ef17"], [21302, "35d46fabaf63c0b1b607bd91cd5680eeaa2f9a14"], [21314, "5aa2f9c651546d420c8da551b3d95849f4ade310"], [21326, "ac4baca72a392bf683d513e5cd3aa00b01f5e7a8"], [21336, "b6b8880f0ec3f057dc56320f6886be173a8f0d8e"], [21357, "17ffe51aa366d51719da0eeb452ad05b9ac23d90"]]}

@bors
Copy link
Contributor

@bors bors commented on de3ea99 Jan 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing rollup candidate = 8dac4f2

Successful merges:

Please sign in to comment.