diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-03-08 00:28:53 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-03-08 00:28:53 +0000 |
| commit | 23f52d591c0bc61ec157b0406a4b97ebce7d5b9f (patch) | |
| tree | d531bb0a93003a6574f975b30b3033a68a664af0 /src | |
| parent | 114f9c876d441a6aff99e295942e0a296505634f (diff) | |
Support parsing booleans in json
Diffstat (limited to 'src')
| -rw-r--r-- | src/json_ui.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/json_ui.cc b/src/json_ui.cc index c6189f96..aea412b1 100644 --- a/src/json_ui.cc +++ b/src/json_ui.cc @@ -261,6 +261,10 @@ parse_json(const char* pos, const char* end) skip_while(digit_end, end, is_digit); return Result{ Value{str_to_int({pos, end})}, digit_end }; } + if (end - pos > 4 and StringView{pos, pos+4} == "true") + return Result{ Value{true}, pos+4 }; + if (end - pos > 5 and StringView{pos, pos+5} == "false") + return Result{ Value{false}, pos+5 }; if (*pos == '"') { String value; |
