Next / Previous / Contents / Shipman's homepage

35. Scan.deblankFile(): Skip whitespace over multiple lines

logscan.py
# - - -   S c a n . d e b l a n k F i l e

    def deblankFile(self):
        '''Skip whitespace until end of file
        '''
        #-- 1 --
        while not self.atEndFile:
            #-- 1 body --
            # [ if there is a nonblank character at on the current
            #   line at or after the current position ->
            #     self  :=  self advanced to that character
            #     return
            #   else ->
            #     self  :=  self advanced to the start of the
            #               next line ]

            #-- 1.1 --
            # [ self  :=  self advanced past all whitespace on the
            #       current line at or after the current position ]
            self.deblankLine()

            #-- 1.2 --
            # [ if self is at end of line ->
            #     self  :=  self advanced to the next line or to
            #               end of file, whichever comes first
            #   else -> return ]
            if self.atEndLine():
                self.nextLine()
            else:
                return