Mercurial > hg > octave-max
changeset 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 | 333bf09e3b6e |
children | 8f17e3309a82 |
files | src/ChangeLog src/oct-parse.yy |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-09 John W. Eaton <jwe@octave.org> + + * oct-parse.yy (parse_fcn_file): Handle empty script files + (bug #30588). + 2010-08-09 Jaroslav Hajek <highegg@gmail.com> * ov.cc (octave_value::assign (assign_op, const std::string&,
--- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -3488,6 +3488,9 @@ std::string help_txt = gobble_leading_white_space (ffile, eof); + if (! help_txt.empty ()) + help_buf.push (help_txt); + if (! eof) { std::string file_type; @@ -3553,9 +3556,6 @@ symbol_table::scope_id scope = symbol_table::top_scope (); frame.add_fcn (symbol_table::unmark_forced_variables, scope); - if (! help_txt.empty ()) - help_buf.push (help_txt); - if (reading_script_file) prep_lexer_for_script_file (); else @@ -3576,6 +3576,15 @@ error ("parse error while reading %s file %s", file_type.c_str(), ff.c_str ()); } + else + { + tree_statement *end_of_script + = make_end ("endscript", input_line_number, current_input_column); + + make_script (0, end_of_script); + + fcn_ptr = primary_fcn_ptr; + } } else if (require_file) error ("no such file, `%s'", ff.c_str ());