mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd::json: Minor cleanup/formatting.
This commit is contained in:
parent
ba3d1e7af4
commit
db24cef649
1 changed files with 26 additions and 20 deletions
46
ircd/json.cc
46
ircd/json.cc
|
@ -108,6 +108,13 @@ struct ircd::json::input
|
|||
rule<> value_sep { lit(',') ,"value sep" };
|
||||
rule<> escape { lit('\\') ,"escape" };
|
||||
rule<> quote { lit('"') ,"quote" };
|
||||
|
||||
rule<> unicode
|
||||
{
|
||||
lit('u') >> qi::uint_parser<char, 16, 4, 4>{}
|
||||
,"escaped unicode"
|
||||
};
|
||||
|
||||
rule<> escaped
|
||||
{
|
||||
lit('"') | lit('\\') | lit('\b') | lit('\f') | lit('\n') | lit('\r') | lit('\t')
|
||||
|
@ -116,14 +123,7 @@ struct ircd::json::input
|
|||
|
||||
rule<> escaper
|
||||
{
|
||||
lit('\\') |
|
||||
lit('"') |
|
||||
lit('b') |
|
||||
lit('f') |
|
||||
lit('n') |
|
||||
lit('r') |
|
||||
lit('t') |
|
||||
(lit('u') >> qi::uint_parser<char, 16, 4, 4>{})
|
||||
lit('"') | lit('\\') | lit('b') | lit('f') | lit('n') | lit('r') | lit('t') | unicode
|
||||
,"escaped"
|
||||
};
|
||||
|
||||
|
@ -312,13 +312,16 @@ ircd::json::printer::operator()(char *&out,
|
|||
attr&& a)
|
||||
const
|
||||
{
|
||||
const auto throws([&out, &stop]
|
||||
const auto throws{[&out, &stop]
|
||||
{
|
||||
throw print_error("Failed to print attribute '%s' generator '%s' (%zd bytes in buffer)",
|
||||
demangle<decltype(a)>(),
|
||||
demangle<decltype(g)>(),
|
||||
size_t(stop - out));
|
||||
});
|
||||
throw print_error
|
||||
{
|
||||
"Failed to print attribute '%s' generator '%s' (%zd bytes in buffer)",
|
||||
demangle<decltype(a)>(),
|
||||
demangle<decltype(g)>(),
|
||||
size_t(stop - out)
|
||||
};
|
||||
}};
|
||||
|
||||
const auto gg
|
||||
{
|
||||
|
@ -335,12 +338,15 @@ ircd::json::printer::operator()(char *&out,
|
|||
gen&& g)
|
||||
const
|
||||
{
|
||||
const auto throws([&out, &stop]
|
||||
const auto throws{[&out, &stop]
|
||||
{
|
||||
throw print_error("Failed to print generator '%s' (%zd bytes in buffer)",
|
||||
demangle<decltype(g)>(),
|
||||
size_t(stop - out));
|
||||
});
|
||||
throw print_error
|
||||
{
|
||||
"Failed to print generator '%s' (%zd bytes in buffer)",
|
||||
demangle<decltype(g)>(),
|
||||
size_t(stop - out)
|
||||
};
|
||||
}};
|
||||
|
||||
const auto gg
|
||||
{
|
||||
|
@ -1274,7 +1280,7 @@ const
|
|||
case NUMBER:
|
||||
return serial? string_view{string, len}:
|
||||
floats? byte_view<string_view>{floating}:
|
||||
byte_view<string_view>{integer};
|
||||
byte_view<string_view>{integer};
|
||||
case ARRAY:
|
||||
case OBJECT:
|
||||
case LITERAL:
|
||||
|
|
Loading…
Reference in a new issue