Mercurial > octave-nkf
comparison src/lex.l @ 947:570f55edf65f
[project @ 1994-11-22 17:12:12 by jwe]
author | jwe |
---|---|
date | Tue, 22 Nov 1994 17:12:12 +0000 |
parents | c4827d0fe063 |
children | b228d6cd59a1 |
comparison
equal
deleted
inserted
replaced
946:91edf12ce30b | 947:570f55edf65f |
---|---|
162 else | 162 else |
163 TOK_RETURN (';'); | 163 TOK_RETURN (';'); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 <TEXT_FCN>{S}* { current_input_column += yyleng; } | |
168 | |
167 <HELP_FCN>[^ \t\n]*{S}* | | 169 <HELP_FCN>[^ \t\n]*{S}* | |
168 <TEXT_FCN>[^ \t\n\;\,]*{S}* { | 170 <TEXT_FCN>[^ \t\n\;\,]*{S}* { |
169 static char *tok = 0; | 171 static char *tok = 0; |
170 delete [] tok; | 172 delete [] tok; |
171 tok = strip_trailing_whitespace (yytext); | 173 tok = strip_trailing_whitespace (yytext); |
217 token_stack.push (yylval.tok_val); | 219 token_stack.push (yylval.tok_val); |
218 current_input_column += yyleng; | 220 current_input_column += yyleng; |
219 } | 221 } |
220 return TEXT; | 222 return TEXT; |
221 } | 223 } |
222 | |
223 <TEXT_FCN>{S}* { current_input_column += yyleng; } | |
224 | 224 |
225 <STRING>{QSTR}*[\n\'] { | 225 <STRING>{QSTR}*[\n\'] { |
226 if (braceflag) | 226 if (braceflag) |
227 BEGIN MATRIX; | 227 BEGIN MATRIX; |
228 else | 228 else |
294 // | 294 // |
295 // It would have been so much easier if the delimiters were simply | 295 // It would have been so much easier if the delimiters were simply |
296 // different for the expression on the left hand side of the equals | 296 // different for the expression on the left hand side of the equals |
297 // operator. | 297 // operator. |
298 | 298 |
299 in_brace_or_paren.pop (); | 299 if (! in_brace_or_paren.empty ()) |
300 braceflag--; | 300 { |
301 in_brace_or_paren.pop (); | |
302 braceflag--; | |
303 } | |
304 | |
301 if (braceflag == 0) | 305 if (braceflag == 0) |
302 { | 306 { |
303 if (! defining_func) | 307 if (! defining_func) |
304 promptflag++; | 308 promptflag++; |
305 BEGIN 0; | 309 BEGIN 0; |
310 convert_spaces_to_comma = 1; | 314 convert_spaces_to_comma = 1; |
311 return ']'; | 315 return ']'; |
312 } | 316 } |
313 | 317 |
314 <MATRIX>{SN}*\]{S}*/= { | 318 <MATRIX>{SN}*\]{S}*/= { |
315 in_brace_or_paren.pop (); | 319 if (! in_brace_or_paren.empty ()) |
316 braceflag--; | 320 { |
321 in_brace_or_paren.pop (); | |
322 braceflag--; | |
323 } | |
324 | |
317 if (braceflag == 0) | 325 if (braceflag == 0) |
318 { | 326 { |
319 BEGIN 0; | 327 BEGIN 0; |
320 if (! defining_func) | 328 if (! defining_func) |
321 promptflag++; | 329 promptflag++; |
334 fixup_column_count (yytext); | 342 fixup_column_count (yytext); |
335 | 343 |
336 // It's a pain in the ass to decide whether to insert a comma after | 344 // It's a pain in the ass to decide whether to insert a comma after |
337 // seeing a ']' character... | 345 // seeing a ']' character... |
338 | 346 |
339 in_brace_or_paren.pop (); | 347 if (! in_brace_or_paren.empty ()) |
340 braceflag--; | 348 { |
349 in_brace_or_paren.pop (); | |
350 braceflag--; | |
351 } | |
352 | |
341 if (braceflag == 0) | 353 if (braceflag == 0) |
342 { | 354 { |
343 if (! defining_func) | 355 if (! defining_func) |
344 promptflag++; | 356 promptflag++; |
345 BEGIN 0; | 357 BEGIN 0; |
356 | 368 |
357 int c1 = yyinput (); | 369 int c1 = yyinput (); |
358 unput (c1); | 370 unput (c1); |
359 int other_op = match_any (c1, ",;\n]"); | 371 int other_op = match_any (c1, ",;\n]"); |
360 | 372 |
361 if (! (postfix_un_op || bin_op || other_op) | 373 if (! (postfix_un_op |
362 && in_brace_or_paren.top () | 374 || bin_op |
363 && convert_spaces_to_comma) | 375 || other_op |
376 || in_brace_or_paren.empty ()) | |
377 && in_brace_or_paren.top () | |
378 && convert_spaces_to_comma) | |
364 { | 379 { |
365 unput (','); | 380 unput (','); |
366 return ']'; | 381 return ']'; |
367 } | 382 } |
368 } | 383 } |
383 { | 398 { |
384 int bin_op = next_token_is_bin_op (1, yytext); | 399 int bin_op = next_token_is_bin_op (1, yytext); |
385 int postfix_un_op | 400 int postfix_un_op |
386 = next_token_is_postfix_unary_op (1, yytext); | 401 = next_token_is_postfix_unary_op (1, yytext); |
387 | 402 |
388 if (! (postfix_un_op || bin_op) | 403 if (! (postfix_un_op |
404 || bin_op | |
405 || in_brace_or_paren.empty ()) | |
389 && in_brace_or_paren.top () | 406 && in_brace_or_paren.top () |
390 && convert_spaces_to_comma) | 407 && convert_spaces_to_comma) |
391 TOK_RETURN (','); | 408 TOK_RETURN (','); |
392 } | 409 } |
393 } | 410 } |