Mercurial > hg > octave-avbm
changeset 4241:71209cc7ad4a
[project @ 2002-12-26 00:24:10 by jwe]
author | jwe |
---|---|
date | Thu, 26 Dec 2002 00:24:10 +0000 |
parents | 8627d992beb8 |
children | 4d3994172bd5 |
files | src/lex.l |
diffstat | 1 files changed, 0 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lex.l +++ b/src/lex.l @@ -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<char> (c); - beginning_of_comment = false; - } - break; - - case '%': - case '#': - if (in_comment) - { - if (! beginning_of_comment) - comment_buf += static_cast<char> (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<char> (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<char> (c); - c = yyinput (); - if (c == EOF) - break; - else if (c == '\n') - { - if (in_comment) - { - comment_buf += static_cast<char> (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<char> (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) {