Mercurial > octave
comparison libinterp/parse-tree/lex.ll @ 28774:d2ad5e0e5aca
maint: merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 22 Sep 2020 14:19:11 -0400 |
parents | e6928695dacb 9cd5d348d36c |
children | cff933892ec2 |
comparison
equal
deleted
inserted
replaced
28771:671fd568b130 | 28774:d2ad5e0e5aca |
---|---|
272 && curr_lexer->space_follows_previous_token () \ | 272 && curr_lexer->space_follows_previous_token () \ |
273 && ! (tok == '[' || tok == '{' \ | 273 && ! (tok == '[' || tok == '{' \ |
274 || curr_lexer->previous_token_is_binop ())) \ | 274 || curr_lexer->previous_token_is_binop ())) \ |
275 { \ | 275 { \ |
276 yyless (0); \ | 276 yyless (0); \ |
277 unput (','); \ | 277 curr_lexer->xunput (','); \ |
278 } \ | 278 } \ |
279 else \ | 279 else \ |
280 return curr_lexer->handle_number<BASE> (); \ | 280 return curr_lexer->handle_number<BASE> (); \ |
281 } \ | 281 } \ |
282 } \ | 282 } \ |
293 && curr_lexer->space_follows_previous_token () \ | 293 && curr_lexer->space_follows_previous_token () \ |
294 && ! (tok == '[' || tok == '{' \ | 294 && ! (tok == '[' || tok == '{' \ |
295 || curr_lexer->previous_token_is_binop ())) \ | 295 || curr_lexer->previous_token_is_binop ())) \ |
296 { \ | 296 { \ |
297 yyless (0); \ | 297 yyless (0); \ |
298 unput (','); \ | 298 curr_lexer->xunput (','); \ |
299 } \ | 299 } \ |
300 else \ | 300 else \ |
301 { \ | 301 { \ |
302 if (! curr_lexer->m_looking_at_decl_list \ | 302 if (! curr_lexer->m_looking_at_decl_list \ |
303 && curr_lexer->previous_token_may_be_command ()) \ | 303 && curr_lexer->previous_token_may_be_command ()) \ |
580 | 580 |
581 curr_lexer->m_string_text += yytext; | 581 curr_lexer->m_string_text += yytext; |
582 curr_lexer->m_filepos.increment_column (yyleng); | 582 curr_lexer->m_filepos.increment_column (yyleng); |
583 } | 583 } |
584 | 584 |
585 %{ | |
586 // Whitespace inside matrix lists. | |
587 %} | |
588 | |
585 <MATRIX_START>{S}* { | 589 <MATRIX_START>{S}* { |
586 curr_lexer->lexer_debug ("<MATRIX_START>{S}*"); | 590 curr_lexer->lexer_debug ("<MATRIX_START>{S}*"); |
587 | 591 |
588 curr_lexer->m_filepos.increment_column (yyleng); | 592 curr_lexer->m_filepos.increment_column (yyleng); |
589 | 593 |
602 int tok = curr_lexer->previous_token_value (); | 606 int tok = curr_lexer->previous_token_value (); |
603 | 607 |
604 if (! (tok == ';' || tok == '[' || tok == '{')) | 608 if (! (tok == ';' || tok == '[' || tok == '{')) |
605 curr_lexer->xunput (';'); | 609 curr_lexer->xunput (';'); |
606 } | 610 } |
611 } | |
612 | |
613 %{ | |
614 // Continuation lines in matrix constants are handled as whitespace. | |
615 // Allow arbitrary text after the continuation marker. | |
616 %} | |
617 | |
618 <MATRIX_START>\.\.\.{ANY_EXCEPT_NL}*{NL} { | |
619 curr_lexer->lexer_debug ("<MATRIX_START>\\.\\.\\.{ANY_EXCEPT_NL}*{NL}"); | |
620 | |
621 curr_lexer->handle_continuation (); | |
622 | |
623 // Even if there wasn't a space before or after the continuation | |
624 // marker, treat the continuation as if it were. But since it will | |
625 // be transformed to a separator later anyway, there's no need to | |
626 // actually unput a space on the input stream. | |
627 | |
628 curr_lexer->mark_previous_token_trailing_space (); | |
607 } | 629 } |
608 | 630 |
609 %{ | 631 %{ |
610 // For this and the next two rules, we're looking at ']', and we | 632 // For this and the next two rules, we're looking at ']', and we |
611 // need to know if the next token is '=' or '=='. | 633 // need to know if the next token is '=' or '=='. |
1412 && curr_lexer->space_follows_previous_token () | 1434 && curr_lexer->space_follows_previous_token () |
1413 && ! (tok_val == '[' || tok_val == '{' | 1435 && ! (tok_val == '[' || tok_val == '{' |
1414 || curr_lexer->previous_token_is_binop ())) | 1436 || curr_lexer->previous_token_is_binop ())) |
1415 { | 1437 { |
1416 yyless (0); | 1438 yyless (0); |
1417 unput (','); | 1439 curr_lexer->xunput (','); |
1418 } | 1440 } |
1419 else | 1441 else |
1420 { | 1442 { |
1421 curr_lexer->update_token_positions (yyleng); | 1443 curr_lexer->update_token_positions (yyleng); |
1422 | 1444 |