diff --git a/include/ircd/spirit/parse.h b/include/ircd/spirit/parse.h index 35c2f38cd..67db6fdd2 100644 --- a/include/ircd/spirit/parse.h +++ b/include/ircd/spirit/parse.h @@ -16,8 +16,11 @@ namespace spirit __attribute__((visibility("internal"))) { struct substring_view; - struct custom_parser; - BOOST_SPIRIT_TERMINAL(custom); + + template struct custom_parser; + BOOST_SPIRIT_TERMINAL(custom0); + BOOST_SPIRIT_TERMINAL(custom1); + BOOST_SPIRIT_TERMINAL(custom2); template @@ -37,18 +40,35 @@ __attribute__((visibility("internal"))) namespace qi { template - struct make_primitive; + struct make_primitive; + + template + struct make_primitive; + + template + struct make_primitive; } template<> - struct use_terminal + struct use_terminal + :mpl::true_ + {}; + + template<> + struct use_terminal + :mpl::true_ + {}; + + template<> + struct use_terminal :mpl::true_ {}; }} +template struct [[gnu::visibility("internal")]] ircd::spirit::custom_parser -:qi::primitive_parser +:qi::primitive_parser> { template @@ -72,9 +92,33 @@ ircd::spirit::custom_parser template struct [[gnu::visibility("internal")]] -boost::spirit::qi::make_primitive +boost::spirit::qi::make_primitive { - using result_type = ircd::spirit::custom_parser; + using result_type = ircd::spirit::custom_parser<0>; + + result_type operator()(unused_type, unused_type) const + { + return result_type{}; + } +}; + +template +struct [[gnu::visibility("internal")]] +boost::spirit::qi::make_primitive +{ + using result_type = ircd::spirit::custom_parser<1>; + + result_type operator()(unused_type, unused_type) const + { + return result_type{}; + } +}; + +template +struct [[gnu::visibility("internal")]] +boost::spirit::qi::make_primitive +{ + using result_type = ircd::spirit::custom_parser<2>; result_type operator()(unused_type, unused_type) const { diff --git a/ircd/json.cc b/ircd/json.cc index 164da8f4e..17aa2b94c 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -164,7 +164,7 @@ ircd::json::parser }; template static u64x2 string_content_block(const block_t, const block_t) noexcept; - const custom_parser string_content{}; + const custom_parser<0> string_content{}; const rule string { //quote >> chars >> (!escape >> quote) @@ -474,16 +474,17 @@ const /// to the end of whatever the user provided. Returns true if successful and /// the result string_view is set in the context attribute; the iterator is /// advanced. +template<> template inline bool -ircd::json::custom_parser::parse(iterator &__restrict__ start, - const iterator &__restrict__ stop, - context &g, - const skipper &, - attr &) +ircd::json::custom_parser<0>::parse(iterator &__restrict__ start, + const iterator &__restrict__ stop, + context &g, + const skipper &, + attr &) const { // Clang scales between 128bit and 256bit systems when we use the 256 bit