comparison src/oct-parse.yy @ 10872:988d16d5ae34

correctly .m files that are empty or contain only comments
author John W. Eaton <jwe@octave.org>
date Mon, 09 Aug 2010 04:46:14 -0400
parents 8baff2aceabc
children 5af852c93af3
comparison
equal deleted inserted replaced
10871:333bf09e3b6e 10872:988d16d5ae34
3486 { 3486 {
3487 bool eof; 3487 bool eof;
3488 3488
3489 std::string help_txt = gobble_leading_white_space (ffile, eof); 3489 std::string help_txt = gobble_leading_white_space (ffile, eof);
3490 3490
3491 if (! help_txt.empty ())
3492 help_buf.push (help_txt);
3493
3491 if (! eof) 3494 if (! eof)
3492 { 3495 {
3493 std::string file_type; 3496 std::string file_type;
3494 3497
3495 frame.protect_var (get_input_from_eval_string); 3498 frame.protect_var (get_input_from_eval_string);
3551 // the forced variables will be unmarked in the event of an 3554 // the forced variables will be unmarked in the event of an
3552 // interrupt. 3555 // interrupt.
3553 symbol_table::scope_id scope = symbol_table::top_scope (); 3556 symbol_table::scope_id scope = symbol_table::top_scope ();
3554 frame.add_fcn (symbol_table::unmark_forced_variables, scope); 3557 frame.add_fcn (symbol_table::unmark_forced_variables, scope);
3555 3558
3556 if (! help_txt.empty ())
3557 help_buf.push (help_txt);
3558
3559 if (reading_script_file) 3559 if (reading_script_file)
3560 prep_lexer_for_script_file (); 3560 prep_lexer_for_script_file ();
3561 else 3561 else
3562 prep_lexer_for_function_file (); 3562 prep_lexer_for_function_file ();
3563 3563
3573 "in file %s", ff.c_str ()); 3573 "in file %s", ff.c_str ());
3574 3574
3575 if (status != 0) 3575 if (status != 0)
3576 error ("parse error while reading %s file %s", 3576 error ("parse error while reading %s file %s",
3577 file_type.c_str(), ff.c_str ()); 3577 file_type.c_str(), ff.c_str ());
3578 }
3579 else
3580 {
3581 tree_statement *end_of_script
3582 = make_end ("endscript", input_line_number, current_input_column);
3583
3584 make_script (0, end_of_script);
3585
3586 fcn_ptr = primary_fcn_ptr;
3578 } 3587 }
3579 } 3588 }
3580 else if (require_file) 3589 else if (require_file)
3581 error ("no such file, `%s'", ff.c_str ()); 3590 error ("no such file, `%s'", ff.c_str ());
3582 else if (! warn_for.empty ()) 3591 else if (! warn_for.empty ())