octave-maintainers
[Top][All Lists]
Advanced

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

Re: Parsing "commands"


From: John W. Eaton
Subject: Re: Parsing "commands"
Date: Mon, 16 Feb 2009 16:59:55 -0500

On 16-Feb-2009, Søren Hauberg wrote:

| søn, 15 02 2009 kl. 23:50 -0500, skrev John W. Eaton:
| > On 15-Feb-2009, Søren Hauberg wrote:
| > 
| > | lør, 14 02 2009 kl. 20:12 -0500, skrev John W. Eaton:
| > | > Although I see all tests passing with this change, it is still quite
| > | > experimental and probably not quite right yet, so I have not checked
| > | > it in.  But it would help for it and the previous lexer/parser patch
| > | > to get some additional testing.
| > | > 
| > | > Comments?
| > | 
| > | My intuition tells me that it's fairly hard to test such a change. So, I
| > | think the best way to test it, is to use it in "real life" situations.
| > | So, I'd say, commit the changes, to get more wide testing.
| > 
| > OK, you're probably right.  I checked these changes in.
| 
| Okay, so I'm playing a bit around with a recent checkout. I've created
| the following function
| 
|   function retval = cmd (varargin)
|     str = sprintf ('%s ', varargin {:});
|     retval = length (str);
|   endfunction
| 
| I see the following non-compatible situations
| 
| ** Octave **
| octave:4> cmd - 1
| parse error:
| 
|   syntax error
| 
| >>> cmd - 1
|           ^
| 
| ** Matlab ** 
| >> cmd - 1
| 
| ans =
| 
|     -1
| 
| ** Octave **
| octave:11> cmd + - 1
| ans =  1
| 
| ** Matlab **
| >> cmd + - 1
| 
| ans =
| 
|     -1

I checked in a change that fixes these.

| ** Octave **
| octave:13> cmd += 2
| parse error:
| 
|   syntax error
| 
| >>> cmd += 2
| 
| ** Matlab **
| >> cmd += 2
| 
| ans =
| 
|      5

In Octave, +=, -=, etc., are binary assignment operators.  But I guess
they don't make sense unless the left hand side is a variable, so
maybe I can "fix" this one too.  But I'll have to give it a little
more thought.

jwe



reply via email to

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