tokenizer: Added guard in case the preprocessor is mismatching

This commit is contained in:
Daniel Marjamäki 2009-01-24 17:15:38 +00:00
parent fa070ac73c
commit 0b95fdafb7
1 changed files with 1528 additions and 1522 deletions

View File

@ -309,6 +309,12 @@ void Tokenizer::tokenize(std::istream &code, const char FileName[])
else if (strncmp(line.c_str(), "#endfile", 8) == 0) else if (strncmp(line.c_str(), "#endfile", 8) == 0)
{ {
if ( lineNumbers.empty() || fileIndexes.empty() )
{
std::cerr << "####### Preprocessor bug! #######\n";
std::exit(0);
}
lineno = lineNumbers.back(); lineno = lineNumbers.back();
lineNumbers.pop_back(); lineNumbers.pop_back();
FileIndex = fileIndexes.back(); FileIndex = fileIndexes.back();