# HG changeset patch # User jwe # Date 1040862250 0 # Node ID 71209cc7ad4a375e193a67643ea79674a899c13d # Parent 8627d992beb86dce585c48c14017235d41c566a0 [project @ 2002-12-26 00:24:10 by jwe] diff -r 8627d992beb8 -r 71209cc7ad4a src/lex.l --- a/src/lex.l Wed Dec 25 23:07:03 2002 +0000 +++ b/src/lex.l Thu Dec 26 00:24:10 2002 +0000 @@ -2520,112 +2520,6 @@ return NAME; } -// Print a warning if a function file that defines a function has -// anything other than comments and whitespace following the END token -// that matches the FUNCTION statement. - -void -check_for_garbage_after_fcn_def (void) -{ - // By making a newline be the next character to be read, we will - // force the parser to return after reading the function. Calling - // unput with EOF does not work. - - std::string comment_buf; - - bool in_comment = false; - bool beginning_of_comment = true; - - int lineno = input_line_number; - - int c = 0; - - while ((c = yyinput ()) != EOF) - { - switch (c) - { - case ' ': - case '\t': - case ';': - case ',': - if (in_comment) - { - comment_buf += static_cast (c); - beginning_of_comment = false; - } - break; - - case '%': - case '#': - if (in_comment) - { - if (! beginning_of_comment) - comment_buf += static_cast (c); - } - else - { - maybe_gripe_matlab_incompatible_comment (c); - in_comment = true; - beginning_of_comment = true; - } - break; - - case '\n': - if (in_comment) - { - comment_buf += static_cast (c); - octave_comment_buffer::append (comment_buf); - comment_buf.resize (0); - in_comment = false; - beginning_of_comment = false; - } - break; - - case '\r': - if (in_comment) - comment_buf += static_cast (c); - c = yyinput (); - if (c == EOF) - break; - else if (c == '\n') - { - if (in_comment) - { - comment_buf += static_cast (c); - octave_comment_buffer::append (comment_buf); - comment_buf.resize (0); - in_comment = false; - beginning_of_comment = false; - } - break; - } - - // Fall through... - - default: - if (in_comment) - { - comment_buf += static_cast (c); - beginning_of_comment = false; - break; - } - else - { - warning ("ignoring trailing garbage after end of function\n\ - near line %d of file `%s.m'", lineno, curr_fcn_file_name.c_str ()); - - unput ('\n'); - return; - } - } - } - - if (! comment_buf.empty ()) - octave_comment_buffer::append (comment_buf); - - unput ('\n'); -} - void lexical_feedback::init (void) {