Mercurial > octave
comparison NEWS @ 29900:da6e5914ddaf
handle all binary operators the same when detecting command syntax (bug #60882)
This change breaks Matlab compatibility when parsing things like
x += 2
Matlab will handle this as a command-style function call with two
arguments '+=' and '2'. Octave will now treat this as a computed
assignment (the variable X incremented by 2). Octave will still
handle
x +=2
as a command-style function call when parsing this statement inside a
function.
At the command line, Octave will recognize this statement as a
computed assignment expression if X is already defined to be a
variable. Note that command lines are parsed completely before
executing anything, so in
octave> clear x
octave> x = 1; x +=2
the "x +=2" statement will be parsed as a command-style function call
because the parser does not find a definition for X as a variable when
that portion of the command line is parsed.
* lex.ll (CMD_OR_COMPUTED_ASSIGN_OP): Delete macro. Change all uses
to CMD_OR_OP instead.
(base_lexer::handle_identifier): Don't call mark_may_be_command for
token if we are at the top level and the identifier has already been
recognized as a variable.
* parser.tst: Update test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 21 Jul 2021 09:49:09 -0400 |
parents | 6829836f86c2 |
children | ad023dbe9606 |
comparison
equal
deleted
inserted
replaced
29899:853e4b7ae0d5 | 29900:da6e5914ddaf |
---|