10#include "interval.hpp"
24#include <netinet/in.h>
36#pragma warning(disable: 4100)
39#define ENUM_FLAG_OPERATOR(T,X) \
40inline 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)); } \
41inline 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); } \
42inline 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)); } \
43inline T& operator X= (T& lhs, const T rhs) { return lhs = lhs X rhs; } \
44inline T& operator X= (T& lhs, const std::underlying_type_t<T> rhs) { return lhs = lhs X rhs; }
45#define ENUM_FLAGS(T, type) \
47inline T operator ~ (T t) { return (T) (~static_cast<std::underlying_type_t <T>>(t)); } \
48ENUM_FLAG_OPERATOR(T,|) \
49ENUM_FLAG_OPERATOR(T,^) \
50ENUM_FLAG_OPERATOR(T,&) \
54#elif defined(__APPLE__)
55#define s6_words __u6_addr.__u6_addr16
57#define s6_words s6_addr16
67 constexpr int match_default = 0;
68 constexpr int match_case_insensitive = 0x1;
69 constexpr int match_multiline = 0x2;
82 _In_reads_or_z_opt_(end)
const T* text,
83 _In_ size_t start = 0,
87 for (
size_t i = start; i < end && text[i]; i++)
88 if (match(text, i, end,
flags))
94 _In_reads_or_z_opt_(end)
const T* text,
95 _In_ size_t start = 0,
99 return do_match(text, start, end,
flags);
103 _In_ const std::basic_string_view<T, std::char_traits<T>> text,
104 _In_ size_t start = 0,
108 return match(text.data(), start, std::min<size_t>(end, text.size()),
flags);
111 virtual void invalidate()
119 virtual bool do_match(
120 _In_reads_or_z_opt_(end)
const T* text,
121 _In_ size_t start = 0,
128 if (text[start] ==
'&') {
130 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
139 if (
n >= 2 && text[start + 1] ==
'#') {
142 if (text[start + 2] ==
'x' || text[start + 2] ==
'X')
143 unicode = strtou32(text + start + 3,
n - 2,
nullptr, 16);
145 unicode = strtou32(text + start + 2,
n - 1,
nullptr, 10);
152 ucs4_to_surrogate_pair(buf,
unicode);
176 buf[0] = text[start];
183 std::locale m_locale;
186 using parser = basic_parser<char>;
187 using wparser = basic_parser<wchar_t>;
189 using tparser = wparser;
191 using tparser = parser;
193 using sgml_parser = basic_parser<char>;
202 virtual bool do_match(
203 _In_reads_or_z_opt_(end)
const T* text,
204 _In_ size_t start = 0,
208 _Assume_(text || start >= end);
209 if (start < end && text[start]) {
210 this->interval.
start = this->interval.
end = start;
237 virtual bool do_match(
238 _In_reads_or_z_opt_(end)
const T* text,
239 _In_ size_t start = 0,
243 _Assume_(text || start >= end);
244 if (start < end && text[start]) {
245 this->interval.
end = (this->interval.
start = start) + 1;
270 virtual bool do_match(
271 _In_reads_or_z_(end)
const char* text,
272 _In_ size_t start = 0,
276 _Assume_(text || start >= end);
277 if (start < end && text[start]) {
278 if (text[start] ==
'&') {
280 const auto&
ctype = std::use_facet<std::ctype<char>>(m_locale);
281 for (this->interval.
end = start + 1; this->interval.
end < end && text[this->interval.
end]; this->interval.
end++)
282 if (text[this->interval.
end] ==
';') {
283 this->interval.
end++;
284 this->interval.
start = start;
291 this->interval.
end = (this->interval.
start = start) + 1;
313 virtual bool do_match(
314 _In_reads_or_z_opt_(end)
const T* text,
315 _In_ size_t start = 0,
319 _Assume_(text || start >= end);
320 if (start < end && text[start]) {
322 if (
flags & match_case_insensitive) {
323 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
324 r =
ctype.tolower(text[start]) ==
ctype.tolower(m_chr);
327 r = text[start] == m_chr;
328 if ((
r && !m_invert) || (!
r && m_invert)) {
329 this->interval.
end = (this->interval.
start = start) + 1;
366 virtual bool do_match(
367 _In_reads_or_z_(end)
const char* text,
368 _In_ size_t start = 0,
372 _Assume_(text || start >= end);
373 if (start < end && text[start]) {
376 bool r = ((
flags & match_case_insensitive) ?
377 stdex::strnicmp(
chr,
SIZE_MAX, m_chr.data(), m_chr.size(), m_locale) :
378 stdex::strncmp(
chr,
SIZE_MAX, m_chr.data(), m_chr.size())) == 0;
379 if ((
r && !m_invert) || (!
r && m_invert)) {
380 this->interval.
start = start;
405 virtual bool do_match(
406 _In_reads_or_z_opt_(end)
const T* text,
407 _In_ size_t start = 0,
411 _Assume_(text || start >= end);
412 if (start < end && text[start]) {
414 ((
flags & match_multiline) || !stdex::islbreak(text[start])) &&
415 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space, text[start]);
416 if ((
r && !m_invert) || (!
r && m_invert)) {
417 this->interval.
end = (this->interval.
start = start) + 1;
447 virtual bool do_match(
448 _In_reads_or_z_(end)
const char* text,
449 _In_ size_t start = 0,
453 _Assume_(text || start >= end);
454 if (start < end && text[start]) {
460 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space,
chr,
chr_end) ==
chr_end;
461 if ((
r && !m_invert) || (!
r && m_invert)) {
462 this->interval.
start = start;
485 virtual bool do_match(
486 _In_reads_or_z_opt_(end)
const T* text,
487 _In_ size_t start = 0,
491 _Assume_(text || start >= end);
492 if (start < end && text[start]) {
493 bool r = std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::punct, text[start]);
494 if ((
r && !m_invert) || (!
r && m_invert)) {
495 this->interval.
end = (this->interval.
start = start) + 1;
525 virtual bool do_match(
526 _In_reads_or_z_(end)
const char* text,
527 _In_ size_t start = 0,
531 _Assume_(text || start >= end);
532 if (start < end && text[start]) {
537 if ((
r && !m_invert) || (!
r && m_invert)) {
538 this->interval.
start = start;
560 virtual bool do_match(
561 _In_reads_or_z_opt_(end)
const T* text,
562 _In_ size_t start = 0,
566 _Assume_(text || start >= end);
567 if (start < end && text[start]) {
569 ((
flags & match_multiline) || !stdex::islbreak(text[start])) &&
570 std::use_facet<std::ctype<T>>(this->m_locale).is(std::ctype_base::space | std::ctype_base::punct, text[start]);
571 if ((
r && !m_invert) || (!
r && m_invert)) {
572 this->interval.
end = (this->interval.
start = start) + 1;
602 virtual bool do_match(
603 _In_reads_or_z_(end)
const char* text,
604 _In_ size_t start = 0,
608 _Assume_(text || start >= end);
609 if (start < end && text[start]) {
615 std::use_facet<std::ctype<wchar_t>>(m_locale).scan_not(std::ctype_base::space | std::ctype_base::punct,
chr,
chr_end) ==
chr_end;
616 if ((
r && !m_invert) || (!
r && m_invert)) {
617 this->interval.
start = start;
636 virtual bool do_match(
637 _In_reads_or_z_opt_(end)
const T* text,
638 _In_ size_t start = 0,
642 _Assume_(text || !end);
643 _Assume_(text || start >= end);
644 bool r = start == 0 || (start <= end && stdex::islbreak(text[start - 1]));
645 if ((
r && !m_invert) || (!
r && m_invert)) {
646 this->interval.
end = this->interval.
start = start;
675 virtual bool do_match(
676 _In_reads_or_z_opt_(end)
const T* text,
677 _In_ size_t start = 0,
681 _Assume_(text || start >= end);
682 bool r = start >= end || !text[start] || stdex::islbreak(text[start]);
683 if ((
r && !m_invert) || (!
r && m_invert)) {
684 this->interval.
end = this->interval.
start = start;
713 virtual void invalidate()
722 virtual bool do_match(
723 _In_reads_or_z_opt_(end)
const T* text,
724 _In_ size_t start = 0,
739 _In_reads_or_z_(
count)
const T* set,
742 _In_ const std::locale&
locale = std::locale()) :
746 m_set.assign(set, set + stdex::strnlen(set,
count));
750 virtual bool do_match(
751 _In_reads_or_z_opt_(end)
const T* text,
752 _In_ size_t start = 0,
756 _Assume_(text || start >= end);
757 if (start < end && text[start]) {
758 const T* set = m_set.data();
759 size_t r = (
flags & match_case_insensitive) ?
760 stdex::strnichr(set, m_set.size(), text[start], this->m_locale) :
761 stdex::strnchr(set, m_set.size(), text[start]);
762 if ((
r != stdex::npos && !this->m_invert) || (
r == stdex::npos && this->m_invert)) {
763 this->hit_offset =
r;
764 this->interval.
end = (this->interval.
start = start) + 1;
773 std::basic_string<T> m_set;
794 m_set = sgml2str(set,
count);
798 virtual bool do_match(
799 _In_reads_or_z_(end)
const char* text,
800 _In_ size_t start = 0,
804 _Assume_(text || start >= end);
805 if (start < end && text[start]) {
808 const wchar_t* set = m_set.data();
809 size_t r = (
flags & match_case_insensitive) ?
810 stdex::strnistr(set, m_set.size(),
chr, m_locale) :
811 stdex::strnstr(set, m_set.size(),
chr);
812 if ((
r != stdex::npos && !m_invert) || (
r == stdex::npos && m_invert)) {
814 this->interval.
start = start;
834 _In_reads_or_z_(
count)
const T*
str,
836 _In_ const std::locale&
locale = std::locale()) :
842 virtual bool do_match(
843 _In_reads_or_z_opt_(end)
const T* text,
844 _In_ size_t start = 0,
848 _Assume_(text || start >= end);
851 n = std::min<size_t>(end - start,
m);
852 bool r = ((
flags & match_case_insensitive) ?
853 stdex::strnicmp(text + start,
n, m_str.data(),
m, this->m_locale) :
854 stdex::strncmp(text + start,
n, m_str.data(),
m)) == 0;
856 this->interval.
end = (this->interval.
start = start) +
n;
863 std::basic_string<T> m_str;
886 virtual bool do_match(
887 _In_reads_or_z_(end)
const char* text,
888 _In_ size_t start = 0,
892 _Assume_(text || start >= end);
893 const wchar_t*
str = m_str.data();
895 const auto&
ctype = std::use_facet<std::ctype<wchar_t>>(m_locale);
896 for (this->interval.
end = start;;) {
898 this->interval.
start = start;
936 virtual bool do_match(
937 _In_reads_or_z_opt_(end)
const T* text,
938 _In_ size_t start = 0,
942 _Assume_(text || start >= end);
943 this->interval.
start = this->interval.
end = start;
944 for (
size_t i = 0; ; i++) {
956 this->interval.
end =
m_el->interval.end;
962 std::shared_ptr<basic_parser<T>>
m_el;
990 _In_ const std::locale&
locale = std::locale()) :
994 m_collection.reserve(
count);
995 for (
size_t i = 0; i <
count; i++)
996 m_collection.push_back(
el[i]);
1001 _In_ const std::locale&
locale = std::locale()) :
1006 virtual void invalidate()
1008 for (
auto&
el : m_collection)
1014 std::vector<std::shared_ptr<basic_parser<T>>> m_collection;
1027 _In_ const std::locale&
locale = std::locale()) :
1033 _In_ const std::locale&
locale = std::locale()) :
1038 virtual bool do_match(
1039 _In_reads_or_z_opt_(end)
const T* text,
1040 _In_ size_t start = 0,
1044 _Assume_(text || start >= end);
1045 this->interval.
end = start;
1046 for (
auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i) {
1048 for (++i; i != this->m_collection.end(); ++i)
1053 this->interval.
end = (*i)->interval.end;
1055 this->interval.
start = start;
1085 _In_ const std::locale&
locale = std::locale()) :
1092 _In_ const std::locale&
locale = std::locale()) :
1097 virtual void invalidate()
1106 virtual bool do_match(
1107 _In_reads_or_z_opt_(end)
const T* text,
1108 _In_ size_t start = 0,
1112 _Assume_(text || start >= end);
1114 for (
auto i = this->m_collection.begin(); i != this->m_collection.end(); ++i, ++hit_offset) {
1115 if ((*i)->match(text, start, end,
flags)) {
1117 for (++i; i != this->m_collection.end(); ++i)
1140 template <
class T,
class T_parser = basic_
string<T>>
1147 _In_ const std::locale&
locale = std::locale()) :
1181 this->m_collection.reserve(
n);
1194 this->m_collection.push_back(std::move(std::make_shared<T_parser>(
str,
SIZE_MAX,
this->m_locale)));
1195 (p =
va_arg(params,
const T*)) !=
nullptr;
1196 this->m_collection.push_back(std::move(std::make_shared<T_parser>(p,
SIZE_MAX, this->m_locale))));
1219 _In_ const std::locale&
locale = std::locale()) :
1225 _In_ const std::locale&
locale = std::locale()) :
1230 virtual bool do_match(
1231 _In_reads_or_z_opt_(end)
const T* text,
1232 _In_ size_t start = 0,
1236 _Assume_(text || start >= end);
1237 for (
auto&
el : this->m_collection)
1239 if (match_recursively(text, start, end,
flags)) {
1240 this->interval.
start = start;
1247 bool match_recursively(
1248 _In_reads_or_z_opt_(end)
const T* text,
1249 _In_ size_t start = 0,
1254 for (
auto&
el : this->m_collection) {
1258 if (
el->match(text, start, end,
flags)) {
1269 this->interval.
end = start;
1297 virtual void invalidate()
1325 _In_ const std::locale&
locale = std::locale()) :
1340 virtual bool do_match(
1341 _In_reads_or_z_opt_(end)
const T* text,
1342 _In_ size_t start = 0,
1346 _Assume_(text || start >= end);
1347 for (this->interval.
end = start,
this->value = 0; this->interval.
end < end && text[this->interval.
end];) {
1363 this->interval.
start = start;
1370 std::shared_ptr<basic_parser<T>>
1402 _In_ const std::locale&
locale = std::locale()) :
1407 m_separator(separator)
1410 virtual void invalidate()
1421 virtual bool do_match(
1422 _In_reads_or_z_opt_(end)
const T* text,
1423 _In_ size_t start = 0,
1427 _Assume_(text || start >= end);
1428 if (m_digits->match(text, start, end,
flags)) {
1430 this->
value = m_digits->value;
1433 this->interval.
start = start;
1434 this->interval.
end = m_digits->interval.end;
1435 if (m_digits->interval.size() <= 3) {
1439 (hit_offset ==
SIZE_MAX || hit_offset == m_separator->hit_offset) &&
1440 m_digits->match(text, m_separator->interval.end, end,
flags) &&
1441 m_digits->interval.size() == 3)
1444 this->
value = this->
value * 1000 + m_digits->value;
1447 this->interval.
end = m_digits->interval.end;
1448 hit_offset = m_separator->hit_offset;
1459 std::shared_ptr<basic_integer10<T>> m_digits;
1460 std::shared_ptr<basic_set<T>> m_separator;
1463 using integer10ts = basic_integer10ts<char>;
1464 using winteger10ts = basic_integer10ts<wchar_t>;
1466 using tinteger10ts = winteger10ts;
1468 using tinteger10ts = integer10ts;
1470 using sgml_integer10ts = basic_integer10ts<char>;
1496 _In_ const std::locale&
locale = std::locale()) :
1517 virtual bool do_match(
1518 _In_reads_or_z_opt_(end)
const T* text,
1519 _In_ size_t start = 0,
1523 _Assume_(text || start >= end);
1524 for (this->interval.
end = start,
this->value = 0; this->interval.
end < end && text[this->interval.
end];) {
1536 else if (m_digit_10->match(text,
this->
interval.
end, end,
flags)) {
dig = 10; this->interval.
end = m_digit_10->interval.end; }
1537 else if (m_digit_11->match(text,
this->
interval.
end, end,
flags)) {
dig = 11; this->interval.
end = m_digit_11->interval.end; }
1538 else if (m_digit_12->match(text,
this->
interval.
end, end,
flags)) {
dig = 12; this->interval.
end = m_digit_12->interval.end; }
1539 else if (m_digit_13->match(text,
this->
interval.
end, end,
flags)) {
dig = 13; this->interval.
end = m_digit_13->interval.end; }
1540 else if (m_digit_14->match(text,
this->
interval.
end, end,
flags)) {
dig = 14; this->interval.
end = m_digit_14->interval.end; }
1541 else if (m_digit_15->match(text,
this->
interval.
end, end,
flags)) {
dig = 15; this->interval.
end = m_digit_15->interval.end; }
1546 this->interval.
start = start;
1553 std::shared_ptr<basic_parser<T>>
1598 _In_ const std::locale&
locale = std::locale()) :
1612 virtual bool do_match(
1613 _In_reads_or_z_opt_(end)
const T* text,
1614 _In_ size_t start = 0,
1618 _Assume_(text || start >= end);
1628 else if (m_digit_100 && m_digit_100->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 100;
end2 = m_digit_100->interval.end; }
1629 else if (m_digit_500 && m_digit_500->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 500;
end2 = m_digit_500->interval.end; }
1630 else if (m_digit_1000 && m_digit_1000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 1000;
end2 = m_digit_1000->interval.end; }
1631 else if (m_digit_5000 && m_digit_5000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 5000;
end2 = m_digit_5000->interval.end; }
1632 else if (m_digit_10000 && m_digit_10000->match(text,
this->
interval.
end, end,
flags)) {
dig[0] = 10000;
end2 = m_digit_10000->interval.end; }
1644 this->
value += dig[0];
1647 (
dig[1] == 1 && (
dig[0] == 5 ||
dig[0] == 10)) ||
1648 (
dig[1] == 10 && (
dig[0] == 50 ||
dig[0] == 100)) ||
1649 (
dig[1] == 100 && (
dig[0] == 500 ||
dig[0] == 1000)) ||
1650 (
dig[1] == 1000 && (
dig[0] == 5000 ||
dig[0] == 10000)))
1657 this->
value -= dig[1];
1661 this->
value += dig[0];
1669 this->interval.
start = start;
1676 std::shared_ptr<basic_parser<T>>
1708 _In_ const std::locale&
locale = std::locale()) :
1715 virtual void invalidate()
1717 numerator->invalidate();
1718 fraction_line->invalidate();
1719 denominator->invalidate();
1723 std::shared_ptr<basic_parser<T>> numerator;
1724 std::shared_ptr<basic_parser<T>> fraction_line;
1725 std::shared_ptr<basic_parser<T>> denominator;
1728 virtual bool do_match(
1729 _In_reads_or_z_opt_(end)
const T* text,
1730 _In_ size_t start = 0,
1734 _Assume_(text || start >= end);
1735 if (numerator->match(text, start, end,
flags) &&
1736 fraction_line->match(text, numerator->interval.end, end,
flags) &&
1737 denominator->match(text, fraction_line->interval.end, end,
flags))
1739 this->interval.
start = start;
1740 this->interval.
end = denominator->interval.end;
1743 numerator->invalidate();
1744 fraction_line->invalidate();
1745 denominator->invalidate();
1772 _In_ const std::locale&
locale = std::locale()) :
1780 virtual void invalidate()
1783 separator->invalidate();
1784 guest->invalidate();
1788 std::shared_ptr<basic_parser<T>> home;
1789 std::shared_ptr<basic_parser<T>> separator;
1790 std::shared_ptr<basic_parser<T>> guest;
1793 virtual bool do_match(
1794 _In_reads_or_z_opt_(end)
const T* text,
1795 _In_ size_t start = 0,
1799 _Assume_(text || start >= end);
1800 this->interval.
end = start;
1805 this->interval.
end = home->interval.end;
1809 for (; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
1812 this->interval.
end = separator->interval.end;
1816 for (; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
1819 this->interval.
end = guest->interval.end;
1823 this->interval.
start = start;
1828 separator->invalidate();
1829 guest->invalidate();
1834 std::shared_ptr<basic_parser<T>> m_space;
1858 _In_ const std::locale&
locale = std::locale()) :
1866 virtual void invalidate()
1881 virtual bool do_match(
1882 _In_reads_or_z_opt_(end)
const T* text,
1883 _In_ size_t start = 0,
1887 _Assume_(text || start >= end);
1888 this->interval.
end = start;
1910 this->interval.
start = start;
1911 this->interval.
end =
number->interval.end;
1923 using signed_numeral = basic_signed_numeral<char>;
1924 using wsigned_numeral = basic_signed_numeral<wchar_t>;
1926 using tsigned_numeral = wsigned_numeral;
1928 using tsigned_numeral = signed_numeral;
1930 using sgml_signed_numeral = basic_signed_numeral<char>;
1946 _In_ const std::locale&
locale = std::locale()) :
1956 virtual void invalidate()
1973 virtual bool do_match(
1974 _In_reads_or_z_opt_(end)
const T* text,
1975 _In_ size_t start = 0,
1979 _Assume_(text || start >= end);
1980 this->interval.
end = start;
2008 for (this->interval.
end = m_space->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
2010 this->interval.
start = start;
2015 this->interval.
start = start;
2023 this->interval.
start = start;
2031 this->interval.
start = start;
2045 std::shared_ptr<basic_parser<T>> m_space;
2048 using mixed_numeral = basic_mixed_numeral<char>;
2049 using wmixed_numeral = basic_mixed_numeral<wchar_t>;
2051 using tmixed_numeral = wmixed_numeral;
2053 using tmixed_numeral = mixed_numeral;
2055 using sgml_mixed_numeral = basic_mixed_numeral<char>;
2075 _In_ const std::locale&
locale = std::locale()) :
2087 value(std::numeric_limits<double>::quiet_NaN())
2090 virtual void invalidate()
2102 value = std::numeric_limits<double>::quiet_NaN();
2119 virtual bool do_match(
2120 _In_reads_or_z_opt_(end)
const T* text,
2121 _In_ size_t start = 0,
2125 _Assume_(text || start >= end);
2126 this->interval.
end = start;
2160 if (
integer->interval.empty() &&
2212 this->interval.
start = start;
2217 using scientific_numeral = basic_scientific_numeral<char>;
2218 using wscientific_numeral = basic_scientific_numeral<wchar_t>;
2220 using tscientific_numeral = wscientific_numeral;
2222 using tscientific_numeral = scientific_numeral;
2224 using sgml_scientific_numeral = basic_scientific_numeral<char>;
2241 _In_ const std::locale&
locale = std::locale()) :
2252 virtual void invalidate()
2273 virtual bool do_match(
2274 _In_reads_or_z_opt_(end)
const T* text,
2275 _In_ size_t start = 0,
2279 _Assume_(text || start >= end);
2280 this->interval.
end = start;
2326 if (
integer->interval.empty() &&
2341 this->interval.
start = start;
2346 using monetary_numeral = basic_monetary_numeral<char>;
2347 using wmonetary_numeral = basic_monetary_numeral<wchar_t>;
2349 using tmonetary_numeral = wmonetary_numeral;
2351 using tmonetary_numeral = monetary_numeral;
2353 using sgml_monetary_numeral = basic_monetary_numeral<char>;
2374 _In_ const std::locale&
locale = std::locale()) :
2386 m_separator(separator)
2391 virtual void invalidate()
2409 virtual bool do_match(
2410 _In_reads_or_z_opt_(end)
const T* text,
2411 _In_ size_t start = 0,
2415 _Assume_(text || start >= end);
2416 this->interval.
end = start;
2420 for (i = 0; i < 4; i++) {
2423 this->interval.
end = m_separator->interval.end;
2431 for (
x = 0; this->interval.
end < end && text[this->interval.
end];) {
2434 else if (m_digit_1->match(text, this->interval.end, end, flags)) { dig = 1; digit_end = m_digit_1->interval.end; }
2435 else if (m_digit_2->match(text, this->interval.end, end, flags)) { dig = 2; digit_end = m_digit_2->interval.end; }
2436 else if (m_digit_3->match(text, this->interval.end, end, flags)) { dig = 3; digit_end = m_digit_3->interval.end; }
2437 else if (m_digit_4->match(text, this->interval.end, end, flags)) { dig = 4; digit_end = m_digit_4->interval.end; }
2438 else if (m_digit_5->match(text, this->interval.end, end, flags)) { dig = 5; digit_end = m_digit_5->interval.end; }
2439 else if (m_digit_6->match(text, this->interval.end, end, flags)) { dig = 6; digit_end = m_digit_6->interval.end; }
2440 else if (m_digit_7->match(text, this->interval.end, end, flags)) { dig = 7; digit_end = m_digit_7->interval.end; }
2441 else if (m_digit_8->match(text, this->interval.end, end, flags)) { dig = 8; digit_end = m_digit_8->interval.end; }
2442 else if (m_digit_9->match(text, this->interval.end, end, flags)) { dig = 9; digit_end = m_digit_9->interval.end; }
2444 size_t x_n = x * 10 + dig;
2447 this->interval.
end = digit_end;
2456 value.s_addr = (
value.s_addr << 8) | (uint8_t)x;
2461 HE2BE(
reinterpret_cast<uint32_t&
>(
value.s_addr));
2462 this->interval.
start = start;
2470 std::shared_ptr<basic_parser<T>>
2481 std::shared_ptr<basic_parser<T>> m_separator;
2484 using ipv4_address = basic_ipv4_address<char>;
2485 using wipv4_address = basic_ipv4_address<wchar_t>;
2487 using tipv4_address = wipv4_address;
2489 using tipv4_address = ipv4_address;
2491 using sgml_ipv4_address = basic_ipv4_address<char>;
2503 virtual bool do_match(
2504 _In_reads_or_z_opt_(end)
const T* text,
2505 _In_ size_t start = 0,
2509 _Assume_(text || start >= end);
2510 if (start < end && text[start]) {
2511 if (text[start] ==
'-' ||
2512 text[start] ==
'_' ||
2513 text[start] ==
':' ||
2514 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2516 this->interval.
end = (this->interval.
start = start) + 1;
2542 virtual bool do_match(
2543 _In_reads_or_z_(end)
const char* text,
2544 _In_ size_t start = 0,
2548 _Assume_(text || start >= end);
2549 if (start < end && text[start]) {
2553 if (((
chr[0] ==
L'-' ||
2555 chr[0] ==
L':') &&
chr[1] == 0) ||
2558 this->interval.
start = start;
2594 _In_ const std::locale&
locale = std::locale()) :
2612 m_separator(separator),
2619 virtual void invalidate()
2647 virtual bool do_match(
2648 _In_reads_or_z_opt_(end)
const T* text,
2649 _In_ size_t start = 0,
2653 _Assume_(text || start >= end);
2654 this->interval.
end = start;
2658 for (i = 0; i < 8; i++) {
2663 this->interval.
end = m_separator->interval.end;
2670 this->interval.
end = m_separator->interval.end;
2689 for (
x = 0; this->interval.
end < end && text[this->interval.
end];) {
2709 if (
x_n <= 0xffff) {
2725 HE2BE(
reinterpret_cast<uint16_t&
>(this->value.s6_words[i]));
2732 this->value.s6_words[--
j] = this->value.s6_words[--
k];
2736 this->value.s6_words[--
j] = 0;
2744 if (m_scope_id_separator && m_scope_id_separator->match(text,
this->
interval.
end, end,
flags) &&
2750 this->interval.
start = start;
2758 std::shared_ptr<basic_parser<T>>
2775 std::shared_ptr<basic_parser<T>> m_separator, m_scope_id_separator;
2778 using ipv6_address = basic_ipv6_address<char>;
2779 using wipv6_address = basic_ipv6_address<wchar_t>;
2781 using tipv6_address = wipv6_address;
2783 using tipv6_address = ipv6_address;
2785 using sgml_ipv6_address = basic_ipv6_address<char>;
2796 _In_ const std::locale&
locale = std::locale()) :
2805 virtual bool do_match(
2806 _In_reads_or_z_opt_(end)
const T* text,
2807 _In_ size_t start = 0,
2811 _Assume_(text || start >= end);
2812 if (start < end && text[start]) {
2813 if ((
'A' <= text[start] && text[start] <=
'Z') ||
2814 (
'a' <= text[start] && text[start] <=
'z') ||
2815 (
'0' <= text[start] && text[start] <=
'9'))
2817 else if (text[start] ==
'-')
2819 else if (m_allow_idn && std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
2825 this->interval.
end = (this->interval.
start = start) + 1;
2835 using dns_domain_char = basic_dns_domain_char<char>;
2836 using wdns_domain_char = basic_dns_domain_char<wchar_t>;
2838 using tdns_domain_char = wdns_domain_char;
2840 using tdns_domain_char = dns_domain_char;
2851 _In_ const std::locale&
locale = std::locale()) :
2856 virtual bool do_match(
2857 _In_reads_or_z_(end)
const char* text,
2858 _In_ size_t start = 0,
2862 _Assume_(text || start >= end);
2863 if (start < end && text[start]) {
2867 if (((
'A' <=
chr[0] &&
chr[0] <=
'Z') ||
2868 (
'a' <=
chr[0] &&
chr[0] <=
'z') ||
2869 (
'0' <=
chr[0] &&
chr[0] <=
'9')) &&
chr[1] == 0)
2871 else if (
chr[0] ==
'-' &&
chr[1] == 0)
2873 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)
2879 this->interval.
start = start;
2898 _In_ const std::locale&
locale = std::locale()) :
2902 m_separator(separator)
2906 virtual bool do_match(
2907 _In_reads_or_z_opt_(end)
const T* text,
2908 _In_ size_t start = 0,
2912 _Assume_(text || start >= end);
2913 size_t i = start,
count;
2915 if (m_domain_char->match(text, i, end,
flags) &&
2916 m_domain_char->allow_on_edge)
2919 this->interval.
end = i = m_domain_char->interval.end;
2920 while (i < end && text[i]) {
2921 if (m_domain_char->allow_on_edge &&
2922 m_separator->match(text, i, end,
flags))
2926 this->interval.
end = i = m_separator->interval.end;
2928 this->interval.
end = i;
2929 i = m_separator->interval.end;
2933 if (m_domain_char->match(text, i, end,
flags)) {
2934 if (m_domain_char->allow_on_edge)
2935 this->interval.
end = i = m_domain_char->interval.end;
2937 i = m_domain_char->interval.end;
2940 this->interval.
start = start;
2949 this->interval.
start = start;
2957 std::shared_ptr<basic_dns_domain_char<T>> m_domain_char;
2958 std::shared_ptr<basic_parser<T>> m_separator;
2980 virtual bool do_match(
2981 _In_reads_or_z_opt_(end)
const T* text,
2982 _In_ size_t start = 0,
2986 _Assume_(text || start >= end);
2987 if (start < end && text[start]) {
2988 if (text[start] ==
'-' ||
2989 text[start] ==
'.' ||
2990 text[start] ==
'_' ||
2991 text[start] ==
'~' ||
2992 text[start] ==
'%' ||
2993 text[start] ==
'!' ||
2994 text[start] ==
'$' ||
2995 text[start] ==
'&' ||
2996 text[start] ==
'\'' ||
2999 text[start] ==
'*' ||
3000 text[start] ==
'+' ||
3001 text[start] ==
',' ||
3002 text[start] ==
';' ||
3003 text[start] ==
'=' ||
3004 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3006 this->interval.
end = (this->interval.
start = start) + 1;
3032 virtual bool do_match(
3033 _In_reads_or_z_(end)
const char* text,
3034 _In_ size_t start = 0,
3038 _Assume_(text || start >= end);
3039 if (start < end && text[start]) {
3043 if (((
chr[0] ==
L'-' ||
3058 chr[0] ==
L'=') &&
chr[1] == 0) ||
3061 this->interval.
start = start;
3081 virtual bool do_match(
3082 _In_reads_or_z_opt_(end)
const T* text,
3083 _In_ size_t start = 0,
3087 _Assume_(text || start >= end);
3088 if (start < end && text[start]) {
3089 if (text[start] ==
'-' ||
3090 text[start] ==
'.' ||
3091 text[start] ==
'_' ||
3092 text[start] ==
'~' ||
3093 text[start] ==
'%' ||
3094 text[start] ==
'!' ||
3095 text[start] ==
'$' ||
3096 text[start] ==
'&' ||
3097 text[start] ==
'\'' ||
3098 text[start] ==
'(' ||
3099 text[start] ==
')' ||
3100 text[start] ==
'*' ||
3101 text[start] ==
'+' ||
3102 text[start] ==
',' ||
3103 text[start] ==
';' ||
3104 text[start] ==
'=' ||
3105 text[start] ==
':' ||
3106 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3108 this->interval.
end = (this->interval.
start = start) + 1;
3134 virtual bool do_match(
3135 _In_reads_or_z_(end)
const char* text,
3136 _In_ size_t start = 0,
3140 _Assume_(text || start >= end);
3141 if (start < end && text[start]) {
3145 if (((
chr[0] ==
L'-' ||
3161 chr[0] ==
L':') &&
chr[1] == 0) ||
3164 this->interval.
start = start;
3183 virtual bool do_match(
3184 _In_reads_or_z_opt_(end)
const T* text,
3185 _In_ size_t start = 0,
3189 _Assume_(text || start >= end);
3190 if (start < end && text[start]) {
3191 if (text[start] ==
'/' ||
3192 text[start] ==
'-' ||
3193 text[start] ==
'.' ||
3194 text[start] ==
'_' ||
3195 text[start] ==
'~' ||
3196 text[start] ==
'%' ||
3197 text[start] ==
'!' ||
3198 text[start] ==
'$' ||
3199 text[start] ==
'&' ||
3200 text[start] ==
'\'' ||
3201 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 std::use_facet<std::ctype<T>>(this->m_locale).
is(std::ctype_base::alnum, text[start]))
3214 this->interval.
end = (this->interval.
start = start) + 1;
3240 virtual bool do_match(
3241 _In_reads_or_z_(end)
const char* text,
3242 _In_ size_t start = 0,
3246 _Assume_(text || start >= end);
3247 if (start < end && text[start]) {
3251 if (((
chr[0] ==
L'/' ||
3271 chr[0] ==
L'#') &&
chr[1] == 0) ||
3274 this->interval.
start = start;
3294 _In_ const std::locale&
locale = std::locale()) :
3301 virtual void invalidate()
3317 virtual bool do_match(
3318 _In_reads_or_z_opt_(end)
const T* text,
3319 _In_ size_t start = 0,
3323 _Assume_(text || start >= end);
3325 this->interval.
end = start;
3336 path.
end = this->interval.
end;
3337 query.
start = this->interval.
end = m_query_start->interval.end;
3340 query.
end = this->interval.
end;
3344 query.
end = this->interval.
end;
3345 bookmark.
start = this->interval.
end = m_bookmark_start->interval.end;
3348 bookmark.
end = this->interval.
end;
3352 this->interval.
end = m_path_char->interval.end;
3354 bookmark.
end = this->interval.
end;
3358 this->interval.
start = start;
3362 this->interval.
end = m_path_char->interval.end;
3364 query.
end = this->interval.
end;
3368 this->interval.
start = start;
3372 path.
end = this->interval.
end;
3373 bookmark.
start = this->interval.
end = m_bookmark_start->interval.end;
3376 bookmark.
end = this->interval.
end;
3380 this->interval.
end = m_path_char->interval.end;
3382 bookmark.
end = this->interval.
end;
3386 this->interval.
start = start;
3390 this->interval.
end = m_path_char->interval.end;
3396 path.
end = this->interval.
end;
3397 this->interval.
start = start;
3409 std::shared_ptr<basic_parser<T>> m_path_char;
3410 std::shared_ptr<basic_parser<T>> m_query_start;
3411 std::shared_ptr<basic_parser<T>> m_bookmark_start;
3447 _In_ const std::locale&
locale = std::locale()) :
3467 virtual void invalidate()
3469 http_scheme->invalidate();
3470 ftp_scheme->invalidate();
3471 mailto_scheme->invalidate();
3472 file_scheme->invalidate();
3473 username->invalidate();
3474 password->invalidate();
3475 ipv4_host->invalidate();
3476 ipv6_host->invalidate();
3477 dns_host->invalidate();
3483 std::shared_ptr<basic_parser<T>> http_scheme;
3484 std::shared_ptr<basic_parser<T>> ftp_scheme;
3485 std::shared_ptr<basic_parser<T>> mailto_scheme;
3486 std::shared_ptr<basic_parser<T>> file_scheme;
3487 std::shared_ptr<basic_parser<T>> username;
3488 std::shared_ptr<basic_parser<T>> password;
3489 std::shared_ptr<basic_parser<T>> ipv4_host;
3490 std::shared_ptr<basic_parser<T>> ipv6_host;
3491 std::shared_ptr<basic_parser<T>> dns_host;
3492 std::shared_ptr<basic_parser<T>> port;
3493 std::shared_ptr<basic_parser<T>> path;
3496 virtual bool do_match(
3497 _In_reads_or_z_opt_(end)
const T* text,
3498 _In_ size_t start = 0,
3502 _Assume_(text || start >= end);
3504 this->interval.
end = start;
3507 m_colon->match(text, http_scheme->interval.end, end,
flags) &&
3508 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3509 m_slash->match(text, m_slash->interval.end, end,
flags))
3512 this->interval.
end = m_slash->interval.end;
3513 ftp_scheme->invalidate();
3514 mailto_scheme->invalidate();
3515 file_scheme->invalidate();
3518 m_colon->match(text, ftp_scheme->interval.end, end,
flags) &&
3519 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3520 m_slash->match(text, m_slash->interval.end, end,
flags))
3523 this->interval.
end = m_slash->interval.end;
3524 http_scheme->invalidate();
3525 mailto_scheme->invalidate();
3526 file_scheme->invalidate();
3529 m_colon->match(text, mailto_scheme->interval.end, end,
flags))
3532 this->interval.
end = m_colon->interval.end;
3533 http_scheme->invalidate();
3534 ftp_scheme->invalidate();
3535 file_scheme->invalidate();
3538 m_colon->match(text, file_scheme->interval.end, end,
flags) &&
3539 m_slash->match(text, m_colon->interval.end, end,
flags) &&
3540 m_slash->match(text, m_slash->interval.end, end,
flags))
3543 this->interval.
end = m_slash->interval.end;
3544 http_scheme->invalidate();
3545 ftp_scheme->invalidate();
3546 mailto_scheme->invalidate();
3550 http_scheme->invalidate();
3551 ftp_scheme->invalidate();
3552 mailto_scheme->invalidate();
3553 file_scheme->invalidate();
3556 if (ftp_scheme->interval) {
3558 if (m_colon->match(text, username->interval.end, end,
flags) &&
3559 password->match(text, m_colon->interval.end, end,
flags) &&
3560 m_at->match(text, password->interval.end, end,
flags))
3563 this->interval.
end = m_at->interval.end;
3567 this->interval.
end = m_at->interval.end;
3568 password->invalidate();
3571 username->invalidate();
3572 password->invalidate();
3576 username->invalidate();
3577 password->invalidate();
3582 this->interval.
end = ipv4_host->interval.end;
3583 ipv6_host->invalidate();
3584 dns_host->invalidate();
3588 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3589 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3592 this->interval.
end = m_ip_rbracket->interval.end;
3593 ipv4_host->invalidate();
3594 dns_host->invalidate();
3598 this->interval.
end = dns_host->interval.end;
3599 ipv4_host->invalidate();
3600 ipv6_host->invalidate();
3608 port->match(text, m_colon->interval.end, end,
flags))
3611 this->interval.
end = port->interval.end;
3618 this->interval.
end = path->interval.end;
3621 this->interval.
start = start;
3625 if (mailto_scheme->interval) {
3627 m_at->match(text, username->interval.end, end,
flags))
3630 this->interval.
end = m_at->interval.end;
3638 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3639 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3642 this->interval.
end = m_ip_rbracket->interval.end;
3643 ipv6_host->invalidate();
3644 dns_host->invalidate();
3648 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3649 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3652 this->interval.
end = m_ip_rbracket->interval.end;
3653 ipv4_host->invalidate();
3654 dns_host->invalidate();
3658 this->interval.
end = dns_host->interval.end;
3659 ipv4_host->invalidate();
3660 ipv6_host->invalidate();
3667 password->invalidate();
3670 this->interval.
start = start;
3674 if (file_scheme->interval) {
3677 this->interval.
end = path->interval.end;
3680 username->invalidate();
3681 password->invalidate();
3682 ipv4_host->invalidate();
3683 ipv6_host->invalidate();
3684 dns_host->invalidate();
3686 this->interval.
start = start;
3693 if (http_scheme->interval &&
3696 if (m_colon->match(text, username->interval.end, end,
flags) &&
3697 password->match(text, m_colon->interval.end, end,
flags) &&
3698 m_at->match(text, password->interval.end, end,
flags))
3701 this->interval.
end = m_at->interval.end;
3703 else if (m_at->match(text, username->interval.end, end,
flags)) {
3705 this->interval.
end = m_at->interval.end;
3706 password->invalidate();
3709 username->invalidate();
3710 password->invalidate();
3714 username->invalidate();
3715 password->invalidate();
3720 this->interval.
end = ipv4_host->interval.end;
3721 ipv6_host->invalidate();
3722 dns_host->invalidate();
3726 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3727 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3730 this->interval.
end = m_ip_rbracket->interval.end;
3731 ipv4_host->invalidate();
3732 dns_host->invalidate();
3736 this->interval.
end = dns_host->interval.end;
3737 ipv4_host->invalidate();
3738 ipv6_host->invalidate();
3746 port->match(text, m_colon->interval.end, end,
flags))
3749 this->interval.
end = port->interval.end;
3756 this->interval.
end = path->interval.end;
3759 this->interval.
start = start;
3763 std::shared_ptr<basic_parser<T>> m_colon;
3764 std::shared_ptr<basic_parser<T>> m_slash;
3765 std::shared_ptr<basic_parser<T>> m_at;
3766 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3767 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3794 _In_ const std::locale&
locale = std::locale()) :
3805 virtual void invalidate()
3807 username->invalidate();
3808 ipv4_host->invalidate();
3809 ipv6_host->invalidate();
3810 dns_host->invalidate();
3814 std::shared_ptr<basic_parser<T>> username;
3815 std::shared_ptr<basic_parser<T>> ipv4_host;
3816 std::shared_ptr<basic_parser<T>> ipv6_host;
3817 std::shared_ptr<basic_parser<T>> dns_host;
3820 virtual bool do_match(
3821 _In_reads_or_z_opt_(end)
const T* text,
3822 _In_ size_t start = 0,
3826 _Assume_(text || start >= end);
3828 if (username->match(text, start, end,
flags) &&
3829 m_at->match(text, username->interval.end, end,
flags))
3832 if (m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3833 ipv4_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3834 m_ip_rbracket->match(text, ipv4_host->interval.end, end,
flags))
3837 this->interval.
end = m_ip_rbracket->interval.end;
3838 ipv6_host->invalidate();
3839 dns_host->invalidate();
3842 m_ip_lbracket->match(text, m_at->interval.end, end,
flags) &&
3843 ipv6_host->match(text, m_ip_lbracket->interval.end, end,
flags) &&
3844 m_ip_rbracket->match(text, ipv6_host->interval.end, end,
flags))
3847 this->interval.
end = m_ip_rbracket->interval.end;
3848 ipv4_host->invalidate();
3849 dns_host->invalidate();
3851 else if (dns_host->match(text, m_at->interval.end, end,
flags)) {
3853 this->interval.
end = dns_host->interval.end;
3854 ipv4_host->invalidate();
3855 ipv6_host->invalidate();
3859 this->interval.
start = start;
3868 std::shared_ptr<basic_parser<T>> m_at;
3869 std::shared_ptr<basic_parser<T>> m_ip_lbracket;
3870 std::shared_ptr<basic_parser<T>> m_ip_rbracket;
3895 _In_ const std::locale&
locale = std::locale()) :
3904 virtual void invalidate()
3910 mouth->invalidate();
3915 std::shared_ptr<basic_parser<T>>
apex;
3916 std::shared_ptr<basic_parser<T>>
eyes;
3917 std::shared_ptr<basic_parser<T>>
nose;
3921 virtual bool do_match(
3922 _In_reads_or_z_opt_(end)
const T* text,
3923 _In_ size_t start = 0,
3927 _Assume_(text || start >= end);
3933 mouth->invalidate();
3934 this->interval.
start = start;
3939 this->interval.
end = start;
3942 this->interval.
end =
apex->interval.end;
3950 hit_offset =
mouth->hit_offset;
3952 for (this->interval.
end =
mouth->interval.end;
mouth->match(text, this->interval.
end, end,
flags) &&
mouth->hit_offset == hit_offset; this->interval.
end =
mouth->interval.end);
3955 this->interval.
start = start;
3961 hit_offset =
mouth->hit_offset;
3963 for (this->interval.
end =
mouth->interval.end;
mouth->match(text, this->interval.
end, end,
flags) &&
mouth->hit_offset == hit_offset; this->interval.
end =
mouth->interval.end);
3967 this->interval.
start = start;
3976 mouth->invalidate();
3982 using emoticon = basic_emoticon<char>;
3983 using wemoticon = basic_emoticon<wchar_t>;
3985 using temoticon = wemoticon;
3987 using temoticon = emoticon;
3989 using sgml_emoticon = basic_emoticon<char>;
3994 enum date_format_t {
3995 date_format_none = 0,
3996 date_format_dmy = 0x1,
3997 date_format_mdy = 0x2,
3998 date_format_ymd = 0x4,
3999 date_format_ym = 0x8,
4000 date_format_my = 0x10,
4001 date_format_dm = 0x20,
4002 date_format_md = 0x40,
4019 _In_ const std::locale&
locale = std::locale()) :
4021 format(date_format_none),
4026 m_separator(separator),
4030 virtual void invalidate()
4032 if (day) day->invalidate();
4033 if (month) month->invalidate();
4034 if (year) year->invalidate();
4035 format = date_format_none;
4039 date_format_t format;
4040 std::shared_ptr<basic_integer<T>> day;
4041 std::shared_ptr<basic_integer<T>> month;
4042 std::shared_ptr<basic_integer<T>> year;
4045 virtual bool do_match(
4046 _In_reads_or_z_opt_(end)
const T* text,
4047 _In_ size_t start = 0,
4051 _Assume_(text || start >= end);
4054 if ((m_format_mask & date_format_dmy) == date_format_dmy) {
4055 if (day->match(text, start, end,
flags)) {
4056 for (this->interval.
end = day->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4058 size_t hit_offset = m_separator->hit_offset;
4059 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4061 for (this->interval.
end = month->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4063 m_separator->hit_offset == hit_offset)
4065 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4067 is_valid(day->value, month->value))
4069 this->interval.
start = start;
4070 this->interval.
end = year->interval.end;
4071 format = date_format_dmy;
4080 if ((m_format_mask & date_format_mdy) == date_format_mdy) {
4081 if (month->match(text, start, end,
flags)) {
4082 for (this->interval.
end = month->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4084 size_t hit_offset = m_separator->hit_offset;
4085 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4087 for (this->interval.
end = day->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4089 m_separator->hit_offset == hit_offset)
4091 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4093 is_valid(day->value, month->value))
4095 this->interval.
start = start;
4096 this->interval.
end = year->interval.end;
4097 format = date_format_mdy;
4106 if ((m_format_mask & date_format_ymd) == date_format_ymd) {
4107 if (year->match(text, start, end,
flags)) {
4108 for (this->interval.
end = year->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4110 size_t hit_offset = m_separator->hit_offset;
4111 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4113 for (this->interval.
end = month->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4115 m_separator->hit_offset == hit_offset)
4117 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4119 is_valid(day->value, month->value))
4121 this->interval.
start = start;
4122 this->interval.
end = day->interval.end;
4123 format = date_format_ymd;
4132 if ((m_format_mask & date_format_ym) == date_format_ym) {
4133 if (year->match(text, start, end,
flags)) {
4134 for (this->interval.
end = year->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4136 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4140 if (day) day->invalidate();
4141 this->interval.
start = start;
4142 this->interval.
end = month->interval.end;
4143 format = date_format_ym;
4150 if ((m_format_mask & date_format_my) == date_format_my) {
4151 if (month->match(text, start, end,
flags)) {
4152 for (this->interval.
end = month->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4154 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4158 if (day) day->invalidate();
4159 this->interval.
start = start;
4160 this->interval.
end = year->interval.end;
4161 format = date_format_my;
4168 if ((m_format_mask & date_format_dm) == date_format_dm) {
4169 if (day->match(text, start, end,
flags)) {
4170 for (this->interval.
end = day->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4172 size_t hit_offset = m_separator->hit_offset;
4173 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4175 is_valid(day->value, month->value))
4177 if (year) year->invalidate();
4178 this->interval.
start = start;
4179 for (this->interval.
end = month->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4181 m_separator->hit_offset == hit_offset)
4182 this->interval.
end = m_separator->interval.end;
4184 this->interval.
end = month->interval.end;
4185 format = date_format_dm;
4192 if ((m_format_mask & date_format_md) == date_format_md) {
4193 if (month->match(text, start, end,
flags)) {
4194 for (this->interval.
end = month->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4196 size_t hit_offset = m_separator->hit_offset;
4197 for (this->interval.
end = m_separator->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4199 is_valid(day->value, month->value))
4201 if (year) year->invalidate();
4202 this->interval.
start = start;
4203 for (this->interval.
end = day->interval.end; m_space->match(text, this->interval.
end, end,
space_match_flags); this->interval.
end = m_space->interval.end);
4205 m_separator->hit_offset == hit_offset)
4206 this->interval.
end = m_separator->interval.end;
4208 this->interval.
end = day->interval.end;
4209 format = date_format_md;
4216 if (day) day->invalidate();
4217 if (month) month->invalidate();
4218 if (year) year->invalidate();
4219 format = date_format_none;
4224 static bool is_valid(
size_t day,
size_t month)
4243 return 1 <= day && day <= 31;
4245 return 1 <= day && day <= 29;
4250 return 1 <= day && day <= 30;
4257 std::shared_ptr<basic_set<T>> m_separator;
4258 std::shared_ptr<basic_parser<T>> m_space;
4284 _In_ const std::locale&
locale = std::locale()) :
4290 m_separator(separator),
4294 virtual void invalidate()
4297 minute->invalidate();
4298 if (second) second->invalidate();
4299 if (millisecond) millisecond->invalidate();
4303 std::shared_ptr<basic_integer10<T>> hour;
4304 std::shared_ptr<basic_integer10<T>> minute;
4305 std::shared_ptr<basic_integer10<T>> second;
4306 std::shared_ptr<basic_integer10<T>> millisecond;
4309 virtual bool do_match(
4310 _In_reads_or_z_opt_(end)
const T* text,
4311 _In_ size_t start = 0,
4315 _Assume_(text || start >= end);
4317 if (hour->match(text, start, end,
flags) &&
4318 m_separator->match(text, hour->interval.end, end,
flags) &&
4319 minute->match(text, m_separator->interval.end, end,
flags) &&
4323 size_t hit_offset = m_separator->hit_offset;
4324 if (m_separator->match(text, minute->interval.end, end,
flags) &&
4325 m_separator->hit_offset == hit_offset &&
4326 second && second->match(text, m_separator->interval.end, end,
flags) &&
4330 if (m_millisecond_separator && m_millisecond_separator->match(text, second->interval.end, end,
flags) &&
4331 millisecond && millisecond->match(text, m_millisecond_separator->interval.end, end,
flags) &&
4332 millisecond->value < 1000)
4335 this->interval.
end = millisecond->interval.end;
4338 if (millisecond) millisecond->invalidate();
4339 this->interval.
end = second->interval.end;
4343 if (second) second->invalidate();
4344 if (millisecond) millisecond->invalidate();
4345 this->interval.
end = minute->interval.end;
4347 this->interval.
start = start;
4352 minute->invalidate();
4353 if (second) second->invalidate();
4354 if (millisecond) millisecond->invalidate();
4359 std::shared_ptr<basic_set<T>> m_separator;
4360 std::shared_ptr<basic_parser<T>> m_millisecond_separator;
4387 _In_ const std::locale&
locale = std::locale()) :
4398 virtual void invalidate()
4400 degree->invalidate();
4401 degree_separator->invalidate();
4402 minute->invalidate();
4403 minute_separator->invalidate();
4404 if (second) second->invalidate();
4405 if (second_separator) second_separator->invalidate();
4406 if (decimal) decimal->invalidate();
4410 std::shared_ptr<basic_integer10<T>> degree;
4411 std::shared_ptr<basic_parser<T>> degree_separator;
4412 std::shared_ptr<basic_integer10<T>> minute;
4413 std::shared_ptr<basic_parser<T>> minute_separator;
4414 std::shared_ptr<basic_integer10<T>> second;
4415 std::shared_ptr<basic_parser<T>> second_separator;
4416 std::shared_ptr<basic_parser<T>> decimal;
4419 virtual bool do_match(
4420 _In_reads_or_z_opt_(end)
const T* text,
4421 _In_ size_t start = 0,
4425 _Assume_(text || start >= end);
4427 this->interval.
end = start;
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();
4456 this->interval.
end = second->interval.end;
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))
4473 this->interval.
end = decimal->interval.end;
4476 decimal->invalidate();
4477 this->interval.
start = start;
4480 if (decimal) decimal->invalidate();
4509 _In_ const std::locale&
locale = std::locale()) :
4515 m_separator(separator),
4519 virtual void invalidate()
4528 virtual bool do_match(
4529 _In_reads_or_z_opt_(end)
const T* text,
4530 _In_ size_t start = 0,
4534 _Assume_(text || start >= end);
4540 this->interval.
end = start;
4542 m_lparenthesis->invalidate();
4543 m_rparenthesis->invalidate();
4546 value.append(text + m_plus_sign->interval.start, text + m_plus_sign->interval.end);
4548 this->interval.
end = m_plus_sign->interval.end;
4552 _Assume_(text || this->interval.
end >= end);
4557 value.append(text + m_digit->interval.start, text + m_digit->interval.end);
4558 this->interval.
end = m_digit->interval.end;
4568 m_lparenthesis && !m_lparenthesis->interval &&
4569 m_rparenthesis && !m_rparenthesis->interval &&
4573 value.append(text + m_lparenthesis->interval.start, m_lparenthesis->interval.size());
4574 this->interval.
end = m_lparenthesis->interval.end;
4581 m_rparenthesis && !m_rparenthesis->interval &&
4583 m_lparenthesis->hit_offset == m_rparenthesis->hit_offset)
4586 value.append(text + m_rparenthesis->interval.start, text + m_rparenthesis->interval.end);
4587 this->interval.
end = m_rparenthesis->interval.end;
4601 this->interval.
end = m_separator->interval.end;
4610 this->interval.
end = m_space->interval.end;
4619 this->interval.
start = start;
4628 std::shared_ptr<basic_parser<T>> m_digit;
4629 std::shared_ptr<basic_parser<T>> m_plus_sign;
4630 std::shared_ptr<basic_set<T>> m_lparenthesis;
4631 std::shared_ptr<basic_set<T>> m_rparenthesis;
4632 std::shared_ptr<basic_parser<T>> m_separator;
4633 std::shared_ptr<basic_parser<T>> m_space;
4636 using phone_number = basic_phone_number<char>;
4637 using wphone_number = basic_phone_number<wchar_t>;
4639 using tphone_number = wphone_number;
4641 using tphone_number = phone_number;
4643 using sgml_phone_number = basic_phone_number<char>;
4656 _In_ const std::locale&
locale = std::locale()) :
4666 virtual void invalidate()
4681 virtual bool do_match(
4682 _In_reads_or_z_opt_(end)
const T* text,
4683 _In_ size_t start = 0,
4687 _Assume_(text || start >= end);
4688 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4696 { {
'A',
'D' }, {}, 24 },
4697 { {
'A',
'E' }, {}, 23 },
4698 { {
'A',
'L' }, {}, 28 },
4699 { {
'A',
'O' }, {}, 25 },
4700 { {
'A',
'T' }, {}, 20 },
4701 { {
'A',
'Z' }, {}, 28 },
4702 { {
'B',
'A' }, {
'3',
'9' }, 20},
4703 { {
'B',
'E' }, {}, 16 },
4704 { {
'B',
'F' }, {}, 28 },
4705 { {
'B',
'G' }, {}, 22 },
4706 { {
'B',
'H' }, {}, 22 },
4707 { {
'B',
'I' }, {}, 27 },
4708 { {
'B',
'J' }, {}, 28 },
4709 { {
'B',
'R' }, {}, 29 },
4710 { {
'B',
'Y' }, {}, 28 },
4711 { {
'C',
'F' }, {}, 27 },
4712 { {
'C',
'G' }, {}, 27 },
4713 { {
'C',
'H' }, {}, 21 },
4714 { {
'C',
'I' }, {}, 28 },
4715 { {
'C',
'M' }, {}, 27 },
4716 { {
'C',
'R' }, {}, 22 },
4717 { {
'C',
'V' }, {}, 25 },
4718 { {
'C',
'Y' }, {}, 28 },
4719 { {
'C',
'Z' }, {}, 24 },
4720 { {
'D',
'E' }, {}, 22 },
4721 { {
'D',
'J' }, {}, 27 },
4722 { {
'D',
'K' }, {}, 18 },
4723 { {
'D',
'O' }, {}, 28 },
4724 { {
'D',
'Z' }, {}, 26 },
4725 { {
'E',
'E' }, {}, 20 },
4726 { {
'E',
'G' }, {}, 29 },
4727 { {
'E',
'S' }, {}, 24 },
4728 { {
'F',
'I' }, {}, 18 },
4729 { {
'F',
'O' }, {}, 18 },
4730 { {
'F',
'R' }, {}, 27 },
4731 { {
'G',
'A' }, {}, 27 },
4732 { {
'G',
'B' }, {}, 22 },
4733 { {
'G',
'E' }, {}, 22 },
4734 { {
'G',
'I' }, {}, 23 },
4735 { {
'G',
'L' }, {}, 18 },
4736 { {
'G',
'Q' }, {}, 27 },
4737 { {
'G',
'R' }, {}, 27 },
4738 { {
'G',
'T' }, {}, 28 },
4739 { {
'G',
'W' }, {}, 25 },
4740 { {
'H',
'N' }, {}, 28 },
4741 { {
'H',
'R' }, {}, 21 },
4742 { {
'H',
'U' }, {}, 28 },
4743 { {
'I',
'E' }, {}, 22 },
4744 { {
'I',
'L' }, {}, 23 },
4745 { {
'I',
'Q' }, {}, 23 },
4746 { {
'I',
'R' }, {}, 26 },
4747 { {
'I',
'S' }, {}, 26 },
4748 { {
'I',
'T' }, {}, 27 },
4749 { {
'J',
'O' }, {}, 30 },
4750 { {
'K',
'M' }, {}, 27 },
4751 { {
'K',
'W' }, {}, 30 },
4752 { {
'K',
'Z' }, {}, 20 },
4753 { {
'L',
'B' }, {}, 28 },
4754 { {
'L',
'C' }, {}, 32 },
4755 { {
'L',
'I' }, {}, 21 },
4756 { {
'L',
'T' }, {}, 20 },
4757 { {
'L',
'U' }, {}, 20 },
4758 { {
'L',
'V' }, {}, 21 },
4759 { {
'L',
'Y' }, {}, 25 },
4760 { {
'M',
'A' }, {}, 28 },
4761 { {
'M',
'C' }, {}, 27 },
4762 { {
'M',
'D' }, {}, 24 },
4763 { {
'M',
'E' }, {
'2',
'5' }, 22 },
4764 { {
'M',
'G' }, {}, 27 },
4765 { {
'M',
'K' }, {
'0',
'7' }, 19 },
4766 { {
'M',
'L' }, {}, 28 },
4767 { {
'M',
'R' }, {
'1',
'3' }, 27},
4768 { {
'M',
'T' }, {}, 31 },
4769 { {
'M',
'U' }, {}, 30 },
4770 { {
'M',
'Z' }, {}, 25 },
4771 { {
'N',
'E' }, {}, 28 },
4772 { {
'N',
'I' }, {}, 32 },
4773 { {
'N',
'L' }, {}, 18 },
4774 { {
'N',
'O' }, {}, 15 },
4775 { {
'P',
'K' }, {}, 24 },
4776 { {
'P',
'L' }, {}, 28 },
4777 { {
'P',
'S' }, {}, 29 },
4778 { {
'P',
'T' }, {
'5',
'0' }, 25 },
4779 { {
'Q',
'A' }, {}, 29 },
4780 { {
'R',
'O' }, {}, 24 },
4781 { {
'R',
'S' }, {
'3',
'5' }, 22 },
4782 { {
'R',
'U' }, {}, 33 },
4783 { {
'S',
'A' }, {}, 24 },
4784 { {
'S',
'C' }, {}, 31 },
4785 { {
'S',
'D' }, {}, 18 },
4786 { {
'S',
'E' }, {}, 24 },
4787 { {
'S',
'I' }, {
'5',
'6' }, 19 },
4788 { {
'S',
'K' }, {}, 24 },
4789 { {
'S',
'M' }, {}, 27 },
4790 { {
'S',
'N' }, {}, 28 },
4791 { {
'S',
'T' }, {}, 25 },
4792 { {
'S',
'V' }, {}, 28 },
4793 { {
'T',
'D' }, {}, 27 },
4794 { {
'T',
'G' }, {}, 28 },
4795 { {
'T',
'L' }, {
'3',
'8' }, 23},
4796 { {
'T',
'N' }, {
'5',
'9' }, 24 },
4797 { {
'T',
'R' }, {}, 26 },
4798 { {
'U',
'A' }, {}, 29 },
4799 { {
'V',
'A' }, {}, 22 },
4800 { {
'V',
'G' }, {}, 24 },
4801 { {
'X',
'K' }, {}, 20 },
4807 this->interval.
end = start;
4808 for (
size_t i = 0; i < 2; ++i, ++this->interval.
end) {
4812 if (
chr <
'A' ||
'Z' <
chr)
4814 this->country[i] =
chr;
4819 size_t m = (
l +
r) / 2;
4821 if (
c.country[0] <
this->country[0] || (
c.country[0] ==
this->country[0] &&
c.country[1] <
this->country[1]))
4823 else if (this->country[0] <
c.country[0] || (
this->country[0] ==
c.country[0] &&
this->country[1] <
c.country[1]))
4830 this->country[2] = 0;
4832 for (
size_t i = 0; i < 2; ++i, ++this->interval.
end) {
4835 this->check_digits[i] = text[this->interval.
end];
4837 this->check_digits[2] = 0;
4848 this->interval.
end = m_space->interval.end;
4852 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
4853 this->bban[
n++] =
chr;
4854 this->interval.
end++;
4864 for (
size_t i = 0; ; ++i) {
4865 if (!this->bban[i]) {
4866 for (i = 0; i < 2; ++i) {
4867 if (
'A' <= this->country[i] && this->country[i] <=
'J') {
4871 else if (
'K' <= this->country[i] && this->country[i] <=
'T') {
4875 else if (
'U' <= this->country[i] && this->country[i] <=
'Z') {
4885 if (
'0' <= this->bban[i] && this->bban[i] <=
'9')
4887 else if (
'A' <= this->bban[i] && this->bban[i] <=
'J') {
4891 else if (
'K' <= this->bban[i] && this->bban[i] <=
'T') {
4895 else if (
'U' <= this->bban[i] && this->bban[i] <=
'Z') {
4910 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
4914 this->interval.
start = start;
4922 std::shared_ptr<basic_parser<T>> m_space;
4925 using iban = basic_iban<char>;
4926 using wiban = basic_iban<wchar_t>;
4928 using tiban = wiban;
4932 using sgml_iban = basic_iban<char>;
4945 _In_ const std::locale&
locale = std::locale()) :
4949 this->check_digits[0] = 0;
4951 this->is_valid =
false;
4954 virtual void invalidate()
4956 this->check_digits[0] = 0;
4958 this->is_valid =
false;
4967 virtual bool do_match(
4968 _In_reads_or_z_opt_(end)
const T* text,
4969 _In_ size_t start = 0,
4973 _Assume_(text || start >= end);
4974 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
4979 this->interval.
end = start;
4980 if (this->interval.
end + 1 >= end ||
4984 this->interval.
end += 2;
4986 for (
size_t i = 0; i < 2; ++i, ++this->interval.
end) {
4989 this->check_digits[i] = text[this->interval.
end];
4991 this->check_digits[2] = 0;
4995 this->interval.
end = m_space->interval.end;
4996 for (
size_t j = 0;
j < 4; ++
j) {
5000 if ((
'0' <=
chr &&
chr <=
'9') || (
'A' <=
chr &&
chr <=
'Z')) {
5003 this->reference[
n++] =
chr;
5004 this->interval.
end++;
5013 this->reference[_countof(this->reference) - 1] = 0;
5014 for (
size_t i =
n,
j = _countof(this->reference) - 1; i;)
5015 this->reference[--
j] = this->reference[--i];
5016 for (
size_t j = _countof(this->reference) - 1 -
n;
j;)
5017 this->reference[--
j] =
'0';
5022 for (
size_t i = 0; ; ++i) {
5023 if (!this->reference[i]) {
5033 if (
'0' <= this->reference[i] && this->reference[i] <=
'9')
5035 else if (
'A' <= this->reference[i] && this->reference[i] <=
'J') {
5039 else if (
'K' <= this->reference[i] && this->reference[i] <=
'T') {
5043 else if (
'U' <= this->reference[i] && this->reference[i] <=
'Z') {
5058 for (; digit_count < 9 &&
normalized[next]; ++next, ++digit_count)
5062 this->interval.
start = start;
5070 std::shared_ptr<basic_parser<T>> m_space;
5073 using creditor_reference = basic_creditor_reference<char>;
5074 using wcreditor_reference = basic_creditor_reference<wchar_t>;
5076 using tcreditor_reference = wcreditor_reference;
5078 using tcreditor_reference = creditor_reference;
5080 using sgml_creditor_reference = basic_creditor_reference<char>;
5094 virtual bool do_match(
5095 _In_reads_or_z_opt_(end)
const T* text,
5096 _In_ size_t start = 0,
5100 _Assume_(text || start >= end);
5101 this->interval.
end = start;
5106 this->interval.
end++;
5111 this->interval.
start = start;
5140 virtual bool do_match(
5141 _In_reads_or_z_opt_(end)
const T* text,
5142 _In_ size_t start = 0,
5146 _Assume_(text || start >= end);
5147 if (start < end && text[start] ==
'-') {
5148 this->interval.
end = (this->interval.
start = start) + 1;
5178 _In_ const std::locale&
locale = std::locale()) :
5190 virtual void invalidate()
5193 this->
part1.invalidate();
5194 this->
part2.invalidate();
5195 this->
part3.invalidate();
5196 this->is_valid =
false;
5207 virtual bool do_match(
5208 _In_reads_or_z_opt_(end)
const T* text,
5209 _In_ size_t start = 0,
5213 _Assume_(text || start >= end);
5214 const auto&
ctype = std::use_facet<std::ctype<T>>(this->m_locale);
5217 this->interval.
end = start;
5218 if (this->interval.
end + 1 >= end ||
5222 this->interval.
end += 2;
5224 for (
size_t i = 0; i < 2; ++i, ++this->interval.
end) {
5227 this->model[i] = text[this->interval.
end];
5231 this->part1.invalidate();
5232 this->part2.invalidate();
5233 this->part3.invalidate();
5234 if (this->model[0] ==
'9' && this->model[1] ==
'9') {
5236 this->interval.
start = start;
5241 this->interval.
end = m_space->interval.end;
5243 this->part1.match(text, this->interval.
end, end,
flags) &&
5249 this->interval.
start = start;
5257 this->interval.
end = start + 4;
5259 if (this->model[0] ==
'0' && this->model[1] ==
'0')
5270 else if (this->model[0] ==
'0' && this->model[1] ==
'1')
5289 else if (this->model[0] ==
'0' && this->model[1] ==
'2')
5297 else if (this->model[0] ==
'0' && this->model[1] ==
'3')
5306 else if (this->model[0] ==
'0' && this->model[1] ==
'4')
5314 else if ((this->model[0] ==
'0' || this->model[0] ==
'5') && this->model[1] ==
'5')
5328 else if (this->model[0] ==
'0' && this->model[1] ==
'6')
5341 else if (this->model[0] ==
'0' && this->model[1] ==
'7')
5352 else if (this->model[0] ==
'0' && this->model[1] ==
'8')
5362 else if (this->model[0] ==
'0' && this->model[1] ==
'9')
5380 else if (this->model[0] ==
'1' && this->model[1] ==
'0')
5396 (this->model[0] ==
'1' && (this->model[1] ==
'1' || this->model[1] ==
'8' || this->model[1] ==
'9')) ||
5397 ((this->model[0] ==
'2' || this->model[0] ==
'3') && this->model[1] ==
'8') ||
5398 (this->model[0] ==
'4' && (this->model[1] ==
'0' || this->model[1] ==
'1' || this->model[1] ==
'8' || this->model[1] ==
'9')) ||
5399 (this->model[0] ==
'5' && (this->model[1] ==
'1' || this->model[1] ==
'8')))
5412 else if (this->model[0] ==
'1' && this->model[1] ==
'2')
5420 else if ((this->model[0] ==
'2' || this->model[0] ==
'3') && this->model[1] ==
'1')
5437 static bool check11(
5450 static bool check11(
5451 _In_count_(num_part1)
const T*
part1, _In_
size_t num_part1,
5452 _In_count_(num_part2)
const T*
part2, _In_
size_t num_part2)
5454 _Assume_(
part1 || !num_part1);
5455 _Assume_(
part2 && num_part2 >= 1);
5456 uint32_t nominator = 0, ponder = 2;
5457 for (
size_t i = num_part2 - 1; i--; ++ponder)
5458 nominator += (
part2[i] -
'0') * ponder;
5459 for (
size_t i = num_part1; i--; ++ponder)
5460 nominator += (
part1[i] -
'0') * ponder;
5461 uint8_t control = 11 -
static_cast<uint8_t
>(nominator % 11);
5464 return control ==
part2[num_part2 - 1] -
'0';
5467 static bool check11(
5468 _In_count_(num_part1)
const T*
part1, _In_
size_t num_part1,
5469 _In_count_(num_part2)
const T*
part2, _In_
size_t num_part2,
5470 _In_count_(num_part3)
const T*
part3, _In_
size_t num_part3)
5472 _Assume_(
part1 || !num_part1);
5473 _Assume_(
part2 || !num_part2);
5474 _Assume_(
part3 && num_part3 >= 1);
5475 uint32_t nominator = 0, ponder = 2;
5476 for (
size_t i = num_part3 - 1; i--; ++ponder)
5477 nominator += (
part3[i] -
'0') * ponder;
5478 for (
size_t i = num_part2; i--; ++ponder)
5479 nominator += (
part2[i] -
'0') * ponder;
5480 for (
size_t i = num_part1; i--; ++ponder)
5481 nominator += (
part1[i] -
'0') * ponder;
5482 uint8_t control = 11 -
static_cast<uint8_t
>(nominator % 11);
5485 return control ==
part2[num_part3 - 1] -
'0';
5488 std::shared_ptr<basic_parser<T>> m_space;
5489 basic_si_reference_delimiter<T> m_delimiter;
5492 using si_reference = basic_si_reference<char>;
5493 using wsi_reference = basic_si_reference<wchar_t>;
5495 using tsi_reference = wsi_reference;
5497 using tsi_reference = si_reference;
5499 using sgml_si_reference = basic_si_reference<char>;
5512 _In_ const std::locale&
locale = std::locale()) :
5521 virtual void invalidate()
5532 virtual bool do_match(
5533 _In_reads_or_z_opt_(end)
const T* text,
5534 _In_ size_t start = 0,
5538 _Assume_(text || start >= end);
5542 this->interval.
end = start;
5547 this->interval.
end = m_element->interval.end;
5549 this->interval.
end = m_digit->interval.end;
5555 this->interval.
end = m_sign->interval.end;
5558 this->interval.
start = start;
5568 std::shared_ptr<basic_parser<T>> m_element;
5569 std::shared_ptr<basic_parser<T>> m_digit;
5570 std::shared_ptr<basic_parser<T>> m_sign;
5588 virtual bool do_match(
5589 _In_reads_or_z_(end)
const char* text,
5590 _In_ size_t start = 0,
5594 _Assume_(text || start >= end);
5595 this->interval.
end = start;
5597 _Assume_(text || this->interval.
end >= end);
5599 if (text[this->interval.
end] ==
'\r') {
5600 this->interval.
end++;
5602 this->interval.
start = start;
5603 this->interval.
end++;
5607 else if (text[this->interval.
end] ==
'\n') {
5608 this->interval.
start = start;
5609 this->interval.
end++;
5624 virtual bool do_match(
5625 _In_reads_or_z_(end)
const char* text,
5626 _In_ size_t start = 0,
5630 _Assume_(text || start >= end);
5631 this->interval.
end = start;
5635 this->interval.
start = start;
5636 this->interval.
end++;
5642 this->interval.
start = start;
5643 this->interval.
end++;
5660 virtual bool do_match(
5661 _In_reads_or_z_(end)
const char* text,
5662 _In_ size_t start = 0,
5666 _Assume_(text || start >= end);
5667 this->interval.
end = start;
5669 _Assume_(text || this->interval.
end >= end);
5671 this->interval.
start = start;
5676 this->interval.
start = start;
5677 this->interval.
end++;
5693 virtual bool do_match(
5694 _In_reads_or_z_(end)
const char* text,
5695 _In_ size_t start = 0,
5699 _Assume_(text || start >= end);
5700 this->interval.
end = start;
5703 if ((
unsigned int)text[this->interval.
end] < 0x20 ||
5725 this->interval.
end++;
5731 this->interval.
start = start;
5747 virtual void invalidate()
5751 parser::invalidate();
5757 virtual bool do_match(
5758 _In_reads_or_z_(end)
const char* text,
5759 _In_ size_t start = 0,
5763 _Assume_(text || start >= end);
5764 this->interval.
end = start;
5767 this->interval.
end++;
5770 _Assume_(text || this->interval.
end >= end);
5772 if (text[this->interval.
end] ==
'"') {
5774 this->interval.
end++;
5777 else if (text[this->interval.
end] ==
'\\') {
5778 this->interval.
end++;
5780 this->interval.
end++;
5786 this->interval.
end++;
5793 this->interval.
start = start;
5810 virtual void invalidate()
5812 string.invalidate();
5814 parser::invalidate();
5821 virtual bool do_match(
5822 _In_reads_or_z_(end)
const char* text,
5823 _In_ size_t start = 0,
5827 _Assume_(text || start >= end);
5828 this->interval.
end = start;
5829 if (
string.match(text, this->interval.
end, end,
flags)) {
5831 this->interval.
end =
string.interval.end;
5832 this->interval.
start = start;
5836 string.invalidate();
5838 this->interval.
start = start;
5854 virtual void invalidate()
5858 parser::invalidate();
5865 virtual bool do_match(
5866 _In_reads_or_z_(end)
const char* text,
5867 _In_ size_t start = 0,
5871 _Assume_(text || start >= end);
5872 this->interval.
end = start;
5879 _Assume_(text || this->interval.
end >= end);
5881 this->interval.
end++;
5889 this->interval.
start = start;
5906 virtual bool do_match(
5907 _In_reads_or_z_(end)
const char* text,
5908 _In_ size_t start = 0,
5912 _Assume_(text || start >= end);
5913 if (start + 2 < end &&
5914 text[start] ==
'*' &&
5915 text[start + 1] ==
'/' &&
5916 text[start + 2] ==
'*')
5918 this->interval.
end = (this->interval.
start = start) + 3;
5921 else if (start < end && text[start] ==
'*') {
5922 this->interval.
end = (this->interval.
start = start) + 1;
5938 virtual void invalidate()
5941 subtype.invalidate();
5942 parser::invalidate();
5949 virtual bool do_match(
5950 _In_reads_or_z_(end)
const char* text,
5951 _In_ size_t start = 0,
5955 _Assume_(text || start >= end);
5956 this->interval.
end = start;
5964 this->interval.
end++;
5973 this->interval.
start = start;
5990 virtual void invalidate()
5993 http_media_range::invalidate();
5996 std::list<http_parameter> params;
5999 virtual bool do_match(
6000 _In_reads_or_z_(end)
const char* text,
6001 _In_ size_t start = 0,
6005 _Assume_(text || start >= end);
6006 if (!http_media_range::do_match(text, start, end,
flags))
6013 else if (text[this->interval.
end] ==
';') {
6014 this->interval.
end++;
6019 this->interval.
end = param.interval.end;
6020 params.push_back(std::move(param));
6031 this->interval.
end = params.empty() ? subtype.
interval.
end : params.back().interval.end;
6046 virtual bool do_match(
6047 _In_reads_or_z_(end)
const char* text,
6048 _In_ size_t start = 0,
6052 _Assume_(text || start >= end);
6053 this->interval.
end = start;
6056 if ((
unsigned int)text[this->interval.
end] < 0x20 ||
6063 this->interval.
end++;
6069 this->interval.
start = start;
6088 virtual void invalidate()
6091 parser::invalidate();
6097 virtual bool do_match(
6098 _In_reads_or_z_(end)
const char* text,
6099 _In_ size_t start = 0,
6103 _Assume_(text || start >= end);
6105 this->interval.
end = start;
6116 this->interval.
end++;
6125 this->interval.
start = start;
6139 virtual bool do_match(
6140 _In_reads_or_z_(end)
const char* text,
6141 _In_ size_t start = 0,
6145 _Assume_(text || start >= end);
6146 this->interval.
end = start;
6149 if ((
unsigned int)text[this->interval.
end] < 0x20 ||
6156 this->interval.
end++;
6161 this->interval.
start = start;
6172 virtual void invalidate()
6175 parser::invalidate();
6181 virtual bool do_match(
6182 _In_reads_or_z_(end)
const char* text,
6183 _In_ size_t start = 0,
6187 _Assume_(text || start >= end);
6189 this->interval.
end = start;
6191 _Assume_(text || this->interval.
end >= end);
6194 this->interval.
end++;
6195 s.match(text, this->interval.
end, end,
flags);
6197 this->interval.
end = s.interval.end;
6200 if (text[this->interval.
end] ==
'/') {
6201 this->interval.
end++;
6202 s.match(text, this->interval.
end, end,
flags);
6204 this->interval.
end = s.interval.end;
6212 this->interval.
start = start;
6227 virtual void invalidate()
6233 parser::invalidate();
6240 virtual bool do_match(
6241 _In_reads_or_z_(end)
const char* text,
6242 _In_ size_t start = 0,
6246 _Assume_(text || start >= end);
6247 this->interval.
end = start;
6251 if ((
unsigned int)text[this->interval.
end] < 0x20 ||
6258 this->interval.
end++;
6264 name.
end = this->interval.
end;
6267 if (text[this->interval.
end] ==
'=') {
6268 this->interval.
end++;
6272 if ((
unsigned int)text[this->interval.
end] < 0x20 ||
6278 this->interval.
end++;
6283 value.
end = this->interval.
end;
6289 this->interval.
start = start;
6309 virtual void invalidate()
6311 server.invalidate();
6315 parser::invalidate();
6321 std::list<http_url_parameter> params;
6324 virtual bool do_match(
6325 _In_reads_or_z_(end)
const char* text,
6326 _In_ size_t start = 0,
6330 _Assume_(text || start >= end);
6331 this->interval.
end = start;
6334 this->interval.
end += 7;
6340 this->interval.
end++;
6350 server.invalidate();
6363 this->interval.
end++;
6366 if ((
unsigned int)text[this->interval.
end] < 0x20 ||
6370 else if (text[this->interval.
end] ==
'&')
6371 this->interval.
end++;
6375 this->interval.
end = param.interval.end;
6376 params.push_back(std::move(param));
6387 this->interval.
start = start;
6402 virtual void invalidate()
6405 parser::invalidate();
6408 std::vector<stdex::interval<size_t>> components;
6411 virtual bool do_match(
6412 _In_reads_or_z_(end)
const char* text,
6413 _In_ size_t start = 0,
6417 _Assume_(text || start >= end);
6418 this->interval.
end = start;
6423 k.end = this->interval.
end;
6425 if (
k.end < end && text[
k.end]) {
6426 if (stdex::isalpha(text[
k.end]))
6434 if (this->interval.
end <
k.end) {
6435 k.start = this->interval.
end;
6436 this->interval.
end =
k.end;
6437 components.push_back(
k);
6442 this->interval.
end++;
6449 if (!components.empty()) {
6450 this->interval.
start = start;
6451 this->interval.
end = components.back().end;
6470 virtual void invalidate()
6473 parser::invalidate();
6479 virtual bool do_match(
6480 _In_reads_or_z_(end)
const char* text,
6481 _In_ size_t start = 0,
6485 _Assume_(text || start >= end);
6487 this->interval.
end = start;
6492 this->interval.
end++;
6494 else if (text[this->interval.
end] ==
'.') {
6495 this->interval.
end++;
6501 this->interval.
end++;
6519 this->interval.
start = start;
6534 virtual bool do_match(
6535 _In_reads_or_z_(end)
const char* text,
6536 _In_ size_t start = 0,
6540 _Assume_(text || end <= start);
6541 if (start < end && text[start] ==
'*') {
6542 this->interval.
end = (this->interval.
start = start) + 1;
6553 template <
class T,
class T_asterisk = http_asterisk>
6562 virtual void invalidate()
6564 asterisk.invalidate();
6566 factor.invalidate();
6567 parser::invalidate();
6575 virtual bool do_match(
6576 _In_reads_or_z_(end)
const char* text,
6577 _In_ size_t start = 0,
6581 _Assume_(text || start >= end);
6583 this->interval.
end = start;
6590 asterisk.invalidate();
6593 asterisk.invalidate();
6601 this->interval.
end++;
6604 this->interval.
end++;
6607 this->interval.
end++;
6615 factor.invalidate();
6618 this->interval.
start = start;
6629 virtual void invalidate()
6633 parser::invalidate();
6640 virtual bool do_match(
6641 _In_reads_or_z_(end)
const char* text,
6642 _In_ size_t start = 0,
6646 _Assume_(text || start >= end);
6647 this->interval.
end = start;
6649 this->interval.
end++;
6659 this->interval.
end++;
6668 this->interval.
start = start;
6685 virtual void invalidate()
6690 parser::invalidate();
6698 virtual bool do_match(
6699 _In_reads_or_z_(end)
const char* text,
6700 _In_ size_t start = 0,
6704 _Assume_(text || start >= end);
6705 this->interval.
end = start;
6713 this->interval.
end++;
6727 else if (text[this->interval.
end] ==
';') {
6728 this->interval.
end++;
6733 this->interval.
end = param.interval.end;
6734 params.push_back(std::move(param));
6745 this->interval.
start = start;
6763 virtual void invalidate()
6769 parser::invalidate();
6776 virtual bool do_match(
6777 _In_reads_or_z_(end)
const char* text,
6778 _In_ size_t start = 0,
6782 _Assume_(text || start >= end);
6783 this->interval.
end = start;
6787 if (text[this->interval.
end] ==
'/') {
6788 type.
end = this->interval.
end;
6789 this->interval.
end++;
6790 version.
start = this->interval.
end;
6793 if (stdex::isspace(text[this->interval.
end])) {
6794 version.
end = this->interval.
end;
6798 this->interval.
end++;
6801 version.
end = this->interval.
end;
6807 else if (stdex::isspace(text[this->interval.
end])) {
6808 type.
end = this->interval.
end;
6812 this->interval.
end++;
6815 type.
end = this->interval.
end;
6820 this->interval.
start = start;
6843 virtual void invalidate()
6847 version_maj.
start = 1;
6848 version_maj.
end = 0;
6849 version_min.
start = 1;
6850 version_min.
end = 0;
6852 parser::invalidate();
6861 virtual bool do_match(
6862 _In_reads_or_z_(end)
const char* text,
6863 _In_ size_t start = 0,
6867 _Assume_(text || start >= end);
6868 this->interval.
end = start;
6872 if (text[this->interval.
end] ==
'/') {
6873 type.
end = this->interval.
end;
6874 this->interval.
end++;
6877 else if (stdex::isspace(text[this->interval.
end]))
6880 this->interval.
end++;
6883 type.
end = this->interval.
end;
6887 version_maj.
start = this->interval.
end;
6890 if (text[this->interval.
end] ==
'.') {
6891 version_maj.
end = this->interval.
end;
6892 this->interval.
end++;
6893 version_min.
start = this->interval.
end;
6896 if (stdex::isspace(text[this->interval.
end])) {
6897 version_min.
end = this->interval.
end;
6899 (
uint16_t)strtoui(text + version_maj.
start, version_maj.
size(),
nullptr, 10) * 0x100 +
6904 this->interval.
end++;
6911 else if (stdex::isspace(text[this->interval.
end])) {
6912 version_maj.
end = this->interval.
end;
6913 version_min.
start = 1;
6914 version_min.
end = 0;
6919 this->interval.
end++;
6924 this->interval.
start = start;
6945 virtual void invalidate()
6950 protocol.invalidate();
6951 parser::invalidate();
6959 virtual bool do_match(
6960 _In_reads_or_z_(end)
const char* text,
6961 _In_ size_t start = 0,
6965 _Assume_(text || start >= end);
6966 this->interval.
end = start;
6972 if (stdex::isspace(text[this->interval.
end]))
6973 this->interval.
end++;
6985 if (stdex::isspace(text[this->interval.
end])) {
6986 verb.
end = this->interval.
end;
6987 this->interval.
end++;
6991 this->interval.
end++;
7001 if (stdex::isspace(text[this->interval.
end]))
7002 this->interval.
end++;
7014 protocol.invalidate();
7021 if (stdex::isspace(text[this->interval.
end]))
7022 this->interval.
end++;
7048 this->interval.
end++;
7054 this->interval.
start = start;
7071 virtual void invalidate()
7077 parser::invalidate();
7084 virtual bool do_match(
7085 _In_reads_or_z_(end)
const char* text,
7086 _In_ size_t start = 0,
7090 _Assume_(text || start >= end);
7091 this->interval.
end = start;
7101 if (stdex::isspace(text[this->interval.
end])) {
7102 name.
end = this->interval.
end;
7103 this->interval.
end++;
7108 if (stdex::isspace(text[this->interval.
end]))
7109 this->interval.
end++;
7117 this->interval.
end++;
7124 else if (text[this->interval.
end] ==
':') {
7125 name.
end = this->interval.
end;
7126 this->interval.
end++;
7130 this->interval.
end++;
7142 this->interval.
end++;
7147 if (stdex::isspace(text[this->interval.
end]))
7148 this->interval.
end++;
7151 value.
end = ++this->interval.
end;
7157 this->interval.
start = start;
7171 template <
class KEY,
class T>
7176 _In_reads_or_z_(end)
const char* text,
7177 _In_ size_t start = 0,
7181 while (start < end) {
7182 while (start < end && text[start] && stdex::isspace(text[start])) start++;
7183 if (start < end && text[start] ==
',') {
7185 while (start < end&& text[start] && stdex::isspace(text[start])) start++;
7188 if (
el.match(text, start, end,
flags)) {
7190 T::insert(std::move(
el));
7200 constexpr bool operator()(
const T& a,
const T& b)
const noexcept
7202 return a.factor.value > b.factor.value;
7209 template <
class T,
class AX = std::allocator<T>>
7231 _In_ const std::locale&
locale = std::locale()) :
7246 virtual void invalidate()
7252 std::basic_string<T> value;
7255 virtual bool do_match(
7256 _In_reads_or_z_opt_(end)
const T* text,
7257 _In_ size_t start = 0,
7261 _Assume_(text || start >= end);
7262 this->interval.
end = start;
7264 this->interval.
end = m_quote->interval.end;
7268 this->interval.
start = start;
7269 this->interval.
end = m_quote->interval.end;
7273 if (m_quote->match(text, m_escape->interval.end, end,
flags)) {
7274 value +=
'"'; this->interval.
end = m_quote->interval.end;
7277 if (m_sol->match(text, m_escape->interval.end, end,
flags)) {
7278 value +=
'/'; this->interval.
end = m_sol->interval.end;
7281 if (m_bs->match(text, m_escape->interval.end, end,
flags)) {
7282 value +=
'\b'; this->interval.
end = m_bs->interval.end;
7285 if (m_ff->match(text, m_escape->interval.end, end,
flags)) {
7286 value +=
'\f'; this->interval.
end = m_ff->interval.end;
7289 if (m_lf->match(text, m_escape->interval.end, end,
flags)) {
7290 value +=
'\n'; this->interval.
end = m_lf->interval.end;
7293 if (m_cr->match(text, m_escape->interval.end, end,
flags)) {
7294 value +=
'\r'; this->interval.
end = m_cr->interval.end;
7297 if (m_htab->match(text, m_escape->interval.end, end,
flags)) {
7298 value +=
'\t'; this->interval.
end = m_htab->interval.end;
7302 m_uni->match(text, m_escape->interval.end, end,
flags) &&
7303 m_hex->match(text, m_uni->interval.end, std::min(m_uni->interval.end + 4, end),
flags | match_case_insensitive) &&
7304 m_hex->interval.size() == 4 )
7306 _Assume_(m_hex->value <= 0xffff);
7307 if (
sizeof(T) == 1) {
7308 if (m_hex->value > 0x7ff) {
7309 value += (T)(0xe0 | ((m_hex->value >> 12) & 0x0f));
7310 value += (T)(0x80 | ((m_hex->value >> 6) & 0x3f));
7311 value += (T)(0x80 | (m_hex->value & 0x3f));
7313 else if (m_hex->value > 0x7f) {
7314 value += (T)(0xc0 | ((m_hex->value >> 6) & 0x1f));
7315 value += (T)(0x80 | (m_hex->value & 0x3f));
7318 value += (T)(m_hex->value & 0x7f);
7321 value += (T)m_hex->value;
7322 this->interval.
end = m_hex->interval.end;
7325 if (m_escape->match(text, m_escape->interval.end, end,
flags)) {
7326 value +=
'\\'; this->interval.
end = m_escape->interval.end;
7331 value.append(text + m_chr->interval.start, m_chr->interval.size());
7332 this->interval.
end = m_chr->interval.end;
7343 std::shared_ptr<basic_parser<T>> m_quote;
7344 std::shared_ptr<basic_parser<T>> m_chr;
7345 std::shared_ptr<basic_parser<T>> m_escape;
7346 std::shared_ptr<basic_parser<T>> m_sol;
7347 std::shared_ptr<basic_parser<T>> m_bs;
7348 std::shared_ptr<basic_parser<T>> m_ff;
7349 std::shared_ptr<basic_parser<T>> m_lf;
7350 std::shared_ptr<basic_parser<T>> m_cr;
7351 std::shared_ptr<basic_parser<T>> m_htab;
7352 std::shared_ptr<basic_parser<T>> m_uni;
7353 std::shared_ptr<basic_integer16<T>> m_hex;
7371 virtual void invalidate()
7374 basic_parser::invalidate();
7380 virtual bool do_match(
7381 _In_reads_or_z_opt_(end)
const T* text,
7382 _In_ size_t start = 0,
7386 _Unreferenced_(
flags);
7387 _Assume_(text || start + 1 >= end);
7388 if (start + 1 < end &&
7389 text[start] ==
'/' &&
7390 text[start + 1] ==
'*')
7393 this->content.
start = this->interval.
end = start + 2;
7397 if (this->interval.
end + 1 < end &&
7402 this->content.
end = this->interval.
end;
7403 this->interval.
start = start;
7404 this->interval.
end = this->interval.
end + 2;
7407 this->interval.
end++;
7416 using css_comment = basic_css_comment<char>;
7417 using wcss_comment = basic_css_comment<wchar_t>;
7419 using tcss_comment = wcss_comment;
7421 using tcss_comment = css_comment;
7431 virtual bool do_match(
7432 _In_reads_or_z_opt_(end)
const T* text,
7433 _In_ size_t start = 0,
7437 _Unreferenced_(
flags);
7438 _Assume_(text || start + 3 >= end);
7439 if (start + 3 < end &&
7440 text[start] ==
'<' &&
7441 text[start + 1] ==
'!' &&
7442 text[start + 2] ==
'-' &&
7443 text[start + 3] ==
'-')
7445 this->interval.
start = start;
7446 this->interval.
end = start + 4;
7469 virtual bool do_match(
7470 _In_reads_or_z_opt_(end)
const T* text,
7471 _In_ size_t start = 0,
7475 _Unreferenced_(
flags);
7476 _Assume_(text || start + 2 >= end);
7477 if (start + 2 < end &&
7478 text[start] ==
'-' &&
7479 text[start + 1] ==
'-' &&
7480 text[start + 2] ==
'>')
7482 this->interval.
start = start;
7483 this->interval.
end = start + 3;
7506 virtual void invalidate()
7509 basic_parser::invalidate();
7515 virtual bool do_match(
7516 _In_reads_or_z_opt_(end)
const T* text,
7517 _In_ size_t start = 0,
7521 _Unreferenced_(
flags);
7522 this->interval.
end = start;
7523 _Assume_(text || this->interval.
end >= end);
7524 if (this->interval.
end < end &&
7528 T
quote = text[this->interval.
end];
7529 this->content.
start = ++this->interval.
end;
7533 if (text[this->interval.
end] ==
quote) {
7535 this->content.
end = this->interval.
end;
7536 this->interval.
start = start;
7537 this->interval.
end++;
7540 if (this->interval.
end + 1 < end &&
7545 this->interval.
end = this->interval.
end + 2;
7548 this->interval.
end++;
7558 using css_string = basic_css_string<char>;
7559 using wcss_string = basic_css_string<wchar_t>;
7561 using tcss_string = wcss_string;
7563 using tcss_string = css_string;
7573 virtual void invalidate()
7576 basic_parser::invalidate();
7582 virtual bool do_match(
7583 _In_reads_or_z_opt_(end)
const T* text,
7584 _In_ size_t start = 0,
7588 _Unreferenced_(
flags);
7589 this->interval.
end = start;
7590 _Assume_(text || this->interval.
end + 3 >= end);
7591 if (this->interval.
end + 3 < end &&
7598 this->interval.
end = this->interval.
end + 4;
7601 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7604 if (this->interval.
end < end &&
7608 T
quote = text[this->interval.
end];
7609 this->content.
start = ++this->interval.
end;
7613 if (text[this->interval.
end] ==
quote) {
7615 this->content.
end = this->interval.
end;
7616 this->interval.
end++;
7619 if (this->interval.
end + 1 < end &&
7624 this->interval.
end = this->interval.
end + 2;
7627 this->interval.
end++;
7633 if (this->interval.
end < end &&
7637 this->interval.
start = start;
7638 this->interval.
end++;
7648 if (text[this->interval.
end] ==
')') {
7650 this->interval.
start = start;
7651 this->interval.
end++;
7655 this->interval.
end++;
7657 this->content.
end = ++this->interval.
end;
7668 using css_uri = basic_css_uri<char>;
7669 using wcss_uri = basic_css_uri<wchar_t>;
7671 using tcss_uri = wcss_uri;
7673 using tcss_uri = css_uri;
7683 virtual void invalidate()
7686 basic_parser::invalidate();
7692 virtual bool do_match(
7693 _In_reads_or_z_opt_(end)
const T* text,
7694 _In_ size_t start = 0,
7698 _Unreferenced_(
flags);
7699 this->interval.
end = start;
7700 _Assume_(text || this->interval.
end + 6 >= end);
7701 if (this->interval.
end + 6 < end &&
7711 this->interval.
end = this->interval.
end + 7;
7714 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7717 if (this->interval.
end < end &&
7721 T
quote = text[this->interval.
end];
7722 this->content.
start = ++this->interval.
end;
7726 if (text[this->interval.
end] ==
quote) {
7728 this->content.
end = this->interval.
end;
7729 this->interval.
start = start;
7730 this->interval.
end++;
7733 if (this->interval.
end + 1 < end &&
7738 this->interval.
end = this->interval.
end + 2;
7741 this->interval.
end++;
7752 using css_import = basic_css_import<char>;
7753 using wcss_import = basic_css_import<wchar_t>;
7755 using tcss_import = wcss_import;
7757 using tcss_import = css_import;
7767 virtual void invalidate()
7772 basic_parser::invalidate();
7780 virtual bool do_match(
7781 _In_reads_or_z_opt_(end)
const T* text,
7782 _In_ size_t start = 0,
7786 _Unreferenced_(
flags);
7787 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7789 this->interval.
end = start;
7790 this->base_type.
start = this->interval.
end;
7792 _Assume_(text || this->interval.
end >= end);
7795 if (text[this->interval.
end] ==
'/' ||
7799 this->interval.
end++;
7801 if (this->interval.
end <=
this->base_type.start)
7803 this->base_type.
end = this->interval.
end;
7808 this->interval.
end++;
7809 this->sub_type.
start = this->interval.
end;
7813 if (text[this->interval.
end] ==
'/' ||
7817 this->interval.
end++;
7819 if (this->interval.
end <=
this->sub_type.start)
7822 this->sub_type.
end = this->interval.
end;
7825 this->interval.
end++;
7830 if (this->interval.
end + 7 < end &&
7832 (text[this->interval.
end + 1] ==
'h' || text[this->interval.
end + 1] ==
'H') &&
7834 (text[this->interval.
end + 3] ==
'r' || text[this->interval.
end + 3] ==
'R') &&
7836 (text[this->interval.
end + 5] ==
'e' || text[this->interval.
end + 5] ==
'E') &&
7838 text[this->interval.
end + 7] ==
'=')
7840 this->interval.
end = this->interval.
end + 8;
7841 if (this->interval.
end < end &&
7845 T
quote = text[this->interval.
end];
7846 this->charset.
start = ++this->interval.
end;
7853 if (text[this->interval.
end] ==
quote) {
7855 this->charset.
end = this->interval.
end;
7856 this->interval.
end++;
7859 this->interval.
end++;
7864 this->charset.
start = this->interval.
end;
7868 this->charset.
end = this->interval.
end;
7871 this->interval.
end++;
7876 this->interval.
start = start;
7885 using mime_type = basic_mime_type<char>;
7886 using wmime_type = basic_mime_type<wchar_t>;
7888 using tmime_type = wmime_type;
7890 using tmime_type = mime_type;
7900 virtual bool do_match(
7901 _In_reads_or_z_opt_(end)
const T* text,
7902 _In_ size_t start = 0,
7906 _Unreferenced_(
flags);
7907 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7908 this->interval.
end = start;
7910 _Assume_(text || this->interval.
end >= end);
7913 this->interval.
start = start;
7919 if (text[this->interval.
end] ==
'>' ||
7924 this->interval.
start = start;
7927 this->interval.
end++;
7947 virtual void invalidate()
7950 basic_parser::invalidate();
7956 virtual bool do_match(
7957 _In_reads_or_z_opt_(end)
const T* text,
7958 _In_ size_t start = 0,
7962 _Unreferenced_(
flags);
7963 this->interval.
end = start;
7964 _Assume_(text || this->interval.
end >= end);
7965 if (this->interval.
end < end &&
7969 T
quote = text[this->interval.
end];
7970 this->content.
start = ++this->interval.
end;
7978 if (text[this->interval.
end] ==
quote) {
7980 this->content.
end = this->interval.
end;
7981 this->interval.
start = start;
7982 this->interval.
end++;
7985 this->interval.
end++;
7990 this->content.
start = this->interval.
end;
7991 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
7993 _Assume_(text || this->interval.
end >= end);
7995 this->content.
end = this->interval.
end;
7996 this->interval.
start = start;
7999 if (text[this->interval.
end] ==
'>' ||
8003 this->content.
end = this->interval.
end;
8004 this->interval.
start = start;
8007 this->interval.
end++;
8012 using html_value = basic_html_value<char>;
8013 using whtml_value = basic_html_value<wchar_t>;
8015 using thtml_value = whtml_value;
8017 using thtml_value = html_value;
8023 enum class html_sequence_t {
8054 type(html_sequence_t::unknown)
8057 virtual void invalidate()
8059 this->type = html_sequence_t::unknown;
8060 this->name.invalidate();
8062 basic_parser::invalidate();
8070 virtual bool do_match(
8071 _In_reads_or_z_opt_(end)
const T* text,
8072 _In_ size_t start = 0,
8076 _Assume_(text || start >= end);
8077 if (start >= end || text[start] !=
'<')
8079 this->interval.
end = start + 1;
8082 if (text[this->interval.
end] ==
'/' &&
8086 this->type = html_sequence_t::element_end;
8087 this->name = this->m_ident.
interval;
8090 else if (text[this->interval.
end] ==
'!') {
8092 this->interval.
end++;
8093 if (this->interval.
end + 1 < end &&
8098 this->name.
start = this->interval.
end = this->interval.
end + 2;
8102 if (this->interval.
end + 2 < end &&
8108 this->type = html_sequence_t::comment;
8109 this->name.
end = this->interval.
end;
8110 this->attributes.clear();
8111 this->interval.
start = start;
8112 this->interval.
end = this->interval.
end + 3;
8115 this->interval.
end++;
8118 this->type = html_sequence_t::declaration;
8119 this->name.
start = this->name.
end = this->interval.
end;
8121 else if (text[this->interval.
end] ==
'?') {
8123 this->name.
start = ++this->interval.
end;
8127 if (text[this->interval.
end] ==
'>') {
8129 this->type = html_sequence_t::instruction;
8130 this->name.
end = this->interval.
end;
8131 this->attributes.clear();
8132 this->interval.
start = start;
8133 this->interval.
end++;
8136 if (this->interval.
end + 1 < end &&
8141 this->type = html_sequence_t::instruction;
8142 this->name.
end = this->interval.
end;
8143 this->attributes.clear();
8144 this->interval.
start = start;
8145 this->interval.
end = this->interval.
end + 2;
8148 this->interval.
end++;
8153 this->type = html_sequence_t::element_start;
8154 this->name = this->m_ident.
interval;
8161 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8164 this->attributes.clear();
8166 if (this->type == html_sequence_t::element_start &&
8167 this->interval.
end + 1 < end &&
8172 this->type = html_sequence_t::element;
8173 this->interval.
end = this->interval.
end + 2;
8176 if (this->interval.
end < end &&
8180 this->interval.
end++;
8183 if (this->type == html_sequence_t::declaration &&
8184 this->interval.
end + 1 < end &&
8189 this->interval.
end = this->interval.
end + 2;
8192 if (this->type == html_sequence_t::declaration &&
8193 this->interval.
end + 1 < end &&
8198 this->interval.
end = this->interval.
end + 2;
8202 if (this->interval.
end + 1 < end &&
8207 this->interval.
end = this->interval.
end + 2;
8210 this->interval.
end++;
8225 a = &this->attributes.back();
8231 this->interval.
end++;
8239 this->interval.
end++;
8246 a->value = this->m_value.content;
8255 a->value.invalidate();
8259 this->interval.
start = start;
8271 using html_tag = basic_html_tag<char>;
8272 using whtml_tag = basic_html_tag<wchar_t>;
8274 using thtml_tag = whtml_tag;
8276 using thtml_tag = html_tag;
8286 virtual void invalidate()
8289 basic_parser::invalidate();
8296 _In_reads_or_z_opt_(end)
const T* text,
8297 _In_ size_t start = 0,
8301 _Unreferenced_(
flags);
8302 _Assume_(text || start + 2 >= end);
8303 if (start + 2 < end &&
8304 text[start] ==
'<' &&
8305 text[start + 1] ==
'!' &&
8306 text[start + 2] ==
'[')
8308 this->interval.
end = start + 3;
8311 const auto&
ctype = std::use_facet<std::ctype<T>>(m_locale);
8314 this->condition.
start = this->condition.
end = this->interval.
end;
8319 if (text[this->interval.
end] ==
'[') {
8320 this->interval.
start = start;
8321 this->interval.
end++;
8325 this->interval.
end++;
8327 this->condition.
end = ++this->interval.
end;
8337 using html_declaration_condition_start = basic_html_declaration_condition_start<char>;
8338 using whtml_declaration_condition_start = basic_html_declaration_condition_start<wchar_t>;
8340 using thtml_declaration_condition_start = whtml_declaration_condition_start;
8342 using thtml_declaration_condition_start = html_declaration_condition_start;
8352 virtual bool do_match(
8353 _In_reads_or_z_opt_(end)
const T* text,
8354 _In_ size_t start = 0,
8358 _Unreferenced_(
flags);
8359 _Assume_(text || start + 2 >= end);
8360 if (start + 2 < end &&
8361 text[start] ==
']' &&
8362 text[start + 1] ==
']' &&
8363 text[start + 2] ==
'>')
8365 this->interval.
start = start;
8366 this->interval.
end = start + 3;
8384#undef ENUM_FLAG_OPERATOR
locale_t helper class to free_locale when going out of scope.
Definition locale.hpp:69
Test for angle in d°mm'ss.dddd form.
Definition parser.hpp:4377
Test for any code unit.
Definition parser.hpp:232
Test for beginning of line.
Definition parser.hpp:631
Test for any.
Definition parser.hpp:1074
Test for Creditor Reference.
Definition parser.hpp:4941
T reference[22]
Normalized national reference number.
Definition parser.hpp:4963
T check_digits[3]
Two check digits.
Definition parser.hpp:4962
bool is_valid
Is reference valid per ISO 7064.
Definition parser.hpp:4964
Legacy CSS comment end -->
Definition parser.hpp:7467
Legacy CSS comment start <!--
Definition parser.hpp:7429
CSS import directive.
Definition parser.hpp:7681
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7689
CSS string.
Definition parser.hpp:7504
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7512
URI in CSS.
Definition parser.hpp:7571
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7579
Test for any code unit from a given string of code units.
Definition parser.hpp:736
Test for specific code unit.
Definition parser.hpp:304
Test for date.
Definition parser.hpp:4010
Test for valid DNS domain character.
Definition parser.hpp:2792
bool allow_on_edge
Is character allowed at the beginning or an end of a DNS domain?
Definition parser.hpp:2802
Test for DNS domain/hostname.
Definition parser.hpp:2892
bool m_allow_absolute
May DNS names end with a dot (absolute name)?
Definition parser.hpp:2956
Test for e-mail address.
Definition parser.hpp:3784
Test for emoticon.
Definition parser.hpp:3887
std::shared_ptr< basic_parser< T > > apex
apex/eyebrows/halo (e.g. O, 0)
Definition parser.hpp:3915
std::shared_ptr< basic_parser< T > > eyes
eyes (e.g. :, ;, >, |, B)
Definition parser.hpp:3916
std::shared_ptr< basic_set< T > > mouth
mouth (e.g. ), ), (, (, |, P, D, p, d)
Definition parser.hpp:3918
std::shared_ptr< basic_parser< T > > nose
nose (e.g. -, o)
Definition parser.hpp:3917
std::shared_ptr< basic_parser< T > > emoticon
emoticon as a whole (e.g. 😀, 🤔, 😶)
Definition parser.hpp:3914
Test for end of line.
Definition parser.hpp:670
Test for fraction.
Definition parser.hpp:1702
End of condition ...]]>
Definition parser.hpp:8350
Start of condition <![condition[...
Definition parser.hpp:8284
virtual bool do_match(_In_reads_or_z_opt_(end) const T *text, size_t start=0, size_t end=SIZE_MAX, int flags=match_multiline)
condition position in source
Definition parser.hpp:8295
Contiguous sequence of characters representing name of element, attribute etc.
Definition parser.hpp:7898
Tag.
Definition parser.hpp:8050
std::vector< html_attribute > attributes
tag attributes
Definition parser.hpp:8067
html_sequence_t type
tag type
Definition parser.hpp:8065
stdex::interval< size_t > name
tag name position in source
Definition parser.hpp:8066
Optionally-quoted string representing value of an attribute.
Definition parser.hpp:7945
stdex::interval< size_t > content
content position in source
Definition parser.hpp:7953
Test for International Bank Account Number.
Definition parser.hpp:4652
T bban[31]
Normalized Basic Bank Account Number.
Definition parser.hpp:4677
T country[3]
ISO 3166-1 alpha-2 country code.
Definition parser.hpp:4675
T check_digits[3]
Two check digits.
Definition parser.hpp:4676
bool is_valid
Is IBAN valid per ISO 7064.
Definition parser.hpp:4678
Test for decimal integer.
Definition parser.hpp:1312
Test for decimal integer possibly containing thousand separators.
Definition parser.hpp:1397
bool has_separators
Did integer have any separators?
Definition parser.hpp:1418
size_t digit_count
Total number of digits in integer.
Definition parser.hpp:1417
Test for hexadecimal integer.
Definition parser.hpp:1477
Base class for integer testing.
Definition parser.hpp:1290
size_t value
Calculated value of the numeral.
Definition parser.hpp:1304
Test for IPv4 address.
Definition parser.hpp:2360
stdex::interval< size_t > components[4]
Individual component intervals.
Definition parser.hpp:2405
struct in_addr value
IPv4 address value.
Definition parser.hpp:2406
Test for IPv6 address.
Definition parser.hpp:2572
std::shared_ptr< basic_parser< T > > scope_id
Scope ID (e.g. NIC index with link-local addresses)
Definition parser.hpp:2644
stdex::interval< size_t > components[8]
Individual component intervals.
Definition parser.hpp:2642
struct in6_addr value
IPv6 address value.
Definition parser.hpp:2643
Test for valid IPv6 address scope ID character.
Definition parser.hpp:2498
Test for repeating.
Definition parser.hpp:926
bool m_greedy
try to match as long sequence as possible
Definition parser.hpp:965
std::shared_ptr< basic_parser< T > > m_el
repeating element
Definition parser.hpp:962
size_t m_min_iterations
minimum number of iterations
Definition parser.hpp:963
size_t m_max_iterations
maximum number of iterations
Definition parser.hpp:964
Test for JSON string.
Definition parser.hpp:7217
MIME content type.
Definition parser.hpp:7765
stdex::interval< size_t > base_type
basic type position in source
Definition parser.hpp:7775
stdex::interval< size_t > sub_type
sub-type position in source
Definition parser.hpp:7776
stdex::interval< size_t > charset
charset position in source
Definition parser.hpp:7777
Test for mixed numeral.
Definition parser.hpp:1937
std::shared_ptr< basic_parser< T > > fraction
fraction
Definition parser.hpp:1970
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1968
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1967
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1966
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:1969
Test for monetary numeral.
Definition parser.hpp:2231
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2264
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2269
std::shared_ptr< basic_parser< T > > currency
Currency part.
Definition parser.hpp:2267
std::shared_ptr< basic_parser< T > > decimal
Decimal part.
Definition parser.hpp:2270
std::shared_ptr< basic_parser< T > > integer
Integer part.
Definition parser.hpp:2268
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2265
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2266
"No-op" match
Definition parser.hpp:200
Base template for all parsers.
Definition parser.hpp:76
stdex::interval< size_t > interval
Region of the last match.
Definition parser.hpp:116
Test for permutation.
Definition parser.hpp:1214
Test for phone number.
Definition parser.hpp:4500
std::basic_string< T > value
Normalized phone number.
Definition parser.hpp:4525
Test for any punctuation code unit.
Definition parser.hpp:477
Test for Roman numeral.
Definition parser.hpp:1586
Test for scientific numeral.
Definition parser.hpp:2062
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:2108
std::shared_ptr< basic_parser< T > > exponent_symbol
Exponent symbol (e.g. 'e')
Definition parser.hpp:2112
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:2106
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:2107
double value
Calculated value of the numeral.
Definition parser.hpp:2116
std::shared_ptr< basic_parser< T > > negative_exp_sign
Negative exponent sign (e.g. '-')
Definition parser.hpp:2114
std::shared_ptr< basic_integer< T > > decimal
Decimal part.
Definition parser.hpp:2111
std::shared_ptr< basic_parser< T > > positive_exp_sign
Positive exponent sign (e.g. '+')
Definition parser.hpp:2113
std::shared_ptr< basic_integer< T > > exponent
Exponent part.
Definition parser.hpp:2115
std::shared_ptr< basic_parser< T > > decimal_separator
Decimal separator.
Definition parser.hpp:2110
std::shared_ptr< basic_integer< T > > integer
Integer part.
Definition parser.hpp:2109
Test for match score.
Definition parser.hpp:1765
Test for sequence.
Definition parser.hpp:1022
Definition parser.hpp:705
Test for SI Reference delimiter.
Definition parser.hpp:5135
Test for SI Reference part.
Definition parser.hpp:5089
Test for SI Reference.
Definition parser.hpp:5174
basic_si_reference_part< T > part3
Reference data part 3 (P3)
Definition parser.hpp:5203
basic_si_reference_part< T > part1
Reference data part 1 (P1)
Definition parser.hpp:5201
bool is_valid
Is reference valid.
Definition parser.hpp:5204
T model[3]
Reference model.
Definition parser.hpp:5200
basic_si_reference_part< T > part2
Reference data part 2 (P2)
Definition parser.hpp:5202
Test for signed numeral.
Definition parser.hpp:1851
std::shared_ptr< basic_parser< T > > special_sign
Special sign (e.g. plus-minus '±')
Definition parser.hpp:1877
std::shared_ptr< basic_parser< T > > negative_sign
Negative sign.
Definition parser.hpp:1876
std::shared_ptr< basic_parser< T > > positive_sign
Positive sign.
Definition parser.hpp:1875
std::shared_ptr< basic_parser< T > > number
Number.
Definition parser.hpp:1878
Test for any space code unit.
Definition parser.hpp:397
Test for any space or punctuation code unit.
Definition parser.hpp:552
Test for any string.
Definition parser.hpp:1142
Test for given string.
Definition parser.hpp:831
Test for time.
Definition parser.hpp:4275
Test for valid URL password character.
Definition parser.hpp:3076
Test for valid URL path character.
Definition parser.hpp:3178
Test for URL path.
Definition parser.hpp:3288
Test for valid URL username character.
Definition parser.hpp:2975
Test for URL.
Definition parser.hpp:3428
Test for HTTP agent.
Definition parser.hpp:6761
Test for HTTP any type.
Definition parser.hpp:5904
Test for HTTP asterisk.
Definition parser.hpp:6532
Test for HTTP cookie parameter (RFC2109)
Definition parser.hpp:6627
Test for HTTP cookie (RFC2109)
Definition parser.hpp:6683
std::list< http_cookie_parameter > params
List of cookie parameters.
Definition parser.hpp:6695
http_token name
Cookie name.
Definition parser.hpp:6693
http_value value
Cookie value.
Definition parser.hpp:6694
Test for HTTP language (RFC1766)
Definition parser.hpp:6400
Test for HTTP line break (RFC2616: CRLF | LF)
Definition parser.hpp:5586
Test for HTTP parameter (RFC2616: parameter)
Definition parser.hpp:5852
http_token name
Parameter name.
Definition parser.hpp:5861
http_value value
Parameter value.
Definition parser.hpp:5862
Test for HTTP protocol.
Definition parser.hpp:6836
uint16_t version
HTTP protocol version: 0x100 = 1.0, 0x101 = 1.1...
Definition parser.hpp:6858
Test for HTTP quoted string (RFC2616: quoted-string)
Definition parser.hpp:5745
stdex::interval< size_t > content
String content (without quotes)
Definition parser.hpp:5754
Test for HTTP request.
Definition parser.hpp:6937
Test for HTTP space (RFC2616: LWS)
Definition parser.hpp:5622
Test for HTTP text character (RFC2616: TEXT)
Definition parser.hpp:5658
Test for HTTP token (RFC2616: token - tolerates non-ASCII)
Definition parser.hpp:5691
Test for HTTP URL parameter.
Definition parser.hpp:6225
Test for HTTP URL path segment.
Definition parser.hpp:6137
Test for HTTP URL path segment.
Definition parser.hpp:6170
std::vector< http_url_path_segment > segments
Path segments.
Definition parser.hpp:6178
Test for HTTP URL port.
Definition parser.hpp:6081
Test for HTTP URL server.
Definition parser.hpp:6044
Test for HTTP URL.
Definition parser.hpp:6302
Collection of HTTP values.
Definition parser.hpp:7173
Test for HTTP value (RFC2616: value)
Definition parser.hpp:5808
http_quoted_string string
Value when matched as quoted string.
Definition parser.hpp:5817
http_token token
Value when matched as token.
Definition parser.hpp:5818
Test for HTTP weight factor.
Definition parser.hpp:6463
float value
Calculated value of the weight factor.
Definition parser.hpp:6476
Test for HTTP weighted value.
Definition parser.hpp:6555
Base template for collection-holding parsers.
Definition parser.hpp:982
Test for any SGML code point.
Definition parser.hpp:265
Test for any SGML code point from a given string of SGML code points.
Definition parser.hpp:788
Test for specific SGML code point.
Definition parser.hpp:353
Test for valid DNS domain SGML character.
Definition parser.hpp:2847
Test for valid IPv6 address scope ID SGML character.
Definition parser.hpp:2537
Test for any SGML punctuation code point.
Definition parser.hpp:518
Test for any SGML space code point.
Definition parser.hpp:440
Test for any SGML space or punctuation code point.
Definition parser.hpp:595
Test for SGML given string.
Definition parser.hpp:878
Test for valid URL password SGML character.
Definition parser.hpp:3129
Test for valid URL path SGML character.
Definition parser.hpp:3235
Test for valid URL username SGML character.
Definition parser.hpp:3027
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:8040
stdex::interval< size_t > name
attribute name position in source
Definition parser.hpp:8041
stdex::interval< size_t > value
attribute value position in source
Definition parser.hpp:8042
Definition parser.hpp:7199