comparison src/lex.l @ 3427:e098ebb77023

[project @ 2000-01-13 09:25:53 by jwe]
author jwe
date Thu, 13 Jan 2000 09:25:59 +0000
parents 18366d37e7dd
children 5b77cf82393c
comparison
equal deleted inserted replaced
3426:f8dde1807dee 3427:e098ebb77023
1171 } 1171 }
1172 1172
1173 // Grab the help text from an function file. Always overwrites the 1173 // Grab the help text from an function file. Always overwrites the
1174 // current contents of help_buf. 1174 // current contents of help_buf.
1175 1175
1176 // XXX FIXME XXX -- gobble_leading_white_space() in variables.cc 1176 // XXX FIXME XXX -- gobble_leading_white_space() in parse.y
1177 // duplicates some of this code! 1177 // duplicates some of this code!
1178 1178
1179 static void 1179 static void
1180 grab_help_text (void) 1180 grab_help_text (void)
1181 { 1181 {
1182 help_buf.resize (0); 1182 help_buf.resize (0);
1183 1183
1184 bool begin_comment = true; 1184 bool begin_comment = true;
1185 bool in_comment = true; 1185 bool in_comment = true;
1186 bool discard_space = true;
1186 int c = 0; 1187 int c = 0;
1187 1188
1188 while ((c = yyinput ()) != EOF) 1189 while ((c = yyinput ()) != EOF)
1189 { 1190 {
1190 if (begin_comment) 1191 if (begin_comment)
1191 { 1192 {
1192 if (c == '%' || c == '#') 1193 if (c == '%' || c == '#')
1193 continue; 1194 continue;
1195 else if (discard_space && c == ' ')
1196 {
1197 discard_space = false;
1198 continue;
1199 }
1194 else 1200 else
1195 begin_comment = false; 1201 begin_comment = false;
1196 } 1202 }
1197 1203
1198 if (in_comment) 1204 if (in_comment)
1199 { 1205 {
1200 help_buf += (char) c; 1206 help_buf += (char) c;
1201 1207
1202 if (c == '\n') 1208 if (c == '\n')
1203 in_comment = false; 1209 {
1210 in_comment = false;
1211 discard_space = true;
1212 }
1204 } 1213 }
1205 else 1214 else
1206 { 1215 {
1207 switch (c) 1216 switch (c)
1208 { 1217 {