|
|
@ -61,10 +61,11 @@ void Job::printErrorLine(Token token, const char* message) |
|
|
|
"\033[0m" // Reset
|
|
|
|
"\033[0m" // Reset
|
|
|
|
"%s" |
|
|
|
"%s" |
|
|
|
"\n"; |
|
|
|
"\n"; |
|
|
|
printf(errorFormat.c_str(), |
|
|
|
fprintf(stderr, |
|
|
|
token.line + 1, |
|
|
|
errorFormat.c_str(), |
|
|
|
token.column + 1, |
|
|
|
token.line + 1, |
|
|
|
message); |
|
|
|
token.column + 1, |
|
|
|
|
|
|
|
message); |
|
|
|
|
|
|
|
|
|
|
|
// Get the JSON line that caused the error
|
|
|
|
// Get the JSON line that caused the error
|
|
|
|
std::istringstream input(m_input); |
|
|
|
std::istringstream input(m_input); |
|
|
@ -91,10 +92,11 @@ void Job::printErrorLine(Token token, const char* message) |
|
|
|
"%s" |
|
|
|
"%s" |
|
|
|
"\033[0m" // Reset
|
|
|
|
"\033[0m" // Reset
|
|
|
|
"\n"; |
|
|
|
"\n"; |
|
|
|
printf(lineFormat.c_str(), |
|
|
|
fprintf(stderr, |
|
|
|
token.line + 1, |
|
|
|
lineFormat.c_str(), |
|
|
|
line.substr(0, token.column).c_str(), |
|
|
|
token.line + 1, |
|
|
|
line.substr(token.column).c_str()); |
|
|
|
line.substr(0, token.column).c_str(), |
|
|
|
|
|
|
|
line.substr(token.column).c_str()); |
|
|
|
|
|
|
|
|
|
|
|
// Arrow pointer
|
|
|
|
// Arrow pointer
|
|
|
|
std::string arrowFormat = " %s | " |
|
|
|
std::string arrowFormat = " %s | " |
|
|
@ -102,10 +104,11 @@ 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, |
|
|
|
std::string(m_lineNumbersWidth, ' ').c_str(), |
|
|
|
arrowFormat.c_str(), |
|
|
|
std::string(token.column, ' ').c_str(), |
|
|
|
std::string(m_lineNumbersWidth, ' ').c_str(), |
|
|
|
std::string(line.length() - token.column, '~').c_str()); |
|
|
|
std::string(token.column, ' ').c_str(), |
|
|
|
|
|
|
|
std::string(line.length() - token.column, '~').c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // namespace Json
|
|
|
|
} // namespace Json
|
|
|
|