# HG changeset patch # User John W. Eaton # Date 1627446506 14400 # Node ID aeba7278cf801a9998e3a4d4cb76d25aeef0888e # Parent b436a01d186d1339618cf6c064352d7e8f7239c6 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. diff -r b436a01d186d -r aeba7278cf80 libinterp/parse-tree/lex.ll --- 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 (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 (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)