0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::rfc3986: Add public rule abstracting uri_parse construction.

This commit is contained in:
Jason Volk 2022-06-11 14:13:19 -07:00
parent 6f0f6a46ac
commit ba06a52368
2 changed files with 11 additions and 5 deletions

View file

@ -146,6 +146,8 @@ namespace ircd::rfc3986::parser
extern const rule<> absolute_uri;
extern const rule<> uri;
extern const rule<> uri_ref; // uri | relative_ref
extern const rule<rfc3986::uri> uri_parse;
}
#pragma GCC visibility pop

View file

@ -398,20 +398,24 @@ BOOST_FUSION_ADAPT_STRUCT
)
#pragma GCC visibility pop
ircd::rfc3986::uri::uri(const string_view &input)
decltype(ircd::rfc3986::parser::uri_parse)
ircd::rfc3986::parser::uri_parse
{
static const parser::rule<rfc3986::uri> rule
{
expect
[
raw[parser::scheme] >> lit("://")
>> -raw[parser::userinfo >> lit('@')]
>> raw[parser::remote]
>> raw[parser::path_abempty]
>> -raw[lit('?') >> parser::query]
>> -raw[lit('#') >> parser::fragment]
};
]
};
ircd::rfc3986::uri::uri(const string_view &input)
{
const char *start(begin(input)), *const stop(end(input));
qi::parse(start, stop, eps > rule, *this);
ircd::parse(start, stop, parser::uri_parse, *this);
//TODO: XXX Can this go?
this->user = rstrip(this->user, '@');