--- parser3/src/main/compile.C 2001/02/20 18:45:52 1.1 +++ parser3/src/main/compile.C 2001/02/21 06:21:19 1.3 @@ -1,7 +1,8 @@ /* - $Id: compile.C,v 1.1 2001/02/20 18:45:52 paf Exp $ + $Id: compile.C,v 1.3 2001/02/21 06:21:19 paf Exp $ */ +#include "pa_string.h" #include "pa_array.h" #include "code.h" #include "compile_tools.h" @@ -13,6 +14,9 @@ extern int yydebug; extern int yyparse (void *); Array *real_compile(COMPILE_PARAMS) { + if(!source) + return 0; + yydebug=1; struct parse_control pc; /* input */ @@ -24,11 +28,11 @@ Array *real_compile(COMPILE_PARAMS) { #endif /* state to initial */ pc.pending_state=0; - pc.string=string_create(pool); + pc.string=new(*pool) String(*pool); pc.ls=LS_USER; pc.sp=0; /* parse! */ - printf("[yyparse returned %d]", yyparse(&pc)); + int parse_error=yyparse(&pc); /* result */ - return static_cast(pc.result); + return parse_error?0:static_cast(pc.result); }