I was looking for some sublime-syntax help. I have the following code:
field:
- match: "[a-zA-Z_]+\\d_]*\\s*:"
push:
- meta_scope: meta.message.field
- include: string
- include: constant
constant:
- match: \b(?:true|false|null)\b
scope: constant.language
pop: true # Pops meta.message.field
string:
- match: '"'
captures:
0: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: '"'
captures:
0: punctuation.definition.string.end
pop: true # I want to pop string.quoted.double and meta.message.field
- match: '[a-zA-Z_]\w*'
scope: string.unquoted
pop: true # Pops meta.message.field
It matches
foo: bar
foo: true
foo: "bar"
The problem is that the double quote leaves the meta.message.field scope on the stack. Is there a way to have the closing double quote pop twice so meta.message.field gets popped off the stack as well?