In the post below, by line(".") I do _not_ mean the line where
the cursor currently is; but I mean "the line the syntax engine
is currently dealing with".
-----Original Message-----
Bram Moolenaar wrote:
>
> Suresh Govindachar wrote:
>
>> Please consider supporting expressions for syntax matching.
>> An example of usage is indicated below:
>
> I don't quite get it. ":syn match" commands use a pattern. You
> can use ":exec" to get the pattern from an expression.
Good, but how does one use :exec to get the pattern from an
expression?
As an example expression, the following expression returns 0 or 1
for line("."):
(
\ ( foldlevel(line(".")) != foldlevel(line(".")-1) ) &&
\ ( foldlevel(line(".")) != foldlevel(line(".")+1) ) &&
\ ( 4 == foldlevel(line('.'))/2 )
\ )
\ ? 1
\ : 0
How would I use exec to get a pattern?
syn match level4 /exec(above expression)/ contains=todoo
> I don't see what else could be done.
>
> If you perhaps think of using an expression instead of a
> pattern: That is impossible, the syntax HL code requires a
> pattern.
>