aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/e/required_use_verifier.cc19
-rw-r--r--paludis/repositories/e/required_use_verifier.hh1
-rw-r--r--paludis/repositories/e/spec_tree_pretty_printer.cc40
-rw-r--r--paludis/repositories/e/spec_tree_pretty_printer.hh1
4 files changed, 61 insertions, 0 deletions
diff --git a/paludis/repositories/e/required_use_verifier.cc b/paludis/repositories/e/required_use_verifier.cc
index 593881cd3..6c55c742d 100644
--- a/paludis/repositories/e/required_use_verifier.cc
+++ b/paludis/repositories/e/required_use_verifier.cc
@@ -176,6 +176,25 @@ RequiredUseVerifier::visit(const RequiredUseSpecTree::NodeType<ExactlyOneDepSpec
}
void
+RequiredUseVerifier::visit(const RequiredUseSpecTree::NodeType<AtMostOneDepSpec>::Type & node)
+{
+ _imp->stack.push_front(Met{0, false});
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+
+ Met met(*_imp->stack.begin());
+ _imp->stack.pop_front();
+
+ if (met.number_met <= 1)
+ ++_imp->stack.begin()->number_met;
+ else if (met.number_met > 1)
+ _imp->stack.begin()->any_unmet = true;
+ else if (met.any_unmet)
+ _imp->stack.begin()->any_unmet = true;
+ else
+ ++_imp->stack.begin()->number_met;
+}
+
+void
RequiredUseVerifier::visit(const RequiredUseSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
if (! node.spec()->condition_met(_imp->env, _imp->id))
diff --git a/paludis/repositories/e/required_use_verifier.hh b/paludis/repositories/e/required_use_verifier.hh
index a193c38d1..7b6689635 100644
--- a/paludis/repositories/e/required_use_verifier.hh
+++ b/paludis/repositories/e/required_use_verifier.hh
@@ -51,6 +51,7 @@ namespace paludis
void visit(const RequiredUseSpecTree::NodeType<AllDepSpec>::Type & node);
void visit(const RequiredUseSpecTree::NodeType<AnyDepSpec>::Type & node);
void visit(const RequiredUseSpecTree::NodeType<ExactlyOneDepSpec>::Type & node);
+ void visit(const RequiredUseSpecTree::NodeType<AtMostOneDepSpec>::Type & node);
void visit(const RequiredUseSpecTree::NodeType<ConditionalDepSpec>::Type & node);
};
}
diff --git a/paludis/repositories/e/spec_tree_pretty_printer.cc b/paludis/repositories/e/spec_tree_pretty_printer.cc
index da9996a59..d0437c270 100644
--- a/paludis/repositories/e/spec_tree_pretty_printer.cc
+++ b/paludis/repositories/e/spec_tree_pretty_printer.cc
@@ -139,6 +139,10 @@ namespace
{
}
+ void visit(const GenericSpecTree::NodeType<AtMostOneDepSpec>::Type &)
+ {
+ }
+
void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type &)
{
}
@@ -275,6 +279,42 @@ SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>:
}
void
+SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<AtMostOneDepSpec>::Type & node)
+{
+ Save<bool> old_outer(&_imp->outer_block, false);
+ Save<bool> old_needs_parens(&_imp->all_needs_parens, true);
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << "?? (";
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+
+ {
+ Save<unsigned> old_indent(&_imp->indent, _imp->indent + 1);
+ Save<bool> extra_label_indent(&_imp->extra_label_indent, false);
+ std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this));
+ }
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.indentify(_imp->indent);
+ else if (_imp->need_space)
+ _imp->s << " ";
+ _imp->s << ")";
+
+ do_annotations(*node.spec());
+
+ if (_imp->use_newlines)
+ _imp->s << _imp->pretty_printer.newline();
+ else
+ _imp->need_space = true;
+}
+
+void
SpecTreePrettyPrinter::visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node)
{
Save<bool> old_outer(&_imp->outer_block, false);
diff --git a/paludis/repositories/e/spec_tree_pretty_printer.hh b/paludis/repositories/e/spec_tree_pretty_printer.hh
index 373a7affb..5451ef119 100644
--- a/paludis/repositories/e/spec_tree_pretty_printer.hh
+++ b/paludis/repositories/e/spec_tree_pretty_printer.hh
@@ -53,6 +53,7 @@ namespace paludis
void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node);
void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node);
void visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & node);
+ void visit(const GenericSpecTree::NodeType<AtMostOneDepSpec>::Type & node);
void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node);
void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node);
void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node);