Mercurial > octave
view .dir-locals.el @ 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 | df203b20cfc6 |
children |
line wrap: on
line source
((nil . ((c-file-style . "gnu") (indent-tabs-mode . nil) (fill-column . 72))) (change-log-mode . ((indent-tabs-mode . t))) (makefile-mode . ((indent-tabs-mode . t))))