diff --git a/include/boost/url/rfc/detail/paths_bnf.hpp b/include/boost/url/rfc/detail/paths_bnf.hpp index 68e6571b..a011ba3f 100644 --- a/include/boost/url/rfc/detail/paths_bnf.hpp +++ b/include/boost/url/rfc/detail/paths_bnf.hpp @@ -35,7 +35,8 @@ struct segment_bnf using bnf::parse; return parse(it, end, ec, pct_encoded_bnf< - pchar_mask>{t.v}); + masked_char_set< + pchar_mask>>{t.v}); } }; @@ -57,7 +58,8 @@ struct segment_nz_bnf auto const start = it; if(! parse(it, end, ec, pct_encoded_bnf< - pchar_mask>{t.v})) + masked_char_set< + pchar_mask>>{t.v})) return false; if(it == start) { @@ -87,8 +89,9 @@ struct segment_nz_nc_bnf auto const start = it; if(! parse(it, end, ec, pct_encoded_bnf< - pchar_mask & - ~colon_char_mask>{t.v})) + masked_char_set< + pchar_mask & + ~colon_char_mask>>{t.v})) return false; if(it == start) { diff --git a/include/boost/url/rfc/detail/query_params_bnf.hpp b/include/boost/url/rfc/detail/query_params_bnf.hpp index c412f34e..5c114fd1 100644 --- a/include/boost/url/rfc/detail/query_params_bnf.hpp +++ b/include/boost/url/rfc/detail/query_params_bnf.hpp @@ -33,7 +33,8 @@ struct query_params_bnf // key if(! parse(it, end, ec, pct_encoded_bnf< - qpchar_mask>{t.key})) + masked_char_set< + qpchar_mask>>{t.key})) return false; // "=" if(! parse(it, end, ec, '=')) @@ -47,8 +48,9 @@ struct query_params_bnf t.value.emplace(); if(! parse(it, end, ec, pct_encoded_bnf< - qpchar_mask | - equals_char_mask>{*t.value})) + masked_char_set< + qpchar_mask | + equals_char_mask>>{*t.value})) { ec = {}; t.value.reset(); @@ -75,7 +77,8 @@ struct query_params_bnf // key if(! parse(it, end, ec, pct_encoded_bnf< - qpchar_mask>{t.key})) + masked_char_set< + qpchar_mask>>{t.key})) return false; // "=" if(! parse(it, end, ec, '=')) @@ -89,8 +92,10 @@ struct query_params_bnf t.value.emplace(); if(! parse(it, end, ec, pct_encoded_bnf< - qpchar_mask | - equals_char_mask>{*t.value})) + masked_char_set< + qpchar_mask | + equals_char_mask>>{ + *t.value})) { ec = {}; t.value.reset(); diff --git a/include/boost/url/rfc/impl/fragment_bnf.ipp b/include/boost/url/rfc/impl/fragment_bnf.ipp index 5b9da82a..954f1299 100644 --- a/include/boost/url/rfc/impl/fragment_bnf.ipp +++ b/include/boost/url/rfc/impl/fragment_bnf.ipp @@ -28,9 +28,10 @@ parse( using bnf::parse; return parse(it, end, ec, pct_encoded_bnf< - pchar_mask | - slash_char_mask | - question_char_mask>{t.v}); + masked_char_set< + pchar_mask | + slash_char_mask | + question_char_mask>>{t.v}); } } // urls diff --git a/include/boost/url/rfc/impl/host_bnf.ipp b/include/boost/url/rfc/impl/host_bnf.ipp index 501e22b4..1853c841 100644 --- a/include/boost/url/rfc/impl/host_bnf.ipp +++ b/include/boost/url/rfc/impl/host_bnf.ipp @@ -73,8 +73,9 @@ parse( pct_encoded_str ns; if(! parse(it, end, ec, pct_encoded_bnf< - unsub_char_mask>{ - t.name_})) + masked_char_set< + unsub_char_mask>>{ + t.name_})) { // bad reg-name return false; diff --git a/include/boost/url/rfc/impl/pct_encoded_bnf.hpp b/include/boost/url/rfc/impl/pct_encoded_bnf.hpp index 77979216..b0d19e65 100644 --- a/include/boost/url/rfc/impl/pct_encoded_bnf.hpp +++ b/include/boost/url/rfc/impl/pct_encoded_bnf.hpp @@ -16,19 +16,18 @@ namespace boost { namespace urls { -template +template bool parse( char const*& it, char const* const end, error_code& ec, pct_encoded_bnf< - CharMask> const& t) noexcept + CharSet> const& t) noexcept { auto const start = it; - masked_char_set cs; if(! detail::parse_pct_encoded_impl( - it, end, ec, cs, + it, end, ec, CharSet{}, t.v.decoded_size)) return false; t.v.str = string_view( diff --git a/include/boost/url/rfc/impl/userinfo_bnf.ipp b/include/boost/url/rfc/impl/userinfo_bnf.ipp index 27af1b0f..e682fd1c 100644 --- a/include/boost/url/rfc/impl/userinfo_bnf.ipp +++ b/include/boost/url/rfc/impl/userinfo_bnf.ipp @@ -36,11 +36,13 @@ parse( bnf::literal<':'>> colon; if(! parse(it, end, ec, pct_encoded_bnf< - unsub_char_mask>{user}, + masked_char_set< + unsub_char_mask>>{user}, colon, pct_encoded_bnf< - unsub_char_mask | - colon_char_mask>{pass})) + masked_char_set< + unsub_char_mask | + colon_char_mask>>{pass})) return false; t.str = string_view( start, it - start); diff --git a/include/boost/url/rfc/pct_encoded_bnf.hpp b/include/boost/url/rfc/pct_encoded_bnf.hpp index c4e8ec97..1eb93a60 100644 --- a/include/boost/url/rfc/pct_encoded_bnf.hpp +++ b/include/boost/url/rfc/pct_encoded_bnf.hpp @@ -13,6 +13,8 @@ #include #include #include +#include +#include namespace boost { namespace urls { @@ -35,21 +37,25 @@ struct pct_encoded_str @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.1 */ -template +template struct pct_encoded_bnf { pct_encoded_str& v; - template + BOOST_STATIC_ASSERT( + bnf::detail::is_char_set_pred< + CharSet>::value); + + template friend bool parse( char const*& it, char const* const end, error_code& ec, - pct_encoded_bnf const& t) noexcept; + pct_encoded_bnf const& t) noexcept; }; - + } // urls } // boost