* Do not close a nesting level twice after close() has been

called explicitly on a Nest object.
This commit is contained in:
Eelco Dolstra 2004-03-27 15:33:19 +00:00
parent 7823db2137
commit f0f7a9f299
2 changed files with 11 additions and 1 deletions

View file

@ -279,6 +279,7 @@ void Nest::close()
nestingLevel--; nestingLevel--;
if (logType == ltEscapes) if (logType == ltEscapes)
cerr << "\033[q"; cerr << "\033[q";
nest = false;
} }
} }

View file

@ -16,6 +16,7 @@ struct Decoder
bool newNumber; bool newNumber;
int priority; int priority;
bool ignoreLF; bool ignoreLF;
int lineNo, charNo;
Decoder() Decoder()
{ {
@ -25,6 +26,8 @@ struct Decoder
level = 0; level = 0;
priority = 1; priority = 1;
ignoreLF = false; ignoreLF = false;
lineNo = 1;
charNo = 0;
} }
void pushChar(char c); void pushChar(char c);
@ -35,6 +38,11 @@ struct Decoder
void Decoder::pushChar(char c) void Decoder::pushChar(char c)
{ {
if (c == '\n') {
lineNo++;
charNo = 0;
} else charNo++;
switch (state) { switch (state) {
case stTop: case stTop:
@ -71,7 +79,8 @@ void Decoder::pushChar(char c)
level--; level--;
cout << "</nest>" << endl; cout << "</nest>" << endl;
} else } else
cerr << "not enough nesting levels" << endl; cerr << "not enough nesting levels at line "
<< lineNo << ", character " << charNo << endl;
break; break;
case 's': case 's':
if (line.size()) finishLine(); if (line.size()) finishLine();