23#include <netinet/in.h>
34#pragma warning(disable: 4100)
37#define ENUM_FLAG_OPERATOR(T,X) \
38inline T operator X (const T lhs, const T rhs) { return static_cast<T>(static_cast<std::underlying_type_t<T>>(lhs) X static_cast<std::underlying_type_t<T>>(rhs)); } \
39inline T operator X (const T lhs, const std::underlying_type_t<T> rhs) { return static_cast<T>(static_cast<std::underlying_type_t<T>>(lhs) X rhs); } \
40inline T operator X (const std::underlying_type_t<T> lhs, const T rhs) { return static_cast<T>(lhs X static_cast<std::underlying_type_t<T>>(rhs)); } \
41inline T& operator X= (T& lhs, const T rhs) { return lhs = lhs X rhs; } \
42inline T& operator X= (T& lhs, const std::underlying_type_t<T> rhs) { return lhs = lhs X rhs; }
43#define ENUM_FLAGS(T, type) \
45inline T operator ~ (T t) { return (T) (~static_cast<std::underlying_type_t <T>>(t)); } \
46ENUM_FLAG_OPERATOR(T,|) \
47ENUM_FLAG_OPERATOR(T,^) \
48ENUM_FLAG_OPERATOR(T,&) \
52#elif defined(__APPLE__)
53#define s6_words __u6_addr.__u6_addr16
55#define s6_words s6_addr16
65 constexpr int match_default = 0;
66 constexpr int match_case_insensitive = 0x1;
67 constexpr int match_multiline = 0x2;
76 basic_parser(
_In_ const std::locale& locale = std::locale()) : m_locale(locale) {}
80 _In_reads_or_z_opt_(end)
const T* text,
81 _In_ size_t start = 0,
85 for (
size_t i = start; i < end && text[i]; i++)
86 if (match(text, i, end,
flags))
92 _In_reads_or_z_opt_(end)
const T* text,
93 _In_ size_t start = 0,
97 template<
class _Traits,
class _Ax>
99 const std::basic_string<T, _Traits, _Ax>& text,
100 _In_ size_t start = 0,
104 return match(text.c_str(), start, std::min<size_t>(end, text.size()),
flags);
107 virtual void invalidate()
116 if (text[start] ==
'&') {
118 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
127 if (
n >= 2 && text[start + 1] ==
'#') {
130 if (text[start + 2] ==
'x' || text[start + 2] ==
'X')
131 unicode = strtou32(text + start + 3,
n - 2,
nullptr, 16);
133 unicode = strtou32(text + start + 2,
n - 1,
nullptr, 10);
140 ucs4_to_surrogate_pair(buf,
unicode);
164 buf[0] = text[start];
175 std::locale m_locale;
195 _In_reads_or_z_opt_(end)
const T* text,
196 _In_ size_t start = 0,
200 _Assume_(text || start >= end);
201 if (start < end && text[start]) {
229 _In_reads_or_z_opt_(end)
const T* text,
230 _In_ size_t start = 0,
234 _Assume_(text || start >= end);
235 if (start < end && text[start]) {
261 _In_reads_or_z_(end)
const char* text,
262 _In_ size_t start = 0,
266 _Assume_(text || start >= end);
267 if (start < end && text[start]) {
268 if (text[start] ==
'&') {
270 const auto&
ctype = std::use_facet<std::ctype<char>>(m_locale);
303 _In_reads_or_z_opt_(end)
const T* text,
304 _In_ size_t start = 0,
308 _Assume_(text || start >= end);
309 if (start < end && text[start]) {
311 if (
flags & match_case_insensitive) {
312 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
313 r =
ctype.tolower(text[start]) ==
ctype.tolower(m_chr);
316 r = text[start] == m_chr;
317 if ((
r && !m_invert) || (!
r && m_invert)) {
356 _In_reads_or_z_(end)
const char* text,
357 _In_ size_t start = 0,
361 _Assume_(text || start >= end);
362 if (start < end && text[start]) {
365 bool r = ((
flags & match_case_insensitive) ?
366 stdex::strnicmp(
chr,
SIZE_MAX, m_chr.c_str(), m_chr.size(), m_locale) :
367 stdex::strncmp(
chr,
SIZE_MAX, m_chr.c_str(), m_chr.size())) == 0;
368 if ((
r && !m_invert) || (!
r && m_invert)) {
395 _In_reads_or_z_opt_(end)
const T* text,
396 _In_ size_t start = 0,
400 _Assume_(text || start >= end);
401 if (start < end && text[start]) {
403 ((
flags & match_multiline) || !stdex::islbreak(text[start])) &&
404 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space, text[start]);
405 if ((
r && !m_invert) || (!
r && m_invert)) {
437 _In_reads_or_z_(end)
const char* text,
438 _In_ size_t start = 0,
442 _Assume_(text || start >= end);
443 if (start < end && text[start]) {
449 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space,
chr,
chr_end) ==
chr_end;
450 if ((
r && !m_invert) || (!
r && m_invert)) {
474 _In_reads_or_z_opt_(end)
const T* text,
475 _In_ size_t start = 0,
479 _Assume_(text || start >= end);
480 if (start < end && text[start]) {
481 bool r = std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::punct, text[start]);
482 if ((
r && !m_invert) || (!
r && m_invert)) {
514 _In_reads_or_z_(end)
const char* text,
515 _In_ size_t start = 0,
519 _Assume_(text || start >= end);
520 if (start < end && text[start]) {
525 if ((
r && !m_invert) || (!
r && m_invert)) {
548 _In_reads_or_z_opt_(end)
const T* text,
549 _In_ size_t start = 0,
553 _Assume_(text || start >= end);
554 if (start < end && text[start]) {
556 ((
flags & match_multiline) || !stdex::islbreak(text[start])) &&
557 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space | std::ctype_base::punct, text[start]);
558 if ((
r && !m_invert) || (!
r && m_invert)) {
590 _In_reads_or_z_(end)
const char* text,
591 _In_ size_t start = 0,
595 _Assume_(text || start >= end);
596 if (start < end && text[start]) {
602 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space | std::ctype_base::punct,
chr,
chr_end) ==
chr_end;
603 if ((
r && !m_invert) || (!
r && m_invert)) {
623 _In_reads_or_z_opt_(end)
const T* text,
624 _In_ size_t start = 0,
628 _Assume_(text || !end);
629 _Assume_(text || start >= end);
630 bool r = start == 0 || (start <= end && stdex::islbreak(text[start - 1]));
631 if ((
r && !m_invert) || (!
r && m_invert)) {
662 _In_reads_or_z_opt_(end)
const T* text,
663 _In_ size_t start = 0,
667 _Assume_(text || start >= end);
668 bool r = start >= end || !text[start] || stdex::islbreak(text[start]);
669 if ((
r && !m_invert) || (!
r && m_invert)) {
701 _In_reads_or_z_opt_(end)
const T* text,
702 _In_ size_t start = 0,
706 virtual void invalidate()
727 _In_reads_or_z_(
count)
const T* set,
730 _In_ const std::locale& locale = std::locale()) :
734 m_set.assign(set, set + stdex::strnlen(set,
count));
738 _In_reads_or_z_opt_(end)
const T* text,
739 _In_ size_t start = 0,
743 _Assume_(text || start >= end);
744 if (start < end && text[start]) {
745 const T* set = m_set.c_str();
746 size_t r = (
flags & match_case_insensitive) ?
747 stdex::strnichr(set, m_set.size(), text[start], this->m_locale) :
748 stdex::strnchr(set, m_set.size(), text[start]);
749 if ((
r != stdex::npos && !this->m_invert) || (
r == stdex::npos && this->m_invert)) {
750 this->hit_offset =
r;
761 std::basic_string<T> m_set;
782 m_set = sgml2str(set,
count);
786 _In_reads_or_z_(end)
const char* text,
787 _In_ size_t start = 0,
791 _Assume_(text || start >= end);
792 if (start < end && text[start]) {
795 const wchar_t* set = m_set.c_str();
796 size_t r = (
flags & match_case_insensitive) ?
797 stdex::strnistr(set, m_set.size(),
chr, m_locale) :
798 stdex::strnstr(set, m_set.size(),
chr);
799 if ((
r != stdex::npos && !m_invert) || (
r == stdex::npos && m_invert)) {
822 _In_reads_or_z_(
count)
const T*
str,
824 _In_ const std::locale& locale = std::locale()) :
830 _In_reads_or_z_opt_(end)
const T* text,
831 _In_ size_t start = 0,
835 _Assume_(text || start >= end);
838 n = std::min<size_t>(end - start,
m);
839 bool r = ((
flags & match_case_insensitive) ?
840 stdex::strnicmp(text + start,
n, m_str.c_str(),
m, this->m_locale) :
841 stdex::strncmp(text + start,
n, m_str.c_str(),
m)) == 0;
851 std::basic_string<T> m_str;
874 _In_reads_or_z_(end)
const char* text,
875 _In_ size_t start = 0,
879 _Assume_(text || start >= end);
880 const wchar_t*
str = m_str.c_str();
882 const auto&
ctype = std::use_facet<std::ctype<wchar_t>>(m_locale);
924 _In_reads_or_z_opt_(end)
const T* text,
925 _In_ size_t start = 0,
929 _Assume_(text || start >= end);
931 for (
size_t i = 0; ; i++) {
950 std::shared_ptr<basic_parser<T>>
m_el;
978 _In_ const std::locale& locale = std::locale()) :
982 m_collection.reserve(
count);
983 for (
size_t i = 0; i <
count; i++)
984 m_collection.push_back(
el[i]);
989 _In_ const std::locale& locale = std::locale()) :
994 virtual void invalidate()
996 for (
auto&
el : m_collection)
1002 std::vector<std::shared_ptr<basic_parser<T>>> m_collection;
1015 _In_ const std::locale& locale = std::locale()) :
1021 _In_ const std::locale& locale = std::locale()) :
1026 _In_reads_or_z_opt_(end)
const T* text,
1027 _In_ size_t start = 0,
1031 _Assume_(text || start >= end);
1033 for (
auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i) {
1035 for (++i; i != this->m_collection.end(); ++i)
1072 _In_ const std::locale& locale = std::locale()) :
1079 _In_ const std::locale& locale = std::locale()) :
1085 _In_reads_or_z_opt_(end)
const T* text,
1086 _In_ size_t start = 0,
1090 _Assume_(text || start >= end);
1092 for (
auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i, ++hit_offset) {
1093 if ((*i)->match(text, start, end,
flags)) {
1095 for (++i; i != this->m_collection.end(); ++i)
1105 virtual void invalidate()
1127 template <
class T,
class T_parser = basic_
string<T>>
1134 _In_ const std::locale& locale = std::locale()) :
1168 this->m_collection.reserve(
n);
1181 this->m_collection.push_back(std::move(std::make_shared<T_parser>(
str,
SIZE_MAX,
this->m_locale)));
1182 (p =
va_arg(params,
const T*)) !=
nullptr;
1183 this->m_collection.push_back(std::move(std::make_shared<T_parser>(p,
SIZE_MAX, this->m_locale))));
1206 _In_ const std::locale& locale = std::locale()) :
1212 _In_ const std::locale& locale = std::locale()) :
1217 _In_reads_or_z_opt_(end)
const T* text,
1218 _In_ size_t start = 0,
1222 _Assume_(text || start >= end);
1223 for (
auto&
el : this->m_collection)
1225 if (match_recursively(text, start, end,
flags)) {
1234 bool match_recursively(
1235 _In_reads_or_z_opt_(end)
const T* text,
1236 _In_ size_t start = 0,
1241 for (
auto&
el : this->m_collection) {
1245 if (
el->match(text, start, end,
flags)) {
1284 virtual void invalidate()
1312 _In_ const std::locale& locale = std::locale()) :
1327 _In_reads_or_z_opt_(end)
const T* text,
1328 _In_ size_t start = 0,
1332 _Assume_(text || start >= end);
1357 std::shared_ptr<basic_parser<T>>
1389 _In_ const std::locale& locale = std::locale()) :
1394 m_separator(separator)
1398 _In_reads_or_z_opt_(end)
const T* text,
1399 _In_ size_t start = 0,
1403 _Assume_(text || start >= end);
1404 if (m_digits->match(text, start, end,
flags)) {
1406 this->
value = m_digits->value;
1411 if (m_digits->interval.size() <= 3) {
1415 (hit_offset ==
SIZE_MAX || hit_offset == m_separator->hit_offset) &&
1416 m_digits->match(text, m_separator->interval.end, end,
flags) &&
1417 m_digits->interval.size() == 3)
1420 this->
value = this->
value * 1000 + m_digits->value;
1424 hit_offset = m_separator->hit_offset;
1435 virtual void invalidate()
1447 std::shared_ptr<basic_integer10<T>> m_digits;
1448 std::shared_ptr<basic_set<T>> m_separator;
1484 _In_ const std::locale& locale = std::locale()) :
1505 _In_reads_or_z_opt_(end)
const T* text,
1506 _In_ size_t start = 0,
1510 _Assume_(text || start >= end);
1541 std::shared_ptr<basic_parser<T>>
1586 _In_ const std::locale& locale = std::locale()) :
1600 _In_reads_or_z_opt_(end)
const T* text,
1601 _In_ size_t start = 0,
1605 _Assume_(text || start >= end);
1615 else if (m_digit_100 && m_digit_100->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 100;
end2 = m_digit_100->interval.end; }
1616 else if (m_digit_500 && m_digit_500->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 500;
end2 = m_digit_500->interval.end; }
1617 else if (m_digit_1000 && m_digit_1000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 1000;
end2 = m_digit_1000->interval.end; }
1618 else if (m_digit_5000 && m_digit_5000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 5000;
end2 = m_digit_5000->interval.end; }
1619 else if (m_digit_10000 && m_digit_10000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 10000;
end2 = m_digit_10000->interval.end; }
1631 this->
value += dig[0];
1634 (
dig[1] == 1 && (
dig[0] == 5 ||
dig[0] == 10)) ||
1635 (
dig[1] == 10 && (
dig[0] == 50 ||
dig[0] == 100)) ||
1636 (
dig[1] == 100 && (
dig[0] == 500 ||
dig[0] == 1000)) ||
1637 (
dig[1] == 1000 && (
dig[0] == 5000 ||
dig[0] == 10000)))
1644 this->
value -= dig[1];
1648 this->
value += dig[0];
1664 std::shared_ptr<basic_parser<T>>
1696 _In_ const std::locale& locale = std::locale()) :
1704 _In_reads_or_z_opt_(end)
const T* text,
1705 _In_ size_t start = 0,
1709 _Assume_(text || start >= end);
1710 if (numerator->match(text, start, end,
flags) &&
1711 fraction_line->match(text, numerator->interval.end, end,
flags) &&
1712 denominator->match(text, fraction_line->interval.end, end,
flags))
1718 numerator->invalidate();
1719 fraction_line->invalidate();
1720 denominator->invalidate();
1725 virtual void invalidate()
1727 numerator->invalidate();
1728 fraction_line->invalidate();
1729 denominator->invalidate();
1734 std::shared_ptr<basic_parser<T>> numerator;
1735 std::shared_ptr<basic_parser<T>> fraction_line;
1736 std::shared_ptr<basic_parser<T>> denominator;
1760 _In_ const std::locale& locale = std::locale()) :
1769 _In_reads_or_z_opt_(end)
const T* text,
1770 _In_ size_t start = 0,
1774 _Assume_(text || start >= end);
1803 separator->invalidate();
1804 guest->invalidate();
1809 virtual void invalidate()
1812 separator->invalidate();
1813 guest->invalidate();
1818 std::shared_ptr<basic_parser<T>> home;
1819 std::shared_ptr<basic_parser<T>> separator;
1820 std::shared_ptr<basic_parser<T>> guest;
1823 std::shared_ptr<basic_parser<T>> m_space;
1847 _In_ const std::locale& locale = std::locale()) :
1856 _In_reads_or_z_opt_(end)
const T* text,
1857 _In_ size_t start = 0,
1861 _Assume_(text || start >= end);
1896 virtual void invalidate()
1935 _In_ const std::locale& locale = std::locale()) :
1946 _In_reads_or_z_opt_(end)
const T* text,
1947 _In_ size_t start = 0,
1951 _Assume_(text || start >= end);
2017 virtual void invalidate()
2035 std::shared_ptr<basic_parser<T>> m_space;
2065 _In_ const std::locale& locale = std::locale()) :
2077 value(std::numeric_limits<double>::quiet_NaN())
2081 _In_reads_or_z_opt_(end)
const T* text,
2082 _In_ size_t start = 0,
2086 _Assume_(text || start >= end);
2121 if (
integer->interval.empty() &&
2177 virtual void invalidate()
2189 value = std::numeric_limits<double>::quiet_NaN();
2231 _In_ const std::locale& locale = std::locale()) :
2243 _In_reads_or_z_opt_(end)
const T* text,
2244 _In_ size_t start = 0,
2248 _Assume_(text || start >= end);
2295 if (
integer->interval.empty() &&
2314 virtual void invalidate()
2364 _In_ const std::locale& locale = std::locale()) :
2376 m_separator(separator)
2382 _In_reads_or_z_opt_(end)
const T* text,
2383 _In_ size_t start = 0,
2387 _Assume_(text || start >= end);
2392 for (i = 0; i < 4; i++) {
2450 virtual void invalidate()
2469 std::shared_ptr<basic_parser<T>>
2480 std::shared_ptr<basic_parser<T>> m_separator;
2502 _In_reads_or_z_opt_(end)
const T* text,
2503 _In_ size_t start = 0,
2507 _Assume_(text || start >= end);
2508 if (start < end && text[start]) {
2509 if (text[start] ==
'-' ||
2510 text[start] ==
'_' ||
2511 text[start] ==
':' ||
2512 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2540 _In_reads_or_z_(end)
const char* text,
2541 _In_ size_t start = 0,
2545 _Assume_(text || start >= end);
2546 if (start < end && text[start]) {
2550 if (((
chr[0] ==
L'-' ||
2552 chr[0] ==
L':') &&
chr[1] == 0) ||
2591 _In_ const std::locale& locale = std::locale()) :
2609 m_separator(separator),
2617 _In_reads_or_z_opt_(end)
const T* text,
2618 _In_ size_t start = 0,
2622 _Assume_(text || start >= end);
2627 for (i = 0; i < 8; i++) {
2678 if (
x_n <= 0xffff) {
2701 this->
value.s6_words[--j] = this->
value.s6_words[--k];
2705 this->
value.s6_words[--j] = 0;
2713 if (m_scope_id_separator && m_scope_id_separator->match(text,
this->
interval.
end, end,
flags) &&
2745 virtual void invalidate()
2774 std::shared_ptr<basic_parser<T>>
2791 std::shared_ptr<basic_parser<T>> m_separator, m_scope_id_separator;
2812 _In_ const std::locale& locale = std::locale()) :
2819 _In_reads_or_z_opt_(end)
const T* text,
2820 _In_ size_t start = 0,
2824 _Assume_(text || start >= end);
2825 if (start < end && text[start]) {
2826 if ((
'A' <= text[start] && text[start] <=
'Z') ||
2827 (
'a' <= text[start] && text[start] <=
'z') ||
2828 (
'0' <= text[start] && text[start] <=
'9'))
2830 else if (text[start] ==
'-')
2832 else if (m_allow_idn && std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2868 _In_ const std::locale& locale = std::locale()) :
2873 _In_reads_or_z_(end)
const char* text,
2874 _In_ size_t start = 0,
2878 _Assume_(text || start >= end);
2879 if (start < end && text[start]) {
2883 if (((
'A' <=
chr[0] &&
chr[0] <=
'Z') ||
2884 (
'a' <=
chr[0] &&
chr[0] <=
'z') ||
2885 (
'0' <=
chr[0] &&
chr[0] <=
'9')) &&
chr[1] == 0)
2887 else if (
chr[0] ==
'-' &&
chr[1] == 0)
2889 else if (m_allow_idn && std::use_facet<std::ctype<wchar_t>>(m_locale).
scan_not(std::ctype_base::alnum,
chr,
chr_end) ==
chr_end)
2914 _In_ const std::locale& locale = std::locale()) :
2918 m_separator(separator)
2922 _In_reads_or_z_opt_(end)
const T* text,
2923 _In_ size_t start = 0,
2927 _Assume_(text || start >= end);
2928 size_t i = start,
count;
2930 if (m_domain_char->match(text, i, end,
flags) &&
2931 m_domain_char->allow_on_edge)
2934 this->
interval.
end = i = m_domain_char->interval.end;
2935 while (i < end && text[i]) {
2936 if (m_domain_char->allow_on_edge &&
2937 m_separator->match(text, i, end,
flags))
2941 this->
interval.
end = i = m_separator->interval.end;
2944 i = m_separator->interval.end;
2948 if (m_domain_char->match(text, i, end,
flags)) {
2949 if (m_domain_char->allow_on_edge)
2950 this->
interval.
end = i = m_domain_char->interval.end;
2952 i = m_domain_char->interval.end;
2973 std::shared_ptr<basic_dns_domain_char<T>> m_domain_char;
2974 std::shared_ptr<basic_parser<T>> m_separator;
2996 _In_reads_or_z_opt_(end)
const T* text,
2997 _In_ size_t start = 0,
3001 _Assume_(text || start >= end);
3002 if (start < end && text[start]) {
3003 if (text[start] ==
'-' ||
3004 text[start] ==
'.' ||
3005 text[start] ==
'_' ||
3006 text[start] ==
'~' ||
3007 text[start] ==
'%' ||
3008 text[start] ==
'!' ||
3009 text[start] ==
'$' ||
3010 text[start] ==
'&' ||
3011 text[start] ==
'\'' ||
3014 text[start] ==
'*' ||
3015 text[start] ==
'+' ||
3016 text[start] ==
',' ||
3017 text[start] ==
';' ||
3018 text[start] ==
'=' ||
3019 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3047 _In_reads_or_z_(end)
const char* text,
3048 _In_ size_t start = 0,
3052 _Assume_(text || start >= end);
3053 if (start < end && text[start]) {
3057 if (((
chr[0] ==
L'-' ||
3072 chr[0] ==
L'=') &&
chr[1] == 0) ||
3095 _In_reads_or_z_opt_(end)
const T* text,
3096 _In_ size_t start = 0,
3100 _Assume_(text || start >= end);
3101 if (start < end && text[start]) {
3102 if (text[start] ==
'-' ||
3103 text[start] ==
'.' ||
3104 text[start] ==
'_' ||
3105 text[start] ==
'~' ||
3106 text[start] ==
'%' ||
3107 text[start] ==
'!' ||
3108 text[start] ==
'$' ||
3109 text[start] ==
'&' ||
3110 text[start] ==
'\'' ||
3111 text[start] ==
'(' ||
3112 text[start] ==
')' ||
3113 text[start] ==
'*' ||
3114 text[start] ==
'+' ||
3115 text[start] ==
',' ||
3116 text[start] ==
';' ||
3117 text[start] ==
'=' ||
3118 text[start] ==
':' ||
3119 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3147 _In_reads_or_z_(end)
const char* text,
3148 _In_ size_t start = 0,
3152 _Assume_(text || start >= end);
3153 if (start < end && text[start]) {
3157 if (((
chr[0] ==
L'-' ||
3173 chr[0] ==
L':') &&
chr[1] == 0) ||
3195 _In_reads_or_z_opt_(end)
const T* text,
3196 _In_ size_t start = 0,
3200 _Assume_(text || start >= end);
3201 if (start < end && text[start]) {
3202 if (text[start] ==
'/' ||
3203 text[start] ==
'-' ||
3204 text[start] ==
'.' ||
3205 text[start] ==
'_' ||
3206 text[start] ==
'~' ||
3207 text[start] ==
'%' ||
3208 text[start] ==
'!' ||
3209 text[start] ==
'$' ||
3210 text[start] ==
'&' ||
3211 text[start] ==
'\'' ||
3212 text[start] ==
'(' ||
3213 text[start] ==
')' ||
3214 text[start] ==
'*' ||
3215 text[start] ==
'+' ||
3216 text[start] ==
',' ||
3217 text[start] ==
';' ||
3218 text[start] ==
'=' ||
3219 text[start] ==
':' ||
3220 text[start] ==
'@' ||
3221 text[start] ==
'?' ||
3222 text[start] ==
'#' ||
3223 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3251 _In_reads_or_z_(end)
const char* text,
3252 _In_ size_t start = 0,
3256 _Assume_(text || start >= end);
3257 if (start < end && text[start]) {
3261 if (((
chr[0] ==
L'/' ||
3281 chr[0] ==
L'#') &&
chr[1] == 0) ||
3304 _In_ const std::locale& locale = std::locale()) :
3312 _In_reads_or_z_opt_(end)
const T* text,
3313 _In_ size_t start = 0,
3317 _Assume_(text || start >= end);
3403 virtual void invalidate()
3420 std::shared_ptr<basic_parser<T>> m_path_char;
3421 std::shared_ptr<basic_parser<T>> m_query_start;
3422 std::shared_ptr<basic_parser<T>> m_bookmark_start;
3458 _In_ const std::locale& locale = std::locale()) :
3479 _In_reads_or_z_opt_(end)
const T* text,
3480 _In_ size_t start = 0,
3484 _Assume_(text || start >= end);
3489 m_colon->match(text, http_scheme->interval.end, end,
flags) &&
3490 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3491 m_slash->match(text, m_slash->interval.end, end,
flags))
3495 ftp_scheme->invalidate();
3496 mailto_scheme->invalidate();
3497 file_scheme->invalidate();
3500 m_colon->match(text, ftp_scheme->interval.end, end,
flags) &&
3501 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3502 m_slash->match(text, m_slash->interval.end, end,
flags))
3506 http_scheme->invalidate();
3507 mailto_scheme->invalidate();
3508 file_scheme->invalidate();
3511 m_colon->match(text, mailto_scheme->interval.end, end,
flags))
3515 http_scheme->invalidate();
3516 ftp_scheme->invalidate();
3517 file_scheme->invalidate();
3520 m_colon->match(text, file_scheme->interval.end, end,
flags) &&
3521 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3522 m_slash->match(text, m_slash->interval.end, end,
flags))
3526 http_scheme->invalidate();
3527 ftp_scheme->invalidate();
3528 mailto_scheme->invalidate();
3532 http_scheme->invalidate();
3533 ftp_scheme->invalidate();
3534 mailto_scheme->invalidate();
3535 file_scheme->invalidate();
3538 if (ftp_scheme->interval) {
3540 if (m_colon->match(text, username->interval.end, end,
flags) &&
3541 password->match(text, m_colon->interval.end, end,
flags) &&
3542 m_at->match(text, password->interval.end, end,
flags))
3550 password->invalidate();
3553 username->invalidate();
3554 password->invalidate();
3558 username->invalidate();
3559 password->invalidate();
3565 ipv6_host->invalidate();
3566 dns_host->invalidate();
3570 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3571 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3575 ipv4_host->invalidate();
3576 dns_host->invalidate();
3581 ipv4_host->invalidate();
3582 ipv6_host->invalidate();
3590 port->match(text, m_colon->interval.end, end,
flags))
3607 if (mailto_scheme->interval) {
3609 m_at->match(text, username->interval.end, end,
flags))
3620 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3621 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3625 ipv6_host->invalidate();
3626 dns_host->invalidate();
3630 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3631 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3635 ipv4_host->invalidate();
3636 dns_host->invalidate();
3641 ipv4_host->invalidate();
3642 ipv6_host->invalidate();
3649 password->invalidate();
3656 if (file_scheme->interval) {
3662 username->invalidate();
3663 password->invalidate();
3664 ipv4_host->invalidate();
3665 ipv6_host->invalidate();
3666 dns_host->invalidate();
3675 if (http_scheme->interval &&
3678 if (m_colon->match(text, username->interval.end, end,
flags) &&
3679 password->match(text, m_colon->interval.end, end,
flags) &&
3680 m_at->match(text, password->interval.end, end,
flags))
3685 else if (m_at->match(text, username->interval.end, end,
flags)) {
3688 password->invalidate();
3691 username->invalidate();
3692 password->invalidate();
3696 username->invalidate();
3697 password->invalidate();
3703 ipv6_host->invalidate();
3704 dns_host->invalidate();
3708 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3709 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3713 ipv4_host->invalidate();
3714 dns_host->invalidate();
3719 ipv4_host->invalidate();
3720 ipv6_host->invalidate();
3728 port->match(text, m_colon->interval.end, end,
flags))
3745 virtual void invalidate()
3747 http_scheme->invalidate();
3748 ftp_scheme->invalidate();
3749 mailto_scheme->invalidate();
3750 file_scheme->invalidate();
3751 username->invalidate();
3752 password->invalidate();
3753 ipv4_host->invalidate();
3754 ipv6_host->invalidate();
3755 dns_host->invalidate();
3762 std::shared_ptr<basic_parser<T>> http_scheme;
3763 std::shared_ptr<basic_parser<T>> ftp_scheme;
3764 std::shared_ptr<basic_parser<T>> mailto_scheme;
3765 std::shared_ptr<basic_parser<T>> file_scheme;
3766 std::shared_ptr<basic_parser<T>> username;
3767 std::shared_ptr<basic_parser<T>> password;
3768 std::shared_ptr<basic_parser<T>> ipv4_host;
3769 std::shared_ptr<basic_parser<T>> ipv6_host;
3770 std::shared_ptr<basic_parser<T>> dns_host;
3771 std::shared_ptr<basic_parser<T>> port;
3772 std::shared_ptr<basic_parser<T>> path;
3775 std::shared_ptr<basic_parser<T>> m_colon;
3776 std::shared_ptr<basic_parser<T>> m_slash;
3777 std::shared_ptr<basic_parser<T>> m_at;
3778 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3779 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3806 _In_ const std::locale& locale = std::locale()) :
3818 _In_reads_or_z_opt_(end)
const T* text,
3819 _In_ size_t start = 0,
3823 _Assume_(text || start >= end);
3825 if (username->match(text, start, end,
flags) &&
3826 m_at->match(text, username->interval.end, end,
flags))
3829 if (m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3830 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3831 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3835 ipv6_host->invalidate();
3836 dns_host->invalidate();
3839 m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3840 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3841 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3845 ipv4_host->invalidate();
3846 dns_host->invalidate();
3848 else if (dns_host->match(text, m_at->interval.end, end,
flags)) {
3851 ipv4_host->invalidate();
3852 ipv6_host->invalidate();
3861 username->invalidate();
3862 ipv4_host->invalidate();
3863 ipv6_host->invalidate();
3864 dns_host->invalidate();
3869 virtual void invalidate()
3871 username->invalidate();
3872 ipv4_host->invalidate();
3873 ipv6_host->invalidate();
3874 dns_host->invalidate();
3879 std::shared_ptr<basic_parser<T>> username;
3880 std::shared_ptr<basic_parser<T>> ipv4_host;
3881 std::shared_ptr<basic_parser<T>> ipv6_host;
3882 std::shared_ptr<basic_parser<T>> dns_host;
3885 std::shared_ptr<basic_parser<T>> m_at;
3886 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3887 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3912 _In_ const std::locale& locale = std::locale()) :
3922 _In_reads_or_z_opt_(end)
const T* text,
3923 _In_ size_t start = 0,
3927 _Assume_(text || start >= end);
3933 mouth->invalidate();
3950 hit_offset =
mouth->hit_offset;
3961 hit_offset =
mouth->hit_offset;
3976 mouth->invalidate();
3981 virtual void invalidate()
3987 mouth->invalidate();
3993 std::shared_ptr<basic_parser<T>>
apex;
3994 std::shared_ptr<basic_parser<T>>
eyes;
3995 std::shared_ptr<basic_parser<T>>
nose;
4011 enum date_format_t {
4012 date_format_none = 0,
4013 date_format_dmy = 0x1,
4014 date_format_mdy = 0x2,
4015 date_format_ymd = 0x4,
4016 date_format_ym = 0x8,
4017 date_format_my = 0x10,
4018 date_format_dm = 0x20,
4019 date_format_md = 0x40,
4036 _In_ const std::locale& locale = std::locale()) :
4038 format(date_format_none),
4043 m_separator(separator),
4048 _In_reads_or_z_opt_(end)
const T* text,
4049 _In_ size_t start = 0,
4053 _Assume_(text || start >= end);
4056 if ((m_format_mask & date_format_dmy) == date_format_dmy) {
4057 if (day->match(text, start, end,
flags)) {
4060 size_t hit_offset = m_separator->hit_offset;
4065 m_separator->hit_offset == hit_offset)
4069 is_valid(day->value, month->value))
4073 format = date_format_dmy;
4082 if ((m_format_mask & date_format_mdy) == date_format_mdy) {
4083 if (month->match(text, start, end,
flags)) {
4086 size_t hit_offset = m_separator->hit_offset;
4091 m_separator->hit_offset == hit_offset)
4095 is_valid(day->value, month->value))
4099 format = date_format_mdy;
4108 if ((m_format_mask & date_format_ymd) == date_format_ymd) {
4109 if (year->match(text, start, end,
flags)) {
4112 size_t hit_offset = m_separator->hit_offset;
4117 m_separator->hit_offset == hit_offset)
4121 is_valid(day->value, month->value))
4125 format = date_format_ymd;
4134 if ((m_format_mask & date_format_ym) == date_format_ym) {
4135 if (year->match(text, start, end,
flags)) {
4142 if (day) day->invalidate();
4145 format = date_format_ym;
4152 if ((m_format_mask & date_format_my) == date_format_my) {
4153 if (month->match(text, start, end,
flags)) {
4160 if (day) day->invalidate();
4163 format = date_format_my;
4170 if ((m_format_mask & date_format_dm) == date_format_dm) {
4171 if (day->match(text, start, end,
flags)) {
4174 size_t hit_offset = m_separator->hit_offset;
4177 is_valid(day->value, month->value))
4179 if (year) year->invalidate();
4183 m_separator->hit_offset == hit_offset)
4187 format = date_format_dm;
4194 if ((m_format_mask & date_format_md) == date_format_md) {
4195 if (month->match(text, start, end,
flags)) {
4198 size_t hit_offset = m_separator->hit_offset;
4201 is_valid(day->value, month->value))
4203 if (year) year->invalidate();
4207 m_separator->hit_offset == hit_offset)
4211 format = date_format_md;
4218 if (day) day->invalidate();
4219 if (month) month->invalidate();
4220 if (year) year->invalidate();
4221 format = date_format_none;
4226 virtual void invalidate()
4228 if (day) day->invalidate();
4229 if (month) month->invalidate();
4230 if (year) year->invalidate();
4231 format = date_format_none;
4236 static inline bool is_valid(
size_t day,
size_t month)
4255 return 1 <= day && day <= 31;
4257 return 1 <= day && day <= 29;
4262 return 1 <= day && day <= 30;
4269 date_format_t format;
4270 std::shared_ptr<basic_integer<T>> day;
4271 std::shared_ptr<basic_integer<T>> month;
4272 std::shared_ptr<basic_integer<T>> year;
4276 std::shared_ptr<basic_set<T>> m_separator;
4277 std::shared_ptr<basic_parser<T>> m_space;
4303 _In_ const std::locale& locale = std::locale()) :
4309 m_separator(separator),
4314 _In_reads_or_z_opt_(end)
const T* text,
4315 _In_ size_t start = 0,
4319 _Assume_(text || start >= end);
4321 if (hour->match(text, start, end,
flags) &&
4322 m_separator->match(text, hour->interval.end, end,
flags) &&
4323 minute->match(text, m_separator->interval.end, end,
flags) &&
4327 size_t hit_offset = m_separator->hit_offset;
4328 if (m_separator->match(text, minute->interval.end, end,
flags) &&
4329 m_separator->hit_offset == hit_offset &&
4330 second && second->match(text, m_separator->interval.end, end,
flags) &&
4334 if (m_millisecond_separator && m_millisecond_separator->match(text, second->interval.end, end,
flags) &&
4335 millisecond && millisecond->match(text, m_millisecond_separator->interval.end, end,
flags) &&
4336 millisecond->value < 1000)
4342 if (millisecond) millisecond->invalidate();
4347 if (second) second->invalidate();
4348 if (millisecond) millisecond->invalidate();
4356 minute->invalidate();
4357 if (second) second->invalidate();
4358 if (millisecond) millisecond->invalidate();
4363 virtual void invalidate()
4366 minute->invalidate();
4367 if (second) second->invalidate();
4368 if (millisecond) millisecond->invalidate();
4373 std::shared_ptr<basic_integer10<T>> hour;
4374 std::shared_ptr<basic_integer10<T>> minute;
4375 std::shared_ptr<basic_integer10<T>> second;
4376 std::shared_ptr<basic_integer10<T>> millisecond;
4379 std::shared_ptr<basic_set<T>> m_separator;
4380 std::shared_ptr<basic_parser<T>> m_millisecond_separator;
4407 _In_ const std::locale& locale = std::locale()) :
4419 _In_reads_or_z_opt_(end)
const T* text,
4420 _In_ size_t start = 0,
4424 _Assume_(text || start >= end);
4429 degree_separator->match(text, degree->interval.end, end,
flags))
4432 this->
interval.
end = degree_separator->interval.end;
4435 degree->invalidate();
4436 degree_separator->invalidate();
4440 minute->value < 60 &&
4441 minute_separator->match(text, minute->interval.end, end,
flags))
4444 this->
interval.
end = minute_separator->interval.end;
4447 minute->invalidate();
4448 minute_separator->invalidate();
4457 this->
interval.
end = second_separator->interval.end;
4459 if (second_separator) second_separator->invalidate();
4462 if (second) second->invalidate();
4463 if (second_separator) second_separator->invalidate();
4466 if (degree->interval.start < degree->interval.end ||
4467 minute->interval.start < minute->interval.end ||
4468 (second && second->interval.start < second->interval.end))
4475 decimal->invalidate();
4479 if (decimal) decimal->invalidate();
4484 virtual void invalidate()
4486 degree->invalidate();
4487 degree_separator->invalidate();
4488 minute->invalidate();
4489 minute_separator->invalidate();
4490 if (second) second->invalidate();
4491 if (second_separator) second_separator->invalidate();
4492 if (decimal) decimal->invalidate();
4497 std::shared_ptr<basic_integer10<T>> degree;
4498 std::shared_ptr<basic_parser<T>> degree_separator;
4499 std::shared_ptr<basic_integer10<T>> minute;
4500 std::shared_ptr<basic_parser<T>> minute_separator;
4501 std::shared_ptr<basic_integer10<T>> second;
4502 std::shared_ptr<basic_parser<T>> second_separator;
4503 std::shared_ptr<basic_parser<T>> decimal;
4529 _In_ const std::locale& locale = std::locale()) :
4535 m_separator(separator),
4540 _In_reads_or_z_opt_(end)
const T* text,
4541 _In_ size_t start = 0,
4545 _Assume_(text || start >= end);
4553 m_lparenthesis->invalidate();
4554 m_rparenthesis->invalidate();
4557 value.append(text + m_plus_sign->interval.start, text + m_plus_sign->interval.end);
4568 value.append(text + m_digit->interval.start, text + m_digit->interval.end);
4579 m_lparenthesis && !m_lparenthesis->interval &&
4580 m_rparenthesis && !m_rparenthesis->interval &&
4584 value.append(text + m_lparenthesis->interval.start, m_lparenthesis->interval.size());
4585 this->
interval.
end = m_lparenthesis->interval.end;
4592 m_rparenthesis && !m_rparenthesis->interval &&
4594 m_lparenthesis->hit_offset == m_rparenthesis->hit_offset)
4597 value.append(text + m_rparenthesis->interval.start, text + m_rparenthesis->interval.end);
4598 this->
interval.
end = m_rparenthesis->interval.end;
4639 virtual void invalidate()
4649 std::shared_ptr<basic_parser<T>> m_digit;
4650 std::shared_ptr<basic_parser<T>> m_plus_sign;
4651 std::shared_ptr<basic_set<T>> m_lparenthesis;
4652 std::shared_ptr<basic_set<T>> m_rparenthesis;
4653 std::shared_ptr<basic_parser<T>> m_separator;
4654 std::shared_ptr<basic_parser<T>> m_space;
4677 _In_ const std::locale& locale = std::locale()) :
4688 _In_reads_or_z_opt_(end)
const T* text,
4689 _In_ size_t start = 0,
4693 _Assume_(text || start >= end);
4694 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4702 { {
'A',
'D' }, {}, 24 },
4703 { {
'A',
'E' }, {}, 23 },
4704 { {
'A',
'L' }, {}, 28 },
4705 { {
'A',
'O' }, {}, 25 },
4706 { {
'A',
'T' }, {}, 20 },
4707 { {
'A',
'Z' }, {}, 28 },
4708 { {
'B',
'A' }, {
'3',
'9' }, 20},
4709 { {
'B',
'E' }, {}, 16 },
4710 { {
'B',
'F' }, {}, 28 },
4711 { {
'B',
'G' }, {}, 22 },
4712 { {
'B',
'H' }, {}, 22 },
4713 { {
'B',
'I' }, {}, 27 },
4714 { {
'B',
'J' }, {}, 28 },
4715 { {
'B',
'R' }, {}, 29 },
4716 { {
'B',
'Y' }, {}, 28 },
4717 { {
'C',
'F' }, {}, 27 },
4718 { {
'C',
'G' }, {}, 27 },
4719 { {
'C',
'H' }, {}, 21 },
4720 { {
'C',
'I' }, {}, 28 },
4721 { {
'C',
'M' }, {}, 27 },
4722 { {
'C',
'R' }, {}, 22 },
4723 { {
'C',
'V' }, {}, 25 },
4724 { {
'C',
'Y' }, {}, 28 },
4725 { {
'C',
'Z' }, {}, 24 },
4726 { {
'D',
'E' }, {}, 22 },
4727 { {
'D',
'J' }, {}, 27 },
4728 { {
'D',
'K' }, {}, 18 },
4729 { {
'D',
'O' }, {}, 28 },
4730 { {
'D',
'Z' }, {}, 26 },
4731 { {
'E',
'E' }, {}, 20 },
4732 { {
'E',
'G' }, {}, 29 },
4733 { {
'E',
'S' }, {}, 24 },
4734 { {
'F',
'I' }, {}, 18 },
4735 { {
'F',
'O' }, {}, 18 },
4736 { {
'F',
'R' }, {}, 27 },
4737 { {
'G',
'A' }, {}, 27 },
4738 { {
'G',
'B' }, {}, 22 },
4739 { {
'G',
'E' }, {}, 22 },
4740 { {
'G',
'I' }, {}, 23 },
4741 { {
'G',
'L' }, {}, 18 },
4742 { {
'G',
'Q' }, {}, 27 },
4743 { {
'G',
'R' }, {}, 27 },
4744 { {
'G',
'T' }, {}, 28 },
4745 { {
'G',
'W' }, {}, 25 },
4746 { {
'H',
'N' }, {}, 28 },
4747 { {
'H',
'R' }, {}, 21 },
4748 { {
'H',
'U' }, {}, 28 },
4749 { {
'I',
'E' }, {}, 22 },
4750 { {
'I',
'L' }, {}, 23 },
4751 { {
'I',
'Q' }, {}, 23 },
4752 { {
'I',
'R' }, {}, 26 },
4753 { {
'I',
'S' }, {}, 26 },
4754 { {
'I',
'T' }, {}, 27 },
4755 { {
'J',
'O' }, {}, 30 },
4756 { {
'K',
'M' }, {}, 27 },
4757 { {
'K',
'W' }, {}, 30 },
4758 { {
'K',
'Z' }, {}, 20 },
4759 { {
'L',
'B' }, {}, 28 },
4760 { {
'L',
'C' }, {}, 32 },
4761 { {
'L',
'I' }, {}, 21 },
4762 { {
'L',
'T' }, {}, 20 },
4763 { {
'L',
'U' }, {}, 20 },
4764 { {
'L',
'V' }, {}, 21 },
4765 { {
'L',
'Y' }, {}, 25 },
4766 { {
'M',
'A' }, {}, 28 },
4767 { {
'M',
'C' }, {}, 27 },
4768 { {
'M',
'D' }, {}, 24 },
4769 { {
'M',
'E' }, {
'2',
'5' }, 22 },
4770 { {
'M',
'G' }, {}, 27 },
4771 { {
'M',
'K' }, {
'0',
'7' }, 19 },
4772 { {
'M',
'L' }, {}, 28 },
4773 { {
'M',
'R' }, {
'1',
'3' }, 27},
4774 { {
'M',
'T' }, {}, 31 },
4775 { {
'M',
'U' }, {}, 30 },
4776 { {
'M',
'Z' }, {}, 25 },
4777 { {
'N',
'E' }, {}, 28 },
4778 { {
'N',
'I' }, {}, 32 },
4779 { {
'N',
'L' }, {}, 18 },
4780 { {
'N',
'O' }, {}, 15 },
4781 { {
'P',
'K' }, {}, 24 },
4782 { {
'P',
'L' }, {}, 28 },
4783 { {
'P',
'S' }, {}, 29 },
4784 { {
'P',
'T' }, {
'5',
'0' }, 25 },
4785 { {
'Q',
'A' }, {}, 29 },
4786 { {
'R',
'O' }, {}, 24 },
4787 { {
'R',
'S' }, {
'3',
'5' }, 22 },
4788 { {
'R',
'U' }, {}, 33 },
4789 { {
'S',
'A' }, {}, 24 },
4790 { {
'S',
'C' }, {}, 31 },
4791 { {
'S',
'D' }, {}, 18 },
4792 { {
'S',
'E' }, {}, 24 },
4793 { {
'S',
'I' }, {
'5',
'6' }, 19 },
4794 { {
'S',
'K' }, {}, 24 },
4795 { {
'S',
'M' }, {}, 27 },
4796 { {
'S',
'N' }, {}, 28 },
4797 { {
'S',
'T' }, {}, 25 },
4798 { {
'S',
'V' }, {}, 28 },
4799 { {
'T',
'D' }, {}, 27 },
4800 { {
'T',
'G' }, {}, 28 },
4801 { {
'T',
'L' }, {
'3',
'8' }, 23},
4802 { {
'T',
'N' }, {
'5',
'9' }, 24 },
4803 { {
'T',
'R' }, {}, 26 },
4804 { {
'U',
'A' }, {}, 29 },
4805 { {
'V',
'A' }, {}, 22 },
4806 { {
'V',
'G' }, {}, 24 },
4807 { {
'X',
'K' }, {}, 20 },
4814 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
4818 if (
chr <
'A' ||
'Z' <
chr)
4825 size_t m = (
l +
r) / 2;
4827 if (
c.country[0] <
this->country[0] || (
c.country[0] ==
this->country[0] &&
c.country[1] <
this->country[1]))
4829 else if (this->
country[0] < c.country[0] || (
this->country[0] ==
c.country[0] &&
this->country[1] <
c.country[1]))
4838 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
4845 if ((country_desc->check_digits[0] &&
this->check_digits[0] !=
country_desc->check_digits[0]) ||
4858 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
4870 for (
size_t i = 0; ; ++i) {
4871 if (!this->
bban[i]) {
4872 for (i = 0; i < 2; ++i) {
4891 if (
'0' <= this->
bban[i] && this->
bban[i] <=
'9')
4893 else if (
'A' <= this->
bban[i] && this->
bban[i] <=
'J') {
4897 else if (
'K' <= this->
bban[i] && this->
bban[i] <=
'T') {
4901 else if (
'U' <= this->
bban[i] && this->
bban[i] <=
'Z') {
4916 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
4932 virtual void invalidate()
4948 std::shared_ptr<basic_parser<T>> m_space;
4971 _In_ const std::locale& locale = std::locale()) :
4981 _In_reads_or_z_opt_(end)
const T* text,
4982 _In_ size_t start = 0,
4986 _Assume_(text || start >= end);
4987 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4999 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
5009 for (
size_t j = 0;
j < 4; ++
j) {
5013 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
5027 for (
size_t i =
n,
j = _countof(this->
reference) - 1; i;)
5029 for (
size_t j = _countof(this->
reference) - 1 - n;
j;)
5035 for (
size_t i = 0; ; ++i) {
5071 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
5086 virtual void invalidate()
5100 std::shared_ptr<basic_parser<T>> m_space;
5124 _In_reads_or_z_opt_(end)
const T* text,
5125 _In_ size_t start = 0,
5129 _Assume_(text || start >= end);
5169 _In_reads_or_z_opt_(end)
const T* text,
5170 _In_ size_t start = 0,
5174 _Assume_(text || start >= end);
5175 if (start < end && text[start] ==
'-') {
5206 _In_ const std::locale& locale = std::locale()) :
5219 _In_reads_or_z_opt_(end)
const T* text,
5220 _In_ size_t start = 0,
5224 _Assume_(text || start >= end);
5225 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
5235 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
5242 this->
part1.invalidate();
5243 this->
part2.invalidate();
5244 this->
part3.invalidate();
5245 if (this->
model[0] ==
'9' && this->
model[1] ==
'9') {
5270 if (this->
model[0] ==
'0' && this->
model[1] ==
'0')
5281 else if (this->
model[0] ==
'0' && this->
model[1] ==
'1')
5300 else if (this->
model[0] ==
'0' && this->
model[1] ==
'2')
5308 else if (this->
model[0] ==
'0' && this->
model[1] ==
'3')
5317 else if (this->
model[0] ==
'0' && this->
model[1] ==
'4')
5325 else if ((this->
model[0] ==
'0' || this->
model[0] ==
'5') && this->
model[1] ==
'5')
5339 else if (this->
model[0] ==
'0' && this->
model[1] ==
'6')
5352 else if (this->
model[0] ==
'0' && this->
model[1] ==
'7')
5363 else if (this->
model[0] ==
'0' && this->
model[1] ==
'8')
5373 else if (this->
model[0] ==
'0' && this->
model[1] ==
'9')
5391 else if (this->
model[0] ==
'1' && this->
model[1] ==
'0')
5407 (this->
model[0] ==
'1' && (this->
model[1] ==
'1' || this->
model[1] ==
'8' || this->
model[1] ==
'9')) ||
5408 ((this->
model[0] ==
'2' || this->
model[0] ==
'3') && this->
model[1] ==
'8') ||
5409 (this->
model[0] ==
'4' && (this->
model[1] ==
'0' || this->
model[1] ==
'1' || this->
model[1] ==
'8' || this->
model[1] ==
'9')) ||
5410 (this->
model[0] ==
'5' && (this->
model[1] ==
'1' || this->
model[1] ==
'8')))
5423 else if (this->
model[0] ==
'1' && this->
model[1] ==
'2')
5431 else if ((this->
model[0] ==
'2' || this->
model[0] ==
'3') && this->
model[1] ==
'1')
5453 virtual void invalidate()
5456 this->
part1.invalidate();
5457 this->
part2.invalidate();
5458 this->
part3.invalidate();
5464 static bool check11(
5477 static bool check11(
5494 static bool check11(
5523 std::shared_ptr<basic_parser<T>> m_space;
5547 _In_ const std::locale& locale = std::locale()) :
5557 _In_reads_or_z_opt_(end)
const T* text,
5558 _In_ size_t start = 0,
5562 _Assume_(text || start >= end);
5592 virtual void invalidate()
5604 std::shared_ptr<basic_parser<T>> m_element;
5605 std::shared_ptr<basic_parser<T>> m_digit;
5606 std::shared_ptr<basic_parser<T>> m_sign;
5625 _In_reads_or_z_(end)
const char* text,
5626 _In_ size_t start = 0,
5630 _Assume_(text || start >= end);
5661 _In_reads_or_z_(end)
const char* text,
5662 _In_ size_t start = 0,
5666 _Assume_(text || start >= end);
5698 _In_reads_or_z_(end)
const char* text,
5699 _In_ size_t start = 0,
5703 _Assume_(text || start >= end);
5732 _In_reads_or_z_(end)
const char* text,
5733 _In_ size_t start = 0,
5737 _Assume_(text || start >= end);
5741 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
5786 _In_reads_or_z_(end)
const char* text,
5787 _In_ size_t start = 0,
5791 _Assume_(text || start >= end);
5831 virtual void invalidate()
5835 parser::invalidate();
5852 _In_reads_or_z_(end)
const char* text,
5853 _In_ size_t start = 0,
5857 _Assume_(text || start >= end);
5866 string.invalidate();
5877 virtual void invalidate()
5879 string.invalidate();
5881 parser::invalidate();
5896 _In_reads_or_z_(end)
const char* text,
5897 _In_ size_t start = 0,
5901 _Assume_(text || start >= end);
5929 virtual void invalidate()
5933 parser::invalidate();
5951 _In_reads_or_z_(end)
const char* text,
5952 _In_ size_t start = 0,
5956 _Assume_(text || start >= end);
5957 if (start + 2 < end &&
5958 text[start] ==
'*' &&
5959 text[start + 1] ==
'/' &&
5960 text[start + 2] ==
'*')
5965 else if (start < end && text[start] ==
'*') {
5983 _In_reads_or_z_(end)
const char* text,
5984 _In_ size_t start = 0,
5988 _Assume_(text || start >= end);
6011 subtype.invalidate();
6016 virtual void invalidate()
6019 subtype.invalidate();
6020 parser::invalidate();
6038 _In_reads_or_z_(end)
const char* text,
6039 _In_ size_t start = 0,
6043 _Assume_(text || start >= end);
6044 if (!http_media_range::match(text, start, end,
flags))
6058 params.push_back(std::move(param));
6073 http_media_range::invalidate();
6079 virtual void invalidate()
6082 http_media_range::invalidate();
6086 std::list<http_parameter> params;
6096 _In_reads_or_z_(end)
const char* text,
6097 _In_ size_t start = 0,
6101 _Assume_(text || start >= end);
6105 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6138 _In_reads_or_z_(end)
const char* text,
6139 _In_ size_t start = 0,
6143 _Assume_(text || start >= end);
6172 virtual void invalidate()
6175 parser::invalidate();
6189 _In_reads_or_z_(end)
const char* text,
6190 _In_ size_t start = 0,
6194 _Assume_(text || start >= end);
6198 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6222 _In_reads_or_z_(end)
const char* text,
6223 _In_ size_t start = 0,
6227 _Assume_(text || start >= end);
6261 virtual void invalidate()
6264 parser::invalidate();
6278 _In_reads_or_z_(end)
const char* text,
6279 _In_ size_t start = 0,
6283 _Assume_(text || start >= end);
6288 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6309 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6338 virtual void invalidate()
6344 parser::invalidate();
6358 http_url(
_In_ const std::locale& locale = std::locale()) :
6364 _In_reads_or_z_(end)
const char* text,
6365 _In_ size_t start = 0,
6369 _Assume_(text || start >= end);
6389 server.invalidate();
6405 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6415 params.push_back(std::move(param));
6430 server.invalidate();
6438 virtual void invalidate()
6440 server.invalidate();
6444 parser::invalidate();
6451 std::list<http_url_parameter> params;
6461 _In_reads_or_z_(end)
const char* text,
6462 _In_ size_t start = 0,
6466 _Assume_(text || start >= end);
6474 if (
k.end < end && text[
k.end]) {
6475 if (stdex::isalpha(text[
k.end]))
6486 components.push_back(
k);
6498 if (!components.empty()) {
6507 virtual void invalidate()
6510 parser::invalidate();
6514 std::vector<stdex::interval<size_t>> components;
6529 _In_reads_or_z_(end)
const char* text,
6530 _In_ size_t start = 0,
6534 _Assume_(text || start >= end);
6576 virtual void invalidate()
6579 parser::invalidate();
6593 _In_reads_or_z_(end)
const char* text,
6594 _In_ size_t start = 0,
6598 _Assume_(text || end <= start);
6599 if (start < end && text[start] ==
'*') {
6611 template <
class T,
class T_asterisk = http_asterisk>
6621 _In_reads_or_z_(end)
const char* text,
6622 _In_ size_t start = 0,
6626 _Assume_(text || start >= end);
6635 asterisk.invalidate();
6638 asterisk.invalidate();
6660 factor.invalidate();
6667 virtual void invalidate()
6669 asterisk.invalidate();
6671 factor.invalidate();
6672 parser::invalidate();
6688 _In_reads_or_z_(end)
const char* text,
6689 _In_ size_t start = 0,
6693 _Assume_(text || start >= end);
6725 virtual void invalidate()
6729 parser::invalidate();
6747 _In_reads_or_z_(end)
const char* text,
6748 _In_ size_t start = 0,
6752 _Assume_(text || start >= end);
6782 params.push_back(std::move(param));
6805 virtual void invalidate()
6810 parser::invalidate();
6829 _In_reads_or_z_(end)
const char* text,
6830 _In_ size_t start = 0,
6834 _Assume_(text || start >= end);
6859 else if (stdex::isspace(text[this->
interval.
end])) {
6883 virtual void invalidate()
6889 parser::invalidate();
6909 _In_reads_or_z_(end)
const char* text,
6910 _In_ size_t start = 0,
6914 _Assume_(text || start >= end);
6924 else if (stdex::isspace(text[this->
interval.
end]))
6946 (
uint16_t)strtoui(text + version_maj.
start, version_maj.
size(),
nullptr, 10) * 0x100 +
6958 else if (stdex::isspace(text[this->
interval.
end])) {
6960 version_min.
start = 1;
6961 version_min.
end = 0;
6977 version_maj.
start = 1;
6978 version_maj.
end = 0;
6979 version_min.
start = 1;
6980 version_min.
end = 0;
6986 virtual void invalidate()
6990 version_maj.
start = 1;
6991 version_maj.
end = 0;
6992 version_min.
start = 1;
6993 version_min.
end = 0;
6995 parser::invalidate();
7018 _In_reads_or_z_(end)
const char* text,
7019 _In_ size_t start = 0,
7023 _Assume_(text || start >= end);
7072 protocol.invalidate();
7119 protocol.invalidate();
7124 virtual void invalidate()
7129 protocol.invalidate();
7130 parser::invalidate();
7149 _In_reads_or_z_(end)
const char* text,
7150 _In_ size_t start = 0,
7154 _Assume_(text || start >= end);
7233 virtual void invalidate()
7239 parser::invalidate();
7253 template <
class _Key,
class T>
7258 _In_reads_or_z_(end)
const char* text,
7259 _In_ size_t start = 0,
7263 while (start < end) {
7264 while (start < end && text[start] && stdex::isspace(text[start])) start++;
7265 if (start < end && text[start] ==
',') {
7267 while (start < end&& text[start] && stdex::isspace(text[start])) start++;
7270 if (
el.match(text, start, end,
flags)) {
7272 T::insert(std::move(
el));
7282 constexpr bool operator()(
const T& a,
const T& b)
const noexcept
7284 return a.factor.value > b.factor.value;
7291 template <
class T,
class _Alloc = std::allocator<T>>
7313 _In_ const std::locale& locale = std::locale()) :
7329 _In_reads_or_z_opt_(end)
const T* text,
7330 _In_ size_t start = 0,
7334 _Assume_(text || start >= end);
7346 if (m_quote->match(text, m_escape->interval.end, end,
flags)) {
7347 value +=
'"'; this->
interval.
end = m_quote->interval.end;
7350 if (m_sol->match(text, m_escape->interval.end, end,
flags)) {
7351 value +=
'/'; this->
interval.
end = m_sol->interval.end;
7354 if (m_bs->match(text, m_escape->interval.end, end,
flags)) {
7355 value +=
'\b'; this->
interval.
end = m_bs->interval.end;
7358 if (m_ff->match(text, m_escape->interval.end, end,
flags)) {
7359 value +=
'\f'; this->
interval.
end = m_ff->interval.end;
7362 if (m_lf->match(text, m_escape->interval.end, end,
flags)) {
7363 value +=
'\n'; this->
interval.
end = m_lf->interval.end;
7366 if (m_cr->match(text, m_escape->interval.end, end,
flags)) {
7367 value +=
'\r'; this->
interval.
end = m_cr->interval.end;
7370 if (m_htab->match(text, m_escape->interval.end, end,
flags)) {
7371 value +=
'\t'; this->
interval.
end = m_htab->interval.end;
7375 m_uni->match(text, m_escape->interval.end, end,
flags) &&
7376 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end),
flags | match_case_insensitive) &&
7377 m_hex->interval.size() == 4 )
7379 _Assume_(m_hex->value <= 0xffff);
7380 if (
sizeof(T) == 1) {
7381 if (m_hex->value > 0x7ff) {
7382 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
7383 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
7384 value += (T)(0x80 | (m_hex->value & 0x3f));
7386 else if (m_hex->value > 0x7f) {
7387 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
7388 value += (T)(0x80 | (m_hex->value & 0x3f));
7391 value += (T)(m_hex->value & 0x7f);
7394 value += (T)m_hex->value;
7398 if (m_escape->match(text, m_escape->interval.end, end,
flags)) {
7399 value +=
'\\'; this->
interval.
end = m_escape->interval.end;
7404 value.append(text + m_chr->interval.start, m_chr->interval.size());
7416 virtual void invalidate()
7423 std::basic_string<T> value;
7426 std::shared_ptr<basic_parser<T>> m_quote;
7427 std::shared_ptr<basic_parser<T>> m_chr;
7428 std::shared_ptr<basic_parser<T>> m_escape;
7429 std::shared_ptr<basic_parser<T>> m_sol;
7430 std::shared_ptr<basic_parser<T>> m_bs;
7431 std::shared_ptr<basic_parser<T>> m_ff;
7432 std::shared_ptr<basic_parser<T>> m_lf;
7433 std::shared_ptr<basic_parser<T>> m_cr;
7434 std::shared_ptr<basic_parser<T>> m_htab;
7435 std::shared_ptr<basic_parser<T>> m_uni;
7436 std::shared_ptr<basic_integer16<T>> m_hex;
7455 _In_reads_or_z_opt_(end)
const T* text,
7456 _In_ size_t start = 0,
7460 _Unreferenced_(
flags);
7461 _Assume_(text || start + 1 >= end);
7462 if (start + 1 < end &&
7463 text[start] ==
'/' &&
7464 text[start + 1] ==
'*')
7489 virtual void invalidate()
7492 basic_parser::invalidate();
7515 _In_reads_or_z_opt_(end)
const T* text,
7516 _In_ size_t start = 0,
7520 _Unreferenced_(
flags);
7521 _Assume_(text || start + 3 >= end);
7522 if (start + 3 < end &&
7523 text[start] ==
'<' &&
7524 text[start + 1] ==
'!' &&
7525 text[start + 2] ==
'-' &&
7526 text[start + 3] ==
'-')
7553 _In_reads_or_z_opt_(end)
const T* text,
7554 _In_ size_t start = 0,
7558 _Unreferenced_(
flags);
7559 _Assume_(text || start + 2 >= end);
7560 if (start + 2 < end &&
7561 text[start] ==
'-' &&
7562 text[start + 1] ==
'-' &&
7563 text[start + 2] ==
'>')
7590 _In_reads_or_z_opt_(end)
const T* text,
7591 _In_ size_t start = 0,
7595 _Unreferenced_(
flags);
7631 virtual void invalidate()
7634 basic_parser::invalidate();
7657 _In_reads_or_z_opt_(end)
const T* text,
7658 _In_ size_t start = 0,
7662 _Unreferenced_(
flags);
7675 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7742 virtual void invalidate()
7745 basic_parser::invalidate();
7768 _In_reads_or_z_opt_(end)
const T* text,
7769 _In_ size_t start = 0,
7773 _Unreferenced_(
flags);
7789 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7827 virtual void invalidate()
7830 basic_parser::invalidate();
7853 _In_reads_or_z_opt_(end)
const T* text,
7854 _In_ size_t start = 0,
7858 _Unreferenced_(
flags);
7859 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7959 virtual void invalidate()
7964 basic_parser::invalidate();
7989 _In_reads_or_z_opt_(end)
const T* text,
7990 _In_ size_t start = 0,
7994 _Unreferenced_(
flags);
7995 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8036 _In_reads_or_z_opt_(end)
const T* text,
8037 _In_ size_t start = 0,
8041 _Unreferenced_(
flags);
8070 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8090 virtual void invalidate()
8093 basic_parser::invalidate();
8111 enum class html_sequence_t {
8142 type(html_sequence_t::unknown)
8146 _In_reads_or_z_opt_(end)
const T* text,
8147 _In_ size_t start = 0,
8151 _Assume_(text || start >= end);
8152 if (start >= end || text[start] !=
'<')
8161 this->
type = html_sequence_t::element_end;
8183 this->
type = html_sequence_t::comment;
8193 this->
type = html_sequence_t::declaration;
8204 this->
type = html_sequence_t::instruction;
8216 this->
type = html_sequence_t::instruction;
8228 this->
type = html_sequence_t::element_start;
8236 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8241 if (this->
type == html_sequence_t::element_start &&
8247 this->
type = html_sequence_t::element;
8258 if (this->
type == html_sequence_t::declaration &&
8267 if (this->
type == html_sequence_t::declaration &&
8321 a->value = this->m_value.content;
8330 a->value.invalidate();
8338 this->
type = html_sequence_t::unknown;
8345 virtual void invalidate()
8347 this->
type = html_sequence_t::unknown;
8350 basic_parser::invalidate();
8379 _In_reads_or_z_opt_(end)
const T* text,
8380 _In_ size_t start = 0,
8384 _Unreferenced_(
flags);
8385 _Assume_(text || start + 2 >= end);
8386 if (start + 2 < end &&
8387 text[start] ==
'<' &&
8388 text[start + 1] ==
'!' &&
8389 text[start + 2] ==
'[')
8394 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8419 virtual void invalidate()
8422 basic_parser::invalidate();
8445 _In_reads_or_z_opt_(end)
const T* text,
8446 _In_ size_t start = 0,
8450 _Unreferenced_(
flags);
8451 _Assume_(text || start + 2 >= end);
8452 if (start + 2 < end &&
8453 text[start] ==
']' &&
8454 text[start + 1] ==
']' &&
8455 text[start + 2] ==
'>')
8476#undef ENUM_FLAG_OPERATOR
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4397
Test for any code unit.
Definition parser.hpp:224
Test for beginning of line.
Definition parser.hpp:618
Test for any.
Definition parser.hpp:1061
Test for Creditor Reference.
Definition parser.hpp:4967
T reference[22]
Normalized national reference number.
Definition parser.hpp:5096
T check_digits[3]
Two check digits.
Definition parser.hpp:5095
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:5097
Legacy CSS comment end -->
Definition parser.hpp:7550
Legacy CSS comment start <!--
Definition parser.hpp:7512
CSS import directive.
Definition parser.hpp:7765
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7834
CSS string.
Definition parser.hpp:7587
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7638
URI in CSS.
Definition parser.hpp:7654
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7749
Test for any code unit from a given string of code units.
Definition parser.hpp:724
Test for specific code unit.
Definition parser.hpp:294
Test for date.
Definition parser.hpp:4027
Test for valid DNS domain character.
Definition parser.hpp:2808
bool allow_on_edge
Is character allowed at the beginning or an end of a DNS domain?
Definition parser.hpp:2846
Test for DNS domain/hostname.
Definition parser.hpp:2908
bool m_allow_absolute
May DNS names end with a dot (absolute name)?
Definition parser.hpp:2972
Test for e-mail address.
Definition parser.hpp:3796
Test for emoticon.
Definition parser.hpp:3904
std::shared_ptr< basic_parser< T > > apex
apex/eyebrows/halo (e.g. O, 0)
Definition parser.hpp:3993
std::shared_ptr< basic_parser< T > > eyes
eyes (e.g. :, ;, >, |, B)
Definition parser.hpp:3994
std::shared_ptr< basic_set< T > > mouth
mouth (e.g. ), ), (, (, |, P, D, p, d)
Definition parser.hpp:3996
std::shared_ptr< basic_parser< T > > nose
nose (e.g. -, o)
Definition parser.hpp:3995
std::shared_ptr< basic_parser< T > > emoticon
emoticon as a whole (e.g. 😀, 🤔, 😶)
Definition parser.hpp:3992
Test for end of line.
Definition parser.hpp:657
Test for fraction.
Definition parser.hpp:1690
End of condition ...]]>
Definition parser.hpp:8442
Start of condition <![condition[...
Definition parser.hpp:8376
Contiguous sequence of characters representing name of element, attribute etc.
Definition parser.hpp:7986
Tag.
Definition parser.hpp:8138
std::vector< html_attribute > attributes
tag attributes
Definition parser.hpp:8356
html_sequence_t type
tag type
Definition parser.hpp:8354
stdex::interval< size_t > name
tag name position in source
Definition parser.hpp:8355
Optionally-quoted string representing value of an attribute.
Definition parser.hpp:8033
stdex::interval< size_t > content
content position in source
Definition parser.hpp:8097
Test for International Bank Account Number.
Definition parser.hpp:4673
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4944
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4942
T check_digits[3]
Two check digits.
Definition parser.hpp:4943
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4945
Test for decimal integer.
Definition parser.hpp:1299
Test for decimal integer possibly containing thousand separators.
Definition parser.hpp:1384
bool has_separators
Did integer have any separators?
Definition parser.hpp:1444
size_t digit_count
Total number of digits in integer.
Definition parser.hpp:1443
Test for hexadecimal integer.
Definition parser.hpp:1465
Base class for integer testing.
Definition parser.hpp:1277
size_t value
Calculated value of the numeral.
Definition parser.hpp:1291
Test for IPv4 address.
Definition parser.hpp:2350
stdex::interval< size_t > components[4]
Individual component intervals.
Definition parser.hpp:2465
struct in_addr value
IPv4 address value.
Definition parser.hpp:2466
Test for IPv6 address.
Definition parser.hpp:2569
std::shared_ptr< basic_parser< T > > scope_id
Scope ID (e.g. NIC index with link-local addresses)
Definition parser.hpp:2771
stdex::interval< size_t > components[8]
Individual component intervals.
Definition parser.hpp:2769
struct in6_addr value
IPv6 address value.
Definition parser.hpp:2770
Test for valid IPv6 address scope ID character.
Definition parser.hpp:2497
Test for repeating.
Definition parser.hpp:914
bool m_greedy
try to match as long sequence as possible
Definition parser.hpp:953
std::shared_ptr< basic_parser< T > > m_el
repeating element
Definition parser.hpp:950
size_t m_min_iterations
minimum number of iterations
Definition parser.hpp:951
size_t m_max_iterations
maximum number of iterations
Definition parser.hpp:952
Test for JSON string.
Definition parser.hpp:7299
MIME content type.
Definition parser.hpp:7850
stdex::interval< size_t > base_type
basic type position in source
Definition parser.hpp:7968
stdex::interval< size_t > sub_type
sub-type position in source
Definition parser.hpp:7969
stdex::interval< size_t > charset
charset position in source
Definition parser.hpp:7970
Test for mixed numeral.
Definition parser.hpp:1926
std::shared_ptr< basic_parser< T > > fraction
fraction
Definition parser.hpp:2032
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2030
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2029
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2028
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2031
Test for monetary numeral.
Definition parser.hpp:2221
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2327
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2332
std::shared_ptr< basic_parser< T > > currency
Currency part.
Definition parser.hpp:2330
std::shared_ptr< basic_parser< T > > decimal
Decimal part.
Definition parser.hpp:2333
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2331
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2328
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2329
"No-op" match
Definition parser.hpp:192
Base template for all parsers.
Definition parser.hpp:74
stdex::interval< size_t > interval
Region of the last match.
Definition parser.hpp:172
Test for permutation.
Definition parser.hpp:1201
Test for phone number.
Definition parser.hpp:4520
std::basic_string< T > value
Normalized phone number.
Definition parser.hpp:4646
Test for any punctuation code unit.
Definition parser.hpp:466
Test for Roman numeral.
Definition parser.hpp:1574
Test for scientific numeral.
Definition parser.hpp:2052
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2196
std::shared_ptr< basic_parser< T > > exponent_symbol
Exponent symbol (e.g. 'e')
Definition parser.hpp:2200
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2194
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2195
double value
Calculated value of the numeral.
Definition parser.hpp:2204
std::shared_ptr< basic_parser< T > > negative_exp_sign
Negative exponent sign (e.g. '-')
Definition parser.hpp:2202
std::shared_ptr< basic_integer< T > > decimal
Decimal part.
Definition parser.hpp:2199
std::shared_ptr< basic_parser< T > > positive_exp_sign
Positive exponent sign (e.g. '+')
Definition parser.hpp:2201
std::shared_ptr< basic_integer< T > > exponent
Exponent part.
Definition parser.hpp:2203
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2198
std::shared_ptr< basic_integer< T > > integer
Integer part.
Definition parser.hpp:2197
Test for match score.
Definition parser.hpp:1753
Test for sequence.
Definition parser.hpp:1010
Definition parser.hpp:692
Test for SI Reference delimiter.
Definition parser.hpp:5164
Test for SI Reference part.
Definition parser.hpp:5119
Test for SI Reference.
Definition parser.hpp:5202
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5519
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5517
bool is_valid
Is reference valid.
Definition parser.hpp:5520
T model[3]
Reference model.
Definition parser.hpp:5516
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5518
Test for signed numeral.
Definition parser.hpp:1840
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1908
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1907
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1906
std::shared_ptr< basic_parser< T > > number
Number.
Definition parser.hpp:1909
Test for any space code unit.
Definition parser.hpp:387
Test for any space or punctuation code unit.
Definition parser.hpp:540
Test for any string.
Definition parser.hpp:1129
Test for given string.
Definition parser.hpp:819
Test for time.
Definition parser.hpp:4294
Test for valid URL password character.
Definition parser.hpp:3090
Test for valid URL path character.
Definition parser.hpp:3190
Test for URL path.
Definition parser.hpp:3298
Test for valid URL username character.
Definition parser.hpp:2991
Test for URL.
Definition parser.hpp:3439
Test for HTTP agent.
Definition parser.hpp:6826
Test for HTTP any type.
Definition parser.hpp:5948
Test for HTTP asterisk.
Definition parser.hpp:6590
Test for HTTP cookie parameter (RFC2109)
Definition parser.hpp:6685
Test for HTTP cookie (RFC2109)
Definition parser.hpp:6744
std::list< http_cookie_parameter > params
List of cookie parameters.
Definition parser.hpp:6816
http_token name
Cookie name.
Definition parser.hpp:6814
http_value value
Cookie value.
Definition parser.hpp:6815
Test for HTTP language (RFC1766)
Definition parser.hpp:6458
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5622
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5893
http_token name
Parameter name.
Definition parser.hpp:5937
http_value value
Parameter value.
Definition parser.hpp:5938
Test for HTTP protocol.
Definition parser.hpp:6901
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:7002
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5783
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5839
Test for HTTP request.
Definition parser.hpp:7009
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5658
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5695
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5729
Test for HTTP URL parameter.
Definition parser.hpp:6275
Test for HTTP URL path segment.
Definition parser.hpp:6186
Test for HTTP URL path segment.
Definition parser.hpp:6219
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6268
Test for HTTP URL port.
Definition parser.hpp:6130
Test for HTTP URL server.
Definition parser.hpp:6093
Test for HTTP URL.
Definition parser.hpp:6356
Collection of HTTP values.
Definition parser.hpp:7255
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5849
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5885
http_token token
Value when matched as token.
Definition parser.hpp:5886
Test for HTTP weight factor.
Definition parser.hpp:6521
float value
Calculated value of the weight factor.
Definition parser.hpp:6583
Test for HTTP weighted value.
Definition parser.hpp:6613
Base template for collection-holding parsers.
Definition parser.hpp:970
Test for any SGML code point.
Definition parser.hpp:256
Test for any SGML code point from a given string of SGML code points.
Definition parser.hpp:776
Test for specific SGML code point.
Definition parser.hpp:343
Test for valid DNS domain SGML character.
Definition parser.hpp:2864
Test for valid IPv6 address scope ID SGML character.
Definition parser.hpp:2535
Test for any SGML punctuation code point.
Definition parser.hpp:507
Test for any SGML space code point.
Definition parser.hpp:430
Test for any SGML space or punctuation code point.
Definition parser.hpp:583
Test for SGML given string.
Definition parser.hpp:866
Test for valid URL password SGML character.
Definition parser.hpp:3142
Test for valid URL path SGML character.
Definition parser.hpp:3246
Test for valid URL username SGML character.
Definition parser.hpp:3042
Numerical interval.
Definition interval.hpp:18
T size() const
Returns interval size.
Definition interval.hpp:47
T end
interval end
Definition interval.hpp:20
interval() noexcept
Constructs an invalid interval.
Definition interval.hpp:25
void invalidate()
Invalidates interval.
Definition interval.hpp:59
T start
interval start
Definition interval.hpp:19
Tag attribute.
Definition parser.hpp:8128
stdex::interval< size_t > name
attribute name position in source
Definition parser.hpp:8129
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8130
Definition parser.hpp:7281