aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/Paragraphs.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-03 14:12:50 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-03 14:12:50 -0700
commit35ccbc869bd6a405ef92db46b4c0eb303ed46a66 (patch)
tree1a6f383e3f8c3803de948ace6bb1ff5986d1e72d /toolsrc/src/Paragraphs.cpp
parent23887e920822599e04a87bff0d03733b309dce98 (diff)
parentb992a05a5979f4a13e2f51a90c34f99847278030 (diff)
downloadvcpkg-35ccbc869bd6a405ef92db46b4c0eb303ed46a66.tar.gz
vcpkg-35ccbc869bd6a405ef92db46b4c0eb303ed46a66.zip
Merge branch 'tobiaskohlbau-vcpkg_comment'
Diffstat (limited to 'toolsrc/src/Paragraphs.cpp')
-rw-r--r--toolsrc/src/Paragraphs.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp
index aebe3d1f8..898fc6460 100644
--- a/toolsrc/src/Paragraphs.cpp
+++ b/toolsrc/src/Paragraphs.cpp
@@ -32,6 +32,16 @@ namespace vcpkg::Paragraphs
}
}
+ void skip_comment(char& ch)
+ {
+ while (ch != '\r')
+ next(ch);
+ if (ch == '\r')
+ next(ch);
+ if (ch == '\n')
+ next(ch);
+ }
+
void skip_spaces(char& ch)
{
while (ch == ' ' || ch == '\t')
@@ -45,6 +55,11 @@ namespace vcpkg::Paragraphs
|| (ch >= '0' && ch <= '9');
}
+ static bool is_comment(char ch)
+ {
+ return (ch == '#');
+ }
+
static bool is_lineend(char ch)
{
return ch == '\r' || ch == '\n' || ch == 0;
@@ -68,7 +83,7 @@ namespace vcpkg::Paragraphs
if (ch == '\n')
next(ch);
- if (is_alphanum(ch))
+ if (is_alphanum(ch) || is_comment(ch))
{
// Line begins a new field.
return;
@@ -115,6 +130,12 @@ namespace vcpkg::Paragraphs
std::string fieldvalue;
do
{
+ if (is_comment(ch))
+ {
+ skip_comment(ch);
+ continue;
+ }
+
get_fieldname(ch, fieldname);
auto it = fields.find(fieldname);