Skip to content

Commit

Permalink
Merge pull request #53 from grimmer0125/use_python3_print_function
Browse files Browse the repository at this point in the history
Use Python 3 print function instead
  • Loading branch information
thorfdbg committed May 20, 2021
2 parents 434f327 + ea854ef commit ea585fa
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions doxyfilter.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,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$")
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,


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)

0 comments on commit ea585fa

Please sign in to comment.