def parse(system):
    """
    Parse input file with the given format in system.files.input_format
    """

    t, _ = elapsed()

    input_format = system.files.input_format
    add_format = system.files.add_format
    # exit when no input format is given
    if not input_format:
        logger.error(
            'No input format found. Specify or guess a format before parsing.')
        return False

    # exit if the format parser could not be imported
    try:
        parser = importlib.import_module('.' + input_format, __name__)
        dmparser = importlib.import_module('.' + 'dome', __name__)
        if add_format:
            addparser = importlib.import_module('.' + add_format, __name__)
    except ImportError:
        logger.error(
            'Parser for {:s} format not found. Program will exit.'.format(
                input_format))
        return False

    # try parsing the base case file
    logger.info('Parsing input file <{:s}>'.format(system.files.fullname))

    if not parser.read(system.files.case, system):
        logger.error(
            'Error parsing case file {:s} with {:s} format parser.'.format(
                system.files.fullname, input_format))
        return False

    # Try parsing the addfile
    if system.files.addfile:
        if not system.files.add_format:
            logger.error('Unknown addfile format.')
            return
        logger.info('Parsing additional file {:s}.'.format(
            system.files.addfile))
        if not addparser.readadd(system.files.addfile, system):
            logger.error(
                'Error parsing addfile {:s} with {:s} format parser.'.format(
                    system.files.addfile, input_format))
            return False

    # Try parsing the dynfile with dm filter
    if system.files.dynfile:
        logger.info('Parsing input file {:s}.'.format(
            system.files.dynfile))
        if not dmparser.read(system.files.dynfile, system):
            logger.error(
                'Error parsing dynfile {:s} with dm format parser.'.format(
                    system.files.dynfile))
            return False

    _, s = elapsed(t)
    logger.debug('Case file {:s} parsed in {:s}.'.format(
        system.files.fullname, s))

    return True
Parse input file with the given format in system.files.input_format