mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
* Do not close a nesting level twice after close() has been
called explicitly on a Nest object.
This commit is contained in:
parent
7823db2137
commit
f0f7a9f299
2 changed files with 11 additions and 1 deletions
|
@ -279,6 +279,7 @@ void Nest::close()
|
||||||
nestingLevel--;
|
nestingLevel--;
|
||||||
if (logType == ltEscapes)
|
if (logType == ltEscapes)
|
||||||
cerr << "\033[q";
|
cerr << "\033[q";
|
||||||
|
nest = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue