@@ -1179,6 +1179,16 @@ struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
return expr_get_leftmost_symbol(ret);
}
+static void
+expr_print_newline(struct expr *e,
+ void (*fn)(void *, struct symbol *, const char *),
+ void *data,
+ int prevtoken)
+{
+ fn(data, NULL, "\n - ");
+ expr_print(e, fn, data, prevtoken);
+}
+
static void __expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken, bool revdep)
{
if (!e) {
@@ -1191,7 +1201,10 @@ static void __expr_print(struct expr *e, void (*fn)(void *, struct symbol *, con
switch (e->type) {
case E_SYMBOL:
if (e->left.sym->name)
- fn(data, e->left.sym, e->left.sym->name);
+ if (!revdep)
+ fn(data, e->left.sym, e->left.sym->name);
+ else
+ expr_print_newline(e, fn, data, E_OR);
else
fn(data, NULL, "<choice>");
break;
@@ -1234,19 +1247,19 @@ static void __expr_print(struct expr *e, void (*fn)(void *, struct symbol *, con
fn(data, e->right.sym, e->right.sym->name);
break;
case E_OR:
- if (revdep && e->left.expr->type != E_OR)
- fn(data, NULL, "\n - ");
__expr_print(e->left.expr, fn, data, E_OR, revdep);
- if (revdep)
- fn(data, NULL, "\n - ");
- else
+ if (!revdep)
fn(data, NULL, " || ");
__expr_print(e->right.expr, fn, data, E_OR, revdep);
break;
case E_AND:
- expr_print(e->left.expr, fn, data, E_AND);
- fn(data, NULL, " && ");
- expr_print(e->right.expr, fn, data, E_AND);
+ if (!revdep) {
+ expr_print(e->left.expr, fn, data, E_AND);
+ fn(data, NULL, " && ");
+ expr_print(e->right.expr, fn, data, E_AND);
+ } else {
+ expr_print_newline(e, fn, data, E_OR);
+ }
break;
case E_LIST:
fn(data, e->right.sym, e->right.sym->name);