comparison libinterp/interpfcn/toplev.cc @ 16151:e309eb7940be

parser tweaks * input.cc (get_debug_input): Create parser outside of loop. * toplev.cc (main_loop): Likewise. * oct-parse.yy (parse_fcn_file): Don't reset newly created parser.
author John W. Eaton <jwe@octave.org>
date Wed, 27 Feb 2013 20:32:42 -0500
parents 49dfba4fd3c5
children c5bfdc4c0963
comparison
equal deleted inserted replaced
16150:891a2a4df71f 16151:e309eb7940be
557 557
558 octave_initialized = true; 558 octave_initialized = true;
559 559
560 // The big loop. 560 // The big loop.
561 561
562 unwind_protect frame;
563
564 // octave_parser constructor sets this for us.
565 frame.protect_var (CURR_LEXER);
566
567 octave_parser *curr_parser = new octave_parser ();
568 frame.add_fcn (octave_parser::cleanup, curr_parser);
569
562 int retval = 0; 570 int retval = 0;
563 do 571 do
564 { 572 {
565 try 573 try
566 { 574 {
567 unwind_protect frame; 575 unwind_protect inner_frame;
568
569 // octave_parser constructor sets this for us.
570 frame.protect_var (CURR_LEXER);
571
572 octave_parser *curr_parser = new octave_parser ();
573 frame.add_fcn (octave_parser::cleanup, curr_parser);
574 576
575 reset_error_handler (); 577 reset_error_handler ();
576 578
577 curr_parser->reset (); 579 curr_parser->reset ();
578 580
581 583
582 // Do this with an unwind-protect cleanup function so that 584 // Do this with an unwind-protect cleanup function so that
583 // the forced variables will be unmarked in the event of an 585 // the forced variables will be unmarked in the event of an
584 // interrupt. 586 // interrupt.
585 symbol_table::scope_id scope = symbol_table::top_scope (); 587 symbol_table::scope_id scope = symbol_table::top_scope ();
586 frame.add_fcn (symbol_table::unmark_forced_variables, scope); 588 inner_frame.add_fcn (symbol_table::unmark_forced_variables, scope);
587 589
588 frame.protect_var (global_command); 590 inner_frame.protect_var (global_command);
589 591
590 global_command = 0; 592 global_command = 0;
591 593
592 retval = curr_parser->run (); 594 retval = curr_parser->run ();
593 595