コード例 #1
0
 def __init__(self, st):
     self.finallst = []
     self.commentbin = []
     self.wordbin = []
     sep = ";"
     linesep = mylib3.getlinesep(st)
     st = "dummy;" + linesep + st  # the first command is skipped
     (comment, word, rest) = self.commentwordrest(st, sep, linesep)
     self.commentbin.append(comment)
     self.wordbin.append(word)
     while rest != None:
         rest = self.commasemifinish(rest, linesep)
コード例 #2
0
ファイル: eplusdata.py プロジェクト: JasonGlazer/eppy
def removecomment(st,c):
    # the comment is similar to that in python.
    # any charachter after the # is treated as a comment 
    # until the end of the line
    # st is the string to be de-commented
    # c is the comment phrase
    linesep=mylib3.getlinesep(st)
    ls=st.split(linesep)
    for i in range(len(ls)):
        l=ls[i].split(c)
        ls[i]=l[0]
    
    return string.join(ls,linesep)
コード例 #3
0
    def __init__(self, st):
        linesep = mylib3.getlinesep(st)
        self.linesep = linesep
        nocom = nocomment(st)
        iddst = nocom.nocom.strip()
        st = self.removecommasemi(iddst)

        # b=eplus1.ordereddict()
        while st.find(";") != -1:
            (command, this, rest) = self.commandthisrest(st)
            st = rest
            self.add(command, this)

        self.reverse()
コード例 #4
0
def removeblanklines(st):
	"""
	removeblanklines(st)
	returns the string after
	remove blank lines in 'st'
	"""
	linesep=mylib3.getlinesep(st)
	ls=st.split(linesep)
	lss=[]
	for el in ls:
		ell=el.strip()
		if ell!='':
			lss.append(el)
	st1=linesep.join(lss)
	return st1
コード例 #5
0
 def stripcomments(self, text):
     lsep = mylib3.getlinesep(text)
     ls = string.split(text, lsep)
     for i in range(len(ls)):
         ls[i] = self.striplinecomments(ls[i])
     return string.join(ls, lsep)