octave-maintainers
[Top][All Lists]
Advanced

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

Re: whitespace and structure access operator


From: John W. Eaton
Subject: Re: whitespace and structure access operator
Date: Wed, 25 Nov 2015 17:50:57 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0

On 11/25/2015 11:23 AM, Rik wrote:
On 11/25/2015 04:43 AM, John W. Eaton wrote:
On 11/25/2015 03:59 AM, Sebastian Schöps wrote:
Rik-4 wrote
Can someone test whether the Matlab interpreter accepts the following
code?

b .x = 1

The key is the space between the structure access operator "." and the
initially undefined variable b.  Without the space Octave parses this just
fine.

--Rik


Yes it does (R2015b, Mac):

b .x = 1

b =

      x: 1

Thanks.

Rik, do you want me to take a look at fixing this, or do you want to do it?

jwe,

I'm sure this is in the parser which means you are likely to find the
solution faster than me.  I hope it is as simple as having some sort of
rule to eat whitespace in the lexer.  The original bug report that brought
this to my attention was https://savannah.gnu.org/bugs/?42559.

This problem is due to the lexer recognizing things like

  b .x

as commands instead of structure references, so the syntax is valid and it is being treated as a function call equivalent to

  b ('.x')

That's incorrect, but I don't see an immediate fix.

What does Matlab do for things like

  b . x = 1

Does the behavior differ if there is a function called 'b' in the path (I hope not, but I have to ask)?

jwe




reply via email to

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