Example #1
0
std::ostream & operator<<(std::ostream & out, options const & o) {
    bool unicode = get_pp_unicode(o);
    out << (unicode ? g_left_angle_bracket : "(");
    bool first = true;
    for_each(o.m_value, [&](sexpr const & p) {
            if (first) first = false; else out << ", ";
            out << head(p) << " " << (unicode ? g_arrow : g_assign) << " " << tail(p);
        });
    out << (unicode ? g_right_angle_bracket : ")");
    return out;
}
Example #2
0
format pp(options const & o) {
    bool unicode = get_pp_unicode(o);
    format r;
    bool first = true;
    char const * arrow = unicode ? g_arrow : g_assign;
    for_each(o.m_value, [&](sexpr const & p) {
            if (first) { first = false; } else { r += comma(); r += line(); }
            name const & n = to_name(head(p));
            unsigned sz = n.size();
            unsigned indent = unicode ? sz+3 : sz+4;
            r += group(nest(indent, pp(head(p)) + space() + format(arrow) + space() + pp(tail(p))));
        });
    format open  = unicode ? format(g_left_angle_bracket) : lp();
    format close = unicode ? format(g_right_angle_bracket) : rp();
    return group(nest(1, open + r + close));
}
Example #3
0
format pp(level const & lhs, level const & rhs, options const & opts) {
    return pp(lhs, rhs, get_pp_unicode(opts), get_pp_indent(opts));
}