Mercurial > octave
changeset 29924:aeba7278cf80
fix logic error in changeset 28a39ddabbfc
* lex.ll (.): Check for possible command-style function call syntax
after checking for end of input buffer or end of file, not before.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 28 Jul 2021 00:28:26 -0400 |
parents | b436a01d186d |
children | 53de043ea532 |
files | libinterp/parse-tree/lex.ll |
diffstat | 1 files changed, 27 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll Tue Jul 27 23:45:08 2021 -0400 +++ b/libinterp/parse-tree/lex.ll Wed Jul 28 00:28:26 2021 -0400 @@ -1889,43 +1889,40 @@ . { curr_lexer->lexer_debug ("."); - if (curr_lexer->previous_token_may_be_command () - && curr_lexer->space_follows_previous_token ()) + curr_lexer->xunput (yytext[0]); + + int c = curr_lexer->text_yyinput (); + + if (c == 1) + return -1; + else if (c == EOF) + return curr_lexer->handle_end_of_input (); + else if (curr_lexer->previous_token_may_be_command () + && curr_lexer->space_follows_previous_token ()) { yyless (0); curr_lexer->push_start_state (COMMAND_START); } else { - curr_lexer->xunput (yytext[0]); - - int c = curr_lexer->text_yyinput (); - - if (c == 1) - return -1; - else if (c == EOF) - return curr_lexer->handle_end_of_input (); - else - { - std::ostringstream buf; - - buf << "invalid character '" - << octave::undo_string_escape (static_cast<char> (c)) - << "' (ASCII " << c << ")"; - - // Use current file position for error token. - octave::token *tok - = new octave::token (LEXICAL_ERROR, buf.str (), - curr_lexer->m_filepos, curr_lexer->m_filepos); - - curr_lexer->push_token (tok); - - curr_lexer->m_filepos.increment_column (); - - return curr_lexer->count_token_internal (LEXICAL_ERROR); - } + std::ostringstream buf; + + buf << "invalid character '" + << octave::undo_string_escape (static_cast<char> (c)) + << "' (ASCII " << c << ")"; + + // Use current file position for error token. + octave::token *tok + = new octave::token (LEXICAL_ERROR, buf.str (), + curr_lexer->m_filepos, curr_lexer->m_filepos); + + curr_lexer->push_token (tok); + + curr_lexer->m_filepos.increment_column (); + + return curr_lexer->count_token_internal (LEXICAL_ERROR); } -} + } %{ #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)