I am trying to write custom syntax highlighting for a domain specific markup language for a simulator I am working on. I can get everything but one part working. A simple example would look something like this:
(ObjectType
stringAttribute: "String value"
numberAttribute: 42
listAttribute: {
one: 1
two: "two"
}
objectAttribute:
(AnotherObjectType
//More attributes here
)
)
where the ObjectType tells the simulation what class to load, and the attributes are set as properties of that object. The files can have deeply nested objects and lists, so I have them set up as fold regions as follows:
syn region object start="(" end=")" fold transparent
syn region arglist start="{" end="}" fold transparent
However, I would like to highlight the object types, but haven't found a way to do so. I have gotten it to work in the with
syn match objectType display "(\s*\zs[A-Za-z0-9~!@#$%^&*\-_+<>?/]\+" contained
and adding contains=objectType
to the end of the object
rule. However, this breaks my other highlighting on things nested further down (e.g. strings, numbers, etc.). How would I get both the object type to be highlighted without messing everything else up?