Util: Print Json error messages to stderr
This commit is contained in:
@@ -61,7 +61,8 @@ void Job::printErrorLine(Token token, const char* message)
|
|||||||
"\033[0m" // Reset
|
"\033[0m" // Reset
|
||||||
"%s"
|
"%s"
|
||||||
"\n";
|
"\n";
|
||||||
printf(errorFormat.c_str(),
|
fprintf(stderr,
|
||||||
|
errorFormat.c_str(),
|
||||||
token.line + 1,
|
token.line + 1,
|
||||||
token.column + 1,
|
token.column + 1,
|
||||||
message);
|
message);
|
||||||
@@ -91,7 +92,8 @@ void Job::printErrorLine(Token token, const char* message)
|
|||||||
"%s"
|
"%s"
|
||||||
"\033[0m" // Reset
|
"\033[0m" // Reset
|
||||||
"\n";
|
"\n";
|
||||||
printf(lineFormat.c_str(),
|
fprintf(stderr,
|
||||||
|
lineFormat.c_str(),
|
||||||
token.line + 1,
|
token.line + 1,
|
||||||
line.substr(0, token.column).c_str(),
|
line.substr(0, token.column).c_str(),
|
||||||
line.substr(token.column).c_str());
|
line.substr(token.column).c_str());
|
||||||
@@ -102,7 +104,8 @@ void Job::printErrorLine(Token token, const char* message)
|
|||||||
"%s^%s"
|
"%s^%s"
|
||||||
"\033[0m" // Reset
|
"\033[0m" // Reset
|
||||||
"\n";
|
"\n";
|
||||||
printf(arrowFormat.c_str(),
|
fprintf(stderr,
|
||||||
|
arrowFormat.c_str(),
|
||||||
std::string(m_lineNumbersWidth, ' ').c_str(),
|
std::string(m_lineNumbersWidth, ' ').c_str(),
|
||||||
std::string(token.column, ' ').c_str(),
|
std::string(token.column, ' ').c_str(),
|
||||||
std::string(line.length() - token.column, '~').c_str());
|
std::string(line.length() - token.column, '~').c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user