예제 #1
0
void PrettyPrinter::VisitWhileStatement(WhileStatement* node) {
  PrintLabels(node->labels());
  Print("while (");
  Visit(node->cond());
  Print(") ");
  Visit(node->body());
}
예제 #2
0
void PrettyPrinter::VisitForOfStatement(ForOfStatement* node) {
  PrintLabels(node->labels());
  Print("for (");
  Visit(node->each());
  Print(" of ");
  Visit(node->iterable());
  Print(") ");
  Visit(node->body());
}
예제 #3
0
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("}");
}
예제 #4
0
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;
}
예제 #5
0
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());
}
예제 #6
0
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;
    }
}