diff --git a/libinterp/parse-tree/lex.h b/libinterp/parse-tree/lex.h --- a/libinterp/parse-tree/lex.h +++ b/libinterp/parse-tree/lex.h @@ -347,8 +347,6 @@ namespace octave bool previous_token_may_be_command (void) const; - void maybe_mark_previous_token_as_variable (void); - void mark_as_variable (const std::string& nm); void mark_as_variables (const std::list& lst); diff --git a/libinterp/parse-tree/lex.ll b/libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -1817,8 +1817,6 @@ ANY_INCLUDING_NL (.|{NL}) "=" { curr_lexer->lexer_debug ("="); - curr_lexer->maybe_mark_previous_token_as_variable (); - return curr_lexer->handle_op ('='); } @@ -2353,12 +2351,9 @@ namespace octave } void - lexical_feedback::maybe_mark_previous_token_as_variable (void) + lexical_feedback::mark_as_variable (const std::string& nm) { - token *tok = m_tokens.front (); - - if (tok && tok->isstring ()) - m_pending_local_variables.insert (tok->text ()); + m_pending_local_variables.insert (nm); } void diff --git a/libinterp/parse-tree/oct-parse.yy b/libinterp/parse-tree/oct-parse.yy --- a/libinterp/parse-tree/oct-parse.yy +++ b/libinterp/parse-tree/oct-parse.yy @@ -3428,6 +3428,8 @@ namespace octave { tree_expression *tmp = lhs->remove_front (); + m_lexer.mark_as_variable (tmp->name ()); + retval = new tree_simple_for_command (parfor, tmp, expr, maxproc, body, lc, tc, l, c); @@ -3444,9 +3446,11 @@ namespace octave bison_error ("invalid syntax for parfor statement"); } - else - retval = new tree_complex_for_command (lhs, expr, body, - lc, tc, l, c); + + m_lexer.mark_as_variables (lhs->variable_names ()); + + retval = new tree_complex_for_command (lhs, expr, body, + lc, tc, l, c); } } else @@ -3769,6 +3773,8 @@ namespace octave delete lhs; + m_lexer.mark_as_variable (tmp->name ()); + return new tree_simple_assignment (tmp, rhs, false, l, c, t); } else @@ -3789,6 +3795,8 @@ namespace octave } } + m_lexer.mark_as_variables (names); + return new tree_multi_assignment (lhs, rhs, false, l, c); } }