aboutsummaryrefslogtreecommitdiff
path: root/libbutl/manifest-parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-01-08 15:30:40 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-01-08 15:31:29 +0300
commit6ac4f3bcc0bd1306bf1a8dd1bebae1a00081c6b7 (patch)
tree18557b6da8fafbdc511a0c0f505137ca9317d5ef /libbutl/manifest-parser.cxx
parent6876fd23ef84487c016e7be46d3deb7d1e695cef (diff)
Add support for filtering during manifest parsing and serialization
Diffstat (limited to 'libbutl/manifest-parser.cxx')
-rw-r--r--libbutl/manifest-parser.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/libbutl/manifest-parser.cxx b/libbutl/manifest-parser.cxx
index 20932e3..9aa35b7 100644
--- a/libbutl/manifest-parser.cxx
+++ b/libbutl/manifest-parser.cxx
@@ -41,13 +41,17 @@ namespace butl
using parsing = manifest_parsing;
using name_value = manifest_name_value;
- name_value manifest_parser::
- next ()
+ void manifest_parser::
+ parse_next (name_value& r)
{
if (s_ == end)
- return name_value {
+ {
+ r = name_value {
"", "", line, column, line, column, position, position, position};
+ return;
+ }
+
auto clp (skip_spaces ());
xchar c (clp.first);
uint64_t start_pos (clp.second);
@@ -67,15 +71,18 @@ namespace butl
{
s_ = start;
- return name_value {"", "",
- c.line, c.column, c.line, c.column,
- start_pos, c.position, c.position};
+ r = name_value {"", "",
+ c.line, c.column, c.line, c.column,
+ start_pos, c.position, c.position};
+ return;
}
+ r.name.clear ();
+ r.value.clear ();
+
// Regardless of the state, what should come next is a name,
// potentially the special empty one.
//
- name_value r;
r.start_pos = start_pos;
parse_name (r);
@@ -98,7 +105,7 @@ namespace butl
r.value_column = r.name_column;
r.colon_pos = r.start_pos;
r.end_pos = r.start_pos;
- return r;
+ return;
}
if (c != ':')
@@ -162,8 +169,6 @@ namespace butl
//
assert (!r.name.empty ());
}
-
- return r;
}
pair<string, string> manifest_parser::