I am trying to create a custom syntax that has a structure similar to the following
Title String:
{
...,
...,
...
}
Title String2:
{
...,
{
...,
...,
...
}
...,
...,
...
}
I have been able to write syn match
and syn region
statements that detect everything within the { ... }
regions, however I have not been able to come up with one that will match the Title Strings.
Here is my region statement:
syn region dbgMessage start="{" end="}" contains=ALLBUT,dbgMessageHeader
I attempted to add something like this to detect the Title Strings, which I want to be everything/anything up to but not including the opening bracket.
syn match dbgMessageHeader "\v.\{-}\ze(\{)"
My reasoning:
.\{-}
should consume every character and be non greedy\ze(\{)
should look ahead for an opening bracket and stop when it finds one
A bonus challenge is that it would be great if this syntax could correctly detect everything if I get the code in a flattened state, ex:
Title String: { ..., ..., ... }
Title String2: { ..., { ..., ..., ... } ..., ..., ... }
Again, my current implementation can correctly match everything inside the brackets in both flat and formatted states, so it would be great if I could figure something out that would also match the title strings in both cases.
See something that I'm missing?