mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::rfc3986: Add public rule abstracting uri_parse construction.
This commit is contained in:
parent
6f0f6a46ac
commit
ba06a52368
2 changed files with 11 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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, '@');
|
||||
|
|
Loading…
Reference in a new issue