<boost/url/grammar/type_traits.hpp>
template<class T>
concept Rule = requires (T t, char const*& it, char const* end)
{
typename T::value_type;
{ t.parse(it, end) } -> std::same_as<system::result<typename T::value_type>>;
};
This concept is satisfied if T
is a valid grammar Rule
A Rule
defines an algorithm used to match an input buffer of ASCII characters against a set of syntactical specifications.
Each rule represents either a terminal symbol or a composition in the represented grammar.
The library comes with a set of rules for productions typically found in RFC documents. Rules are not invoked directly; instead, rule variables are used with overloads of parse
which provide a convenient, uniform front end.
For best results, it is suggested that all constructors for rules be marked constexpr
.
struct Rule
{
struct value_type;
constexpr Rule( Rule const& ) noexcept = default;
auto parse( char const*& it, char const* end ) const -> result< value_type >;
};
// Declare a variable of type Rule for notational convenience
constexpr Rule rule{};
dec_octet_rule
delim_rule
not_empty_rule
optional_rule
range_rule
token_rule
tuple_rule
unsigned_rule
variant_rule