Tons of stuff. Regex still a work in progress, along with related template member function scoping bugs

This commit is contained in:
Nathan Braswell
2015-06-09 20:02:02 -04:00
parent 47bc52f00c
commit d90cb4b6db
14 changed files with 78 additions and 28 deletions

View File

@@ -148,15 +148,10 @@ int RegEx::longMatch(std::string stringToMatch) {
//Go through every current state. Check to see if it is goal, if so update last goal.
//Also, add each state's advance to nextStates
for (std::vector<RegExState*>::size_type j = 0; j < currentStates.size(); j++) {
if (currentStates[j]->isGoal()) {
if (currentStates[j]->isGoal())
lastMatch = i;
//std::cout << "Hit goal at " << i << " character: " << stringToMatch[i-1] << std::endl;
} else {
//std::cout << "currentState " << j << ", " << currentStates[j]->toString() << " is not goal" <<std::endl;
}
std::vector<RegExState*>* addStates = currentStates[j]->advance(stringToMatch.at(i));
nextStates.insert(nextStates.end(), addStates->begin(), addStates->end());
delete addStates;
std::vector<RegExState*> addStates = currentStates[j]->advance(stringToMatch.at(i));
nextStates.insert(nextStates.end(), addStates.begin(), addStates.end());
}
//Now, clear our current states and add eaczh one of our addStates if it is not already in current states