Mercurial > octave
diff 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 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll Tue Sep 22 19:26:09 2020 +0200 +++ b/libinterp/parse-tree/lex.ll Tue Sep 22 14:19:11 2020 -0400 @@ -274,7 +274,7 @@ || curr_lexer->previous_token_is_binop ())) \ { \ yyless (0); \ - unput (','); \ + curr_lexer->xunput (','); \ } \ else \ return curr_lexer->handle_number<BASE> (); \ @@ -295,7 +295,7 @@ || curr_lexer->previous_token_is_binop ())) \ { \ yyless (0); \ - unput (','); \ + curr_lexer->xunput (','); \ } \ else \ { \ @@ -582,6 +582,10 @@ curr_lexer->m_filepos.increment_column (yyleng); } +%{ +// Whitespace inside matrix lists. +%} + <MATRIX_START>{S}* { curr_lexer->lexer_debug ("<MATRIX_START>{S}*"); @@ -607,6 +611,24 @@ } %{ +// Continuation lines in matrix constants are handled as whitespace. +// Allow arbitrary text after the continuation marker. +%} + +<MATRIX_START>\.\.\.{ANY_EXCEPT_NL}*{NL} { + curr_lexer->lexer_debug ("<MATRIX_START>\\.\\.\\.{ANY_EXCEPT_NL}*{NL}"); + + curr_lexer->handle_continuation (); + + // Even if there wasn't a space before or after the continuation + // marker, treat the continuation as if it were. But since it will + // be transformed to a separator later anyway, there's no need to + // actually unput a space on the input stream. + + curr_lexer->mark_previous_token_trailing_space (); + } + +%{ // For this and the next two rules, we're looking at ']', and we // need to know if the next token is '=' or '=='. // @@ -1414,7 +1436,7 @@ || curr_lexer->previous_token_is_binop ())) { yyless (0); - unput (','); + curr_lexer->xunput (','); } else {