public void visitExternDeclarations(ExternDeclarations e) { append("extern \"", e.getLanguage(), "\" {\n"); indent(); implode(e.getDeclarations(), "\n" + indent); deindent(); append("\n", indent, "}"); }
public void visitTry(Try e) { append("try {\n"); indent(); append(indent, e.getTryStatement()); deindent(); append("\n", indent, "}"); implode(e.getCatches(), " "); if (e.getFinallyStatement() != null) { append(" finally {\n"); indent(); append(indent); append(e.getFinallyStatement()); deindent(); append("\n", indent, "}"); } }
@Override public void visitNamespace(Namespace ns) { append("namespace ").append(ns.getName()).append(" {\n"); indent(); implode(ns.getDeclarations(), "\n" + indent); deindent(); append("\n", indent, "}"); }
@Override public void visitDoWhile(DoWhile doWhileStat) { append("do {\n"); indent(); append(doWhileStat.getBody()); deindent(); append("\n", indent, "} while (").append(doWhileStat.getCondition()).append(");"); }
@Override public void visitWhile(While whileStat) { append("while (").append(whileStat.getCondition()).append("{\n"); indent(); append(whileStat.getBody()); deindent(); append("\n", indent, "}"); }
public void visitBlock(Block e) { append("{"); if (!e.getStatements().isEmpty()) { if (e.isCompact()) { append(' '); implode(e.getStatements(), ", "); append(' '); } else { indent(); append("\n", indent); implode(e.getStatements(), "\n" + indent); deindent(); append("\n", indent); } } append('}'); }
append("\n"); deindent(); append(indent, "}");
@Override public void visitFor(For aFor) { append("for (").implode(aFor.getInitStatements(), ", ").append(";").append(aFor.getCondition()).append(";").implode(aFor.getPostStatements(), ", ").append(") {\n"); indent(); append(aFor.getBody()); deindent(); append("\n", indent, "}"); }
public void visitEnumItem(EnumItem e) { formatComments(e, false, true, true); append(e.getName()); if (!e.getArguments().isEmpty()) { if (e.getType() == Type.C) { append(" = ", e.getArguments().get(0)); } else { append("("); implode(e.getArguments(), ", "); append(")"); } } if (e.getBody() != null) { append(" {\n\t", indent); indent(); implode(e.getBody().getDeclarations(), "\n" + indent); deindent(); append("\n", indent, "}"); } space(e.getCommentAfter() != null).append(e.getCommentAfter()); }
public void visitIf(If e) { append("if (", e.getCondition(), ") "); if (e.getThenBranch() == null) { append("<null>"); } else { if (e.getThenBranch() instanceof Block) { append(e.getThenBranch()); if (e.getElseBranch() != null) { append(" "); } } else { indent(); append("\n", indent, e.getThenBranch()); deindent(); if (e.getElseBranch() != null) { append("\n", indent); } } } if (e.getElseBranch() != null) { append("else "); if (e.getElseBranch() instanceof Block) { append(e.getElseBranch()); } else { indent(); append("\n", indent, e.getElseBranch()); deindent(); } } }
append(indent); implode(e.getDeclarations(), "\n" + indent); deindent(); append("\n", indent, "}");