1 | /* |
---|
2 | * |
---|
3 | * Copyright (c) 2004 |
---|
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 regex_traits_defaults.cpp |
---|
15 | * VERSION see <boost/version.hpp> |
---|
16 | * DESCRIPTION: Declares API's for access to regex_traits default properties. |
---|
17 | */ |
---|
18 | |
---|
19 | #define BOOST_REGEX_SOURCE |
---|
20 | #include <boost/regex/regex_traits.hpp> |
---|
21 | |
---|
22 | #include <cctype> |
---|
23 | #ifndef BOOST_NO_WREGEX |
---|
24 | #include <cwctype> |
---|
25 | #endif |
---|
26 | |
---|
27 | #if defined(BOOST_NO_STDC_NAMESPACE) |
---|
28 | namespace std{ |
---|
29 | using ::tolower; |
---|
30 | using ::toupper; |
---|
31 | #ifndef BOOST_NO_WREGEX |
---|
32 | using ::towlower; |
---|
33 | using ::towupper; |
---|
34 | #endif |
---|
35 | } |
---|
36 | #endif |
---|
37 | |
---|
38 | |
---|
39 | namespace boost{ namespace re_detail{ |
---|
40 | |
---|
41 | BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n) |
---|
42 | { |
---|
43 | // if the user hasn't supplied a message catalog, then this supplies |
---|
44 | // default "messages" for us to load in the range 1-100. |
---|
45 | const char* messages[] = { |
---|
46 | "", |
---|
47 | "(", |
---|
48 | ")", |
---|
49 | "$", |
---|
50 | "^", |
---|
51 | ".", |
---|
52 | "*", |
---|
53 | "+", |
---|
54 | "?", |
---|
55 | "[", |
---|
56 | "]", |
---|
57 | "|", |
---|
58 | "\\", |
---|
59 | "#", |
---|
60 | "-", |
---|
61 | "{", |
---|
62 | "}", |
---|
63 | "0123456789", |
---|
64 | "b", |
---|
65 | "B", |
---|
66 | "<", |
---|
67 | ">", |
---|
68 | "", |
---|
69 | "", |
---|
70 | "A`", |
---|
71 | "z'", |
---|
72 | "\n", |
---|
73 | ",", |
---|
74 | "a", |
---|
75 | "f", |
---|
76 | "n", |
---|
77 | "r", |
---|
78 | "t", |
---|
79 | "v", |
---|
80 | "x", |
---|
81 | "c", |
---|
82 | ":", |
---|
83 | "=", |
---|
84 | "e", |
---|
85 | "", |
---|
86 | "", |
---|
87 | "", |
---|
88 | "", |
---|
89 | "", |
---|
90 | "", |
---|
91 | "", |
---|
92 | "", |
---|
93 | "E", |
---|
94 | "Q", |
---|
95 | "X", |
---|
96 | "C", |
---|
97 | "Z", |
---|
98 | "G", |
---|
99 | "!", |
---|
100 | "p", |
---|
101 | "P", |
---|
102 | "N", |
---|
103 | }; |
---|
104 | |
---|
105 | return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]); |
---|
106 | } |
---|
107 | |
---|
108 | BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n) |
---|
109 | { |
---|
110 | static const char* const s_default_error_messages[] = { |
---|
111 | "Success", /* REG_NOERROR */ |
---|
112 | "No match", /* REG_NOMATCH */ |
---|
113 | "Invalid regular expression", /* REG_BADPAT */ |
---|
114 | "Invalid collation character", /* REG_ECOLLATE */ |
---|
115 | "Invalid character class name", /* REG_ECTYPE */ |
---|
116 | "Invalid or trailing backslash", /* REG_EESCAPE */ |
---|
117 | "Invalid back reference", /* REG_ESUBREG */ |
---|
118 | "Unmatched [ or [^", /* REG_EBRACK */ |
---|
119 | "Unmatched ( or \\(", /* REG_EPAREN */ |
---|
120 | "Unmatched { or \\{", /* REG_EBRACE */ |
---|
121 | "Invalid content of repeat range", /* REG_BADBR */ |
---|
122 | "Invalid range end", /* REG_ERANGE */ |
---|
123 | "Memory exhausted", /* REG_ESPACE */ |
---|
124 | "Invalid preceding regular expression", /* REG_BADRPT */ |
---|
125 | "Premature end of regular expression", /* REG_EEND */ |
---|
126 | "Regular expression too big", /* REG_ESIZE */ |
---|
127 | "Unmatched ) or \\)", /* REG_ERPAREN */ |
---|
128 | "Empty expression", /* REG_EMPTY */ |
---|
129 | "Complexity requirements exceeded", /* REG_ECOMPLEXITY */ |
---|
130 | "Out of stack space", /* REG_ESTACK */ |
---|
131 | "Unknown error", /* REG_E_UNKNOWN */ |
---|
132 | "", |
---|
133 | "", |
---|
134 | "", |
---|
135 | }; |
---|
136 | |
---|
137 | return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n]; |
---|
138 | } |
---|
139 | |
---|
140 | BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_least16_t c) |
---|
141 | { |
---|
142 | const boost::uint_least16_t combining_ranges[] = { 0x0300, 0x0361, |
---|
143 | 0x0483, 0x0486, |
---|
144 | 0x0903, 0x0903, |
---|
145 | 0x093E, 0x0940, |
---|
146 | 0x0949, 0x094C, |
---|
147 | 0x0982, 0x0983, |
---|
148 | 0x09BE, 0x09C0, |
---|
149 | 0x09C7, 0x09CC, |
---|
150 | 0x09D7, 0x09D7, |
---|
151 | 0x0A3E, 0x0A40, |
---|
152 | 0x0A83, 0x0A83, |
---|
153 | 0x0ABE, 0x0AC0, |
---|
154 | 0x0AC9, 0x0ACC, |
---|
155 | 0x0B02, 0x0B03, |
---|
156 | 0x0B3E, 0x0B3E, |
---|
157 | 0x0B40, 0x0B40, |
---|
158 | 0x0B47, 0x0B4C, |
---|
159 | 0x0B57, 0x0B57, |
---|
160 | 0x0B83, 0x0B83, |
---|
161 | 0x0BBE, 0x0BBF, |
---|
162 | 0x0BC1, 0x0BCC, |
---|
163 | 0x0BD7, 0x0BD7, |
---|
164 | 0x0C01, 0x0C03, |
---|
165 | 0x0C41, 0x0C44, |
---|
166 | 0x0C82, 0x0C83, |
---|
167 | 0x0CBE, 0x0CBE, |
---|
168 | 0x0CC0, 0x0CC4, |
---|
169 | 0x0CC7, 0x0CCB, |
---|
170 | 0x0CD5, 0x0CD6, |
---|
171 | 0x0D02, 0x0D03, |
---|
172 | 0x0D3E, 0x0D40, |
---|
173 | 0x0D46, 0x0D4C, |
---|
174 | 0x0D57, 0x0D57, |
---|
175 | 0x0F7F, 0x0F7F, |
---|
176 | 0x20D0, 0x20E1, |
---|
177 | 0x3099, 0x309A, |
---|
178 | 0xFE20, 0xFE23, |
---|
179 | 0xffff, 0xffff, }; |
---|
180 | |
---|
181 | const boost::uint_least16_t* p = combining_ranges + 1; |
---|
182 | while(*p < c) p += 2; |
---|
183 | --p; |
---|
184 | if((c >= *p) && (c <= *(p+1))) |
---|
185 | return true; |
---|
186 | return false; |
---|
187 | } |
---|
188 | |
---|
189 | // |
---|
190 | // these are the POSIX collating names: |
---|
191 | // |
---|
192 | BOOST_REGEX_DECL const char* def_coll_names[] = { |
---|
193 | "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline", |
---|
194 | "vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", |
---|
195 | "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark", |
---|
196 | "quotation-mark", "number-sign", "dollar-sign", "percent-sign", "ampersand", "apostrophe", |
---|
197 | "left-parenthesis", "right-parenthesis", "asterisk", "plus-sign", "comma", "hyphen", |
---|
198 | "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", |
---|
199 | "colon", "semicolon", "less-than-sign", "equals-sign", "greater-than-sign", |
---|
200 | "question-mark", "commercial-at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", |
---|
201 | "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "left-square-bracket", "backslash", |
---|
202 | "right-square-bracket", "circumflex", "underscore", "grave-accent", "a", "b", "c", "d", "e", "f", |
---|
203 | "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "left-curly-bracket", |
---|
204 | "vertical-line", "right-curly-bracket", "tilde", "DEL", "", |
---|
205 | }; |
---|
206 | |
---|
207 | // these multi-character collating elements |
---|
208 | // should keep most Western-European locales |
---|
209 | // happy - we should really localise these a |
---|
210 | // little more - but this will have to do for |
---|
211 | // now: |
---|
212 | |
---|
213 | BOOST_REGEX_DECL const char* def_multi_coll[] = { |
---|
214 | "ae", |
---|
215 | "Ae", |
---|
216 | "AE", |
---|
217 | "ch", |
---|
218 | "Ch", |
---|
219 | "CH", |
---|
220 | "ll", |
---|
221 | "Ll", |
---|
222 | "LL", |
---|
223 | "ss", |
---|
224 | "Ss", |
---|
225 | "SS", |
---|
226 | "nj", |
---|
227 | "Nj", |
---|
228 | "NJ", |
---|
229 | "dz", |
---|
230 | "Dz", |
---|
231 | "DZ", |
---|
232 | "lj", |
---|
233 | "Lj", |
---|
234 | "LJ", |
---|
235 | "", |
---|
236 | }; |
---|
237 | |
---|
238 | |
---|
239 | |
---|
240 | BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name) |
---|
241 | { |
---|
242 | unsigned int i = 0; |
---|
243 | while(*def_coll_names[i]) |
---|
244 | { |
---|
245 | if(def_coll_names[i] == name) |
---|
246 | { |
---|
247 | return std::string(1, char(i)); |
---|
248 | } |
---|
249 | ++i; |
---|
250 | } |
---|
251 | i = 0; |
---|
252 | while(*def_multi_coll[i]) |
---|
253 | { |
---|
254 | if(def_multi_coll[i] == name) |
---|
255 | { |
---|
256 | return def_multi_coll[i]; |
---|
257 | } |
---|
258 | ++i; |
---|
259 | } |
---|
260 | return std::string(); |
---|
261 | } |
---|
262 | |
---|
263 | BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c) |
---|
264 | { |
---|
265 | return static_cast<char>((std::tolower)((unsigned char)c)); |
---|
266 | } |
---|
267 | |
---|
268 | BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c) |
---|
269 | { |
---|
270 | return static_cast<char>((std::toupper)((unsigned char)c)); |
---|
271 | } |
---|
272 | #ifndef BOOST_NO_WREGEX |
---|
273 | BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c) |
---|
274 | { |
---|
275 | return (std::towlower)(c); |
---|
276 | } |
---|
277 | |
---|
278 | BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c) |
---|
279 | { |
---|
280 | return (std::towupper)(c); |
---|
281 | } |
---|
282 | #ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T |
---|
283 | BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c) |
---|
284 | { |
---|
285 | return (std::towlower)(c); |
---|
286 | } |
---|
287 | |
---|
288 | BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c) |
---|
289 | { |
---|
290 | return (std::towupper)(c); |
---|
291 | } |
---|
292 | #endif |
---|
293 | |
---|
294 | #endif |
---|
295 | |
---|
296 | BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c) |
---|
297 | { |
---|
298 | // |
---|
299 | // char_syntax determines how the compiler treats a given character |
---|
300 | // in a regular expression. |
---|
301 | // |
---|
302 | static regex_constants::escape_syntax_type char_syntax[] = { |
---|
303 | regex_constants::escape_type_identity, /**/ |
---|
304 | regex_constants::escape_type_identity, /**/ |
---|
305 | regex_constants::escape_type_identity, /**/ |
---|
306 | regex_constants::escape_type_identity, /**/ |
---|
307 | regex_constants::escape_type_identity, /**/ |
---|
308 | regex_constants::escape_type_identity, /**/ |
---|
309 | regex_constants::escape_type_identity, /**/ |
---|
310 | regex_constants::escape_type_identity, /**/ |
---|
311 | regex_constants::escape_type_identity, /**/ |
---|
312 | regex_constants::escape_type_identity, /**/ |
---|
313 | regex_constants::escape_type_identity, /**/ |
---|
314 | regex_constants::escape_type_identity, /**/ |
---|
315 | regex_constants::escape_type_identity, /**/ |
---|
316 | regex_constants::escape_type_identity, /**/ |
---|
317 | regex_constants::escape_type_identity, /**/ |
---|
318 | regex_constants::escape_type_identity, /**/ |
---|
319 | regex_constants::escape_type_identity, /**/ |
---|
320 | regex_constants::escape_type_identity, /**/ |
---|
321 | regex_constants::escape_type_identity, /**/ |
---|
322 | regex_constants::escape_type_identity, /**/ |
---|
323 | regex_constants::escape_type_identity, /**/ |
---|
324 | regex_constants::escape_type_identity, /**/ |
---|
325 | regex_constants::escape_type_identity, /**/ |
---|
326 | regex_constants::escape_type_identity, /**/ |
---|
327 | regex_constants::escape_type_identity, /**/ |
---|
328 | regex_constants::escape_type_identity, /**/ |
---|
329 | regex_constants::escape_type_identity, /**/ |
---|
330 | regex_constants::escape_type_identity, /**/ |
---|
331 | regex_constants::escape_type_identity, /**/ |
---|
332 | regex_constants::escape_type_identity, /**/ |
---|
333 | regex_constants::escape_type_identity, /**/ |
---|
334 | regex_constants::escape_type_identity, /**/ |
---|
335 | regex_constants::escape_type_identity, /* */ // 32 |
---|
336 | regex_constants::escape_type_identity, /*!*/ |
---|
337 | regex_constants::escape_type_identity, /*"*/ |
---|
338 | regex_constants::escape_type_identity, /*#*/ |
---|
339 | regex_constants::escape_type_identity, /*$*/ |
---|
340 | regex_constants::escape_type_identity, /*%*/ |
---|
341 | regex_constants::escape_type_identity, /*&*/ |
---|
342 | regex_constants::escape_type_end_buffer, /*'*/ |
---|
343 | regex_constants::syntax_open_mark, /*(*/ |
---|
344 | regex_constants::syntax_close_mark, /*)*/ |
---|
345 | regex_constants::escape_type_identity, /***/ |
---|
346 | regex_constants::syntax_plus, /*+*/ |
---|
347 | regex_constants::escape_type_identity, /*,*/ |
---|
348 | regex_constants::escape_type_identity, /*-*/ |
---|
349 | regex_constants::escape_type_identity, /*.*/ |
---|
350 | regex_constants::escape_type_identity, /*/*/ |
---|
351 | regex_constants::escape_type_decimal, /*0*/ |
---|
352 | regex_constants::escape_type_backref, /*1*/ |
---|
353 | regex_constants::escape_type_backref, /*2*/ |
---|
354 | regex_constants::escape_type_backref, /*3*/ |
---|
355 | regex_constants::escape_type_backref, /*4*/ |
---|
356 | regex_constants::escape_type_backref, /*5*/ |
---|
357 | regex_constants::escape_type_backref, /*6*/ |
---|
358 | regex_constants::escape_type_backref, /*7*/ |
---|
359 | regex_constants::escape_type_backref, /*8*/ |
---|
360 | regex_constants::escape_type_backref, /*9*/ |
---|
361 | regex_constants::escape_type_identity, /*:*/ |
---|
362 | regex_constants::escape_type_identity, /*;*/ |
---|
363 | regex_constants::escape_type_left_word, /*<*/ |
---|
364 | regex_constants::escape_type_identity, /*=*/ |
---|
365 | regex_constants::escape_type_right_word, /*>*/ |
---|
366 | regex_constants::syntax_question, /*?*/ |
---|
367 | regex_constants::escape_type_identity, /*@*/ |
---|
368 | regex_constants::escape_type_start_buffer, /*A*/ |
---|
369 | regex_constants::escape_type_not_word_assert, /*B*/ |
---|
370 | regex_constants::escape_type_C, /*C*/ |
---|
371 | regex_constants::escape_type_not_class, /*D*/ |
---|
372 | regex_constants::escape_type_E, /*E*/ |
---|
373 | regex_constants::escape_type_not_class, /*F*/ |
---|
374 | regex_constants::escape_type_G, /*G*/ |
---|
375 | regex_constants::escape_type_not_class, /*H*/ |
---|
376 | regex_constants::escape_type_not_class, /*I*/ |
---|
377 | regex_constants::escape_type_not_class, /*J*/ |
---|
378 | regex_constants::escape_type_not_class, /*K*/ |
---|
379 | regex_constants::escape_type_not_class, /*L*/ |
---|
380 | regex_constants::escape_type_not_class, /*M*/ |
---|
381 | regex_constants::escape_type_named_char, /*N*/ |
---|
382 | regex_constants::escape_type_not_class, /*O*/ |
---|
383 | regex_constants::escape_type_not_property, /*P*/ |
---|
384 | regex_constants::escape_type_Q, /*Q*/ |
---|
385 | regex_constants::escape_type_not_class, /*R*/ |
---|
386 | regex_constants::escape_type_not_class, /*S*/ |
---|
387 | regex_constants::escape_type_not_class, /*T*/ |
---|
388 | regex_constants::escape_type_not_class, /*U*/ |
---|
389 | regex_constants::escape_type_not_class, /*V*/ |
---|
390 | regex_constants::escape_type_not_class, /*W*/ |
---|
391 | regex_constants::escape_type_X, /*X*/ |
---|
392 | regex_constants::escape_type_not_class, /*Y*/ |
---|
393 | regex_constants::escape_type_Z, /*Z*/ |
---|
394 | regex_constants::escape_type_identity, /*[*/ |
---|
395 | regex_constants::escape_type_identity, /*\*/ |
---|
396 | regex_constants::escape_type_identity, /*]*/ |
---|
397 | regex_constants::escape_type_identity, /*^*/ |
---|
398 | regex_constants::escape_type_identity, /*_*/ |
---|
399 | regex_constants::escape_type_start_buffer, /*`*/ |
---|
400 | regex_constants::escape_type_control_a, /*a*/ |
---|
401 | regex_constants::escape_type_word_assert, /*b*/ |
---|
402 | regex_constants::escape_type_ascii_control, /*c*/ |
---|
403 | regex_constants::escape_type_class, /*d*/ |
---|
404 | regex_constants::escape_type_e, /*e*/ |
---|
405 | regex_constants::escape_type_control_f, /*f*/ |
---|
406 | regex_constants::escape_type_class, /*g*/ |
---|
407 | regex_constants::escape_type_class, /*h*/ |
---|
408 | regex_constants::escape_type_class, /*i*/ |
---|
409 | regex_constants::escape_type_class, /*j*/ |
---|
410 | regex_constants::escape_type_class, /*k*/ |
---|
411 | regex_constants::escape_type_class, /*l*/ |
---|
412 | regex_constants::escape_type_class, /*m*/ |
---|
413 | regex_constants::escape_type_control_n, /*n*/ |
---|
414 | regex_constants::escape_type_class, /*o*/ |
---|
415 | regex_constants::escape_type_property, /*p*/ |
---|
416 | regex_constants::escape_type_class, /*q*/ |
---|
417 | regex_constants::escape_type_control_r, /*r*/ |
---|
418 | regex_constants::escape_type_class, /*s*/ |
---|
419 | regex_constants::escape_type_control_t, /*t*/ |
---|
420 | regex_constants::escape_type_class, /*u*/ |
---|
421 | regex_constants::escape_type_control_v, /*v*/ |
---|
422 | regex_constants::escape_type_class, /*w*/ |
---|
423 | regex_constants::escape_type_hex, /*x*/ |
---|
424 | regex_constants::escape_type_class, /*y*/ |
---|
425 | regex_constants::escape_type_end_buffer, /*z*/ |
---|
426 | regex_constants::syntax_open_brace, /*{*/ |
---|
427 | regex_constants::syntax_or, /*|*/ |
---|
428 | regex_constants::syntax_close_brace, /*}*/ |
---|
429 | regex_constants::escape_type_identity, /*~*/ |
---|
430 | regex_constants::escape_type_identity, /**/ |
---|
431 | regex_constants::escape_type_identity, /**/ |
---|
432 | regex_constants::escape_type_identity, /**/ |
---|
433 | regex_constants::escape_type_identity, /**/ |
---|
434 | regex_constants::escape_type_identity, /**/ |
---|
435 | regex_constants::escape_type_identity, /**/ |
---|
436 | regex_constants::escape_type_identity, /*
*/ |
---|
437 | regex_constants::escape_type_identity, /**/ |
---|
438 | regex_constants::escape_type_identity, /**/ |
---|
439 | regex_constants::escape_type_identity, /**/ |
---|
440 | regex_constants::escape_type_identity, /**/ |
---|
441 | regex_constants::escape_type_identity, /**/ |
---|
442 | regex_constants::escape_type_identity, /**/ |
---|
443 | regex_constants::escape_type_identity, /**/ |
---|
444 | regex_constants::escape_type_identity, /**/ |
---|
445 | regex_constants::escape_type_identity, /**/ |
---|
446 | regex_constants::escape_type_identity, /**/ |
---|
447 | regex_constants::escape_type_identity, /**/ |
---|
448 | regex_constants::escape_type_identity, /**/ |
---|
449 | regex_constants::escape_type_identity, /**/ |
---|
450 | regex_constants::escape_type_identity, /**/ |
---|
451 | regex_constants::escape_type_identity, /**/ |
---|
452 | regex_constants::escape_type_identity, /**/ |
---|
453 | regex_constants::escape_type_identity, /**/ |
---|
454 | regex_constants::escape_type_identity, /**/ |
---|
455 | regex_constants::escape_type_identity, /**/ |
---|
456 | regex_constants::escape_type_identity, /**/ |
---|
457 | regex_constants::escape_type_identity, /**/ |
---|
458 | regex_constants::escape_type_identity, /**/ |
---|
459 | regex_constants::escape_type_identity, /**/ |
---|
460 | regex_constants::escape_type_identity, /**/ |
---|
461 | regex_constants::escape_type_identity, /**/ |
---|
462 | regex_constants::escape_type_identity, /**/ |
---|
463 | regex_constants::escape_type_identity, /* */ |
---|
464 | regex_constants::escape_type_identity, /*¡*/ |
---|
465 | regex_constants::escape_type_identity, /*¢*/ |
---|
466 | regex_constants::escape_type_identity, /*£*/ |
---|
467 | regex_constants::escape_type_identity, /*¤*/ |
---|
468 | regex_constants::escape_type_identity, /*¥*/ |
---|
469 | regex_constants::escape_type_identity, /*¦*/ |
---|
470 | regex_constants::escape_type_identity, /*§*/ |
---|
471 | regex_constants::escape_type_identity, /*¨*/ |
---|
472 | regex_constants::escape_type_identity, /*©*/ |
---|
473 | regex_constants::escape_type_identity, /*ª*/ |
---|
474 | regex_constants::escape_type_identity, /*«*/ |
---|
475 | regex_constants::escape_type_identity, /*¬*/ |
---|
476 | regex_constants::escape_type_identity, /**/ |
---|
477 | regex_constants::escape_type_identity, /*®*/ |
---|
478 | regex_constants::escape_type_identity, /*¯*/ |
---|
479 | regex_constants::escape_type_identity, /*°*/ |
---|
480 | regex_constants::escape_type_identity, /*±*/ |
---|
481 | regex_constants::escape_type_identity, /*²*/ |
---|
482 | regex_constants::escape_type_identity, /*³*/ |
---|
483 | regex_constants::escape_type_identity, /*´*/ |
---|
484 | regex_constants::escape_type_identity, /*µ*/ |
---|
485 | regex_constants::escape_type_identity, /*¶*/ |
---|
486 | }; |
---|
487 | |
---|
488 | return char_syntax[(unsigned char)c]; |
---|
489 | } |
---|
490 | |
---|
491 | BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c) |
---|
492 | { |
---|
493 | // |
---|
494 | // char_syntax determines how the compiler treats a given character |
---|
495 | // in a regular expression. |
---|
496 | // |
---|
497 | static regex_constants::syntax_type char_syntax[] = { |
---|
498 | regex_constants::syntax_char, /**/ |
---|
499 | regex_constants::syntax_char, /**/ |
---|
500 | regex_constants::syntax_char, /**/ |
---|
501 | regex_constants::syntax_char, /**/ |
---|
502 | regex_constants::syntax_char, /**/ |
---|
503 | regex_constants::syntax_char, /**/ |
---|
504 | regex_constants::syntax_char, /**/ |
---|
505 | regex_constants::syntax_char, /**/ |
---|
506 | regex_constants::syntax_char, /**/ |
---|
507 | regex_constants::syntax_char, /**/ |
---|
508 | regex_constants::syntax_newline, /**/ |
---|
509 | regex_constants::syntax_char, /**/ |
---|
510 | regex_constants::syntax_char, /**/ |
---|
511 | regex_constants::syntax_char, /**/ |
---|
512 | regex_constants::syntax_char, /**/ |
---|
513 | regex_constants::syntax_char, /**/ |
---|
514 | regex_constants::syntax_char, /**/ |
---|
515 | regex_constants::syntax_char, /**/ |
---|
516 | regex_constants::syntax_char, /**/ |
---|
517 | regex_constants::syntax_char, /**/ |
---|
518 | regex_constants::syntax_char, /**/ |
---|
519 | regex_constants::syntax_char, /**/ |
---|
520 | regex_constants::syntax_char, /**/ |
---|
521 | regex_constants::syntax_char, /**/ |
---|
522 | regex_constants::syntax_char, /**/ |
---|
523 | regex_constants::syntax_char, /**/ |
---|
524 | regex_constants::syntax_char, /**/ |
---|
525 | regex_constants::syntax_char, /**/ |
---|
526 | regex_constants::syntax_char, /**/ |
---|
527 | regex_constants::syntax_char, /**/ |
---|
528 | regex_constants::syntax_char, /**/ |
---|
529 | regex_constants::syntax_char, /**/ |
---|
530 | regex_constants::syntax_char, /* */ // 32 |
---|
531 | regex_constants::syntax_not, /*!*/ |
---|
532 | regex_constants::syntax_char, /*"*/ |
---|
533 | regex_constants::syntax_hash, /*#*/ |
---|
534 | regex_constants::syntax_dollar, /*$*/ |
---|
535 | regex_constants::syntax_char, /*%*/ |
---|
536 | regex_constants::syntax_char, /*&*/ |
---|
537 | regex_constants::syntax_char, /*'*/ |
---|
538 | regex_constants::syntax_open_mark, /*(*/ |
---|
539 | regex_constants::syntax_close_mark, /*)*/ |
---|
540 | regex_constants::syntax_star, /***/ |
---|
541 | regex_constants::syntax_plus, /*+*/ |
---|
542 | regex_constants::syntax_comma, /*,*/ |
---|
543 | regex_constants::syntax_dash, /*-*/ |
---|
544 | regex_constants::syntax_dot, /*.*/ |
---|
545 | regex_constants::syntax_char, /*/*/ |
---|
546 | regex_constants::syntax_digit, /*0*/ |
---|
547 | regex_constants::syntax_digit, /*1*/ |
---|
548 | regex_constants::syntax_digit, /*2*/ |
---|
549 | regex_constants::syntax_digit, /*3*/ |
---|
550 | regex_constants::syntax_digit, /*4*/ |
---|
551 | regex_constants::syntax_digit, /*5*/ |
---|
552 | regex_constants::syntax_digit, /*6*/ |
---|
553 | regex_constants::syntax_digit, /*7*/ |
---|
554 | regex_constants::syntax_digit, /*8*/ |
---|
555 | regex_constants::syntax_digit, /*9*/ |
---|
556 | regex_constants::syntax_colon, /*:*/ |
---|
557 | regex_constants::syntax_char, /*;*/ |
---|
558 | regex_constants::escape_type_left_word, /*<*/ |
---|
559 | regex_constants::syntax_equal, /*=*/ |
---|
560 | regex_constants::escape_type_right_word, /*>*/ |
---|
561 | regex_constants::syntax_question, /*?*/ |
---|
562 | regex_constants::syntax_char, /*@*/ |
---|
563 | regex_constants::syntax_char, /*A*/ |
---|
564 | regex_constants::syntax_char, /*B*/ |
---|
565 | regex_constants::syntax_char, /*C*/ |
---|
566 | regex_constants::syntax_char, /*D*/ |
---|
567 | regex_constants::syntax_char, /*E*/ |
---|
568 | regex_constants::syntax_char, /*F*/ |
---|
569 | regex_constants::syntax_char, /*G*/ |
---|
570 | regex_constants::syntax_char, /*H*/ |
---|
571 | regex_constants::syntax_char, /*I*/ |
---|
572 | regex_constants::syntax_char, /*J*/ |
---|
573 | regex_constants::syntax_char, /*K*/ |
---|
574 | regex_constants::syntax_char, /*L*/ |
---|
575 | regex_constants::syntax_char, /*M*/ |
---|
576 | regex_constants::syntax_char, /*N*/ |
---|
577 | regex_constants::syntax_char, /*O*/ |
---|
578 | regex_constants::syntax_char, /*P*/ |
---|
579 | regex_constants::syntax_char, /*Q*/ |
---|
580 | regex_constants::syntax_char, /*R*/ |
---|
581 | regex_constants::syntax_char, /*S*/ |
---|
582 | regex_constants::syntax_char, /*T*/ |
---|
583 | regex_constants::syntax_char, /*U*/ |
---|
584 | regex_constants::syntax_char, /*V*/ |
---|
585 | regex_constants::syntax_char, /*W*/ |
---|
586 | regex_constants::syntax_char, /*X*/ |
---|
587 | regex_constants::syntax_char, /*Y*/ |
---|
588 | regex_constants::syntax_char, /*Z*/ |
---|
589 | regex_constants::syntax_open_set, /*[*/ |
---|
590 | regex_constants::syntax_escape, /*\*/ |
---|
591 | regex_constants::syntax_close_set, /*]*/ |
---|
592 | regex_constants::syntax_caret, /*^*/ |
---|
593 | regex_constants::syntax_char, /*_*/ |
---|
594 | regex_constants::syntax_char, /*`*/ |
---|
595 | regex_constants::syntax_char, /*a*/ |
---|
596 | regex_constants::syntax_char, /*b*/ |
---|
597 | regex_constants::syntax_char, /*c*/ |
---|
598 | regex_constants::syntax_char, /*d*/ |
---|
599 | regex_constants::syntax_char, /*e*/ |
---|
600 | regex_constants::syntax_char, /*f*/ |
---|
601 | regex_constants::syntax_char, /*g*/ |
---|
602 | regex_constants::syntax_char, /*h*/ |
---|
603 | regex_constants::syntax_char, /*i*/ |
---|
604 | regex_constants::syntax_char, /*j*/ |
---|
605 | regex_constants::syntax_char, /*k*/ |
---|
606 | regex_constants::syntax_char, /*l*/ |
---|
607 | regex_constants::syntax_char, /*m*/ |
---|
608 | regex_constants::syntax_char, /*n*/ |
---|
609 | regex_constants::syntax_char, /*o*/ |
---|
610 | regex_constants::syntax_char, /*p*/ |
---|
611 | regex_constants::syntax_char, /*q*/ |
---|
612 | regex_constants::syntax_char, /*r*/ |
---|
613 | regex_constants::syntax_char, /*s*/ |
---|
614 | regex_constants::syntax_char, /*t*/ |
---|
615 | regex_constants::syntax_char, /*u*/ |
---|
616 | regex_constants::syntax_char, /*v*/ |
---|
617 | regex_constants::syntax_char, /*w*/ |
---|
618 | regex_constants::syntax_char, /*x*/ |
---|
619 | regex_constants::syntax_char, /*y*/ |
---|
620 | regex_constants::syntax_char, /*z*/ |
---|
621 | regex_constants::syntax_open_brace, /*{*/ |
---|
622 | regex_constants::syntax_or, /*|*/ |
---|
623 | regex_constants::syntax_close_brace, /*}*/ |
---|
624 | regex_constants::syntax_char, /*~*/ |
---|
625 | regex_constants::syntax_char, /**/ |
---|
626 | regex_constants::syntax_char, /**/ |
---|
627 | regex_constants::syntax_char, /**/ |
---|
628 | regex_constants::syntax_char, /**/ |
---|
629 | regex_constants::syntax_char, /**/ |
---|
630 | regex_constants::syntax_char, /**/ |
---|
631 | regex_constants::syntax_char, /*
*/ |
---|
632 | regex_constants::syntax_char, /**/ |
---|
633 | regex_constants::syntax_char, /**/ |
---|
634 | regex_constants::syntax_char, /**/ |
---|
635 | regex_constants::syntax_char, /**/ |
---|
636 | regex_constants::syntax_char, /**/ |
---|
637 | regex_constants::syntax_char, /**/ |
---|
638 | regex_constants::syntax_char, /**/ |
---|
639 | regex_constants::syntax_char, /**/ |
---|
640 | regex_constants::syntax_char, /**/ |
---|
641 | regex_constants::syntax_char, /**/ |
---|
642 | regex_constants::syntax_char, /**/ |
---|
643 | regex_constants::syntax_char, /**/ |
---|
644 | regex_constants::syntax_char, /**/ |
---|
645 | regex_constants::syntax_char, /**/ |
---|
646 | regex_constants::syntax_char, /**/ |
---|
647 | regex_constants::syntax_char, /**/ |
---|
648 | regex_constants::syntax_char, /**/ |
---|
649 | regex_constants::syntax_char, /**/ |
---|
650 | regex_constants::syntax_char, /**/ |
---|
651 | regex_constants::syntax_char, /**/ |
---|
652 | regex_constants::syntax_char, /**/ |
---|
653 | regex_constants::syntax_char, /**/ |
---|
654 | regex_constants::syntax_char, /**/ |
---|
655 | regex_constants::syntax_char, /**/ |
---|
656 | regex_constants::syntax_char, /**/ |
---|
657 | regex_constants::syntax_char, /**/ |
---|
658 | regex_constants::syntax_char, /* */ |
---|
659 | regex_constants::syntax_char, /*¡*/ |
---|
660 | regex_constants::syntax_char, /*¢*/ |
---|
661 | regex_constants::syntax_char, /*£*/ |
---|
662 | regex_constants::syntax_char, /*¤*/ |
---|
663 | regex_constants::syntax_char, /*¥*/ |
---|
664 | regex_constants::syntax_char, /*¦*/ |
---|
665 | regex_constants::syntax_char, /*§*/ |
---|
666 | regex_constants::syntax_char, /*¨*/ |
---|
667 | regex_constants::syntax_char, /*©*/ |
---|
668 | regex_constants::syntax_char, /*ª*/ |
---|
669 | regex_constants::syntax_char, /*«*/ |
---|
670 | regex_constants::syntax_char, /*¬*/ |
---|
671 | regex_constants::syntax_char, /**/ |
---|
672 | regex_constants::syntax_char, /*®*/ |
---|
673 | regex_constants::syntax_char, /*¯*/ |
---|
674 | regex_constants::syntax_char, /*°*/ |
---|
675 | regex_constants::syntax_char, /*±*/ |
---|
676 | regex_constants::syntax_char, /*²*/ |
---|
677 | regex_constants::syntax_char, /*³*/ |
---|
678 | regex_constants::syntax_char, /*´*/ |
---|
679 | regex_constants::syntax_char, /*µ*/ |
---|
680 | regex_constants::syntax_char, /*¶*/ |
---|
681 | }; |
---|
682 | |
---|
683 | return char_syntax[(unsigned char)c]; |
---|
684 | } |
---|
685 | |
---|
686 | |
---|
687 | } // re_detail |
---|
688 | } // boost |
---|