while (true) {
DSCCommentPage page = (DSCCommentPage)pageOrTrailer;
boolean validPage = (page.getPagePosition() >= from && page.getPagePosition() <= to);
if (validPage) {
page.setPagePosition(page.getPagePosition() - from + 1);
page.generate(gen);
pageCount++;
}
pageOrTrailer = DSCTools.nextPageOrTrailer(parser, (validPage ? gen : null));
if (pageOrTrailer == null) {
throw new DSCException("File is not DSC-compliant: Unexpected end of file");