Next / Previous / Contents / Shipman's homepage

19.13. BaseCompiler.scanEncounter(): Process an encounter line

This method processes the various different kinds of encounter lines.

baseclasses.py
# - - -   B a s e 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.
        '''

This method classifies the various types of encounter lines and parses them. Most of the work is done by a static method of class BaseEncounter. That method processes encounter lines under the MAPS 2006 protocol. Derived classes for other protocols should replace this method with one that uses a class derived from BaseEncounter.

In the future, when implementing the next protocol after MAPS 2006, the logic for the current protocol should be moved out of BaseEncounter.scanEncounter(), and that method should be replaced with the new protocol, so that the base class's .scanEncounter() method is always the latest MAPS protocol. See Section 74.6, “BaseEncounter.scanLine(): Scan a raw encounter record”.

baseclasses.py
        #-- 1 --
        # [ if the line in self.scan is a valid MAPS 2006
        #   encounter line ->
        #     self.oldEncounter  :=  a BaseEncounter object
        #                            representing that record
        #     yield that BaseEncounter object
        #   else ->
        #     Log()  +:=  error message(s) ]
        try:
            encounter = BaseEncounter.scanLine(self, self.scan)
            self.oldEncounter = encounter
            yield encounter
            
        except SyntaxError:
            pass

        #-- 2 --
        raise StopIteration