1 from __future__
import print_function
3 __date__ =
"$2010-09-23 15.00.20$" 7 declarator =
'(\*|&)?(\w|<|,|>|$|::)+' 8 cv_decl =
'\s*(const|volatile|noexcept)\s*' 9 exception =
'throw\(((::)|\w|\s|,|<|>)*\)' 10 decl_param =
'\s((\(%s\))|(%s))\s*\((\w|\s|\*|&|\.|=|\'|\"|-|<|>|,|(::))*\)'%(declarator, declarator)
11 operator =
'(%s|)operator\s*(\(\)|\[\]|\s+(new|delete)(\s*\[\]|)|\->[*]{0,1}|[+\-*/%%^&|~!=<>,]{1,2}(=|))'%(declarator)
13 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)
18 for i
in range(len(fileList)):
19 if type(fileList[0]).__name__ !=
'tuple':
26 files.append((file, fileLines))
33 if type(file).__name__ !=
'list':
34 lines = open(file).read()
42 m = functStart_re.search(lines)
46 startPosition = m.start()
48 for i, character
in enumerate(lines[m.end():]):
51 elif character ==
"}":
53 if openBracket == closeBracket :
54 prevEndPosition += endPosition
55 endPosition = m.end() + i + 1
57 if openBracket != closeBracket:
58 print(
"Error in file. To much open brackets. Run commentSkipper before you run functionSkipper.")
63 lines =
delLines(lines, startPosition, endPosition)
64 fileLines = fileLines[:prevEndPosition] + lines
65 lines = lines[endPosition:]
71 for index, character
in enumerate(fileLines):
73 listOfLines.append(fileLines[startLine:index+1])
75 listOfLines.append(fileLines[startLine:])
78 def delLines(string, startPosition, endPosition):
82 if i != -1
and string[i] !=
'\n':
85 string = string[:i+1] + (end - i - 1)*
' ' + string[end:]
90 while(i != endPosition):
94 string = string[:start] + (i-start)*
str(
" ") + string[i:]
97 string = string[:start] + (endPosition-start)*
str(
" ") + string[endPosition:]
S & print(S &os, JobReport::InputFile const &f)
def filterFiles(fileList)
def delLines(string, startPosition, endPosition)