//Re-order statements so order is MODULE,WIRES,COMPONENTS,ENDMODULE,...repeat bool reorder_statements_list (evl_statements::const_iterator m_itr, evl_statements &statements){ m_itr = statements.begin(); for(evl_statements::const_iterator it = statements.begin(); it != statements.end(); ++it) { if (it->type == evl_statement::WIRE) { statements.insert(++m_itr,*it); m_itr--; it = statements.erase(it); //--it; } } return true; }
void display_statements(std::ostream &out, const evl_statements &statements) { int count = 1; for (evl_statements::const_iterator iter = statements.begin(); iter != statements.end(); ++iter) { if (iter->type == evl_statement::MODULE) { out << "STATEMENT " << count << " MODULE, " << iter->tokens.size() << " tokens" << std::endl; } else if (iter->type == evl_statement::WIRE) { out << "STATEMENT " << count << " WIRE, " << iter->tokens.size() << " tokens" << std::endl; } else if (iter->type == evl_statement::COMPONENT) { out << "STATEMENT " << count << " COMPONENT, " << iter->tokens.size() << " tokens" << std::endl; } else if (iter->type == evl_statement::ENDMODULE) { out << "STATEMENT " << count << " ENDMODULE" << std::endl; } else { out << "ERROR" << std::endl; } count++; } }