octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60882] error parsing command syntax


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #60882] error parsing command syntax
Date: Wed, 21 Jul 2021 13:38:01 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #31, bug #60882 (project octave):

BTW, this trouble all started when I was working on handling the new
"arguments" block syntax and I decided to try to eliminate some duplicated
information in the parser and interpreter.  Instead of storing lists of
pending variables (function parameters and identifiers found on the LHS of
assignment operators) in the lexer and storing identifiers in the symbol
table, I thought it would be best to just tag the symbols in the symbol table
as (expected) variables based on syntax alone.  A mistake in that change
caused the bug reported here.  (The mistake was entering "diary" as a variable
when it appeared in an expression like "job.diary = ...", even though "diary"
by itself here isn't a variable.)

Now I think I'm just confused about what we should be doing here, because I
just made a change so that we are once again treating


a=1;
b=2;
a -b


at the command line differently from what happens in a function or script
because my change made Octave look at the symbol table to decide whether "a"
is a variable when parsing "a -b", and if it is, to not handle that statement
as a command.  But according to comment #15, current versions of Matlab are no
longer doing that?  I think it is better if there is not special treatment at
the command line, so I undid that part of my previous change, here:

I also think it is best if we can parse the command-style syntax completely
based on syntax, so I would prefer to stick with that change.  But it does
present some compatibility problems.  If we use syntax alone and opt for full
Matlab compatibility, then none  of the OP= operators can work properly with
simple identifiers at the beginning of an expression because Matlab will
always parse statements like "foo -= bar" as commands (please correct me if
that's not the case).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60882>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]