Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:26

0001 /*
0002  *
0003  * Copyright (c) 2004
0004  * John Maddock
0005  *
0006  * Use, modification and distribution are subject to the
0007  * Boost Software License, Version 1.0. (See accompanying file
0008  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009  *
0010  */
0011 
0012  /*
0013   *   LOCATION:    see http://www.boost.org for most recent version.
0014   *   FILE         regex_traits_defaults.hpp
0015   *   VERSION      see <boost/version.hpp>
0016   *   DESCRIPTION: Declares API's for access to regex_traits default properties.
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 // helpers to suppress warnings:
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    // if the user hasn't supplied a message catalog, then this supplies
0074    // default "messages" for us to load in the range 1-100.
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",                                                            /* REG_NOERROR 0 error_ok */
0145       "No match",                                                           /* REG_NOMATCH 1 error_no_match */
0146       "Invalid regular expression.",                                        /* REG_BADPAT 2 error_bad_pattern */
0147       "Invalid collation character.",                                       /* REG_ECOLLATE 3 error_collate */
0148       "Invalid character class name, collating name, or character range.",  /* REG_ECTYPE 4 error_ctype */
0149       "Invalid or unterminated escape sequence.",                           /* REG_EESCAPE 5 error_escape */
0150       "Invalid back reference: specified capturing group does not exist.",  /* REG_ESUBREG 6 error_backref */
0151       "Unmatched [ or [^ in character class declaration.",                  /* REG_EBRACK 7 error_brack */
0152       "Unmatched marking parenthesis ( or \\(.",                            /* REG_EPAREN 8 error_paren */
0153       "Unmatched quantified repeat operator { or \\{.",                     /* REG_EBRACE 9 error_brace */
0154       "Invalid content of repeat range.",                                   /* REG_BADBR 10 error_badbrace */
0155       "Invalid range end in character class",                               /* REG_ERANGE 11 error_range */
0156       "Out of memory.",                                                     /* REG_ESPACE 12 error_space NOT USED */
0157       "Invalid preceding regular expression prior to repetition operator.", /* REG_BADRPT 13 error_badrepeat */
0158       "Premature end of regular expression",                                /* REG_EEND 14 error_end NOT USED */
0159       "Regular expression is too large.",                                   /* REG_ESIZE 15 error_size NOT USED */
0160       "Unmatched ) or \\)",                                                 /* REG_ERPAREN 16 error_right_paren NOT USED */
0161       "Empty regular expression.",                                          /* REG_EMPTY 17 error_empty */
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.",                                  /* REG_ECOMPLEXITY 18 error_complexity */
0166       "Ran out of stack space trying to match the regular expression.",     /* REG_ESTACK 19 error_stack */
0167       "Invalid or unterminated Perl (?...) sequence.",                      /* REG_E_PERL 20 error_perl */
0168       "Unknown error.",                                                     /* REG_E_UNKNOWN 21 error_unknown */
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    // char_syntax determines how the compiler treats a given character
0178    // in a regular expression.
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,        /* */    // 32
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,        /*0*/
0230       regex_constants::syntax_digit,        /*1*/
0231       regex_constants::syntax_digit,        /*2*/
0232       regex_constants::syntax_digit,        /*3*/
0233       regex_constants::syntax_digit,        /*4*/
0234       regex_constants::syntax_digit,        /*5*/
0235       regex_constants::syntax_digit,        /*6*/
0236       regex_constants::syntax_digit,        /*7*/
0237       regex_constants::syntax_digit,        /*8*/
0238       regex_constants::syntax_digit,        /*9*/
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,        /*A*/
0247       regex_constants::syntax_char,        /*B*/
0248       regex_constants::syntax_char,        /*C*/
0249       regex_constants::syntax_char,        /*D*/
0250       regex_constants::syntax_char,        /*E*/
0251       regex_constants::syntax_char,        /*F*/
0252       regex_constants::syntax_char,        /*G*/
0253       regex_constants::syntax_char,        /*H*/
0254       regex_constants::syntax_char,        /*I*/
0255       regex_constants::syntax_char,        /*J*/
0256       regex_constants::syntax_char,        /*K*/
0257       regex_constants::syntax_char,        /*L*/
0258       regex_constants::syntax_char,        /*M*/
0259       regex_constants::syntax_char,        /*N*/
0260       regex_constants::syntax_char,        /*O*/
0261       regex_constants::syntax_char,        /*P*/
0262       regex_constants::syntax_char,        /*Q*/
0263       regex_constants::syntax_char,        /*R*/
0264       regex_constants::syntax_char,        /*S*/
0265       regex_constants::syntax_char,        /*T*/
0266       regex_constants::syntax_char,        /*U*/
0267       regex_constants::syntax_char,        /*V*/
0268       regex_constants::syntax_char,        /*W*/
0269       regex_constants::syntax_char,        /*X*/
0270       regex_constants::syntax_char,        /*Y*/
0271       regex_constants::syntax_char,        /*Z*/
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,        /*a*/
0279       regex_constants::syntax_char,        /*b*/
0280       regex_constants::syntax_char,        /*c*/
0281       regex_constants::syntax_char,        /*d*/
0282       regex_constants::syntax_char,        /*e*/
0283       regex_constants::syntax_char,        /*f*/
0284       regex_constants::syntax_char,        /*g*/
0285       regex_constants::syntax_char,        /*h*/
0286       regex_constants::syntax_char,        /*i*/
0287       regex_constants::syntax_char,        /*j*/
0288       regex_constants::syntax_char,        /*k*/
0289       regex_constants::syntax_char,        /*l*/
0290       regex_constants::syntax_char,        /*m*/
0291       regex_constants::syntax_char,        /*n*/
0292       regex_constants::syntax_char,        /*o*/
0293       regex_constants::syntax_char,        /*p*/
0294       regex_constants::syntax_char,        /*q*/
0295       regex_constants::syntax_char,        /*r*/
0296       regex_constants::syntax_char,        /*s*/
0297       regex_constants::syntax_char,        /*t*/
0298       regex_constants::syntax_char,        /*u*/
0299       regex_constants::syntax_char,        /*v*/
0300       regex_constants::syntax_char,        /*w*/
0301       regex_constants::syntax_char,        /*x*/
0302       regex_constants::syntax_char,        /*y*/
0303       regex_constants::syntax_char,        /*z*/
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    // char_syntax determines how the compiler treats a given character
0373    // in a regular expression.
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,        /* */    // 32
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,        /*0*/
0425       regex_constants::escape_type_backref,        /*1*/
0426       regex_constants::escape_type_backref,        /*2*/
0427       regex_constants::escape_type_backref,        /*3*/
0428       regex_constants::escape_type_backref,        /*4*/
0429       regex_constants::escape_type_backref,        /*5*/
0430       regex_constants::escape_type_backref,        /*6*/
0431       regex_constants::escape_type_backref,        /*7*/
0432       regex_constants::escape_type_backref,        /*8*/
0433       regex_constants::escape_type_backref,        /*9*/
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,     /*A*/
0442       regex_constants::escape_type_not_word_assert,  /*B*/
0443       regex_constants::escape_type_C,                /*C*/
0444       regex_constants::escape_type_not_class,        /*D*/
0445       regex_constants::escape_type_E,                /*E*/
0446       regex_constants::escape_type_not_class,        /*F*/
0447       regex_constants::escape_type_G,                /*G*/
0448       regex_constants::escape_type_not_class,        /*H*/
0449       regex_constants::escape_type_not_class,        /*I*/
0450       regex_constants::escape_type_not_class,        /*J*/
0451       regex_constants::escape_type_reset_start_mark, /*K*/
0452       regex_constants::escape_type_not_class,        /*L*/
0453       regex_constants::escape_type_not_class,        /*M*/
0454       regex_constants::escape_type_named_char,       /*N*/
0455       regex_constants::escape_type_not_class,        /*O*/
0456       regex_constants::escape_type_not_property,     /*P*/
0457       regex_constants::escape_type_Q,                /*Q*/
0458       regex_constants::escape_type_line_ending,      /*R*/
0459       regex_constants::escape_type_not_class,        /*S*/
0460       regex_constants::escape_type_not_class,        /*T*/
0461       regex_constants::escape_type_not_class,        /*U*/
0462       regex_constants::escape_type_not_class,        /*V*/
0463       regex_constants::escape_type_not_class,        /*W*/
0464       regex_constants::escape_type_X,                /*X*/
0465       regex_constants::escape_type_not_class,        /*Y*/
0466       regex_constants::escape_type_Z,                /*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,        /*a*/
0474       regex_constants::escape_type_word_assert,        /*b*/
0475       regex_constants::escape_type_ascii_control,        /*c*/
0476       regex_constants::escape_type_class,        /*d*/
0477       regex_constants::escape_type_e,        /*e*/
0478       regex_constants::escape_type_control_f,       /*f*/
0479       regex_constants::escape_type_extended_backref,  /*g*/
0480       regex_constants::escape_type_class,        /*h*/
0481       regex_constants::escape_type_class,        /*i*/
0482       regex_constants::escape_type_class,        /*j*/
0483       regex_constants::escape_type_extended_backref, /*k*/
0484       regex_constants::escape_type_class,        /*l*/
0485       regex_constants::escape_type_class,        /*m*/
0486       regex_constants::escape_type_control_n,       /*n*/
0487       regex_constants::escape_type_class,           /*o*/
0488       regex_constants::escape_type_property,        /*p*/
0489       regex_constants::escape_type_class,           /*q*/
0490       regex_constants::escape_type_control_r,       /*r*/
0491       regex_constants::escape_type_class,           /*s*/
0492       regex_constants::escape_type_control_t,       /*t*/
0493       regex_constants::escape_type_class,         /*u*/
0494       regex_constants::escape_type_control_v,       /*v*/
0495       regex_constants::escape_type_class,           /*w*/
0496       regex_constants::escape_type_hex,             /*x*/
0497       regex_constants::escape_type_class,           /*y*/
0498       regex_constants::escape_type_end_buffer,      /*z*/
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 // is charT c a combining character?
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__) // can't use WCHAR_MAX/MIN in pp-directives
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 // is a charT c a line separator?
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 // get a default collating element:
0680 //
0681 inline std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name)
0682 {
0683    //
0684    // these are the POSIX collating names:
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    // these multi-character collating elements
0702    // should keep most Western-European locales
0703    // happy - we should really localise these a
0704    // little more - but this will have to do for
0705    // now:
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 // get the state_id of a character classification, the individual
0755 // traits classes then transform that state_id into a bitmask:
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       // Not only do we check that the ranges are of equal size before
0770       // calling std::equal, but there is no other algorithm available:
0771       // not even a non-standard MS one.  So forward to unchecked_equal
0772       // in the MS case.
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,}, // alnum
0800       {data+5, data+10,}, // alpha
0801       {data+10, data+15,}, // blank
0802       {data+15, data+20,}, // cntrl
0803       {data+20, data+21,}, // d
0804       {data+20, data+25,}, // digit
0805       {data+25, data+30,}, // graph
0806       {data+29, data+30,}, // h
0807       {data+30, data+31,}, // l
0808       {data+30, data+35,}, // lower
0809       {data+35, data+40,}, // print
0810       {data+40, data+45,}, // punct
0811       {data+45, data+46,}, // s
0812       {data+45, data+50,}, // space
0813       {data+57, data+58,}, // u
0814       {data+50, data+57,}, // unicode
0815       {data+57, data+62,}, // upper
0816       {data+62, data+63,}, // v
0817       {data+63, data+64,}, // w
0818       {data+63, data+67,}, // word
0819       {data+67, data+73,}, // xdigit
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 // helper functions:
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 // This sucks: declare template specialisations of global_lower/global_upper
0890 // that just forward to the non-template implementation functions.  We do
0891 // this because there is one compiler (Compaq Tru64 C++) that doesn't seem
0892 // to differentiate between templates and non-template overloads....
0893 // what's more, the primary template, plus all overloads have to be
0894 // defined in the same translation unit (if one is inline they all must be)
0895 // otherwise the "local template instantiation" compiler option can pick
0896 // the wrong instantiation when linking:
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; // warning suppression
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 } // BOOST_REGEX_DETAIL_NS
0984 } // boost
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