Annotation of parser3/src/main/compile.C, revision 1.6
1.1 paf 1: /*
1.6 ! paf 2: $Id: compile.C,v 1.5 2001/02/21 07:19:40 paf Exp $
1.1 paf 3: */
4:
1.3 paf 5: #include "pa_string.h"
1.1 paf 6: #include "pa_array.h"
7: #include "code.h"
8: #include "compile_tools.h"
9: #include "compile.h"
1.4 paf 10: #include "pa_exception.h"
1.1 paf 11:
12: #include <stdio.h>
13:
14: extern int yydebug;
15: extern int yyparse (void *);
16:
17: Array *real_compile(COMPILE_PARAMS) {
1.2 paf 18: if(!source)
19: return 0;
20:
1.4 paf 21: Pool& pool=request.pool();
22:
1.5 paf 23: yydebug=1;
1.1 paf 24: struct parse_control pc;
25: /* input */
1.4 paf 26: pc.pool=&pool;
1.1 paf 27: pc.source=source;
28: #ifndef NO_STRING_ORIGIN
29: pc.file=file;
1.4 paf 30: pc.line=pc.col=1;
1.1 paf 31: #endif
32: /* state to initial */
33: pc.pending_state=0;
1.4 paf 34: pc.string=new(pool) String(pool);
1.1 paf 35: pc.ls=LS_USER;
36: pc.sp=0;
37: /* parse! */
1.6 ! paf 38: if(yyparse(&pc)) // parse, error?
! 39: request.exception().raise(0,0,
! 40: 0,
! 41: "%s @%s[%d:%d]", pc.error, file, pc.line, pc.col-1);
1.4 paf 42:
1.1 paf 43: /* result */
1.4 paf 44: return pc.result;
1.1 paf 45: }
E-mail: