Next / Previous / Contents / Shipman's homepage

20.1. StdHead.__init__()

nomcompile3
# - - -   S t d H e a d . _ _ i n i t _ _

    def __init__ ( self, hier, scan ):
        '''Parse the common head portion of a std forms line.
        '''

See Section 20.2, “StdHead.__scanRankCode() and Section 20.3, “StdHead.__scanStatus(). The length of a rank code is given in Section 6.9, “L_RANK_CODE.

nomcompile3
        #-- 1 --
        # [ if scan starts with a rank code ->
        #     if that rank code is in hier ->
        #       scan  :=  scan advanced past that rank code
        #       self.rank  :=  the Rank instance corresponding to
        #                      that code in hier
        #     else ->
        #       scan  :=  scan advanced not past end of line
        #       raise KeyError 
        #   else if scan starts with L_RANK_CODE blanks ->
        #     scan  :=  scan advanced L_RANK_CODE
        #     self.rank  :=  None
        #   else ->
        #     scan  :=  scan advanced not past end of line
        #     Log()  +:=  error message(s)
        #     raise SyntaxError ]
        self.__scanRankCode ( hier, scan )

        #-- 2 --
        # [ if scan starts with a valid status field ->
        #     scan  :=  scan advanced past that field
        #     self.status  :=  that field
        #   else ->
        #     scan  :=  scan advanced not past end of line
        #     Log()  +:=  error message(s)
        #     raise SyntaxError ]
        self.__scanStatus ( scan )