예제 #1
0
  /**
   * Print a description of the <b>if-then-else</b> construct. If the <b>else</b> part is empty,
   * just print an <b>if-then</b> construct.
   *
   * @param out Where to print the description.
   * @param depth How much indentation to use while printing.
   */
  @Override
  public void printOn(PrintStream out, int depth) {
    Indentable.printIndentOnLn(out, depth, "if " + condition + " then ");

    whenTrue.printOnSeperateLines(out, depth + 1);
    if (whenFalse != null) {
      Indentable.printIndentOnLn(out, depth, "else");
      whenFalse.printOnSeperateLines(out, depth + 1);
    }
    Indentable.printIndentOnLn(out, depth, "fi");
  }
 /**
  * Print a description of the <b>repeat-until</b> construct.
  *
  * @param out Where to print the description.
  * @param depth How much indentation to use while printing.
  */
 @Override
 public void printOn(PrintStream out, int depth) {
   Indentable.printIndentOnLn(out, depth, "repeat");
   body.printOnSeperateLines(out, depth + 1);
   Indentable.printIndentOnLn(out, depth, " until " + expn);
 }
예제 #3
0
 /**
  * Print <b>return</b> on a line, by itself.
  *
  * @param out Where to print.
  * @param depth How much indentation to use while printing.
  */
 @Override
 public void printOn(PrintStream out, int depth) {
   Indentable.printIndentOn(out, depth);
   out.println("return ");
 }