Log menu parsing errors in stderr

This commit is contained in:
Jan 2021-12-27 11:32:47 +01:00
parent d4154d0cc2
commit cc88fb0a5a
2 changed files with 10 additions and 10 deletions

View File

@ -79,25 +79,25 @@ bool MenuFileReader::IsValidEndState(const MenuFileParserState* state) const
{
if (state->m_current_item)
{
std::cout << "In \"" << m_file_name << "\": Unclosed item at end of file!\n";
std::cerr << "In \"" << m_file_name << "\": Unclosed item at end of file!\n";
return false;
}
if (state->m_current_menu)
{
std::cout << "In \"" << m_file_name << "\": Unclosed menu at end of file!\n";
std::cerr << "In \"" << m_file_name << "\": Unclosed menu at end of file!\n";
return false;
}
if (state->m_current_function)
{
std::cout << "In \"" << m_file_name << "\": Unclosed function at end of file!\n";
std::cerr << "In \"" << m_file_name << "\": Unclosed function at end of file!\n";
return false;
}
if (state->m_in_global_scope)
{
std::cout << "In \"" << m_file_name << "\": Did not close global scope!\n";
std::cerr << "In \"" << m_file_name << "\": Did not close global scope!\n";
return false;
}
@ -137,11 +137,11 @@ std::unique_ptr<ParsingResult> MenuFileReader::ReadMenuFile()
if (!parser->Parse())
{
std::cout << "Parsing menu file failed!" << std::endl;
std::cerr << "Parsing menu file failed!" << std::endl;
const auto* parserEndState = parser->GetState();
if(parserEndState->m_current_event_handler_set && !parserEndState->m_permissive_mode)
std::cout << "You can use the --menu-permissive option to try to compile the event handler script anyway." << std::endl;
std::cerr << "You can use the --menu-permissive option to try to compile the event handler script anyway." << std::endl;
return nullptr;
}

View File

@ -64,12 +64,12 @@ public:
if (!line.IsEof())
{
std::cout << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression:\n"
std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression:\n"
<< line.m_line.substr(pos.m_column - 1) << std::endl;
}
else
{
std::cout << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression." << std::endl;
std::cerr << "Error: " << pos.m_filename.get() << " L" << pos.m_line << ':' << pos.m_column << " Could not parse expression." << std::endl;
}
return false;
}
@ -82,11 +82,11 @@ public:
if (!line.IsEof() && line.m_line.size() > static_cast<unsigned>(pos.m_column - 1))
{
std::cout << "Error: " << e.FullMessage() << "\n" << line.m_line.substr(pos.m_column - 1) << std::endl;
std::cerr << "Error: " << e.FullMessage() << "\n" << line.m_line.substr(pos.m_column - 1) << std::endl;
}
else
{
std::cout << "Error: " << e.FullMessage() << std::endl;
std::cerr << "Error: " << e.FullMessage() << std::endl;
}
return false;