2 __date__ =
"$2010-09-23 15.00.20$"
6 declarator =
'(\*|&)?(\w|<|>|$|::)+'
7 cv_decl =
'\s*(const|volatile|noexcept)\s*'
8 exception =
'throw\(((::)|\w|\s|,|<|>)*\)'
9 decl_param =
'\s((\(%s\))|(%s))\s*\((\w|\s|\*|&|\.|=|\'|\"|-|<|>|,|(::))*\)'%(declarator, declarator)
10 operator =
'(%s|)operator\s*(\(\)|\[\]|\s+(new|delete)(\s*\[\]|)|\->[*]{0,1}|[+\-*/%%^&|~!=<>,]{1,2}(=|))'%(declarator)
12 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)
17 for i
in range(len(fileList)):
18 if type(fileList[0]).__name__ !=
'tuple':
25 files.append((file, fileLines))
32 if type(file).__name__ !=
'list':
33 lines = open(file).
read()
41 m = functStart_re.search(lines)
45 startPosition = m.start()
47 for i, character
in enumerate(lines[m.end():]):
50 elif character ==
"}":
52 if openBracket == closeBracket :
53 prevEndPosition += endPosition
54 endPosition = m.end() + i + 1
56 if openBracket != closeBracket:
57 print "Error in file. To much open brackets. Run commentSkipper before you run functionSkipper."
62 lines = delLines(lines, startPosition, endPosition)
63 fileLines = fileLines[:prevEndPosition] + lines
64 lines = lines[endPosition:]
70 for index, character
in enumerate(fileLines):
72 listOfLines.append(fileLines[startLine:index+1])
74 listOfLines.append(fileLines[startLine:])
77 def delLines(string, startPosition, endPosition):
81 if i != -1
and string[i] !=
'\n':
84 string = string[:i+1] + (end - i - 1)*
' ' + string[end:]
89 while(i != endPosition):
93 string = string[:start] + (i-start)*str(
" ") + string[i:]
96 string = string[:start] + (endPosition-start)*str(
" ") + string[endPosition:]