Brett Stahlman wrote:

> Consider the following sample text, to be highlighted with 3 different 
> syntaxes, shown below...
> 
> a --- A
> b --- B
> a --- Ab --- B
> 
> *** CASE 1 ***
> syn region a start=/a/ end=/A/ nextgroup=after_a skipnl
> syn region after_a start=/\%(A\n\?\)\@<=/ end=/B/ contained
> hi link a Comment
> hi link after_a Error
> 
> Note: This one works as expected. Both occurrences of region a are 
> highlighted as Comment. Both occurrences of region after_a are 
> highlighted as Error.
> 
> *** CASE 2 ***
> syn region a start=/a\@<=/ end=/A/ nextgroup=after_a skipnl
> hi link a Comment
> syn region after_a start=/\%(A\n\?\)\@<=/ end=/B/ contained
> hi link after_a Error
> 
> Note: This one doesn't work at all. The only difference between this 
> case and case 1 is that the `start=' for this one uses a positive 
> look-behind assertion to match the a.
> 
> *** CASE 3 ***
> syn region a start=/a\@<=/ end=/A/
> hi link a Comment
> 
> Note: Region a is highlighted as Comment. This seems odd to me, since 
> the start and end patterns for case 2 and 3 are identical. In fact, the 
> only difference in the region a definitions is that case 2 contains a 
> nextgroup and skipnl. Although these attributes are supposed to 
> determine only what happens after a region ends, they appear to be 
> preventing the region a start pattern from matching in case 2. Is this a 
> bug or is there a subtlety regarding nextgroup and look-behind 
> assertions that I'm missing?

You try to use a start pattern that is zero width.  This confuses the
logic.  Try putting a dot in the pattern, e.g.:

syn region a start=/a\@<=./ end=/A/ nextgroup=after_a skipnl

I'm not sure if what you see in case 2 is a bug or undefined behavior.

-- 
Witches prefer brooms: vacuum-cleaners need extension cords!

 /// 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    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to