* Emit warning='1' or error='1' attributes for lines marked as

warnings or errors with \e[w or \e[e.
This commit is contained in:
Eelco Dolstra 2010-03-05 12:54:58 +00:00
parent bc6f7fc139
commit 04791840f4

View file

@ -18,6 +18,8 @@ struct Decoder
int priority; int priority;
bool ignoreLF; bool ignoreLF;
int lineNo, charNo; int lineNo, charNo;
bool warning;
bool error;
Decoder() Decoder()
{ {
@ -29,6 +31,8 @@ struct Decoder
ignoreLF = false; ignoreLF = false;
lineNo = 1; lineNo = 1;
charNo = 0; charNo = 0;
warning = false;
error = false;
} }
void pushChar(char c); void pushChar(char c);
@ -95,6 +99,12 @@ void Decoder::pushChar(char c)
case 'b': case 'b':
ignoreLF = false; ignoreLF = false;
break; break;
case 'e':
error = true;
break;
case 'w':
warning = true;
break;
} }
} else if (c >= '0' && c <= '9') { } else if (c >= '0' && c <= '9') {
int n = 0; int n = 0;
@ -118,6 +128,8 @@ void Decoder::finishLine()
string tag = inHeader ? "head" : "line"; string tag = inHeader ? "head" : "line";
cout << "<" << tag; cout << "<" << tag;
if (priority != 1) cout << " priority='" << priority << "'"; if (priority != 1) cout << " priority='" << priority << "'";
if (warning) cout << " warning='1'";
if (error) cout << " error='1'";
cout << ">"; cout << ">";
for (unsigned int i = 0; i < line.size(); i++) { for (unsigned int i = 0; i < line.size(); i++) {
@ -158,6 +170,8 @@ void Decoder::finishLine()
line = ""; line = "";
inHeader = false; inHeader = false;
priority = 1; priority = 1;
warning = false;
error = false;
} }