protected void addToCurrentLine(LinePart part) {
   if (currentLine == null) {
     currentLine = factory.createLine();
     if (!(part instanceof Literal) && !result.getLines().isEmpty()) {
       Line prevLine = result.getLines().get(result.getLines().size() - 1);
       LineBreak lineBreak = (LineBreak) prevLine.getParts().get(prevLine.getParts().size() - 1);
       Literal literal = factory.createLiteral();
       literal.setLength(0);
       literal.setOffset(lineBreak.getLiteral().getValue().length());
       literal.setLiteral(lineBreak.getLiteral());
       currentLine.getParts().add(literal);
     }
     result.getLines().add(currentLine);
   }
   if (part != null) currentLine.getParts().add(part);
 }
 public void announceSemanticLinebreak(LineBreak lineBreak) {
   boolean controlStructureSeen = false;
   for (LinePart part : lineBreak.getLine().getParts()) {
     if (!(part instanceof Literal)) {
       controlStructureSeen = true;
       break;
     }
   }
   acceptor.acceptSemanticLineBreak(
       lineBreak.getLength(), lineBreak.getLiteral(), controlStructureSeen);
 }
 protected void announceTemplateLinebreak(LineBreak lineBreak) {
   acceptor.acceptTemplateLineBreak(lineBreak.getLength(), lineBreak.getLiteral());
 }