Ilya Bobir wrote: > I've already posted about this bug in syntax matching code. But now I > have a fix. > > Test case > ========= > Having following syntax rules > > :syn cluster Top contains=Block,String,Identifier > :syn region Block start=+{+ end=+}+ keepend extend [EMAIL PROTECTED] > :syn region String start=+"+ end=+"+ contains=Identifier > :syn region Identifier start=+\${+ end=+}+ extend > > and the following buffer is matched incorrectly > > { "string ${var} string" } > > on current vim version (7.0.109) I'm getting following syntax groups: > > { "string ${var} string" } > BBBBBBBBBBBBBBBBBBBBBBBBBB > SSSSSSSSSSSSSS SS > IIIIII > > Where B means Block region, S - String region and I - Identifier region. > > While I'm expecting to see the following picture: > > { "string ${var} string" } > BBBBBBBBBBBBBBBBBBBBBBBBBB > SSSSSSSSSSSSSSSSSSSSSS > IIIIII > > Bug description > =============== > Bug appears, when one have an extend region inside a normal region > inside a keepend region. Currently, when any extend region ends vim > checks all the outer keepend regions to see, if theirs ends should be > "extended", but it does not checks intermediate normal (non keepend) > regions and theirs ends should also be checked otherwise one could end > up with a normal region been forcefully ended by enclosing keepend > region and this keepend region later be extended by a containing extend > region. > > Just as it is seen in the first picture in the test case. Block region > ends String region on a first '}'. But later when Identifier region > consumes that first '}' Block region is extended, while String region is > not. > > Solution > ======== > Test intermediate normal region ends along with keepend region ends when > an extend region ends. > > Here is a patch for syntax.c that does this check. I'm getting correct > behavior with this patch for my test case.
Complicated stuff. I'm glad you managed to find a solution. But we need to check for side effects. I'll include it and try it out for a while before sending out an official patch. -- SOLDIER: What? Ridden on a horse? ARTHUR: Yes! SOLDIER: You're using coconuts! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///