Dan Doel wrote:
On Thu, Oct 31, 2013 at 11:53 AM, Charles Campbell
<charles.e.campb...@nasa.gov> wrote:
MMAMBMB
# a b b
# b b
MMMMM

At the time the syntax hilighter sees the "#" in "# b b", note that
'#\=\s*\zsb' DOES NOT MATCH.
However, the "M" syntax DOES MATCH, and so its highlighted as MyComment.

Syntax highlighting is tricky.
This does not explain why the bs in the second line are still not
matched even when the comment rule is removed.

Is it that the entire nextgroup is thrown away, because the # is not
officially part of the B match, so it is counted as not matching?

I note that removing the '#\=\s*\zs' portion from the B match:

syn clear
syntax match MyComment '#.*$' contains=A
syntax match A 'a' nextgroup=B skipwhite skipnl
syntax match B 'b' contained nextgroup=B skipwhite skipnl
highlight default link A Type
highlight default link B Error
highlight default link MyComment Comment

and using it on

# a b b b
b b

also shows the "b"s on the second line without highlighting. What I think is happening is that MyComment matches to only one line which may contain A; once a newline is encountered, the MyComment match terminates, taking the A and B matches with it. I tried using the extend keyword, but that didn't affect the resulting highlighting.

Regards,
C Campbell

--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui