import os
import collections

from ..coverage_file import CoverageFile

class ModOffData(CoverageFile):
    """
    A module+offset log parser.
    """

    def __init__(self, filepath):
        super(ModOffData, self).__init__(filepath)

    #--------------------------------------------------------------------------
    # Public
    #--------------------------------------------------------------------------

    def get_offsets(self, module_name):
        return self.modules.get(module_name, {}).keys()

    #--------------------------------------------------------------------------
    # Parsing Routines - Top Level
    #--------------------------------------------------------------------------

    def _parse(self):
        """
        Parse modoff coverage from the given log file.
        """
        modules = collections.defaultdict(lambda: collections.defaultdict(int))
        with open(self.filepath) as f:
            for line in f:
                module_name, bb_offset = line.rsplit("+", 1)
                modules[module_name][int(bb_offset, 16)] += 1
        self.modules = modules

@@ -942,24 +942,253 @@
  line in f:%0A
+                trimmed = line.trim()%0A%0A                # skip empty lines%0A                if not len(trimmed): continue%0A%0A                # comments can start with ';' or '#'%0A                if trimmed%5B0%5D in %5B';', '#'%5D: continue%0A%0A
             

Allow blank and comments in modoff