From 8c08b8a59441b4cdbcf1039197bf875f358fbe58 Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 29 Jun 2022 14:14:09 +0200 Subject: [PATCH] Util: Add error report to Lexer default case --- src/util/json/lexer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/json/lexer.cpp b/src/util/json/lexer.cpp index b550dae..888d0d4 100644 --- a/src/util/json/lexer.cpp +++ b/src/util/json/lexer.cpp @@ -104,7 +104,9 @@ void Lexer::analyze() break; default: // Error! - printf("Invalid JSON!\n"); + m_tokens->push_back({ Token::Type::None, m_line, m_column, std::string(1, peek()) }); + m_job->printErrorLine(m_tokens->back(), + ("unexpected character '" + std::string(1, peek()) + "'").c_str()); return; break; }