diff --git a/include/ircd/spirit.h b/include/ircd/spirit.h index cf7aa7775..9a8f1e07c 100644 --- a/include/ircd/spirit.h +++ b/include/ircd/spirit.h @@ -50,7 +50,6 @@ namespace spirit __attribute__((visibility("default"))) { template struct expectation_failure; - struct substring_view; IRCD_EXCEPTION(ircd::error, error); IRCD_EXCEPTION(error, generator_error); @@ -176,6 +175,10 @@ namespace ircd { namespace spirit __attribute__((visibility("internal"))) { + struct substring_view; + struct custom_parser; + BOOST_SPIRIT_TERMINAL(custom); + template bool parse(const char *&start, const char *const &stop, gen&&, attr&&...); @@ -198,12 +201,58 @@ namespace ircd using spirit::parse; } -namespace ircd { +namespace boost { namespace spirit -__attribute__((visibility("default"))) +__attribute__((visibility("internal"))) { + namespace qi + { + template + struct make_primitive; + } + + template<> + struct use_terminal + :mpl::true_ + {}; }} +struct [[gnu::visibility("internal")]] +ircd::spirit::custom_parser +:qi::primitive_parser +{ + template + struct attribute + { + using type = iterator; + }; + + template + boost::spirit::info what(context &) const + { + return boost::spirit::info("custom"); + } + + template + bool parse(iterator &, const iterator &, context &, const skipper &, attr &) const; +}; + +template +struct [[gnu::visibility("internal")]] +boost::spirit::qi::make_primitive +{ + using result_type = ircd::spirit::custom_parser; + + result_type operator()(unused_type, unused_type) const + { + return result_type{}; + } +}; + struct ircd::spirit::substring_view :ircd::string_view {