-
Notifications
You must be signed in to change notification settings - Fork 81
/
doxyfilter.py
executable file
·42 lines (40 loc) · 1.16 KB
/
doxyfilter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
from __future__ import print_function
import fileinput
import string
import re
commentblock = 0
emptycomment = re.compile("^//$")
fullcomment = re.compile("^//.")
foldmarker = re.compile("^///")
hppfile = re.compile("^.*\.hpp$")
for line in fileinput.input():
if hppfile.match(fileinput.filename()):
line = string.expandtabs(line)
token = string.strip(line)
indent = len(line) - len(string.lstrip(line))
if (indent > 0):
blanks = string.ljust("", indent-1)
else:
blanks = ""
if emptycomment.match(token):
continue
if fullcomment.match(token) and not foldmarker.match(token):
if commentblock:
print(re.sub("//", " ", line))
else:
print()
print(blanks)
print("/*!")
print(re.sub("//", " ", line))
commentblock = 1
else:
if commentblock:
print(blanks)
print(" */")
print(line)
commentblock = 0
else:
print(line)
else:
print(line)