--- a/src/format.cc Fri Jan 17 21:42:02 2014 +0200 +++ b/src/format.cc Fri Jan 17 22:55:13 2014 +0200 @@ -31,6 +31,7 @@ #include <cstdio> #include "main.h" #include "format.h" +#include "lexer.h" static void draw_pos (const string& fmt, int pos) { @@ -121,4 +122,18 @@ { string out = format_args (args); fprintf (fp, "%s", out.chars()); +} + +void do_error (string msg) +{ + lexer* lx = lexer::get_main_lexer(); + string fileinfo; + + if (lx != null && lx->has_valid_token()) + { + lexer::token* tk = lx->get_token(); + fileinfo = format ("%1:%2:%3: ", tk->file, tk->line, tk->column); + } + + throw script_error (fileinfo + msg); } \ No newline at end of file