Next / Previous / Contents / Shipman's homepage

23. class Maws2004Compiler: MAWS compiler

This class contains the machinery for processing a file in the MAWS 2004 protocol.

baseclasses.py
# - - - - -   c l a s s   M a w s 2 0 0 4 C o m p i l e r   - - - - -

class Maws2004Compiler(Maps2004Compiler):
    '''Compiler logic for the MAWS 2004 protocol.

      Exports:  As inherited.
    '''

23.1. Maws2004Compiler.scanEncounter()

Same as the inherited method, but it uses the Maws2004Encounter constructor instead of BaseEncounter.

baseclasses.py
# - - -   M a w 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.
        '''
        #-- 1 --
        # [ if the line in self.scan is a valid MAWS 2004
        #   encounter line ->
        #     self.oldEncounter  :=  a Maws2004Encounter object
        #                            representing that record
        #     yield that Maws2004Encounter object
        #   else ->
        #     Log()  +:=  error message(s) ]
        try:
            encounter = Maws2004Encounter.scanLine(self, self.scan)
            self.oldEncounter = encounter
            yield encounter
            
        except SyntaxError:
            pass

        #-- 2 --
        raise StopIteration