diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-02-26 17:16:45 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-02-26 17:17:49 +0300 |
commit | 5ae9686adac1508873f2d980e84becd3496244c2 (patch) | |
tree | d7c88e678b29ed6bb7ae30b74bd01aa2b5d2e9a8 /libbutl/manifest-parser.ixx | |
parent | afb726d2d59b3715960a8647738860f40e37cf4f (diff) |
Add notion of validator to char_scanner and make sure manifest is UTF-8
This involves implementing utf8_validator and UTF-8 utility functions and
using them during the manifest parsing, serialization, and rewriting.
Diffstat (limited to 'libbutl/manifest-parser.ixx')
-rw-r--r-- | libbutl/manifest-parser.ixx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libbutl/manifest-parser.ixx b/libbutl/manifest-parser.ixx index e616ad9..bc5246c 100644 --- a/libbutl/manifest-parser.ixx +++ b/libbutl/manifest-parser.ixx @@ -3,6 +3,37 @@ namespace butl { + + inline auto manifest_parser:: + get (const char* what) -> xchar + { + xchar c (base::get (ebuf_)); + + if (invalid (c)) + throw manifest_parsing (name_, + c.line, c.column, + std::string ("invalid ") + what + ": " + ebuf_); + return c; + } + + inline void manifest_parser:: + get (const xchar& peeked) + { + base::get (peeked); + } + + inline auto manifest_parser:: + peek (const char* what) -> xchar + { + xchar c (base::peek (ebuf_)); + + if (invalid (c)) + throw manifest_parsing (name_, + c.line, c.column, + std::string ("invalid ") + what + ": " + ebuf_); + return c; + } + inline manifest_name_value manifest_parser:: next () { |