Currently, LexMatlab.cpp has no support for MATLAB/Octave style block comments:
%{ comment for MATLAB and Octave %}
#{ Octave only #}
Attached is a patch to fix the latest version from the repository, but not exactly as to the specification of MATLAB/Octave (MATLAB and Octave both require the %} be on a new line, with only leading whitespace, while Octave also allows trailing whitespace - as is, the patch treats it like C style comments). I'm not sure if this is the intended method to fix it, but it seems to work fine.
Thanks!
Fix For MATLAB/Octave Block-Style Comments
I won't be looking at this until the new year.
This does not appear to initialise the inBlockComment variable if lexing starts with a line inside the comment.
Is anyone looking at the block comment bug for matlab/octave?
I tried the patch here on the 3.3.0 sources and see the following:
1. It doesnt support nested multiline comments
2. seems to not recognise the commented block lines very well when typing into the editor (mainly due to the inBlockComment variable starting as false, no matter what state it should have been)
There was no reply to my last message so its unlikely that anyone is working on this.
New LexMat.cxx file attached - let me know if you prefer a diff file.
Changes:
- added block comment (and nested block comments) implementation
- added '...' continuation string displayed as a comment
- removed unused IsAWord functions
- added some comments in the code
The comment examples provided above appear to leak onto their following lines. Perhaps I'm not understanding the format here. An example file that includes a variety of constructs may make understanding and testing easier.
The transpose variable is worrying. Generally a variable that lives between loops needs to either be reinitialised at line start or end (a variable with line lifetime) or be initialised from linestate or seek back before the loop starts (a variable with (potentially) multi-line lifetime).
What do you meean by leaking onto following lines? Is there any way I can see this?
I have attached a matlab file I was using to do a quick check that formatting 'looked' ok.
I didnt like the transpose, but left it alone as it was already in the code.
I wasn't understanding that %} can't be at the end of a line that starts with %{ like the second line of the initial report. In this image, I'd expect the contents of the block comment to be in green and the 'if' not be recognised as a keyword. Perhaps the block comments are only supposed to be for commenting out code.
OK about transpose - I saw the new comment and assumed the variable was new too.
Sorry, I was looking at the wrong version.
Committed as [8ae066].
Related
Commit: [8ae066]
No problems :)