void asl_cel_format::stack_event(stream_type& os, bool is_push) { const format_element_t& top(stack_top()); name_t self(top.tag()); name_t parent(stack_depth() >= 2 ? stack_n(1).tag() : name_t()); if (self == atom_name_g) { handle_atom(os, is_push); } else if (is_push) { if (self == bag_name_g) { os << '{'; up(); } else if (self == seq_name_g && parent != bag_name_g) { os << "[ "; } } else { if (self == bag_name_g) { down(); if (top.num_out_m > 0) os << '\n' << indents(depth()); else os << ' '; os << '}'; } else if (self == seq_name_g && parent != bag_name_g) { if (top.num_out_m > 0) os << ' '; os << ']'; } } }
void pdf_format::stack_event(stream_type& os, bool is_push) { const format_element_t& top(stack_top()); name_t self(top.tag()); name_t parent(stack_depth() >= 2 ? stack_n(1).tag() : name_t()); name_t grandparent(stack_depth() >= 3 ? stack_n(2).tag() : name_t()); if (self == atom_name_g) { handle_atom(os, is_push); } else if (is_push) { if (self == static_name_t("pdf")) { os << "% start pdf" << std::endl; } else if (self == bag_name_g) { os << "<<"; up(); } else if (self == seq_name_g && parent != bag_name_g) { os << "[ "; } } else { if (self == static_name_t("pdf")) { os << "\n% end pdf"; } else if (self == bag_name_g) { down(); if (top.num_out_m > 0) os << '\n' << indents(depth()); else os << ' '; os << ">>"; } else if (self == seq_name_g && parent != bag_name_g) { if (top.num_out_m > 0) os << ' '; os << ']'; } } }