15 lines = open(file).readlines()
18 for i
in range(len(lines)):
22 while lines[i][j] !=
'\n':
28 if lines[i][j+1] ==
'*' and not commentStage:
30 commentStartLine, commentStartColumn = i, j
33 elif not commentStage
and (lines[i][j+1] ==
'/'):
34 lines[i] = string.replace(lines[i], lines[i][j:],
'\n', 1)
39 next = string.find(lines[i][j+1:],
'"')
40 lines[i] = string.replace(lines[i], lines[i][j:j+next+2],
'', 1)
44 next = string.find(lines[i][j+1:],
'\'')
45 lines[i] = string.replace(lines[i], lines[i][j:j+next+2],
'', 1)
48 if (commentStage
and (lines[i][j+1] ==
'/')):
50 if commentStartLine != i:
51 lines[i] = string.replace(lines[i], lines[i][:j+2],
'', 1)
54 lines[i] = string.replace(lines[i], lines[i][commentStartColumn:j+2],
'', 1)
55 j = commentStartColumn - 1
56 if j != len(lines[i]) - 1:
62 if i == commentStartLine: lines[i] = lines[i].
replace(lines[i][commentStartColumn:],
'\n', 1)
63 else: lines[i] = lines[i].
replace(lines[i][:],
'\n')
64 return lines
def replace(string, replacements)