Next / Previous / Contents / Shipman's homepage

40. Scan.tabMatchArb(): Case-insensitive match and move

logscan.py
# - - -   S c a n . t a b M a t c h A r b

    def tabMatchArb(self, s):
        '''Check to see if s is next, and advance past it if so.
        '''
        #-- 1 --
        # [ if the current position starts with s, case-insensitive ->
        #     endPos  :=  the position just after the match
        #   else ->
        #     endPos  :=  none ]
        endPos = self.matchArb(s)

        #-- 2 --
        # [ if endPos is None ->
        #     return None
        #   else ->
        #     self  :=  self advanced to endPos
        #     return current line between self.pos and endPos ]
        if endPos is None:
            return None
        else:
            return self.tab(endPos)