-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.ron.js
122 lines (120 loc) · 3.65 KB
/
source.ron.js
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/a5huynh/vscode-ron>
// and licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.ron'],
names: ['ron'],
patterns: [{include: '#expression'}],
repository: {
array: {
begin: '\\[',
beginCaptures: {0: {name: 'punctuation.section.array.begin.ron'}},
end: '\\]',
endCaptures: {0: {name: 'punctuation.section.array.end.ron'}},
patterns: [{include: '#value'}, {include: '#object-name'}]
},
block_comment: {begin: '/\\*', end: '\\*/', name: 'comment.block.ron'},
character: {
begin: "'",
contentName: 'constant.character.ron',
end: "'",
name: 'string.quoted.single'
},
constant: {match: '\\b(true|false)\\b', name: 'constant.language.ron'},
dictionary: {
begin: '\\{',
beginCaptures: {0: {name: 'punctuation.section.dictionary.begin.ron'}},
end: '\\}',
endCaptures: {0: {name: 'punctuation.section.dictionary.end.ron'}},
patterns: [
{include: '#value'},
{include: '#object-name'},
{include: '#object'},
{include: '#tag-name'},
{match: ',', name: 'punctuation.separator.dictionary.ron'},
{match: ':', name: 'punctuation.separator.dictionary.key-value.ron'}
]
},
escapes: {
captures: {
1: {name: 'constant.character.escape.backslash.ron'},
2: {name: 'constant.character.escape.bit.ron'},
3: {name: 'constant.character.escape.unicode.ron'},
4: {name: 'constant.character.escape.unicode.punctuation.ron'},
5: {name: 'constant.character.escape.unicode.punctuation.ron'}
},
match:
'(\\\\)(?:(?:(x[0-7][0-7a-fA-F])|(u(\\{)[\\da-fA-F]{4,6}(\\}))|.))',
name: 'constant.character.escape.ron'
},
expression: {
patterns: [
{include: '#array'},
{include: '#block_comment'},
{include: '#constant'},
{include: '#dictionary'},
{include: '#line_comment'},
{include: '#number'},
{include: '#object-name'},
{include: '#object'},
{include: '#string'},
{include: '#character'},
{include: '#tag-name'}
]
},
line_comment: {
begin: '//',
end: '$',
name: 'comment.line.double-slash.ron'
},
number: {
match: '(?x:-?(?:0|[1-9]\\d*)(?:(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)?)',
name: 'constant.numeric.ron'
},
object: {
begin: '\\(',
beginCaptures: {0: {name: 'punctuation.section.dictionary.begin.ron'}},
end: '\\)',
endCaptures: {0: {name: 'punctuation.section.dictionary.end.ron'}},
patterns: [
{include: '#value'},
{include: '#dictionary'},
{include: '#tag-name'},
{include: '#object-name'},
{include: '#object'}
]
},
'object-name': {
match: '[A-Za-z_][A-Za-z_0-9]*',
name: 'entity.name.class.ron'
},
string: {
begin: '(b?)(")',
end: '"',
name: 'string.quoted.double',
patterns: [{include: '#escapes'}]
},
'tag-name': {match: '[a-z_][A-Za-z_0-9]*', name: 'entity.name.tag.ron'},
value: {
patterns: [
{include: '#array'},
{include: '#block_comment'},
{include: '#constant'},
{include: '#dictionary'},
{include: '#line_comment'},
{include: '#number'},
{include: '#object'},
{include: '#string'},
{include: '#character'}
]
}
},
scopeName: 'source.ron'
}
export default grammar