diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-14T08·54+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-14T08·54+0200 |
commit | e07c0dcf5c128875bf8af740b2c4bc81918713c9 (patch) | |
tree | 10cbe40f35fafb3a25c0802679f6c33f72b78be6 /src/libutil/util.cc | |
parent | 2c8c103ef80378bfcfa29ae054fd878305b5e275 (diff) |
Move some .drv parsing functions out of util
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index f1e714a664a5..7efaf3e89e6a 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1087,47 +1087,6 @@ bool hasSuffix(const string & s, const string & suffix) } -void expect(std::istream & str, const string & s) -{ - char s2[s.size()]; - str.read(s2, s.size()); - if (string(s2, s.size()) != s) - throw FormatError(format("expected string ‘%1%’") % s); -} - - -string parseString(std::istream & str) -{ - string res; - expect(str, "\""); - int c; - while ((c = str.get()) != '"') - if (c == '\\') { - c = str.get(); - if (c == 'n') res += '\n'; - else if (c == 'r') res += '\r'; - else if (c == 't') res += '\t'; - else res += c; - } - else res += c; - return res; -} - - -bool endOfList(std::istream & str) -{ - if (str.peek() == ',') { - str.get(); - return false; - } - if (str.peek() == ']') { - str.get(); - return true; - } - return false; -} - - string decodeOctalEscaped(const string & s) { string r; |