-
Notifications
You must be signed in to change notification settings - Fork 2
/
keyvalues.yaml-tmLanguage
82 lines (72 loc) · 1.97 KB
/
keyvalues.yaml-tmLanguage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: KeyValues
scopeName: source.keyvalues
fileTypes:
- gameinfo.txt
patterns:
- include: '#main'
repository:
main:
patterns:
- include: '#block'
- include: '#comment'
- include: '#string'
- include: '#number'
# Blocks
block:
name: meta.structure.block.keyvalues
begin: '{'
beginCaptures:
'0': { name: punctuation.definition.block.begin.keyvalues }
end: '}'
endCaptures:
'0': { name: punctuation.definition.block.end.keyvalues }
patterns:
- include: '#main'
# Comments
comment:
name: comment.line.slash.keyvalues
begin: '/'
end: '$'
beginCaptures:
'0': { name: punctuation.definition.comment.keyvalues }
# String variables
string_parts:
patterns:
# Includes
- name: entity.name.tag.include.keyvalues
match: '(?<!\w)(#)\w+'
captures:
'1': { name: punctuation.definition.include.keyvalues }
# Directory variables
- name: string.unquoted.file-path.keyvalues
match: '(\|)(\S+)(\|)'
captures:
'0': { name: constant.language.directory.keyvalues }
'1': { name: punctuation.definition.directory.begin.keyvalues }
'3': { name: punctuation.definition.directory.end.keyvalues }
# Escape sequences
- name: constant.character.escape.keyvalues
match: '\\[\\nt"]'
# Strings
string:
patterns:
- include: '#string_parts'
# Quoted
- name: string.quoted.double.keyvalues
begin: '"'
beginCaptures:
'0': { name: punctuation.definition.string.begin.keyvalues }
end: '"'
endCaptures:
'0': { name: punctuation.definition.string.end.keyvalues }
patterns:
- include: '#string_parts'
# Unquoted
- name: string.unquoted.keyvalues
match: '[^\s{}]+'
patterns:
- include: '#string_parts'
# Numbers
number:
name: constant.numeric.integer.keyvalues
match: '\b\d+\b$'