Mercurial > hg > octave-nkf
changeset 2300:9484969866d2
[project @ 1996-06-24 07:13:26 by jwe]
author | jwe |
---|---|
date | Mon, 24 Jun 1996 07:15:11 +0000 |
parents | f296bbc757a1 |
children | b6c2559cf865 |
files | src/lex.l src/variables.cc |
diffstat | 2 files changed, 37 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lex.l +++ b/src/lex.l @@ -1063,22 +1063,34 @@ // Grab the help text from an function file. Always overwrites the // current contents of help_buf. +// XXX FIXME XXX -- gobble_leading_white_space() in variables.cc +// duplicates some of this code! + static void grab_help_text (void) { help_buf.resize (0); - int in_comment = 1; + bool begin_comment = true; + bool in_comment = true; int c = 0; while ((c = yyinput ()) != EOF) { + if (begin_comment) + { + if (c == '%' || c == '#') + continue; + else + begin_comment = false; + } + if (in_comment) { help_buf += (char) c; if (c == '\n') - in_comment = 0; + in_comment = false; } else { @@ -1086,7 +1098,8 @@ { case '%': case '#': - in_comment = 1; + in_comment = true; + begin_comment = true; break; case ' ':
--- a/src/variables.cc +++ b/src/variables.cc @@ -411,25 +411,37 @@ // IN_PARTS, consider each block of comments separately; otherwise, // grab them all at once. +// XXX FIXME XXX -- grab_help_text() in lex.l duplicates some of this +// code! + static string gobble_leading_white_space (FILE *ffile, int in_parts) { string help_txt; - int first_comments_seen = 0; - int have_help_text = 0; - int in_comment = 0; + bool first_comments_seen = false; + bool begin_comment = false; + bool have_help_text = false; + bool in_comment = false; int c; while ((c = getc (ffile)) != EOF) { current_input_column++; + if (begin_comment) + { + if (c == '%' || c == '#') + continue; + else + begin_comment = false; + } + if (in_comment) { if (! have_help_text) { - first_comments_seen = 1; + first_comments_seen = true; help_txt += (char) c; } @@ -437,7 +449,7 @@ { input_line_number++; current_input_column = 0; - in_comment = 0; + in_comment = false; if (in_parts) { @@ -460,19 +472,20 @@ case ' ': case '\t': if (first_comments_seen) - have_help_text = 1; + have_help_text = true; break; case '\n': if (first_comments_seen) - have_help_text = 1; + have_help_text = true; input_line_number++; current_input_column = 0; continue; case '%': case '#': - in_comment = 1; + begin_comment = true; + in_comment = true; break; default: