aboutsummaryrefslogtreecommitdiff
path: root/src/tests/regex.cpp
diff options
context:
space:
mode:
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