--- parser3/src/targets/parser/Attic/parser.C 2001/02/21 11:13:37 1.10 +++ parser3/src/targets/parser/Attic/parser.C 2001/02/21 15:27:00 1.13 @@ -1,5 +1,5 @@ /* - $Id: parser.C,v 1.10 2001/02/21 11:13:37 paf Exp $ + $Id: parser.C,v 1.13 2001/02/21 15:27:00 paf Exp $ */ #include @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) { // compile char *file="c:\\temp\\test.p"; char *source=file_read(request.pool(), file); - Array *compiled_methods=COMPILE(request, source, file); + Array& compiled_methods=COMPILE(request, source, file); String name_RUN(request.pool()); name_RUN.APPEND_CONST("RUN"); // create new 'name' vclass, add it to request's classes @@ -158,26 +158,24 @@ int main(int argc, char *argv[]) { VClass *vclass=new(pool) VClass(pool, &name_RUN, immediate_parents); request.classes().put(name_RUN, vclass); - if(compiled_methods) { - for(int i=0; isize(); i++) { - Method &method=*static_cast(compiled_methods->raw_get(i)); - vclass->add_method(method.name, method); - } + for(int i=0; i(compiled_methods.quick_get(i)); + vclass->add_method(method.name, method); } } { - VClass *class_RUN=request.classes().get(RUN); + VClass *class_RUN=static_cast(request.classes().get(name_RUN)); String name_main(pool); - name_main.APPEND_CONST("main"); - Method *method_main=vclass.get_method(name_main); + name_main.APPEND_CONST(MAIN_METHOD_NAME); + Method *method_main=class_RUN->get_method(name_main); if(!method_main) request.exception().raise(0,0, - class_RUN.name(), - "no 'main' method"); + &class_RUN->name(), + "no 'main' method in class"); - Array *code=method_main->code; - execute(&pool, code); + Array& code=method_main->code; + execute(pool, code); } } else { @@ -194,9 +192,12 @@ int main(int argc, char *argv[]) { const String *problem_source=e.problem_source(); if(problem_source) { const Origin& origin=problem_source->origin(); - printf(" '%s' [%s:%d]\n", - problem_source->cstr(), - origin.file, origin.line); + printf(" '%s'\n", + problem_source->cstr()); + if(origin.file) + printf(" [%s:%d]", + origin.file, origin.line); + printf("\n"); } } } else {