Hi all, I’m creating a custom syntax file for a programming language that is not defined to Sublime Text.
One of the rules of this language is, like YAML itself, that if a double tick mark (or a “double single quote,” if you will, like this: ''
) appears within a single quoted string, it should be escaped and shown as a literal single quote mark.
For example: 'My name is ''David'''
appears as My name is 'David'
.
How do I define this in the YAML specification? This is what I’m trying:
strings:
- match: '"'
scope: punctuation.definition.string.double.lang
push: inside_string
- match: ''''
scope: punctuation.definition.string.single.lang
push: inside_string
inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.lang
- match: '"'
scope: punctuation.definition.string.double.lang
pop: true
# Escaped double tick mark should show as an escaped quote within
# a single quoted string
- match: ''''''
scope: constant.character.escape.lang
pop: false
- match: ''''
scope: punctuation.definition.string.single.lang
pop: true
But I think my problem is that when defining constant.character.escape.lang
, it thinks that ''
is supposed to be the “escape character” (meaning it should be followed by something else) and not just escape the single quote itself.
I’m not familiar with YAML, so how can this be defined in the syntax definition?