Closed Ganimed closed 6 years ago
Sounds like an okay solution to me. Make a pull request, so I can review the code. A pull request will also run the current test suite.
I have some difficulties with making a pull request. I.e. I made my changes locally in an own local branch called "remove_comment_header". But how can I make a pull request with this local branch?
I'm not an git expert :). What I normally do (like 2-3 times) is to fork the project to my own github account, and push the changes to this fork. From there it is easy to make a pull request.
Thank's for the hint, I'm also not a git-expert. ;)
Fixed in 4abc42e3210758028709819aad7fccc885deb677
This is a fork from issue #57 to split up two different problems.
As I have mentioned in the previous discussion, I was testing what will happen when a simple comment is set on the top of the file (before function or defclass). The result was that the parser does not ignore the comment and causes that matlabdomain will crash with following unhandled exception:
This will happen when
.. autoclass::
or.. autofunction::
will be called with the corresponding class or function name.Here is the corresponding log:
So I have studied your code in mat_types.py and found a simple solution for this error that would kill 2 birds with one stone. I added in MatObject a simple function that removes any comment line or empty line above a class or function. This will be done after the file was read and before the code string will be parsed. This leads to, that no exception will be raised and at the same time it allows to write some comments or a long comment header outside of a class or function that should be ignored by the matlabdomain.
Currently, I have not tested this with a script file. But for class-files and function-files works this solution well.
But the decision is up to you if want or like this kind of solution.