Next / Previous / Contents / Shipman's homepage

22. class SpTail: Scanner for the species tail

This class handles only the scanning logic for the tail part of a species line in the standard forms file.

nomcompile3
# - - - -   c l a s s   S p T a i l

class SpTail(object):
    '''Parses the tail section of a species line in the std file.

      Exports:
        SpTail ( scan ):
          [ scan is a Scan instance ->
              if the balance of the line in scan is a valid
              species tail ->
                scan  :=  scan advanced to end of line
                return a new SpTail instance representing the
                fields of that line
              else ->
                scan  :=  scan advanced not past end of line
                Log()  +:=  error message(s)
                raise SyntaxError ]
        .genus:          [ genus name ]
        .subgenus:
          [ if the line had a subgenus field -> its name
            else -> None ]
        .species:        [ species name ]
        .eng:            [ English name ]
        .disamb:
          [ if the line has a disambiguated code -> that code
            else -> None ]
        .canonical:
          [ the bird code derived from self.eng by the standard rules ]
    '''