CMS 3D CMS Logo

Functions | Variables

commentSkipper::buildFileCommentSkipper Namespace Reference

Functions

def filterFile
def filterFiles
def filterMultilineComment
def filterOneLineComment

Variables

string __author__ = "Aurelija"
string __date__ = "$2010-07-20 11.52.22$"

Function Documentation

def commentSkipper::buildFileCommentSkipper::filterFile (   file)

Definition at line 14 of file buildFileCommentSkipper.py.

00015                     :
00016     lines = open(file).readlines()
00017     lines = filterMultilineComment(lines, '"""', '"""')
00018     lines = filterMultilineComment(lines, "'''", "'''")
00019     lines = filterMultilineComment(lines, '<!--', '-->')
00020     lines = filterOneLineComment(lines, "#")
00021     return lines
00022 

def commentSkipper::buildFileCommentSkipper::filterFiles (   fileList)

Definition at line 6 of file buildFileCommentSkipper.py.

00007                          :
00008     files = []
00009 
00010     for file in fileList:
00011         files.append((file, filterFile(file)))
00012     return files
00013 

def commentSkipper::buildFileCommentSkipper::filterMultilineComment (   lines,
  commentStart,
  commentEnd 
)

Definition at line 31 of file buildFileCommentSkipper.py.

00032                                                            :
00033     i = 0
00034     tlines = len(lines)
00035     while (i < tlines):
00036         startIndex = lines[i].find(commentStart)
00037         startLine = i
00038         while((startIndex != -1) and (i < tlines)):
00039             endIndex = lines[i].find(commentEnd)
00040             if endIndex != -1:
00041                 if startLine == i:
00042                     lines[i] = lines[i].replace(lines[i][startIndex:endIndex+3], '', 1)
00043                 else:
00044                     lines[i] = lines[i].replace(lines[i][:endIndex+3], '')
00045                 startIndex = lines[i].find(commentStart)
00046                 startLine = i
00047             else:
00048                 if startLine == i:
00049                     lines[i] = lines[i].replace(lines[i][startIndex:], '\n', 1)
00050                 else:
00051                     lines[i] = lines[i].replace(lines[i][:], '\n')
00052                 i += 1
00053         i += 1
00054     return lines
def commentSkipper::buildFileCommentSkipper::filterOneLineComment (   lines,
  commentStart 
)

Definition at line 23 of file buildFileCommentSkipper.py.

00024                                              :
00025     for i in range(len(lines)):
00026         index = lines[i].find(commentStart)
00027         if index != -1:
00028             lines[i] = lines[i].replace(lines[i][index:], '\n')
00029     return lines
00030 


Variable Documentation

Definition at line 1 of file buildFileCommentSkipper.py.

string commentSkipper::buildFileCommentSkipper::__date__ = "$2010-07-20 11.52.22$"

Definition at line 2 of file buildFileCommentSkipper.py.