This class contains the machinery for processing a file in
the MAWS 2007 protocol. It is nearly identical to Maps2004Compiler, except that it expects a
six-character rather than a four-character species code.
BaseCompiler class.
# - - - - - c l a s s M a w s 2 0 0 7 C o m p i l e r - - - - -
class Maws2007Compiler(Maps2004Compiler):
'''Compiler logic for the MAWS 2007 protocol.
Exports: As inherited.
'''
Same as the inherited method, but it uses the Maws2007Encounter constructor instead of BaseEncounter.
# - - - M a w s 2 0 0 7 C o m p i l e r . s c a n E n c o u n t e r
def scanEncounter(self):
'''Process an encounter line.
'''
#-- 1 --
# [ if the line in self.scan is a valid MAWS 2007
# encounter line ->
# self.oldEncounter := a Maws2007Encounter object
# representing that record
# yield that Maws2007Encounter object
# else ->
# Log() +:= error message(s) ]
try:
encounter = Maws2007Encounter.scanLine(self, self.scan)
self.oldEncounter = encounter
yield encounter
except SyntaxError:
pass
#-- 2 --
raise StopIteration