aboutsummaryrefslogtreecommitdiff
path: root/paludis/elike_use_requirement.cc
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-10-26 09:31:14 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-10-26 09:31:14 +0000
commitd6ea84ebfedb53646b94779c7f25dfd3bdc18142 (patch)
treef76382e316a9597c2b27818c0837b631faf45f0e /paludis/elike_use_requirement.cc
parent6d533ba362502f2b2d6cab645d248c6daae8f4db (diff)
downloadpaludis-d6ea84ebfedb53646b94779c7f25dfd3bdc18142.tar.gz
paludis-d6ea84ebfedb53646b94779c7f25dfd3bdc18142.tar.xz
Change [opt+] and [opt-] to [opt(+)] and [opt(-)]
Diffstat (limited to 'paludis/elike_use_requirement.cc')
-rw-r--r--paludis/elike_use_requirement.cc54
1 files changed, 29 insertions, 25 deletions
diff --git a/paludis/elike_use_requirement.cc b/paludis/elike_use_requirement.cc
index 1aabf3345..574489fb9 100644
--- a/paludis/elike_use_requirement.cc
+++ b/paludis/elike_use_requirement.cc
@@ -476,37 +476,41 @@ namespace
else
factory = make_unconditional_requirement<EnabledUseRequirement>;
- if ('+' == flag.at(flag.length() - 1))
+ if (')' == flag.at(flag.length() - 1))
{
- if (! options[euro_allow_default_values])
- {
- if (options[euro_strict_parsing])
- throw ELikeUseRequirementError(s, "[use+] not safe for use here");
- else
- Log::get_instance()->message("e.use_requirement.flag_not_equal_not_allowed", ll_warning, lc_context)
- << "[use+] not safe for use here";
- }
-
- flag.erase(flag.length() - 1, 1);
- if (flag.empty())
+ if (flag.length() < 4 || flag.at(flag.length() - 3) != '(')
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return factory(ChoiceNameWithPrefix(flag), id, Tribool(true));
- }
- else if ('-' == flag.at(flag.length() - 1))
- {
- if (! options[euro_allow_default_values])
+
+ if ('+' == flag.at(flag.length() - 2))
{
- if (options[euro_strict_parsing])
- throw ELikeUseRequirementError(s, "[use-] not safe for use here");
- else
- Log::get_instance()->message("e.use_requirement.flag_not_equal_not_allowed", ll_warning, lc_context)
- << "[use-] not safe for use here";
+ if (! options[euro_allow_default_values])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[use(+)] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.flag_bracket_plus_not_allowed", ll_warning, lc_context)
+ << "[use(+)] not safe for use here";
+ }
+
+ flag.erase(flag.length() - 3, 3);
+ return factory(ChoiceNameWithPrefix(flag), id, Tribool(true));
}
+ else if ('-' == flag.at(flag.length() - 2))
+ {
+ if (! options[euro_allow_default_values])
+ {
+ if (options[euro_strict_parsing])
+ throw ELikeUseRequirementError(s, "[use(-)] not safe for use here");
+ else
+ Log::get_instance()->message("e.use_requirement.flag_bracket_minus_not_allowed", ll_warning, lc_context)
+ << "[use(-)] not safe for use here";
+ }
- flag.erase(flag.length() - 1, 1);
- if (flag.empty())
+ flag.erase(flag.length() - 3, 3);
+ return factory(ChoiceNameWithPrefix(flag), id, Tribool(false));
+ }
+ else
throw ELikeUseRequirementError(s, "Invalid [] contents");
- return factory(ChoiceNameWithPrefix(flag), id, Tribool(false));
}
else
return factory(ChoiceNameWithPrefix(flag), id, Tribool(indeterminate));