mirror of
https://github.com/matrix-construct/construct
synced 2024-10-31 19:08:59 +01:00
ircd::rfc3986: Add expectations for host and port parsers.
This commit is contained in:
parent
a2f6acd73f
commit
f4fe10ba38
1 changed files with 9 additions and 3 deletions
|
@ -635,13 +635,19 @@ try
|
|||
|
||||
static const parser::rule<string_view> rule
|
||||
{
|
||||
(lit('[') >> raw[literal]) | raw[non_literal]
|
||||
(&lit('[') > raw[literal]) | raw[non_literal]
|
||||
,"host"
|
||||
};
|
||||
|
||||
static const parser::rule<string_view> grammar
|
||||
{
|
||||
expect[rule >> omit[&lit(':') | eoi]]
|
||||
,"host"
|
||||
};
|
||||
|
||||
string_view ret;
|
||||
const char *start(str.data()), *const stop(start + str.size());
|
||||
qi::parse(start, stop, eps > rule, ret);
|
||||
qi::parse(start, stop, grammar, ret);
|
||||
return ret;
|
||||
}
|
||||
catch(const qi::expectation_failure<const char *> &e)
|
||||
|
@ -665,7 +671,7 @@ try
|
|||
|
||||
static const parser::rule<uint16_t> rule
|
||||
{
|
||||
non_literal | (literal >> -(lit(':') >> parser::port) >> eoi)
|
||||
non_literal | (literal >> -(lit(':') >> parser::port)) >> eoi
|
||||
,"port"
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue