Tokenizer::syntaxError(): throw exception when debug enabled.

This allows to stop test suite when first syntax error found.
This commit is contained in:
Slava Semushin 2009-09-02 00:30:54 +07:00
parent 953183d905
commit 92f436b474
1 changed files with 11 additions and 3 deletions

View File

@ -35,6 +35,7 @@
#include <algorithm>
#include <cctype>
#include <stack>
#include <stdexcept> // for std::runtime_error
//---------------------------------------------------------------------------
@ -3503,9 +3504,16 @@ void Tokenizer::syntaxError(const Token *tok, char c)
if (!_errorLogger)
{
std::cerr << "### Unlogged error at Tokenizer::syntaxError: Invalid number of character ("
<< c << ")"
<< std::endl;
std::ostringstream err;
err << "### Unlogged error at Tokenizer::syntaxError: Invalid number of character (" << c << ")";
if (_settings && _settings->_debug)
{
throw std::runtime_error(err.str());
}
else
{
std::cerr << err.str() << std::endl;
}
return;
}