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