Next / Previous / Contents / Shipman's homepage

16.4. Rank.__init__(): Constructor

nomcompile3
# - - -   R a n k . _ _ i n i t _ _

    def __init__ ( self, depth, scan ):
        '''Converts a rank file line into a Rank object.
        '''
        #-- 1 --
        self.depth = depth

For the methods that process each field, see Section 16.5, “Rank.__scanCode(): Scan the code field”; Section 16.6, “Rank.__scanRequired(): Scan the required flag field”; Section 16.7, “Rank.__scanKeyLen(): Scan the key length field”; and Section 16.8, “Rank.__scanName(): Scan the rank name field”.

nomcompile3
        #-- 2 --
        # [ if the line in scan starts with a valid code field ->
        #     scan  :=  scan advanced past that field
        #     self.code  :=  that code, blank-stripped
        #   else ->
        #     scan  :=  scan advanced no further than end of line
        #     Log()  +:=  error message(s)
        #     raise SyntaxError ]
        self.__scanCode ( scan )

        #-- 3 --
        # [ if the line in scan starts with a valid required flag
        #   field ->
        #     scan  :=  scan advanced past that field
        #     self.required  :=  that field encoded as True for ' ',
        #         False for '?'
        #   else ->
        #     scan  :=  scan advanced no further than end of line
        #     Log()  +:=  error message(s)
        #     raise SyntaxError ]
        self.__scanRequired ( scan )

        #-- 4 --
        # [ if the line in scan starts with a valid key length field ->
        #     scan  :=  scan advanced past that field
        #     self.keyLen  :=  that field as an int
        #   else ->
        #     scan  :=  scan advanced no further than end of line
        #     Log()  +:=  error message(s)
        #     raise SyntaxError ]
        self.__scanKeyLen ( scan )

        #-- 5 --
        # [ 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 ]
        self.__scanName ( scan )