Hi all!
I've been using doxygen to write documentation for a wavelet image compression codec of mine, which is written in C. There I noticed two things on folding, which are the following:
/** This is the basic "pixel" type. * \Warning This should not be less than 15 bits + sign! **/ typedef short int wv_pel;
Here, the end-comment marker has to have two *s, it doesn't fold with one, but if I add a third * to the open comment bit, then it still works?
Another thing which I couldn't figure out is the following:
if (foo > (bar >> 3)) { /* this does something nice */ foo++; } else { /* not nice */ bar++; }
Here, the folding does not activate with the comment on the same line, which I actually use quite often.
I am really bad with regular expressions, so I couldn't figure out what they're trying to (referring to the folding patterns). I am aware though, that I can change them myself if I were so inclined, but I just wanted to ask whether TM expects me to do the above things in different way which may be equally nice.
Oh, and Allan, nice website overhaul. :)
Thanks, Daniel.
On 5/1/2006, at 9:53, Daniel Vollmer wrote:
[...] Here, the end-comment marker has to have two *s, it doesn't fold with one, but if I add a third * to the open comment bit, then it still works?
The folding patterns just need to match a subset of the line. You could e.g. add (?!*) after the two asterisks to ensure that a third doesn't follow (if this is desired).
I am really bad with regular expressions, so I couldn't figure out what they're trying to (referring to the folding patterns). I am aware though, that I can change them myself if I were so inclined, but I just wanted to ask whether TM expects me to do the above things in different way which may be equally nice.
The simple case should be straight forward, as in something like: “\ {\s*($|/*|//)”. This matches { which are last on the line, or which are followed by a block or single line comment. But then, one may ensure that the block comment either do not end at this line, or that only \s*$ follows the */ part…
I'm told that if you can write a wavelet codec, you should be able to learn this stuff :)
Though I now made them:
foldingStartMarker = '/**(?!*)|{\s*($|//|/*(?!.*?*/.*\S))|^@ (interface|protocol|implementation)\b'; foldingStopMarker = '(?<!*)**/|^\s*}|^@end\b';
The C pattern btw already seemed to handle the comments after { (I think Kevin added this some weeks ago), but maybe you were actually using C++ (which didn't have it).