Monday, December 2, 2019

Re: hightlight syntax problem

On Mo, 02 Dez 2019, Ni Va wrote:

> Hi all,
>
> Considering this kind of line:
>
>       SPB   ERR2; 
>
>
>
> With in my syntax file these syntax pattern recognition:
>
> syn match s7JumpsOperand    /^\s\+\zs\(SPA\|SPL\|SPBNB\|SPBN\|SPBB\|SPB\|SPBI\|
> SPBIN\|SLW\|SPO\|SPS\|SPZ\|SPN\|SPP\|SPM\|SPPZ\|SPMZ\|SPU\|LOOP\)\ze/
> syn match s7JumpsLabel         /^\(\s\+SPB\s\+\)\zs\([^;]\+\)\ze;/
>
> HiLink s7JumpsOperand        JumpsColorDarkRed
> HiLink s7JumpsLabel             JumpsColorDarkRed
>
>
>
> Why it highlights only first SPB Operand and no ERR2 like that ?
>
>       SPB   ERR2; 

They both try to match at the same location, because you implicitly
anchored your match. For that kind of thing you can use nextgroup e.g.

:syn match s7JumpsOperand /SPB\ze\s\+/ nextgroup=s7JumpLabel
:syn match s7JumpLabel /ERR2\ze;$/


Best,
Christian
--
So verblaßt das Abwesende, und eine neue Liebe tritt ein.
-- Ovid (Liebeskunst)

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20191202144822.GB28132%40256bit.org.

No comments: