-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from grimmer0125/use_python3_print_function
Use Python 3 print function instead
- Loading branch information
Showing
1 changed file
with
33 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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) |