mirror of
https://github.com/boostorg/regex.git
synced 2025-06-30 14:20:58 +02:00
Compare commits
429 Commits
boost-1.20
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
ee3d533e84 | |||
99f8d02805 | |||
7043e5585f | |||
048d5b788c | |||
ee631c02eb | |||
4600a25228 | |||
aebb44e507 | |||
8d994b14b2 | |||
d310bc9835 | |||
6c02074270 | |||
ca44c8182c | |||
2e10c5ec17 | |||
ba148bae42 | |||
7c74a98ae5 | |||
9424952e8f | |||
c3f14400b0 | |||
55a6787950 | |||
4c0572d98f | |||
25e51d3984 | |||
c9b37542c5 | |||
6382470ac1 | |||
1dc081e1c2 | |||
b3e28896b7 | |||
76176b302b | |||
a262f28327 | |||
e3aacc5c55 | |||
dc90d07749 | |||
300ca31723 | |||
c65dd3be41 | |||
5a29047906 | |||
cdd130ae2d | |||
9f47972bcf | |||
0633ba70f2 | |||
8330b19cec | |||
b8eab985e5 | |||
f90d8c667e | |||
4b7f14e72d | |||
89515b9a8e | |||
3075aaba4a | |||
50b8204753 | |||
02c652c01e | |||
b3f7d35f68 | |||
f1312f16c4 | |||
9ebe515adf | |||
c9efbea4a7 | |||
6cbda47155 | |||
3e60ca3481 | |||
3026d5e6c6 | |||
f3088d1c77 | |||
f82771be8c | |||
02f6fd45b8 | |||
9058b985a9 | |||
65f6604b24 | |||
16d6b87b1b | |||
82572db442 | |||
80104e292d | |||
be01708af3 | |||
39f1fb4d17 | |||
b84b17b3c4 | |||
2c3ff62e1b | |||
7858e47a26 | |||
cd0072b3e7 | |||
bf9350aa16 | |||
6b95ac002e | |||
7f93cee9af | |||
e79458b0e3 | |||
207b0c63cd | |||
f6b9c3d809 | |||
a008c722a4 | |||
dddfc1a63a | |||
a247f4d7f8 | |||
84c2228b3f | |||
ebc12d24c9 | |||
1a50827c46 | |||
d19f04af7b | |||
2e9fa8c8f8 | |||
c642977acd | |||
27875c1e55 | |||
42337410fc | |||
aa132bec5d | |||
d0258375ae | |||
7ba011232c | |||
6bb6cddad6 | |||
f9d0907868 | |||
8324fad77c | |||
23f71d7727 | |||
de9338cedf | |||
dc3878df84 | |||
aa68609a60 | |||
a804285fb6 | |||
8b4da77f83 | |||
2606d1bdd1 | |||
9215a04042 | |||
f7eb12d9c7 | |||
515044821c | |||
72a7a13565 | |||
63778bea05 | |||
54e9a2fbcb | |||
ff1c0a0bb5 | |||
c23a7a8cfe | |||
651256800f | |||
696fa47670 | |||
ab5a7a768d | |||
a669854a84 | |||
11ea8aab76 | |||
ee85ed89a1 | |||
13dfa17e63 | |||
182616ea25 | |||
83306608a7 | |||
f3c1b8d784 | |||
3b27d5a38e | |||
567d76e8e4 | |||
51ef8177d3 | |||
2e1ed31f34 | |||
ccc9c16e93 | |||
4e412a1774 | |||
e4248fcb19 | |||
ae95ac6ad0 | |||
feb3f7bc40 | |||
b66ac65061 | |||
d695b70ee9 | |||
222b16693c | |||
6750cf4892 | |||
9d565f63ed | |||
8a5b00c128 | |||
11f535596b | |||
bba214f904 | |||
8be91f0568 | |||
cddfd077a8 | |||
41e54c1cf2 | |||
0f2f6b6dfc | |||
ff80be2019 | |||
8e03097d9d | |||
e12105e591 | |||
1c915e3fda | |||
cb9409160a | |||
c32c644a38 | |||
5c0a6398ab | |||
4a851cf958 | |||
6f9ba7a289 | |||
4a06f15183 | |||
01a3b56f8a | |||
3fc6433d44 | |||
5255c45b0a | |||
ed48905c5e | |||
13769e4fff | |||
6dfa7ef86c | |||
eb91bf612a | |||
e016ef8e21 | |||
ca984697f0 | |||
2f9da388c1 | |||
f50f35d1fc | |||
df4b8e696f | |||
3673a0a888 | |||
a69678c3c6 | |||
8fb69853fc | |||
70199360d3 | |||
9aa18a159d | |||
4122e8f08d | |||
922322b644 | |||
89d445c1b6 | |||
31d1dc1182 | |||
8bb6861595 | |||
11ddff601b | |||
088b492987 | |||
535e1b05cc | |||
1f15026060 | |||
f0f32bdda1 | |||
a81a1ea30f | |||
640f633395 | |||
0ed72c37e4 | |||
5cf85df857 | |||
3819294ac1 | |||
ea96eafacc | |||
a31ae14cf8 | |||
158c26d85c | |||
86e5251979 | |||
cebaf09b5d | |||
d0ba00a2e7 | |||
75293e9854 | |||
45e593c4fe | |||
251099c828 | |||
5705d52e84 | |||
88a0f9d75a | |||
fbb087dec9 | |||
c84ebf1c5b | |||
1eec12f177 | |||
82ad27c468 | |||
897c33be2a | |||
2ecd905fb2 | |||
abef9c7249 | |||
0e37a76df0 | |||
adc4ee41e3 | |||
9a4e5d29c1 | |||
ff4890b2e2 | |||
3a5f4775f7 | |||
5a65397974 | |||
e5d9c95456 | |||
b6a13dd215 | |||
cf285ed3e5 | |||
66ddab7fae | |||
09bfc7f853 | |||
13df8a293b | |||
40ab965ee9 | |||
0fec291b28 | |||
6ee955be5f | |||
eeae9a0762 | |||
c7c8400efa | |||
a7f8f56d92 | |||
66ac67533c | |||
d9694bbc1f | |||
f81bdae7f1 | |||
aebf86bbe5 | |||
de9ecb7407 | |||
fa43c7ab1d | |||
5f0f6fa8f1 | |||
81f404ec69 | |||
38b55d0db8 | |||
bed785ad19 | |||
bb711db956 | |||
13f9af564d | |||
43cf48f61e | |||
2767f7f6ba | |||
035e752ed2 | |||
753a3d6584 | |||
ab0051399e | |||
61ea1b566a | |||
1ad6328d33 | |||
e6a371c6d6 | |||
ee59983ea9 | |||
ad769fcfdb | |||
2468d450f2 | |||
d47f20f147 | |||
0575e50ddb | |||
de40dac5d1 | |||
b2c4abc9cf | |||
b856079e74 | |||
293b945785 | |||
998f94ffe9 | |||
53de3c4ae6 | |||
bbbd65c2e4 | |||
129cf61f65 | |||
992eb043af | |||
084af757b4 | |||
1035f25b65 | |||
eacf31772b | |||
8d8a209d8b | |||
6b75e3962d | |||
1826080071 | |||
2ee6dec715 | |||
298651b2f6 | |||
752c43f9d4 | |||
976fb02a1b | |||
d67a843d5a | |||
3e3752e992 | |||
7c42b3aca6 | |||
bb89bbb29a | |||
2035a49533 | |||
6e82619133 | |||
1d560fae85 | |||
b4cf815f7d | |||
1d3653812a | |||
9ef4719dff | |||
e18c474222 | |||
7f6be58d92 | |||
11accf4a8b | |||
b55cce9a42 | |||
6f9658fa6c | |||
936e0cfd99 | |||
290270440e | |||
76c85c7c34 | |||
44d33b20d5 | |||
98377b57aa | |||
43df21bca1 | |||
c8e9df8fa2 | |||
a5d1526fbb | |||
f79497c625 | |||
a108657449 | |||
9225fa8531 | |||
07c20c1926 | |||
d227059666 | |||
f5082341c0 | |||
5613d77433 | |||
6463dcfb07 | |||
c07c4e0a11 | |||
e993619390 | |||
e22aaa9d20 | |||
52dbd281ca | |||
e4138b5bdc | |||
534f6273c0 | |||
b2dd7877da | |||
0cda8c8a2e | |||
04282b5d0a | |||
554832217c | |||
63130c1ef5 | |||
edbc68df6c | |||
372a07902e | |||
4ae95dae74 | |||
277ca851c8 | |||
f0d62fb2c0 | |||
7104418bd5 | |||
0bd54d3821 | |||
c167b1f183 | |||
52920ff98f | |||
72c3b4ed13 | |||
6cc5cf41d5 | |||
a7984bb149 | |||
876ff39307 | |||
79f80ad09d | |||
19d8e96cf5 | |||
e047b2b509 | |||
28968bd2b6 | |||
c4b295684b | |||
33b6eb0637 | |||
de9ad8df74 | |||
a042a0b6de | |||
f16f300347 | |||
a543dce5e3 | |||
fe45d5bf4a | |||
4dd87c299f | |||
3d3f591516 | |||
5b5d4c3145 | |||
1c45c7a48d | |||
4922ae784f | |||
007c0da3b2 | |||
3fb0375da4 | |||
0cef054b31 | |||
7218f9847a | |||
2bc1f9c998 | |||
9edaddab6f | |||
1647dd908e | |||
187208adf5 | |||
30e9920147 | |||
1d473147fd | |||
1be8e9241b | |||
e60414a5e7 | |||
7bd8e2a14d | |||
b2396011f9 | |||
b9628e449d | |||
139a2f60fb | |||
a4912a834e | |||
014b66b2f4 | |||
b2ea26705d | |||
432f59cde7 | |||
846da064e0 | |||
88a6779e8b | |||
5749937f26 | |||
e1492c79ce | |||
a06c964cab | |||
77f76889f8 | |||
50c4d1e6ca | |||
7079ba0424 | |||
e7b8b5712d | |||
f5f309be54 | |||
890dc95e0d | |||
517d3e9256 | |||
9bbca4613c | |||
01575dccbd | |||
3045723a54 | |||
2fd9ef66cc | |||
56447e1443 | |||
d36070e4cd | |||
4f1b0d09b3 | |||
1acfee5702 | |||
330d46f306 | |||
60659c5d84 | |||
1444ac208f | |||
c0a8361373 | |||
0ef48255a7 | |||
bfb3ccc907 | |||
04b11fdd1c | |||
f466b2ad2a | |||
f913683002 | |||
a58bf0705d | |||
f6fd177e2a | |||
9f051ee667 | |||
08cee9a2a6 | |||
efd0ce56bc | |||
fb81ff65fc | |||
774c7ec4d5 | |||
19dab6c60a | |||
a719c77f63 | |||
33a84ba374 | |||
8d9bce7c33 | |||
a92faf9d3d | |||
ab16e6c6c0 | |||
ed21a5183b | |||
dcb64d5db7 | |||
42ba37691e | |||
020cbe902e | |||
fac0fa6653 | |||
b8adb4df00 | |||
1758679bd6 | |||
98fd29d60c | |||
26ccffe3d0 | |||
f5368b7666 | |||
c126ed4b87 | |||
9e6a7d8e5f | |||
15142ddf9d | |||
831160baa2 | |||
db6b4db44d | |||
f414a067b8 | |||
833740c25b | |||
ee8c9873bc | |||
efdf9e57a4 | |||
2609a56230 | |||
24dd51c869 | |||
8872307cb1 | |||
50610bf111 | |||
25d57dbe3e | |||
d754f23bcf | |||
973b12c5c8 | |||
ff022f31cf | |||
bc4755e14f | |||
9f9f46f34b | |||
dd2dbfacbb | |||
2f8875124b | |||
603337af8f | |||
47f5cc6fa1 | |||
31c5b449bb | |||
1afe49fdbf | |||
b5dcded581 | |||
36c217882a | |||
49d23c0323 | |||
ec8aac99c5 | |||
328e0b5561 | |||
e927090ba0 | |||
1d0dabd892 | |||
2c52692f8d |
1339
appendix.htm
1339
appendix.htm
File diff suppressed because it is too large
Load Diff
225
changes.txt
225
changes.txt
@ -1,225 +0,0 @@
|
||||
CHANGED: Build options for VC6 to avoid compiler optimisation bug.
|
||||
FIXED: Missing BOOST_RE_NO_WCSTRING guard around using declaration in regex.h
|
||||
FIXED: Pathological regular expressions in snip4.cpp and in docs.
|
||||
FIXED: Missing std:: prefixes in some headers.
|
||||
|
||||
Version 302:
|
||||
FIXED: STLPort debug problems.
|
||||
FIXED: Compatibility with updated Dinkum libraries and VC6.
|
||||
ADDED: Tentative support for partial matches (not yet documented).
|
||||
|
||||
Version 301:
|
||||
First boost release version,
|
||||
CHANGED: reg_match to match_results
|
||||
CHANGED: Documentation updated to reflect changes, provided links to sources from docs.
|
||||
CHANGED: RegEx(const char*) constructor to explicit.
|
||||
CHANGED: Return type of RegEx::Split to unsigned int.
|
||||
ADDED: Exception documentation for OS errors.
|
||||
REMOVED: BOOST_RE_NO_EXCEPTIONS macro.
|
||||
FIXED: mapfile::open/close to check for OS errors.
|
||||
FIXED: Non-exception safe code in cpp_regex_traits.
|
||||
FIXED: Removed undefined symbol INFINITE from re_thrd.hpp
|
||||
FIXED: Bug in configure script thread detection code.
|
||||
CHANGED: "depreciated" to "deprecated"
|
||||
FIXED: Documentation error for bad_expression.
|
||||
CHANGED: regbase::flag_type to unsigned int
|
||||
ADDED: explicit constructors to reg_expression/match_results
|
||||
ADDED: extra signatures for regex_format/regex_merge for std::string arguments.
|
||||
REMOVED: bad_pattern/bad_expression::what from regex.cpp
|
||||
REMOVED: Implicit conversion operators from sub_match (except for conversion to basic_string).
|
||||
|
||||
Version 300:
|
||||
Candidate release boost version,
|
||||
ADDED: Support for non-greedy repeats.
|
||||
ADDED: Support for non-marking grouping.
|
||||
ADDED: Auto-detection of STLPort STL versions.
|
||||
CHANGED: Re-written and re-organised traits classes.
|
||||
CHANGED: Regression test make files for more rigorous testing of all build versions.
|
||||
|
||||
Version 249:
|
||||
Pre-release boost version,
|
||||
CHANGED: All macro prefixes to BOOST_RE_
|
||||
CHANGED: namespaces to boost
|
||||
CHANGED: Header file extentions to .hpp
|
||||
DEPRECIATED: Old style algorithms, replaced with more consistant naming style.
|
||||
DEPRECIATED: Standard library independant compiles no longer possible, bespoke
|
||||
classes replaced with standard library/boost equivalents where available.
|
||||
|
||||
Version 221:
|
||||
ADDED: C++ Builder 3 workaround in boost/detail/jgrep.hpp
|
||||
|
||||
Version 220:
|
||||
ADDED: Merge functions to class RegEx
|
||||
|
||||
|
||||
Version 218:
|
||||
FIXED: All known bugs prior to this version.
|
||||
FIXED: Added workaround for gcc optimisation bug to jm/regmatch.h
|
||||
ADDED: Cygwin mount point support.
|
||||
|
||||
Version 217:
|
||||
BUG: configure script did not correctly identify template
|
||||
friend support, or template function partial ordering support.
|
||||
|
||||
FIXED: All known bugs prior to this version.
|
||||
|
||||
Version 216:
|
||||
BUG: Some RegEx::Grep variants buggy.
|
||||
BUG: FileIterator leaked memory.
|
||||
BUG: Memory alignment problems with gcc/sparc platform
|
||||
|
||||
CHANGED: RegEx callback declarations to cope with VC6 builds using
|
||||
non-default calling conventions.
|
||||
CHANGED: Some configuration options to try and keep Mingwin32 port
|
||||
of gcc 2.95 happy.
|
||||
FIXED: Bug in RegEx::What introduced in version 214 fix :-(
|
||||
|
||||
Version 215:
|
||||
CHANGED: Added #pragma push/pop to fix C++ Builder 3 problems.
|
||||
CHANGED: Wide to narrow character conversions, to be more conformant with standard.
|
||||
CHANGED: Minor documentation updates.
|
||||
|
||||
Version 214:
|
||||
FIXED All known bugs rpior to this point.
|
||||
CHANGED: Minor changes to keep VC5 and GCC 2.95 happy.
|
||||
|
||||
Version 213:
|
||||
BUG: Far eastern versions of Win32 could not compile
|
||||
re_nlsw.cpp due to string literal - code page
|
||||
interactions.
|
||||
|
||||
ADDED: Convenience conversion operators to sub_match<>.
|
||||
CHANGED: Removed REG_E_MEMORY as it duplicates REG_ESPACE.
|
||||
ADDED: Additional tests to regress.
|
||||
CHANGED: RegEx::GrepFiles and RegEx::FindFiles previously had undefined
|
||||
behaviour if the callback returned false, changed to abort
|
||||
the whole search if the callback returns false.
|
||||
|
||||
FIXED: All known bugs prior to this release.
|
||||
|
||||
Version 212:
|
||||
BUG: Use of catopen in re_mss.cpp causes problems on some systems.
|
||||
BUG: Comparison operators for reg_expression and reg_match should be const.
|
||||
BUG: Missing output iterator increment in regfmt.h.
|
||||
|
||||
ADDED: REG_NOCOLLATE, so that locale dependent collation can be turned off for
|
||||
the POSIX C API's as well as the underlying templates.
|
||||
CHANGED: Misc. documentation updates.
|
||||
FIXED: Linking problem for some egcs ports.
|
||||
CHANGED: Tightened up exception safety.
|
||||
ADDED: Convenience interfaces to query_match, reg_search, reg_grep, reg_format and reg_merge.
|
||||
ADDED: Convenience std::string overloads of reg_expression members.
|
||||
FIXED: All bugs found prior to this release.
|
||||
|
||||
|
||||
Version 211:
|
||||
BUG: RegEx::GrepFiles fails to log sub-expression matches correctly.
|
||||
BUG: file_iterator/directory_iterator fail to find all files when using '*'.
|
||||
|
||||
CHANGED: Changes required to make the code compile with HP's aCC compiler.
|
||||
CHANGED: Using declarations, to hide implimentation details.
|
||||
CHANGED: Behavior of ^ and $ to follow Unicode newline guidelines and account
|
||||
for \r\n sequences.
|
||||
|
||||
Version 210:
|
||||
FIXED: All known bugs prior to this point.
|
||||
ADDED: configure shell script for porting to Unix style systems.
|
||||
CHANGED: jm::reg_match_base::pair to jm::sub_match, for easier porting.
|
||||
|
||||
Version 200:
|
||||
BUG: RegEx::GrepFiles buggy
|
||||
BUG: RegEx::FindFiles buggy
|
||||
BUG: non-portable header file usage in fileiter.h
|
||||
BUG: non-portable enum declarations in headers.
|
||||
BUG: non-portable use of isspace in regfacet.cpp
|
||||
BUG: Missing regfac.obj from bcb makefiles.
|
||||
BUG: non-portable declaration of type jm::reg_match_base::reference.
|
||||
BUG: missing <wchar.h> declaration required by some systems.
|
||||
BUG: Use of JM_NO_WCSTRING incomplete.
|
||||
BUG: Misspelled JM_NO_EXCEPTIONS in places.
|
||||
BUG: regfmt.h has typo on line 538.
|
||||
BUG: reg_format and reg_merge not portable to all output iterator types.
|
||||
BUG: non-portable use of typedefs.
|
||||
BUG: non-portable use of friend declarations.
|
||||
|
||||
CHANGED: Allocator usage, to improve efficiency with instance based allocators.
|
||||
CHANGED: regress.h, various fixes for various Borland C++ versions, allocators cleaned up.
|
||||
ADDED: Win32 specific localisation code.
|
||||
ADDED: C and C++ specific localisation code.
|
||||
ADDED: collating element and equivalence class support.
|
||||
CHANGED: Character class declarations.
|
||||
CHANGED: Behaviour of ranges to deal with locales.
|
||||
ADDED: Support for some perl escape sequences (but not yet (?...) ).
|
||||
CHANGED: regbase::icase flag now turns on case insensitivity,
|
||||
traits class char_regex_traits_i is now deprecated.
|
||||
CHANGED: reg_grep now takes a predicate not an output iterator,
|
||||
allows user code to terminate search midway through,
|
||||
and to use regular callback function with grep.
|
||||
CHANGED: Modified search heuristics to improve certain expression
|
||||
types, especially expressions which start with a literal
|
||||
string, or a single character repeat. The latter are much
|
||||
less likely to become pathological now.
|
||||
ADDED: High level C++ class RegEx.
|
||||
|
||||
Version 111:
|
||||
BUG: Wouldn't compile directly on C++ Builder 4 when it was released
|
||||
(not really a bug - more an incompatability)
|
||||
|
||||
FIXED: All bugs discovered prior to this version (below).
|
||||
|
||||
Version 110:
|
||||
BUG: reg_match::maybe_assign could lead to pointer
|
||||
overrun in certain (rare) circumstances.
|
||||
|
||||
FIXED: All bugs discovered prior to this version (below).
|
||||
FIXED: Support for VC++, GCC, EGCS.
|
||||
CHANGED: Regress.h to work around various compiler bugs.
|
||||
|
||||
Version 100:
|
||||
BUG: Literal "," not recognised as a literal.
|
||||
|
||||
FIXED: All bugs discovered prior to this version (below).
|
||||
ADDED: Regress.exe, regression test application.
|
||||
|
||||
Version 095
|
||||
BUG: wide character sets that start with ^ not recognised,
|
||||
for example [^[:space:]] will not find anything.
|
||||
BUG: reg_grep fails if match occurs at first character.
|
||||
BUG: If regcomp fails, internal data not freed.
|
||||
BUG: reg_grep fails to reinitialise match after assignment
|
||||
to output iterator. Line start optimised search restarts
|
||||
from the wrong location if the match is longer than one line.
|
||||
BUG: POSIX API functions can propagate C++ exceptions if the
|
||||
default allocator can throw exceptions.
|
||||
BUG: character sets don't function correctly when regbase::char_classes
|
||||
is not set.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
1712
configure.in
1712
configure.in
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE posix_api_compiler_check.c
|
||||
* VERSION 3.01
|
||||
* DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
|
||||
* time check only.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <boost/regex.h>
|
||||
|
||||
const char* expression = "^";
|
||||
const char* text = "\n ";
|
||||
regmatch_t matches[1];
|
||||
int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
|
||||
REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
int result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
return result;
|
||||
}
|
||||
assert(re.re_nsub == 0);
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = strlen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
regfree(&re);
|
||||
return result;
|
||||
}
|
||||
assert(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
regfree(&re);
|
||||
return 0;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE posix_api_compiler_check.c
|
||||
* VERSION 3.01
|
||||
* DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
|
||||
* time check only.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <boost/regex.h>
|
||||
|
||||
const char* expression = "^";
|
||||
const char* text = "\n ";
|
||||
regmatch_t matches[1];
|
||||
int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
|
||||
REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
int result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
return result;
|
||||
}
|
||||
assert(re.re_nsub == 0);
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = strlen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
regfree(&re);
|
||||
return result;
|
||||
}
|
||||
assert(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
regfree(&re);
|
||||
return 0;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE wide_posix_api_compiler_check.c
|
||||
* VERSION 3.01
|
||||
* DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
|
||||
* time check only.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#define UNICODE
|
||||
#include <boost/regex.h>
|
||||
|
||||
const wchar_t* expression = L"^";
|
||||
const wchar_t* text = L"\n ";
|
||||
regmatch_t matches[1];
|
||||
int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
|
||||
REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
int result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
wchar_t buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
wprintf(buf);
|
||||
return result;
|
||||
}
|
||||
assert(re.re_nsub == 0);
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = wcslen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
wchar_t buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
wprintf(buf);
|
||||
regfree(&re);
|
||||
return result;
|
||||
}
|
||||
assert(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
regfree(&re);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE wide_posix_api_compiler_check.c
|
||||
* VERSION 3.01
|
||||
* DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
|
||||
* time check only.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#define UNICODE
|
||||
#include <boost/regex.h>
|
||||
|
||||
const wchar_t* expression = L"^";
|
||||
const wchar_t* text = L"\n ";
|
||||
regmatch_t matches[1];
|
||||
int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
|
||||
REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
int result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
wchar_t buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
wprintf(buf);
|
||||
return result;
|
||||
}
|
||||
assert(re.re_nsub == 0);
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = wcslen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
wchar_t buf[256];
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
wprintf(buf);
|
||||
regfree(&re);
|
||||
return result;
|
||||
}
|
||||
assert(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
regfree(&re);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
|
||||
# very basic makefile for jgrep.exe
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bc builder install
|
||||
#
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
LIBPATH=..\..\lib\bcb5
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
LINKOPTS= -ap -Tpe -x
|
||||
COMPOPTS= -O2 -tWM- -DSTRICT; -I$(BCROOT)\include;../../../../; -D_NO_VCL
|
||||
|
||||
|
||||
|
||||
jgrep.exe : jgrep.obj main.obj
|
||||
$(BCC32) $(COMPOPTS) -e$@ -L$(LIBPATH) main.obj jgrep.obj
|
||||
|
||||
jgrep.obj : jgrep.cpp
|
||||
$(BCC32) -c @&&|
|
||||
$(COMPOPTS) -o$@ jgrep.cpp
|
||||
|
|
||||
|
||||
main.obj : main.cpp
|
||||
$(BCC32) -c @&&|
|
||||
$(COMPOPTS) -o$@ main.cpp
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,49 +0,0 @@
|
||||
|
||||
# very basic makefile for jgrep.exe
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bc builder install
|
||||
#
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
LIBPATH="..\..\lib\bcb4"
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
LINKOPTS= -ap -Tpe -x
|
||||
COMPOPTS= -O2 -tWM- -DSTRICT; -I$(BCROOT)\include;../../../../; -D_NO_VCL
|
||||
|
||||
|
||||
|
||||
jgrep.exe : jgrep.obj main.obj
|
||||
$(BCC32) @&&|
|
||||
$(COMPOPTS) -e$@ -L$(LIBPATH) main.obj jgrep.obj
|
||||
|
|
||||
|
||||
jgrep.obj : jgrep.cpp
|
||||
$(BCC32) -c @&&|
|
||||
$(COMPOPTS) -o$@ jgrep.cpp
|
||||
|
|
||||
|
||||
main.obj : main.cpp
|
||||
$(BCC32) -c @&&|
|
||||
$(COMPOPTS) -o$@ main.cpp
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
|
||||
# very basic makefile for jgrep.exe
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bc builder install
|
||||
#
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
LIBPATH=../../lib/bcb5
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
LINKOPTS= -ap -Tpe -x
|
||||
COMPOPTS= -O2 -tWM- -DSTRICT; -I$(BCROOT)\include;../../../../; -D_NO_VCL
|
||||
|
||||
|
||||
|
||||
jgrep.exe : jgrep.obj main.obj
|
||||
$(BCC32) $(COMPOPTS) -e$@ -L..\..\lib\bcb5 main.obj jgrep.obj
|
||||
|
||||
jgrep.obj : jgrep.cpp
|
||||
$(BCC32) -c @&&|
|
||||
$(COMPOPTS) -o$@ jgrep.cpp
|
||||
|
|
||||
|
||||
main.obj : main.cpp
|
||||
$(BCC32) -c @&&|
|
||||
$(COMPOPTS) -o$@ main.cpp
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
|
||||
# very basic makefile for jgrep
|
||||
#
|
||||
# GNU compiler g++
|
||||
#
|
||||
CXX= -O2 -I../../../../ -I./
|
||||
|
||||
jgrep : jgrep.cpp main.cpp
|
||||
g++ -ojgrep $(CXX) jgrep.cpp main.cpp -L../../lib/gcc -lregex++
|
||||
|
||||
debug : jgrep.cpp main.cpp
|
||||
g++ -ojgrep -I../../../../ -I./ -g jgrep.cpp main.cpp -L../../lib/gcc -lregex++debug
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FILE jgrep.cpp
|
||||
* VERSION 3.02
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <boost/regex.hpp>
|
||||
#ifdef JM_OLD_IOSTREAM
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
using std::cin;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
#endif
|
||||
#pragma hrdstop
|
||||
|
||||
#include <boost/re_detail/fileiter.hpp>
|
||||
|
||||
#include "jgrep.h"
|
||||
|
||||
|
||||
//
|
||||
// class ogrep_predicate
|
||||
// outputs the results of regex_grep to screen:
|
||||
template <class iterator, class Allocator >
|
||||
class ogrep_predicate
|
||||
{
|
||||
unsigned int& lines;
|
||||
const char* filename;
|
||||
unsigned int last_line;
|
||||
iterator end_of_storage;
|
||||
public:
|
||||
ogrep_predicate(unsigned int& i, const char* p, iterator e) : lines(i), filename(p), last_line(-1), end_of_storage(e) {}
|
||||
ogrep_predicate(const ogrep_predicate& o) : lines(o.lines), filename(o.filename), last_line(o.last_line), end_of_storage(o.end_of_storage) {}
|
||||
bool operator () (const boost::match_results<iterator, Allocator>& i);
|
||||
};
|
||||
|
||||
// ideally we'd ignor the allocator type and use a template member function
|
||||
// to deel with the allocator type passed to regex_grep, unfortunately most
|
||||
// compilers don't support this feature yet, so we'll have to be sure that
|
||||
// the allocator passed to instances of this class match that used in our
|
||||
// regular expression classes.
|
||||
|
||||
template <class iterator, class Allocator>
|
||||
bool ogrep_predicate<iterator, Allocator>::operator()(const boost::match_results<iterator, Allocator>& i)
|
||||
{
|
||||
if(last_line == (unsigned int)-1)
|
||||
cout << "File " << filename << ":" << endl;
|
||||
if(last_line != i.line())
|
||||
{
|
||||
++lines;
|
||||
last_line = i.line();
|
||||
if(count_only == 0)
|
||||
{
|
||||
if(show_lines)
|
||||
cout << i.line() << "\t";
|
||||
iterator ptr = i.line_start();
|
||||
while((ptr != end_of_storage) && (*ptr != '\n'))++ptr;
|
||||
iterator pos = i.line_start();
|
||||
while(pos != ptr)
|
||||
{
|
||||
cout.put(*pos);
|
||||
++pos;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void process_grep(const char* file)
|
||||
{
|
||||
using namespace boost;
|
||||
mapfile f(file);
|
||||
unsigned int count = 0;
|
||||
ogrep_predicate<mapfile::iterator, allocator_type> oi(count, file, f.end());
|
||||
if(files_only)
|
||||
{
|
||||
bool ok;
|
||||
boost::match_results<mapfile::iterator, allocator_type> m;
|
||||
ok = regex_search(f.begin(), f.end(), m, e, match_not_dot_newline | match_not_dot_null);
|
||||
if(ok)
|
||||
cout << "File " << file << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
regex_grep(oi, f.begin(), f.end(), e, match_not_dot_newline | match_not_dot_null);
|
||||
if(count)
|
||||
{
|
||||
if(verbose || count_only)
|
||||
{
|
||||
cout << count << " lines match" << endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(verbose)
|
||||
{
|
||||
cout << "File " << file << "(" << f.size() << "bytes):" << endl << "0 lines match" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FILE jgrep.h
|
||||
* VERSION 3.02
|
||||
*/
|
||||
|
||||
#ifndef _JGREP_H
|
||||
#define _JGREP_H
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// case sensitive reg_expression determines our allocator type:
|
||||
typedef boost::reg_expression<char> re_type;
|
||||
typedef re_type::allocator_type allocator_type;
|
||||
|
||||
// now declare static (global) data, including an allocator
|
||||
// instance which we'll pass to all instances that require an allocator.
|
||||
|
||||
extern allocator_type a;
|
||||
|
||||
extern re_type e;
|
||||
|
||||
// flags for output:
|
||||
|
||||
extern bool use_case;
|
||||
extern bool show_lines;
|
||||
extern bool count_only;
|
||||
extern bool files_only;
|
||||
extern bool recurse;
|
||||
extern bool regularexs;
|
||||
extern bool words_only;
|
||||
extern bool verbose;
|
||||
|
||||
void process_grep(const char* file);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,284 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* FILE main.cpp
|
||||
* VERSION 3.02
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <boost/regex.hpp>
|
||||
#ifdef JM_OLD_IOSTREAM
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
using std::cin;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
#endif
|
||||
#pragma hrdstop
|
||||
|
||||
#include <boost/re_detail/fileiter.hpp>
|
||||
#include "jgrep.h"
|
||||
|
||||
#ifndef JM_ALGO_INCLUDED
|
||||
// HP and SGI STL's use <algo.h> instead
|
||||
// this will have been pulled in by <jm_cfg.h>
|
||||
// for std::distance
|
||||
#include <algorithm>
|
||||
#endif
|
||||
|
||||
allocator_type a;
|
||||
|
||||
re_type e(a);
|
||||
//rei_type ei(a);
|
||||
|
||||
// flags for output:
|
||||
|
||||
bool use_case = true;
|
||||
bool show_lines = false;
|
||||
bool count_only = false;
|
||||
bool files_only = false;
|
||||
bool recurse = false;
|
||||
bool regularexs = true;
|
||||
bool words_only = false;
|
||||
bool verbose = false;
|
||||
|
||||
|
||||
void usage()
|
||||
{
|
||||
cout <<
|
||||
"jgrep version 0.95\n"
|
||||
"usage: jgrep [-options] expression file [files...]\n"
|
||||
"\n"
|
||||
"options can be one of the following:\n"
|
||||
"\n"
|
||||
"-c prints a count of the number of matching lines only\n"
|
||||
"-d recurses through subdirectories for matching files\n"
|
||||
"-i causes case to be ignored when matching\n"
|
||||
"-l lists the files which contain a match only\n"
|
||||
"-n displays the line numbers of matches\n"
|
||||
"-r- causes the expression to be interpreted as a literal string and not\n"
|
||||
" as a regular expression\n"
|
||||
"-w searches for matches that are whole words only\n"
|
||||
"-z verbose mode\n"
|
||||
"\n"
|
||||
"expression: a regular expression, or a literal string if -r- is specified\n"
|
||||
"\n"
|
||||
"files: one or more files to search, the names can contain the wildcard\n"
|
||||
" characters ? and *\n" << endl;
|
||||
|
||||
}
|
||||
|
||||
void parse_switch(const char* flag)
|
||||
{
|
||||
++flag;
|
||||
while(*flag)
|
||||
{
|
||||
switch(*flag)
|
||||
{
|
||||
case '-':
|
||||
switch(*(flag-1))
|
||||
{
|
||||
case 'c':
|
||||
count_only = false;
|
||||
break;
|
||||
case 'd':
|
||||
recurse = false;
|
||||
break;
|
||||
case 'i':
|
||||
use_case = false;
|
||||
break;
|
||||
case 'l':
|
||||
files_only = false;
|
||||
break;
|
||||
case 'n':
|
||||
show_lines = false;
|
||||
break;
|
||||
case 'r':
|
||||
regularexs = false;
|
||||
break;
|
||||
case 'w':
|
||||
words_only = false;
|
||||
break;
|
||||
case 'z':
|
||||
verbose = false;
|
||||
break;
|
||||
default:
|
||||
cout << "Undefined option -";
|
||||
cout.put(*flag);
|
||||
cout << endl;
|
||||
}
|
||||
// turn off prev character:
|
||||
break;
|
||||
case 'c':
|
||||
count_only = true;
|
||||
break;
|
||||
case 'd':
|
||||
recurse = true;
|
||||
break;
|
||||
case 'i':
|
||||
use_case = false;
|
||||
break;
|
||||
case 'l':
|
||||
files_only = true;
|
||||
break;
|
||||
case 'n':
|
||||
show_lines = true;
|
||||
break;
|
||||
case 'r':
|
||||
regularexs = true;
|
||||
break;
|
||||
case 'w':
|
||||
words_only = true;
|
||||
break;
|
||||
case 'z':
|
||||
verbose = true;
|
||||
break;
|
||||
case '?':
|
||||
usage();
|
||||
exit(0);
|
||||
case '+':
|
||||
break;
|
||||
default:
|
||||
cout << "Undefined option -";
|
||||
cout.put(*flag);
|
||||
cout << endl;
|
||||
}
|
||||
++flag;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleFile(const char* wild)
|
||||
{
|
||||
using namespace boost;
|
||||
jm_trace("Handling file " << wild);
|
||||
file_iterator end;
|
||||
file_iterator start(wild);
|
||||
|
||||
if(recurse)
|
||||
{
|
||||
// go through sub directories:
|
||||
char buf[MAX_PATH];
|
||||
std::strcpy(buf, start.root());
|
||||
int rootlen = strlen(buf);
|
||||
if(*buf == 0)
|
||||
{
|
||||
std::strcpy(buf, ".");
|
||||
std::strcat(buf, directory_iterator::separator());
|
||||
std::strcat(buf, "*");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::strcat(buf, directory_iterator::separator());
|
||||
std::strcat(buf, "*");
|
||||
}
|
||||
jm_trace("Enumerating directories: " << buf);
|
||||
directory_iterator dstart(buf);
|
||||
directory_iterator dend;
|
||||
|
||||
// now get the file mask bit of "wild":
|
||||
const char* ptr = wild + rootlen;
|
||||
if(*ptr) ++ptr;
|
||||
jm_trace("File mask part is: " << ptr);
|
||||
|
||||
while(dstart != dend)
|
||||
{
|
||||
std::sprintf(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
|
||||
HandleFile(buf);
|
||||
++dstart;
|
||||
}
|
||||
}
|
||||
std::for_each(start, end, process_grep);
|
||||
}
|
||||
|
||||
int done = 0;
|
||||
|
||||
void HandleArg(const char* arg)
|
||||
{
|
||||
using namespace boost;
|
||||
jm_trace("Handling argument: " << arg);
|
||||
if(*arg == '-')
|
||||
{
|
||||
parse_switch(arg);
|
||||
return;
|
||||
}
|
||||
if(done == 0)
|
||||
{
|
||||
// parse regular expression
|
||||
if(regularexs)
|
||||
{
|
||||
if(words_only == 0)
|
||||
{
|
||||
e.set_expression(arg, use_case ? regbase::normal : regbase::normal | regbase::icase);
|
||||
//ei.set_expression(arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
char* buf = new char[std::strlen(arg) + 8];
|
||||
std::sprintf(buf, "\\<%s\\>", arg);
|
||||
e.set_expression(buf, use_case ? regbase::normal : regbase::normal | regbase::icase);
|
||||
//ei.set_expression(buf);
|
||||
delete[] buf;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we need to convert text to literal:
|
||||
int len2 = std::strlen(arg);
|
||||
int len = len2 * 5 + 6;
|
||||
char buf[8];
|
||||
char* buf2 = new char[len];
|
||||
*buf2 = 0;
|
||||
if(words_only)
|
||||
std::strcpy(buf2, "\\<");
|
||||
for(int j = 0; j < len2; ++j)
|
||||
{
|
||||
std::sprintf(buf, "\\0%o", int(arg[j]));
|
||||
std::strcat(buf2, buf);
|
||||
}
|
||||
if(words_only)
|
||||
std::strcat(buf2, "\\>");
|
||||
e.set_expression(buf2, use_case ? regbase::normal : regbase::normal | regbase::icase);
|
||||
//ei.set_expression(buf2);
|
||||
delete[] buf2;
|
||||
}
|
||||
done = 1;
|
||||
return;
|
||||
}
|
||||
// if we get to here we have one or more file names to process:
|
||||
++done;
|
||||
HandleFile(arg);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
for(int i = 1; i < argc; ++i)
|
||||
HandleArg(argv[i]);
|
||||
if(done < 2)
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
|
||||
# very basic makefile for jgrep
|
||||
#
|
||||
|
||||
CXX=@CXX@
|
||||
CXXFLAGS=@CXXFLAGS@
|
||||
LIBS=@LIBS@
|
||||
EXE=@ac_exe_ext@
|
||||
OBJ=@ac_obj_ext@
|
||||
|
||||
LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp
|
||||
|
||||
jgrep$(EXE) : jgrep$(OBJ) main$(OBJ)
|
||||
$(CXX) -o jgrep$(EXE) jgrep$(OBJ) main$(OBJ) -L../../lib -lregex++ $(LIBS)
|
||||
|
||||
jgrep$(OBJ) : jgrep.cpp jgrep.h $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) -I../../../../ -I./ jgrep.cpp
|
||||
|
||||
main$(OBJ) : main.cpp jgrep.h $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) -I../../../../ -I./ main.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,20 +0,0 @@
|
||||
# Makefile for timer application
|
||||
#
|
||||
# for SUN workshop 5.0 C++ compiler
|
||||
#
|
||||
|
||||
CXX=CC
|
||||
CPP_FLAGS = -O -I../../../../ -I./
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) -c -o $@ $(CPP_FLAGS) $<
|
||||
|
||||
jgrep : jgrep.o main.o
|
||||
$(CXX) -o $@ $(CPP_FLAGS) jgrep.o main.o -L../../lib -lregex++
|
||||
|
||||
clean:
|
||||
rm -rf SunWS_cache
|
||||
rm -f jgrep.o jgrep main.o
|
||||
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
|
||||
#
|
||||
# very simple makefile for Visual C++ 6 + STLPort 4
|
||||
#
|
||||
|
||||
jgrep.exe: main.cpp jgrep.cpp jgrep.h
|
||||
cl -GX -GR /Oityb1 /GF /Gy -MT -I..\..\..\..\ jgrep.cpp main.cpp /link /LIBPATH:..\..\lib\vc6-stlport user32.lib
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
|
||||
#
|
||||
# very simple makefile for Visual C++ 6
|
||||
#
|
||||
|
||||
jgrep.exe: main.cpp jgrep.cpp jgrep.h
|
||||
cl -GX -GR /Oityb1 /GF /Gy -I..\..\..\..\ jgrep.cpp main.cpp /link /LIBPATH:..\..\lib\vc6 user32.lib
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,134 +0,0 @@
|
||||
|
||||
# very basic makefile for regress
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bcb install
|
||||
#
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
TLINK32 = $(BCROOT)\bin\ILink32.exe
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
LINKOPTS= -ap -Tpe -x
|
||||
CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb5
|
||||
|
||||
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe
|
||||
echo testing static single threaded version....
|
||||
r1 tests.txt test1252.txt
|
||||
r2 tests.txt
|
||||
r3 tests.txt
|
||||
r4 tests.txt test1252.txt
|
||||
r5 tests.txt
|
||||
r6 tests.txt
|
||||
echo testing static multi-threaded version....
|
||||
r1m tests.txt test1252.txt
|
||||
r2m tests.txt
|
||||
r3m tests.txt
|
||||
r4m tests.txt test1252.txt
|
||||
r5m tests.txt
|
||||
r6m tests.txt
|
||||
echo testing dll single threaded version....
|
||||
r1l tests.txt test1252.txt
|
||||
r2l tests.txt
|
||||
r3l tests.txt
|
||||
r4l tests.txt test1252.txt
|
||||
r5l tests.txt
|
||||
r6l tests.txt
|
||||
echo testing dll multi-threaded version....
|
||||
r1lm tests.txt test1252.txt
|
||||
r2lm tests.txt
|
||||
r3lm tests.txt
|
||||
r4lm tests.txt test1252.txt
|
||||
r5lm tests.txt
|
||||
r6lm tests.txt
|
||||
|
||||
|
||||
r1.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er1.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er2.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er3.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er4.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er5.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er6.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,186 +0,0 @@
|
||||
|
||||
# very basic makefile for regress
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bcb install
|
||||
#
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
TLINK32 = $(BCROOT)\bin\ILink32.exe
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
LINKOPTS= -ap -Tpe -x
|
||||
CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb4
|
||||
|
||||
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe
|
||||
echo testing static single threaded version....
|
||||
r1 tests.txt test1252.txt
|
||||
r2 tests.txt
|
||||
r3 tests.txt
|
||||
r4 tests.txt test1252.txt
|
||||
r5 tests.txt
|
||||
r6 tests.txt
|
||||
echo testing static multi-threaded version....
|
||||
r1m tests.txt test1252.txt
|
||||
r2m tests.txt
|
||||
r3m tests.txt
|
||||
r4m tests.txt test1252.txt
|
||||
r5m tests.txt
|
||||
r6m tests.txt
|
||||
echo testing static VCL version....
|
||||
r1v tests.txt test1252.txt
|
||||
r2v tests.txt
|
||||
r3v tests.txt
|
||||
r4v tests.txt test1252.txt
|
||||
r5v tests.txt
|
||||
r6v tests.txt
|
||||
echo testing dll single threaded version....
|
||||
r1l tests.txt test1252.txt
|
||||
r2l tests.txt
|
||||
r3l tests.txt
|
||||
r4l tests.txt test1252.txt
|
||||
r5l tests.txt
|
||||
r6l tests.txt
|
||||
echo testing dll multi-threaded version....
|
||||
r1lm tests.txt test1252.txt
|
||||
r2lm tests.txt
|
||||
r3lm tests.txt
|
||||
r4lm tests.txt test1252.txt
|
||||
r5lm tests.txt
|
||||
r6lm tests.txt
|
||||
echo testing dll VCL version....
|
||||
r1lv tests.txt test1252.txt
|
||||
r2lv tests.txt
|
||||
r3lv tests.txt
|
||||
r4lv tests.txt test1252.txt
|
||||
r5lv tests.txt
|
||||
r6lv tests.txt
|
||||
|
||||
|
||||
r1.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er1.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er2.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er3.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er4.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er5.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er6.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r2lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,186 +0,0 @@
|
||||
|
||||
# very basic makefile for regress
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bcb install
|
||||
#
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
TLINK32 = $(BCROOT)\bin\ILink32.exe
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
LINKOPTS= -ap -Tpe -x
|
||||
CFLAGS= -O2 -tWC -DSTRICT; -w-inl -w-aus -w-csu -w-eff -w-rch -I$(BCROOT)\include;..\..\..\..\; -L..\..\lib\bcb5
|
||||
|
||||
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1v.exe r2v.exe r3v.exe r4v.exe r5v.exe r6v.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1lm.exe r2lm.exe r3lm.exe r4lm.exe r5lm.exe r6lm.exe r1lv.exe r2lv.exe r3lv.exe r4lv.exe r5lv.exe r6lv.exe
|
||||
echo testing static single threaded version....
|
||||
r1 tests.txt test1252.txt
|
||||
r2 tests.txt
|
||||
r3 tests.txt
|
||||
r4 tests.txt test1252.txt
|
||||
r5 tests.txt
|
||||
r6 tests.txt
|
||||
echo testing static multi-threaded version....
|
||||
r1m tests.txt test1252.txt
|
||||
r2m tests.txt
|
||||
r3m tests.txt
|
||||
r4m tests.txt test1252.txt
|
||||
r5m tests.txt
|
||||
r6m tests.txt
|
||||
echo testing static VCL version....
|
||||
r1v tests.txt test1252.txt
|
||||
r2v tests.txt
|
||||
r3v tests.txt
|
||||
r4v tests.txt test1252.txt
|
||||
r5v tests.txt
|
||||
r6v tests.txt
|
||||
echo testing dll single threaded version....
|
||||
r1l tests.txt test1252.txt
|
||||
r2l tests.txt
|
||||
r3l tests.txt
|
||||
r4l tests.txt test1252.txt
|
||||
r5l tests.txt
|
||||
r6l tests.txt
|
||||
echo testing dll multi-threaded version....
|
||||
r1lm tests.txt test1252.txt
|
||||
r2lm tests.txt
|
||||
r3lm tests.txt
|
||||
r4lm tests.txt test1252.txt
|
||||
r5lm tests.txt
|
||||
r6lm tests.txt
|
||||
echo testing dll VCL version....
|
||||
r1lv tests.txt test1252.txt
|
||||
r2lv tests.txt
|
||||
r3lv tests.txt
|
||||
r4lv tests.txt test1252.txt
|
||||
r5lv tests.txt
|
||||
r6lv tests.txt
|
||||
|
||||
|
||||
r1.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er1.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er2.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er3.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er4.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er5.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -D_NO_VCL $(CFLAGS) -er6.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1m.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er1m.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er2m.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er3m.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er4m.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er5m.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6m.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -D_NO_VCL $(CFLAGS) -er6m.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1v.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er1v.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er2v.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er3v.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er4v.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er5v.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6v.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWV $(CFLAGS) -er6v.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1l.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er1l.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er2l.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er3l.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er4l.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er5l.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6l.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM- -tWR -D_NO_VCL $(CFLAGS) -er6l.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1lm.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er1lm.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er2lm.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er3lm.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er4lm.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er5lm.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6lm.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -D_NO_VCL $(CFLAGS) -er6lm.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
r1lv.exe : tests.cpp regress.cpp parse.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er1lv.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp regress.cpp parse.cpp
|
||||
|
||||
r2lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er2lv.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r3lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er3lv.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r4lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er4lv.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r5lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er5lv.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
r6lv.exe : tests.cpp parse.cpp regress.cpp
|
||||
$(BCC32) -tWM -tWR -tWV -tWC $(CFLAGS) -er6lv.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
|
||||
# very basic makefile for regression tests
|
||||
#
|
||||
# g++ 2.95 and greater
|
||||
#
|
||||
CXX= g++ -pedantic -Wall -I../../../../ -I./ -L../../lib/gcc
|
||||
|
||||
total : r2
|
||||
./r2 tests.txt
|
||||
|
||||
r2 : tests.cpp parse.cpp regress.cpp
|
||||
$(CXX) -O2 -o r2 tests.cpp parse.cpp regress.cpp -lregex++
|
||||
|
||||
debug : tests.cpp parse.cpp regress.cpp
|
||||
$(CXX) -g -o r2 tests.cpp parse.cpp regress.cpp -lregex++debug
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
|
||||
# very basic makefile for regression tests
|
||||
#
|
||||
CXX=@CXX@
|
||||
CXXFLAGS=@CXXFLAGS@ -I../../../../
|
||||
LIBS=@LIBS@ -L../../lib -lregex++
|
||||
EXE=@ac_exe_ext@
|
||||
OBJ=@ac_obj_ext@
|
||||
|
||||
total : @ac_regress@
|
||||
|
||||
LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp
|
||||
|
||||
r1$(EXE) :: tests.cpp parse.cpp regress.cpp
|
||||
$(CXX) -o r1$(EXE) $(CXXFLAGS) tests.cpp parse.cpp regress.cpp $(LIBS)
|
||||
./r1 tests.txt
|
||||
|
||||
r2$(EXE) :: tests.cpp parse.cpp regress.cpp
|
||||
$(CXX) -o r2$(EXE) $(CXXFLAGS) -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LIBS)
|
||||
./r2 tests.txt
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,327 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* FILE parse.cpp
|
||||
* VERSION 3.02
|
||||
*
|
||||
* Input parsing functions for regress.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include "regress.h"
|
||||
|
||||
#ifndef BOOST_RE_ALGO_INCLUDED
|
||||
#include <algorithm>
|
||||
#endif
|
||||
|
||||
using namespace boost;
|
||||
|
||||
//
|
||||
// start by defining all our flag types:
|
||||
|
||||
flag_info flag_data[] = {
|
||||
{ BOOST_RE_STR("REG_BASIC"), 9, REG_BASIC, 0 },
|
||||
{ BOOST_RE_STR("REG_EXTENDED"), 12, REG_EXTENDED, 0 },
|
||||
{ BOOST_RE_STR("REG_ICASE"), 9, REG_ICASE, 0 },
|
||||
{ BOOST_RE_STR("REG_NOSUB"), 9, REG_NOSUB, 0 },
|
||||
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
|
||||
{ BOOST_RE_STR("REG_NEWLINE"), 11, REG_NEWLINE, 0 },
|
||||
{ BOOST_RE_STR("REG_NOSPEC"), 10, REG_NOSPEC, 0 },
|
||||
|
||||
{ BOOST_RE_STR("REG_NOTBOL"), 10, REG_NOTBOL, 1 },
|
||||
{ BOOST_RE_STR("REG_NOTEOL"), 10, REG_NOTEOL, 1 },
|
||||
{ BOOST_RE_STR("REG_STARTEND"), 12, REG_STARTEND, 1 },
|
||||
|
||||
{ BOOST_RE_STR("basic"), 5, regbase::basic, 2 },
|
||||
{ BOOST_RE_STR("escape_in_lists"), 15, regbase::escape_in_lists, 2 },
|
||||
{ BOOST_RE_STR("char_classes"), 12, regbase::char_classes, 2 },
|
||||
{ BOOST_RE_STR("intervals"), 9, regbase::intervals, 2 },
|
||||
{ BOOST_RE_STR("limited_ops"), 11, regbase::limited_ops, 2 },
|
||||
{ BOOST_RE_STR("newline_alt"), 11, regbase::newline_alt, 2 },
|
||||
{ BOOST_RE_STR("bk_plus_qm"), 10, regbase::bk_plus_qm, 2 },
|
||||
{ BOOST_RE_STR("bk_braces"), 9, regbase::bk_braces, 2 },
|
||||
{ BOOST_RE_STR("bk_parens"), 9, regbase::bk_parens, 2 },
|
||||
{ BOOST_RE_STR("bk_refs"), 7, regbase::bk_refs, 2 },
|
||||
{ BOOST_RE_STR("bk_vbar"), 7, regbase::bk_vbar, 2 },
|
||||
{ BOOST_RE_STR("use_except"), 10, regbase::use_except, 2 },
|
||||
{ BOOST_RE_STR("literal"), 7, regbase::literal, 2 },
|
||||
{ BOOST_RE_STR("normal"), 6, regbase::normal, 2 },
|
||||
{ BOOST_RE_STR("basic"), 5, regbase::basic, 2 },
|
||||
{ BOOST_RE_STR("extended"), 8, regbase::extended, 2 },
|
||||
|
||||
{ BOOST_RE_STR("match_default"), 13, match_default, 3 },
|
||||
{ BOOST_RE_STR("match_not_bol"), 13, match_not_bol, 3 },
|
||||
{ BOOST_RE_STR("match_not_eol"), 13, match_not_eol, 3 },
|
||||
{ BOOST_RE_STR("match_not_bob"), 13, match_not_bob, 3 },
|
||||
{ BOOST_RE_STR("match_not_eob"), 13, match_not_eob, 3 },
|
||||
{ BOOST_RE_STR("match_not_bow"), 13, match_not_bow, 3 },
|
||||
{ BOOST_RE_STR("match_not_eow"), 13, match_not_eow, 3 },
|
||||
{ BOOST_RE_STR("match_not_dot_newline"), 21, match_not_dot_newline, 3 },
|
||||
{ BOOST_RE_STR("match_not_dot_null"), 18, match_not_dot_null, 3 },
|
||||
{ BOOST_RE_STR("match_prev_avail"), 16, match_prev_avail, 3 },
|
||||
{ BOOST_RE_STR("match_any"), 9, match_any, 3 },
|
||||
{ BOOST_RE_STR("match_not_null"), 14, match_not_null, 3 },
|
||||
{ BOOST_RE_STR("match_continuous"), 16, match_continuous, 3 },
|
||||
{ BOOST_RE_STR("match_partial"), 13, match_partial, 3 },
|
||||
|
||||
{ BOOST_RE_STR("format_sed"), 10, format_sed, 3 },
|
||||
{ BOOST_RE_STR("format_perl"), 11, format_perl, 3 },
|
||||
{ BOOST_RE_STR("format_no_copy"), 14, format_no_copy, 3 },
|
||||
|
||||
{ BOOST_RE_STR("REG_NO_POSIX_TEST"), 17, REG_NO_POSIX_TEST, 4 },
|
||||
{ BOOST_RE_STR("REG_UNICODE_ONLY"), 16, REG_UNICODE_ONLY, 4 },
|
||||
{ BOOST_RE_STR("REG_GREP"), 8, REG_GREP, 4 },
|
||||
{ BOOST_RE_STR("REG_MERGE"), 9, REG_MERGE, 4 },
|
||||
{ BOOST_RE_STR("REG_MERGE_COPY"), 14, REG_MERGE_COPY, 4 },
|
||||
|
||||
{ BOOST_RE_STR(""), 0, 0, 0 },
|
||||
};
|
||||
|
||||
// basically we create a simple token parser
|
||||
// using regular expressions
|
||||
|
||||
const char_t* expression_text = BOOST_RE_STR("(;.*)|") // comment
|
||||
BOOST_RE_STR("(^[[:blank:]]*-)|") // -
|
||||
BOOST_RE_STR("([^\"[:space:]][^[:space:]]*)|") // token
|
||||
BOOST_RE_STR("(\"(([^\"]|\\\\\")*)\")") // "token"
|
||||
;
|
||||
|
||||
typedef reg_expression<char_t> re_parse_t;
|
||||
typedef re_parse_t::allocator_type parse_alloc;
|
||||
typedef match_results<string_type::const_iterator, parse_alloc> parse_grep;
|
||||
typedef string_type::const_iterator parse_iterator;
|
||||
|
||||
re_parse_t parse_expression(expression_text, regbase::normal);
|
||||
|
||||
//
|
||||
// now define our grep predicate function object:
|
||||
class parse_function
|
||||
{
|
||||
int mode;
|
||||
public:
|
||||
parse_function() : mode(0) {}
|
||||
parse_function(const parse_function& o) : mode(o.mode) {}
|
||||
bool operator()(const parse_grep& i);
|
||||
};
|
||||
|
||||
bool parse_function::operator()(const parse_grep& g)
|
||||
{
|
||||
parse_iterator i, j;
|
||||
// determine what caused the match:
|
||||
if(g[1].matched)
|
||||
{
|
||||
// we have a comment:
|
||||
return true;
|
||||
}
|
||||
else if(g[2].matched)
|
||||
{
|
||||
// we have the start of a line of flags
|
||||
mode = -1;
|
||||
for(int i = 0; i < 5; ++i)
|
||||
flags[i] = 0;
|
||||
return true;
|
||||
}
|
||||
else if(g[3].matched)
|
||||
{
|
||||
// token:
|
||||
i = g[3].first;
|
||||
j = g[3].second;
|
||||
}
|
||||
else
|
||||
{
|
||||
// token delimited by ""
|
||||
i = g[5].first;
|
||||
j = g[5].second;
|
||||
}
|
||||
|
||||
// now we need to switch depending upon what mode we are in:
|
||||
switch(mode)
|
||||
{
|
||||
case -1:
|
||||
{
|
||||
// parse the flag:
|
||||
unsigned int id = 0;
|
||||
while(flag_data[id].len != 0)
|
||||
{
|
||||
if(static_cast<unsigned int>(j - i) != flag_data[id].len)
|
||||
{
|
||||
++id;
|
||||
continue;
|
||||
}
|
||||
if(std::equal(i, j, flag_data[id].name) == true)
|
||||
{
|
||||
flags[flag_data[id].id] |= flag_data[id].value;
|
||||
return true;
|
||||
}
|
||||
++id;
|
||||
}
|
||||
cout << "Warning: Unknown flag: ";
|
||||
string_type t(i, j);
|
||||
cout << t.c_str();
|
||||
cout << endl;
|
||||
return true;
|
||||
}
|
||||
case 0:
|
||||
// set the expression text:
|
||||
expression = string_type(i, j);
|
||||
do_test = true;
|
||||
break;
|
||||
case 1:
|
||||
// set the text to match:
|
||||
search_text = string_type(i, j);
|
||||
jm_trace("Initial search text: " << search_text);
|
||||
expand_escapes(search_text);
|
||||
jm_trace("Search text after escapes expanded: " << search_text);
|
||||
break;
|
||||
case 2:
|
||||
// maybe set format string:
|
||||
if(flags[4] & REG_MERGE)
|
||||
{
|
||||
format_string = string_type(i, j);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
matches[mode - 2] = to_int(i, j);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
// maybe set format result:
|
||||
if(flags[4] & REG_MERGE)
|
||||
{
|
||||
merge_string = string_type(i, j);
|
||||
expand_escapes(merge_string);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
matches[mode - 2] = to_int(i, j);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
jm_assert(mode >= 2);
|
||||
// set the relevent int value:
|
||||
matches[mode - 2] = to_int(i, j);
|
||||
}
|
||||
++mode;
|
||||
return true;
|
||||
}
|
||||
|
||||
void parse_input_line(const string_type& s)
|
||||
{
|
||||
// set matches back to starting values:
|
||||
for(int i = 0; i < MAX_MATCHES; ++i)
|
||||
{
|
||||
matches[i] = -2;
|
||||
}
|
||||
parse_function op;
|
||||
do_test = false;
|
||||
regex_grep(op, s.begin(), s.end(), parse_expression);
|
||||
jm_trace("expression: " << expression);
|
||||
jm_trace("search string: " << search_text);
|
||||
}
|
||||
|
||||
int to_int(string_type::const_iterator i, string_type::const_iterator j)
|
||||
{
|
||||
int val = 0;
|
||||
bool neg = false;
|
||||
if((i != j) && (*i == BOOST_RE_STR('-')))
|
||||
{
|
||||
neg = true;
|
||||
++i;
|
||||
}
|
||||
while (i != j)
|
||||
{
|
||||
val *= 10;
|
||||
val += *i - BOOST_RE_STR('0');
|
||||
++i;
|
||||
}
|
||||
if(neg)
|
||||
val *= -1;
|
||||
return val;
|
||||
}
|
||||
|
||||
void expand_escapes(string_type& s)
|
||||
{
|
||||
for(unsigned int i = 0; i < s.size(); ++i)
|
||||
{
|
||||
if(s[i] == BOOST_RE_STR('\\'))
|
||||
{
|
||||
switch(s[i+1])
|
||||
{
|
||||
case BOOST_RE_STR('a'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\a');
|
||||
break;
|
||||
case BOOST_RE_STR('b'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\b');
|
||||
break;
|
||||
case BOOST_RE_STR('f'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\f');
|
||||
break;
|
||||
case BOOST_RE_STR('n'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\n');
|
||||
break;
|
||||
case BOOST_RE_STR('r'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\r');
|
||||
break;
|
||||
case BOOST_RE_STR('t'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\t');
|
||||
break;
|
||||
case BOOST_RE_STR('v'):
|
||||
s.erase(s.begin() + i);
|
||||
s[i] = BOOST_RE_STR('\v');
|
||||
break;
|
||||
default:
|
||||
if( (s[i + 1] >= BOOST_RE_STR('0')) && (s[i + 1] <= BOOST_RE_STR('9')) )
|
||||
{
|
||||
int val = 0;
|
||||
unsigned int pos = i;
|
||||
++i;
|
||||
while((i < s.size()) && (s[i] >= BOOST_RE_STR('0')) && (s[i] <= BOOST_RE_STR('9')))
|
||||
{
|
||||
val *= 10;
|
||||
val += s[i] - BOOST_RE_STR('0');
|
||||
++i;
|
||||
}
|
||||
s.erase(s.begin() + pos, s.begin() + i);
|
||||
if(0 == val)
|
||||
{
|
||||
s.insert(s.begin()+pos, ' ');
|
||||
s[pos] = 0;
|
||||
}
|
||||
else
|
||||
s.insert(s.begin() + pos, val);
|
||||
i = pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.erase(s.begin() + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,201 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_test.cpp
|
||||
* VERSION 3.02
|
||||
* DESCRIPTION: Builds regression test program with default
|
||||
* locale and narrow character tests. Also
|
||||
* instantiates all the templates in the library
|
||||
* as a sanity check.
|
||||
*/
|
||||
|
||||
// disable automatic selection of support library:
|
||||
#define BOOST_RE_NO_LIB
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
//
|
||||
// instantiate templates used:
|
||||
//
|
||||
namespace boost{
|
||||
|
||||
#if defined(__GNUC__) && defined(__BEOS__)
|
||||
#define ra_it const char*
|
||||
#define test_char_type char
|
||||
#else
|
||||
typedef const char* ra_it;
|
||||
typedef char test_char_type;
|
||||
#endif
|
||||
typedef std::basic_string<test_char_type> test_string_type;
|
||||
|
||||
bool pred1(const match_results<ra_it>&)
|
||||
{ return true; }
|
||||
|
||||
typedef bool (*pred1_type)(const match_results<ra_it>&);
|
||||
typedef bool (*pred2_type)(const match_results<test_string_type::const_iterator>&);
|
||||
|
||||
//check that all the defined flags are available:
|
||||
regbase::flag_type f = regbase::escape_in_lists | regbase::char_classes | regbase::intervals | regbase::limited_ops
|
||||
| regbase::newline_alt | regbase::bk_plus_qm | regbase::bk_braces
|
||||
| regbase::bk_parens | regbase::bk_refs | regbase::bk_vbar | regbase::use_except
|
||||
| regbase::failbit | regbase::literal | regbase::icase | regbase::nocollate | regbase::basic
|
||||
| regbase::extended | regbase::normal | regbase::emacs | regbase::awk | regbase::grep | regbase::egrep | regbase::sed;
|
||||
|
||||
template class reg_expression<test_char_type>;
|
||||
template struct sub_match<ra_it>;
|
||||
template class match_results<ra_it>;
|
||||
|
||||
template bool regex_match(ra_it,
|
||||
ra_it,
|
||||
match_results<ra_it>& m,
|
||||
const reg_expression<test_char_type>& e,
|
||||
unsigned flags);
|
||||
template bool regex_match(ra_it,
|
||||
ra_it,
|
||||
const reg_expression<test_char_type>& e,
|
||||
unsigned flags);
|
||||
template bool regex_search(ra_it,
|
||||
ra_it,
|
||||
match_results<ra_it>& m,
|
||||
const reg_expression<test_char_type>& e,
|
||||
unsigned flags);
|
||||
template unsigned int regex_grep(pred1_type,
|
||||
ra_it,
|
||||
ra_it,
|
||||
const reg_expression<test_char_type>& e,
|
||||
unsigned flags);
|
||||
template test_char_type* regex_format(test_char_type*,
|
||||
const match_results<ra_it>& m,
|
||||
const test_char_type* fmt,
|
||||
unsigned flags);
|
||||
template test_char_type* regex_format(test_char_type*,
|
||||
const match_results<ra_it>& m,
|
||||
const test_string_type& fmt,
|
||||
unsigned flags);
|
||||
template test_char_type* regex_merge(test_char_type*,
|
||||
ra_it,
|
||||
ra_it,
|
||||
const reg_expression<test_char_type>&,
|
||||
const test_char_type*,
|
||||
unsigned int flags);
|
||||
template test_char_type* regex_merge(test_char_type*,
|
||||
ra_it,
|
||||
ra_it,
|
||||
const reg_expression<test_char_type>& e,
|
||||
const test_string_type&,
|
||||
unsigned int flags);
|
||||
template std::size_t regex_split(test_string_type*,
|
||||
test_string_type&,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags,
|
||||
std::size_t);
|
||||
template std::size_t regex_split(test_string_type*,
|
||||
test_string_type& s,
|
||||
const reg_expression<test_char_type>& e,
|
||||
unsigned flags);
|
||||
|
||||
template std::size_t regex_split(test_string_type*, test_string_type&);
|
||||
|
||||
#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC
|
||||
//
|
||||
// the following prototypes are only available if partial ordering
|
||||
// of template functions is supported:
|
||||
//
|
||||
template bool regex_match(const test_char_type*,
|
||||
match_results<const test_char_type*>& m,
|
||||
const reg_expression<test_char_type>& e,
|
||||
unsigned flags);
|
||||
template bool regex_match(const test_string_type&,
|
||||
match_results<test_string_type::const_iterator>&,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_match(const test_char_type*,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_match(const test_string_type&,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_search(const test_char_type*,
|
||||
match_results<const test_char_type*>&,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_search(const test_string_type&,
|
||||
match_results<test_string_type::const_iterator>&,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template unsigned int regex_grep(pred1_type,
|
||||
const test_char_type*,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template unsigned int regex_grep(pred2_type,
|
||||
const test_string_type&,
|
||||
const reg_expression<test_char_type>&,
|
||||
unsigned flags);
|
||||
template test_string_type regex_format
|
||||
(const match_results<test_string_type::const_iterator>& m,
|
||||
const test_char_type*,
|
||||
unsigned flags);
|
||||
template test_string_type regex_format
|
||||
(const match_results<test_string_type::const_iterator>&,
|
||||
const test_string_type&,
|
||||
unsigned flags);
|
||||
template test_string_type regex_merge(const test_string_type&,
|
||||
const reg_expression<test_char_type>&,
|
||||
const test_char_type*,
|
||||
unsigned int flags);
|
||||
template test_string_type regex_merge(const test_string_type&,
|
||||
const reg_expression<test_char_type>&,
|
||||
const test_string_type&,
|
||||
unsigned int flags);
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
//
|
||||
// include regression test source files:
|
||||
//
|
||||
#ifdef BOOST_RE_LOCALE_W32
|
||||
#define BOOST_RE_TEST_LOCALE_W32
|
||||
#elif !defined(BOOST_RE_LOCALE_C)
|
||||
#define BOOST_RE_TEST_LOCALE_CPP
|
||||
#endif
|
||||
|
||||
#include "tests.cpp"
|
||||
#include "parse.cpp"
|
||||
#include "regress.cpp"
|
||||
|
||||
//
|
||||
// include library source files:
|
||||
//
|
||||
#ifdef BOOST_RE_LOCALE_W32
|
||||
#include "libs/regex/src/w32_regex_traits.cpp"
|
||||
#elif defined(BOOST_RE_LOCALE_C)
|
||||
#include "libs/regex/src/c_regex_traits.cpp"
|
||||
#else
|
||||
#include "libs/regex/src/cpp_regex_traits.cpp"
|
||||
#endif
|
||||
#include "libs/regex/src/c_regex_traits_common.cpp"
|
||||
#include "libs/regex/src/cregex.cpp"
|
||||
#include "libs/regex/src/fileiter.cpp"
|
||||
#include "libs/regex/src/posix_api.cpp"
|
||||
#include "libs/regex/src/regex.cpp"
|
||||
#include "libs/regex/src/regex_debug.cpp"
|
||||
#include "libs/regex/src/regex_synch.cpp"
|
||||
#include "libs/regex/src/wide_posix_api.cpp"
|
||||
|
||||
|
@ -1,246 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* FILE regress.cpp
|
||||
* VERSION 3.02
|
||||
*
|
||||
* main() and associated code for regress.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <boost/regex.hpp>
|
||||
#ifdef BOOST_RE_OLD_IOSTREAM
|
||||
#include <fstream.h>
|
||||
#else
|
||||
#include <fstream>
|
||||
using std::ifstream;
|
||||
using std::ofstream;
|
||||
//using std::cin;
|
||||
//using std::cout;
|
||||
using std::endl;
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hrdstop
|
||||
#endif
|
||||
|
||||
#include "regress.h"
|
||||
|
||||
|
||||
//
|
||||
// declare all our globals here:
|
||||
//
|
||||
|
||||
string_type expression;
|
||||
string_type search_text;
|
||||
string_type format_string;
|
||||
string_type merge_string;
|
||||
int matches[MAX_MATCHES];
|
||||
|
||||
char file[MAX_PATH];
|
||||
int line;
|
||||
bool do_test = false;
|
||||
unsigned int flags[5];
|
||||
unsigned error_count = 0;
|
||||
|
||||
void usage()
|
||||
{
|
||||
cout <<
|
||||
|
||||
"Usage: regress filename [filename2...]\n"
|
||||
"see tests.txt for an example test script\n"
|
||||
"and the script format.\n";
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
if(argc < 2)
|
||||
usage();
|
||||
int i;
|
||||
for(i = 1; i < argc; ++i)
|
||||
{
|
||||
reset_error();
|
||||
ifstream is(argv[i]);
|
||||
if(is.good() == false)
|
||||
{
|
||||
cout << "Error unable to open file: " << argv[i] << endl << endl;
|
||||
continue;
|
||||
}
|
||||
std::strcpy(file, argv[i]);
|
||||
line = 0;
|
||||
unsigned int tests = 0;
|
||||
while(is.good())
|
||||
{
|
||||
string_type s;
|
||||
get_line(is, s);
|
||||
++line;
|
||||
jm_trace("Reading test script line " << line << " " << s);
|
||||
parse_input_line(s);
|
||||
if(do_test)
|
||||
{
|
||||
run_tests();
|
||||
++tests;
|
||||
}
|
||||
}
|
||||
cout << line << " lines, " << tests << " tests completed in file " << argv[i] << endl;
|
||||
}
|
||||
return error_count;
|
||||
}
|
||||
|
||||
#ifdef TEST_UNICODE
|
||||
|
||||
ostream& operator << (ostream& os, const wchar_t* s)
|
||||
{
|
||||
while(*s)
|
||||
{
|
||||
os.put((char)*s);
|
||||
++s;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& os, const std::wstring& s)
|
||||
{
|
||||
os << s.c_str();
|
||||
return os;
|
||||
}
|
||||
|
||||
istream& get_line(istream& is, nstring_type& s, char delim)
|
||||
{
|
||||
char c = (char)is.get();
|
||||
s.erase(s.begin(), s.end());
|
||||
while((c != delim) && (c != EOF))
|
||||
{
|
||||
s.append(1, c);
|
||||
c = (char)is.get();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
istream& get_line(istream& is, string_type& s, char delim)
|
||||
{
|
||||
nstring_type t;
|
||||
get_line(is, t, delim);
|
||||
s.erase(s.begin(), s.end());
|
||||
const char* i, *j;
|
||||
i = t.c_str();
|
||||
j = t.c_str() + t.size();
|
||||
wchar_t* buf = new wchar_t[MB_CUR_MAX + 1];
|
||||
int cchars;
|
||||
while(i != j)
|
||||
{
|
||||
cchars = mbtowc(buf, i, j - i);
|
||||
if(cchars == -1)
|
||||
break;
|
||||
if(cchars == 0)
|
||||
break;
|
||||
s.insert(s.end(), buf, buf + cchars);
|
||||
i += cchars;
|
||||
}
|
||||
delete[] buf;
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
istream& get_line(istream& is, string_type& s, char delim)
|
||||
{
|
||||
char c = (char)is.get();
|
||||
s.erase(s.begin(), s.end());
|
||||
while((c != delim) && (c != EOF))
|
||||
{
|
||||
s.append(1, c);
|
||||
c = (char)is.get();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
jm_debug_alloc::jm_debug_alloc()
|
||||
{
|
||||
blocks = new int;
|
||||
count = new int;
|
||||
*blocks = 0;
|
||||
*count = 1;
|
||||
guard = this;
|
||||
}
|
||||
|
||||
jm_debug_alloc::jm_debug_alloc(const jm_debug_alloc& d)
|
||||
{
|
||||
blocks = d.blocks;
|
||||
count = d.count;
|
||||
++(*count);
|
||||
guard = this;
|
||||
}
|
||||
jm_debug_alloc& jm_debug_alloc::operator=(const jm_debug_alloc& d)
|
||||
{
|
||||
free();
|
||||
blocks = d.blocks;
|
||||
count = d.count;
|
||||
++(*count);
|
||||
return *this;
|
||||
}
|
||||
|
||||
jm_debug_alloc::~jm_debug_alloc()
|
||||
{
|
||||
if(guard != this)
|
||||
{
|
||||
cout << "Error: attempt to destroy object already destroyed" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
free();
|
||||
guard = 0;
|
||||
}
|
||||
}
|
||||
void jm_debug_alloc::free()
|
||||
{
|
||||
if(--(*count) == 0)
|
||||
{
|
||||
if(*blocks)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: " << *blocks << " blocks not freed by allocator" << endl;
|
||||
}
|
||||
delete count;
|
||||
delete blocks;
|
||||
}
|
||||
}
|
||||
|
||||
jm_debug_alloc::pointer jm_debug_alloc::allocate(size_type n, void* hint)
|
||||
{
|
||||
pointer p = new char[n + maxi(sizeof(size_type), boost::re_detail::padding_size)];
|
||||
*(size_type*)p = n;
|
||||
++(*blocks);
|
||||
return p + maxi(sizeof(size_type), boost::re_detail::padding_size);
|
||||
}
|
||||
void jm_debug_alloc::deallocate(pointer p, size_type n)
|
||||
{
|
||||
p -= maxi(sizeof(size_type), boost::re_detail::padding_size);
|
||||
if(*(size_type*)p != n)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: size mismatch in allocate/deallocate calls" << endl;
|
||||
}
|
||||
--(*blocks);
|
||||
delete[] p;
|
||||
}
|
||||
|
@ -1,337 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* FILE regress.h
|
||||
* VERSION 3.02
|
||||
*
|
||||
* Function and data declarations for regress.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _REGRESS_H
|
||||
#define _REGRESS_H
|
||||
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
|
||||
#ifdef BOOST_RE_OLD_IOSTREAM
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
using std::cin;
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
|
||||
#ifdef TEST_UNICODE
|
||||
#ifdef __GNUC__
|
||||
#define char_t wchar_t
|
||||
#else
|
||||
typedef wchar_t char_t;
|
||||
#endif
|
||||
#define NO_POSIX_TEST
|
||||
typedef std::basic_string<char_t> string_type;
|
||||
typedef std::basic_string<char> nstring_type;
|
||||
inline istream& get_line(istream& is, nstring_type& s, char delim = '\n');
|
||||
istream& get_line(istream& is, string_type& s, char delim = L'\n');
|
||||
#define BOOST_RE_STR(x) L##x
|
||||
ostream& operator << (ostream& os, const string_type& s);
|
||||
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define char_t char
|
||||
#else
|
||||
typedef char char_t;
|
||||
#endif
|
||||
typedef std::basic_string<char_t> string_type;
|
||||
inline istream& get_line(istream& is, string_type& s, char delim = '\n');
|
||||
#define BOOST_RE_STR(x) x
|
||||
|
||||
#endif
|
||||
|
||||
ostream& operator << (ostream& os, const wchar_t* s);
|
||||
void parse_input_line(const string_type& s);
|
||||
void expand_escapes(string_type& s);
|
||||
void run_tests();
|
||||
void begin_error();
|
||||
void reset_error();
|
||||
int to_int(string_type::const_iterator i, string_type::const_iterator j);
|
||||
|
||||
#define MAX_MATCHES 30
|
||||
extern string_type expression;
|
||||
extern string_type search_text;
|
||||
extern string_type format_string;
|
||||
extern string_type merge_string;
|
||||
extern int matches[MAX_MATCHES];
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
extern char file[MAX_PATH];
|
||||
extern int line;
|
||||
extern bool do_test;
|
||||
extern unsigned int flags[5];
|
||||
extern unsigned error_count;
|
||||
|
||||
struct flag_info
|
||||
{
|
||||
const char_t* name; // printable flag name
|
||||
unsigned int len; // length of name
|
||||
unsigned int value; // value of the flag
|
||||
unsigned int id; // index to assign value to
|
||||
};
|
||||
|
||||
extern flag_info flag_data[];
|
||||
|
||||
//
|
||||
// class jm_debug_alloc
|
||||
// NB this is a byte based allocator
|
||||
//
|
||||
class jm_debug_alloc
|
||||
{
|
||||
private:
|
||||
int* blocks, *count;
|
||||
jm_debug_alloc* guard;
|
||||
public:
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef char* pointer;
|
||||
typedef const char* const_pointer;
|
||||
typedef char& reference;
|
||||
typedef const char& const_reference;
|
||||
typedef char value_type;
|
||||
|
||||
|
||||
#ifndef BOOST_RE_NO_MEMBER_TEMPLATES
|
||||
template <class U>
|
||||
struct rebind
|
||||
{
|
||||
typedef boost::re_detail::re_alloc_binder<U, jm_debug_alloc> other;
|
||||
};
|
||||
#endif
|
||||
|
||||
jm_debug_alloc();
|
||||
|
||||
jm_debug_alloc(const jm_debug_alloc& d);
|
||||
jm_debug_alloc& operator=(const jm_debug_alloc& d);
|
||||
|
||||
~jm_debug_alloc();
|
||||
void free();
|
||||
static pointer address(reference x)
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
static const_pointer address(const_reference x)
|
||||
{
|
||||
return &x;
|
||||
}
|
||||
unsigned maxi(unsigned i, unsigned j)
|
||||
{
|
||||
return i < j ? j : i;
|
||||
}
|
||||
pointer allocate(size_type n, void* hint = 0);
|
||||
void deallocate(pointer p, size_type n);
|
||||
|
||||
static size_type max_size()
|
||||
{
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
static void construct(pointer , const char& )
|
||||
{
|
||||
}
|
||||
|
||||
static void destroy(pointer )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ < 0x520
|
||||
|
||||
#define BOOST_RE_BORLAND_FIX
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//
|
||||
// class debug_iterator
|
||||
//
|
||||
template <class T>
|
||||
struct debug_iterator : public BOOST_RE_RA_ITERATOR(T, std::ptrdiff_t)
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef char_t value_type;
|
||||
typedef char_t* pointer;
|
||||
typedef char_t& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef debug_iterator self;
|
||||
typedef std::size_t size_type;
|
||||
|
||||
T cur;
|
||||
T first;
|
||||
T last;
|
||||
|
||||
debug_iterator(T c, T f, T l)
|
||||
: cur(c), first(f), last(l) {}
|
||||
debug_iterator() : cur(), first(), last() {}
|
||||
debug_iterator(const debug_iterator& x)
|
||||
: cur(x.cur), first(x.first), last(x.last) {}
|
||||
debug_iterator& operator=(const debug_iterator& x)
|
||||
{
|
||||
cur = x.cur;
|
||||
first = x.first;
|
||||
last = x.last;
|
||||
return *this;
|
||||
}
|
||||
|
||||
reference operator*() const
|
||||
{
|
||||
if(cur == last)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: attempt to dereference iterator past range" << endl;
|
||||
}
|
||||
return *cur;
|
||||
}
|
||||
|
||||
operator T()const { return cur; }
|
||||
|
||||
difference_type operator-(const self& x) const {
|
||||
return (difference_type)(cur - x.cur);
|
||||
}
|
||||
|
||||
self& operator++()
|
||||
{
|
||||
if(cur == last)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: attempt to increment iterator past range" << endl;
|
||||
return *this;
|
||||
}
|
||||
++cur;
|
||||
return *this;
|
||||
}
|
||||
self operator++(int)
|
||||
{
|
||||
self tmp = *this;
|
||||
++*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
self& operator--()
|
||||
{
|
||||
if(cur == first)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: attempt to decrement iterator past range" << endl;
|
||||
return *this;
|
||||
}
|
||||
--cur;
|
||||
return *this;
|
||||
}
|
||||
self operator--(int)
|
||||
{
|
||||
self tmp = *this;
|
||||
--*this;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
self& operator+=(difference_type n)
|
||||
{
|
||||
if((last - cur) < n)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: attempt to increment iterator past range" << endl;
|
||||
return *this;
|
||||
}
|
||||
cur += n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
self operator+(difference_type n) const
|
||||
{
|
||||
self tmp = *this;
|
||||
return tmp += n;
|
||||
}
|
||||
|
||||
self& operator-=(difference_type n) { return *this += -n; }
|
||||
|
||||
self operator-(difference_type n) const
|
||||
{
|
||||
self tmp = *this;
|
||||
return tmp -= n;
|
||||
}
|
||||
|
||||
reference operator[](difference_type n) const { return *(cur + n); }
|
||||
|
||||
bool operator==(const self& x) const { return cur == x.cur; }
|
||||
bool operator!=(const self& x) const { return !(*this == x); }
|
||||
bool operator<(const self& x) const {
|
||||
return (cur < x.cur);
|
||||
}
|
||||
friend self operator+(difference_type n, const self& i)
|
||||
{
|
||||
self tmp = i;
|
||||
return tmp += n;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__SGI_STL_PORT) && (__SGI_STL_PORT >= 0x400)
|
||||
namespace std{
|
||||
template <class T>
|
||||
inline random_access_iterator_tag __STL_CALL
|
||||
__iterator_category(const debug_iterator<T>&) {
|
||||
return random_access_iterator_tag();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_TEST_LOCALE_W32
|
||||
typedef boost::reg_expression<char_t, boost::w32_regex_traits<char_t>, jm_debug_alloc> re_type;
|
||||
#elif defined(BOOST_RE_TEST_LOCALE_CPP)
|
||||
typedef boost::reg_expression<char_t, boost::cpp_regex_traits<char_t>, jm_debug_alloc> re_type;
|
||||
#else
|
||||
typedef boost::reg_expression<char_t, boost::c_regex_traits<char_t>, jm_debug_alloc> re_type;
|
||||
#endif
|
||||
|
||||
#define REG_NO_POSIX_TEST 1
|
||||
#define REG_UNICODE_ONLY 2
|
||||
#define REG_GREP 4
|
||||
#define REG_MERGE 8
|
||||
#define REG_MERGE_COPY 16
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
# Makefile for timer application
|
||||
#
|
||||
# for SUN workshop 5.0 C++ compiler
|
||||
#
|
||||
|
||||
CXX=CC
|
||||
CPP_FLAGS = -O -I../../../../ -I./
|
||||
|
||||
all: r2 r5
|
||||
r2 tests.txt
|
||||
r5 tests.txt
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) -c -o $@ $(CPP_FLAGS) $<
|
||||
|
||||
r2 : tests.cpp parse.cpp regress.cpp
|
||||
$(CXX) -o $@ $(CPP_FLAGS) tests.cpp parse.cpp regress.cpp -L../../lib -lregex++
|
||||
|
||||
r5 : tests.cpp parse.cpp regress.cpp
|
||||
$(CXX) -o $@ $(CPP_FLAGS) -DTEST_UNICODE tests.cpp parse.cpp regress.cpp -L../../lib -lregex++
|
||||
|
||||
clean:
|
||||
rm -rf SunWS_cache
|
||||
rm -f r2.o r2 r5 r5.o
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
;
|
||||
; This file tests code page 1252 - US / Western European code page.
|
||||
;
|
||||
; See tests.txt for a desciption of the scipt format.
|
||||
;
|
||||
|
||||
- match_default extended REG_EXTENDED
|
||||
|
||||
; start by testing character classes:
|
||||
[[:lower:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 32
|
||||
[[:upper:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 31
|
||||
[[:punct:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 31
|
||||
[[:print:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 94
|
||||
[[:graph:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 94
|
||||
[a-z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 31
|
||||
[a-z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 31
|
||||
[[:word:]]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 61
|
||||
;and equivalence classes:
|
||||
[[=a=]]+ aA<61><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 14
|
||||
|
||||
; and then test case mapping:
|
||||
- match_default extended REG_EXTENDED REG_ICASE
|
||||
;[A-Z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 31
|
||||
;[a-z]+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 31
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 30
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,749 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* FILE tests.cpp
|
||||
* VERSION 3.02
|
||||
*
|
||||
* the actual tests conducted by regress.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include "regress.h"
|
||||
|
||||
using namespace boost;
|
||||
|
||||
template <class M1, class M2>
|
||||
bool compare_result(const M1& sm, const M2& m)
|
||||
{
|
||||
if(sm.size() != m.size())
|
||||
return false;
|
||||
if(sm.line() != m.line())
|
||||
return false;
|
||||
for(unsigned int i = 0; i < sm.size(); ++i)
|
||||
{
|
||||
if(sm.position(i) != m.position(i))
|
||||
return false;
|
||||
if(sm.length(i) != m.length(i))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class M1>
|
||||
bool compare_result(const M1& sm, const M1& m)
|
||||
{
|
||||
return sm == m;
|
||||
}
|
||||
|
||||
|
||||
template <class C, class T, class A>
|
||||
void cpp_eh_tests(const reg_expression<C, T, A>& )
|
||||
{
|
||||
#ifndef __GNUC__
|
||||
bool thrown = false;
|
||||
// try set_expression form first:
|
||||
try
|
||||
{
|
||||
A a;
|
||||
reg_expression<C, T, A> e(a);
|
||||
e.set_expression(expression.c_str(), flags[2] | regbase::use_except);
|
||||
}
|
||||
catch(const boost::bad_expression&)
|
||||
{
|
||||
thrown = true;
|
||||
}
|
||||
catch(...){}
|
||||
if(!thrown)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: expected exception not thrown" << endl;
|
||||
}
|
||||
|
||||
// now try constructor form:
|
||||
thrown = false;
|
||||
try
|
||||
{
|
||||
A a;
|
||||
reg_expression<C, T, A> e(expression.c_str(), flags[2] | regbase::use_except, a);
|
||||
}
|
||||
catch(const boost::bad_expression&)
|
||||
{
|
||||
thrown = true;
|
||||
}
|
||||
catch(...){}
|
||||
if(!thrown)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Error: expected exception not thrown" << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class iterator>
|
||||
iterator find_last_line(iterator start, iterator end)
|
||||
{
|
||||
iterator result = start;
|
||||
while(start != end)
|
||||
{
|
||||
if(*start == '\n')
|
||||
{
|
||||
++start;
|
||||
result = start;
|
||||
}
|
||||
else
|
||||
++start;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class iterator>
|
||||
unsigned int count_lines(iterator start, iterator end)
|
||||
{
|
||||
unsigned int result = 0;
|
||||
while(start != end)
|
||||
{
|
||||
if(*start == '\n')
|
||||
++result;
|
||||
++start;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class iterator, class Alloc>
|
||||
class grep_test_predicate
|
||||
{
|
||||
int match_id;
|
||||
iterator base, term;
|
||||
public:
|
||||
grep_test_predicate(iterator i, iterator j) : base(i), term(j) { match_id = 0; }
|
||||
~grep_test_predicate(){}
|
||||
bool operator()(const boost::match_results< iterator, Alloc >& m);
|
||||
};
|
||||
|
||||
template <class iterator, class Alloc>
|
||||
bool grep_test_predicate<iterator, Alloc>::operator()(const boost::match_results< iterator, Alloc >& m)
|
||||
{
|
||||
int start, end;
|
||||
start = m[0].first - base;
|
||||
end = m[0].second - base;
|
||||
if((matches[match_id] != start) || (matches[match_id + 1] != end))
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ grep match error: found [" << start << "," << end << "] expected [" << matches[match_id] << "," << matches[match_id+1] << "]" << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// check $`:
|
||||
start = m[-1].first - base;
|
||||
end = m[-1].second - base;
|
||||
if(match_id &&
|
||||
( (end != matches[match_id]) || (start != matches[match_id - 1]) )
|
||||
)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ grep error in $`: found [" << start << "," << end << "] expected [" << matches[match_id-1] << "," << matches[match_id] << "]" << endl;
|
||||
}
|
||||
else if((!match_id) && ((start != 0) || (end != matches[0])))
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// check $':
|
||||
start = m[-2].first - base;
|
||||
end = m[-2].second - base;
|
||||
if((start != matches[match_id + 1]) || (end != (term-base)))
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ grep error in $': found [" << start << "," << end << "] expected [" << matches[match_id + 1] << "," << (term-base) << "]" << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// now check line()
|
||||
start = m.line();
|
||||
end = count_lines(base, iterator(m[0].first)) + 1;
|
||||
if(start != end)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ grep error in line(): found " << start << " expected " << end << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// now check line_start()
|
||||
start = m.line_start() - base;
|
||||
end = find_last_line(base, iterator(m[0].first)) - base;
|
||||
if(start != end)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ grep error in line_start(): found " << start << " expected " << end << endl;
|
||||
}
|
||||
|
||||
match_id += 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class C, class T, class A>
|
||||
void cpp_tests(const reg_expression<C, T, A>& e, bool recurse = true)
|
||||
{
|
||||
typedef A allocator_type;
|
||||
if(flags[4] & REG_MERGE)
|
||||
{
|
||||
//
|
||||
// test merge code:
|
||||
//
|
||||
string_type s;
|
||||
s = regex_merge(search_text, e, format_string.c_str(), flags[3]);
|
||||
if(s != merge_string)
|
||||
{
|
||||
begin_error();
|
||||
cout << "merge result mismatch: found \"" << s.c_str() << "\" expected \"" << merge_string.c_str() << "\"" << endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(recurse)
|
||||
{
|
||||
// copy and assign test:
|
||||
reg_expression<C, T, A> e2(e);
|
||||
cpp_tests(e2, false);
|
||||
e2 = e;
|
||||
cpp_tests(e2, false);
|
||||
}
|
||||
|
||||
if(e.error_code())
|
||||
{
|
||||
// verify that we don't expect expression to compile
|
||||
if(search_text != BOOST_RE_STR("!"))
|
||||
{
|
||||
begin_error();
|
||||
cout << "Expression did not compile using regex++ API" << endl;
|
||||
}
|
||||
else if((recurse) && ((flags[3] & match_partial) == 0))
|
||||
cpp_eh_tests(e);
|
||||
}
|
||||
else if(flags[4] & REG_GREP)
|
||||
{
|
||||
// try to do grep:
|
||||
debug_iterator<string_type::iterator> x(search_text.begin(), search_text.begin(), search_text.end());
|
||||
debug_iterator<string_type::iterator> y(search_text.end(), search_text.begin(), search_text.end());
|
||||
grep_test_predicate<debug_iterator<string_type::iterator>, allocator_type> oi(x, y);
|
||||
regex_grep(oi, x, y, e, flags[3]);
|
||||
#if !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) && !defined(BOOST_RE_NO_STRING_H) && !defined(BOOST_RE_NO_STRING_DEF_ARGS)
|
||||
if(!recurse)
|
||||
{
|
||||
std::basic_string<char_t> s(search_text.begin(), search_text.end());
|
||||
grep_test_predicate<std::basic_string<char_t>::const_iterator, reg_expression<C, T, A>::allocator_type> oi2(s.begin(), s.end());
|
||||
regex_grep(oi2, s, e, flags[3]);
|
||||
grep_test_predicate<const char_t*, reg_expression<C, T, A>::allocator_type> oi3(s.c_str(), s.c_str()+s.size());
|
||||
regex_grep(oi3, s.c_str(), e, flags[3]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// try to find match
|
||||
match_results< debug_iterator<string_type::iterator>, reg_expression<C, T, A>::allocator_type> m;
|
||||
debug_iterator<string_type::iterator> x(search_text.begin(), search_text.begin(), search_text.end());
|
||||
debug_iterator<string_type::iterator> y(search_text.end(), search_text.begin(), search_text.end());
|
||||
if(regex_search(x, y, m, e, flags[3]))
|
||||
{
|
||||
// match found compare what matched with what we expect:
|
||||
int j = 0;
|
||||
for(unsigned int i = 0; i < m.size(); ++i, j += 2)
|
||||
{
|
||||
if(m[i].matched == false)
|
||||
{
|
||||
if(matches[j] != -1)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in sub-expression " << i <<
|
||||
", found (" << (m[i].first - x) << "," <<
|
||||
(m[i].second - x) << ") expected (" <<
|
||||
matches[j] << "," << matches[j+1] << ")" << endl;
|
||||
}
|
||||
}
|
||||
else if(((m[i].first - x) != matches[j]) || ((m[i].second - x) != matches[j+1]))
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in sub-expression " << i <<
|
||||
", found (" << (m[i].first - x) << "," <<
|
||||
(m[i].second - x) << ") expected (" <<
|
||||
matches[j] << "," << matches[j+1] << ")" << endl;
|
||||
}
|
||||
}
|
||||
//
|
||||
// now check $` and $':
|
||||
//
|
||||
if((m[-1].first != x) || (m[-1].second != m[0].first))
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in $` (match -1), found (" <<
|
||||
(m[-1].first - x) << "," << (m[-1].second - x) << ") expected (0" <<
|
||||
"," << matches[0] << ")" << endl;
|
||||
}
|
||||
if(((flags[3] & match_partial) == 0) && ((m[-2].first != m[0].second) || (m[-2].second != y)))
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in $' (match -2), found (" <<
|
||||
(m[-2].first - x) << "," << (m[-2].second - x) << ") expected (" <<
|
||||
matches[1] << "," << (y-x) << ")" << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// now try alternative forms of regex_search if available:
|
||||
#if !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC) && !defined(BOOST_RE_NO_STRING_H) && !defined(BOOST_RE_NO_STRING_DEF_ARGS)
|
||||
if(!recurse)
|
||||
{
|
||||
std::basic_string<char_t> s(search_text.begin(), search_text.end());
|
||||
match_results<std::basic_string<char_t>::const_iterator> sm;
|
||||
if(regex_search(s, sm, e, flags[3]))
|
||||
{
|
||||
if(compare_result(sm, m) == false)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_search(const std::string&, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
//
|
||||
// partial match should give same result as full match
|
||||
// provided a full match is expected:
|
||||
//
|
||||
if(matches[0] > 0)
|
||||
{
|
||||
if(regex_search(x, y, m, e, flags[3] | boost::match_partial))
|
||||
{
|
||||
if(compare_result(sm, m) == false)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_search when enabling match_partial" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result: match not found when match_partial specified" << endl;
|
||||
}
|
||||
}
|
||||
if(s.find(char_t(0)) == std::basic_string<char_t>::npos)
|
||||
{
|
||||
match_results<const char_t*> ssm;
|
||||
if(regex_search(search_text.c_str(), ssm, e, flags[3]))
|
||||
{
|
||||
if(compare_result(ssm, m) == false)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_search(const char_t*, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if((false == recurse) && (matches[0] == 0) && (matches[1] == search_text.size()))
|
||||
{
|
||||
//
|
||||
// match expected on whole string, so all versions
|
||||
// of regex_match should also succeed:
|
||||
//
|
||||
match_results< debug_iterator<string_type::iterator>, reg_expression<C, T, A>::allocator_type> m1;
|
||||
debug_iterator<string_type::iterator> x1(search_text.begin(), search_text.begin(), search_text.end());
|
||||
debug_iterator<string_type::iterator> y1(search_text.end(), search_text.begin(), search_text.end());
|
||||
if(regex_match(x1, y1, m1, e, flags[3]))
|
||||
{
|
||||
if(compare_result(m1, m) == false)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_match(iterator, iterator, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
std::basic_string<char_t> s(search_text.begin(), search_text.end());
|
||||
match_results<std::basic_string<char_t>::const_iterator> sm;
|
||||
if(regex_match(s, sm, e, flags[3]))
|
||||
{
|
||||
if(compare_result(sm, m) == false)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_match(const std::string&, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
if(s.find(char_t(0)) == std::basic_string<char_t>::npos)
|
||||
{
|
||||
match_results<const char_t*> ssm;
|
||||
if(regex_match(search_text.c_str(), ssm, e, flags[3]))
|
||||
{
|
||||
if(compare_result(ssm, m) == false)
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_match(const char_t*, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
begin_error();
|
||||
cout << "regex++ API result mismatch in regex_match(const char_t*, match_results&, const reg_expression&, int)" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// match not found
|
||||
if(matches[0] != -1)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Match expected but not found using regex++ API" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(TEST_UNICODE)
|
||||
|
||||
unsigned int hl_match_id;
|
||||
|
||||
bool hl_grep_test_proc(const RegEx& e)
|
||||
{
|
||||
int start, end;
|
||||
start = e.Position(0);
|
||||
end = start + e.Length();
|
||||
if((matches[hl_match_id] != start) || (matches[hl_match_id + 1] != end))
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep match error: found [" << start << "," << end << "] expected [" << matches[hl_match_id] << "," << matches[hl_match_id+1] << "]" << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// check $`:
|
||||
start = e.Position(-1);
|
||||
end = start + e.Length(-1);
|
||||
if(start == -1)
|
||||
{
|
||||
if(hl_match_id &&
|
||||
( matches[hl_match_id] != matches[hl_match_id - 1] )
|
||||
)
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << matches[hl_match_id-1] << "," << matches[hl_match_id] << "]" << endl;
|
||||
}
|
||||
else if((!hl_match_id) && (0 != matches[0]))
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(hl_match_id &&
|
||||
( (end != matches[hl_match_id]) || (start != matches[hl_match_id - 1]) )
|
||||
)
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << matches[hl_match_id-1] << "," << matches[hl_match_id] << "]" << endl;
|
||||
}
|
||||
else if((!hl_match_id) && ((start != 0) || (end != matches[0])))
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep error in $`: found [" << start << "," << end << "] expected [" << 0 << "," << matches[0] << "]" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// check $':
|
||||
start = e.Position(-2);
|
||||
end = start + e.Length(-2);
|
||||
if(start == -1)
|
||||
{
|
||||
if(matches[hl_match_id + 1] != search_text.size())
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep error in $': found [" << start << "," << end << "] expected [" << matches[hl_match_id + 1] << "," << (search_text.size()) << "]" << endl;
|
||||
}
|
||||
}
|
||||
else if((start != matches[hl_match_id + 1]) || (end != search_text.size()))
|
||||
{
|
||||
begin_error();
|
||||
cout << "class RegEx grep error in $': found [" << start << "," << end << "] expected [" << matches[hl_match_id + 1] << "," << (search_text.size()) << "]" << endl;
|
||||
}
|
||||
|
||||
hl_match_id += 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
void cpp_hl_tests(RegEx& e, bool recurse = true)
|
||||
{
|
||||
if(flags[4] & REG_MERGE)
|
||||
return;
|
||||
|
||||
if(recurse)
|
||||
{
|
||||
// copy and assign test:
|
||||
RegEx e2(e);
|
||||
cpp_hl_tests(e2, false);
|
||||
e2 = e;
|
||||
cpp_hl_tests(e2, false);
|
||||
}
|
||||
|
||||
if(flags[4] & REG_GREP)
|
||||
{
|
||||
// try to do grep:
|
||||
hl_match_id = 0;
|
||||
GrepCallback cb = hl_grep_test_proc;
|
||||
e.Grep(cb, search_text.c_str(), flags[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(e.Search(search_text.c_str(), flags[3]))
|
||||
{
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
while(matches[j] != -2)
|
||||
{
|
||||
if( (matches[j] != e.Position(i)) || (matches[j+1] - matches[j] != e.Length(i)) )
|
||||
{
|
||||
begin_error();
|
||||
cout << "RegEx::Search error in subexpression " << i << ": found [" << e.Position(i) << "," << (e.Position(i) + e.Length(i)) << "] expected [" << matches[j] << "," << matches[j+1] << "]" << endl;
|
||||
}
|
||||
++i;
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(matches[0] != -1)
|
||||
{
|
||||
begin_error();
|
||||
cout << "match expected but not found with RexEx::Search" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if((matches[0] == 0) && (e.Match(search_text.c_str(), flags[3])))
|
||||
{
|
||||
unsigned int i = 0;
|
||||
unsigned int j = 0;
|
||||
while(matches[j] != -2)
|
||||
{
|
||||
if( (matches[j] != e.Position(i)) || (matches[j+1] - matches[j] != e.Length(i)) )
|
||||
{
|
||||
begin_error();
|
||||
cout << "RegEx::Match error in subexpression " << i << ": found [" << e.Position(i) << "," << (e.Position(i) + e.Length(i)) << "] expected [" << matches[j] << "," << matches[j+1] << "]" << endl;
|
||||
}
|
||||
++i;
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class iterator>
|
||||
bool has_nulls(iterator i, iterator j)
|
||||
{
|
||||
while(i != j)
|
||||
{
|
||||
if(*i == 0)
|
||||
return true;
|
||||
++i;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef TEST_UNICODE
|
||||
#undef regcomp
|
||||
#undef regerror
|
||||
#undef regexec
|
||||
#undef regfree
|
||||
#undef regex_t
|
||||
#define regcomp regcompW
|
||||
#define regerror regerrorW
|
||||
#define regexec regexecW
|
||||
#define regfree regfreeW
|
||||
#define regex_t regex_tW
|
||||
#endif
|
||||
|
||||
|
||||
void run_tests()
|
||||
{
|
||||
#ifndef TEST_UNICODE
|
||||
if(flags[4] & REG_UNICODE_ONLY)
|
||||
return;
|
||||
#endif
|
||||
#ifndef NO_CPP_TEST
|
||||
try
|
||||
{
|
||||
unsigned int f = flags[2] & ~regbase::use_except;
|
||||
if(flags[0] & REG_ICASE)
|
||||
f |= regbase::icase;
|
||||
re_type e(expression.c_str(), f);
|
||||
cpp_tests(e, true);
|
||||
}
|
||||
#ifndef BOOST_RE_NO_EXCEPTION_H
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
//
|
||||
// this is only an error if the expression is expected to be valid:
|
||||
if(search_text != BOOST_RE_STR("!"))
|
||||
{
|
||||
begin_error();
|
||||
cout << "Unexpected exception thrown from C++ library: " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
catch(...)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Unexpected exception thrown from C++ library" << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(TEST_UNICODE)
|
||||
try
|
||||
{
|
||||
if(((flags[3] & match_partial) == 0) && (flags[2] == regbase::normal) && (has_nulls(search_text.begin(), search_text.end()) == false))
|
||||
{
|
||||
RegEx e;
|
||||
e.SetExpression(expression.c_str(), flags[0] & REG_ICASE);
|
||||
cpp_hl_tests(e, true);
|
||||
}
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
if(search_text != BOOST_RE_STR("!"))
|
||||
{
|
||||
begin_error();
|
||||
cout << "Expression did not compile with class RegEx" << endl;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Unexpected exception thrown from RegEx::SetExpression" << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(flags[4] & (REG_NO_POSIX_TEST | REG_GREP | REG_MERGE | REG_MERGE_COPY))
|
||||
return;
|
||||
regex_t posix_expression;
|
||||
regmatch_t m[MAX_MATCHES];
|
||||
if(regcomp(&posix_expression, expression.c_str(), flags[0]) == 0)
|
||||
{
|
||||
if(flags[1] & REG_STARTEND)
|
||||
{
|
||||
m[0].rm_so = 0;
|
||||
m[0].rm_eo = search_text.size();
|
||||
}
|
||||
if(regexec(&posix_expression, search_text.c_str(), MAX_MATCHES, m, flags[1]))
|
||||
{
|
||||
// match not found
|
||||
if(matches[0] != -1)
|
||||
{
|
||||
begin_error();
|
||||
cout << "Match expected but not found using POSIX API" << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// match found compare what matched with what we expect:
|
||||
int j = 0;
|
||||
for(unsigned int i = 0; i <= posix_expression.re_nsub; ++i, j += 2)
|
||||
{
|
||||
if((m[i].rm_so != matches[j]) || (m[i].rm_eo != matches[j+1]))
|
||||
{
|
||||
begin_error();
|
||||
cout << "POSIX API result mismatch in sub-expression " << i << ", found (" << m[i].rm_so << "," << m[i].rm_eo <<
|
||||
") expected (" << matches[j] << "," << matches[j+1] << ")" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
regfree(&posix_expression);
|
||||
}
|
||||
else
|
||||
{
|
||||
// expression did not compile
|
||||
if(search_text != BOOST_RE_STR("!"))
|
||||
{
|
||||
begin_error();
|
||||
cout << "Expression did not compile using POSIX API" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// error reporting:
|
||||
int last_line = 0;
|
||||
|
||||
void begin_error()
|
||||
{
|
||||
if(line != last_line)
|
||||
{
|
||||
cout << "Error in line " << line << " of file " << file << endl;
|
||||
cout << "Expression: " << expression.c_str() << endl;
|
||||
cout << "Search text: " << search_text.c_str() << endl;
|
||||
cout << "Flags: ";
|
||||
bool started = false;
|
||||
unsigned int id = 0;
|
||||
while(flag_data[id].len != 0)
|
||||
{
|
||||
if(flags[flag_data[id].id] & flag_data[id].value)
|
||||
{
|
||||
if(started)
|
||||
cout << " | ";
|
||||
cout << flag_data[id].name;
|
||||
started = true;
|
||||
}
|
||||
++id;
|
||||
}
|
||||
cout << endl;
|
||||
last_line = line;
|
||||
++error_count;
|
||||
}
|
||||
}
|
||||
|
||||
void reset_error()
|
||||
{
|
||||
last_line = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,867 +0,0 @@
|
||||
;
|
||||
;
|
||||
; this file contains a script of tests to run through regress.exe
|
||||
;
|
||||
; comments start with a semicolon and proceed to the end of the line
|
||||
;
|
||||
; changes to regular expression compile flags start with a "-" as the first
|
||||
; non-whitespace character and consist of a list of the printable names
|
||||
; of the flags, for example "match_default"
|
||||
;
|
||||
; Other lines contain a test to perform using the current flag status
|
||||
; the first token contains the expression to compile, the second the string
|
||||
; to match it against. If the second string is "!" then the expression should
|
||||
; not compile, that is the first string is an invalid regular expression.
|
||||
; This is then followed by a list of integers that specify what should match,
|
||||
; each pair represents the starting and ending positions of a subexpression
|
||||
; starting with the zeroth subexpression (the whole match).
|
||||
; A value of -1 indicates that the subexpression should not take part in the
|
||||
; match at all, if the first value is -1 then no part of the expression should
|
||||
; match the string.
|
||||
;
|
||||
|
||||
- match_default normal REG_EXTENDED
|
||||
|
||||
;
|
||||
; try some really simple literals:
|
||||
a a 0 1
|
||||
Z Z 0 1
|
||||
Z aaa -1 -1
|
||||
Z xxxxZZxxx 4 5
|
||||
|
||||
; and some simple brackets:
|
||||
(a) zzzaazz 3 4 3 4
|
||||
() zzz 0 0 0 0
|
||||
() "" 0 0 0 0
|
||||
( !
|
||||
) !
|
||||
(aa !
|
||||
aa) !
|
||||
a b -1 -1
|
||||
\(\) () 0 2
|
||||
\(a\) (a) 0 3
|
||||
\() !
|
||||
(\) !
|
||||
p(a)rameter ABCparameterXYZ 3 12 4 5
|
||||
[pq](a)rameter ABCparameterXYZ 3 12 4 5
|
||||
|
||||
; now try escaped brackets:
|
||||
- match_default bk_parens REG_BASIC
|
||||
\(a\) zzzaazz 3 4 3 4
|
||||
\(\) zzz 0 0 0 0
|
||||
\(\) "" 0 0 0 0
|
||||
\( !
|
||||
\) !
|
||||
\(aa !
|
||||
aa\) !
|
||||
() () 0 2
|
||||
(a) (a) 0 3
|
||||
(\) !
|
||||
\() !
|
||||
|
||||
; now move on to "." wildcards
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
. a 0 1
|
||||
. \n 0 1
|
||||
. \r 0 1
|
||||
. \0 0 1
|
||||
- match_default normal match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE
|
||||
. a 0 1
|
||||
. \n -1 -1
|
||||
. \r -1 -1
|
||||
. \0 0 1
|
||||
- match_default normal match_not_dot_null match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE
|
||||
. \n -1 -1
|
||||
. \r -1 -1
|
||||
; this *WILL* produce an error from the POSIX API functions:
|
||||
- match_default normal match_not_dot_null match_not_dot_newline REG_EXTENDED REG_STARTEND REG_NEWLINE REG_NO_POSIX_TEST
|
||||
. \0 -1 -1
|
||||
|
||||
|
||||
;
|
||||
; now move on to the repetion ops,
|
||||
; starting with operator *
|
||||
- match_default normal REG_EXTENDED
|
||||
a* b 0 0
|
||||
ab* a 0 1
|
||||
ab* ab 0 2
|
||||
ab* sssabbbbbbsss 3 10
|
||||
ab*c* a 0 1
|
||||
ab*c* abbb 0 4
|
||||
ab*c* accc 0 4
|
||||
ab*c* abbcc 0 5
|
||||
*a !
|
||||
\<* !
|
||||
\>* !
|
||||
\n* \n\n 0 2
|
||||
\** ** 0 2
|
||||
\* * 0 1
|
||||
|
||||
; now try operator +
|
||||
ab+ a -1 -1
|
||||
ab+ ab 0 2
|
||||
ab+ sssabbbbbbsss 3 10
|
||||
ab+c+ a -1 -1
|
||||
ab+c+ abbb -1 -1
|
||||
ab+c+ accc -1 -1
|
||||
ab+c+ abbcc 0 5
|
||||
+a !
|
||||
\<+ !
|
||||
\>+ !
|
||||
\n+ \n\n 0 2
|
||||
\+ + 0 1
|
||||
\+ ++ 0 1
|
||||
\++ ++ 0 2
|
||||
- match_default normal bk_plus_qm REG_EXTENDED REG_NO_POSIX_TEST
|
||||
+ + 0 1
|
||||
\+ !
|
||||
a\+ aa 0 2
|
||||
|
||||
; now try operator ?
|
||||
- match_default normal REG_EXTENDED
|
||||
a? b 0 0
|
||||
ab? a 0 1
|
||||
ab? ab 0 2
|
||||
ab? sssabbbbbbsss 3 5
|
||||
ab?c? a 0 1
|
||||
ab?c? abbb 0 2
|
||||
ab?c? accc 0 2
|
||||
ab?c? abcc 0 3
|
||||
?a !
|
||||
\<? !
|
||||
\>? !
|
||||
\n? \n\n 0 1
|
||||
\? ? 0 1
|
||||
\? ?? 0 1
|
||||
\?? ?? 0 1
|
||||
- match_default normal bk_plus_qm REG_EXTENDED REG_NO_POSIX_TEST
|
||||
? ? 0 1
|
||||
\? !
|
||||
a\? aa 0 1
|
||||
a\? b 0 0
|
||||
|
||||
- match_default normal limited_ops
|
||||
a? a? 0 2
|
||||
a+ a+ 0 2
|
||||
a\? a? 0 2
|
||||
a\+ a+ 0 2
|
||||
|
||||
; now try operator {}
|
||||
- match_default normal REG_EXTENDED
|
||||
a{2} a -1 -1
|
||||
a{2} aa 0 2
|
||||
a{2} aaa 0 2
|
||||
a{2,} a -1 -1
|
||||
a{2,} aa 0 2
|
||||
a{2,} aaaaa 0 5
|
||||
a{2,4} a -1 -1
|
||||
a{2,4} aa 0 2
|
||||
a{2,4} aaa 0 3
|
||||
a{2,4} aaaa 0 4
|
||||
a{2,4} aaaaa 0 4
|
||||
; spaces are now allowed inside {}
|
||||
"a{ 2 , 4 }" aaaaa 0 4
|
||||
a{} !
|
||||
"a{ }" !
|
||||
a{2 !
|
||||
a} !
|
||||
\{\} {} 0 2
|
||||
|
||||
- match_default normal bk_braces
|
||||
a\{2\} a -1 -1
|
||||
a\{2\} aa 0 2
|
||||
a\{2\} aaa 0 2
|
||||
a\{2,\} a -1 -1
|
||||
a\{2,\} aa 0 2
|
||||
a\{2,\} aaaaa 0 5
|
||||
a\{2,4\} a -1 -1
|
||||
a\{2,4\} aa 0 2
|
||||
a\{2,4\} aaa 0 3
|
||||
a\{2,4\} aaaa 0 4
|
||||
a\{2,4\} aaaaa 0 4
|
||||
"a\{ 2 , 4 \}" aaaaa 0 4
|
||||
{} {} 0 2
|
||||
|
||||
; now test the alternation operator |
|
||||
- match_default normal REG_EXTENDED
|
||||
a|b a 0 1
|
||||
a|b b 0 1
|
||||
a(b|c) ab 0 2 1 2
|
||||
a(b|c) ac 0 2 1 2
|
||||
a(b|c) ad -1 -1 -1 -1
|
||||
|c !
|
||||
c| !
|
||||
(|) !
|
||||
(a|) !
|
||||
(|a) !
|
||||
a\| a| 0 2
|
||||
- match_default normal limited_ops
|
||||
a| a| 0 2
|
||||
a\| a| 0 2
|
||||
| | 0 1
|
||||
- match_default normal bk_vbar REG_NO_POSIX_TEST
|
||||
a| a| 0 2
|
||||
a\|b a 0 1
|
||||
a\|b b 0 1
|
||||
|
||||
; now test the set operator []
|
||||
- match_default normal REG_EXTENDED
|
||||
; try some literals first
|
||||
[abc] a 0 1
|
||||
[abc] b 0 1
|
||||
[abc] c 0 1
|
||||
[abc] d -1 -1
|
||||
[^bcd] a 0 1
|
||||
[^bcd] b -1 -1
|
||||
[^bcd] d -1 -1
|
||||
[^bcd] e 0 1
|
||||
a[b]c abc 0 3
|
||||
a[ab]c abc 0 3
|
||||
a[^ab]c adc 0 3
|
||||
a[]b]c a]c 0 3
|
||||
a[[b]c a[c 0 3
|
||||
a[-b]c a-c 0 3
|
||||
a[^]b]c adc 0 3
|
||||
a[^-b]c adc 0 3
|
||||
a[b-]c a-c 0 3
|
||||
a[b !
|
||||
a[] !
|
||||
|
||||
; then some ranges
|
||||
[b-e] a -1 -1
|
||||
[b-e] b 0 1
|
||||
[b-e] e 0 1
|
||||
[b-e] f -1 -1
|
||||
[^b-e] a 0 1
|
||||
[^b-e] b -1 -1
|
||||
[^b-e] e -1 -1
|
||||
[^b-e] f 0 1
|
||||
a[1-3]c a2c 0 3
|
||||
a[3-1]c !
|
||||
a[1-3-5]c !
|
||||
a[1- !
|
||||
|
||||
; and some classes
|
||||
a[[:alpha:]]c abc 0 3
|
||||
a[[:unknown:]]c !
|
||||
a[[: !
|
||||
a[[:alpha !
|
||||
a[[:alpha:] !
|
||||
a[[:alpha,:] !
|
||||
a[[:]:]]b !
|
||||
a[[:-:]]b !
|
||||
a[[:alph:]] !
|
||||
a[[:alphabet:]] !
|
||||
[[:alnum:]]+ -%@a0X- 3 6
|
||||
[[:alpha:]]+ -%@aX0- 3 5
|
||||
[[:blank:]]+ "a \tb" 1 4
|
||||
[[:cntrl:]]+ a\n\tb 1 3
|
||||
[[:digit:]]+ a019b 1 4
|
||||
[[:graph:]]+ " a%b " 1 4
|
||||
[[:lower:]]+ AabC 1 3
|
||||
[[:print:]]+ "\na b\n" 1 4
|
||||
[[:punct:]]+ " %-&\t" 1 4
|
||||
[[:space:]]+ "a \n\t\rb" 1 5
|
||||
[[:upper:]]+ aBCd 1 3
|
||||
[[:xdigit:]]+ p0f3Cx 1 5
|
||||
|
||||
; now test flag settings:
|
||||
- escape_in_lists REG_NO_POSIX_TEST
|
||||
[\n] \n 0 1
|
||||
- REG_NO_POSIX_TEST
|
||||
[\n] \n -1 -1
|
||||
[\n] \\ 0 1
|
||||
[[:class:] : 0 1
|
||||
[[:class:] [ 0 1
|
||||
[[:class:] c 0 1
|
||||
|
||||
; line anchors
|
||||
- match_default normal REG_EXTENDED
|
||||
^ab ab 0 2
|
||||
^ab xxabxx -1 -1
|
||||
^ab xx\nabzz 3 5
|
||||
ab$ ab 0 2
|
||||
ab$ abxx -1 -1
|
||||
ab$ ab\nzz 0 2
|
||||
- match_default match_not_bol match_not_eol normal REG_EXTENDED REG_NOTBOL REG_NOTEOL
|
||||
^ab ab -1 -1
|
||||
^ab xxabxx -1 -1
|
||||
^ab xx\nabzz 3 5
|
||||
ab$ ab -1 -1
|
||||
ab$ abxx -1 -1
|
||||
ab$ ab\nzz 0 2
|
||||
|
||||
; back references
|
||||
- match_default normal REG_EXTENDED
|
||||
a(b)\2c !
|
||||
a(b\1)c !
|
||||
a(b*)c\1d abbcbbd 0 7 1 3
|
||||
a(b*)c\1d abbcbd -1 -1
|
||||
a(b*)c\1d abbcbbbd -1 -1
|
||||
^(.)\1 abc -1 -1
|
||||
a([bc])\1d abcdabbd 4 8 5 6
|
||||
; strictly speaking this is at best ambiguous, at worst wrong, this is what most
|
||||
; re implimentations will match though.
|
||||
a(([bc])\2)*d abbccd 0 6 3 5 3 4
|
||||
|
||||
a(([bc])\2)*d abbcbd -1 -1
|
||||
a((b)*\2)*d abbbd 0 5 1 4 2 3
|
||||
(ab*)[ab]*\1 ababaaa 0 7 0 1
|
||||
(a)\1bcd aabcd 0 5 0 1
|
||||
(a)\1bc*d aabcd 0 5 0 1
|
||||
(a)\1bc*d aabd 0 4 0 1
|
||||
(a)\1bc*d aabcccd 0 7 0 1
|
||||
(a)\1bc*[ce]d aabcccd 0 7 0 1
|
||||
^(a)\1b(c)*cd$ aabcccd 0 7 0 1 4 5
|
||||
|
||||
;
|
||||
; characters by code:
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
\0101 A 0 1
|
||||
\00 \0 0 1
|
||||
\0 \0 0 1
|
||||
\0172 z 0 1
|
||||
|
||||
;
|
||||
; word operators:
|
||||
\w a 0 1
|
||||
\w z 0 1
|
||||
\w A 0 1
|
||||
\w Z 0 1
|
||||
\w _ 0 1
|
||||
\w } -1 -1
|
||||
\w ` -1 -1
|
||||
\w [ -1 -1
|
||||
\w @ -1 -1
|
||||
; non-word:
|
||||
\W a -1 -1
|
||||
\W z -1 -1
|
||||
\W A -1 -1
|
||||
\W Z -1 -1
|
||||
\W _ -1 -1
|
||||
\W } 0 1
|
||||
\W ` 0 1
|
||||
\W [ 0 1
|
||||
\W @ 0 1
|
||||
; word start:
|
||||
\<abcd " abcd" 2 6
|
||||
\<ab cab -1 -1
|
||||
\<ab "\nab" 1 3
|
||||
\<tag ::tag 2 5
|
||||
;word end:
|
||||
abc\> abc 0 3
|
||||
abc\> abcd -1 -1
|
||||
abc\> abc\n 0 3
|
||||
abc\> abc:: 0 3
|
||||
; word boundary:
|
||||
\babcd " abcd" 2 6
|
||||
\bab cab -1 -1
|
||||
\bab "\nab" 1 3
|
||||
\btag ::tag 2 5
|
||||
abc\b abc 0 3
|
||||
abc\b abcd -1 -1
|
||||
abc\b abc\n 0 3
|
||||
abc\b abc:: 0 3
|
||||
; within word:
|
||||
\B ab 1 1
|
||||
a\Bb ab 0 2
|
||||
a\B ab 0 1
|
||||
a\B a -1 -1
|
||||
a\B "a " -1 -1
|
||||
|
||||
;
|
||||
; buffer operators:
|
||||
\`abc abc 0 3
|
||||
\`abc \nabc -1 -1
|
||||
\`abc " abc" -1 -1
|
||||
abc\' abc 0 3
|
||||
abc\' abc\n -1 -1
|
||||
abc\' "abc " -1 -1
|
||||
|
||||
;
|
||||
; extra escape sequences:
|
||||
\a \a 0 1
|
||||
\f \f 0 1
|
||||
\n \n 0 1
|
||||
\r \r 0 1
|
||||
\t \t 0 1
|
||||
\v \v 0 1
|
||||
|
||||
|
||||
;
|
||||
; now follows various complex expressions designed to try and bust the matcher:
|
||||
a(((b)))c abc 0 3 1 2 1 2 1 2
|
||||
a(b|(c))d abd 0 3 1 2 -1 -1
|
||||
a(b|(c))d acd 0 3 1 2 1 2
|
||||
a(b*|c)d abbd 0 4 1 3
|
||||
; just gotta have one DFA-buster, of course
|
||||
a[ab]{20} aaaaabaaaabaaaabaaaab 0 21
|
||||
; and an inline expansion in case somebody gets tricky
|
||||
a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] aaaaabaaaabaaaabaaaab 0 21
|
||||
; and in case somebody just slips in an NFA...
|
||||
a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) aaaaabaaaabaaaabaaaabweeknights 0 31 21 24 24 31
|
||||
; one really big one
|
||||
1234567890123456789012345678901234567890123456789012345678901234567890 a1234567890123456789012345678901234567890123456789012345678901234567890b 1 71
|
||||
; fish for problems as brackets go past 8
|
||||
[ab][cd][ef][gh][ij][kl][mn] xacegikmoq 1 8
|
||||
[ab][cd][ef][gh][ij][kl][mn][op] xacegikmoq 1 9
|
||||
[ab][cd][ef][gh][ij][kl][mn][op][qr] xacegikmoqy 1 10
|
||||
[ab][cd][ef][gh][ij][kl][mn][op][q] xacegikmoqy 1 10
|
||||
; and as parenthesis go past 9:
|
||||
(a)(b)(c)(d)(e)(f)(g)(h) zabcdefghi 1 9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9
|
||||
(a)(b)(c)(d)(e)(f)(g)(h)(i) zabcdefghij 1 10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10
|
||||
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j) zabcdefghijk 1 11 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11
|
||||
(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k) zabcdefghijkl 1 12 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12
|
||||
(a)d|(b)c abc 1 3 -1 -1 1 2
|
||||
"_+((www)|(ftp)|(mailto)):_*" "_wwwnocolon _mailto:" 12 20 13 19 -1 -1 -1 -1 13 19
|
||||
|
||||
; subtleties of matching
|
||||
a(b)?c\1d acd 0 3 -1 -1
|
||||
a(b?c)+d accd 0 4 2 3
|
||||
(wee|week)(knights|night) weeknights 0 10 0 3 3 10
|
||||
.* abc 0 3
|
||||
a(b|(c))d abd 0 3 1 2 -1 -1
|
||||
a(b|(c))d acd 0 3 1 2 1 2
|
||||
a(b*|c|e)d abbd 0 4 1 3
|
||||
a(b*|c|e)d acd 0 3 1 2
|
||||
a(b*|c|e)d ad 0 2 1 1
|
||||
a(b?)c abc 0 3 1 2
|
||||
a(b?)c ac 0 2 1 1
|
||||
a(b+)c abc 0 3 1 2
|
||||
a(b+)c abbbc 0 5 1 4
|
||||
a(b*)c ac 0 2 1 1
|
||||
(a|ab)(bc([de]+)f|cde) abcdef 0 6 0 1 1 6 3 5
|
||||
a([bc]?)c abc 0 3 1 2
|
||||
a([bc]?)c ac 0 2 1 1
|
||||
a([bc]+)c abc 0 3 1 2
|
||||
a([bc]+)c abcc 0 4 1 3
|
||||
a([bc]+)bc abcbc 0 5 1 3
|
||||
a(bb+|b)b abb 0 3 1 2
|
||||
a(bbb+|bb+|b)b abb 0 3 1 2
|
||||
a(bbb+|bb+|b)b abbb 0 4 1 3
|
||||
a(bbb+|bb+|b)bb abbb 0 4 1 2
|
||||
(.*).* abcdef 0 6 0 6
|
||||
(a*)* bc 0 0 0 0
|
||||
|
||||
; do we get the right subexpression when it is used more than once?
|
||||
a(b|c)*d ad 0 2 -1 -1
|
||||
a(b|c)*d abcd 0 4 2 3
|
||||
a(b|c)+d abd 0 3 1 2
|
||||
a(b|c)+d abcd 0 4 2 3
|
||||
a(b|c?)+d ad 0 2 1 1
|
||||
a(b|c?)+d abcd 0 4 2 3
|
||||
a(b|c){0,0}d ad 0 2 -1 -1
|
||||
a(b|c){0,1}d ad 0 2 -1 -1
|
||||
a(b|c){0,1}d abd 0 3 1 2
|
||||
a(b|c){0,2}d ad 0 2 -1 -1
|
||||
a(b|c){0,2}d abcd 0 4 2 3
|
||||
a(b|c){0,}d ad 0 2 -1 -1
|
||||
a(b|c){0,}d abcd 0 4 2 3
|
||||
a(b|c){1,1}d abd 0 3 1 2
|
||||
a(b|c){1,2}d abd 0 3 1 2
|
||||
a(b|c){1,2}d abcd 0 4 2 3
|
||||
a(b|c){1,}d abd 0 3 1 2
|
||||
a(b|c){1,}d abcd 0 4 2 3
|
||||
a(b|c){2,2}d acbd 0 4 2 3
|
||||
a(b|c){2,2}d abcd 0 4 2 3
|
||||
a(b|c){2,4}d abcd 0 4 2 3
|
||||
a(b|c){2,4}d abcbd 0 5 3 4
|
||||
a(b|c){2,4}d abcbcd 0 6 4 5
|
||||
a(b|c){2,}d abcd 0 4 2 3
|
||||
a(b|c){2,}d abcbd 0 5 3 4
|
||||
a(b+|((c)*))+d abd 0 3 1 2 -1 -1 -1 -1
|
||||
a(b+|((c)*))+d abcd 0 4 2 3 2 3 2 3
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_NOSPEC literal
|
||||
\**?/{} \\**?/{} 0 7
|
||||
|
||||
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST ; we disable POSIX testing because it can't handle escapes in sets
|
||||
; try to match C++ syntax elements:
|
||||
; line comment:
|
||||
//[^\n]* "++i //here is a line comment\n" 4 28
|
||||
; block comment:
|
||||
/\*([^*]|\*+[^*/])*\*+/ "/* here is a block comment */" 0 29 26 27
|
||||
/\*([^*]|\*+[^*/])*\*+/ "/**/" 0 4 -1 -1
|
||||
/\*([^*]|\*+[^*/])*\*+/ "/***/" 0 5 -1 -1
|
||||
/\*([^*]|\*+[^*/])*\*+/ "/****/" 0 6 -1 -1
|
||||
/\*([^*]|\*+[^*/])*\*+/ "/*****/" 0 7 -1 -1
|
||||
/\*([^*]|\*+[^*/])*\*+/ "/*****/*/" 0 7 -1 -1
|
||||
; preprossor directives:
|
||||
^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol" 0 19 -1 -1
|
||||
^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) #x" 0 25 -1 -1
|
||||
^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);" 0 53 28 42
|
||||
; literals:
|
||||
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFF 0 4 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 35 0 2 0 2 -1 -1 0 2 -1 -1 -1 -1 -1 -1
|
||||
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFu 0 5 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFL 0 5 0 4 0 4 -1 -1 4 5 -1 -1 -1 -1
|
||||
((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFFFFFFFFFFFFFFFuint64 0 24 0 18 0 18 -1 -1 19 24 19 24 22 24
|
||||
; strings:
|
||||
'([^\\']|\\.)*' '\\x3A' 0 6 4 5
|
||||
'([^\\']|\\.)*' '\\'' 0 4 1 3
|
||||
'([^\\']|\\.)*' '\\n' 0 4 1 3
|
||||
|
||||
; now try and test some unicode specific characters:
|
||||
- match_default normal REG_EXTENDED REG_UNICODE_ONLY
|
||||
[[:unicode:]]+ a\0300\0400z 1 3
|
||||
|
||||
; finally try some case insensitive matches:
|
||||
- match_default normal REG_EXTENDED REG_ICASE
|
||||
; upper and lower have no meaning here so they fail, however these
|
||||
; may compile with other libraries...
|
||||
;[[:lower:]] !
|
||||
;[[:upper:]] !
|
||||
0123456789@abcdefghijklmnopqrstuvwxyz\[\\\]\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\{\|\} 0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\} 0 72
|
||||
|
||||
; known and suspected bugs:
|
||||
- match_default normal REG_EXTENDED
|
||||
\( ( 0 1
|
||||
\) ) 0 1
|
||||
\$ $ 0 1
|
||||
\^ ^ 0 1
|
||||
\. . 0 1
|
||||
\* * 0 1
|
||||
\+ + 0 1
|
||||
\? ? 0 1
|
||||
\[ [ 0 1
|
||||
\] ] 0 1
|
||||
\| | 0 1
|
||||
\\ \\ 0 1
|
||||
# # 0 1
|
||||
\# # 0 1
|
||||
a- a- 0 2
|
||||
\- - 0 1
|
||||
\{ { 0 1
|
||||
\} } 0 1
|
||||
0 0 0 1
|
||||
1 1 0 1
|
||||
9 9 0 1
|
||||
b b 0 1
|
||||
B B 0 1
|
||||
< < 0 1
|
||||
> > 0 1
|
||||
w w 0 1
|
||||
W W 0 1
|
||||
` ` 0 1
|
||||
' ' 0 1
|
||||
\n \n 0 1
|
||||
, , 0 1
|
||||
a a 0 1
|
||||
f f 0 1
|
||||
n n 0 1
|
||||
r r 0 1
|
||||
t t 0 1
|
||||
v v 0 1
|
||||
c c 0 1
|
||||
x x 0 1
|
||||
: : 0 1
|
||||
(\.[[:alnum:]]+){2} "w.a.b " 1 5 3 5
|
||||
|
||||
- match_default normal REG_EXTENDED REG_ICASE
|
||||
a A 0 1
|
||||
A a 0 1
|
||||
[abc]+ abcABC 0 6
|
||||
[ABC]+ abcABC 0 6
|
||||
[a-z]+ abcABC 0 6
|
||||
[A-Z]+ abzANZ 0 6
|
||||
[a-Z]+ abzABZ 0 6
|
||||
[A-z]+ abzABZ 0 6
|
||||
[[:lower:]]+ abyzABYZ 0 8
|
||||
[[:upper:]]+ abzABZ 0 6
|
||||
[[:word:]]+ abcZZZ 0 6
|
||||
[[:alpha:]]+ abyzABYZ 0 8
|
||||
[[:alnum:]]+ 09abyzABYZ 0 10
|
||||
|
||||
; updated tests for version 2:
|
||||
- match_default normal REG_EXTENDED
|
||||
\x41 A 0 1
|
||||
\xff \255 0 1
|
||||
\xFF \255 0 1
|
||||
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST
|
||||
\c@ \0 0 1
|
||||
- match_default normal REG_EXTENDED
|
||||
\cA \1 0 1
|
||||
\cz \58 0 1
|
||||
\c= !
|
||||
\c? !
|
||||
=: =: 0 2
|
||||
|
||||
; word start:
|
||||
[[:<:]]abcd " abcd" 2 6
|
||||
[[:<:]]ab cab -1 -1
|
||||
[[:<:]]ab "\nab" 1 3
|
||||
[[:<:]]tag ::tag 2 5
|
||||
;word end:
|
||||
abc[[:>:]] abc 0 3
|
||||
abc[[:>:]] abcd -1 -1
|
||||
abc[[:>:]] abc\n 0 3
|
||||
abc[[:>:]] abc:: 0 3
|
||||
|
||||
; collating elements and rewritten set code:
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
[[.zero.]] 0 0 1
|
||||
[[.one.]] 1 0 1
|
||||
[[.two.]] 2 0 1
|
||||
[[.three.]] 3 0 1
|
||||
[[.a.]] baa 1 2
|
||||
[[.right-curly-bracket.]] } 0 1
|
||||
[[.NUL.]] \0 0 1
|
||||
[[:<:]z] !
|
||||
[a[:>:]] !
|
||||
[[=a=]] a 0 1
|
||||
[[=right-curly-bracket=]] } 0 1
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE
|
||||
[[.A.]] A 0 1
|
||||
[[.A.]] a 0 1
|
||||
[[.A.]-b]+ AaBb 0 4
|
||||
[A-[.b.]]+ AaBb 0 4
|
||||
[[.a.]-B]+ AaBb 0 4
|
||||
[a-[.B.]]+ AaBb 0 4
|
||||
- match_default normal REG_EXTENDED REG_NO_POSIX_TEST
|
||||
[\x61] a 0 1
|
||||
[\x61-c]+ abcd 0 3
|
||||
[a-\x63]+ abcd 0 3
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
[[.a.]-c]+ abcd 0 3
|
||||
[a-[.c.]]+ abcd 0 3
|
||||
[[:alpha:]-a] !
|
||||
[a-[:alpha:]] !
|
||||
|
||||
; try mutli-character ligatures:
|
||||
[[.ae.]] ae 0 2
|
||||
[[.ae.]] aE -1 -1
|
||||
[[.AE.]] AE 0 2
|
||||
[[.Ae.]] Ae 0 2
|
||||
[[.ae.]-b] a -1 -1
|
||||
[[.ae.]-b] b 0 1
|
||||
[[.ae.]-b] ae 0 2
|
||||
[a-[.ae.]] a 0 1
|
||||
[a-[.ae.]] b -1 -1
|
||||
[a-[.ae.]] ae 0 2
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE
|
||||
[[.ae.]] AE 0 2
|
||||
[[.ae.]] Ae 0 2
|
||||
[[.AE.]] Ae 0 2
|
||||
[[.Ae.]] aE 0 2
|
||||
[[.AE.]-B] a -1 -1
|
||||
[[.Ae.]-b] b 0 1
|
||||
[[.Ae.]-b] B 0 1
|
||||
[[.ae.]-b] AE 0 2
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
;extended perl style escape sequences:
|
||||
\e \27 0 1
|
||||
\x1b \27 0 1
|
||||
\x{1b} \27 0 1
|
||||
\x{} !
|
||||
\x{ !
|
||||
\x} !
|
||||
\x !
|
||||
\x{yy !
|
||||
\x{1b !
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_NO_POSIX_TEST
|
||||
\l+ ABabcAB 2 5
|
||||
[\l]+ ABabcAB 2 5
|
||||
[a-\l] !
|
||||
[\l-a] !
|
||||
[\L] !
|
||||
\L+ abABCab 2 5
|
||||
\u+ abABCab 2 5
|
||||
[\u]+ abABCab 2 5
|
||||
[\U] !
|
||||
\U+ ABabcAB 2 5
|
||||
\d+ ab012ab 2 5
|
||||
[\d]+ ab012ab 2 5
|
||||
[\D] !
|
||||
\D+ 01abc01 2 5
|
||||
\s+ "ab ab" 2 5
|
||||
[\s]+ "ab ab" 2 5
|
||||
[\S] !
|
||||
\S+ " abc " 2 5
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
\Qabc !
|
||||
\Qabc\E abcd 0 3
|
||||
\Qabc\Ed abcde 0 4
|
||||
\Q+*?\\E +*?\\ 0 4
|
||||
|
||||
\C+ abcde 0 5
|
||||
\X+ abcde 0 5
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_UNICODE_ONLY
|
||||
\X+ a\768\769 0 3
|
||||
\X+ \2309\2307 0 2 ;DEVANAGARI script
|
||||
\X+ \2489\2494 0 2 ;BENGALI script
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND
|
||||
\Aabc abc 0 3
|
||||
\Aabc aabc -1 -1
|
||||
abc\z abc 0 3
|
||||
abc\z abcd -1 -1
|
||||
abc\Z abc\n\n 0 3
|
||||
abc\Z abc 0 3
|
||||
|
||||
|
||||
\Gabc abc 0 3
|
||||
\Gabc dabcd -1 -1
|
||||
a\Gbc abc -1 -1
|
||||
a\Aab abc -1 -1
|
||||
|
||||
;
|
||||
; now test grep,
|
||||
; basically check all our restart types - line, word, etc
|
||||
; checking each one for null and non-null matches.
|
||||
;
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP
|
||||
a " a a a aa" 1 2 3 4 5 6 7 8 8 9
|
||||
a+b+ "aabaabbb ab" 0 3 3 8 9 11
|
||||
a(b*|c|e)d adabbdacd 0 2 2 6 6 9
|
||||
a "\na\na\na\naa" 1 2 3 4 5 6 7 8 8 9
|
||||
|
||||
^ " \n\n \n\n\n" 0 0 4 4 5 5 8 8 9 9 10 10
|
||||
^ab "ab \nab ab\n" 0 2 5 7
|
||||
^[^\n]*\n " \n \n\n \n" 0 4 4 7 7 8 8 11
|
||||
\<abc "abcabc abc\n\nabc" 0 3 7 10 12 15
|
||||
\< " ab a aaa " 2 2 5 5 7 7
|
||||
\<\w+\W+ " aa aa a " 1 5 5 9 9 11
|
||||
|
||||
\Aabc "abc abc" 0 3
|
||||
\G\w+\W+ "abc abc a cbbb " 0 5 5 9 9 11 11 18
|
||||
\Ga+b+ "aaababb abb" 0 4 4 7
|
||||
|
||||
abc abc 0 3
|
||||
abc " abc abcabc " 1 4 5 8 8 11
|
||||
\n\n " \n\n\n \n \n\n\n\n " 1 3 18 20 20 22
|
||||
|
||||
$ " \n\n \n\n\n" 3 3 4 4 7 7 8 8 9 9 10 10
|
||||
\b " abb a abbb " 2 2 5 5 6 6 7 7 8 8 12 12
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP REG_ICASE
|
||||
A " a a a aa" 1 2 3 4 5 6 7 8 8 9
|
||||
A+B+ "aabaabbb ab" 0 3 3 8 9 11
|
||||
A(B*|c|e)D adabbdacd 0 2 2 6 6 9
|
||||
A "\na\na\na\naa" 1 2 3 4 5 6 7 8 8 9
|
||||
|
||||
^aB "Ab \nab Ab\n" 0 2 5 7
|
||||
\<abc "Abcabc aBc\n\nabc" 0 3 7 10 12 15
|
||||
|
||||
ABC abc 0 3
|
||||
abc " ABC ABCABC " 1 4 5 8 8 11
|
||||
|
||||
|
||||
;
|
||||
; now test merge,
|
||||
;
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE format_no_copy
|
||||
; start by testing subs:
|
||||
a+ "...aaa,,," $` "..."
|
||||
a+ "...aaa,,," $' ",,,"
|
||||
a+ "...aaa,,," $& "aaa"
|
||||
a+ "...aaa,,," $0 aaa
|
||||
a+ "...aaa,,," $1 ""
|
||||
a+ "...aaa,,," $15 ""
|
||||
(a+)b+ "...aaabbb,,," $1 aaa
|
||||
|
||||
; and now escapes:
|
||||
a+ "...aaa,,," $x "$x"
|
||||
a+ "...aaa,,," \a "\a"
|
||||
a+ "...aaa,,," \f "\f"
|
||||
a+ "...aaa,,," \n "\n"
|
||||
a+ "...aaa,,," \r "\r"
|
||||
a+ "...aaa,,," \t "\t"
|
||||
a+ "...aaa,,," \v "\v"
|
||||
|
||||
a+ "...aaa,,," \x21 "!"
|
||||
a+ "...aaa,,," \x{21} "!"
|
||||
a+ "...aaa,,," \c@ \0
|
||||
a+ "...aaa,,," \e \27
|
||||
a+ "...aaa,,," \0101 A
|
||||
a+ "...aaa,,," (\0101) A
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE format_sed format_no_copy
|
||||
(a+)(b+) ...aabb,, \0 aabb
|
||||
(a+)(b+) ...aabb,, \1 aa
|
||||
(a+)(b+) ...aabb,, \2 bb
|
||||
(a+)(b+) ...aabb,, & aabb
|
||||
(a+)(b+) ...aabb,, $ $
|
||||
(a+)(b+) ...aabb,, $1 $1
|
||||
(a+)(b+) ...aabb,, ()?: ()?:
|
||||
(a+)(b+) ...aabb,, \\ \\
|
||||
(a+)(b+) ...aabb,, \& &
|
||||
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE format_perl format_no_copy
|
||||
(a+)(b+) ...aabb,, $0 aabb
|
||||
(a+)(b+) ...aabb,, $1 aa
|
||||
(a+)(b+) ...aabb,, $2 bb
|
||||
(a+)(b+) ...aabb,, $& aabb
|
||||
(a+)(b+) ...aabb,, & &
|
||||
(a+)(b+) ...aabb,, \0 \0
|
||||
(a+)(b+) ...aabb,, ()?: ()?:
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_MERGE
|
||||
; move to copying unmatched data:
|
||||
a+ "...aaa,,," bbb "...bbb,,,"
|
||||
a+(b+) "...aaabb,,," $1 "...bb,,,"
|
||||
a+(b+) "...aaabb,,,ab*abbb?" $1 "...bb,,,b*bbb?"
|
||||
|
||||
(a+)|(b+) "...aaabb,,,ab*abbb?" (?1A)(?2B) "...AB,,,AB*AB?"
|
||||
(a+)|(b+) "...aaabb,,,ab*abbb?" ?1A:B "...AB,,,AB*AB?"
|
||||
(a+)|(b+) "...aaabb,,,ab*abbb?" (?1A:B)C "...ACBC,,,ACBC*ACBC?"
|
||||
(a+)|(b+) "...aaabb,,,ab*abbb?" ?1:B "...B,,,B*B?"
|
||||
|
||||
;
|
||||
; changes to newline handling with 2.11:
|
||||
;
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP
|
||||
|
||||
^. " \n \r\n " 0 1 3 4 7 8
|
||||
.$ " \n \r\n " 1 2 4 5 8 9
|
||||
|
||||
- match_default normal REG_EXTENDED REG_STARTEND REG_GREP REG_UNICODE_ONLY
|
||||
^. " \8232 \8233 " 0 1 3 4 5 6
|
||||
.$ " \8232 \8233 " 1 2 3 4 6 7
|
||||
|
||||
;
|
||||
; non-greedy repeats added 21/04/00
|
||||
- match_default normal REG_EXTENDED
|
||||
a** !
|
||||
a*? aa 0 0
|
||||
a?? aa 0 0
|
||||
a++ !
|
||||
a+? aa 0 1
|
||||
a{1,3}{1} !
|
||||
a{1,3}? aaa 0 1
|
||||
\w+?w ...ccccccwcccccw 3 10
|
||||
\W+\w+?w ...ccccccwcccccw 0 10
|
||||
abc|\w+? abd 0 1
|
||||
abc|\w+? abcd 0 3
|
||||
<\s*tag[^>]*>(.*?)<\s*/tag\s*> " <tag>here is some text</tag> <tag></tag>" 1 29 6 23
|
||||
<\s*tag[^>]*>(.*?)<\s*/tag\s*> " < tag attr=\"something\">here is some text< /tag > <tag></tag>" 1 49 24 41
|
||||
|
||||
;
|
||||
; non-marking parenthesis added 25/04/00
|
||||
- match_default normal REG_EXTENDED
|
||||
(?:abc)+ xxabcabcxx 2 8
|
||||
(?:a+)(b+) xaaabbbx 1 7 4 7
|
||||
(a+)(?:b+) xaaabbba 1 7 1 4
|
||||
(?:(a+)b+) xaaabbba 1 7 1 4
|
||||
(?:a+(b+)) xaaabbba 1 7 4 7
|
||||
a+(?#b+)b+ xaaabbba 1 7
|
||||
|
||||
;
|
||||
; try some partial matches:
|
||||
- match_partial match_default normal REG_EXTENDED REG_NO_POSIX_TEST
|
||||
(xyz)(.*)abc xyzaaab -1 -1 0 3 3 7
|
||||
(xyz)(.*)abc xyz -1 -1 0 3 3 3
|
||||
(xyz)(.*)abc xy -1 -1 -1 -1 -1 -1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,119 +0,0 @@
|
||||
|
||||
# very basic makefile for regression tests
|
||||
#
|
||||
# Visual C++ 6 + full stlport 4.x
|
||||
#
|
||||
# we don't test single threaded builds as stlport doesn't support these...
|
||||
#
|
||||
CFLAGS= /Oityb1 /GF /Gy -GX -GR -I..\..\..\..\
|
||||
|
||||
LFLAGS= -link /LIBPATH:..\..\lib\vc6-stlport user32.lib
|
||||
|
||||
all :: r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1md.exe r2md.exe r3md.exe r4md.exe r5md.exe r6md.exe r1lmd.exe r2lmd.exe r3lmd.exe r4lmd.exe r5lmd.exe r6lmd.exe
|
||||
echo testing static multi-threaded version....
|
||||
r1m tests.txt test1252.txt
|
||||
r2m tests.txt
|
||||
r3m tests.txt
|
||||
r4m tests.txt test1252.txt
|
||||
r5m tests.txt
|
||||
r6m tests.txt
|
||||
echo testing DLL version....
|
||||
r1l tests.txt test1252.txt
|
||||
r2l tests.txt
|
||||
r3l tests.txt
|
||||
r4l tests.txt test1252.txt
|
||||
r5l tests.txt
|
||||
r6l tests.txt
|
||||
echo testing static multi-threaded debug version....
|
||||
r1md tests.txt test1252.txt
|
||||
r2md tests.txt
|
||||
r3md tests.txt
|
||||
r4md tests.txt test1252.txt
|
||||
r5md tests.txt
|
||||
r6md tests.txt
|
||||
echo testing dll debug version....
|
||||
r1lmd tests.txt test1252.txt
|
||||
r2lmd tests.txt
|
||||
r3lmd tests.txt
|
||||
r4lmd tests.txt test1252.txt
|
||||
r5lmd tests.txt
|
||||
r6lmd tests.txt
|
||||
|
||||
|
||||
r1m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT -o r1m.exe $(CFLAGS) -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r2m.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r3m.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r4m.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r5m.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r6m.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r1l.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r2l.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r3l.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r4l.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r5l.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r6l.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r1md.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r2md.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r3md.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r4md.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r5md.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r6md.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r1lmd.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r2lmd.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r3lmd.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r4lmd.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r5lmd.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmd.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
|
@ -1,181 +0,0 @@
|
||||
|
||||
# very basic makefile for regression tests
|
||||
#
|
||||
# Visual C++ 6
|
||||
#
|
||||
CFLAGS= /Oityb1 /GF /Gy -GX -GR -I..\..\..\..\
|
||||
|
||||
LFLAGS= -link /LIBPATH:..\..\lib\vc6 user32.lib
|
||||
|
||||
all :: r1.exe r2.exe r3.exe r4.exe r5.exe r6.exe r1m.exe r2m.exe r3m.exe r4m.exe r5m.exe r6m.exe r1l.exe r2l.exe r3l.exe r4l.exe r5l.exe r6l.exe r1d.exe r2d.exe r3d.exe r4d.exe r5d.exe r6d.exe r1md.exe r2md.exe r3md.exe r4md.exe r5md.exe r6md.exe r1lmd.exe r2lmd.exe r3lmd.exe r4lmd.exe r5lmd.exe r6lmd.exe
|
||||
echo testing static single threaded version....
|
||||
r1 tests.txt test1252.txt
|
||||
r2 tests.txt
|
||||
r3 tests.txt
|
||||
r4 tests.txt test1252.txt
|
||||
r5 tests.txt
|
||||
r6 tests.txt
|
||||
echo testing static multi-threaded version....
|
||||
r1m tests.txt test1252.txt
|
||||
r2m tests.txt
|
||||
r3m tests.txt
|
||||
r4m tests.txt test1252.txt
|
||||
r5m tests.txt
|
||||
r6m tests.txt
|
||||
echo testing DLL version....
|
||||
r1l tests.txt test1252.txt
|
||||
r2l tests.txt
|
||||
r3l tests.txt
|
||||
r4l tests.txt test1252.txt
|
||||
r5l tests.txt
|
||||
r6l tests.txt
|
||||
echo testing static single threaded debug version....
|
||||
r1d tests.txt test1252.txt
|
||||
r2d tests.txt
|
||||
r3d tests.txt
|
||||
r4d tests.txt test1252.txt
|
||||
r5d tests.txt
|
||||
r6d tests.txt
|
||||
echo testing static multi-threaded debug version....
|
||||
r1md tests.txt test1252.txt
|
||||
r2md tests.txt
|
||||
r3md tests.txt
|
||||
r4md tests.txt test1252.txt
|
||||
r5md tests.txt
|
||||
r6md tests.txt
|
||||
echo testing dll debug version....
|
||||
r1lmd tests.txt test1252.txt
|
||||
r2lmd tests.txt
|
||||
r3lmd tests.txt
|
||||
r4lmd tests.txt test1252.txt
|
||||
r5lmd tests.txt
|
||||
r6lmd tests.txt
|
||||
|
||||
|
||||
r1.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /ML $(CFLAGS) -o r1.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /ML $(CFLAGS) -o r2.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /ML $(CFLAGS) -o r3.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /ML $(CFLAGS) -o r4.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /ML $(CFLAGS) -o r5.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /ML $(CFLAGS) -o r6.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT -o r1m.exe $(CFLAGS) -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r2m.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r3m.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r4m.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r5m.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6m.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MT /D_MT $(CFLAGS) -o r6m.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r1l.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r2l.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r3l.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r4l.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r5l.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6l.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MD /D_MT /D_DLL $(CFLAGS) -o r6l.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1d.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MLd $(CFLAGS) -o r1d.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2d.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MLd $(CFLAGS) -o r2d.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3d.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MLd $(CFLAGS) -o r3d.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4d.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MLd $(CFLAGS) -o r4d.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5d.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MLd $(CFLAGS) -o r5d.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6d.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MLd $(CFLAGS) -o r6d.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r1md.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r2md.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r3md.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r4md.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r5md.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6md.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MTd /D_MT $(CFLAGS) -o r6md.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
r1lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r1lmd.exe -DBOOST_RE_TEST_LOCALE_W32 tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r2lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r2lmd.exe -DBOOST_RE_TEST_LOCALE_C tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r3lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r3lmd.exe -DBOOST_RE_TEST_LOCALE_CPP tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r4lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r4lmd.exe -DBOOST_RE_TEST_LOCALE_W32 -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r5lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r5lmd.exe -DBOOST_RE_TEST_LOCALE_C -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
r6lmd.exe : tests.cpp parse.cpp regress.cpp
|
||||
cl /MDd /D_MT /D_DLL $(CFLAGS) -o r6lmd.exe -DBOOST_RE_TEST_LOCALE_CPP -DTEST_UNICODE tests.cpp parse.cpp regress.cpp $(LFLAGS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,196 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_test.cpp
|
||||
* VERSION 3.02
|
||||
* DESCRIPTION: Builds regression test program with default
|
||||
* locale and wide character tests. Also
|
||||
* instantiates all the templates in the library
|
||||
* as a sanity check.
|
||||
*/
|
||||
|
||||
// disable automatic selection of support library:
|
||||
#define BOOST_RE_NO_LIB
|
||||
#define TEST_UNICODE
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
//
|
||||
// instantiate templates used:
|
||||
//
|
||||
namespace boost{
|
||||
|
||||
typedef const wchar_t* ra_it;
|
||||
typedef wchar_t char_type;
|
||||
typedef std::basic_string<char_type> test_string_type;
|
||||
|
||||
bool pred1(const match_results<ra_it>&)
|
||||
{ return true; }
|
||||
|
||||
typedef bool (*pred1_type)(const match_results<ra_it>&);
|
||||
typedef bool (*pred2_type)(const match_results<test_string_type::const_iterator>&);
|
||||
|
||||
//check that all the defined flags are available:
|
||||
regbase::flag_type f = regbase::escape_in_lists | regbase::char_classes | regbase::intervals | regbase::limited_ops
|
||||
| regbase::newline_alt | regbase::bk_plus_qm | regbase::bk_braces
|
||||
| regbase::bk_parens | regbase::bk_refs | regbase::bk_vbar | regbase::use_except
|
||||
| regbase::failbit | regbase::literal | regbase::icase | regbase::nocollate | regbase::basic
|
||||
| regbase::extended | regbase::normal | regbase::emacs | regbase::awk | regbase::grep | regbase::egrep | regbase::sed;
|
||||
|
||||
template class reg_expression<char_type>;
|
||||
template struct sub_match<ra_it>;
|
||||
template class match_results<ra_it>;
|
||||
|
||||
template bool regex_match(ra_it,
|
||||
ra_it,
|
||||
match_results<ra_it>& m,
|
||||
const reg_expression<char_type>& e,
|
||||
unsigned flags);
|
||||
template bool regex_match(ra_it,
|
||||
ra_it,
|
||||
const reg_expression<char_type>& e,
|
||||
unsigned flags);
|
||||
template bool regex_search(ra_it,
|
||||
ra_it,
|
||||
match_results<ra_it>& m,
|
||||
const reg_expression<char_type>& e,
|
||||
unsigned flags);
|
||||
template unsigned int regex_grep(pred1_type,
|
||||
ra_it,
|
||||
ra_it,
|
||||
const reg_expression<char_type>& e,
|
||||
unsigned flags);
|
||||
template char_type* regex_format(char_type*,
|
||||
const match_results<ra_it>& m,
|
||||
const char_type* fmt,
|
||||
unsigned flags);
|
||||
template char_type* regex_format(char_type*,
|
||||
const match_results<ra_it>& m,
|
||||
const test_string_type& fmt,
|
||||
unsigned flags);
|
||||
template char_type* regex_merge(char_type*,
|
||||
ra_it,
|
||||
ra_it,
|
||||
const reg_expression<char_type>&,
|
||||
const char_type*,
|
||||
unsigned int flags);
|
||||
template char_type* regex_merge(char_type*,
|
||||
ra_it,
|
||||
ra_it,
|
||||
const reg_expression<char_type>& e,
|
||||
const test_string_type&,
|
||||
unsigned int flags);
|
||||
template std::size_t regex_split(test_string_type*,
|
||||
test_string_type&,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags,
|
||||
std::size_t);
|
||||
template std::size_t regex_split(test_string_type*,
|
||||
test_string_type& s,
|
||||
const reg_expression<char_type>& e,
|
||||
unsigned flags);
|
||||
|
||||
template std::size_t regex_split(test_string_type*, test_string_type&);
|
||||
|
||||
#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC
|
||||
//
|
||||
// the following prototypes are only available if partial ordering
|
||||
// of template functions is supported:
|
||||
//
|
||||
template bool regex_match(const char_type*,
|
||||
match_results<const char_type*>& m,
|
||||
const reg_expression<char_type>& e,
|
||||
unsigned flags);
|
||||
template bool regex_match(const test_string_type&,
|
||||
match_results<test_string_type::const_iterator>&,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_match(const char_type*,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_match(const test_string_type&,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_search(const char_type*,
|
||||
match_results<const char_type*>&,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template bool regex_search(const test_string_type&,
|
||||
match_results<test_string_type::const_iterator>&,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template unsigned int regex_grep(pred1_type,
|
||||
const char_type*,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template unsigned int regex_grep(pred2_type,
|
||||
const test_string_type&,
|
||||
const reg_expression<char_type>&,
|
||||
unsigned flags);
|
||||
template test_string_type regex_format
|
||||
(const match_results<test_string_type::const_iterator>& m,
|
||||
const char_type*,
|
||||
unsigned flags);
|
||||
template test_string_type regex_format
|
||||
(const match_results<test_string_type::const_iterator>&,
|
||||
const test_string_type&,
|
||||
unsigned flags);
|
||||
template test_string_type regex_merge(const test_string_type&,
|
||||
const reg_expression<char_type>&,
|
||||
const char_type*,
|
||||
unsigned int flags);
|
||||
template test_string_type regex_merge(const test_string_type&,
|
||||
const reg_expression<char_type>&,
|
||||
const test_string_type&,
|
||||
unsigned int flags);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
//
|
||||
// include regression test source files:
|
||||
//
|
||||
#ifdef BOOST_RE_LOCALE_W32
|
||||
#define BOOST_RE_TEST_LOCALE_W32
|
||||
#elif !defined(BOOST_RE_LOCALE_C)
|
||||
#define BOOST_RE_TEST_LOCALE_CPP
|
||||
#endif
|
||||
#include "tests.cpp"
|
||||
#include "parse.cpp"
|
||||
#include "regress.cpp"
|
||||
|
||||
//
|
||||
// include library source files:
|
||||
//
|
||||
#ifdef BOOST_RE_LOCALE_W32
|
||||
#include "libs/regex/src/w32_regex_traits.cpp"
|
||||
#elif defined(BOOST_RE_LOCALE_C)
|
||||
#include "libs/regex/src/c_regex_traits.cpp"
|
||||
#else
|
||||
#include "libs/regex/src/cpp_regex_traits.cpp"
|
||||
#endif
|
||||
#include "libs/regex/src/c_regex_traits_common.cpp"
|
||||
#include "libs/regex/src/cregex.cpp"
|
||||
#include "libs/regex/src/fileiter.cpp"
|
||||
#include "libs/regex/src/posix_api.cpp"
|
||||
#include "libs/regex/src/regex.cpp"
|
||||
#include "libs/regex/src/regex_debug.cpp"
|
||||
#include "libs/regex/src/regex_synch.cpp"
|
||||
#include "libs/regex/src/wide_posix_api.cpp"
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip1.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: ftp based regex_match example.
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <boost/regex.hpp>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
|
||||
regex expression("^([0-9]+)(\\-| |$)(.*)$");
|
||||
|
||||
// process_ftp:
|
||||
// on success returns the ftp response code, and fills
|
||||
// msg with the ftp response message.
|
||||
int process_ftp(const char* response, std::string* msg)
|
||||
{
|
||||
cmatch what;
|
||||
if(regex_match(response, what, expression))
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[1] contains the response code
|
||||
// what[2] contains the separator character
|
||||
// what[3] contains the text message.
|
||||
if(msg)
|
||||
msg->assign(what[3].first, what[3].second);
|
||||
return std::atoi(what[1].first);
|
||||
}
|
||||
// failure did not match
|
||||
if(msg)
|
||||
msg->erase();
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
|
||||
//
|
||||
// problem with std::getline under MSVC6sp3
|
||||
istream& getline(istream& is, std::string& s)
|
||||
{
|
||||
s.erase();
|
||||
char c = is.get();
|
||||
while(c != '\n')
|
||||
{
|
||||
s.append(1, c);
|
||||
c = is.get();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string in, out;
|
||||
while(true)
|
||||
{
|
||||
cout << "enter test string" << endl;
|
||||
getline(cin, in);
|
||||
if(in == "quit")
|
||||
break;
|
||||
int result;
|
||||
result = process_ftp(in.c_str(), &out);
|
||||
if(result != -1)
|
||||
{
|
||||
cout << "Match found:" << endl;
|
||||
cout << "Response code: " << result << endl;
|
||||
cout << "Message text: " << out << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Match not found" << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
|
||||
#include <string>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
bool validate_card_format(const std::string& s)
|
||||
{
|
||||
static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");
|
||||
return boost::regex_match(s, e);
|
||||
}
|
||||
|
||||
const boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
|
||||
const std::string machine_format("\\1\\2\\3\\4");
|
||||
const std::string human_format("\\1-\\2-\\3-\\4");
|
||||
|
||||
std::string machine_readable_card_number(const std::string& s)
|
||||
{
|
||||
return boost::regex_merge(s, e, machine_format, boost::match_default | boost::format_sed);
|
||||
}
|
||||
|
||||
std::string human_readable_card_number(const std::string& s)
|
||||
{
|
||||
return boost::regex_merge(s, e, human_format, boost::match_default | boost::format_sed);
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
string s[4] = { "0000111122223333", "0000 1111 2222 3333",
|
||||
"0000-1111-2222-3333", "000-1111-2222-3333", };
|
||||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
cout << "validate_card_format(\"" << s[i] << "\") returned " << validate_card_format(s[i]) << endl;
|
||||
}
|
||||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
cout << "machine_readable_card_number(\"" << s[i] << "\") returned " << machine_readable_card_number(s[i]) << endl;
|
||||
}
|
||||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
cout << "human_readable_card_number(\"" << s[i] << "\") returned " << human_readable_card_number(s[i]) << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,106 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip2.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_search example: searches a cpp file for class definitions.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
|
||||
|
||||
void IndexClasses(map_type& m, const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
boost::match_results<std::string::const_iterator> what;
|
||||
unsigned int flags = boost::match_default;
|
||||
while(boost::regex_search(start, end, what, expression, flags))
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - file.begin();
|
||||
// update search position:
|
||||
start = what[0].second;
|
||||
// update flags:
|
||||
flags |= boost::match_prev_avail;
|
||||
flags |= boost::match_not_bob;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
std::string text;
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
map_type m;
|
||||
std::ifstream fs(argv[i]);
|
||||
load_file(text, fs);
|
||||
IndexClasses(m, text);
|
||||
cout << m.size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = m.begin();
|
||||
d = m.end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip3.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_grep example 1: searches a cpp file for class definitions.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
|
||||
|
||||
class IndexClassesPred
|
||||
{
|
||||
map_type& m;
|
||||
std::string::const_iterator base;
|
||||
public:
|
||||
IndexClassesPred(map_type& a, std::string::const_iterator b) : m(a), base(b) {}
|
||||
bool operator()(const boost::match_results<std::string::const_iterator, boost::regex::allocator_type>& what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
m[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void IndexClasses(map_type& m, const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
boost::regex_grep(IndexClassesPred(m, start), start, end, expression);
|
||||
}
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
std::string text;
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
map_type m;
|
||||
std::ifstream fs(argv[i]);
|
||||
load_file(text, fs);
|
||||
IndexClasses(m, text);
|
||||
cout << m.size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = m.begin();
|
||||
d = m.end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,131 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip4.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_merge example:
|
||||
* converts a C++ file to syntax highlighted HTML.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <boost/regex.hpp>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file and transform to
|
||||
// syntax highlighted code in html format
|
||||
|
||||
boost::regex e1, e2;
|
||||
extern const char* expression_text;
|
||||
extern const char* format_string;
|
||||
extern const char* pre_expression;
|
||||
extern const char* pre_format;
|
||||
extern const char* header_text;
|
||||
extern const char* footer_text;
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
e1.set_expression(expression_text);
|
||||
e2.set_expression(pre_expression);
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
std::cout << "Processing file " << argv[i] << std::endl;
|
||||
std::ifstream fs(argv[i]);
|
||||
std::string in;
|
||||
load_file(in, fs);
|
||||
std::string out_name(std::string(argv[i]) + std::string(".htm"));
|
||||
std::ofstream os(out_name.c_str());
|
||||
os << header_text;
|
||||
// strip '<' and '>' first by outputting to a
|
||||
// temporary string stream
|
||||
std::ostringstream t(std::ios::out | std::ios::binary);
|
||||
std::ostream_iterator<char, char> oi(t);
|
||||
boost::regex_merge(oi, in.begin(), in.end(), e2, pre_format);
|
||||
// then output to final output stream
|
||||
// adding syntax highlighting:
|
||||
std::string s(t.str());
|
||||
std::ostream_iterator<char, char> out(os);
|
||||
boost::regex_merge(out, s.begin(), s.end(), e1, format_string);
|
||||
os << footer_text;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern const char* pre_expression = "(<)|(>)|\\r";
|
||||
extern const char* pre_format = "(?1<)(?2>)";
|
||||
|
||||
|
||||
const char* expression_text = // preprocessor directives: index 1
|
||||
"(^[[:blank:]]*#(?:[^\\\\\\n]|\\\\[^\\n[:punct:][:word:]]*[\\n[:punct:][:word:]])*)|"
|
||||
// comment: index 2
|
||||
"(//[^\\n]*|/\\*.*?\\*/)|"
|
||||
// literals: index 3
|
||||
"\\<([+-]?(?:(?:0x[[:xdigit:]]+)|(?:(?:[[:digit:]]*\\.)?[[:digit:]]+(?:[eE][+-]?[[:digit:]]+)?))u?(?:(?:int(?:8|16|32|64))|L)?)\\>|"
|
||||
// string literals: index 4
|
||||
"('(?:[^\\\\']|\\\\.)*'|\"(?:[^\\\\\"]|\\\\.)*\")|"
|
||||
// keywords: index 5
|
||||
"\\<(__asm|__cdecl|__declspec|__export|__far16|__fastcall|__fortran|__import"
|
||||
"|__pascal|__rtti|__stdcall|_asm|_cdecl|__except|_export|_far16|_fastcall"
|
||||
"|__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto|bool"
|
||||
"|break|case|catch|cdecl|char|class|const|const_cast|continue|default|delete"
|
||||
"|do|double|dynamic_cast|else|enum|explicit|extern|false|float|for|friend|goto"
|
||||
"|if|inline|int|long|mutable|namespace|new|operator|pascal|private|protected"
|
||||
"|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_cast"
|
||||
"|struct|switch|template|this|throw|true|try|typedef|typeid|typename|union|unsigned"
|
||||
"|using|virtual|void|volatile|wchar_t|while)\\>"
|
||||
;
|
||||
|
||||
const char* format_string = "(?1<font color=\"#008040\">$&</font>)"
|
||||
"(?2<I><font color=\"#000080\">$&</font></I>)"
|
||||
"(?3<font color=\"#0000A0\">$&</font>)"
|
||||
"(?4<font color=\"#0000FF\">$&</font>)"
|
||||
"(?5<B>$&</B>)";
|
||||
|
||||
const char* header_text = "<HTML>\n<HEAD>\n"
|
||||
"<TITLE>Auto-generated html formated source</TITLE>\n"
|
||||
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=windows-1252\">\n"
|
||||
"</HEAD>\n"
|
||||
"<BODY LINK=\"#0000ff\" VLINK=\"#800080\" BGCOLOR=\"#ffffff\">\n"
|
||||
"<P> </P>\n<PRE>";
|
||||
|
||||
const char* footer_text = "</PRE>\n</BODY>\n\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip5.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions,
|
||||
* using a global callback function.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
boost::regex expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)");
|
||||
map_type class_index;
|
||||
std::string::const_iterator base;
|
||||
|
||||
bool grep_callback(const boost::match_results<std::string::const_iterator, boost::regex::allocator_type>& what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
class_index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
|
||||
void IndexClasses(const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
boost::regex_grep(grep_callback, start, end, expression);
|
||||
}
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
std::string text;
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
std::ifstream fs(argv[i]);
|
||||
load_file(text, fs);
|
||||
IndexClasses(text);
|
||||
cout << class_index.size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = class_index.begin();
|
||||
d = class_index.end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
class_index.erase(class_index.begin(), class_index.end());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip6.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions,
|
||||
* using a bound member function callback.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
#include <functional>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
class class_index
|
||||
{
|
||||
boost::regex expression;
|
||||
map_type index;
|
||||
std::string::const_iterator base;
|
||||
|
||||
bool grep_callback(boost::match_results<std::string::const_iterator, boost::regex::allocator_type> what);
|
||||
public:
|
||||
map_type& get_map() { return index; }
|
||||
void IndexClasses(const std::string& file);
|
||||
class_index()
|
||||
: index(),
|
||||
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)")
|
||||
{}
|
||||
};
|
||||
|
||||
bool class_index::grep_callback(boost::match_results<std::string::const_iterator, boost::regex::allocator_type> what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
|
||||
void class_index::IndexClasses(const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
boost::regex_grep(std::bind1st(std::mem_fun(&class_index::grep_callback), this),
|
||||
start,
|
||||
end,
|
||||
expression);
|
||||
}
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
std::string text;
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
std::ifstream fs(argv[i]);
|
||||
load_file(text, fs);
|
||||
class_index i;
|
||||
i.IndexClasses(text);
|
||||
cout << i.get_map().size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = i.get_map().begin();
|
||||
d = i.get_map().end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,121 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip7.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_grep example 2: searches a cpp file for class definitions,
|
||||
* using a C++ Builder closure as a callback.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <boost/regex.hpp>
|
||||
#include <functional>
|
||||
|
||||
// purpose:
|
||||
// takes the contents of a file in the form of a string
|
||||
// and searches for all the C++ class definitions, storing
|
||||
// their locations in a map of strings/int's
|
||||
|
||||
typedef std::map<std::string, int, std::less<std::string> > map_type;
|
||||
|
||||
class class_index
|
||||
{
|
||||
boost::regex expression;
|
||||
map_type index;
|
||||
std::string::const_iterator base;
|
||||
typedef boost::match_results<std::string::const_iterator, boost::regex::allocator_type> arg_type;
|
||||
|
||||
bool grep_callback(const boost::match_results<std::string::const_iterator, boost::regex::allocator_type>& what);
|
||||
public:
|
||||
map_type& get_map() { return index; }
|
||||
typedef bool (__closure* grep_callback_type)(const arg_type&);
|
||||
void IndexClasses(const std::string& file);
|
||||
class_index()
|
||||
: index(),
|
||||
expression("^(template[[:space:]]*<[^;:{]+>[[:space:]]*)?(class|struct)[[:space:]]*(\\<\\w+\\>([[:blank:]]*\\([^)]*\\))?[[:space:]]*)*(\\<\\w*\\>)[[:space:]]*(<[^;:{]+>)?[[:space:]]*(\\{|:[^;\\{()]*\\{)")
|
||||
{}
|
||||
};
|
||||
|
||||
bool class_index::grep_callback(const boost::match_results<std::string::const_iterator, boost::regex::allocator_type>& what)
|
||||
{
|
||||
// what[0] contains the whole string
|
||||
// what[5] contains the class name.
|
||||
// what[6] contains the template specialisation if any.
|
||||
// add class name and position to map:
|
||||
index[std::string(what[5].first, what[5].second) + std::string(what[6].first, what[6].second)] =
|
||||
what[5].first - base;
|
||||
return true;
|
||||
}
|
||||
|
||||
void class_index::IndexClasses(const std::string& file)
|
||||
{
|
||||
std::string::const_iterator start, end;
|
||||
start = file.begin();
|
||||
end = file.end();
|
||||
base = start;
|
||||
class_index::grep_callback_type cl = &(this->grep_callback);
|
||||
boost::regex_grep(cl,
|
||||
start,
|
||||
end,
|
||||
expression);
|
||||
}
|
||||
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
std::string text;
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
cout << "Processing file " << argv[i] << endl;
|
||||
std::ifstream fs(argv[i]);
|
||||
load_file(text, fs);
|
||||
class_index i;
|
||||
i.IndexClasses(text);
|
||||
cout << i.get_map().size() << " matches found" << endl;
|
||||
map_type::iterator c, d;
|
||||
c = i.get_map().begin();
|
||||
d = i.get_map().end();
|
||||
while(c != d)
|
||||
{
|
||||
cout << "class \"" << (*c).first << "\" found at index: " << (*c).second << endl;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip8.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_split example: split a string into tokens.
|
||||
*/
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
|
||||
unsigned tokenise(std::list<std::string>& l, std::string& s)
|
||||
{
|
||||
return boost::regex_split(std::back_inserter(l), s);
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550))
|
||||
//
|
||||
// problem with std::getline under MSVC6sp3
|
||||
istream& getline(istream& is, std::string& s)
|
||||
{
|
||||
s.erase();
|
||||
char c = is.get();
|
||||
while(c != '\n')
|
||||
{
|
||||
s.append(1, c);
|
||||
c = is.get();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
string s;
|
||||
list<string> l;
|
||||
do{
|
||||
cout << "Enter text to split (or \"quit\" to exit): ";
|
||||
getline(cin, s);
|
||||
if(s == "quit") break;
|
||||
unsigned result = tokenise(l, s);
|
||||
cout << result << " tokens found" << endl;
|
||||
cout << "The remaining text is: \"" << s << "\"" << endl;
|
||||
while(l.size())
|
||||
{
|
||||
s = *(l.begin());
|
||||
l.pop_front();
|
||||
cout << s << endl;
|
||||
}
|
||||
}while(true);
|
||||
return 0;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE snip9.cpp
|
||||
* VERSION 3.00
|
||||
* DESCRIPTION: regex_split example: spit out linked URL's.
|
||||
*/
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)\"",
|
||||
boost::regbase::normal | boost::regbase::icase);
|
||||
|
||||
void load_file(std::string& s, std::istream& is)
|
||||
{
|
||||
s.erase();
|
||||
//
|
||||
// attempt to grow string buffer to match file size,
|
||||
// this doesn't always work...
|
||||
s.reserve(is.rdbuf()->in_avail());
|
||||
char c;
|
||||
while(is.get(c))
|
||||
{
|
||||
// use logarithmic growth stategy, in case
|
||||
// in_avail (above) returned zero:
|
||||
if(s.capacity() == s.size())
|
||||
s.reserve(s.capacity() * 3);
|
||||
s.append(1, c);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string s;
|
||||
std::list<std::string> l;
|
||||
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
|
||||
s.erase();
|
||||
std::ifstream is(argv[i]);
|
||||
load_file(s, is);
|
||||
boost::regex_split(std::back_inserter(l), s, e);
|
||||
while(l.size())
|
||||
{
|
||||
s = *(l.begin());
|
||||
l.pop_front();
|
||||
std::cout << s << std::endl;
|
||||
}
|
||||
}
|
||||
//
|
||||
// alternative method:
|
||||
// split one match at a time and output direct to
|
||||
// cout via ostream_iterator<std::string>....
|
||||
//
|
||||
for(int i = 1; i < argc; ++i)
|
||||
{
|
||||
std::cout << "Findings URL's in " << argv[i] << ":" << std::endl;
|
||||
s.erase();
|
||||
std::ifstream is(argv[i]);
|
||||
load_file(s, is);
|
||||
while(boost::regex_split(std::ostream_iterator<std::string>(std::cout), s, e, boost::match_default, 1)) std::cout << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
|
||||
# very basic makefile for timer.exe
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bc builder install
|
||||
#
|
||||
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
COMPOPTS= -O2 -tWC -tWM- -D_NO_VCL; -I../../../../; -L..\..\lib\bcb5
|
||||
|
||||
|
||||
timer.exe : ..\..\..\timer\timer.cpp regex_timer.cpp
|
||||
$(BCC32) @&&|
|
||||
$(COMPOPTS) -e$@ ..\..\..\timer\timer.cpp regex_timer.cpp
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
|
||||
# very basic makefile for timer.exe
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bc builder install
|
||||
#
|
||||
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
COMPOPTS= -O2 -tWC -tWM- -D_NO_VCL; -I../../../../; -L..\..\lib\bcb4
|
||||
|
||||
|
||||
timer.exe : ..\..\..\timer\timer.cpp regex_timer.cpp
|
||||
$(BCC32) @&&|
|
||||
$(COMPOPTS) -e$@ ..\..\..\timer\timer.cpp regex_timer.cpp
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
|
||||
# very basic makefile for timer.exe
|
||||
#
|
||||
# Borland C++ tools
|
||||
#
|
||||
# BCROOT defines the root directory of your bc builder install
|
||||
#
|
||||
|
||||
!ifndef BCROOT
|
||||
BCROOT=$(MAKEDIR)\..
|
||||
!endif
|
||||
|
||||
BCC32 = $(BCROOT)\bin\Bcc32.exe
|
||||
|
||||
IDE_LinkFLAGS32 = -L$(BCROOT)\LIB
|
||||
COMPOPTS= -O2 -tWC -tWM- -D_NO_VCL; -I../../../../; -L..\..\lib\bcb5
|
||||
|
||||
|
||||
timer.exe : ..\..\..\timer\timer.cpp regex_timer.cpp
|
||||
$(BCC32) @&&|
|
||||
$(COMPOPTS) -e$@ ..\..\..\timer\timer.cpp regex_timer.cpp
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
|
||||
# very basic makefile for timer.exe
|
||||
#
|
||||
# GNU compiler GCC
|
||||
#
|
||||
CXX=-I../../../../ -I./
|
||||
|
||||
timer : regex_timer.cpp timer.cpp
|
||||
g++ $(CXX) -O2 -o timer regex_timer.cpp timer.cpp -L../../lib/gcc -lregex++
|
||||
|
||||
debug : regex_timer.cpp timer.cpp
|
||||
g++ $(CXX) -g -o timer regex_timer.cpp timer.cpp -L../../lib/gcc -lregex++debug
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
|
||||
# very basic makefile for timer
|
||||
#
|
||||
CXX=@CXX@
|
||||
CXXFLAGS=@CXXFLAGS@
|
||||
LIBS=@LIBS@
|
||||
EXE=@ac_exe_ext@
|
||||
OBJ=@ac_obj_ext@
|
||||
|
||||
LIBDEP=../../lib/libregex++.a ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp
|
||||
|
||||
regex_timer$(EXE) : regex_timer$(OBJ) timer$(OBJ)
|
||||
$(CXX) -o timer$(EXE) timer$(OBJ) regex_timer$(OBJ) -L../../lib -lregex++ $(LIBS)
|
||||
|
||||
regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ regex_timer.cpp
|
||||
|
||||
timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) -DSTRICT -I../../../../ -I./ ../../../timer/timer.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,322 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef BOOST_RE_OLD_IOSTREAM
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include <iostream>
|
||||
using std::cout;
|
||||
using std::cin;
|
||||
using std::cerr;
|
||||
using std::istream;
|
||||
using std::ostream;
|
||||
using std::endl;
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
// no Koenig lookup, use using declaration instead:
|
||||
using namespace boost;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
ostream& operator << (ostream& os, const std::wstring& s)
|
||||
{
|
||||
std::wstring::const_iterator i, j;
|
||||
i = s.begin();
|
||||
j = s.end();
|
||||
while(i != j)
|
||||
{
|
||||
os.put(*i);
|
||||
++i;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class S>
|
||||
class string_out_iterator
|
||||
{
|
||||
S* out;
|
||||
public:
|
||||
string_out_iterator(S& s) : out(&s) {}
|
||||
string_out_iterator& operator++() { return *this; }
|
||||
string_out_iterator& operator++(int) { return *this; }
|
||||
string_out_iterator& operator*() { return *this; }
|
||||
string_out_iterator& operator=(typename S::value_type v)
|
||||
{
|
||||
out->append(1, v);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC) || (defined(__BORLANDC__) && (__BORLANDC__ == 0x550)) || defined(__SGI_STL_PORT)
|
||||
//
|
||||
// problem with std::getline under MSVC6sp3
|
||||
// and C++ Builder 5.5, is this really that hard?
|
||||
istream& getline(istream& is, std::string& s)
|
||||
{
|
||||
s.erase();
|
||||
char c = is.get();
|
||||
while(c != '\n')
|
||||
{
|
||||
s.append(1, c);
|
||||
c = is.get();
|
||||
}
|
||||
return is;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::regex ex;
|
||||
boost::match_results<std::string::const_iterator> sm;
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
std::wstring ws1, ws2;
|
||||
boost::wregex wex;
|
||||
boost::match_results<std::wstring::const_iterator> wsm;
|
||||
#endif
|
||||
boost::match_results<std::deque<char>::iterator> dm;
|
||||
std::string s1, s2, ts;
|
||||
std::deque<char> ds;
|
||||
boost::regex_t r;
|
||||
boost::scoped_array<boost::regmatch_t> matches;
|
||||
size_t nsubs;
|
||||
boost::timer t;
|
||||
double tim;
|
||||
bool result;
|
||||
int iters = 100;
|
||||
|
||||
while(true)
|
||||
{
|
||||
cout << "Enter expression (or \"quit\" to exit): ";
|
||||
getline(cin, s1);
|
||||
if(s1 == "quit")
|
||||
break;
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
ws1.erase();
|
||||
std::copy(s1.begin(), s1.end(), string_out_iterator<std::wstring>(ws1));
|
||||
#endif
|
||||
try{
|
||||
ex.assign(s1.begin(), s1.end());
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
wex.assign(ws1.begin(), ws1.end());
|
||||
#endif
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
cout << "Error in expression: \"" << e.what() << "\"" << endl;
|
||||
continue;
|
||||
}
|
||||
int code = regcomp(&r, s1.c_str(), boost::REG_PERL);
|
||||
if(code != 0)
|
||||
{
|
||||
char buf[256];
|
||||
regerror(code, &r, buf, 256);
|
||||
cout << "regcomp error: \"" << buf << "\"" << endl;
|
||||
continue;
|
||||
}
|
||||
nsubs = r.re_nsub + 1;
|
||||
matches.reset(new boost::regmatch_t[nsubs]);
|
||||
|
||||
while(true)
|
||||
{
|
||||
cout << "Enter string to search (or \"quit\" to exit): ";
|
||||
getline(cin, s2);
|
||||
if(s2 == "quit")
|
||||
break;
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
ws2.erase();
|
||||
std::copy(s2.begin(), s2.end(), string_out_iterator<std::wstring>(ws2));
|
||||
#endif
|
||||
ds.erase(ds.begin(), ds.end());
|
||||
std::copy(s2.begin(), s2.end(), std::back_inserter(ds));
|
||||
|
||||
int i;
|
||||
iters = 10;
|
||||
tim = 1.1;
|
||||
|
||||
#if defined(_WIN32) && defined(BOOST_RE_LOCALE_W32)
|
||||
MSG msg;
|
||||
PeekMessage(&msg, 0, 0, 0, 0);
|
||||
Sleep(0);
|
||||
#endif
|
||||
|
||||
// cache load:
|
||||
regex_search(s2, sm, ex);
|
||||
|
||||
// measure time interval for reg_expression<char>
|
||||
do{
|
||||
iters *= (tim > 0.001) ? (1.1/tim) : 100;
|
||||
t.restart();
|
||||
for(i =0; i < iters; ++i)
|
||||
{
|
||||
result = regex_search(s2, sm, ex);
|
||||
}
|
||||
tim = t.elapsed();
|
||||
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
|
||||
|
||||
cout << "regex time: " << (tim * 1000000 / iters) << "us" << endl;
|
||||
if(result)
|
||||
{
|
||||
for(i = 0; i < sm.size(); ++i)
|
||||
{
|
||||
ts = sm[i];
|
||||
cout << "\tmatch " << i << ": \"";
|
||||
cout << ts;
|
||||
cout << "\" (matched=" << sm[i].matched << ")" << endl;
|
||||
}
|
||||
cout << "\tmatch $`: \"";
|
||||
cout << std::string(sm[-1]);
|
||||
cout << "\" (matched=" << sm[-1].matched << ")" << endl;
|
||||
cout << "\tmatch $': \"";
|
||||
cout << std::string(sm[-2]);
|
||||
cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl;
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
// measure time interval for boost::wregex
|
||||
iters = 10;
|
||||
tim = 1.1;
|
||||
// cache load:
|
||||
regex_search(ws2, wsm, wex);
|
||||
do{
|
||||
iters *= (tim > 0.001) ? (1.1/tim) : 100;
|
||||
t.restart();
|
||||
for(i = 0; i < iters; ++i)
|
||||
{
|
||||
result = regex_search(ws2, wsm, wex);
|
||||
}
|
||||
tim = t.elapsed();
|
||||
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
|
||||
cout << "wregex time: " << (tim * 1000000 / iters) << "us" << endl;
|
||||
if(result)
|
||||
{
|
||||
std::wstring tw;
|
||||
for(i = 0; i < wsm.size(); ++i)
|
||||
{
|
||||
tw.erase();
|
||||
std::copy(wsm[i].first, wsm[i].second, string_out_iterator<std::wstring>(tw));
|
||||
cout << "\tmatch " << i << ": \"" << tw;
|
||||
cout << "\" (matched=" << sm[i].matched << ")" << endl;
|
||||
}
|
||||
cout << "\tmatch $`: \"";
|
||||
tw.erase();
|
||||
std::copy(wsm[-1].first, wsm[-1].second, string_out_iterator<std::wstring>(tw));
|
||||
cout << tw;
|
||||
cout << "\" (matched=" << sm[-1].matched << ")" << endl;
|
||||
cout << "\tmatch $': \"";
|
||||
tw.erase();
|
||||
std::copy(wsm[-2].first, wsm[-2].second, string_out_iterator<std::wstring>(tw));
|
||||
cout << tw;
|
||||
cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// measure time interval for reg_expression<char> using a deque
|
||||
iters = 10;
|
||||
tim = 1.1;
|
||||
// cache load:
|
||||
regex_search(ds.begin(), ds.end(), dm, ex);
|
||||
do{
|
||||
iters *= (tim > 0.001) ? (1.1/tim) : 100;
|
||||
t.restart();
|
||||
for(i = 0; i < iters; ++i)
|
||||
{
|
||||
result = regex_search(ds.begin(), ds.end(), dm, ex);
|
||||
}
|
||||
tim = t.elapsed();
|
||||
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
|
||||
cout << "regex time (search over std::deque<char>): " << (tim * 1000000 / iters) << "us" << endl;
|
||||
|
||||
if(result)
|
||||
{
|
||||
for(i = 0; i < dm.size(); ++i)
|
||||
{
|
||||
ts.erase();
|
||||
std::copy(dm[i].first, dm[i].second, string_out_iterator<std::string>(ts));
|
||||
cout << "\tmatch " << i << ": \"" << ts;
|
||||
cout << "\" (matched=" << sm[i].matched << ")" << endl;
|
||||
}
|
||||
cout << "\tmatch $`: \"";
|
||||
ts.erase();
|
||||
std::copy(dm[-1].first, dm[-1].second, string_out_iterator<std::string>(ts));
|
||||
cout << ts;
|
||||
cout << "\" (matched=" << sm[-1].matched << ")" << endl;
|
||||
cout << "\tmatch $': \"";
|
||||
ts.erase();
|
||||
std::copy(dm[-2].first, dm[-2].second, string_out_iterator<std::string>(ts));
|
||||
cout << ts;
|
||||
cout << "\" (matched=" << sm[-2].matched << ")" << endl << endl;
|
||||
}
|
||||
|
||||
// measure time interval for POSIX matcher:
|
||||
iters = 10;
|
||||
tim = 1.1;
|
||||
// cache load:
|
||||
regexec(&r, s2.c_str(), nsubs, matches.get(), 0);
|
||||
do{
|
||||
iters *= (tim > 0.001) ? (1.1/tim) : 100;
|
||||
t.restart();
|
||||
for(i = 0; i < iters; ++i)
|
||||
{
|
||||
result = regexec(&r, s2.c_str(), nsubs, matches.get(), 0);
|
||||
}
|
||||
tim = t.elapsed();
|
||||
}while((tim < t.elapsed_min() * 1000) || (tim < 1));
|
||||
cout << "POSIX regexec time: " << (tim * 1000000 / iters) << "us" << endl;
|
||||
|
||||
if(result == 0)
|
||||
{
|
||||
for(i = 0; i < nsubs; ++i)
|
||||
{
|
||||
if(matches[i].rm_so >= 0)
|
||||
{
|
||||
ts.assign(s2.begin() + matches[i].rm_so, s2.begin() + matches[i].rm_eo);
|
||||
cout << "\tmatch " << i << ": \"" << ts << "\" (matched=" << (matches[i].rm_so != -1) << ")"<< endl;
|
||||
}
|
||||
else
|
||||
cout << "\tmatch " << i << ": \"\" (matched=" << (matches[i].rm_so != -1) << ")" << endl; // no match
|
||||
}
|
||||
cout << "\tmatch $`: \"";
|
||||
ts.erase();
|
||||
ts.assign(s2.begin(), s2.begin() + matches[0].rm_so);
|
||||
cout << ts;
|
||||
cout << "\" (matched=" << (matches[0].rm_so != 0) << ")" << endl;
|
||||
cout << "\tmatch $': \"";
|
||||
ts.erase();
|
||||
ts.assign(s2.begin() + matches[0].rm_eo, s2.end());
|
||||
cout << ts;
|
||||
cout << "\" (matched=" << (matches[0].rm_eo != s2.size()) << ")" << endl << endl;
|
||||
}
|
||||
}
|
||||
regfree(&r);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
# Makefile for timer application
|
||||
#
|
||||
# for SUN workshop 5.0 C++ compiler
|
||||
#
|
||||
|
||||
CXX=CC
|
||||
CPP_FLAGS = -O -I../../../../ -I./
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) -c -o $@ $(CPP_FLAGS) $<
|
||||
|
||||
timer : regex_timer.o timer.o
|
||||
$(CXX) -o $@ $(CPP_FLAGS) timer.o regex_timer.o -L../../lib -lregex++
|
||||
|
||||
timer.o : ../../../timer/timer.cpp
|
||||
$(CXX) -c $(CPPFLAGS) ../../../timer/timer.cpp
|
||||
|
||||
clean:
|
||||
rm -rf SunWS_cache
|
||||
rm -f timer.o timer
|
||||
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
#
|
||||
# very basic VC6 makefile for timer
|
||||
#
|
||||
CXX=cl
|
||||
CXXFLAGS=/Oityb1 /GF /Gy -MT -GX -DSTRICT -I../../../../ -I./
|
||||
LIBS=/link /LIBPATH:..\..\lib\vc6-stlport kernel32.lib user32.lib
|
||||
EXE=.exe
|
||||
OBJ=.obj
|
||||
|
||||
LIBDEP= ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp
|
||||
|
||||
regex_timer$(EXE) : regex_timer$(OBJ) timer$(OBJ)
|
||||
$(CXX) -o timer$(EXE) timer$(OBJ) regex_timer$(OBJ) $(LIBS)
|
||||
|
||||
regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) regex_timer.cpp
|
||||
|
||||
timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) ../../../timer/timer.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# very basic VC6 makefile for timer
|
||||
#
|
||||
CXX=cl
|
||||
CXXFLAGS=/Oityb1 /GF /Gy -GX -DSTRICT -I../../../../ -I./
|
||||
LIBS=/link /LIBPATH:..\..\lib\vc6 kernel32.lib user32.lib
|
||||
EXE=.exe
|
||||
OBJ=.obj
|
||||
|
||||
LIBDEP= ../../../../boost/re_detail/regex_options.hpp ../../../../boost/re_detail/regex_config.hpp
|
||||
|
||||
regex_timer$(EXE) : regex_timer$(OBJ) timer$(OBJ)
|
||||
$(CXX) -o timer$(EXE) timer$(OBJ) regex_timer$(OBJ) $(LIBS)
|
||||
|
||||
regex_timer$(OBJ) : regex_timer.cpp $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) regex_timer.cpp
|
||||
|
||||
timer$(OBJ) : ../../../timer/timer.cpp $(LIBDEP)
|
||||
$(CXX) -c $(CXXFLAGS) ../../../timer/timer.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
14
dmi.sh
14
dmi.sh
@ -1,14 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
if test "$#" != "1"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$1"
|
||||
|
||||
if eval make; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 1
|
||||
|
141
faq.htm
141
faq.htm
@ -1,141 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
||||
|
||||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="Template"
|
||||
CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.5 [en] (Win98; I) [Netscape]">
|
||||
<TITLE>Regex++ - FAQ</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080">
|
||||
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="7" WIDTH="100%">
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="50%"> <H3>
|
||||
<IMG SRC="../../c++boost.gif" HEIGHT="86" WIDTH="276" ALT="C++ Boost"></H3>
|
||||
</TD>
|
||||
<TD VALIGN="TOP" WIDTH="50%"> <CENTER>
|
||||
<H3> Regex++, FAQ.</H3>
|
||||
</CENTER>
|
||||
<CENTER>
|
||||
<I>(version 3.02, 18 April 2000)</I>
|
||||
</CENTER>
|
||||
<PRE><I>Copyright (c) 1998-2000
|
||||
Dr John Maddock
|
||||
|
||||
Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee,
|
||||
provided that the above copyright notice appear in all copies and
|
||||
that both that copyright notice and this permission notice appear
|
||||
in supporting documentation. Dr John Maddock makes no representations
|
||||
about the suitability of this software for any purpose.
|
||||
It is provided "as is" without express or implied warranty.</I></PRE>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<P><FONT COLOR="#FF0000">Q. Configure says that my compiler is unable to merge
|
||||
template instances, what does this mean?</FONT> </P>
|
||||
<P>A. When you compile template code, you can end up with the same template
|
||||
instances in multiple translation units - this will lead to link time errors
|
||||
unless your compiler/linker is smart enough to merge these template instances
|
||||
into a single record in the executable file. If you see this warning after
|
||||
running configure, then you can still link to libregex++.a if: </P>
|
||||
<OL>
|
||||
<LI> You use only the low-level template classes (reg_expression<>
|
||||
match_results<> etc), from a single translation unit, and use no other part
|
||||
of regex++.</LI>
|
||||
<LI> You use only the POSIX API functions (regcomp regexec etc), and no other
|
||||
part of regex++.</LI>
|
||||
<LI> You use only the high level class RegEx, and no other part of regex++.
|
||||
</LI>
|
||||
</OL>
|
||||
Another option is to create a master include file, which #include's all the
|
||||
regex++ source files, and all the source files in which you use regex++. You
|
||||
then compile and link this master file as a single translation unit. <P><FONT
|
||||
COLOR="#FF0000">Q. Configure says that my compiler is unable to merge template
|
||||
instances from archive files, what does this mean?</FONT> </P>
|
||||
<P>A. When you compile template code, you can end up with the same template
|
||||
instances in multiple translation units - this will lead to link time errors
|
||||
unless your compiler/linker is smart enough to merge these template instances
|
||||
into a single record in the executable file. Some compilers are able to do this
|
||||
for normal .cpp or .o files, but fail if the object file has been placed in a
|
||||
library archive. If you see this warning after running configure, then you can
|
||||
still link to libregex++.a if: </P>
|
||||
<OL>
|
||||
<LI> You use only the low-level template classes (reg_expression<>
|
||||
match_results<> etc), and use no other part of regex++.</LI>
|
||||
<LI> You use only the POSIX API functions (regcomp regexec etc), and no other
|
||||
part of regex++.</LI>
|
||||
<LI> You use only the high level class RegEx, and no other part of regex++.
|
||||
</LI>
|
||||
</OL>
|
||||
Another option is to add the regex++ source files directly to your project
|
||||
instead of linking to libregex++.a, generally you should do this only if you
|
||||
are getting link time errors with libregex++.a. <P><FONT COLOR="#FF0000">Q.
|
||||
Configure says that my compiler can't merge templates containing switch
|
||||
statements, what does this mean?</FONT> </P>
|
||||
<P>A. Some compilers can't merge templates that contain static data - this
|
||||
includes switch statements which implicitly generate static data as well as
|
||||
code. Principally this affects the egcs compiler - but note gcc 2.81 also
|
||||
suffers from this problem - the compiler will compile and link the code - but
|
||||
the code will not run because the code and the static data it uses have become
|
||||
separated. The default behaviour of regex++ is to try and fix this problem by
|
||||
declaring "problem" templates inside unnamed namespaces, so that the
|
||||
templates have internal linkage. Note that this can result in a great deal of
|
||||
code bloat. If the compiler doesn't support namespaces, or if code bloat
|
||||
becomes a problem, then follow the guidelines above for placing all the
|
||||
templates used in a single translation unit, and edit jm_opt.h so that
|
||||
BOOST_RE_NO_TEMPLATE_SWITCH_MERGE is no longer defined. </P>
|
||||
<P><FONT COLOR="#FF0000">Q. I can't get regex++ to work with escape characters,
|
||||
what's going on?</FONT> </P>
|
||||
<P>A. If you embed regular expressions in C++ code, then remember that escape
|
||||
characters are processed twice: once by the C++ compiler, and once by the
|
||||
regex++ expression compiler, so to pass the regular expression \d+ to regex++,
|
||||
you need to embed "\\d+" in your code. Likewise to match a literal
|
||||
backslash you will need to embed "\\\\" in your code. </P>
|
||||
<P><FONT COLOR="#FF0000">Q. Why don't character ranges work properly?</FONT>
|
||||
<BR>
|
||||
A. The POSIX standard specifies that character range expressions are locale
|
||||
sensitive - so for example the expression [A-Z] will match any collating
|
||||
element that collates between 'A' and 'Z'. That means that for most locales
|
||||
other than "C" or "POSIX", [A-Z] would match the single
|
||||
character 't' for example, which is not what most people expect - or at least
|
||||
not what most people have come to expect from regular expression engines. For
|
||||
this reason, the default behaviour of regex++ is to turn locale sensitive
|
||||
collation off by setting the regbase::nocollate compile time flag (this is set
|
||||
by regbase::normal). However if you set a non-default compile time flag - for
|
||||
example regbase::extended or regbase::basic, then locale dependent collation
|
||||
will be enabled, this also applies to the POSIX API functions which use either
|
||||
regbase::extended or regbase::basic internally, in the latter case use
|
||||
REG_NOCOLLATE in combination with either REG_BASIC or REG_EXTENDED when
|
||||
invoking regcomp if you don't want locale sensitive collation. <I>[Note - when
|
||||
regbase::nocollate in effect, the library behaves "as if" the
|
||||
LC_COLLATE locale category were always "C", regardless of what its
|
||||
actually set to - end note</I>]. </P>
|
||||
<P><FONT COLOR="#FF0000"> Q. Why can't I use the "convenience"
|
||||
versions of query_match/reg_search/reg_grep/reg_format/reg_merge?</FONT> </P>
|
||||
<P>A. These versions may or may not be available depending upon the
|
||||
capabilities of your compiler, the rules determining the format of these
|
||||
functions are quite complex - and only the versions visible to a standard
|
||||
compliant compiler are given in the help. To find out what your compiler
|
||||
supports, run <boost/regex.hpp> through your C++ pre-processor, and
|
||||
search the output file for the function that you are interested in. </P>
|
||||
<P><FONT COLOR="#FF0000">Q. Why are there no throw specifications on any of the
|
||||
functions? What exceptions can the library throw?</FONT> </P>
|
||||
<P>A. Not all compilers support (or honor) throw specifications, others support
|
||||
them but with reduced efficiency. Throw specifications may be added at a later
|
||||
date as compilers begin to handle this better. The library should throw only
|
||||
three types of exception: boost::bad_expression can be thrown by reg_expression
|
||||
when compiling a regular expression; boost::bad_pattern can be thrown by the
|
||||
class sub_match's conversion operators; finally std::bad_alloc can be thrown by
|
||||
just about any of the functions in this library. <BR>
|
||||
</P>
|
||||
<HR>
|
||||
<P><I>Copyright <A HREF="mailto:John_Maddock@compuserve.com">Dr John
|
||||
Maddock</A> 1998-2000 all rights reserved.</I> </P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
@ -1,202 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
|
||||
|
||||
<HTML>
|
||||
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="Template"
|
||||
CONTENT="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.5 [en] (Win98; I) [Netscape]">
|
||||
<TITLE>Regex++, Format String Reference</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF" LINK="#0000FF" VLINK="#800080">
|
||||
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="7" WIDTH="100%">
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="50%"> <H3>
|
||||
<IMG SRC="../../c++boost.gif" HEIGHT="86" WIDTH="276" ALT="C++ Boost"></H3>
|
||||
</TD>
|
||||
<TD VALIGN="TOP" WIDTH="50%"> <CENTER>
|
||||
<H3> Regex++, Format String Reference.</H3>
|
||||
</CENTER>
|
||||
<CENTER>
|
||||
<I>(version 3.02, 18 April 2000)</I>
|
||||
</CENTER>
|
||||
<PRE><I>Copyright (c) 1998-2000
|
||||
Dr John Maddock
|
||||
|
||||
Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee,
|
||||
provided that the above copyright notice appear in all copies and
|
||||
that both that copyright notice and this permission notice appear
|
||||
in supporting documentation. Dr John Maddock makes no representations
|
||||
about the suitability of this software for any purpose.
|
||||
It is provided "as is" without express or implied warranty.</I></PRE>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<HR>
|
||||
<H3> <A NAME="format_string"></A>Format String Syntax</H3>
|
||||
Format strings are used by the algorithms
|
||||
<A HREF="template_class_ref.htm#reg_format">regex_format</A> and
|
||||
<A HREF="template_class_ref.htm#reg_merge">regex_merge</A>, and are used to
|
||||
transform one string into another. <P>There are three kind of format string:
|
||||
sed, perl and extended, the extended syntax is the default so this is covered
|
||||
first. </P>
|
||||
<P><B><I>Extended format syntax</I></B> </P>
|
||||
<P>In format strings, all characters are treated as literals except: ()$\?:
|
||||
</P>
|
||||
<P>To use any of these as literals you must prefix them with the escape
|
||||
character \ </P>
|
||||
<P>The following special sequences are recognized: <BR>
|
||||
<BR>
|
||||
</P>
|
||||
<P><I>Grouping:</I> </P>
|
||||
<P>Use the parenthesis characters ( and ) to group sub-expressions within the
|
||||
format string, use \( and \) to represent literal '(' and ')'. <BR>
|
||||
<BR>
|
||||
</P>
|
||||
<P><I>Sub-expression expansions:</I> </P>
|
||||
<P>The following perl like expressions expand to a particular matched
|
||||
sub-expression: <BR>
|
||||
</P>
|
||||
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="7" WIDTH="100%">
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">$`</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">Expands to all the text from the end of the
|
||||
previous match to the start of the current match, if there was no previous
|
||||
match in the current operation, then everything from the start of the input
|
||||
string to the start of the match.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">$'</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">Expands to all the text from the end of the match
|
||||
to the end of the input string.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">$&</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">Expands to all of the current match.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">$0</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">Expands to all of the current match.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">$N</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">Expands to the text that matched sub-expression
|
||||
<I>N</I>.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR>
|
||||
<P><I>Conditional expressions:</I> </P>
|
||||
<P>Conditional expressions allow two different format strings to be selected
|
||||
dependent upon whether a sub-expression participated in the match or not: </P>
|
||||
<P>?Ntrue_expression:false_expression </P>
|
||||
<P>Executes true_expression if sub-expression <I>N</I> participated in the
|
||||
match, otherwise executes false_expression. </P>
|
||||
<P>Example: suppose we search for "(while)|(for)" then the format
|
||||
string "?1WHILE:FOR" would output what matched, but in upper case.
|
||||
<BR>
|
||||
<BR>
|
||||
</P>
|
||||
<P><I>Escape sequences:</I> </P>
|
||||
<P>The following escape sequences are also allowed: <BR>
|
||||
</P>
|
||||
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="7" WIDTH="100%">
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\a</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The bell character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\f</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The form feed character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\n</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The newline character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\r</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The carriage return character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\t</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The tab character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\v</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">A vertical tab character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\x</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">A hexadecimal character - for example \x0D.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\x{}</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">A possible unicode hexadecimal character - for
|
||||
example \x{1A0}</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\cx</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The ASCII escape character x, for example \c@ is
|
||||
equivalent to escape-@.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\e</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">The ASCII escape character.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="TOP" WIDTH="8%"> </TD>
|
||||
<TD VALIGN="TOP" WIDTH="40%">\dd</TD>
|
||||
<TD VALIGN="TOP" WIDTH="43%">An octal character constant, for example \10.</TD>
|
||||
<TD VALIGN="TOP" WIDTH="9%"> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR>
|
||||
<P><B><I>Perl format strings</I></B> </P>
|
||||
<P>Perl format strings are the same as the default syntax except that the
|
||||
characters ()?: have no special meaning. </P>
|
||||
<P><B><I>Sed format strings</I></B> </P>
|
||||
<P>Sed format strings use only the characters \ and & as special
|
||||
characters. </P>
|
||||
<P>\n where n is a digit, is expanded to the nth sub-expression. </P>
|
||||
<P>& is expanded to the whole of the match (equivalent to \0). </P>
|
||||
<P>Other escape sequences are expanded as per the default syntax. <BR>
|
||||
</P>
|
||||
<HR>
|
||||
<P><I>Copyright <A HREF="mailto:John_Maddock@compuserve.com">Dr John
|
||||
Maddock</A> 1998-2000 all rights reserved.</I> </P>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
548
hl_ref.htm
548
hl_ref.htm
@ -1,548 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type"
|
||||
content="text/html; charset=iso-8859-1">
|
||||
<meta name="Template"
|
||||
content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
|
||||
<title>Regex++, RegEx Class Reference</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#FFFFFF" link="#0000FF" vlink="#800080">
|
||||
|
||||
<p> </p>
|
||||
|
||||
<table border="0" cellpadding="7" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td valign="top" width="50%"><h3><img src="../../c++boost.gif"
|
||||
alt="C++ Boost" width="276" height="86"></h3>
|
||||
</td>
|
||||
<td valign="top" width="50%"><h3 align="center">Regex++,
|
||||
RegEx Class Reference. </h3>
|
||||
<p><i>(version 3.02, 18 April 2000)</i> </p>
|
||||
<pre><i>Copyright (c) 1998-2000
|
||||
Dr John Maddock
|
||||
|
||||
Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose is hereby granted without fee,
|
||||
provided that the above copyright notice appear in all copies and
|
||||
that both that copyright notice and this permission notice appear
|
||||
in supporting documentation. Dr John Maddock makes no representations
|
||||
about the suitability of this software for any purpose.
|
||||
It is provided "as is" without express or implied warranty.</i></pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><a name="RegEx"></a><i>Class RegEx</i></h3>
|
||||
|
||||
<p>#include <boost/cregex.hpp> </p>
|
||||
|
||||
<p>The class RegEx provides a high level simplified interface to
|
||||
the regular expression library, this class only handles narrow
|
||||
character strings, and regular expressions always follow the
|
||||
"normal" syntax - that is the same as the standard
|
||||
POSIX extended syntax, but with locale specific collation
|
||||
disabled, and escape characters inside character set declarations
|
||||
are allowed. </p>
|
||||
|
||||
<pre><b>typedef</b> <b>bool</b> (*GrepCallback)(<b>const</b> RegEx& expression);
|
||||
<b>typedef</b> <b>bool</b> (*GrepFileCallback)(<b>const</b> <b>char</b>* file, <b>const</b> RegEx& expression);
|
||||
<b>typedef</b> <b>bool</b> (*FindFilesCallback)(<b>const</b> <b>char</b>* file);
|
||||
|
||||
<b>class</b> RegEx
|
||||
{
|
||||
<b>public</b>:
|
||||
RegEx();
|
||||
RegEx(<b>const</b> RegEx& o);
|
||||
~RegEx();
|
||||
RegEx(<b>const</b> <b>char</b>* c, <b>bool</b> icase = <b>false</b>);
|
||||
<strong>explicit</strong> RegEx(<b>const</b> std::string& s, <b>bool</b> icase = <b>false</b>);
|
||||
RegEx& <b>operator</b>=(<b>const</b> RegEx& o);
|
||||
RegEx& <b>operator</b>=(<b>const</b> <b>char</b>* p);
|
||||
RegEx& <b>operator</b>=(<b>const</b> std::string& s);
|
||||
<b>unsigned</b> <b>int</b> SetExpression(<b>const</b> <b>char</b>* p, <b>bool</b> icase = <b>false</b>);
|
||||
<b>unsigned</b> <b>int</b> SetExpression(<b>const</b> std::string& s, <b>bool</b> icase = <b>false</b>);
|
||||
std::string Expression()<b>const</b>;
|
||||
<font color="#000080"><i>//
|
||||
</i> <i>// now matching operators: </i>
|
||||
<i>// </i></font>
|
||||
<b>bool</b> Match(<b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>bool</b> Match(<b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>bool</b> Search(<b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>bool</b> Search(<b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(GrepCallback cb, <b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<std::string>& v, <b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<std::string>& v, <b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned</b> <b>int</b>>& v, <b>const</b> <b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> Grep(std::vector<<b>unsigned</b> <b>int</b>>& v, <b>const</b> std::string& s, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> GrepFiles(GrepFileCallback cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback cb, <b>const</b> <b>char</b>* files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
<b>unsigned</b> <b>int</b> FindFiles(FindFilesCallback cb, <b>const</b> std::string& files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
std::string Merge(<b>const</b> std::string& in, <b>const</b> std::string& fmt, <b>bool</b> copy = <b>true</b>, <b>unsigned</b> <b>int</b> flags = match_default);
|
||||
std::string Merge(<b>const</b> char* in, <b>const</b> char* fmt, <b>bool</b> copy = <b>true</b>, <b>unsigned int </b>flags = match_default);
|
||||
<b>unsigned</b> Split(std::vector<std::string>& v, std::string& s, <b>unsigned</b> flags = match_default, <b>unsigned</b> max_count = ~0);
|
||||
<font color="#000080"><i>//
|
||||
</i> <i>// now operators for returning what matched in more detail:
|
||||
</i> <i>//
|
||||
</i></font> <b>unsigned</b> <b>int</b> Position(<b>int</b> i = 0)<b>const</b>;
|
||||
<b>unsigned</b> <b>int</b> Length(<b>int</b> i = 0)<b>const</b>;
|
||||
<b>unsigned</b> <b>int</b> Line()<b>const</b>;
|
||||
<b>unsigned int</b> Marks() const;
|
||||
std::string What(<b>int</b> i)<b>const</b>;
|
||||
std::string <b>operator</b>[](<b>int</b> i)<b>const</b> ;
|
||||
}; </pre>
|
||||
|
||||
<p>Member functions for class RegEx are defined as follows: <br>
|
||||
</p>
|
||||
|
||||
<table border="0" cellpadding="7" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx();</td>
|
||||
<td valign="top" width="42%">Default constructor,
|
||||
constructs an instance of RegEx without any valid
|
||||
expression.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx(<b>const</b> RegEx&
|
||||
o);</td>
|
||||
<td valign="top" width="42%">Copy constructor, all the
|
||||
properties of parameter <i>o</i> are copied.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx(<b>const</b> <b>char</b>*
|
||||
c, <b>bool</b> icase = <b>false</b>);</td>
|
||||
<td valign="top" width="42%">Constructs an instance of
|
||||
RegEx, setting the expression to <i>c</i>, if <i>icase</i>
|
||||
is <i>true</i> then matching is insensitive to case,
|
||||
otherwise it is sensitive to case. Throws <i>bad_expression</i>
|
||||
on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx(<b>const</b> std::string&
|
||||
s, <b>bool</b> icase = <b>false</b>);</td>
|
||||
<td valign="top" width="42%">Constructs an instance of
|
||||
RegEx, setting the expression to <i>s</i>, if <i>icase </i>is
|
||||
<i>true</i> then matching is insensitive to case,
|
||||
otherwise it is sensitive to case. Throws <i>bad_expression</i>
|
||||
on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx& <b>operator</b>=(<b>const</b>
|
||||
RegEx& o);</td>
|
||||
<td valign="top" width="42%">Default assignment operator.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx& <b>operator</b>=(<b>const</b>
|
||||
<b>char</b>* p);</td>
|
||||
<td valign="top" width="42%">Assignment operator,
|
||||
equivalent to calling <i>SetExpression(p, false).</i>
|
||||
Throws <i>bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">RegEx& <b>operator</b>=(<b>const</b>
|
||||
std::string& s);</td>
|
||||
<td valign="top" width="42%">Assignment operator,
|
||||
equivalent to calling <i>SetExpression(s, false).</i>
|
||||
Throws <i>bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
SetExpression(<b>constchar</b>* p, <b>bool</b> icase = <b>false</b>);</td>
|
||||
<td valign="top" width="42%">Sets the current expression
|
||||
to <i>p</i>, if <i>icase</i> is <i>true</i> then matching
|
||||
is insensitive to case, otherwise it is sensitive to case.
|
||||
Throws <i>bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
SetExpression(<b>const</b> std::string& s, <b>bool</b>
|
||||
icase = <b>false</b>);</td>
|
||||
<td valign="top" width="42%">Sets the current expression
|
||||
to <i>s</i>, if <i>icase</i> is <i>true</i> then matching
|
||||
is insensitive to case, otherwise it is sensitive to case.
|
||||
Throws <i>bad_expression</i> on failure.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string Expression()<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns a copy of the
|
||||
current regular expression.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Match(<b>const</b>
|
||||
<b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Attempts to match the
|
||||
current expression against the text <i>p</i> using the
|
||||
match flags <i>flags</i> - see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
Returns <i>true</i> if the expression matches the whole
|
||||
of the input string.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Match(<b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default) ;</td>
|
||||
<td valign="top" width="42%">Attempts to match the
|
||||
current expression against the text <i>s</i> using the
|
||||
match flags <i>flags</i> - see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
Returns <i>true</i> if the expression matches the whole
|
||||
of the input string.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Search(<b>const</b>
|
||||
<b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Attempts to find a match for
|
||||
the current expression somewhere in the text <i>p</i>
|
||||
using the match flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
Returns <i>true</i> if the match succeeds.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>bool</b> Search(<b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default) ;</td>
|
||||
<td valign="top" width="42%">Attempts to find a match for
|
||||
the current expression somewhere in the text <i>s</i>
|
||||
using the match flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
Returns <i>true</i> if the match succeeds.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(GrepCallback cb, <b>const</b> <b>char</b>* p, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the text <i>p</i> using the match
|
||||
flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match found calls the call-back function <i>cb</i>
|
||||
as: cb(*this); <p>If at any stage the call-back function
|
||||
returns false then the grep operation terminates,
|
||||
otherwise continues until no further matches are found.
|
||||
Returns the number of matches found.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(GrepCallback cb, <b>const</b> std::string& s, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the text <i>s</i> using the match
|
||||
flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match found calls the call-back function <i>cb</i>
|
||||
as: cb(*this); <p>If at any stage the call-back function
|
||||
returns false then the grep operation terminates,
|
||||
otherwise continues until no further matches are found.
|
||||
Returns the number of matches found. </p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<std::string>& v, <b>const</b> <b>char</b>*
|
||||
p, <b>unsigned</b> <b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the text <i>p</i> using the match
|
||||
flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match pushes a copy of what matched onto <i>v</i>.
|
||||
Returns the number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<std::string>& v, <b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the text <i>s</i> using the match
|
||||
flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match pushes a copy of what matched onto <i>v</i>.
|
||||
Returns the number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<<b>unsigned int</b>>& v, <b>const</b>
|
||||
<b>char</b>* p, <b>unsigned</b> <b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the text <i>p</i> using the match
|
||||
flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match pushes the starting index of what matched
|
||||
onto <i>v</i>. Returns the number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Grep(std::vector<<b>unsigned int</b>>& v, <b>const</b>
|
||||
std::string& s, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the text <i>s</i> using the match
|
||||
flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match pushes the starting index of what matched
|
||||
onto <i>v</i>. Returns the number of matches found.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
GrepFiles(GrepFileCallback cb, <b>const</b> <b>char</b>*
|
||||
files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the files <i>files</i> using the
|
||||
match flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match calls the call-back function cb. <p>If
|
||||
the call-back returns false then the algorithm returns
|
||||
without considering further matches in the current file,
|
||||
or any further files. </p>
|
||||
<p>The parameter <i>files</i> can include wild card
|
||||
characters '*' and '?', if the parameter <i>recurse</i>
|
||||
is true then searches sub-directories for matching file
|
||||
names. </p>
|
||||
<p>Returns the total number of matches found.</p>
|
||||
<p>May throw an exception derived from std::runtime_error
|
||||
if file io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
GrepFiles(GrepFileCallback cb, <b>const</b> std::string&
|
||||
files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Finds all matches of the
|
||||
current expression in the files <i>files</i> using the
|
||||
match flags <i>flags </i>- see <a
|
||||
href="template_class_ref.htm#match_type">match flags</a>.
|
||||
For each match calls the call-back function cb. <p>If
|
||||
the call-back returns false then the algorithm returns
|
||||
without considering further matches in the current file,
|
||||
or any further files. </p>
|
||||
<p>The parameter <i>files</i> can include wild card
|
||||
characters '*' and '?', if the parameter <i>recurse</i>
|
||||
is true then searches sub-directories for matching file
|
||||
names. </p>
|
||||
<p>Returns the total number of matches found.</p>
|
||||
<p>May throw an exception derived from std::runtime_error
|
||||
if file io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
FindFiles(FindFilesCallback cb, <b>const</b> <b>char</b>*
|
||||
files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Searches <i>files</i> to
|
||||
find all those which contain at least one match of the
|
||||
current expression using the match flags <i>flags </i>-
|
||||
see <a href="template_class_ref.htm#match_type">match
|
||||
flags</a>. For each matching file calls the call-back
|
||||
function cb. <p>If the call-back returns false then
|
||||
the algorithm returns without considering any further
|
||||
files. </p>
|
||||
<p>The parameter <i>files</i> can include wild card
|
||||
characters '*' and '?', if the parameter <i>recurse</i>
|
||||
is true then searches sub-directories for matching file
|
||||
names. </p>
|
||||
<p>Returns the total number of files found.</p>
|
||||
<p>May throw an exception derived from std::runtime_error
|
||||
if file io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
FindFiles(FindFilesCallback cb, <b>const</b> std::string&
|
||||
files, <b>bool</b> recurse = <b>false</b>, <b>unsigned</b>
|
||||
<b>int</b> flags = match_default);</td>
|
||||
<td valign="top" width="42%">Searches <i>files</i> to
|
||||
find all those which contain at least one match of the
|
||||
current expression using the match flags <i>flags </i>-
|
||||
see <a href="template_class_ref.htm#match_type">match
|
||||
flags</a>. For each matching file calls the call-back
|
||||
function cb. <p>If the call-back returns false then
|
||||
the algorithm returns without considering any further
|
||||
files. </p>
|
||||
<p>The parameter <i>files</i> can include wild card
|
||||
characters '*' and '?', if the parameter <i>recurse</i>
|
||||
is true then searches sub-directories for matching file
|
||||
names. </p>
|
||||
<p>Returns the total number of files found.</p>
|
||||
<p>May throw an exception derived from std::runtime_error
|
||||
if file io fails.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string Merge(<b>const</b>
|
||||
std::string& in, <b>const</b> std::string& fmt, <b>bool</b>
|
||||
copy = <b>true</b>, <b>unsigned</b> <b>int</b> flags =
|
||||
match_default);</td>
|
||||
<td valign="top" width="42%">Performs a search and
|
||||
replace operation: searches through the string <i>in</i>
|
||||
for all occurrences of the current expression, for each
|
||||
occurrence replaces the match with the format string <i>fmt</i>.
|
||||
Uses <i>flags</i> to determine what gets matched. If <i>copy</i>
|
||||
is true then all unmatched sections of input are copied
|
||||
unchanged to output. Returns the new string. See <a
|
||||
href="format_string.htm#format_string">also format string
|
||||
syntax</a>.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string Merge(<b>const</b>
|
||||
char* in, <b>const</b> char* fmt, <b>bool</b> copy = <b>true</b>,
|
||||
<b>unsigned int </b>flags = match_default);</td>
|
||||
<td valign="top" width="42%">Performs a search and
|
||||
replace operation: searches through the string <i>in</i>
|
||||
for all occurrences of the current expression, for each
|
||||
occurrence replaces the match with the format string <i>fmt</i>.
|
||||
Uses <i>flags</i> to determine what gets matched. If <i>copy</i>
|
||||
is true then all unmatched sections of input are copied
|
||||
unchanged to output. Returns the new string. See <a
|
||||
href="format_string.htm#format_string">also format string
|
||||
syntax</a>.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td valign="top"><b>unsigned</b> Split(std::vector<std::string>&
|
||||
v, std::string& s, <b>unsigned</b> flags = match_default,
|
||||
<b>unsigned</b> max_count = ~0);</td>
|
||||
<td valign="top">Splits the input string and pushes each
|
||||
one onto the vector. If the expression contains no marked
|
||||
sub-expressions, then one string is outputted for each
|
||||
section of the input that does not match the expression.
|
||||
If the expression does contain marked sub-expressions,
|
||||
then outputs one string for each marked sub-expression
|
||||
each time a match occurs. Outputs no more than <i>max_count
|
||||
</i>strings. Before returning, deletes from the input
|
||||
string <i>s</i> all of the input that has been processed
|
||||
(all of the string if <i>max_count</i> was not reached).
|
||||
Returns the number of strings pushed onto the vector.</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Position(<b>int</b> i = 0)<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns the position of what
|
||||
matched sub-expression <i>i</i>. If <i>i = 0</i> then
|
||||
returns the position of the whole match. Returns -1 if
|
||||
the supplied index is invalid, or if the specified sub-expression
|
||||
did not participate in the match.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Length(<b>int</b> i = 0)<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns the length of what
|
||||
matched sub-expression <i>i</i>. If <i>i = 0</i> then
|
||||
returns the length of the whole match. Returns -1 if the
|
||||
supplied index is invalid, or if the specified sub-expression
|
||||
did not participate in the match.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned</b> <b>int</b>
|
||||
Line()<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns the line on which
|
||||
the match occurred, indexes start from 1 not zero, if no
|
||||
match occurred then returns (unsigned)-1.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%"><b>unsigned int</b> Marks()
|
||||
const;</td>
|
||||
<td valign="top" width="42%">Returns the number of marked
|
||||
sub-expressions contained in the expression. Note that
|
||||
this includes the whole match (sub-expression zero), so
|
||||
the value returned is always >= 1.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string What(<b>int</b>
|
||||
i)<b>const</b>;</td>
|
||||
<td valign="top" width="42%">Returns a copy of what
|
||||
matched sub-expression <i>i</i>. If <i>i = 0</i> then
|
||||
returns a copy of the whole match. Returns a null string
|
||||
if the index is invalid or if the specified sub-expression
|
||||
did not participate in a match.</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="7%"> </td>
|
||||
<td valign="top" width="43%">std::string <b>operator</b>[](<b>int</b>
|
||||
i)<b>const</b> ;</td>
|
||||
<td valign="top" width="42%">Returns <i>what(i);</i> <p>Can
|
||||
be used to simplify access to sub-expression matches, and
|
||||
make usage more perl-like.</p>
|
||||
</td>
|
||||
<td valign="top" width="7%"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<p><i>Copyright </i><a href="mailto:John_Maddock@compuserve.com"><i>Dr
|
||||
John Maddock</i></a><i> 1998-2000 all rights reserved.</i> </p>
|
||||
</body>
|
||||
</html>
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* LOCATION: see http://www.boost.org/libs/regex for most recent version.
|
||||
* FILE cregex.cpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares POSIX API functions
|
||||
* + boost::RegEx high level wrapper.
|
||||
*/
|
||||
@ -24,276 +20,14 @@
|
||||
#ifndef BOOST_RE_CREGEX_HPP
|
||||
#define BOOST_RE_CREGEX_HPP
|
||||
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
/* include these defs only for POSIX compatablity */
|
||||
#ifdef __cplusplus
|
||||
namespace boost{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int regoff_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const char* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
unsigned int eflags; /* none of your business :-) */
|
||||
} regex_tA;
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const wchar_t* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
unsigned int eflags; /* none of your business :-) */
|
||||
} regex_tW;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* start of match */
|
||||
regoff_t rm_eo; /* end of match */
|
||||
} regmatch_t;
|
||||
|
||||
/* regcomp() flags */
|
||||
typedef enum{
|
||||
REG_BASIC = 0000,
|
||||
REG_EXTENDED = 0001,
|
||||
REG_ICASE = 0002,
|
||||
REG_NOSUB = 0004,
|
||||
REG_NEWLINE = 0010,
|
||||
REG_NOSPEC = 0020,
|
||||
REG_PEND = 0040,
|
||||
REG_DUMP = 0200,
|
||||
REG_NOCOLLATE = 0400,
|
||||
REG_ESCAPE_IN_LISTS = 01000,
|
||||
REG_NEWLINE_ALT = 02000,
|
||||
|
||||
REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS,
|
||||
REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS,
|
||||
REG_GREP = REG_BASIC | REG_NEWLINE_ALT,
|
||||
REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT,
|
||||
|
||||
REG_ASSERT = 15,
|
||||
REG_INVARG = 16,
|
||||
REG_ATOI = 255, /* convert name to number (!) */
|
||||
REG_ITOA = 0400 /* convert number to name (!) */
|
||||
} reg_comp_flags;
|
||||
|
||||
/* regexec() flags */
|
||||
typedef enum{
|
||||
REG_NOTBOL = 00001,
|
||||
REG_NOTEOL = 00002,
|
||||
REG_STARTEND = 00004
|
||||
} reg_exec_flags;
|
||||
|
||||
BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompA(regex_tA*, const char*, int);
|
||||
BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorA(int, const regex_tA*, char*, unsigned int);
|
||||
BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecA(const regex_tA*, const char*, unsigned int, regmatch_t*, int);
|
||||
BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeA(regex_tA*);
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
BOOST_RE_IX_DECL int BOOST_RE_CCALL regcompW(regex_tW*, const wchar_t*, int);
|
||||
BOOST_RE_IX_DECL unsigned int BOOST_RE_CCALL regerrorW(int, const regex_tW*, wchar_t*, unsigned int);
|
||||
BOOST_RE_IX_DECL int BOOST_RE_CCALL regexecW(const regex_tW*, const wchar_t*, unsigned int, regmatch_t*, int);
|
||||
BOOST_RE_IX_DECL void BOOST_RE_CCALL regfreeW(regex_tW*);
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define regcomp regcompW
|
||||
#define regerror regerrorW
|
||||
#define regexec regexecW
|
||||
#define regfree regfreeW
|
||||
#define regex_t regex_tW
|
||||
#ifdef BOOST_REGEX_V3
|
||||
#include <boost/regex/v3/cregex.hpp>
|
||||
#else
|
||||
#define regcomp regcompA
|
||||
#define regerror regerrorA
|
||||
#define regexec regexecA
|
||||
#define regfree regfreeA
|
||||
#define regex_t regex_tA
|
||||
#endif
|
||||
|
||||
/* regerror() flags */
|
||||
typedef enum
|
||||
{
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH = 1, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT = 2, /* Invalid pattern. */
|
||||
REG_ECOLLATE = 3, /* Undefined collating element. */
|
||||
REG_ECTYPE = 4, /* Invalid character class name. */
|
||||
REG_EESCAPE = 5, /* Trailing backslash. */
|
||||
REG_ESUBREG = 6, /* Invalid back reference. */
|
||||
REG_EBRACK = 7, /* Unmatched left bracket. */
|
||||
REG_EPAREN = 8, /* Parenthesis imbalance. */
|
||||
REG_EBRACE = 9, /* Unmatched \{. */
|
||||
REG_BADBR = 10, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE = 11, /* Invalid range end. */
|
||||
REG_ESPACE = 12, /* Ran out of memory. */
|
||||
REG_BADRPT = 13, /* No preceding re for repetition op. */
|
||||
REG_EEND = 14, /* unexpected end of expression */
|
||||
REG_ESIZE = 15, /* expression too big */
|
||||
REG_ERPAREN = 16, /* unmatched right parenthesis */
|
||||
REG_EMPTY = 17, /* empty expression */
|
||||
REG_E_MEMORY = REG_ESIZE, /* out of memory */
|
||||
REG_E_UNKNOWN = 18 /* unknown error */
|
||||
} reg_errcode_t;
|
||||
|
||||
enum match_flags
|
||||
{
|
||||
match_default = 0,
|
||||
match_not_bol = 1, // first is not start of line
|
||||
match_not_eol = match_not_bol << 1, // last is not end of line
|
||||
match_not_bob = match_not_eol << 1, // first is not start of buffer
|
||||
match_not_eob = match_not_bob << 1, // last is not end of buffer
|
||||
match_not_bow = match_not_eob << 1, // first is not start of word
|
||||
match_not_eow = match_not_bow << 1, // last is not end of word
|
||||
match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.'
|
||||
match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.'
|
||||
match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression
|
||||
match_init = match_prev_avail << 1, // internal use
|
||||
match_any = match_init << 1, // don't care what we match
|
||||
match_not_null = match_any << 1, // string can't be null
|
||||
match_continuous = match_not_null << 1, // each grep match must continue from
|
||||
// uninterupted from the previous one
|
||||
match_partial = match_continuous << 1, // find partial matches
|
||||
|
||||
match_stop = match_partial << 1, // stop after first match (grep)
|
||||
match_all = match_stop << 1, // must find the whole of input even if match_any is set
|
||||
match_max = match_all
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// C++ high level wrapper goes here:
|
||||
//
|
||||
#if defined(__cplusplus) && !defined(BOOST_RE_NO_STRING_H)
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class RegEx;
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
class RegExData;
|
||||
struct pred1;
|
||||
struct pred2;
|
||||
struct pred3;
|
||||
struct pred4;
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
#if defined(BOOST_MSVC) || defined(__BORLANDC__)
|
||||
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
|
||||
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (__cdecl *FindFilesCallback)(const char* file);
|
||||
#else
|
||||
typedef bool (*GrepCallback)(const RegEx& expression);
|
||||
typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (*FindFilesCallback)(const char* file);
|
||||
#endif
|
||||
|
||||
class BOOST_RE_IX_DECL RegEx
|
||||
{
|
||||
private:
|
||||
re_detail::RegExData* pdata;
|
||||
public:
|
||||
RegEx();
|
||||
RegEx(const RegEx& o);
|
||||
~RegEx();
|
||||
explicit RegEx(const char* c, bool icase = false);
|
||||
explicit RegEx(const std::string& s, bool icase = false);
|
||||
RegEx& operator=(const RegEx& o);
|
||||
RegEx& operator=(const char* p);
|
||||
RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
|
||||
unsigned int SetExpression(const char* p, bool icase = false);
|
||||
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
|
||||
std::string Expression()const;
|
||||
//
|
||||
// now matching operators:
|
||||
//
|
||||
bool Match(const char* p, unsigned int flags = match_default);
|
||||
bool Match(const std::string& s, unsigned int flags = match_default) { return Match(s.c_str(), flags); }
|
||||
bool Search(const char* p, unsigned int flags = match_default);
|
||||
bool Search(const std::string& s, unsigned int flags = match_default) { return Search(s.c_str(), flags); }
|
||||
unsigned int Grep(GrepCallback cb, const char* p, unsigned int flags = match_default);
|
||||
unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default) { return Grep(cb, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<std::string>& v, const char* p, unsigned int flags = match_default);
|
||||
unsigned int Grep(std::vector<std::string>& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<unsigned int>& v, const char* p, unsigned int flags = match_default);
|
||||
unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, unsigned int flags = match_default) { return Grep(v, s.c_str(), flags); }
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default);
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
|
||||
unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default);
|
||||
unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); }
|
||||
|
||||
std::string Merge(const std::string& in, const std::string& fmt,
|
||||
bool copy = true, unsigned int flags = match_default);
|
||||
std::string Merge(const char* in, const char* fmt,
|
||||
bool copy = true, unsigned int flags = match_default);
|
||||
|
||||
unsigned int Split(std::vector<std::string>& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0);
|
||||
//
|
||||
// now operators for returning what matched in more detail:
|
||||
//
|
||||
unsigned int Position(int i = 0)const;
|
||||
unsigned int Length(int i = 0)const;
|
||||
unsigned int Line()const;
|
||||
unsigned int Marks()const;
|
||||
std::string What(int i = 0)const;
|
||||
std::string operator[](int i)const { return What(i); }
|
||||
|
||||
friend struct re_detail::pred1;
|
||||
friend struct re_detail::pred2;
|
||||
friend struct re_detail::pred3;
|
||||
friend struct re_detail::pred4;
|
||||
};
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/regex/v4/cregex.hpp>
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
@ -303,3 +37,7 @@ public:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE pattern_except.cpp
|
||||
* VERSION 3.01
|
||||
* DESCRIPTION: Declares pattern-matching exception classes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_PAT_EXCEPT_HPP
|
||||
#define BOOST_RE_PAT_EXCEPT_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class BOOST_RE_IX_DECL bad_pattern : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
|
||||
~bad_pattern() throw();
|
||||
};
|
||||
|
||||
class BOOST_RE_IX_DECL bad_expression : public bad_pattern
|
||||
{
|
||||
public:
|
||||
explicit bad_expression(const std::string& s) : bad_pattern(s) {}
|
||||
~bad_expression() throw();
|
||||
};
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,139 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_cstring.hpp
|
||||
* VERSION 3.02
|
||||
* DESCRIPTION: This is an internal header file, do not include directly.
|
||||
* String support and helper functions, for regular
|
||||
* expression library.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_CSTRING_HPP
|
||||
#define BOOST_REGEX_CSTRING_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// start by defining some template function aliases for C API functions:
|
||||
//
|
||||
|
||||
template <class charT>
|
||||
std::size_t BOOST_RE_CALL re_strlen(const charT *s)
|
||||
{
|
||||
std::size_t len = 0;
|
||||
while(*s)
|
||||
{
|
||||
++s;
|
||||
++len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
inline std::size_t BOOST_RE_CALL re_strlen(const char *s)
|
||||
{
|
||||
return std::strlen(s);
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
|
||||
inline std::size_t BOOST_RE_CALL re_strlen(const wchar_t *s)
|
||||
{
|
||||
return std::wcslen(s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
#endif
|
||||
BOOST_RE_IX_DECL void BOOST_RE_CALL re_transform(std::string& out, const std::string& in);
|
||||
|
||||
template <class charT>
|
||||
void BOOST_RE_CALL re_trunc_primary(std::basic_string<charT>& s)
|
||||
{
|
||||
for(unsigned int i = 0; i < s.size(); ++i)
|
||||
{
|
||||
if(s[i] <= 1)
|
||||
{
|
||||
s.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline char* BOOST_RE_CALL re_strcpy(char *s1, const char *s2)
|
||||
{
|
||||
#if defined(__BORLANDC__) && defined(strcpy)
|
||||
return ::strcpy(s1, s2);
|
||||
#else
|
||||
return std::strcpy(s1, s2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
|
||||
inline wchar_t* BOOST_RE_CALL re_strcpy(wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
return std::wcscpy(s1, s2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template <class charT>
|
||||
charT* BOOST_RE_CALL re_strdup(const charT* p)
|
||||
{
|
||||
charT* buf = new charT[re_strlen(p) + 1];
|
||||
re_strcpy(buf, p);
|
||||
return buf;
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
inline void BOOST_RE_CALL re_strfree(charT* p)
|
||||
{
|
||||
delete[] p;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_CSTRING_HPP
|
||||
|
||||
|
||||
|
||||
|
@ -1,147 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_libary_include.hpp
|
||||
* VERSION 3.02
|
||||
* DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
#define BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
#ifndef BOOST_RE_NO_LIB
|
||||
|
||||
#if defined(BOOST_MSVC) && !defined(BOOST_RE_BUILD_DLL)
|
||||
#ifdef __SGI_STL_PORT
|
||||
#ifdef _DLL
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300dl.lib")
|
||||
#else // DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300l.lib")
|
||||
#endif // _DEBUG
|
||||
#else // _DLL
|
||||
#ifdef _MT
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300dm.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300m.lib")
|
||||
#endif //_DEBUG
|
||||
#else //_MT
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300d.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-stlport-re300.lib")
|
||||
#endif //_DEBUG
|
||||
#endif //_MT
|
||||
#endif //_DLL
|
||||
#else
|
||||
#ifdef _DLL
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-re300dl.lib")
|
||||
#else // DEBUG
|
||||
#pragma comment(lib, "vc6-re300l.lib")
|
||||
#endif // _DEBUG
|
||||
#else // _DLL
|
||||
#ifdef _MT
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-re300dm.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-re300m.lib")
|
||||
#endif //_DEBUG
|
||||
#else //_MT
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "vc6-re300d.lib")
|
||||
#else //_DEBUG
|
||||
#pragma comment(lib, "vc6-re300.lib")
|
||||
#endif //_DEBUG
|
||||
#endif //_MT
|
||||
#endif //_DLL
|
||||
#endif // __SGI_STL_PORT
|
||||
#endif //BOOST_MSVC
|
||||
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(BOOST_RE_BUILD_DLL)
|
||||
|
||||
#if __BORLANDC__ < 0x550
|
||||
|
||||
#ifdef BOOST_RE_USE_VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#pragma comment(lib, "bcb4re300lv.lib")
|
||||
#else
|
||||
#pragma comment(lib, "bcb4re300v.lib")
|
||||
#endif
|
||||
|
||||
#else // VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb4re300lm.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb4re300l.lib")
|
||||
#endif // __MT__
|
||||
#else //_RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb4re300m.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb4re300.lib")
|
||||
#endif // __MT__
|
||||
#endif // _RTLDLL
|
||||
|
||||
#endif // VCL
|
||||
|
||||
#else // C++ Builder 5:
|
||||
|
||||
#ifdef BOOST_RE_USE_VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#pragma comment(lib, "bcb5re300lv.lib")
|
||||
#else
|
||||
#pragma comment(lib, "bcb5re300v.lib")
|
||||
#endif
|
||||
|
||||
#else // VCL
|
||||
|
||||
#ifdef _RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb5re300lm.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb5re300l.lib")
|
||||
#endif // __MT__
|
||||
#else //_RTLDLL
|
||||
#ifdef __MT__
|
||||
#pragma comment(lib, "bcb5re300m.lib")
|
||||
#else // __MT__
|
||||
#pragma comment(lib, "bcb5re300.lib")
|
||||
#endif // __MT__
|
||||
#endif // _RTLDLL
|
||||
|
||||
#endif // VCL
|
||||
|
||||
#endif
|
||||
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#endif //BOOST_RE_NO_LIB
|
||||
|
||||
#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
|
||||
|
||||
|
||||
|
@ -1,467 +0,0 @@
|
||||
|
||||
#ifndef BOOST_RE_OPT_H
|
||||
#define BOOST_RE_OPT_H
|
||||
|
||||
/* #define BOOST_RE_AUTO_CONFIGURE */
|
||||
#ifdef BOOST_RE_AUTO_CONFIGURE
|
||||
|
||||
/* Compiler options: */
|
||||
|
||||
/* BOOST_NO_STDC_NAMESPACE C library not in namespace std */
|
||||
/* #define BOOST_NO_STDC_NAMESPACE */
|
||||
|
||||
/* BOOST_RE_NO_MUTABLE Disables use of mutable keyword. */
|
||||
/* #define BOOST_RE_NO_MUTABLE */
|
||||
|
||||
/* BOOST_RE_INT32_LONG If 32-bit integers are long */
|
||||
/* #define BOOST_RE_INT32_LONG */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_FRIEND If template friend declarations are not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_FRIEND */
|
||||
|
||||
/* BOOST_RE_PLATFORM_WINDOWS Platform is MS Windows. */
|
||||
/* #define BOOST_RE_PLATFORM_WINDOWS */
|
||||
|
||||
/* BOOST_RE_PLATFORM_DOS Platform if MSDOS. */
|
||||
/* #define BOOST_RE_PLATFORM_DOS */
|
||||
|
||||
/* BOOST_RE_PLATFORM_W32 Platform is MS Win32 */
|
||||
/* #define BOOST_RE_PLATFORM_W32 */
|
||||
|
||||
/* BOOST_RE_NO_W32 Disable Win32 support even when present */
|
||||
/* #define BOOST_RE_NO_W32 */
|
||||
|
||||
/* BOOST_RE_NO_BOOL If bool is not a distict type. */
|
||||
/* #define BOOST_RE_NO_BOOL */
|
||||
|
||||
/* BOOST_RE_NO_WCHAR_H If there is no <wchar.h> */
|
||||
/* #define BOOST_RE_NO_WCHAR_H */
|
||||
|
||||
/* BOOST_RE_NO_WCTYPE_H If there is no <wctype.h> */
|
||||
/* #define BOOST_RE_NO_WCTYPE_H */
|
||||
|
||||
/* BOOST_RE_NO_WCSTRING If there are no wcslen and wcsncmp functions available. */
|
||||
/* #define BOOST_RE_NO_WCSTRING */
|
||||
|
||||
/* BOOST_RE_NO_SWPRINTF If there is no swprintf available. */
|
||||
/* #define BOOST_RE_NO_SWPRINTF */
|
||||
|
||||
/* BOOST_RE_NO_WSPRINTF If there is no wsprintf available. */
|
||||
/* #define BOOST_RE_NO_WSPRINTF */
|
||||
|
||||
/* BOOST_RE_NO_MEMBER_TEMPLATES If member function templates or nested template classes are not allowed. */
|
||||
/* #define BOOST_RE_NO_MEMBER_TEMPLATES */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_RETURNS If template functions based on return type are not supported. */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_RETURNS */
|
||||
|
||||
/* BOOST_RE_NO_PARTIAL_FUNC_SPEC If partial template function specialisation is not supported */
|
||||
/* #define BOOST_RE_NO_PARTIAL_FUNC_SPEC */
|
||||
|
||||
/* BOOST_RE_NO_INT64 If 64bit integers are not supported. */
|
||||
/* BOOST_RE_INT64t The type of a 64-bit signed integer if available. */
|
||||
/* BOOST_RE_IMM64(val) Declares a 64-bit immediate value by appending any
|
||||
necessary suffix to val. */
|
||||
/* BOOST_RE_INT64_T 0 = NA
|
||||
1 = short
|
||||
2 = int
|
||||
3 = long
|
||||
4 = int64_t
|
||||
5 = long long
|
||||
6 = __int64 */
|
||||
/* #define BOOST_RE_INT64_T_0 */
|
||||
/* #define BOOST_RE_INT64_T_1 */
|
||||
/* #define BOOST_RE_INT64_T_2 */
|
||||
/* #define BOOST_RE_INT64_T_3 */
|
||||
/* #define BOOST_RE_INT64_T_4 */
|
||||
/* #define BOOST_RE_INT64_T_5 */
|
||||
/* #define BOOST_RE_INT64_T_6 */
|
||||
|
||||
/* BOOST_RE_NO_CAT Define if the compiler does not support POSIX style
|
||||
message categories (catopen catgets catclose). */
|
||||
/* #define BOOST_RE_NO_CAT */
|
||||
|
||||
/* BOOST_RE_THREADS Define if the compiler supports multiple threads in
|
||||
the current translation mode. */
|
||||
/* #define BOOST_RE_THREADS */
|
||||
|
||||
/* BOOST_RE_NESTED_TEMPLATE_DECL Defaults to template, the standard prefix when accessing
|
||||
nested template classes, can be redefined to nothing if
|
||||
the compiler does not support this. */
|
||||
/* #define BOOST_RE_NESTED_TEMPLATE_DECL */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_INST If explicit template instantiation with the "template class X<T>"
|
||||
syntax is not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_INST */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_MERGE If template in separate translation units don't merge at link time */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_MERGE */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_MERGE_A If template merging from library archives is not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_MERGE_A */
|
||||
|
||||
/* BOOST_RE_NO_TEMPLATE_SWITCH_MERGE If merging of templates containing switch statements is not supported */
|
||||
/* #define BOOST_RE_NO_TEMPLATE_SWITCH_MERGE */
|
||||
|
||||
/* BOOST_RE_CALL Optionally define a calling convention for C++ functions */
|
||||
/* #define BOOST_RE_CALL */
|
||||
|
||||
/* BOOST_RE_CCALL Optionally define a calling convention for C functions */
|
||||
/* #define BOOST_RE_CCALL */
|
||||
|
||||
/* BOOST_RE_SIZEOF_SHORT sizeof(short) */
|
||||
/* #define BOOST_RE_SIZEOF_SHORT */
|
||||
|
||||
/* BOOST_RE_SIZEOF_INT sizeof(int) */
|
||||
/* #define BOOST_RE_SIZEOF_INT */
|
||||
|
||||
/* BOOST_RE_SIZEOF_LONG sizeof(long) */
|
||||
/* #define BOOST_RE_SIZEOF_LONG */
|
||||
|
||||
/* BOOST_RE_SIZEOF_WCHAR_T sizeof(wchar_t) */
|
||||
/* #define BOOST_RE_SIZEOF_WCHAR_T */
|
||||
|
||||
|
||||
/* STL options: */
|
||||
|
||||
/* BOOST_RE_NO_EXCEPTION_H Define if you do not a compliant <exception>
|
||||
header file. */
|
||||
/* #define BOOST_RE_NO_EXCEPTION_H */
|
||||
|
||||
/* BOOST_RE_NO_ITERATOR_H Define if you do not have a version of <iterator>. */
|
||||
/* #define BOOST_RE_NO_ITERATOR_H */
|
||||
|
||||
/* BOOST_RE_NO_MEMORY_H Define if <memory> does not fully comply with the
|
||||
latest standard, and is not auto-recognised,
|
||||
that means nested template classes
|
||||
which hardly any compilers support at present. */
|
||||
/* #define BOOST_RE_NO_MEMORY_H */
|
||||
|
||||
/* BOOST_RE_NO_LOCALE_H Define if there is no verion of the standard
|
||||
<locale> header available. */
|
||||
/* #define BOOST_RE_NO_LOCALE_H */
|
||||
|
||||
/* BOOST_RE_NO_STL Disables the use of any supporting STL code. */
|
||||
/* #define BOOST_RE_NO_STL */
|
||||
|
||||
/* BOOST_RE_NO_NOT_EQUAL Disables the generation of operator!= if this
|
||||
clashes with the STL version. */
|
||||
|
||||
/* BOOST_RE_NO_STRING_DEF_ARGS Define if std::basic_string<charT> not allowed - in
|
||||
other words if the template is missing its required
|
||||
default arguments. */
|
||||
/* #define BOOST_RE_NO_STRING_DEF_ARGS */
|
||||
|
||||
/* BOOST_RE_USE_ALGO If <algo.h> not <algorithm> is present */
|
||||
/* #define BOOST_RE_USE_ALGO */
|
||||
|
||||
/* BOOST_RE_OLD_IOSTREAM If the new iostreamm classes are not available */
|
||||
/* #define BOOST_RE_OLD_IOSTREAM */
|
||||
|
||||
/* BOOST_RE_DISTANCE_T For std::distance:
|
||||
0 = NA
|
||||
1 = std::distance(i, j, n)
|
||||
2 = n = std::distance(i, j) */
|
||||
/* #define BOOST_RE_DISTANCE_T_0 */
|
||||
/* #define BOOST_RE_DISTANCE_T_1 */
|
||||
/* #define BOOST_RE_DISTANCE_T_2 */
|
||||
|
||||
/* BOOST_RE_ITERATOR_T Defines generic standard iterator type if available, use this as
|
||||
a shortcut to define all the other iterator types.
|
||||
1 = std::iterator<std::tag_type, T, D, T*, T&>
|
||||
2 = std::iterator<std::tag_type, T, D> */
|
||||
/* #define BOOST_RE_ITERATOR_T_0 */
|
||||
/* #define BOOST_RE_ITERATOR_T_1 */
|
||||
/* #define BOOST_RE_ITERATOR_T_2 */
|
||||
|
||||
/* BOOST_RE_OI_T For output iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::output_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::output_iterator_tag, T, D>
|
||||
3 = std::output_iterator */
|
||||
/* #define BOOST_RE_OI_T_0 */
|
||||
/* #define BOOST_RE_OI_T_1 */
|
||||
/* #define BOOST_RE_OI_T_2 */
|
||||
/* #define BOOST_RE_OI_T_3 */
|
||||
|
||||
/* BOOST_RE_II_T For input iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::input_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::input_iterator_tag, T, D>
|
||||
3 = std::input_iterator<T, D>
|
||||
4 = std::input_iterator<T> */
|
||||
/* #define BOOST_RE_II_T_0 */
|
||||
/* #define BOOST_RE_II_T_1 */
|
||||
/* #define BOOST_RE_II_T_2 */
|
||||
/* #define BOOST_RE_II_T_3 */
|
||||
/* #define BOOST_RE_II_T_4 */
|
||||
|
||||
|
||||
/* BOOST_RE_FI_T For forward iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::forward_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::forward_iterator_tag, T, D>
|
||||
3 = std::forward_iterator<T, D> */
|
||||
/* #define BOOST_RE_FI_T_0 */
|
||||
/* #define BOOST_RE_FI_T_1 */
|
||||
/* #define BOOST_RE_FI_T_2 */
|
||||
/* #define BOOST_RE_FI_T_3 */
|
||||
|
||||
/* BOOST_RE_BI_T For bidirectional iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::bidirectional_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::bidirectional_iterator_tag, T, D>
|
||||
3 = std::bidirectional_iterator<T, D> */
|
||||
/* #define BOOST_RE_BI_T_0 */
|
||||
/* #define BOOST_RE_BI_T_1 */
|
||||
/* #define BOOST_RE_BI_T_2 */
|
||||
/* #define BOOST_RE_BI_T_3 */
|
||||
|
||||
/* BOOST_RE_RI_T For random access iterators:
|
||||
0 = NA
|
||||
1 = std::iterator<std::random_access_iterator_tag, T, D, T*, T&>
|
||||
2 = std::iterator<std::random_access_iterator_tag, T, D>
|
||||
3 = std::random_access_iterator<T, D> */
|
||||
/* #define BOOST_RE_RI_T_0 */
|
||||
/* #define BOOST_RE_RI_T_1 */
|
||||
/* #define BOOST_RE_RI_T_2 */
|
||||
/* #define BOOST_RE_RI_T_3 */
|
||||
|
||||
/* BOOST_RE_NO_OI_ASSIGN If output iterators ostream_iterator<>, back_insert_iterator<> and
|
||||
front_insert_iterator<> do not have assignment operators */
|
||||
/* #define BOOST_RE_NO_OI_ASSIGN */
|
||||
|
||||
|
||||
#ifdef BOOST_RE_INT64_T_0
|
||||
#define BOOST_RE_NO_INT64
|
||||
#elif defined(BOOST_RE_INT64_T_1)
|
||||
#define BOOST_RE_INT64t short
|
||||
#define BOOST_RE_IMM64(val) val
|
||||
#elif defined(BOOST_RE_INT64_T_2)
|
||||
#define BOOST_RE_INT64t int
|
||||
#define BOOST_RE_IMM64(val) val
|
||||
#elif defined(BOOST_RE_INT64_T_3)
|
||||
#define BOOST_RE_INT64t long
|
||||
#define BOOST_RE_IMM64(val) val##L
|
||||
#elif defined(BOOST_RE_INT64_T_4)
|
||||
#define BOOST_RE_INT64t int64_t
|
||||
#define BOOST_RE_IMM64(val) INT64_C(val)
|
||||
#elif defined(BOOST_RE_INT64_T_5)
|
||||
#define BOOST_RE_INT64t long long
|
||||
#define BOOST_RE_IMM64(val) val##LL
|
||||
#elif defined(BOOST_RE_INT64_T_6)
|
||||
#define BOOST_RE_INT64t __int64
|
||||
#define BOOST_RE_IMM64(val) val##i64
|
||||
#else
|
||||
syntax error: unknown value for BOOST_RE_INT64_T
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_DISTANCE_T_0
|
||||
# define BOOST_RE_DISTANCE(i, j, n) n = j - i
|
||||
#elif defined(BOOST_RE_DISTANCE_T_1)
|
||||
# define BOOST_RE_DISTANCE(i, j, n) n = std::distance(i, j)
|
||||
#elif defined(BOOST_RE_DISTANCE_T_2)
|
||||
# define BOOST_RE_DISTANCE(i, j, n) (n = 0, std::distance(i, j, n))
|
||||
#else
|
||||
syntax erorr
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_0
|
||||
#ifndef BOOST_RE_OI_T_0
|
||||
#define BOOST_RE_OI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_0
|
||||
#define BOOST_RE_II_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_0
|
||||
#define BOOST_RE_FI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_0
|
||||
#define BOOST_RE_BI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_0
|
||||
#define BOOST_RE_RI_T_0 BOOST_RE_ITERATOR_T_0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_1
|
||||
#ifndef BOOST_RE_OI_T_1
|
||||
#define BOOST_RE_OI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_1
|
||||
#define BOOST_RE_II_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_1
|
||||
#define BOOST_RE_FI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_1
|
||||
#define BOOST_RE_BI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_1
|
||||
#define BOOST_RE_RI_T_1 BOOST_RE_ITERATOR_T_1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_2
|
||||
#ifndef BOOST_RE_OI_T_2
|
||||
#define BOOST_RE_OI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_2
|
||||
#define BOOST_RE_II_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_2
|
||||
#define BOOST_RE_FI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_2
|
||||
#define BOOST_RE_BI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_2
|
||||
#define BOOST_RE_RI_T_2 BOOST_RE_ITERATOR_T_2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_3
|
||||
#ifndef BOOST_RE_OI_T_3
|
||||
#define BOOST_RE_OI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_3
|
||||
#define BOOST_RE_II_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_3
|
||||
#define BOOST_RE_FI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_3
|
||||
#define BOOST_RE_BI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_3
|
||||
#define BOOST_RE_RI_T_3 BOOST_RE_ITERATOR_T_3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_ITERATOR_T_4
|
||||
#ifndef BOOST_RE_OI_T_4
|
||||
#define BOOST_RE_OI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_II_T_4
|
||||
#define BOOST_RE_II_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_FI_T_4
|
||||
#define BOOST_RE_FI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_BI_T_4
|
||||
#define BOOST_RE_BI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#ifndef BOOST_RE_RI_T_4
|
||||
#define BOOST_RE_RI_T_4 BOOST_RE_ITERATOR_T_4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_OI_T_0
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_OI_T_1)
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator<std::output_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_OI_T_2)
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::iterator<std::output_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_OI_T_3)
|
||||
# define BOOST_RE_OUTPUT_ITERATOR(T, D) std::output_iterator
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_II_T_0
|
||||
# define BOOST_RE_INPUT_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_II_T_1)
|
||||
#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator<std::input_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_II_T_2)
|
||||
#define BOOST_RE_INPUT_ITERATOR(T, D) std::iterator<std::input_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_II_T_3)
|
||||
# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator<T, D>
|
||||
#elif defined(BOOST_RE_II_T_4)
|
||||
# define BOOST_RE_INPUT_ITERATOR(T, D) std::input_iterator<T>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_FI_T_0
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_FI_T_1)
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator<std::forward_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_FI_T_2)
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) std::iterator<std::forward_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_FI_T_3)
|
||||
# define BOOST_RE_FWD_ITERATOR(T, D) std::forward_iterator<T, D>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_BI_T_0
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_BI_T_1)
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator<std::bidirectional_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_BI_T_2)
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) std::iterator<std::bidirectional_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_BI_T_3)
|
||||
# define BOOST_RE_BIDI_ITERATOR(T, D) std::bidirectional_iterator<T, D>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_RI_T_0
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) boost::re_detail::dummy_iterator_base<T>
|
||||
#elif defined(BOOST_RE_RI_T_1)
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) std::iterator<std::random_access_iterator_tag, T, D, T*, T&>
|
||||
#elif defined(BOOST_RE_RI_T_2)
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) std::iterator<std::random_access_iterator_tag, T, D>
|
||||
#elif defined(BOOST_RE_RI_T_3)
|
||||
# define BOOST_RE_RA_ITERATOR(T, D) std::random_access_iterator<T, D>
|
||||
#else
|
||||
syntax error
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef BOOST_RE_NO_EXCEPTION_H
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RE_NO_ITERATOR_H
|
||||
#include <iterator>
|
||||
#ifdef BOOST_RE_USE_ALGO
|
||||
#include <algo.h>
|
||||
#else
|
||||
#include <algorithm>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RE_NO_MEMORY_H) || defined(__GNUC__)
|
||||
#define BOOST_RE_OLD_ALLOCATORS
|
||||
#define REBIND_INSTANCE(x, y, inst) re_alloc_binder<x, y>(inst)
|
||||
#define REBIND_TYPE(x, y) re_alloc_binder<x, y>
|
||||
#define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_DEFAULT_PARAM( boost::re_detail::jm_def_alloc )
|
||||
#define BOOST_RE_DEF_ALLOC(x) boost::re_detail::jm_def_alloc
|
||||
|
||||
#define BOOST_RE_NEED_BINDER
|
||||
#define BOOST_RE_NEED_ALLOC
|
||||
#else
|
||||
#include <memory>
|
||||
#define REBIND_INSTANCE(x, y, inst) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind<x>::other(inst)
|
||||
#define REBIND_TYPE(x, y) y::BOOST_RE_NESTED_TEMPLATE_DECL rebind<x>::other
|
||||
#define BOOST_RE_DEF_ALLOC_PARAM(x) BOOST_RE_TRICKY_DEFAULT_PARAM( std::allocator<x> )
|
||||
#define BOOST_RE_DEF_ALLOC(x) std::allocator<x>
|
||||
#endif
|
||||
|
||||
|
||||
#endif // BOOST_RE_AUTO_CONFIGURE
|
||||
|
||||
|
||||
#endif /* BOOST_RE_OPT_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,181 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_synch.hpp
|
||||
* VERSION 3.02
|
||||
* DESCRIPTION: Thread synchronisation for regex code.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_SYNCH_HPP
|
||||
#define BOOST_REGEX_SYNCH_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_RE_PLATFORM_W32) && defined(BOOST_RE_THREADS)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void BOOST_RE_CALL re_init_threads();
|
||||
void BOOST_RE_CALL re_free_threads();
|
||||
|
||||
#ifdef BOOST_RE_THREADS
|
||||
|
||||
#ifndef BOOST_RE_PLATFORM_W32
|
||||
|
||||
typedef pthread_mutex_t CRITICAL_SECTION;
|
||||
|
||||
inline void BOOST_RE_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_init(ps, NULL);
|
||||
}
|
||||
|
||||
inline void BOOST_RE_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_destroy(ps);
|
||||
}
|
||||
|
||||
inline void BOOST_RE_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_lock(ps);
|
||||
}
|
||||
|
||||
inline void BOOST_RE_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_unlock(ps);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <class Lock>
|
||||
class lock_guard
|
||||
{
|
||||
typedef Lock lock_type;
|
||||
public:
|
||||
lock_guard(lock_type& m, bool aq = true)
|
||||
: mut(m), owned(false){ acquire(aq); }
|
||||
|
||||
~lock_guard()
|
||||
{ acquire(false); }
|
||||
|
||||
void BOOST_RE_CALL acquire(bool aq = true)
|
||||
{
|
||||
if(aq && !owned)
|
||||
{
|
||||
mut.acquire(true);
|
||||
owned = true;
|
||||
}
|
||||
else if(!aq && owned)
|
||||
{
|
||||
mut.acquire(false);
|
||||
owned = false;
|
||||
}
|
||||
}
|
||||
private:
|
||||
lock_type& mut;
|
||||
bool owned;
|
||||
};
|
||||
|
||||
|
||||
class critical_section
|
||||
{
|
||||
public:
|
||||
critical_section()
|
||||
{ InitializeCriticalSection(&hmutex);}
|
||||
|
||||
critical_section(const critical_section&)
|
||||
{ InitializeCriticalSection(&hmutex);}
|
||||
|
||||
const critical_section& BOOST_RE_CALL operator=(const critical_section&)
|
||||
{return *this;}
|
||||
|
||||
~critical_section()
|
||||
{DeleteCriticalSection(&hmutex);}
|
||||
|
||||
private:
|
||||
|
||||
void BOOST_RE_CALL acquire(bool aq)
|
||||
{ if(aq) EnterCriticalSection(&hmutex);
|
||||
else LeaveCriticalSection(&hmutex);
|
||||
}
|
||||
|
||||
CRITICAL_SECTION hmutex;
|
||||
|
||||
public:
|
||||
typedef lock_guard<critical_section> ro_guard;
|
||||
typedef lock_guard<critical_section> rw_guard;
|
||||
|
||||
friend lock_guard<critical_section>;
|
||||
};
|
||||
|
||||
inline bool BOOST_RE_CALL operator==(const critical_section&, const critical_section&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool BOOST_RE_CALL operator<(const critical_section&, const critical_section&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef lock_guard<critical_section> cs_guard;
|
||||
|
||||
BOOST_RE_IX_DECL extern critical_section* p_re_lock;
|
||||
BOOST_RE_IX_DECL extern unsigned int re_lock_count;
|
||||
|
||||
#define BOOST_RE_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst);
|
||||
|
||||
#else // BOOST_RE_THREADS
|
||||
|
||||
#define BOOST_RE_GUARD(inst)
|
||||
|
||||
#endif // BOOST_RE_THREADS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // sentry
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -3,20 +3,16 @@
|
||||
* Copyright (c) 1998-2000
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* LOCATION: see http://www.boost.org/libs/regex for documentation.
|
||||
* FILE regex.h
|
||||
* VERSION 3.02
|
||||
* VERSION 3.12
|
||||
* DESCRIPTION: Declares POSIX API functions
|
||||
*/
|
||||
|
||||
@ -65,7 +61,7 @@ using boost::regerrorA;
|
||||
using boost::regexecA;
|
||||
using boost::regfreeA;
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
using boost::regcompW;
|
||||
using boost::regerrorW;
|
||||
using boost::regexecW;
|
||||
@ -100,3 +96,5 @@ using boost::reg_errcode_t;
|
||||
#endif // BOOST_RE_REGEX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
627
include/boost/regex/config.hpp
Normal file
627
include/boost/regex/config.hpp
Normal file
@ -0,0 +1,627 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE config.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: regex extended config setup.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#define BOOST_REGEX_CONFIG_HPP
|
||||
//
|
||||
// Borland C++ Fix/error check
|
||||
// this has to go *before* we include any std lib headers:
|
||||
//
|
||||
#if defined(__BORLANDC__)
|
||||
# include <boost/regex/config/borland.hpp>
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Include all the headers we need here:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
# ifndef BOOST_REGEX_USER_CONFIG
|
||||
# define BOOST_REGEX_USER_CONFIG <boost/regex/user.hpp>
|
||||
# endif
|
||||
|
||||
# include BOOST_REGEX_USER_CONFIG
|
||||
|
||||
# include <cstdlib>
|
||||
# include <cstddef>
|
||||
# include <cstdio>
|
||||
# include <clocale>
|
||||
# include <cassert>
|
||||
# include <string>
|
||||
# include <stdexcept>
|
||||
# include <iterator>
|
||||
# include <iosfwd>
|
||||
# include <vector>
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/cstdint.hpp>
|
||||
# include <boost/regex/config/allocator.hpp>
|
||||
# include <boost/regex/config/cstring.hpp>
|
||||
# include <boost/throw_exception.hpp>
|
||||
# include <boost/scoped_ptr.hpp>
|
||||
# ifndef BOOST_NO_STD_LOCALE
|
||||
# include <locale>
|
||||
# endif
|
||||
#else
|
||||
//
|
||||
// C build,
|
||||
// don't include <boost/config.hpp> because that may
|
||||
// do C++ specific things in future...
|
||||
//
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
# ifdef _MSC_VER
|
||||
# define BOOST_MSVC _MSC_VER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Boilerplate regex config options:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* Obsolete macro, use BOOST_VERSION instead: */
|
||||
#define BOOST_RE_VERSION 320
|
||||
|
||||
// fix:
|
||||
#if defined(_UNICODE) && !defined(UNICODE)
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
//
|
||||
// If there isn't good enough wide character support then there will
|
||||
// be no wide character regular expressions:
|
||||
//
|
||||
#if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING))
|
||||
# if !defined(BOOST_NO_WREGEX)
|
||||
# define BOOST_NO_WREGEX
|
||||
# endif
|
||||
#else
|
||||
# if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
// STLPort on IRIX is misconfigured: <cwctype> does not compile
|
||||
// as a temporary fix include <wctype.h> instead and prevent inclusion
|
||||
// of STLPort version of <cwctype>
|
||||
# include <wctype.h>
|
||||
# define __STLPORT_CWCTYPE
|
||||
# define _STLP_CWCTYPE
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <boost/regex/config/cwchar.hpp>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// If Win32 support has been disabled for boost in general, then
|
||||
// it is for regex in particular:
|
||||
//
|
||||
#if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32)
|
||||
# define BOOST_REGEX_NO_W32
|
||||
#endif
|
||||
|
||||
// some versions of gcc can't merge template instances:
|
||||
#if defined(__CYGWIN__)
|
||||
# define BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE
|
||||
#endif
|
||||
|
||||
// fix problems with bool as a macro,
|
||||
// this probably doesn't affect any current compilers:
|
||||
#if defined(bool) || defined(true) || defined(false)
|
||||
# define BOOST_REGEX_NO_BOOL
|
||||
#endif
|
||||
|
||||
// We don't make our templates external if the compiler
|
||||
// can't handle it:
|
||||
#if (defined(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS) || defined(__HP_aCC) || defined(__MWERKS__) || defined(__COMO__) || defined(BOOST_INTEL))\
|
||||
&& !defined(BOOST_MSVC) && !defined(__BORLANDC__)
|
||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
#endif
|
||||
|
||||
// disable our own file-iterators and mapfiles if we can't
|
||||
// support them:
|
||||
#if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32))
|
||||
# define BOOST_REGEX_NO_FILEITER
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef MB_CUR_MAX
|
||||
// yuk!
|
||||
// better make a conservative guess!
|
||||
#define MB_CUR_MAX 10
|
||||
#endif
|
||||
|
||||
namespace boost{ namespace re_detail{
|
||||
#ifdef BOOST_NO_STD_DISTANCE
|
||||
template <class T>
|
||||
std::ptrdiff_t distance(const T& x, const T& y)
|
||||
{ return y - x; }
|
||||
#else
|
||||
using std::distance;
|
||||
#endif
|
||||
}}
|
||||
|
||||
|
||||
#ifdef BOOST_REGEX_NO_BOOL
|
||||
# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>((x) ? true : false)
|
||||
#else
|
||||
# ifdef BOOST_MSVC
|
||||
// warning suppression with VC6:
|
||||
# pragma warning(disable: 4800)
|
||||
# endif
|
||||
# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>(x)
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
// backwards compatibitity:
|
||||
#if defined(BOOST_RE_NO_LIB)
|
||||
# define BOOST_REGEX_NO_LIB
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (defined(_WIN32) || defined(__CYGWIN__))
|
||||
// gcc on win32 has problems merging switch statements in templates:
|
||||
# define BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE
|
||||
// gcc on win32 has problems if you include <windows.h>
|
||||
// (sporadically generates bad code).
|
||||
# define BOOST_REGEX_USE_C_LOCALE
|
||||
# define BOOST_REGEX_NO_W32
|
||||
#endif
|
||||
#if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
|
||||
# define BOOST_REGEX_NO_W32
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Wide character workarounds:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1300) && !defined(BOOST_REGEX_V3) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
# define BOOST_REGEX_HAS_SHORT_WCHAR_T
|
||||
namespace boost{ typedef __wchar_t regex_wchar_type; }
|
||||
#else
|
||||
namespace boost{ typedef wchar_t regex_wchar_type; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Set up dll import/export options:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
|
||||
# if defined(BOOST_REGEX_SOURCE)
|
||||
# define BOOST_REGEX_DECL __declspec(dllexport)
|
||||
# define BOOST_REGEX_BUILD_DLL
|
||||
# else
|
||||
# define BOOST_REGEX_DECL __declspec(dllimport)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_DECL
|
||||
# define BOOST_REGEX_DECL
|
||||
#endif
|
||||
|
||||
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
|
||||
# define BOOST_LIB_NAME boost_regex
|
||||
# if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
# endif
|
||||
#ifdef BOOST_REGEX_DIAG
|
||||
# define BOOST_LIB_DIAGNOSTIC
|
||||
#endif
|
||||
# include <boost/config/auto_link.hpp>
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Set up function call type:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS)
|
||||
#if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS)
|
||||
# define BOOST_REGEX_CALL __cdecl
|
||||
#else
|
||||
# define BOOST_REGEX_CALL __fastcall
|
||||
#endif
|
||||
# define BOOST_REGEX_CCALL __cdecl
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)
|
||||
# define BOOST_REGEX_CALL __fastcall
|
||||
# define BOOST_REGEX_CCALL __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_CALL
|
||||
# define BOOST_REGEX_CALL
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_CCALL
|
||||
#define BOOST_REGEX_CCALL
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Set up localisation model:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
// backwards compatibility:
|
||||
#ifdef BOOST_RE_LOCALE_C
|
||||
# define BOOST_REGEX_USE_C_LOCALE
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_RE_LOCALE_CPP
|
||||
# define BOOST_REGEX_USE_CPP_LOCALE
|
||||
#endif
|
||||
|
||||
// Win32 defaults to native Win32 locale:
|
||||
#if defined(_WIN32) && !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_REGEX_NO_W32)
|
||||
# define BOOST_REGEX_USE_WIN32_LOCALE
|
||||
#endif
|
||||
// otherwise use C locale:
|
||||
#if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE)
|
||||
# define BOOST_REGEX_USE_C_LOCALE
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef MAXPATH
|
||||
# define BOOST_REGEX_MAX_PATH MAXPATH
|
||||
#elif defined(MAX_PATH)
|
||||
# define BOOST_REGEX_MAX_PATH MAX_PATH
|
||||
#elif defined(FILENAME_MAX)
|
||||
# define BOOST_REGEX_MAX_PATH FILENAME_MAX
|
||||
#else
|
||||
# define BOOST_REGEX_MAX_PATH 200
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_MAX_STATE_COUNT
|
||||
# define BOOST_REGEX_MAX_STATE_COUNT 100000000
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Error Handling for exception free compilers:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
//
|
||||
// If there are no exceptions then we must report critical-errors
|
||||
// the only way we know how; by terminating.
|
||||
//
|
||||
# define BOOST_REGEX_NOEH_ASSERT(x)\
|
||||
if(0 == (x))\
|
||||
{\
|
||||
std::string s("Error: critical regex++ failure in: ");\
|
||||
s.append(#x);\
|
||||
std::runtime_error e(s);\
|
||||
boost::throw_exception(e);\
|
||||
}
|
||||
#else
|
||||
//
|
||||
// With exceptions then error handling is taken care of and
|
||||
// there is no need for these checks:
|
||||
//
|
||||
# define BOOST_REGEX_NOEH_ASSERT(x)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Debugging / tracing support:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(BOOST_REGEX_DEBUG) && defined(__cplusplus)
|
||||
|
||||
# include <iostream>
|
||||
using std::cout;
|
||||
using std::cin;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::hex;
|
||||
using std::dec;
|
||||
|
||||
# ifndef jm_assert
|
||||
# define jm_assert(x) assert(x)
|
||||
# endif
|
||||
# ifndef jm_trace
|
||||
# define jm_trace(x) cerr << x << endl;
|
||||
# endif
|
||||
# ifndef jm_instrument
|
||||
# define jm_instrument jm_trace(__FILE__<<"#"<<__LINE__)
|
||||
# endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
class debug_guard
|
||||
{
|
||||
public:
|
||||
char g1[32];
|
||||
const char* pc;
|
||||
char* pnc;
|
||||
const char* file;
|
||||
int line;
|
||||
char g2[32];
|
||||
debug_guard(const char* f, int l, const char* p1 = 0, char* p2 = 0);
|
||||
~debug_guard();
|
||||
};
|
||||
|
||||
# define BOOST_RE_GUARD_STACK boost::re_detail::debug_guard sg(__FILE__, __LINE__);
|
||||
# define BOOST_RE_GUARD_GLOBAL(x) const char g1##x[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }; char g2##x[32]; boost::debug_guard g3##x(__FILE__, __LINE__, g1##x, g2##x);
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
# define jm_assert(x)
|
||||
# define jm_trace(x)
|
||||
# define BOOST_RE_GUARD_STACK
|
||||
# define BOOST_RE_GUARD_GLOBAL(x)
|
||||
# ifndef jm_instrument
|
||||
# define jm_instrument
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Stack protection under MS Windows:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_V3)
|
||||
# if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
|
||||
&& !defined(__GNUC__) \
|
||||
&& !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
|
||||
&& !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
|
||||
# define BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
# endif
|
||||
#elif defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
|
||||
# undef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Error handling:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_regex_exception(const std::string& s);
|
||||
|
||||
template <class traits>
|
||||
void raise_error(const traits& t, unsigned code)
|
||||
{
|
||||
(void)t; // warning suppression
|
||||
raise_regex_exception(t.error_string(code));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Algorithm selection and configuration:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
|
||||
# if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG)
|
||||
# define BOOST_REGEX_RECURSIVE
|
||||
# else
|
||||
# define BOOST_REGEX_NON_RECURSIVE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
||||
# ifdef BOOST_REGEX_RECURSIVE
|
||||
# error "Can't set both BOOST_REGEX_RECURSIVE and BOOST_REGEX_NON_RECURSIVE"
|
||||
# endif
|
||||
# ifndef BOOST_REGEX_BLOCKSIZE
|
||||
# define BOOST_REGEX_BLOCKSIZE 4096
|
||||
# endif
|
||||
# if BOOST_REGEX_BLOCKSIZE < 512
|
||||
# error "BOOST_REGEX_BLOCKSIZE must be at least 512"
|
||||
# endif
|
||||
# ifndef BOOST_REGEX_MAX_BLOCKS
|
||||
# define BOOST_REGEX_MAX_BLOCKS 1024
|
||||
# endif
|
||||
# ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
# undef BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
# endif
|
||||
# ifndef BOOST_REGEX_MAX_CACHE_BLOCKS
|
||||
# define BOOST_REGEX_MAX_CACHE_BLOCKS 16
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Fix broken compilers that wrongly #define some symbols:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// the following may be defined as macros; this is
|
||||
// incompatable with std::something syntax, we have
|
||||
// no choice but to undef them?
|
||||
|
||||
#ifdef sprintf
|
||||
#undef sprintf
|
||||
#endif
|
||||
#ifdef swprintf
|
||||
#undef swprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Fix broken broken namespace support:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
|
||||
|
||||
namespace std{
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
using ::sprintf;
|
||||
using ::abs;
|
||||
using ::setlocale;
|
||||
# ifndef BOOST_NO_WREGEX
|
||||
# ifndef BOOST_NO_SWPRINTF
|
||||
using ::swprintf;
|
||||
# endif
|
||||
using ::wcstombs;
|
||||
using ::mbstowcs;
|
||||
# if !defined(BOOST_NO_STD_LOCALE) && !defined (__STL_NO_NATIVE_MBSTATE_T) && !defined(_STLP_NO_NATIVE_MBSTATE_T)
|
||||
using ::mbstate_t;
|
||||
# endif
|
||||
# endif // BOOST_NO_WREGEX
|
||||
using ::fseek;
|
||||
using ::fread;
|
||||
using ::ftell;
|
||||
using ::fopen;
|
||||
using ::fclose;
|
||||
using ::FILE;
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
using ::fprintf;
|
||||
using ::abort;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* helper functions pointer_construct/pointer_destroy:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace boost{ namespace re_detail{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4100)
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline void pointer_destroy(T* p)
|
||||
{ p->~T(); (void)p; }
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline void pointer_construct(T* p, const T& t)
|
||||
{ new (p) T(t); }
|
||||
|
||||
}} // namespaces
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* helper memory allocation functions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE)
|
||||
namespace boost{ namespace re_detail{
|
||||
|
||||
BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
|
||||
|
||||
}} // namespaces
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Diagnostics:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef BOOST_REGEX_CONFIG_INFO
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info();
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_DIAG)
|
||||
# pragma message ("BOOST_REGEX_DECL set as: " BOOST_STRINGIZE(BOOST_REGEX_DECL))
|
||||
# pragma message ("BOOST_REGEX_CALL set as: " BOOST_STRINGIZE(BOOST_REGEX_CALL))
|
||||
# pragma message ("BOOST_REGEX_CCALL set as: " BOOST_STRINGIZE(BOOST_REGEX_CCALL))
|
||||
#ifdef BOOST_REGEX_USE_C_LOCALE
|
||||
# pragma message ("Using C locale in regex traits class")
|
||||
#elif BOOST_REGEX_USE_CPP_LOCALE
|
||||
# pragma message ("Using C++ locale in regex traits class")
|
||||
#else
|
||||
# pragma message ("Using Win32 locale in regex traits class")
|
||||
#endif
|
||||
#ifdef BOOST_REGEX_DYN_LINK
|
||||
# pragma message ("Dynamic linking enabled")
|
||||
#endif
|
||||
#ifdef BOOST_REGEX_NO_LIB
|
||||
# pragma message ("Auto-linking disabled")
|
||||
#endif
|
||||
#ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
# pragma message ("Extern templates disabled")
|
||||
#endif
|
||||
#ifdef BOOST_REGEX_V3
|
||||
# pragma message ("Using Version 3 regex code")
|
||||
#else
|
||||
# pragma message ("Using Version 4 regex code")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
281
include/boost/regex/config/allocator.hpp
Normal file
281
include/boost/regex/config/allocator.hpp
Normal file
@ -0,0 +1,281 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2001
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_ALLOCATOR_HPP
|
||||
#define BOOST_DETAIL_ALLOCATOR_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <assert.h>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
// see if we have SGI alloc class:
|
||||
#if defined(BOOST_NO_STD_ALLOCATOR) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__GLIBCPP__) || defined(__STL_CONFIG_H))
|
||||
# define BOOST_HAVE_SGI_ALLOCATOR
|
||||
# include <memory>
|
||||
# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
namespace boost{ namespace detail{
|
||||
typedef std::__sgi_alloc alloc_type;
|
||||
}}
|
||||
# else
|
||||
namespace boost{ namespace detail{
|
||||
typedef std::alloc alloc_type;
|
||||
}}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{ namespace detail{
|
||||
|
||||
template <class T>
|
||||
void allocator_construct(T* p, const T& t)
|
||||
{ new (p) T(t); }
|
||||
|
||||
template <class T>
|
||||
void allocator_destroy(T* p)
|
||||
{
|
||||
(void)p; // warning suppression
|
||||
p->~T();
|
||||
}
|
||||
|
||||
} }
|
||||
|
||||
#if !defined(BOOST_NO_STD_ALLOCATOR)
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define BOOST_DEFAULT_ALLOCATOR(T) std::allocator< T >
|
||||
|
||||
namespace boost{ namespace detail{
|
||||
|
||||
template <class T, class A>
|
||||
struct rebind_allocator
|
||||
{
|
||||
typedef typename A::template rebind<T> binder;
|
||||
typedef typename binder::other type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#elif !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__SUNPRO_CC)
|
||||
|
||||
// no std::allocator, but the compiler supports the necessary syntax,
|
||||
// write our own allocator instead:
|
||||
|
||||
#define BOOST_DEFAULT_ALLOCATOR(T) ::boost::detail::allocator< T >
|
||||
|
||||
namespace boost{ namespace detail{
|
||||
|
||||
template <class T>
|
||||
class allocator
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
typedef value_type * pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
template <class U>
|
||||
struct rebind
|
||||
{
|
||||
typedef allocator<U> other;
|
||||
};
|
||||
|
||||
allocator(){}
|
||||
|
||||
template <class U>
|
||||
allocator(const allocator<U>&){}
|
||||
|
||||
allocator(const allocator&){}
|
||||
|
||||
template <class U>
|
||||
allocator& operator=(const allocator<U>&)
|
||||
{ return *this; }
|
||||
|
||||
~allocator(){}
|
||||
|
||||
pointer address(reference x) { return &x; }
|
||||
|
||||
const_pointer address(const_reference x) const { return &x; }
|
||||
|
||||
pointer allocate(size_type n, const void* = 0)
|
||||
{
|
||||
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||
return n != 0 ?
|
||||
reinterpret_cast<pointer>(alloc_type::allocate(n * sizeof(value_type)))
|
||||
: 0;
|
||||
#else
|
||||
return n != 0 ?
|
||||
reinterpret_cast<pointer>(::operator new(n * sizeof(value_type)))
|
||||
: 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||
assert( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
alloc_type::deallocate((void*)p, n);
|
||||
#else
|
||||
assert( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
::operator delete((void*)p);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{ return size_t(-1) / sizeof(value_type); }
|
||||
|
||||
void construct(pointer p, const T& val) const
|
||||
{ allocator_construct(p, val); }
|
||||
|
||||
void destroy(pointer p) const
|
||||
{ allocator_destroy(p); }
|
||||
};
|
||||
|
||||
template <class T, class A>
|
||||
struct rebind_allocator
|
||||
{
|
||||
typedef typename A::template rebind<T> binder;
|
||||
typedef typename binder::other type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
// no std::allocator, use workaround version instead,
|
||||
// each allocator class must derive from a base class
|
||||
// that allocates blocks of bytes:
|
||||
|
||||
#define BOOST_DEFAULT_ALLOCATOR(T) ::boost::detail::allocator_adapter<T, ::boost::detail::simple_alloc>
|
||||
|
||||
namespace boost{ namespace detail{
|
||||
|
||||
class simple_alloc
|
||||
{
|
||||
public:
|
||||
|
||||
typedef void value_type;
|
||||
typedef value_type * pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
simple_alloc(){}
|
||||
simple_alloc(const simple_alloc&){}
|
||||
|
||||
~simple_alloc(){}
|
||||
|
||||
pointer allocate(size_type n, const void* = 0)
|
||||
{
|
||||
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||
return n != 0 ?
|
||||
reinterpret_cast<pointer>(alloc_type::allocate(n))
|
||||
: 0;
|
||||
#else
|
||||
return n != 0 ?
|
||||
reinterpret_cast<pointer>(::operator new(n))
|
||||
: 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||
assert( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
alloc_type::deallocate((void*)p, n);
|
||||
#else
|
||||
assert( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
::operator delete((void*)p);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class Base>
|
||||
class allocator_adapter : public Base
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
typedef value_type * pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef Base base_type;
|
||||
|
||||
allocator_adapter(){}
|
||||
allocator_adapter(const base_type& x) : Base(x){}
|
||||
allocator_adapter& operator=(const base_type& x)
|
||||
{
|
||||
*(static_cast<base_type*>(this)) = x;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~allocator_adapter(){}
|
||||
|
||||
pointer address(reference x) { return &x; }
|
||||
|
||||
const_pointer address(const_reference x) const { return &x; }
|
||||
|
||||
pointer allocate(size_type n, const void* = 0)
|
||||
{
|
||||
return n != 0 ?
|
||||
reinterpret_cast<pointer>(base_type::allocate(n * sizeof(value_type)))
|
||||
: 0;
|
||||
}
|
||||
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
assert( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
static_cast<base_type*>(this)->deallocate((void*)p, n * sizeof(value_type));
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{ return size_t(-1) / sizeof(value_type); }
|
||||
|
||||
void construct(pointer p, const T& val) const
|
||||
{ allocator_construct(p, val); }
|
||||
|
||||
void destroy(pointer p) const
|
||||
{ allocator_destroy(p); }
|
||||
};
|
||||
|
||||
template <class T, class A>
|
||||
struct rebind_allocator
|
||||
{
|
||||
typedef allocator_adapter<T, typename A::base_type> type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
63
include/boost/regex/config/borland.hpp
Normal file
63
include/boost/regex/config/borland.hpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE boost/regex/config/borland.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: regex borland-specific config setup.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
# if (__BORLANDC__ == 0x550) || (__BORLANDC__ == 0x551)
|
||||
// problems with std::basic_string and dll RTL:
|
||||
# if defined(_RTLDLL) && defined(_RWSTD_COMPILE_INSTANTIATE)
|
||||
# ifdef BOOST_REGEX_BUILD_DLL
|
||||
# error _RWSTD_COMPILE_INSTANTIATE must not be defined when building regex++ as a DLL
|
||||
# else
|
||||
# pragma message("Defining _RWSTD_COMPILE_INSTANTIATE when linking to the DLL version of the RTL may produce memory corruption problems in std::basic_string, as a result of separate versions of basic_string's static data in the RTL and you're exe/dll: be warned!!")
|
||||
# endif
|
||||
# endif
|
||||
# ifndef _RTLDLL
|
||||
// this is harmless for a staic link:
|
||||
# define _RWSTD_COMPILE_INSTANTIATE
|
||||
# endif
|
||||
// external templates cause problems for some reason:
|
||||
# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
# endif
|
||||
# if (__BORLANDC__ <= 0x540) && !defined(BOOST_REGEX_NO_LIB) && !defined(_NO_VCL)
|
||||
// C++ Builder 4 and earlier, we can't tell whether we should be using
|
||||
// the VCL runtime or not, do a static link instead:
|
||||
# define BOOST_REGEX_STATIC_LINK
|
||||
# endif
|
||||
//
|
||||
// VCL support:
|
||||
// if we're building a console app then there can't be any VCL (can there?)
|
||||
# if !defined(__CONSOLE__) && !defined(_NO_VCL)
|
||||
# define BOOST_REGEX_USE_VCL
|
||||
# endif
|
||||
//
|
||||
// if this isn't Win32 then don't automatically select link
|
||||
// libraries:
|
||||
//
|
||||
# ifndef _Windows
|
||||
# ifndef BOOST_REGEX_NO_LIB
|
||||
# define BOOST_REGEX_NO_LIB
|
||||
# endif
|
||||
# ifndef BOOST_REGEX_STATIC_LINK
|
||||
# define BOOST_REGEX_STATIC_LINK
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
303
include/boost/regex/config/cstring.hpp
Normal file
303
include/boost/regex/config/cstring.hpp
Normal file
@ -0,0 +1,303 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE boost/regex/config/cstring.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: regex narrow character string fixes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_CSTRING_HPP
|
||||
#define BOOST_REGEX_CONFIG_CSTRING_HPP
|
||||
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#ifndef __sgi
|
||||
#ifdef __KCC
|
||||
#include <ios>
|
||||
#endif
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace std{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option push -w-8008 -w-8066 -w-8004
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
|
||||
// Any function that is a macro is converted into an inline function:
|
||||
#ifdef memcmp
|
||||
inline int boost_memcmp(const void * p1, const void * p2, size_t s)
|
||||
{ return memcmp(p1, p2, s); }
|
||||
#undef memcmp
|
||||
inline int memcmp(const void * p1, const void * p2, size_t s)
|
||||
{ return boost_memcmp(p1, p2, s); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::memcmp;
|
||||
#endif
|
||||
|
||||
#ifdef memcpy
|
||||
inline void *boost_memcpy(void * p1, const void *p2, size_t s)
|
||||
{ return memcpy(p1, p2, s); }
|
||||
#undef memcpy
|
||||
inline void *memcpy(void * p1, const void *p2, size_t s)
|
||||
{ return boost_memcpy(p1, p2, s); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::memcpy;
|
||||
#endif
|
||||
|
||||
#ifdef memmove
|
||||
inline void *(memmove)(void *, const void *, size_t)
|
||||
{ return memmove(p1,p2,s); }
|
||||
#undef memmove
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::memmove;
|
||||
#endif
|
||||
|
||||
#ifdef memset
|
||||
inline void *(boost_memset)(void *p, int a, size_t b)
|
||||
{ return memset(p,a,b); }
|
||||
#undef memset
|
||||
inline void *(memset)(void *p, int a, size_t b)
|
||||
{ return boost_memset(p,a,b); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::memset;
|
||||
#endif
|
||||
|
||||
#ifdef strcat
|
||||
inline char *(boost_strcat)(char *p1, const char *p2)
|
||||
{ return strcat(p1,p2); }
|
||||
#undef strcat
|
||||
inline char *(strcat)(char *p1, const char *p2)
|
||||
{ return boost_strcat(p1,p2); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::strcat;
|
||||
#endif
|
||||
|
||||
#ifdef strcmp
|
||||
inline int (boost_strcmp)(const char *p1, const char *p2)
|
||||
{ return strcmp(p1,p2); }
|
||||
#undef strcmp
|
||||
inline int (strcmp)(const char *p1, const char *p2)
|
||||
{ return boost_strcmp(p1,p2); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::strcmp;
|
||||
#endif
|
||||
|
||||
#ifdef strcoll
|
||||
inline int (boost_strcoll) (const char *p1, const char *p2)
|
||||
{ return strcoll(p1,p2); }
|
||||
#undef strcoll
|
||||
inline int (strcoll) (const char *p1, const char *p2)
|
||||
{ return boost_strcoll(p1,p2); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::strcoll;
|
||||
#endif
|
||||
|
||||
#ifdef strcpy
|
||||
inline char *(boost_strcpy)(char *p1, const char *p2)
|
||||
{ return strcpy(p1,p2); }
|
||||
#undef strcpy
|
||||
inline char *(strcpy)(char *p1, const char *p2)
|
||||
{ return boost_strcpy(p1,p2); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::strcpy;
|
||||
#endif
|
||||
|
||||
#ifdef strlen
|
||||
inline size_t (boost_strlen)(const char *p)
|
||||
{ return strlen(p); }
|
||||
#undef strlen
|
||||
inline size_t (strlen)(const char *p)
|
||||
{ return boost_strlen(p); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::strlen;
|
||||
#endif
|
||||
|
||||
#ifdef strxfrm
|
||||
inline size_t (boost_strxfrm)(char *p1, const char *p2, size_t s)
|
||||
{ return strxfrm(p1,p2,s); }
|
||||
#undef strxfrm
|
||||
inline size_t (strxfrm)(char *p1, const char *p2, size_t s)
|
||||
{ return boost_strxfrm(p1,p2,s); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::strxfrm;
|
||||
#endif
|
||||
|
||||
#ifdef isalnum
|
||||
inline int (boost_isalnum)(int i)
|
||||
{ return isalnum(i); }
|
||||
#undef isalnum
|
||||
inline int (isalnum)(int i)
|
||||
{ return boost_isalnum(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isalnum;
|
||||
#endif
|
||||
|
||||
#ifdef isalpha
|
||||
inline int (boost_isalpha)(int i)
|
||||
{ return isalpha(i); }
|
||||
#undef isalpha
|
||||
inline int (isalpha)(int i)
|
||||
{ return boost_isalpha(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isalpha;
|
||||
#endif
|
||||
|
||||
#ifdef iscntrl
|
||||
inline int (boost_iscntrl)(int i)
|
||||
{ return iscntrl(i); }
|
||||
#undef iscntrl
|
||||
inline int (iscntrl)(int i)
|
||||
{ return boost_iscntrl(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iscntrl;
|
||||
#endif
|
||||
|
||||
#ifdef isdigit
|
||||
inline int (boost_isdigit)(int i)
|
||||
{ return isdigit(i); }
|
||||
#undef isdigit
|
||||
inline int (isdigit)(int i)
|
||||
{ return boost_isdigit(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isdigit;
|
||||
#endif
|
||||
|
||||
#ifdef isgraph
|
||||
inline int (boost_isgraph)(int i)
|
||||
{ return isgraph(i); }
|
||||
#undef isgraph
|
||||
inline int (isgraph)(int i)
|
||||
{ return boost_isgraph(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isgraph;
|
||||
#endif
|
||||
|
||||
#ifdef islower
|
||||
inline int (boost_islower)(int i)
|
||||
{ return islower(i); }
|
||||
#undef islower
|
||||
inline int (islower)(int i)
|
||||
{ return boost_islower(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::islower;
|
||||
#endif
|
||||
|
||||
#ifdef isprint
|
||||
inline int (boost_isprint)(int i)
|
||||
{ return isprint(i); }
|
||||
#undef isprint
|
||||
inline int (isprint)(int i)
|
||||
{ return boost_isprint(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isprint;
|
||||
#endif
|
||||
|
||||
#ifdef ispunct
|
||||
inline int (boost_ispunct)(int i)
|
||||
{ return ispunct(i); }
|
||||
#undef ispunct
|
||||
inline int (ispunct)(int i)
|
||||
{ return boost_ispunct(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::ispunct;
|
||||
#endif
|
||||
|
||||
#ifdef isspace
|
||||
inline int (isspace)(int i)
|
||||
{ return isspace(i); }
|
||||
#undef isspace
|
||||
inline int (boost_isspace)(int i)
|
||||
{ return boost_isspace(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isspace;
|
||||
#endif
|
||||
|
||||
#ifdef isupper
|
||||
inline int (isupper)(int i)
|
||||
{ return isupper(i); }
|
||||
#undef isupper
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isupper;
|
||||
#endif
|
||||
|
||||
#ifdef isxdigit
|
||||
inline int (isxdigit)(int i)
|
||||
{ return isxdigit(i); }
|
||||
#undef isxdigit
|
||||
inline int (boost_isxdigit)(int i)
|
||||
{ return boost_isxdigit(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::isxdigit;
|
||||
#endif
|
||||
|
||||
#ifdef tolower
|
||||
inline int (boost_tolower)(int i)
|
||||
{ return tolower(i); }
|
||||
#undef tolower
|
||||
inline int (tolower)(int i)
|
||||
{ return boost_tolower(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::tolower;
|
||||
#endif
|
||||
|
||||
#ifdef toupper
|
||||
inline int (boost_toupper)(int i)
|
||||
{ return toupper(i); }
|
||||
#undef toupper
|
||||
inline int (toupper)(int i)
|
||||
{ return boost_toupper(i); }
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::toupper;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#undef memcmp
|
||||
#undef memcpy
|
||||
#undef memmove
|
||||
#undef memset
|
||||
#undef strcat
|
||||
#undef strcmp
|
||||
#undef strcoll
|
||||
#undef strcpy
|
||||
#undef strlen
|
||||
#undef strxfrm
|
||||
#undef isalnum
|
||||
#undef isalpha
|
||||
#undef iscntrl
|
||||
#undef isdigit
|
||||
#undef isgraph
|
||||
#undef islower
|
||||
#undef isprint
|
||||
#undef ispunct
|
||||
#undef isspace
|
||||
#undef isupper
|
||||
#undef isxdigit
|
||||
#undef tolower
|
||||
#undef toupper
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option pop
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif // __sgi
|
||||
|
||||
#endif
|
||||
|
184
include/boost/regex/config/cwchar.hpp
Normal file
184
include/boost/regex/config/cwchar.hpp
Normal file
@ -0,0 +1,184 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE boost/regex/config/cwchar.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: regex wide character string fixes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_CWCHAR_HPP
|
||||
#define BOOST_REGEX_CONFIG_CWCHAR_HPP
|
||||
|
||||
#include <cwchar>
|
||||
#include <cwctype>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace std{
|
||||
|
||||
#ifndef BOOST_NO_STDC_NAMESPACE
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#ifdef iswalnum
|
||||
inline int (iswalnum)(wint_t i)
|
||||
{ return iswalnum(i); }
|
||||
#undef iswalnum
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswalnum;
|
||||
#endif
|
||||
|
||||
#ifdef iswalpha
|
||||
inline int (iswalpha)(wint_t i)
|
||||
{ return iswalpha(i); }
|
||||
#undef iswalpha
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswalpha;
|
||||
#endif
|
||||
|
||||
#ifdef iswcntrl
|
||||
inline int (iswcntrl)(wint_t i)
|
||||
{ return iswcntrl(i); }
|
||||
#undef iswcntrl
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswcntrl;
|
||||
#endif
|
||||
|
||||
#ifdef iswdigit
|
||||
inline int (iswdigit)(wint_t i)
|
||||
{ return iswdigit(i); }
|
||||
#undef iswdigit
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswdigit;
|
||||
#endif
|
||||
|
||||
#ifdef iswgraph
|
||||
inline int (iswgraph)(wint_t i)
|
||||
{ return iswgraph(i); }
|
||||
#undef iswgraph
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswgraph;
|
||||
#endif
|
||||
|
||||
#ifdef iswlower
|
||||
inline int (iswlower)(wint_t i)
|
||||
{ return iswlower(i); }
|
||||
#undef iswlower
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswlower;
|
||||
#endif
|
||||
|
||||
#ifdef iswprint
|
||||
inline int (iswprint)(wint_t i)
|
||||
{ return iswprint(i); }
|
||||
#undef iswprint
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswprint;
|
||||
#endif
|
||||
|
||||
#ifdef iswpunct
|
||||
inline int (iswpunct)(wint_t i)
|
||||
{ return iswpunct(i); }
|
||||
#undef iswpunct
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswpunct;
|
||||
#endif
|
||||
|
||||
#ifdef iswspace
|
||||
inline int (iswspace)(wint_t i)
|
||||
{ return iswspace(i); }
|
||||
#undef iswspace
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswspace;
|
||||
#endif
|
||||
|
||||
#ifdef iswupper
|
||||
inline int (iswupper)(wint_t i)
|
||||
{ return iswupper(i); }
|
||||
#undef iswupper
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswupper;
|
||||
#endif
|
||||
|
||||
#ifdef iswxdigit
|
||||
inline int (iswxdigit)(wint_t i)
|
||||
{ return iswxdigit(i); }
|
||||
#undef iswxdigit
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::iswxdigit;
|
||||
#endif
|
||||
|
||||
#ifdef towlower
|
||||
inline wint_t (towlower)(wint_t i)
|
||||
{ return towlower(i); }
|
||||
#undef towlower
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::towlower;
|
||||
#endif
|
||||
|
||||
#ifdef towupper
|
||||
inline wint_t (towupper)(wint_t i)
|
||||
{ return towupper(i); }
|
||||
#undef towupper
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using :: towupper;
|
||||
#endif
|
||||
|
||||
#ifdef wcscmp
|
||||
inline int (wcscmp)(const wchar_t *p1, const wchar_t *p2)
|
||||
{ return wcscmp(p1,p2); }
|
||||
#undef wcscmp
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::wcscmp;
|
||||
#endif
|
||||
|
||||
#ifdef wcscoll
|
||||
inline int (wcscoll)(const wchar_t *p1, const wchar_t *p2)
|
||||
{ return wcscoll(p1,p2); }
|
||||
#undef wcscoll
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::wcscoll;
|
||||
#endif
|
||||
|
||||
#ifdef wcscpy
|
||||
inline wchar_t *(wcscpy)(wchar_t *p1, const wchar_t *p2)
|
||||
{ return wcscpy(p1,p2); }
|
||||
#undef wcscpy
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::wcscpy;
|
||||
#endif
|
||||
|
||||
#ifdef wcslen
|
||||
inline size_t (wcslen)(const wchar_t *p)
|
||||
{ return wcslen(p); }
|
||||
#undef wcslen
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::wcslen;
|
||||
#endif
|
||||
|
||||
#ifdef wcsxfrm
|
||||
size_t wcsxfrm(wchar_t *p1, const wchar_t *p2, size_t s)
|
||||
{ return wcsxfrm(p1,p2,s); }
|
||||
#undef wcsxfrm
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::wcsxfrm;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef BOOST_NO_STDC_NAMESPACE
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
|
204
include/boost/regex/config/regex_library_include.hpp
Normal file
204
include/boost/regex/config/regex_library_include.hpp
Normal file
@ -0,0 +1,204 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_libary_include.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
|
||||
Libraries for Borland and Microsoft compilers are automatically
|
||||
selected here, the name of the lib is selected according to the following
|
||||
formula:
|
||||
|
||||
BOOST_LIB_PREFIX
|
||||
+ BOOST_LIB_NAME
|
||||
+ "_"
|
||||
+ BOOST_LIB_TOOLSET
|
||||
+ "_"
|
||||
+ BOOST_LIB_THREAD_OPT
|
||||
+ BOOST_LIB_RT_OPT
|
||||
+ BOOST_LIB_DEBUG_OPT
|
||||
|
||||
These are defined as:
|
||||
|
||||
BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".
|
||||
|
||||
BOOST_LIB_NAME: The base name of the lib (boost_regex).
|
||||
|
||||
BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
|
||||
|
||||
BOOST_LIB_THREAD_OPT: "s" for single thread builds,
|
||||
"m" for multithread builds.
|
||||
|
||||
BOOST_LIB_RT_OPT: "s" for static runtime,
|
||||
"d" for dynamic runtime.
|
||||
|
||||
BOOST_LIB_DEBUG_OPT: nothing for release builds,
|
||||
"d" for debug builds,
|
||||
"dd" for debug-diagnostic builds (_STLP_DEBUG).
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#if !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_REGEX_NO_LIB)
|
||||
#define BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
|
||||
#define BOOST_LIB_NAME "boost_regex"
|
||||
|
||||
//
|
||||
// select toolset:
|
||||
//
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
|
||||
// vc6-stlport:
|
||||
# define BOOST_LIB_TOOLSET "vc6-stlport"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1200)
|
||||
|
||||
// vc6:
|
||||
# define BOOST_LIB_TOOLSET "vc6"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
|
||||
// vc6-stlport:
|
||||
# define BOOST_LIB_TOOLSET "vc7-stlport"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
|
||||
|
||||
// vc7:
|
||||
# define BOOST_LIB_TOOLSET "vc7"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1310) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
|
||||
// vc71-stlport:
|
||||
# define BOOST_LIB_TOOLSET "vc71-stlport"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1310)
|
||||
|
||||
// vc71:
|
||||
# define BOOST_LIB_TOOLSET "vc71"
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x560)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb6"
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb5"
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x540)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb4"
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// select thread opt:
|
||||
//
|
||||
#if defined(_MT) || defined(__MT__)
|
||||
# define BOOST_LIB_THREAD_OPT "m"
|
||||
#else
|
||||
# define BOOST_LIB_THREAD_OPT "s"
|
||||
#endif
|
||||
|
||||
//
|
||||
// select runtime opt:
|
||||
//
|
||||
#if defined(_DLL) || defined(_RTLDLL)
|
||||
# define BOOST_LIB_RT_OPT "d"
|
||||
#else
|
||||
# define BOOST_LIB_RT_OPT "s"
|
||||
#endif
|
||||
|
||||
//
|
||||
// select linkage opt:
|
||||
//
|
||||
#if defined(BOOST_REGEX_STATIC_LINK) && defined(BOOST_REGEX_DYN_LINK)
|
||||
# undef BOOST_REGEX_STATIC_LINK
|
||||
#endif
|
||||
#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_REGEX_DYN_LINK)
|
||||
# define BOOST_LIB_PREFIX
|
||||
#else
|
||||
# define BOOST_LIB_PREFIX "lib"
|
||||
#endif
|
||||
|
||||
//
|
||||
// select debug opt:
|
||||
//
|
||||
#if defined(BOOST_MSVC) && defined(_DEBUG) && (defined(_STLP_DEBUG) || defined(__STL_DEBUG))
|
||||
# define BOOST_LIB_DEBUG_OPT "dd"
|
||||
#elif defined(BOOST_MSVC) && defined(_DEBUG)
|
||||
# define BOOST_LIB_DEBUG_OPT "d"
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (defined(_STLP_DEBUG) || defined(__STL_DEBUG))
|
||||
# define BOOST_LIB_DEBUG_OPT "dd"
|
||||
#else
|
||||
# define BOOST_LIB_DEBUG_OPT
|
||||
#endif
|
||||
|
||||
//
|
||||
// now include the lib:
|
||||
//
|
||||
#if defined(BOOST_LIB_NAME) \
|
||||
&& defined(BOOST_LIB_PREFIX) \
|
||||
&& defined(BOOST_LIB_TOOLSET) \
|
||||
&& defined(BOOST_LIB_THREAD_OPT) \
|
||||
&& defined(BOOST_LIB_RT_OPT) \
|
||||
&& defined(BOOST_LIB_DEBUG_OPT)
|
||||
|
||||
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
|
||||
#ifdef BOOST_REGEX_DIAG
|
||||
# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// finally undef any macros we may have set:
|
||||
//
|
||||
#if defined(BOOST_LIB_NAME)
|
||||
# undef BOOST_LIB_NAME
|
||||
#endif
|
||||
#if defined(BOOST_LIB_TOOLSET)
|
||||
# undef BOOST_LIB_TOOLSET
|
||||
#endif
|
||||
#if defined(BOOST_LIB_THREAD_OPT)
|
||||
# undef BOOST_LIB_THREAD_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_RT_OPT)
|
||||
# undef BOOST_LIB_RT_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_LINK_OPT)
|
||||
# undef BOOST_LIB_LINK_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_DEBUG_OPT)
|
||||
# undef BOOST_LIB_DEBUG_OPT
|
||||
#endif
|
||||
|
||||
|
||||
#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
62
include/boost/regex/pattern_except.hpp
Normal file
62
include/boost/regex/pattern_except.hpp
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE pattern_except.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares pattern-matching exception classes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_PAT_EXCEPT_HPP
|
||||
#define BOOST_RE_PAT_EXCEPT_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4275)
|
||||
#endif
|
||||
class BOOST_REGEX_DECL bad_pattern : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
|
||||
~bad_pattern() throw();
|
||||
};
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
class BOOST_REGEX_DECL bad_expression : public bad_pattern
|
||||
{
|
||||
public:
|
||||
explicit bad_expression(const std::string& s) : bad_pattern(s) {}
|
||||
~bad_expression() throw();
|
||||
};
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
41
include/boost/regex/regex_traits.hpp
Normal file
41
include/boost/regex/regex_traits.hpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_traits.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares regular expression traits classes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_TRAITS_HPP
|
||||
#define BOOST_REGEX_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
# include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_V3
|
||||
# ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
|
||||
# include <boost/regex/v3/regex_traits.hpp>
|
||||
# endif
|
||||
#else
|
||||
# ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
|
||||
# include <boost/regex/v4/regex_traits.hpp>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // include
|
||||
|
||||
|
||||
|
||||
|
||||
|
55
include/boost/regex/src.cpp
Normal file
55
include/boost/regex/src.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE src.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Includes all the regex source files, include this
|
||||
* file only if you need to build the regex library
|
||||
* as a single file. You must include this file
|
||||
* before any other regex header.
|
||||
*
|
||||
* CAUTION: THIS FILE IS DEPRICATED AND WILL CAUSE
|
||||
* UNNECESSARY CODE BLOAT.
|
||||
*/
|
||||
|
||||
#if (!defined(BOOST_REGEX_NO_LIB) || !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)) && defined(BOOST_REGEX_CONFIG_HPP)
|
||||
#error too late you have already included a regex header - make sure that you include this header before any other boost header
|
||||
#endif
|
||||
|
||||
#define BOOST_REGEX_NO_LIB
|
||||
#define BOOST_REGEX_STATIC_LINK
|
||||
#define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
//
|
||||
// include library source files:
|
||||
//
|
||||
#ifdef BOOST_REGEX_USE_WIN32_LOCALE
|
||||
#include "libs/regex/src/w32_regex_traits.cpp"
|
||||
#elif defined(BOOST_REGEX_USE_C_LOCALE)
|
||||
#include "libs/regex/src/c_regex_traits.cpp"
|
||||
#else
|
||||
#include "libs/regex/src/cpp_regex_traits.cpp"
|
||||
#endif
|
||||
#include "libs/regex/src/c_regex_traits_common.cpp"
|
||||
#include "libs/regex/src/cregex.cpp"
|
||||
#include "libs/regex/src/fileiter.cpp"
|
||||
#include "libs/regex/src/posix_api.cpp"
|
||||
#include "libs/regex/src/wide_posix_api.cpp"
|
||||
#include "libs/regex/src/regex.cpp"
|
||||
#include "libs/regex/src/regex_debug.cpp"
|
||||
#include "libs/regex/src/regex_synch.cpp"
|
||||
|
||||
|
||||
|
92
include/boost/regex/user.hpp
Normal file
92
include/boost/regex/user.hpp
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE user.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: User settable options.
|
||||
*/
|
||||
|
||||
// define if you want the regex library to use the C locale
|
||||
// even on Win32:
|
||||
// #define BOOST_REGEX_USE_C_LOCALE
|
||||
|
||||
// define this is you want the regex library to use the C++
|
||||
// locale:
|
||||
// #define BOOST_REGEX_USE_CPP_LOCALE
|
||||
|
||||
// define this if the runtime library is a dll, and you
|
||||
// want BOOST_REGEX_DYN_LINK to set up dll exports/imports
|
||||
// with __declspec(dllexport)/__declspec(dllimport.)
|
||||
// #define BOOST_REGEX_HAS_DLL_RUNTIME
|
||||
|
||||
// define this if you want to dynamically link to regex,
|
||||
// if the runtime library is also a dll (Probably Win32 specific,
|
||||
// and has no effect unless BOOST_REGEX_HAS_DLL_RUNTIME is set):
|
||||
// #define BOOST_REGEX_DYN_LINK
|
||||
|
||||
// define this if you don't want the lib to automatically
|
||||
// select its link libraries:
|
||||
// #define BOOST_REGEX_NO_LIB
|
||||
|
||||
// define this if templates with switch statements cause problems:
|
||||
// #define BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE
|
||||
|
||||
// define this to disable Win32 support when available:
|
||||
// #define BOOST_REGEX_NO_W32
|
||||
|
||||
// define this if bool is not a real type:
|
||||
// #define BOOST_REGEX_NO_BOOL
|
||||
|
||||
// define this if no template instances are to be placed in
|
||||
// the library rather than users object files:
|
||||
// #define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
// define this if the forward declarations in regex_fwd.hpp
|
||||
// cause more problems than they are worth:
|
||||
// #define BOOST_REGEX_NO_FWD
|
||||
|
||||
// define this if your compiler can't cope with the new
|
||||
// version 4 regex code.
|
||||
// #define BOOST_REGEX_V3
|
||||
|
||||
// define this if your compiler supports MS Windows structured
|
||||
// exception handling.
|
||||
// #define BOOST_REGEX_HAS_MS_STACK_GUARD
|
||||
|
||||
// define this if you want to use the recursive algorithm
|
||||
// even if BOOST_REGEX_HAS_MS_STACK_GUARD is not defined.
|
||||
// #define BOOST_REGEX_RECURSIVE
|
||||
|
||||
// define this if you want to use the non-recursive
|
||||
// algorithm, even if the recursive version would be the default.
|
||||
// #define BOOST_REGEX_NON_RECURSIVE
|
||||
|
||||
// define this if you want to set the size of the memory blocks
|
||||
// used by the non-recursive algorithm.
|
||||
// #define BOOST_REGEX_BLOCKSIZE 4096
|
||||
|
||||
// define this if you want to set the maximum number of memory blocks
|
||||
// used by the non-recursive algorithm.
|
||||
// #define BOOST_REGEX_MAX_BLOCKS 1024
|
||||
|
||||
// define this if you want to set the maximum number of memory blocks
|
||||
// cached by the non-recursive algorithm: Normally this is 16, but can be
|
||||
// higher if you have multiple threads all using boost.regex, or lower
|
||||
// if you don't want boost.regex to cache memory.
|
||||
// #define BOOST_REGEX_MAX_CACHE_BLOCKS 16
|
||||
|
||||
// define this if you want to be able to access extended capture
|
||||
// information in your sub_match's (caution this will slow things
|
||||
// down quite a bit).
|
||||
// #define BOOST_REGEX_MATCH_EXTRA
|
||||
|
314
include/boost/regex/v3/cregex.hpp
Normal file
314
include/boost/regex/v3/cregex.hpp
Normal file
@ -0,0 +1,314 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE cregex.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares POSIX API functions
|
||||
* + boost::RegEx high level wrapper.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_CREGEX_HPP_INCLUDED
|
||||
#define BOOST_RE_CREGEX_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
/* include these defs only for POSIX compatablity */
|
||||
#ifdef __cplusplus
|
||||
namespace boost{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
typedef std::ptrdiff_t regoff_t;
|
||||
typedef std::size_t regsize_t;
|
||||
#else
|
||||
typedef ptrdiff_t regoff_t;
|
||||
typedef size_t regsize_t;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const char* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
unsigned int eflags; /* none of your business :-) */
|
||||
} regex_tA;
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const wchar_t* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
unsigned int eflags; /* none of your business :-) */
|
||||
} regex_tW;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* start of match */
|
||||
regoff_t rm_eo; /* end of match */
|
||||
} regmatch_t;
|
||||
|
||||
/* regcomp() flags */
|
||||
typedef enum{
|
||||
REG_BASIC = 0000,
|
||||
REG_EXTENDED = 0001,
|
||||
REG_ICASE = 0002,
|
||||
REG_NOSUB = 0004,
|
||||
REG_NEWLINE = 0010,
|
||||
REG_NOSPEC = 0020,
|
||||
REG_PEND = 0040,
|
||||
REG_DUMP = 0200,
|
||||
REG_NOCOLLATE = 0400,
|
||||
REG_ESCAPE_IN_LISTS = 01000,
|
||||
REG_NEWLINE_ALT = 02000,
|
||||
|
||||
REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS,
|
||||
REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS,
|
||||
REG_GREP = REG_BASIC | REG_NEWLINE_ALT,
|
||||
REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT,
|
||||
|
||||
REG_ASSERT = 15,
|
||||
REG_INVARG = 16,
|
||||
REG_ATOI = 255, /* convert name to number (!) */
|
||||
REG_ITOA = 0400 /* convert number to name (!) */
|
||||
} reg_comp_flags;
|
||||
|
||||
/* regexec() flags */
|
||||
typedef enum{
|
||||
REG_NOTBOL = 00001,
|
||||
REG_NOTEOL = 00002,
|
||||
REG_STARTEND = 00004
|
||||
} reg_exec_flags;
|
||||
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
|
||||
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA*);
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW*, const wchar_t*, int);
|
||||
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, regsize_t);
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, regsize_t, regmatch_t*, int);
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define regcomp regcompW
|
||||
#define regerror regerrorW
|
||||
#define regexec regexecW
|
||||
#define regfree regfreeW
|
||||
#define regex_t regex_tW
|
||||
#else
|
||||
#define regcomp regcompA
|
||||
#define regerror regerrorA
|
||||
#define regexec regexecA
|
||||
#define regfree regfreeA
|
||||
#define regex_t regex_tA
|
||||
#endif
|
||||
|
||||
/* regerror() flags */
|
||||
typedef enum
|
||||
{
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH = 1, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT = 2, /* Invalid pattern. */
|
||||
REG_ECOLLATE = 3, /* Undefined collating element. */
|
||||
REG_ECTYPE = 4, /* Invalid character class name. */
|
||||
REG_EESCAPE = 5, /* Trailing backslash. */
|
||||
REG_ESUBREG = 6, /* Invalid back reference. */
|
||||
REG_EBRACK = 7, /* Unmatched left bracket. */
|
||||
REG_EPAREN = 8, /* Parenthesis imbalance. */
|
||||
REG_EBRACE = 9, /* Unmatched \{. */
|
||||
REG_BADBR = 10, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE = 11, /* Invalid range end. */
|
||||
REG_ESPACE = 12, /* Ran out of memory. */
|
||||
REG_BADRPT = 13, /* No preceding re for repetition op. */
|
||||
REG_EEND = 14, /* unexpected end of expression */
|
||||
REG_ESIZE = 15, /* expression too big */
|
||||
REG_ERPAREN = 16, /* unmatched right parenthesis */
|
||||
REG_EMPTY = 17, /* empty expression */
|
||||
REG_E_MEMORY = REG_ESIZE, /* out of memory */
|
||||
REG_E_UNKNOWN = 18 /* unknown error */
|
||||
} reg_errcode_t;
|
||||
|
||||
enum match_flags
|
||||
{
|
||||
match_default = 0,
|
||||
match_not_bol = 1, // first is not start of line
|
||||
match_not_eol = match_not_bol << 1, // last is not end of line
|
||||
match_not_bob = match_not_eol << 1, // first is not start of buffer
|
||||
match_not_eob = match_not_bob << 1, // last is not end of buffer
|
||||
match_not_bow = match_not_eob << 1, // first is not start of word
|
||||
match_not_eow = match_not_bow << 1, // last is not end of word
|
||||
match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.'
|
||||
match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.'
|
||||
match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression
|
||||
match_init = match_prev_avail << 1, // internal use
|
||||
match_any = match_init << 1, // don't care what we match
|
||||
match_not_null = match_any << 1, // string can't be null
|
||||
match_continuous = match_not_null << 1, // each grep match must continue from
|
||||
// uninterupted from the previous one
|
||||
match_partial = match_continuous << 1, // find partial matches
|
||||
|
||||
match_stop = match_partial << 1, // stop after first match (grep)
|
||||
match_all = match_stop << 1, // must find the whole of input even if match_any is set
|
||||
match_max = match_all
|
||||
};
|
||||
|
||||
typedef unsigned long match_flag_type;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// C++ high level wrapper goes here:
|
||||
//
|
||||
#if defined(__cplusplus)
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class RegEx;
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
class RegExData;
|
||||
struct pred1;
|
||||
struct pred2;
|
||||
struct pred3;
|
||||
struct pred4;
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
#if defined(BOOST_MSVC) || defined(__BORLANDC__)
|
||||
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
|
||||
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (__cdecl *FindFilesCallback)(const char* file);
|
||||
#else
|
||||
typedef bool (*GrepCallback)(const RegEx& expression);
|
||||
typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (*FindFilesCallback)(const char* file);
|
||||
#endif
|
||||
|
||||
class BOOST_REGEX_DECL RegEx
|
||||
{
|
||||
private:
|
||||
re_detail::RegExData* pdata;
|
||||
public:
|
||||
RegEx();
|
||||
RegEx(const RegEx& o);
|
||||
~RegEx();
|
||||
explicit RegEx(const char* c, bool icase = false);
|
||||
explicit RegEx(const std::string& s, bool icase = false);
|
||||
RegEx& operator=(const RegEx& o);
|
||||
RegEx& operator=(const char* p);
|
||||
RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
|
||||
unsigned int SetExpression(const char* p, bool icase = false);
|
||||
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
|
||||
std::string Expression()const;
|
||||
unsigned int error_code()const;
|
||||
//
|
||||
// now matching operators:
|
||||
//
|
||||
bool Match(const char* p, match_flag_type flags = match_default);
|
||||
bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
|
||||
bool Search(const char* p, match_flag_type flags = match_default);
|
||||
bool Search(const std::string& s, match_flag_type flags = match_default) { return Search(s.c_str(), flags); }
|
||||
unsigned int Grep(GrepCallback cb, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(GrepCallback cb, const std::string& s, match_flag_type flags = match_default) { return Grep(cb, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<std::string>& v, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(std::vector<std::string>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(std::vector<std::size_t>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
|
||||
unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
||||
unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); }
|
||||
#endif
|
||||
|
||||
std::string Merge(const std::string& in, const std::string& fmt,
|
||||
bool copy = true, match_flag_type flags = match_default);
|
||||
std::string Merge(const char* in, const char* fmt,
|
||||
bool copy = true, match_flag_type flags = match_default);
|
||||
|
||||
std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
|
||||
//
|
||||
// now operators for returning what matched in more detail:
|
||||
//
|
||||
std::size_t Position(int i = 0)const;
|
||||
std::size_t Length(int i = 0)const;
|
||||
bool Matched(int i = 0)const;
|
||||
unsigned int Line()const;
|
||||
unsigned int Marks()const;
|
||||
std::string What(int i = 0)const;
|
||||
std::string operator[](int i)const { return What(i); }
|
||||
|
||||
static const unsigned int npos;
|
||||
|
||||
friend struct re_detail::pred1;
|
||||
friend struct re_detail::pred2;
|
||||
friend struct re_detail::pred3;
|
||||
friend struct re_detail::pred4;
|
||||
};
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option pop
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,54 +1,54 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE fileiter.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares various platform independent file and
|
||||
* directory iterators, plus binary file input in
|
||||
* the form of class map_file.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_FILEITER_HPP
|
||||
#define BOOST_RE_FILEITER_HPP
|
||||
#ifndef BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
#define BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_RE_NO_W32)
|
||||
#error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
|
||||
#define FI_WIN32_MAP
|
||||
#define FI_POSIX_DIR
|
||||
#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_RE_NO_W32)
|
||||
#define FI_WIN32_MAP
|
||||
#define FI_WIN32_DIR
|
||||
#else
|
||||
#define FI_POSIX_MAP
|
||||
#define FI_POSIX_DIR
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(FI_WIN32_MAP)||defined(FI_WIN32_DIR)
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_WIN32_DIR
|
||||
#else
|
||||
#define BOOST_REGEX_FI_POSIX_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_MAP)||defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(FI_WIN32_DIR)
|
||||
#if defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
typedef WIN32_FIND_DATA _fi_find_data;
|
||||
typedef WIN32_FIND_DATAA _fi_find_data;
|
||||
typedef HANDLE _fi_find_handle;
|
||||
|
||||
} // namespace re_detail
|
||||
@ -58,7 +58,7 @@ typedef HANDLE _fi_find_handle;
|
||||
#define _fi_invalid_handle INVALID_HANDLE_VALUE
|
||||
#define _fi_dir FILE_ATTRIBUTE_DIRECTORY
|
||||
|
||||
#elif defined(FI_POSIX_DIR)
|
||||
#elif defined(BOOST_REGEX_FI_POSIX_DIR)
|
||||
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
@ -79,11 +79,7 @@ namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
struct _fi_find_data
|
||||
@ -95,7 +91,7 @@ struct _fi_find_data
|
||||
struct _fi_priv_data;
|
||||
|
||||
typedef _fi_priv_data* _fi_find_handle;
|
||||
#define _fi_invalid_handle NULL
|
||||
#define _fi_invalid_handle 0
|
||||
#define _fi_dir 1
|
||||
|
||||
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData);
|
||||
@ -121,8 +117,8 @@ bool _fi_FindClose(_fi_find_handle hFindFile);
|
||||
#undef FindClose
|
||||
#endif
|
||||
|
||||
#define FindFirstFile _fi_FindFirstFile
|
||||
#define FindNextFile _fi_FindNextFile
|
||||
#define FindFirstFileA _fi_FindFirstFile
|
||||
#define FindNextFileA _fi_FindNextFile
|
||||
#define FindClose _fi_FindClose
|
||||
|
||||
#endif
|
||||
@ -138,9 +134,9 @@ namespace boost{
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef FI_WIN32_MAP // win32 mapfile
|
||||
#ifdef BOOST_REGEX_FI_WIN32_MAP // win32 mapfile
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
HANDLE hfile;
|
||||
HANDLE hmap;
|
||||
@ -162,11 +158,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#elif !defined(BOOST_RE_NO_STL) // use C API to emulate the memory map:
|
||||
#else
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile_iterator;
|
||||
class BOOST_REGEX_DECL mapfile_iterator;
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
typedef char* pointer;
|
||||
std::FILE* hfile;
|
||||
@ -196,7 +192,10 @@ public:
|
||||
friend class mapfile_iterator;
|
||||
};
|
||||
|
||||
class BOOST_RE_IX_DECL mapfile_iterator : public BOOST_RE_RA_ITERATOR(char, long)
|
||||
class BOOST_REGEX_DECL mapfile_iterator
|
||||
#if !defined(BOOST_NO_STD_ITERATOR) || defined(BOOST_MSVC_STD_ITERATOR)
|
||||
: public std::iterator<std::random_access_iterator_tag, char>
|
||||
#endif
|
||||
{
|
||||
typedef mapfile::pointer internal_pointer;
|
||||
internal_pointer* node;
|
||||
@ -276,12 +275,12 @@ public:
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
#ifndef BOOST_RE_NO_NOT_EQUAL
|
||||
|
||||
friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
#endif
|
||||
|
||||
friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
@ -315,7 +314,7 @@ public:
|
||||
#endif
|
||||
|
||||
// _fi_sep determines the directory separator, either '\\' or '/'
|
||||
BOOST_RE_IX_DECL extern const char* _fi_sep;
|
||||
BOOST_REGEX_DECL extern const char* _fi_sep;
|
||||
|
||||
struct file_iterator_ref
|
||||
{
|
||||
@ -325,7 +324,7 @@ struct file_iterator_ref
|
||||
};
|
||||
|
||||
|
||||
class BOOST_RE_IX_DECL file_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t)
|
||||
class BOOST_REGEX_DECL file_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
@ -333,6 +332,12 @@ class BOOST_RE_IX_DECL file_iterator : public BOOST_RE_INPUT_ITERATOR(const char
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
file_iterator();
|
||||
file_iterator(const char* wild);
|
||||
~file_iterator();
|
||||
@ -351,12 +356,12 @@ public:
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
#ifndef BOOST_RE_NO_NOT_EQUAL
|
||||
|
||||
friend inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
// dwa 9/13/00 - suppress unused parameter warning
|
||||
@ -366,7 +371,7 @@ inline bool operator < (const file_iterator&, const file_iterator&)
|
||||
}
|
||||
|
||||
|
||||
class BOOST_RE_IX_DECL directory_iterator : public BOOST_RE_INPUT_ITERATOR(const char*, std::ptrdiff_t)
|
||||
class BOOST_REGEX_DECL directory_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
@ -374,6 +379,12 @@ class BOOST_RE_IX_DECL directory_iterator : public BOOST_RE_INPUT_ITERATOR(const
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
directory_iterator();
|
||||
directory_iterator(const char* wild);
|
||||
~directory_iterator();
|
||||
@ -396,13 +407,13 @@ public:
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
#ifndef BOOST_RE_NO_NOT_EQUAL
|
||||
|
||||
friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
inline bool operator < (const directory_iterator&, const directory_iterator&)
|
||||
{
|
||||
@ -410,9 +421,7 @@ inline bool operator < (const directory_iterator&, const directory_iterator&)
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -422,7 +431,12 @@ using boost::re_detail::file_iterator;
|
||||
using boost::re_detail::mapfile;
|
||||
} // namespace boost
|
||||
|
||||
#endif // _FILEITER_H
|
||||
#endif // BOOST_REGEX_NO_FILEITER
|
||||
#endif // BOOST_RE_FILEITER_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
165
include/boost/regex/v3/instances.hpp
Normal file
165
include/boost/regex/v3/instances.hpp
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE instances.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Defines those template instances that are placed in the
|
||||
* library rather than in the users object files.
|
||||
*/
|
||||
|
||||
//
|
||||
// note no include guard, we may include this multiple times:
|
||||
//
|
||||
#ifndef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
namespace boost{
|
||||
|
||||
//
|
||||
// this header can be included multiple times, each time with
|
||||
// a different character type, BOOST_REGEX_CHAR_T must be defined
|
||||
// first:
|
||||
//
|
||||
#ifndef BOOST_REGEX_CHAR_T
|
||||
# error "BOOST_REGEX_CHAR_T not defined"
|
||||
#endif
|
||||
|
||||
//
|
||||
// what follows is compiler specific:
|
||||
//
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# pragma option push -Jgx
|
||||
# endif
|
||||
|
||||
template class BOOST_REGEX_DECL reg_expression< BOOST_REGEX_CHAR_T >;
|
||||
template class BOOST_REGEX_DECL re_detail::match_results_base<BOOST_REGEX_CHAR_T const*>;
|
||||
template class BOOST_REGEX_DECL re_detail::match_results_base<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>;
|
||||
template class BOOST_REGEX_DECL match_results<BOOST_REGEX_CHAR_T const*>;
|
||||
template class BOOST_REGEX_DECL match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>;
|
||||
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# pragma option pop
|
||||
# endif
|
||||
|
||||
#pragma option pop
|
||||
|
||||
#elif defined(BOOST_MSVC)
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# define template extern template
|
||||
# endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251 4231 4660)
|
||||
|
||||
//template class BOOST_REGEX_DECL regex_traits< BOOST_REGEX_CHAR_T >;
|
||||
template class BOOST_REGEX_DECL reg_expression< BOOST_REGEX_CHAR_T >;
|
||||
template class BOOST_REGEX_DECL re_detail::match_results_base<BOOST_REGEX_CHAR_T const*, BOOST_DEFAULT_ALLOCATOR(re_detail::def_alloc_param_traits<BOOST_REGEX_CHAR_T const*>::type) >;
|
||||
template class BOOST_REGEX_DECL re_detail::match_results_base<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, BOOST_DEFAULT_ALLOCATOR(re_detail::def_alloc_param_traits<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>::type) >;
|
||||
template class BOOST_REGEX_DECL match_results<BOOST_REGEX_CHAR_T const*, BOOST_DEFAULT_ALLOCATOR(re_detail::def_alloc_param_traits<BOOST_REGEX_CHAR_T const*>::type) >;
|
||||
template class BOOST_REGEX_DECL match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, BOOST_DEFAULT_ALLOCATOR(re_detail::def_alloc_param_traits<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>::type) >;
|
||||
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
# ifdef template
|
||||
# undef template
|
||||
# endif
|
||||
|
||||
#elif !defined(BOOST_REGEX_HAS_DLL_RUNTIME)
|
||||
|
||||
//
|
||||
// for each [member] function declare a full specialisation of that
|
||||
// [member] function, then instantiate it in one translation unit.
|
||||
// This is not guarenteed to work according to the standard, but in
|
||||
// practice it should work for all compilers (unless they use a realy
|
||||
// perverse name mangling convention). Unfortunately this approach
|
||||
// does *not* work for Win32 style import/export, because that can
|
||||
// alter the class layout.
|
||||
//
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# define template template<>
|
||||
# endif
|
||||
|
||||
template reg_expression<BOOST_REGEX_CHAR_T>::reg_expression(const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)&);
|
||||
template reg_expression<BOOST_REGEX_CHAR_T>::reg_expression(const BOOST_REGEX_CHAR_T* p, reg_expression<BOOST_REGEX_CHAR_T>::flag_type f, const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)& a);
|
||||
template reg_expression<BOOST_REGEX_CHAR_T>::reg_expression(const BOOST_REGEX_CHAR_T* p, size_type len, reg_expression<BOOST_REGEX_CHAR_T>::flag_type f, const BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)&);
|
||||
template reg_expression<BOOST_REGEX_CHAR_T>::reg_expression(const reg_expression<BOOST_REGEX_CHAR_T>&);
|
||||
template reg_expression<BOOST_REGEX_CHAR_T>::~reg_expression();
|
||||
template reg_expression<BOOST_REGEX_CHAR_T>& BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::operator=(const reg_expression&);
|
||||
template BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::get_allocator()const;
|
||||
template bool BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::operator==(const reg_expression<BOOST_REGEX_CHAR_T>&)const;
|
||||
template bool BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::operator<(const reg_expression<BOOST_REGEX_CHAR_T>&)const;
|
||||
template BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::allocator()const;
|
||||
template unsigned int BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::set_expression(const BOOST_REGEX_CHAR_T* p, const BOOST_REGEX_CHAR_T* end, reg_expression<BOOST_REGEX_CHAR_T>::flag_type f);
|
||||
template void BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::compile_maps();
|
||||
template void BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::compile_map(re_detail::re_syntax_base* node, unsigned char* _map, unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal)const;
|
||||
template bool BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::probe_start(re_detail::re_syntax_base* node, BOOST_REGEX_CHAR_T c, re_detail::re_syntax_base* terminal)const;
|
||||
template bool BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const;
|
||||
template void BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces);
|
||||
template void BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::move_offsets(re_detail::re_syntax_base* j, unsigned size);
|
||||
template re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::compile_set(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last);
|
||||
template re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::compile_set_aux(re_detail::jstack<reg_expression<BOOST_REGEX_CHAR_T>::traits_string_type, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) >& singles, re_detail::jstack<reg_expression<BOOST_REGEX_CHAR_T>::traits_string_type, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)>& ranges, re_detail::jstack<boost::uint_fast32_t, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) >& classes, re_detail::jstack<reg_expression<BOOST_REGEX_CHAR_T>::traits_string_type, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) >& equivalents, bool isnot, const re_detail::_narrow_type&);
|
||||
template re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::compile_set_aux(re_detail::jstack<reg_expression<BOOST_REGEX_CHAR_T>::traits_string_type, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) >& singles, re_detail::jstack<reg_expression<BOOST_REGEX_CHAR_T>::traits_string_type, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T)>& ranges, re_detail::jstack<boost::uint_fast32_t, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) >& classes, re_detail::jstack<reg_expression<BOOST_REGEX_CHAR_T>::traits_string_type, BOOST_DEFAULT_ALLOCATOR(BOOST_REGEX_CHAR_T) >& equivalents, bool isnot, const re_detail::_wide_type&);
|
||||
template re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot);
|
||||
template unsigned int BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::parse_inner_set(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last);
|
||||
template re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size);
|
||||
template re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::add_literal(re_detail::re_syntax_base* dat, BOOST_REGEX_CHAR_T c);
|
||||
template BOOST_REGEX_CHAR_T BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::parse_escape(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last);
|
||||
template void BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::parse_range(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last, unsigned& min, unsigned& max);
|
||||
template bool BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::skip_space(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last);
|
||||
template unsigned int BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::probe_restart(re_detail::re_syntax_base* dat);
|
||||
template unsigned int BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end);
|
||||
template void BOOST_REGEX_CALL reg_expression<BOOST_REGEX_CHAR_T>::fail(unsigned int err);
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
#define iterator const BOOST_REGEX_CHAR_T*
|
||||
#define Allocator match_results_base<iterator>::alloc_type
|
||||
#define size_type match_results_base<iterator>::size_type
|
||||
|
||||
template void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_first(iterator i);
|
||||
template void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_first(iterator i, std::size_t pos);
|
||||
template match_results_base<iterator, Allocator>::match_results_base(const Allocator& a);
|
||||
template Allocator BOOST_REGEX_CALL match_results_base<iterator, Allocator>::allocator()const;
|
||||
template void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::m_free();
|
||||
template bool match_results_base<iterator, Allocator>::operator==(const match_results_base<iterator, Allocator>& that)const;
|
||||
template void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_type n);
|
||||
template void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::set_size(size_type n, iterator i, iterator j);
|
||||
template void BOOST_REGEX_CALL match_results_base<iterator, Allocator>::cow();
|
||||
|
||||
#undef iterator
|
||||
#undef Allocator
|
||||
#undef size_type
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
# ifdef template
|
||||
# undef template
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
|
||||
|
||||
|
1633
include/boost/regex/v3/regex.hpp
Normal file
1633
include/boost/regex/v3/regex.hpp
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
131
include/boost/regex/v3/regex_cstring.hpp
Normal file
131
include/boost/regex/v3/regex_cstring.hpp
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_cstring.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: This is an internal header file, do not include directly.
|
||||
* String support and helper functions, for regular
|
||||
* expression library.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_CSTRING_HPP
|
||||
#define BOOST_REGEX_CSTRING_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
//
|
||||
// start by defining some template function aliases for C API functions:
|
||||
//
|
||||
|
||||
template <class charT>
|
||||
std::size_t BOOST_REGEX_CALL re_strlen(const charT *s)
|
||||
{
|
||||
std::size_t len = 0;
|
||||
while(*s)
|
||||
{
|
||||
++s;
|
||||
++len;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
inline std::size_t BOOST_REGEX_CALL re_strlen(const char *s)
|
||||
{
|
||||
return std::strlen(s);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
|
||||
inline std::size_t BOOST_REGEX_CALL re_strlen(const wchar_t *s)
|
||||
{
|
||||
return std::wcslen(s);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL re_transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
#endif
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CALL re_transform(std::string& out, const std::string& in);
|
||||
|
||||
template <class charT>
|
||||
void BOOST_REGEX_CALL re_trunc_primary(std::basic_string<charT>& s)
|
||||
{
|
||||
for(unsigned int i = 0; i < s.size(); ++i)
|
||||
{
|
||||
if(s[i] <= 1)
|
||||
{
|
||||
s.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline char* BOOST_REGEX_CALL re_strcpy(char *s1, const char *s2)
|
||||
{
|
||||
#if defined(__BORLANDC__) && defined(strcpy)
|
||||
return ::strcpy(s1, s2);
|
||||
#else
|
||||
return std::strcpy(s1, s2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
|
||||
inline wchar_t* BOOST_REGEX_CALL re_strcpy(wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
return std::wcscpy(s1, s2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template <class charT>
|
||||
charT* BOOST_REGEX_CALL re_strdup(const charT* p)
|
||||
{
|
||||
charT* buf = new charT[re_strlen(p) + 1];
|
||||
re_strcpy(buf, p);
|
||||
return buf;
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
inline void BOOST_REGEX_CALL re_strfree(charT* p)
|
||||
{
|
||||
delete[] p;
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option pop
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_CSTRING_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_format.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Provides formatting output routines for search and replace
|
||||
* operations. Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
@ -33,21 +29,18 @@ enum format_flags_t{
|
||||
format_sed = match_max << 1, // sed style replacement.
|
||||
format_perl = format_sed << 1, // perl style replacement.
|
||||
format_no_copy = format_perl << 1, // don't copy non-matching segments.
|
||||
format_is_if = format_no_copy << 1 // internal use only.
|
||||
format_first_only = format_no_copy << 1, // Only replace first occurance.
|
||||
format_is_if = format_first_only << 1 // internal use only.
|
||||
};
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve -w-8037
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc -w-8037
|
||||
#endif
|
||||
|
||||
template <class O, class I>
|
||||
O BOOST_RE_CALL re_copy_out(O out, I first, I last)
|
||||
O BOOST_REGEX_CALL re_copy_out(O out, I first, I last)
|
||||
{
|
||||
while(first != last)
|
||||
{
|
||||
@ -59,16 +52,20 @@ O BOOST_RE_CALL re_copy_out(O out, I first, I last)
|
||||
}
|
||||
|
||||
template <class charT, class traits_type>
|
||||
void BOOST_RE_CALL re_skip_format(const charT*& fmt, const traits_type& traits_inst)
|
||||
void BOOST_REGEX_CALL re_skip_format(const charT*& fmt, const traits_type& traits_inst)
|
||||
{
|
||||
// dwa 9/13/00 - suppress incorrect unused parameter warning for MSVC
|
||||
(void)traits_inst;
|
||||
|
||||
typedef typename traits_type::size_type traits_size_type;
|
||||
typedef typename traits_type::uchar_type traits_uchar_type;
|
||||
typedef typename traits_type::string_type traits_string_type;
|
||||
|
||||
unsigned int parens = 0;
|
||||
unsigned int c;
|
||||
while(*fmt)
|
||||
{
|
||||
c = traits_inst.syntax_type(*fmt);
|
||||
c = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt));
|
||||
if((c == traits_type::syntax_colon) && (parens == 0))
|
||||
{
|
||||
++fmt;
|
||||
@ -95,7 +92,7 @@ void BOOST_RE_CALL re_skip_format(const charT*& fmt, const traits_type& traits_i
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_RE_NO_OI_ASSIGN
|
||||
#ifdef BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
|
||||
|
||||
//
|
||||
// ugly hack for buggy output iterators
|
||||
@ -103,8 +100,8 @@ void BOOST_RE_CALL re_skip_format(const charT*& fmt, const traits_type& traits_i
|
||||
template <class T>
|
||||
inline void oi_assign(T* p, T v)
|
||||
{
|
||||
jm_destroy(p);
|
||||
jm_construct(p, v);
|
||||
::boost::re_detail::pointer_destroy(p);
|
||||
pointer_construct(p, v);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -115,15 +112,15 @@ inline void oi_assign(T* p, T v)
|
||||
//
|
||||
// if you get a compile time error in here then you either
|
||||
// need to rewrite your output iterator to make it assignable
|
||||
// (as is required by the standard), or define BOOST_RE_NO_OI_ASSIGN
|
||||
// to use the ugly hack above
|
||||
// (as is required by the standard), or define
|
||||
// BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN to use the ugly hack above
|
||||
*p = v;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
|
||||
//
|
||||
// Ugly ugly hack,
|
||||
// template don't merge if they contain switch statements so declare these
|
||||
@ -139,18 +136,22 @@ namespace{
|
||||
// is sent to an OutputIterator,
|
||||
// _reg_format_aux does the actual work:
|
||||
//
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT, class traits_type>
|
||||
OutputIterator BOOST_RE_CALL _reg_format_aux(OutputIterator out,
|
||||
const match_results<iterator, Allocator>& m,
|
||||
template <class OutputIterator, class Iterator, class Allocator, class charT, class traits_type>
|
||||
OutputIterator BOOST_REGEX_CALL _reg_format_aux(OutputIterator out,
|
||||
const match_results<Iterator, Allocator>& m,
|
||||
const charT*& fmt,
|
||||
unsigned flags, const traits_type& traits_inst)
|
||||
{
|
||||
const charT* fmt_end = fmt;
|
||||
while(*fmt_end) ++ fmt_end;
|
||||
|
||||
typedef typename traits_type::size_type traits_size_type;
|
||||
typedef typename traits_type::uchar_type traits_uchar_type;
|
||||
typedef typename traits_type::string_type traits_string_type;
|
||||
|
||||
while(*fmt)
|
||||
{
|
||||
switch(traits_inst.syntax_type(*fmt))
|
||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||
{
|
||||
case traits_type::syntax_dollar:
|
||||
if(flags & format_sed)
|
||||
@ -167,28 +168,28 @@ OutputIterator BOOST_RE_CALL _reg_format_aux(OutputIterator out,
|
||||
++out;
|
||||
return out;
|
||||
}
|
||||
switch(traits_inst.syntax_type(*fmt))
|
||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||
{
|
||||
case traits_type::syntax_start_buffer:
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[-1].first), iterator(m[-1].second)));
|
||||
oi_assign(&out, re_copy_out(out, Iterator(m[-1].first), Iterator(m[-1].second)));
|
||||
++fmt;
|
||||
continue;
|
||||
case traits_type::syntax_end_buffer:
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[-2].first), iterator(m[-2].second)));
|
||||
oi_assign(&out, re_copy_out(out, Iterator(m[-2].first), Iterator(m[-2].second)));
|
||||
++fmt;
|
||||
continue;
|
||||
case traits_type::syntax_digit:
|
||||
{
|
||||
expand_sub:
|
||||
unsigned int index = traits_inst.toi(fmt, fmt_end, 10);
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[index].first), iterator(m[index].second)));
|
||||
oi_assign(&out, re_copy_out(out, Iterator(m[index].first), Iterator(m[index].second)));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// anything else:
|
||||
if(*fmt == '&')
|
||||
{
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second)));
|
||||
oi_assign(&out, re_copy_out(out, Iterator(m[0].first), Iterator(m[0].second)));
|
||||
++fmt;
|
||||
}
|
||||
else
|
||||
@ -213,7 +214,7 @@ expand_sub:
|
||||
++fmt;
|
||||
return out;
|
||||
}
|
||||
switch(traits_inst.syntax_type(*fmt))
|
||||
switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
|
||||
{
|
||||
case traits_type::syntax_a:
|
||||
c = '\a';
|
||||
@ -248,7 +249,7 @@ expand_sub:
|
||||
return out;
|
||||
}
|
||||
// maybe have \x{ddd}
|
||||
if(traits_inst.syntax_type(*fmt) == traits_type::syntax_open_brace)
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) == traits_type::syntax_open_brace)
|
||||
{
|
||||
++fmt;
|
||||
if(fmt == fmt_end)
|
||||
@ -268,9 +269,9 @@ expand_sub:
|
||||
continue;
|
||||
}
|
||||
c = (charT)traits_inst.toi(fmt, fmt_end, -16);
|
||||
if(traits_inst.syntax_type(*fmt) != traits_type::syntax_close_brace)
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_close_brace)
|
||||
{
|
||||
while(traits_inst.syntax_type(*fmt) != traits_type::syntax_slash)
|
||||
while(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_slash)
|
||||
--fmt;
|
||||
++fmt;
|
||||
*out = *fmt;
|
||||
@ -394,13 +395,13 @@ expand_sub:
|
||||
if(m[id].matched)
|
||||
{
|
||||
oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst));
|
||||
if(traits_inst.syntax_type(*(fmt-1)) == traits_type::syntax_colon)
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon)
|
||||
re_skip_format(fmt, traits_inst);
|
||||
}
|
||||
else
|
||||
{
|
||||
re_skip_format(fmt, traits_inst);
|
||||
if(traits_inst.syntax_type(*(fmt-1)) == traits_type::syntax_colon)
|
||||
if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon)
|
||||
oi_assign(&out, _reg_format_aux(out, m, fmt, flags | format_is_if, traits_inst));
|
||||
}
|
||||
return out;
|
||||
@ -410,7 +411,7 @@ expand_sub:
|
||||
default_opt:
|
||||
if((flags & format_sed) && (*fmt == '&'))
|
||||
{
|
||||
oi_assign(&out, re_copy_out(out, iterator(m[0].first), iterator(m[0].second)));
|
||||
oi_assign(&out, re_copy_out(out, Iterator(m[0].first), Iterator(m[0].second)));
|
||||
++fmt;
|
||||
continue;
|
||||
}
|
||||
@ -423,7 +424,7 @@ default_opt:
|
||||
return out;
|
||||
}
|
||||
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
@ -443,36 +444,36 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class OutputIterator, class iterator, class charT, class Allocator, class traits_type>
|
||||
template <class OutputIterator, class Iterator, class charT, class Allocator, class traits_type>
|
||||
class merge_out_predicate
|
||||
{
|
||||
OutputIterator* out;
|
||||
iterator* last;
|
||||
Iterator* last;
|
||||
const charT* fmt;
|
||||
unsigned flags;
|
||||
const traits_type* pt;
|
||||
|
||||
public:
|
||||
merge_out_predicate(OutputIterator& o, iterator& pi, const charT* f, unsigned format_flags, const traits_type& p)
|
||||
merge_out_predicate(OutputIterator& o, Iterator& pi, const charT* f, unsigned format_flags, const traits_type& p)
|
||||
: out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){}
|
||||
|
||||
~merge_out_predicate() {}
|
||||
bool BOOST_RE_CALL operator()(const boost::match_results<iterator, Allocator>& m)
|
||||
bool BOOST_REGEX_CALL operator()(const boost::match_results<Iterator, Allocator>& m)
|
||||
{
|
||||
const charT* f = fmt;
|
||||
if(0 == (flags & format_no_copy))
|
||||
oi_assign(out, re_copy_out(*out, iterator(m[-1].first), iterator(m[-1].second)));
|
||||
oi_assign(out, re_copy_out(*out, Iterator(m[-1].first), Iterator(m[-1].second)));
|
||||
oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt));
|
||||
*last = m[-2].first;
|
||||
return true;
|
||||
return flags & format_first_only ? false : true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
||||
template <class OutputIterator, class Iterator, class Allocator, class charT>
|
||||
OutputIterator regex_format(OutputIterator out,
|
||||
const match_results<iterator, Allocator>& m,
|
||||
const match_results<Iterator, Allocator>& m,
|
||||
const charT* fmt,
|
||||
unsigned flags = 0
|
||||
)
|
||||
@ -481,9 +482,9 @@ OutputIterator regex_format(OutputIterator out,
|
||||
return re_detail::_reg_format_aux(out, m, fmt, flags, t);
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class Allocator, class charT>
|
||||
template <class OutputIterator, class Iterator, class Allocator, class charT>
|
||||
OutputIterator regex_format(OutputIterator out,
|
||||
const match_results<iterator, Allocator>& m,
|
||||
const match_results<Iterator, Allocator>& m,
|
||||
const std::basic_string<charT>& fmt,
|
||||
unsigned flags = 0
|
||||
)
|
||||
@ -493,8 +494,8 @@ OutputIterator regex_format(OutputIterator out,
|
||||
return re_detail::_reg_format_aux(out, m, start, flags, t);
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_format(const match_results<iterator, Allocator>& m, const charT* fmt, unsigned flags = 0)
|
||||
template <class Iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_format(const match_results<Iterator, Allocator>& m, const charT* fmt, unsigned flags = 0)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
@ -502,8 +503,8 @@ std::basic_string<charT> regex_format(const match_results<iterator, Allocator>&
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_format(const match_results<iterator, Allocator>& m, const std::basic_string<charT>& fmt, unsigned flags = 0)
|
||||
template <class Iterator, class Allocator, class charT>
|
||||
std::basic_string<charT> regex_format(const match_results<Iterator, Allocator>& m, const std::basic_string<charT>& fmt, unsigned flags = 0)
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
||||
@ -511,24 +512,24 @@ std::basic_string<charT> regex_format(const match_results<iterator, Allocator>&
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
||||
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
||||
OutputIterator regex_merge(OutputIterator out,
|
||||
iterator first,
|
||||
iterator last,
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const charT* fmt,
|
||||
unsigned int flags = match_default)
|
||||
{
|
||||
iterator l = first;
|
||||
re_detail::merge_out_predicate<OutputIterator, iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
||||
Iterator l = first;
|
||||
re_detail::merge_out_predicate<OutputIterator, Iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
||||
regex_grep(oi, first, last, e, flags);
|
||||
return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last);
|
||||
}
|
||||
|
||||
template <class OutputIterator, class iterator, class traits, class Allocator, class charT>
|
||||
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
||||
inline OutputIterator regex_merge(OutputIterator out,
|
||||
iterator first,
|
||||
iterator last,
|
||||
Iterator first,
|
||||
Iterator last,
|
||||
const reg_expression<charT, traits, Allocator>& e,
|
||||
const std::basic_string<charT>& fmt,
|
||||
unsigned int flags = match_default)
|
||||
@ -561,9 +562,7 @@ std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
@ -573,3 +572,5 @@ std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
|
||||
|
||||
|
||||
|
||||
|
||||
|
67
include/boost/regex/v3/regex_fwd.hpp
Normal file
67
include/boost/regex/v3/regex_fwd.hpp
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_fwd.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Forward declares boost::reg_expression<> and
|
||||
* associated typedefs.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_FWD_HPP_INCLUDED
|
||||
#define BOOST_REGEX_FWD_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
#include <boost/regex/config/allocator.hpp>
|
||||
|
||||
//
|
||||
// define BOOST_REGEX_NO_FWD if this
|
||||
// header doesn't work!
|
||||
//
|
||||
#ifdef BOOST_REGEX_NO_FWD
|
||||
# ifndef BOOST_RE_REGEX_HPP
|
||||
# include <boost/regex.hpp>
|
||||
# endif
|
||||
#else
|
||||
|
||||
//
|
||||
// If there isn't good enough wide character support then there will
|
||||
// be no wide character regular expressions:
|
||||
//
|
||||
#if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING)) && !defined(BOOST_NO_WREGEX)
|
||||
# define BOOST_NO_WREGEX
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
template <class charT>
|
||||
class regex_traits;
|
||||
|
||||
template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
||||
class reg_expression;
|
||||
|
||||
typedef reg_expression<char, regex_traits<char>, BOOST_DEFAULT_ALLOCATOR(char) > regex;
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
typedef reg_expression<wchar_t, regex_traits<wchar_t>, BOOST_DEFAULT_ALLOCATOR(wchar_t) > wregex;
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_NO_FWD
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_kmp.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Provides Knuth Morris Pratt search operations.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
@ -26,7 +22,7 @@
|
||||
#define BOOST_REGEX_KMP_HPP
|
||||
|
||||
#ifdef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
@ -34,11 +30,7 @@ namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
template <class charT>
|
||||
@ -51,29 +43,30 @@ struct kmp_info
|
||||
};
|
||||
|
||||
template <class charT, class Allocator>
|
||||
void kmp_free(kmp_info<charT>* pinfo, Allocator a)
|
||||
void kmp_free(kmp_info<charT>* pinfo, const Allocator& a)
|
||||
{
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype;
|
||||
atype(a).deallocate((char*)pinfo, pinfo->size);
|
||||
typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype;
|
||||
atype(a).deallocate(reinterpret_cast<char*>(pinfo), pinfo->size);
|
||||
}
|
||||
|
||||
template <class iterator, class charT, class Trans, class Allocator>
|
||||
kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans translate, Allocator a)
|
||||
kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans translate, const Allocator& a)
|
||||
{
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) atype;
|
||||
typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype;
|
||||
int i, j, m;
|
||||
i = 0;
|
||||
BOOST_RE_DISTANCE(first, last, m);
|
||||
m = static_cast<int>(boost::re_detail::distance(first, last));
|
||||
++m;
|
||||
unsigned int size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m;
|
||||
--m;
|
||||
//
|
||||
// allocate struct and fill it in:
|
||||
//
|
||||
kmp_info<charT>* pinfo = (kmp_info<charT>*)atype(a).allocate(size);
|
||||
kmp_info<charT>* pinfo = reinterpret_cast<kmp_info<charT>*>(atype(a).allocate(size));
|
||||
BOOST_REGEX_NOEH_ASSERT(pinfo)
|
||||
pinfo->size = size;
|
||||
pinfo->len = m;
|
||||
charT* p = (charT*)((char*)pinfo + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
|
||||
charT* p = reinterpret_cast<charT*>(reinterpret_cast<char*>(pinfo) + sizeof(kmp_info<charT>) + sizeof(int)*(m+1));
|
||||
pinfo->pstr = p;
|
||||
while(first != last)
|
||||
{
|
||||
@ -102,9 +95,7 @@ kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans transla
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namepsace re_detail
|
||||
@ -115,4 +106,3 @@ kmp_info<charT>* kmp_compile(iterator first, iterator last, charT, Trans transla
|
||||
|
||||
|
||||
|
||||
|
181
include/boost/regex/v3/regex_library_include.hpp
Normal file
181
include/boost/regex/v3/regex_library_include.hpp
Normal file
@ -0,0 +1,181 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_libary_include.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
|
||||
Libraries for Borland and Microsoft compilers are automatically
|
||||
selected here, the name of the lib is selected according to the following
|
||||
formula:
|
||||
|
||||
BOOST_LIB_NAME
|
||||
+ "_"
|
||||
+ BOOST_LIB_TOOLSET
|
||||
+ "_"
|
||||
+ BOOST_LIB_THREAD_OPT
|
||||
+ BOOST_LIB_RT_OPT
|
||||
+ BOOST_LIB_LINK_OPT
|
||||
+ BOOST_LIB_DEBUG_OPT
|
||||
|
||||
These are defined as:
|
||||
|
||||
BOOST_LIB_NAME: The base name of the lib (boost_regex).
|
||||
|
||||
BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
|
||||
|
||||
BOOST_LIB_THREAD_OPT: "s" for single thread builds,
|
||||
"m" for multithread builds.
|
||||
|
||||
BOOST_LIB_RT_OPT: "s" for static runtime,
|
||||
"d" for dynamic runtime.
|
||||
|
||||
BOOST_LIB_LINK_OPT: "s" for static link,
|
||||
"i" for dynamic link.
|
||||
|
||||
BOOST_LIB_DEBUG_OPT: nothing for release builds,
|
||||
"d" for debug builds,
|
||||
"dd" for debug-diagnostic builds (_STLP_DEBUG).
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#if !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_REGEX_NO_LIB)
|
||||
#define BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
|
||||
#define BOOST_LIB_NAME "boost_regex"
|
||||
|
||||
//
|
||||
// select toolset:
|
||||
//
|
||||
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
|
||||
// vc6-stlport:
|
||||
# define BOOST_LIB_TOOLSET "vc6-stlport"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1200)
|
||||
|
||||
// vc6:
|
||||
# define BOOST_LIB_TOOLSET "vc6"
|
||||
|
||||
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1300)
|
||||
|
||||
// vc7:
|
||||
# define BOOST_LIB_TOOLSET "vc7"
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x560)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb6"
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb5"
|
||||
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x540)
|
||||
|
||||
// CBuilder 6:
|
||||
# define BOOST_LIB_TOOLSET "bcb4"
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// select thread opt:
|
||||
//
|
||||
#if defined(_MT) || defined(__MT__)
|
||||
# define BOOST_LIB_THREAD_OPT "m"
|
||||
#else
|
||||
# define BOOST_LIB_THREAD_OPT "s"
|
||||
#endif
|
||||
|
||||
//
|
||||
// select runtime opt:
|
||||
//
|
||||
#if defined(_DLL) || defined(_RTLDLL)
|
||||
# define BOOST_LIB_RT_OPT "d"
|
||||
#else
|
||||
# define BOOST_LIB_RT_OPT "s"
|
||||
#endif
|
||||
|
||||
//
|
||||
// select linkage opt:
|
||||
//
|
||||
#if (defined(_DLL) || defined(_RTLDLL)) && !defined(BOOST_REGEX_STATIC_LINK)
|
||||
# define BOOST_LIB_LINK_OPT "i"
|
||||
#else
|
||||
# define BOOST_LIB_LINK_OPT "s"
|
||||
#endif
|
||||
|
||||
//
|
||||
// select debug opt:
|
||||
//
|
||||
#if defined(BOOST_MSVC) && defined(_DEBUG) && (defined(_STLP_DEBUG) || defined(__STL_DEBUG))
|
||||
# define BOOST_LIB_DEBUG_OPT "dd"
|
||||
#elif defined(BOOST_MSVC) && defined(_DEBUG)
|
||||
# define BOOST_LIB_DEBUG_OPT "d"
|
||||
#elif defined(__BORLANDC__) && (__BORLANDC__ == 0x560) && (defined(_STLP_DEBUG) || defined(__STL_DEBUG))
|
||||
# define BOOST_LIB_DEBUG_OPT "dd"
|
||||
#else
|
||||
# define BOOST_LIB_DEBUG_OPT
|
||||
#endif
|
||||
|
||||
//
|
||||
// now include the lib:
|
||||
//
|
||||
#if defined(BOOST_LIB_NAME) \
|
||||
&& defined(BOOST_LIB_TOOLSET) \
|
||||
&& defined(BOOST_LIB_THREAD_OPT) \
|
||||
&& defined(BOOST_LIB_RT_OPT) \
|
||||
&& defined(BOOST_LIB_LINK_OPT) \
|
||||
&& defined(BOOST_LIB_DEBUG_OPT)
|
||||
|
||||
# pragma comment(lib, BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_LINK_OPT BOOST_LIB_DEBUG_OPT ".lib")
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// finally undef any macros we may have set:
|
||||
//
|
||||
#if defined(BOOST_LIB_NAME)
|
||||
# undef BOOST_LIB_NAME
|
||||
#endif
|
||||
#if defined(BOOST_LIB_TOOLSET)
|
||||
# undef BOOST_LIB_TOOLSET
|
||||
#endif
|
||||
#if defined(BOOST_LIB_THREAD_OPT)
|
||||
# undef BOOST_LIB_THREAD_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_RT_OPT)
|
||||
# undef BOOST_LIB_RT_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_LINK_OPT)
|
||||
# undef BOOST_LIB_LINK_OPT
|
||||
#endif
|
||||
#if defined(BOOST_LIB_DEBUG_OPT)
|
||||
# undef BOOST_LIB_DEBUG_OPT
|
||||
#endif
|
||||
|
||||
|
||||
#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_match.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Regular expression matching algorithms.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
@ -26,25 +22,57 @@
|
||||
#ifndef BOOST_REGEX_MATCH_HPP
|
||||
#define BOOST_REGEX_MATCH_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_MAX_STATE_COUNT
|
||||
# define BOOST_REGEX_MAX_STATE_COUNT 100000000
|
||||
#endif
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc -w-8026 -w-8027
|
||||
#endif
|
||||
|
||||
//
|
||||
// Unfortunately Rogue Waves standard library appears to have a bug
|
||||
// in std::basic_string::compare that results in eroneous answers
|
||||
// in some cases (tested with Borland C++ 5.1, Rogue Wave lib version
|
||||
// 0x020101) the test case was:
|
||||
// {39135,0} < {0xff,0}
|
||||
// which succeeds when it should not.
|
||||
//
|
||||
#ifndef _RWSTD_VER
|
||||
# define STR_COMP(s,p) s.compare(p)
|
||||
#else
|
||||
template <class C, class T, class A>
|
||||
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
|
||||
{ return s.compare(p); }
|
||||
inline int string_compare(const std::string& s, const char* p)
|
||||
{ return std::strcmp(s.c_str(), p); }
|
||||
# ifndef BOOST_NO_WREGEX
|
||||
inline int string_compare(const std::wstring& s, const wchar_t* p)
|
||||
{ return std::wcscmp(s.c_str(), p); }
|
||||
# endif
|
||||
# define STR_COMP(s,p) string_compare(s,p)
|
||||
#endif
|
||||
|
||||
template<class charT>
|
||||
inline const charT* re_skip_past_null(const charT* p)
|
||||
{
|
||||
while (*p != 0) ++p;
|
||||
return ++p;
|
||||
}
|
||||
|
||||
template <class iterator, class charT, class traits_type, class Allocator>
|
||||
iterator BOOST_RE_CALL re_is_set_member(iterator next,
|
||||
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
|
||||
iterator last,
|
||||
re_set_long* set_,
|
||||
const re_set_long* set_,
|
||||
const reg_expression<charT, traits_type, Allocator>& e)
|
||||
{
|
||||
const charT* p = (const charT*)(set_+1);
|
||||
const charT* p = reinterpret_cast<const charT*>(set_+1);
|
||||
iterator ptr;
|
||||
unsigned int i;
|
||||
bool icase = e.flags() & regbase::icase;
|
||||
@ -86,8 +114,7 @@ iterator BOOST_RE_CALL re_is_set_member(iterator next,
|
||||
if(*p == 0) // if null we've matched
|
||||
return set_->isnot ? next : (ptr == next) ? ++next : ptr;
|
||||
|
||||
while(*p)++p;
|
||||
++p; // skip null
|
||||
p = re_skip_past_null(p); // skip null
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,11 +135,11 @@ iterator BOOST_RE_CALL re_is_set_member(iterator next,
|
||||
traits_inst.transform(s1, s2);
|
||||
for(i = 0; i < set_->cranges; ++i)
|
||||
{
|
||||
if(s1 <= p)
|
||||
if(STR_COMP(s1, p) <= 0)
|
||||
{
|
||||
while(*p)++p;
|
||||
++p;
|
||||
if(s1 >= p)
|
||||
if(STR_COMP(s1, p) >= 0)
|
||||
return set_->isnot ? next : ++next;
|
||||
}
|
||||
else
|
||||
@ -133,7 +160,7 @@ iterator BOOST_RE_CALL re_is_set_member(iterator next,
|
||||
traits_inst.transform_primary(s1, s2);
|
||||
for(i = 0; i < set_->cequivalents; ++i)
|
||||
{
|
||||
if(s1 == p)
|
||||
if(STR_COMP(s1, p) == 0)
|
||||
return set_->isnot ? next : ++next;
|
||||
// skip string
|
||||
while(*p)++p;
|
||||
@ -150,8 +177,9 @@ template <class iterator, class Allocator>
|
||||
class _priv_match_data
|
||||
{
|
||||
public:
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(int, Allocator) i_alloc;
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(iterator, Allocator) it_alloc;
|
||||
typedef typename boost::detail::rebind_allocator<int, Allocator>::type i_alloc;
|
||||
typedef typename boost::detail::rebind_allocator<iterator, Allocator>::type it_alloc;
|
||||
typedef typename regex_iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
match_results_base<iterator, Allocator> temp_match;
|
||||
// failure stacks:
|
||||
@ -161,15 +189,17 @@ public:
|
||||
jstack<int, Allocator> prev_acc;
|
||||
int* accumulators;
|
||||
unsigned int caccumulators;
|
||||
difference_type state_count;
|
||||
difference_type max_state_count;
|
||||
iterator* loop_starts;
|
||||
|
||||
_priv_match_data(const match_results_base<iterator, Allocator>&);
|
||||
_priv_match_data(const match_results_base<iterator, Allocator>&, iterator, iterator, std::size_t);
|
||||
|
||||
~_priv_match_data()
|
||||
{
|
||||
free();
|
||||
m_free();
|
||||
}
|
||||
void free();
|
||||
void m_free();
|
||||
void set_accumulator_size(unsigned int size);
|
||||
int* get_accumulators()
|
||||
{
|
||||
@ -179,15 +209,34 @@ public:
|
||||
{
|
||||
return loop_starts;
|
||||
}
|
||||
void estimate_max_state_count(iterator a, iterator b, std::size_t states, std::random_access_iterator_tag*)
|
||||
{
|
||||
difference_type dist = boost::re_detail::distance(a,b);
|
||||
states *= states;
|
||||
difference_type lim = (std::numeric_limits<difference_type>::max)() - 1000 - states;
|
||||
if(dist > (difference_type)(lim / states))
|
||||
max_state_count = lim;
|
||||
else
|
||||
max_state_count = 1000 + states * dist;
|
||||
}
|
||||
void estimate_max_state_count(iterator a, iterator b, std::size_t states, void*)
|
||||
{
|
||||
// we don't know how long the sequence is:
|
||||
max_state_count = BOOST_REGEX_MAX_STATE_COUNT;
|
||||
}
|
||||
};
|
||||
|
||||
template <class iterator, class Allocator>
|
||||
_priv_match_data<iterator, Allocator>::_priv_match_data(const match_results_base<iterator, Allocator>& m)
|
||||
_priv_match_data<iterator, Allocator>::_priv_match_data(const match_results_base<iterator, Allocator>& m, iterator a, iterator b, std::size_t states)
|
||||
: temp_match(m), matches(64, m.allocator()), prev_pos(64, m.allocator()), prev_record(64, m.allocator())
|
||||
{
|
||||
typedef typename regex_iterator_traits<iterator>::iterator_category category;
|
||||
|
||||
accumulators = 0;
|
||||
caccumulators = 0;
|
||||
loop_starts = 0;
|
||||
state_count = 0;
|
||||
estimate_max_state_count(a, b, states, static_cast<category*>(0));
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator>
|
||||
@ -195,26 +244,26 @@ void _priv_match_data<iterator, Allocator>::set_accumulator_size(unsigned int si
|
||||
{
|
||||
if(size > caccumulators)
|
||||
{
|
||||
free();
|
||||
m_free();
|
||||
caccumulators = size;
|
||||
accumulators = i_alloc(temp_match.allocator()).allocate(caccumulators);
|
||||
BOOST_REGEX_NOEH_ASSERT(accumulators)
|
||||
loop_starts = it_alloc(temp_match.allocator()).allocate(caccumulators);
|
||||
BOOST_REGEX_NOEH_ASSERT(loop_starts)
|
||||
for(unsigned i = 0; i < caccumulators; ++i)
|
||||
new (loop_starts + i) iterator();
|
||||
}
|
||||
}
|
||||
|
||||
template <class iterator, class Allocator>
|
||||
void _priv_match_data<iterator, Allocator>::free()
|
||||
void _priv_match_data<iterator, Allocator>::m_free()
|
||||
{
|
||||
if(caccumulators)
|
||||
{
|
||||
//REBIND_INSTANCE(int, Allocator, temp_match.allocator()).deallocate(accumulators, caccumulators);
|
||||
i_alloc temp1(temp_match.allocator());
|
||||
temp1.deallocate(accumulators, caccumulators);
|
||||
for(unsigned i = 0; i < caccumulators; ++i)
|
||||
jm_destroy(loop_starts + i);
|
||||
//REBIND_INSTANCE(iterator, Allocator, temp_match.allocator()).deallocate(loop_starts, caccumulators);
|
||||
::boost::re_detail::pointer_destroy(loop_starts + i);
|
||||
it_alloc temp2(temp_match.allocator());
|
||||
temp2.deallocate(loop_starts, caccumulators);
|
||||
}
|
||||
@ -237,7 +286,7 @@ struct access_t : public reg_expression<charT, traits, Allocator>
|
||||
{ return base_type::first(b); }
|
||||
static const unsigned char* get_map(const base_type& b)
|
||||
{ return base_type::get_map(b); }
|
||||
static unsigned int leading_length(const base_type& b)
|
||||
static std::size_t leading_length(const base_type& b)
|
||||
{ return base_type::leading_length(b); }
|
||||
static const kmp_info<charT>* get_kmp(const base_type& b)
|
||||
{ return base_type::get_kmp(b); }
|
||||
@ -248,7 +297,7 @@ struct access_t : public reg_expression<charT, traits, Allocator>
|
||||
};
|
||||
|
||||
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
|
||||
//
|
||||
// Ugly ugly hack,
|
||||
// template don't merge if they contain switch statements so declare these
|
||||
@ -274,6 +323,7 @@ bool query_match_aux(iterator first,
|
||||
typedef typename traits::size_type traits_size_type;
|
||||
typedef typename traits::uchar_type traits_uchar_type;
|
||||
typedef typename is_byte<charT>::width_type width_type;
|
||||
typedef typename re_detail::regex_iterator_traits<iterator>::difference_type difference_type;
|
||||
|
||||
// declare some local aliases to reduce pointer loads
|
||||
// good optimising compilers should make this unnecessary!!
|
||||
@ -283,10 +333,12 @@ bool query_match_aux(iterator first,
|
||||
jstack<int, Allocator>& prev_acc = pd.prev_acc;
|
||||
match_results_base<iterator, Allocator>& temp_match = pd.temp_match;
|
||||
temp_match.set_first(first);
|
||||
difference_type& state_count = pd.state_count;
|
||||
|
||||
const re_syntax_base* ptr = access::first(e);
|
||||
bool match_found = false;
|
||||
bool have_partial_match = false;
|
||||
bool unwind_stack = false;
|
||||
bool need_push_match = (e.mark_count() > 1);
|
||||
int cur_acc = -1; // no active accumulator
|
||||
pd.set_accumulator_size(access::repeat_count(e));
|
||||
@ -313,6 +365,7 @@ bool query_match_aux(iterator first,
|
||||
while(first != last)
|
||||
{
|
||||
jm_assert(ptr);
|
||||
++state_count;
|
||||
switch(ptr->type)
|
||||
{
|
||||
case syntax_element_match:
|
||||
@ -322,6 +375,8 @@ bool query_match_aux(iterator first,
|
||||
// longer one.
|
||||
if((flags & match_not_null) && (first == temp_match[0].first))
|
||||
goto failure;
|
||||
if((flags & match_all) && (first != last))
|
||||
goto failure;
|
||||
temp_match.set_second(first);
|
||||
m.maybe_assign(temp_match);
|
||||
match_found = true;
|
||||
@ -342,19 +397,52 @@ bool query_match_aux(iterator first,
|
||||
}
|
||||
goto failure;
|
||||
case syntax_element_startmark:
|
||||
if(((re_brace*)ptr)->index > 0)
|
||||
temp_match.set_first(first, ((re_brace*)ptr)->index);
|
||||
start_mark_jump:
|
||||
if(static_cast<const re_brace*>(ptr)->index > 0)
|
||||
{
|
||||
temp_match.set_first(first, static_cast<const re_brace*>(ptr)->index);
|
||||
}
|
||||
else if(
|
||||
(static_cast<const re_brace*>(ptr)->index == -1)
|
||||
|| (static_cast<const re_brace*>(ptr)->index == -2)
|
||||
)
|
||||
{
|
||||
matches.push(temp_match);
|
||||
for(k = 0; k <= cur_acc; ++k)
|
||||
prev_pos.push(start_loop[k]);
|
||||
prev_pos.push(first);
|
||||
prev_record.push(ptr);
|
||||
for(k = 0; k <= cur_acc; ++k)
|
||||
prev_acc.push(accumulators[k]);
|
||||
prev_acc.push(cur_acc);
|
||||
prev_acc.push(match_found);
|
||||
match_found = false;
|
||||
// skip next jump and fall through:
|
||||
ptr = ptr->next.p;
|
||||
}
|
||||
ptr = ptr->next.p;
|
||||
break;
|
||||
case syntax_element_endmark:
|
||||
if(((re_brace*)ptr)->index > 0)
|
||||
temp_match.set_second(first, ((re_brace*)ptr)->index);
|
||||
end_mark_jump:
|
||||
if(static_cast<const re_brace*>(ptr)->index > 0)
|
||||
{
|
||||
temp_match.set_second(first, static_cast<const re_brace*>(ptr)->index);
|
||||
}
|
||||
else if(
|
||||
(static_cast<const re_brace*>(ptr)->index == -1)
|
||||
|| (static_cast<const re_brace*>(ptr)->index == -2)
|
||||
)
|
||||
{
|
||||
match_found = true;
|
||||
unwind_stack = true;
|
||||
goto failure;
|
||||
}
|
||||
ptr = ptr->next.p;
|
||||
break;
|
||||
case syntax_element_literal:
|
||||
{
|
||||
unsigned int len = ((re_literal*)ptr)->length;
|
||||
charT* what = (charT*)(((re_literal*)ptr) + 1);
|
||||
unsigned int len = static_cast<const re_literal*>(ptr)->length;
|
||||
const charT* what = reinterpret_cast<const charT*>(static_cast<const re_literal*>(ptr) + 1);
|
||||
//
|
||||
// compare string with what we stored in
|
||||
// our records:
|
||||
@ -436,7 +524,11 @@ bool query_match_aux(iterator first,
|
||||
case syntax_element_word_boundary:
|
||||
{
|
||||
// prev and this character must be opposites:
|
||||
#if defined(BOOST_REGEX_USE_C_LOCALE) && defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
|
||||
bool b = traits::is_class(*first, traits::char_class_word);
|
||||
#else
|
||||
bool b = traits_inst.is_class(*first, traits::char_class_word);
|
||||
#endif
|
||||
if((first == temp_match[0].first) && ((flags & match_prev_avail) == 0))
|
||||
{
|
||||
if(flags & match_not_bow)
|
||||
@ -533,8 +625,8 @@ bool query_match_aux(iterator first,
|
||||
case syntax_element_backref:
|
||||
{
|
||||
// compare with what we previously matched:
|
||||
iterator i = temp_match[((re_brace*)ptr)->index].first;
|
||||
iterator j = temp_match[((re_brace*)ptr)->index].second;
|
||||
iterator i = temp_match[static_cast<const re_brace*>(ptr)->index].first;
|
||||
iterator j = temp_match[static_cast<const re_brace*>(ptr)->index].second;
|
||||
while(i != j)
|
||||
{
|
||||
if((first == last) || (traits_inst.translate(*first, icase) != traits_inst.translate(*i, icase)))
|
||||
@ -548,7 +640,7 @@ bool query_match_aux(iterator first,
|
||||
case syntax_element_long_set:
|
||||
{
|
||||
// let the traits class do the work:
|
||||
iterator t = re_is_set_member(first, last, (re_set_long*)ptr, e);
|
||||
iterator t = re_is_set_member(first, last, static_cast<const re_set_long*>(ptr), e);
|
||||
if(t != first)
|
||||
{
|
||||
ptr = ptr->next.p;
|
||||
@ -559,7 +651,7 @@ bool query_match_aux(iterator first,
|
||||
}
|
||||
case syntax_element_set:
|
||||
// lookup character in table:
|
||||
if(((re_set*)ptr)->_map[(traits_uchar_type)traits_inst.translate(*first, icase)])
|
||||
if(static_cast<const re_set*>(ptr)->_map[(traits_uchar_type)traits_inst.translate(*first, icase)])
|
||||
{
|
||||
ptr = ptr->next.p;
|
||||
++first;
|
||||
@ -567,16 +659,16 @@ bool query_match_aux(iterator first,
|
||||
}
|
||||
goto failure;
|
||||
case syntax_element_jump:
|
||||
ptr = ((re_jump*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_jump*>(ptr)->alt.p;
|
||||
continue;
|
||||
case syntax_element_alt:
|
||||
{
|
||||
// alt_jump:
|
||||
if(access::can_start(*first, ((re_jump*)ptr)->_map, (unsigned char)mask_take))
|
||||
if(access::can_start(*first, static_cast<const re_jump*>(ptr)->_map, (unsigned char)mask_take))
|
||||
{
|
||||
// we can take the first alternative,
|
||||
// see if we need to push next alternative:
|
||||
if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip))
|
||||
if(access::can_start(*first, static_cast<const re_jump*>(ptr)->_map, mask_skip))
|
||||
{
|
||||
if(need_push_match)
|
||||
matches.push(temp_match);
|
||||
@ -591,9 +683,9 @@ bool query_match_aux(iterator first,
|
||||
ptr = ptr->next.p;
|
||||
continue;
|
||||
}
|
||||
if(access::can_start(*first, ((re_jump*)ptr)->_map, mask_skip))
|
||||
if(access::can_start(*first, static_cast<const re_jump*>(ptr)->_map, mask_skip))
|
||||
{
|
||||
ptr = ((re_jump*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_jump*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
goto failure; // neither option is possible
|
||||
@ -603,16 +695,16 @@ bool query_match_aux(iterator first,
|
||||
// repeater_jump:
|
||||
// if we're moving to a higher id (nested repeats etc)
|
||||
// zero out our accumualtors:
|
||||
if(cur_acc < ((re_repeat*)ptr)->id)
|
||||
if(cur_acc < static_cast<const re_repeat*>(ptr)->id)
|
||||
{
|
||||
cur_acc = ((re_repeat*)ptr)->id;
|
||||
cur_acc = static_cast<const re_repeat*>(ptr)->id;
|
||||
accumulators[cur_acc] = 0;
|
||||
start_loop[cur_acc] = first;
|
||||
}
|
||||
|
||||
cur_acc = ((re_repeat*)ptr)->id;
|
||||
cur_acc = static_cast<const re_repeat*>(ptr)->id;
|
||||
|
||||
if(((re_repeat*)ptr)->leading)
|
||||
if(static_cast<const re_repeat*>(ptr)->leading)
|
||||
*restart = first;
|
||||
|
||||
//charT c = traits_inst.translate(*first);
|
||||
@ -621,17 +713,17 @@ bool query_match_aux(iterator first,
|
||||
// if that is the case then repeat as many times as possible,
|
||||
// as long as the repeat is greedy:
|
||||
|
||||
if((((re_repeat*)ptr)->alt.p->type == syntax_element_match)
|
||||
&& (((re_repeat*)ptr)->greedy == true))
|
||||
if((static_cast<const re_repeat*>(ptr)->alt.p->type == syntax_element_match)
|
||||
&& (static_cast<const re_repeat*>(ptr)->greedy == true))
|
||||
{
|
||||
// see if we can take the repeat:
|
||||
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
|
||||
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take))
|
||||
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
|
||||
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_take))
|
||||
{
|
||||
// push terminating match as fallback:
|
||||
if((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
|
||||
if((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
|
||||
{
|
||||
if((prev_record.empty() == false) && (prev_record.peek() == ((re_repeat*)ptr)->alt.p))
|
||||
if((prev_record.empty() == false) && (prev_record.peek() == static_cast<const re_repeat*>(ptr)->alt.p))
|
||||
{
|
||||
// we already have the required fallback
|
||||
// don't add any more, just update this one:
|
||||
@ -644,7 +736,7 @@ bool query_match_aux(iterator first,
|
||||
if(need_push_match)
|
||||
matches.push(temp_match);
|
||||
prev_pos.push(first);
|
||||
prev_record.push(((re_repeat*)ptr)->alt.p);
|
||||
prev_record.push(static_cast<const re_repeat*>(ptr)->alt.p);
|
||||
}
|
||||
}
|
||||
// move to next item in list:
|
||||
@ -655,13 +747,22 @@ bool query_match_aux(iterator first,
|
||||
start_loop[cur_acc] = first;
|
||||
continue;
|
||||
}
|
||||
else if((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->min)
|
||||
{
|
||||
// the repeat was null, and we haven't gone round min times yet,
|
||||
// since all subsequent repeats will be null as well, just update
|
||||
// our repeat count and skip out.
|
||||
accumulators[cur_acc] = static_cast<const re_repeat*>(ptr)->min;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
goto failure;
|
||||
}
|
||||
// see if we can skip the repeat:
|
||||
if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
|
||||
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_skip))
|
||||
if(((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
|
||||
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_skip))
|
||||
{
|
||||
ptr = ((re_repeat*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
// otherwise fail:
|
||||
@ -670,16 +771,16 @@ bool query_match_aux(iterator first,
|
||||
|
||||
// OK if we get to here then the repeat is either non-terminal or non-greedy,
|
||||
// see if we can skip the repeat:
|
||||
if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
|
||||
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_skip))
|
||||
if(((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
|
||||
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_skip))
|
||||
{
|
||||
// see if we can push failure info:
|
||||
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
|
||||
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take))
|
||||
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
|
||||
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_take))
|
||||
{
|
||||
// check to see if the last loop matched a NULL string
|
||||
// if so then we really don't want to loop again:
|
||||
if(((unsigned int)accumulators[cur_acc] == ((re_repeat*)ptr)->min)
|
||||
if(((unsigned int)accumulators[cur_acc] == static_cast<const re_repeat*>(ptr)->min)
|
||||
|| (first != start_loop[cur_acc]))
|
||||
{
|
||||
if(need_push_match)
|
||||
@ -689,20 +790,20 @@ bool query_match_aux(iterator first,
|
||||
for(k = 0; k <= cur_acc; ++k)
|
||||
prev_acc.push(accumulators[k]);
|
||||
// for non-greedy repeats save whether we have a match already:
|
||||
if(((re_repeat*)ptr)->greedy == false)
|
||||
if(static_cast<const re_repeat*>(ptr)->greedy == false)
|
||||
{
|
||||
prev_acc.push(match_found);
|
||||
match_found = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
ptr = ((re_repeat*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
|
||||
// otherwise see if we can take the repeat:
|
||||
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
|
||||
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take) &&
|
||||
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
|
||||
&& access::can_start(*first, static_cast<const re_repeat*>(ptr)->_map, mask_take) &&
|
||||
((first != start_loop[cur_acc]) || !accumulators[cur_acc]))
|
||||
{
|
||||
// move to next item in list:
|
||||
@ -711,6 +812,15 @@ bool query_match_aux(iterator first,
|
||||
start_loop[cur_acc] = first;
|
||||
continue;
|
||||
}
|
||||
else if((first == start_loop[cur_acc]) && accumulators[cur_acc] && ((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->min))
|
||||
{
|
||||
// the repeat was null, and we haven't gone round min times yet,
|
||||
// since all subsequent repeats will be null as well, just update
|
||||
// our repeat count and skip out.
|
||||
accumulators[cur_acc] = static_cast<const re_repeat*>(ptr)->min;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we get here then neither option is allowed so fail:
|
||||
goto failure;
|
||||
@ -728,7 +838,7 @@ bool query_match_aux(iterator first,
|
||||
if(flags & match_not_eob)
|
||||
goto failure;
|
||||
iterator p(first);
|
||||
while((p != last) && traits_inst.is_separator(traits_inst.translate(*first, icase)))++p;
|
||||
while((p != last) && traits_inst.is_separator(traits_inst.translate(*p, icase)))++p;
|
||||
if(p != last)
|
||||
goto failure;
|
||||
ptr = ptr->next.p;
|
||||
@ -753,18 +863,15 @@ bool query_match_aux(iterator first,
|
||||
while(true)
|
||||
{
|
||||
jm_assert(ptr);
|
||||
++state_count;
|
||||
switch(ptr->type)
|
||||
{
|
||||
case syntax_element_match:
|
||||
goto match_jump;
|
||||
case syntax_element_startmark:
|
||||
temp_match.set_first(first, ((re_brace*)ptr)->index);
|
||||
ptr = ptr->next.p;
|
||||
break;
|
||||
goto start_mark_jump;
|
||||
case syntax_element_endmark:
|
||||
temp_match.set_second(first, ((re_brace*)ptr)->index);
|
||||
ptr = ptr->next.p;
|
||||
break;
|
||||
goto end_mark_jump;
|
||||
case syntax_element_start_line:
|
||||
goto outer_line_check;
|
||||
case syntax_element_end_line:
|
||||
@ -796,7 +903,7 @@ bool query_match_aux(iterator first,
|
||||
ptr = ptr->next.p;
|
||||
break;
|
||||
case syntax_element_jump:
|
||||
ptr = ((re_jump*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_jump*>(ptr)->alt.p;
|
||||
continue;
|
||||
case syntax_element_alt:
|
||||
if(ptr->can_be_null & mask_take)
|
||||
@ -820,33 +927,33 @@ bool query_match_aux(iterator first,
|
||||
}
|
||||
if(ptr->can_be_null & mask_skip)
|
||||
{
|
||||
ptr = ((re_jump*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_jump*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
goto failure; // neither option is possible
|
||||
case syntax_element_rep:
|
||||
// if we're moving to a higher id (nested repeats etc)
|
||||
// zero out our accumualtors:
|
||||
if(cur_acc < ((re_repeat*)ptr)->id)
|
||||
if(cur_acc < static_cast<const re_repeat*>(ptr)->id)
|
||||
{
|
||||
cur_acc = ((re_repeat*)ptr)->id;
|
||||
cur_acc = static_cast<const re_repeat*>(ptr)->id;
|
||||
accumulators[cur_acc] = 0;
|
||||
start_loop[cur_acc] = first;
|
||||
}
|
||||
|
||||
cur_acc = ((re_repeat*)ptr)->id;
|
||||
cur_acc = static_cast<const re_repeat*>(ptr)->id;
|
||||
|
||||
// see if we can skip the repeat:
|
||||
if(((unsigned int)accumulators[cur_acc] >= ((re_repeat*)ptr)->min)
|
||||
if(((unsigned int)accumulators[cur_acc] >= static_cast<const re_repeat*>(ptr)->min)
|
||||
&& ((ptr->can_be_null & mask_skip) || (flags & match_partial)))
|
||||
{
|
||||
// don't push failure info, there's no point:
|
||||
ptr = ((re_repeat*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_repeat*>(ptr)->alt.p;
|
||||
continue;
|
||||
}
|
||||
|
||||
// otherwise see if we can take the repeat:
|
||||
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
|
||||
if(((unsigned int)accumulators[cur_acc] < static_cast<const re_repeat*>(ptr)->max)
|
||||
&& (((ptr->can_be_null & (mask_take | mask_skip)) == (mask_take | mask_skip))) || (flags & match_partial))
|
||||
{
|
||||
// move to next item in list:
|
||||
@ -863,6 +970,12 @@ bool query_match_aux(iterator first,
|
||||
goto failure;
|
||||
ptr = ptr->next.p;
|
||||
continue;
|
||||
case syntax_element_backref:
|
||||
if(temp_match[static_cast<const re_brace*>(ptr)->index].first
|
||||
!= temp_match[static_cast<const re_brace*>(ptr)->index].second)
|
||||
goto failure;
|
||||
ptr = ptr->next.p;
|
||||
continue;
|
||||
default:
|
||||
goto failure;
|
||||
}
|
||||
@ -870,6 +983,26 @@ bool query_match_aux(iterator first,
|
||||
|
||||
failure:
|
||||
|
||||
//
|
||||
// check to see if we've been searching too many states:
|
||||
//
|
||||
if(state_count >= pd.max_state_count)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
throw std::runtime_error("Max regex search depth exceeded.");
|
||||
#else
|
||||
while(matches.empty() == false)
|
||||
matches.pop();
|
||||
while(prev_pos.empty() == false)
|
||||
prev_pos.pop();
|
||||
while(prev_record.empty() == false)
|
||||
prev_record.pop();
|
||||
while(prev_acc.empty() == false)
|
||||
prev_acc.pop();
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// check for possible partial match:
|
||||
//
|
||||
@ -879,6 +1012,7 @@ bool query_match_aux(iterator first,
|
||||
&& (first == last)) // end of input has been reached
|
||||
{
|
||||
have_partial_match = true;
|
||||
temp_match.set_second(first, 0, false);
|
||||
m.maybe_assign(temp_match);
|
||||
}
|
||||
|
||||
@ -889,7 +1023,7 @@ bool query_match_aux(iterator first,
|
||||
{
|
||||
case syntax_element_alt:
|
||||
// get next alternative:
|
||||
ptr = ((re_jump*)ptr)->alt.p;
|
||||
ptr = static_cast<const re_jump*>(ptr)->alt.p;
|
||||
if(need_push_match)
|
||||
matches.pop(temp_match);
|
||||
prev_acc.pop(cur_acc);
|
||||
@ -899,6 +1033,7 @@ bool query_match_aux(iterator first,
|
||||
for(k = cur_acc; k >= 0; --k)
|
||||
prev_pos.pop(start_loop[k]);
|
||||
prev_record.pop();
|
||||
if(unwind_stack) goto failure; // unwinding forward assert
|
||||
goto retry;
|
||||
case syntax_element_rep:
|
||||
{
|
||||
@ -908,8 +1043,8 @@ bool query_match_aux(iterator first,
|
||||
if(need_push_match)
|
||||
matches.pop(temp_match);
|
||||
prev_pos.pop(first);
|
||||
cur_acc = ((re_repeat*)ptr)->id;
|
||||
if(((re_repeat*)ptr)->greedy == false)
|
||||
cur_acc = static_cast<const re_repeat*>(ptr)->id;
|
||||
if(static_cast<const re_repeat*>(ptr)->greedy == false)
|
||||
{
|
||||
saved_matched = prev_acc.peek();
|
||||
prev_acc.pop();
|
||||
@ -917,11 +1052,12 @@ bool query_match_aux(iterator first,
|
||||
for(k = cur_acc; k >= 0; --k)
|
||||
prev_acc.pop(accumulators[k]);
|
||||
prev_record.pop();
|
||||
if((unsigned int)++accumulators[cur_acc] > ((re_repeat*)ptr)->max)
|
||||
if(unwind_stack) goto failure; // unwinding forward assert
|
||||
if((unsigned int)++accumulators[cur_acc] > static_cast<const re_repeat*>(ptr)->max)
|
||||
goto failure; // repetions exhausted.
|
||||
//
|
||||
// if the repeat is non-greedy, and we found a match then fail again:
|
||||
if((((re_repeat*)ptr)->greedy == false) && (match_found == true))
|
||||
if((static_cast<const re_repeat*>(ptr)->greedy == false) && (match_found == true))
|
||||
{
|
||||
goto failure;
|
||||
}
|
||||
@ -931,11 +1067,42 @@ bool query_match_aux(iterator first,
|
||||
start_loop[cur_acc] = first;
|
||||
goto retry;
|
||||
}
|
||||
case syntax_element_startmark:
|
||||
{
|
||||
bool saved_matched = match_found;
|
||||
matches.pop(temp_match);
|
||||
match_found = prev_acc.peek();
|
||||
prev_acc.pop();
|
||||
prev_acc.pop(cur_acc);
|
||||
for(k = cur_acc; k >= 0; --k)
|
||||
prev_acc.pop(accumulators[k]);
|
||||
prev_pos.pop(first);
|
||||
for(k = cur_acc; k >= 0; --k)
|
||||
prev_pos.pop(start_loop[k]);
|
||||
prev_record.pop();
|
||||
unwind_stack = false;
|
||||
if(static_cast<const re_brace*>(ptr)->index == -1)
|
||||
{
|
||||
if (saved_matched == false)
|
||||
goto failure;
|
||||
ptr = static_cast<const re_jump*>(ptr->next.p)->alt.p->next.p;
|
||||
goto retry;
|
||||
}
|
||||
if(static_cast<const re_brace*>(ptr)->index == -2)
|
||||
{
|
||||
if (saved_matched == true)
|
||||
goto failure;
|
||||
ptr = static_cast<const re_jump*>(ptr->next.p)->alt.p->next.p;
|
||||
goto retry;
|
||||
}
|
||||
else goto failure;
|
||||
}
|
||||
case syntax_element_match:
|
||||
if(need_push_match)
|
||||
matches.pop(temp_match);
|
||||
prev_pos.pop(first);
|
||||
prev_record.pop();
|
||||
if(unwind_stack) goto failure; // unwinding forward assert
|
||||
goto retry;
|
||||
default:
|
||||
jm_assert(0);
|
||||
@ -944,13 +1111,16 @@ bool query_match_aux(iterator first,
|
||||
}
|
||||
|
||||
if(match_found || have_partial_match)
|
||||
{
|
||||
pd.state_count = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// if we get to here then everything has failed
|
||||
// and no match was found:
|
||||
return false;
|
||||
}
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
@ -971,10 +1141,10 @@ void _skip_and_inc(unsigned int& clines, iterator& last_line, iterator& first, c
|
||||
}
|
||||
|
||||
template <class iterator>
|
||||
void _skip_and_dec(unsigned int& clines, iterator& last_line, iterator& first, iterator base, unsigned int len)
|
||||
void _skip_and_dec(unsigned int& clines, iterator& last_line, iterator& first, iterator base, std::size_t len)
|
||||
{
|
||||
bool need_line = false;
|
||||
for(unsigned int i = 0; i < len; ++i)
|
||||
for(std::size_t i = 0; i < len; ++i)
|
||||
{
|
||||
--first;
|
||||
if(*first == '\n')
|
||||
@ -1024,7 +1194,7 @@ struct grep_search_predicate
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined(BOOST_RE_NO_TEMPLATE_RETURNS) && !defined(BOOST_RE_NO_PARTIAL_FUNC_SPEC)
|
||||
#if !defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
|
||||
template <class iterator, class Allocator>
|
||||
inline const match_results_base<iterator, Allocator>& grep_out_type(const grep_search_predicate<iterator, Allocator>& o, const Allocator&)
|
||||
@ -1040,7 +1210,7 @@ inline const Allocator& grep_out_type(const T&, const Allocator& a)
|
||||
return a;
|
||||
}
|
||||
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
|
||||
//
|
||||
// Ugly ugly hack,
|
||||
// template don't merge if they contain switch statements so declare these
|
||||
@ -1077,6 +1247,7 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
I next_base;
|
||||
I base = first;
|
||||
bool need_init;
|
||||
bool leading_match = false;
|
||||
const traits& traits_inst = e.get_traits();
|
||||
// dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never
|
||||
// referenced
|
||||
@ -1084,7 +1255,7 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
|
||||
flags |= match_init;
|
||||
|
||||
_priv_match_data<I, A2> pd(m);
|
||||
_priv_match_data<I, A2> pd(m, first, last, e.size());
|
||||
|
||||
const unsigned char* _map = access::get_map(e);
|
||||
unsigned int type;
|
||||
@ -1110,8 +1281,11 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
if(query_match_aux(first, last, m, e, flags, pd, &restart))
|
||||
{
|
||||
++cmatches;
|
||||
leading_match = true;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
// update to end of what matched
|
||||
// trying to match again with match_not_null set if this
|
||||
// is a null match...
|
||||
@ -1130,6 +1304,7 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
else
|
||||
{
|
||||
need_init = false;
|
||||
leading_match = false;
|
||||
for(unsigned int i = 0; (restart != first) && (i < access::leading_length(e)); ++i, --restart)
|
||||
{} // dwa 10/20/2000 - warning suppression for MWCW
|
||||
if(restart != last)
|
||||
@ -1161,7 +1336,9 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
|
||||
// depending on what the first record is we may be able to
|
||||
// optimise the search:
|
||||
type = (flags & match_continuous) ? regbase::restart_continue : access::restart_type(e);
|
||||
type = (flags & match_continuous) ?
|
||||
static_cast<unsigned int>(regbase::restart_continue)
|
||||
: static_cast<unsigned int>(access::restart_type(e));
|
||||
|
||||
if(type == regbase::restart_buf)
|
||||
return cmatches;
|
||||
@ -1188,13 +1365,15 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
{
|
||||
_skip_and_dec(clines, last_line, first, base, j);
|
||||
restart = first;
|
||||
restart += len;
|
||||
std::advance(restart, len);
|
||||
m.set_first(first);
|
||||
m.set_second(restart);
|
||||
m.set_line(clines, last_line);
|
||||
++cmatches;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
_skip_and_inc(clines, last_line, first, restart);
|
||||
next_base = m[0].second;
|
||||
pd.temp_match.init_fail(next_base, last);
|
||||
@ -1212,6 +1391,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
++cmatches;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
// update to end of what matched
|
||||
_skip_and_inc(clines, last_line, first, m[0].second);
|
||||
next_base = m[0].second;
|
||||
@ -1246,6 +1427,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
++cmatches;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
// update to end of what matched
|
||||
// trying to match again with match_not_null set if this
|
||||
// is a null match...
|
||||
@ -1335,6 +1518,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
++cmatches;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
// update to end of what matched
|
||||
// trying to match again with match_not_null set if this
|
||||
// is a null match...
|
||||
@ -1411,6 +1596,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
++cmatches;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
// update to end of what matched
|
||||
// trying to match again with match_not_null set if this
|
||||
// is a null match...
|
||||
@ -1461,6 +1648,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
break;
|
||||
case regbase::restart_continue:
|
||||
{
|
||||
if(!leading_match)
|
||||
return cmatches;
|
||||
while(first != last)
|
||||
{
|
||||
if( access::can_start(*first, _map, (unsigned char)mask_any) )
|
||||
@ -1471,6 +1660,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
++cmatches;
|
||||
if(foo(m) == false)
|
||||
return cmatches;
|
||||
if(m[0].second == last)
|
||||
return cmatches;
|
||||
// update to end of what matched
|
||||
// trying to match again with match_not_null set if this
|
||||
// is a null match...
|
||||
@ -1517,7 +1708,7 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
|
||||
|
||||
return cmatches;
|
||||
}
|
||||
#if defined(BOOST_RE_NO_TEMPLATE_SWITCH_MERGE) && !defined(BOOST_RE_NO_NAMESPACES)
|
||||
#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
|
||||
} // namespace {anon}
|
||||
#endif
|
||||
|
||||
@ -1539,12 +1730,10 @@ bool regex_match(iterator first, iterator last, match_results<iterator, Allocato
|
||||
m.set_line(1, first);
|
||||
}
|
||||
flags |= match_all; // must match all of input.
|
||||
re_detail::_priv_match_data<iterator, Allocator> pd(m);
|
||||
re_detail::_priv_match_data<iterator, Allocator> pd(m, first, last, e.size());
|
||||
iterator restart;
|
||||
bool result = re_detail::query_match_aux(first, last, m, e, flags, pd, &restart);
|
||||
if(result && (last == m[0].second))
|
||||
return true;
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
template <class iterator, class charT, class traits, class Allocator2>
|
||||
bool regex_match(iterator first, iterator last, const reg_expression<charT, traits, Allocator2>& e, unsigned flags = match_default)
|
||||
@ -1554,7 +1743,7 @@ bool regex_match(iterator first, iterator last, const reg_expression<charT, trai
|
||||
}
|
||||
//
|
||||
// query_match convenience interfaces:
|
||||
#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
@ -1609,7 +1798,7 @@ inline bool regex_match(const char* str,
|
||||
match_results<const char*> m;
|
||||
return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_match(const wchar_t* str,
|
||||
wcmatch& m,
|
||||
const wregex& e,
|
||||
@ -1639,7 +1828,7 @@ inline bool regex_match(const std::string& s,
|
||||
match_results<std::string::const_iterator, regex::allocator_type> m;
|
||||
return regex_match(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#if !defined(BOOST_RE_NO_WCSTRING)
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool regex_match(const std::basic_string<wchar_t>& s,
|
||||
match_results<std::basic_string<wchar_t>::const_iterator, wregex::allocator_type>& m,
|
||||
const wregex& e,
|
||||
@ -1672,7 +1861,7 @@ bool regex_search(iterator first, iterator last, match_results<iterator, Allocat
|
||||
|
||||
//
|
||||
// regex_search convenience interfaces:
|
||||
#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
@ -1702,7 +1891,7 @@ inline bool regex_search(const char* str,
|
||||
{
|
||||
return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
|
||||
}
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline bool regex_search(const wchar_t* str,
|
||||
wcmatch& m,
|
||||
const wregex& e,
|
||||
@ -1718,7 +1907,7 @@ inline bool regex_search(const std::string& s,
|
||||
{
|
||||
return regex_search(s.begin(), s.end(), m, e, flags);
|
||||
}
|
||||
#if !defined(BOOST_RE_NO_WCSTRING)
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline bool regex_search(const std::basic_string<wchar_t>& s,
|
||||
match_results<std::basic_string<wchar_t>::const_iterator, wregex::allocator_type>& m,
|
||||
const wregex& e,
|
||||
@ -1743,7 +1932,7 @@ inline unsigned int regex_grep(Predicate foo, iterator first, iterator last, con
|
||||
|
||||
//
|
||||
// regex_grep convenience interfaces:
|
||||
#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC
|
||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
//
|
||||
// this isn't really a partial specialisation, but template function
|
||||
// overloading - if the compiler doesn't support partial specialisation
|
||||
@ -1770,7 +1959,7 @@ inline unsigned int regex_grep(bool (*foo)(const cmatch&), const char* str,
|
||||
{
|
||||
return regex_grep(foo, str, str + regex::traits_type::length(str), e, flags);
|
||||
}
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline unsigned int regex_grep(bool (*foo)(const wcmatch&), const wchar_t* str,
|
||||
const wregex& e,
|
||||
unsigned flags = match_default)
|
||||
@ -1784,7 +1973,7 @@ inline unsigned int regex_grep(bool (*foo)(const match_results<std::string::cons
|
||||
{
|
||||
return regex_grep(foo, s.begin(), s.end(), e, flags);
|
||||
}
|
||||
#if !defined(BOOST_RE_NO_WCSTRING)
|
||||
#if !defined(BOOST_NO_WREGEX)
|
||||
inline unsigned int regex_grep(bool (*foo)(const match_results<std::basic_string<wchar_t>::const_iterator, wregex::allocator_type>&),
|
||||
const std::basic_string<wchar_t>& s,
|
||||
const wregex& e,
|
||||
@ -1798,9 +1987,7 @@ inline unsigned int regex_grep(bool (*foo)(const match_results<std::basic_string
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
@ -1817,3 +2004,10 @@ inline unsigned int regex_grep(bool (*foo)(const match_results<std::basic_string
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_raw_buffer.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Raw character buffer for regex code.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
@ -26,18 +22,14 @@
|
||||
#define BOOST_REGEX_RAW_BUFFER_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
struct empty_padding{};
|
||||
@ -109,9 +101,9 @@ class raw_storage
|
||||
{
|
||||
public:
|
||||
typedef Allocator allocator_type;
|
||||
typedef typename REBIND_TYPE(unsigned char, allocator_type)::size_type size_type;
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, allocator_type) alloc_inst_type;
|
||||
typedef typename REBIND_TYPE(unsigned char, allocator_type)::pointer pointer;
|
||||
typedef typename boost::detail::rebind_allocator<unsigned char, allocator_type>::type alloc_inst_type;
|
||||
typedef typename alloc_inst_type::size_type size_type;
|
||||
typedef typename alloc_inst_type::pointer pointer;
|
||||
private:
|
||||
//
|
||||
// empty member optimisation:
|
||||
@ -131,9 +123,9 @@ public:
|
||||
alloc_inst.deallocate(start, (alloc_inst.last - start));
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL resize(size_type n);
|
||||
void BOOST_REGEX_CALL resize(size_type n);
|
||||
|
||||
void* BOOST_RE_CALL extend(size_type n)
|
||||
void* BOOST_REGEX_CALL extend(size_type n)
|
||||
{
|
||||
if(size_type(alloc_inst.last - end) < n)
|
||||
resize(n + (end - start));
|
||||
@ -142,66 +134,68 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
void* BOOST_RE_CALL insert(size_type pos, size_type n);
|
||||
void* BOOST_REGEX_CALL insert(size_type pos, size_type n);
|
||||
|
||||
size_type BOOST_RE_CALL size()
|
||||
size_type BOOST_REGEX_CALL size()
|
||||
{
|
||||
return end - start;
|
||||
}
|
||||
|
||||
size_type BOOST_RE_CALL capacity()
|
||||
size_type BOOST_REGEX_CALL capacity()
|
||||
{
|
||||
return alloc_inst.last - start;
|
||||
}
|
||||
|
||||
void* BOOST_RE_CALL data()const
|
||||
void* BOOST_REGEX_CALL data()const
|
||||
{
|
||||
return start;
|
||||
}
|
||||
|
||||
size_type BOOST_RE_CALL index(void* ptr)
|
||||
size_type BOOST_REGEX_CALL index(void* ptr)
|
||||
{
|
||||
return (unsigned char*)ptr - (unsigned char*)data();
|
||||
return reinterpret_cast<unsigned char*>(ptr) - reinterpret_cast<unsigned char*>(data());
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL clear()
|
||||
void BOOST_REGEX_CALL clear()
|
||||
{
|
||||
end = start;
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL align()
|
||||
void BOOST_REGEX_CALL align()
|
||||
{
|
||||
// move end up to a boundary:
|
||||
end = (unsigned char*)start + ((((unsigned char*)end - (unsigned char*)start) + padding_mask) & ~padding_mask);
|
||||
end = reinterpret_cast<unsigned char*>(start) + (((reinterpret_cast<unsigned char*>(end) - reinterpret_cast<unsigned char*>(start)) + padding_mask) & ~padding_mask);
|
||||
}
|
||||
|
||||
Allocator BOOST_RE_CALL allocator()const;
|
||||
Allocator BOOST_REGEX_CALL allocator()const;
|
||||
};
|
||||
|
||||
template <class Allocator>
|
||||
CONSTRUCTOR_INLINE raw_storage<Allocator>::raw_storage(const Allocator& a)
|
||||
raw_storage<Allocator>::raw_storage(const Allocator& a)
|
||||
: alloc_inst(a)
|
||||
{
|
||||
start = end = alloc_inst.allocate(1024);
|
||||
BOOST_REGEX_NOEH_ASSERT(start)
|
||||
alloc_inst.last = start + 1024;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
CONSTRUCTOR_INLINE raw_storage<Allocator>::raw_storage(size_type n, const Allocator& a)
|
||||
raw_storage<Allocator>::raw_storage(size_type n, const Allocator& a)
|
||||
: alloc_inst(a)
|
||||
{
|
||||
start = end = alloc_inst.allocate(n);
|
||||
BOOST_REGEX_NOEH_ASSERT(start)
|
||||
alloc_inst.last = start + n;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
Allocator BOOST_RE_CALL raw_storage<Allocator>::allocator()const
|
||||
Allocator BOOST_REGEX_CALL raw_storage<Allocator>::allocator()const
|
||||
{
|
||||
return alloc_inst;
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
void BOOST_RE_CALL raw_storage<Allocator>::resize(size_type n)
|
||||
void BOOST_REGEX_CALL raw_storage<Allocator>::resize(size_type n)
|
||||
{
|
||||
register size_type newsize = (alloc_inst.last - start) * 2;
|
||||
register size_type datasize = end - start;
|
||||
@ -212,6 +206,7 @@ void BOOST_RE_CALL raw_storage<Allocator>::resize(size_type n)
|
||||
|
||||
// allocate and copy data:
|
||||
register unsigned char* ptr = alloc_inst.allocate(newsize);
|
||||
BOOST_REGEX_NOEH_ASSERT(ptr)
|
||||
std::memcpy(ptr, start, datasize);
|
||||
|
||||
// get rid of old buffer:
|
||||
@ -224,7 +219,7 @@ void BOOST_RE_CALL raw_storage<Allocator>::resize(size_type n)
|
||||
}
|
||||
|
||||
template <class Allocator>
|
||||
void* BOOST_RE_CALL raw_storage<Allocator>::insert(size_type pos, size_type n)
|
||||
void* BOOST_REGEX_CALL raw_storage<Allocator>::insert(size_type pos, size_type n)
|
||||
{
|
||||
jm_assert(pos <= size_type(end - start));
|
||||
if(size_type(alloc_inst.last - end) < n)
|
||||
@ -236,9 +231,7 @@ void* BOOST_RE_CALL raw_storage<Allocator>::insert(size_type pos, size_type n)
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
@ -249,3 +242,5 @@ void* BOOST_RE_CALL raw_storage<Allocator>::insert(size_type pos, size_type n)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_split.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Implements regex_split and associated functions.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
@ -28,11 +24,7 @@
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
namespace re_detail{
|
||||
@ -40,7 +32,7 @@ namespace re_detail{
|
||||
template <class charT>
|
||||
const reg_expression<charT>& get_default_expression(charT)
|
||||
{
|
||||
static const charT expression_text[] = { '\\', 's', '+', '\00', };
|
||||
static const charT expression_text[4] = { '\\', 's', '+', '\00', };
|
||||
static const reg_expression<charT> e(expression_text);
|
||||
return e;
|
||||
}
|
||||
@ -73,8 +65,9 @@ bool split_pred<OutputIterator, charT, Traits1, Alloc1, Alloc2>::operator()
|
||||
{
|
||||
*(*p_out) = static_cast<string_type>(what[i]);
|
||||
++(*p_out);
|
||||
return --*p_max;
|
||||
if(0 == --*p_max) return false;
|
||||
}
|
||||
return *p_max != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -145,11 +138,12 @@ inline std::size_t regex_split(OutputIterator out,
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,22 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_stack.hpp
|
||||
* VERSION 3.02
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Implements customised internal regex stacks.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
@ -26,21 +22,17 @@
|
||||
#define BOOST_REGEX_STACK_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/re_detail/regex_config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
|
||||
#include <boost/re_detail/regex_raw_buffer.hpp>
|
||||
#include <boost/regex/v3/regex_raw_buffer.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -48,12 +40,13 @@ namespace boost{
|
||||
// simplified stack optimised for push/peek/pop
|
||||
// operations, we could use std::stack<std::vector<T>> instead...
|
||||
//
|
||||
template <class T, class Allocator BOOST_RE_DEF_ALLOC_PARAM(T) >
|
||||
template <class T, class Allocator = BOOST_DEFAULT_ALLOCATOR(T) >
|
||||
class jstack
|
||||
{
|
||||
private:
|
||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(unsigned char, Allocator) allocator_type;
|
||||
typedef typename REBIND_TYPE(T, Allocator)::size_type size_type;
|
||||
typedef typename boost::detail::rebind_allocator<unsigned char, Allocator>::type allocator_type;
|
||||
typedef typename boost::detail::rebind_allocator<T, Allocator>::type T_alloc_type;
|
||||
typedef typename T_alloc_type::size_type size_type;
|
||||
typedef T value_type;
|
||||
struct node
|
||||
{
|
||||
@ -77,70 +70,71 @@ private:
|
||||
node base;
|
||||
size_type block_size;
|
||||
|
||||
void BOOST_RE_CALL pop_aux()const;
|
||||
void BOOST_RE_CALL push_aux();
|
||||
void BOOST_REGEX_CALL pop_aux()const;
|
||||
void BOOST_REGEX_CALL push_aux();
|
||||
|
||||
public:
|
||||
jstack(size_type n = 64, const Allocator& a = Allocator());
|
||||
|
||||
~jstack();
|
||||
|
||||
node* BOOST_RE_CALL get_node()
|
||||
node* BOOST_REGEX_CALL get_node()
|
||||
{
|
||||
node* new_stack = (node*)alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size);
|
||||
new_stack->last = (T*)(new_stack+1);
|
||||
node* new_stack = reinterpret_cast<node*>(alloc_inst.allocate(sizeof(node) + sizeof(T) * block_size));
|
||||
BOOST_REGEX_NOEH_ASSERT(new_stack)
|
||||
new_stack->last = reinterpret_cast<T*>(new_stack+1);
|
||||
new_stack->start = new_stack->end = new_stack->last + block_size;
|
||||
new_stack->next = 0;
|
||||
return new_stack;
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL empty()
|
||||
bool BOOST_REGEX_CALL empty()
|
||||
{
|
||||
return (m_stack->start == m_stack->end) && (m_stack->next == 0);
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL good()
|
||||
bool BOOST_REGEX_CALL good()
|
||||
{
|
||||
return (m_stack->start != m_stack->end) || (m_stack->next != 0);
|
||||
}
|
||||
|
||||
T& BOOST_RE_CALL peek()
|
||||
T& BOOST_REGEX_CALL peek()
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
return *m_stack->end;
|
||||
}
|
||||
|
||||
const T& BOOST_RE_CALL peek()const
|
||||
const T& BOOST_REGEX_CALL peek()const
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
return *m_stack->end;
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL pop()
|
||||
void BOOST_REGEX_CALL pop()
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
jm_destroy(m_stack->end);
|
||||
::boost::re_detail::pointer_destroy(m_stack->end);
|
||||
++(m_stack->end);
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL pop(T& t)
|
||||
void BOOST_REGEX_CALL pop(T& t)
|
||||
{
|
||||
if(m_stack->start == m_stack->end)
|
||||
pop_aux();
|
||||
t = *m_stack->end;
|
||||
jm_destroy(m_stack->end);
|
||||
::boost::re_detail::pointer_destroy(m_stack->end);
|
||||
++(m_stack->end);
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL push(const T& t)
|
||||
void BOOST_REGEX_CALL push(const T& t)
|
||||
{
|
||||
if(m_stack->end == m_stack->last)
|
||||
push_aux();
|
||||
--(m_stack->end);
|
||||
jm_construct(m_stack->end, t);
|
||||
pointer_construct(m_stack->end, t);
|
||||
}
|
||||
|
||||
};
|
||||
@ -158,7 +152,7 @@ jstack<T, Allocator>::jstack(size_type n, const Allocator& a)
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
void BOOST_RE_CALL jstack<T, Allocator>::push_aux()
|
||||
void BOOST_REGEX_CALL jstack<T, Allocator>::push_aux()
|
||||
{
|
||||
// make sure we have spare space on TOS:
|
||||
register node* new_node;
|
||||
@ -178,7 +172,7 @@ void BOOST_RE_CALL jstack<T, Allocator>::push_aux()
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
void BOOST_RE_CALL jstack<T, Allocator>::pop_aux()const
|
||||
void BOOST_REGEX_CALL jstack<T, Allocator>::pop_aux()const
|
||||
{
|
||||
// make sure that we have a valid item
|
||||
// on TOS:
|
||||
@ -199,20 +193,18 @@ jstack<T, Allocator>::~jstack()
|
||||
{
|
||||
condemned = unused;
|
||||
unused = unused->next;
|
||||
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
||||
alloc_inst.deallocate(reinterpret_cast<unsigned char*>(condemned), sizeof(node) + sizeof(T) * block_size);
|
||||
}
|
||||
while(m_stack != &base)
|
||||
{
|
||||
condemned = m_stack;
|
||||
m_stack = m_stack->next;
|
||||
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
||||
alloc_inst.deallocate(reinterpret_cast<unsigned char*>(condemned), sizeof(node) + sizeof(T) * block_size);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
@ -227,3 +219,6 @@ jstack<T, Allocator>::~jstack()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
210
include/boost/regex/v3/regex_synch.hpp
Normal file
210
include/boost/regex/v3/regex_synch.hpp
Normal file
@ -0,0 +1,210 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_synch.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Thread synchronisation for regex code.
|
||||
* Note this is an internal header file included
|
||||
* by regex.hpp, do not include on its own.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_SYNCH_HPP
|
||||
#define BOOST_REGEX_SYNCH_HPP
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_THREADS)
|
||||
# if defined(BOOST_HAS_WINTHREADS)
|
||||
# include <windows.h>
|
||||
# elif defined(BOOST_HAS_BETHREADS)
|
||||
# include <OS.h>
|
||||
# include <cassert>
|
||||
# elif defined(BOOST_HAS_PTHREADS)
|
||||
# include <pthread.h>
|
||||
# else
|
||||
# error "Unknown threading API"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
void BOOST_REGEX_CALL re_init_threads();
|
||||
void BOOST_REGEX_CALL re_free_threads();
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
|
||||
# ifdef BOOST_HAS_BETHREADS
|
||||
|
||||
typedef sem_id CRITICAL_SECTION;
|
||||
|
||||
inline void BOOST_REGEX_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
*ps = create_sem(1, "regex++");
|
||||
assert(*ps > 0);
|
||||
}
|
||||
|
||||
inline void BOOST_REGEX_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
int t = delete_sem(*ps);
|
||||
assert(t == B_NO_ERROR);
|
||||
}
|
||||
|
||||
inline void BOOST_REGEX_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
status_t t = acquire_sem(*ps);
|
||||
assert(t == B_NO_ERROR);
|
||||
}
|
||||
|
||||
inline void BOOST_REGEX_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
status_t t = release_sem(*ps);
|
||||
assert(t == B_NO_ERROR);
|
||||
}
|
||||
|
||||
# elif defined(BOOST_HAS_PTHREADS)
|
||||
|
||||
typedef pthread_mutex_t CRITICAL_SECTION;
|
||||
|
||||
inline void BOOST_REGEX_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_init(ps, 0);
|
||||
}
|
||||
|
||||
inline void BOOST_REGEX_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_destroy(ps);
|
||||
}
|
||||
|
||||
inline void BOOST_REGEX_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_lock(ps);
|
||||
}
|
||||
|
||||
inline void BOOST_REGEX_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
|
||||
{
|
||||
pthread_mutex_unlock(ps);
|
||||
}
|
||||
|
||||
# elif !defined(BOOST_HAS_WINTHREADS)
|
||||
# error "Unknown threading API"
|
||||
# endif
|
||||
|
||||
template <class Lock>
|
||||
class lock_guard
|
||||
{
|
||||
typedef Lock lock_type;
|
||||
public:
|
||||
lock_guard(lock_type& m, bool aq = true)
|
||||
: mut(m), owned(false){ acquire(aq); }
|
||||
|
||||
~lock_guard()
|
||||
{ acquire(false); }
|
||||
|
||||
void BOOST_REGEX_CALL acquire(bool aq = true)
|
||||
{
|
||||
if(aq && !owned)
|
||||
{
|
||||
mut.acquire(true);
|
||||
owned = true;
|
||||
}
|
||||
else if(!aq && owned)
|
||||
{
|
||||
mut.acquire(false);
|
||||
owned = false;
|
||||
}
|
||||
}
|
||||
private:
|
||||
lock_type& mut;
|
||||
bool owned;
|
||||
// VC6 warning suppression:
|
||||
lock_guard& operator=(const lock_guard&);
|
||||
};
|
||||
|
||||
|
||||
class critical_section
|
||||
{
|
||||
public:
|
||||
critical_section()
|
||||
{ InitializeCriticalSection(&hmutex);}
|
||||
|
||||
critical_section(const critical_section&)
|
||||
{ InitializeCriticalSection(&hmutex);}
|
||||
|
||||
const critical_section& BOOST_REGEX_CALL operator=(const critical_section&)
|
||||
{return *this;}
|
||||
|
||||
~critical_section()
|
||||
{DeleteCriticalSection(&hmutex);}
|
||||
|
||||
private:
|
||||
|
||||
void BOOST_REGEX_CALL acquire(bool aq)
|
||||
{ if(aq) EnterCriticalSection(&hmutex);
|
||||
else LeaveCriticalSection(&hmutex);
|
||||
}
|
||||
|
||||
CRITICAL_SECTION hmutex;
|
||||
|
||||
public:
|
||||
typedef lock_guard<critical_section> ro_guard;
|
||||
typedef lock_guard<critical_section> rw_guard;
|
||||
|
||||
friend class lock_guard<critical_section>;
|
||||
};
|
||||
|
||||
inline bool BOOST_REGEX_CALL operator==(const critical_section&, const critical_section&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool BOOST_REGEX_CALL operator<(const critical_section&, const critical_section&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef lock_guard<critical_section> cs_guard;
|
||||
|
||||
BOOST_REGEX_DECL extern critical_section* p_re_lock;
|
||||
BOOST_REGEX_DECL extern unsigned int re_lock_count;
|
||||
|
||||
#define BOOST_REGEX_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst);
|
||||
|
||||
#else // BOOST_HAS_THREADS
|
||||
|
||||
#define BOOST_REGEX_GUARD(inst)
|
||||
|
||||
#endif // BOOST_HAS_THREADS
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option pop
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // sentry
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,39 +1,35 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2000
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Dr John Maddock makes no representations
|
||||
* about the suitability of this software for any purpose.
|
||||
* It is provided "as is" without express or implied warranty.
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex.cpp
|
||||
* VERSION 3.02
|
||||
* FILE regex_traits.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares regular expression traits classes.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_TRAITS_HPP
|
||||
#define BOOST_REGEX_TRAITS_HPP
|
||||
#ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
|
||||
#define BOOST_REGEX_TRAITS_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_RE_CREGEX_HPP
|
||||
#include <boost/cregex.hpp>
|
||||
#include <boost/re_detail/regex_cstring.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_CSTRING_HPP
|
||||
#include <boost/regex/v3/regex_cstring.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ == 0x530
|
||||
#pragma option push -a4 -b -Ve
|
||||
#elif __BORLANDC__ > 0x530
|
||||
#pragma option push -a8 -b -Ve
|
||||
#endif
|
||||
#pragma option push -a8 -b -Vx -Ve -pc
|
||||
#endif
|
||||
|
||||
template <class charT>
|
||||
@ -47,20 +43,18 @@ struct mss
|
||||
const char* what;
|
||||
};
|
||||
|
||||
BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
|
||||
BOOST_RE_IX_DECL unsigned int BOOST_RE_CALL re_get_default_message(char* buf, unsigned int len, unsigned int id);
|
||||
extern BOOST_RE_IX_DECL const char *re_default_error_messages[];
|
||||
BOOST_RE_IX_DECL bool BOOST_RE_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
|
||||
BOOST_RE_IX_DECL bool BOOST_RE_CALL is_combining(wchar_t c);
|
||||
//extern BOOST_RE_IX_DECL const wchar_t combining_ranges[];
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
|
||||
BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id);
|
||||
extern BOOST_REGEX_DECL const char *re_default_error_messages[];
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
extern BOOST_RE_IX_DECL wchar_t wide_lower_case_map[];
|
||||
extern BOOST_RE_IX_DECL unsigned short wide_unicode_classes[];
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
extern BOOST_REGEX_DECL wchar_t wide_lower_case_map[];
|
||||
extern BOOST_REGEX_DECL unsigned short wide_unicode_classes[];
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(wchar_t c);
|
||||
#endif
|
||||
|
||||
|
||||
struct BOOST_RE_IX_DECL regex_traits_base
|
||||
struct BOOST_REGEX_DECL regex_traits_base
|
||||
{
|
||||
enum char_syntax_type
|
||||
{
|
||||
@ -121,40 +115,47 @@ struct BOOST_RE_IX_DECL regex_traits_base
|
||||
syntax_Z = 51, // for \Z
|
||||
syntax_G = 52, // for \G
|
||||
|
||||
syntax_max = 53
|
||||
// new extentions:
|
||||
syntax_not = 53, // for (?!...)
|
||||
|
||||
syntax_max = 54
|
||||
};
|
||||
#ifdef __BORLANDC__
|
||||
private:
|
||||
char dummy_member;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct BOOST_RE_IX_DECL c_traits_base : public regex_traits_base
|
||||
struct BOOST_REGEX_DECL c_traits_base : public regex_traits_base
|
||||
{
|
||||
public:
|
||||
enum{
|
||||
char_class_none = 0,
|
||||
char_class_alpha = 1,
|
||||
char_class_cntrl = char_class_alpha << 1,
|
||||
char_class_digit = char_class_cntrl << 1,
|
||||
char_class_lower = char_class_digit << 1,
|
||||
char_class_punct = char_class_lower << 1,
|
||||
char_class_space = char_class_punct << 1,
|
||||
char_class_upper = char_class_space << 1,
|
||||
char_class_xdigit = char_class_upper << 1,
|
||||
char_class_blank = char_class_xdigit << 1,
|
||||
char_class_unicode = char_class_blank << 1,
|
||||
char_class_underscore = char_class_unicode << 1,
|
||||
char_class_alpha = 0x0001,
|
||||
char_class_cntrl = 0x0002,
|
||||
char_class_digit = 0x0004,
|
||||
char_class_lower = 0x0008,
|
||||
char_class_punct = 0x0010,
|
||||
char_class_space = 0x0020,
|
||||
char_class_upper = 0x0040,
|
||||
char_class_xdigit = 0x0080,
|
||||
char_class_blank = 0x0100,
|
||||
char_class_underscore = 0x4000,
|
||||
char_class_unicode = 0x8000,
|
||||
|
||||
char_class_alnum = char_class_alpha | char_class_digit,
|
||||
char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
|
||||
char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank,
|
||||
char_class_word = char_class_alpha | char_class_digit | char_class_underscore
|
||||
};
|
||||
static std::string set_message_catalogue(const std::string& s);
|
||||
static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
|
||||
protected:
|
||||
#if defined(__MWERKS__) && __MWERKS__ <= 0x6000
|
||||
friend class c_regex_traits<char>;
|
||||
friend class c_regex_traits<wchar_t>;
|
||||
#endif
|
||||
|
||||
static char regex_message_catalogue[200];
|
||||
static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
|
||||
enum syntax_map_size
|
||||
{
|
||||
map_size = UCHAR_MAX + 1
|
||||
@ -164,20 +165,20 @@ protected:
|
||||
static unsigned short class_map[map_size];
|
||||
static char lower_case_map[map_size];
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p);
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p);
|
||||
static void BOOST_RE_CALL do_update_ctype();
|
||||
static void BOOST_RE_CALL do_update_collate();
|
||||
static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
|
||||
static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
|
||||
static void BOOST_REGEX_CALL do_update_ctype();
|
||||
static void BOOST_REGEX_CALL do_update_collate();
|
||||
public:
|
||||
static std::string error_string(unsigned id);
|
||||
static char* get_catalogue() { return regex_message_catalogue; }
|
||||
static std::string BOOST_REGEX_CALL error_string(unsigned id);
|
||||
static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL c_regex_traits<char> : public re_detail::c_traits_base
|
||||
class BOOST_REGEX_DECL c_regex_traits<char> : public re_detail::c_traits_base
|
||||
{
|
||||
typedef re_detail::c_traits_base base_type;
|
||||
public:
|
||||
@ -187,54 +188,54 @@ public:
|
||||
typedef std::string string_type;
|
||||
typedef int locale_type;
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
static std::size_t BOOST_REGEX_CALL length(const char_type* p)
|
||||
{
|
||||
return std::strlen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c)
|
||||
static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
|
||||
{
|
||||
return syntax_map[c];
|
||||
}
|
||||
static char BOOST_RE_CALL translate(char c, bool icase)
|
||||
static char BOOST_REGEX_CALL translate(char c, bool icase)
|
||||
{
|
||||
return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
|
||||
}
|
||||
static void BOOST_RE_CALL transform(std::string& out, const std::string& in);
|
||||
static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in);
|
||||
static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(char c)
|
||||
static bool BOOST_REGEX_CALL is_separator(char c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(char)
|
||||
static bool BOOST_REGEX_CALL is_combining(char)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)
|
||||
static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
|
||||
return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(char c);
|
||||
static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix);
|
||||
static int BOOST_REGEX_CALL toi(char c);
|
||||
static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)
|
||||
static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_class(s.c_str());
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
|
||||
static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_collate(buf, s.c_str());
|
||||
}
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
|
||||
|
||||
c_regex_traits()
|
||||
{
|
||||
@ -242,7 +243,7 @@ public:
|
||||
}
|
||||
~c_regex_traits()
|
||||
{
|
||||
free();
|
||||
m_free();
|
||||
}
|
||||
struct sentry
|
||||
{
|
||||
@ -250,19 +251,19 @@ public:
|
||||
{ c_regex_traits<char>::update(); }
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void update();
|
||||
static void BOOST_REGEX_CALL update();
|
||||
private:
|
||||
static void init();
|
||||
static void free();
|
||||
static void BOOST_REGEX_CALL init();
|
||||
static void BOOST_REGEX_CALL m_free();
|
||||
static c_regex_traits<char> i;
|
||||
|
||||
static unsigned sort_type;
|
||||
static char sort_delim;
|
||||
};
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
|
||||
class BOOST_REGEX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
|
||||
{
|
||||
typedef re_detail::c_traits_base base_type;
|
||||
public:
|
||||
@ -271,60 +272,60 @@ public:
|
||||
typedef unsigned int size_type;
|
||||
typedef std::basic_string<wchar_t> string_type;
|
||||
typedef int locale_type;
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
static std::size_t BOOST_REGEX_CALL length(const char_type* p)
|
||||
{
|
||||
return std::wcslen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c);
|
||||
static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)
|
||||
static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
|
||||
static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
|
||||
{
|
||||
return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c;
|
||||
}
|
||||
|
||||
static void BOOST_RE_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(wchar_t c)
|
||||
static bool BOOST_REGEX_CALL is_separator(wchar_t c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(wchar_t c)
|
||||
static bool BOOST_REGEX_CALL is_combining(wchar_t c)
|
||||
{ return re_detail::is_combining(c); }
|
||||
|
||||
static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)
|
||||
static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
|
||||
return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(wchar_t c);
|
||||
static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
|
||||
static int BOOST_REGEX_CALL toi(wchar_t c);
|
||||
static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
|
||||
static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
|
||||
static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
|
||||
c_regex_traits<wchar_t>()
|
||||
{ init(); }
|
||||
~c_regex_traits<wchar_t>()
|
||||
{ free(); }
|
||||
{ m_free(); }
|
||||
struct sentry
|
||||
{
|
||||
sentry(const c_regex_traits<wchar_t>&)
|
||||
{ c_regex_traits<wchar_t>::update(); }
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void BOOST_RE_CALL update();
|
||||
static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2);
|
||||
static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
|
||||
static void BOOST_REGEX_CALL update();
|
||||
static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
|
||||
static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
|
||||
private:
|
||||
static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f);
|
||||
static void BOOST_RE_CALL free();
|
||||
static void BOOST_RE_CALL init();
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
|
||||
static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
|
||||
static void BOOST_REGEX_CALL m_free();
|
||||
static void BOOST_REGEX_CALL init();
|
||||
static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
|
||||
static c_regex_traits<wchar_t> init_;
|
||||
|
||||
static unsigned sort_type;
|
||||
@ -332,11 +333,11 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(BOOST_RE_NO_W32)
|
||||
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
struct BOOST_RE_IX_DECL w32_traits_base : public regex_traits_base
|
||||
struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
|
||||
{
|
||||
enum{
|
||||
char_class_none = 0,
|
||||
@ -352,14 +353,17 @@ struct BOOST_RE_IX_DECL w32_traits_base : public regex_traits_base
|
||||
char_class_upper = C1_UPPER,
|
||||
char_class_xdigit = C1_XDIGIT,
|
||||
char_class_blank = C1_BLANK,
|
||||
char_class_underscore = 0x0200,
|
||||
char_class_underscore = 0x4000,
|
||||
char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore,
|
||||
char_class_unicode = 0x0400
|
||||
char_class_unicode = 0x8000,
|
||||
char_class_win = 0x01FF
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
static std::string set_message_catalogue(const std::string& s);
|
||||
static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
|
||||
protected:
|
||||
static char regex_message_catalogue[200];
|
||||
static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
|
||||
enum syntax_map_size
|
||||
{
|
||||
map_size = UCHAR_MAX + 1
|
||||
@ -369,22 +373,23 @@ protected:
|
||||
static unsigned short class_map[map_size];
|
||||
static char lower_case_map[map_size];
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL do_lookup_class(const char* p);
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::string& buf, const char* p);
|
||||
static void BOOST_RE_CALL do_free();
|
||||
static void BOOST_RE_CALL do_init();
|
||||
static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
|
||||
static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
|
||||
static void BOOST_REGEX_CALL do_free();
|
||||
static void BOOST_REGEX_CALL do_init();
|
||||
public:
|
||||
static std::string error_string(unsigned id);
|
||||
static char* get_catalogue() { return regex_message_catalogue; }
|
||||
static std::string BOOST_REGEX_CALL error_string(unsigned id);
|
||||
static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
|
||||
};
|
||||
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
template<class charT>
|
||||
class w32_regex_traits;
|
||||
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
|
||||
class BOOST_REGEX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
|
||||
{
|
||||
typedef re_detail::w32_traits_base base_type;
|
||||
public:
|
||||
@ -394,54 +399,54 @@ public:
|
||||
typedef std::string string_type;
|
||||
typedef int locale_type;
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
static std::size_t BOOST_REGEX_CALL length(const char_type* p)
|
||||
{
|
||||
return std::strlen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c)
|
||||
static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
|
||||
{
|
||||
return syntax_map[c];
|
||||
}
|
||||
static char BOOST_RE_CALL translate(char c, bool icase)
|
||||
static char BOOST_REGEX_CALL translate(char c, bool icase)
|
||||
{
|
||||
return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
|
||||
}
|
||||
static void BOOST_RE_CALL transform(std::string& out, const std::string& in);
|
||||
static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in);
|
||||
static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(char c)
|
||||
static bool BOOST_REGEX_CALL is_separator(char c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(char)
|
||||
static bool BOOST_REGEX_CALL is_combining(char)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)
|
||||
static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
|
||||
return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(char c);
|
||||
static int BOOST_RE_CALL toi(const char*& first, const char* last, int radix);
|
||||
static int BOOST_REGEX_CALL toi(char c);
|
||||
static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)
|
||||
static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_class(s.c_str());
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
|
||||
static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
|
||||
{
|
||||
std::string s(first, last);
|
||||
return do_lookup_collate(buf, s.c_str());
|
||||
}
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
|
||||
|
||||
struct sentry
|
||||
{
|
||||
@ -450,16 +455,16 @@ public:
|
||||
~sentry(){}
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void update();
|
||||
static void BOOST_REGEX_CALL update();
|
||||
w32_regex_traits();
|
||||
~w32_regex_traits();
|
||||
private:
|
||||
static w32_regex_traits<char> i;
|
||||
};
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
|
||||
class BOOST_REGEX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
|
||||
{
|
||||
typedef re_detail::w32_traits_base base_type;
|
||||
public:
|
||||
@ -468,42 +473,42 @@ public:
|
||||
typedef unsigned int size_type;
|
||||
typedef std::basic_string<wchar_t> string_type;
|
||||
typedef int locale_type;
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
static std::size_t BOOST_REGEX_CALL length(const char_type* p)
|
||||
{
|
||||
return std::wcslen(p);
|
||||
}
|
||||
static unsigned int BOOST_RE_CALL syntax_type(size_type c);
|
||||
static wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)
|
||||
static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
|
||||
static wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)
|
||||
{
|
||||
return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c;
|
||||
}
|
||||
|
||||
static void BOOST_RE_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
static void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static void BOOST_RE_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
static void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in);
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(wchar_t c)
|
||||
static bool BOOST_REGEX_CALL is_separator(wchar_t c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(wchar_t c)
|
||||
static bool BOOST_REGEX_CALL is_combining(wchar_t c)
|
||||
{ return re_detail::is_combining(c); }
|
||||
|
||||
static bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)
|
||||
static bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
|
||||
return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
|
||||
}
|
||||
|
||||
static int BOOST_RE_CALL toi(wchar_t c);
|
||||
static int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
|
||||
static int BOOST_REGEX_CALL toi(wchar_t c);
|
||||
static int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix);
|
||||
|
||||
static jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
|
||||
static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static bool BOOST_RE_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
|
||||
static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last);
|
||||
|
||||
static locale_type imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_RE_CALL getloc()const{ return locale_type(); }
|
||||
static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
|
||||
|
||||
struct sentry
|
||||
{
|
||||
@ -512,27 +517,33 @@ public:
|
||||
~sentry(){}
|
||||
operator void*() { return this; }
|
||||
};
|
||||
static void BOOST_RE_CALL update();
|
||||
static void BOOST_REGEX_CALL update();
|
||||
w32_regex_traits();
|
||||
~w32_regex_traits();
|
||||
static unsigned int BOOST_RE_CALL strnarrow(char *s1, unsigned int len, const wchar_t *s2);
|
||||
static unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2);
|
||||
static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const wchar_t *s2);
|
||||
static std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2);
|
||||
|
||||
private:
|
||||
static bool BOOST_RE_CALL do_iswclass(wchar_t c, jm_uintfast32_t f);
|
||||
static bool BOOST_RE_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
|
||||
static bool BOOST_REGEX_CALL do_iswclass(wchar_t c, boost::uint_fast32_t f);
|
||||
static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<wchar_t>& out, const wchar_t* first, const wchar_t* last);
|
||||
static w32_regex_traits<wchar_t> init_;
|
||||
static wchar_t BOOST_RE_CALL wtolower(wchar_t c);
|
||||
static wchar_t BOOST_REGEX_CALL wtolower(wchar_t c);
|
||||
static unsigned short wide_unicode_classes[];
|
||||
};
|
||||
#endif // Wide strings
|
||||
#endif // Win32
|
||||
|
||||
#ifndef BOOST_RE_NO_LOCALE_H
|
||||
#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
|
||||
|
||||
} // namspace boost
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option pop
|
||||
#endif
|
||||
#include <locale>
|
||||
#ifdef __BORLANDC__
|
||||
#pragma option push -a4 -b -Ve -pc
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -548,7 +559,7 @@ struct message_data<char>;
|
||||
template <>
|
||||
struct message_data<wchar_t>;
|
||||
|
||||
struct BOOST_RE_IX_DECL cpp_regex_traits_base : public regex_traits_base
|
||||
struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
|
||||
{
|
||||
enum char_class_type
|
||||
{
|
||||
@ -574,9 +585,9 @@ struct BOOST_RE_IX_DECL cpp_regex_traits_base : public regex_traits_base
|
||||
| char_class_upper | char_class_xdigit
|
||||
};
|
||||
|
||||
static std::string set_message_catalogue(const std::string& s);
|
||||
static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
|
||||
protected:
|
||||
static char regex_message_cat[200];
|
||||
static char regex_message_cat[BOOST_REGEX_MAX_PATH];
|
||||
};
|
||||
|
||||
} // namespace re_detail
|
||||
@ -585,7 +596,7 @@ template <class charT>
|
||||
class cpp_regex_traits;
|
||||
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
|
||||
class BOOST_REGEX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
|
||||
{
|
||||
typedef re_detail::cpp_regex_traits_base base_type;
|
||||
private:
|
||||
@ -611,36 +622,38 @@ public:
|
||||
cpp_regex_traits();
|
||||
~cpp_regex_traits();
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
void swap(cpp_regex_traits&);
|
||||
|
||||
static std::size_t BOOST_REGEX_CALL length(const char_type* p)
|
||||
{
|
||||
return std::strlen(p);
|
||||
}
|
||||
unsigned int BOOST_RE_CALL syntax_type(size_type c)const
|
||||
unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
|
||||
{
|
||||
return psyntax[c];
|
||||
}
|
||||
char BOOST_RE_CALL translate(char c, bool icase)const
|
||||
char BOOST_REGEX_CALL translate(char c, bool icase)const
|
||||
{
|
||||
return icase ? lower_map[(size_type)(uchar_type)c] : c;
|
||||
}
|
||||
void BOOST_RE_CALL transform(std::string& out, const std::string& in)const
|
||||
void BOOST_REGEX_CALL transform(std::string& out, const std::string& in)const
|
||||
{
|
||||
out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str();
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL transform_primary(std::string& out, const std::string& in)const;
|
||||
void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in)const;
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(char c)
|
||||
static bool BOOST_REGEX_CALL is_separator(char c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(char)
|
||||
static bool BOOST_REGEX_CALL is_combining(char)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BOOST_RE_CALL is_class(char c, jm_uintfast32_t f)const
|
||||
bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)const
|
||||
{
|
||||
if(pctype->is((std::ctype<char>::mask)(f & char_class_all_base), c))
|
||||
return true;
|
||||
@ -651,15 +664,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
int BOOST_RE_CALL toi(char c)const;
|
||||
int BOOST_RE_CALL toi(const char*& first, const char* last, int radix)const;
|
||||
int BOOST_REGEX_CALL toi(char c)const;
|
||||
int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix)const;
|
||||
|
||||
jm_uintfast32_t BOOST_RE_CALL lookup_classname(const char* first, const char* last)const;
|
||||
bool BOOST_RE_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
|
||||
boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)const;
|
||||
bool BOOST_REGEX_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
|
||||
|
||||
std::string BOOST_RE_CALL error_string(unsigned id)const;
|
||||
locale_type BOOST_RE_CALL imbue(locale_type l);
|
||||
locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; }
|
||||
std::string BOOST_REGEX_CALL error_string(unsigned id)const;
|
||||
locale_type BOOST_REGEX_CALL imbue(locale_type l);
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
|
||||
|
||||
struct sentry
|
||||
{
|
||||
@ -668,9 +681,9 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
#ifndef BOOST_RE_NO_WCSTRING
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template<>
|
||||
class BOOST_RE_IX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
|
||||
class BOOST_REGEX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
|
||||
{
|
||||
typedef re_detail::cpp_regex_traits_base base_type;
|
||||
public:
|
||||
@ -688,7 +701,7 @@ private:
|
||||
const std::collate<wchar_t>* pcollate;
|
||||
const std::codecvt<wchar_t, char, std::mbstate_t>* pcdv;
|
||||
std::locale locale_inst;
|
||||
unsigned int BOOST_RE_CALL do_syntax_type(size_type c)const;
|
||||
unsigned int BOOST_REGEX_CALL do_syntax_type(size_type c)const;
|
||||
unsigned sort_type;
|
||||
wchar_t sort_delim;
|
||||
|
||||
@ -697,34 +710,34 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
static size_t BOOST_RE_CALL length(const char_type* p)
|
||||
static std::size_t BOOST_REGEX_CALL length(const char_type* p)
|
||||
{
|
||||
return std::wcslen(p);
|
||||
}
|
||||
unsigned int BOOST_RE_CALL syntax_type(size_type c)const
|
||||
unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
|
||||
{
|
||||
return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c);
|
||||
}
|
||||
wchar_t BOOST_RE_CALL translate(wchar_t c, bool icase)const
|
||||
wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool icase)const
|
||||
{
|
||||
return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c;
|
||||
}
|
||||
void BOOST_RE_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
|
||||
void BOOST_REGEX_CALL transform(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
|
||||
{
|
||||
out = pcollate->transform(in.c_str(), in.c_str() + in.size());
|
||||
}
|
||||
|
||||
void BOOST_RE_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const;
|
||||
void BOOST_REGEX_CALL transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const;
|
||||
|
||||
static bool BOOST_RE_CALL is_separator(wchar_t c)
|
||||
static bool BOOST_REGEX_CALL is_separator(wchar_t c)
|
||||
{
|
||||
return BOOST_RE_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (wchar_t)0x2028) || (c == (wchar_t)0x2029));
|
||||
}
|
||||
|
||||
static bool BOOST_RE_CALL is_combining(wchar_t c)
|
||||
static bool BOOST_REGEX_CALL is_combining(wchar_t c)
|
||||
{ return re_detail::is_combining(c); }
|
||||
|
||||
bool BOOST_RE_CALL is_class(wchar_t c, jm_uintfast32_t f)const
|
||||
bool BOOST_REGEX_CALL is_class(wchar_t c, boost::uint_fast32_t f)const
|
||||
{
|
||||
if(pctype->is((std::ctype<wchar_t>::mask)(f & char_class_all_base), c))
|
||||
return true;
|
||||
@ -732,23 +745,24 @@ public:
|
||||
return true;
|
||||
if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
|
||||
return true;
|
||||
if((f & char_class_unicode) && (c > (size_type)(uchar_type)255))
|
||||
if((f & char_class_unicode) && ((uchar_type)c > (uchar_type)255))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int BOOST_RE_CALL toi(wchar_t c)const;
|
||||
int BOOST_RE_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const;
|
||||
int BOOST_REGEX_CALL toi(wchar_t c)const;
|
||||
int BOOST_REGEX_CALL toi(const wchar_t*& first, const wchar_t* last, int radix)const;
|
||||
|
||||
jm_uintfast32_t BOOST_RE_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const;
|
||||
bool BOOST_RE_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const;
|
||||
boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const;
|
||||
bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const;
|
||||
|
||||
std::string BOOST_RE_CALL error_string(unsigned id)const;
|
||||
std::string BOOST_REGEX_CALL error_string(unsigned id)const;
|
||||
cpp_regex_traits();
|
||||
~cpp_regex_traits();
|
||||
locale_type BOOST_RE_CALL imbue(locale_type l);
|
||||
locale_type BOOST_RE_CALL BOOST_RE_CALL getloc()const{ return locale_inst; }
|
||||
unsigned int BOOST_RE_CALL strwiden(wchar_t *s1, unsigned int len, const char *s2)const;
|
||||
locale_type BOOST_REGEX_CALL imbue(locale_type l);
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
|
||||
std::size_t BOOST_REGEX_CALL strwiden(wchar_t *s1, std::size_t len, const char *s2)const;
|
||||
void swap(cpp_regex_traits&);
|
||||
|
||||
struct sentry
|
||||
{
|
||||
@ -756,25 +770,25 @@ public:
|
||||
operator void*() { return this; }
|
||||
};
|
||||
};
|
||||
#endif // BOOST_RE_NO_WCSTRING
|
||||
#endif // BOOST_NO_WREGEX
|
||||
|
||||
#endif // BOOST_RE_NO_LOCALE_H
|
||||
#endif // BOOST_NO_STD_LOCALE
|
||||
|
||||
#ifdef BOOST_RE_LOCALE_W32
|
||||
#ifdef BOOST_REGEX_USE_WIN32_LOCALE
|
||||
|
||||
template <class charT>
|
||||
class regex_traits : public w32_regex_traits<charT>
|
||||
{
|
||||
};
|
||||
|
||||
#elif defined(BOOST_RE_LOCALE_C)
|
||||
#elif defined(BOOST_REGEX_USE_C_LOCALE)
|
||||
|
||||
template <class charT>
|
||||
class regex_traits : public c_regex_traits<charT>
|
||||
{
|
||||
};
|
||||
|
||||
#elif defined(BOOST_RE_LOCALE_CPP)
|
||||
#elif defined(BOOST_REGEX_USE_CPP_LOCALE)
|
||||
|
||||
template <class charT>
|
||||
class regex_traits : public cpp_regex_traits<charT>
|
||||
@ -786,12 +800,16 @@ class regex_traits : public cpp_regex_traits<charT>
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__ > 0x520
|
||||
#pragma option pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
396
include/boost/regex/v4/basic_regex.hpp
Normal file
396
include/boost/regex/v4/basic_regex.hpp
Normal file
@ -0,0 +1,396 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE basic_regex.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares template class basic_regex (note that member function
|
||||
* bodies are in regex_compile.hpp).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP
|
||||
#define BOOST_REGEX_V4_BASIC_REGEX_HPP
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
//
|
||||
// class reg_expression
|
||||
// represents the compiled
|
||||
// regular expression:
|
||||
//
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251 4231 4660)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_NO_FWD
|
||||
template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
||||
#else
|
||||
template <class charT, class traits, class Allocator >
|
||||
#endif
|
||||
class reg_expression : public regbase
|
||||
{
|
||||
public:
|
||||
// typedefs:
|
||||
typedef typename traits::size_type traits_size_type;
|
||||
typedef typename traits::uchar_type traits_uchar_type;
|
||||
typedef typename traits::string_type traits_string_type;
|
||||
typedef charT char_type;
|
||||
typedef traits traits_type;
|
||||
|
||||
typedef charT value_type;
|
||||
typedef charT& reference;
|
||||
typedef const charT& const_reference;
|
||||
typedef const charT* const_iterator;
|
||||
typedef const_iterator iterator;
|
||||
typedef typename Allocator::difference_type difference_type;
|
||||
typedef typename Allocator::size_type size_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef Allocator alloc_type;
|
||||
typedef regex_constants::syntax_option_type flag_type;
|
||||
// locale_type
|
||||
// placeholder for actual locale type used by the
|
||||
// traits class to localise *this.
|
||||
typedef typename traits::locale_type locale_type;
|
||||
|
||||
public:
|
||||
explicit reg_expression(const Allocator& a = Allocator());
|
||||
explicit reg_expression(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
|
||||
reg_expression(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
|
||||
reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator());
|
||||
reg_expression(const reg_expression&);
|
||||
~reg_expression();
|
||||
reg_expression& BOOST_REGEX_CALL operator=(const reg_expression&);
|
||||
reg_expression& BOOST_REGEX_CALL operator=(const charT* ptr)
|
||||
{
|
||||
set_expression(ptr, regex_constants::normal | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//
|
||||
// assign:
|
||||
reg_expression& assign(const reg_expression& that)
|
||||
{ return *this = that; }
|
||||
reg_expression& assign(const charT* ptr, flag_type f = regex_constants::normal)
|
||||
{
|
||||
set_expression(ptr, f | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
reg_expression& assign(const charT* ptr, size_type len, flag_type f)
|
||||
{
|
||||
std::basic_string<charT> s(ptr, len);
|
||||
set_expression(s.c_str(), f | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
|
||||
reg_expression& assign(const charT* arg_first,
|
||||
const charT* arg_last,
|
||||
flag_type f = regex_constants::normal)
|
||||
{
|
||||
set_expression(arg_first, arg_last, f | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||
|
||||
template <class ST, class SA>
|
||||
unsigned int BOOST_REGEX_CALL set_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
|
||||
{ return set_expression(p.data(), p.data() + p.size(), f); }
|
||||
|
||||
template <class ST, class SA>
|
||||
explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
|
||||
: data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0) { set_expression(p, f | regex_constants::use_except); }
|
||||
|
||||
template <class InputIterator>
|
||||
reg_expression(InputIterator arg_first, InputIterator arg_last, flag_type f = regex_constants::normal, const Allocator& al = Allocator())
|
||||
: data(al), pkmp(0), error_code_(REG_EMPTY), _expression(0)
|
||||
{
|
||||
std::basic_string<charT> a(arg_first, arg_last);
|
||||
set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except);
|
||||
}
|
||||
|
||||
template <class ST, class SA>
|
||||
reg_expression& BOOST_REGEX_CALL operator=(const std::basic_string<charT, ST, SA>& p)
|
||||
{
|
||||
set_expression(p.c_str(), p.c_str() + p.size(), regex_constants::normal | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class string_traits, class A>
|
||||
reg_expression& BOOST_REGEX_CALL assign(
|
||||
const std::basic_string<charT, string_traits, A>& s,
|
||||
flag_type f = regex_constants::normal)
|
||||
{
|
||||
set_expression(s.c_str(), s.c_str() + s.size(), f | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
reg_expression& BOOST_REGEX_CALL assign(InputIterator arg_first,
|
||||
InputIterator arg_last,
|
||||
flag_type f = regex_constants::normal)
|
||||
{
|
||||
std::basic_string<charT> a(arg_first, arg_last);
|
||||
set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
unsigned int BOOST_REGEX_CALL set_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
|
||||
{ return set_expression(p.data(), p.data() + p.size(), f | regex_constants::use_except); }
|
||||
|
||||
reg_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
|
||||
: data(a), pkmp(0) { set_expression(p, f | regex_constants::use_except); }
|
||||
|
||||
reg_expression& BOOST_REGEX_CALL operator=(const std::basic_string<charT>& p)
|
||||
{
|
||||
set_expression(p.c_str(), p.c_str() + p.size(), regex_constants::normal | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
|
||||
reg_expression& BOOST_REGEX_CALL assign(
|
||||
const std::basic_string<charT>& s,
|
||||
flag_type f = regex_constants::normal)
|
||||
{
|
||||
set_expression(s.c_str(), s.c_str() + s.size(), f | regex_constants::use_except);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// allocator access:
|
||||
Allocator BOOST_REGEX_CALL get_allocator()const;
|
||||
//
|
||||
// locale:
|
||||
locale_type BOOST_REGEX_CALL imbue(locale_type l){ return traits_inst.imbue(l); }
|
||||
locale_type BOOST_REGEX_CALL getloc()const{ return traits_inst.getloc(); }
|
||||
//
|
||||
// getflags:
|
||||
// retained for backwards compatibility only, the base class has "flags"
|
||||
// member which is now the prefered name:
|
||||
flag_type BOOST_REGEX_CALL getflags()const
|
||||
{ return this->flags(); }
|
||||
//
|
||||
// str:
|
||||
std::basic_string<charT> BOOST_REGEX_CALL str()const
|
||||
{
|
||||
std::basic_string<charT> result;
|
||||
if(this->error_code() == 0)
|
||||
result = std::basic_string<charT>(_expression, _expression_len);
|
||||
return result;
|
||||
}
|
||||
//
|
||||
// begin, end:
|
||||
const_iterator BOOST_REGEX_CALL begin()const
|
||||
{ return (this->error_code() ? 0 : _expression); }
|
||||
const_iterator BOOST_REGEX_CALL end()const
|
||||
{ return (this->error_code() ? 0 : _expression + _expression_len); }
|
||||
//
|
||||
// swap:
|
||||
void BOOST_REGEX_CALL swap(reg_expression&)throw();
|
||||
//
|
||||
// size:
|
||||
size_type BOOST_REGEX_CALL size()const
|
||||
{ return (this->error_code() ? 0 : _expression_len); }
|
||||
//
|
||||
// max_size:
|
||||
size_type BOOST_REGEX_CALL max_size()const
|
||||
{ return UINT_MAX; }
|
||||
//
|
||||
// empty:
|
||||
bool BOOST_REGEX_CALL empty()const
|
||||
{ return 0 != this->error_code(); }
|
||||
|
||||
unsigned BOOST_REGEX_CALL mark_count()const { return (this->error_code() ? 0 : marks); }
|
||||
int BOOST_REGEX_CALL compare(const reg_expression&) const;
|
||||
bool BOOST_REGEX_CALL operator==(const reg_expression& e)const
|
||||
{ return compare(e) == 0; }
|
||||
bool operator != (const basic_regex<charT, traits, Allocator>& e)
|
||||
{ return compare(e) != 0; }
|
||||
bool BOOST_REGEX_CALL operator<(const reg_expression& e)const
|
||||
{ return compare(e) < 0; }
|
||||
bool BOOST_REGEX_CALL operator>(const reg_expression& e)const
|
||||
{ return compare(e) > 0; }
|
||||
bool BOOST_REGEX_CALL operator<=(const reg_expression& e)const
|
||||
{ return compare(e) <= 0; }
|
||||
bool BOOST_REGEX_CALL operator>=(const reg_expression& e)const
|
||||
{ return compare(e) >= 0; }
|
||||
|
||||
//
|
||||
// The following are deprecated as public interfaces
|
||||
// but are available for compatibility with earlier versions.
|
||||
allocator_type BOOST_REGEX_CALL allocator()const;
|
||||
const charT* BOOST_REGEX_CALL expression()const { return (this->error_code() ? 0 : _expression); }
|
||||
unsigned int BOOST_REGEX_CALL set_expression(const charT* p, const charT* end, flag_type f = regex_constants::normal);
|
||||
unsigned int BOOST_REGEX_CALL set_expression(const charT* p, flag_type f = regex_constants::normal) { return set_expression(p, p + traits_type::length(p), f); }
|
||||
//
|
||||
// this should be private but template friends don't work:
|
||||
const traits_type& get_traits()const { return traits_inst; }
|
||||
unsigned int BOOST_REGEX_CALL error_code()const
|
||||
{
|
||||
return error_code_;
|
||||
}
|
||||
|
||||
private:
|
||||
traits_type traits_inst; // traits class in use
|
||||
re_detail::raw_storage<Allocator> data; // our state machine
|
||||
unsigned _restart_type; // search method to use
|
||||
unsigned marks; // number of marked sub-expressions
|
||||
int repeats; // number of repeats
|
||||
unsigned char* startmap; // characters that can match the first state(s) in the machine
|
||||
std::size_t _expression_len; // length of the expression
|
||||
std::size_t _leading_len; // length of any leading literal
|
||||
const charT* _leading_string; // leading literal string
|
||||
std::size_t _leading_string_len; // and it's length
|
||||
re_detail::kmp_info<charT>* pkmp; // pointer to Knuth Morris Pratt state machine when available
|
||||
unsigned error_code_; // our current status
|
||||
charT* _expression; // the expression we just compiled if any
|
||||
|
||||
void BOOST_REGEX_CALL compile_maps();
|
||||
void BOOST_REGEX_CALL compile_map(re_detail::re_syntax_base* node, unsigned char* _map, unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal = 0)const;
|
||||
bool BOOST_REGEX_CALL probe_start(re_detail::re_syntax_base* node, charT c, re_detail::re_syntax_base* terminal)const;
|
||||
bool BOOST_REGEX_CALL probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const;
|
||||
void BOOST_REGEX_CALL fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces);
|
||||
void BOOST_REGEX_CALL move_offsets(re_detail::re_syntax_base* j, unsigned size);
|
||||
re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set(const charT*& first, const charT* last);
|
||||
re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_narrow_type&);
|
||||
re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_wide_type&);
|
||||
re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot = false);
|
||||
unsigned int BOOST_REGEX_CALL parse_inner_set(const charT*& first, const charT* last);
|
||||
|
||||
re_detail::re_syntax_base* BOOST_REGEX_CALL add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size = sizeof(re_detail::re_syntax_base));
|
||||
re_detail::re_syntax_base* BOOST_REGEX_CALL add_literal(re_detail::re_syntax_base* dat, charT c);
|
||||
charT BOOST_REGEX_CALL parse_escape(const charT*& first, const charT* last);
|
||||
void BOOST_REGEX_CALL parse_range(const charT*& first, const charT* last, unsigned& min, unsigned& max);
|
||||
bool BOOST_REGEX_CALL skip_space(const charT*& first, const charT* last);
|
||||
unsigned int BOOST_REGEX_CALL probe_restart(re_detail::re_syntax_base* dat);
|
||||
unsigned int BOOST_REGEX_CALL fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end);
|
||||
void BOOST_REGEX_CALL fail(unsigned int err);
|
||||
|
||||
protected:
|
||||
static int BOOST_REGEX_CALL repeat_count(const reg_expression& e)
|
||||
{ return e.repeats; }
|
||||
static unsigned int BOOST_REGEX_CALL restart_type(const reg_expression& e)
|
||||
{ return e._restart_type; }
|
||||
static const re_detail::re_syntax_base* BOOST_REGEX_CALL first(const reg_expression& e)
|
||||
{ return (const re_detail::re_syntax_base*)e.data.data(); }
|
||||
static const unsigned char* BOOST_REGEX_CALL get_map(const reg_expression& e)
|
||||
{ return e.startmap; }
|
||||
static std::size_t BOOST_REGEX_CALL leading_length(const reg_expression& e)
|
||||
{ return e._leading_len; }
|
||||
static const re_detail::kmp_info<charT>* get_kmp(const reg_expression& e)
|
||||
{ return e.pkmp; }
|
||||
static bool BOOST_REGEX_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&);
|
||||
static bool BOOST_REGEX_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&);
|
||||
};
|
||||
|
||||
template <class charT, class traits, class Allocator >
|
||||
void swap(reg_expression<charT, traits, Allocator>& a, reg_expression<charT, traits, Allocator>& b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
template <class charT, class traits, class traits2, class Allocator>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator << (std::basic_ostream<charT, traits>& os,
|
||||
const reg_expression<charT, traits2, Allocator>& e)
|
||||
{
|
||||
return (os << e.str());
|
||||
}
|
||||
#else
|
||||
template <class traits, class Allocator>
|
||||
std::ostream& operator << (std::ostream& os, const reg_expression<char, traits, Allocator>& e)
|
||||
{
|
||||
return (os << e.str());
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// We want to rename reg_expression basic_regex but maintain
|
||||
// backwards compatibility, so class basic_regex is just a thin
|
||||
// wrapper around reg_expression:
|
||||
//
|
||||
#ifdef BOOST_REGEX_NO_FWD
|
||||
template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
|
||||
#else
|
||||
template <class charT, class traits, class Allocator >
|
||||
#endif
|
||||
class basic_regex : public reg_expression<charT, traits, Allocator>
|
||||
{
|
||||
public:
|
||||
typedef typename reg_expression<charT, traits, Allocator>::flag_type flag_type;
|
||||
typedef typename reg_expression<charT, traits, Allocator>::size_type size_type;
|
||||
explicit basic_regex(const Allocator& a = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(a){}
|
||||
explicit basic_regex(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(p,f,a){}
|
||||
basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(p1,p2,f,a){}
|
||||
basic_regex(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(p,len,f,a){}
|
||||
basic_regex(const basic_regex& that)
|
||||
: reg_expression<charT, traits, Allocator>(that){}
|
||||
~basic_regex(){}
|
||||
basic_regex& BOOST_REGEX_CALL operator=(const basic_regex& that)
|
||||
{
|
||||
this->assign(that);
|
||||
return *this;
|
||||
}
|
||||
basic_regex& BOOST_REGEX_CALL operator=(const charT* ptr)
|
||||
{
|
||||
this->assign(ptr);
|
||||
return *this;
|
||||
}
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !(defined(__IBMCPP__) && (__IBMCPP__ <= 502))
|
||||
template <class ST, class SA>
|
||||
explicit basic_regex(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(p,f,a){}
|
||||
|
||||
template <class I>
|
||||
basic_regex(I arg_first, I arg_last, flag_type f = regex_constants::normal, const Allocator& al = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(arg_first, arg_last, f, al){}
|
||||
|
||||
template <class ST, class SA>
|
||||
basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string<charT, ST, SA>& p)
|
||||
{
|
||||
this->assign(p);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
basic_regex(const std::basic_string<charT>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
|
||||
: reg_expression<charT, traits, Allocator>(p,f,a){}
|
||||
|
||||
basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string<charT>& p)
|
||||
{
|
||||
this->assign(p);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
82
include/boost/regex/v4/char_regex_traits.hpp
Normal file
82
include/boost/regex/v4/char_regex_traits.hpp
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE char_regex_traits.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares deprecated traits classes char_regex_traits<>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP
|
||||
#define BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace deprecated{
|
||||
//
|
||||
// class char_regex_traits_i
|
||||
// provides case insensitive traits classes (deprecated):
|
||||
template <class charT>
|
||||
class char_regex_traits_i : public regex_traits<charT> {};
|
||||
|
||||
template<>
|
||||
class char_regex_traits_i<char> : public regex_traits<char>
|
||||
{
|
||||
public:
|
||||
typedef char char_type;
|
||||
typedef unsigned char uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef regex_traits<char> base_type;
|
||||
|
||||
char BOOST_REGEX_CALL translate(char c, bool)const
|
||||
{
|
||||
return static_cast<const regex_traits<char>*>(this)->translate(c, true);
|
||||
}
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
template<>
|
||||
class char_regex_traits_i<wchar_t> : public regex_traits<wchar_t>
|
||||
{
|
||||
public:
|
||||
typedef wchar_t char_type;
|
||||
typedef unsigned short uchar_type;
|
||||
typedef unsigned int size_type;
|
||||
typedef regex_traits<wchar_t> base_type;
|
||||
|
||||
wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool)const
|
||||
{
|
||||
return static_cast<const regex_traits<wchar_t>*>(this)->translate(c, true);
|
||||
}
|
||||
boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const
|
||||
{
|
||||
boost::uint_fast32_t result = static_cast<const regex_traits<wchar_t>*>(this)->lookup_classname(first, last);
|
||||
if((result & base_type::char_class_upper) == base_type::char_class_upper)
|
||||
result |= base_type::char_class_alpha;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
} // namespace deprecated
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif // include
|
||||
|
281
include/boost/regex/v4/cregex.hpp
Normal file
281
include/boost/regex/v4/cregex.hpp
Normal file
@ -0,0 +1,281 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE cregex.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares POSIX API functions
|
||||
* + boost::RegEx high level wrapper.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_CREGEX_HPP_INCLUDED
|
||||
#define BOOST_RE_CREGEX_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#include <boost/regex/v4/match_flags.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
/* include these defs only for POSIX compatablity */
|
||||
#ifdef __cplusplus
|
||||
namespace boost{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(BOOST_NO_STDC_NAMESPACE)
|
||||
typedef std::ptrdiff_t regoff_t;
|
||||
typedef std::size_t regsize_t;
|
||||
#else
|
||||
typedef ptrdiff_t regoff_t;
|
||||
typedef size_t regsize_t;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const char* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
match_flag_type eflags; /* none of your business :-) */
|
||||
} regex_tA;
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
typedef struct
|
||||
{
|
||||
unsigned int re_magic;
|
||||
unsigned int re_nsub; /* number of parenthesized subexpressions */
|
||||
const wchar_t* re_endp; /* end pointer for REG_PEND */
|
||||
void* guts; /* none of your business :-) */
|
||||
match_flag_type eflags; /* none of your business :-) */
|
||||
} regex_tW;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* start of match */
|
||||
regoff_t rm_eo; /* end of match */
|
||||
} regmatch_t;
|
||||
|
||||
/* regcomp() flags */
|
||||
typedef enum{
|
||||
REG_BASIC = 0000,
|
||||
REG_EXTENDED = 0001,
|
||||
REG_ICASE = 0002,
|
||||
REG_NOSUB = 0004,
|
||||
REG_NEWLINE = 0010,
|
||||
REG_NOSPEC = 0020,
|
||||
REG_PEND = 0040,
|
||||
REG_DUMP = 0200,
|
||||
REG_NOCOLLATE = 0400,
|
||||
REG_ESCAPE_IN_LISTS = 01000,
|
||||
REG_NEWLINE_ALT = 02000,
|
||||
REG_PERLEX = 04000,
|
||||
|
||||
REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | REG_PERLEX,
|
||||
REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS,
|
||||
REG_GREP = REG_BASIC | REG_NEWLINE_ALT,
|
||||
REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT,
|
||||
|
||||
REG_ASSERT = 15,
|
||||
REG_INVARG = 16,
|
||||
REG_ATOI = 255, /* convert name to number (!) */
|
||||
REG_ITOA = 0400 /* convert number to name (!) */
|
||||
} reg_comp_flags;
|
||||
|
||||
/* regexec() flags */
|
||||
typedef enum{
|
||||
REG_NOTBOL = 00001,
|
||||
REG_NOTEOL = 00002,
|
||||
REG_STARTEND = 00004
|
||||
} reg_exec_flags;
|
||||
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
|
||||
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA*);
|
||||
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW*, const wchar_t*, int);
|
||||
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, regsize_t);
|
||||
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, regsize_t, regmatch_t*, int);
|
||||
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
|
||||
#endif
|
||||
|
||||
#ifdef UNICODE
|
||||
#define regcomp regcompW
|
||||
#define regerror regerrorW
|
||||
#define regexec regexecW
|
||||
#define regfree regfreeW
|
||||
#define regex_t regex_tW
|
||||
#else
|
||||
#define regcomp regcompA
|
||||
#define regerror regerrorA
|
||||
#define regexec regexecA
|
||||
#define regfree regfreeA
|
||||
#define regex_t regex_tA
|
||||
#endif
|
||||
|
||||
/* regerror() flags */
|
||||
typedef enum
|
||||
{
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH = 1, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT = 2, /* Invalid pattern. */
|
||||
REG_ECOLLATE = 3, /* Undefined collating element. */
|
||||
REG_ECTYPE = 4, /* Invalid character class name. */
|
||||
REG_EESCAPE = 5, /* Trailing backslash. */
|
||||
REG_ESUBREG = 6, /* Invalid back reference. */
|
||||
REG_EBRACK = 7, /* Unmatched left bracket. */
|
||||
REG_EPAREN = 8, /* Parenthesis imbalance. */
|
||||
REG_EBRACE = 9, /* Unmatched \{. */
|
||||
REG_BADBR = 10, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE = 11, /* Invalid range end. */
|
||||
REG_ESPACE = 12, /* Ran out of memory. */
|
||||
REG_BADRPT = 13, /* No preceding re for repetition op. */
|
||||
REG_EEND = 14, /* unexpected end of expression */
|
||||
REG_ESIZE = 15, /* expression too big */
|
||||
REG_ERPAREN = 16, /* unmatched right parenthesis */
|
||||
REG_EMPTY = 17, /* empty expression */
|
||||
REG_E_MEMORY = REG_ESIZE, /* out of memory */
|
||||
REG_E_UNKNOWN = 18 /* unknown error */
|
||||
} reg_errcode_t;
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
//
|
||||
// C++ high level wrapper goes here:
|
||||
//
|
||||
#if defined(__cplusplus)
|
||||
#include <string>
|
||||
#include <vector>
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
class RegEx;
|
||||
|
||||
namespace re_detail{
|
||||
|
||||
class RegExData;
|
||||
struct pred1;
|
||||
struct pred2;
|
||||
struct pred3;
|
||||
struct pred4;
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
#if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
|
||||
typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
|
||||
typedef bool (__cdecl *GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (__cdecl *FindFilesCallback)(const char* file);
|
||||
#else
|
||||
typedef bool (*GrepCallback)(const RegEx& expression);
|
||||
typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression);
|
||||
typedef bool (*FindFilesCallback)(const char* file);
|
||||
#endif
|
||||
|
||||
class BOOST_REGEX_DECL RegEx
|
||||
{
|
||||
private:
|
||||
re_detail::RegExData* pdata;
|
||||
public:
|
||||
RegEx();
|
||||
RegEx(const RegEx& o);
|
||||
~RegEx();
|
||||
explicit RegEx(const char* c, bool icase = false);
|
||||
explicit RegEx(const std::string& s, bool icase = false);
|
||||
RegEx& operator=(const RegEx& o);
|
||||
RegEx& operator=(const char* p);
|
||||
RegEx& operator=(const std::string& s){ return this->operator=(s.c_str()); }
|
||||
unsigned int SetExpression(const char* p, bool icase = false);
|
||||
unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
|
||||
std::string Expression()const;
|
||||
unsigned int error_code()const;
|
||||
//
|
||||
// now matching operators:
|
||||
//
|
||||
bool Match(const char* p, match_flag_type flags = match_default);
|
||||
bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
|
||||
bool Search(const char* p, match_flag_type flags = match_default);
|
||||
bool Search(const std::string& s, match_flag_type flags = match_default) { return Search(s.c_str(), flags); }
|
||||
unsigned int Grep(GrepCallback cb, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(GrepCallback cb, const std::string& s, match_flag_type flags = match_default) { return Grep(cb, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<std::string>& v, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(std::vector<std::string>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
|
||||
unsigned int Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags = match_default);
|
||||
unsigned int Grep(std::vector<std::size_t>& v, const std::string& s, match_flag_type flags = match_default) { return Grep(v, s.c_str(), flags); }
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
||||
unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return GrepFiles(cb, files.c_str(), recurse, flags); }
|
||||
unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, match_flag_type flags = match_default);
|
||||
unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, match_flag_type flags = match_default) { return FindFiles(cb, files.c_str(), recurse, flags); }
|
||||
#endif
|
||||
|
||||
std::string Merge(const std::string& in, const std::string& fmt,
|
||||
bool copy = true, match_flag_type flags = match_default);
|
||||
std::string Merge(const char* in, const char* fmt,
|
||||
bool copy = true, match_flag_type flags = match_default);
|
||||
|
||||
std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
|
||||
//
|
||||
// now operators for returning what matched in more detail:
|
||||
//
|
||||
std::size_t Position(int i = 0)const;
|
||||
std::size_t Length(int i = 0)const;
|
||||
bool Matched(int i = 0)const;
|
||||
unsigned int Marks()const;
|
||||
std::string What(int i = 0)const;
|
||||
std::string operator[](int i)const { return What(i); }
|
||||
|
||||
static const std::size_t npos;
|
||||
|
||||
friend struct re_detail::pred1;
|
||||
friend struct re_detail::pred2;
|
||||
friend struct re_detail::pred3;
|
||||
friend struct re_detail::pred4;
|
||||
};
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // include guard
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
447
include/boost/regex/v4/fileiter.hpp
Normal file
447
include/boost/regex/v4/fileiter.hpp
Normal file
@ -0,0 +1,447 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE fileiter.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares various platform independent file and
|
||||
* directory iterators, plus binary file input in
|
||||
* the form of class map_file.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
#define BOOST_RE_FILEITER_HPP_INCLUDED
|
||||
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
|
||||
#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#error "Sorry, can't mix <windows.h> with STL code and gcc compiler: if you ran configure, try again with configure --disable-ms-windows"
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#elif (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(BOOST_REGEX_NO_W32)
|
||||
#define BOOST_REGEX_FI_WIN32_MAP
|
||||
#define BOOST_REGEX_FI_WIN32_DIR
|
||||
#else
|
||||
#define BOOST_REGEX_FI_POSIX_MAP
|
||||
#define BOOST_REGEX_FI_POSIX_DIR
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_MAP)||defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_REGEX_FI_WIN32_DIR)
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
typedef WIN32_FIND_DATAA _fi_find_data;
|
||||
typedef HANDLE _fi_find_handle;
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define _fi_invalid_handle INVALID_HANDLE_VALUE
|
||||
#define _fi_dir FILE_ATTRIBUTE_DIRECTORY
|
||||
|
||||
#elif defined(BOOST_REGEX_FI_POSIX_DIR)
|
||||
|
||||
#include <cstdio>
|
||||
#include <cctype>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <cassert>
|
||||
#include <dirent.h>
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
using std::list;
|
||||
#endif
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 256
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
struct _fi_find_data
|
||||
{
|
||||
unsigned dwFileAttributes;
|
||||
char cFileName[MAX_PATH];
|
||||
};
|
||||
|
||||
struct _fi_priv_data;
|
||||
|
||||
typedef _fi_priv_data* _fi_find_handle;
|
||||
#define _fi_invalid_handle 0
|
||||
#define _fi_dir 1
|
||||
|
||||
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindNextFile(_fi_find_handle hFindFile, _fi_find_data* lpFindFileData);
|
||||
bool _fi_FindClose(_fi_find_handle hFindFile);
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#ifdef FindFirstFile
|
||||
#undef FindFirstFile
|
||||
#endif
|
||||
#ifdef FindNextFile
|
||||
#undef FindNextFile
|
||||
#endif
|
||||
#ifdef FindClose
|
||||
#undef FindClose
|
||||
#endif
|
||||
|
||||
#define FindFirstFileA _fi_FindFirstFile
|
||||
#define FindNextFileA _fi_FindNextFile
|
||||
#define FindClose _fi_FindClose
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_FI_WIN32_MAP // win32 mapfile
|
||||
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
HANDLE hfile;
|
||||
HANDLE hmap;
|
||||
const char* _first;
|
||||
const char* _last;
|
||||
public:
|
||||
|
||||
typedef const char* iterator;
|
||||
|
||||
mapfile(){ hfile = hmap = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
const char* begin(){ return _first; }
|
||||
const char* end(){ return _last; }
|
||||
size_t size(){ return _last - _first; }
|
||||
bool valid(){ return (hfile != 0) && (hfile != INVALID_HANDLE_VALUE); }
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator;
|
||||
|
||||
class BOOST_REGEX_DECL mapfile
|
||||
{
|
||||
typedef char* pointer;
|
||||
std::FILE* hfile;
|
||||
long int _size;
|
||||
pointer* _first;
|
||||
pointer* _last;
|
||||
mutable std::list<pointer*> condemed;
|
||||
enum sizes
|
||||
{
|
||||
buf_size = 4096
|
||||
};
|
||||
void lock(pointer* node)const;
|
||||
void unlock(pointer* node)const;
|
||||
public:
|
||||
|
||||
typedef mapfile_iterator iterator;
|
||||
|
||||
mapfile(){ hfile = 0; _size = 0; _first = _last = 0; }
|
||||
mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); }
|
||||
~mapfile(){ close(); }
|
||||
void open(const char* file);
|
||||
void close();
|
||||
iterator begin()const;
|
||||
iterator end()const;
|
||||
unsigned long size()const{ return _size; }
|
||||
bool valid()const{ return hfile != 0; }
|
||||
friend class mapfile_iterator;
|
||||
};
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator
|
||||
#if !defined(BOOST_NO_STD_ITERATOR) || defined(BOOST_MSVC_STD_ITERATOR)
|
||||
: public std::iterator<std::random_access_iterator_tag, char>
|
||||
#endif
|
||||
{
|
||||
typedef mapfile::pointer internal_pointer;
|
||||
internal_pointer* node;
|
||||
const mapfile* file;
|
||||
unsigned long offset;
|
||||
long position()const
|
||||
{
|
||||
return file ? ((node - file->_first) * mapfile::buf_size + offset) : 0;
|
||||
}
|
||||
void position(long pos)
|
||||
{
|
||||
if(file)
|
||||
{
|
||||
node = file->_first + (pos / mapfile::buf_size);
|
||||
offset = pos % mapfile::buf_size;
|
||||
}
|
||||
}
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef char value_type;
|
||||
typedef const char* pointer;
|
||||
typedef const char& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
|
||||
mapfile_iterator() { node = 0; file = 0; offset = 0; }
|
||||
mapfile_iterator(const mapfile* f, long arg_position)
|
||||
{
|
||||
file = f;
|
||||
node = f->_first + arg_position / mapfile::buf_size;
|
||||
offset = arg_position % mapfile::buf_size;
|
||||
if(file)
|
||||
file->lock(node);
|
||||
}
|
||||
mapfile_iterator(const mapfile_iterator& i)
|
||||
{
|
||||
file = i.file;
|
||||
node = i.node;
|
||||
offset = i.offset;
|
||||
if(file)
|
||||
file->lock(node);
|
||||
}
|
||||
~mapfile_iterator()
|
||||
{
|
||||
if(file && node)
|
||||
file->unlock(node);
|
||||
}
|
||||
mapfile_iterator& operator = (const mapfile_iterator& i);
|
||||
char operator* ()const
|
||||
{
|
||||
assert(node >= file->_first);
|
||||
assert(node < file->_last);
|
||||
return file ? *(*node + sizeof(int) + offset) : char(0);
|
||||
}
|
||||
char operator[] (long off)const
|
||||
{
|
||||
mapfile_iterator tmp(*this);
|
||||
tmp += off;
|
||||
return *tmp;
|
||||
}
|
||||
mapfile_iterator& operator++ ();
|
||||
mapfile_iterator operator++ (int);
|
||||
mapfile_iterator& operator-- ();
|
||||
mapfile_iterator operator-- (int);
|
||||
|
||||
mapfile_iterator& operator += (long off)
|
||||
{
|
||||
position(position() + off);
|
||||
return *this;
|
||||
}
|
||||
mapfile_iterator& operator -= (long off)
|
||||
{
|
||||
position(position() - off);
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend inline bool operator==(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return (i.file == j.file) && (i.node == j.node) && (i.offset == j.offset);
|
||||
}
|
||||
|
||||
friend inline bool operator!=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return !(i == j);
|
||||
}
|
||||
|
||||
friend inline bool operator<(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() < j.position();
|
||||
}
|
||||
friend inline bool operator>(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() > j.position();
|
||||
}
|
||||
friend inline bool operator<=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() <= j.position();
|
||||
}
|
||||
friend inline bool operator>=(const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() >= j.position();
|
||||
}
|
||||
|
||||
friend mapfile_iterator operator + (const mapfile_iterator& i, long off);
|
||||
friend mapfile_iterator operator + (long off, const mapfile_iterator& i)
|
||||
{
|
||||
mapfile_iterator tmp(i);
|
||||
return tmp += off;
|
||||
}
|
||||
friend mapfile_iterator operator - (const mapfile_iterator& i, long off);
|
||||
friend inline long operator - (const mapfile_iterator& i, const mapfile_iterator& j)
|
||||
{
|
||||
return i.position() - j.position();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// _fi_sep determines the directory separator, either '\\' or '/'
|
||||
BOOST_REGEX_DECL extern const char* _fi_sep;
|
||||
|
||||
struct file_iterator_ref
|
||||
{
|
||||
_fi_find_handle hf;
|
||||
_fi_find_data _data;
|
||||
long count;
|
||||
};
|
||||
|
||||
|
||||
class BOOST_REGEX_DECL file_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
file_iterator();
|
||||
file_iterator(const char* wild);
|
||||
~file_iterator();
|
||||
file_iterator(const file_iterator&);
|
||||
file_iterator& operator=(const file_iterator&);
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
file_iterator& operator++() { next(); return *this; }
|
||||
file_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
friend inline bool operator == (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
friend inline bool operator != (const file_iterator& f1, const file_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// dwa 9/13/00 - suppress unused parameter warning
|
||||
inline bool operator < (const file_iterator&, const file_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
class BOOST_REGEX_DECL directory_iterator
|
||||
{
|
||||
char* _root;
|
||||
char* _path;
|
||||
char* ptr;
|
||||
file_iterator_ref* ref;
|
||||
|
||||
public:
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const char* value_type;
|
||||
typedef const char** pointer;
|
||||
typedef const char*& reference;
|
||||
typedef std::input_iterator_tag iterator_category;
|
||||
|
||||
directory_iterator();
|
||||
directory_iterator(const char* wild);
|
||||
~directory_iterator();
|
||||
directory_iterator(const directory_iterator& other);
|
||||
directory_iterator& operator=(const directory_iterator& other);
|
||||
|
||||
const char* root()const { return _root; }
|
||||
const char* path()const { return _path; }
|
||||
const char* name()const { return ptr; }
|
||||
_fi_find_data* data() { return &(ref->_data); }
|
||||
void next();
|
||||
directory_iterator& operator++() { next(); return *this; }
|
||||
directory_iterator operator++(int);
|
||||
const char* operator*() { return path(); }
|
||||
|
||||
static const char* separator() { return _fi_sep; }
|
||||
|
||||
friend inline bool operator == (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return ((f1.ref->hf == _fi_invalid_handle) && (f2.ref->hf == _fi_invalid_handle));
|
||||
}
|
||||
|
||||
|
||||
friend inline bool operator != (const directory_iterator& f1, const directory_iterator& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline bool operator < (const directory_iterator&, const directory_iterator&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace re_detail
|
||||
using boost::re_detail::directory_iterator;
|
||||
using boost::re_detail::file_iterator;
|
||||
using boost::re_detail::mapfile;
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_NO_FILEITER
|
||||
#endif // BOOST_RE_FILEITER_HPP
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
89
include/boost/regex/v4/instances.hpp
Normal file
89
include/boost/regex/v4/instances.hpp
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE instances.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Defines those template instances that are placed in the
|
||||
* library rather than in the users object files.
|
||||
*/
|
||||
|
||||
//
|
||||
// note no include guard, we may include this multiple times:
|
||||
//
|
||||
#ifndef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
namespace boost{
|
||||
|
||||
//
|
||||
// this header can be included multiple times, each time with
|
||||
// a different character type, BOOST_REGEX_CHAR_T must be defined
|
||||
// first:
|
||||
//
|
||||
#ifndef BOOST_REGEX_CHAR_T
|
||||
# error "BOOST_REGEX_CHAR_T not defined"
|
||||
#endif
|
||||
|
||||
//
|
||||
// what follows is compiler specific:
|
||||
//
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x600)
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# pragma option push -Jgx
|
||||
# endif
|
||||
|
||||
template class BOOST_REGEX_DECL reg_expression< BOOST_REGEX_CHAR_T >;
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# pragma option pop
|
||||
# endif
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#elif (defined(BOOST_MSVC) && defined(_MSC_EXTENSIONS)) || defined(__GNUC__)
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# define template extern template
|
||||
# endif
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4251 4231 4660)
|
||||
# endif
|
||||
|
||||
template class BOOST_REGEX_DECL reg_expression< BOOST_REGEX_CHAR_T >;
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
# endif
|
||||
|
||||
# ifdef template
|
||||
# undef template
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
||||
|
||||
|
||||
|
||||
|
87
include/boost/regex/v4/iterator_category.hpp
Normal file
87
include/boost/regex/v4/iterator_category.hpp
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE regex_match.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Iterator traits for selecting an iterator type as
|
||||
* an integral constant expression.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_REGEX_ITERATOR_CATEGORY_HPP
|
||||
#define BOOST_REGEX_ITERATOR_CATEGORY_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace detail{
|
||||
|
||||
template <class I>
|
||||
struct is_random_imp
|
||||
{
|
||||
private:
|
||||
typedef typename std::iterator_traits<I>::iterator_category cat;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
|
||||
};
|
||||
|
||||
template <class I>
|
||||
struct is_random_pointer_imp
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template <bool is_pointer_type>
|
||||
struct is_random_imp_selector
|
||||
{
|
||||
template <class I>
|
||||
struct rebind
|
||||
{
|
||||
typedef is_random_imp<I> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_random_imp_selector<true>
|
||||
{
|
||||
template <class I>
|
||||
struct rebind
|
||||
{
|
||||
typedef is_random_pointer_imp<I> type;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class I>
|
||||
struct is_random_access_iterator
|
||||
{
|
||||
private:
|
||||
typedef detail::is_random_imp_selector< ::boost::is_pointer<I>::value> selector;
|
||||
typedef typename selector::template rebind<I> bound_type;
|
||||
typedef typename bound_type::type answer;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value = answer::value);
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
template <class I>
|
||||
const bool is_random_access_iterator<I>::value;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
103
include/boost/regex/v4/iterator_traits.hpp
Normal file
103
include/boost/regex/v4/iterator_traits.hpp
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* Dr John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE iterator_traits.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares iterator traits workarounds.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
|
||||
#define BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <class T>
|
||||
struct regex_iterator_traits
|
||||
{
|
||||
typedef typename T::iterator_category iterator_category;
|
||||
typedef typename T::value_type value_type;
|
||||
#if !defined(BOOST_NO_STD_ITERATOR)
|
||||
typedef typename T::difference_type difference_type;
|
||||
typedef typename T::pointer pointer;
|
||||
typedef typename T::reference reference;
|
||||
#else
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct pointer_iterator_traits
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
template <class T>
|
||||
struct const_pointer_iterator_traits
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef const T* pointer;
|
||||
typedef const T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct regex_iterator_traits<char*> : pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const char*> : const_pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
|
||||
|
||||
#if defined(__SGI_STL_PORT) && defined(__STL_DEBUG)
|
||||
template<>
|
||||
struct regex_iterator_traits<std::string::iterator> : pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<std::string::const_iterator> : const_pointer_iterator_traits<char>{};
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<>
|
||||
struct regex_iterator_traits<std::wstring::iterator> : pointer_iterator_traits<wchar_t>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<std::wstring::const_iterator> : const_pointer_iterator_traits<wchar_t>{};
|
||||
#endif // BOOST_NO_WSTRING
|
||||
#endif // stport
|
||||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
struct regex_iterator_traits : public std::iterator_traits<T> {};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace re_detail
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user