File indexing completed on 2025-01-18 09:51:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
0020 #define BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
0021
0022 #ifdef BOOST_MSVC
0023 #pragma warning(push)
0024 #pragma warning(disable: 4103)
0025 #endif
0026 #ifdef BOOST_HAS_ABI_HEADERS
0027 # include BOOST_ABI_PREFIX
0028 #endif
0029 #ifdef BOOST_MSVC
0030 #pragma warning(pop)
0031 #endif
0032
0033 #include <boost/regex/config.hpp>
0034 #include <boost/cstdint.hpp>
0035
0036 #include <cctype>
0037 #include <cwctype>
0038 #include <locale>
0039
0040 #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
0041 #include <boost/regex/v4/syntax_type.hpp>
0042 #endif
0043 #ifndef BOOST_REGEX_ERROR_TYPE_HPP
0044 #include <boost/regex/v4/error_type.hpp>
0045 #endif
0046 #include <boost/regex/v4/regex_workaround.hpp>
0047 #include <boost/type_traits/make_unsigned.hpp>
0048 #include <boost/utility/enable_if.hpp>
0049
0050 #ifdef BOOST_NO_STDC_NAMESPACE
0051 namespace std{
0052 using ::strlen;
0053 }
0054 #endif
0055
0056 namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
0057
0058
0059
0060
0061
0062 template <class charT>
0063 inline bool is_extended(charT c)
0064 {
0065 typedef typename make_unsigned<charT>::type unsigned_type;
0066 return (sizeof(charT) > 1) && (static_cast<unsigned_type>(c) >= 256u);
0067 }
0068 inline bool is_extended(char)
0069 { return false; }
0070
0071 inline const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n)
0072 {
0073
0074
0075 const char* messages[] = {
0076 "",
0077 "(",
0078 ")",
0079 "$",
0080 "^",
0081 ".",
0082 "*",
0083 "+",
0084 "?",
0085 "[",
0086 "]",
0087 "|",
0088 "\\",
0089 "#",
0090 "-",
0091 "{",
0092 "}",
0093 "0123456789",
0094 "b",
0095 "B",
0096 "<",
0097 ">",
0098 "",
0099 "",
0100 "A`",
0101 "z'",
0102 "\n",
0103 ",",
0104 "a",
0105 "f",
0106 "n",
0107 "r",
0108 "t",
0109 "v",
0110 "x",
0111 "c",
0112 ":",
0113 "=",
0114 "e",
0115 "",
0116 "",
0117 "",
0118 "",
0119 "",
0120 "",
0121 "",
0122 "",
0123 "E",
0124 "Q",
0125 "X",
0126 "C",
0127 "Z",
0128 "G",
0129 "!",
0130 "p",
0131 "P",
0132 "N",
0133 "gk",
0134 "K",
0135 "R",
0136 };
0137
0138 return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]);
0139 }
0140
0141 inline const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n)
0142 {
0143 static const char* const s_default_error_messages[] = {
0144 "Success",
0145 "No match",
0146 "Invalid regular expression.",
0147 "Invalid collation character.",
0148 "Invalid character class name, collating name, or character range.",
0149 "Invalid or unterminated escape sequence.",
0150 "Invalid back reference: specified capturing group does not exist.",
0151 "Unmatched [ or [^ in character class declaration.",
0152 "Unmatched marking parenthesis ( or \\(.",
0153 "Unmatched quantified repeat operator { or \\{.",
0154 "Invalid content of repeat range.",
0155 "Invalid range end in character class",
0156 "Out of memory.",
0157 "Invalid preceding regular expression prior to repetition operator.",
0158 "Premature end of regular expression",
0159 "Regular expression is too large.",
0160 "Unmatched ) or \\)",
0161 "Empty regular expression.",
0162 "The complexity of matching the regular expression exceeded predefined bounds. "
0163 "Try refactoring the regular expression to make each choice made by the state machine unambiguous. "
0164 "This exception is thrown to prevent \"eternal\" matches that take an "
0165 "indefinite period time to locate.",
0166 "Ran out of stack space trying to match the regular expression.",
0167 "Invalid or unterminated Perl (?...) sequence.",
0168 "Unknown error.",
0169 };
0170
0171 return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[::boost::regex_constants::error_unknown] : s_default_error_messages[n];
0172 }
0173
0174 inline regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c)
0175 {
0176
0177
0178
0179
0180 static regex_constants::syntax_type char_syntax[] = {
0181 regex_constants::syntax_char,
0182 regex_constants::syntax_char,
0183 regex_constants::syntax_char,
0184 regex_constants::syntax_char,
0185 regex_constants::syntax_char,
0186 regex_constants::syntax_char,
0187 regex_constants::syntax_char,
0188 regex_constants::syntax_char,
0189 regex_constants::syntax_char,
0190 regex_constants::syntax_char,
0191 regex_constants::syntax_newline,
0192 regex_constants::syntax_char,
0193 regex_constants::syntax_char,
0194 regex_constants::syntax_char,
0195 regex_constants::syntax_char,
0196 regex_constants::syntax_char,
0197 regex_constants::syntax_char,
0198 regex_constants::syntax_char,
0199 regex_constants::syntax_char,
0200 regex_constants::syntax_char,
0201 regex_constants::syntax_char,
0202 regex_constants::syntax_char,
0203 regex_constants::syntax_char,
0204 regex_constants::syntax_char,
0205 regex_constants::syntax_char,
0206 regex_constants::syntax_char,
0207 regex_constants::syntax_char,
0208 regex_constants::syntax_char,
0209 regex_constants::syntax_char,
0210 regex_constants::syntax_char,
0211 regex_constants::syntax_char,
0212 regex_constants::syntax_char,
0213 regex_constants::syntax_char,
0214 regex_constants::syntax_not,
0215 regex_constants::syntax_char,
0216 regex_constants::syntax_hash,
0217 regex_constants::syntax_dollar,
0218 regex_constants::syntax_char,
0219 regex_constants::syntax_char,
0220 regex_constants::escape_type_end_buffer,
0221 regex_constants::syntax_open_mark,
0222 regex_constants::syntax_close_mark,
0223 regex_constants::syntax_star,
0224 regex_constants::syntax_plus,
0225 regex_constants::syntax_comma,
0226 regex_constants::syntax_dash,
0227 regex_constants::syntax_dot,
0228 regex_constants::syntax_char,
0229 regex_constants::syntax_digit,
0230 regex_constants::syntax_digit,
0231 regex_constants::syntax_digit,
0232 regex_constants::syntax_digit,
0233 regex_constants::syntax_digit,
0234 regex_constants::syntax_digit,
0235 regex_constants::syntax_digit,
0236 regex_constants::syntax_digit,
0237 regex_constants::syntax_digit,
0238 regex_constants::syntax_digit,
0239 regex_constants::syntax_colon,
0240 regex_constants::syntax_char,
0241 regex_constants::escape_type_left_word,
0242 regex_constants::syntax_equal,
0243 regex_constants::escape_type_right_word,
0244 regex_constants::syntax_question,
0245 regex_constants::syntax_char,
0246 regex_constants::syntax_char,
0247 regex_constants::syntax_char,
0248 regex_constants::syntax_char,
0249 regex_constants::syntax_char,
0250 regex_constants::syntax_char,
0251 regex_constants::syntax_char,
0252 regex_constants::syntax_char,
0253 regex_constants::syntax_char,
0254 regex_constants::syntax_char,
0255 regex_constants::syntax_char,
0256 regex_constants::syntax_char,
0257 regex_constants::syntax_char,
0258 regex_constants::syntax_char,
0259 regex_constants::syntax_char,
0260 regex_constants::syntax_char,
0261 regex_constants::syntax_char,
0262 regex_constants::syntax_char,
0263 regex_constants::syntax_char,
0264 regex_constants::syntax_char,
0265 regex_constants::syntax_char,
0266 regex_constants::syntax_char,
0267 regex_constants::syntax_char,
0268 regex_constants::syntax_char,
0269 regex_constants::syntax_char,
0270 regex_constants::syntax_char,
0271 regex_constants::syntax_char,
0272 regex_constants::syntax_open_set,
0273 regex_constants::syntax_escape,
0274 regex_constants::syntax_close_set,
0275 regex_constants::syntax_caret,
0276 regex_constants::syntax_char,
0277 regex_constants::syntax_char,
0278 regex_constants::syntax_char,
0279 regex_constants::syntax_char,
0280 regex_constants::syntax_char,
0281 regex_constants::syntax_char,
0282 regex_constants::syntax_char,
0283 regex_constants::syntax_char,
0284 regex_constants::syntax_char,
0285 regex_constants::syntax_char,
0286 regex_constants::syntax_char,
0287 regex_constants::syntax_char,
0288 regex_constants::syntax_char,
0289 regex_constants::syntax_char,
0290 regex_constants::syntax_char,
0291 regex_constants::syntax_char,
0292 regex_constants::syntax_char,
0293 regex_constants::syntax_char,
0294 regex_constants::syntax_char,
0295 regex_constants::syntax_char,
0296 regex_constants::syntax_char,
0297 regex_constants::syntax_char,
0298 regex_constants::syntax_char,
0299 regex_constants::syntax_char,
0300 regex_constants::syntax_char,
0301 regex_constants::syntax_char,
0302 regex_constants::syntax_char,
0303 regex_constants::syntax_char,
0304 regex_constants::syntax_open_brace,
0305 regex_constants::syntax_or,
0306 regex_constants::syntax_close_brace,
0307 regex_constants::syntax_char,
0308 regex_constants::syntax_char,
0309 regex_constants::syntax_char,
0310 regex_constants::syntax_char,
0311 regex_constants::syntax_char,
0312 regex_constants::syntax_char,
0313 regex_constants::syntax_char,
0314 regex_constants::syntax_char,
0315 regex_constants::syntax_char,
0316 regex_constants::syntax_char,
0317 regex_constants::syntax_char,
0318 regex_constants::syntax_char,
0319 regex_constants::syntax_char,
0320 regex_constants::syntax_char,
0321 regex_constants::syntax_char,
0322 regex_constants::syntax_char,
0323 regex_constants::syntax_char,
0324 regex_constants::syntax_char,
0325 regex_constants::syntax_char,
0326 regex_constants::syntax_char,
0327 regex_constants::syntax_char,
0328 regex_constants::syntax_char,
0329 regex_constants::syntax_char,
0330 regex_constants::syntax_char,
0331 regex_constants::syntax_char,
0332 regex_constants::syntax_char,
0333 regex_constants::syntax_char,
0334 regex_constants::syntax_char,
0335 regex_constants::syntax_char,
0336 regex_constants::syntax_char,
0337 regex_constants::syntax_char,
0338 regex_constants::syntax_char,
0339 regex_constants::syntax_char,
0340 regex_constants::syntax_char,
0341 regex_constants::syntax_char,
0342 regex_constants::syntax_char,
0343 regex_constants::syntax_char,
0344 regex_constants::syntax_char,
0345 regex_constants::syntax_char,
0346 regex_constants::syntax_char,
0347 regex_constants::syntax_char,
0348 regex_constants::syntax_char,
0349 regex_constants::syntax_char,
0350 regex_constants::syntax_char,
0351 regex_constants::syntax_char,
0352 regex_constants::syntax_char,
0353 regex_constants::syntax_char,
0354 regex_constants::syntax_char,
0355 regex_constants::syntax_char,
0356 regex_constants::syntax_char,
0357 regex_constants::syntax_char,
0358 regex_constants::syntax_char,
0359 regex_constants::syntax_char,
0360 regex_constants::syntax_char,
0361 regex_constants::syntax_char,
0362 regex_constants::syntax_char,
0363 regex_constants::syntax_char,
0364 };
0365
0366 return char_syntax[(unsigned char)c];
0367 }
0368
0369 inline regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c)
0370 {
0371
0372
0373
0374
0375 static regex_constants::escape_syntax_type char_syntax[] = {
0376 regex_constants::escape_type_identity,
0377 regex_constants::escape_type_identity,
0378 regex_constants::escape_type_identity,
0379 regex_constants::escape_type_identity,
0380 regex_constants::escape_type_identity,
0381 regex_constants::escape_type_identity,
0382 regex_constants::escape_type_identity,
0383 regex_constants::escape_type_identity,
0384 regex_constants::escape_type_identity,
0385 regex_constants::escape_type_identity,
0386 regex_constants::escape_type_identity,
0387 regex_constants::escape_type_identity,
0388 regex_constants::escape_type_identity,
0389 regex_constants::escape_type_identity,
0390 regex_constants::escape_type_identity,
0391 regex_constants::escape_type_identity,
0392 regex_constants::escape_type_identity,
0393 regex_constants::escape_type_identity,
0394 regex_constants::escape_type_identity,
0395 regex_constants::escape_type_identity,
0396 regex_constants::escape_type_identity,
0397 regex_constants::escape_type_identity,
0398 regex_constants::escape_type_identity,
0399 regex_constants::escape_type_identity,
0400 regex_constants::escape_type_identity,
0401 regex_constants::escape_type_identity,
0402 regex_constants::escape_type_identity,
0403 regex_constants::escape_type_identity,
0404 regex_constants::escape_type_identity,
0405 regex_constants::escape_type_identity,
0406 regex_constants::escape_type_identity,
0407 regex_constants::escape_type_identity,
0408 regex_constants::escape_type_identity,
0409 regex_constants::escape_type_identity,
0410 regex_constants::escape_type_identity,
0411 regex_constants::escape_type_identity,
0412 regex_constants::escape_type_identity,
0413 regex_constants::escape_type_identity,
0414 regex_constants::escape_type_identity,
0415 regex_constants::escape_type_end_buffer,
0416 regex_constants::syntax_open_mark,
0417 regex_constants::syntax_close_mark,
0418 regex_constants::escape_type_identity,
0419 regex_constants::syntax_plus,
0420 regex_constants::escape_type_identity,
0421 regex_constants::escape_type_identity,
0422 regex_constants::escape_type_identity,
0423 regex_constants::escape_type_identity,
0424 regex_constants::escape_type_decimal,
0425 regex_constants::escape_type_backref,
0426 regex_constants::escape_type_backref,
0427 regex_constants::escape_type_backref,
0428 regex_constants::escape_type_backref,
0429 regex_constants::escape_type_backref,
0430 regex_constants::escape_type_backref,
0431 regex_constants::escape_type_backref,
0432 regex_constants::escape_type_backref,
0433 regex_constants::escape_type_backref,
0434 regex_constants::escape_type_identity,
0435 regex_constants::escape_type_identity,
0436 regex_constants::escape_type_left_word,
0437 regex_constants::escape_type_identity,
0438 regex_constants::escape_type_right_word,
0439 regex_constants::syntax_question,
0440 regex_constants::escape_type_identity,
0441 regex_constants::escape_type_start_buffer,
0442 regex_constants::escape_type_not_word_assert,
0443 regex_constants::escape_type_C,
0444 regex_constants::escape_type_not_class,
0445 regex_constants::escape_type_E,
0446 regex_constants::escape_type_not_class,
0447 regex_constants::escape_type_G,
0448 regex_constants::escape_type_not_class,
0449 regex_constants::escape_type_not_class,
0450 regex_constants::escape_type_not_class,
0451 regex_constants::escape_type_reset_start_mark,
0452 regex_constants::escape_type_not_class,
0453 regex_constants::escape_type_not_class,
0454 regex_constants::escape_type_named_char,
0455 regex_constants::escape_type_not_class,
0456 regex_constants::escape_type_not_property,
0457 regex_constants::escape_type_Q,
0458 regex_constants::escape_type_line_ending,
0459 regex_constants::escape_type_not_class,
0460 regex_constants::escape_type_not_class,
0461 regex_constants::escape_type_not_class,
0462 regex_constants::escape_type_not_class,
0463 regex_constants::escape_type_not_class,
0464 regex_constants::escape_type_X,
0465 regex_constants::escape_type_not_class,
0466 regex_constants::escape_type_Z,
0467 regex_constants::escape_type_identity,
0468 regex_constants::escape_type_identity,
0469 regex_constants::escape_type_identity,
0470 regex_constants::escape_type_identity,
0471 regex_constants::escape_type_identity,
0472 regex_constants::escape_type_start_buffer,
0473 regex_constants::escape_type_control_a,
0474 regex_constants::escape_type_word_assert,
0475 regex_constants::escape_type_ascii_control,
0476 regex_constants::escape_type_class,
0477 regex_constants::escape_type_e,
0478 regex_constants::escape_type_control_f,
0479 regex_constants::escape_type_extended_backref,
0480 regex_constants::escape_type_class,
0481 regex_constants::escape_type_class,
0482 regex_constants::escape_type_class,
0483 regex_constants::escape_type_extended_backref,
0484 regex_constants::escape_type_class,
0485 regex_constants::escape_type_class,
0486 regex_constants::escape_type_control_n,
0487 regex_constants::escape_type_class,
0488 regex_constants::escape_type_property,
0489 regex_constants::escape_type_class,
0490 regex_constants::escape_type_control_r,
0491 regex_constants::escape_type_class,
0492 regex_constants::escape_type_control_t,
0493 regex_constants::escape_type_class,
0494 regex_constants::escape_type_control_v,
0495 regex_constants::escape_type_class,
0496 regex_constants::escape_type_hex,
0497 regex_constants::escape_type_class,
0498 regex_constants::escape_type_end_buffer,
0499 regex_constants::syntax_open_brace,
0500 regex_constants::syntax_or,
0501 regex_constants::syntax_close_brace,
0502 regex_constants::escape_type_identity,
0503 regex_constants::escape_type_identity,
0504 regex_constants::escape_type_identity,
0505 regex_constants::escape_type_identity,
0506 regex_constants::escape_type_identity,
0507 regex_constants::escape_type_identity,
0508 regex_constants::escape_type_identity,
0509 regex_constants::escape_type_identity,
0510 regex_constants::escape_type_identity,
0511 regex_constants::escape_type_identity,
0512 regex_constants::escape_type_identity,
0513 regex_constants::escape_type_identity,
0514 regex_constants::escape_type_identity,
0515 regex_constants::escape_type_identity,
0516 regex_constants::escape_type_identity,
0517 regex_constants::escape_type_identity,
0518 regex_constants::escape_type_identity,
0519 regex_constants::escape_type_identity,
0520 regex_constants::escape_type_identity,
0521 regex_constants::escape_type_identity,
0522 regex_constants::escape_type_identity,
0523 regex_constants::escape_type_identity,
0524 regex_constants::escape_type_identity,
0525 regex_constants::escape_type_identity,
0526 regex_constants::escape_type_identity,
0527 regex_constants::escape_type_identity,
0528 regex_constants::escape_type_identity,
0529 regex_constants::escape_type_identity,
0530 regex_constants::escape_type_identity,
0531 regex_constants::escape_type_identity,
0532 regex_constants::escape_type_identity,
0533 regex_constants::escape_type_identity,
0534 regex_constants::escape_type_identity,
0535 regex_constants::escape_type_identity,
0536 regex_constants::escape_type_identity,
0537 regex_constants::escape_type_identity,
0538 regex_constants::escape_type_identity,
0539 regex_constants::escape_type_identity,
0540 regex_constants::escape_type_identity,
0541 regex_constants::escape_type_identity,
0542 regex_constants::escape_type_identity,
0543 regex_constants::escape_type_identity,
0544 regex_constants::escape_type_identity,
0545 regex_constants::escape_type_identity,
0546 regex_constants::escape_type_identity,
0547 regex_constants::escape_type_identity,
0548 regex_constants::escape_type_identity,
0549 regex_constants::escape_type_identity,
0550 regex_constants::escape_type_identity,
0551 regex_constants::escape_type_identity,
0552 regex_constants::escape_type_identity,
0553 regex_constants::escape_type_identity,
0554 regex_constants::escape_type_identity,
0555 regex_constants::escape_type_identity,
0556 regex_constants::escape_type_identity,
0557 regex_constants::escape_type_identity,
0558 regex_constants::escape_type_identity,
0559 };
0560
0561 return char_syntax[(unsigned char)c];
0562 }
0563
0564
0565 inline bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_least16_t c)
0566 {
0567 const boost::uint_least16_t combining_ranges[] = { 0x0300, 0x0361,
0568 0x0483, 0x0486,
0569 0x0903, 0x0903,
0570 0x093E, 0x0940,
0571 0x0949, 0x094C,
0572 0x0982, 0x0983,
0573 0x09BE, 0x09C0,
0574 0x09C7, 0x09CC,
0575 0x09D7, 0x09D7,
0576 0x0A3E, 0x0A40,
0577 0x0A83, 0x0A83,
0578 0x0ABE, 0x0AC0,
0579 0x0AC9, 0x0ACC,
0580 0x0B02, 0x0B03,
0581 0x0B3E, 0x0B3E,
0582 0x0B40, 0x0B40,
0583 0x0B47, 0x0B4C,
0584 0x0B57, 0x0B57,
0585 0x0B83, 0x0B83,
0586 0x0BBE, 0x0BBF,
0587 0x0BC1, 0x0BCC,
0588 0x0BD7, 0x0BD7,
0589 0x0C01, 0x0C03,
0590 0x0C41, 0x0C44,
0591 0x0C82, 0x0C83,
0592 0x0CBE, 0x0CBE,
0593 0x0CC0, 0x0CC4,
0594 0x0CC7, 0x0CCB,
0595 0x0CD5, 0x0CD6,
0596 0x0D02, 0x0D03,
0597 0x0D3E, 0x0D40,
0598 0x0D46, 0x0D4C,
0599 0x0D57, 0x0D57,
0600 0x0F7F, 0x0F7F,
0601 0x20D0, 0x20E1,
0602 0x3099, 0x309A,
0603 0xFE20, 0xFE23,
0604 0xffff, 0xffff, };
0605
0606 const boost::uint_least16_t* p = combining_ranges + 1;
0607 while (*p < c) p += 2;
0608 --p;
0609 if ((c >= *p) && (c <= *(p + 1)))
0610 return true;
0611 return false;
0612 }
0613
0614 template <class charT>
0615 inline bool is_combining(charT c)
0616 {
0617 return (c <= static_cast<charT>(0)) ? false : ((c >= static_cast<charT>((std::numeric_limits<uint_least16_t>::max)())) ? false : is_combining_implementation(static_cast<unsigned short>(c)));
0618 }
0619 template <>
0620 inline bool is_combining<char>(char)
0621 {
0622 return false;
0623 }
0624 template <>
0625 inline bool is_combining<signed char>(signed char)
0626 {
0627 return false;
0628 }
0629 template <>
0630 inline bool is_combining<unsigned char>(unsigned char)
0631 {
0632 return false;
0633 }
0634 #if !defined(__hpux) && !defined(__WINSCW__)
0635 #ifdef _MSC_VER
0636 template<>
0637 inline bool is_combining<wchar_t>(wchar_t c)
0638 {
0639 return is_combining_implementation(static_cast<unsigned short>(c));
0640 }
0641 #elif !defined(__DECCXX) && !defined(__osf__) && !defined(__OSF__) && defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
0642 #if defined(WCHAR_MAX) && (WCHAR_MAX <= USHRT_MAX)
0643 template<>
0644 inline bool is_combining<wchar_t>(wchar_t c)
0645 {
0646 return is_combining_implementation(static_cast<unsigned short>(c));
0647 }
0648 #else
0649 template<>
0650 inline bool is_combining<wchar_t>(wchar_t c)
0651 {
0652 return (c >= (std::numeric_limits<uint_least16_t>::max)()) ? false : is_combining_implementation(static_cast<unsigned short>(c));
0653 }
0654 #endif
0655 #endif
0656 #endif
0657
0658
0659
0660
0661 template <class charT>
0662 inline bool is_separator(charT c)
0663 {
0664 return BOOST_REGEX_MAKE_BOOL(
0665 (c == static_cast<charT>('\n'))
0666 || (c == static_cast<charT>('\r'))
0667 || (c == static_cast<charT>('\f'))
0668 || (static_cast<boost::uint16_t>(c) == 0x2028u)
0669 || (static_cast<boost::uint16_t>(c) == 0x2029u)
0670 || (static_cast<boost::uint16_t>(c) == 0x85u));
0671 }
0672 template <>
0673 inline bool is_separator<char>(char c)
0674 {
0675 return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r') || (c == '\f'));
0676 }
0677
0678
0679
0680
0681 inline std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name)
0682 {
0683
0684
0685
0686 static const char* def_coll_names[] = {
0687 "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline",
0688 "vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
0689 "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark",
0690 "quotation-mark", "number-sign", "dollar-sign", "percent-sign", "ampersand", "apostrophe",
0691 "left-parenthesis", "right-parenthesis", "asterisk", "plus-sign", "comma", "hyphen",
0692 "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
0693 "colon", "semicolon", "less-than-sign", "equals-sign", "greater-than-sign",
0694 "question-mark", "commercial-at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
0695 "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "left-square-bracket", "backslash",
0696 "right-square-bracket", "circumflex", "underscore", "grave-accent", "a", "b", "c", "d", "e", "f",
0697 "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "left-curly-bracket",
0698 "vertical-line", "right-curly-bracket", "tilde", "DEL", "",
0699 };
0700
0701
0702
0703
0704
0705
0706
0707 static const char* def_multi_coll[] = {
0708 "ae",
0709 "Ae",
0710 "AE",
0711 "ch",
0712 "Ch",
0713 "CH",
0714 "ll",
0715 "Ll",
0716 "LL",
0717 "ss",
0718 "Ss",
0719 "SS",
0720 "nj",
0721 "Nj",
0722 "NJ",
0723 "dz",
0724 "Dz",
0725 "DZ",
0726 "lj",
0727 "Lj",
0728 "LJ",
0729 "",
0730 };
0731
0732 unsigned int i = 0;
0733 while (*def_coll_names[i])
0734 {
0735 if (def_coll_names[i] == name)
0736 {
0737 return std::string(1, char(i));
0738 }
0739 ++i;
0740 }
0741 i = 0;
0742 while (*def_multi_coll[i])
0743 {
0744 if (def_multi_coll[i] == name)
0745 {
0746 return def_multi_coll[i];
0747 }
0748 ++i;
0749 }
0750 return std::string();
0751 }
0752
0753
0754
0755
0756
0757 template <class charT>
0758 struct character_pointer_range
0759 {
0760 const charT* p1;
0761 const charT* p2;
0762
0763 bool operator < (const character_pointer_range& r)const
0764 {
0765 return std::lexicographical_compare(p1, p2, r.p1, r.p2);
0766 }
0767 bool operator == (const character_pointer_range& r)const
0768 {
0769
0770
0771
0772
0773 return ((p2 - p1) == (r.p2 - r.p1)) && BOOST_REGEX_DETAIL_NS::equal(p1, p2, r.p1);
0774 }
0775 };
0776 template <class charT>
0777 int get_default_class_id(const charT* p1, const charT* p2)
0778 {
0779 static const charT data[73] = {
0780 'a', 'l', 'n', 'u', 'm',
0781 'a', 'l', 'p', 'h', 'a',
0782 'b', 'l', 'a', 'n', 'k',
0783 'c', 'n', 't', 'r', 'l',
0784 'd', 'i', 'g', 'i', 't',
0785 'g', 'r', 'a', 'p', 'h',
0786 'l', 'o', 'w', 'e', 'r',
0787 'p', 'r', 'i', 'n', 't',
0788 'p', 'u', 'n', 'c', 't',
0789 's', 'p', 'a', 'c', 'e',
0790 'u', 'n', 'i', 'c', 'o', 'd', 'e',
0791 'u', 'p', 'p', 'e', 'r',
0792 'v',
0793 'w', 'o', 'r', 'd',
0794 'x', 'd', 'i', 'g', 'i', 't',
0795 };
0796
0797 static const character_pointer_range<charT> ranges[21] =
0798 {
0799 {data+0, data+5,},
0800 {data+5, data+10,},
0801 {data+10, data+15,},
0802 {data+15, data+20,},
0803 {data+20, data+21,},
0804 {data+20, data+25,},
0805 {data+25, data+30,},
0806 {data+29, data+30,},
0807 {data+30, data+31,},
0808 {data+30, data+35,},
0809 {data+35, data+40,},
0810 {data+40, data+45,},
0811 {data+45, data+46,},
0812 {data+45, data+50,},
0813 {data+57, data+58,},
0814 {data+50, data+57,},
0815 {data+57, data+62,},
0816 {data+62, data+63,},
0817 {data+63, data+64,},
0818 {data+63, data+67,},
0819 {data+67, data+73,},
0820 };
0821 const character_pointer_range<charT>* ranges_begin = ranges;
0822 const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
0823
0824 character_pointer_range<charT> t = { p1, p2, };
0825 const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);
0826 if((p != ranges_end) && (t == *p))
0827 return static_cast<int>(p - ranges);
0828 return -1;
0829 }
0830
0831
0832
0833
0834 template <class charT>
0835 std::ptrdiff_t global_length(const charT* p)
0836 {
0837 std::ptrdiff_t n = 0;
0838 while(*p)
0839 {
0840 ++p;
0841 ++n;
0842 }
0843 return n;
0844 }
0845 template<>
0846 inline std::ptrdiff_t global_length<char>(const char* p)
0847 {
0848 return (std::strlen)(p);
0849 }
0850 #ifndef BOOST_NO_WREGEX
0851 template<>
0852 inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
0853 {
0854 return (std::ptrdiff_t)(std::wcslen)(p);
0855 }
0856 #endif
0857 template <class charT>
0858 inline charT BOOST_REGEX_CALL global_lower(charT c)
0859 {
0860 return c;
0861 }
0862 template <class charT>
0863 inline charT BOOST_REGEX_CALL global_upper(charT c)
0864 {
0865 return c;
0866 }
0867
0868 inline char BOOST_REGEX_CALL do_global_lower(char c)
0869 {
0870 return static_cast<char>((std::tolower)((unsigned char)c));
0871 }
0872
0873 inline char BOOST_REGEX_CALL do_global_upper(char c)
0874 {
0875 return static_cast<char>((std::toupper)((unsigned char)c));
0876 }
0877 #ifndef BOOST_NO_WREGEX
0878 inline wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c)
0879 {
0880 return (std::towlower)(c);
0881 }
0882
0883 inline wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c)
0884 {
0885 return (std::towupper)(c);
0886 }
0887 #endif
0888
0889
0890
0891
0892
0893
0894
0895
0896
0897
0898 template<> inline char BOOST_REGEX_CALL global_lower<char>(char c) { return do_global_lower(c); }
0899 template<> inline char BOOST_REGEX_CALL global_upper<char>(char c) { return do_global_upper(c); }
0900 #ifndef BOOST_NO_WREGEX
0901 template<> inline wchar_t BOOST_REGEX_CALL global_lower<wchar_t>(wchar_t c) { return do_global_lower(c); }
0902 template<> inline wchar_t BOOST_REGEX_CALL global_upper<wchar_t>(wchar_t c) { return do_global_upper(c); }
0903 #endif
0904
0905 template <class charT>
0906 int global_value(charT c)
0907 {
0908 static const charT zero = '0';
0909 static const charT nine = '9';
0910 static const charT a = 'a';
0911 static const charT f = 'f';
0912 static const charT A = 'A';
0913 static const charT F = 'F';
0914
0915 if(c > f) return -1;
0916 if(c >= a) return 10 + (c - a);
0917 if(c > F) return -1;
0918 if(c >= A) return 10 + (c - A);
0919 if(c > nine) return -1;
0920 if(c >= zero) return c - zero;
0921 return -1;
0922 }
0923 template <class charT, class traits>
0924 boost::intmax_t global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
0925 {
0926 (void)t;
0927 boost::intmax_t limit = (std::numeric_limits<boost::intmax_t>::max)() / radix;
0928 boost::intmax_t next_value = t.value(*p1, radix);
0929 if((p1 == p2) || (next_value < 0) || (next_value >= radix))
0930 return -1;
0931 boost::intmax_t result = 0;
0932 while(p1 != p2)
0933 {
0934 next_value = t.value(*p1, radix);
0935 if((next_value < 0) || (next_value >= radix))
0936 break;
0937 result *= radix;
0938 result += next_value;
0939 ++p1;
0940 if (result > limit)
0941 return -1;
0942 }
0943 return result;
0944 }
0945
0946 template <class charT>
0947 inline typename boost::enable_if_c<(sizeof(charT) > 1), const charT*>::type get_escape_R_string()
0948 {
0949 #ifdef BOOST_MSVC
0950 # pragma warning(push)
0951 # pragma warning(disable:4309 4245)
0952 #endif
0953 static const charT e1[] = { '(', '?', '-', 'x', ':', '(', '?', '>', '\x0D', '\x0A', '?',
0954 '|', '[', '\x0A', '\x0B', '\x0C', static_cast<charT>(0x85), static_cast<charT>(0x2028),
0955 static_cast<charT>(0x2029), ']', ')', ')', '\0' };
0956 static const charT e2[] = { '(', '?', '-', 'x', ':', '(', '?', '>', '\x0D', '\x0A', '?',
0957 '|', '[', '\x0A', '\x0B', '\x0C', static_cast<charT>(0x85), ']', ')', ')', '\0' };
0958
0959 charT c = static_cast<charT>(0x2029u);
0960 bool b = (static_cast<unsigned>(c) == 0x2029u);
0961
0962 return (b ? e1 : e2);
0963 #ifdef BOOST_MSVC
0964 # pragma warning(pop)
0965 #endif
0966 }
0967
0968 template <class charT>
0969 inline typename boost::disable_if_c<(sizeof(charT) > 1), const charT*>::type get_escape_R_string()
0970 {
0971 #ifdef BOOST_MSVC
0972 # pragma warning(push)
0973 # pragma warning(disable:4309)
0974 #endif
0975 static const charT e2[] = { '(', '?', '-', 'x', ':', '(', '?', '>', '\x0D', '\x0A', '?',
0976 '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', ')', '\0' };
0977 return e2;
0978 #ifdef BOOST_MSVC
0979 # pragma warning(pop)
0980 #endif
0981 }
0982
0983 }
0984 }
0985
0986 #ifdef BOOST_MSVC
0987 #pragma warning(push)
0988 #pragma warning(disable: 4103)
0989 #endif
0990 #ifdef BOOST_HAS_ABI_HEADERS
0991 # include BOOST_ABI_SUFFIX
0992 #endif
0993 #ifdef BOOST_MSVC
0994 #pragma warning(pop)
0995 #endif
0996
0997 #endif