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