[Python-checkins] python/dist/src/Lib shlex.py,1.18,1.19

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Thu, 17 Apr 2003 15:01:23 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv16227

Modified Files:
	shlex.py 
Log Message:
- use Tue/False for booleans
- some very minor cleanups


Index: shlex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/shlex.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** shlex.py	17 Apr 2003 21:31:29 -0000	1.18
--- shlex.py	17 Apr 2003 22:01:17 -0000	1.19
***************
*** 22,26 ****
  class shlex:
      "A lexical analyzer class for simple shell-like syntaxes."
!     def __init__(self, instream=None, infile=None, posix=0):
          if type(instream) in StringTypes:
              instream = StringIO(instream)
--- 22,26 ----
  class shlex:
      "A lexical analyzer class for simple shell-like syntaxes."
!     def __init__(self, instream=None, infile=None, posix=False):
          if type(instream) in StringTypes:
              instream = StringIO(instream)
***************
*** 43,47 ****
                                 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')
          self.whitespace = ' \t\r\n'
!         self.whitespace_split = 0
          self.quotes = '\'"'
          self.escape = '\\'
--- 43,47 ----
                                 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')
          self.whitespace = ' \t\r\n'
!         self.whitespace_split = False
          self.quotes = '\'"'
          self.escape = '\\'
***************
*** 62,66 ****
          if self.debug >= 1:
              print "shlex: pushing token " + `tok`
!         self.pushback = [tok] + self.pushback
  
      def push_source(self, newstream, newfile=None):
--- 62,66 ----
          if self.debug >= 1:
              print "shlex: pushing token " + `tok`
!         self.pushback.insert(0, tok)
  
      def push_source(self, newstream, newfile=None):
***************
*** 91,96 ****
          "Get a token from the input stream (or from stack if it's nonempty)"
          if self.pushback:
!             tok = self.pushback[0]
!             self.pushback = self.pushback[1:]
              if self.debug >= 1:
                  print "shlex: popping token " + `tok`
--- 91,95 ----
          "Get a token from the input stream (or from stack if it's nonempty)"
          if self.pushback:
!             tok = self.pushback.pop(0)
              if self.debug >= 1:
                  print "shlex: popping token " + `tok`
***************
*** 108,112 ****
          # Maybe we got EOF instead?
          while raw == self.eof:
!             if len(self.filestack) == 0:
                  return self.eof
              else:
--- 107,111 ----
          # Maybe we got EOF instead?
          while raw == self.eof:
!             if not self.filestack:
                  return self.eof
              else:
***************
*** 122,126 ****
  
      def read_token(self):
!         quoted = 0
          escapedstate = ' '
          while 1:
--- 121,125 ----
  
      def read_token(self):
!         quoted = False
          escapedstate = ' '
          while 1:
***************
*** 168,172 ****
                          continue
              elif self.state in self.quotes:
!                 quoted = 1
                  if not nextchar:      # end of file
                      if self.debug >= 2:
--- 167,171 ----
                          continue
              elif self.state in self.quotes:
!                 quoted = True
                  if not nextchar:      # end of file
                      if self.debug >= 2:
***************
*** 230,234 ****
                      self.token = self.token + nextchar
                  else:
!                     self.pushback = [nextchar] + self.pushback
                      if self.debug >= 2:
                          print "shlex: I see punctuation in word state"
--- 229,233 ----
                      self.token = self.token + nextchar
                  else:
!                     self.pushback.insert(0, nextchar)
                      if self.debug >= 2:
                          print "shlex: I see punctuation in word state"