--- /globalhome/mol/projects/LOFAR/shlex-32.py 2009-10-09 08:14:40.543753080 +0000 +++ shlex.py 2009-10-09 08:15:55.707647906 +0000 @@ -134,16 +134,24 @@ class shlex: if not nextchar: self.state = None # end of file break - elif nextchar in self.whitespace: + elif nextchar in self.commenters: + remainder = self.instream.readline() + self.lineno = self.lineno + 1 + + if not remainder: + self.state = None # end of file + break + + # continue parsing the newline as any other character + nextchar = '\n' + + if nextchar in self.whitespace: if self.debug >= 2: print "shlex: I see whitespace in whitespace state" if self.token or (self.posix and quoted): break # emit current token else: continue - elif nextchar in self.commenters: - self.instream.readline() - self.lineno = self.lineno + 1 elif self.posix and nextchar in self.escape: escapedstate = 'a' self.state = nextchar