16 lines = open(file).readlines()
19 for i
in range(len(lines)):
23 while lines[i][j] !=
'\n':
29 if lines[i][j+1] ==
'*' and not commentStage:
31 commentStartLine, commentStartColumn = i, j
34 elif not commentStage
and (lines[i][j+1] ==
'/'):
35 lines[i] = string.replace(lines[i], lines[i][j:],
'\n', 1)
40 next = string.find(lines[i][j+1:],
'"')
41 lines[i] = string.replace(lines[i], lines[i][j:j+next+2],
'', 1)
45 next = string.find(lines[i][j+1:],
'\'')
46 lines[i] = string.replace(lines[i], lines[i][j:j+next+2],
'', 1)
49 if (commentStage
and (lines[i][j+1] ==
'/')):
51 if commentStartLine != i:
52 lines[i] = string.replace(lines[i], lines[i][:j+2],
'', 1)
55 lines[i] = string.replace(lines[i], lines[i][commentStartColumn:j+2],
'', 1)
56 j = commentStartColumn - 1
57 if j != len(lines[i]) - 1:
63 if i == commentStartLine: lines[i] = lines[i].
replace(lines[i][commentStartColumn:],
'\n', 1)
64 else: lines[i] = lines[i].
replace(lines[i][:],
'\n')
65 return lines
def replace(string, replacements)