-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
source.clean.js
144 lines (142 loc) · 4.07 KB
/
source.clean.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.icl', '.dcl'],
names: ['clean'],
patterns: [
{include: '#marks'},
{include: '#comments'},
{include: '#keywords'},
{include: '#literals'},
{include: '#operators'},
{include: '#delimiters'}
],
repository: {
commentBlock: {
begin: '/\\*',
beginCaptures: {0: {name: 'punctuation.definition.comment.begin.clean'}},
end: '\\*/',
endCaptures: {0: {name: 'punctuation.definition.comment.end.clean'}},
name: 'comment.block.clean',
patterns: [{include: '#comment'}]
},
commentDoc: {
begin: '/\\*\\*',
beginCaptures: {
0: {name: 'punctuation.definition.comment.documentation.begin.clean'}
},
end: '\\*/',
endCaptures: {
0: {name: 'punctuation.definition.comment.documentation.begin.clean'}
},
name: 'comment.block.documentation',
patterns: [{include: 'source.gfm'}]
},
commentLine: {
begin: '//',
beginCaptures: {0: {name: 'punctuation.definition.comment.clean'}},
end: '$',
name: 'comment.line.double-slash.clean'
},
comments: {
patterns: [
{include: '#commentDoc'},
{include: '#commentBlock'},
{include: '#commentLine'}
]
},
delimiters: {match: '[,;(){}]', name: 'punctuation.separator'},
keywordGeneral: {
match: '\\b(if|let|in|with|where|case|of|class|instance)\\b',
name: 'keyword.control.clean'
},
keywordImport: {
match:
'\\b(implementation|definition|system|module|from|import|qualified|as)\\b',
name: 'keyword.control.import.clean'
},
keywordReserved: {
match:
'\\b(special|code|inline|foreign|export|ccall|stdcall|generic|derive|infix(l|r)?|otherwise|dynamic)\\b',
name: 'keyword.reserved.clean'
},
keywords: {
patterns: [
{include: '#keywordGeneral'},
{include: '#keywordImport'},
{include: '#keywordReserved'}
]
},
literalBool: {
match: '\\b(True|False)\\b',
name: 'constant.language.boolean.clean'
},
literalChar: {
match: "'([^'\\\\]|\\\\(x[0-9a-fA-F]+|\\d+|.))'",
name: 'constant.character.clean'
},
literalHex: {
match: '\\b[+~-]?0x[0-9A-Fa-f]+\\b',
name: 'constant.numeric.integer.hexadecimal.clean'
},
literalInt: {
match: '\\b[+~-]?[0-9]+\\b',
name: 'constant.numeric.integer.decimal.clean'
},
literalOct: {
match: '\\b[+~-]?0[0-7]+\\b',
name: 'constant.numeric.integer.octal.clean'
},
literalReal: {
match: '\\b[+~-]?[0-9]+\\.[0-9]+(E[+-]?[0-9]+)?\\b',
name: 'constant.numeric.float.clean'
},
literalString: {
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.clean'}},
end: '"',
endCaptures: {0: {name: 'punctuation.definition.string.end.clean'}},
name: 'string.quoted.double.clean',
patterns: [{include: '#escaped_character'}]
},
literals: {
patterns: [
{include: '#literalChar'},
{include: '#literalInt'},
{include: '#literalOct'},
{include: '#literalHex'},
{include: '#literalReal'},
{include: '#literalBool'},
{include: '#literalString'}
]
},
mark: {
begin: '/// #+ ',
beginCaptures: {0: {name: 'punctuation.definition.comment.clean'}},
end: '$',
name: 'markup.heading.clean'
},
marks: {patterns: [{include: '#mark'}]},
operatorComposition: {
match: '\\s+o\\s+',
name: 'keyword.operator.composition.clean'
},
operatorGeneral: {
match: '[-~@#$%^?!+*<>\\\\/|&=:.]+',
name: 'keyword.operator.clean'
},
operators: {
patterns: [
{include: '#operatorGeneral'},
{include: '#operatorComposition'}
]
}
},
scopeName: 'source.clean'
}
export default grammar