nicer output for printErrorPos()
This commit is contained in:
+22
-5
@@ -153,13 +153,30 @@ void printErrorPos(ostream& out, vector<string>::iterator begin, const vector<st
|
|||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
string item = *begin;
|
||||||
|
size_t i = item.find(TEXT_SEPARATOR);
|
||||||
|
if (i != string::npos) {
|
||||||
|
do {
|
||||||
|
item.replace(i, 1, TEXT_SEPARATOR_STR TEXT_SEPARATOR_STR);
|
||||||
|
i = item.find(TEXT_SEPARATOR, i+sizeof(TEXT_SEPARATOR_STR)+sizeof(TEXT_SEPARATOR_STR));
|
||||||
|
} while (i != string::npos);
|
||||||
|
i = 0;
|
||||||
|
} else {
|
||||||
|
i = item.find(FIELD_SEPARATOR);
|
||||||
|
}
|
||||||
|
if (i!=string::npos) {
|
||||||
|
out << TEXT_SEPARATOR << item << TEXT_SEPARATOR;
|
||||||
|
if (begin < pos)
|
||||||
|
cnt += 2;
|
||||||
|
else if (begin == pos)
|
||||||
|
cnt++;
|
||||||
|
} else {
|
||||||
|
out << item;
|
||||||
|
}
|
||||||
if (begin < pos)
|
if (begin < pos)
|
||||||
cnt += 1+(unsigned int)(*begin).length()+1;
|
cnt += (unsigned int)(item).length();
|
||||||
else if (begin == pos)
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
string item = *begin++;
|
begin++;
|
||||||
out << TEXT_SEPARATOR << item << TEXT_SEPARATOR;
|
|
||||||
}
|
}
|
||||||
out << endl;
|
out << endl;
|
||||||
out << setw(cnt) << " " << setw(0) << "^" << endl;
|
out << setw(cnt) << " " << setw(0) << "^" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user