Save state before re-write of RegEx.

This commit is contained in:
Nathan Braswell
2014-01-07 13:14:58 -05:00
parent 82df9b1592
commit 0297f29dcd
13 changed files with 139 additions and 57 deletions

View File

@@ -2,8 +2,10 @@
#include <cassert>
RegEx::RegEx(std::string inPattern) {
std::cout << inPattern << " at rexex" << std::endl;
pattern = inPattern;
construct();
std::cout << inPattern << " at rexex post" << std::endl;
deperenthesize();
}
@@ -310,5 +312,12 @@ void RegEx::test() {
assert(re.longMatch("ab") == 1);
}
{
RegEx re("((ab)|c)*");
assert(re.longMatch("ababc") == 5);
assert(re.longMatch("ad") == 1);
assert(re.longMatch("ababccd") == 6);
}
std::cout << "RegEx tests pass\n";
}