Whitespace normalization.

This commit is contained in:
Tim Peters 2001-01-17 08:48:39 +00:00
parent a888540593
commit 70c4378dbc
57 changed files with 2434 additions and 2440 deletions

View file

@ -1,14 +1,14 @@
"""A lexical analyzer class for simple shell-like syntaxes."""
# Module and documentation by Eric S. Raymond, 21 Dec 1998
# Module and documentation by Eric S. Raymond, 21 Dec 1998
# Input stacking and error message cleanup added by ESR, March 2000
# push_source() and pop_source() made explicit by ESR, January 2001.
# push_source() and pop_source() made explicit by ESR, January 2001.
import os.path
import sys
class shlex:
"A lexical analyzer class for simple shell-like syntaxes."
"A lexical analyzer class for simple shell-like syntaxes."
def __init__(self, instream=None, infile=None):
if instream:
self.instream = instream
@ -101,7 +101,7 @@ class shlex:
self.lineno = self.lineno + 1
if self.debug >= 3:
print "shlex: in state", repr(self.state), \
"I see character:", repr(nextchar)
"I see character:", repr(nextchar)
if self.state is None:
self.token = '' # past end of file
break
@ -136,14 +136,14 @@ class shlex:
if nextchar == self.state:
self.state = ' '
break
elif not nextchar: # end of file
elif not nextchar: # end of file
if self.debug >= 2:
print "shlex: I see EOF in quotes state"
# XXX what error should be raised here?
raise ValueError, "No closing quotation"
elif self.state == 'a':
if not nextchar:
self.state = None # end of file
self.state = None # end of file
break
elif nextchar in self.whitespace:
if self.debug >= 2:
@ -194,7 +194,7 @@ class shlex:
return "\"%s\", line %d: " % (infile, lineno)
if __name__ == '__main__':
if __name__ == '__main__':
if len(sys.argv) == 1:
lexer = shlex()
else: