mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Improved error printing torquescript
Added a vector that can lookback across x number of lines in a file, if not a file just print out the error.
This commit is contained in:
parent
f82082f59f
commit
8cf5fac497
4 changed files with 130 additions and 110 deletions
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
int outtext(char *fmt, ...);
|
||||
extern int serrors;
|
||||
extern char linebuf[512];
|
||||
extern Vector<String> lines;
|
||||
|
||||
#define nil 0
|
||||
#undef YY_ARGS
|
||||
|
|
@ -3352,11 +3352,15 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||
output += String::ToString("%s %s", i == 0 ? ": expected" : "or", yysymbol_name(expected[i]));
|
||||
}
|
||||
|
||||
if (dStrlen(linebuf) > 1)
|
||||
if (lines.size() > 0)
|
||||
{
|
||||
output += "\n";
|
||||
output += String::ToString("%5d | %s\n", loc->first_line, linebuf);
|
||||
output += String::ToString("%5s | %*s", "", loc->first_column, "^");
|
||||
output += "\n";
|
||||
for (int i = 0; i < lines.size(); i++)
|
||||
{
|
||||
int line = 10 - i;
|
||||
output += String::ToString("%5d | ", loc->first_line - (line-1)) + lines[i] + "\n";
|
||||
}
|
||||
output += String::ToString("%5s | %*s", "", loc->first_column, "^");
|
||||
}
|
||||
|
||||
yyerror(output.c_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue