[changeset] parsing nested functions
David Grundberg
individ at acc.umu.se
Wed Jul 29 14:31:46 CDT 2009
Hi all,
I've modified the parser to be able to properly parse nested functions.
So now a function body can contain nested functions anywhere, and not
just in the beginning. The nested function still work like subfunctions
to the primary function though, regardless where they are declared (or
in which depth). This changeset adds a warning message if any nested
function has been declared. Since they work as subfunctions, I thought
it reasonable.
An error is raised if the functionends are incorrectly balanced. If one
function is explicitly ended, so must all the others.
One mayor syntax change is that eval_string will require all function to
be explicitly ended. I removed the condition in the action of
function_end that allowed implicit ends (at END_OF_INPUT). Since Matlab
do not allow function declarations in eval strings, I think Octave could
be stricter.
The parser now have a special way of parsing function files, and
statements are not allowed outside first-level functions.
As I worked on this, I removed some intelligence from the lexer and
moved them into the parser. I also removed the parent_scope property
from the symbol table, since I couldn't find it used anywhere else than
in the parser.
Best regards,
David
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nested.changeset
Url: https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20090729/74357f64/attachment-0001.ksh
More information about the Octave-maintainers
mailing list