Example #1
0
 @Override
 public Boolean caseForLoopStart(ForLoopStart object) {
   RichStringForLoop loop = object.getLoop();
   acceptor.acceptForLoop(loop.getDeclaredParam(), loop.getForExpression());
   pushTemplateIndentationTwice(
       computeInitialIndentation((RichString) loop.getEachExpression()));
   boolean hasNext =
       acceptor.forLoopHasNext(
           loop.getBefore(),
           loop.getSeparator(),
           indentationHandler.getTotalSemanticIndentation());
   if (hasNext) {
     while (hasNext) {
       computeNextPart(object);
       while (nextPart != object.getEnd()) {
         doSwitch(nextPart);
       }
       hasNext =
           acceptor.forLoopHasNext(
               loop.getBefore(),
               loop.getSeparator(),
               indentationHandler.getTotalSemanticIndentation());
     }
   } else {
     nextPart = object.getEnd();
   }
   return Boolean.TRUE;
 }
Example #2
0
 @Override
 public Boolean caseRichStringForLoop(RichStringForLoop object) {
   ForLoopStart start = factory.createForLoopStart();
   start.setLoop(object);
   addToCurrentLine(start);
   doSwitch(object.getEachExpression());
   ForLoopEnd end = factory.createForLoopEnd();
   end.setStart(start);
   addToCurrentLine(end);
   return Boolean.TRUE;
 }