I have a textmate grammar with just strings and colons. Is it possible to have a pattern that matches the strings that are followed by a colon with a different name than the strings that are not followed by a colon?
example:
"a""b""this one should be different": "c""d"
my current source:
{
"name": "mylang",
"scopeName": "source.mylang",
"patterns": [
{
"match": ":",
"name": "punctuation.definition.colon.mylang"
},
{
"include": "#string"
}
],
"repository": {
"string": {
"begin": "\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.string.quote.begin.mylang"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.string.quote.end.mylang"
}
},
"name": "string.quoted.double.mylang",
"patterns": [
{
"include": "#stringcontent"
}
]
},
"stringcontent": {
"patterns": [
{
"match": "(?x) # turn on extended mode\n \\\\ # a literal backslash\n (?: # ...followed by...\n [\"\\\\/bfnrt] # one of these characters\n | # ...or...\n u # a u\n [0-9a-fA-F]{4}) # and four hex digits",
"name": "constant.character.escape.mylang"
},
{
"match": "\\\\.",
"name": "invalid.illegal.unrecognized-string-escape.mylang"
}
]
}
}
}