Next / Previous / Contents / Shipman's homepage

16.8. Rank.__scanName(): Scan the rank name field

nomcompile3
# - - -   R a n k . _ _ s c a n N a m e

    def __scanName ( self, scan ):
        '''Scan the name of the rank.

          [ scan is a Scan instance ->
              if the line in scan is not blank ->
                scan  :=  scan advanced to end of line
                self.name  :=  remaining characters on the line,
                               deblanked
              else ->
                scan  :=  scan advanced no further than end of line
                Log()  +:=  error message(s)
                raise SyntaxError ]
        '''
        #-- 1 --
        # [ scan  :=  scan advanced to the end of the line
        #   self.name  :=  characters from scan up to end of line,
        #                  deblanked both ends ]
        self.name = scan.tab(-1).strip()

        #-- 2 --
        if len(self.name) == 0:
            scan.syntax ( "Expecting the rank's name, e.g., 'Order'." )