vector<bool> regex_matches_adds;
vector<bool> regex_matches_dels;
- if (!data->last_text_tokens.empty()) {
+ if (data->last_text_tokens.empty()) {
+ additions = data->text;
+ } else {
// do the diff
dtl::Diff< string, vector<string> > d(data->last_text_tokens, text_tokens);
break;
}
}
-
- if (!additions.empty()) {
- //cout << "ADD: " << additions << endl;
- for (vector<pcrecpp::RE>::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) {
- pcrecpp::RE& regex = *r;
- regex_matches_adds.push_back(regex.PartialMatch(additions));
- }
+ }
+
+ if (!additions.empty()) {
+ //cout << "ADD: " << additions << endl;
+ for (vector<pcrecpp::RE>::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) {
+ pcrecpp::RE& regex = *r;
+ regex_matches_adds.push_back(regex.PartialMatch(additions));
}
+ }
- if (!deletions.empty()) {
- //cout << "DEL: " << deletions << endl;
- for (vector<pcrecpp::RE>::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) {
- pcrecpp::RE& regex = *r;
- regex_matches_dels.push_back(regex.PartialMatch(deletions));
- }
+ if (!deletions.empty()) {
+ //cout << "DEL: " << deletions << endl;
+ for (vector<pcrecpp::RE>::iterator r = data->regexes.begin(); r != data->regexes.end(); ++r) {
+ pcrecpp::RE& regex = *r;
+ regex_matches_dels.push_back(regex.PartialMatch(deletions));
}
-
- // apply regex to the diff
-
}
data->last_text_tokens = text_tokens;