clear lines, and dont try to print lines when there is no file.
This commit is contained in:
marauder2k7 2024-06-07 20:13:56 +01:00
parent eeb002ce6b
commit 8140ed9b64
4 changed files with 20 additions and 12 deletions

View file

@ -3352,15 +3352,18 @@ yyreport_syntax_error (const yypcontext_t *ctx)
output += String::ToString("%s %s", i == 0 ? ": expected" : "or", yysymbol_name(expected[i]));
}
if (lines.size() > 0)
if(CMDGetCurrentFile())
{
output += "\n";
for (int i = 0; i < lines.size(); i++)
if (lines.size() > 0)
{
int line = lines.size() - i;
output += String::ToString("%5d | ", loc->first_line - (line-1)) + lines[i] + "\n";
output += "\n";
for (int i = 0; i < lines.size(); i++)
{
int line = lines.size() - i;
output += String::ToString("%5d | ", loc->first_line - (line-1)) + lines[i] + "\n";
}
output += String::ToString("%5s | %*s", "", loc->first_column, "^");
}
output += String::ToString("%5s | %*s", "", loc->first_column, "^");
}
yyerror(output.c_str());