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) || !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_(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) || !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_(end)
const T* text,
624 _In_ size_t start = 0,
628 _Assume_(text || start >= end);
629 bool r = start == 0 || (start <= end && stdex::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 = start >= end || !text[start] || stdex::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++) {
2677 if (
x_n <= 0xffff) {
2700 this->
value.s6_words[--j] = this->
value.s6_words[--k];
2704 this->
value.s6_words[--j] = 0;
2712 if (m_scope_id_separator && m_scope_id_separator->match(text,
this->
interval.
end, end,
flags) &&
2744 virtual void invalidate()
2773 std::shared_ptr<basic_parser<T>>
2790 std::shared_ptr<basic_parser<T>> m_separator, m_scope_id_separator;
2811 _In_ const std::locale& locale = std::locale()) :
2818 _In_reads_or_z_(end)
const T* text,
2819 _In_ size_t start = 0,
2823 _Assume_(text || start >= end);
2824 if (start < end && text[start]) {
2825 if ((
'A' <= text[start] && text[start] <=
'Z') ||
2826 (
'a' <= text[start] && text[start] <=
'z') ||
2827 (
'0' <= text[start] && text[start] <=
'9'))
2829 else if (text[start] ==
'-')
2831 else if (m_allow_idn && std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2867 _In_ const std::locale& locale = std::locale()) :
2872 _In_reads_or_z_(end)
const char* text,
2873 _In_ size_t start = 0,
2877 _Assume_(text || start >= end);
2878 if (start < end && text[start]) {
2882 if (((
'A' <=
chr[0] &&
chr[0] <=
'Z') ||
2883 (
'a' <=
chr[0] &&
chr[0] <=
'z') ||
2884 (
'0' <=
chr[0] &&
chr[0] <=
'9')) &&
chr[1] == 0)
2886 else if (
chr[0] ==
'-' &&
chr[1] == 0)
2888 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)
2913 _In_ const std::locale& locale = std::locale()) :
2917 m_separator(separator)
2921 _In_reads_or_z_(end)
const T* text,
2922 _In_ size_t start = 0,
2926 _Assume_(text || start >= end);
2927 size_t i = start,
count;
2929 if (m_domain_char->match(text, i, end,
flags) &&
2930 m_domain_char->allow_on_edge)
2933 this->
interval.
end = i = m_domain_char->interval.end;
2934 while (i < end && text[i]) {
2935 if (m_domain_char->allow_on_edge &&
2936 m_separator->match(text, i, end,
flags))
2940 this->
interval.
end = i = m_separator->interval.end;
2943 i = m_separator->interval.end;
2947 if (m_domain_char->match(text, i, end,
flags)) {
2948 if (m_domain_char->allow_on_edge)
2949 this->
interval.
end = i = m_domain_char->interval.end;
2951 i = m_domain_char->interval.end;
2972 std::shared_ptr<basic_dns_domain_char<T>> m_domain_char;
2973 std::shared_ptr<basic_parser<T>> m_separator;
2995 _In_reads_or_z_(end)
const T* text,
2996 _In_ size_t start = 0,
3000 _Assume_(text || start >= end);
3001 if (start < end && text[start]) {
3002 if (text[start] ==
'-' ||
3003 text[start] ==
'.' ||
3004 text[start] ==
'_' ||
3005 text[start] ==
'~' ||
3006 text[start] ==
'%' ||
3007 text[start] ==
'!' ||
3008 text[start] ==
'$' ||
3009 text[start] ==
'&' ||
3010 text[start] ==
'\'' ||
3013 text[start] ==
'*' ||
3014 text[start] ==
'+' ||
3015 text[start] ==
',' ||
3016 text[start] ==
';' ||
3017 text[start] ==
'=' ||
3018 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3046 _In_reads_or_z_(end)
const char* text,
3047 _In_ size_t start = 0,
3051 _Assume_(text || start >= end);
3052 if (start < end && text[start]) {
3056 if (((
chr[0] ==
L'-' ||
3071 chr[0] ==
L'=') &&
chr[1] == 0) ||
3094 _In_reads_or_z_(end)
const T* text,
3095 _In_ size_t start = 0,
3099 _Assume_(text || start >= end);
3100 if (start < end && text[start]) {
3101 if (text[start] ==
'-' ||
3102 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 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3146 _In_reads_or_z_(end)
const char* text,
3147 _In_ size_t start = 0,
3151 _Assume_(text || start >= end);
3152 if (start < end && text[start]) {
3156 if (((
chr[0] ==
L'-' ||
3172 chr[0] ==
L':') &&
chr[1] == 0) ||
3194 _In_reads_or_z_(end)
const T* text,
3195 _In_ size_t start = 0,
3199 _Assume_(text || start >= end);
3200 if (start < end && text[start]) {
3201 if (text[start] ==
'/' ||
3202 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 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3250 _In_reads_or_z_(end)
const char* text,
3251 _In_ size_t start = 0,
3255 _Assume_(text || start >= end);
3256 if (start < end && text[start]) {
3260 if (((
chr[0] ==
L'/' ||
3280 chr[0] ==
L'#') &&
chr[1] == 0) ||
3303 _In_ const std::locale& locale = std::locale()) :
3311 _In_reads_or_z_(end)
const T* text,
3312 _In_ size_t start = 0,
3316 _Assume_(text || start >= end);
3402 virtual void invalidate()
3419 std::shared_ptr<basic_parser<T>> m_path_char;
3420 std::shared_ptr<basic_parser<T>> m_query_start;
3421 std::shared_ptr<basic_parser<T>> m_bookmark_start;
3457 _In_ const std::locale& locale = std::locale()) :
3478 _In_reads_or_z_(end)
const T* text,
3479 _In_ size_t start = 0,
3483 _Assume_(text || start >= end);
3488 m_colon->match(text, http_scheme->interval.end, end,
flags) &&
3489 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3490 m_slash->match(text, m_slash->interval.end, end,
flags))
3494 ftp_scheme->invalidate();
3495 mailto_scheme->invalidate();
3496 file_scheme->invalidate();
3499 m_colon->match(text, ftp_scheme->interval.end, end,
flags) &&
3500 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3501 m_slash->match(text, m_slash->interval.end, end,
flags))
3505 http_scheme->invalidate();
3506 mailto_scheme->invalidate();
3507 file_scheme->invalidate();
3510 m_colon->match(text, mailto_scheme->interval.end, end,
flags))
3514 http_scheme->invalidate();
3515 ftp_scheme->invalidate();
3516 file_scheme->invalidate();
3519 m_colon->match(text, file_scheme->interval.end, end,
flags) &&
3520 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3521 m_slash->match(text, m_slash->interval.end, end,
flags))
3525 http_scheme->invalidate();
3526 ftp_scheme->invalidate();
3527 mailto_scheme->invalidate();
3531 http_scheme->invalidate();
3532 ftp_scheme->invalidate();
3533 mailto_scheme->invalidate();
3534 file_scheme->invalidate();
3537 if (ftp_scheme->interval) {
3539 if (m_colon->match(text, username->interval.end, end,
flags) &&
3540 password->match(text, m_colon->interval.end, end,
flags) &&
3541 m_at->match(text, password->interval.end, end,
flags))
3549 password->invalidate();
3552 username->invalidate();
3553 password->invalidate();
3557 username->invalidate();
3558 password->invalidate();
3564 ipv6_host->invalidate();
3565 dns_host->invalidate();
3569 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3570 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3574 ipv4_host->invalidate();
3575 dns_host->invalidate();
3580 ipv4_host->invalidate();
3581 ipv6_host->invalidate();
3589 port->match(text, m_colon->interval.end, end,
flags))
3606 if (mailto_scheme->interval) {
3608 m_at->match(text, username->interval.end, end,
flags))
3619 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3620 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3624 ipv6_host->invalidate();
3625 dns_host->invalidate();
3629 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3630 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3634 ipv4_host->invalidate();
3635 dns_host->invalidate();
3640 ipv4_host->invalidate();
3641 ipv6_host->invalidate();
3648 password->invalidate();
3655 if (file_scheme->interval) {
3661 username->invalidate();
3662 password->invalidate();
3663 ipv4_host->invalidate();
3664 ipv6_host->invalidate();
3665 dns_host->invalidate();
3674 if (http_scheme->interval &&
3677 if (m_colon->match(text, username->interval.end, end,
flags) &&
3678 password->match(text, m_colon->interval.end, end,
flags) &&
3679 m_at->match(text, password->interval.end, end,
flags))
3684 else if (m_at->match(text, username->interval.end, end,
flags)) {
3687 password->invalidate();
3690 username->invalidate();
3691 password->invalidate();
3695 username->invalidate();
3696 password->invalidate();
3702 ipv6_host->invalidate();
3703 dns_host->invalidate();
3707 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3708 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3712 ipv4_host->invalidate();
3713 dns_host->invalidate();
3718 ipv4_host->invalidate();
3719 ipv6_host->invalidate();
3727 port->match(text, m_colon->interval.end, end,
flags))
3744 virtual void invalidate()
3746 http_scheme->invalidate();
3747 ftp_scheme->invalidate();
3748 mailto_scheme->invalidate();
3749 file_scheme->invalidate();
3750 username->invalidate();
3751 password->invalidate();
3752 ipv4_host->invalidate();
3753 ipv6_host->invalidate();
3754 dns_host->invalidate();
3761 std::shared_ptr<basic_parser<T>> http_scheme;
3762 std::shared_ptr<basic_parser<T>> ftp_scheme;
3763 std::shared_ptr<basic_parser<T>> mailto_scheme;
3764 std::shared_ptr<basic_parser<T>> file_scheme;
3765 std::shared_ptr<basic_parser<T>> username;
3766 std::shared_ptr<basic_parser<T>> password;
3767 std::shared_ptr<basic_parser<T>> ipv4_host;
3768 std::shared_ptr<basic_parser<T>> ipv6_host;
3769 std::shared_ptr<basic_parser<T>> dns_host;
3770 std::shared_ptr<basic_parser<T>> port;
3771 std::shared_ptr<basic_parser<T>> path;
3774 std::shared_ptr<basic_parser<T>> m_colon;
3775 std::shared_ptr<basic_parser<T>> m_slash;
3776 std::shared_ptr<basic_parser<T>> m_at;
3777 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3778 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3805 _In_ const std::locale& locale = std::locale()) :
3817 _In_reads_or_z_(end)
const T* text,
3818 _In_ size_t start = 0,
3822 _Assume_(text || start >= end);
3824 if (username->match(text, start, end,
flags) &&
3825 m_at->match(text, username->interval.end, end,
flags))
3828 if (m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3829 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3830 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3834 ipv6_host->invalidate();
3835 dns_host->invalidate();
3838 m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3839 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3840 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3844 ipv4_host->invalidate();
3845 dns_host->invalidate();
3847 else if (dns_host->match(text, m_at->interval.end, end,
flags)) {
3850 ipv4_host->invalidate();
3851 ipv6_host->invalidate();
3860 username->invalidate();
3861 ipv4_host->invalidate();
3862 ipv6_host->invalidate();
3863 dns_host->invalidate();
3868 virtual void invalidate()
3870 username->invalidate();
3871 ipv4_host->invalidate();
3872 ipv6_host->invalidate();
3873 dns_host->invalidate();
3878 std::shared_ptr<basic_parser<T>> username;
3879 std::shared_ptr<basic_parser<T>> ipv4_host;
3880 std::shared_ptr<basic_parser<T>> ipv6_host;
3881 std::shared_ptr<basic_parser<T>> dns_host;
3884 std::shared_ptr<basic_parser<T>> m_at;
3885 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3886 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3911 _In_ const std::locale& locale = std::locale()) :
3921 _In_reads_or_z_(end)
const T* text,
3922 _In_ size_t start = 0,
3926 _Assume_(text || start >= end);
3932 mouth->invalidate();
3949 hit_offset =
mouth->hit_offset;
3960 hit_offset =
mouth->hit_offset;
3975 mouth->invalidate();
3980 virtual void invalidate()
3986 mouth->invalidate();
3992 std::shared_ptr<basic_parser<T>>
apex;
3993 std::shared_ptr<basic_parser<T>>
eyes;
3994 std::shared_ptr<basic_parser<T>>
nose;
4010 enum date_format_t {
4011 date_format_none = 0,
4012 date_format_dmy = 0x1,
4013 date_format_mdy = 0x2,
4014 date_format_ymd = 0x4,
4015 date_format_ym = 0x8,
4016 date_format_my = 0x10,
4017 date_format_dm = 0x20,
4018 date_format_md = 0x40,
4035 _In_ const std::locale& locale = std::locale()) :
4037 format(date_format_none),
4042 m_separator(separator),
4047 _In_reads_or_z_(end)
const T* text,
4048 _In_ size_t start = 0,
4052 _Assume_(text || start >= end);
4055 if ((m_format_mask & date_format_dmy) == date_format_dmy) {
4056 if (day->match(text, start, end,
flags)) {
4059 size_t hit_offset = m_separator->hit_offset;
4064 m_separator->hit_offset == hit_offset)
4068 is_valid(day->value, month->value))
4072 format = date_format_dmy;
4081 if ((m_format_mask & date_format_mdy) == date_format_mdy) {
4082 if (month->match(text, start, end,
flags)) {
4085 size_t hit_offset = m_separator->hit_offset;
4090 m_separator->hit_offset == hit_offset)
4094 is_valid(day->value, month->value))
4098 format = date_format_mdy;
4107 if ((m_format_mask & date_format_ymd) == date_format_ymd) {
4108 if (year->match(text, start, end,
flags)) {
4111 size_t hit_offset = m_separator->hit_offset;
4116 m_separator->hit_offset == hit_offset)
4120 is_valid(day->value, month->value))
4124 format = date_format_ymd;
4133 if ((m_format_mask & date_format_ym) == date_format_ym) {
4134 if (year->match(text, start, end,
flags)) {
4141 if (day) day->invalidate();
4144 format = date_format_ym;
4151 if ((m_format_mask & date_format_my) == date_format_my) {
4152 if (month->match(text, start, end,
flags)) {
4159 if (day) day->invalidate();
4162 format = date_format_my;
4169 if ((m_format_mask & date_format_dm) == date_format_dm) {
4170 if (day->match(text, start, end,
flags)) {
4173 size_t hit_offset = m_separator->hit_offset;
4176 is_valid(day->value, month->value))
4178 if (year) year->invalidate();
4182 m_separator->hit_offset == hit_offset)
4186 format = date_format_dm;
4193 if ((m_format_mask & date_format_md) == date_format_md) {
4194 if (month->match(text, start, end,
flags)) {
4197 size_t hit_offset = m_separator->hit_offset;
4200 is_valid(day->value, month->value))
4202 if (year) year->invalidate();
4206 m_separator->hit_offset == hit_offset)
4210 format = date_format_md;
4217 if (day) day->invalidate();
4218 if (month) month->invalidate();
4219 if (year) year->invalidate();
4220 format = date_format_none;
4225 virtual void invalidate()
4227 if (day) day->invalidate();
4228 if (month) month->invalidate();
4229 if (year) year->invalidate();
4230 format = date_format_none;
4235 static inline bool is_valid(
size_t day,
size_t month)
4254 return 1 <= day && day <= 31;
4256 return 1 <= day && day <= 29;
4261 return 1 <= day && day <= 30;
4268 date_format_t format;
4269 std::shared_ptr<basic_integer<T>> day;
4270 std::shared_ptr<basic_integer<T>> month;
4271 std::shared_ptr<basic_integer<T>> year;
4275 std::shared_ptr<basic_set<T>> m_separator;
4276 std::shared_ptr<basic_parser<T>> m_space;
4302 _In_ const std::locale& locale = std::locale()) :
4308 m_separator(separator),
4313 _In_reads_or_z_(end)
const T* text,
4314 _In_ size_t start = 0,
4318 _Assume_(text || start >= end);
4320 if (hour->match(text, start, end,
flags) &&
4321 m_separator->match(text, hour->interval.end, end,
flags) &&
4322 minute->match(text, m_separator->interval.end, end,
flags) &&
4326 size_t hit_offset = m_separator->hit_offset;
4327 if (m_separator->match(text, minute->interval.end, end,
flags) &&
4328 m_separator->hit_offset == hit_offset &&
4329 second && second->match(text, m_separator->interval.end, end,
flags) &&
4333 if (m_millisecond_separator && m_millisecond_separator->match(text, second->interval.end, end,
flags) &&
4334 millisecond && millisecond->match(text, m_millisecond_separator->interval.end, end,
flags) &&
4335 millisecond->value < 1000)
4341 if (millisecond) millisecond->invalidate();
4346 if (second) second->invalidate();
4347 if (millisecond) millisecond->invalidate();
4355 minute->invalidate();
4356 if (second) second->invalidate();
4357 if (millisecond) millisecond->invalidate();
4362 virtual void invalidate()
4365 minute->invalidate();
4366 if (second) second->invalidate();
4367 if (millisecond) millisecond->invalidate();
4372 std::shared_ptr<basic_integer10<T>> hour;
4373 std::shared_ptr<basic_integer10<T>> minute;
4374 std::shared_ptr<basic_integer10<T>> second;
4375 std::shared_ptr<basic_integer10<T>> millisecond;
4378 std::shared_ptr<basic_set<T>> m_separator;
4379 std::shared_ptr<basic_parser<T>> m_millisecond_separator;
4406 _In_ const std::locale& locale = std::locale()) :
4418 _In_reads_or_z_(end)
const T* text,
4419 _In_ size_t start = 0,
4423 _Assume_(text || start >= end);
4428 degree_separator->match(text, degree->interval.end, end,
flags))
4431 this->
interval.
end = degree_separator->interval.end;
4434 degree->invalidate();
4435 degree_separator->invalidate();
4439 minute->value < 60 &&
4440 minute_separator->match(text, minute->interval.end, end,
flags))
4443 this->
interval.
end = minute_separator->interval.end;
4446 minute->invalidate();
4447 minute_separator->invalidate();
4456 this->
interval.
end = second_separator->interval.end;
4458 if (second_separator) second_separator->invalidate();
4461 if (second) second->invalidate();
4462 if (second_separator) second_separator->invalidate();
4465 if (degree->interval.start < degree->interval.end ||
4466 minute->interval.start < minute->interval.end ||
4467 (second && second->interval.start < second->interval.end))
4474 decimal->invalidate();
4478 if (decimal) decimal->invalidate();
4483 virtual void invalidate()
4485 degree->invalidate();
4486 degree_separator->invalidate();
4487 minute->invalidate();
4488 minute_separator->invalidate();
4489 if (second) second->invalidate();
4490 if (second_separator) second_separator->invalidate();
4491 if (decimal) decimal->invalidate();
4496 std::shared_ptr<basic_integer10<T>> degree;
4497 std::shared_ptr<basic_parser<T>> degree_separator;
4498 std::shared_ptr<basic_integer10<T>> minute;
4499 std::shared_ptr<basic_parser<T>> minute_separator;
4500 std::shared_ptr<basic_integer10<T>> second;
4501 std::shared_ptr<basic_parser<T>> second_separator;
4502 std::shared_ptr<basic_parser<T>> decimal;
4528 _In_ const std::locale& locale = std::locale()) :
4534 m_separator(separator),
4539 _In_reads_or_z_(end)
const T* text,
4540 _In_ size_t start = 0,
4544 _Assume_(text || start >= end);
4552 m_lparenthesis->invalidate();
4553 m_rparenthesis->invalidate();
4556 value.append(text + m_plus_sign->interval.start, text + m_plus_sign->interval.end);
4567 value.append(text + m_digit->interval.start, text + m_digit->interval.end);
4578 m_lparenthesis && !m_lparenthesis->interval &&
4579 m_rparenthesis && !m_rparenthesis->interval &&
4583 value.append(text + m_lparenthesis->interval.start, m_lparenthesis->interval.size());
4584 this->
interval.
end = m_lparenthesis->interval.end;
4591 m_rparenthesis && !m_rparenthesis->interval &&
4593 m_lparenthesis->hit_offset == m_rparenthesis->hit_offset)
4596 value.append(text + m_rparenthesis->interval.start, text + m_rparenthesis->interval.end);
4597 this->
interval.
end = m_rparenthesis->interval.end;
4638 virtual void invalidate()
4648 std::shared_ptr<basic_parser<T>> m_digit;
4649 std::shared_ptr<basic_parser<T>> m_plus_sign;
4650 std::shared_ptr<basic_set<T>> m_lparenthesis;
4651 std::shared_ptr<basic_set<T>> m_rparenthesis;
4652 std::shared_ptr<basic_parser<T>> m_separator;
4653 std::shared_ptr<basic_parser<T>> m_space;
4676 _In_ const std::locale& locale = std::locale()) :
4687 _In_reads_or_z_(end)
const T* text,
4688 _In_ size_t start = 0,
4692 _Assume_(text || start >= end);
4693 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4701 { {
'A',
'D' }, {}, 24 },
4702 { {
'A',
'E' }, {}, 23 },
4703 { {
'A',
'L' }, {}, 28 },
4704 { {
'A',
'O' }, {}, 25 },
4705 { {
'A',
'T' }, {}, 20 },
4706 { {
'A',
'Z' }, {}, 28 },
4707 { {
'B',
'A' }, {
'3',
'9' }, 20},
4708 { {
'B',
'E' }, {}, 16 },
4709 { {
'B',
'F' }, {}, 28 },
4710 { {
'B',
'G' }, {}, 22 },
4711 { {
'B',
'H' }, {}, 22 },
4712 { {
'B',
'I' }, {}, 27 },
4713 { {
'B',
'J' }, {}, 28 },
4714 { {
'B',
'R' }, {}, 29 },
4715 { {
'B',
'Y' }, {}, 28 },
4716 { {
'C',
'F' }, {}, 27 },
4717 { {
'C',
'G' }, {}, 27 },
4718 { {
'C',
'H' }, {}, 21 },
4719 { {
'C',
'I' }, {}, 28 },
4720 { {
'C',
'M' }, {}, 27 },
4721 { {
'C',
'R' }, {}, 22 },
4722 { {
'C',
'V' }, {}, 25 },
4723 { {
'C',
'Y' }, {}, 28 },
4724 { {
'C',
'Z' }, {}, 24 },
4725 { {
'D',
'E' }, {}, 22 },
4726 { {
'D',
'J' }, {}, 27 },
4727 { {
'D',
'K' }, {}, 18 },
4728 { {
'D',
'O' }, {}, 28 },
4729 { {
'D',
'Z' }, {}, 26 },
4730 { {
'E',
'E' }, {}, 20 },
4731 { {
'E',
'G' }, {}, 29 },
4732 { {
'E',
'S' }, {}, 24 },
4733 { {
'F',
'I' }, {}, 18 },
4734 { {
'F',
'O' }, {}, 18 },
4735 { {
'F',
'R' }, {}, 27 },
4736 { {
'G',
'A' }, {}, 27 },
4737 { {
'G',
'B' }, {}, 22 },
4738 { {
'G',
'E' }, {}, 22 },
4739 { {
'G',
'I' }, {}, 23 },
4740 { {
'G',
'L' }, {}, 18 },
4741 { {
'G',
'Q' }, {}, 27 },
4742 { {
'G',
'R' }, {}, 27 },
4743 { {
'G',
'T' }, {}, 28 },
4744 { {
'G',
'W' }, {}, 25 },
4745 { {
'H',
'N' }, {}, 28 },
4746 { {
'H',
'R' }, {}, 21 },
4747 { {
'H',
'U' }, {}, 28 },
4748 { {
'I',
'E' }, {}, 22 },
4749 { {
'I',
'L' }, {}, 23 },
4750 { {
'I',
'Q' }, {}, 23 },
4751 { {
'I',
'R' }, {}, 26 },
4752 { {
'I',
'S' }, {}, 26 },
4753 { {
'I',
'T' }, {}, 27 },
4754 { {
'J',
'O' }, {}, 30 },
4755 { {
'K',
'M' }, {}, 27 },
4756 { {
'K',
'W' }, {}, 30 },
4757 { {
'K',
'Z' }, {}, 20 },
4758 { {
'L',
'B' }, {}, 28 },
4759 { {
'L',
'C' }, {}, 32 },
4760 { {
'L',
'I' }, {}, 21 },
4761 { {
'L',
'T' }, {}, 20 },
4762 { {
'L',
'U' }, {}, 20 },
4763 { {
'L',
'V' }, {}, 21 },
4764 { {
'L',
'Y' }, {}, 25 },
4765 { {
'M',
'A' }, {}, 28 },
4766 { {
'M',
'C' }, {}, 27 },
4767 { {
'M',
'D' }, {}, 24 },
4768 { {
'M',
'E' }, {
'2',
'5' }, 22 },
4769 { {
'M',
'G' }, {}, 27 },
4770 { {
'M',
'K' }, {
'0',
'7' }, 19 },
4771 { {
'M',
'L' }, {}, 28 },
4772 { {
'M',
'R' }, {
'1',
'3' }, 27},
4773 { {
'M',
'T' }, {}, 31 },
4774 { {
'M',
'U' }, {}, 30 },
4775 { {
'M',
'Z' }, {}, 25 },
4776 { {
'N',
'E' }, {}, 28 },
4777 { {
'N',
'I' }, {}, 32 },
4778 { {
'N',
'L' }, {}, 18 },
4779 { {
'N',
'O' }, {}, 15 },
4780 { {
'P',
'K' }, {}, 24 },
4781 { {
'P',
'L' }, {}, 28 },
4782 { {
'P',
'S' }, {}, 29 },
4783 { {
'P',
'T' }, {
'5',
'0' }, 25 },
4784 { {
'Q',
'A' }, {}, 29 },
4785 { {
'R',
'O' }, {}, 24 },
4786 { {
'R',
'S' }, {
'3',
'5' }, 22 },
4787 { {
'R',
'U' }, {}, 33 },
4788 { {
'S',
'A' }, {}, 24 },
4789 { {
'S',
'C' }, {}, 31 },
4790 { {
'S',
'D' }, {}, 18 },
4791 { {
'S',
'E' }, {}, 24 },
4792 { {
'S',
'I' }, {
'5',
'6' }, 19 },
4793 { {
'S',
'K' }, {}, 24 },
4794 { {
'S',
'M' }, {}, 27 },
4795 { {
'S',
'N' }, {}, 28 },
4796 { {
'S',
'T' }, {}, 25 },
4797 { {
'S',
'V' }, {}, 28 },
4798 { {
'T',
'D' }, {}, 27 },
4799 { {
'T',
'G' }, {}, 28 },
4800 { {
'T',
'L' }, {
'3',
'8' }, 23},
4801 { {
'T',
'N' }, {
'5',
'9' }, 24 },
4802 { {
'T',
'R' }, {}, 26 },
4803 { {
'U',
'A' }, {}, 29 },
4804 { {
'V',
'A' }, {}, 22 },
4805 { {
'V',
'G' }, {}, 24 },
4806 { {
'X',
'K' }, {}, 20 },
4813 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
4817 if (
chr <
'A' ||
'Z' <
chr)
4824 size_t m = (
l +
r) / 2;
4826 if (
c.country[0] <
this->country[0] || (
c.country[0] ==
this->country[0] &&
c.country[1] <
this->country[1]))
4828 else if (this->
country[0] < c.country[0] || (
this->country[0] ==
c.country[0] &&
this->country[1] <
c.country[1]))
4837 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
4844 if ((country_desc->check_digits[0] &&
this->check_digits[0] !=
country_desc->check_digits[0]) ||
4857 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
4869 for (
size_t i = 0; ; ++i) {
4870 if (!this->
bban[i]) {
4871 for (i = 0; i < 2; ++i) {
4890 if (
'0' <= this->
bban[i] && this->
bban[i] <=
'9')
4892 else if (
'A' <= this->
bban[i] && this->
bban[i] <=
'J') {
4896 else if (
'K' <= this->
bban[i] && this->
bban[i] <=
'T') {
4900 else if (
'U' <= this->
bban[i] && this->
bban[i] <=
'Z') {
4915 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
4931 virtual void invalidate()
4947 std::shared_ptr<basic_parser<T>> m_space;
4970 _In_ const std::locale& locale = std::locale()) :
4980 _In_reads_or_z_(end)
const T* text,
4981 _In_ size_t start = 0,
4985 _Assume_(text || start >= end);
4986 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4998 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
5008 for (
size_t j = 0;
j < 4; ++
j) {
5012 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
5026 for (
size_t i =
n,
j = _countof(this->
reference) - 1; i;)
5028 for (
size_t j = _countof(this->
reference) - 1 - n;
j;)
5034 for (
size_t i = 0; ; ++i) {
5070 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
5085 virtual void invalidate()
5099 std::shared_ptr<basic_parser<T>> m_space;
5123 _In_reads_or_z_(end)
const T* text,
5124 _In_ size_t start = 0,
5128 _Assume_(text || start >= end);
5168 _In_reads_or_z_(end)
const T* text,
5169 _In_ size_t start = 0,
5173 _Assume_(text || start >= end);
5174 if (start < end && text[start] ==
'-') {
5205 _In_ const std::locale& locale = std::locale()) :
5218 _In_reads_or_z_(end)
const T* text,
5219 _In_ size_t start = 0,
5223 _Assume_(text || start >= end);
5224 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
5234 for (
size_t i = 0; i < 2; ++i, ++this->
interval.
end) {
5241 this->
part1.invalidate();
5242 this->
part2.invalidate();
5243 this->
part3.invalidate();
5244 if (this->
model[0] ==
'9' && this->
model[1] ==
'9') {
5269 if (this->
model[0] ==
'0' && this->
model[1] ==
'0')
5280 else if (this->
model[0] ==
'0' && this->
model[1] ==
'1')
5299 else if (this->
model[0] ==
'0' && this->
model[1] ==
'2')
5307 else if (this->
model[0] ==
'0' && this->
model[1] ==
'3')
5316 else if (this->
model[0] ==
'0' && this->
model[1] ==
'4')
5324 else if ((this->
model[0] ==
'0' || this->
model[0] ==
'5') && this->
model[1] ==
'5')
5338 else if (this->
model[0] ==
'0' && this->
model[1] ==
'6')
5351 else if (this->
model[0] ==
'0' && this->
model[1] ==
'7')
5362 else if (this->
model[0] ==
'0' && this->
model[1] ==
'8')
5372 else if (this->
model[0] ==
'0' && this->
model[1] ==
'9')
5390 else if (this->
model[0] ==
'1' && this->
model[1] ==
'0')
5406 (this->
model[0] ==
'1' && (this->
model[1] ==
'1' || this->
model[1] ==
'8' || this->
model[1] ==
'9')) ||
5407 ((this->
model[0] ==
'2' || this->
model[0] ==
'3') && this->
model[1] ==
'8') ||
5408 (this->
model[0] ==
'4' && (this->
model[1] ==
'0' || this->
model[1] ==
'1' || this->
model[1] ==
'8' || this->
model[1] ==
'9')) ||
5409 (this->
model[0] ==
'5' && (this->
model[1] ==
'1' || this->
model[1] ==
'8')))
5422 else if (this->
model[0] ==
'1' && this->
model[1] ==
'2')
5430 else if ((this->
model[0] ==
'2' || this->
model[0] ==
'3') && this->
model[1] ==
'1')
5452 virtual void invalidate()
5455 this->
part1.invalidate();
5456 this->
part2.invalidate();
5457 this->
part3.invalidate();
5463 static bool check11(
5476 static bool check11(
5493 static bool check11(
5522 std::shared_ptr<basic_parser<T>> m_space;
5546 _In_ const std::locale& locale = std::locale()) :
5556 _In_reads_or_z_(end)
const T* text,
5557 _In_ size_t start = 0,
5561 _Assume_(text || start >= end);
5591 virtual void invalidate()
5603 std::shared_ptr<basic_parser<T>> m_element;
5604 std::shared_ptr<basic_parser<T>> m_digit;
5605 std::shared_ptr<basic_parser<T>> m_sign;
5624 _In_reads_or_z_(end)
const char* text,
5625 _In_ size_t start = 0,
5629 _Assume_(text || start >= end);
5660 _In_reads_or_z_(end)
const char* text,
5661 _In_ size_t start = 0,
5665 _Assume_(text || start >= end);
5697 _In_reads_or_z_(end)
const char* text,
5698 _In_ size_t start = 0,
5702 _Assume_(text || start >= end);
5731 _In_reads_or_z_(end)
const char* text,
5732 _In_ size_t start = 0,
5736 _Assume_(text || start >= end);
5740 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
5785 _In_reads_or_z_(end)
const char* text,
5786 _In_ size_t start = 0,
5790 _Assume_(text || start >= end);
5830 virtual void invalidate()
5834 parser::invalidate();
5851 _In_reads_or_z_(end)
const char* text,
5852 _In_ size_t start = 0,
5856 _Assume_(text || start >= end);
5865 string.invalidate();
5876 virtual void invalidate()
5878 string.invalidate();
5880 parser::invalidate();
5895 _In_reads_or_z_(end)
const char* text,
5896 _In_ size_t start = 0,
5900 _Assume_(text || start >= end);
5928 virtual void invalidate()
5932 parser::invalidate();
5950 _In_reads_or_z_(end)
const char* text,
5951 _In_ size_t start = 0,
5955 _Assume_(text || start >= end);
5956 if (start + 2 < end &&
5957 text[start] ==
'*' &&
5958 text[start + 1] ==
'/' &&
5959 text[start + 2] ==
'*')
5964 else if (start < end && text[start] ==
'*') {
5982 _In_reads_or_z_(end)
const char* text,
5983 _In_ size_t start = 0,
5987 _Assume_(text || start >= end);
6010 subtype.invalidate();
6015 virtual void invalidate()
6018 subtype.invalidate();
6019 parser::invalidate();
6037 _In_reads_or_z_(end)
const char* text,
6038 _In_ size_t start = 0,
6042 _Assume_(text || start >= end);
6043 if (!http_media_range::match(text, start, end,
flags))
6057 params.push_back(std::move(param));
6072 http_media_range::invalidate();
6078 virtual void invalidate()
6081 http_media_range::invalidate();
6085 std::list<http_parameter> params;
6095 _In_reads_or_z_(end)
const char* text,
6096 _In_ size_t start = 0,
6100 _Assume_(text || start >= end);
6104 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6137 _In_reads_or_z_(end)
const char* text,
6138 _In_ size_t start = 0,
6142 _Assume_(text || start >= end);
6171 virtual void invalidate()
6174 parser::invalidate();
6188 _In_reads_or_z_(end)
const char* text,
6189 _In_ size_t start = 0,
6193 _Assume_(text || start >= end);
6197 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6221 _In_reads_or_z_(end)
const char* text,
6222 _In_ size_t start = 0,
6226 _Assume_(text || start >= end);
6260 virtual void invalidate()
6263 parser::invalidate();
6277 _In_reads_or_z_(end)
const char* text,
6278 _In_ size_t start = 0,
6282 _Assume_(text || start >= end);
6287 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6308 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6337 virtual void invalidate()
6343 parser::invalidate();
6357 http_url(
_In_ const std::locale& locale = std::locale()) :
6363 _In_reads_or_z_(end)
const char* text,
6364 _In_ size_t start = 0,
6368 _Assume_(text || start >= end);
6388 server.invalidate();
6404 if ((
unsigned int)text[this->
interval.
end] < 0x20 ||
6414 params.push_back(std::move(param));
6429 server.invalidate();
6437 virtual void invalidate()
6439 server.invalidate();
6443 parser::invalidate();
6450 std::list<http_url_parameter> params;
6460 _In_reads_or_z_(end)
const char* text,
6461 _In_ size_t start = 0,
6465 _Assume_(text || start >= end);
6473 if (
k.end < end && text[
k.end]) {
6474 if (stdex::isalpha(text[
k.end]))
6485 components.push_back(
k);
6497 if (!components.empty()) {
6506 virtual void invalidate()
6509 parser::invalidate();
6513 std::vector<stdex::interval<size_t>> components;
6528 _In_reads_or_z_(end)
const char* text,
6529 _In_ size_t start = 0,
6533 _Assume_(text || start >= end);
6575 virtual void invalidate()
6578 parser::invalidate();
6592 _In_reads_or_z_(end)
const char* text,
6593 _In_ size_t start = 0,
6597 _Assume_(text || end <= start);
6598 if (start < end && text[start] ==
'*') {
6610 template <
class T,
class T_asterisk = http_asterisk>
6620 _In_reads_or_z_(end)
const char* text,
6621 _In_ size_t start = 0,
6625 _Assume_(text || start >= end);
6634 asterisk.invalidate();
6637 asterisk.invalidate();
6659 factor.invalidate();
6666 virtual void invalidate()
6668 asterisk.invalidate();
6670 factor.invalidate();
6671 parser::invalidate();
6687 _In_reads_or_z_(end)
const char* text,
6688 _In_ size_t start = 0,
6692 _Assume_(text || start >= end);
6724 virtual void invalidate()
6728 parser::invalidate();
6746 _In_reads_or_z_(end)
const char* text,
6747 _In_ size_t start = 0,
6751 _Assume_(text || start >= end);
6781 params.push_back(std::move(param));
6804 virtual void invalidate()
6809 parser::invalidate();
6828 _In_reads_or_z_(end)
const char* text,
6829 _In_ size_t start = 0,
6833 _Assume_(text || start >= end);
6858 else if (stdex::isspace(text[this->
interval.
end])) {
6882 virtual void invalidate()
6888 parser::invalidate();
6908 _In_reads_or_z_(end)
const char* text,
6909 _In_ size_t start = 0,
6913 _Assume_(text || start >= end);
6923 else if (stdex::isspace(text[this->
interval.
end]))
6945 (
uint16_t)strtoui(text + version_maj.
start, version_maj.
size(),
nullptr, 10) * 0x100 +
6957 else if (stdex::isspace(text[this->
interval.
end])) {
6959 version_min.
start = 1;
6960 version_min.
end = 0;
6976 version_maj.
start = 1;
6977 version_maj.
end = 0;
6978 version_min.
start = 1;
6979 version_min.
end = 0;
6985 virtual void invalidate()
6989 version_maj.
start = 1;
6990 version_maj.
end = 0;
6991 version_min.
start = 1;
6992 version_min.
end = 0;
6994 parser::invalidate();
7017 _In_reads_or_z_(end)
const char* text,
7018 _In_ size_t start = 0,
7022 _Assume_(text || start >= end);
7071 protocol.invalidate();
7118 protocol.invalidate();
7123 virtual void invalidate()
7128 protocol.invalidate();
7129 parser::invalidate();
7148 _In_reads_or_z_(end)
const char* text,
7149 _In_ size_t start = 0,
7153 _Assume_(text || start >= end);
7232 virtual void invalidate()
7238 parser::invalidate();
7252 template <
class _Key,
class T>
7257 _In_reads_or_z_(end)
const char* text,
7258 _In_ size_t start = 0,
7262 while (start < end) {
7263 while (start < end && text[start] && stdex::isspace(text[start])) start++;
7264 if (start < end && text[start] ==
',') {
7266 while (start < end&& text[start] && stdex::isspace(text[start])) start++;
7269 if (
el.match(text, start, end,
flags)) {
7271 T::insert(std::move(
el));
7281 constexpr bool operator()(
const T& a,
const T& b)
const noexcept
7283 return a.factor.value > b.factor.value;
7290 template <
class T,
class _Alloc = std::allocator<T>>
7312 _In_ const std::locale& locale = std::locale()) :
7328 _In_reads_or_z_(end)
const T* text,
7329 _In_ size_t start = 0,
7333 _Assume_(text || start >= end);
7345 if (m_quote->match(text, m_escape->interval.end, end,
flags)) {
7346 value +=
'"'; this->
interval.
end = m_quote->interval.end;
7349 if (m_sol->match(text, m_escape->interval.end, end,
flags)) {
7350 value +=
'/'; this->
interval.
end = m_sol->interval.end;
7353 if (m_bs->match(text, m_escape->interval.end, end,
flags)) {
7354 value +=
'\b'; this->
interval.
end = m_bs->interval.end;
7357 if (m_ff->match(text, m_escape->interval.end, end,
flags)) {
7358 value +=
'\f'; this->
interval.
end = m_ff->interval.end;
7361 if (m_lf->match(text, m_escape->interval.end, end,
flags)) {
7362 value +=
'\n'; this->
interval.
end = m_lf->interval.end;
7365 if (m_cr->match(text, m_escape->interval.end, end,
flags)) {
7366 value +=
'\r'; this->
interval.
end = m_cr->interval.end;
7369 if (m_htab->match(text, m_escape->interval.end, end,
flags)) {
7370 value +=
'\t'; this->
interval.
end = m_htab->interval.end;
7374 m_uni->match(text, m_escape->interval.end, end,
flags) &&
7375 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end),
flags | match_case_insensitive) &&
7376 m_hex->interval.size() == 4 )
7378 _Assume_(m_hex->value <= 0xffff);
7379 if (
sizeof(T) == 1) {
7380 if (m_hex->value > 0x7ff) {
7381 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
7382 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
7383 value += (T)(0x80 | (m_hex->value & 0x3f));
7385 else if (m_hex->value > 0x7f) {
7386 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
7387 value += (T)(0x80 | (m_hex->value & 0x3f));
7390 value += (T)(m_hex->value & 0x7f);
7393 value += (T)m_hex->value;
7397 if (m_escape->match(text, m_escape->interval.end, end,
flags)) {
7398 value +=
'\\'; this->
interval.
end = m_escape->interval.end;
7403 value.append(text + m_chr->interval.start, m_chr->interval.size());
7415 virtual void invalidate()
7422 std::basic_string<T> value;
7425 std::shared_ptr<basic_parser<T>> m_quote;
7426 std::shared_ptr<basic_parser<T>> m_chr;
7427 std::shared_ptr<basic_parser<T>> m_escape;
7428 std::shared_ptr<basic_parser<T>> m_sol;
7429 std::shared_ptr<basic_parser<T>> m_bs;
7430 std::shared_ptr<basic_parser<T>> m_ff;
7431 std::shared_ptr<basic_parser<T>> m_lf;
7432 std::shared_ptr<basic_parser<T>> m_cr;
7433 std::shared_ptr<basic_parser<T>> m_htab;
7434 std::shared_ptr<basic_parser<T>> m_uni;
7435 std::shared_ptr<basic_integer16<T>> m_hex;
7454 _In_reads_or_z_opt_(end)
const T* text,
7455 _In_ size_t start = 0,
7459 _Unreferenced_(
flags);
7460 _Assume_(text || start + 1 >= end);
7461 if (start + 1 < end &&
7462 text[start] ==
'/' &&
7463 text[start + 1] ==
'*')
7488 virtual void invalidate()
7491 basic_parser::invalidate();
7514 _In_reads_or_z_opt_(end)
const T* text,
7515 _In_ size_t start = 0,
7519 _Unreferenced_(
flags);
7520 _Assume_(text || start + 3 >= end);
7521 if (start + 3 < end &&
7522 text[start] ==
'<' &&
7523 text[start + 1] ==
'!' &&
7524 text[start + 2] ==
'-' &&
7525 text[start + 3] ==
'-')
7552 _In_reads_or_z_opt_(end)
const T* text,
7553 _In_ size_t start = 0,
7557 _Unreferenced_(
flags);
7558 _Assume_(text || start + 2 >= end);
7559 if (start + 2 < end &&
7560 text[start] ==
'-' &&
7561 text[start + 1] ==
'-' &&
7562 text[start + 2] ==
'>')
7589 _In_reads_or_z_opt_(end)
const T* text,
7590 _In_ size_t start = 0,
7594 _Unreferenced_(
flags);
7630 virtual void invalidate()
7633 basic_parser::invalidate();
7656 _In_reads_or_z_opt_(end)
const T* text,
7657 _In_ size_t start = 0,
7661 _Unreferenced_(
flags);
7674 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7741 virtual void invalidate()
7744 basic_parser::invalidate();
7767 _In_reads_or_z_opt_(end)
const T* text,
7768 _In_ size_t start = 0,
7772 _Unreferenced_(
flags);
7788 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7826 virtual void invalidate()
7829 basic_parser::invalidate();
7852 _In_reads_or_z_opt_(end)
const T* text,
7853 _In_ size_t start = 0,
7857 _Unreferenced_(
flags);
7858 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7958 virtual void invalidate()
7963 basic_parser::invalidate();
7988 _In_reads_or_z_opt_(end)
const T* text,
7989 _In_ size_t start = 0,
7993 _Unreferenced_(
flags);
7994 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8035 _In_reads_or_z_opt_(end)
const T* text,
8036 _In_ size_t start = 0,
8040 _Unreferenced_(
flags);
8069 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8089 virtual void invalidate()
8092 basic_parser::invalidate();
8110 enum class html_sequence_t {
8141 type(html_sequence_t::unknown)
8145 _In_reads_or_z_opt_(end)
const T* text,
8146 _In_ size_t start = 0,
8150 _Assume_(text || start >= end);
8151 if (start >= end || text[start] !=
'<')
8160 this->
type = html_sequence_t::element_end;
8182 this->
type = html_sequence_t::comment;
8192 this->
type = html_sequence_t::declaration;
8203 this->
type = html_sequence_t::instruction;
8215 this->
type = html_sequence_t::instruction;
8227 this->
type = html_sequence_t::element_start;
8235 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8240 if (this->
type == html_sequence_t::element_start &&
8246 this->
type = html_sequence_t::element;
8257 if (this->
type == html_sequence_t::declaration &&
8266 if (this->
type == html_sequence_t::declaration &&
8320 a->value = this->m_value.content;
8329 a->value.invalidate();
8337 this->
type = html_sequence_t::unknown;
8344 virtual void invalidate()
8346 this->
type = html_sequence_t::unknown;
8349 basic_parser::invalidate();
8378 _In_reads_or_z_opt_(end)
const T* text,
8379 _In_ size_t start = 0,
8383 _Unreferenced_(
flags);
8384 _Assume_(text || start + 2 >= end);
8385 if (start + 2 < end &&
8386 text[start] ==
'<' &&
8387 text[start + 1] ==
'!' &&
8388 text[start + 2] ==
'[')
8393 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8418 virtual void invalidate()
8421 basic_parser::invalidate();
8444 _In_reads_or_z_opt_(end)
const T* text,
8445 _In_ size_t start = 0,
8449 _Unreferenced_(
flags);
8450 _Assume_(text || start + 2 >= end);
8451 if (start + 2 < end &&
8452 text[start] ==
']' &&
8453 text[start + 1] ==
']' &&
8454 text[start + 2] ==
'>')
8475#undef ENUM_FLAG_OPERATOR
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4396
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:4966
T reference[22]
Normalized national reference number.
Definition parser.hpp:5095
T check_digits[3]
Two check digits.
Definition parser.hpp:5094
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:5096
Legacy CSS comment end -->
Definition parser.hpp:7549
Legacy CSS comment start <!--
Definition parser.hpp:7511
CSS import directive.
Definition parser.hpp:7764
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7833
CSS string.
Definition parser.hpp:7586
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7637
URI in CSS.
Definition parser.hpp:7653
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7748
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:4026
Test for valid DNS domain character.
Definition parser.hpp:2807
bool allow_on_edge
Is character allowed at the beginning or an end of a DNS domain?
Definition parser.hpp:2845
Test for DNS domain/hostname.
Definition parser.hpp:2907
bool m_allow_absolute
May DNS names end with a dot (absolute name)?
Definition parser.hpp:2971
Test for e-mail address.
Definition parser.hpp:3795
Test for emoticon.
Definition parser.hpp:3903
std::shared_ptr< basic_parser< T > > apex
apex/eyebrows/halo (e.g. O, 0)
Definition parser.hpp:3992
std::shared_ptr< basic_parser< T > > eyes
eyes (e.g. :, ;, >, |, B)
Definition parser.hpp:3993
std::shared_ptr< basic_set< T > > mouth
mouth (e.g. ), ), (, (, |, P, D, p, d)
Definition parser.hpp:3995
std::shared_ptr< basic_parser< T > > nose
nose (e.g. -, o)
Definition parser.hpp:3994
std::shared_ptr< basic_parser< T > > emoticon
emoticon as a whole (e.g. 😀, 🤔, 😶)
Definition parser.hpp:3991
Test for end of line.
Definition parser.hpp:656
Test for fraction.
Definition parser.hpp:1689
End of condition ...]]>
Definition parser.hpp:8441
Start of condition <![condition[...
Definition parser.hpp:8375
Contiguous sequence of characters representing name of element, attribute etc.
Definition parser.hpp:7985
Tag.
Definition parser.hpp:8137
std::vector< html_attribute > attributes
tag attributes
Definition parser.hpp:8355
html_sequence_t type
tag type
Definition parser.hpp:8353
stdex::interval< size_t > name
tag name position in source
Definition parser.hpp:8354
Optionally-quoted string representing value of an attribute.
Definition parser.hpp:8032
stdex::interval< size_t > content
content position in source
Definition parser.hpp:8096
Test for International Bank Account Number.
Definition parser.hpp:4672
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4943
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4941
T check_digits[3]
Two check digits.
Definition parser.hpp:4942
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4944
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:2770
stdex::interval< size_t > components[8]
Individual component intervals.
Definition parser.hpp:2768
struct in6_addr value
IPv6 address value.
Definition parser.hpp:2769
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:7298
MIME content type.
Definition parser.hpp:7849
stdex::interval< size_t > base_type
basic type position in source
Definition parser.hpp:7967
stdex::interval< size_t > sub_type
sub-type position in source
Definition parser.hpp:7968
stdex::interval< size_t > charset
charset position in source
Definition parser.hpp:7969
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:4519
std::basic_string< T > value
Normalized phone number.
Definition parser.hpp:4645
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:5163
Test for SI Reference part.
Definition parser.hpp:5118
Test for SI Reference.
Definition parser.hpp:5201
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5518
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5516
bool is_valid
Is reference valid.
Definition parser.hpp:5519
T model[3]
Reference model.
Definition parser.hpp:5515
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5517
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:4293
Test for valid URL password character.
Definition parser.hpp:3089
Test for valid URL path character.
Definition parser.hpp:3189
Test for URL path.
Definition parser.hpp:3297
Test for valid URL username character.
Definition parser.hpp:2990
Test for URL.
Definition parser.hpp:3438
Test for HTTP agent.
Definition parser.hpp:6825
Test for HTTP any type.
Definition parser.hpp:5947
Test for HTTP asterisk.
Definition parser.hpp:6589
Test for HTTP cookie parameter (RFC2109)
Definition parser.hpp:6684
Test for HTTP cookie (RFC2109)
Definition parser.hpp:6743
std::list< http_cookie_parameter > params
List of cookie parameters.
Definition parser.hpp:6815
http_token name
Cookie name.
Definition parser.hpp:6813
http_value value
Cookie value.
Definition parser.hpp:6814
Test for HTTP language (RFC1766)
Definition parser.hpp:6457
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5621
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5892
http_token name
Parameter name.
Definition parser.hpp:5936
http_value value
Parameter value.
Definition parser.hpp:5937
Test for HTTP protocol.
Definition parser.hpp:6900
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:7001
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5782
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5838
Test for HTTP request.
Definition parser.hpp:7008
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5657
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5694
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5728
Test for HTTP URL parameter.
Definition parser.hpp:6274
Test for HTTP URL path segment.
Definition parser.hpp:6185
Test for HTTP URL path segment.
Definition parser.hpp:6218
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6267
Test for HTTP URL port.
Definition parser.hpp:6129
Test for HTTP URL server.
Definition parser.hpp:6092
Test for HTTP URL.
Definition parser.hpp:6355
Collection of HTTP values.
Definition parser.hpp:7254
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5848
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5884
http_token token
Value when matched as token.
Definition parser.hpp:5885
Test for HTTP weight factor.
Definition parser.hpp:6520
float value
Calculated value of the weight factor.
Definition parser.hpp:6582
Test for HTTP weighted value.
Definition parser.hpp:6612
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:2863
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:3141
Test for valid URL path SGML character.
Definition parser.hpp:3245
Test for valid URL username SGML character.
Definition parser.hpp:3041
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:8127
stdex::interval< size_t > name
attribute name position in source
Definition parser.hpp:8128
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8129
Definition parser.hpp:7280