Unify process_alloc() and process_realloc() with PROCESS_ALLOC_MODE_REALLOC bit
[moveable_pool.git] / blank.py
1 #!/usr/bin/env python3
2
3 import sys
4
5 opens = set(['(', '{', '['])
6 closes = set([')', '}', ']'])
7
8 before = None
9 blank = False
10 for i in sys.stdin:
11   i = i.rstrip()
12   if len(i) == 0:
13     blank = True
14   else:
15     after = i.lstrip()
16     if blank and before is not None and before[-1:] not in opens and after[:1] not in closes:
17       sys.stdout.write('\n')
18     sys.stdout.write(i + '\n')
19     j = i.find('//')
20     before = i if j == -1 else i[:j].rstrip()
21     blank = False