Mercurial > hg > octave-nkf
diff 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 |
line wrap: on
line diff
--- 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 ());