@Override
 public Boolean caseRichStringLiteral(RichStringLiteral object) {
   String value = object.getValue();
   List<TextLine> lines = TextLines.splitString(value);
   if (lines.isEmpty()) {
     Literal literal = factory.createLiteral();
     literal.setLength(0);
     literal.setOffset(0);
     literal.setLiteral(object);
     addToCurrentLine(literal);
   } else {
     for (TextLine textLine : lines) {
       Literal literal = factory.createLiteral();
       literal.setLength(textLine.length());
       literal.setOffset(textLine.getRelativeOffset());
       literal.setLiteral(object);
       addToCurrentLine(literal);
       if (textLine.hasTrailingLineBreak()) {
         LineBreak lineBreak = factory.createLineBreak();
         lineBreak.setLength(textLine.getDelimiterLength());
         lineBreak.setOffset(textLine.getRelativeOffset() + textLine.length());
         lineBreak.setLiteral(object);
         addToCurrentLine(lineBreak);
         currentLine = null;
       }
     }
   }
   return Boolean.TRUE;
 }
 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 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);
 }
 @Override
 public Boolean caseLineBreak(LineBreak object) {
   Line line = object.getLine();
   if (isTemplateLine(line)) {
     announceTemplateLinebreak(object);
     ProcessedRichString string = line.getRichString();
     boolean firstOrLast =
         string.getLines().get(0) == line
             || string.getLines().get(string.getLines().size() - 1) == line;
     if (!firstOrLast) popIndentation();
   } else {
     announceSemanticLinebreak(object);
     popIndentation();
   }
   computeNextPart(object);
   return Boolean.TRUE;
 }
 protected void announceTemplateLinebreak(LineBreak lineBreak) {
   acceptor.acceptTemplateLineBreak(lineBreak.getLength(), lineBreak.getLiteral());
 }