aboutsummaryrefslogtreecommitdiff
path: root/src/tests/regex.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/tests/regex.cpp
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
-rw-r--r--src/tests/regex.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/tests/regex.cpp b/src/tests/regex.cpp
index 82c3466..7e4188e 100644
--- a/src/tests/regex.cpp
+++ b/src/tests/regex.cpp
@@ -6,35 +6,35 @@ using namespace Bu;
6 6
7void compile( const Bu::String &s, Bu::RegExEngine<char> &ree ) 7void compile( const Bu::String &s, Bu::RegExEngine<char> &ree )
8{ 8{
9 int iRoot = ree.addState(); 9 int iRoot = ree.addState();
10 int iCur = iRoot; 10 int iCur = iRoot;
11 for( Bu::String::const_iterator i = s.begin(); i; i++ ) 11 for( Bu::String::const_iterator i = s.begin(); i; i++ )
12 { 12 {
13 int iNext = -1; 13 int iNext = -1;
14 if( i+1 ) 14 if( i+1 )
15 iNext = ree.addState(); 15 iNext = ree.addState();
16 ree.addCompletion( iCur, *i, *i, iNext ); 16 ree.addCompletion( iCur, *i, *i, iNext );
17 iCur = iNext; 17 iCur = iNext;
18 } 18 }
19} 19}
20 20
21int main() 21int main()
22{ 22{
23 Bu::String sRegEx("abcd"); 23 Bu::String sRegEx("abcd");
24 Bu::String sMatch("abcdefg"); 24 Bu::String sMatch("abcdefg");
25 25
26 Bu::RegExEngine<char> ree; 26 Bu::RegExEngine<char> ree;
27 27
28 compile( sRegEx, ree ); 28 compile( sRegEx, ree );
29 29
30 bool bRet; 30 bool bRet;
31 int iSize, iCompletion; 31 int iSize, iCompletion;
32 bRet = ree.match( sMatch, iSize, iCompletion ); 32 bRet = ree.match( sMatch, iSize, iCompletion );
33 33
34 sio << "Matched: " << bRet << sio.nl 34 sio << "Matched: " << bRet << sio.nl
35 << "Size: " << iSize << sio.nl 35 << "Size: " << iSize << sio.nl
36 << "Completion: " << iCompletion << sio.nl; 36 << "Completion: " << iCompletion << sio.nl;
37 37
38 return 0; 38 return 0;
39} 39}
40 40