diff --git a/ircd/json.cc b/ircd/json.cc index e97042029..6d9f5441f 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -201,7 +201,12 @@ struct ircd::json::output rule lit_null { karma::string("null") ,"literal null" }; rule boolean { lit_true | lit_false ,"boolean" }; rule literal { lit_true | lit_false | lit_null ,"literal" }; - rule number { double_ ,"number" }; + + rule number + { + double_ + ,"number" + }; rule chars { @@ -221,6 +226,35 @@ struct ircd::json::output ,"name" }; + const rule value + { + (&object << object) + | (&array << array) + | (&literal << literal) + | ("e << chars << "e) + | (&number << number) + | (&string << string) + ,"value" + }; + + const rule member + { + name << name_sep << value + ,"member" + }; + + const rule object + { + object_begin << -(member % value_sep) << object_end + ,"object" + }; + + const rule array + { + array_begin << -(value % value_sep) << array_end + ,"array" + }; + output() :output::base_type{rule<>{}} {}