class ListingParser {

    public ListingParseResult parseListing(final File listing) throws IOException {
        if (listing == null)
            throw new NullPointerException("Listing cannot be null.");

        final EtmPoint point = PointFactory.getPoint(getClass(), "parseListing");
        final Collection<CclError> errors = new ArrayList<CclError>();
        final Collection<CclWarning> warnings = new ArrayList<CclWarning>();
        try {
            for (final Iterator<String> it = readFile(listing).iterator(); it.hasNext();) {
                final String line = it.next();
                if (!LINE_NUM_PATTERN.matcher(line).matches()) {
                    if (line.startsWith("%CCL-E"))
                        errors.add(new CclError(parseMessage(line, it)));
                    else if (line.startsWith("%CCL-W"))
                        warnings.add(new CclWarning(parseMessage(line, it)));
                }
            }
        } finally {
            point.collect();
        }

        return new ListingParseResult(warnings, errors);
    }

}