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_(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_(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_(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_(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_(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_(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) || !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_(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_(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) || !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_(end)
const T* text,
624 _In_ size_t start = 0,
628 _Assume_(text || start >= end);
629 bool r = start == 0 || (start <= end && islbreak(text[start - 1]));
630 if ((
r && !m_invert) || (!
r && m_invert)) {
661 _In_reads_or_z_(end)
const T* text,
662 _In_ size_t start = 0,
666 _Assume_(text || start >= end);
667 bool r = islbreak(text[start]);
668 if ((
r && !m_invert) || (!
r && m_invert)) {
700 _In_reads_or_z_(end)
const T* text,
701 _In_ size_t start = 0,
705 virtual void invalidate()
726 _In_reads_or_z_(
count)
const T* set,
729 _In_ const std::locale& locale = std::locale()) :
733 m_set.assign(set, set + stdex::strnlen(set,
count));
737 _In_reads_or_z_(end)
const T* text,
738 _In_ size_t start = 0,
742 _Assume_(text || start >= end);
743 if (start < end && text[start]) {
744 const T* set = m_set.c_str();
745 size_t r = (
flags & match_case_insensitive) ?
746 stdex::strnichr(set, m_set.size(), text[start], this->m_locale) :
747 stdex::strnchr(set, m_set.size(), text[start]);
748 if ((
r != stdex::npos && !this->m_invert) || (
r == stdex::npos && this->m_invert)) {
749 this->hit_offset =
r;
760 std::basic_string<T> m_set;
781 m_set = sgml2str(set,
count);
785 _In_reads_or_z_(end)
const char* text,
786 _In_ size_t start = 0,
790 _Assume_(text || start >= end);
791 if (start < end && text[start]) {
794 const wchar_t* set = m_set.c_str();
795 size_t r = (
flags & match_case_insensitive) ?
796 stdex::strnistr(set, m_set.size(),
chr, m_locale) :
797 stdex::strnstr(set, m_set.size(),
chr);
798 if ((
r != stdex::npos && !m_invert) || (
r == stdex::npos && m_invert)) {
821 _In_reads_or_z_(
count)
const T*
str,
823 _In_ const std::locale& locale = std::locale()) :
829 _In_reads_or_z_(end)
const T* text,
830 _In_ size_t start = 0,
834 _Assume_(text || start >= end);
837 n = std::min<size_t>(end - start,
m);
838 bool r = ((
flags & match_case_insensitive) ?
839 stdex::strnicmp(text + start,
n, m_str.c_str(),
m, this->m_locale) :
840 stdex::strncmp(text + start,
n, m_str.c_str(),
m)) == 0;
850 std::basic_string<T> m_str;
873 _In_reads_or_z_(end)
const char* text,
874 _In_ size_t start = 0,
878 _Assume_(text || start >= end);
879 const wchar_t*
str = m_str.c_str();
881 const auto&
ctype = std::use_facet<std::ctype<wchar_t>>(m_locale);
923 _In_reads_or_z_(end)
const T* text,
924 _In_ size_t start = 0,
928 _Assume_(text || start >= end);
930 for (
size_t i = 0; ; i++) {
949 std::shared_ptr<basic_parser<T>>
m_el;
977 _In_ const std::locale& locale = std::locale()) :
981 m_collection.reserve(
count);
982 for (
size_t i = 0; i <
count; i++)
983 m_collection.push_back(
el[i]);
988 _In_ const std::locale& locale = std::locale()) :
993 virtual void invalidate()
995 for (
auto&
el : m_collection)
1001 std::vector<std::shared_ptr<basic_parser<T>>> m_collection;
1014 _In_ const std::locale& locale = std::locale()) :
1020 _In_ const std::locale& locale = std::locale()) :
1025 _In_reads_or_z_(end)
const T* text,
1026 _In_ size_t start = 0,
1030 _Assume_(text || start >= end);
1032 for (
auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i) {
1034 for (++i; i != this->m_collection.end(); ++i)
1071 _In_ const std::locale& locale = std::locale()) :
1078 _In_ const std::locale& locale = std::locale()) :
1084 _In_reads_or_z_(end)
const T* text,
1085 _In_ size_t start = 0,
1089 _Assume_(text || start >= end);
1091 for (
auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i, ++hit_offset) {
1092 if ((*i)->match(text, start, end,
flags)) {
1094 for (++i; i != this->m_collection.end(); ++i)
1104 virtual void invalidate()
1126 template <
class T,
class T_parser = basic_
string<T>>
1133 _In_ const std::locale& locale = std::locale()) :
1167 this->m_collection.reserve(
n);
1180 this->m_collection.push_back(std::move(std::make_shared<T_parser>(
str,
SIZE_MAX,
this->m_locale)));
1181 (p =
va_arg(params,
const T*)) !=
nullptr;
1182 this->m_collection.push_back(std::move(std::make_shared<T_parser>(p,
SIZE_MAX, this->m_locale))));
1205 _In_ const std::locale& locale = std::locale()) :
1211 _In_ const std::locale& locale = std::locale()) :
1216 _In_reads_or_z_(end)
const T* text,
1217 _In_ size_t start = 0,
1221 _Assume_(text || start >= end);
1222 for (
auto&
el : this->m_collection)
1224 if (match_recursively(text, start, end,
flags)) {
1233 bool match_recursively(
1234 _In_reads_or_z_(end)
const T* text,
1235 _In_ size_t start = 0,
1240 for (
auto&
el : this->m_collection) {
1244 if (
el->match(text, start, end,
flags)) {
1283 virtual void invalidate()
1311 _In_ const std::locale& locale = std::locale()) :
1326 _In_reads_or_z_(end)
const T* text,
1327 _In_ size_t start = 0,
1331 _Assume_(text || start >= end);
1356 std::shared_ptr<basic_parser<T>>
1388 _In_ const std::locale& locale = std::locale()) :
1393 m_separator(separator)
1397 _In_reads_or_z_(end)
const T* text,
1398 _In_ size_t start = 0,
1402 _Assume_(text || start >= end);
1403 if (m_digits->match(text, start, end,
flags)) {
1405 this->
value = m_digits->value;
1410 if (m_digits->interval.size() <= 3) {
1414 (hit_offset ==
SIZE_MAX || hit_offset == m_separator->hit_offset) &&
1415 m_digits->match(text, m_separator->interval.end, end,
flags) &&
1416 m_digits->interval.size() == 3)
1419 this->
value = this->
value * 1000 + m_digits->value;
1423 hit_offset = m_separator->hit_offset;
1434 virtual void invalidate()
1446 std::shared_ptr<basic_integer10<T>> m_digits;
1447 std::shared_ptr<basic_set<T>> m_separator;
1483 _In_ const std::locale& locale = std::locale()) :
1504 _In_reads_or_z_(end)
const T* text,
1505 _In_ size_t start = 0,
1509 _Assume_(text || start >= end);
1540 std::shared_ptr<basic_parser<T>>
1585 _In_ const std::locale& locale = std::locale()) :
1599 _In_reads_or_z_(end)
const T* text,
1600 _In_ size_t start = 0,
1604 _Assume_(text || start >= end);
1614 else if (m_digit_100 && m_digit_100->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 100;
end2 = m_digit_100->interval.end; }
1615 else if (m_digit_500 && m_digit_500->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 500;
end2 = m_digit_500->interval.end; }
1616 else if (m_digit_1000 && m_digit_1000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 1000;
end2 = m_digit_1000->interval.end; }
1617 else if (m_digit_5000 && m_digit_5000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 5000;
end2 = m_digit_5000->interval.end; }
1618 else if (m_digit_10000 && m_digit_10000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 10000;
end2 = m_digit_10000->interval.end; }
1630 this->
value += dig[0];
1633 (
dig[1] == 1 && (
dig[0] == 5 ||
dig[0] == 10)) ||
1634 (
dig[1] == 10 && (
dig[0] == 50 ||
dig[0] == 100)) ||
1635 (
dig[1] == 100 && (
dig[0] == 500 ||
dig[0] == 1000)) ||
1636 (
dig[1] == 1000 && (
dig[0] == 5000 ||
dig[0] == 10000)))
1643 this->
value -= dig[1];
1647 this->
value += dig[0];
1663 std::shared_ptr<basic_parser<T>>
1695 _In_ const std::locale& locale = std::locale()) :
1703 _In_reads_or_z_(end)
const T* text,
1704 _In_ size_t start = 0,
1708 _Assume_(text || start >= end);
1709 if (numerator->match(text, start, end,
flags) &&
1710 fraction_line->match(text, numerator->interval.end, end,
flags) &&
1711 denominator->match(text, fraction_line->interval.end, end,
flags))
1717 numerator->invalidate();
1718 fraction_line->invalidate();
1719 denominator->invalidate();
1724 virtual void invalidate()
1726 numerator->invalidate();
1727 fraction_line->invalidate();
1728 denominator->invalidate();
1733 std::shared_ptr<basic_parser<T>> numerator;
1734 std::shared_ptr<basic_parser<T>> fraction_line;
1735 std::shared_ptr<basic_parser<T>> denominator;
1759 _In_ const std::locale& locale = std::locale()) :
1768 _In_reads_or_z_(end)
const T* text,
1769 _In_ size_t start = 0,
1773 _Assume_(text || start >= end);
1802 separator->invalidate();
1803 guest->invalidate();
1808 virtual void invalidate()
1811 separator->invalidate();
1812 guest->invalidate();
1817 std::shared_ptr<basic_parser<T>> home;
1818 std::shared_ptr<basic_parser<T>> separator;
1819 std::shared_ptr<basic_parser<T>> guest;
1822 std::shared_ptr<basic_parser<T>> m_space;
1846 _In_ const std::locale& locale = std::locale()) :
1855 _In_reads_or_z_(end)
const T* text,
1856 _In_ size_t start = 0,
1860 _Assume_(text || start >= end);
1895 virtual void invalidate()
1934 _In_ const std::locale& locale = std::locale()) :
1945 _In_reads_or_z_(end)
const T* text,
1946 _In_ size_t start = 0,
1950 _Assume_(text || start >= end);
2016 virtual void invalidate()
2034 std::shared_ptr<basic_parser<T>> m_space;
2064 _In_ const std::locale& locale = std::locale()) :
2076 value(std::numeric_limits<double>::quiet_NaN())
2080 _In_reads_or_z_(end)
const T* text,
2081 _In_ size_t start = 0,
2085 _Assume_(text || start >= end);
2120 if (
integer->interval.empty() &&
2176 virtual void invalidate()
2188 value = std::numeric_limits<double>::quiet_NaN();
2230 _In_ const std::locale& locale = std::locale()) :
2242 _In_reads_or_z_(end)
const T* text,
2243 _In_ size_t start = 0,
2247 _Assume_(text || start >= end);
2294 if (
integer->interval.empty() &&
2313 virtual void invalidate()
2363 _In_ const std::locale& locale = std::locale()) :
2375 m_separator(separator)
2381 _In_reads_or_z_(end)
const T* text,
2382 _In_ size_t start = 0,
2386 _Assume_(text || start >= end);
2391 for (i = 0; i < 4; i++) {
2449 virtual void invalidate()
2468 std::shared_ptr<basic_parser<T>>
2479 std::shared_ptr<basic_parser<T>> m_separator;
2501 _In_reads_or_z_(end)
const T* text,
2502 _In_ size_t start = 0,
2506 _Assume_(text || start >= end);
2507 if (start < end && text[start]) {
2508 if (text[start] ==
'-' ||
2509 text[start] ==
'_' ||
2510 text[start] ==
':' ||
2511 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2539 _In_reads_or_z_(end)
const char* text,
2540 _In_ size_t start = 0,
2544 _Assume_(text || start >= end);
2545 if (start < end && text[start]) {
2549 if (((
chr[0] ==
L'-' ||
2551 chr[0] ==
L':') &&
chr[1] == 0) ||
2590 _In_ const std::locale& locale = std::locale()) :
2608 m_separator(separator),
2616 _In_reads_or_z_(end)
const T* text,
2617 _In_ size_t start = 0,
2621 _Assume_(text || start >= end);
2626 for (i = 0; i < 8; i++) {
2630 if (m_separator->match(text, m_separator->interval.end, end,
flags)) {
2679 if (
x_n <= 0xffff) {
2702 this->
value.s6_words[--j] = this->
value.s6_words[--k];
2706 this->
value.s6_words[--j] = 0;
2714 if (m_scope_id_separator && m_scope_id_separator->match(text,
this->
interval.
end, end,
flags) &&
2746 virtual void invalidate()
2775 std::shared_ptr<basic_parser<T>>
2792 std::shared_ptr<basic_parser<T>> m_separator, m_scope_id_separator;
2813 _In_ const std::locale& locale = std::locale()) :
2820 _In_reads_or_z_(end)
const T* text,
2821 _In_ size_t start = 0,
2825 _Assume_(text || start >= end);
2826 if (start < end && text[start]) {
2827 if ((
'A' <= text[start] && text[start] <=
'Z') ||
2828 (
'a' <= text[start] && text[start] <=
'z') ||
2829 (
'0' <= text[start] && text[start] <=
'9'))
2831 else if (text[start] ==
'-')
2833 else if (m_allow_idn && std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2869 _In_ const std::locale& locale = std::locale()) :
2874 _In_reads_or_z_(end)
const char* text,
2875 _In_ size_t start = 0,
2879 _Assume_(text || start >= end);
2880 if (start < end && text[start]) {
2884 if (((
'A' <=
chr[0] &&
chr[0] <=
'Z') ||
2885 (
'a' <=
chr[0] &&
chr[0] <=
'z') ||
2886 (
'0' <=
chr[0] &&
chr[0] <=
'9')) &&
chr[1] == 0)
2888 else if (
chr[0] ==
'-' &&
chr[1] == 0)
2890 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)
2915 _In_ const std::locale& locale = std::locale()) :
2919 m_separator(separator)
2923 _In_reads_or_z_(end)
const T* text,
2924 _In_ size_t start = 0,
2928 _Assume_(text || start >= end);
2929 size_t i = start,
count;
2931 if (m_domain_char->match(text, i, end,
flags) &&
2932 m_domain_char->allow_on_edge)
2935 this->
interval.
end = i = m_domain_char->interval.end;
2936 while (i < end && text[i]) {
2937 if (m_domain_char->allow_on_edge &&
2938 m_separator->match(text, i, end,
flags))
2942 this->
interval.
end = i = m_separator->interval.end;
2945 i = m_separator->interval.end;
2949 if (m_domain_char->match(text, i, end,
flags)) {
2950 if (m_domain_char->allow_on_edge)
2951 this->
interval.
end = i = m_domain_char->interval.end;
2953 i = m_domain_char->interval.end;
2974 std::shared_ptr<basic_dns_domain_char<T>> m_domain_char;
2975 std::shared_ptr<basic_parser<T>> m_separator;
2997 _In_reads_or_z_(end)
const T* text,
2998 _In_ size_t start = 0,
3002 _Assume_(text || start >= end);
3003 if (start < end && text[start]) {
3004 if (text[start] ==
'-' ||
3005 text[start] ==
'.' ||
3006 text[start] ==
'_' ||
3007 text[start] ==
'~' ||
3008 text[start] ==
'%' ||
3009 text[start] ==
'!' ||
3010 text[start] ==
'$' ||
3011 text[start] ==
'&' ||
3012 text[start] ==
'\'' ||
3015 text[start] ==
'*' ||
3016 text[start] ==
'+' ||
3017 text[start] ==
',' ||
3018 text[start] ==
';' ||
3019 text[start] ==
'=' ||
3020 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3048 _In_reads_or_z_(end)
const char* text,
3049 _In_ size_t start = 0,
3053 _Assume_(text || start >= end);
3054 if (start < end && text[start]) {
3058 if (((
chr[0] ==
L'-' ||
3073 chr[0] ==
L'=') &&
chr[1] == 0) ||
3096 _In_reads_or_z_(end)
const T* text,
3097 _In_ size_t start = 0,
3101 _Assume_(text || start >= end);
3102 if (start < end && text[start]) {
3103 if (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 text[start] ==
':' ||
3120 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3148 _In_reads_or_z_(end)
const char* text,
3149 _In_ size_t start = 0,
3153 _Assume_(text || start >= end);
3154 if (start < end && text[start]) {
3158 if (((
chr[0] ==
L'-' ||
3174 chr[0] ==
L':') &&
chr[1] == 0) ||
3196 _In_reads_or_z_(end)
const T* text,
3197 _In_ size_t start = 0,
3201 _Assume_(text || start >= end);
3202 if (start < end && text[start]) {
3203 if (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 text[start] ==
'#' ||
3224 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3252 _In_reads_or_z_(end)
const char* text,
3253 _In_ size_t start = 0,
3257 _Assume_(text || start >= end);
3258 if (start < end && text[start]) {
3262 if (((
chr[0] ==
L'/' ||
3282 chr[0] ==
L'#') &&
chr[1] == 0) ||
3305 _In_ const std::locale& locale = std::locale()) :
3313 _In_reads_or_z_(end)
const T* text,
3314 _In_ size_t start = 0,
3318 _Assume_(text || start >= end);
3404 virtual void invalidate()
3421 std::shared_ptr<basic_parser<T>> m_path_char;
3422 std::shared_ptr<basic_parser<T>> m_query_start;
3423 std::shared_ptr<basic_parser<T>> m_bookmark_start;
3459 _In_ const std::locale& locale = std::locale()) :
3480 _In_reads_or_z_(end)
const T* text,
3481 _In_ size_t start = 0,
3485 _Assume_(text || start >= end);
3490 m_colon->match(text, http_scheme->interval.end, end,
flags) &&
3491 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3492 m_slash->match(text, m_slash->interval.end, end,
flags))
3496 ftp_scheme->invalidate();
3497 mailto_scheme->invalidate();
3498 file_scheme->invalidate();
3501 m_colon->match(text, ftp_scheme->interval.end, end,
flags) &&
3502 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3503 m_slash->match(text, m_slash->interval.end, end,
flags))
3507 http_scheme->invalidate();
3508 mailto_scheme->invalidate();
3509 file_scheme->invalidate();
3512 m_colon->match(text, mailto_scheme->interval.end, end,
flags))
3516 http_scheme->invalidate();
3517 ftp_scheme->invalidate();
3518 file_scheme->invalidate();
3521 m_colon->match(text, file_scheme->interval.end, end,
flags) &&
3522 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3523 m_slash->match(text, m_slash->interval.end, end,
flags))
3527 http_scheme->invalidate();
3528 ftp_scheme->invalidate();
3529 mailto_scheme->invalidate();
3533 http_scheme->invalidate();
3534 ftp_scheme->invalidate();
3535 mailto_scheme->invalidate();
3536 file_scheme->invalidate();
3539 if (ftp_scheme->interval) {
3541 if (m_colon->match(text, username->interval.end, end,
flags) &&
3542 password->match(text, m_colon->interval.end, end,
flags) &&
3543 m_at->match(text, password->interval.end, end,
flags))
3551 password->invalidate();
3554 username->invalidate();
3555 password->invalidate();
3559 username->invalidate();
3560 password->invalidate();
3566 ipv6_host->invalidate();
3567 dns_host->invalidate();
3571 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3572 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3576 ipv4_host->invalidate();
3577 dns_host->invalidate();
3582 ipv4_host->invalidate();
3583 ipv6_host->invalidate();
3591 port->match(text, m_colon->interval.end, end,
flags))
3608 if (mailto_scheme->interval) {
3610 m_at->match(text, username->interval.end, end,
flags))
3621 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3622 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3626 ipv6_host->invalidate();
3627 dns_host->invalidate();
3631 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3632 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3636 ipv4_host->invalidate();
3637 dns_host->invalidate();
3642 ipv4_host->invalidate();
3643 ipv6_host->invalidate();
3650 password->invalidate();
3657 if (file_scheme->interval) {
3663 username->invalidate();
3664 password->invalidate();
3665 ipv4_host->invalidate();
3666 ipv6_host->invalidate();
3667 dns_host->invalidate();
3676 if (http_scheme->interval &&
3679 if (m_colon->match(text, username->interval.end, end,
flags) &&
3680 password->match(text, m_colon->interval.end, end,
flags) &&
3681 m_at->match(text, password->interval.end, end,
flags))
3686 else if (m_at->match(text, username->interval.end, end,
flags)) {
3689 password->invalidate();
3692 username->invalidate();
3693 password->invalidate();
3697 username->invalidate();
3698 password->invalidate();
3704 ipv6_host->invalidate();
3705 dns_host->invalidate();
3709 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3710 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3714 ipv4_host->invalidate();
3715 dns_host->invalidate();
3720 ipv4_host->invalidate();
3721 ipv6_host->invalidate();
3729 port->match(text, m_colon->interval.end, end,
flags))
3746 virtual void invalidate()
3748 http_scheme->invalidate();
3749 ftp_scheme->invalidate();
3750 mailto_scheme->invalidate();
3751 file_scheme->invalidate();
3752 username->invalidate();
3753 password->invalidate();
3754 ipv4_host->invalidate();
3755 ipv6_host->invalidate();
3756 dns_host->invalidate();
3763 std::shared_ptr<basic_parser<T>> http_scheme;
3764 std::shared_ptr<basic_parser<T>> ftp_scheme;
3765 std::shared_ptr<basic_parser<T>> mailto_scheme;
3766 std::shared_ptr<basic_parser<T>> file_scheme;
3767 std::shared_ptr<basic_parser<T>> username;
3768 std::shared_ptr<basic_parser<T>> password;
3769 std::shared_ptr<basic_parser<T>> ipv4_host;
3770 std::shared_ptr<basic_parser<T>> ipv6_host;
3771 std::shared_ptr<basic_parser<T>> dns_host;
3772 std::shared_ptr<basic_parser<T>> port;
3773 std::shared_ptr<basic_parser<T>> path;
3776 std::shared_ptr<basic_parser<T>> m_colon;
3777 std::shared_ptr<basic_parser<T>> m_slash;
3778 std::shared_ptr<basic_parser<T>> m_at;
3779 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3780 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3807 _In_ const std::locale& locale = std::locale()) :
3819 _In_reads_or_z_(end)
const T* text,
3820 _In_ size_t start = 0,
3824 _Assume_(text || start >= end);
3826 if (username->match(text, start, end,
flags) &&
3827 m_at->match(text, username->interval.end, end,
flags))
3830 if (m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3831 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3832 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3836 ipv6_host->invalidate();
3837 dns_host->invalidate();
3840 m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3841 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3842 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3846 ipv4_host->invalidate();
3847 dns_host->invalidate();
3849 else if (dns_host->match(text, m_at->interval.end, end,
flags)) {
3852 ipv4_host->invalidate();
3853 ipv6_host->invalidate();
3862 username->invalidate();
3863 ipv4_host->invalidate();
3864 ipv6_host->invalidate();
3865 dns_host->invalidate();
3870 virtual void invalidate()
3872 username->invalidate();
3873 ipv4_host->invalidate();
3874 ipv6_host->invalidate();
3875 dns_host->invalidate();
3880 std::shared_ptr<basic_parser<T>> username;
3881 std::shared_ptr<basic_parser<T>> ipv4_host;
3882 std::shared_ptr<basic_parser<T>> ipv6_host;
3883 std::shared_ptr<basic_parser<T>> dns_host;
3886 std::shared_ptr<basic_parser<T>> m_at;
3887 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3888 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3913 _In_ const std::locale& locale = std::locale()) :
3923 _In_reads_or_z_(end)
const T* text,
3924 _In_ size_t start = 0,
3928 _Assume_(text || start >= end);
3934 mouth->invalidate();
3951 hit_offset =
mouth->hit_offset;
3962 hit_offset =
mouth->hit_offset;
3977 mouth->invalidate();
3982 virtual void invalidate()
3988 mouth->invalidate();
3994 std::shared_ptr<basic_parser<T>>
apex;
3995 std::shared_ptr<basic_parser<T>>
eyes;
3996 std::shared_ptr<basic_parser<T>>
nose;
4012 enum date_format_t {
4013 date_format_none = 0,
4014 date_format_dmy = 0x1,
4015 date_format_mdy = 0x2,
4016 date_format_ymd = 0x4,
4017 date_format_ym = 0x8,
4018 date_format_my = 0x10,
4019 date_format_dm = 0x20,
4020 date_format_md = 0x40,
4037 _In_ const std::locale& locale = std::locale()) :
4039 format(date_format_none),
4044 m_separator(separator),
4049 _In_reads_or_z_(end)
const T* text,
4050 _In_ size_t start = 0,
4054 _Assume_(text || start >= end);
4057 if ((m_format_mask & date_format_dmy) == date_format_dmy) {
4058 if (day->match(text, start, end,
flags)) {
4061 size_t hit_offset = m_separator->hit_offset;
4066 m_separator->hit_offset == hit_offset)
4070 is_valid(day->value, month->value))
4074 format = date_format_dmy;
4083 if ((m_format_mask & date_format_mdy) == date_format_mdy) {
4084 if (month->match(text, start, end,
flags)) {
4087 size_t hit_offset = m_separator->hit_offset;
4092 m_separator->hit_offset == hit_offset)
4096 is_valid(day->value, month->value))
4100 format = date_format_mdy;
4109 if ((m_format_mask & date_format_ymd) == date_format_ymd) {
4110 if (year->match(text, start, end,
flags)) {
4113 size_t hit_offset = m_separator->hit_offset;
4118 m_separator->hit_offset == hit_offset)
4122 is_valid(day->value, month->value))
4126 format = date_format_ymd;
4135 if ((m_format_mask & date_format_ym) == date_format_ym) {
4136 if (year->match(text, start, end,
flags)) {
4143 if (day) day->invalidate();
4146 format = date_format_ym;
4153 if ((m_format_mask & date_format_my) == date_format_my) {
4154 if (month->match(text, start, end,
flags)) {
4161 if (day) day->invalidate();
4164 format = date_format_my;
4171 if ((m_format_mask & date_format_dm) == date_format_dm) {
4172 if (day->match(text, start, end,
flags)) {
4175 size_t hit_offset = m_separator->hit_offset;
4178 is_valid(day->value, month->value))
4180 if (year) year->invalidate();
4184 m_separator->hit_offset == hit_offset)
4188 format = date_format_dm;
4195 if ((m_format_mask & date_format_md) == date_format_md) {
4196 if (month->match(text, start, end,
flags)) {
4199 size_t hit_offset = m_separator->hit_offset;
4202 is_valid(day->value, month->value))
4204 if (year) year->invalidate();
4208 m_separator->hit_offset == hit_offset)
4212 format = date_format_md;
4219 if (day) day->invalidate();
4220 if (month) month->invalidate();
4221 if (year) year->invalidate();
4222 format = date_format_none;
4227 virtual void invalidate()
4229 if (day) day->invalidate();
4230 if (month) month->invalidate();
4231 if (year) year->invalidate();
4232 format = date_format_none;
4237 static inline bool is_valid(
size_t day,
size_t month)
4256 return 1 <= day && day <= 31;
4258 return 1 <= day && day <= 29;
4263 return 1 <= day && day <= 30;
4270 date_format_t format;
4271 std::shared_ptr<basic_integer<T>> day;
4272 std::shared_ptr<basic_integer<T>> month;
4273 std::shared_ptr<basic_integer<T>> year;
4277 std::shared_ptr<basic_set<T>> m_separator;
4278 std::shared_ptr<basic_parser<T>> m_space;
4304 _In_ const std::locale& locale = std::locale()) :
4310 m_separator(separator),
4315 _In_reads_or_z_(end)
const T* text,
4316 _In_ size_t start = 0,
4320 _Assume_(text || start >= end);
4322 if (hour->match(text, start, end,
flags) &&
4323 m_separator->match(text, hour->interval.end, end,
flags) &&
4324 minute->match(text, m_separator->interval.end, end,
flags) &&
4328 size_t hit_offset = m_separator->hit_offset;
4329 if (m_separator->match(text, minute->interval.end, end,
flags) &&
4330 m_separator->hit_offset == hit_offset &&
4331 second && second->match(text, m_separator->interval.end, end,
flags) &&
4335 if (m_millisecond_separator && m_millisecond_separator->match(text, second->interval.end, end,
flags) &&
4336 millisecond && millisecond->match(text, m_millisecond_separator->interval.end, end,
flags) &&
4337 millisecond->value < 1000)
4343 if (millisecond) millisecond->invalidate();
4348 if (second) second->invalidate();
4349 if (millisecond) millisecond->invalidate();
4357 minute->invalidate();
4358 if (second) second->invalidate();
4359 if (millisecond) millisecond->invalidate();
4364 virtual void invalidate()
4367 minute->invalidate();
4368 if (second) second->invalidate();
4369 if (millisecond) millisecond->invalidate();
4374 std::shared_ptr<basic_integer10<T>> hour;
4375 std::shared_ptr<basic_integer10<T>> minute;
4376 std::shared_ptr<basic_integer10<T>> second;
4377 std::shared_ptr<basic_integer10<T>> millisecond;
4380 std::shared_ptr<basic_set<T>> m_separator;
4381 std::shared_ptr<basic_parser<T>> m_millisecond_separator;
4408 _In_ const std::locale& locale = std::locale()) :
4420 _In_reads_or_z_(end)
const T* text,
4421 _In_ size_t start = 0,
4425 _Assume_(text || start >= end);
4430 degree_separator->match(text, degree->interval.end, end,
flags))
4433 this->
interval.
end = degree_separator->interval.end;
4436 degree->invalidate();
4437 degree_separator->invalidate();
4441 minute->value < 60 &&
4442 minute_separator->match(text, minute->interval.end, end,
flags))
4445 this->
interval.
end = minute_separator->interval.end;
4448 minute->invalidate();
4449 minute_separator->invalidate();
4458 this->
interval.
end = second_separator->interval.end;
4460 if (second_separator) second_separator->invalidate();
4463 if (second) second->invalidate();
4464 if (second_separator) second_separator->invalidate();
4467 if (degree->interval.start < degree->interval.end ||
4468 minute->interval.start < minute->interval.end ||
4469 (second && second->interval.start < second->interval.end))
4476 decimal->invalidate();
4480 if (decimal) decimal->invalidate();
4485 virtual void invalidate()
4487 degree->invalidate();
4488 degree_separator->invalidate();
4489 minute->invalidate();
4490 minute_separator->invalidate();
4491 if (second) second->invalidate();
4492 if (second_separator) second_separator->invalidate();
4493 if (decimal) decimal->invalidate();
4498 std::shared_ptr<basic_integer10<T>> degree;
4499 std::shared_ptr<basic_parser<T>> degree_separator;
4500 std::shared_ptr<basic_integer10<T>> minute;
4501 std::shared_ptr<basic_parser<T>> minute_separator;
4502 std::shared_ptr<basic_integer10<T>> second;
4503 std::shared_ptr<basic_parser<T>> second_separator;
4504 std::shared_ptr<basic_parser<T>> decimal;
4530 _In_ const std::locale& locale = std::locale()) :
4536 m_separator(separator),
4541 _In_reads_or_z_(end)
const T* text,
4542 _In_ size_t start = 0,
4546 _Assume_(text || start >= end);
4554 m_lparenthesis->invalidate();
4555 m_rparenthesis->invalidate();
4558 value.append(text + m_plus_sign->interval.start, text + m_plus_sign->interval.end);
4569 value.append(text + m_digit->interval.start, text + m_digit->interval.end);
4580 m_lparenthesis && !m_lparenthesis->interval &&
4581 m_rparenthesis && !m_rparenthesis->interval &&
4585 value.append(text + m_lparenthesis->interval.start, m_lparenthesis->interval.size());
4586 this->
interval.
end = m_lparenthesis->interval.end;
4593 m_rparenthesis && !m_rparenthesis->interval &&
4595 m_lparenthesis->hit_offset == m_rparenthesis->hit_offset)
4598 value.append(text + m_rparenthesis->interval.start, text + m_rparenthesis->interval.end);
4599 this->
interval.
end = m_rparenthesis->interval.end;
4640 virtual void invalidate()
4650 std::shared_ptr<basic_parser<T>> m_digit;
4651 std::shared_ptr<basic_parser<T>> m_plus_sign;
4652 std::shared_ptr<basic_set<T>> m_lparenthesis;
4653 std::shared_ptr<basic_set<T>> m_rparenthesis;
4654 std::shared_ptr<basic_parser<T>> m_separator;
4655 std::shared_ptr<basic_parser<T>> m_space;
4678 _In_ const std::locale& locale = std::locale()) :
4689 _In_reads_or_z_(end)
const T* text,
4690 _In_ size_t start = 0,
4694 _Assume_(text || start >= end);
4695 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4703 { {
'A',
'D' }, {}, 24 },
4704 { {
'A',
'E' }, {}, 23 },
4705 { {
'A',
'L' }, {}, 28 },
4706 { {
'A',
'O' }, {}, 25 },
4707 { {
'A',
'T' }, {}, 20 },
4708 { {
'A',
'Z' }, {}, 28 },
4709 { {
'B',
'A' }, {
'3',
'9' }, 20},
4710 { {
'B',
'E' }, {}, 16 },
4711 { {
'B',
'F' }, {}, 28 },
4712 { {
'B',
'G' }, {}, 22 },
4713 { {
'B',
'H' }, {}, 22 },
4714 { {
'B',
'I' }, {}, 27 },
4715 { {
'B',
'J' }, {}, 28 },
4716 { {
'B',
'R' }, {}, 29 },
4717 { {
'B',
'Y' }, {}, 28 },
4718 { {
'C',
'F' }, {}, 27 },
4719 { {
'C',
'G' }, {}, 27 },
4720 { {
'C',
'H' }, {}, 21 },
4721 { {
'C',
'I' }, {}, 28 },
4722 { {
'C',
'M' }, {}, 27 },
4723 { {
'C',
'R' }, {}, 22 },
4724 { {
'C',
'V' }, {}, 25 },
4725 { {
'C',
'Y' }, {}, 28 },
4726 { {
'C',
'Z' }, {}, 24 },
4727 { {
'D',
'E' }, {}, 22 },
4728 { {
'D',
'J' }, {}, 27 },
4729 { {
'D',
'K' }, {}, 18 },
4730 { {
'D',
'O' }, {}, 28 },
4731 { {
'D',
'Z' }, {}, 26 },
4732 { {
'E',
'E' }, {}, 20 },
4733 { {
'E',
'G' }, {}, 29 },
4734 { {
'E',
'S' }, {}, 24 },
4735 { {
'F',
'I' }, {}, 18 },
4736 { {
'F',
'O' }, {}, 18 },
4737 { {
'F',
'R' }, {}, 27 },
4738 { {
'G',
'A' }, {}, 27 },
4739 { {
'G',
'B' }, {}, 22 },
4740 { {
'G',
'E' }, {}, 22 },
4741 { {
'G',
'I' }, {}, 23 },
4742 { {
'G',
'L' }, {}, 18 },
4743 { {
'G',
'Q' }, {}, 27 },
4744 { {
'G',
'R' }, {}, 27 },
4745 { {
'G',
'T' }, {}, 28 },
4746 { {
'G',
'W' }, {}, 25 },
4747 { {
'H',
'N' }, {}, 28 },
4748 { {
'H',
'R' }, {}, 21 },
4749 { {
'H',
'U' }, {}, 28 },
4750 { {
'I',
'E' }, {}, 22 },
4751 { {
'I',
'L' }, {}, 23 },
4752 { {
'I',
'Q' }, {}, 23 },
4753 { {
'I',
'R' }, {}, 26 },
4754 { {
'I',
'S' }, {}, 26 },
4755 { {
'I',
'T' }, {}, 27 },
4756 { {
'J',
'O' }, {}, 30 },
4757 { {
'K',
'M' }, {}, 27 },
4758 { {
'K',
'W' }, {}, 30 },
4759 { {
'K',
'Z' }, {}, 20 },
4760 { {
'L',
'B' }, {}, 28 },
4761 { {
'L',
'C' }, {}, 32 },
4762 { {
'L',
'I' }, {}, 21 },
4763 { {
'L',
'T' }, {}, 20 },
4764 { {
'L',
'U' }, {}, 20 },
4765 { {
'L',
'V' }, {}, 21 },
4766 { {
'L',
'Y' }, {}, 25 },
4767 { {
'M',
'A' }, {}, 28 },
4768 { {
'M',
'C' }, {}, 27 },
4769 { {
'M',
'D' }, {}, 24 },
4770 { {
'M',
'E' }, {
'2',
'5' }, 22 },
4771 { {
'M',
'G' }, {}, 27 },
4772 { {
'M',
'K' }, {
'0',
'7' }, 19 },
4773 { {
'M',
'L' }, {}, 28 },
4774 { {
'M',
'R' }, {
'1',
'3' }, 27},
4775 { {
'M',
'T' }, {}, 31 },
4776 { {
'M',
'U' }, {}, 30 },
4777 { {
'M',
'Z' }, {}, 25 },
4778 { {
'N',
'E' }, {}, 28 },
4779 { {
'N',
'I' }, {}, 32 },
4780 { {
'N',
'L' }, {}, 18 },
4781 { {
'N',
'O' }, {}, 15 },
4782 { {
'P',
'K' }, {}, 24 },
4783 { {
'P',
'L' }, {}, 28 },
4784 { {
'P',
'S' }, {}, 29 },
4785 { {
'P',
'T' }, {
'5',
'0' }, 25 },
4786 { {
'Q',
'A' }, {}, 29 },
4787 { {
'R',
'O' }, {}, 24 },
4788 { {
'R',
'S' }, {
'3',
'5' }, 22 },
4789 { {
'R',
'U' }, {}, 33 },
4790 { {
'S',
'A' }, {}, 24 },
4791 { {
'S',
'C' }, {}, 31 },
4792 { {
'S',
'D' }, {}, 18 },
4793 { {
'S',
'E' }, {}, 24 },
4794 { {
'S',
'I' }, {
'5',
'6' }, 19 },
4795 { {
'S',
'K' }, {}, 24 },
4796 { {
'S',
'M' }, {}, 27 },
4797 { {
'S',
'N' }, {}, 28 },
4798 { {
'S',
'T' }, {}, 25 },
4799 { {
'S',
'V' }, {}, 28 },
4800 { {
'T',
'D' }, {}, 27 },
4801 { {
'T',
'G' }, {}, 28 },
4802 { {
'T',
'L' }, {
'3',
'8' }, 23},
4803 { {
'T',
'N' }, {
'5',
'9' }, 24 },
4804 { {
'T',
'R' }, {}, 26 },
4805 { {
'U',
'A' }, {}, 29 },
4806 { {
'V',
'A' }, {}, 22 },
4807 { {
'V',
'G' }, {}, 24 },
4808 { {
'X',
'K' }, {}, 20 },
4815 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
4819 if (
chr <
'A' ||
'Z' <
chr)
4826 size_t m = (
l +
r) / 2;
4828 if (
c.country[0] <
this->country[0] || (
c.country[0] ==
this->country[0] &&
c.country[1] <
this->country[1]))
4830 else if (this->
country[0] < c.country[0] || (
this->country[0] ==
c.country[0] &&
this->country[1] <
c.country[1]))
4839 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
4846 if ((country_desc->check_digits[0] &&
this->check_digits[0] !=
country_desc->check_digits[0]) ||
4859 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
4871 for (
size_t i = 0; ; ++i) {
4872 if (!this->
bban[i]) {
4873 for (i = 0; i < 2; ++i) {
4892 if (
'0' <= this->
bban[i] && this->
bban[i] <=
'9')
4894 else if (
'A' <= this->
bban[i] && this->
bban[i] <=
'J') {
4898 else if (
'K' <= this->
bban[i] && this->
bban[i] <=
'T') {
4902 else if (
'U' <= this->
bban[i] && this->
bban[i] <=
'Z') {
4917 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
4933 virtual void invalidate()
4949 std::shared_ptr<basic_parser<T>> m_space;
4972 _In_ const std::locale& locale = std::locale()) :
4982 _In_reads_or_z_(end)
const T* text,
4983 _In_ size_t start = 0,
4987 _Assume_(text || start >= end);
4988 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
5000 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
5010 for (
size_t j = 0;
j < 4; ++
j) {
5014 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
5028 for (
size_t i =
n,
j = _countof(this->
reference) - 1; i;)
5030 for (
size_t j = _countof(this->
reference) - 1 - n;
j;)
5036 for (
size_t i = 0; ; ++i) {
5072 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
5087 virtual void invalidate()
5101 std::shared_ptr<basic_parser<T>> m_space;
5125 _In_reads_or_z_(end)
const T* text,
5126 _In_ size_t start = 0,
5130 _Assume_(text || start >= end);
5170 _In_reads_or_z_(end)
const T* text,
5171 _In_ size_t start = 0,
5175 _Assume_(text || start >= end);
5176 if (start < end && text[start] ==
'-') {
5207 _In_ const std::locale& locale = std::locale()) :
5220 _In_reads_or_z_(end)
const T* text,
5221 _In_ size_t start = 0,
5225 _Assume_(text || start >= end);
5226 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
5236 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
5243 this->
part1.invalidate();
5244 this->
part2.invalidate();
5245 this->
part3.invalidate();
5246 if (this->
model[0] ==
'9' && this->
model[1] ==
'9') {
5271 if (this->
model[0] ==
'0' && this->
model[1] ==
'0')
5282 else if (this->
model[0] ==
'0' && this->
model[1] ==
'1')
5301 else if (this->
model[0] ==
'0' && this->
model[1] ==
'2')
5309 else if (this->
model[0] ==
'0' && this->
model[1] ==
'3')
5318 else if (this->
model[0] ==
'0' && this->
model[1] ==
'4')
5326 else if ((this->
model[0] ==
'0' || this->
model[0] ==
'5') && this->
model[1] ==
'5')
5340 else if (this->
model[0] ==
'0' && this->
model[1] ==
'6')
5353 else if (this->
model[0] ==
'0' && this->
model[1] ==
'7')
5364 else if (this->
model[0] ==
'0' && this->
model[1] ==
'8')
5374 else if (this->
model[0] ==
'0' && this->
model[1] ==
'9')
5392 else if (this->
model[0] ==
'1' && this->
model[1] ==
'0')
5408 (this->
model[0] ==
'1' && (this->
model[1] ==
'1' || this->
model[1] ==
'8' || this->
model[1] ==
'9')) ||
5409 ((this->
model[0] ==
'2' || this->
model[0] ==
'3') && this->
model[1] ==
'8') ||
5410 (this->
model[0] ==
'4' && (this->
model[1] ==
'0' || this->
model[1] ==
'1' || this->
model[1] ==
'8' || this->
model[1] ==
'9')) ||
5411 (this->
model[0] ==
'5' && (this->
model[1] ==
'1' || this->
model[1] ==
'8')))
5424 else if (this->
model[0] ==
'1' && this->
model[1] ==
'2')
5432 else if ((this->
model[0] ==
'2' || this->
model[0] ==
'3') && this->
model[1] ==
'1')
5454 virtual void invalidate()
5457 this->
part1.invalidate();
5458 this->
part2.invalidate();
5459 this->
part3.invalidate();
5465 static bool check11(
5478 static bool check11(
5495 static bool check11(
5524 std::shared_ptr<basic_parser<T>> m_space;
5548 _In_ const std::locale& locale = std::locale()) :
5558 _In_reads_or_z_(end)
const T* text,
5559 _In_ size_t start = 0,
5563 _Assume_(text || start >= end);
5593 virtual void invalidate()
5605 std::shared_ptr<basic_parser<T>> m_element;
5606 std::shared_ptr<basic_parser<T>> m_digit;
5607 std::shared_ptr<basic_parser<T>> m_sign;
5626 _In_reads_or_z_(end)
const char* text,
5627 _In_ size_t start = 0,
5631 _Assume_(text || start >= end);
5662 _In_reads_or_z_(end)
const char* text,
5663 _In_ size_t start = 0,
5667 _Assume_(text || start >= end);
5699 _In_reads_or_z_(end)
const char* text,
5700 _In_ size_t start = 0,
5704 _Assume_(text || start >= end);
5733 _In_reads_or_z_(end)
const char* text,
5734 _In_ size_t start = 0,
5738 _Assume_(text || start >= end);
5742 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
5787 _In_reads_or_z_(end)
const char* text,
5788 _In_ size_t start = 0,
5792 _Assume_(text || start >= end);
5832 virtual void invalidate()
5836 parser::invalidate();
5853 _In_reads_or_z_(end)
const char* text,
5854 _In_ size_t start = 0,
5858 _Assume_(text || start >= end);
5867 string.invalidate();
5878 virtual void invalidate()
5880 string.invalidate();
5882 parser::invalidate();
5897 _In_reads_or_z_(end)
const char* text,
5898 _In_ size_t start = 0,
5902 _Assume_(text || start >= end);
5930 virtual void invalidate()
5934 parser::invalidate();
5952 _In_reads_or_z_(end)
const char* text,
5953 _In_ size_t start = 0,
5957 _Assume_(text || start >= end);
5958 if (start + 2 < end &&
5959 text[start] ==
'*' &&
5960 text[start + 1] ==
'/' &&
5961 text[start + 2] ==
'*')
5966 else if (start < end && text[start] ==
'*') {
5984 _In_reads_or_z_(end)
const char* text,
5985 _In_ size_t start = 0,
5989 _Assume_(text || start >= end);
6012 subtype.invalidate();
6017 virtual void invalidate()
6020 subtype.invalidate();
6021 parser::invalidate();
6039 _In_reads_or_z_(end)
const char* text,
6040 _In_ size_t start = 0,
6044 _Assume_(text || start >= end);
6045 if (!http_media_range::match(text, start, end,
flags))
6059 params.push_back(std::move(param));
6074 http_media_range::invalidate();
6080 virtual void invalidate()
6083 http_media_range::invalidate();
6087 std::list<http_parameter> params;
6097 _In_reads_or_z_(end)
const char* text,
6098 _In_ size_t start = 0,
6102 _Assume_(text || start >= end);
6106 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6139 _In_reads_or_z_(end)
const char* text,
6140 _In_ size_t start = 0,
6144 _Assume_(text || start >= end);
6173 virtual void invalidate()
6176 parser::invalidate();
6190 _In_reads_or_z_(end)
const char* text,
6191 _In_ size_t start = 0,
6195 _Assume_(text || start >= end);
6199 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6223 _In_reads_or_z_(end)
const char* text,
6224 _In_ size_t start = 0,
6228 _Assume_(text || start >= end);
6262 virtual void invalidate()
6265 parser::invalidate();
6279 _In_reads_or_z_(end)
const char* text,
6280 _In_ size_t start = 0,
6284 _Assume_(text || start >= end);
6289 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6310 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6339 virtual void invalidate()
6345 parser::invalidate();
6359 http_url(
_In_ const std::locale& locale = std::locale()) :
6365 _In_reads_or_z_(end)
const char* text,
6366 _In_ size_t start = 0,
6370 _Assume_(text || start >= end);
6390 server.invalidate();
6406 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6416 params.push_back(std::move(param));
6431 server.invalidate();
6439 virtual void invalidate()
6441 server.invalidate();
6445 parser::invalidate();
6452 std::list<http_url_parameter> params;
6462 _In_reads_or_z_(end)
const char* text,
6463 _In_ size_t start = 0,
6467 _Assume_(text || start >= end);
6475 if (
k.end < end && text[
k.end]) {
6487 components.push_back(
k);
6499 if (!components.empty()) {
6508 virtual void invalidate()
6511 parser::invalidate();
6515 std::vector<stdex::interval<size_t>> components;
6530 _In_reads_or_z_(end)
const char* text,
6531 _In_ size_t start = 0,
6535 _Assume_(text || start >= end);
6577 virtual void invalidate()
6580 parser::invalidate();
6594 _In_reads_or_z_(end)
const char* text,
6595 _In_ size_t start = 0,
6599 _Assume_(text || end <= start);
6600 if (start < end && text[start] ==
'*') {
6612 template <
class T,
class T_asterisk = http_asterisk>
6622 _In_reads_or_z_(end)
const char* text,
6623 _In_ size_t start = 0,
6627 _Assume_(text || start >= end);
6636 asterisk.invalidate();
6639 asterisk.invalidate();
6661 factor.invalidate();
6668 virtual void invalidate()
6670 asterisk.invalidate();
6672 factor.invalidate();
6673 parser::invalidate();
6689 _In_reads_or_z_(end)
const char* text,
6690 _In_ size_t start = 0,
6694 _Assume_(text || start >= end);
6726 virtual void invalidate()
6730 parser::invalidate();
6748 _In_reads_or_z_(end)
const char* text,
6749 _In_ size_t start = 0,
6753 _Assume_(text || start >= end);
6783 params.push_back(std::move(param));
6806 virtual void invalidate()
6811 parser::invalidate();
6830 _In_reads_or_z_(end)
const char* text,
6831 _In_ size_t start = 0,
6835 _Assume_(text || start >= end);
6884 virtual void invalidate()
6890 parser::invalidate();
6910 _In_reads_or_z_(end)
const char* text,
6911 _In_ size_t start = 0,
6915 _Assume_(text || start >= end);
6947 (
uint16_t)strtoui(text + version_maj.
start, version_maj.
size(),
nullptr, 10) * 0x100 +
6961 version_min.
start = 1;
6962 version_min.
end = 0;
6978 version_maj.
start = 1;
6979 version_maj.
end = 0;
6980 version_min.
start = 1;
6981 version_min.
end = 0;
6987 virtual void invalidate()
6991 version_maj.
start = 1;
6992 version_maj.
end = 0;
6993 version_min.
start = 1;
6994 version_min.
end = 0;
6996 parser::invalidate();
7019 _In_reads_or_z_(end)
const char* text,
7020 _In_ size_t start = 0,
7024 _Assume_(text || start >= end);
7073 protocol.invalidate();
7120 protocol.invalidate();
7125 virtual void invalidate()
7130 protocol.invalidate();
7131 parser::invalidate();
7150 _In_reads_or_z_(end)
const char* text,
7151 _In_ size_t start = 0,
7155 _Assume_(text || start >= end);
7234 virtual void invalidate()
7240 parser::invalidate();
7254 template <
class _Key,
class T>
7259 _In_reads_or_z_(end)
const char* text,
7260 _In_ size_t start = 0,
7264 while (start < end) {
7265 while (start < end && text[start] &&
isspace(text[start])) start++;
7266 if (start < end && text[start] ==
',') {
7268 while (start < end&& text[start] &&
isspace(text[start])) start++;
7271 if (
el.match(text, start, end,
flags)) {
7273 T::insert(std::move(
el));
7283 constexpr bool operator()(
const T& a,
const T& b)
const noexcept
7285 return a.factor.value > b.factor.value;
7292 template <
class T,
class _Alloc = std::allocator<T>>
7314 _In_ const std::locale& locale = std::locale()) :
7330 _In_reads_or_z_(end)
const T* text,
7331 _In_ size_t start = 0,
7335 _Assume_(text || start >= end);
7347 if (m_quote->match(text, m_escape->interval.end, end,
flags)) {
7348 value +=
'"'; this->
interval.
end = m_quote->interval.end;
7351 if (m_sol->match(text, m_escape->interval.end, end,
flags)) {
7352 value +=
'/'; this->
interval.
end = m_sol->interval.end;
7355 if (m_bs->match(text, m_escape->interval.end, end,
flags)) {
7356 value +=
'\b'; this->
interval.
end = m_bs->interval.end;
7359 if (m_ff->match(text, m_escape->interval.end, end,
flags)) {
7360 value +=
'\f'; this->
interval.
end = m_ff->interval.end;
7363 if (m_lf->match(text, m_escape->interval.end, end,
flags)) {
7364 value +=
'\n'; this->
interval.
end = m_lf->interval.end;
7367 if (m_cr->match(text, m_escape->interval.end, end,
flags)) {
7368 value +=
'\r'; this->
interval.
end = m_cr->interval.end;
7371 if (m_htab->match(text, m_escape->interval.end, end,
flags)) {
7372 value +=
'\t'; this->
interval.
end = m_htab->interval.end;
7376 m_uni->match(text, m_escape->interval.end, end,
flags) &&
7377 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end),
flags | match_case_insensitive) &&
7378 m_hex->interval.size() == 4 )
7380 _Assume_(m_hex->value <= 0xffff);
7381 if (
sizeof(T) == 1) {
7382 if (m_hex->value > 0x7ff) {
7383 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
7384 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
7385 value += (T)(0x80 | (m_hex->value & 0x3f));
7387 else if (m_hex->value > 0x7f) {
7388 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
7389 value += (T)(0x80 | (m_hex->value & 0x3f));
7392 value += (T)(m_hex->value & 0x7f);
7395 value += (T)m_hex->value;
7399 if (m_escape->match(text, m_escape->interval.end, end,
flags)) {
7400 value +=
'\\'; this->
interval.
end = m_escape->interval.end;
7405 value.append(text + m_chr->interval.start, m_chr->interval.size());
7417 virtual void invalidate()
7424 std::basic_string<T> value;
7427 std::shared_ptr<basic_parser<T>> m_quote;
7428 std::shared_ptr<basic_parser<T>> m_chr;
7429 std::shared_ptr<basic_parser<T>> m_escape;
7430 std::shared_ptr<basic_parser<T>> m_sol;
7431 std::shared_ptr<basic_parser<T>> m_bs;
7432 std::shared_ptr<basic_parser<T>> m_ff;
7433 std::shared_ptr<basic_parser<T>> m_lf;
7434 std::shared_ptr<basic_parser<T>> m_cr;
7435 std::shared_ptr<basic_parser<T>> m_htab;
7436 std::shared_ptr<basic_parser<T>> m_uni;
7437 std::shared_ptr<basic_integer16<T>> m_hex;
7456 _In_reads_or_z_opt_(end)
const T* text,
7457 _In_ size_t start = 0,
7461 _Unreferenced_(
flags);
7462 _Assume_(text || start + 1 >= end);
7463 if (start + 1 < end &&
7464 text[start] ==
'/' &&
7465 text[start + 1] ==
'*')
7490 virtual void invalidate()
7493 basic_parser::invalidate();
7516 _In_reads_or_z_opt_(end)
const T* text,
7517 _In_ size_t start = 0,
7521 _Unreferenced_(
flags);
7522 _Assume_(text || start + 3 >= end);
7523 if (start + 3 < end &&
7524 text[start] ==
'<' &&
7525 text[start + 1] ==
'!' &&
7526 text[start + 2] ==
'-' &&
7527 text[start + 3] ==
'-')
7554 _In_reads_or_z_opt_(end)
const T* text,
7555 _In_ size_t start = 0,
7559 _Unreferenced_(
flags);
7560 _Assume_(text || start + 2 >= end);
7561 if (start + 2 < end &&
7562 text[start] ==
'-' &&
7563 text[start + 1] ==
'-' &&
7564 text[start + 2] ==
'>')
7591 _In_reads_or_z_opt_(end)
const T* text,
7592 _In_ size_t start = 0,
7596 _Unreferenced_(
flags);
7632 virtual void invalidate()
7635 basic_parser::invalidate();
7658 _In_reads_or_z_opt_(end)
const T* text,
7659 _In_ size_t start = 0,
7663 _Unreferenced_(
flags);
7676 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7743 virtual void invalidate()
7746 basic_parser::invalidate();
7769 _In_reads_or_z_opt_(end)
const T* text,
7770 _In_ size_t start = 0,
7774 _Unreferenced_(
flags);
7790 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7828 virtual void invalidate()
7831 basic_parser::invalidate();
7854 _In_reads_or_z_opt_(end)
const T* text,
7855 _In_ size_t start = 0,
7859 _Unreferenced_(
flags);
7860 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7960 virtual void invalidate()
7965 basic_parser::invalidate();
7990 _In_reads_or_z_opt_(end)
const T* text,
7991 _In_ size_t start = 0,
7995 _Unreferenced_(
flags);
7996 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8037 _In_reads_or_z_opt_(end)
const T* text,
8038 _In_ size_t start = 0,
8042 _Unreferenced_(
flags);
8071 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8091 virtual void invalidate()
8094 basic_parser::invalidate();
8112 enum class html_sequence_t {
8143 type(html_sequence_t::unknown)
8147 _In_reads_or_z_opt_(end)
const T* text,
8148 _In_ size_t start = 0,
8152 _Assume_(text || start >= end);
8153 if (start >= end || text[start] !=
'<')
8162 this->
type = html_sequence_t::element_end;
8184 this->
type = html_sequence_t::comment;
8194 this->
type = html_sequence_t::declaration;
8205 this->
type = html_sequence_t::instruction;
8217 this->
type = html_sequence_t::instruction;
8229 this->
type = html_sequence_t::element_start;
8237 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8242 if (this->
type == html_sequence_t::element_start &&
8248 this->
type = html_sequence_t::element;
8259 if (this->
type == html_sequence_t::declaration &&
8268 if (this->
type == html_sequence_t::declaration &&
8322 a->value = this->m_value.content;
8331 a->value.invalidate();
8339 this->
type = html_sequence_t::unknown;
8346 virtual void invalidate()
8348 this->
type = html_sequence_t::unknown;
8351 basic_parser::invalidate();
8380 _In_reads_or_z_opt_(end)
const T* text,
8381 _In_ size_t start = 0,
8385 _Unreferenced_(
flags);
8386 _Assume_(text || start + 2 >= end);
8387 if (start + 2 < end &&
8388 text[start] ==
'<' &&
8389 text[start + 1] ==
'!' &&
8390 text[start + 2] ==
'[')
8395 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8420 virtual void invalidate()
8423 basic_parser::invalidate();
8446 _In_reads_or_z_opt_(end)
const T* text,
8447 _In_ size_t start = 0,
8451 _Unreferenced_(
flags);
8452 _Assume_(text || start + 2 >= end);
8453 if (start + 2 < end &&
8454 text[start] ==
']' &&
8455 text[start + 1] ==
']' &&
8456 text[start + 2] ==
'>')
8477#undef ENUM_FLAG_OPERATOR
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4398
Test for any code unit.
Definition parser.hpp:224
Test for beginning of line.
Definition parser.hpp:618
Test for any.
Definition parser.hpp:1060
Test for Creditor Reference.
Definition parser.hpp:4968
T reference[22]
Normalized national reference number.
Definition parser.hpp:5097
T check_digits[3]
Two check digits.
Definition parser.hpp:5096
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:5098
Legacy CSS comment end -->
Definition parser.hpp:7551
Legacy CSS comment start <!--
Definition parser.hpp:7513
CSS import directive.
Definition parser.hpp:7766
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7835
CSS string.
Definition parser.hpp:7588
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7639
URI in CSS.
Definition parser.hpp:7655
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7750
Test for any code unit from a given string of code units.
Definition parser.hpp:723
Test for specific code unit.
Definition parser.hpp:294
Test for date.
Definition parser.hpp:4028
Test for valid DNS domain character.
Definition parser.hpp:2809
bool allow_on_edge
Is character allowed at the beginning or an end of a DNS domain?
Definition parser.hpp:2847
Test for DNS domain/hostname.
Definition parser.hpp:2909
bool m_allow_absolute
May DNS names end with a dot (absolute name)?
Definition parser.hpp:2973
Test for e-mail address.
Definition parser.hpp:3797
Test for emoticon.
Definition parser.hpp:3905
std::shared_ptr< basic_parser< T > > apex
apex/eyebrows/halo (e.g. O, 0)
Definition parser.hpp:3994
std::shared_ptr< basic_parser< T > > eyes
eyes (e.g. :, ;, >, |, B)
Definition parser.hpp:3995
std::shared_ptr< basic_set< T > > mouth
mouth (e.g. ), ), (, (, |, P, D, p, d)
Definition parser.hpp:3997
std::shared_ptr< basic_parser< T > > nose
nose (e.g. -, o)
Definition parser.hpp:3996
std::shared_ptr< basic_parser< T > > emoticon
emoticon as a whole (e.g. 😀, 🤔, 😶)
Definition parser.hpp:3993
Test for end of line.
Definition parser.hpp:656
Test for fraction.
Definition parser.hpp:1689
End of condition ...]]>
Definition parser.hpp:8443
Start of condition <![condition[...
Definition parser.hpp:8377
Contiguous sequence of characters representing name of element, attribute etc.
Definition parser.hpp:7987
Tag.
Definition parser.hpp:8139
std::vector< html_attribute > attributes
tag attributes
Definition parser.hpp:8357
html_sequence_t type
tag type
Definition parser.hpp:8355
stdex::interval< size_t > name
tag name position in source
Definition parser.hpp:8356
Optionally-quoted string representing value of an attribute.
Definition parser.hpp:8034
stdex::interval< size_t > content
content position in source
Definition parser.hpp:8098
Test for International Bank Account Number.
Definition parser.hpp:4674
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4945
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4943
T check_digits[3]
Two check digits.
Definition parser.hpp:4944
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4946
Test for decimal integer.
Definition parser.hpp:1298
Test for decimal integer possibly containing thousand separators.
Definition parser.hpp:1383
bool has_separators
Did integer have any separators?
Definition parser.hpp:1443
size_t digit_count
Total number of digits in integer.
Definition parser.hpp:1442
Test for hexadecimal integer.
Definition parser.hpp:1464
Base class for integer testing.
Definition parser.hpp:1276
size_t value
Calculated value of the numeral.
Definition parser.hpp:1290
Test for IPv4 address.
Definition parser.hpp:2349
stdex::interval< size_t > components[4]
Individual component intervals.
Definition parser.hpp:2464
struct in_addr value
IPv4 address value.
Definition parser.hpp:2465
Test for IPv6 address.
Definition parser.hpp:2568
std::shared_ptr< basic_parser< T > > scope_id
Scope ID (e.g. NIC index with link-local addresses)
Definition parser.hpp:2772
stdex::interval< size_t > components[8]
Individual component intervals.
Definition parser.hpp:2770
struct in6_addr value
IPv6 address value.
Definition parser.hpp:2771
Test for valid IPv6 address scope ID character.
Definition parser.hpp:2496
Test for repeating.
Definition parser.hpp:913
bool m_greedy
try to match as long sequence as possible
Definition parser.hpp:952
std::shared_ptr< basic_parser< T > > m_el
repeating element
Definition parser.hpp:949
size_t m_min_iterations
minimum number of iterations
Definition parser.hpp:950
size_t m_max_iterations
maximum number of iterations
Definition parser.hpp:951
Test for JSON string.
Definition parser.hpp:7300
MIME content type.
Definition parser.hpp:7851
stdex::interval< size_t > base_type
basic type position in source
Definition parser.hpp:7969
stdex::interval< size_t > sub_type
sub-type position in source
Definition parser.hpp:7970
stdex::interval< size_t > charset
charset position in source
Definition parser.hpp:7971
Test for mixed numeral.
Definition parser.hpp:1925
std::shared_ptr< basic_parser< T > > fraction
fraction
Definition parser.hpp:2031
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2029
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2028
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2027
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2030
Test for monetary numeral.
Definition parser.hpp:2220
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2326
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2331
std::shared_ptr< basic_parser< T > > currency
Currency part.
Definition parser.hpp:2329
std::shared_ptr< basic_parser< T > > decimal
Decimal part.
Definition parser.hpp:2332
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2330
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2327
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2328
"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:1200
Test for phone number.
Definition parser.hpp:4521
std::basic_string< T > value
Normalized phone number.
Definition parser.hpp:4647
Test for any punctuation code unit.
Definition parser.hpp:466
Test for Roman numeral.
Definition parser.hpp:1573
Test for scientific numeral.
Definition parser.hpp:2051
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2195
std::shared_ptr< basic_parser< T > > exponent_symbol
Exponent symbol (e.g. 'e')
Definition parser.hpp:2199
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2193
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2194
double value
Calculated value of the numeral.
Definition parser.hpp:2203
std::shared_ptr< basic_parser< T > > negative_exp_sign
Negative exponent sign (e.g. '-')
Definition parser.hpp:2201
std::shared_ptr< basic_integer< T > > decimal
Decimal part.
Definition parser.hpp:2198
std::shared_ptr< basic_parser< T > > positive_exp_sign
Positive exponent sign (e.g. '+')
Definition parser.hpp:2200
std::shared_ptr< basic_integer< T > > exponent
Exponent part.
Definition parser.hpp:2202
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2197
std::shared_ptr< basic_integer< T > > integer
Integer part.
Definition parser.hpp:2196
Test for match score.
Definition parser.hpp:1752
Test for sequence.
Definition parser.hpp:1009
Definition parser.hpp:691
Test for SI Reference delimiter.
Definition parser.hpp:5165
Test for SI Reference part.
Definition parser.hpp:5120
Test for SI Reference.
Definition parser.hpp:5203
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5520
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5518
bool is_valid
Is reference valid.
Definition parser.hpp:5521
T model[3]
Reference model.
Definition parser.hpp:5517
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5519
Test for signed numeral.
Definition parser.hpp:1839
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1907
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1906
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1905
std::shared_ptr< basic_parser< T > > number
Number.
Definition parser.hpp:1908
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:1128
Test for given string.
Definition parser.hpp:818
Test for time.
Definition parser.hpp:4295
Test for valid URL password character.
Definition parser.hpp:3091
Test for valid URL path character.
Definition parser.hpp:3191
Test for URL path.
Definition parser.hpp:3299
Test for valid URL username character.
Definition parser.hpp:2992
Test for URL.
Definition parser.hpp:3440
Test for HTTP agent.
Definition parser.hpp:6827
Test for HTTP any type.
Definition parser.hpp:5949
Test for HTTP asterisk.
Definition parser.hpp:6591
Test for HTTP cookie parameter (RFC2109)
Definition parser.hpp:6686
Test for HTTP cookie (RFC2109)
Definition parser.hpp:6745
std::list< http_cookie_parameter > params
List of cookie parameters.
Definition parser.hpp:6817
http_token name
Cookie name.
Definition parser.hpp:6815
http_value value
Cookie value.
Definition parser.hpp:6816
Test for HTTP language (RFC1766)
Definition parser.hpp:6459
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5623
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5894
http_token name
Parameter name.
Definition parser.hpp:5938
http_value value
Parameter value.
Definition parser.hpp:5939
Test for HTTP protocol.
Definition parser.hpp:6902
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:7003
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5784
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5840
Test for HTTP request.
Definition parser.hpp:7010
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5659
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5696
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5730
Test for HTTP URL parameter.
Definition parser.hpp:6276
Test for HTTP URL path segment.
Definition parser.hpp:6187
Test for HTTP URL path segment.
Definition parser.hpp:6220
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6269
Test for HTTP URL port.
Definition parser.hpp:6131
Test for HTTP URL server.
Definition parser.hpp:6094
Test for HTTP URL.
Definition parser.hpp:6357
Collection of HTTP values.
Definition parser.hpp:7256
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5850
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5886
http_token token
Value when matched as token.
Definition parser.hpp:5887
Test for HTTP weight factor.
Definition parser.hpp:6522
float value
Calculated value of the weight factor.
Definition parser.hpp:6584
Test for HTTP weighted value.
Definition parser.hpp:6614
Base template for collection-holding parsers.
Definition parser.hpp:969
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:775
Test for specific SGML code point.
Definition parser.hpp:343
Test for valid DNS domain SGML character.
Definition parser.hpp:2865
Test for valid IPv6 address scope ID SGML character.
Definition parser.hpp:2534
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:865
Test for valid URL password SGML character.
Definition parser.hpp:3143
Test for valid URL path SGML character.
Definition parser.hpp:3247
Test for valid URL username SGML character.
Definition parser.hpp:3043
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:8129
stdex::interval< size_t > name
attribute name position in source
Definition parser.hpp:8130
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8131
Definition parser.hpp:7282