Thank you again for helping me.
I know this example works, but if the file is a bit more complex, it doesn’t work (and I don’t know why).
Example:
try.txt
country = {
tag = FRA
country_rank = {
tier = { kingdom duchy }
rank = 1
}
effect = {
prestige = 200
}
}
country = {
tag = RUS
country_rank =
{
tier = { kingdom duchy }
rank = 2
}
effect =
{
prestige = 400
}
}
carpenter.sublime-syntax
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: carpenter
file_extensions:
- txt
scope: source.txt
contexts:
main:
- include: CONTEXT_META_country_1a
- include: CONTEXT_META_country_1b
CONTEXT_META_country_1a:
- match: '^(country)\b(\s*=\s*\{)'
captures:
1: entity.name.tag
push:
- meta_content_scope: meta_scope_country
- include: CONTEXT_META_country_2
CONTEXT_META_country_1b:
- match: '^(country)\b(\s*=\s*$)'
captures:
1: entity.name.tag
- match: '\{'
push:
- meta_content_scope: meta_scope_country
- include: CONTEXT_META_country_2
CONTEXT_META_country_2:
- match: '\}'
pop: true
- match: '\b(tag)\b'
scope: entity.name.tag
- include: CONTEXT_META_country_rank_1a
- include: CONTEXT_META_country_rank_1b
- include: CONTEXT_META_effect_1a
- include: CONTEXT_META_effect_1b
- match: '\{'
push: CONTEXT_META_country_2
CONTEXT_META_country_rank_1a:
- match: '^\s+(country_rank)\b(\s*=\s*\{)'
captures:
1: entity.name.tag
push:
- meta_content_scope: meta_scope_country_rank
- include: CONTEXT_META_country_rank_2
CONTEXT_META_country_rank_1b:
- match: '^\s+(country_rank)\b(\s*=\s*$)'
captures:
1: entity.name.tag
- match: '\{'
push:
- meta_content_scope: meta_scope_country_rank
- include: CONTEXT_META_country_rank_2
CONTEXT_META_country_rank_2:
- match: '\}'
pop: true
- match: '\b(tier|rank)\b'
scope: support.constant
- match: '\{'
push: CONTEXT_META_country_rank_2
CONTEXT_META_effect_1a:
- match: '^\s+(effect)\b(\s*=\s*\{)'
captures:
1: entity.name.tag
push:
- meta_content_scope: meta_scope_effect
- include: CONTEXT_META_effect_2
CONTEXT_META_effect_1b:
- match: '^\s+(effect)\b(\s*=\s*$)'
captures:
1: entity.name.tag
- match: '\{'
push:
- meta_content_scope: meta_scope_effect
- include: CONTEXT_META_effect_2
CONTEXT_META_effect_2:
- match: '\}'
pop: true
- match: '\b(prestige)\b'
scope: support.constant
# - include:
- match: '\{'
push: CONTEXT_META_effect_2
“prestige” is not highlighted. Why ?