increase visibility of highlighting the failed argument

This commit is contained in:
Axel Kohlmeyer
2025-01-16 11:39:53 -05:00
parent 6c16b1de74
commit da5a12fcd1
2 changed files with 8 additions and 7 deletions

View File

@ -132,7 +132,7 @@ void utils::missing_cmd_args(const std::string &file, int line, const std::strin
if (error) error->all(file, line, "Illegal {} command: missing argument(s)", cmd);
}
std::string utils::point_to_error(Input *input, int failedarg)
std::string utils::point_to_error(Input *input, int failed)
{
if (input) {
std::string cmdline = "Preprocessed: ";
@ -142,14 +142,15 @@ std::string utils::point_to_error(Input *input, int failedarg)
// assemble pre-processed command line and update error indicator position, if needed.
for (int i = 0; i < input->narg; ++i) {
if (i == failedarg) indicator = cmdline.size();
if (i == failed) indicator = cmdline.size();
cmdline += input->arg[i];
cmdline += ' ';
}
// construct and append error indicator line
cmdline += '\n';
cmdline += std::string(indicator, ' ');
cmdline += "^\n";
cmdline += std::string(strlen(input->arg[failed]), '^');
cmdline += '\n';
return cmdline;
} else return std::string("(Failed command line text not available)");
}