void parse_file( OBJECT * f, FRAME * frame ) { /* Suspend scan of current file and push this new file in the stream. */ yyfparse( f ); /* Now parse each block of rules and execute it. Execute it outside of the * parser so that recursive calls to yyrun() work (no recursive yyparse's). */ for ( ; ; ) { PARSE * p; FUNCTION * func; /* Filled by yyparse() calling parse_save(). */ yypsave = 0; /* If parse error or empty parse, outta here. */ if ( yyparse() || !( p = yypsave ) ) break; /* Run the parse tree. */ func = function_compile( p ); parse_free( p ); list_free( function_run( func, frame, stack_global() ) ); function_free( func ); } yyfdone(); }
void parse_file( const char *f ) { /* Suspend scan of current file */ /* and push this new file in the stream */ yyfparse(f); /* Now parse each block of rules and execute it. */ /* Execute it outside of the parser so that recursive */ /* calls to yyrun() work (no recursive yyparse's). */ for(;;) { LOL l; PARSE *p; int jmp = 0; /* JMP_NONE */ /* $(<) and $(>) empty in outer scope. */ lol_init( &l ); /* Filled by yyparse() calling parse_save() */ yypsave = 0; /* If parse error or empty parse, outta here */ if( yyparse() || !( p = yypsave ) ) break; /* Run the parse tree. */ list_free( (*(p->func))( p, &l, &jmp ) ); parse_free( p ); } }