1 /* 2 * 3 * Copyright (c) 1998-2002 4 * John Maddock 5 * 6 * Use, modification and distribution are subject to the 7 * Boost Software License, Version 1.0. (See accompanying file 8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 * 10 */ 11 12 /* 13 * LOCATION: see http://www.boost.org for most recent version. 14 * FILE regbase.cpp 15 * VERSION see <boost/version.hpp> 16 * DESCRIPTION: Declares class regbase. 17 */ 18 19 #ifndef BOOST_REGEX_V5_REGBASE_HPP 20 #define BOOST_REGEX_V5_REGBASE_HPP 21 22 namespace boost{ 23 // 24 // class regbase 25 // handles error codes and flags 26 // 27 class regbase 28 { 29 public: 30 enum flag_type_ 31 { 32 // 33 // Divide the flags up into logical groups: 34 // bits 0-7 indicate main synatx type. 35 // bits 8-15 indicate syntax subtype. 36 // bits 16-31 indicate options that are common to all 37 // regex syntaxes. 38 // In all cases the default is 0. 39 // 40 // Main synatx group: 41 // 42 perl_syntax_group = 0, // default 43 basic_syntax_group = 1, // POSIX basic 44 literal = 2, // all characters are literals 45 main_option_type = literal | basic_syntax_group | perl_syntax_group, // everything! 46 // 47 // options specific to perl group: 48 // 49 no_bk_refs = 1 << 8, // \d not allowed 50 no_perl_ex = 1 << 9, // disable perl extensions 51 no_mod_m = 1 << 10, // disable Perl m modifier 52 mod_x = 1 << 11, // Perl x modifier 53 mod_s = 1 << 12, // force s modifier on (overrides match_not_dot_newline) 54 no_mod_s = 1 << 13, // force s modifier off (overrides match_not_dot_newline) 55 56 // 57 // options specific to basic group: 58 // 59 no_char_classes = 1 << 8, // [[:CLASS:]] not allowed 60 no_intervals = 1 << 9, // {x,y} not allowed 61 bk_plus_qm = 1 << 10, // uses \+ and \? 62 bk_vbar = 1 << 11, // use \| for alternatives 63 emacs_ex = 1 << 12, // enables emacs extensions 64 65 // 66 // options common to all groups: 67 // 68 no_escape_in_lists = 1 << 16, // '\' not special inside [...] 69 newline_alt = 1 << 17, // \n is the same as | 70 no_except = 1 << 18, // no exception on error 71 failbit = 1 << 19, // error flag 72 icase = 1 << 20, // characters are matched regardless of case 73 nocollate = 0, // don't use locale specific collation (deprecated) 74 collate = 1 << 21, // use locale specific collation 75 nosubs = 1 << 22, // don't mark sub-expressions 76 save_subexpression_location = 1 << 23, // save subexpression locations 77 no_empty_expressions = 1 << 24, // no empty expressions allowed 78 optimize = 0, // not really supported 79 80 81 82 basic = basic_syntax_group | collate | no_escape_in_lists, 83 extended = no_bk_refs | collate | no_perl_ex | no_escape_in_lists, 84 normal = 0, 85 emacs = basic_syntax_group | collate | emacs_ex | bk_vbar, 86 awk = no_bk_refs | collate | no_perl_ex, 87 grep = basic | newline_alt, 88 egrep = extended | newline_alt, 89 sed = basic, 90 perl = normal, 91 ECMAScript = normal, 92 JavaScript = normal, 93 JScript = normal 94 }; 95 typedef unsigned int flag_type; 96 97 enum restart_info 98 { 99 restart_any = 0, 100 restart_word = 1, 101 restart_line = 2, 102 restart_buf = 3, 103 restart_continue = 4, 104 restart_lit = 5, 105 restart_fixed_lit = 6, 106 restart_count = 7 107 }; 108 }; 109 110 // 111 // provide std lib proposal compatible constants: 112 // 113 namespace regex_constants{ 114 115 enum flag_type_ 116 { 117 118 no_except = ::boost::regbase::no_except, 119 failbit = ::boost::regbase::failbit, 120 literal = ::boost::regbase::literal, 121 icase = ::boost::regbase::icase, 122 nocollate = ::boost::regbase::nocollate, 123 collate = ::boost::regbase::collate, 124 nosubs = ::boost::regbase::nosubs, 125 optimize = ::boost::regbase::optimize, 126 bk_plus_qm = ::boost::regbase::bk_plus_qm, 127 bk_vbar = ::boost::regbase::bk_vbar, 128 no_intervals = ::boost::regbase::no_intervals, 129 no_char_classes = ::boost::regbase::no_char_classes, 130 no_escape_in_lists = ::boost::regbase::no_escape_in_lists, 131 no_mod_m = ::boost::regbase::no_mod_m, 132 mod_x = ::boost::regbase::mod_x, 133 mod_s = ::boost::regbase::mod_s, 134 no_mod_s = ::boost::regbase::no_mod_s, 135 save_subexpression_location = ::boost::regbase::save_subexpression_location, 136 no_empty_expressions = ::boost::regbase::no_empty_expressions, 137 138 basic = ::boost::regbase::basic, 139 extended = ::boost::regbase::extended, 140 normal = ::boost::regbase::normal, 141 emacs = ::boost::regbase::emacs, 142 awk = ::boost::regbase::awk, 143 grep = ::boost::regbase::grep, 144 egrep = ::boost::regbase::egrep, 145 sed = basic, 146 perl = normal, 147 ECMAScript = normal, 148 JavaScript = normal, 149 JScript = normal 150 }; 151 typedef ::boost::regbase::flag_type syntax_option_type; 152 153 } // namespace regex_constants 154 155 } // namespace boost 156 157 #endif 158 159