I am trying to write a sublime-syntax to highlight a language that looks roughly like:
{
<embedded Go syntax>
}
Something <- More Somethings {
<embedded Go Syntax
}
Essentially almost anything between outer {}
should be treated as Go syntax (except for brackets within string literals and the like which I can already handle). The problem I seem to be running into is that the Go language will already use the }
character in many places. I was trying to use the embed
item in the match on the open bracket with an escape of the closing bracket like so:
contexts:
main:
- match: "{"
embed: scope:source.go
escape: "}"
However this stops syntax highlighting after the first }
seen within the block of Go code which is almost always the wrong thing to do. I saw the bracket matching example in the docs but I am not sure how to use that while embedding a syntax.
Essentially I need to stop treating source as Go code when I see the matching close bracket (not just any closing bracket). Is this possible?
For reference here is an example file I am trying to highlight: https://github.com/mna/pigeon/blob/master/examples/calculator/calculator.peg