-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjson.yaml-tmLanguage
106 lines (95 loc) · 2.7 KB
/
json.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: JSON
scopeName: source.json
fileTypes:
- '.json'
patterns:
- include: '#main'
repository:
main:
patterns:
- include: '#object'
- include: '#key'
- include: '#array'
- include: '#string'
- include: '#number'
- include: '#boolean'
- include: '#null'
- include: '#delimiters'
- include: '#invalid'
# Objects
object:
name: meta.block.object.json
begin: '{'
end: '}'
beginCaptures:
'0': { name: punctuation.definition.block.object.begin.json }
endCaptures:
'0': { name: punctuation.definition.block.object.end.json }
patterns:
- include: '#main'
# Array
array:
name: meta.block.array.json
begin: '\['
end: '\]'
beginCaptures:
'0': { name: punctuation.definition.block.array.begin.json }
endCaptures:
'0': { name: punctuation.definition.block.array.end.json }
patterns:
- include: '#main'
# Escape sequences
escapes:
patterns:
- name: constant.character.escape.json
match: '(\\)["\\/bfnrt]'
captures:
'1': { name: punctuation.definition.escape.backslash.json }
- name: constant.character.escape.unicode.json
match: '(\\)u[0-9A-Fa-f]{4}'
captures:
'1': { name: punctuation.definition.escape.backslash.json }
- name: invalid.illegal.unrecognised-escape.json
match: '\\.'
# Key:value pairs
key:
name: entity.name.tag.key.json
match: '(")((?:[^\\"]|\\.)*+)(")(?=\s*:)'
captures:
'1': { name: punctuation.definition.key.start.json }
'2': { patterns: [ include: '#escapes' ] }
'3': { name: punctuation.definition.key.end.json }
# String
string:
name: string.quoted.double.json
match: '(")((?:[^\\"]|\\.)*+)(")(?!\s*:)'
captures:
'1': { name: punctuation.definition.string.begin.json }
'2': { patterns: [ include: '#escapes' ] }
'3': { name: punctuation.definition.string.end.json }
# Numbers
number:
patterns:
- name: invalid.illegal.leading-zero.json
match: '-?0\d+(?:\.\d+)?(?:[eE][-+]?[0-9]+)?'
- name: constant.numeric.json
match: '-?\d+(?:\.\d+)?(?:[eE][-+]?[0-9]+)?'
# Boolean
boolean:
name: constant.language.boolean.$1.json
match: '(?<=^|[,:\s\[])(true|false)(?=$|[,\s}\]])'
# Null
'null':
name: constant.language.null.json
match: '(?<=^|[,:\s\[])null(?=$|[,\s}\]])'
# Delimiter
delimiters:
patterns:
- name: punctuation.separator.key-value.colon.json
match: '(?<=")\s*:'
- name: punctuation.separator.comma.json
match: ',(?!\s*[}\]])'
# Other/invalid
invalid:
name: 'invalid.illegal.unexpected-character.json'
match: '\S[^}\]]*'