void PrettyPrinter::VisitWhileStatement(WhileStatement* node) { PrintLabels(node->labels()); Print("while ("); Visit(node->cond()); Print(") "); Visit(node->body()); }
void PrettyPrinter::VisitForOfStatement(ForOfStatement* node) { PrintLabels(node->labels()); Print("for ("); Visit(node->each()); Print(" of "); Visit(node->iterable()); Print(") "); Visit(node->body()); }
void PrettyPrinter::VisitSwitchStatement(SwitchStatement* node) { PrintLabels(node->labels()); Print("switch ("); Visit(node->tag()); Print(") { "); ZoneList<CaseClause*>* cases = node->cases(); for (int i = 0; i < cases->length(); i++) Visit(cases->at(i)); Print("}"); }
void ProofNode::PrintGraph(ostream& fout) { //graph notation preamble fout << "digraph proof {" << endl; PrintNodes(fout); fout << endl; PrintLabels(fout); fout << "INFO_NODE [label=\"The conclusion is the negation of the last premise in the root.\" shape=box]" << endl; fout << "}" << endl; fout << endl; }
void PrettyPrinter::VisitForStatement(ForStatement* node) { PrintLabels(node->labels()); Print("for ("); if (node->init() != NULL) { Visit(node->init()); Print(" "); } else { Print("; "); } if (node->cond() != NULL) Visit(node->cond()); Print("; "); if (node->next() != NULL) { Visit(node->next()); // prints extra ';', unfortunately // to fix: should use Expression for next } Print(") "); Visit(node->body()); }
void PrettyPrinter::VisitLoopStatement(LoopStatement* node) { PrintLabels(node->labels()); switch (node->type()) { case LoopStatement::DO_LOOP: ASSERT(node->init() == NULL); ASSERT(node->next() == NULL); Print("do "); Visit(node->body()); Print(" while ("); Visit(node->cond()); Print(");"); break; case LoopStatement::FOR_LOOP: Print("for ("); if (node->init() != NULL) { Visit(node->init()); Print(" "); } else { Print("; "); } if (node->cond() != NULL) Visit(node->cond()); Print("; "); if (node->next() != NULL) Visit(node->next()); // prints extra ';', unfortunately // to fix: should use Expression for next Print(") "); Visit(node->body()); break; case LoopStatement::WHILE_LOOP: ASSERT(node->init() == NULL); ASSERT(node->next() == NULL); Print("while ("); Visit(node->cond()); Print(") "); Visit(node->body()); break; } }