aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/SourceParagraph.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-19 19:27:34 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-19 19:27:34 -0700
commitf219ce0b8c3e84e5fc1df21ad2f2c8b13f0fe413 (patch)
treed78ee0a1a2e2a30ee465c6c90cd8544106a9c133 /toolsrc/src/SourceParagraph.cpp
parent4d34488649fe5d71b8a553706d960a3784c56bb1 (diff)
downloadvcpkg-f219ce0b8c3e84e5fc1df21ad2f2c8b13f0fe413.tar.gz
vcpkg-f219ce0b8c3e84e5fc1df21ad2f2c8b13f0fe413.zip
[vcpkg] Reorganize some parsing functions.
Diffstat (limited to 'toolsrc/src/SourceParagraph.cpp')
-rw-r--r--toolsrc/src/SourceParagraph.cpp57
1 files changed, 5 insertions, 52 deletions
diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp
index f9ae6854a..76c5a2004 100644
--- a/toolsrc/src/SourceParagraph.cpp
+++ b/toolsrc/src/SourceParagraph.cpp
@@ -157,29 +157,15 @@ namespace vcpkg
return std::move(control_file);
}
- Features parse_feature_list(const std::string& name)
- {
- auto maybe_spec = ParsedSpecifier::from_string(name);
- if (auto spec = maybe_spec.get())
- {
- Checks::check_exit(
- VCPKG_LINE_INFO, spec->triplet.empty(), "error: triplet not allowed in specifier: %s", name);
-
- Features f;
- f.name = spec->name;
- f.features = spec->features;
- return f;
- }
-
- Checks::exit_with_message(
- VCPKG_LINE_INFO, "error while parsing feature list: %s: %s", to_string(maybe_spec.error()), name);
- }
-
Dependency Dependency::parse_dependency(std::string name, std::string qualifier)
{
Dependency dep;
dep.qualifier = qualifier;
- dep.depend = parse_feature_list(name);
+ if (auto maybe_features = Features::from_string(name))
+ dep.depend = *maybe_features.get();
+ else
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "error while parsing dependency: %s: %s", to_string(maybe_features.error()), name);
return dep;
}
@@ -217,39 +203,6 @@ namespace vcpkg
});
}
- std::vector<std::string> parse_comma_list(const std::string& str)
- {
- if (str.empty())
- {
- return {};
- }
-
- std::vector<std::string> out;
-
- size_t cur = 0;
- do
- {
- auto pos = str.find(',', cur);
- if (pos == std::string::npos)
- {
- out.push_back(str.substr(cur));
- break;
- }
- out.push_back(str.substr(cur, pos - cur));
-
- // skip comma and space
- ++pos;
- if (str[pos] == ' ')
- {
- ++pos;
- }
-
- cur = pos;
- } while (cur != std::string::npos);
-
- return out;
- }
-
std::vector<std::string> filter_dependencies(const std::vector<vcpkg::Dependency>& deps, const Triplet& t)
{
std::vector<std::string> ret;