Tuesday, April 7, 2015

Syntax highlight problems

Hi everyone.

I think I'm a little bit rusty using regular expressions in syntax highlight.
I was trying to add a custom highlight to a Doxygen comment body and, for some
reason, it is leaking to outside the comment limits.

In the file 'after/syntax/doxygen.vim' I did the following:

syn match doxygenCustomUnderline contained /[^}]*/
    \ containedin=doxygenUnderlineMatch
syn region doxygenUnderlineMatch transparent contained
    \ start=/\%(\%(\\\|@\)uf\){/ms=s+4 end=/}/ keepend
    \ contains=doxygenCustomUnderline containedin=doxygenBody,doxygenBrief

hi def link doxygenCustomUnderline Underlined

NOTE: In the original file there are no continuation lines. Each group is
wrote in a single line. I use continuation line here to ease reading.

The I made the test in a 'syntest.cpp' file:

/**
 * Brief description \uf{underlined}.
 * With body @uf{underlined too}.
 */
int main(int argc, char** argv) { }
        --------------------------

Surprisingly the underlined text is marked with '--' in addition to both
regions in the doxygen comment. What could cause this kind of leak? I can't
understand since the group 'doxygenCustomUnderline' is specifically set as
contained in the group 'doxygenUnderlineMatch'.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment