functionend ignored
John W. Eaton
jwe at octave.org
Thu Jul 16 11:06:32 CDT 2009
On 16-Jul-2009, David Grundberg wrote:
| > OK, what is happening is that endfunction tokens (and end tokens that
| > should match function keywords) are ignored by the lexer. I think
| > this was done as a semi-tricky way to handle subfunctions. I guess we
| > should fix that in some other way so that the parser does see end
| > keywords instead of just EOF. I'll try to take a look a this part of
| > the problem, but I can't guarantee that I will get to it any time
| > soon.
|
| Looked further into the lexer yesterday and pretty much came to the same
| conclusion (special cases for parsing subfunctions). I think this is an
| interesting problem (and such a challenging tokenizer/parser) so I'll
| look at it more.
My thoughts were to change the lexer/parser to do the following
if parsing a function file (not a script) and we are looking at
the second "function" keyword in the file then:
if we are not expecting an "end" token (or, perhaps
equivalently, we are not currently parsing a function) then we
are looking at a subfunction.
Otherwise, we are looking at a nested function (which Octave
doesn't currently handle, but without some changes like this,
we won't be able to, so I think this change is needed anyway).
jwe
More information about the Bug-octave
mailing list