--- parser3/src/main/compile.C 2003/03/21 16:16:43 1.69.2.6.2.4 +++ parser3/src/main/compile.C 2004/02/26 14:37:30 1.73 @@ -1,11 +1,11 @@ /** @file Parser: compiler part of request class. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char* IDENT_COMPILE_C="$Date: 2003/03/21 16:16:43 $"; +static const char * const IDENT_COMPILE_C="$Date: 2004/02/26 14:37:30 $"; #include "pa_opcode.h" #include "pa_request.h" @@ -14,21 +14,23 @@ static const char* IDENT_COMPILE_C="$Dat extern int yydebug; extern int yyparse (void *); -VStateless_class& Request::compile(VStateless_class* aclass, const char* source, const char* file) { +VStateless_class& Request::compile(VStateless_class* aclass, + const char* source, const String* main_alias, + uint file_no, + int line_no_offset) { // prepare to parse - parse_control pc(*this, aclass, source, file); + Parse_control pc(*this, aclass, source, main_alias, file_no, line_no_offset); // parse=compile! //yydebug=1; if(yyparse(&pc)) { // error? - if(pc.col==0) { // expecting something after EOL means they've expected it BEFORE - // step back. -1 col means EOL - pc.line--; - pc.col=-1; - } + pc.pos_prev_c(); + if(pc.pos.col==0) // expecting something after EOL means they've expected it BEFORE + pc.pos_prev_c(); + throw Exception("parser.compile", 0, - "%s(%d:%d): %s", file, 1+pc.line, pc.col, pc.error); + "%s(%u:%u): %s", file_list[file_no].cstr(), 1+pc.pos.line, 1+pc.pos.col, pc.error); } // result