1 from __future__
import print_function
2 from builtins
import range
4 __date__ =
"$2010-09-23 15.00.20$" 8 declarator =
'(\*|&)?(\w|<|,|>|$|::)+' 9 cv_decl =
'\s*(const|volatile|noexcept)\s*' 10 exception =
'throw\(((::)|\w|\s|,|<|>)*\)' 11 decl_param =
'\s((\(%s\))|(%s))\s*\((\w|\s|\*|&|\.|=|\'|\"|-|<|>|,|(::))*\)'%(declarator, declarator)
12 operator =
'(%s|)operator\s*(\(\)|\[\]|\s+(new|delete)(\s*\[\]|)|\->[*]{0,1}|[+\-*/%%^&|~!=<>,]{1,2}(=|))'%(declarator)
14 functStart_re = re.compile(
'(\s|~|^)((\(%s\))|(%s)|(%s))\s*\((%s|\w|\s|\*|&|\.|=|\'|\"|-|<|>|,|::)*\)(%s)?(%s)?\s*(%s)?\s*{'%(declarator, declarator, operator, decl_param, cv_decl, exception,dm_init), re.MULTILINE)
19 for i
in range(len(fileList)):
20 if type(fileList[0]).__name__ !=
'tuple':
27 files.append((file, fileLines))
34 if type(file).__name__ !=
'list':
35 lines = open(file).read()
43 m = functStart_re.search(lines)
47 startPosition = m.start()
49 for i, character
in enumerate(lines[m.end():]):
52 elif character ==
"}":
54 if openBracket == closeBracket :
55 prevEndPosition += endPosition
56 endPosition = m.end() + i + 1
58 if openBracket != closeBracket:
59 print(
"Error in file. To much open brackets. Run commentSkipper before you run functionSkipper.")
64 lines =
delLines(lines, startPosition, endPosition)
65 fileLines = fileLines[:prevEndPosition] + lines
66 lines = lines[endPosition:]
72 for index, character
in enumerate(fileLines):
74 listOfLines.append(fileLines[startLine:index+1])
76 listOfLines.append(fileLines[startLine:])
79 def delLines(string, startPosition, endPosition):
83 if i != -1
and string[i] !=
'\n':
86 string = string[:i+1] + (end - i - 1)*
' ' + string[end:]
91 while(i != endPosition):
95 string = string[:start] + (i-start)*
str(
" ") + string[i:]
98 string = string[:start] + (endPosition-start)*
str(
" ") + string[endPosition:]
S & print(S &os, JobReport::InputFile const &f)
def filterFiles(fileList)
def delLines(string, startPosition, endPosition)