# - - - T x n y . _ _ s c a n S u b s p e c i f i c A l t def __scanSubspecificAlt ( self, scan, code ): '''Scan a line defining a sub-specific form. [ (scan is a Scan instance) and (code is a bird code) -> if (code+ALT_SUBSPECIES+(line in scan) are a valid subspecific alternate forms line -> scan := scan advanced to end of line self.taxaTree +:= a new subspecies taxon made from that line self.abTab +:= a new StdBind binding for (code) to that new taxon else -> scan := scan advanced no further than end of line Log() +:= error message(s) raise SyntaxError ] '''
Here are a couple of examples. Underbars are used to mark up words that should be presented in italics whenever possible.
branth<brant Brant (_hrota_) prhlar<horlar Lark, Prairie (_practicola_) Horned
txny.hier does not contain the
subspecific rank, there is no need to proceed with
#-- 1 -- # [ if self.hier contains rank code SSP_CODE -> # I # else -> # scan := scan advanced to end of line # return ] if SSP_CODE not in self.hier: scan.tab(-1) return
scan is pointing just past the
<” character. The first step
is to scan the code for the containing species; see
Section 17.17, “
Txny.__scanAbbr(): Scan a code”.
#-- 2 -- # [ if the line in scan starts with a valid bird code, # right-padded to abbrMod.ABBR_L -> # scan := scan advanced by abbrMod.ABBR_L # otherCode := that bird code, uppercased and stripped # else -> # Log() +:= error message(s) # raise SyntaxError ] otherCode = self.__scanAbbr ( scan )
The rest of the line is the English name, typically set off from the second bird code by one space, but we strip spaces from both ends, just in case.
#-- 3 -- # [ scan := scan advanced to the end of the line # eng := balance of the line in scan, stripped of leading # and trailing whitespace ] eng = scan.tab(-1).strip()
Now we have everything we need to create a new
Taxon instance and a binding for the new code. For
the logic that does all that, see Section 17.23, “
subspecific taxa are added after the entire standard
forms file has been read, the
otherCode must be
defined as a species-rank taxon.
#-- 4 -- # [ if otherCode is bound to a species in self.abTab -> # self.taxaTree +:= a new subspecies with otherCode's # species as its parent, English name (eng), # normal status, canon (code), and disamb (None) # self.abTab +:= a new StdBind binding (code) to # that new subspecies # else -> # Log() +:= error message(s) # raise SyntaxError ] self.__bindSubspecificAlt ( scan, otherCode, eng, code )