Compared to the MAPS 2006 protocol, compiling the MAPS 2004 protocol has these differences:
Instead of the current free-field tail section
that follows the alignment character, this compiler uses
the old fixed-field “short tail” and
“long tail” formats. Even the alignment
character is affected; it may be “*” to signify feather-pulled.
The output record lacks the cloacal swab field at the very end.
Inheritance handles both these variations. We use the
inherited mechanism until the scanEncounter() method, at which point we replace that method with that
instantiates a Maps2004Encounter record
instead of the inherited Maps2006Encounter
record. The Maps2004Encounter class takes
care of both the differences in input scanning, and the
different output format.
# - - - - - c l a s s M a p s 2 0 0 4 C o m p i l e r - - - - -
class Maps2004Compiler(Maps2006Compiler):
'''Compiler logic for the MAPS 2004 protocol.
Exports: As inherited.
'''
This method is identical to the same method in Maps2006Compiler except that it uses the Maps2004Encounter class instead of the Maps2006Encounter class.
# - - - M a p s 2 0 0 4 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.
'''
See Section 76, “class Maps2004Encounter” and Section 74.6, “BaseEncounter.scanLine(): Scan a raw
encounter record”.
#-- 1 --
# [ if the line in self.scan is a valid MAPS 2004
# encounter line ->
# self.oldEncounter := a Maps2004Encounter object
# representing that record
# yield that Maps2004Encounter object
# else ->
# Log() +:= error message(s) ]
try:
encounter = Maps2004Encounter.scanLine(self, self.scan)
self.oldEncounter = encounter
yield encounter
except SyntaxError:
pass
#-- 2 --
raise StopIteration