Monday, December 2, 2019

Re: hightlight syntax problem

 i tried this 

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/ nextgroup=s7JumpLabel
syn match s7JumpsLabel      /^\s\+\S\+\s\+\zs\([^;]\+\)\ze;/


It does not highlight second group s7JumLabel because of same location ... how to avoid this ?

Le lundi 2 décembre 2019 15:48:28 UTC+1, Christian Brabandt a écrit :

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/00ad9c6d-660f-4783-aff7-3d29922e2eb2%40googlegroups.com.

No comments: